# Self-setup mode

> The agent connects itself to mail, folders, trackers and any other service when asked in plain words, tests the connection and improves itself.

**Self-setup mode** is for giving the agent access to what you use without knowing the technology.
You say what you want to be able to do: "help me connect my work mail", "how do I give you
access to the folder with contracts", "connect our task tracker". The agent finds out how the
service is reached, asks you in plain words, collects what is needed in a form, connects, tests
and explains what it checked and what it can now do.

The mode is **universal**: Buff Code has no list of "supported" services. Mail, drives, folders
and trackers on this page are examples only. Anything with programmatic access can be connected,
including an internal system of your company.

## How to enter the mode

- **Window:** the **"Self-setup"** section in the chats column on the left — its own chats and a
  "+" button; in the current chat — the **"Self-setup"** toggle next to "Plan" under the input box.
- **Console:** `/setup [what to connect]` opens a new chat of the mode; to switch the current
  one, change the agent (`shift+tab`) to `setup`. In the chat list (`ctrl+x l`) the mode's
  chats form their own group.
- **Phone:** the **"Self-setup"** group with "+" in the machine's chat list; the mode toggle in the
  chat details.
- **Web client:** Settings → Chat plugins → "Make a new one in Self-setup", or the "Open
  Self-setup" button of the introduction (Settings → About).
- **From a normal conversation:** when you ask for something that needs a connection you do not
  have yet ("find the letter from the supplier"), the agent offers to switch to Setup. Agree —
  a new chat of the mode opens with the task ready; the previous conversation stays as it is.

## How a setup goes

1. **The agent clarifies** what you want to be able to do — one question at a time, with ready
   options.
2. **It finds the way in:** from the service's documentation and the web. A ready connection
   first (the service's own MCP server or a published one); when there is none, or this computer
   lacks the runtime it needs, the agent **writes its own connection** and runs it with Buff Code
   itself, installing nothing.
3. **It asks for data with a form:** address, login, folder, choice of account — and secrets. A
   password, key or token goes into a **protected field**: the agent neither sees nor receives
   it; the value goes to Buff Code's store and the connection's settings keep only a reference.
4. **It saves and tests:** connects, looks at what the connection offers, makes one harmless trial
   call (read, list, search — never send or delete). If it fails, it reads the reason, fixes it and
   tests again.
5. **It reports** what it checked, what it can now do and what it deliberately left out — and
   writes itself instructions for the connection to use it well in later chats.

Saving or removing a connection and installing third-party code are always **confirmed by
you**: you see exactly what will be saved or run.

## Signing in through the service

When a service lets you in only through its own sign-in page, the agent gives you a link: open
it, sign in, come back. From the computer the service returns you to Buff Code itself. **From
the phone** the service brings you back into the Buff app after the sign-in, and the app hands
the code to the agent by itself — nothing to copy. If the return did not happen, paste the
address of the page you ended up on into the form field. If the service requires "an app of your
own" (an identifier and a secret), the agent walks you through the steps in plain words and asks
for them with the same protected form.

## Secrets

- The agent never asks for a password in the chat and never shows it back.
- In the window the secret field is masked; in the console dots replace the characters; on the
  phone the input is hidden.
- Configuration files hold a reference of the form `{secret:…}` instead of the value; the value
  is filled in only when the connection starts.
- Removing a connection removes its secrets with it.

## Teaching it to draw

In Self-setup the agent learns not only to connect but to **show**: "learn to show the sales
funnel", "draw the shift schedule as a board". It makes a chat plugin, tests it in your app and
shows an example. More in [Charts and visuals in a chat](/en/docs/buff-code/work/visuals).

## Self-improvement

In Self-setup mode the agent may, **with your permission**, change only its own things: connections,
the code of its own connections (add an action, fix one), chat plugins, skills and instructions for the
connections. All of it lives in your configuration folder. Buff Code's own code and your project
files stay untouched.

## What to ask for

Examples, not a list of what is possible: "connect my work mail and learn to search letters",
"give yourself access to the documents folder and make a table of contents", "connect our tracker
and show my tasks", "connect the calendar and remind me about meetings", "connect the internal
reports service at this address".

## When something is wrong

- **"It did not connect"** — the agent names the reason in words: a wrong address, a rejected
  key, a service that does not answer. Correct the data; it saves and tests again.
- **Redo it** — say "remove this connection" or "connect it again".
- **What is connected** — "Settings → Extensions → MCP" in the window, `/mcps` in the console;
  a connection can be disabled there too.
