Claude Code Goal Command: How /goal Keeps Claude Working Until the Job Is Actually Done

David IyaDavid Iya September 30, 2026 8 min read
A small red flag planted at the top of a stack of smooth grey stones on a wooden desk, beside a brass compass and a closed notebook, in cool morning light
Original image, Claude Code Club

What the Claude Code goal command does

The Claude Code goal command is /goal followed by a completion condition, for example /goal all tests in test/auth pass and the lint step is clean. Setting it starts a turn straight away, with the condition as the instruction. After each turn, a small fast model checks whether the condition holds. If it does not, Claude starts another turn instead of handing control back to you. The goal clears on its own when the condition is met, when the evaluator judges it impossible, or when a turn fails on an error you have to fix. One goal can be active per session, and it works in the desktop app, in the terminal, and through Remote Control.

The part that matters to me is who decides the work is finished. Without a goal, Claude stops when Claude thinks it is done. With a goal, a fresh model that did none of the work reads the conversation and makes the call. That is the same reason I do not review my own pull requests. The builder is the worst judge of whether the build is complete, and /goal gives you a second opinion on every single turn without you having to be there.

How to set a goal in the Claude Code desktop app

Open a session on the project in the desktop app, type /goal followed by your condition, and send it. You do not need a separate prompt. The condition is the instruction, and Claude starts working as soon as it is set. While the goal is active, an indicator shows that it is running and for how long.

  1. Commit your work first. A goal can run for many turns, and a clean commit is the cheapest undo you have. Using Claude Code with git covers the habit.
  2. Pick your permission mode on purpose. A goal does not change it. In Manual mode, Claude still asks before any tool call your settings do not already allow, so the goal will sit waiting for you. To let the turns run unattended, set the goal in auto mode.
  3. Type /goal and the condition, then send. Setting a new goal while one is active replaces the old one.
  4. Check in with /goal on its own. It shows the condition, how long it has been running, how many turns have been evaluated, the token spend so far, and the evaluator's most recent reason.
  5. Stop it with /goal clear if you change your mind. The words stop, off, reset, none and cancel work too, and running /clear to start a new conversation also removes the goal.

If you close the session with a goal still active, resuming that session brings the goal back. The condition carries over, and the turn count, timer and token-spend figures start again from zero. A goal that was already achieved or cleared does not come back. How to resume a Claude Code session covers the resume routes.

The CCC Finish Line Formula: how to write a goal condition

A goal condition has to be something Claude's own output can prove. The evaluator does not run commands and does not read your files. It reads the conversation, and that is all. "All tests in test/auth pass" works because Claude runs the tests and the result lands in the transcript. "The code is clean" does not work, because nothing Claude prints can settle it. The CCC Finish Line Formula is the four parts I write every time.

The CCC Finish Line Formula

PartWhat it isExample
End stateOne measurable result: a test result, a build exit code, a file count, an empty queueEvery call site uses the new payments client
ProofThe check Claude must run and shownpm test exits 0 and git status is clean
GuardrailsWhat must not change on the way thereNo test file is modified and no dependency is added
CeilingA turn or time limit written into the conditionOr stop after 20 turns

Put together, that reads: /goal every call site uses the new payments client, npm test exits 0, no test file is modified, or stop after 20 turns. The condition can be up to 4,000 characters, so there is room to be exact. The ceiling is the part people skip. Claude reports progress against a turn or time clause each turn and the evaluator judges it from the conversation, which makes it the simplest way to bound a run you are not watching.

The guardrail line is the one I would not leave out. A model told to make the tests pass has two ways to get there, and one of them is editing the tests. Writing "no test file is modified" into the condition closes that door. If the work is big enough to need a page of acceptance criteria, write them down first. How to write a technical spec for Claude Code is the format I use, and the goal then becomes "every acceptance criterion in the spec holds".

/goal vs /loop vs auto mode vs a Stop hook

These four get confused because they all make Claude Code do more without you. They answer different questions. /goal decides when the work is finished. /loop re-runs a prompt on a time interval. Auto mode removes the approval prompts inside a turn. A Stop hook is the permanent, scripted version of what /goal does for one session.

Four ways to keep Claude Code working, and what each one controls

ToolWhat starts the next turnWhat stops itReach for it when
/goalThe previous turn finishingA separate model confirms the condition is met or impossible, an error you have to fix, or /goal clearThe job has a finish line you can check
/loopA time interval passingYou stop it, or Claude decides the work is doneThe job is a repeat check, not a finish line
Auto modeNothing. It approves tool calls inside one turn and does not start a new oneClaude judging the work doneYou want fewer approval prompts
Stop hookThe previous turn finishingYour own script or promptYou want the same check on every session, saved in settings

/goal and auto mode are built to be used together. Auto mode removes the per-tool prompts and /goal removes the per-turn prompts. Under the hood, /goal is a wrapper around a prompt-based Stop hook that lasts for the current session only. If you find yourself typing the same goal every day, that is the sign to make it a real hook. Hooks that earn their keep covers which ones are worth it. For work that should run when no session is open at all, that is a scheduled task in the desktop app, not a goal.

What stops a goal, and what only pauses it

