# Session: input field, modes, questions

> Talking to the agent: the input field, permission modes, permission requests with an edit preview, the agent’s questions, attachments, background work, usage.

A **session** is one conversation with the agent in a project folder. You write a task, the agent reads the code,
edits files and runs commands, and under every answer you can see what it did.

_Illustration: The agent added a function and a test, the test immediately caught a bug — the agent fixed it. Under the answer is the summary of the turn’s changes._

## The feed

- **“Used N — …”** — which tools the agent called between replies: “Read”,
  “Edit”, “Shell”, “To-do list”, “Knowledge base: entry” and others. A click expands
  the calls with their results.
- **The agent’s answer** — plain text with markup. File paths in it are links.
- **The summary of the turn’s changes** — under the answer, if the turn changed files: “Changed 2 files +23 −1” and
  “Rewind the turn”. In detail — [Changes and undo](/en/docs/buff-code/work/changes).
- **Service marks** — as a collapsed line: an agent switch, session compaction, marks of the
  [goal](/en/docs/buff-code/work/plan-goal#goal).

## The input field

Under the field there is a control line:

| Element | What it does |
| --- | --- |
| **+** | a menu: “Images and files” (Ctrl+U), “Commands” (`/`), “Context” (`@`), “Shell command” (`!`) |
| **Mode** (“Edit on its own”) | how much the agent may do without asking — see below |
| **Plan** | the agent only drafts a plan and changes nothing until you approve it — see [Plan and goal](/en/docs/buff-code/work/plan-goal) |
| **Model** | the organisation’s model the agent answers with. The list — [Models and usage](/en/docs/buff-code/models) |
| **◆ organisation › project** | the working context: whose knowledge, repositories and connections the agent sees. To switch — [Sign-in and working context](/en/docs/buff-code/sign-in) |
| **⎇ branch ±N** | the Git branch and the number of changed files; a click opens the [Git window](/en/docs/buff-code/work/git) |
| **balance, ₽** | the organisation’s funds; a click opens “Balance and spending” — see below |

_Illustration: The “+” menu. Each item has its own sign, which you can type right in the field._

- **`/`** — commands: built-in (`/goal`, `/side`, `/compact`, `/undo`…), the project’s own commands
  and skills. A command without arguments runs on Enter; for a command with optional
  text (`/side`, `/goal`) the first Enter inserts it into the field — add the text or press Enter
  again.
- **`@`** — a project file or folder as part of the message; the agent gets their contents.
- **`!`** — a shell command from you, without the agent: `!bun test`. It runs in the project folder,
  and the output shows up in the feed right away and goes into the agent’s context.

### The request map

A long session has **request map ticks** to the left of the feed, one for each of your messages.
Hovering shows the request and the start of the answer; a click takes you to it.

_Illustration: The request map: hover over a tick to see what the request was about._

### Attachments and quotes

- **Images and files** — with the button, by dragging or by pasting from the clipboard. Each has
  a thumbnail; a click opens a preview. If the model does not read images itself, the attachment goes as a
  file, and the hint on the badge explains it: “The model does not read images itself — it opens the file with its
  tools”. There is no limit on the number of attachments.
- **A large paste** — three lines or more, or over 150 characters — becomes a chip “Pasted
  text · N lines”. A click shows the whole text; you can “Expand into text” or delete it.
  The model gets the whole paste.
- **A quote from an answer** — select a fragment in the agent’s answer, and an “Add to
  message” button appears next to it. A “From the answer · N lines” chip goes into the field, and the agent gets the fragment as a quote.

## Permission modes

A mode is the rules of the current session: what the agent does without asking and what it asks about. You
choose the mode — in the input field or with the `/mode` command; the agent does not change it. The organisation does not
fix the mode: it is a developer setting. A new session starts with the mode chosen last.

_Illustration: Three modes, each with an explanation. The check mark is the current mode of this session._

| Mode | What the agent does by itself | What it asks about |
| --- | --- | --- |
| **Ask** | reads and searches | before every file edit and every command |
| **Edit on its own** | edits project files | before shell commands |
| **Full access** | edits and runs commands in the project | outside the project and before `.env` files |

### Permission request

When the agent needs permission, a request appears above the input field: the whole command, and for a file
edit — the edit itself, as in a diff — and three buttons.

_Illustration: The “Ask” mode: the agent wants to add a line — the edit is visible before you allow it._

- **Allow once** — only this action.
- **Allow always** — remember it for the project. Under the command it says exactly what will be remembered:
  “«Always» remembers for this project: commands `cat *`, `echo *`”.
- **Deny** — with a “What to do instead” field. The text goes to the agent and the turn continues:
  the agent does it your way rather than stopping.

A request from a subagent is marked “from a subagent”.

## The agent’s questions

If the task lacks a decision, the agent asks — with a card above the input field. A question has
answer options with explanations, and you can write your own answer in the last line. There may be
several questions: “1 of 2 questions”, “Next”, “Back”, “Submit”.

_Illustration: The agent noticed the catalogue has no tea over 1000 ₽ and asked how to read the task instead of guessing._

## Background work

The agent can start a long command in the background and keep working. While such work runs, the line
under the input field shows “1 background task running”; a click opens the list.

_Illustration: A background command of the agent: how long it has been running, its output and stopping it._

- Each task has its running time, **“Output”** (the whole output, appended while the command runs) and
  **“Halt”**.
- **“Halt” does not wake the agent.** A “Shell: cancelled” mark goes into the feed; the agent sees it on
  the next turn.
- Your own command (`!`) or the agent’s command, while running, is moved to the background with the “Move to
  background” button or Ctrl+B (on macOS — also Ctrl+B).

## Balance and usage

The organisation’s balance is at the end of the line under the input field. A click opens **“Balance and
spending”**: how many days it will last at the organisation’s spending over 30 days, the plan and prices per million
tokens, the estimate for this session in roubles, your spending over 30 days — as bars and by day, “Open
cabinet” and “Refresh”. Requires company connector v0.18.0 or newer; with an older one the window says “the company
connector does not know this request — update it”.

_Illustration: Balance and spending: the balance, runway in days, the plan, the estimate for this session and your spending._

- When funds are low, the balance turns yellow; when they have run out — red, and a bar
  “Open cabinet / More details / Hide” appears above the input field.
- A turn refused for lack of funds is explained in words, with a “Balance and cabinet” button.
- The session cost is an **estimate by the plan**, not an invoice. Charges are visible in the workspace, see
  [Models and usage](/en/docs/buff-code/models).

## Session compaction

When a conversation gets long, you can compact it: `/compact`. The recent part of the conversation
is kept verbatim, and the agent retells the earlier part as a summary for itself. In the feed compaction shows
as a “Session compacted” divider with the number of tokens; the summary opens with the “Summary for the model” button.

## In the console

_Illustration: The console: the same session as in the window — with to-dos, the mode and the cost in the status line._

| What | How |
| --- | --- |
| permission mode | `/mode`; the current one is shown under the input field |
| plan | shift+tab — switch the agent (Build ↔ Plan) |
| shell command | `!` at the start of the line |
| background work | the line under the input field, the background work tabs, `ctrl+d` — stop |
| balance | the main screen’s status line; `/balance` — in detail |
| large paste | “[Pasted text · N lines]” |
