From 9d1ecb07542ec93316c1d7558837691c13bdf4bb Mon Sep 17 00:00:00 2001 From: Gaurav Dubey Date: Fri, 10 Jul 2026 09:46:40 +0530 Subject: [PATCH] fix(opencode): resolve command agent ids to registered opencode agents (#2477) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `.opencode/commands/*.md` frontmatter referenced agents with the Claude Code plugin namespace (`agent: everything-claude-code:`), but ECC's opencode integration registers its agents unscoped in `opencode.json`'s `agent` map (`code-reviewer`, `planner`, ...), and that file's own `command` section already references them unscoped. The `everything-claude-code:` scope resolves under no opencode config (the opencode plugin package is `ecc-universal`, and inline-config agents are bare), so subtask commands like `/code-review` hard-fail with `Agent not found: everything-claude-code:code-reviewer`. Non-subtask commands fall back to the default agent and appear to work — which is why only some commands failed. Strip the `everything-claude-code:` prefix from all 30 command frontmatter agent ids so they match the registered agents, fix the MIGRATION.md example, and replace the test that enforced the broken scoped invariant with one that asserts each command agent id is a registered opencode agent (fails on the old scoped ids, passes on the fix). Fixes #2477 --- .opencode/MIGRATION.md | 2 +- .opencode/commands/build-fix.md | 2 +- .opencode/commands/checkpoint.md | 2 +- .opencode/commands/code-review.md | 2 +- .opencode/commands/e2e.md | 2 +- .opencode/commands/eval.md | 2 +- .opencode/commands/evolve.md | 2 +- .opencode/commands/go-build.md | 2 +- .opencode/commands/go-review.md | 2 +- .opencode/commands/go-test.md | 2 +- .opencode/commands/instinct-export.md | 2 +- .opencode/commands/instinct-import.md | 2 +- .opencode/commands/instinct-status.md | 2 +- .opencode/commands/learn.md | 2 +- .opencode/commands/orchestrate.md | 2 +- .opencode/commands/plan.md | 2 +- .opencode/commands/projects.md | 2 +- .opencode/commands/promote.md | 2 +- .opencode/commands/refactor-clean.md | 2 +- .opencode/commands/rust-build.md | 2 +- .opencode/commands/rust-review.md | 2 +- .opencode/commands/rust-test.md | 2 +- .opencode/commands/security-scan.md | 2 +- .opencode/commands/security.md | 2 +- .opencode/commands/setup-pm.md | 2 +- .opencode/commands/skill-create.md | 2 +- .opencode/commands/tdd.md | 2 +- .opencode/commands/test-coverage.md | 2 +- .opencode/commands/update-codemaps.md | 2 +- .opencode/commands/update-docs.md | 2 +- .opencode/commands/verify.md | 2 +- tests/opencode-config.test.js | 24 +++++++++++++++++++++--- 32 files changed, 52 insertions(+), 34 deletions(-) diff --git a/.opencode/MIGRATION.md b/.opencode/MIGRATION.md index c727e4dfc..418f15342 100644 --- a/.opencode/MIGRATION.md +++ b/.opencode/MIGRATION.md @@ -184,7 +184,7 @@ Create a detailed implementation plan for: {input} ```markdown --- description: Create implementation plan -agent: everything-claude-code:planner +agent: planner --- Create a detailed implementation plan for: $ARGUMENTS diff --git a/.opencode/commands/build-fix.md b/.opencode/commands/build-fix.md index bd864ff9b..984cf29ca 100644 --- a/.opencode/commands/build-fix.md +++ b/.opencode/commands/build-fix.md @@ -1,6 +1,6 @@ --- description: Fix build and TypeScript errors with minimal changes -agent: everything-claude-code:build-error-resolver +agent: build-error-resolver subtask: true --- diff --git a/.opencode/commands/checkpoint.md b/.opencode/commands/checkpoint.md index 0fcf9ce70..5f1959c4c 100644 --- a/.opencode/commands/checkpoint.md +++ b/.opencode/commands/checkpoint.md @@ -1,6 +1,6 @@ --- description: Save verification state and progress checkpoint -agent: everything-claude-code:build +agent: build --- # Checkpoint Command diff --git a/.opencode/commands/code-review.md b/.opencode/commands/code-review.md index c672780db..2020d5ebb 100644 --- a/.opencode/commands/code-review.md +++ b/.opencode/commands/code-review.md @@ -1,6 +1,6 @@ --- description: Review code for quality, security, and maintainability -agent: everything-claude-code:code-reviewer +agent: code-reviewer subtask: true --- diff --git a/.opencode/commands/e2e.md b/.opencode/commands/e2e.md index a113c4f80..afc679695 100644 --- a/.opencode/commands/e2e.md +++ b/.opencode/commands/e2e.md @@ -1,6 +1,6 @@ --- description: Generate and run E2E tests with Playwright -agent: everything-claude-code:e2e-runner +agent: e2e-runner subtask: true --- diff --git a/.opencode/commands/eval.md b/.opencode/commands/eval.md index 191c82281..2b78c3b55 100644 --- a/.opencode/commands/eval.md +++ b/.opencode/commands/eval.md @@ -1,6 +1,6 @@ --- description: Run evaluation against acceptance criteria -agent: everything-claude-code:build +agent: build --- # Eval Command diff --git a/.opencode/commands/evolve.md b/.opencode/commands/evolve.md index 59ecc86e1..6f344a530 100644 --- a/.opencode/commands/evolve.md +++ b/.opencode/commands/evolve.md @@ -1,6 +1,6 @@ --- description: Analyze instincts and suggest or generate evolved structures -agent: everything-claude-code:build +agent: build --- # Evolve Command diff --git a/.opencode/commands/go-build.md b/.opencode/commands/go-build.md index ad8c54b27..22e1d6d2e 100644 --- a/.opencode/commands/go-build.md +++ b/.opencode/commands/go-build.md @@ -1,6 +1,6 @@ --- description: Fix Go build and vet errors -agent: everything-claude-code:go-build-resolver +agent: go-build-resolver subtask: true --- diff --git a/.opencode/commands/go-review.md b/.opencode/commands/go-review.md index 5dfc32cb4..d794fc1c7 100644 --- a/.opencode/commands/go-review.md +++ b/.opencode/commands/go-review.md @@ -1,6 +1,6 @@ --- description: Go code review for idiomatic patterns -agent: everything-claude-code:go-reviewer +agent: go-reviewer subtask: true --- diff --git a/.opencode/commands/go-test.md b/.opencode/commands/go-test.md index 82b7be54c..361e5934c 100644 --- a/.opencode/commands/go-test.md +++ b/.opencode/commands/go-test.md @@ -1,6 +1,6 @@ --- description: Go TDD workflow with table-driven tests -agent: everything-claude-code:tdd-guide +agent: tdd-guide subtask: true --- diff --git a/.opencode/commands/instinct-export.md b/.opencode/commands/instinct-export.md index 727ac9b64..486d934bf 100644 --- a/.opencode/commands/instinct-export.md +++ b/.opencode/commands/instinct-export.md @@ -1,6 +1,6 @@ --- description: Export instincts for sharing -agent: everything-claude-code:build +agent: build --- # Instinct Export Command diff --git a/.opencode/commands/instinct-import.md b/.opencode/commands/instinct-import.md index d0a45e211..e15672379 100644 --- a/.opencode/commands/instinct-import.md +++ b/.opencode/commands/instinct-import.md @@ -1,6 +1,6 @@ --- description: Import instincts from external sources -agent: everything-claude-code:build +agent: build --- # Instinct Import Command diff --git a/.opencode/commands/instinct-status.md b/.opencode/commands/instinct-status.md index 85aa1b53c..0d9331553 100644 --- a/.opencode/commands/instinct-status.md +++ b/.opencode/commands/instinct-status.md @@ -1,6 +1,6 @@ --- description: Show learned instincts (project + global) with confidence -agent: everything-claude-code:build +agent: build --- # Instinct Status Command diff --git a/.opencode/commands/learn.md b/.opencode/commands/learn.md index eb0ba9f9a..3a43cc110 100644 --- a/.opencode/commands/learn.md +++ b/.opencode/commands/learn.md @@ -1,6 +1,6 @@ --- description: Extract patterns and learnings from current session -agent: everything-claude-code:build +agent: build --- # Learn Command diff --git a/.opencode/commands/orchestrate.md b/.opencode/commands/orchestrate.md index d42db61e1..76f9a0b43 100644 --- a/.opencode/commands/orchestrate.md +++ b/.opencode/commands/orchestrate.md @@ -1,6 +1,6 @@ --- description: Orchestrate multiple agents for complex tasks -agent: everything-claude-code:planner +agent: planner subtask: true --- diff --git a/.opencode/commands/plan.md b/.opencode/commands/plan.md index c3f73c738..801f4215f 100644 --- a/.opencode/commands/plan.md +++ b/.opencode/commands/plan.md @@ -1,6 +1,6 @@ --- description: Create implementation plan with risk assessment -agent: everything-claude-code:planner +agent: planner subtask: true --- diff --git a/.opencode/commands/projects.md b/.opencode/commands/projects.md index 4aac769c3..77785d01d 100644 --- a/.opencode/commands/projects.md +++ b/.opencode/commands/projects.md @@ -1,6 +1,6 @@ --- description: List registered projects and instinct counts -agent: everything-claude-code:build +agent: build --- # Projects Command diff --git a/.opencode/commands/promote.md b/.opencode/commands/promote.md index 9bbc5b9cc..566a662e3 100644 --- a/.opencode/commands/promote.md +++ b/.opencode/commands/promote.md @@ -1,6 +1,6 @@ --- description: Promote project instincts to global scope -agent: everything-claude-code:build +agent: build --- # Promote Command diff --git a/.opencode/commands/refactor-clean.md b/.opencode/commands/refactor-clean.md index 9f5a5cde3..d28e0fc7e 100644 --- a/.opencode/commands/refactor-clean.md +++ b/.opencode/commands/refactor-clean.md @@ -1,6 +1,6 @@ --- description: Remove dead code and consolidate duplicates -agent: everything-claude-code:refactor-cleaner +agent: refactor-cleaner subtask: true --- diff --git a/.opencode/commands/rust-build.md b/.opencode/commands/rust-build.md index 88f099c15..82a668df1 100644 --- a/.opencode/commands/rust-build.md +++ b/.opencode/commands/rust-build.md @@ -1,6 +1,6 @@ --- description: Fix Rust build errors and borrow checker issues -agent: everything-claude-code:rust-build-resolver +agent: rust-build-resolver subtask: true --- diff --git a/.opencode/commands/rust-review.md b/.opencode/commands/rust-review.md index f1b2c6c3f..ad9c8ecec 100644 --- a/.opencode/commands/rust-review.md +++ b/.opencode/commands/rust-review.md @@ -1,6 +1,6 @@ --- description: Rust code review for ownership, safety, and idiomatic patterns -agent: everything-claude-code:rust-reviewer +agent: rust-reviewer subtask: true --- diff --git a/.opencode/commands/rust-test.md b/.opencode/commands/rust-test.md index abd75fa6c..a1f2dbd2d 100644 --- a/.opencode/commands/rust-test.md +++ b/.opencode/commands/rust-test.md @@ -1,6 +1,6 @@ --- description: Rust TDD workflow with unit and property tests -agent: everything-claude-code:tdd-guide +agent: tdd-guide subtask: true --- diff --git a/.opencode/commands/security-scan.md b/.opencode/commands/security-scan.md index e916e57bf..d78a2e807 100644 --- a/.opencode/commands/security-scan.md +++ b/.opencode/commands/security-scan.md @@ -1,6 +1,6 @@ --- description: Run AgentShield against agent, hook, MCP, permission, and secret surfaces. -agent: everything-claude-code:security-reviewer +agent: security-reviewer subtask: true --- diff --git a/.opencode/commands/security.md b/.opencode/commands/security.md index fa66cc355..226e57246 100644 --- a/.opencode/commands/security.md +++ b/.opencode/commands/security.md @@ -1,6 +1,6 @@ --- description: Run comprehensive security review -agent: everything-claude-code:security-reviewer +agent: security-reviewer subtask: true --- diff --git a/.opencode/commands/setup-pm.md b/.opencode/commands/setup-pm.md index f902f0ac9..afaac6a7c 100644 --- a/.opencode/commands/setup-pm.md +++ b/.opencode/commands/setup-pm.md @@ -1,6 +1,6 @@ --- description: Configure package manager preference -agent: everything-claude-code:build +agent: build --- # Setup Package Manager Command diff --git a/.opencode/commands/skill-create.md b/.opencode/commands/skill-create.md index ea5f19548..5e550df9d 100644 --- a/.opencode/commands/skill-create.md +++ b/.opencode/commands/skill-create.md @@ -1,6 +1,6 @@ --- description: Generate skills from git history analysis -agent: everything-claude-code:build +agent: build --- # Skill Create Command diff --git a/.opencode/commands/tdd.md b/.opencode/commands/tdd.md index 0513cac38..7fc06b617 100644 --- a/.opencode/commands/tdd.md +++ b/.opencode/commands/tdd.md @@ -1,6 +1,6 @@ --- description: Enforce TDD workflow with 80%+ coverage -agent: everything-claude-code:tdd-guide +agent: tdd-guide subtask: true --- diff --git a/.opencode/commands/test-coverage.md b/.opencode/commands/test-coverage.md index 4898965fa..1eac79c93 100644 --- a/.opencode/commands/test-coverage.md +++ b/.opencode/commands/test-coverage.md @@ -1,6 +1,6 @@ --- description: Analyze and improve test coverage -agent: everything-claude-code:tdd-guide +agent: tdd-guide subtask: true --- diff --git a/.opencode/commands/update-codemaps.md b/.opencode/commands/update-codemaps.md index 61b341874..13166c335 100644 --- a/.opencode/commands/update-codemaps.md +++ b/.opencode/commands/update-codemaps.md @@ -1,6 +1,6 @@ --- description: Update codemaps for codebase navigation -agent: everything-claude-code:doc-updater +agent: doc-updater subtask: true --- diff --git a/.opencode/commands/update-docs.md b/.opencode/commands/update-docs.md index d14f96fb1..a3bdaa58d 100644 --- a/.opencode/commands/update-docs.md +++ b/.opencode/commands/update-docs.md @@ -1,6 +1,6 @@ --- description: Update documentation for recent changes -agent: everything-claude-code:doc-updater +agent: doc-updater subtask: true --- diff --git a/.opencode/commands/verify.md b/.opencode/commands/verify.md index 71599c4c5..7dce731a5 100644 --- a/.opencode/commands/verify.md +++ b/.opencode/commands/verify.md @@ -1,6 +1,6 @@ --- description: Run verification loop to validate implementation -agent: everything-claude-code:build +agent: build --- # Verify Command diff --git a/tests/opencode-config.test.js b/tests/opencode-config.test.js index dec608f97..9b0254e7e 100644 --- a/tests/opencode-config.test.js +++ b/tests/opencode-config.test.js @@ -77,10 +77,16 @@ if ( else failed++; if ( - test('command markdown frontmatter uses plugin-scoped agent ids', () => { + test('command markdown frontmatter agent ids resolve to a registered opencode agent', () => { const commandsDir = path.join(opencodeDir, 'commands'); + const registeredAgents = new Set(Object.keys(config.agent || {})); + assert.ok(registeredAgents.size > 0, 'Expected opencode.json to register at least one agent'); for (const entry of fs.readdirSync(commandsDir)) { + if (!entry.endsWith('.md')) { + continue; + } + const body = fs.readFileSync(path.join(commandsDir, entry), 'utf8'); const match = body.match(/^agent:\s*(.+)$/m); @@ -88,9 +94,21 @@ if ( continue; } + const agentId = match[1].trim().replace(/^['"]|['"]$/g, ''); + + // Regression guard for #2477: the Claude Code plugin namespace + // (`everything-claude-code:`) is not a valid opencode agent scope. + // OpenCode registers these agents unscoped in opencode.json's `agent` + // map, so a scoped id fails to resolve ("Agent not found") and hard- + // breaks subtask commands like /code-review on opencode. assert.ok( - match[1].startsWith('everything-claude-code:'), - `Expected plugin-scoped agent id in ${entry}, got: ${match[1]}` + !agentId.includes('everything-claude-code:'), + `${entry}: command agent must be an unscoped opencode agent id, got: ${agentId}` + ); + + assert.ok( + registeredAgents.has(agentId), + `${entry}: command agent "${agentId}" is not registered in opencode.json's agent map` ); } })