implement_plan_micro

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Formal Specification

正式规范

Multimodal Logic Integration

多模态逻辑集成

Five modal logics via fusion with bridge principles:
  • JL: Justification Logic - evidence-backed claims
  • IEL: Inferential Erotetic Logic - question handling
  • TEL: Temporal Epistemic Logic - phase sequencing
  • SDL: Standard Deontic Logic - obligations/permissions
  • DEL: Dynamic Epistemic Logic - action modalities
通过融合桥接原则实现五种模态逻辑:
  • JL: 辩护逻辑 - 基于证据的主张
  • IEL: 推理疑问逻辑 - 问题处理
  • TEL: 时序认知逻辑 - 阶段排序
  • SDL: 标准道义逻辑 - 义务/权限
  • DEL: 动态认知逻辑 - 行动模态

Justification Logic (JL)

辩护逻辑(JL)

undefined
undefined

Justification terms

辩护术语

[h]:context(task_n) # Handoff h justifies task context [v]:verified(phase_n) # Verification v justifies completion [p]:plan(tasks) # Plan p justifies task list
[h]:context(task_n) # 交接h为任务上下文提供辩护 [v]:verified(phase_n) # 验证v为阶段完成提供辩护 [p]:plan(tasks) # 计划p为任务列表提供辩护

Evidence production

证据生成

[read(f)]exists e. [e]:content(f) [verify(c)]exists v. [v]:pass(c) | [v]:fail(c)
[read(f)]exists e. [e]:content(f) [verify(c)]exists v. [v]:pass(c) | [v]:fail(c)

Handoff chain: evidence propagates

交接链:证据传播

[h_n]:complete(task_n) -> [h_{n+1}]:context(task_{n+1}) proceed(task) <-> exists h. [h]:validated
undefined
[h_n]:complete(task_n) -> [h_{n+1}]:context(task_{n+1}) proceed(task) <-> exists h. [h]:validated
undefined

Inferential Erotetic Logic (IEL)

推理疑问逻辑(IEL)

undefined
undefined

Mode and blocker questions

模式与阻塞问题

?{direct, orchestration} # Mode selection ?{continue, retry, ask_user} # Blocker resolution mismatch(plan, reality) -> ?{how_proceed} no_validation -> ?{run_validation_first}
undefined
?{direct, orchestration} # 模式选择 ?{continue, retry, ask_user} # 阻塞解决 mismatch(plan, reality) -> ?{how_proceed} no_validation -> ?{run_validation_first}
undefined

Temporal Epistemic Logic (TEL)

时序认知逻辑(TEL)

undefined
undefined

File reading constraints

文件读取约束

[](mentioned(f) -> <>read_fully(f)) # Eventually read [](mentioned(f) -> not spawn U read_fully(f)) # No spawn until read [](partial_read(f) -> false) # Partial reads forbidden
[](mentioned(f) -> <>read_fully(f)) # 最终需完整读取 [](mentioned(f) -> not spawn U read_fully(f)) # 读取完成前不启动进程 [](partial_read(f) -> false) # 禁止部分读取

Phase sequencing

阶段排序

[](phase(n) -> P(phase(n-1) & verified(n-1))) # Verified before next [](automated_pass -> <>manual_verify) # Automated gates manual [](manual_pass(n) -> <>phase(n+1)) # Manual gates next phase
[](phase(n) -> P(phase(n-1) & verified(n-1))) # 进入下一阶段前需完成上一阶段验证 [](automated_pass -> <>manual_verify) # 自动化验证通过后触发人工验证 [](manual_pass(n) -> <>phase(n+1)) # 人工验证通过后进入下一阶段

Handoff persistence

交接持久化

[](handoff_created(h) -> []exists_on_disk(h)) # Survives compaction
[](handoff_created(h) -> []exists_on_disk(h)) # 交接记录在压缩后仍保留

Termination

终止条件

