goal-prompt

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Goal Prompt

Goal Prompt

/goal
keeps the agent working until a completion condition is met. Both Claude Code and Codex take it as one line, max 4,000 characters. In Claude Code a small model re-judges the condition after each turn from the transcript alone — it cannot run commands.
Draft a condition that can terminate, then format it. A goal fits work bigger than one turn with a checkable finish line; chain small goals with review between them rather than writing one giant goal.
/goal
可让Agent持续工作直到满足完成条件。Claude Code和Codex均接受单行格式,最多4000字符。在Claude Code中,一个小型模型会根据对话记录单独判断每一轮后的条件——它无法执行命令。
请起草一个可终止的条件并进行格式化。目标适用于需要多轮完成且有可验证终点的任务;建议将大型目标拆分为多个小目标,中间穿插审核,而非编写一个庞大的目标。

Draft

Draft

Include, joined with AND — never "or", the loop takes the cheaper branch:
  1. End state, not activity — "all
    legacyAuth()
    call sites use
    auth.verify()
    ", not "migrate the auth code". An activity can be claimed; an end state is true or false.
  2. Scope to read first — the files, issue, logs, or plan to read before acting.
  3. Stated check — the exact command and its observable result ("
    npm test
    exits 0"), plus an instruction to run it and show the output; a result that never lands in the transcript does not exist to the evaluator.
  4. Invariants — what must not change ("without modifying vendor/"), always including "do not weaken, skip, or edit the checks themselves".
  5. Stop bound or blocked clause — "or stop after 20 turns", "if blocked, stop and report the blocker". Without one, a mis-stated condition loops forever; the formatter warns when it is missing. (Claude Code resets the turn counter on session resume, so a turn bound silently extends across resumes.)
Keep it small. Every constraint narrows the state space the model can explore. Collapse to one terminating criterion when possible, move scope and definitions into a referenced file, and drop non-goals — a constraint earns its place only by closing a real easy-out.
For long goals, also name the final evidence (diff, report, artifact) and require a progress log file — durable state across compaction and resume. If the brief exceeds 4,000 characters, put the details in a
GOAL.md
and reference that file from the objective.
Never invent missing elements. Ground every element in the user's request, the conversation, or the repository — look things up rather than guessing. If an element cannot be filled from available information, still optimize and format what the user provided, leave the element out, and flag it as missing (see Format). A goal with an invented success condition terminates on the wrong contract.
请包含以下内容,用AND连接——绝对不要用“or”,否则循环会选择成本更低的分支:
  1. 最终状态,而非活动 ——例如“所有
    legacyAuth()
    调用点均使用
    auth.verify()
    ”,而非“迁移认证代码”。活动可被声称完成,但最终状态是明确的真或假。
  2. 先限定读取范围 ——指定执行操作前需要读取的文件、问题、日志或计划。
  3. 明确的验证方式 ——精确的命令及其可观测结果(例如“
    npm test
    退出码为0”),同时要求运行该命令并展示输出;未出现在对话记录中的结果对评估器而言等同于不存在。
  4. 不变约束 ——必须保持不变的内容(例如“不得修改vendor/目录”),始终包含“不得弱化、跳过或编辑验证规则本身”。
  5. 停止限制或阻塞处理条款 ——例如“或20轮后停止”、“若被阻塞,停止并报告阻塞原因”。如果缺少该条款,表述有误的条件会导致无限循环;格式化工具会在缺失时发出警告。(Claude Code在会话恢复时会重置轮次计数器,因此轮次限制会在会话恢复后自动延长。)
保持简洁。每一项约束都会缩小模型可探索的状态空间。尽可能将内容简化为一个终止标准,将范围和定义移至引用文件中,并剔除非目标内容——只有能真正避免投机取巧的约束才值得保留。
对于长期目标,还需指定最终证据(差异文件、报告、产物)并要求生成进度日志文件——确保在会话压缩和恢复时状态持久化。如果内容超过4000字符,可将细节放入
GOAL.md
文件,并在目标中引用该文件。
切勿凭空捏造缺失内容。所有内容都必须基于用户的请求、对话内容或代码库——优先查找信息而非猜测。如果某个元素无法从现有信息中补充,仍需优化并格式化用户提供的内容,省略该元素并标记为缺失(参见格式部分)。带有虚构成功条件的目标会在错误的前提下终止任务。

Close the easy-outs

Close the easy-outs

Before formatting, reread the drafted condition as a lazy model would: what is the cheapest way to make every check pass without doing the intended work? Close the cheapest ones — prefer pairing checks you already have over adding constraints, and do not enumerate every conceivable out into a non-goal list. The recurring outs:
  • Delete or stub instead of fix — "search prints nothing" also holds when the callers are gone; pair such checks with one that proves the feature still works.
  • Pass on a subset — running one test file, narrowing the search path, excluding directories from the check.
  • Game the gate — skipping/xfail-ing tests, hardcoding expected outputs, special-casing the test inputs, editing the check (the invariants rule).
  • Claim without running — declaring done or blocked with no check output in the transcript (the show-the-output rule).
Same discipline as above: an out you cannot close from available information goes in the
Missing:
list as a warning — an invented or absurd constraint is worse than a flagged gap.
在格式化前,以偷懒的模型视角重新审视起草的条件:如何以最低成本满足所有验证规则却不完成预期工作?请封堵这些最容易的投机取巧方式——优先结合已有的验证规则而非添加新约束,无需枚举所有可能的投机方式。常见的投机方式包括:
  • 删除或存根而非修复 ——“搜索无输出”在调用点被删除时也成立;需将此类验证与证明功能仍正常运行的验证结合。
  • 仅验证子集 ——仅运行一个测试文件、缩小搜索路径、在验证中排除目录。
  • 钻规则空子 ——跳过/标记预期失败的测试、硬编码预期输出、针对测试输入做特殊处理、编辑验证规则(违反不变约束规则)。
  • 未验证就声称完成 ——在对话记录中无验证输出的情况下宣称任务完成或被阻塞(违反展示输出规则)。
遵循同样的原则:如果无法从现有信息中封堵某个投机方式,需将其列入
Missing:
列表作为警告——凭空捏造或不合理的约束比明确标记的漏洞更糟糕。

Security research goals

Security research goals

Collapse audit goals to one terminating criterion, such as identifying, triggering, and validating one high-severity vulnerability valid under a referenced threat-model file. That file, not the goal, carries scope, attacker powers, severity baseline, and known findings to skip. Use neutral wording ("trigger and validate", not "prove this is exploitable"), require demonstrated preconditions — assumed attacker access is the most common false positive — and stop for human review after each finding rather than piling up untriaged reports. Validate findings with a second pass by a fresh agent, never the finder alone.
将审计目标简化为一个终止标准,例如识别、触发并验证一个符合引用威胁模型文件的高严重性漏洞。范围、攻击者权限、严重性基准以及需跳过的已知发现应在该文件中说明,而非目标中。使用中性措辞(例如“触发并验证”,而非“证明可被利用”),要求展示前置条件——假设的攻击者权限是最常见的误判原因——并在每次发现后暂停等待人工审核,而非堆积未分类的报告。需通过全新Agent进行二次验证,不能仅依赖发现者自身的验证。

Format

Format

Run
uv run --no-project {baseDir}/scripts/format_goal_prompt.py --fenced
on the draft (file or stdin). It collapses whitespace to one line, strips
/goal
prefixes, quotes, and fences, warns on a missing stop clause, and rejects output over 4,000 characters — shorten or move detail to a file and rerun.
Return exactly one fenced
text
block, one line:
text
/goal <single normalized objective>
Add no prose around it — except when checklist elements could not be grounded: then follow the block with a
Missing:
list, one line per gap, telling the user what to supply.
在草稿(文件或标准输入)上运行
uv run --no-project {baseDir}/scripts/format_goal_prompt.py --fenced
。该工具会将空白压缩为单行,去除
/goal
前缀、引号和围栏,在缺少停止条款时发出警告,并拒绝超过4000字符的输出——此时需缩短内容或将细节移至文件后重新运行。
返回一个带围栏的
text
块,单行内容:
text
/goal <single normalized objective>
请勿添加任何额外文字——除非清单中的某些元素无法基于现有信息确定:此时需在块后添加
Missing:
列表,每行一个漏洞,告知用户需要补充的内容。

Example

Example

Draft:
/goal Migrate the auth module:
  - replace legacyAuth() with auth.verify()
  - make sure the tests still work
Redrafted and formatted:
text
/goal All legacyAuth() call sites use auth.verify(): `rg "legacyAuth\(" -t ts` prints nothing AND `npm test` exits 0 (run both, show the output), without modifying vendor/ or weakening any test. If blocked, stop and report attempted paths and the blocker, or stop after 20 turns.
Here
npm test
came from the repo's package.json — not a guess — and pairing it with the zero-matches check closes the cheapest out: deleting the call sites instead of migrating them. When nothing grounds an element, format what exists and flag the gaps:
Draft:
make checkout faster
, with no metric or benchmark anywhere in context:
text
/goal Make checkout faster
Missing:
  • measurable end state — which metric and threshold count as "faster"
  • verification — the benchmark or command that proves it
  • stop bound — e.g. "or stop after 20 turns"
草稿:
/goal Migrate the auth module:
  - replace legacyAuth() with auth.verify()
  - make sure the tests still work
重写并格式化后:
text
/goal All legacyAuth() call sites use auth.verify(): `rg "legacyAuth\(" -t ts` prints nothing AND `npm test` exits 0 (run both, show the output), without modifying vendor/ or weakening any test. If blocked, stop and report attempted paths and the blocker, or stop after 20 turns.
此处的
npm test
来自代码库的package.json——而非猜测——将其与零匹配验证结合,封堵了最容易的投机方式:删除调用点而非迁移。当没有信息支撑某个元素时,格式化现有内容并标记漏洞:
草稿:
make checkout faster
,上下文无任何指标或基准:
text
/goal Make checkout faster
Missing:
  • measurable end state —— 需明确哪个指标及阈值算作“更快”
  • verification —— 证明速度提升的基准或命令
  • stop bound —— 例如“或20轮后停止”