Guide

Write a Goal That Can Finish

Write verifiable completion conditions with test checks, constraints, and copy-paste prompts for Claude Code, Codex, and Hermes Agent.

~8 min read

The 6-Part Verifiable Goal Contract diagram showing end state, test checks, constraints, boundaries, blocker protocols, and budget ceilings.

/goal keeps the session going until a judge says the condition holds, says it cannot, or you clear it. The message you send is the directive. No second prompt. No markdown fence around the message you run.

Checked against Claude Code, Codex, and Hermes Agent docs on September 30, 2026. Narrative version: A /goal is a condition, not a sitting.

The 6-Part Verifiable Goal Contract architectural diagram
The 6-Part Verifiable Goal Contract: structure conditions so an independent judge model can verify completion.

Before you type it

  1. Confirm the command exists: In Claude Code, update the CLI. In Codex (CLI 0.128.0+), run "codex features enable goals" or set goals = true in ~/.codex/config.toml. In Hermes Agent, it is built in with a default 20-turn budget in ~/.hermes/config.yaml under goals.max_turns.
  2. Decide you actually need the loop: One-turn edits do not. A vague "make it better" does not. A job you would otherwise nudge with "continue" three times does.
  3. Put the check in the repo before you arm the loop: The judge reads the conversation. It does not run the test suite for you.
  4. Match permission to how alone you want to be: On Claude Code, /goal does not change permission mode. Manual mode still asks before tool use; auto mode lets allowed tools run without you. The goal is what starts the next turn.
  5. Keep irreversibles out: No send-money, no sign-as-me, and no permanent public post unless that action is explicitly allowed.

The shape of a goal

One single message. First character is "/". Then "goal", a space, and the condition. Keep it under 4,000 characters. If you have a longer spec, write a file and point the goal at that file.

/goal <end state a stranger can mark yes or no>, verified by <command, file, benchmark, or screenshot>, while preserving <what must not change>. Use <paths or inputs in scope>. If blocked, stop with the attempted paths, the evidence, and the input that would unlock the next step. Or stop after <N> turns.

Compare a weak prompt to a strong goal prompt:

  • Weak: "implement a function that validates email addresses"
  • Strong: "/goal validateEmail exists and the example cases pass: user@example.com is true, invalid is false, user@.com is false. Run the tests after implementing. Or stop after 15 turns."

Claude Code prompts

Status, clear, and headless commands:

You type: /goal
You type: /goal clear
Comment: Headless execution from your shell:
Command: claude -p "/goal CHANGELOG.md has an entry for every PR merged this week"
Standard commands for inspecting, clearing, and running headless goals.

Auth suite verification:

/goal all tests in test/auth pass and the lint step is clean. Prove it with the test command and the lint command output in the transcript. Do not modify unrelated test files. If a failure is an environment error you cannot fix, stop and name it. Or stop after 20 turns.

Module migration:

/goal every call site of the legacy billing client compiles against the v2 client and the billing tests pass. Prove it with the typecheck and the billing test command. Do not change payment amounts or webhook signatures. If a call site needs a product decision, stop and list it. Or stop after 25 turns.

File split:

/goal src/legacy/report.ts is split into focused modules and each file is under 300 lines. The report tests still pass. No behavior change. Prove it with the test command and a line count. Or stop after 20 turns.

Codex prompts

Benchmark optimization contract:

/goal Reduce p95 checkout latency below 120 ms, verified by the checkout benchmark, while keeping the correctness suite green. Use only the checkout service, benchmark fixtures, and related tests. Between iterations, record what changed, what the benchmark showed, and the next best experiment to try. If the benchmark cannot run or no valid paths remain, stop with the attempted paths, the evidence gathered, the blocker, and the next input needed.

Stack migration:

/goal Migrate this project from the legacy stack named in PLAN.md to the target stack named there. All screens stay visually the same. Verify with Playwright against the reference screens. Do not change copy or pricing. Stop when the new path passes the contract tests and the legacy path still has a rollback, or when a screen needs a product decision.

Hermes Agent prompts

Lint and test verification:

/goal Fix every lint error in src/ and verify ruff check passes

Structured contract drafting:

/goal draft Build a small CLI to rename files by their EXIF dates, then test it against the photos/ folder

Add shell quality gates with "/goal gate add <command>" so the judge is backed by deterministic script exits.

Anti-patterns to avoid

  • A fenced code block as the prompt you paste. The slash command must be the first character.
  • "I will be in the chat the whole way, do not mark complete." Let the judge evaluate completion.
  • A Desktop folder and summary markdown file as mandatory baggage. Add them only if you require them.
  • One prompt that claims to be Claude, Codex, and Hermes simultaneously. Share the condition; customize the controls per CLI.

After it stops

Read the evidence, not the final sentence. Check the test command output, the exit code, and the diff. Then run /goal to see whether the condition cleared, failed as impossible, or remains active.

If it cleared too early, the condition was loose: add a stricter check and run again. If it stalled, provide the missing decision or credential rather than another vague "continue".

Sources and further reading

Stay updated

Get new guides in your inbox

One task, one guide, done fast. Practical Claude Code skills, zero noise.