I have two separate agent instances running on two different machines. I wanted them to stay in sync with each other - not real-time chat, just low-frequency operational sync:
- pass task notes back and forth
- keep my
USER.mdpreferences/profile synced across both machines - sync my custom skills folder
- without standing up Redis, Kafka, or some custom message broker
(And before anyone asks “why not ACP?” - ACP is for local editor-to-agent IPC on one machine, it doesn’t do cross-machine state sync.)
Since I already had an S3 bucket mounted on both machines via rclone mount (from my S3 on macOS setup), my first thought was: hey, both machines already see this folder, let’s just use a shared directory as a file-based message bus!
bus/
inbox-a/
inbox-b/
archive-a/
archive-b/
PROTOCOL.txt
Super simple protocol:
- Machine A drops a JSON file into
inbox-b/ - Machine B reads
inbox-b/, does the work, and moves the JSON file toarchive-b/
Looked great on paper.
Why the shared mount failed
Remember that --dir-cache-time 30m flag I put on my rclone mount so Finder wouldn’t lag? Yeah, that came back to bite me here.
Because it’s an object-store mount with directory caching (not a real POSIX filesystem), I kept hitting this exact sequence:
- Machine A writes a message into
inbox-b/ - Machine B runs
ls inbox-b/and sees an empty folder - I check S3 directly - the file is 100% there
- Machine B still thinks the folder is empty because its local FUSE directory cache hasn’t expired yet
Even though my sync job only ran everyfew hours, a 30-minute stale directory cache meant you could never trust ls. Did the other agent not send an ack yet, or is FUSE lying to me?
I briefly thought about setting up a proper NFS share over Tailscale or AWS EFS, and immediately decided against it. Who wants to babysit stuck NFS mounts across laptops that sleep and wake up on different Wi-Fi networks?
The fix: just use Git as the bus
Switched the whole thing from a mounted folder to a tiny private Git repo:
bus-repo/
inbox-a/
inbox-b/
archive-a/
archive-b/
user-sync/
USER.md
README.md
Now the agent cron job does this:
git pull- Read everything in its inbox
- Move processed messages to
archive/ git add -A && git commit && git push- Write any outbound messages to the other agent’s inbox
git add -A && git commit && git push
Also kept two separate repos so things stay clean:
skillsrepo -> actualSKILL.mdfiles and scriptsbusrepo -> inbox/archive JSON messages (pull-skills,ack,profile-updated,heartbeat) +USER.md
Merging USER.md with the model instead of git merge
One nice trick for USER.md: since both agents can learn new preferences about me independently, a standard line-by-line git merge on prose notes is annoying and creates dumb merge conflicts.
Instead, when USER.md changes, the sync job does an in-model merge:
- Read remote
USER.mdand localUSER.md - Combine the facts and deduplicate
- Write out the clean merged
USER.mdand commit
Why Git works way better here
With the FUSE mount, everything was guesswork - is the file actually written? Is the directory listing cached?
With Git, if git pull succeeded, you have the exact state of the bus at that commit SHA, plus a full git log audit trail of when every message was sent and archived. For low-frequency sync between agents across machines, git pull / git push beats a shared network mount every time.