Skip to content

feat: add OpenCode as a first-class harness client#42

Open
Ram-Pavith wants to merge 3 commits into
AlmanacCode:mainfrom
Ram-Pavith:opencode-support
Open

feat: add OpenCode as a first-class harness client#42
Ram-Pavith wants to merge 3 commits into
AlmanacCode:mainfrom
Ram-Pavith:opencode-support

Conversation

@Ram-Pavith

@Ram-Pavith Ram-Pavith commented Jul 19, 2026

Copy link
Copy Markdown

Summary

Adds OpenCode as a first-class CodeAlmanac harness client so build / ingest / garden run through the OpenCode CLI (opencode run), alongside Codex and Claude via Yoke.

Also covers transcript sync, setup UI polish, and almanac wiki — while keeping a native OpenCode harness (not Yoke).

Closes #41

Why not Yoke for OpenCode

OpenCode is a model router, not a single provider. Users already connect OpenRouter, native provider APIs, Zen free models, and other OpenAI-compatible endpoints in the OpenCode TUI. Whatever shows up in opencode models is what they can run interactively.

A Yoke OpenCode path would:

  1. Block shipping on AlmanacCode/Yoke releasing and pinning Provider.OPENCODE.
  2. Cap model choice to whatever Yoke/CodeAlmanac encodes — always behind the user’s live OpenCode catalog (including nested OpenRouter ids like openrouter/...).
  3. Re-own auth that OpenCode already handles.

This PR calls opencode run --model <provider/model> with the user’s normal OpenCode install. Config only checks id shape (provider/model; nested segments allowed). Setup prefers the live opencode models list. Result: lifecycle jobs can use the same connected models as the OpenCode TUI (OpenRouter and everything else OpenCode is logged into), without a second allowlist or Yoke pin.

Contrast: #28 wires OpenCode through Yoke — better if the product wants every harness only via Yoke; worse for “use my OpenCode accounts/models now.”

What changed

Harness

  • Native OpenCode adapter (integrations/harnesses/opencode/)
  • Lifecycle agents staged under runtime_root/opencode/ via additive OPENCODE_CONFIG_DIR (not the user repo’s .opencode/)
  • Setup target + OpenCode provider/model config validation + README

Transcript sync

  • TranscriptApp.OPENCODE
  • Discovery via ~/.local/share/opencode/opencode.db (session / parent_id IS NULL)
  • Synthetic identity opencode-session:<id>
  • Runtime over message/part (before generic transcript runtime)
  • query_readonly_or_empty for foreign SQLite
  • sync --from defaults to all transcript apps

Setup UI polish

  • OpenCode brand color, responsive card grid, change-handling module
  • SIGWINCH redraw; OpenCode in instruction-step copy
  • Telemetry step kept (7-step wizard)

Almanac wiki

  • opencode-harness.md, dual on-ramp guide, controlled-model decision carve-out for OpenCode, event-shape/sync docs

Test plan

  • uv run pytest tests/test_opencode_*.py tests/test_setup_wizard_*.py tests/test_cli.py -q
  • Full uv run pytest / uv run ruff check .
  • Manual: config set harness.default opencode + harness.model to an OpenRouter id from opencode models
  • Manual: codealmanac sync status --from opencode

Related

Pavith added 2 commits July 19, 2026 20:17
Add an OpenCode CLI harness adapter, setup target, model validation, and
docs/tests so build/ingest/garden can run through `opencode run`.
Add SQLite discovery/runtime for OpenCode sessions, responsive setup
wizard cards/brand/SIGWINCH polish, and almanac docs for native OpenCode.
Stage lifecycle agents under runtime_root/opencode via OPENCODE_CONFIG_DIR
so jobs do not dirty the project tree. Refresh harness/guides/decision wiki
for native OpenCode and dual on-ramps.
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.

Add OpenCode as a first-class CodeAlmanac harness client

1 participant