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.
Draft
Include, joined with AND — never "or", the loop takes the cheaper branch:
- End state, not activity — "all
legacyAuth()call sites useauth.verify()", not "migrate the auth code". An activity can be claimed; an end state is true or false. - Scope to read first — the files, issue, logs, or plan to read before acting.
- Stated check — the exact command and its observable result ("
npm testexits 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. - Invariants — what must not change ("without modifying vendor/"), always including "do not weaken, skip, or edit the checks themselves".
- 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.