How jyotbuch/ctxrelay works
ctxrelay preserves coding-agent context across subscription switches through two complementary workflows: durable task-state capture and repository-graph indexing/query. A switch assembles recorded notes, verified work, live Git state, and graph context into a handoff, then checks and launches the destination CLI. The graph also supports MCP and optional natural-language code search. Edges reflect shown calls or README-documented behavior; several CLI and graph details are unsampled, so those relationships are omitted rather than inferred.
Main entry points: cli.py Command router · handoff.py Handoff renderer · mcp_server.py MCP tools · state.py Task notes
Components 13
CLI and setup
- Command router
ctxrelay/cli.py - Terminal interface
ctxrelay/ui.py - MCP tools
ctxrelay/mcp_server.py
Task capture
- Task notes
ctxrelay/state.py - Work events
ctxrelay/events.py
Code graph
- Repository index
ctxrelay/graph.py - Code search
ctxrelay/graph.py
Handoff and switching
- Handoff renderer
ctxrelay/handoff.py - Switch checks
ctxrelay/switch.py
Other components
- Developer
- Coding agent
- Git repository
- Destination CLI
Connections 18
- Developer → Command router: runs commands
README.md - Command router → Terminal interface: shows status
ctxrelay/cli.py - Command router → Task notes: records notes
ctxrelay/cli.py - Command router → Work events: ingests events
ctxrelay/cli.py - Command router → Repository index: refreshes index
ctxrelay/cli.py - Command router → Handoff renderer: writes handoff
ctxrelay/cli.py - Command router → Switch checks: checks destination
ctxrelay/cli.py - Coding agent → MCP tools: calls tools
README.md - MCP tools → Repository index: serves graph queries
ctxrelay/mcp_server.py - MCP tools → Task notes: records notes
ctxrelay/mcp_server.py - MCP tools → Handoff renderer: renders handoff
ctxrelay/mcp_server.py - Handoff renderer → Task notes: loads notes
ctxrelay/handoff.py - Handoff renderer → Work events: summarizes work
ctxrelay/handoff.py - Handoff renderer → Repository index: reads code map
ctxrelay/handoff.py - Handoff renderer → Git repository: reads repository state
ctxrelay/handoff.py - Switch checks → Destination CLI: checks and launches
ctxrelay/switch.py - Command router → Destination CLI: launches switch
README.md - Code search → Coding agent: finds code by description
README.md