Use an ACP client
An Agent Client Protocol (ACP) client can spawn and drive Cotal agents. T3 Code, Zed, JetBrains IDEs and Neovim are ACP clients. In the client, each thread is one Cotal agent. Its first prompt spawns the agent through your space's manager, in the thread's folder. The agent belongs to the manager, so it keeps running on the mesh when the client closes.
Install the extension
The cotal acp command comes from the optional @cotal-ai/acp extension.
cotal setup adds it when it finds T3 Code or Zed on this computer.
To add it yourself, run this on the machine where the client runs its agents:
cotal ext add @cotal-ai/acpThe agent needs a running mesh.
It finds the space the way other commands do, from the folder the client starts it in.
A client may start it anywhere, so pin the space with --space.
When none of the managers a new thread may use runs on this machine, as when none may start its agent or only another computer's is live, cotal acp starts this machine's manager for the space with cotal manager start --idle-exit 600 before the thread offers anything. The thread's first prompt says so in one line, before the agent's reply, because a client may not show a line sent outside a prompt.
Threads that open at the same time share one start, and the later ones say the manager is running.
That manager stops itself once it has held no agents for 10 minutes, so nothing runs while you use no agents.
It runs on its own, so closing the thread, or the app that runs cotal acp, does not stop it (background services).
Its seats get a provider key or harness folder from the environment cotal acp runs in only when spawn.env lists it.
Until then, a bare cotal down for the space refuses and names the command that stops that manager first.
A thread's first prompt checks again when its Machine is this machine's, so a thread left open past that time starts the manager again.
When no manager is registered for the space, as after that manager stopped itself, listing threads, loading or deleting one, and /open fail with a message that says so and that a new thread starts this machine's manager. None of them starts a manager.
If the start fails, the new thread fails with the start's reason. It also fails when the start succeeds but the space does not list a manager on this machine yet; open the thread again.
A manager runs on this machine when it names this machine's id, the machine field of its status and presence (see Control discovery). The host name decides nothing, because macOS changes it when the network changes. A manager that names no machine, such as one an older release started, runs on this machine when this machine's manager service for the space runs it: cotal acp reads cotal manager status, and the listed manager with the native instance it shows is this machine's. Any other manager that names no machine counts as another computer's. When cotal acp cannot read this machine's own id, as in a container with no /etc/machine-id, no manager counts as this machine's, so a thread neither defaults to one nor starts one. A new thread offers the listed managers in the Machine option, a prompt with none chosen fails and says why, and a manager the thread names runs its agent as before. With none listed, the new thread fails and says why.
Add Cotal to the client
cotal setup adds Cotal to T3 Code and Zed when it finds them on this computer, one entry per space.
It finds T3 Code from a t3 command or its ~/.t3 folder (T3CODE_HOME when set), and Zed from a zed or zeditor command or its settings folder.
Run setup once for each space you want in the client.
Each entry runs this computer's cotal acp --space <name> by absolute path, because an app started from the desktop often does not see the folders your shell adds to PATH.
The paths are ones that survive an upgrade: under the get.cotal.ai launcher the entry runs the launcher's own Node link, not the folder of one Node version such as Homebrew's Cellar/node/<version>, and it runs the install's entry, not one update's copy.
When COTAL_HOME or XDG_CONFIG_HOME is set, the entry passes it on.
A new entry is named Cotal (<name>).
An entry that already runs cotal acp for the space, such as one you added by hand, is updated in place.
In T3 Code, setup uses a different provider ID if another provider already has the ID Cotal would use.
Setup keeps your other settings, and in Zed it keeps your comments.
Before it changes a settings file, it copies it next to the original as settings.json.cotal-backup-<time>.
Setup and update refuse a settings file that is not valid UTF-8 and leave its bytes unchanged. Save it as UTF-8 before retrying.
Both apps load the change without a restart.
When a settings file cannot be read or written, setup says which one and why, saves the rest, and reports the run as partial.
cotal update points every Cotal entry at the Cotal it installed, for example after Cotal moved to another folder.
It leaves other Zed agents unchanged, even if they use the same acp --space arguments.
If update refuses a client settings file, correct the reported problem and repeat the original update command. You do not need to set up the space again.
When the client refreshes fail for the same classified reason, regular update telemetry records that code without the settings path or text. It assigns no common code to different failures.
cotal status lists the spaces each client reaches, and shows an entry whose command is gone.
To add an entry by hand, give the absolute path of cotal (command -v cotal prints it) and acp --space <name> as its arguments.
In T3 Code, add a provider instance with a local ACP command to T3's settings.json.
Its settings page shows the command but not its arguments:
{
"providerInstances": {
"cotal-<name>": {
"driver": "acpRegistry",
"displayName": "Cotal (<name>)",
"enabled": true,
"config": { "source": "local", "commandPath": "/home/you/.local/bin/cotal", "commandArgs": ["acp", "--space", "<name>"] }
}
}
}In Zed, add it under agent_servers in your settings:
{
"agent_servers": {
"Cotal (<name>)": { "type": "custom", "command": "/home/you/.local/bin/cotal", "args": ["acp", "--space", "<name>"] }
}
}Start it with npx
A client that installs agents as npm packages starts Cotal with npx @cotal-ai/acp.
That command keeps nothing of its own. It finds the cotal installed on this computer, on PATH, in ~/.local/bin or in npm's global folder, and runs its cotal acp with the same arguments.
Your spaces, sign-in and agents stay the ones that cotal already uses.
When this computer has no Cotal, or a Cotal without the ACP extension, the agent offers only Sign in to Cotal.
That sign-in runs in a terminal. It installs Cotal with curl -fsSL https://get.cotal.ai | sh (npm install -g cotal-ai on Windows) or adds the extension, then signs in to a space or sets one up.
How threads map to agents
| In the client | On the mesh |
|---|---|
| A new thread | Nothing yet. A thread that is opened and dropped leaves no agent. |
| The thread's first prompt | Spawns an agent in the thread's folder, with that prompt as its first task. The agent's name is the thread's id, or the name you gave it with /name. The turn ends when that first task's run ends. |
| A later prompt | Reaches the agent as your own words: through the agent's turn where its presence says it takes one now, else typed into its terminal through its manager. The thread picks the path from the agent's presence before it sends the prompt, and a path that fails is reported, not retried another way. The turn ends once the agent has started working and stopped again. |
| The thread's title | The name the agent shows: the label it took from its first message, else its name. The thread sends it when it starts or loads its agent, and again each time the agent's presence shows another name, as after /name, a label or a rename made elsewhere. Where the client lists its own thread server, as T3 Code does, a title you give the thread there becomes the agent's label (see Thread titles). |
| Listing sessions | The managed agents in that folder, including ones you spawned elsewhere. An agent a thread spawned or opened is listed as that thread. |
| Importing a session | Shows what the agent's event channel still holds, then follows it live. |
| Deleting a session | Hides that agent run from the list. The agent keeps running. |
A later prompt sent as a turn joins the agent's queue, as one of the agent's own commands does. While the agent finishes earlier work, the prompt waits there and its turn stays open, however long that takes. The turn shows only the agent's run for that prompt.
A new prompt to an asleep agent fails without sending input. Ask the Manager that holds the agent to wake it.
If an agent goes to sleep during a prompt, the prompt fails as soon as the client sees the change. The agent may still finish the work when it wakes. Both failures carry L4030 in the error data.
If the agent does not start working on a later prompt within 30 seconds of taking it, or of having it typed in, the turn ends with a note saying so.
The agent still has the prompt, and answers it when it gets to it.
When the agent's turn fails, the prompt fails with the application's own error text and, in parentheses, its error kind, such as acp_x's turn failed: You've hit your usage limit. ... (usageLimitExceeded).
The text and kind come from the agent's presence condition (SPEC §6), because the run error on its event channel carries only the fixed text run failed.
The error's data.condition holds the condition's code, source and message.
The thread waits up to 2 seconds for the condition after the run fails.
An application that reports no text, such as Hermes for a message it could not process, fails the prompt with <agent>'s turn failed alone.
Hermes shows its own error reply, such as a provider failure, as the agent's message instead.
A turn shows the agent's messages, its reasoning when the application publishes it, and its tool calls.
A tool call shows its arguments and its result, and a file edit shows as a diff.
They come from the agent's payload rail (SPEC 13.19), so a call shows by name and status until its payload arrives, and a result over the rail's size limit is replaced by a note.
Importing a session and /open replay the rail's history too. When it cannot be read, they still replay the agent's messages and show its earlier tool calls by name and status, and the thread says that the agent's earlier tool inputs and results cannot be read, and why.
A to-do list the agent keeps, such as Claude Code's tasks, Codex's plan, or the to-do lists of OpenCode, Jcode and Hermes, shows as the thread's plan.
On current models Claude Code keeps tasks only when the operator opts in (Claude connector).
The thread draws a tool call from the view the agent publishes with its arguments, when it publishes one (SPEC 13.19): its kind, title, files and diffs.
A call with no view, from an agent on an older Cotal or replayed from before views, is drawn from the thread's own knowledge of the file and shell tools of Claude Code, Pi, Codex, OpenCode, Jcode and Hermes, and so are the to-do and task tools. Any other tool shows by name, with its arguments and result as the agent sent them.
The thread also uses the agent's agent endpoint (SPEC 13.22), on every space.
On a static space the bridge calls it through a connection that holds only the calls an owner makes to their agents, minted from the space's signing key on this machine.
On an open mesh nothing checks who calls, so any program that reaches the broker can answer an agent's questions or run its commands.
- A question the agent stops to ask, such as a tool permission, shows as a permission request in the client, which may answer it from the thread's mode. A question with a form is shown as a form when the client takes forms. The answer goes back to the agent. An option that needs a written note is not offered; answer it at the agent's terminal. A client takes a question only during a prompt, so one the agent asks while the thread runs none, as when it works on a message from another agent, shows when you next send a prompt in the thread. Answer it there or at the agent's terminal. A prompt stays open while a question it shows is unanswered.
- An agent the thread spawns asks before it uses a tool where its application can, so those permission requests reach the thread. It also publishes its reasoning where its application can. The thread asks for both only where the manager reports that the application takes them, and a manager that refuses fails the first prompt with its reason.
- The agent's own commands and skills join the command list. A skill is listed with a leading
$. Sending one runs it through the agent'scommand. - A prompt can carry images (PNG, JPEG, GIF or WebP) when the agent's presence says it takes them with a turn. Otherwise the prompt fails before anything is sent. A first prompt with images starts the agent with no task, waits up to 20 seconds until it takes a turn, and then gives it the prompt.
- After each turn, the client's context meter shows how full the agent's context window is, when the agent's presence says it reports its usage. The usage arrives before the prompt answers, unless the agent takes more than 3 seconds to report it.
- Choosing another model or reasoning choice on a running thread switches the agent with its
set-model, from its next turn. The thread then shows what the agent runs. The model must belong to the agent's application and be one it lists: a model of another application, or the application's default, needs a new agent after/despawn. When the agent cannot switch now, such as a Claude Code session with mods off, or refuses the model, the choice fails with the agent's reason and stays. Each connector's reference page says what its switch calls and what it leaves on the launch model.
Thread titles
T3 Code lists an MCP server of its own for each thread in session/new and session/load.
The bridge finds such a thread server by the tools it offers, t3_thread_configure, t3_thread_read and t3_thread_update, and never by the client's name.
The bridge starts each MCP server the client passes once, to read its tools, and closes it when the list is read.
It knows a server by its command and arguments, and lists each one once for as long as the bridge runs.
Only a server that offers the three tools stays open, for the thread whose session listed it.
The bridge starts a server with the command, arguments and environment the client gave, and no variable of its own.
- When a thread starts or loads its agent, and at the start of each prompt, the bridge reads the thread's title there.
- A title that changed since the bridge last set or read it, and differs from the name the agent shows, becomes the agent's label before the prompt reaches it. The agent's name, which mentions and direct messages use, stays.
- Otherwise the bridge sets the name the agent shows as the title there, and again each time it sends the thread's title.
- The bridge stores the last title it set or read with the thread's link. A load in a new bridge compares the title with it, so a title you gave the thread while no bridge ran becomes the label, and a name the agent took elsewhere becomes the title. A link with no title stored gives the agent's name.
- A title the bridge set itself is never taken as a rename.
- A label follows the rule for a label an agent takes from its first message: one line of at most 40 characters, no
/or\, and single spaces between words. The agent refuses any other title. - A read that fails, or a label the agent refuses, is said in the thread and logged, and the prompt runs. A refused title is set back to the name the agent shows.
- A client that lists no thread server gets the title through ACP alone.
Choose the agent
A new thread offers these options next to the model list. They apply when the first prompt spawns the agent. On a running thread, the model and reasoning choices switch the agent instead, and the others need a new agent after /despawn.
| Option | What it sets |
|---|---|
| Model | The application and model, as <application>/<model>. On a running thread, choosing another model of the same application switches the agent (above). Each name starts with its application, so the list picks the application in clients that do not show groups, such as T3 Code. <application>/default leaves the model to the application. When the application lists a model whose id is default, this choice is that model: it has that model's name and reasoning choices, and the agent starts on it. A model id the list does not show is passed to the manager as given. |
| Harness | The application the agent runs, when more than one can. Choosing a model moves it to that model's application, and choosing another harness starts that application on its default model. |
| Reasoning | The model's variant. Offered while any listed model has variants; for a model without them it holds only the model default. Its id is reasoning, because T3 Code treats an option named variant as OpenCode's and shows it as Unknown. |
| Persona | A persona from the manager's catalog. A catalog of 64 or more personas offers a short list: the default, the current choice, and up to 16 personas you own. /persona picks any other. |
| Channel | One channel the new agent joins. A space with 64 or more channels offers a short list: no channel, the current choice, and up to 16 channels, those the space describes first, each group with the most retained messages first. /join picks any other. |
| Machine | Which manager spawns the agent. The default is your live manager on this machine, listed as This machine; another computer's manager is listed by its host name. Another computer's manager is never the default, because it cannot use this machine's folder. A listed manager whose rail the broker reports empty, as when its computer is gone or it died without deregistering, is not offered. With none of yours live on this machine, a new thread starts this machine's manager first, as above, so another computer is used only when you choose it here. The list is offered when there is more than one manager, or when none of them runs on this machine. On a space where people sign in, the list comes from the space's auth service: the space's own manager while you have registered none, and each of your registered managers it lists as a candidate once you have. A candidate can be one whose computer is gone. With none of yours live, a new thread starts this machine's manager, which registers it on its first start, as a manual cotal manager start does. Every call a thread makes names its manager, so a space host that sends unnamed calls to its own manager (local-primary, see Embedding a manager) does not change the list. A thread keeps the manager it started on. When a thread you load offers this list, its agent's manager is in it and is the current choice, so a new agent the thread starts after /despawn starts there unless you choose another. |
Only applications that publish an event plane are offered, because the thread is built from it (see Connectors).
An application whose models the manager could not read is not offered either. Choosing it, or opening a thread where it is the only application, fails with the manager's reason. Loading a thread or using /open on a running agent of that application still works, because driving it starts nothing. The model list then shows only that agent's model, and after /despawn a prompt there fails with the manager's reason. An application whose connector lists no models offers only its default.
Any other select that would hold 64 or more choices is not offered.
The session's model list also gives each model its reasoning choices, so a client that reads them, such as T3 Code, shows a model's reasoning choices before any thread has run it.
Slash commands
| Command | What it does |
|---|---|
/name <new name> | Before the first prompt, sets the name the agent starts with. On a running agent, changes the name it shows on the mesh and the thread's title. Its manager still lists it by the name it started with. |
/open <name> | In a thread with no agent, drives an agent that is already running, found by its name or the name it shows. The thread's options change to show that agent's model, and the thread shows what the agent's event channel still holds, then follows it live. When you load the thread again, it opens that agent. |
/despawn | Send it by itself to stop the thread's agent. The thread stays, and its next prompt spawns a new agent when your grant may spawn agents (see Sign in). |
/roster | Lists who is on the mesh and what each is doing. |
/channels | Lists the space's channels. |
/persona <name> | Sets the Persona option to any persona in the manager's catalog, by its exact name. Offered when the Persona option shows a short list. |
/join <channel> | Sets the Channel option to any channel of the space, by its exact name. Offered when the Channel option shows a short list. |
/persona and /join are offered only while the thread has no agent, because the choices apply when the agent starts. While an agent runs, the thread does not take them, so the agent's own command of that name reaches it. A name the list does not hold fails with one line, and the choice stays.
Sign in
For a space that authenticates users, a client that can run a terminal offers Sign in to Cotal. Open and static-auth spaces do not offer it.
It runs cotal acp --auth, which signs in to a space that authenticates users with cotal login.
When no space is recorded, the client offers the same action to run cotal setup instead.
On a space where people sign in, your own sign-in is enough. Whatever your scope, it lists and
loads your agents, types into them, stops their turns, reads their event channels and despawns them.
Starting a thread also needs a grant that may spawn agents. Without one, a thread you load offers
only the agent's own model, and once you despawn that agent the thread cannot start another. You need no admin scope, because a
person controls every agent under their own owner (see
Delegation).
Limits
- Stopping a turn takes one path, picked from the agent's presence when you stop it: the agent's own
interruptwhere its presence says it serves it now, else the interrupt key through its manager, which Claude Code and Pi agents support. A Claude Code agent servesinterruptonly while its command mod runs. When that path fails, the thread says the agent could not be stopped, the turn ends as cancelled, and the agent keeps working on the mesh. A prompt still waiting in the agent's queue is taken out of the queue instead, so it never runs, and the agent's earlier work goes on. - When you stop a Claude Code turn before the agent answered, Claude puts that prompt back in its input box. Your next prompt is typed after it, so the agent gets both.
- A later prompt that is typed into the agent's terminal is typed as if you typed it into the application, so the application's input shortcuts apply. In Claude Code, a prompt that starts with
!runs as a shell command and its turn does not show in the thread. - A later prompt typed through the manager ends when the agent stops working. When the agent was already busy as the prompt arrived, the turn can end when that earlier work does.
- A later prompt typed through the manager needs an agent on the built-in
ptyruntime. An agent on tmux, cmux, Orca or Herdr refuses it, and so does a Claude Code agent showing a selection menu. The turn then fails with the manager's reason. An agent that takes aturnhas no such limit. - Images need the
agentendpoint and a harness that takes them. Otherwise the prompt fails and says why. - Work an agent does between your prompts, such as answering a peer, does not show live in T3 Code.
- An agent on another machine's manager shows its conversation and tool calls, but T3 Code shows no diffs or checkpoints for it.
- An agent on another machine's manager starts in the thread's folder, so that folder must exist on that machine. Otherwise the spawn is refused.
- On a space where people sign in, the thread list shows your agents on every live manager the space's auth service lists for you, the space's own included. You can load them even while none of your managers may start a new thread.
- A manager that does not answer leaves its agents out of the list until it answers again. While it does not answer, loading or deleting any thread the list does not show fails, because its agent may run there. On a space where people do not sign in, a registered manager whose host is gone is not waited for. Where they do, it is waited for like one that does not answer, until you remove it with
cotal endpoint deregister manager <id> --space <space> --yes, which needs thesupervisescope. The error names that command when one of your own registrations does not answer a read. The space's own manager is not yours to remove; ask the space's operator. A manager that died less than a minute ago can still look current, and then a new thread fails reading its lists. Try again once its presence lapses, or remove the registration. A sleeping laptop's manager is not gone, so it holds those loads up until the laptop wakes. - Every manager read and command opens its own connection. A list opens one for each manager it reads, a new or loaded thread opens about three more, and each prompt, cancel or
/despawnopens one. A space limits how many connections one sign-in opens a minute (60 by default), and your othercotalcommands count too. Opening many threads at once can be refused, and the refusal names the limit. The allowance refills through the minute, so a retry a few seconds later can pass. - When your sign-in is granted again, or this machine signs in as another account, while
cotal acpruns, it stops and says why. It sends nothing as the new sign-in. Start the agent again in your client. - Switching a running agent's model needs an application whose connector can switch it. Hermes cannot yet.
- A title you give a thread in the client becomes its agent's label only through a thread server, and only once the thread loads or you send its next prompt. An agent whose connector predates
set-labelrefuses it. /openfinds the agents the thread list would show. If another thread in the same client drives that agent, the agent moves to the new thread.- A rollback in T3 Code starts a fresh session, which spawns a new agent.
- An agent whose credential holds no rows for the
agentendpoint, such as one an older release started on a static space, answers none of its calls: its questions stay at its terminal, its commands are not listed, and/nameand a thread title fail. Despawn it and start it again. - The client's own MCP servers are not passed to the agent. The bridge itself uses only a thread server (see Thread titles).
cotal acp
cotal acp [--space <name>] [--server <url>]
cotal acp --auth [--space <name>]Serves the ACP agent on standard input and output. Standard output carries the protocol only. Logs go to standard error.
| Flag | Meaning |
|---|---|
--space <name> | The space the agent works in. |
--server <url> | The broker address. An explicit address overrides the address recorded for the space. |
--auth | Sign in to the space, or set one up, then exit. |
Deleted sessions are kept as agent runs in acp/hidden-runs under the Cotal home, one per line.
The link from each thread to the agent run it spawned or opened is kept in acp/threads, one per line.