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
- 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.
- It works across turns: Each model round-trip (one step in the agent's loop) counts as one turn against the goal's budget.
- 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).
- 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.
- 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.
A goal runs with a budget of model turns so an autonomous loop can't run indefinitely and use up all available credits.
| Setting | Value |
|---|---|
| Default budget | 100 turns |
| Maximum budget | 1000 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:
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:
| State | Example headline | Meaning |
|---|---|---|
| Active | Goal active · turn 7/100 · 2m | The loop is running; shows the in-flight turn, budget, and elapsed time. |
| Achieved | Goal achieved · 4m · 9 turns | The objective was completed and verified. |
| Paused | Goal paused · out of turns | The turn budget was exhausted before completion. |
| Paused | Goal paused · couldn't verify completion | Completion claims were repeatedly rejected, or the check couldn't give an answer. |
| Paused | Goal paused · no progress | Three turns in a row had no successful tool call. |
| Paused | Goal paused · 5 automatic continuations used | The goal used all its automatic continuations. |
| Idle | Goal idle · turn 7/100 · 2m | A 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 pressCtrl + Cto interrupt and clear the goal.
Unlike setting a goal, /goal status and /goal clear both work mid-turn.
Set a goal
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
The goal runs for at most 20 turns before pausing.
- Switch to Accept Edits Mode so a goal can run unattended
- Use checkpoints to rewind a goal run
- Re-check a goal on a schedule with
/loop - Join our Discord community for feedback, requests, and support.