| Filename | Latest commit message | Latest commit date |
|---|---|---|
Audit follow-ups on the secondary-account retry. The accounts snapshot is written by the heartbeat task and, now, by the retry loop. Both used one fixed tmp path, so concurrent writers could clobber it or fail the rename. Each write now names its own tmp file (pid + counter); a test hammers it from four threads. A permanently bad secondary logged three warnings per attempt, every 16 minutes, for as long as the daemon ran. DownAccounts::failed now reports whether a failure is news (first, or a different reason from the last); only that is a warning, repeats are debug. The two per-attempt warnings in client.rs and credential.rs are covered by that line, which names the reason, so the store-token one drops to debug. The comments in client.rs and a credential.rs test, and persistence.md, still described the old skip-until-restart behaviour or implied that a store-listed account without a credential is retried here; that case is handled by the linked-name set changing, not by this loop. |
||
| .. | ||
| 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).