| Filename | Latest commit message | Latest commit date |
|---|---|---|
The daemon reads each account's token from `swarm/agents/<agent>/matrix/` as the agent itself, inside its own container, and falls back to the file only when the store has none. This is #4519's read, without its `main` carve-out: the swarm now mints `main` there and no hive writes the file. The daemon unit gets the agent's store identity, spelled the way forge-token.nix spells it. A timer re-starts it while it is down: a token the swarm mints or replaces in the store changes no file, so the path watcher never fires for it, and a daemon that exited on a replaced token would otherwise stay down until the container restarts. |
||
| .. | ||
| src | ||
| Cargo.toml | ||
| README.md | ||
hive-matrix-mcp
Per-agent matrix integration: a long-running daemon
(hive-matrix-daemon) that holds a matrix-sdk Client + sync loop per
configured account and serves the matrix tool surface (send_message,
send_dm, list_rooms, read_room, …) directly over streamable-http.
No stdio bridge, no per-turn respawn — claude reconnects to the same
stable URL every turn.
When to use it
Look here when changing matrix tool behaviour, multi-account handling,
or the incoming-event → todo/wake path. The daemon owns the whole
lifecycle: per-account bring-up (accounts.rs, client.rs), the sync
loop that sweeps invites/unread rooms into the harness's in-agent todo
socket (timeline.rs, wake.rs), and the MCP tool router itself
(mcp.rs).
Shape
One bin (hive-matrix-daemon, src/main.rs) built from the crate's
own lib (src/lib.rs):
accounts.rs— multi-account config + the account→Clientdispatch registry (mainis always the hive-internal primary; extras come fromHIVE_MATRIX_ACCOUNTS).client.rs— session restore, stale-token recovery, avatar sync, cross-signing bootstrap.timeline.rs/wake.rs— per-sync-callback invite/unread sweeps that push todos ontoHIVE_AGENT_SOCKET.handlers.rs— per-tool dispatch, returnsprotocol::DaemonResponse.mcp.rs— thermcptool router +serve_http, resolving each call's optionalaccountarg against the registry before calling intohandlers.paths.rs— per-agent path resolution (token file, matrix-sdk state dir, homeserver URL, accounts snapshot).