@jimmyyen/opencode-code-relay-plugin
v0.1.8
Published
OpenCode plugin that automates the Code Relay protocol (concept based on yan5xu/code-relay): cross-session and cross-repo state handoff for AI coding agents.
Maintainers
Readme
OpenCode Code Relay Plugin
OpenCode plugin that automates the Code Relay protocol: cross-session and cross-repo state handoff for AI coding agents. It turns the manual HANDOFF / CHECKPOINT routine into single commands plus a session hook, so context survives across sessions and repositories without the agent starting from zero.
Concept based on yan5xu/code-relay. Licensed MIT.
Why
AI coding agents lose context across sessions and across repositories. Code Relay solves this with a file-based handoff protocol, but it relies on the developer remembering to write HANDOFF docs. This plugin automates capture, cross-repo awareness, and restoration.
Install
# from npm
opencode plugin add opencode-code-relay-plugin
# or locally (during development)
opencode plugin add .Commands
relay init— createrelay.jsonat the workspace root and capture project context.relay save— snapshot the current repo to.code-relay/state.json, update the root state, run Spec Sync, and renderRESUME.md.relay close— Closing Ritual: consistency check → delta snapshot →next_step.md→ atomic commit with asession-endtag.relay switch <repo>— move the active baton to another repo and load itsspecs/as context.relay resume— print the current repo'sRESUME.md.relay status— condensed view ofrelay.json.
How it works
- Relay Manager —
relay.jsonat the workspace root holdsproject_context,active_baton, and a per-repo map. Per-repo snapshots live in.code-relay/state.json. - Spec Sync — deterministic diff of
specs/**/*.spec.md(no LLM) compresses intent into the root state and powers therelay closeconsistency check. - Context Injector — renders a Resume Prompt from state + handover templates, injected
automatically via the
experimental.session.compactinghook and on demand viarelay resume.
State model (hybrid)
relay.json— machine-readable global state (workspace root).<repo>/.code-relay/state.json— per-repo snapshot.<repo>/.code-relay/RESUME.md— rendered, agent-readable resume prompt.<repo>/.code-relay/next_step.md— next session's first action.
Non-goals
LLM-based spec summarization, GitHub Collaboration Mode, multi-agent swarm orchestration, and a GUI are deferred.
License
MIT — see LICENSE.
