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

# Goals and bounded loops

> Keep Inlay working toward one result across turns, or repeat a reviewed task on a schedule while the session is open.

Use a goal when you want Inlay to keep working, turn after turn, until it reaches one result. Use a bounded loop to repeat a reviewed task at a fixed interval while the session is open.

## Set a goal

Run `/goal` with the objective, the scope, and the check that proves it's done:

```text theme={"theme":"css-variables"}
/goal Fix the bootloader update path. Keep the image format unchanged and
finish when the bootloader build and existing update tests pass.
```

Inlay starts right away and keeps going with automatic turns until the goal is complete, paused, or blocked. In VS Code, each automatic turn starts with **Continuing goal**. In the terminal UI, while the chat is in Act mode, the status bar shows **Pursuing goal** with the time spent, or the tokens used when the goal has a budget.

> [!WARNING]
>
> A goal set with `/goal` switches the chat to Act mode and to **Skip all approvals**, so edits and commands run without asking. Put any prohibited changes in the objective, and review the work as it progresses. When the goal is no longer active, your previous approval mode returns. The chat stays in Act mode.

Automatic turns don't stop to ask you questions, switch modes, submit a plan, or upload documents, so include the decisions Inlay would otherwise ask about in the objective. You can send a message at any time. Your message interrupts the current automatic turn, Inlay takes it into account, and the goal continues. An objective can be up to 4,000 characters. Files, images, and `@` mentions you attach to `/goal <objective>` go with the goal's first turn.

### Set a token budget

To cap how much work a goal can use, ask for a goal with a token budget in chat, in Act or Debug mode:

```text theme={"theme":"css-variables"}
Set a goal to fix the bootloader update path with a token budget of 2M tokens.
```

A goal you set this way keeps your current approval mode, so approval requests still wait for you. Inlay can't set a goal this way while an unfinished goal exists; run `/goal clear` first. Only automatic turns count toward a goal's time, tokens, and budget. Your own turns and Plan mode turns don't.

## Check and control a goal

| Command | Effect |
| - | - |
| `/goal` | Shows the goal's status, objective, time used, tokens used, budget if it has one, and the commands you can run next. |
| `/goal pause` | Stops scheduling automatic turns and keeps the goal. A turn that's already running finishes first; choose **Stop** to interrupt it. |
| `/goal resume` | Continues a goal that's paused, blocked, or usage limited, and switches the chat back to Act mode if needed. |
| `/goal edit` | In VS Code, opens **Edit Goal** so you can change the objective. Saving restarts the goal as active and resets its time and tokens; the budget stays. In the terminal UI, it shows the current goal; run `/goal` with a new objective to replace it. |
| `/goal clear` | Removes the goal from the conversation. |

Stopping a turn while a goal is active pauses the goal. So do rewinding, running `/clear`, and reopening the conversation from history. To replace an unfinished goal, run `/goal` with a new objective and confirm **Replace the current goal?**.

`/goal` reports one of these statuses. Read the reason before you resume:

| Status | What happened | Next step |
| - | - | - |
| **active** | Inlay is working toward the objective. | Review progress. |
| **paused** | You paused it, stopped a turn, rewound, cleared, or reopened the conversation, or 50 automatic turns ran in a row without a message from you. | Run `/goal resume`. |
| **blocked** | Inlay can't progress without your input or a change outside the chat, or a turn failed. | Read the last turn, resolve the issue, then run `/goal resume`. |
| **usage limited** | A usage limit or an account issue, such as an expired sign-in, stopped the goal. | Resolve the issue, then run `/goal resume`. |
| **limited by budget** | The goal used its token budget. | Run `/goal clear`, then set a new goal with a larger budget. |
| **complete** | Inlay met the objective. | Review the result. |

Switching to Plan mode suspends automatic turns, but the goal stays active. To continue, return to Act mode and send a message, or run `/goal resume`.

## Create a bounded loop

Run `/loop` to open the designer, then answer its questions. `/loop` takes no arguments.

1. **Goal**: choose **Current objective**, **Investigate a question**, or **Monitor a condition**, or describe a different outcome and the evidence to watch for.
2. **Workload**: choose what each iteration may do. See the table below.
3. **Cadence**: **Every 15 minutes** (the default), **Every 5 minutes**, or **Every hour**.
4. **Limit**: **10 iterations** (recommended), **3 iterations**, or **24 iterations**.
5. **Completion**: **Goal is demonstrated**, **Answer is complete**, or **Only I stop it**.
6. **Mode transition**, if the workload needs a different mode: **Ask before switching**, **Stay in current mode**, or **Approve this transition**.
7. **Research worker**, for research loops: **Current conversation**, or a **Codebase specialist**, **Documentation specialist**, or **Web specialist** that runs the iterations in one separate session.

Inlay then shows the loop plan: goal, workload, cadence, limits, completion rule, mode, and boundaries. Choose **Start loop**, **Revise** to answer the questions again, or **Cancel**. The first iteration runs one interval after you start the loop. Each iteration appears in the conversation as **Loop N/M** followed by the goal.

Choose the workload that matches the job:

| Workload | Each iteration can | Runs in |
| - | - | - |
| **Research and report** | Read and search code, documentation, project memory, and the web, without editing files. | Plan mode |
| **Update a plan** | Do the same and edit the plan document. | Plan mode |
| **Edit software** | Do the same and create, edit, or delete source files. | Act mode |
| **Observe hardware** | Do the same research, and read hardware status and serial output that's already buffered or saved. | Debug mode |

If you choose **Stay in current mode**, the loop runs with the current mode's limits, and an **Update a plan** loop runs as research.

Loops don't change your approval mode. In **Manually approve** mode, edits from an **Edit software** loop still wait for your approval, and the next iteration waits until you answer.

Loops can't run shell commands, flash hardware, send device commands, start live captures, use GDB, MCP tools, or skills, or start subagents other than the research worker you chose. Use loops for repeated inspection or scoped edits. Use a [hardware script](/docs/debug-mode/hardware-scripts.md) for a soak test or a long measurement.

## Set an interval and stopping condition

Iterations never overlap. A loop stops at its iteration limit or three days after you create it, whichever comes first.

With **Goal is demonstrated** or **Answer is complete**, the loop stops early once an iteration shows the required evidence. With **Only I stop it**, it runs until you stop it or it reaches a limit.

For example, to check a known issue for new evidence until you have a supported answer, choose **Investigate a question**, **Research and report**, and **Answer is complete**.

## Manage an existing loop

A session runs one loop at a time, and the loop runs only while the session stays open. Run `/loop` again to see the plan with its state, completed iterations, consecutive failures, and next run time. Then choose **Pause** or **Resume**, **Stop**, or **Keep current state**.

If the session is busy or waiting for your answer when an iteration is due, the loop waits one more interval. The loop pauses when:

* You stop a turn, rewind, or clear the conversation.
* An iteration needs your decision, new permissions, or a change outside the chat.
* Three iterations in a row fail.
* The project, workspace folder, conversation, or mode changes.
* You decline a mode switch. With **Ask before switching**, the first iteration asks **Switch once** or **Pause loop**.

When Inlay pauses the loop for you, it tells you why. Resolve the reported issue, then run `/loop` and choose **Resume**.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.