Two ways in, both spawned by the editor over stdio: ACP drives whole runs, and agent6 mcp serve exposes a few tools to another agent (see As an MCP server).
agent6 acp runs agent6 as an Agent Client Protocol agent: an editor spawns it, sends prompts, and renders the run as it happens.
It uses the same engine, config, and jail as agent6 run.
agent6 serves ACP v1 and v2, one version per connection.
initializeselects the highest version agent6 serves that is at most theprotocolVersionthe editor requests: 1 selects v1, 2 or more selects v2- a request for 0 answers
-32022withdata.supported: [1, 2] - an editor that sends no
initializeis served as v1 - v2 is the protocol's Preview; agent6 follows its
schema-v2.0.0-beta.3
The sections below describe v1. What v2 changes lists each difference.
Every run writes one event journal; the CLI, TUI, web UI, and ACP all render it the same way.
An editor sees what agent6 attach shows: reasoning, each tool call and its outcome, auto-commits, and how the run ended.
ACP v1 carries a tool call as two messages.
tool_call(in_progress) when the run dispatches it,tool_call_update(completedorfailed, with the output) when its result lands- a call names its tool (
name) beside the call's title; built-in calls carry their ACP kind, and an edit result carries each written or deleted path as an absolute follow-along location, without a line - a call waiting on an approval or an
ask_useranswer is updated topendingwhile its prompt is open, and back toin_progressonce answered - a long verify shows as in progress while it runs; a call the run never returned from settles as
failedwhen the run'ssession.stopis written, or when the tail ends without one (a worker killed mid-call) toolCallIdis<run id>:<execution id>:<call>, unique for the life of the session; the dispatcher numbers each execution's calls from 1
An edit shows as a diff.
- the
tool_call_updateof a successfulapply_editorapply_patchcarries its text summary, then onediffentry per file: the absolutepath,oldTextandnewText - a created file has
oldText: null; a deleted file hasnewText: "", and the summary saysdeleted - both texts are recorded when the tool writes, so two edits to one file in a turn each show their own diff, and
session/loadreplays the diffs the live run showed - the budget is 64 KiB of UTF-8 per call, both sides of all its files together.
A call over it carries no diff, and its summary ends
(diff omitted for size); a side is never cut to fit. - a preview, a failed call, a command and an MCP tool carry no diff
- after
sessions pruneremoved a run's stored texts, a replayed edit carries its summary anddiff unavailable: its stored text is gone
Worker text and thinking arrive as they stream; output from side calls stays out of the conversation.
Inspect persisted line-origin evidence with /findings, agent6 sessions findings <id> or the web Findings card.
Four more updates ride the journal.
session_info_update: the task's headline as the session title, the lineagent6 sessions listshowsavailable_commands_update: the slash commands the editor can offer for this run's mode. The front end handles finding actions without sending their text to the model.abort,exitanddetachare task text over ACP, not terminal commands. The editor cancels throughsession/cancel.usage_updateafter each model call: the last call's whole prompt over the model's context window (thectx N%rule), and the run's cumulative USD when it spent any and every call was priced (a plan-metered run carries none); nothing while the window is unknownplan: the run's task list, in the depth-first order every other surface shows it. Each change of the task graph sends the complete list, an empty one included; so does the run's end, which clears the focus, andsession/loadreplays them.- the content is the task's title, and every entry is
mediumpriority - a pending task reads
pending; a task in progress, or the one the worker is on, readsin_progress; a passed task readscompleted - a failed task reads
pendingwith(failed)after its title, since ACP has no failed status - skipped and obsolete tasks are left out
- the content is the task's title, and every entry is
initialize answers promptCapabilities.image: a session/prompt may carry image blocks.
- the block's inline
datais read; itsuriis never opened - the images go with the task a first prompt starts, or with the instruction a later prompt resumes the run with, after the prompt's text
- the limits and the refusals are the ones every image has; a refused image answers the request with a JSON-RPC error that names it
- a prompt that is a directive (
/review,/parallel) takes no image - a request line may be 4 MiB plus the base64 of 4 MiB
/parallel [SPEC --] TASK starts child attempts on the same terms as a run.
Repeat /parallel in the prompt to start another task.
A first prompt can dispatch these tasks without a parent model call.
The model can dispatch work only when [harness.parallel].tool is on.
Child steps appear as labelled messages in the parent conversation while the children run. The parent relays a child's approval request with the child id in the title. The children run in their own clones under the run's budget and sandbox settings. They get no editor filesystem, terminal or connection.
Findings and dispositions appear as [agent6] transcript notices, not native review threads.
Commands act on the conversation's recorded run.
An answer to a queued question reaches the run at its next turn.
An ended run receives the answer on its next prompt, which resumes it.
Use /fix with --resume to confirm Resume to fix when the session is idle.
--all selects every open finding without a queued Fix.
Fix uses the stored reports and leaves the findings open.
It refuses a missing resume point rather than starting a new run.
Live disposition actions use the worker's IPC queue; their notices arrive when recorded. Fix does not support mid-run steering through ACP.
The advertised /receipt command reads testing, review and reversal evidence without calling the worker or rerunning checks.
Ask for a reversal in a subsequent prompt or a new isolated run; displayed git commands are explanations, not executable actions.
See Code-review rules for discovery and limits.
session/request_permission carries every approval the CLI would prompt for.
- a command under
run_commands = "ask" - an MCP tool call the server's
approvedoes not cover - a
fetchto a host outside the allow-list - an unsandboxed autorun
- a new run on another run's branch
The editor renders the buttons; the request names the tool call it gates and carries the prompt as that call's title.
A prompt that gates no call (a pre-run question) announces a tool call of its own and closes it with the answer.
The prompt and its answer go through the same gate every front-end answers through, so agent6 attach and the web show the run as waiting; the answer journals source: "acp", "frontend" when another surface answered it, or "headless" when the client cannot answer it.
- an unanswered request denies after five minutes, and the run continues without it
- a command or an MCP tool call offers the four answers every front-end shares: "allow" (
allow_once) and "deny" (reject_once) answer the one call, "allow all" (allow_always) grants that scope's later calls for the session, "deny all" (reject_always) withdraws the scope's tools for the session - an off-list
fetchhost is offered asallow_onceonly, so an editor's "always allow" cannot cover a different host later - a standing "allow all", from the editor or an earlier front-end, answers that scope's later prompts without asking the editor (
source: "session")
A session is one conversation in one directory.
session/newcarries an absolutecwd, a git repository, whose own layered config applies Each execution uses that directory without changing the connection process's cwd.- the first prompt starts an
agent6 run; every later prompt resumes it with the text as its steering instruction (an execution that died before its first checkpoint leaves nothing to resume: the next prompt starts a new run, and the editor is told) After an undo on another surface, the next prompt follows the run's continuation. - under v1 a busy session refuses a prompt rather than queueing it; under v2 the prompt steers the run
- one connection runs one prompt at a time across its sessions, and a prompt on another session queues and says for which session it waits
session/list(cwdoptional, absolute) names the repository's resumable runs, newest first: agent6's run id assessionId, the task astitle, the last activity asupdatedAt; one page, no cursor. A runagent6 resumewould refuse (a child, a run whose worktree is gone, a run with no checkpoint) is left out. Withoutcwdit covers every repository the connection has a session open in.session/resumeopens a conversation on a recorded run by that id, so an editor reopens its thread after a restart.session/resumerefuses a plan, an ask, a run whose worker is alive, or a runagent6 resumewould refuse. It also refuses a run this connection has open for another directory or with a prompt in flight.session/loadopens the recorded run likesession/resume, replays its journal as orderedsession/updatenotifications, then returns.session/promptanswersend_turnwhen the run finishes, a red gate included, andmax_turn_requestsat the turn cap. A run that fails or never starts answers with a JSON-RPC error (-32603, or-32602for a prompt agent6 refuses); the reason arrives first as a message.session/closeends a conversation; a prompt in flight is cancelled first and answerscancelled.session/cancelcuts a model call in flight and ends a running foreground command at once, without waiting for or signalling the worker (the ACP server itself). The prompt answerscancelled(ACP's word) and the run's record readsstopped, as every operator stop does; what it had not yet committed stays in the tree for the next prompt, which resumes it. A prompt still queued answerscancelledat once. Cancellation releases an open permission wait without waiting for the client's reply. A late permission reply is ignored and cannot grant permission to a later prompt.
session/new, session/load and session/resume answer with configOptions: two selects an editor shows as pickers.
model(categorymodel): the routes the configured providers offer, the list every other front-end's picker offers. Its current value is the route the next prompt runs: the picked one, else the one the run recorded, else the config's.effort(categorythought_level):inherit, which takes the config's effort, thenoff,low,medium,high,xhighandmaxsession/set_config_optionpicks a value for that session alone and answers with the complete list. The pick applies from the next prompt, a prompt that resumes the run included. It changes no running turn and writes no config file.- a set is refused while a prompt runs on the session, and for an id or a value the session does not offer; the error says which
config_option_updatecarries the complete list when agent6 changes it: a run cached a provider's listing, or recorded another route- there is no
modeoption and nomodes: an ACP session only opens runs - a session with no route to run offers no option: its config does not load or names no model, and no run is recorded. The first prompt says why it cannot run.
- a run another front-end detaches to the background keeps the picked model and takes the config's effort
An editor that requests protocolVersion: 2 gets the same runs through v2's messages.
session/promptanswers{messageId}once the prompt's message is in the conversation, not when the run ends. A first prompt is in once its run has recorded it as the task. A later prompt is in once the resumed run has queued it as its steer.- a
user_messageupdate carries the samemessageIdand the prompt's text state_updatereports the session:runningas work starts,requires_actionwhile a permission request is open,idleas work ends- the
idlethat ends the work carries itsstopReason:end_turn,max_turn_requests,cancelledorerror - a run that fails after its message is in ends with
stopReason: "error"and the JSON-RPC error object inerror. A prompt that fails before that answers the request with the error. - a command agent6 answers itself (
/receipt,/findings,/answer,/resolve,/reopen) is a turn of its own: its message,running, its answer,idlewithend_turn. Answered during a run, it reports no state.
- a prompt that arrives while the session runs joins the run's steer queue, as a message typed during a run does on every other surface
- it answers
{messageId}once it is queued, and the run takes it at its next turn boundary - if the run ends or is cancelled first, the steer waits in the queue: the next execution delivers the waiting steers in order before its own prompt reaches the model
- a steer the run handles as a directive (
/pin,/parallel, a skill) is reported when it is sent, and a replay does not repeat it as a user message abort,exit,detachand/undotravel as task text; a composer command (/compact) or a malformed directive answers-32602- a prompt that arrives before the execution has chosen its run answers
-32603; send it again
- a prompt may carry an
idempotencyKeyof 1 to 255 characters; anything else answers-32602 - the message's id is derived from the session and the key, and the run's journal keeps that id with the message; the key itself is not stored
- a prompt whose key names a message the conversation holds answers that
messageIdand adds nothing, after a restart too - a retry that arrives before the first request is answered shares its answer
- a prompt that answered an error left no message, so its key can be sent again
- the key of a command agent6 answered itself is known until the connection ends
- every message carries a
messageId. A message from the journal is named by its row, and a prompt's message by the id its reply carried, so a replay names both as the live run did. The model's streamed text and thinking are chunks of one message per model call; every other message arrives whole. - a tool call is created by its first
tool_call_update, which carries itstitle,nameandkind; there is notool_call - a call waiting on an approval or an answer reads
paused, and a call the operator's stop cut short readscancelled - an edit's diff is one entry:
changesnames each file'soperation(add,delete,modify) and absolutepath, andpatchholds agit_patchof them all. The patch gives an added or deleted file mode100644, since the stored change holds its text alone. - the task list is a
plan_updatewithplanId: "tasks" usage_updatecarriescost: nullwhen the run has no priced total- each command and each command input carries its
type
session/newandsession/resumeanswer withavailableCommandsbesideconfigOptions; an option's key isconfigIdsession/resumetakesreplayFrom: {"type": "start"}to replay the conversation, then sendsreplay_complete. Every resume sends the session'sstate_updatebefore its reply. There is nosession/load.session/set_config_optionneedstype: "id"session/request_permissioncarries the prompt astitleand names the gated call as itssubject; a prompt that gates no call has no subject. A request nobody waits on any more is cancelled with$/cancel_request.session/closereplies after the cancelled work's last update, and closing a session that is not open succeedssession/cancelends withidleandstopReason: "cancelled"; a prompt cancelled before its message is in answers-32800- an unknown session answers
-32002withdata.sessionId - a request with a null
id, and aninitializeafter another request, answer-32600 - a prompt block that is not
text,resource_linkorimageanswers-32602 capabilities.session.prompt.imageadvertises image blocks; no MCP transport is advertised
session/delete: the operator removes a run's record (agent6 sessions remove).- Mid-run steering under v1: v1 has no message for a prompt while the previous prompt is running.
fs/*andterminal/*(v1): ACP lets the client own the filesystem and the terminal, and agent6 keeps both behind the jail the operator configured.- Free-text answers to a waiting
ask_userquestion: the editor gets option buttons only, so a waiting question without options is unanswered and not queued (see the frontend cases);/answertakes any text. - Embedded resources in a prompt: text,
resource_linkandimageblocks are read (a link rides in as its uri; the workspace boundary still decides what it reaches)- v1 drops an embedded resource, as
promptCapabilities.embeddedContextsays; v2 refuses the prompt
- v1 drops an embedded resource, as
- MCP servers and additional directories from the editor: agent6 takes both from its own config, and a session that carries either is refused.
v2 parts agent6 does not send or serve:
notice,compaction_update,compaction_summary_chunk,terminal_update,terminal_output_chunk,subagent_update,session_message,session_message_chunkand thebackgroundlist: agent6's own lines are[agent6]agent messages, and child steps are labelled messages in the parent conversationtool_call_content_chunk: a tool call's content arrives whole in atool_call_updateplan_removed: the task list is the only plan, and it staystool_call/cancel,terminal/cancel,elicitation/create,elicitation/complete,auth/login,auth/logoutandsystemPrompt
v2 rules agent6 does not meet:
- a request before
initializeis served as v1 instead of answering-32600 session/resumeof a session with a prompt in flight on the same connection is refused instead of synchronized- a resume sends no
session_info_update
- stdout is the protocol stream: nothing but JSON-RPC
- everything agent6 would print goes to stderr (the editor's agent logs)
- a wrapper echoing to stdout before exec'ing
agent6breaks the connection irrecoverably; write to stderr
agent6 mcp serve speaks MCP over stdio, so another agent (an editor's own, or a second agent6 with [mcp.servers]) can use agent6's jail and run state.
The cwd's config decides everything: the sandbox the commands run in, and which tools exist at all.
Five tools, of which a default config publishes two:
| Tool | Withheld when |
|---|---|
get_task_graph (a run's task graph) |
never |
list_sessions (this repository's sessions) |
never |
run_verify_command (the configured gate, jailed) |
no [harness.verify] command, or [sandbox] run_commands is not allow |
run_in_sandbox (an argv, jailed) |
[sandbox] run_commands is not allow |
apply_patch_in_sandbox (a patch, then the gate) |
either of the two above |
run_commands = "ask" withholds the command tools: the MCP boundary has no operator to prompt.
// Zed: settings.json -- agent6's jail as another agent's tool surface
{
"context_servers": {
"agent6": { "command": "agent6", "args": ["mcp", "serve"] }
}
}The tools reach the repository the server was started in, under that repository's sandbox policy; list_sessions and get_task_graph read its state dir and nothing else.