fix(opencode): inherit user-selected models

This commit is contained in:
dajiaohuang
2026-08-24 20:09:12 -04:00
committed by haelyra
parent 4caab329db
commit 894f85350b
4 changed files with 20 additions and 33 deletions
+4 -2
View File
@@ -224,8 +224,6 @@ Full configuration in `opencode.json`:
```json
{
"$schema": "https://opencode.ai/config.json",
"model": "anthropic/claude-sonnet-4-5",
"small_model": "anthropic/claude-haiku-4-5",
"plugin": ["./plugins"],
"instructions": [
"skills/tdd-workflow/SKILL.md",
@@ -236,6 +234,10 @@ Full configuration in `opencode.json`:
}
```
The reference config intentionally leaves model selection to OpenCode. Connect a
provider and select a model in OpenCode; ECC's primary agent uses that global
selection, and its subagents inherit the invoking primary agent's model.
## License
MIT
-28
View File
@@ -1,7 +1,5 @@
{
"$schema": "https://opencode.ai/config.json",
"model": "anthropic/claude-sonnet-4-5",
"small_model": "anthropic/claude-haiku-4-5",
"default_agent": "build",
"instructions": [
"AGENTS.md",
@@ -31,7 +29,6 @@
"build": {
"description": "Primary coding agent for development work",
"mode": "primary",
"model": "anthropic/claude-sonnet-4-5",
"tools": {
"write": true,
"edit": true,
@@ -43,7 +40,6 @@
"planner": {
"description": "Expert planning specialist for complex features and refactoring. Use for implementation planning, architectural changes, or complex refactoring.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:prompts/agents/planner.txt}",
"tools": {
"read": true,
@@ -55,7 +51,6 @@
"architect": {
"description": "Software architecture specialist for system design, scalability, and technical decision-making.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:prompts/agents/architect.txt}",
"tools": {
"read": true,
@@ -67,7 +62,6 @@
"code-reviewer": {
"description": "Expert code review specialist. Reviews code for quality, security, and maintainability. Use immediately after writing or modifying code.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:prompts/agents/code-reviewer.txt}",
"tools": {
"read": true,
@@ -79,7 +73,6 @@
"security-reviewer": {
"description": "Security vulnerability detection and remediation specialist. Use after writing code that handles user input, authentication, API endpoints, or sensitive data.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:prompts/agents/security-reviewer.txt}",
"tools": {
"read": true,
@@ -91,7 +84,6 @@
"tdd-guide": {
"description": "Test-Driven Development specialist enforcing write-tests-first methodology. Use when writing new features, fixing bugs, or refactoring code. Ensures 80%+ test coverage.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:prompts/agents/tdd-guide.txt}",
"tools": {
"read": true,
@@ -103,7 +95,6 @@
"build-error-resolver": {
"description": "Build and TypeScript error resolution specialist. Use when build fails or type errors occur. Fixes build/type errors only with minimal diffs.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:prompts/agents/build-error-resolver.txt}",
"tools": {
"read": true,
@@ -115,7 +106,6 @@
"e2e-runner": {
"description": "End-to-end testing specialist using Playwright. Generates, maintains, and runs E2E tests for critical user flows.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:prompts/agents/e2e-runner.txt}",
"tools": {
"read": true,
@@ -127,7 +117,6 @@
"doc-updater": {
"description": "Documentation and codemap specialist. Use for updating codemaps and documentation.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:prompts/agents/doc-updater.txt}",
"tools": {
"read": true,
@@ -139,7 +128,6 @@
"refactor-cleaner": {
"description": "Dead code cleanup and consolidation specialist. Use for removing unused code, duplicates, and refactoring.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:prompts/agents/refactor-cleaner.txt}",
"tools": {
"read": true,
@@ -151,7 +139,6 @@
"go-reviewer": {
"description": "Expert Go code reviewer specializing in idiomatic Go, concurrency patterns, error handling, and performance.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:prompts/agents/go-reviewer.txt}",
"tools": {
"read": true,
@@ -163,7 +150,6 @@
"go-build-resolver": {
"description": "Go build, vet, and compilation error resolution specialist. Fixes Go build errors with minimal changes.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:prompts/agents/go-build-resolver.txt}",
"tools": {
"read": true,
@@ -175,7 +161,6 @@
"database-reviewer": {
"description": "PostgreSQL database specialist for query optimization, schema design, security, and performance. Incorporates Supabase best practices.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:prompts/agents/database-reviewer.txt}",
"tools": {
"read": true,
@@ -187,7 +172,6 @@
"cpp-reviewer": {
"description": "Expert C++ code reviewer specializing in memory safety, modern C++ idioms, concurrency, and performance. Use for all C++ code changes.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:prompts/agents/cpp-reviewer.txt}",
"tools": {
"read": true,
@@ -199,7 +183,6 @@
"cpp-build-resolver": {
"description": "C++ build, CMake, and compilation error resolution specialist. Fixes build errors, linker issues, and template errors with minimal changes.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:prompts/agents/cpp-build-resolver.txt}",
"tools": {
"read": true,
@@ -211,7 +194,6 @@
"docs-lookup": {
"description": "Documentation specialist using Context7 MCP to fetch current library and API documentation with code examples.",
"mode": "subagent",
"model": "anthropic/claude-sonnet-4-5",
"prompt": "{file:prompts/agents/docs-lookup.txt}",
"tools": {
"read": true,
@@ -223,7 +205,6 @@
"harness-optimizer": {
"description": "Analyze and improve the local agent harness configuration for reliability, cost, and throughput.",
"mode": "subagent",
"model": "anthropic/claude-sonnet-4-5",
"prompt": "{file:prompts/agents/harness-optimizer.txt}",
"tools": {
"read": true,
@@ -234,7 +215,6 @@
"java-reviewer": {
"description": "Expert Java and Spring Boot code reviewer specializing in layered architecture, JPA patterns, security, and concurrency.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:prompts/agents/java-reviewer.txt}",
"tools": {
"read": true,
@@ -246,7 +226,6 @@
"java-build-resolver": {
"description": "Java/Maven/Gradle build, compilation, and dependency error resolution specialist. Fixes build errors with minimal changes.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:prompts/agents/java-build-resolver.txt}",
"tools": {
"read": true,
@@ -258,7 +237,6 @@
"kotlin-reviewer": {
"description": "Kotlin and Android/KMP code reviewer. Reviews Kotlin code for idiomatic patterns, coroutine safety, Compose best practices.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:prompts/agents/kotlin-reviewer.txt}",
"tools": {
"read": true,
@@ -270,7 +248,6 @@
"kotlin-build-resolver": {
"description": "Kotlin/Gradle build, compilation, and dependency error resolution specialist. Fixes Kotlin build errors with minimal changes.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:prompts/agents/kotlin-build-resolver.txt}",
"tools": {
"read": true,
@@ -282,7 +259,6 @@
"loop-operator": {
"description": "Operate autonomous agent loops, monitor progress, and intervene safely when loops stall.",
"mode": "subagent",
"model": "anthropic/claude-sonnet-4-5",
"prompt": "{file:prompts/agents/loop-operator.txt}",
"tools": {
"read": true,
@@ -293,7 +269,6 @@
"php-reviewer": {
"description": "Expert PHP code reviewer specializing in PSR-12 compliance, PHP type system, Eloquent ORM patterns, security, and performance.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:prompts/agents/php-reviewer.txt}",
"tools": {
"read": true,
@@ -305,7 +280,6 @@
"python-reviewer": {
"description": "Expert Python code reviewer specializing in PEP 8 compliance, Pythonic idioms, type hints, security, and performance.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:prompts/agents/python-reviewer.txt}",
"tools": {
"read": true,
@@ -317,7 +291,6 @@
"rust-reviewer": {
"description": "Expert Rust code reviewer specializing in idiomatic Rust, ownership, lifetimes, concurrency, and performance.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:prompts/agents/rust-reviewer.txt}",
"tools": {
"read": true,
@@ -329,7 +302,6 @@
"rust-build-resolver": {
"description": "Rust build, Cargo, and compilation error resolution specialist. Fixes Rust build errors with minimal changes.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:prompts/agents/rust-build-resolver.txt}",
"tools": {
"read": true,
+3 -3
View File
@@ -1532,7 +1532,7 @@ See [affaan-m/ECC#2065](https://github.com/affaan-m/ECC/issues/2065).
| Claude Code | Stable primary | Plugin or selective installer | The plugin advertises the installed catalog to the model; use a selective/manual profile when context footprint matters. Optional shell-backed skills are not portable to every OS. |
| Codex | Supported sync; marketplace experimental | Repo config or `sync-ecc-to-codex.sh` | No ECC hook runtime. The marketplace package can omit shared repository content from Codex's cache; use sync for the reliable path. |
| Cursor | Beta project adapter | Selective installer into `.cursor/` | Agent discovery varies by Cursor build, and ECC's installer paths do not yet expose identical hook sets ([#2419](https://github.com/affaan-m/ECC/issues/2419)). |
| OpenCode | Beta built plugin | Build plugin, then selective installer | ECC ships a subset of the catalog and the reference config pins Anthropic models; select models available to your provider ([#2617](https://github.com/affaan-m/ECC/issues/2617)). |
| OpenCode | Beta built plugin | Build plugin, then selective installer | ECC ships a subset of the catalog; connect a provider and select a model in OpenCode ([#2617](https://github.com/affaan-m/ECC/issues/2617)). |
| GitHub Copilot | Instruction-only | Checked-in instructions and prompt files | No ECC hooks, runtime agents, delegation, or native skill discovery. |
| Gemini, Zed, Antigravity, Qwen, Hermes, OpenClaw, Kimi, CodeBuddy, JoyCode | Experimental/minimal adapters | Harness-specific selective target | File placement and instruction portability are tested; full Claude feature parity is not claimed. |
@@ -1718,7 +1718,7 @@ The adapter writes ECC-managed files under `.zed/` and keeps BYOK/OpenRouter cre
<details>
<summary><strong>OpenCode support in depth</strong></summary>
ECC provides a beta OpenCode plugin integration with instructions, a catalog subset, commands, custom tools, and hook events. It does not provide feature parity with Claude Code, and the reference model IDs must exist in the user's configured provider.
ECC provides a beta OpenCode plugin integration with instructions, a catalog subset, commands, custom tools, and hook events. It does not provide feature parity with Claude Code. The reference config inherits the user's OpenCode model selection instead of pinning a provider-specific model.
```bash
# Install OpenCode
@@ -2042,7 +2042,7 @@ Each component is fully independent.
Yes. ECC is cross-platform:
- **Cursor**: Pre-translated configs in `.cursor/`. See [Platform Support](#platform-support).
- **Gemini CLI**: Experimental project-local support via `.gemini/GEMINI.md` and shared installer plumbing.
- **OpenCode**: Beta plugin integration in `.opencode/`; provider model selection and catalog parity remain limited.
- **OpenCode**: Beta plugin integration in `.opencode/`; models follow the user's OpenCode selection, while catalog parity remains limited.
- **Codex**: Supported repo/sync path for macOS app and CLI; ECC's marketplace package remains experimental.
- **GitHub Copilot (VS Code)**: Instruction and prompt layer via `.github/copilot-instructions.md`, `.vscode/settings.json`, and `.github/prompts/`.
- **Antigravity**: Native Antigravity 2.0 setup for workflows, skills, custom agents, and flattened rules in `.agents/`. See [Antigravity Guide](docs/ANTIGRAVITY-GUIDE.md).
+13
View File
@@ -28,6 +28,19 @@ const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
let passed = 0;
let failed = 0;
if (
test('model selection inherits the user configured OpenCode provider', () => {
assert.ok(!Object.hasOwn(config, 'model'), 'Root config must not pin a provider-specific model');
assert.ok(!Object.hasOwn(config, 'small_model'), 'Root config must not pin a provider-specific small model');
for (const [agentId, agent] of Object.entries(config.agent || {})) {
assert.ok(!Object.hasOwn(agent, 'model'), `Agent "${agentId}" must inherit the selected OpenCode model`);
}
})
)
passed++;
else failed++;
if (
test('plugin paths do not duplicate the .opencode directory', () => {
const plugins = config.plugin || [];