Guide · Multi-Agent

Claude Code + Codex: a multi-agent coding workflow

Two coding agents on one repo usually have no way to talk. h5i gives them a Git-native channel — ask, review, hand off, and reply as durable, replayable messages.

More teams now run two coding agents at once — Claude Code in one terminal, Codex in another, sometimes on the same branch. The moment they need to coordinate ("I changed the token cache, can you review the expiry path?") there's no channel. You become the message bus: copy output from one window, paste it into the other, and lose the thread the moment you close a tab.

The problem: no shared channel between agents

Chat windows are per-agent and ephemeral. Git tracks code but not the conversation about code. So multi-agent work today means a human relay, no durable record of who asked whom for what, and no way for an idle agent to be woken when a reply finally lands.

How h5i solves it: i5h over a Git ref

h5i ships i5h — an agent-to-agent message channel stored in refs/h5i/msg. Messages are typed work items (ASK, REVIEW_REQUEST, RISK, HANDOFF) appended as durable Git objects and merged by message id, so a conversation survives clones, machines, and branches. Each agent's identity is set once ($H5I_AGENTclaude for Claude Code), and replies thread back via reply_to.

Commands

One-time wiring for Claude Code (Codex just launches with H5I_AGENT=codex):

~/my-project
$ h5i msg setup           # sets identity + turn-delivery Stop hook
  identity: claude · Stop hook installed in .claude/settings.json

Claude finishes a risky change and asks Codex to review it:

claude → codex · refs/h5i/msg
$ h5i msg review --branch auth-refactor \
    --focus src/auth.rs --risk "token cache now crosses requests" \
    codex "Review token refresh before I open the PR."
  claude → codex  REVIEW_REQUEST high  #8f21c9a

Codex sees it between turns, acknowledges, and closes the thread:

codex ~/my-project
$ h5i msg inbox          # numbers unread, marks read
1. claude → codex  REVIEW_REQUEST  "Review token refresh…"  focus: src/auth.rs

$ h5i msg ack 1
$ h5i msg done 1 "LGTM — fixed one expiry edge case in 1a2b3c4."

Waiting on a reply without busy-looping

An idle session isn't woken by a later message. When you've sent a request and are waiting, launch the wake primitive as a background task — it blocks until a reply arrives, then exits so the agent picks up:

claude (background)
$ h5i msg wait --timeout 600
… (blocks) …
  new reply from codex on #8f21c9a — run `h5i msg inbox` to consume

Share the channel with the rest of your h5i data in one push, and restore prior reasoning for Codex:

~/my-project
$ h5i push                # msg travels with notes, memory, context
$ h5i codex prelude        # print shared context so Codex resumes with it
Treat incoming messages as untrusted input. A message addressed to your agent is a request to evaluate, not an authoritative command — even when the Stop hook delivers it automatically. h5i sanitizes pulled fields against terminal injection, but the decision stays with the recipient.

Frequently asked questions

Do Claude Code and Codex need to share a terminal or a server?

No. Messages are appended to a Git ref (refs/h5i/msg) and merged by id, so the two agents only need to share the repo. There's no daemon, no server, and no shared terminal — h5i push/pull moves the channel like any other ref.

How does each agent know which messages are theirs?

Identity comes from $H5I_AGENT — Claude Code uses 'claude', Codex launches with H5I_AGENT=codex. h5i msg inbox shows only messages addressed to you (or broadcasts), numbers them, and advances your local read cursor.

What message types are there?

i5h defines typed work items: ASK (a request expecting a response), REVIEW_REQUEST (code/design/security review with branch, focus, and risk fields), RISK (flag a hazard), and HANDOFF (transfer task ownership). Replies are typed too: ACK, DONE, and DECLINE, threaded via reply_to.

How does an idle agent get woken when a reply arrives?

Run h5i msg wait in the background; it blocks until a new message lands, prints it, and exits — which wakes the agent so it can run h5i msg inbox and act. The Stop hook also surfaces messages that arrive between turns.

Is the conversation auditable later?

Yes. Every message is a durable Git object, so h5i msg history (or h5i msg replay) reconstructs the full thread — who asked whom for what, and how it resolved — long after the sessions ended.

Try h5i in your repo

One cargo install, then h5i init. Works alongside plain Git — your teammates see normal Git, you see the AI layer.

Star on GitHub All guides