> ## Documentation Index
> Fetch the complete documentation index at: https://opensre.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Goals

> Give OpenSRE a finish line with /goal and let it work through multi-step questions on its own

Most questions are answered in one reply. Some are not — "how many Windows users
signed up last week?" may need OpenSRE to check whether PostHog is connected,
write a query, run it, and only then answer.

`/goal` gives OpenSRE a **finish line** instead of a single prompt. You state the
condition once, and OpenSRE keeps taking turns until it reaches it, runs out of
its turn budget, or you stop it. You can walk away and check the progress line
when you come back.

## Commands at a glance

| Command                               | What it does                                          |
| ------------------------------------- | ----------------------------------------------------- |
| `/goal`                               | Show the current goal, or say there is none           |
| `/goal show`                          | Same as bare `/goal` (`/goal status` also works)      |
| `/goal set <condition>`               | Set a finish line and start working on it immediately |
| `/goal set --max-turns N <condition>` | Same, but cap how many turns it may take              |
| `/goal <condition>`                   | Shorthand for `/goal set <condition>`                 |
| `/goal pause`                         | Stop the next turn, keep the condition and progress   |
| `/goal resume`                        | Start working again from where it paused              |
| `/goal edit <condition>`              | Change the condition without losing progress          |
| `/goal clear`                         | Drop the goal entirely (`/goal unset` also works)     |

## Try it

Paste this into the interactive shell:

```text theme={null}
/goal set --max-turns 4 How many Windows users in the last 7 days? Prefer live PostHog if connected; otherwise draft the HogQL and end with one setup CTA. Do not ask whether to continue.
```

OpenSRE confirms the goal and immediately starts on it:

```text theme={null}
◎ /goal active · 0s · turn 0/4 · +0 tokens
  condition: How many Windows users in the last 7 days? Prefer live PostHog if connected; otherwise draft the HogQL and end with one setup CTA. Do not ask whether to continue.
  reason: waiting for an achieved signal
→ next: condition runs as its own prompt turn (look for [N] ❯ below). /goal · pause · resume · edit · clear
```

Setting a goal **starts the work** — you do not need to retype the condition as a
prompt. The confirmation turn itself does not count against the budget, so the
first real attempt is turn 1 of 4.

<Tip>
  Write the condition the way you would brief a teammate: say what "done" looks
  like, and say what to do when something is missing ("otherwise draft the query
  and end with one setup CTA"). A condition that can never be satisfied will just
  burn the whole turn budget.
</Tip>

## Watching progress

Run `/goal` at any time:

```text theme={null}
◎ /goal active · 1m 12s · turn 2/4 · +18.4k tokens
  condition: How many Windows users in the last 7 days? …
  reason: waiting for an achieved signal
```

| Part of the line | Meaning                                                 |
| ---------------- | ------------------------------------------------------- |
| `active`         | Current state — see [How a goal ends](#how-a-goal-ends) |
| `1m 12s`         | Time since you set the goal                             |
| `turn 2/4`       | Turns used out of the budget                            |
| `+18.4k tokens`  | Tokens spent on this goal since you set it              |
| `condition`      | The finish line you asked for                           |
| `reason`         | Why OpenSRE is still going, or why it stopped           |

When OpenSRE breaks the work into steps, `/goal` also prints a checklist with
`[x]` for finished items and `→` marking the one it is on.

If no goal is set, you get an empty state instead:

```text theme={null}
no active goal. Set one with /goal set <condition>.
```

## Pause and resume

`/goal pause` stops the next turn from firing but keeps everything else —
condition, turn count, and progress so far:

```text theme={null}
◎ /goal paused · 2m 05s · turn 2/4 · +18.4k tokens
  condition: How many Windows users in the last 7 days? …
  reason: paused by you
paused. /goal · resume · edit · clear
```

While paused you can still chat normally — OpenSRE answers your message and then
stays put instead of continuing the goal. This is the way to ask a quick
side question without losing your place.

`/goal resume` picks the work back up from the same turn count:

```text theme={null}
/goal resume
```

## Change the condition

`/goal edit` rewrites the finish line in place, keeping the turns already spent.
Use it when the goal was nearly right but you want to redirect it:

```text theme={null}
/goal edit How many Windows users in the last 7 days, broken down by country?
```

If the goal is active, the updated condition starts running right away. If it is
paused, the text changes and it stays paused until you `/goal resume`. Conditions
longer than 400 characters are shortened.

## Stop the goal

| You want to                          | Do this       |
| ------------------------------------ | ------------- |
| Take a break, keep the goal          | `/goal pause` |
| Interrupt the turn running right now | **Ctrl+C**    |
| Forget the goal completely           | `/goal clear` |

`/goal clear` prints `goal cleared.` and removes it — there is nothing left to
resume.

## How a goal ends

| State              | What happened                                                                                                   |
| ------------------ | --------------------------------------------------------------------------------------------------------------- |
| `active`           | Still working                                                                                                   |
| `paused`           | You ran `/goal pause`                                                                                           |
| `achieved`         | OpenSRE reached the condition you described                                                                     |
| `budget_exhausted` | It used every turn without getting there — read the last reply, then set a narrower goal or raise `--max-turns` |
| `cancelled`        | You interrupted the run with **Ctrl+C**                                                                         |
| `cleared`          | You ran `/goal clear`                                                                                           |

The turn budget defaults to **5** and exists so an impossible condition cannot
loop forever. Raise it with `--max-turns` when the work genuinely needs more
steps.

## `/goal` vs `/work` vs `/background`

| Use                                         | When                                                                                           |
| ------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| `/goal`                                     | One question that needs several turns to answer, and you want OpenSRE to keep going by itself  |
| [`/work`](/docs/work-management)                 | A durable human todo list that outlives the session                                            |
| [`/background`](/docs/background-investigations) | An investigation that runs asynchronously and delivers its report to Slack, Telegram, or email |

## Where goals live

A goal belongs to the session it was set in and is restored with it, so a goal
you set in the shell is still there after `/resume`.

Goals are remembered in chat transports such as Slack and Telegram as well, and
the same status line appears in the timeline while OpenSRE works. One difference
matters there: `/goal set` does **not** start the work on its own. OpenSRE stores
the goal and replies with a hint to run the condition in the interactive shell,
and the goal sits at turn 0 until you send your next message — that message
becomes the first turn, and continuation proceeds normally from there.

<Note>
  Set goals from the interactive shell when you want the work to begin
  immediately without sending a follow-up message.
</Note>

## Related docs

* [Interactive Shell Commands](/docs/interactive-shell-commands) — the full slash command reference
* [Work Management](/docs/work-management) — `/work` durable todos
* [Background investigations](/docs/background-investigations) — async RCA delivery
* [Session History](/docs/sessions) — how sessions persist and resume
* [PostHog](/docs/posthog) — connect PostHog so product questions can run live
