# Plan, to-do list and goal

> A large task in Buff Code: a plan with approval, the agent’s to-do list and a /goal — the agent takes turns until a check confirms the result.

Three ways to keep a large task under control:

| | What it is | When you need it |
| --- | --- | --- |
| **Plan** | the agent first studies the code and proposes a plan without changing anything; it starts working after your “yes” | the task touches several files or decisions and you want to agree on the approach |
| **To-do list** | the agent splits the work into steps and ticks off what is done | any multi-step task — the agent keeps it by itself |
| **Goal** | the agent takes turn after turn until a check confirms the result | the result can be checked, and the number of steps is not known in advance |

## Plan

Click **“Plan”** in the line under the input field and describe the task. While the toggle is on, the agent
reads and searches and asks questions, but does not edit files or run commands that change
anything.

1. The agent studies the code. If the task lacks a decision, it asks — with a question with answer
   options (see [The agent’s questions](/en/docs/buff-code/work/session#the-agents-questions)).
2. The plan arrives as a **“Plan · Waiting for approval”** card: rules, steps, files, the check.
   “Show in full” expands a long plan, “Copy” copies it as text.
3. Above the input field there is the question “Approve the plan and start working? Or write what to change”:
   - **“Approve and start”** — plan mode is turned off, and the agent gets to work;
   - your own answer — what to change; the agent rewrites the plan and asks again.

_Illustration: A discount plan: the agent took the answers to its questions into account and waits for approval._

After approval the card is marked “Approved”. Starting new sessions right in “Plan” can be
chosen on first launch or in the settings — see [Settings](/en/docs/buff-code/work/settings).

## To-do list

For multi-step work the agent keeps a **to-do list**: the line “To-dos 0/4 · Add expensive tea to
catalog.js” shows how much is done and what is in progress. The same line sits above the input field; a click
expands the whole list, with done items struck through.

_Illustration: After the approved plan the agent went through four steps: catalogue, calculation, tests, run._

## Goal

`/goal <what must be true>` sets a **goal** for the session. The agent takes a turn; after every turn
a separate check decides whether the goal has been reached — and if not, the agent gets the reason and takes
the next turn.

```text
/goal the file stock.txt contains the number 2. In one turn increase the number by 1 (no file — create it with 1) and end the turn
```

Above the input field there is the goal line:

- **“Goal · iteration 2 · In progress: …”** — under it, the check’s output after the previous turn: what is already
  done and what is missing;
- **“Pause”** — stop after the current turn, **“Resume”** — get back to the goal;
- **“Reset”** — remove the goal.

_Illustration: The first turn created a file with the number 1. The check answered that one more increase is needed — the second turn is running._

When the check confirms the result, the line turns green — **“Achieved”** — with
an explanation of why. In the feed, under the last answer, there is a collapsed “Goal” mark with the same result.

_Illustration: The goal was reached in two turns; the check explained why._

Worth knowing:

- If the check’s answer cannot be parsed, it asks again once and then pauses the goal
  with its answer — instead of an endless loop.
- A turn that broke off with an error pauses the goal with the error text.
- Write the goal as a checkable statement about the result (“the tests are green”, “the file contains 2”),
  not as an action.

## In the console

_Illustration: A goal in the console: the same goal line and the check’s output; control is through the palette._

| What | How |
| --- | --- |
| plan | shift+tab — switch the agent to Plan and back; the plan arrives in the feed, approval comes as a question |
| to-do list | the line “To-dos N/M · /todos” under the feed; `/todos` — the whole list |
| goal | `/goal <text>`; the goal line above the input field; pause, resume and reset — in the palette (`ctrl+p`): “Buff: goal — pause / resume / reset” |