A goal ends in one of three verdicts or one kind of error. The evaluator returns not yet met, met, or impossible, each with a short reason. Not yet met means Claude keeps going and uses the reason as guidance. Met clears the goal and records it as achieved. Impossible clears it and records the reason, so you are not left with a loop chasing something that cannot happen.

  • Errors that clear the goal: an exhausted credit balance, a model that is not available, a context overflow that auto-compaction could not clear, and an authentication failure when Claude Code manages its own credentials. In the desktop app, which manages sign-in for you, an authentication failure leaves the goal active. When a goal is cleared this way, fix the cause and run /goal again.
  • Errors that keep the goal: everything else. On Claude Code v2.1.269 or later, an interactive session retries on its own after things like an overloaded server or a dropped connection, and pauses after three automatic retries.
  • Limits pause it. An API rate limit or a usage limit pauses the goal and names the cause. If the session is set to continue when the usage limit resets, Claude picks the goal back up then. What to do when you hit usage limits covers your options in the meantime.
  • Talking without working stops the loop. If Claude keeps answering the evaluator with no tool use for several turns in a row, Claude Code stops, prints a warning, and hands control back to you with the goal still set.
  • Background work delays the check. If a subagent or a background command is still running when a turn ends, the evaluation is skipped for that turn and happens once nothing is running. After 30 minutes of waiting, Claude is asked to check on the running tasks and fix or stop any that are stuck.

What the goal command costs

The evaluator itself is cheap. It runs on your configured small fast model, which defaults to Haiku on the Claude API, and the official guidance is that evaluation tokens are typically negligible compared to what the main turns spend. The real cost of a goal is the turns. A goal with no ceiling on a vague condition can take a lot of turns, and every one of them is billed like any other work.

That is why the ceiling is in the formula, and why I check /goal partway through a long run. It shows the token spend so far. If the number is climbing and the evaluator's reason has not changed in a while, the condition is the problem, not the model. Clear it, tighten it, and set it again. What actually eats your limit explains where the rest of the spend goes.

The jobs I hand to /goal, and the ones I do not

A goal earns its place on substantial work with an end state you can verify. It is the wrong tool for anything where finished is a matter of taste.

  • Good fit: moving a module to a new API until every call site compiles and the tests pass.
  • Good fit: building out a written spec until every acceptance criterion holds.
  • Good fit: splitting one oversized file into smaller ones until each is under a size you name.
  • Good fit: working through a labelled backlog of issues until the queue is empty.
  • Bad fit: "make the homepage look better". There is nothing in a transcript that proves it, so the evaluator is guessing.
  • Bad fit: a job where the check lives outside the session, like a client signing off. Claude cannot show that result, so the condition can never be met.
  • Bad fit: anything on a client's production system without limits in place first. A goal in auto mode is Claude Code running unattended, and the same rules about permissions apply. Permissions explained is where I would start.

Set your first goal today

Pick one job on your current project that has a test or a build you trust. Commit, switch to auto mode if the repo is yours to risk, and write the condition with all four parts: end state, proof, guardrails, ceiling. Then leave it alone and read the evaluator's reasons when you come back. They tell you more about how well you wrote the condition than about how well Claude worked. If a run goes somewhere you did not want, checkpoints and rewind plus the commit you made at the start get you back.

Free Claude Code drops, straight to your inbox

Short, practical drops on skills, MCP, agents, prompts, and more. No spam, unsubscribe anytime.

Frequently asked questions

What is the Claude Code goal command?

It is /goal followed by a completion condition. Claude keeps working turn after turn until a separate small fast model confirms the condition is met, judges it impossible, or a turn fails on an error you have to fix. One goal can be active per session.

Does /goal work in the Claude Code desktop app?

Yes. /goal works in the desktop app, in the terminal, in non-interactive mode, and through Remote Control. In the desktop app you type /goal and the condition into the prompt box and send it.

What is the difference between /goal and /loop in Claude Code?

/goal starts the next turn as soon as the previous one finishes and stops when a separate model confirms your condition is met. /loop re-runs a prompt when a time interval passes and stops when you stop it or Claude decides the work is done. Use /goal for a finish line and /loop for a repeat check.

How do I stop a Claude Code goal?

Run /goal clear. The words stop, off, reset, none and cancel are accepted as aliases, and running /clear to start a new conversation also removes an active goal. To limit a goal in advance, write a clause such as or stop after 20 turns into the condition.

Does /goal run without asking for permission?

Not by itself. A goal does not change your permission mode. In Manual mode Claude still asks before tool calls your settings do not already allow. To let goal turns run unattended, set the goal while in auto mode.

How much does /goal cost to run?

The evaluator runs on your configured small fast model, which defaults to Haiku on the Claude API, and its tokens are typically negligible compared to the main turns. The real cost is the number of turns the goal takes, which is why a turn or time ceiling in the condition matters.

Last reviewed by David Iya on September 30, 2026

David Iya

Written by

David Iya

Forbes 30 Under 30 · Y Combinator

Keep reading

Claude CodeWorkflows

Claude Code Doctor: The Checkup I Run After Every Model Release (Plus the New Prompt Audit)

Claude Code doctor is the built-in checkup you start by typing /doctor. It checks your install, finds skills, MCP servers and plugins that cost context without earning it, flags slow hooks, trims a bloated CLAUDE.md, and asks before it changes anything. Since v2.1.283 it also has /doctor prompt-audit, which reads your instructions for rules written for older models. Here is what each check does, when I run it, and how to read the report in the desktop app.

David Iya 8 min
Read article
Claude CodeWorkflows

Claude Code Computer Use: What I Let Claude Click on My Mac (and What It Will Not)

Claude Code computer use lets Claude open your apps, see your screen, click, type, and drag, the way you would, from inside the desktop app. It is off by default, needs a Pro or Max plan, and every app gets approved per session with a fixed level of control: browsers are view-only, terminals are click-only, everything else is full control. Here is how I switched it on, what it caught on a native build that nothing else could reach, which apps I refuse to approve, and the order Claude tries other tools before it touches your screen.

David Iya 9 min
Read article

Ready to build it yourself?

Join Claude Code Club, the #1 community for learning claude code, for $9/month.

← Back to the blog