AgentRelay helps you switch coding agents without losing momentum.
It reads your current AI session, captures real project state (including git context), and generates a high-quality continuation prompt so the next agent can continue from where you actually stopped.
When you switch agents mid-task, context usually breaks.
- Important decisions are scattered in chat history
- Errors and failed attempts get repeated
- The next agent starts from an incomplete picture
AgentRelay builds a clean handoff prompt from:
- Session messages
- Tool calls and outputs
- Open errors and failed approaches
- Current git state and changed files
Result: faster context transfer, less repetition, better continuity.
- Claude Code
- Codex
- OpenCode
- generic
- claude
- codex
- cursor
- chatgpt
- Smart latest-session detection for the current project
- Focused context extraction with noise reduction
- Error-aware prompt generation
- Git-aware summaries (status, diffs, untracked files)
- Optional prompt refinement via OpenRouter
- Clipboard copy on macOS, Linux, and Windows
- Built-in diagnostics with doctor command
- Session browsing with sessions command
Run once with npx:
npx @rajdevxd/agentrelayInstall globally:
npm i -g agentrelaycd your-project
agentrelayYou will:
- Pick source agent (if not provided)
- Parse latest session for current repo
- Capture git/project context
- Generate continuation prompt
- Copy output to clipboard
# Basic
agentrelay
# Choose source
agentrelay --source claude
agentrelay --source codex
agentrelay --source opencode
# Choose target style
agentrelay --source claude --target codex
# Use exact session
agentrelay --source codex --session <id-or-path>
# Save output to file
agentrelay --output ./handoff.md
# Refine with OpenRouter
agentrelay --refine
# Pick preserved context start interactively
agentrelay --pick-user
# Start preserved context from nth user prompt
agentrelay --from-user 2
# Diagnostics
agentrelay doctor --source claude
# List sessions
agentrelay sessions --source codex --limit 5- continue (default): generate handoff prompt
- doctor: validate environment, source availability, git, clipboard, and API key state
- sessions: list recent sessions for current project
| Flag | Description |
|---|---|
| --source | Source agent: claude, codex, opencode |
| --target | Target format: generic, claude, codex, cursor, chatgpt |
| --session <id|path> | Use specific session |
| --pick-user | Pick starting user message interactively |
| --from-user | Start preserved context from nth user message |
| --output, -o | Write final prompt to file |
| --refine | Refine prompt with provider |
| --provider | Refinement provider (default: openrouter) |
| --model | Override model |
| --api-key | Override provider API key |
| --limit, -n | Session rows limit for sessions command |
| --help, -h | Show help |
| --version, -v | Show version |
Refinement is optional.
- Provider: openrouter
- API key resolution order: CLI flag, env variable, local config
Environment variable:
OPENROUTER_API_KEY=your_key_hereLocal config file path:
~/.agentrelay.json
| Source | Path | Format |
|---|---|---|
| Claude Code | ~/.claude/projects//*.jsonl | JSONL |
| Codex | ~/.codex/sessions////*.jsonl | JSONL |
| OpenCode | ~/.local/share/opencode/opencode.db | SQLite |
- Node.js 18+
- One supported source agent with existing session data
- sqlite3 CLI only for OpenCode source
- Git repository recommended for best code-state capture
- No sessions found:
- Run source agent once in the current project
- Run agentrelay sessions --source
- Run agentrelay doctor --source
- OpenCode parsing issues:
- Ensure sqlite3 CLI is available
- Refinement failed:
- Check OPENROUTER_API_KEY
- Retry without --refine to use raw mode
- GitHub: https://github.com/codewithevilxd
- Portfolio: https://nishantdev.space
- Email: codewithevilxd@gmail.com
MIT