# Commands

> Reference for the buff console and the commands inside Buff Code: context, modes, goal, side conversation, undo, Git, automations, workflows, extensions.

Here are the `buff` console commands and the commands inside Buff Code that you need to work with
the organisation: sign-in, context, models, connections. `/help` shows the full list of the other
interface commands.

## Console

| Command | What it does |
| --- | --- |
| `buff` | open Buff Code in the current folder |
| `buff <folder>` | open Buff Code in another folder |
| `buff -c` | continue the last session in this folder |
| `buff -s <id>` | continue a specific session |
| `buff run "<message>"` | run one task without the interface and print the answer |
| `buff models` | show the organisation’s models |
| `buff upgrade [version]` | update Buff Code (`buff update` does the same) |
| `buff uninstall` | remove the console |
| `buff session list` | the local sessions of this folder |
| `buff session export [id]` | export a local session to JSON |
| `buff stats` | usage statistics on this machine |
| `buff --version` | the version |

### `buff run`

A task in one command — for scripts, checks and questions on the go:

```bash
buff run "Find where the discount is calculated and explain the formula"
buff run -c "Now show the tests for it"             # continue the last session
buff run --format json "..."                        # the answer and tool calls as JSON
buff run -f docs/spec.md "Check the code against this document"
```

| Flag | What it does |
| --- | --- |
| `-c`, `--continue` | continue the last session |
| `-s`, `--session <id>` | continue a specific session |
| `--fork` | fork the session before continuing |
| `-m`, `--model` | the model as `buff/<name>` — only from the organisation’s models |
| `-f`, `--file` | attach a file to the message (up to 100 times) |
| `--format json` | output as JSON events: text, tool calls, results |
| `--title` | the session title |
| `--thinking` | show the model’s reasoning |

Things about `buff run` worth knowing:

- it needs a terminal: if there is no sign-in and context yet, `buff run` asks for them on the spot, and without
  a terminal it refuses — do the first sign-in through `buff`;
- **confirmation forms are cancelled**: `buff run` works without asking a person anything, so
  the model’s proposal to [write to the knowledge base](/en/docs/buff-code/knowledge#how-a-new-entry-appears)
  is not carried out in this mode — writing is possible only in the interface;
- a `buff run` session is recorded in the workspace just like any other.

## Commands inside Buff Code

Typed with `/` in the input line; also available in the command palette.

### Ours

| Command | What it does |
| --- | --- |
| `/org` | switch the organisation |
| `/project` | switch the project or choose “No project — organization only” |
| `/space` | choose the organisation’s knowledge spaces |

In detail — [Sign-in and working context](/en/docs/buff-code/sign-in).

### Working in a session

| Command | What it does |
| --- | --- |
| `/mode` | permission mode: “Ask”, “Edit on its own”, “Full access” — see [Modes](/en/docs/buff-code/work/session#permission-modes) |
| `/goal <what must be true>` | goal: the agent takes turns until a check confirms the result — see [Goal](/en/docs/buff-code/work/plan-goal#goal) |
| `/side [question]` | side conversation: a question along the way, the main session does not change — see [Side conversation](/en/docs/buff-code/work/side) |
| `/todos` | the agent’s to-do list |
| `/queries` | jump to one of your requests in a long session |
| `/btw <question>` | a one-off answer from the session’s context; it does not go into the conversation |
| `/undo`, `/redo` | undo a turn with a preview, or bring back what was undone — see [Changes and undo](/en/docs/buff-code/work/changes) |
| `/compact` | compress a long conversation: the recent part stays verbatim, the earlier part becomes a summary for the model |
| `/diff` | view the changes |
| `/commit`, `/push` | commit the checked files with confirmation, push the branch |
| `/models`, `/variants` | the organisation’s model and the reasoning level |
| `/new`, `/sessions` | a new session, another session (in the list: `ctrl+f` — pin, `alt+a` — archive, `ctrl+y` — the archive) |

### Automations, workflows, usage

| Command | What it does |
| --- | --- |
| `/automations`, `/automation-new` | scheduled automations: the list and a new one — see [Automations](/en/docs/buff-code/work/automations) |
| `/workflows` | saved workflows and runs — see [Workflows](/en/docs/buff-code/work/workflows) |
| `/balance` | the organisation’s balance, runway, plan, the session estimate and your usage by day |

### Extensions

| Command | What it does |
| --- | --- |
| `/mcps`, `/mcp-add`, `/mcp-edit`, `/mcp-remove` | MCP servers: `buff`, `knowledge`, `repos` from the organisation, and your own |
| `/skills`, `/skill-attach`, `/skill-detach` | skills and skill directories |
| `/command-add`, `/command-edit`, `/command-remove`, `/command-toggle` | your own commands |
| `/agent-add`, `/agent-edit`, `/agent-remove`, `/agent-toggle` | subagents |
| `/hook-add`, `/hook-remove`, `/hook-toggle` | hooks |
| `/memory` | the `AGENTS.md` memory: a note, turn it on or off |
| `/trust` | what from the project awaits a check — hooks and commands |

In detail — [Extensions](/en/docs/buff-code/work/extensions).

### Everything else

| Command | What it does |
| --- | --- |
| `/connect` | sign-in to Buff and [your own providers](/en/docs/buff-code/own-providers): the line “Buff · your login · organisation”, or sign-in if there is none yet; below — the catalogue providers |
| `/settings`, `/themes` | settings and theme |
| `/phone` | [connect a phone](/en/docs/mobile/pair-buff-code) with a QR code or with a link and a code, rename or disconnect connected ones |
| `/update` | update Buff Code |
| `/help` | all commands and shortcuts |

The palette with all commands — `ctrl+p`; switching the agent (Build ↔ Plan) — `shift+tab`.

## Environment variables

| Variable | What it does |
| --- | --- |
| `BUFF_CONNECTOR_URL` | the connector gateway address; the sign-in form will not ask for it |
| `NODE_EXTRA_CA_CERTS` | the path to your certificate authority’s certificate if it is not in the system store |
