/goal command sets a completion condition that CodeBuddy continuously works toward without requiring step-by-step prompting from you. At the end of each turn, a small-fast model evaluator determines whether the condition is met. If not, CodeBuddy automatically starts the next turn instead of returning control to you. Once the condition is satisfied, the goal is automatically cleared./goal command requires that @tencent-ai/codebuddy-code already includes the goal feature (the GoalService module of agent-cli)./goal to track substantive work that has a verifiable end state:Method | When the Next Round Starts | When to Stop |
/goal | Starts immediately after the previous round ends. | The evaluator confirms that the condition is met. |
/loop | Triggered by time interval | You stop it manually or the model determines that the work is complete. |
Starts immediately after the previous round ends. | Your script or prompt determines it autonomously. |
/goal and Stop hook are triggered after each turn. /goal is a session-level shortcut: you enter a condition, and it takes effect only within the current session. Stop hook is written in settings and applies to all sessions within its scope, and it can run either deterministic scripts or model-evaluated prompts./goal/goal. If an active goal already exists, the new one replaces the old one (the old goal's hook is automatically unregistered)./goal all tests in test/auth pass and the lint step is clean
⊚ /goal active (Xs) indicator appears at the bottom right of the input box, refreshing the elapsed time every second so you always know that goal mode is active.isMeta=true, allowing the model to see the evaluator's perspective in the next turn and precisely address what is still missing. This is key to the model's ability to "know which steps remain."/goal clear. Run /goal (without parameters) to view statistics such as turns / tokens.test/auth pass" works because CodeBuddy runs the tests itself, and the results appear in the transcript for the evaluator to read.\\`npm test\\` exits 0 or \\`git status\\` is cleanor stop after 20 turns. CodeBuddy checks the current progress against this clause in each turn, and the evaluator can also read it from the conversation./goal without parameters:/goal
/goal clear
clear: stop, off, reset, none, and cancel. They are recognized as a clear command only when a single token matches exactly. /goal stop using deprecated API is still processed as "set a new condition" and is not swallowed./clear to restart the session also removes the active goal (hook unregistration + meta cleanup).--resume / --continue, any unfinished goal is restored (both condition and scope are recovered)./goal clear first and then run /goal <condition> again. Goals that have already been achieved or cleared are not restored (the meta has been deleted)./goal is available in both non-interactive mode (headless) and Remote Control. Setting a goal in -p mode makes the evaluator run in a loop until completion:codebuddy -p "/goal CHANGELOG.md has an entry for every PR merged this week"
Ctrl+C./goal is a wrapper around the session-level prompt-based Stop hook. Each time the CodeBuddy main agent completes a turn, the current condition + current conversation are sent together to a configured small-model evaluator. The evaluator returns a tri-state result of "yes / no / unreachable" along with a brief reason:ok: true): Clear the goal, record an "achieved" event, and the UI displays the ✔ Goal achieved status bar.ok: false): Inject the reason into the history as a user message with isMeta=true (so the main model can see what to supplement next), and let CodeBuddy continue working. Also write a goal-progress UI status bar: ◯ Goal not yet met... continuing.ok: false, impossible: true): Used by the evaluator to determine that "this goal is impossible to complete in the current session" (the conditions are contradictory, required capabilities/resources are unavailable, or the model has exhausted all reasonable attempts). Clear the goal immediately, and the UI displays ✕ Goal could not be achieved to avoid getting stuck in a loop.lite slot in the product configuration (mapped to gpt-5.1-codex-mini / gemini-2.5-flash / DeepSeek deepseek-v4-flash on different model providers). Evaluation only reads the existing transcript and does not call tools, so using a small model is both fast and cost-effective.createdAt (ISO 8601) into the evaluator's user prompt and explicitly instruct:Evaluate ONLY the conversation that happened AFTER this timestamp. Earlier messages MUST NOT be used as evidence.
{"ok": false, "reason": "Goal was just set; no work has been done yet against the new condition."}.goal-result / goal-progress (the goal's own UI status items)summary / topic / ai-title / custom-titlefile-history-snapshotUnknown item type warning.Action | Status | Remarks |
Set / Replace / kick-off | ✔ | Starts a round immediately after it is set. If an active goal already exists, it is automatically replaced. |
/goal clear alias | ✔ | Supports five single-token synonyms: stop / off / reset / none / cancel. |
/clear synchronously clears the active goal. | ✔ | When restarting a session, also unregister the goal hook and clear the meta. |
condition limit | ✔ | 4000 characters |
Feedback of reason into history. | ✔ | Injection format: Stop hook feedback: [<condition>]: <reason> |
Three-state semantics (ok / not-yet / impossible) | ✔ | When unreachable, clear the goal immediately to avoid invalid loops. |
evaluator uses the small model. | ✔ | Use the model bound to the lite slot (mapped separately by provider). |
/goal without parameters → status view | ✔ | TUI / Web UI panel + headless text fallback |
Continuous running indicator ⊚ /goal active (Xs) | ✔ | Constantly displays the running duration at the lower right of the input box, refreshing at 1 Hz. |
Reset turn / timer / token when --resume is used. | ✖ | Currently keeps the original createdAt / turnCount. To restart timing, run /goal clear first. |
/goal with -p in CI / scripts.Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback