Anthropic 员工实测 Claude Code /goal:Stop hook 驱动目标检查直到条件达成
Ado Kukic 演示 Claude Code 的 /goal 底层是会话级 Stop prompt hook,检查器读取目标和对话,每次拒绝继续都附带引导下一轮的理由。
作者以第一手实测说明 /goal 的 Stop hook 机制,并给出可被对话记录验证的目标写法,便于迁移到自己的 Claude Code 用法。
Under the hood it's a session-scoped prompt hook on Stop. The checker reads your condition plus the conversation, and every "not yet" comes with a reason that steers the next turn.
I tried "/goal build a modern game engine in Rust comparable to Unity or Unreal". It said "not yet" 25 times, into the next morning. The checker runs no tools, so it judges only what Claude has shown, and Claude kept writing that the engine was "not yet a peer of Unity or Unreal".
I still got a real engine out of it: renderer, physics, an editor and a stack of sample games.
Write a goal the transcript can prove:
- /goal cargo test --workspace passes and the demo holds 60 fps, or stop after 30 turns
- /goal npm test exits 0 and git status shows only src/ changed
来源:Ado · x.com