AI Agent
Plan 模式
复杂任务:先让 Agent 写计划 → 你确认 → 再执行。
Plan 模式解决什么
默认模式下,Agent 拿到 prompt 就开干 — 适合小任务。Plan 模式让 Agent 先停下来,写一份结构化计划:目标、子步骤、每步会调用哪些工具、可能的失败点。你审完点 Approve 才开始执行。
这对不可逆操作(删文件、调 API、修改生产数据库)是关键护栏。你只需多花 30 秒看计划,就能避免后续半小时的回滚。
触发方式
- 在 prompt 里说 "Use plan mode" / "先做个计划"
- 或点击输入框右下角的 plan toggle
- 用
/planslash command - Agent 会输出计划 → 等你 Approve / Edit / Reject
一个 plan 长什么样
Plan: migrate notes/ from old format to v2
Steps:
1. grep notes/**/*.md for "::deprecated::" markers
tools: grep
2. For each match, read the file and parse front-matter
tools: Read (parallel)
3. Rewrite front-matter into v2 schema, keep body
tools: Edit (parallel, batched 10)
4. Re-validate by running scripts/validate-v2.sh
tools: Bash
5. Print a summary table of migrated / skipped / failed
Risk:
- Step 3 rewrites files. I will skip files modified in the
last hour to avoid clobbering active edits.
- Step 4 requires Bash permission for scripts/.
Estimated tool calls: ~120
Estimated cost: $0.18 with sonnet什么时候用
- 跨多个文档 / 表的修改
- 需要外部 API 调用
- 操作不可逆(如 rm / API write)
- 工具调用预计超过 20 次 — 看一眼计划能省成本
- 团队 Vault — 别人也看得到决策记录
Plan vs Goal 模式
Plan 是"一次性写完计划再执行",适合任务边界清楚的活。Goal 模式则相反:你给一个长期目标,Agent 自主分解、执行、复盘、再分解,直到达成或被打断 — 适合"调研三家竞品并出对比报告"这种开放任务。
两者可以叠加:用 Goal 模式跑长任务,每个子阶段强制走 Plan 审核。