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 <token>. 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
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"
Intents
GET /intents/{id} returns the signed envelope chain for an intent — every lifecycle transition (drafting → … → 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.
