Octomind Integration: Agent Client Protocol, WebSocket
skillConnect Octomind to other software: editors over the Agent Client Protocol (ACP, Zed), WebSocket clients, daemons with webhook hooks, schedule and monitor.
agents that use this skill
instructions
Overview
Octomind connects to other software in four ways: as an ACP agent that an editor launches, as a WebSocket server for your own client, as a named daemon fed by octomind send and webhook hooks, and through the schedule and monitor tools that feed a session from inside. Answer with the exact command, config entry or message shape. octomind <command> --help wins over this text.
All CLI flags and slash commands belong to octomind-cli, the config file layout to octomind-config, the tap, mcp, skill and capability tools to octomind-runtime.
Mental model
Every surface drives the same session engine.
- ACP:
octomind acp [TAG]; JSON-RPC lines on stdin; no send socket, no hooks. - WebSocket:
octomind server [TAG]; JSON text frames; no send socket, no hooks. - Daemon:
octomind run --name N --daemon --format jsonl; first message on stdin,octomind send, hooks. - In-session tools:
scheduleandmonitor; timers and watcher output.
Injected work lands in the session inbox. ACP and WebSocket sessions process it in the background without a prompt, so output can arrive unasked.
Rules
Editors over ACP
octomind acp [TAG]speaks JSON-RPC over stdio. Stdout carries only the protocol. An editor entry is executableoctomindwith args["acp"]or["acp", "<tag>"].- Omitting TAG uses the config
defaultrole; a local role beats a tap agent of the same name. Resolution details are inoctomind-cli. - Flags:
-n/--name,-r/--resume SESSION,--resume-recent,-m/--model,--sandbox,--readonly. The name and resume flags apply to the firstsession/newonly;session/loadignores them.--modelapplies to every session of the process. Start the process in the project directory;session/newalso sendscwd. - Zed: an
agent_serversentry insettings.jsonwith"type": "custom",command,args,env. - JetBrains: Settings > Tools > AI Assistant, add an external agent, command
octomind acp. - Neovim: a CodeCompanion custom adapter or an avante.nvim
vendors.octomindentry, both withcommand = "octomind",args = { "acp" }; the docs call the snippets illustrative. No other editor is documented; any ACP client takes the same executable and args. - Logs go to
logs/under the data directory:acp-debug.log,acp-errors.jsonl,acp-init-errors.log(failures before logging starts). A role that cannot start does not exit:initializesucceeds and every session request fails withAgent '<tag>' cannot start: .... - A host may inject MCP servers in
session/newandsession/load: stdio and HTTP only, SSE skipped, 30 s timeout, stdioenvand HTTPheadersignored, an existing server of the same name kept. - Slash commands are prompt text starting with
/. The menu lists 30 names without the slash, plus plugin commands. The_octomind/commandmethod takes{session_id, command, args}, with the leading slash incommand, and returns{success, output, error}. It does not process trailing/doneinstructions. - Cancel with the
session/cancelnotification. Shut down by closing stdin and reading stdout to EOF. Usage arrives in_meta["octomind.usage"]ofsession_info_update. A prompt on anoctohub:*model without a key fails withauth_required;authenticatewith methodoctomind-loginsigns in.
WebSocket server
octomind server [TAG] [--host 127.0.0.1] [-p 8080] [--sandbox] [--allow-origin ORIGIN].--port 0picks a free port and the startup lineWebSocket server started on ws://<addr>shows it. There is no TLS; put a TLS proxy in front for remote use. Logs:logs/websocket-debug.log.- A handshake with an
Originheader not listed in--allow-origin(exact scheme, host, port) gets HTTP 403. Native clients send noOriginand need no entry. - With
OCTOMIND_SERVER_TOKENset in the environment (there is no flag), every handshake needsAuthorization: Bearer <token>or gets 401. The origin check runs first. Unset means no authentication. - One process is one identity. Any connection may resume any session by name. For several users run one process each, with separate
OCTOMIND_DATA_DIRandOCTOMIND_MEDIA_ROOT. - Frames are JSON text with a
typefield. After connect the server sends astatusframe. Bind first, then message:
{"type":"session","request_id":"r1","session_id":"s1","cwd":"/abs/dir","role":"<tag>","capabilities":["elicitation_v1","commands_v1"]}
{"type":"message","request_id":"r2","session_id":"s1","content":"Explain main.rs","attachments":[{"id":"AbCdEf0123456789GhIjKlMn","kind":"image","media_type":"image/png","name":"a.png","size":1234}]}
{"type":"command","session_id":"s1","command":"mcp","args":["list"]}
{"type":"cancel","session_id":"s1"}
{"type":"close","session_id":"s1"}sessioncreates or resumes:session_idabsent means an auto name; present means resume if the file exists, else create. Thestatusreply saysSession created: <id>orSession resumed: <id>.cwdmust be an absolute existing directory;roleapplies only to a new session.messageandcommandnever create one; an unknown session returnsSession not found: <id>. Send a "session" message first ....commandnames have no leading slash; an unknown one returns anerror, never AI input.- Server frames:
ack {request_id, message_type, session_id, status},assistant {content},tool_use {tool, tool_id, server, params},tool_result {tool, tool_id, server, content, success},status {message, session_id?, data?},error {message, request_id?, code?},injected {source_kind, source_label, content}, andcost {session_tokens, session_cost, input_tokens, output_tokens, cache_read_tokens, cache_write_tokens, reasoning_tokens}.costends every AI turn, also a failed or cancelled one; it addsrequest_idfor the frame that started it,cancelled: trueaftercancel, andpending_work: truewhen a follow-up turn will stream on its own. request_idis optional, non-empty, at most 256 bytes.contentis at most 10 MB, empty only with attachments. Bad JSON returnsInvalid JSON: ...; the connection stays open.- Attachments:
id,kind(image,video,audio),media_type,nameandsizeare all required.idis exactly 24 ASCII letters or digits and is never a path. The server reads the one regular file named<id>.<ext>inOCTOMIND_MEDIA_ROOT(default/home/octo/.octomind/media); zero or several matches are an error. The model must support the modality;audiois not sent to it. - Sessions live in the server, not the connection. A connection can bind several sessions and handles one frame at a time, except
cancel,run_logandelicitation_response. Amessageto a busy session getsSession '<id>' is busy processing another request. Please wait.The newest 2 MiB or 4096 frames per session are held; bind again with"resume":{"stream":"<id>","after":<stream_seq>}to replay them (the ack carriesstream,stream_seq,resumed). - Limits: 10 MiB per frame, 256 queued input frames or 10 MiB per connection, 8192 queued output frames or 16 MiB (more disconnects the client), 64 connections, 10 s handshake, 128 loaded sessions (
closefrees one).
Daemon, send and hooks
- Start:
printf '%s\n' 'Wait for events' | octomind run --name ci --daemon --format jsonl. A run is non-interactive when--formatis set or stdin is not a terminal; it then reads stdin to EOF first, and empty input fails withNo input provided via stdin, even with--daemon. The exception is--daemon --format jsonlon a terminal: empty input, then it waits.--daemonwithout--formaton a terminal stays interactive.--daemondoes not detach the process. Without it a non-interactive run exits once schedules, monitors, jobs and tap runs finish. octomind send --name ci "message"or the message on stdin. Empty text is rejected. The endpoint is a Unix socket$XDG_RUNTIME_DIR/octomind/<name>.sock(fallback<tmp>/octomind-<uid>/<name>.sock; long names are shortened) or the pipe\\.\pipe\octomind-<name>.OCTOMIND_DATA_DIRdoes not move it; runsendas the same OS user. Success means queued, not answered. No running session givesno running session named '<name>'and a non-zero exit.- Hooks are
[[hooks]]tables inconfig.toml:
[[hooks]]
name = "github-push"
bind = "127.0.0.1:9876"
script = "./hooks/push.sh"
timeout = 30nameandbindmust be unique;bindisaddress:port;timeoutis 1 to 3600 seconds, default 30. Activate with--hook github-push, repeatable. Startup aborts when the name is unknown, the script is missing or not executable, or the port is taken. Relative script paths resolve from the launch directory.- HTTP contract: any path, POST only (other methods get 405 and the script never runs). The body (at most 10 MiB, else 413) goes to the script on stdin. The script sees
HOOK_NAME,HOOK_METHOD,HOOK_PATH,HOOK_QUERY,HOOK_CONTENT_TYPE,HOOK_SESSIONandHOOK_HEADER_<NAME>(uppercase, hyphens as underscores). - Responses: exit 0 with non-empty trimmed stdout injects it as a user message and returns 200
ok; empty stdout returns 204 and injects nothing; non-zero exit or spawn failure returns 500; a body that cannot be read returns 400; a script pasttimeoutis killed and returns 504. The listener offers no signature check, TLS or authentication; add them in the script or a proxy. 200 means queued. - Queue: each
sendand webhook message gets its own turn. System results (schedules, monitor batches, jobs, tap replies) can share a turn.
Schedule and monitor tools
- Both belong to capability
orchestration, a built-in server with toolstap,schedule,monitor. An agent without it has neither tool;OCTOMIND_CAPABILITIES=orchestrationforce-enables it. scheduletakescommand:add,list,remove,edit.addneeds exactly one payload:message(injected verbatim as a user message) ortool_call{"name":..., "arguments":{...}}(runs the tool directly; it must be available at schedule time and at firing). Other parameters:when,every,description,id(required forremoveandedit).whenaccepts, in local time:idle,now,in 5m,in 1h30m,in 2h 30m,in 90s,15:30,3:30pm,9am(already past means tomorrow),2026-03-22 15:30.everyacceptsidleor a duration such as30s,10m,1h30m(units h, m, s; at most 10 years); a time interval needs a timewhen, andidlecannot mix with a time. With neitherwhennoreverythe entry fires at next idle. Inedit,everyset tononeoroffclears repetition.- Repeating entries keep their ID until removed. A repeating tool call never overlaps itself. Entries are saved in the session log and restored on resume. The session stays alive while entries are pending.
monitortakesaction:start,list,stop.startneedscommand, run withsh -cin the session directory; its stdout is the event stream. Optional:description,working_directory,flush_interval_seconds(default 30, range 5 to 3600),max_batch_bytes(default 65536, range 1024 to 1048576),timeout_ms(default 600000, range 1000 to 86400000),persistent(true removes the deadline). Out-of-range values are rejected.stoptakesid.- Output is injected in batches no more often than the flush interval; an empty interval produces no turn. A non-zero exit or an unexpected clean exit is reported once and the monitor is not restarted. Use it for sources that keep emitting, such as
tail -f log | grep --line-buffered ERROR.
Exit codes and environment
- 0: success.
- 1: command failed, also a provider failure in a non-daemon run.
- 2: invalid arguments.
- 75: a spending threshold stopped a non-interactive run; the session is saved, resume with
--resume. - 130: forced stop, a second Ctrl+C or SIGTERM.
Variables: OCTOMIND_SERVER_TOKEN (WebSocket bearer token), OCTOMIND_MEDIA_ROOT (WebSocket attachment directory), OCTOMIND_DATA_DIR (moves config, sessions and logs/, not the send endpoint), XDG_RUNTIME_DIR (parent of the Unix send socket directory), RUST_LOG (tracing filter for ACP, WebSocket and daemon), OCTOMIND_CAPABILITIES (force-enable capabilities).
Examples
Zed entry without a tag:
{"agent_servers":{"Octomind":{"type":"custom","command":"octomind","args":["acp"],"env":{}}}}Hooks and send exist only under octomind run:
# Bad: acp has no --hook
octomind acp --hook github-push
# Good
octomind run --name ci --daemon --format jsonl --hook github-pushChecklist
- Editor means ACP, own client means WebSocket, outside events mean daemon.
- A headless daemon gets a first message on stdin and a stable
--name. - A WebSocket client binds with
sessionfirst and treatscostas turn end. - Hook scripts are executable, print the message, and check the sender.
scheduleusescommand,monitorusesaction.
References
- Octomind docs, served at https://octomind.run/docs/: the pages Editor Integration, WebSocket Server, ACP Protocol, Daemon and Hooks, CLI Reference (server, acp, run, send, exit codes) and Environment Variables.
octomind-clifor flags and slash commands,octomind-configforconfig.toml,octomind-runtimefor runtime tools.