Skip to content
Apothem
Harnesses

OpenCode

Apothem harness adapter for OpenCode (Beta).

Vendor: OpenCode Install name: opencode Status: Beta Native config: ~/.config/opencode/

Installation

apothem install --harness opencode

The adapter writes OpenCode's JSON config, installs Apothem skills into the OpenCode skills surface, converts command prompts to OpenCode Markdown command files, and normalizes Apothem helper definitions as OpenCode subhelpers.

Files written:

~/.config/opencode/opencode.json
~/.config/opencode/apothem/rules/00-apothem-profile.md
~/.config/opencode/commands/
~/.config/opencode/skills/
~/.config/opencode/agents/
~/.config/opencode/.apothem/support/{rules,templates,hooks}/

Profile-to-native-config mapping

The adapter renders opencode.json with an instructions file list naming your profile document, the four core rules, and the rule index, then propagates each shared Apothem cohort into either a native OpenCode surface or an Apothem-owned support subtree. Existing matching Apothem-managed children are backed up before replacement.

Compatibility notes

OpenCode combines every file the instructions list names into every session (OpenCode rules). The list therefore names your profile document first, then only the rules whose alwaysApply is true, one explicit ~/.config/opencode/.apothem/support/rules/<name>.md path each; OpenCode expands the leading ~/ against your home directory. Those rules are agnostic-posture, authority-inquiry, context-management, session-closure, and the rule index, apothem-rule-index. OpenCode scopes no rule by path, so every other rule is read on demand. It stays installed as reference material under ~/.config/opencode/.apothem/support/, and the index names each rule and the situation that calls for it. A rule, skill, or command that cites a rule, template, or hook prompt reads it from there. Commands, skills, and helper definitions use native discovery locations.

The profile document ~/.config/opencode/apothem/rules/00-apothem-profile.md carries your identity and preferences from the shared profile, and ends with an Apothem support files section that names the absolute directory under ~/.config/opencode/.apothem/support/ each repository-style citation (rules/<name>.md, templates/..., hooks/...) resolves against. It is the first instructions entry, so OpenCode loads it in every session.

An opencode.json written by an earlier release lists the single glob ~/.config/opencode/.apothem/support/rules/*.md, which loads every rule, or an explicit path for each of the 28 rules that were then always-on. apothem install and apothem update replace either form with the list above, which drops the 24 paths that no longer load at launch, and apothem uninstall removes all of them. Your own instructions entries are kept in every case.

Verification

apothem verify --harness opencode

The verify command confirms that:

  1. The native config exists at the expected path.
  2. Each managed target exists; managed files are non-empty, and JSON or YAML configs parse. Add --profile PATH to also confirm that the installed files match that profile.
  3. The adapter-specific verification routine reports success.

Updating

apothem update --harness opencode

Refreshes opencode.json, native commands, skills, helper definitions, and the Apothem support tree.

Uninstalling

apothem uninstall --harness opencode

Removes the entries the adapter added to ~/.config/opencode/opencode.json (your own keys, MCP servers, and instructions entries stay, and the file is deleted only when Apothem created it and nothing of yours is left). Removes the Apothem block from the profile document ~/.config/opencode/apothem/rules/00-apothem-profile.md and keeps any other text in it; that file is deleted only when nothing else remains in it. Also removes the Apothem files in ~/.config/opencode/commands/, ~/.config/opencode/skills/, ~/.config/opencode/agents/, and ~/.config/opencode/.apothem/support/; other files in those folders stay. Each file is backed up under ~/.apothem/backups/ before it is changed or removed. The shared profile YAML and Apothem engine are unaffected.

Conformity gate

python -m apothem.conformity.gate --all .

Troubleshooting

SymptomFix
Config file not foundRe-run apothem install --harness opencode
Verification failedRun apothem update --harness opencode, then verify again
Unexpected config contentCheck ~/.config/apothem/profile.yaml or --profile PATH, then re-run apothem update --harness opencode

Configuration knobs

FlagDefaultDescription
--dry-runfalsePreview install without writing files.

See also

On this page