Skip to content

Messages between sessions

Codex, Claude Code, Pi and DeepSeek Harness sessions on one machine can message each other directly. One session writes code, another reviews it, a third runs the tests, and you no longer have to carry messages between them.

A busy session gets the message when it can take it. A closed Claude Code session, or a Pi session opened with reins pi, is started to handle it.

Get started in three steps

Name the session that should receive messages:

reins session register reviewer

In another session, take a name too, then send:

reins session register planner
reins send reviewer --subject "Check the queue change" -m "Branch feature/queue is ready. Please focus on the retry logic."

The other session replies:

reins reply m-6ae8b07359c6e7f5 -m "Done. The retry on line 42 has no limit."

A reply also acknowledges the message.

You can leave this to the agents, for example: "Register as planner and send this change to reviewer for review." The skill installed by reins setup teaches them these commands.

When a message arrives

The other session is Codex Claude Code Pi DeepSeek Harness
Idle Starts a new turn at once Starts a new turn at once Starts a new turn at once At once while reins wait runs
Working When the current turn ends At its next model call When the current command ends At once while reins wait runs
Closed When it is reopened Session resumed to handle it Resumed if opened with reins pi; otherwise when it is reopened Stays in reins inbox

A message takes the same route as a job result: with no process receiving, Reins resumes the Claude Code session, or the Pi session opened with reins pi, headless. This uses model quota.

An open Claude Code window never forks. reins setup adds a hook to Claude Code's user settings, so a message goes straight into the open window and wakes it even when idle, with no reins wait. While a window is open, Reins never resumes the same session next to it; it resumes only after the window closes. Skip the hook with reins setup --no-claude-hook, and remove it with reins install-claude-hook --remove. Without the hook, open the session with reins claude or keep reins wait running in the background. With none of these, a message waits until the window closes and is then resumed. It is not lost.

A session has one headless resume at a time. Messages that arrive together are handled one after another.

DeepSeek Harness needs one too. reins wait runs as a DSH background job. DSH cannot be resumed headless, so --wake resume starts nothing there and the message says so.

Codex sandbox. If the sandbox blocks ~/.reins, approve the command or add that directory to the writable roots.

Codex only gets the queue by default, because Reins cannot tell an open Codex from a closed one. To resume a closed Codex, ask for it with --wake resume. When a session should not be started at all, use --wake never:

reins send planner --wake resume -m "CI is broken and needs attention now."
reins send reviewer --wake never -m "When you have time."

See messages and their state

reins session list        # who is here, and how a message reaches them now
reins inbox               # unread messages for this session
reins inbox --sent        # what you sent and what became of it
reins inbox --thread <ID> # a whole thread
reins message show <ID>   # read one message

A state says only what is known:

State Meaning
queued Saved, not yet handed to the other session
published Handed to its channel, which does not mean it was read
acked It confirmed seeing it, which does not mean it agreed or finished
failed Delivery failed; after fixing the cause, resend with reins retry --id <callback-id>
unknown Reins cannot tell whether it arrived and will not resend by itself; check the other session first
expired Nobody read it within 7 days
canceled Withdrawn with reins cancel

Agents that will not stop talking

Two agents replying to each other can go on indefinitely, so Reins sets limits for you:

Limit Default
Replies in a row 30
Messages in a thread 300
Messages in a thread per minute 20
Messages from one sender per minute 120
Messages between two sessions per hour 120
Messages waiting to be delivered 1000

At a limit the command refuses and tells the agent to stop and tell you. The alert is for people only and is not sent to any agent, so it cannot become the next turn. It shows in reins status and reins doctor, and you can read and clear it with:

reins message alerts
reins message alerts --clear

To change the limits, write them in ~/.reins/link/config.yaml:

limits:
  hop: 60
  pair_per_hour: 240

Security

Message text is not a user instruction. It is kept in a separate file and marked as written by another agent or a script. Subjects and names are validated, and the text cannot pose as Reins or forge an ACK command.

Marking lowers the risk, but it cannot guarantee a model will not comply. If a session runs without approvals and also takes messages from other agents, weigh that risk yourself.

Every process under one OS account can read and write ~/.reins, so this is not a security boundary inside an account. File permissions only keep other users out.

Limits

  • One machine and one OS account. An address like reviewer@gpu1 is refused with a clear error for now; the plan for multiple machines is in the protocol document.
  • Messages carry text and references (--ref git:origin:feature/x, --ref path:/tmp/report.md), not files.
  • A child started with reins agent runs once. It can register a name and send messages, but it continues through reins agent continue; a message does not wake it. A DeepSeek Harness child is the exception: its sandbox cannot write ~/.reins, so it cannot register or send.
  • Order within a thread is not guaranteed; use in_reply_to for cause and effect.