回顾与练习
关键要点
- 智能体放大的是你精确表达需求、并识别是否如愿以偿的能力 — 而不是取代它。
- 界定范围有双重回报: 范围收得紧的任务产出你真能审查的 diff,松散的任务产出你审不动的 diff。
- 审查 diff,而不是整个代码库 —
git diff --stat几秒钟就能标出范围蔓延,而通过的测试套件永远不能替代亲自运行。 - 绝不要对付费 跑没有限流的智能体循环;给每个循环设硬上限 — 最大迭代次数、支出上限或超时。
- 在信任智能体后台运行之前,先在前台盯着头几次运行,确认它会收敛。
动手试试
挑一个小而边界清晰的任务,连同一个明确的停止条件("尝试 3 次后停止"或"测试再失败两次就停止")一起交给智能体。在前台从头到尾盯完整个运行,然后只用 git diff --stat 再加 git diff 审查这份 diff。如果改动触及的文件多于你界定的范围,那就是收紧任务说明并重跑的信号。
本章提示词
I'm giving you an autonomous task. Obey these guardrails exactly:
- SCOPE: only touch [list the files/modules]. If the fix needs more,
STOP and tell me instead of expanding scope.
- GOAL: [one concrete, checkable outcome].
- STOP CONDITIONS: stop after 3 attempts, OR if tests fail twice in a
row, OR if you've made changes outside the scope above.
- COST: do not call any paid API in a loop without a hard cap.
- REPORT: when you stop, show me `git diff --stat`, the test result,
and one sentence on whether you converged or got stuck.
Begin, and narrate each attempt so I can watch you converge.