<>(all_complete | abandoned)
undefined
<>(all_complete | abandoned)
undefined

Standard Deontic Logic (SDL)

标准道义逻辑(SDL)

undefined
undefined

Reading obligations

读取义务

O(read_fully(plan)) O(read_fully(f)) <- mentioned_in_plan(f) O(check_existing_checkmarks) F(partial_read)
O(read_fully(plan)) O(read_fully(f)) <- mentioned_in_plan(f) O(check_existing_checkmarks) F(partial_read)

Verification obligations

验证义务

O(run_automated) <- impl_complete O(pause_for_manual) <- automated_pass O(present_manual_checklist) F(checkoff_manual) <- not user_confirmed
O(run_automated) <- impl_complete O(pause_for_manual) <- automated_pass O(present_manual_checklist) F(checkoff_manual) <- not user_confirmed

Mode selection

模式选择

O(orchestration) <- tasks >= 4 P(direct) <- tasks <= 3 O(respect_user_preference)
O(orchestration) <- tasks >= 4 P(direct) <- tasks <= 3 O(respect_user_preference)

Orchestration obligations

编排义务

O(read_previous_handoff) <- exists_handoff(task_{n-1}) O(create_handoff) <- agent_completes O(update_ledger) <- task_complete F(batch_tasks) # One agent per task F(proceed_on_mismatch) <- not user_guidance
undefined
O(read_previous_handoff) <- exists_handoff(task_{n-1}) O(create_handoff) <- agent_completes O(update_ledger) <- task_complete F(batch_tasks) # 单个任务对应单个Agent F(proceed_on_mismatch) <- not user_guidance
undefined

Dynamic Epistemic Logic (DEL)

动态认知逻辑(DEL)

undefined
undefined

Implementation actions

实现动作

[read(plan)]K(tasks) & K(phases) & K(criteria) [read(handoff_n)]K(context_{n+1}) [spawn(agent, task)]<>result(agent) [verify(c)](K(pass) | K(fail))
[read(plan)]K(tasks) & K(phases) & K(criteria) [read(handoff_n)]K(context_{n+1}) [spawn(agent, task)]<>result(agent) [verify(c)](K(pass) | K(fail))

Composed workflows

组合工作流

[select_direct][implement ; verify_auto ; present_manual ; wait]* [select_orchestration][prepare ; spawn ; wait ; read_handoff ; update]*
[select_direct][implement ; verify_auto ; present_manual ; wait]* [select_orchestration][prepare ; spawn ; wait ; read_handoff ; update]*

Recovery

恢复流程

[compaction ; read_ledger ; list_handoffs ; read_last]resume
[compaction ; read_ledger ; list_handoffs ; read_last]resume

Mismatch

不匹配处理

[detect_mismatch ; stop ; present ; wait]proceed_or_abort
undefined
[detect_mismatch ; stop ; present ; wait]proceed_or_abort
undefined

Bridge Principles

桥接原则

undefined
undefined

Evidence persistence (JL-TEL)

证据持久化(JL-TEL)

[h]:context(n) -> [][h]:context(n)
[h]:context(n) -> [][h]:context(n)

Evidence obligations (JL-SDL)

证据义务(JL-SDL)

O(exists h. [h]:validated) <- pre_implement O(exists v. [v]:pass(auto)) <- pre_manual
O(exists h. [h]:validated) <- pre_implement O(exists v. [v]:pass(auto)) <- pre_manual

Handoff chain (full integration)

交接链(全集成)

[h_n]:complete(n) -> O([spawn]<>[h_{n+1}]:context(n+1)) compaction -> (forall h. persists(h))
undefined
[h_n]:complete(n) -> O([spawn]<>[h_{n+1}]:context(n+1)) compaction -> (forall h. persists(h))
undefined

State Machine

状态机

