Daemon API
The per-user Matrix daemon (mcl-execute daemon) HTTP + SSE surface: chat, message submission, the events transcript stream, intent envelope chains, and identity.
The per-user daemon (mcl-execute daemon) is the runtime surface for a single user. It is single-flight: one user per process, and a concurrent POST /messages returns 409 Busy.
Auth: when started with MATRIX_DAEMON_TOKEN, all routes except /healthz require Authorization: Bearer ***. In production the router terminates Supabase JWT auth and proxies here over the WireGuard mesh.
Routes
| Method | Path | Purpose |
|---|---|---|
| GET | /healthz | Liveness + SSE broker stats |
| POST | /chat | Converse with the agent (Neo front door) |
| GET | /events | Server-Sent Events tail (live transcript) |
| POST | /messages | Submit a prose message (MCL rigorous rail) |
| GET | /intents/{id} | Read the intent envelope chain by ID |
| GET | /me | Per-user settings + identity |
| POST | /shutdown | Graceful drain |
Chat
POST /chat is the Neo conversational front door. It accepts a natural-language message and returns the agent's response.
messagestringrequiredThe user's natural-language input for this turn.
curl -X POST http://localhost:8080/chat \
-H "Authorization: Bearer $MATRIX_DAEMON_TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "Summarise the README and write it to /tmp/summary.md"}'Events stream
GET /events is a Server-Sent Events stream of the live transcript: assistant narration (say), ephemeral progress (status), deliberate notices (notice), and tool activity. The broker uses per-subscriber buffered channels with drop-on-backpressure.
curl -N http://localhost:8080/events -H "Authorization: Bearer $MATRIX_DAEMON_TOKEN"
The SSE broker maintains per-subscriber buffered channels. Subscribers that fall behind experience drop-on-backpressure rather than unbounded memory growth.
Messages
POST /messages submits a prose message through the MCL rigorous execution rail (compile, plan, walk). Returns 409 Busy if a walk is already in flight.
Intents
GET /intents/{id} returns the signed envelope chain for an intent: every lifecycle transition (drafting, planning, executing, completed/failed/cancelled), each an ed25519-signed envelope stored under journal/<intent_id>/<seq>-<kind>.json.
idstringrequiredThe intent ID (also its content-addressed hash root).
envelopesarrayOrdered lifecycle envelopes, each with seq, kind, body, and signature.
Identity
GET /me returns per-user settings and identity information for the authenticated daemon.
