A new open-source tool called Relay aims to solve a persistent problem for developers running multiple AI coding agents: the loss of context when an agent hits its usage limit. Built as a Go daemon, Relay sits in front of agents like Claude Code or Codex and formalizes the handoff process, preventing the manual copy-paste of plans, decisions, and in-progress work.
How the handoff protocol works
Relay monitors an agent's quota in real time using proxy headers, session files, or request counting. When usage crosses a threshold, it requests a safe pause — typically right after a commit — rather than waiting for a 429 error. The system then creates a git snapshot on a dedicated session branch, leaving the main branch untouched.
The core innovation is a signed continuation contract: a JSON and Markdown document containing the original prompt, remaining tasks, decisions made, files touched with SHA-256 hashes, and truncated code snippets. The contract is HMAC-SHA256 signed with a project-local key, so the next agent can verify its authenticity before trusting any content. Tampered or forged contracts are rejected.
Relay dispatches the contract to the next available agent — potentially a different model, account, or provider — which receives it as system context. A heartbeat confirms the new agent has resumed work. The entire process is governed by a finite state machine (RUNNING → PAUSING → SNAPSHOTTED → ENVELOPE_BUILT → DISPATCHED → RESUMING → RUNNING) with durable writes to disk at each step, allowing recovery from a crash mid-handoff.
Additional capabilities unlocked
Beyond basic handoffs, Relay can detect existing agent sessions — including Claude Code, Codex, Copilot, Cursor, Cline, and Continue — via process scanning and reading their on-disk transcript formats, then lift a session mid-flight onto a different provider. It supports account-aware failover, switching between multiple Claude logins before falling back to another provider, and includes a quota wallet with burn-rate forecasting to trigger handoffs proactively.
Relay also enables multi-agent pipelines defined as directed acyclic graphs (DAGs), where each node is an agent handling one part of a task, with fallback providers and acceptance commands gating each step. The tool is explicitly not another coding agent — it is a layer underneath existing agents, preserving context without attempting to write code itself.
Availability and early stage
Relay is available as a Go daemon with a Rust desktop app (egui) and a TUI, distributed as a single binary under the Apache-2.0 license. The project is still early — features like agent detection, the quota wallet, and pipelines shipped in recent weeks — and the author welcomes feedback on what breaks. Installation is via a curl script, and a typical workflow starts with `relay init` followed by `relay run "add a refund flow to the orders service"`.