Keep Claude working toward a goal
--- a/goal.md
+++ b/goal.md
@@ -67,7 +67,7 @@
### Resume with an active goal
-When you resume a session, Claude Code restores a goal that was still active when the session ended. Claude Code restores it on every resume route: `--continue`, `--resume` with a session ID, name, or [transcript file path](</docs/en/sessions#resume-a-session>), and the [session picker](</docs/en/sessions#use-the-session-picker>). Before v2.1.239, Claude Code restored the goal on every route except the `claude --resume` picker. Claude Code carries the condition over but resets the turn count, timer, and token-spend baseline. It doesn’t restore a goal that was already achieved or cleared.
+When you resume a session, Claude Code restores a goal that was still active when the session ended. Claude Code restores it on every resume route: `--continue`, `--resume` with a session ID, name, or [transcript file path](</docs/en/sessions#resume-a-session>), and the [session picker](</docs/en/sessions#use-the-session-picker>). Before v2.1.239, Claude Code restored the goal on every route except the `claude --resume` picker. The goal’s turn count and timer reset.
### Run non-interactively
--- a/goal.md
+++ b/goal.md
@@ -127,7 +127,7 @@
The evaluator runs on whichever provider your session is configured for. It does not call tools, so it can only judge what Claude has already surfaced in the conversation.
-Evaluation tokens are billed on the small fast model configured for your provider and are typically negligible compared to main-turn spend.
+Evaluation tokens are billed in addition to main-turn spend.
## Requirements
--- a/goal.md
+++ b/goal.md
@@ -12,7 +12,7 @@
Approach| Next turn starts when| Stops when
---|---|---
`/goal`| The previous turn finishes, or, in an interactive session, an idle check-in or an automatic retry comes due| A model confirms the condition is met or judges it impossible, or a turn fails on an error you have to fix, or you run `/goal clear`
-[`/loop`](</docs/en/scheduled-tasks#run-a-prompt-repeatedly-with-%2Floop>)| A time interval elapses| You stop it, or Claude decides the work is done
+[`/loop`](</docs/en/scheduled-tasks#run-a-prompt-repeatedly-with-%2Floop>)| A time interval elapses| You stop it, or [the loop ends on its own](</docs/en/scheduled-tasks#stop-a-loop>)
[Stop hook](</docs/en/hooks-guide#prompt-based-hooks>)| The previous turn finishes| Your own script or prompt decides
`/goal` and a Stop hook both fire after every turn. `/goal` is a session-scoped shortcut: you type a condition and it’s active for the current session only. A Stop hook lives in your settings file, applies to every session in its scope, and can run a script for deterministic checks or a prompt for model-evaluated ones. [Auto mode](</docs/en/auto-mode-config>) on its own approves tool calls within a single turn but doesn’t start a new one. Claude stops when it judges the work done. `/goal` adds a separate evaluator that checks your condition after every turn, so completion is decided by a fresh model rather than the one doing the work. The two are complementary: auto mode removes per-tool prompts, and `/goal` removes per-turn prompts.
Show diff (194 lines)
--- a/goal.md
+++ b/goal.md
@@ -5,11 +5,7 @@
* Splitting a large file into focused modules until each is under a size budget
* Working through a labeled issue backlog until the queue is empty
-##
-
-
-
-Compare ways to keep a session running
+## Compare ways to keep a session running
Three approaches keep the current session running between prompts. Pick based on what should start the next turn:
@@ -23,19 +19,11 @@
The approaches above keep the current session running. You can also schedule work that runs independent of any open session, such as nightly tests or morning triage. See [scheduling options](</docs/en/scheduled-tasks#compare-scheduling-options>) for cloud and Desktop scheduled tasks.
-##
-
-
-
-Use `/goal`
+## Use `/goal`
One goal can be active per session. The same command sets, checks, and clears it depending on the argument.
-###
-
-
-
-Set a goal
+### Set a goal
Run `/goal` followed by the condition you want satisfied. If a goal is already active, the new one replaces it.
@@ -43,11 +31,7 @@
Setting a goal starts a turn immediately, with the condition itself as the directive. You don’t need to send a separate prompt. While the goal is active, a `◎ /goal active` indicator shows how long the goal has been running. A goal doesn’t change your permission mode. To let goal turns run unattended, run `/goal` in [auto mode](</docs/en/auto-mode-config>). In [Manual mode](</docs/en/permission-modes>), Claude still asks before tool calls that your settings don’t already allow, such as the test command above. While the goal is active, the transcript shows each verdict the evaluator returns, and you can press Ctrl+O to see the reason behind it. The status view also shows the most recent reason, so you can see what Claude is working toward next.
-###
-
-
-
-Write an effective condition
+### Write an effective condition
The evaluator judges your condition against what Claude has surfaced in the conversation. It doesn’t run commands or read files independently, so write the condition as something Claude’s own output can demonstrate. “All tests in `test/auth` pass” works because Claude runs the tests and the result appears in the transcript for the evaluator to read. A condition that holds up across many turns usually has:
@@ -57,11 +41,7 @@
The condition can be up to 4,000 characters. To bound how long a goal runs, include a turn or time clause in the condition, such as `or stop after 20 turns`. Claude reports progress against that clause each turn and the evaluator judges it from the conversation.
-###
-
-
-
-Check status
+### Check status
Run `/goal` with no arguments to see the current state.
@@ -77,11 +57,7 @@
The turn count and the most recent reason appear after the first evaluation has run. If no goal is active but one was achieved earlier in the session, the status shows the achieved condition along with its duration, turn count, and token spend.
-###
-
-
-
-Clear a goal
+### Clear a goal
Run `/goal clear` to remove an active goal before it resolves.
@@ -89,19 +65,11 @@
Claude prints `Goal cleared:` followed by the condition to confirm, or `No goal set` if nothing was active. `stop`, `off`, `reset`, `none`, and `cancel` are accepted as aliases for `clear`. Running `/clear` to start a new conversation also removes any active goal.
-###
-
-
-
-Resume with an active goal
+### Resume with an active goal
When you resume a session, Claude Code restores a goal that was still active when the session ended. Claude Code restores it on every resume route: `--continue`, `--resume` with a session ID, name, or [transcript file path](</docs/en/sessions#resume-a-session>), and the [session picker](</docs/en/sessions#use-the-session-picker>). Before v2.1.239, Claude Code restored the goal on every route except the `claude --resume` picker. Claude Code carries the condition over but resets the turn count, timer, and token-spend baseline. It doesn’t restore a goal that was already achieved or cleared.
-###
-
-
-
-Run non-interactively
+### Run non-interactively
`/goal` works in [non-interactive mode](</docs/en/headless>), in the [desktop app](</docs/en/desktop>), and through [Remote Control](</docs/en/remote-control>). Setting a goal with `-p` runs the loop to completion in a single invocation:
@@ -109,11 +77,7 @@
With the default text output, Claude’s final response prints when the loop ends, so a goal that runs many turns can look stuck. Add `--output-format stream-json --verbose` to emit each message as the loop runs. Interrupt the process with Ctrl+C to stop a non-interactive goal before it resolves.
-##
-
-
-
-How evaluation works
+## How evaluation works
`/goal` is a wrapper around a session-scoped [prompt-based Stop hook](</docs/en/hooks#prompt-based-hooks>). Each time Claude finishes a turn, Claude Code sends the condition and the conversation so far to your configured [small fast model](</docs/en/model-config>). The model returns one of three verdicts, each with a short reason:
@@ -123,19 +87,11 @@
If Claude keeps answering the evaluator without making progress (no tool use for several turns in a row), Claude Code stops the loop, prints a warning, and returns control to you with the goal still set. Evaluation resumes after your next prompt. The [hooks guide](</docs/en/hooks-guide#stop-hook-hits-the-block-cap>) explains the underlying mechanism.
-###
-
-
-
-When a turn fails
+### When a turn fails
When a turn fails, Claude Code clears the goal if the error is one you have to fix. After any other error the goal stays set.
-####
-
-
-
-Errors you have to fix clear the goal
+#### Errors you have to fix clear the goal
If a turn fails on an error that won’t clear until you fix it, Claude Code clears the goal and prints a warning naming the cause. The warning starts with `Goal cleared after an unrecoverable error` and ends with `Run /goal again to continue`. Fix the cause, then set the goal again with `/goal <condition>`. Failures that clear the goal include:
@@ -145,11 +101,7 @@
* A context overflow that [auto-compaction](</docs/en/model-config#set-the-auto-compact-window>) couldn’t clear
* A model that isn’t available
-####
-
-
-
-Other errors retry or pause the goal
+#### Other errors retry or pause the goal
After any other failure the goal stays set. In an interactive session on Claude Code v2.1.269 or later, Claude Code also prints a line naming the cause and either retries on its own or waits for you:
@@ -158,11 +110,7 @@
Send a message at any time to start the next turn immediately. To turn automatic retries off, set [`CLAUDE_CODE_GOAL_CHECKIN_MINUTES`](</docs/en/env-vars>) to `0`, which also turns check-ins off.
-###
-
-
-
-Background work defers evaluation
+### Background work defers evaluation
If a subagent or a background shell command is still running when a turn ends, Claude Code skips the evaluation for that turn. It evaluates at the end of the next turn that finishes with no background work running. When the background work finishes, Claude Code delivers the result to Claude as a new turn, so you don’t have to prompt. Once background work has kept the goal waiting for 30 minutes, a check-in is due. In the check-in, Claude Code lists the running tasks and asks Claude to read their output, keep waiting if they’re progressing, and fix or stop any that are stuck. After the first check-in, Claude Code waits twice as long before each later check-in, up to four times the first interval: with the default, 1 hour after the first check-in, then every 2 hours. Claude Code delivers a due check-in, the first one included, in one of two ways:
@@ -171,11 +119,7 @@
Before v2.1.239, only idle check-ins backed off this way; a check-in delivered at a turn end recurred at the first interval. To change the first interval, set [`CLAUDE_CODE_GOAL_CHECKIN_MINUTES`](</docs/en/env-vars>). Claude Code uses your value in place of the 30-minute interval and scales the later intervals with it. Set it to `0` to turn off check-ins and automatic retries. Check-ins require Claude Code v2.1.234 or later.
-###
-
-
-
-Evaluation model and cost
+### Evaluation model and cost
To evaluate on a different model, set [`ANTHROPIC_DEFAULT_HAIKU_MODEL`](</docs/en/model-config#environment-variables>).
@@ -185,19 +129,11 @@
Evaluation tokens are billed on the small fast model configured for your provider and are typically negligible compared to main-turn spend.
-##
-
-
-
-Requirements
+## Requirements
Claude Code makes `/goal` available under the same [workspace trust rule as hooks in settings files](</docs/en/permissions#what-runs-before-you-trust-a-folder>), because the evaluator is part of the hooks system. `/goal` is also unavailable when [`disableAllHooks`](</docs/en/hooks#disable-or-remove-hooks>) is `true` after settings precedence applies, or when [`allowManagedHooksOnly`](</docs/en/settings-reference#allowmanagedhooksonly>) is set in managed settings.
-##
-
-
-
-See also
+## See also
* [Run a prompt repeatedly with `/loop`](</docs/en/scheduled-tasks#run-a-prompt-repeatedly-with-%2Floop>): re-run on a time interval instead of toward a condition
* [Prompt-based hooks](</docs/en/hooks-guide#prompt-based-hooks>): write your own Stop hook when you need custom evaluation logic
--- a/goal.md
+++ b/goal.md
@@ -137,9 +137,10 @@
Errors you have to fix clear the goal
-If a turn fails on an error that won’t clear until you fix it, Claude Code clears the goal and prints a warning naming the cause. The warning starts with `Goal cleared after an unrecoverable error` and ends with `Run /goal again to continue`. Fix the cause, then set the goal again with `/goal <condition>`. Four kinds of failure clear the goal:
+If a turn fails on an error that won’t clear until you fix it, Claude Code clears the goal and prints a warning naming the cause. The warning starts with `Goal cleared after an unrecoverable error` and ends with `Run /goal again to continue`. Fix the cause, then set the goal again with `/goal <condition>`. Failures that clear the goal include:
* An authentication failure, when Claude Code manages its own credentials. When a host manages them for you, such as the desktop app or a [cloud session](</docs/en/claude-code-on-the-web>), Claude Code leaves the goal active because the host restores access on its own.
+ * A disk too full for Claude Code to renew your claude.ai login, when Claude Code manages its own credentials. The warning shows `(disk full)`. [Free space on the disk holding the Claude Code config directory](</docs/en/errors#could-not-refresh-your-login-disk-full>).
* An exhausted credit balance
* A context overflow that [auto-compaction](</docs/en/model-config#set-the-auto-compact-window>) couldn’t clear
* A model that isn’t available
--- a/goal.md
+++ b/goal.md
@@ -190,7 +190,7 @@
Requirements
-Claude Code makes `/goal` available under the same [workspace trust rule as hooks in settings files](</docs/en/permissions#what-runs-before-you-trust-a-folder>), because the evaluator is part of the hooks system. `/goal` is also unavailable when [`disableAllHooks`](</docs/en/hooks#disable-or-remove-hooks>) is `true` after settings precedence applies, or when [`allowManagedHooksOnly`](</docs/en/settings-reference#allowmanagedhooksonly>) is set in managed settings. In each case, the command tells you why instead of silently doing nothing.
+Claude Code makes `/goal` available under the same [workspace trust rule as hooks in settings files](</docs/en/permissions#what-runs-before-you-trust-a-folder>), because the evaluator is part of the hooks system. `/goal` is also unavailable when [`disableAllHooks`](</docs/en/hooks#disable-or-remove-hooks>) is `true` after settings precedence applies, or when [`allowManagedHooksOnly`](</docs/en/settings-reference#allowmanagedhooksonly>) is set in managed settings.
##
--- a/goal.md
+++ b/goal.md
@@ -178,7 +178,7 @@
To evaluate on a different model, set [`ANTHROPIC_DEFAULT_HAIKU_MODEL`](</docs/en/model-config#environment-variables>).
-Claude Code reads `ANTHROPIC_DEFAULT_HAIKU_MODEL` everywhere it uses the small fast model, not only for `/goal` evaluation. When you set it, Claude Code also resolves the [`haiku` alias](</docs/en/model-config#model-aliases>) to that model and runs [background functionality](</docs/en/costs#background-token-usage>), such as conversation summarization, on it.
+Claude Code reads `ANTHROPIC_DEFAULT_HAIKU_MODEL` everywhere it uses the small fast model, not only for `/goal` evaluation. When you set it, Claude Code also resolves the [`haiku` alias](</docs/en/model-config#model-aliases>) to that model and runs session title generation and some other background tasks on it.
The evaluator runs on whichever provider your session is configured for. It does not call tools, so it can only judge what Claude has already surfaced in the conversation.
--- a/goal.md
+++ b/goal.md
@@ -21,7 +21,7 @@
`/goal` and a Stop hook both fire after every turn. `/goal` is a session-scoped shortcut: you type a condition and it’s active for the current session only. A Stop hook lives in your settings file, applies to every session in its scope, and can run a script for deterministic checks or a prompt for model-evaluated ones. [Auto mode](</docs/en/auto-mode-config>) on its own approves tool calls within a single turn but doesn’t start a new one. Claude stops when it judges the work done. `/goal` adds a separate evaluator that checks your condition after every turn, so completion is decided by a fresh model rather than the one doing the work. The two are complementary: auto mode removes per-tool prompts, and `/goal` removes per-turn prompts.
-The approaches above keep the current session running. You can also schedule work that runs independent of any open session, such as nightly tests or morning triage. See [scheduling options](</docs/en/scheduled-tasks#compare-scheduling-options>) for cloud routines and desktop scheduled tasks.
+The approaches above keep the current session running. You can also schedule work that runs independent of any open session, such as nightly tests or morning triage. See [scheduling options](</docs/en/scheduled-tasks#compare-scheduling-options>) for cloud and Desktop scheduled tasks.
##
--- a/goal.md
+++ b/goal.md
@@ -107,7 +107,7 @@
claude -p "/goal CHANGELOG.md has an entry for every PR merged this week"
-With the default text output, nothing prints until the run ends, so a goal that runs many turns can look stuck. Add `--output-format stream-json --verbose` to emit each message as the loop runs. Interrupt the process with Ctrl+C to stop a non-interactive goal before it resolves.
+With the default text output, Claude’s final response prints when the loop ends, so a goal that runs many turns can look stuck. Add `--output-format stream-json --verbose` to emit each message as the loop runs. Interrupt the process with Ctrl+C to stop a non-interactive goal before it resolves.
##
--- a/goal.md
+++ b/goal.md
@@ -1,4 +1,4 @@
-The `/goal` command sets a completion condition and Claude keeps working toward it without you prompting each step. After each turn, a small fast model checks whether the condition holds. If the model judges it not yet met, Claude starts another turn instead of returning control to you. The goal clears automatically once the condition is met, if the model judges the condition impossible to satisfy, or if a turn fails on an error you have to fix. Use a goal for substantial work with a verifiable end state:
+The `/goal` command sets a completion condition and Claude keeps working toward it without you prompting each step. After each turn, a model checks whether the condition holds. If the model judges it not yet met, Claude starts another turn instead of returning control to you. The goal clears automatically once the condition is met, if the model judges the condition impossible to satisfy, or if a turn fails on an error you have to fix. Use a goal for substantial work with a verifiable end state:
* Migrating a module to a new API until every call site compiles and tests pass
* Implementing a design doc until all acceptance criteria hold
@@ -115,7 +115,7 @@
How evaluation works
-`/goal` is a wrapper around a session-scoped [prompt-based Stop hook](</docs/en/hooks#prompt-based-hooks>). Each time Claude finishes a turn, Claude Code sends the condition and the conversation so far to your configured [small fast model](</docs/en/model-config>), which defaults to Haiku on the Claude API; on a third-party provider, check your [provider page](</docs/en/third-party-integrations>) for the platform’s default. The model returns one of three verdicts, each with a short reason:
+`/goal` is a wrapper around a session-scoped [prompt-based Stop hook](</docs/en/hooks#prompt-based-hooks>). Each time Claude finishes a turn, Claude Code sends the condition and the conversation so far to your configured [small fast model](</docs/en/model-config>). The model returns one of three verdicts, each with a short reason:
* **Not yet met** : Claude keeps working and takes the reason as guidance for the next turn.
* **Met** : Claude Code clears the goal and records an achieved entry in the transcript.
--- a/goal.md
+++ b/goal.md
@@ -139,7 +139,7 @@
If a turn fails on an error that won’t clear until you fix it, Claude Code clears the goal and prints a warning naming the cause. The warning starts with `Goal cleared after an unrecoverable error` and ends with `Run /goal again to continue`. Fix the cause, then set the goal again with `/goal <condition>`. Four kinds of failure clear the goal:
- * An authentication failure, when Claude Code manages its own credentials. When a host manages them for you, such as the desktop app, the VS Code extension, or a [cloud session](</docs/en/claude-code-on-the-web>), Claude Code leaves the goal active because the host restores access on its own.
+ * An authentication failure, when Claude Code manages its own credentials. When a host manages them for you, such as the desktop app or a [cloud session](</docs/en/claude-code-on-the-web>), Claude Code leaves the goal active because the host restores access on its own.
* An exhausted credit balance
* A context overflow that [auto-compaction](</docs/en/model-config#set-the-auto-compact-window>) couldn’t clear
* A model that isn’t available
--- a/goal.md
+++ b/goal.md
@@ -49,7 +49,7 @@
Write an effective condition
-The evaluator judges your condition against what Claude has surfaced in the conversation. It doesn’t run commands or read files independently, so write the condition as something Claude’s own output can demonstrate. “All tests in `test/auth` pass” works because Claude runs the tests and the result lands in the transcript for the evaluator to read. A condition that holds up across many turns usually has:
+The evaluator judges your condition against what Claude has surfaced in the conversation. It doesn’t run commands or read files independently, so write the condition as something Claude’s own output can demonstrate. “All tests in `test/auth` pass” works because Claude runs the tests and the result appears in the transcript for the evaluator to read. A condition that holds up across many turns usually has:
* **One measurable end state** : a test result, a build exit code, a file count, an empty queue
* **A stated check** : how Claude should prove it, such as “`npm test` exits 0” or “`git status` is clean”
--- a/goal.md
+++ b/goal.md
@@ -15,7 +15,7 @@
Approach| Next turn starts when| Stops when
---|---|---
-`/goal`| The previous turn finishes, or an idle check-in comes due while background work keeps the goal waiting, up to three times per goal between your prompts| A model confirms the condition is met or judges it impossible, or a turn fails on an error you have to fix, or you run `/goal clear`
+`/goal`| The previous turn finishes, or, in an interactive session, an idle check-in or an automatic retry comes due| A model confirms the condition is met or judges it impossible, or a turn fails on an error you have to fix, or you run `/goal clear`
[`/loop`](</docs/en/scheduled-tasks#run-a-prompt-repeatedly-with-%2Floop>)| A time interval elapses| You stop it, or Claude decides the work is done
[Stop hook](</docs/en/hooks-guide#prompt-based-hooks>)| The previous turn finishes| Your own script or prompt decides
@@ -127,6 +127,14 @@
+When a turn fails
+
+When a turn fails, Claude Code clears the goal if the error is one you have to fix. After any other error the goal stays set.
+
+####
+
+
+
Errors you have to fix clear the goal
If a turn fails on an error that won’t clear until you fix it, Claude Code clears the goal and prints a warning naming the cause. The warning starts with `Goal cleared after an unrecoverable error` and ends with `Run /goal again to continue`. Fix the cause, then set the goal again with `/goal <condition>`. Four kinds of failure clear the goal:
@@ -136,7 +144,18 @@
* A context overflow that [auto-compaction](</docs/en/model-config#set-the-auto-compact-window>) couldn’t clear
* A model that isn’t available
-After any other failure, including transient errors such as rate limits and overloaded servers, Claude Code leaves the goal active.
+####
+
+
+
+Other errors retry or pause the goal
+
+After any other failure the goal stays set. In an interactive session on Claude Code v2.1.269 or later, Claude Code also prints a line naming the cause and either retries on its own or waits for you:
+
+ * **Retry** : after a failure that tends to clear on its own, such as an overloaded server or a dropped connection, a notice starting with `Goal still active` shows the wait before the next attempt. After three automatic retries, the goal pauses instead.
+ * **Pause** : after a failure that a retry would only repeat, such as an API rate limit, a claude.ai [usage limit](</docs/en/errors#youve-hit-your-session-limit>), or a hook that ended the turn, a notice starting with `Goal paused` names the cause. If the session is [waiting to continue automatically when a usage limit resets](</docs/en/interactive-mode#wait-for-a-usage-limit-to-reset>), Claude resumes work toward the goal then.
+
+Send a message at any time to start the next turn immediately. To turn automatic retries off, set [`CLAUDE_CODE_GOAL_CHECKIN_MINUTES`](</docs/en/env-vars>) to `0`, which also turns check-ins off.
###
@@ -149,7 +168,7 @@
* **When a turn ends** : Claude Code delivers the check-in at the end of the next turn that finishes with the work still running. In a non-interactive session, such as one started with `-p`, this is the only way Claude Code delivers check-ins.
* **While the session is idle** : in an interactive session, Claude Code also starts a turn on its own to deliver the check-in instead of waiting for your next prompt. If the background work has stopped without reporting a result, Claude Code asks Claude to continue toward the goal. Claude Code starts at most three idle check-ins per goal between your prompts. In the third idle check-in, Claude Code says that idle check-ins are paused until you send another prompt. Before v2.1.246, idle check-ins were uncapped. Idle check-ins require Claude Code v2.1.236 or later.
-Before v2.1.239, only idle check-ins backed off this way; a check-in delivered at a turn end recurred at the first interval. To change the first interval, set [`CLAUDE_CODE_GOAL_CHECKIN_MINUTES`](</docs/en/env-vars>). Claude Code uses your value in place of the 30-minute interval and scales the later intervals with it. Set it to `0` to turn check-ins off. Check-ins require Claude Code v2.1.234 or later.
+Before v2.1.239, only idle check-ins backed off this way; a check-in delivered at a turn end recurred at the first interval. To change the first interval, set [`CLAUDE_CODE_GOAL_CHECKIN_MINUTES`](</docs/en/env-vars>). Claude Code uses your value in place of the 30-minute interval and scales the later intervals with it. Set it to `0` to turn off check-ins and automatic retries. Check-ins require Claude Code v2.1.234 or later.
###
--- a/goal.md
+++ b/goal.md
@@ -95,7 +95,7 @@
Resume with an active goal
-When you resume a session, Claude Code restores a goal that was still active when the session ended. Claude Code restores it on every resume route: `--continue`, `--resume` with a session ID or name, and the [session picker](</docs/en/sessions#use-the-session-picker>). Before v2.1.239, Claude Code restored the goal on every route except the `claude --resume` picker. Claude Code carries the condition over but resets the turn count, timer, and token-spend baseline. It doesn’t restore a goal that was already achieved or cleared.
+When you resume a session, Claude Code restores a goal that was still active when the session ended. Claude Code restores it on every resume route: `--continue`, `--resume` with a session ID, name, or [transcript file path](</docs/en/sessions#resume-a-session>), and the [session picker](</docs/en/sessions#use-the-session-picker>). Before v2.1.239, Claude Code restored the goal on every route except the `claude --resume` picker. Claude Code carries the condition over but resets the turn count, timer, and token-spend baseline. It doesn’t restore a goal that was already achieved or cleared.
###
--- a/goal.md
+++ b/goal.md
@@ -15,7 +15,7 @@
Approach| Next turn starts when| Stops when
---|---|---
-`/goal`| The previous turn finishes, or an idle check-in comes due while background work keeps the goal waiting| A model confirms the condition is met or judges it impossible, or a turn fails on an error you have to fix, or you run `/goal clear`
+`/goal`| The previous turn finishes, or an idle check-in comes due while background work keeps the goal waiting, up to three times per goal between your prompts| A model confirms the condition is met or judges it impossible, or a turn fails on an error you have to fix, or you run `/goal clear`
[`/loop`](</docs/en/scheduled-tasks#run-a-prompt-repeatedly-with-%2Floop>)| A time interval elapses| You stop it, or Claude decides the work is done
[Stop hook](</docs/en/hooks-guide#prompt-based-hooks>)| The previous turn finishes| Your own script or prompt decides
@@ -147,7 +147,7 @@
If a subagent or a background shell command is still running when a turn ends, Claude Code skips the evaluation for that turn. It evaluates at the end of the next turn that finishes with no background work running. When the background work finishes, Claude Code delivers the result to Claude as a new turn, so you don’t have to prompt. Once background work has kept the goal waiting for 30 minutes, a check-in is due. In the check-in, Claude Code lists the running tasks and asks Claude to read their output, keep waiting if they’re progressing, and fix or stop any that are stuck. After the first check-in, Claude Code waits twice as long before each later check-in, up to four times the first interval: with the default, 1 hour after the first check-in, then every 2 hours. Claude Code delivers a due check-in, the first one included, in one of two ways:
* **When a turn ends** : Claude Code delivers the check-in at the end of the next turn that finishes with the work still running. In a non-interactive session, such as one started with `-p`, this is the only way Claude Code delivers check-ins.
- * **While the session is idle** : in an interactive session, Claude Code also starts a turn on its own to deliver the check-in instead of waiting for your next prompt. If the background work has stopped without reporting a result, Claude Code asks Claude to continue toward the goal. Idle check-ins require Claude Code v2.1.236 or later.
+ * **While the session is idle** : in an interactive session, Claude Code also starts a turn on its own to deliver the check-in instead of waiting for your next prompt. If the background work has stopped without reporting a result, Claude Code asks Claude to continue toward the goal. Claude Code starts at most three idle check-ins per goal between your prompts. In the third idle check-in, Claude Code says that idle check-ins are paused until you send another prompt. Before v2.1.246, idle check-ins were uncapped. Idle check-ins require Claude Code v2.1.236 or later.
Before v2.1.239, only idle check-ins backed off this way; a check-in delivered at a turn end recurred at the first interval. To change the first interval, set [`CLAUDE_CODE_GOAL_CHECKIN_MINUTES`](</docs/en/env-vars>). Claude Code uses your value in place of the 30-minute interval and scales the later intervals with it. Set it to `0` to turn check-ins off. Check-ins require Claude Code v2.1.234 or later.
--- a/goal.md
+++ b/goal.md
@@ -95,7 +95,7 @@
Resume with an active goal
-A goal that was still active when a session ended is restored when you resume that session with `--resume` or `--continue`. The condition carries over, but the turn count, timer, and token-spend baseline all reset on resume. A goal that was already achieved or cleared is not restored.
+When you resume a session, Claude Code restores a goal that was still active when the session ended. Claude Code restores it on every resume route: `--continue`, `--resume` with a session ID or name, and the [session picker](</docs/en/sessions#use-the-session-picker>). Before v2.1.239, Claude Code restored the goal on every route except the `claude --resume` picker. Claude Code carries the condition over but resets the turn count, timer, and token-spend baseline. It doesn’t restore a goal that was already achieved or cleared.
###
@@ -144,12 +144,12 @@
Background work defers evaluation
-If a subagent or a background shell command is still running when a turn ends, Claude Code skips the evaluation for that turn. It evaluates at the end of the next turn that finishes with no background work running. When the background work finishes, Claude Code delivers the result to Claude as a new turn, so you don’t have to prompt. Once background work has kept the goal waiting for 30 minutes, a check-in is due. In the check-in, Claude Code lists the running tasks and asks Claude to read their output, keep waiting if they’re progressing, and fix or stop any that are stuck. After each check-in, the 30 minutes start again. Claude Code delivers a due check-in, the first one included, in one of two ways:
+If a subagent or a background shell command is still running when a turn ends, Claude Code skips the evaluation for that turn. It evaluates at the end of the next turn that finishes with no background work running. When the background work finishes, Claude Code delivers the result to Claude as a new turn, so you don’t have to prompt. Once background work has kept the goal waiting for 30 minutes, a check-in is due. In the check-in, Claude Code lists the running tasks and asks Claude to read their output, keep waiting if they’re progressing, and fix or stop any that are stuck. After the first check-in, Claude Code waits twice as long before each later check-in, up to four times the first interval: with the default, 1 hour after the first check-in, then every 2 hours. Claude Code delivers a due check-in, the first one included, in one of two ways:
* **When a turn ends** : Claude Code delivers the check-in at the end of the next turn that finishes with the work still running. In a non-interactive session, such as one started with `-p`, this is the only way Claude Code delivers check-ins.
- * **While the session is idle** : in an interactive session, Claude Code also starts a turn on its own to deliver the check-in instead of waiting for your next prompt. After the first check-in, Claude Code waits twice as long before each later idle check-in, up to four times the interval: with the default, 1 hour after the first check-in, then every 2 hours. If the background work has stopped without reporting a result, Claude Code asks Claude to continue toward the goal. Idle check-ins require Claude Code v2.1.236 or later.
+ * **While the session is idle** : in an interactive session, Claude Code also starts a turn on its own to deliver the check-in instead of waiting for your next prompt. If the background work has stopped without reporting a result, Claude Code asks Claude to continue toward the goal. Idle check-ins require Claude Code v2.1.236 or later.
-To change the intervals, set [`CLAUDE_CODE_GOAL_CHECKIN_MINUTES`](</docs/en/env-vars>). Claude Code uses your value in place of the 30-minute interval and scales the idle intervals with it. Set it to `0` to turn check-ins off. Check-ins require Claude Code v2.1.234 or later.
+Before v2.1.239, only idle check-ins backed off this way; a check-in delivered at a turn end recurred at the first interval. To change the first interval, set [`CLAUDE_CODE_GOAL_CHECKIN_MINUTES`](</docs/en/env-vars>). Claude Code uses your value in place of the 30-minute interval and scales the later intervals with it. Set it to `0` to turn check-ins off. Check-ins require Claude Code v2.1.234 or later.
###
@@ -171,7 +171,7 @@
Requirements
-Claude Code makes `/goal` available under the same [workspace trust rule as hooks in settings files](</docs/en/permissions#what-runs-before-you-trust-a-folder>), because the evaluator is part of the hooks system. `/goal` is also unavailable when [`disableAllHooks`](</docs/en/hooks#disable-or-remove-hooks>) is `true` after settings precedence applies, or when [`allowManagedHooksOnly`](</docs/en/settings#hook-configuration>) is set in managed settings. In each case, the command tells you why instead of silently doing nothing.
+Claude Code makes `/goal` available under the same [workspace trust rule as hooks in settings files](</docs/en/permissions#what-runs-before-you-trust-a-folder>), because the evaluator is part of the hooks system. `/goal` is also unavailable when [`disableAllHooks`](</docs/en/hooks#disable-or-remove-hooks>) is `true` after settings precedence applies, or when [`allowManagedHooksOnly`](</docs/en/settings-reference#allowmanagedhooksonly>) is set in managed settings. In each case, the command tells you why instead of silently doing nothing.
##
--- a/goal.md
+++ b/goal.md
@@ -15,7 +15,7 @@
Approach| Next turn starts when| Stops when
---|---|---
-`/goal`| The previous turn finishes| A model confirms the condition is met or judges it impossible, or a turn fails on an error you have to fix, or you run `/goal clear`
+`/goal`| The previous turn finishes, or an idle check-in comes due while background work keeps the goal waiting| A model confirms the condition is met or judges it impossible, or a turn fails on an error you have to fix, or you run `/goal clear`
[`/loop`](</docs/en/scheduled-tasks#run-a-prompt-repeatedly-with-%2Floop>)| A time interval elapses| You stop it, or Claude decides the work is done
[Stop hook](</docs/en/hooks-guide#prompt-based-hooks>)| The previous turn finishes| Your own script or prompt decides
@@ -144,7 +144,12 @@
Background work defers evaluation
-If a subagent or a background shell command is still running when a turn ends, Claude Code skips the evaluation for that turn. It evaluates at the end of the next turn that finishes with no background work running. When the background work finishes, Claude Code delivers the result to Claude as a new turn, so you don’t have to prompt. When a turn ends and background work has kept the goal waiting for 30 minutes or more, Claude Code asks Claude to check on that work. Claude Code lists the running tasks and asks Claude to read their output, keep waiting if they’re progressing, and fix or stop any that are stuck. After each further 30 minutes of waiting, Claude Code asks again at the next turn end. To change the interval, set [`CLAUDE_CODE_GOAL_CHECKIN_MINUTES`](</docs/en/env-vars>); set it to `0` to turn check-ins off. Check-ins require Claude Code v2.1.234 or later.
+If a subagent or a background shell command is still running when a turn ends, Claude Code skips the evaluation for that turn. It evaluates at the end of the next turn that finishes with no background work running. When the background work finishes, Claude Code delivers the result to Claude as a new turn, so you don’t have to prompt. Once background work has kept the goal waiting for 30 minutes, a check-in is due. In the check-in, Claude Code lists the running tasks and asks Claude to read their output, keep waiting if they’re progressing, and fix or stop any that are stuck. After each check-in, the 30 minutes start again. Claude Code delivers a due check-in, the first one included, in one of two ways:
+
+ * **When a turn ends** : Claude Code delivers the check-in at the end of the next turn that finishes with the work still running. In a non-interactive session, such as one started with `-p`, this is the only way Claude Code delivers check-ins.
+ * **While the session is idle** : in an interactive session, Claude Code also starts a turn on its own to deliver the check-in instead of waiting for your next prompt. After the first check-in, Claude Code waits twice as long before each later idle check-in, up to four times the interval: with the default, 1 hour after the first check-in, then every 2 hours. If the background work has stopped without reporting a result, Claude Code asks Claude to continue toward the goal. Idle check-ins require Claude Code v2.1.236 or later.
+
+To change the intervals, set [`CLAUDE_CODE_GOAL_CHECKIN_MINUTES`](</docs/en/env-vars>). Claude Code uses your value in place of the 30-minute interval and scales the idle intervals with it. Set it to `0` to turn check-ins off. Check-ins require Claude Code v2.1.234 or later.
###
--- a/goal.md
+++ b/goal.md
@@ -1,4 +1,4 @@
-The `/goal` command sets a completion condition and Claude keeps working toward it without you prompting each step. After each turn, a small fast model checks whether the condition holds. If the model judges it not yet met, Claude starts another turn instead of returning control to you. The goal clears automatically once the condition is met, or if the model judges the condition impossible to satisfy. Use a goal for substantial work with a verifiable end state:
+The `/goal` command sets a completion condition and Claude keeps working toward it without you prompting each step. After each turn, a small fast model checks whether the condition holds. If the model judges it not yet met, Claude starts another turn instead of returning control to you. The goal clears automatically once the condition is met, if the model judges the condition impossible to satisfy, or if a turn fails on an error you have to fix. Use a goal for substantial work with a verifiable end state:
* Migrating a module to a new API until every call site compiles and tests pass
* Implementing a design doc until all acceptance criteria hold
@@ -15,7 +15,7 @@
Approach| Next turn starts when| Stops when
---|---|---
-`/goal`| The previous turn finishes| A model confirms the condition is met or judges it impossible
+`/goal`| The previous turn finishes| A model confirms the condition is met or judges it impossible, or a turn fails on an error you have to fix, or you run `/goal clear`
[`/loop`](</docs/en/scheduled-tasks#run-a-prompt-repeatedly-with-%2Floop>)| A time interval elapses| You stop it, or Claude decides the work is done
[Stop hook](</docs/en/hooks-guide#prompt-based-hooks>)| The previous turn finishes| Your own script or prompt decides
@@ -121,7 +121,38 @@
* **Met** : Claude Code clears the goal and records an achieved entry in the transcript.
* **Impossible** : the evaluator judged that the condition can never be satisfied. Claude Code clears the goal and records a failed entry in the transcript along with the reason. You don’t need to clear it yourself.
-If Claude keeps answering the evaluator without making progress (no tool use for several turns in a row), Claude Code stops the loop, prints a warning, and returns control to you with the goal still set. Evaluation resumes after your next prompt. The [hooks guide](</docs/en/hooks-guide#stop-hook-hits-the-block-cap>) explains the underlying mechanism. If a subagent or a background shell command is still running when a turn ends, Claude Code skips the evaluation for that turn and evaluates when the next turn ends. To evaluate on a different model, set [`ANTHROPIC_DEFAULT_HAIKU_MODEL`](</docs/en/model-config#environment-variables>).
+If Claude keeps answering the evaluator without making progress (no tool use for several turns in a row), Claude Code stops the loop, prints a warning, and returns control to you with the goal still set. Evaluation resumes after your next prompt. The [hooks guide](</docs/en/hooks-guide#stop-hook-hits-the-block-cap>) explains the underlying mechanism.
+
+###
+
+
+
+Errors you have to fix clear the goal
+
+If a turn fails on an error that won’t clear until you fix it, Claude Code clears the goal and prints a warning naming the cause. The warning starts with `Goal cleared after an unrecoverable error` and ends with `Run /goal again to continue`. Fix the cause, then set the goal again with `/goal <condition>`. Four kinds of failure clear the goal:
+
+ * An authentication failure, when Claude Code manages its own credentials. When a host manages them for you, such as the desktop app, the VS Code extension, or a [cloud session](</docs/en/claude-code-on-the-web>), Claude Code leaves the goal active because the host restores access on its own.
+ * An exhausted credit balance
+ * A context overflow that [auto-compaction](</docs/en/model-config#set-the-auto-compact-window>) couldn’t clear
+ * A model that isn’t available
+
+After any other failure, including transient errors such as rate limits and overloaded servers, Claude Code leaves the goal active.
+
+###
+
+
+
+Background work defers evaluation
+
+If a subagent or a background shell command is still running when a turn ends, Claude Code skips the evaluation for that turn. It evaluates at the end of the next turn that finishes with no background work running. When the background work finishes, Claude Code delivers the result to Claude as a new turn, so you don’t have to prompt. When a turn ends and background work has kept the goal waiting for 30 minutes or more, Claude Code asks Claude to check on that work. Claude Code lists the running tasks and asks Claude to read their output, keep waiting if they’re progressing, and fix or stop any that are stuck. After each further 30 minutes of waiting, Claude Code asks again at the next turn end. To change the interval, set [`CLAUDE_CODE_GOAL_CHECKIN_MINUTES`](</docs/en/env-vars>); set it to `0` to turn check-ins off. Check-ins require Claude Code v2.1.234 or later.
+
+###
+
+
+
+Evaluation model and cost
+
+To evaluate on a different model, set [`ANTHROPIC_DEFAULT_HAIKU_MODEL`](</docs/en/model-config#environment-variables>).
Claude Code reads `ANTHROPIC_DEFAULT_HAIKU_MODEL` everywhere it uses the small fast model, not only for `/goal` evaluation. When you set it, Claude Code also resolves the [`haiku` alias](</docs/en/model-config#model-aliases>) to that model and runs [background functionality](</docs/en/costs#background-token-usage>), such as conversation summarization, on it.
--- a/goal.md
+++ b/goal.md
@@ -1,4 +1,4 @@
-The `/goal` command sets a completion condition and Claude keeps working toward it without you prompting each step. After each turn, a small fast model checks whether the condition holds. If not, Claude starts another turn instead of returning control to you. The goal clears automatically once the condition is met. Use a goal for substantial work with a verifiable end state:
+The `/goal` command sets a completion condition and Claude keeps working toward it without you prompting each step. After each turn, a small fast model checks whether the condition holds. If the model judges it not yet met, Claude starts another turn instead of returning control to you. The goal clears automatically once the condition is met, or if the model judges the condition impossible to satisfy. Use a goal for substantial work with a verifiable end state:
* Migrating a module to a new API until every call site compiles and tests pass
* Implementing a design doc until all acceptance criteria hold
@@ -15,7 +15,7 @@
Approach| Next turn starts when| Stops when
---|---|---
-`/goal`| The previous turn finishes| A model confirms the condition is met
+`/goal`| The previous turn finishes| A model confirms the condition is met or judges it impossible
[`/loop`](</docs/en/scheduled-tasks#run-a-prompt-repeatedly-with-%2Floop>)| A time interval elapses| You stop it, or Claude decides the work is done
[Stop hook](</docs/en/hooks-guide#prompt-based-hooks>)| The previous turn finishes| Your own script or prompt decides
@@ -41,7 +41,7 @@
/goal all tests in test/auth pass and the lint step is clean
-Setting a goal starts a turn immediately, with the condition itself as the directive. You don’t need to send a separate prompt. While the goal is active, a `◎ /goal active` indicator shows how long the goal has been running. A goal doesn’t change permissions. In the default permission mode, Claude still asks before tool calls that your settings don’t already allow, such as the test command above. To let goal turns run unattended, pair `/goal` with [auto mode](</docs/en/auto-mode-config>). After each turn, the evaluator returns a short reason explaining why the condition is or isn’t met. The most recent reason appears in the status view and in the transcript so you can see what Claude is working toward next.
+Setting a goal starts a turn immediately, with the condition itself as the directive. You don’t need to send a separate prompt. While the goal is active, a `◎ /goal active` indicator shows how long the goal has been running. A goal doesn’t change your permission mode. To let goal turns run unattended, run `/goal` in [auto mode](</docs/en/auto-mode-config>). In [Manual mode](</docs/en/permission-modes>), Claude still asks before tool calls that your settings don’t already allow, such as the test command above. While the goal is active, the transcript shows each verdict the evaluator returns, and you can press Ctrl+O to see the reason behind it. The status view also shows the most recent reason, so you can see what Claude is working toward next.
###
@@ -83,7 +83,7 @@
Clear a goal
-Run `/goal clear` to remove an active goal before its condition is met.
+Run `/goal clear` to remove an active goal before it resolves.
/goal clear
@@ -107,7 +107,7 @@
claude -p "/goal CHANGELOG.md has an entry for every PR merged this week"
-With the default text output, nothing prints until the condition is met, so a goal that runs many turns can look stuck. Add `--output-format stream-json --verbose` to emit each message as the loop runs. Interrupt the process with Ctrl+C to stop a non-interactive goal before the condition is met.
+With the default text output, nothing prints until the run ends, so a goal that runs many turns can look stuck. Add `--output-format stream-json --verbose` to emit each message as the loop runs. Interrupt the process with Ctrl+C to stop a non-interactive goal before it resolves.
##
@@ -115,12 +115,13 @@
How evaluation works
-`/goal` is a wrapper around a session-scoped [prompt-based Stop hook](</docs/en/hooks#prompt-based-hooks>). Each time Claude finishes a turn, Claude Code sends the condition and the conversation so far to your configured [small fast model](</docs/en/model-config>), which defaults to Haiku on the Claude API; on a third-party provider, check your [provider page](</docs/en/third-party-integrations>) for the platform’s default. The model answers yes or no and gives a short reason.
+`/goal` is a wrapper around a session-scoped [prompt-based Stop hook](</docs/en/hooks#prompt-based-hooks>). Each time Claude finishes a turn, Claude Code sends the condition and the conversation so far to your configured [small fast model](</docs/en/model-config>), which defaults to Haiku on the Claude API; on a third-party provider, check your [provider page](</docs/en/third-party-integrations>) for the platform’s default. The model returns one of three verdicts, each with a short reason:
- * **No** : Claude keeps working and takes the reason as guidance for the next turn.
- * **Yes** : Claude Code clears the goal and records an achieved entry in the transcript.
+ * **Not yet met** : Claude keeps working and takes the reason as guidance for the next turn.
+ * **Met** : Claude Code clears the goal and records an achieved entry in the transcript.
+ * **Impossible** : the evaluator judged that the condition can never be satisfied. Claude Code clears the goal and records a failed entry in the transcript along with the reason. You don’t need to clear it yourself.
-To evaluate on a different model, set [`ANTHROPIC_DEFAULT_HAIKU_MODEL`](</docs/en/model-config#environment-variables>).
+If Claude keeps answering the evaluator without making progress (no tool use for several turns in a row), Claude Code stops the loop, prints a warning, and returns control to you with the goal still set. Evaluation resumes after your next prompt. The [hooks guide](</docs/en/hooks-guide#stop-hook-hits-the-block-cap>) explains the underlying mechanism. If a subagent or a background shell command is still running when a turn ends, Claude Code skips the evaluation for that turn and evaluates when the next turn ends. To evaluate on a different model, set [`ANTHROPIC_DEFAULT_HAIKU_MODEL`](</docs/en/model-config#environment-variables>).
Claude Code reads `ANTHROPIC_DEFAULT_HAIKU_MODEL` everywhere it uses the small fast model, not only for `/goal` evaluation. When you set it, Claude Code also resolves the [`haiku` alias](</docs/en/model-config#model-aliases>) to that model and runs [background functionality](</docs/en/costs#background-token-usage>), such as conversation summarization, on it.
@@ -142,7 +143,7 @@
See also
- * [Run a prompt repeatedly with `/loop`](</docs/en/scheduled-tasks#run-a-prompt-repeatedly-with-%2Floop>): re-run on a time interval instead of until a condition holds
+ * [Run a prompt repeatedly with `/loop`](</docs/en/scheduled-tasks#run-a-prompt-repeatedly-with-%2Floop>): re-run on a time interval instead of toward a condition
* [Prompt-based hooks](</docs/en/hooks-guide#prompt-based-hooks>): write your own Stop hook when you need custom evaluation logic
* [Auto mode](</docs/en/auto-mode-config>): approve tool calls automatically so each goal turn runs unattended
* [Scheduling comparison](</docs/en/scheduled-tasks#compare-scheduling-options>): run work on a schedule independent of any open session
--- a/goal.md
+++ b/goal.md
@@ -134,7 +134,7 @@
Requirements
-`/goal` runs only in workspaces where you have accepted the trust dialog, because the evaluator is part of the hooks system. `/goal` is also unavailable when [`disableAllHooks`](</docs/en/hooks#disable-or-remove-hooks>) is set at any settings level or when [`allowManagedHooksOnly`](</docs/en/settings#hook-configuration>) is set in managed settings. In each case, the command tells you why instead of silently doing nothing.
+Claude Code makes `/goal` available under the same [workspace trust rule as hooks in settings files](</docs/en/permissions#what-runs-before-you-trust-a-folder>), because the evaluator is part of the hooks system. `/goal` is also unavailable when [`disableAllHooks`](</docs/en/hooks#disable-or-remove-hooks>) is `true` after settings precedence applies, or when [`allowManagedHooksOnly`](</docs/en/settings#hook-configuration>) is set in managed settings. In each case, the command tells you why instead of silently doing nothing.
##
--- a/goal.md
+++ b/goal.md
@@ -1,5 +1,3 @@
-`/goal` requires Claude Code v2.1.139 or later.
-
The `/goal` command sets a completion condition and Claude keeps working toward it without you prompting each step. After each turn, a small fast model checks whether the condition holds. If not, Claude starts another turn instead of returning control to you. The goal clears automatically once the condition is met. Use a goal for substantial work with a verifiable end state:
* Migrating a module to a new API until every call site compiles and tests pass
--- a/goal.md
+++ b/goal.md
@@ -44,8 +44,6 @@
/goal all tests in test/auth pass and the lint step is clean
Setting a goal starts a turn immediately, with the condition itself as the directive. You don’t need to send a separate prompt. While the goal is active, a `◎ /goal active` indicator shows how long the goal has been running. A goal doesn’t change permissions. In the default permission mode, Claude still asks before tool calls that your settings don’t already allow, such as the test command above. To let goal turns run unattended, pair `/goal` with [auto mode](</docs/en/auto-mode-config>). After each turn, the evaluator returns a short reason explaining why the condition is or isn’t met. The most recent reason appears in the status view and in the transcript so you can see what Claude is working toward next.
-
-A goal keeps running until the condition is met or you run `/goal clear`. Run `/goal` with no argument to see turns and tokens spent so far.
###
--- a/goal.md
+++ b/goal.md
@@ -119,7 +119,7 @@
How evaluation works
-`/goal` is a wrapper around a session-scoped [prompt-based Stop hook](</docs/en/hooks#prompt-based-hooks>). Each time Claude finishes a turn, the condition and the conversation so far are sent to your configured [small fast model](</docs/en/model-config>), which defaults to Haiku on the Claude API; on a third-party provider, check your [provider page](</docs/en/third-party-integrations>) for the platform’s default. The model answers yes or no and gives a short reason.
+`/goal` is a wrapper around a session-scoped [prompt-based Stop hook](</docs/en/hooks#prompt-based-hooks>). Each time Claude finishes a turn, Claude Code sends the condition and the conversation so far to your configured [small fast model](</docs/en/model-config>), which defaults to Haiku on the Claude API; on a third-party provider, check your [provider page](</docs/en/third-party-integrations>) for the platform’s default. The model answers yes or no and gives a short reason.
* **No** : Claude keeps working and takes the reason as guidance for the next turn.
* **Yes** : Claude Code clears the goal and records an achieved entry in the transcript.
--- a/goal.md
+++ b/goal.md
@@ -119,7 +119,16 @@
How evaluation works
-`/goal` is a wrapper around a session-scoped [prompt-based Stop hook](</docs/en/hooks#prompt-based-hooks>). Each time Claude finishes a turn, the condition and the conversation so far are sent to your configured [small fast model](</docs/en/model-config>), which defaults to Haiku. The model returns a yes-or-no decision and a short reason. A “no” tells Claude to keep working and includes the reason as guidance for the next turn. A “yes” clears the goal and records an achieved entry in the transcript. The evaluator runs on whichever provider your session is configured for. It does not call tools, so it can only judge what Claude has already surfaced in the conversation.
+`/goal` is a wrapper around a session-scoped [prompt-based Stop hook](</docs/en/hooks#prompt-based-hooks>). Each time Claude finishes a turn, the condition and the conversation so far are sent to your configured [small fast model](</docs/en/model-config>), which defaults to Haiku on the Claude API; on a third-party provider, check your [provider page](</docs/en/third-party-integrations>) for the platform’s default. The model answers yes or no and gives a short reason.
+
+ * **No** : Claude keeps working and takes the reason as guidance for the next turn.
+ * **Yes** : Claude Code clears the goal and records an achieved entry in the transcript.
+
+To evaluate on a different model, set [`ANTHROPIC_DEFAULT_HAIKU_MODEL`](</docs/en/model-config#environment-variables>).
+
+Claude Code reads `ANTHROPIC_DEFAULT_HAIKU_MODEL` everywhere it uses the small fast model, not only for `/goal` evaluation. When you set it, Claude Code also resolves the [`haiku` alias](</docs/en/model-config#model-aliases>) to that model and runs [background functionality](</docs/en/costs#background-token-usage>), such as conversation summarization, on it.
+
+The evaluator runs on whichever provider your session is configured for. It does not call tools, so it can only judge what Claude has already surfaced in the conversation.
Evaluation tokens are billed on the small fast model configured for your provider and are typically negligible compared to main-turn spend.
--- a/goal.md
+++ b/goal.md
@@ -43,7 +43,7 @@
/goal all tests in test/auth pass and the lint step is clean
-Setting a goal starts a turn immediately, with the condition itself as the directive. You don’t need to send a separate prompt. While the goal is active, a `◎ /goal active` indicator shows how long the goal has been running. After each turn, the evaluator returns a short reason explaining why the condition is or isn’t met. The most recent reason appears in the status view and in the transcript so you can see what Claude is working toward next.
+Setting a goal starts a turn immediately, with the condition itself as the directive. You don’t need to send a separate prompt. While the goal is active, a `◎ /goal active` indicator shows how long the goal has been running. A goal doesn’t change permissions. In the default permission mode, Claude still asks before tool calls that your settings don’t already allow, such as the test command above. To let goal turns run unattended, pair `/goal` with [auto mode](</docs/en/auto-mode-config>). After each turn, the evaluator returns a short reason explaining why the condition is or isn’t met. The most recent reason appears in the status view and in the transcript so you can see what Claude is working toward next.
A goal keeps running until the condition is met or you run `/goal clear`. Run `/goal` with no argument to see turns and tokens spent so far.
@@ -79,7 +79,7 @@
* The current token spend
* The evaluator’s most recent reason
-If no goal is active but one was achieved earlier in the session, the status shows the achieved condition along with its duration, turn count, and token spend.
+The turn count and the most recent reason appear after the first evaluation has run. If no goal is active but one was achieved earlier in the session, the status shows the achieved condition along with its duration, turn count, and token spend.
###
@@ -91,7 +91,7 @@
/goal clear
-`stop`, `off`, `reset`, `none`, and `cancel` are accepted as aliases for `clear`. Running `/clear` to start a new conversation also removes any active goal.
+Claude prints `Goal cleared:` followed by the condition to confirm, or `No goal set` if nothing was active. `stop`, `off`, `reset`, `none`, and `cancel` are accepted as aliases for `clear`. Running `/clear` to start a new conversation also removes any active goal.
###
@@ -111,7 +111,7 @@
claude -p "/goal CHANGELOG.md has an entry for every PR merged this week"
-Interrupt the process with Ctrl+C to stop a non-interactive goal before the condition is met.
+With the default text output, nothing prints until the condition is met, so a goal that runs many turns can look stuck. Add `--output-format stream-json --verbose` to emit each message as the loop runs. Interrupt the process with Ctrl+C to stop a non-interactive goal before the condition is met.
##
--- a/goal.md
+++ b/goal.md
@@ -6,13 +6,6 @@
* Implementing a design doc until all acceptance criteria hold
* Splitting a large file into focused modules until each is under a size budget
* Working through a labeled issue backlog until the queue is empty
-
-This page covers how to:
-
- * Compare ways to keep a session running: `/loop`, Stop hooks, and auto mode
- * Set a goal and write an effective condition
- * Check status, clear early, and run non-interactively
- * See how evaluation works and requirements
##
--- a/goal.md
+++ b/goal.md
@@ -1,9 +1,3 @@
-> ## Documentation Index
->
-> Fetch the complete documentation index at: <https://code.claude.com/docs/llms.txt>
->
-> Use this file to discover all available pages before exploring further.
-
`/goal` requires Claude Code v2.1.139 or later.
The `/goal` command sets a completion condition and Claude keeps working toward it without you prompting each step. After each turn, a small fast model checks whether the condition holds. If not, Claude starts another turn instead of returning control to you. The goal clears automatically once the condition is met. Use a goal for substantial work with a verifiable end state:
--- a/goal.md
+++ b/goal.md
@@ -15,7 +15,7 @@
This page covers how to:
- * Compare autonomous workflow approaches: `/loop`, Stop hooks, and auto mode
+ * Compare ways to keep a session running: `/loop`, Stop hooks, and auto mode
* Set a goal and write an effective condition
* Check status, clear early, and run non-interactively
* See how evaluation works and requirements
@@ -24,7 +24,7 @@
-Compare to other autonomous workflows
+Compare ways to keep a session running
Three approaches keep the current session running between prompts. Pick based on what should start the next turn:
--- a/goal.md
+++ b/goal.md
@@ -3,6 +3,8 @@
> Fetch the complete documentation index at: <https://code.claude.com/docs/llms.txt>
>
> Use this file to discover all available pages before exploring further.
+
+`/goal` requires Claude Code v2.1.139 or later.
The `/goal` command sets a completion condition and Claude keeps working toward it without you prompting each step. After each turn, a small fast model checks whether the condition holds. If not, Claude starts another turn instead of returning control to you. The goal clears automatically once the condition is met. Use a goal for substantial work with a verifiable end state:
@@ -118,7 +120,7 @@
Run non-interactively
-`/goal` works in [non-interactive mode](</docs/en/headless>) and through [Remote Control](</docs/en/remote-control>). Setting a goal with `-p` runs the loop to completion in a single invocation:
+`/goal` works in [non-interactive mode](</docs/en/headless>), in the [desktop app](</docs/en/desktop>), and through [Remote Control](</docs/en/remote-control>). Setting a goal with `-p` runs the loop to completion in a single invocation:
claude -p "/goal CHANGELOG.md has an entry for every PR merged this week"
--- a/goal.md
+++ b/goal.md
@@ -140,7 +140,7 @@
Requirements
-`/goal` runs only in workspaces where you have accepted the trust dialog, because the evaluator is part of the hooks system. If [`disableAllHooks`](</docs/en/hooks#disable-or-remove-hooks>) is set in managed policy settings, `/goal` is unavailable. In both cases, the command tells you why instead of silently doing nothing.
+`/goal` runs only in workspaces where you have accepted the trust dialog, because the evaluator is part of the hooks system. `/goal` is also unavailable when [`disableAllHooks`](</docs/en/hooks#disable-or-remove-hooks>) is set at any settings level or when [`allowManagedHooksOnly`](</docs/en/settings#hook-configuration>) is set in managed settings. In each case, the command tells you why instead of silently doing nothing.
##
Show diff (157 lines)
--- a/goal.md
+++ b/goal.md
@@ -0,0 +1,154 @@
+> ## Documentation Index
+>
+> Fetch the complete documentation index at: <https://code.claude.com/docs/llms.txt>
+>
+> Use this file to discover all available pages before exploring further.
+
+The `/goal` command sets a completion condition and Claude keeps working toward it without you prompting each step. After each turn, a small fast model checks whether the condition holds. If not, Claude starts another turn instead of returning control to you. The goal clears automatically once the condition is met. Use a goal for substantial work with a verifiable end state:
+
+ * Migrating a module to a new API until every call site compiles and tests pass
+ * Implementing a design doc until all acceptance criteria hold
+ * Splitting a large file into focused modules until each is under a size budget
+ * Working through a labeled issue backlog until the queue is empty
+
+This page covers how to:
+
+ * Compare autonomous workflow approaches: `/loop`, Stop hooks, and auto mode
+ * Set a goal and write an effective condition
+ * Check status, clear early, and run non-interactively
+ * See how evaluation works and requirements
+
+##
+
+
+
+Compare to other autonomous workflows
+
+Three approaches keep the current session running between prompts. Pick based on what should start the next turn:
+
+Approach| Next turn starts when| Stops when
+---|---|---
+`/goal`| The previous turn finishes| A model confirms the condition is met
+[`/loop`](</docs/en/scheduled-tasks#run-a-prompt-repeatedly-with-%2Floop>)| A time interval elapses| You stop it, or Claude decides the work is done
+[Stop hook](</docs/en/hooks-guide#prompt-based-hooks>)| The previous turn finishes| Your own script or prompt decides
+
+`/goal` and a Stop hook both fire after every turn. `/goal` is a session-scoped shortcut: you type a condition and it’s active for the current session only. A Stop hook lives in your settings file, applies to every session in its scope, and can run a script for deterministic checks or a prompt for model-evaluated ones. [Auto mode](</docs/en/auto-mode-config>) on its own approves tool calls within a single turn but doesn’t start a new one. Claude stops when it judges the work done. `/goal` adds a separate evaluator that checks your condition after every turn, so completion is decided by a fresh model rather than the one doing the work. The two are complementary: auto mode removes per-tool prompts, and `/goal` removes per-turn prompts.
+
+The approaches above keep the current session running. You can also schedule work that runs independent of any open session, such as nightly tests or morning triage. See [scheduling options](</docs/en/scheduled-tasks#compare-scheduling-options>) for cloud routines and desktop scheduled tasks.
+
+##
+
+
+
+Use `/goal`
+
+One goal can be active per session. The same command sets, checks, and clears it depending on the argument.
+
+###
+
+
+
+Set a goal
+
+Run `/goal` followed by the condition you want satisfied. If a goal is already active, the new one replaces it.
+
+ /goal all tests in test/auth pass and the lint step is clean
+
+Setting a goal starts a turn immediately, with the condition itself as the directive. You don’t need to send a separate prompt. While the goal is active, a `◎ /goal active` indicator shows how long the goal has been running. After each turn, the evaluator returns a short reason explaining why the condition is or isn’t met. The most recent reason appears in the status view and in the transcript so you can see what Claude is working toward next.
+
+A goal keeps running until the condition is met or you run `/goal clear`. Run `/goal` with no argument to see turns and tokens spent so far.
+
+###
+
+
+
+Write an effective condition
+
+The evaluator judges your condition against what Claude has surfaced in the conversation. It doesn’t run commands or read files independently, so write the condition as something Claude’s own output can demonstrate. “All tests in `test/auth` pass” works because Claude runs the tests and the result lands in the transcript for the evaluator to read. A condition that holds up across many turns usually has:
+
+ * **One measurable end state** : a test result, a build exit code, a file count, an empty queue
+ * **A stated check** : how Claude should prove it, such as “`npm test` exits 0” or “`git status` is clean”
+ * **Constraints that matter** : anything that must not change on the way there, such as “no other test file is modified”
+
+The condition can be up to 4,000 characters. To bound how long a goal runs, include a turn or time clause in the condition, such as `or stop after 20 turns`. Claude reports progress against that clause each turn and the evaluator judges it from the conversation.
+
+###
+
+
+
+Check status
+
+Run `/goal` with no arguments to see the current state.
+
+ /goal
+
+If a goal is active, the status shows:
+
+ * The condition
+ * How long it has been running
+ * How many turns have been evaluated
+ * The current token spend
+ * The evaluator’s most recent reason
+
+If no goal is active but one was achieved earlier in the session, the status shows the achieved condition along with its duration, turn count, and token spend.
+
+###
+
+
+
+Clear a goal
+
+Run `/goal clear` to remove an active goal before its condition is met.
+
+ /goal clear
+
+`stop`, `off`, `reset`, `none`, and `cancel` are accepted as aliases for `clear`. Running `/clear` to start a new conversation also removes any active goal.
+
+###
+
+
+
+Resume with an active goal
+
+A goal that was still active when a session ended is restored when you resume that session with `--resume` or `--continue`. The condition carries over, but the turn count, timer, and token-spend baseline all reset on resume. A goal that was already achieved or cleared is not restored.
+
+###
+
+
+
+Run non-interactively
+
+`/goal` works in [non-interactive mode](</docs/en/headless>) and through [Remote Control](</docs/en/remote-control>). Setting a goal with `-p` runs the loop to completion in a single invocation:
+
+ claude -p "/goal CHANGELOG.md has an entry for every PR merged this week"
+
+Interrupt the process with Ctrl+C to stop a non-interactive goal before the condition is met.
+
+##
+
+
+
+How evaluation works
+
+`/goal` is a wrapper around a session-scoped [prompt-based Stop hook](</docs/en/hooks#prompt-based-hooks>). Each time Claude finishes a turn, the condition and the conversation so far are sent to your configured [small fast model](</docs/en/model-config>), which defaults to Haiku. The model returns a yes-or-no decision and a short reason. A “no” tells Claude to keep working and includes the reason as guidance for the next turn. A “yes” clears the goal and records an achieved entry in the transcript. The evaluator runs on whichever provider your session is configured for. It does not call tools, so it can only judge what Claude has already surfaced in the conversation.
+
+Evaluation tokens are billed on the small fast model configured for your provider and are typically negligible compared to main-turn spend.
+
+##
+
+
+
+Requirements
+
+`/goal` runs only in workspaces where you have accepted the trust dialog, because the evaluator is part of the hooks system. If [`disableAllHooks`](</docs/en/hooks#disable-or-remove-hooks>) is set in managed policy settings, `/goal` is unavailable. In both cases, the command tells you why instead of silently doing nothing.
+
+##
+
+
+
+See also
+
+ * [Run a prompt repeatedly with `/loop`](</docs/en/scheduled-tasks#run-a-prompt-repeatedly-with-%2Floop>): re-run on a time interval instead of until a condition holds
+ * [Prompt-based hooks](</docs/en/hooks-guide#prompt-based-hooks>): write your own Stop hook when you need custom evaluation logic
+ * [Auto mode](</docs/en/auto-mode-config>): approve tool calls automatically so each goal turn runs unattended
+ * [Scheduling comparison](</docs/en/scheduled-tasks#compare-scheduling-options>): run work on a schedule independent of any open session