Using Era Code with OpenCode
OpenCode is the original Era Code harness. Era Code supports two AI coding
harnesses — OpenCode (launched with era-code start) and
Claude Code (launched with era-code claude). Both run the
same governance, agents, commands, skills, and MCP integrations from a single
template source. OpenCode is the canonical format that source is authored in;
the Claude Code tree is translated from it.
Global Setup vs Per-Repo Init
There are two ways to wire Era into OpenCode, and they layer rather than compete:
era-code setup(recommended, run once per machine) installs the full Era baseline at user scope — agents, skills, commands, MCP servers, permissions, governance, and the constitution + universal directives — into~/.config/opencode/, plus global governance memory at~/.era/memory/. After this, every repo inherits Era with no per-repo step. Seeera-code setup.era-code init(optional, per repo) writes a project.era/directory with project-specific directives and syncs the project surface (AGENTS.md/opencode.jsonc,.opencode/).
Run setup once for the org-wide baseline; run init only when a repo needs its
own directives.
What Gets Installed Where
Global resources
Every era-code command keeps ~/.era/era-code/ up to date, gated on the CLI
version (a no-op when the installed version matches). The OpenCode tree is the
canonical template source:
~/.era/era-code/opencode/
├── agents/ # primary agents + subagents (incl. personas)
├── command/ # slash commands
├── skill/ # skills (SKILL.md + references/)
└── _shared/ # shared context files (ethos, output compression, Linear workflow, ...)
Project files
era-code start syncs these project files on every launch:
| Path | Ownership | Contents |
|---|---|---|
.opencode/agent, .opencode/command, .opencode/skill | Era | Agents, commands, and skills for the project |
opencode.jsonc | Era | OpenCode config: mcp: servers, permission: block, and instructions: loading the shared context files |
AGENTS.md | Shared | An Era-managed marker block importing the constitution and directives; everything outside the markers is yours |
DIRECTIVES.md | Era | Compiled from your directive files on launch |
Configuration Files
opencode.jsonc— OpenCode's config file. Era writes themcp:block (servers with{env:VAR}credential interpolation; disabled servers are kept withenabled: false), thepermission:block, and theinstructions:list that loads the shared context files.AGENTS.md— the OpenCode equivalent ofCLAUDE.md: an Era-managed marker block that imports the constitution and directives so governance travels with the repo.
Governance
OpenCode governance runs as the in-process era-governance plugin. It
applies the same rule engine the Claude Code harness wires through a hook:
hardcoded safety denials (privilege escalation, system destruction, secret
extraction, private keys), default GitOps/IaC denials for
kubectl/helm/gcloud/docker/gh/git, .era/governance.yaml overrides,
and compound-command tokenization. The plugin no-ops when the project has no
.era/ directory, and supports audit_mode deny logging.
Additional OpenCode-only plugins reinforce behavior at runtime:
era-compressionreinforces the output-compression doctrine per turn.era-authrefreshes auth tokens per command via ashell.envhook.era-handovertracks context-window usage and drives a two-phase handover.rtk-optimizerrewrites bash commands through RTK to compress shell output.
Agents
OpenCode exposes Era's primary agents — orchestration and plan — which
are selectable and Tab-cyclable, with push-agent as a third primary. Personas
auto-register as primary agents when the project's git remote matches a
registered Era persona. Subagents are invoked automatically via the Task tool.
Set the default primary agent with era-code config --set settings.default_agent=<agent>;
see era-code start for the agent list.
Baseline MCP Servers
Linear, Notion Docs Reader, and Slack are baseline servers — the connections
every Era engineer is expected to have. They are shown checked in the
era-code init checkbox, force-re-added to existing manifests on CLI upgrade, and
gracefully disabled with a one-line warning at launch when the credential is
missing. Provide the token (re-run era-code init or export the env var) and the
next launch re-enables it.
See the MCP Servers guide for Linear, Notion, and Slack setup.
Choosing a Harness
Both harnesses are first-class and share one template source, so governed behavior is equivalent. Practical differences:
- OpenCode offers Era's primary agents (
orchestration,plan) with Tab cycling and plugin-enforced governance, and authenticates with Claude Max through the Meridian proxy. - Claude Code authenticates with Claude Max natively (no proxy) and brings its own main agent and plan mode.
You can switch freely — era-code start and era-code claude each sync their own
harness config from the same .era/ source of truth.