--- name: codex-collab description: Use when the user asks to invoke, delegate to, or collaborate with Codex on any task. Also use PROACTIVELY when an independent, non-Claude perspective from Codex would add value — second opinions on code, plans, architecture, or design decisions. --- # codex-collab codex-collab is a bridge between Claude and Codex. It communicates with Codex via the `codex app-server` JSON-RPC protocol, giving you structured, event-driven access to Codex's capabilities — prompting, code review, tool use, and file editing. Requires bun and the codex CLI on PATH (`codex-collab health` to verify). ## Choosing a path `codex-collab peer up` (foreground, seconds, idempotent) prints the workspace's address, `codex(myproject-a1b2c3)`; `ListAgents` shows it plus one entry per ongoing conversation. `SendMessage` to any of them is the normal way to talk to Codex. Use the CLI instead for `review`, for a result you need within the current turn (`run` blocks and exits with a status code), and for `--goal`, `--template`, or interactive approval policies. Both paths produce the same threads: a CLI-started thread can be messaged afterwards, and a messaged conversation appears in `codex-collab threads`. ## Choosing a path Drive Codex interactions through the `codex-collab` CLI — `run` for tasks, `review` for code review, `--resume` for follow-ups. The ask channel is how Codex reaches you mid-task; `next` watches for those events. ## Native Peer Messaging `SendMessage` to `codex(myproject-a1b2c3)` starts or continues a conversation. Any message may open with a header block of `key: value` lines, stripped before Codex sees the text. `topic:` names or selects the conversation (a later `topic:` switches to that conversation, or starts it); `model:`, `effort:` and `timeout:` (seconds per turn; default 3600 or `config timeout`) set the conversation's settings and, on a later message, change them from the next turn; `sandbox:` and `approval:` are fixed when the conversation starts (`approval:` accepts only `auto`, Codex Guardian — interactive approval prompts route to CLI clients and cannot work over messaging). Parsing stops at the first line that is not a recognized key, so ordinary prose is never consumed as a header. ``` topic: auth refactor effort: xhigh sandbox: read-only Review the login flow and tell me what you would change. ``` Each conversation appears as its own entry in `ListAgents` under its name. Reply to a message's `from` address to continue that specific conversation; a message to a busy conversation is delivered into the running turn and answered when it ends. Messaging is asynchronous: after sending, end your turn — do not poll, sleep, or block waiting for a reply. The reply arrives on its own as a cross-session message that wakes your session, even if you are busy with other work when it lands. A reply that lands mid-turn is folded into your context and renders in the Claude Code terminal, but not on remote views of the session (phone, web). Relaying its substance is normally enough; `codex-collab output --last` is only needed when the transcript itself must carry the verbatim text — for a remote reader, or a reply held back by the receiver's `crossSessionInbound` setting. Messaged conversations write the same run records as CLI runs, so `codex-collab progress `, `output`, `follow` and `kill` work on them; the `` is the short ID in the conversation's address (`peer-.sock`), and `codex-collab threads` lists them alongside CLI runs. A turn that exceeds its limit is stopped and reported as a timeout, so silence means Codex is still working — use `progress` to see what it is doing, not to wait. Codex may send a `[consult]` message mid-task when it needs your judgment; reply to that address to answer. If you don't, Codex proceeds on its own after a timeout. If `peer up` reports messaging unavailable (Windows, or an older Claude Code), the CLI handles everything. Codex can also reach you directly: `codex-collab send` from a Codex session delivers a message to your session from that Codex thread's own address, `codex(-)`; the message's last line names the thread. Reply with `SendMessage` to that address. It is the thread's while you run, so you can also write to it later with anything the thread should know, such as what changed after the user talked to you directly; whatever you send there is kept for the thread. After a day with nothing through it (`config address-idle`) it closes until the thread next sends, and a send to it is refused as one to any session gone. The first thing you send back after a message is its reply, however long the work takes, until the message's task expires four hours after it was sent, so the message carries no deadline. In a session codex-collab started, time spent at a prompt the user answers through Remote Control does not count toward those hours, and once they answer one there are at least 60 minutes (`config linger`) left to reply. If `send` found no Claude session in the workspace, it resumed the workspace's background session, conversation intact, or else started one — a `claude(-)` session in the working directory with none of the user's conversation, running in `auto` permission mode so it can carry out the work Codex hands it, that stops after 60 idle minutes by default (`config linger`). Codex can start further ones beside it, each with a label in its name, `claude(-