Toni Maxx

My Claude Code Sessions Talk, and I Can Join In

ai lesson realtime

  • Built with
  • Python

I run a lot of Claude Code sessions. Most of them live on a Mac mini at home. When I travel, I carry a MacBook. For a long time each session was an island. One session could not ask another a question, and I could not see what they were doing unless I sat at the right keyboard.

On 29 November 2026 I fixed that in one day. Getting agents to talk turned out to be the easy part. The real work was deciding when they may talk, who wakes whom, and how I stay in the loop from my phone. Every rule in this note came from something that went wrong first.

The setup: two Macs and one private network

The Mac mini is my main dev box. The MacBook is for travel. Both sit on one Tailscale network, a private network that only my own devices join. My phone is on it too. Nothing below is open to the public internet.

Diagram: on the home desktop Mac, the desk session posts into the room, a hash-chained log with a small web page. The laptop session talks to desk through Remote Control and posts into the room over SSH. My phone reads and replies in the room over the private network.
The whole thing on one page. The session names are made up for this note.

Step 1: a terminal that survives

First I needed to reach the mini from the MacBook and keep working when the connection dropped. I installed tmux, so a terminal keeps running on the mini after I disconnect. I added mosh, so a session survives a sleeping laptop or a bad hotel connection. Then I set up SSH keys in both directions.

Two small problems came up. A command run over SSH could not find my Homebrew tools, because a non-interactive shell does not read the usual profile. A one-line PATH entry in ~/.zshenv fixed it. Then ssh-copy-id failed with "Too many authentication failures". My SSH agent offered so many keys that the other Mac gave up before it reached the right one. The fix was IdentitiesOnly yes in the SSH config, so only the named key is offered.

Step 2: a tiny helper to poke the other Mac

Next I wanted the mini to reach the MacBook without me. I wrote a small zsh script called mbp. It runs commands on the MacBook over SSH:

  • ping checks that the MacBook is awake.
  • ring plays a sound, say speaks a sentence, notify shows a banner.
  • ps and status show what is running, the battery and free disk.
  • run runs any command.
  • ask runs Claude Code headless (claude -p) on the MacBook and returns the answer.

ask needs a long-lived token on the MacBook. Claude Code normally keeps its login in the macOS keychain, and a command that arrives over SSH cannot read it. The token is kept out of every repository.

This helper is one-way and one-shot. It is good for "make a sound when the build is done". It is not a conversation.

Step 3: session to session, built in

Claude Code can now message your other sessions (cross-session messaging). A session finds the others with ListAgents and sends text with SendMessage. Sessions on the same Mac talk over a local socket. Sessions on another of your machines are reached through Remote Control, and those messages travel through Anthropic's servers on the same account.

My first try failed. The MacBook session did not show up at all. I had not given it a name with /rename, and Remote Control was not on. With both done, the mini session asked the MacBook session for its hostname and the time. The answer came back: "link OK".

What I saw in practice:

  • Same Mac: I get a delivery notice. A session can also ask to be told once when another one goes idle.
  • Across Macs: the message arrives, but I got no delivery notice back. A message can also be held for approval, depending on the permission modes of the two sessions.

The docs are clear on one point I like: a message from another session never counts as your consent, and it cannot approve a permission prompt. That matches how I want my agents to treat each other.

Direct messages had one gap. I could not watch them from my phone, and I could not join in.

Step 4: a room I can watch and join

So I built a room: a small group chat for agents, where I can read along and reply.

  • The record. Each room is an append-only file, one JSON line per message. Every line stores a short sha256 fingerprint of the line before it. The room verify command walks the chain and reports the first line that was edited, removed or added. I tested it by changing one word in an old message, and verify caught it. The chain shows tampering. It does not stop it: someone who can rewrite the whole file can rebuild the chain.
  • The command. A room command for agents and for me: say, ask, read, watch, wait, verify, export, pause, resume and answer.
  • The page. A phone-first web page served by a small Python server, standard library only, with live updates over Server-Sent Events. No framework. It listens only on the private network address.
  • Needs toni cards. When an agent wants something outward or irreversible, it posts an ask. On my phone it shows as a card with Approve and Decline.

The rules, in code, not only in a prompt

A prompt can ask an agent to behave. Code can refuse. These rules live in the room command itself:

  1. An agent replies only when it is @mentioned or given a task.
  2. @all wakes the agents only when I post it.
  3. A paused room refuses agent posts. Only I pause, resume and answer asks.
  4. After 6 agent messages in a row without me, posting stops. The agent must use an ask and wait for me.

Agents wake up with room wait, which runs as a background task and returns as soon as a message mentions them. Try the rules yourself:

Interactive · toy

The room rules, as the code enforces them:

  • An agent replies only when it is @mentioned.
  • @all wakes the agents only when the human posts it.
  • A paused room refuses agent posts. Only the human pauses and resumes.
  • After 6 agent messages in a row without the human, agents must stop and ask.
  • Each line stores a fingerprint of the line before it, so an edited or removed line breaks the chain and verify finds it.

What went wrong, and what each fix taught me

Nobody answered my hello. The first time I opened the page on my iPhone, I said hello. Nothing happened. No agent was listening. Now every agent in a room keeps a room wait listener running, and starts a new one after each reply.

An agent woke the other agent with @all. One agent wrote @all in a normal message, and the other agent woke up. Two agents can keep each other busy that way. Now @all only counts when I write it.

The login service could not read my Desktop. I run the page server as a macOS login agent, so it starts on its own. It failed with "Operation not permitted". macOS privacy rules block a login agent from reading files on the Desktop. I moved the room files to a folder in my home directory, and the server runs an installed copy of the code.

The 6-message guard fired for real. The MacBook agent hit the limit and its post was refused. It stopped and waited. It did not look for a way around the rule. That is the behaviour I wanted, and it was good to see it happen once outside a test.

An honest correction. Everything posted from the web page is recorded as me, because only my devices can reach it. When the setup agent created a room through the page, the log said I did it. The agent did not edit the log to fix that. It posted a correction message below it. A log you can edit quietly is not worth much.

The fun part. Announcements can be spoken out loud. The Macs read the weather and the time, and one of them speaks through an Echo speaker over Bluetooth. I picked a Siri voice for it. The voice setting in System Settings could not be automated, so it was set through the Accessibility preference instead.

The flow that works now

  1. I ask one session for something.
  2. It sends a message to the session on the other Mac.
  3. That session does the work.
  4. It posts the result in the room.
  5. I read it on my phone, and reply there if I need to.

What I would keep: the rules in code, the chained log, and the phone page with no framework. What I would change: I would give every agent its listener from the first minute, and I would make @all a human-only word from the start.

The same habits run through the rest of my work: one AI gateway with credits per person, keeping the last good data when a source fails, and one engineer owning the path end to end. If you want AI features with rules your team can see and trust, read about my AI features work.

Book a free consult