Skip to content

OpenCode

Integrate Archgate with OpenCode. Install the archgate-* agent bundle so OpenCode reads your ADRs before writing code, validates after, and captures new patterns.

Archgate integrates with OpenCode through an agent bundle. OpenCode uses a native primary/subagent model rather than the skills model of Claude Code, so Archgate adapts its governance roles into a primary agent plus subagents — all prefixed archgate-. The primary agent reads the ADRs that apply to a change before coding, validates after, and orchestrates the subagents for review and capture.

  • Archgate CLI — install via the CLI install guide.
  • OpenCode installed and on your PATH. Archgate confirms OpenCode is present before writing files into its config directory — otherwise the agents would sit where nothing reads them. Install OpenCode from opencode.ai first.
  • A GitHub login — the bundle is in closed beta; downloads require an authenticated token from archgate login.

Unlike the Claude Code or Cursor integrations, the OpenCode agents are not written to your project tree. They install at the user scope, so they live on your machine and are available across every project you open with OpenCode.

OpenCode follows the XDG Base Directory convention on every platform (via the xdg-basedir package), so the install location resolves to $XDG_CONFIG_HOME/opencode/agents/ when set, and falls back to ~/.config/opencode/agents/ otherwise. Note that on Windows this is under .config, not %APPDATA%:

PlatformInstall location
Linux / macOS~/.config/opencode/agents/
WindowsC:\Users\<username>\.config\opencode\agents\

.archgate/adrs/ and .archgate/lint/ are still created inside your project as usual — only the OpenCode agent files live outside the project tree.

  1. Log in to obtain a plugin token:

    Terminal window
    archgate login
  2. Initialize your project with the OpenCode editor target:

    Terminal window
    archgate init --editor opencode

    When you are logged in and the opencode CLI is on your PATH, this downloads an authenticated tarball from the plugins service and extracts the archgate-*.md agent files into the OpenCode user-scope directory. The .archgate/ directory is created in your project at the same time.

  3. Select archgate-developer as your primary agent in OpenCode (press Tab) when starting a coding task.

To reinstall or upgrade on an already-initialized project, run archgate plugin install --editor opencode. The service returns the latest bundle on every authenticated download. Full flags are in the CLI guide.

archgate-developer

The general development agent, selectable with Tab. It reads ADRs before coding, validates after, and orchestrates the subagents automatically. Most of the time you only need to select this one and let it run.

Invoke these with @-mention when you need a specific role on demand:

@archgate-reviewer

Validates code changes against all project ADRs using domain-focused sub-agents. ADR violations are hard blockers.

@archgate-adr-author

Creates and edits ADRs following your project’s conventions.

@archgate-lessons-learned

Reviews rule coverage and proposes new ADRs when patterns emerge.

archgate-cli-reference

A hidden internal subagent that loads the complete Archgate CLI command guide on demand.

The bundle also ships an archgate-planner agent for planning-oriented work. These are the same roles available in the Claude Code plugin, adapted to OpenCode’s native primary/subagent model. See Skills and Agents for the role reference.

Select archgate-developer at the start of a session. For every change it follows a structured loop:

  1. Read applicable ADRs — runs archgate review-context to see which ADRs apply to the files being changed. It does not write code until it has read them.
  2. Write code following the constraints — implements the change following the applicable Do’s and Don’ts.
  3. Run compliance checks — runs archgate check and fixes any violations before proceeding.
  4. Review — mentions @archgate-reviewer to validate structural compliance beyond what automated rules catch.
  5. Capture learnings — mentions @archgate-lessons-learned to identify patterns worth capturing as new or updated ADRs.

When a task would require violating an ADR, archgate-developer refuses, cites the ADR and the relevant constraint, and suggests a compliant alternative. This behavior is consistent regardless of how the request is phrased — ADRs are mandatory constraints, not suggestions.

Because the bundle lives in your user-scope OpenCode directory rather than in .opencode/ inside your project:

  • One install per machine. Every project you open with OpenCode sees the same archgate-* agents.
  • Your repo stays clean. No .opencode/ folder is created by archgate init. Teammates run their own archgate plugin install --editor opencode.
  • Upgrades are global. Re-running the install overwrites the existing files with the latest bundle.