Skip to content

Add OpenCode support and refresh the README - #10

Merged
ChristopherLiew merged 3 commits into
mainfrom
feat/opencode-plugin-plan
Nov 16, 2026
Merged

ChristopherLiew merged 3 commits into
mainfrom
feat/opencode-plugin-plan

Conversation

@ChristopherLiew

@ChristopherLiew ChristopherLiew commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

OpenCode support (fourth agent)

  • plugin/opencode/index.ts: a thin TypeScript shim that OpenCode loads directly. It has no dependencies and no build step. It forwards prompt and permission.evaluate events as bridge JSON to agent-quorum hook --agent opencode and applies {"deny"} or {"context"}. It never sets allow.
  • internal/adapter/opencode: pure Parse and Render over the bridge schema, golden-tested strictly both ways.
  • Subagent sessions are mapped to their root session, so they share the parent's claims.
  • Liveness:
    • Under OpenCode's shared background service, which outlives sessions, the shim reports pid 0 and the daemon uses its 30-minute idle timeout.
    • Under --standalone, the shim reports the server pid, so claims free as soon as the run exits.
  • Peer context is injected once per session, so the system prompt stays byte-stable for prompt caching.

Fixes and tidy-ups

  • AGENT_QUORUM_NO_NOTES=1 now blanks the note on every op. Before this, Antigravity, and OpenCode in this PR, still stored prompts, because both register with hello rather than note.
  • cmd/agent-quorum/hook.go: the per-agent hook bodies now share one ask(req, pid) helper.
  • make lint parse-checks the shim with bun when it is installed.

README and branding

  • Per-agent install sections and a supported-agents matrix, now including OpenCode.
  • A redrawn hero image and an architecture diagram.
  • A two-session contention sequence in Mermaid.
  • A monochrome logo, icons and social preview.
  • Safety, privacy and limits sections.
  • The Antigravity update uses fetch plus reset --hard, because stable is force-moved on every release.

Release

The README's OpenCode instructions assume a release that contains this adapter, so cut one after merging, with make release V=0.3.0. This adds an agent, so it's a minor bump. Users on 0.2.0 binaries see the OpenCode plugin quietly do nothing until they update.

Test plan

  • make check (vet, gofmt, lint, go test -race ./...)
  • golangci-lint v2.15.0: 0 issues
  • make validate-plugin: Claude strict, marketplace and Codex install
  • TestEndToEndOpenCode, run against the real binary and daemon:
    • An OpenCode claim denies a Claude Code edit.
    • Git guard on compound segments.
    • The bridge pid drives liveness.
    • A pid-0 session works on the idle timeout.
    • NO_NOTES.
  • OpenCode 2.3.0, opencode run --standalone:
    • Edit contention denied, with the holder named.
    • An unrelated edit is allowed.
    • Claims are freed when the run exits.
    • The plugin fails open when the binary is missing.
    • Subagent events carry the root id.
  • Shim driven by a fake ctx against the real binary:
    • Shell git stash is denied.
    • Non-git shell commands are untouched.
    • Peer context is pushed as a {type:"text"} object and stays byte-identical.
    • The versioned binary resolves without AGENT_QUORUM_BIN.
  • OpenCode 2.3.0 shared background service (the default mode used by the TUI), with the env set through opencode service set env:
    • The plugin loads in serve --service and reports pid: 0.
    • Two concurrent opencode run sessions appear as separate sessions, and B's edit of A's file is denied with A named.
    • After A exits, its claim persists on the idle timeout, as designed, and agent-quorum release frees it.
  • Not exercised end to end: the background binary download. Versioned-binary lookup is covered by the fake-ctx run.
  • After merge: upload .github/social-preview.png under Settings → General → Social preview.

🤖 Generated with Claude Code

chrisliew and others added 3 commits November 16, 2026 15:30
- Per-agent install sections (Claude Code, Codex, Antigravity) with
  update and uninstall commands, plus release-candidate and removal notes
- Supported-agents matrix built from the hook configs
- New architecture diagram and a two-session contention sequence
- Monochrome zinc logo (assets/logo.svg) feeding the plugin icons,
  hero mark and a regenerated social preview
- Badges, nav, safety/privacy and limits sections

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OpenCode becomes the fourth adapter. Its plugins must be JS/TS, so
plugin/opencode/index.ts is a thin TypeScript shim (no deps, no build;
OpenCode runs it on Bun) that maps OpenCode's prompt and
permission.evaluate events onto a bridge schema owned by
internal/adapter/opencode and runs `agent-quorum hook --agent opencode`.
Every coordination decision stays in Go.

- Subagents run in child sessions; the shim maps them to the root so
  they share their parent's claims.
- OpenCode's default shared background service outlives sessions, so the
  shim reports pid 0 there (30-minute idle timeout) and its own pid under
  --standalone. ask(req, pid) takes the pid from the bridge.
- Peer context is injected once per session, keeping the system prompt
  byte-stable for prompt caching.
- AGENT_QUORUM_NO_NOTES now blanks the note on every op, which also fixes
  it for Antigravity (it registers with hello, not note).
- hook.go: the three per-agent hook bodies share one ask helper.

Validated against OpenCode 2.3.0 (contention, liveness, fail-open,
subagents) and covered by golden fixtures, fail-open tests and a
cross-agent end-to-end test. README, CONTRIBUTING, CLAUDE.md, AGENTS.md
and the architecture diagram document the new agent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ChristopherLiew
ChristopherLiew merged commit cf8d1d9 into main Nov 16, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant