Skip to main content
The daemon (packages/coding-agent/src/modes/daemon/) separates the agent runtime from its clients. Start it once, then attach as many CLI, TUI, or web clients as you need — they share sessions.

When to use it

  • You want to keep sessions warm between terminal launches.
  • Multiple clients need to attach to the same session (e.g. web + TUI).
  • You want the IPython kernel to stay alive across resumes without re-provisioning.

Start and stop

Attach a client

Multiple clients can attach to the same session. Each client subscribes to AgentSessionEvent and sees the same stream.

Protocol versioning

Two version numbers govern wire compatibility:
  • DAEMON_PROTOCOL_VERSION — bumps only for incompatible changes.
  • DAEMON_SCHEMA_REVISION — bumps for schema changes.
New daemon commands must be capability-gated. Clients advertise capabilities; the daemon won’t send commands the client didn’t advertise support for. This is what lets old and new clients keep working together across upgrades.

Environment forwarding

DAEMON_CLIENT_ENV_KEYS controls which env vars a client can forward to the daemon (so a client-side OPENAI_API_KEY reaches the running agent). Everything else stays on the client. See Configuration.
Last modified on August 17, 2026