Situation. I was working on lumen-argus, a project that runs across three Claude Code sessions in three different repos. They needed to share context — "I just refactored the auth module," "the schema migration landed, pull main." For weeks I was copy-pasting between terminal windows like a caveman.
Task. I wanted cross-session, cross-repo messaging for AI agents. Cheap. Fast. Local. Ideally something I could read with cat if anything went wrong.
Three constraints:
- Token cost per message had to be near zero.
- No new servers, no daemons, no MCP handshake.
- It had to work for any agent — Claude Code today, Cursor or my next project tomorrow.
Action. I surveyed the existing options. mcp_agent_mail, Agent Teams, broker daemons — all of them spin up an HTTP server, register identities, run a SQLite store, and burn tokens on polling hooks. Overkill for three agents swapping a dozen messages a day.
So I borrowed Linus Torvalds' playbook from git:
-
Per-writer append-only logs. One file per agent:
log-<alias>.jsonl. No file ever has two writers, so there's no locking, no interleave, and Syncthing / Dropbox / iCloud can't cause merge conflicts. -
Content-addressed IDs.
id = sha256({ts, from, to, thread, body})[:16]. Same content → same id, so dedup after sync is automatic. -
mtimeshort-circuit. Before parsing anything, stat the log files; if nothing changed, exit immediately.
I packaged it as SAMP (Simple Agent Message Protocol) — a vendor-neutral spec — and shipped a reference implementation, agent-message: three Claude Code slash commands (/message-send, /message-inbox, /message-reply), a msg shell helper for humans, and a tiny Python wrapper any other agent CLI can spawn.
Result.
- 1 Bash tool call per send/receive from Claude Code. No MCP init, no ack roundtrip.
-
0 LLM tokens when humans (or
cron, or scripts) read/send via the shell helper. The model is never in the loop. -
~30 ms latency — that's
python3startup. Everything else is a file append. - Works offline. Syncs across machines via Syncthing / Dropbox / iCloud with zero conflicts by construction.
- One install script. No pip, no npm, no Docker.
Docs: https://slima4.github.io/agent-message/
Repo: https://github.com/slima4/agent-message
Spec: https://github.com/slima4/agent-message/blob/main/SPEC.md
If you're juggling multiple agent sessions and copy-pasting between them, give it a try. PRs and issues welcome.
Tags: ai, claudecode, anthropic, aiagents, SAMP
Top comments (0)