INIT --> READ_PLAN --> MODE_SELECT --+--> DIRECT: [IMPL -> AUTO -> MANUAL -> WAIT]*
                                     |
                                     +--> ORCHESTRATION: [PREP -> SPAWN -> WAIT -> HANDOFF]*
                                                                                    |
                                                                                    v
                                                                                COMPLETE
INIT --> READ_PLAN --> MODE_SELECT --+--> DIRECT: [IMPL -> AUTO -> MANUAL -> WAIT]*
                                     |
                                     +--> ORCHESTRATION: [PREP -> SPAWN -> WAIT -> HANDOFF]*
                                                                                    |
                                                                                    v
                                                                                COMPLETE

Output Schema

输出 Schema

yaml
handoff_path: "thoughts/handoffs/<session>/task-[NN]-[desc].md"
schema:
  required: [status, task_desc, files_modified[], verification_results, context_for_next]
  optional: [blocker, decisions[], open_questions[]]
tracking:
  plan: "- [x] Task N: description"
  ledger: "[x] Task N"

yaml
handoff_path: "thoughts/handoffs/<session>/task-[NN]-[desc].md"
schema:
  required: [status, task_desc, files_modified[], verification_results, context_for_next]
  optional: [blocker, decisions[], open_questions[]]
tracking:
  plan: "- [x] Task N: description"
  ledger: "[x] Task N"

Prose (Where Logic Insufficient)

补充说明(逻辑未覆盖场景)

Mode Selection

模式选择

TasksContext CriticalMode
1-3NoDirect
1-3YesOrchestration
4+AnyOrchestration
User preference overrides.
任务数量上下文重要性模式
1-3直接模式
1-3编排模式
4+任意编排模式
用户偏好优先级更高。

Templates

模板

Mismatch:
Issue in Phase [N]:
Expected: [plan says]
Found: [actual]
How should I proceed?
Manual Verification Pause:
Phase [N] Complete - Ready for Manual Verification
Automated passed: [list]
Please verify: [manual items from plan]
Let me know when done.
Agent Spawn:
Task(subagent_type="general-purpose", model="claude-opus-4-5-20251101", prompt="""
[implement_task SKILL.md]
不匹配提示:
第[N]阶段问题:
预期:[计划内容]
实际:[实际情况]
应如何推进?
人工验证暂停提示:
第[N]阶段完成 - 等待人工验证
自动化验证通过项:[列表]
请验证:[计划中的人工验证项]
完成后告知我。
Agent 启动模板:
Task(subagent_type="general-purpose", model="claude-opus-4-5-20251101", prompt="""
[implement_task SKILL.md]

Context

上下文

  • Ledger: [content]
  • Plan: [section]
  • Task: [N]/[Total]: [desc]
  • Previous Handoff: [content or "first task"]
  • Handoff Dir: thoughts/handoffs/<session>/ """)

**Recovery (post-compaction):**
1. Ledger auto-loaded by SessionStart
2. `ls thoughts/handoffs/<session>/`
3. Read last handoff
4. Resume next task

---
  • 任务台账:[内容]
  • 计划:[章节]
  • 任务:[N]/[总任务数]:[描述]
  • 上一次交接:[内容或“首个任务”]
  • 交接目录:thoughts/handoffs/<session>/ """)

**恢复流程(压缩后):**
1. 会话启动时自动加载任务台账
2. 执行`ls thoughts/handoffs/<session>/`
3. 读取最新的交接记录
4. 恢复下一个任务

---

Validity Constraints

有效性约束

forall phase. has_auto_criteria(phase) & has_manual_criteria(phase)
forall task. one_agent_per_task(task)
forall h. on_disk(h) -> recoverable(h)
compaction -> (forall h. persists(h))
forall i < j. completed(task_i) before started(task_j)
forall phase. has_auto_criteria(phase) & has_manual_criteria(phase)
forall task. one_agent_per_task(task)
forall h. on_disk(h) -> recoverable(h)
compaction -> (forall h. persists(h))
forall i < j. completed(task_i) before started(task_j)