Work Towards an Objective With /goal

The /goal slash command gives Command Code a standing objective to work toward across many turns, instead of a single request. Once you set a goal, Command Code starts working immediately, step after step, and the goal is only marked achieved when an independent check confirms it from the evidence. When the agent stops before that, Command Code sends the goal back to it automatically, within the limits below.

Use it for end-to-end work you'd otherwise drive turn by turn: "get the test suite green", "migrate this module to the new API", "ship the release".

Basic usage

/goal <objective> # Set an objective and start working toward it /goal status # Output the current goal status /goal clear # Stop and clear the active goal

  1. You set an objective: Command Code pursues the goal step by step, working from fresh context, built up from the filesystem, command output, and test results.
  2. It works across turns: Each model round-trip (one step in the agent's loop) counts as one turn against the goal's budget.
  3. It signals completion only when done: When the agent believes every part of the objective is satisfied, it ends its turn with a completion marker and states the evidence (files changed, commands run, tests passing).
  4. An independent check verifies the claim: A separate completion check inspects the evidence and rejects unproven or partial claims. If the claim is rejected, Command Code keeps working to close the specific gap rather than declaring victory.
  5. It waits for you when the agent stops: Command Code doesn't re-prompt itself after an ordinary stop. If the agent finishes without claiming completion, the goal stays active and your next message continues it.
Info

A goal persists with your session. It shows up in your session list and is restored when you reopen the conversation with --resume. On resume its loop is not running. An unfinished goal shows as idle; restart it with /goal <objective>.

If the completion check times out, fails, or gives an answer that can't be read, it tries once more. If it still has no answer, the goal pauses with Goal paused · couldn't verify completion. The goal is never marked achieved without a real answer from the check, and a failed check doesn't count as a rejected claim. Run /goal <objective> to start again.

A goal runs with a budget of model turns so an autonomous loop can't run indefinitely and use up all available credits.

SettingValue
Default budget100 turns
Maximum budget1000 turns
Override at launch--max-turns <number>

Pass --max-turns when you start Command Code to raise or lower the budget for goals set this session. Values are clamped to the 1000 turn ceiling.

If the budget runs out before the objective is met, the goal pauses rather than stopping silently. Run /goal <objective> again to start a fresh attempt.

When a turn ends without the agent claiming completion, Command Code sends the goal back to the agent on its own. This is on by default in the CLI, the desktop app and the VS Code extension. It keeps going until one of these happens:

  • An independent check confirms the objective is met.
  • The turn budget runs out.
  • It has sent 5 automatic continuations for this goal. The goal pauses with Goal paused · 5 automatic continuations used. Retries after a rejected completion claim and your own messages don't count.
  • Three turns in a row have no successful tool call. The goal pauses with Goal paused · no progress. Updating the todo list doesn't count as progress.
  • You stop it with Esc, Ctrl+C, or /goal clear.

Each continuation runs under your current permission mode. With accept-edits or bypass permissions on, it runs tools, including shell commands, without asking, for up to 5 automatic continuations and the rest of the turn budget. Only leave a goal running unattended in a mode you'd trust for that long.

To have a goal wait for you after each turn instead, turn it off in ~/.commandcode/config.json:

{ "goalAutoContinue": false }

Your messages go first: anything you send or queue runs before the next continuation, and the goal continues after it. A goal also waits for you in plan mode, when a turn fails, and when you deny a permission request.

Run /goal or /goal status at any time to see where a goal stands:

StateExample headlineMeaning
ActiveGoal active · turn 7/100 · 2mThe loop is running; shows the in-flight turn, budget, and elapsed time.
AchievedGoal achieved · 4m · 9 turnsThe objective was completed and verified.
PausedGoal paused · out of turnsThe turn budget was exhausted before completion.
PausedGoal paused · couldn't verify completionCompletion claims were repeatedly rejected, or the check couldn't give an answer.
PausedGoal paused · no progressThree turns in a row had no successful tool call.
PausedGoal paused · 5 automatic continuations usedThe goal used all its automatic continuations.
IdleGoal idle · turn 7/100 · 2mA goal exists (e.g. after --resume) but the loop isn't running.

While a goal is active, the status line also surfaces the latest verification result when a completion claim was turned down.

In the CLI, a label at the bottom right of the input bar shows the current state: /goal: active, /goal: paused, /goal: idle or /goal: achieved. It's hidden when the session has no goal, and on terminals too narrow to fit it.

Run /goal clear to stop and remove the active goal:

  • If nothing is running, the goal is cleared immediately.
  • If a turn is in flight, Command Code finishes the current step and then stops (Goal cleared · finishing current step). You can also press Ctrl + C to interrupt and clear the goal.

Unlike setting a goal, /goal status and /goal clear both work mid-turn.

Set a goal

/goal get the entire test suite passing

Command Code starts working immediately, runs and re-runs the tests, fixes failures, and only declares the goal complete once the suite passes and the evidence is verified. If it stops to ask you something first, reply and it carries on.

Lower the budget

cmd --max-turns 20 /goal remove all unused exports in src/

The goal runs for at most 20 turns before pausing.