Skip to content

feat(opencode): adopt the Codex full-mirror skill-sync model - #171

Open
omergk28 wants to merge 4 commits into
ActiveMemory:mainfrom
omergk28:feat/opencode-mirror-sync
Open

feat(opencode): adopt the Codex full-mirror skill-sync model#171
omergk28 wants to merge 4 commits into
ActiveMemory:mainfrom
omergk28:feat/opencode-mirror-sync

Conversation

@omergk28

@omergk28 omergk28 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

feat(opencode): adopt the Codex full-mirror skill-sync model

Branch: feat/opencode-mirror-syncmain (rebased onto main after #160 merged)
Commits: cd60161d, a04c0637, 8f234e11, 249b6308 · Spec: specs/opencode-mirror-sync.md

What

Follow-up to #160, adopting what #163's Codex integration did better —
and giving Codex what this branch does better. Each integration
inherits the other's strength:

OpenCode adopts the Codex mirror model:

Before (#160) After
Opt-in by directory presence — new canonical skills silently don't ship Default-include mirror: 54 canonical − 4 Claude-only = 50 skills, matching Codex
Orphaned directories blessed by the parity test's exemption rule Sync removes orphans; test flags them
references/ files not shipped (latent 404s) references/ mirrored, embedded, and deployed by ctx setup opencode --write

Excluded (same four as Codex, same rationale): ctx-permission-sanitize,
ctx-plan-import, ctx-dream, ctx-skill-create.

Codex gains CI-level enforcement: TestSyncedSkillParity now
byte-checks all three generated trees and holds the two mirror trees
(OpenCode, Codex) to completeness, no-orphan, and reference-parity
assertions — 135 skills + 4 reference files verified in go test,
which CI runs (make audit's freshness checks only run on developer
machines).

Also: check-opencode-skills restore hardened to full-replace (a
mirror sync adds/removes directories); docs/home/opencode.md follows
the Codex page's presentation. The regenerated search.json indexes
docs/home/codex.md (committed in #163 without its site page), so
site/home/codex/index.html rides along in the site commit — shipping
the index without the page would put dead codex entries in site search.

Verification

  • make audit green end-to-end: all three skill trees in sync.
  • Full test suite green, including the OpenCode setup deploy tests.
  • shellcheck clean on the rewritten sync script.

Notes

🤖 Generated with Claude Code

https://claude.ai/code/session_01VAiL9PRdXX38aUA3z7XSD9

The opt-in-by-directory-presence model from ActiveMemory#158 re-drifts by
default: every future canonical skill silently does not ship to
OpenCode, orphaned directories are blessed by the parity test's
exemption rule, and references/ files skills cite are not shipped.

Mirror the canonical tree the way hack/sync-codex-skills.sh does:
default-include with the same four Claude-only exclusions, mirror
references/ directories, remove orphans. The tree grows from 17
curated skills to the full 50. Deployment ships references via
agent.OpenCodeSkillReferences and a deployReferences step in
ctx setup opencode, mirroring the Codex deploy path.

In return, extend CI-level enforcement to Codex: the parity test
now byte-checks all three generated trees and holds mirror trees
(OpenCode, Codex) to completeness, no-orphan, and reference-parity
assertions — coverage make audit alone gave Codex, since CI never
runs make audit. check-opencode-skills restore is hardened to
full-replace, since a mirror sync adds and removes directories.

Spec: specs/opencode-mirror-sync.md
Signed-off-by: Omer Kocaoglu <omergk28@gmail.com>
Regenerates the OpenCode page for the mirror-model slash-command
section and search.json for both pages. The codex page rides along:
docs/home/codex.md landed in ActiveMemory#163 without its generated site page,
and search.json regeneration inevitably indexes committed docs —
shipping the index without the page would put dead codex entries in
site search. Remaining full-site entity-encoding churn (122 files)
restored, per the 2026-08-19 site-churn learning.

Spec: specs/opencode-mirror-sync.md
Signed-off-by: Omer Kocaoglu <omergk28@gmail.com>
Self-review hardening: deployReferences shipped with no direct test,
against the contributing guide's add-tests-for-new-functionality
rule. Cover the fresh-deploy path (every embedded reference lands
byte-exact) and the skill-skipped path (an unchanged SKILL.md must
still refresh a stale reference — the wiring a reference-only
upstream change depends on).

Record in the spec why ctx-serendipity ships although its companion
ctx-dream is excluded: the single /ctx-dream reference is a passing
provenance mention, not an instruction, and the dream/review split
is a real cross-tool workflow. The Codex mirror ships it under the
same reasoning.

Spec: specs/opencode-mirror-sync.md
Signed-off-by: Omer Kocaoglu <omergk28@gmail.com>
Adversarial-review findings, each reproduced before fixing:

1. Empty EXCLUDE array aborts both mirror sync scripts on stock
   macOS /bin/bash 3.2 under set -u (latent today; the class is a
   recorded must-fix per LEARNINGS 2026-08-19). Guard the expansion
   with the established idiom from lint-drift.sh. The codex sibling
   carried the identical pre-existing pattern and gets the same fix.

2. Wrong-cwd invocation of sync-opencode-skills.sh silently printed
   a 0/0/0 success line and created a junk skills tree via the
   unconditional mkdir -p — a regression vs the old presence-model
   script, and worse than the codex sibling, which at least dies at
   its dual-manifest cp. Self-anchor both scripts to the repo root
   the way eight other hack scripts already do.

3. A YAML block-form allowed-tools: key would be corrupted by the
   sed transform (orphaned sequence items) and pass every existing
   check: the parity test replicates the transform, and the
   frontmatter guard sees one in-frontmatter key line. Teach
   TestAllowedToolsConfinedToFrontmatter to reject the block form.

Spec: specs/opencode-mirror-sync.md
Signed-off-by: Omer Kocaoglu <omergk28@gmail.com>
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