|
| 1 | +--- |
| 2 | +doc-schema-version: 1 |
| 3 | +summary: "Session goals: durable per-session objectives, /goal controls, model goal tools, token budgets, and TUI status" |
| 4 | +read_when: |
| 5 | + - You want OpenClaw to keep one objective visible across a long session |
| 6 | + - You need to pause, resume, block, complete, or clear a session goal |
| 7 | + - You want to understand the get_goal, create_goal, and update_goal tools |
| 8 | + - You want to see how goals appear in the TUI |
| 9 | +title: "Goal" |
| 10 | +--- |
| 11 | + |
| 12 | +# Goal |
| 13 | + |
| 14 | +A **goal** is one durable objective attached to the current OpenClaw session. |
| 15 | +It gives the agent and the operator a shared target for long-running work, |
| 16 | +without turning that target into a background task, reminder, cron job, or |
| 17 | +standing order. |
| 18 | + |
| 19 | +Goals are session state. They move with the session key, survive process |
| 20 | +restarts, show up in `/goal`, are available to the model through the goal |
| 21 | +tools, and appear in the TUI footer when the active session has one. |
| 22 | + |
| 23 | +## Quick start |
| 24 | + |
| 25 | +Set a goal: |
| 26 | + |
| 27 | +```text |
| 28 | +/goal start get CI green for PR 87469 and push the fix |
| 29 | +``` |
| 30 | + |
| 31 | +Check it: |
| 32 | + |
| 33 | +```text |
| 34 | +/goal |
| 35 | +``` |
| 36 | + |
| 37 | +Pause it when work is intentionally waiting: |
| 38 | + |
| 39 | +```text |
| 40 | +/goal pause waiting for CI |
| 41 | +``` |
| 42 | + |
| 43 | +Resume it: |
| 44 | + |
| 45 | +```text |
| 46 | +/goal resume |
| 47 | +``` |
| 48 | + |
| 49 | +Mark it complete: |
| 50 | + |
| 51 | +```text |
| 52 | +/goal complete pushed and verified |
| 53 | +``` |
| 54 | + |
| 55 | +Clear it: |
| 56 | + |
| 57 | +```text |
| 58 | +/goal clear |
| 59 | +``` |
| 60 | + |
| 61 | +## What goals are for |
| 62 | + |
| 63 | +Use a goal when a session has a concrete outcome that should remain visible |
| 64 | +across many turns: |
| 65 | + |
| 66 | +- A PR closeout: fix, verify, autoreview, push, and open or update the PR. |
| 67 | +- A debug run: reproduce the bug, identify the owning surface, patch, and prove |
| 68 | + the fix. |
| 69 | +- A docs pass: read the relevant docs, write the new page, cross-link it, and |
| 70 | + verify the docs build. |
| 71 | +- A maintenance task: inspect current state, make bounded changes, run the right |
| 72 | + checks, and report what changed. |
| 73 | + |
| 74 | +A goal is not a task queue. Use [Task Flow](/automation/taskflow), |
| 75 | +[tasks](/automation/tasks), [cron jobs](/automation/cron-jobs), or |
| 76 | +[standing orders](/automation/standing-orders) when work should run detached, |
| 77 | +repeat on a schedule, fan out into managed sub-work, or persist as a policy. |
| 78 | + |
| 79 | +## Command reference |
| 80 | + |
| 81 | +`/goal` without arguments prints the current goal summary: |
| 82 | + |
| 83 | +```text |
| 84 | +Goal |
| 85 | +Status: active |
| 86 | +Objective: get CI green for PR 87469 and push the fix |
| 87 | +Tokens used: 12k |
| 88 | +Token budget: 12k/50k |
| 89 | +
|
| 90 | +Commands: /goal pause, /goal complete, /goal clear |
| 91 | +``` |
| 92 | + |
| 93 | +Commands: |
| 94 | + |
| 95 | +- `/goal` or `/goal status` shows the current goal. |
| 96 | +- `/goal start <objective>` creates a new goal for the current session. |
| 97 | +- `/goal set <objective>` and `/goal create <objective>` are aliases for |
| 98 | + `start`. |
| 99 | +- `/goal pause [note]` pauses an active goal. |
| 100 | +- `/goal resume [note]` resumes a paused, blocked, usage-limited, or |
| 101 | + budget-limited goal. |
| 102 | +- `/goal complete [note]` marks the goal achieved. |
| 103 | +- `/goal done [note]` is an alias for `complete`. |
| 104 | +- `/goal block [note]` marks the goal blocked. |
| 105 | +- `/goal blocked [note]` is an alias for `block`. |
| 106 | +- `/goal clear` removes the goal from the session. |
| 107 | + |
| 108 | +Only one goal can exist on a session at a time. Starting a second goal fails |
| 109 | +until the current one is cleared. |
| 110 | + |
| 111 | +## Statuses |
| 112 | + |
| 113 | +Goals use a small status set: |
| 114 | + |
| 115 | +- `active`: the session is pursuing the goal. |
| 116 | +- `paused`: the operator paused the goal; `/goal resume` makes it active again. |
| 117 | +- `blocked`: the agent or operator reported a real blocker; `/goal resume` |
| 118 | + makes it active again when new information or state is available. |
| 119 | +- `budget_limited`: the configured token budget was reached; `/goal resume` |
| 120 | + restarts pursuit from the same objective. |
| 121 | +- `usage_limited`: reserved for usage-limit stop states; `/goal resume` |
| 122 | + restarts pursuit when allowed. |
| 123 | +- `complete`: the goal was achieved. Complete goals are terminal; use |
| 124 | + `/goal clear` before starting another goal. |
| 125 | + |
| 126 | +`/new` and `/reset` clear the current session goal because they intentionally |
| 127 | +start fresh session context. |
| 128 | + |
| 129 | +## Token budgets |
| 130 | + |
| 131 | +Goals can have an optional positive token budget. The budget is stored with the |
| 132 | +goal and measured from the session's fresh token count at creation time. If the |
| 133 | +current session only has stale or unknown token usage when the goal starts, |
| 134 | +OpenClaw waits for the next fresh session token snapshot and uses that as the |
| 135 | +baseline, so tokens spent before the goal existed are not charged to the goal. |
| 136 | + |
| 137 | +When token usage reaches the budget, the goal changes to `budget_limited`. This |
| 138 | +does not delete the goal or erase the objective. It tells the operator and the |
| 139 | +agent that the goal is no longer actively being pursued until it is resumed or |
| 140 | +cleared. |
| 141 | + |
| 142 | +Token budgets are a session-goal guardrail, not a billing cap. Provider quota, |
| 143 | +cost reporting, and context-window behavior still use the normal OpenClaw |
| 144 | +usage and model controls. |
| 145 | + |
| 146 | +## Model tools |
| 147 | + |
| 148 | +OpenClaw exposes three core goal tools to agent harnesses: |
| 149 | + |
| 150 | +- `get_goal`: read the current session goal, including status, objective, token |
| 151 | + usage, and token budget. |
| 152 | +- `create_goal`: create a goal only when the user, system, or developer |
| 153 | + instructions explicitly request one. It fails if the session already has a |
| 154 | + goal. |
| 155 | +- `update_goal`: mark the goal `complete` or `blocked`. |
| 156 | + |
| 157 | +The model cannot silently pause, resume, clear, or replace a goal. Those are |
| 158 | +operator/session controls through `/goal` and reset commands. This keeps the |
| 159 | +agent from quietly moving the target while preserving a clean path for the |
| 160 | +agent to report achievement or a genuine blocker. |
| 161 | + |
| 162 | +The `update_goal` tool should mark a goal `complete` only when the objective is |
| 163 | +actually achieved. It should mark a goal `blocked` only when the same blocking |
| 164 | +condition has repeated and the agent cannot make meaningful progress without |
| 165 | +new user input or an external-state change. |
| 166 | + |
| 167 | +## TUI |
| 168 | + |
| 169 | +The TUI keeps the active session's goal visible in the footer next to the |
| 170 | +agent, session, model, run controls, and token counts. |
| 171 | + |
| 172 | +Footer examples: |
| 173 | + |
| 174 | +- `Pursuing goal (12k/50k)` for an active goal with a token budget. |
| 175 | +- `Goal paused (/goal resume)` for a paused goal. |
| 176 | +- `Goal blocked (/goal resume)` for a blocked goal. |
| 177 | +- `Goal hit usage limits (/goal resume)` for a usage-limited goal. |
| 178 | +- `Goal unmet (50k/50k)` for a budget-limited goal. |
| 179 | +- `Goal achieved (42k)` for a completed goal. |
| 180 | + |
| 181 | +The footer is intentionally compact. Use `/goal` for the full objective, note, |
| 182 | +token budget, and available commands. |
| 183 | + |
| 184 | +## Channel behavior |
| 185 | + |
| 186 | +The `/goal` command works in command-capable OpenClaw sessions, including the |
| 187 | +TUI and chat surfaces that permit text commands. Goal state is attached to the |
| 188 | +session key, not the transport. If two surfaces use the same session, they see |
| 189 | +the same goal. |
| 190 | + |
| 191 | +Goal state is not a delivery directive. It does not force replies through a |
| 192 | +channel, change queue behavior, approve tools, or schedule work. |
| 193 | + |
| 194 | +## Troubleshooting |
| 195 | + |
| 196 | +`Goal error: goal already exists` means the session already has a goal. Use |
| 197 | +`/goal` to inspect it, `/goal complete` if it is done, or `/goal clear` before |
| 198 | +starting a different objective. |
| 199 | + |
| 200 | +`Goal error: goal not found` means the session has no goal yet. Start one with |
| 201 | +`/goal start <objective>`. |
| 202 | + |
| 203 | +`Goal error: goal is already complete` means the goal is terminal. Clear it |
| 204 | +before starting or resuming another objective. |
| 205 | + |
| 206 | +If token usage looks like `0` or stale, the active session may not have a fresh |
| 207 | +token snapshot yet. Usage refreshes as OpenClaw records session usage and |
| 208 | +transcript-derived totals. |
| 209 | + |
| 210 | +## Related |
| 211 | + |
| 212 | +- [Slash commands](/tools/slash-commands) |
| 213 | +- [TUI](/web/tui) |
| 214 | +- [Session tool](/concepts/session-tool) |
| 215 | +- [Compaction](/concepts/compaction) |
| 216 | +- [Task Flow](/automation/taskflow) |
| 217 | +- [Standing orders](/automation/standing-orders) |
0 commit comments