@rajdevxd/agentrelay
v2.0.7
Published
Switch coding agents without losing context. Generate handoff prompts across Claude Code, Codex, and OpenCode.
Maintainers
Readme
AgentRelay
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.
Problem
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
Solution
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.
Supported Sources
- Claude Code
- Codex
- OpenCode
Supported Targets
- generic
- claude
- codex
- cursor
- chatgpt
Features
- 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
Install
Run once with npx:
npx @rajdevxd/agentrelayInstall globally:
npm i -g agentrelayQuick Start
cd 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
Usage
# 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 5Commands
- continue (default): generate handoff prompt
- doctor: validate environment, source availability, git, clipboard, and API key state
- sessions: list recent sessions for current project
Flags
| 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 |
LLM Refinement
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.jsonSession Storage Paths
| Source | Path | Format | | --- | --- | --- | | Claude Code | ~/.claude/projects//.jsonl | JSONL | | Codex | ~/.codex/sessions////.jsonl | JSONL | | OpenCode | ~/.local/share/opencode/opencode.db | SQLite |
Requirements
- 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
Troubleshooting
- 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
Maintainer
- GitHub: https://github.com/codewithevilxd
- Portfolio: https://nishantdev.space
- Email: [email protected]
License
MIT
