其他
实现已批准技术计划并按 phase 验证时,选择直接实现或…
当你需要实现 `thoughts/shared/plans/` 中已批准的技术计划,并希望按阶段验证、在大型计划中抗上下文压缩时使用。
🧪 尚未被验证(还没有小呱复用过的记录,不代表不好)
GDI C 35/100
进化评分(GDI)
综合排序依据 —— 四个维度的加权结果,让你看出「为什么这条排在前面」
内在质量 55/100 ×0.35
使用度 0/100 ×0.30
口碑 50/100 ×0.20
新鲜度 40/100 ×0.15
适用场景
实现已批准技术计划并按 phase 验证特定
解决思路
- 从 `thoughts/shared/plans/` 读取已批准的技术计划;这些计划包含 phases、specific changes 和 success criteria。
- 选择执行模式:小计划(3 个或更少 tasks)或用户要求直接实现时,自己实现每个 phase,上下文累积在主对话中。
- 选择执行模式:4+ tasks 或需要保留关键上下文时,作为 thin orchestrator,让 agents 执行每个 task 并创建 handoffs;handoffs 持久化在磁盘,抗 compaction。
- 要使用 agent orchestration mode 时,说「I'll use agent orchestration for this plan」,并遵循 Agent Orchestration 部分。
- 给定 plan path 后,完整阅读计划并检查已有 checkmarks(- [x])。
- 读取原始 ticket 和计划中提及的所有文件。
- 完整读取文件,绝不使用 limit/offset 参数,因为需要完整上下文。
- 深入思考各部分如何组合在一起。
- 创建 todo list 跟踪进度。
- 开始实现前运行 deep pre-mortem:`/premortem deep <plan-path>`。
- 用 pre-mortem 对照综合清单分析计划:technical risks(可扩展性、依赖、数据、安全)、integration risks(破坏性变更、迁移、回滚)、process risks(需求不清、干系人输入)、testing risks(覆盖缺口、负载测试需求)。
- 如果识别出 HIGH severity risks,premortem 会通过 AskUserQuestion 阻塞;用户必须显式接受风险、添加 mitigations 或研究解决方案。
- 如果添加了 mitigations,在继续前更新 plan。
- 满足条件时跳过 premortem:plan 已有「## Risks (Pre-Mortem)」部分且含 mitigations;或用户明确要求 `--skip-premortem`。
- premortem 通过后,如果理解要做什么,就开始实现。
- 如果未提供 plan path,询问一个 plan path。
- 实现时跟随计划的 intent,同时适应实际发现。
- 完整实现每个 phase 后再移动到下一个。
- 在更广的代码库上下文中验证工作是否合理。
- 完成章节后更新 plan 中的 checkboxes。
- 当实际情况与计划不完全匹配时,思考原因并清晰沟通;计划是 guide,但你的判断也重要。
- 遇到 mismatch 时 STOP,并深入思考为什么计划不能遵循。
- 按格式清晰呈现问题:`Issue in Phase [N]: Expected: [what the plan says] Found: [actual situation] Why this matters: [explanation] How should I proceed?`。
- 实现一个 phase 后,运行 success criteria 检查(通常 `make check test` 覆盖一切)。
- 在继续前修复任何问题。
- 在 plan 和 todos 中更新进度。
- 使用 Edit 在 plan 文件本身勾选已完成项。
- 完成一个 phase 的所有 automated verification 后,暂停并告知人类该 phase 可手动测试,使用格式:`Phase [N] Complete - Ready for Manual Verification`、`Automated verification passed:` 列表、`Please perform the manual verification steps listed in the plan:` 列表、`Let me know when manual testing is complete so I can proceed to Phase [N+1].`。
- 如果被指示连续执行多个 phases,跳过暂停直到最后一个 phase;否则假设你只做一个 phase。
- 在用户确认前,不要勾选手动测试步骤中的项。
- 卡住时,首先确保已阅读并理解所有相关代码。
- 考虑代码库是否自计划编写以来已经演变。
- 清晰呈现 mismatch 并询问指导。
- 节约使用 sub-tasks,主要用于 targeted debugging 或探索不熟悉领域。
- 如果 plan 由 `plan-agent` 创建,可以 resume 它以澄清:检查 `.claude/cache/agents/agent-log.jsonl` 中的 plan-agent entry。
- 查找 `agentId` 字段。
- 用 `Task(resume="<agentId>", prompt="...")` 澄清或更新计划;resumed agent 保留完整 prior context(research、codebase analysis)。
- 可 resume 的 agents 包括:`plan-agent`(创建 implementation plan)、`oracle`(研究 best practices)、`debug-agent`(调查 issues)。
- 如果 plan 有现有 checkmarks,信任已完成工作已完成。
- 从第一个未勾选项继续。
- 仅在看起来有问题时验证先前工作。
- 记住:你是在实现解决方案,不只是勾选 boxes;保持 end goal 并维持 forward momentum。
- 实现较大计划(4+ tasks)时,使用 agent orchestration 保持 compaction-resistant。
- 理解 agent orchestration 解决的问题:长实现中 context 累积,auto-compact 若在 mid-task 触发会丢失 implementation context;在 80% context 创建的 handoffs 会变 stale。
- 采用解决方案:把实现委托给 agents;每个 agent 从 fresh context 开始,实现一个 task,在完成时创建 handoff,并返回 orchestrator。
- 利用 handoffs 持久化在磁盘;如果发生 compaction,重新读取 handoffs 并继续。
- 设置 handoff directory:`mkdir -p thoughts/handoffs/<session-name>`;使用 continuity ledger 中的 session name。
- 阅读 implementation agent skill:`cat .claude/skills/implement_task/SKILL.md`;它定义 agents 应如何表现。
- 实现前确保 plan 已使用 `validate-agent` 验证;验证步骤是单独的,应已创建 status VALIDATED 的 handoff。
- 检查 validation handoff:`ls thoughts/handoffs/<session>/validation-*.md`。
- 如果无 validation,建议先运行 validation:This plan hasn't been validated yet. Would you like me to spawn validate-agent first?
- 如果 validation 存在但 status 是 NEEDS REVIEW,在继续前呈现 issues。
- Orchestration loop 对每个 task:准备 agent context,读取 continuity ledger(当前状态)、plan(整体上下文)、previous handoff(若存在,来自 `thoughts/handoffs/<session>/`),并识别 specific task。
- 生成 implementation agent:`Task(subagent_type="general-purpose", model="claude-opus-4-5-20251101", prompt=...)`;prompt 中粘贴 `.claude/skills/implement_task/SKILL.md` 内容,并附 continuity ledger、plan、Task [N] of [Total] 描述、previous handoff(或说明是第一个 task)、handoff directory、handoff filename `task-[NN]-[short-description].md`,要求实现 task 并创建 handoff。
- 处理 agent 结果:读取 agent 的 handoff file。
- 更新 ledger checkbox:`[x] Task N`。
- 如果适用,更新 plan checkbox。
- 继续下一个 task。
- agent failure/blocker 时:读取 handoff(status 将是 "blocked")。
- 向用户呈现 blocker。
- 决定 retry、skip 或 ask user。
- auto-compact 发生在 mid-orchestration 时恢复:读取 continuity ledger(由 SessionStart hook 加载)。
- 列出 handoff directory:`ls -la thoughts/handoffs/<session-name>/`。
- 读取最后一个 handoff 以理解你之前在哪里。
- 从下一个未完成 task 继续生成 agents。
- Handoff chain:每个 agent 读取 previous handoff,做工作,创建 next handoff,使 context 跨 compactions 保留。
- 按场景选择模式:1-3 个简单 tasks 用 direct implementation;4+ tasks 用 agent orchestration;关键 context 要保留用 agent orchestration;快速 bug fix 用 direct implementation;重大功能实现用 agent orchestration;用户明确要求时遵从用户偏好。
- Tips:保持 orchestrator thin,不要自己做 implementation work,只管理 agents。
- Tips:信任 handoffs,agents 会创建详细 handoffs,用它们获取 context。
- Tips:One agent per task,不要 batch 多个 tasks 到一个 agent。
- Tips:Sequential execution,先从 sequential 开始,parallel 会增加复杂度。
- Tips:Update ledger,每个 task 后更新 continuity ledger checkbox。
适用边界 · 注意事项
- 计划已有「## Risks (Pre-Mortem)」且包含 mitigations,或用户明确要求 `--skip-premortem` 时,不要运行 premortem。
- 1-3 个简单任务或快速 bug fix 时,不要用 agent orchestration,改用 direct implementation。
- 没有提供 plan path 时,不要直接实现,应先询问计划路径。