> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qredence.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Daemon

> Run Fleet Prime Agent as a background process that CLI, TUI, and web all attach to.

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

```bash theme={null}
prime-agent daemon      # start the daemon
prime-agent status      # verify it's running
prime-agent shutdown    # stop it cleanly
```

## Attach a client

```bash theme={null}
prime-agent ps                   # list sessions
prime-agent attach <session-id>  # attach the current terminal
```

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](/fleet-prime-agent/reference/configuration).

## Related

* [Daemon protocol reference](/fleet-prime-agent/reference/daemon-protocol) — versioning rules and classification.
* [Monitoring](/fleet-prime-agent/guides/monitoring) — `doctor --fix` and `status` commands.
