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

Published: (April 25, 2026 at 02:18 AM EDT)
3 min read
Source: Dev.to

Source: Dev.to

Situation

I was working on lumen‑argus, a project that spans three Claude Code sessions in three different repositories. The sessions needed to share context—e.g., “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

Create a cross‑session, cross‑repo messaging system for AI agents that is:

  • Cheap and fast
  • Local (no external services)
  • Readable with cat if anything goes wrong

Constraints

  1. Token cost per message must be near zero.
  2. No new servers, daemons, or MCP handshakes.
  3. It must work for any agent—Claude Code today, Cursor or a future project tomorrow.

Action

I evaluated existing options (e.g., 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.

I borrowed Linus Torvalds’ playbook from Git and built SAMP (Simple Agent Message Protocol):

  • Per‑writer append‑only logs – one file per agent:

    log-<agent>.jsonl

    No file ever has two writers, so there’s no locking, no interleaving, and tools like Syncthing, Dropbox, or iCloud can’t cause merge conflicts.

  • Content‑addressed IDs

    import hashlib, json, time
    
    def make_id(ts, frm, to, thread, body):
        payload = json.dumps({
            "ts": ts,
            "from": frm,
            "to": to,
            "thread": thread,
            "body": body
        }, sort_keys=True).encode()
        return hashlib.sha256(payload).hexdigest()[:16]

    Same content → same ID, so deduplication after sync is automatic.

  • mtime short‑circuit – before parsing anything, stat the log files; if nothing changed, exit immediately.

I packaged the spec as a vendor‑neutral document and shipped a reference implementation agent‑message:

  • Three Claude Code slash commands: /message‑send, /message‑inbox, /message‑reply
  • A msg shell helper for human interaction
  • A tiny Python wrapper so any other agent CLI can spawn it

Result

  • One Bash tool call per send/receive from Claude Code. No MCP init, no ack round‑trip.
  • Zero LLM tokens when humans (or cron jobs, scripts) read/send via the shell helper—the model never participates.
  • ~30 ms latency – essentially just Python 3 startup; everything else is a file append.
  • Works offline and syncs across machines via Syncthing, Dropbox, or iCloud with zero conflicts by construction.
  • One‑click install – no pip, npm, or Docker required.

Documentation & source

  • Docs:
  • GitHub:
  • SPEC:

If you’re juggling multiple agent sessions and copy‑pasting between them, give SAMP a try. PRs and issues are welcome.

0 views
Back to Blog

Related posts

Read more »