fix(opencode): resolve command agent ids to registered opencode agents (#2477)

The `.opencode/commands/*.md` frontmatter referenced agents with the Claude
Code plugin namespace (`agent: everything-claude-code:<name>`), 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
This commit is contained in:
Gaurav Dubey
2026-07-10 09:46:40 +05:30
parent 40927950c4
commit 9d1ecb0754
32 changed files with 52 additions and 34 deletions
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
---
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Save verification state and progress checkpoint
agent: everything-claude-code:build
agent: build
---
# Checkpoint Command
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Review code for quality, security, and maintainability
agent: everything-claude-code:code-reviewer
agent: code-reviewer
subtask: true
---
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Generate and run E2E tests with Playwright
agent: everything-claude-code:e2e-runner
agent: e2e-runner
subtask: true
---
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Run evaluation against acceptance criteria
agent: everything-claude-code:build
agent: build
---
# Eval Command
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Analyze instincts and suggest or generate evolved structures
agent: everything-claude-code:build
agent: build
---
# Evolve Command
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Fix Go build and vet errors
agent: everything-claude-code:go-build-resolver
agent: go-build-resolver
subtask: true
---
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Go code review for idiomatic patterns
agent: everything-claude-code:go-reviewer
agent: go-reviewer
subtask: true
---
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Go TDD workflow with table-driven tests
agent: everything-claude-code:tdd-guide
agent: tdd-guide
subtask: true
---
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Export instincts for sharing
agent: everything-claude-code:build
agent: build
---
# Instinct Export Command
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Import instincts from external sources
agent: everything-claude-code:build
agent: build
---
# Instinct Import Command
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Show learned instincts (project + global) with confidence
agent: everything-claude-code:build
agent: build
---
# Instinct Status Command
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Extract patterns and learnings from current session
agent: everything-claude-code:build
agent: build
---
# Learn Command
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Orchestrate multiple agents for complex tasks
agent: everything-claude-code:planner
agent: planner
subtask: true
---
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Create implementation plan with risk assessment
agent: everything-claude-code:planner
agent: planner
subtask: true
---
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: List registered projects and instinct counts
agent: everything-claude-code:build
agent: build
---
# Projects Command
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Promote project instincts to global scope
agent: everything-claude-code:build
agent: build
---
# Promote Command
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Remove dead code and consolidate duplicates
agent: everything-claude-code:refactor-cleaner
agent: refactor-cleaner
subtask: true
---
+1 -1
View File
@@ -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
---
+1 -1
View File
@@ -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
---
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Rust TDD workflow with unit and property tests
agent: everything-claude-code:tdd-guide
agent: tdd-guide
subtask: true
---
+1 -1
View File
@@ -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
---
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Run comprehensive security review
agent: everything-claude-code:security-reviewer
agent: security-reviewer
subtask: true
---
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Configure package manager preference
agent: everything-claude-code:build
agent: build
---
# Setup Package Manager Command
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Generate skills from git history analysis
agent: everything-claude-code:build
agent: build
---
# Skill Create Command
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Enforce TDD workflow with 80%+ coverage
agent: everything-claude-code:tdd-guide
agent: tdd-guide
subtask: true
---
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Analyze and improve test coverage
agent: everything-claude-code:tdd-guide
agent: tdd-guide
subtask: true
---
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Update codemaps for codebase navigation
agent: everything-claude-code:doc-updater
agent: doc-updater
subtask: true
---
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Update documentation for recent changes
agent: everything-claude-code:doc-updater
agent: doc-updater
subtask: true
---
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Run verification loop to validate implementation
agent: everything-claude-code:build
agent: build
---
# Verify Command
+21 -3
View File
@@ -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`
);
}
})