view source

Octomind Integration: Agent Client Protocol, WebSocket

skill

Connect Octomind to other software: editors over the Agent Client Protocol (ACP, Zed), WebSocket clients, daemons with webhook hooks, schedule and monitor.

Apache-2.0 Requires: octomind binary on PATH. macOS/Linux/Windows.

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: schedule and monitor; 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 executable octomind with args ["acp"] or ["acp", "<tag>"].
  • Omitting TAG uses the config default role; a local role beats a tap agent of the same name. Resolution details are in octomind-cli.
  • Flags: -n/--name, -r/--resume SESSION, --resume-recent, -m/--model, --sandbox, --readonly. The name and resume flags apply to the first session/new only; session/load ignores them. --model applies to every session of the process. Start the process in the project directory; session/new also sends cwd.
  • Zed: an agent_servers entry in settings.json with "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.octomind entry, both with command = "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: initialize succeeds and every session request fails with Agent '<tag>' cannot start: ....
  • A host may inject MCP servers in session/new and session/load: stdio and HTTP only, SSE skipped, 30 s timeout, stdio env and HTTP headers ignored, 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/command method takes {session_id, command, args}, with the leading slash in command, and returns {success, output, error}. It does not process trailing /done instructions.
  • Cancel with the session/cancel notification. Shut down by closing stdin and reading stdout to EOF. Usage arrives in _meta["octomind.usage"] of session_info_update. A prompt on an octohub:* model without a key fails with auth_required; authenticate with method octomind-login signs in.

WebSocket server

  • octomind server [TAG] [--host 127.0.0.1] [-p 8080] [--sandbox] [--allow-origin ORIGIN]. --port 0 picks a free port and the startup line WebSocket 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 Origin header not listed in --allow-origin (exact scheme, host, port) gets HTTP 403. Native clients send no Origin and need no entry.
  • With OCTOMIND_SERVER_TOKEN set in the environment (there is no flag), every handshake needs Authorization: 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_DIR and OCTOMIND_MEDIA_ROOT.
  • Frames are JSON text with a type field. After connect the server sends a status frame. Bind first, then message:
json
{"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"}
  • session creates or resumes: session_id absent means an auto name; present means resume if the file exists, else create. The status reply says Session created: <id> or Session resumed: <id>. cwd must be an absolute existing directory; role applies only to a new session. message and command never create one; an unknown session returns Session not found: <id>. Send a "session" message first ....
  • command names have no leading slash; an unknown one returns an error, 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}, and cost {session_tokens, session_cost, input_tokens, output_tokens, cache_read_tokens, cache_write_tokens, reasoning_tokens}. cost ends every AI turn, also a failed or cancelled one; it adds request_id for the frame that started it, cancelled: true after cancel, and pending_work: true when a follow-up turn will stream on its own.
  • request_id is optional, non-empty, at most 256 bytes. content is at most 10 MB, empty only with attachments. Bad JSON returns Invalid JSON: ...; the connection stays open.
  • Attachments: id, kind (image, video, audio), media_type, name and size are all required. id is exactly 24 ASCII letters or digits and is never a path. The server reads the one regular file named <id>.<ext> in OCTOMIND_MEDIA_ROOT (default /home/octo/.octomind/media); zero or several matches are an error. The model must support the modality; audio is 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_log and elicitation_response. A message to a busy session gets Session '<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 carries stream, 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 (close frees 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 --format is set or stdin is not a terminal; it then reads stdin to EOF first, and empty input fails with No input provided via stdin, even with --daemon. The exception is --daemon --format jsonl on a terminal: empty input, then it waits. --daemon without --format on a terminal stays interactive. --daemon does 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_DIR does not move it; run send as the same OS user. Success means queued, not answered. No running session gives no running session named '<name>' and a non-zero exit.
  • Hooks are [[hooks]] tables in config.toml:
toml
[[hooks]]
name = "github-push"
bind = "127.0.0.1:9876"
script = "./hooks/push.sh"
timeout = 30
  • name and bind must be unique; bind is address:port; timeout is 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_SESSION and HOOK_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 past timeout is 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 send and 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 tools tap, schedule, monitor. An agent without it has neither tool; OCTOMIND_CAPABILITIES=orchestration force-enables it.
  • schedule takes command: add, list, remove, edit. add needs exactly one payload: message (injected verbatim as a user message) or tool_call {"name":..., "arguments":{...}} (runs the tool directly; it must be available at schedule time and at firing). Other parameters: when, every, description, id (required for remove and edit).
  • when accepts, 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. every accepts idle or a duration such as 30s, 10m, 1h30m (units h, m, s; at most 10 years); a time interval needs a time when, and idle cannot mix with a time. With neither when nor every the entry fires at next idle. In edit, every set to none or off clears 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.
  • monitor takes action: start, list, stop. start needs command, run with sh -c in 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. stop takes id.
  • 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:

json
{"agent_servers":{"Octomind":{"type":"custom","command":"octomind","args":["acp"],"env":{}}}}

Hooks and send exist only under octomind run:

bash
# Bad: acp has no --hook
octomind acp --hook github-push
# Good
octomind run --name ci --daemon --format jsonl --hook github-push

Checklist

  • 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 session first and treats cost as turn end.
  • Hook scripts are executable, print the message, and check the sender.
  • schedule uses command, monitor uses action.

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-cli for flags and slash commands, octomind-config for config.toml, octomind-runtime for runtime tools.