How I got my AI agents to communicate across repos — and shipped SAMP doing it

posted Originally published at dev.to 2 min read

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.
  • mtime short-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 python3 startup. 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.

More Posts

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelskiverified - Mar 19

Agent Action Guard

praneeth - Mar 31

AI Agents Don't Have Identities. That's Everyone's Problem.

Tom Smithverified - Mar 13

I spent years trying to get AI agents to collaborate. Then Opus 4.6 and Codex 5.3 wrote the rules

snapsynapseverified - Apr 20

Everyone says DeepSeek is cheaper, but I got tired of guessing the exact math. So I built a calculat

abarth23 - Apr 27
chevron_left

Related Jobs

View all jobs →

Commenters (This Week)

4 comments
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!