One delegation policy, three orchestrators.
The Cross-CLI Role Handshake turns the coding-agent CLIs installed on
one machine — claude (Claude Code), codex (OpenAI Codex), and agy
(Google Antigravity) — into each other's pseudo-subagents. Whichever CLI
you are driving is the orchestrator; it delegates suitable work to the
other two via shell, with a role marker (CROSS_CLI_ROLE=DELEGATE /
CROSS_CLI_ORCHESTRATOR=<name>) that prevents delegation loops while
keeping every delegate's own skills, rules, and hooks active.
Previously this policy lived as three hand-synchronized documents (one per CLI). This toolkit replaces them with a single canonical, orchestrator-neutral source:
AGENTS.md # authoritative repository guidance
CLAUDE.md # generated @AGENTS.md bridge
rules/shared/
core.md # handshake, routing principles, write preconditions,
# budgets, cooldowns, verification, destructive-action policy
delegates/claude.md # per-delegate profile: exact invocation, resume
delegates/codex.md # pattern, quirks, and "route here when" criteria
delegates/agy.md
AGENT-INSTALL.md # the agent-guided, merge-aware install contract
The same four policy files install identically for all three harnesses; each CLI reads the policy as addressed to itself and skips its own delegate profile. The repository and install layout follows Portable Agent Authoring: shared policy bodies stay neutral, while each host receives one marker-guarded pointer in its global instruction file.
- Role handshake — orchestrator/delegate markers, prompt-injection resistance (markers only count in the first two lines of a direct invocation), role persistence across resumed sessions.
- Task routing — capability profiles per delegate (strong tier: Claude, Codex; fast tier: Agy), failure fallbacks, unavailability handling.
- Write-task preconditions — clean git baseline, one writer and one orchestrator per working tree, secrets scoping.
- Runtime budgets and conversation-local usage-limit cooldowns.
- Verification — the orchestrator reviews every delegate diff and sends findings back to the same delegate session before ever fixing directly.
- Destructive actions — never delegated; delegates must stop and report.
This is a user-global, user-machine toolkit — it configures the CLIs on your machine and never touches projects. There is no project-level install.
Paste this prompt into any of your coding agents:
Fetch https://github.com/ghraw/jpbaking/cross-cli-handshake/main/AGENT-INSTALL.md and follow it end to end.
Installs are merge-aware: your existing ~/.gemini/GEMINI.md,
~/.codex/AGENTS.md, and ~/.claude/CLAUDE.md content is preserved, and
any legacy hand-maintained copy of this policy is only removed with your
approval. Re-run the same procedure to update; it is per-user, per-machine,
and single-version.