opencode-resolve 0.1.13 → 0.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,345 +1,106 @@
1
1
  # opencode-resolve — Lightweight Resolver Plugin for OpenCode
2
2
 
3
- **[English](./README.md) | [한국어](./README.ko.md)**
3
+ **[English](./README.md) | [Korean](./README.ko.md) | [Documentation](https://jshsakura.github.io/opencode-resolve/)**
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/opencode-resolve.svg)](https://www.npmjs.com/package/opencode-resolve)
6
6
  [![CI](https://github.com/jshsakura/opencode-resolve/actions/workflows/publish.yml/badge.svg)](https://github.com/jshsakura/opencode-resolve/actions/workflows/publish.yml)
7
+ [![GitHub Pages](https://img.shields.io/badge/docs-live-blue?logo=github)](https://jshsakura.github.io/opencode-resolve/)
7
8
  [![license: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
8
9
 
9
- > **opencode-resolve** is a **lightweight resolver plugin for [OpenCode](https://opencode.ai)**. It lives _inside_ your OpenCode session and turns a single instruction into a finished, verified change that is what _resolving_ means here.
10
- >
11
- > It is **not** a standalone application, not a model provider, not a separate CLI you run daily, and not a replacement for your `opencode.json` configuration. It is an OpenCode plugin and nothing more.
10
+ `opencode-resolve` is an [OpenCode](https://opencode.ai) plugin that adds a small, fixed-role resolve loop for coding tasks:
12
11
 
13
- It exposes a **fixed-role verified resolve loop** — **resolver** (context-efficient planner/judge) and **coder** (focused implementer) — with low-friction permissions for edits, verification, and safe shell commands. The resolver inspects only relevant files, plans the smallest patch, dispatches coder with exact instructions, verifies, and iterates through verified checkpoints. Repeated failures trigger debugger/architect recovery guidance and, after repeated consecutive failures, the resolver should stop and report the blocker instead of pretending the task is complete. Internal specialist subagents (**explorer**, **reviewer**, **deep-reviewer**) are injected by default as OpenCode-native subagents — available when the resolver judges them justified — but they are not part of the core path and are never user-facing primary roles. It defines roles, not model providers: agents inherit your OpenCode default model unless you pin them.
12
+ - `resolver` plans, dispatches, verifies, and iterates.
13
+ - `coder` makes focused edits and runs targeted checks.
14
+ - `explorer`, `reviewer`, `deep-reviewer`, and `planner` are available as internal subagents when the resolver needs them.
14
15
 
15
- ```
16
- # Paste this into any AI coding assistant for fully guided setup
17
- Install and configure opencode-resolve by following the instructions here:
18
- https://github.com/jshsakura/opencode-resolve#drop-in-setup-give-to-an-llm
19
- ```
20
-
21
- ---
22
-
23
- ## What this is — and isn't
24
-
25
- | ✅ What it is | ❌ What it isn't |
26
- |---|---|
27
- | A **lightweight resolver plugin for OpenCode** installed via `opencode plugin opencode-resolve` | A standalone app or separate CLI |
28
- | A fixed-role verified loop (resolver + coder) injected into OpenCode | A model provider or API key manager |
29
- | A Context7 MCP auto-registration hook | A replacement for your `opencode.json` config |
30
- | A config file (`resolve.json`) that lives alongside OpenCode config | Something you invoke manually every time you code |
31
- | Installed once, then runs automatically inside OpenCode | An alternative to OpenCode itself |
16
+ It is not a standalone app, model provider, API key manager, or replacement for `opencode.json`.
32
17
 
33
- If OpenCode is not installed or not running, opencode-resolve does nothing.
34
-
35
- ---
18
+ ```sh
19
+ npm install -g opencode-resolve
20
+ opencode plugin opencode-resolve --global --force
21
+ ```
36
22
 
37
- ## Table of Contents
23
+ ## Contents
38
24
 
39
- - [Features](#features)
40
- - [AI-Powered Setup](#ai-powered-setup)
41
- - [Prerequisites](#prerequisites)
42
- - [Quick Start](#quick-start)
43
- - [Drop-in setup (give to an LLM)](#drop-in-setup-give-to-an-llm)
44
- - [Default Behavior](#default-behavior)
45
- - [Project Context Sources](#project-context-sources)
25
+ - [What It Adds](#what-it-adds)
26
+ - [Install](#install)
27
+ - [Recommended Skills](#recommended-skills)
46
28
  - [Configuration](#configuration)
47
- - [Configuration Reference](#configuration-reference)
48
- - [Auto Approval](#auto-approval)
49
- - [Parallel Subagent Limit](#parallel-subagent-limit)
50
- - [Upgrade & Migration](#upgrade--migration)
51
29
  - [Model Setup](#model-setup)
52
- - [Agent Reference](#agent-reference)
53
- - [Optional Commands](#optional-commands)
54
- - [Context7 Integration](#context7-integration)
55
- - [Keeping Up to Date](#keeping-up-to-date)
56
- - [Local Development](#local-development)
57
- - [Verification](#verification)
30
+ - [Agents](#agents)
31
+ - [Permissions](#permissions)
32
+ - [Context7](#context7)
33
+ - [Project Context](#project-context)
34
+ - [Upgrade](#upgrade)
35
+ - [Development](#development)
58
36
  - [Release](#release)
59
- - [Design Rules](#design-rules)
60
- - [License](#license)
61
-
62
- ---
63
-
64
- ## Features
65
-
66
- - **Fixed-role verified resolve loop** — `resolver` (context-efficient planner/judge) + `coder` (focused implementer)
67
- - **Context-efficient by default** — minimal file reads, smallest patch, targeted verification, checkpointed execution, and explicit blocker reporting when repeated fixes fail
68
- - **Committed team context discovery** — detects `HARNESS.md`, `AGENTS.md`, `.opencode/context`, `.claude/context`, `context/`, and Agentic-style `thoughts/`, then lists task-relevant pattern documents without stuffing the whole repo into the prompt
69
- - **OpenCode-native internal specialist subagents** — `reviewer` (verification-gap audit), `explorer` (codebase scout), `deep-reviewer` (risky/security review) — injected as subagents by default but not part of the core path; resolver dispatches them only when justified
70
- - **Low-friction permissions** — edit/webfetch are allowed for write agents; bash is classifier-routed so safe commands are allowed, dangerous commands denied, and unknown commands still ask
71
- - **Context7 MCP** — auto-registers [Context7](https://context7.com) documentation lookup when `context7: true`
72
- - **Model pinning** — pin different models per role when you have measured a benefit; by default all roles inherit your OpenCode default model
73
- - **Soft parallel cap** — `maxParallelSubagents` controls how many coders the resolver fans out
74
- - **Strict validation** — unknown keys, typos, invalid modes, and wrong types all fail fast at load time
75
- - **Additive migration** — upgrades never overwrite your existing config
76
- - **Zero dependencies beyond `@opencode-ai/plugin`** — nothing extra to install
77
-
78
- ---
79
-
80
- ## AI-Powered Setup
81
-
82
- > **One line. Any AI coding assistant. Everything configured automatically.**
83
-
84
- Paste this into Claude Code, Cursor, Codex, OpenCode, Windsurf, VS Code Copilot, or Gemini CLI:
85
-
86
- ```
87
- Install and configure opencode-resolve by following the instructions here:
88
- https://github.com/jshsakura/opencode-resolve#drop-in-setup-give-to-an-llm
89
- ```
90
37
 
91
- Your AI will:
38
+ ## What It Adds
92
39
 
93
- 1. Install the plugin via `opencode plugin opencode-resolve --global --force`
94
- 2. Merge `opencode-resolve` into your `opencode.json` plugin array
95
- 3. Create `resolve.json` with a working configuration
96
- 4. Tell you to restart OpenCode
40
+ - A verified `resolver -> coder` loop that favors small patches and evidence-backed completion.
41
+ - Read-only scout/review subagents for targeted discovery and verification gaps.
42
+ - Optional command aliases: `/resolve`, `/resolve-code`, `/resolve-review`.
43
+ - Optional Context7 MCP registration for documentation lookup.
44
+ - Strict config validation: unknown keys, bad modes, bad agent names, and invalid types fail early.
45
+ - Conservative migration: generated config is additive and existing values are not overwritten without consent.
97
46
 
98
- No manual config editing required. Works on macOS, Linux, and Windows.
99
-
100
- > For manual setup, see [Prerequisites](#prerequisites) and [Quick Start](#quick-start) below.
101
-
102
- ---
103
-
104
- ## Prerequisites
105
-
106
- ### 1. OpenCode
107
-
108
- opencode-resolve is an OpenCode plugin. You need [OpenCode](https://opencode.ai) installed and running.
109
-
110
- Verify:
111
-
112
- ```sh
113
- opencode --version
114
- ```
115
-
116
- ### 2. Node.js ≥ 20
117
-
118
- The plugin and OpenCode itself require Node.js 20 or later.
119
-
120
- Verify:
121
-
122
- ```sh
123
- node --version # should be v20.x or later
124
- ```
125
-
126
- ### 3. A configured model provider
127
-
128
- OpenCode needs at least one model provider configured in `~/.config/opencode/opencode.json` with a valid API key. opencode-resolve agents inherit your default model unless you pin them.
129
-
130
- Example minimal provider setup:
47
+ Default enabled agents:
131
48
 
132
49
  ```json
133
- {
134
- "model": "openai/gpt-4o",
135
- "provider": {
136
- "openai": {
137
- "name": "OpenAI"
138
- }
139
- }
140
- }
50
+ ["coder", "resolver", "explorer", "reviewer", "deep-reviewer", "planner"]
141
51
  ```
142
52
 
143
- > No additional API keys are required for the plugin itself. Context7 is auto-registered by the plugin. For GLM/ZAI users, postinstall may add a local ZAI MCP server bootstrap, but it does **not** copy API keys into `opencode.json`; export `Z_AI_API_KEY` in your shell if that MCP server requires it.
53
+ ## Install
144
54
 
145
- ---
55
+ ### Requirements
146
56
 
147
- ## Quick Start
57
+ - OpenCode installed and runnable: `opencode --version`
58
+ - Node.js 20 or newer: `node --version`
59
+ - At least one OpenCode model provider configured in `~/.config/opencode/opencode.json`
148
60
 
149
- ### Install from npm
61
+ ### Install
150
62
 
151
63
  ```sh
152
64
  npm install -g opencode-resolve
153
- ```
154
-
155
- The `postinstall` script automatically:
156
-
157
- 1. Adds `opencode-resolve` to `~/.config/opencode/opencode.json` `plugin` array (if not already present).
158
- 2. Creates `~/.config/opencode/resolve.json` adapted to your current model provider when the file does not exist:
159
- - **Interactive terminal** → always asks for `mix` / `gpt` / `glm`, then lets you pick three-tier `bronze` / `silver` / `gold` models. In `mix`, it also asks whether to enable dedicated `gpt` and `glm` primary agents.
160
- - **Non-interactive install** → auto-detects providers from opencode.json and writes a model-adapted preset. Enables `resolver`, `gpt`, and `glm` as primary routes.
161
- - **GLM/ZAI model detected** → still adds the non-secret local ZAI MCP bootstrap.
162
-
163
- Existing `resolve.json` files are **never overwritten without consent**. On reinstall, interactive setup asks whether to update the existing file or back it up and run fresh setup. For non-interactive automation, set `OPENCODE_RESOLVE_REINSTALL=fresh` or `OPENCODE_RESOLVE_REINSTALL=update`.
164
-
165
- To skip automatic registration:
166
-
167
- ```sh
168
- OPENCODE_RESOLVE_SKIP_POSTINSTALL=1 npm install -g opencode-resolve
169
- ```
170
-
171
- ### Refresh the plugin cache
172
-
173
- > **Important — OpenCode caches plugins itself.** OpenCode does NOT use globally-installed npm packages directly. It maintains its own cache at `~/.cache/opencode/packages/`. After the very first install (or any future upgrade), refresh the cache:
174
-
175
- ```sh
176
65
  opencode plugin opencode-resolve --global --force
177
- ```
178
-
179
- If OpenCode keeps loading the old package anyway, clear only the OpenCode plugin cache entry and install again. This does **not** delete `~/.config/opencode/resolve.json`.
180
-
181
- Linux/macOS:
182
-
183
- ```sh
184
- export OPENCODE_CACHE_ROOT="${XDG_CACHE_HOME:-$HOME/.cache}/opencode"
185
- rm -rf "$OPENCODE_CACHE_ROOT/packages/opencode-resolve@latest"
186
- opencode plugin opencode-resolve@latest --global --force
187
- node -e "console.log(require(process.env.OPENCODE_CACHE_ROOT + '/packages/opencode-resolve@latest/node_modules/opencode-resolve/package.json').version)"
188
- ```
189
-
190
- Windows PowerShell:
191
-
192
- ```powershell
193
- $OpenCodeCacheRoot = if ($env:XDG_CACHE_HOME) { Join-Path $env:XDG_CACHE_HOME "opencode" } else { Join-Path $env:LOCALAPPDATA "opencode" }
194
- $PluginCache = Join-Path $OpenCodeCacheRoot "packages\opencode-resolve@latest"
195
- Remove-Item -Recurse -Force $PluginCache -ErrorAction SilentlyContinue
196
- opencode plugin opencode-resolve@latest --global --force
197
- $Pkg = Join-Path $PluginCache "node_modules\opencode-resolve\package.json"
198
- node -e "console.log(require(process.argv[1]).version)" $Pkg
199
- ```
200
-
201
- Restart OpenCode after the cache refresh.
202
-
203
- ### Manual fallback
204
-
205
- If `postinstall` didn't register the plugin, add it to `~/.config/opencode/opencode.json` yourself:
206
-
207
- ```json
208
- {
209
- "plugin": ["opencode-resolve"]
210
- }
211
- ```
212
-
213
- ### Restart OpenCode
214
-
215
- ```sh
216
66
  opencode
217
67
  ```
218
68
 
219
- You should now see `resolver` available as the user-facing resolve agent. `coder` is enabled as a subagent for resolver to dispatch, so it may not appear in the primary picker.
69
+ The npm `postinstall` script registers the plugin in `~/.config/opencode/opencode.json`, creates `~/.config/opencode/resolve.json` if missing, preserves existing model pins (unless you opt out with `--reset-config`), and refreshes the OpenCode plugin cache under `~/.cache/opencode/packages/`.
220
70
 
221
- ---
71
+ ### Re-run setup
222
72
 
223
- ## Drop-in setup (give to an LLM)
73
+ Re-run the installer any time with the `opencode-resolve setup` CLI:
224
74
 
225
- Hand the block below to any reasonably capable LLM along with the instruction _"set up opencode-resolve on this machine"_ and it will finish the install end-to-end. The LLM **must run this interactively** — it discovers what providers and models are already configured, then asks the user which to pin per role. No guessing, no invented model IDs.
75
+ | Command | When to use |
76
+ | --- | --- |
77
+ | `opencode-resolve setup --fresh` | Regenerate `resolve.json`; keep existing model pins |
78
+ | `opencode-resolve setup --reset-config` | Regenerate `resolve.json` and reset model pins |
79
+ | `opencode-resolve setup --models` | Re-detect model pins only |
80
+ | `opencode-resolve setup --force-cache` | Refresh OpenCode plugin cache only |
226
81
 
227
- > **For LLMs reading this:** treat every "Ask the user" prompt below as a real question — wait for the user's answer before continuing. Never proceed with a default if the user hasn't responded. Never invent model IDs that aren't in the user's `opencode.json` (or in their declared `provider.*` registry).
228
-
229
- ### Step 1 — Install and prime the cache
82
+ Skip postinstall automation:
230
83
 
231
84
  ```sh
232
- opencode plugin opencode-resolve --global --force
85
+ OPENCODE_RESOLVE_SKIP_POSTINSTALL=1 npm install -g opencode-resolve
233
86
  ```
234
87
 
235
- This downloads the plugin, installs it into OpenCode's package cache (`~/.cache/opencode/packages/`), and makes it available.
88
+ ### Optional companion plugins
89
+
90
+ - `@tarquinen/opencode-dcp@latest` — trims obsolete tool output during long loops.
91
+ - `@slkiser/opencode-quota@latest` — shows token/quota usage without polluting context.
236
92
 
237
- ### Step 2 — Register the plugin in `~/.config/opencode/opencode.json`
93
+ ### Manual setup
238
94
 
239
- Add the string `"opencode-resolve"` to the `plugin` array. **Do not use the inline tuple form here** — keep the entry as a bare string so all role/model config lives in `resolve.json` (Step 3). This avoids split-brain configuration.
95
+ Add the plugin to `~/.config/opencode/opencode.json`:
240
96
 
241
97
  ```json
242
98
  {
243
- "$schema": "https://opencode.ai/config.json",
244
- "model": "<user-default-model-id>",
245
99
  "plugin": ["opencode-resolve"]
246
100
  }
247
101
  ```
248
102
 
249
- > If the user already has other plugins, append `"opencode-resolve"` to the existing array. **Never overwrite** their existing config.
250
-
251
- #### 2b. Offer the recommended companion plugins
252
-
253
- Before moving to model selection, ask the user about two **independent** companion plugins — one question each, recommended-by-default. Both are separate OpenCode plugins; opencode-resolve does not require them but pairs well with both.
254
-
255
- **Companion 1 — `@tarquinen/opencode-dcp` (Dynamic Context Pruning)**
256
-
257
- > _opencode-resolve pairs well with **`@tarquinen/opencode-dcp`** — it prunes obsolete tool outputs so long resolver loops cost fewer tokens. Want to install it? (recommended)_
258
-
259
- **Companion 2 — `@slkiser/opencode-quota` (quota & usage tracking)**
260
-
261
- > _And **`@slkiser/opencode-quota`** — shows your live token/quota usage without polluting the context window. Supports GLM coding-plan, OpenAI Plus/Pro, Qwen, and more. Useful for keeping an eye on your own usage / remaining quota. Install it? (recommended)_
262
-
263
- For each **yes** answer:
264
-
265
- 1. Run `opencode plugin <package>@latest --global --force` (primes the cache).
266
- 2. Append `"<package>@latest"` to the `plugin` array in `~/.config/opencode/opencode.json`, only if it is not already present.
267
-
268
- Where `<package>` is `@tarquinen/opencode-dcp` or `@slkiser/opencode-quota`.
269
-
270
- For each **no**, skip — do not modify `opencode.json` for that entry. Proceed to Step 3 either way.
271
-
272
- > `context7` MCP is registered automatically by opencode-resolve at runtime when `context7: true` (the default in `resolve.json`). No separate question is needed for that.
273
-
274
- ### Step 3 — Pick models interactively, then write `~/.config/opencode/resolve.json`
275
-
276
- The LLM **drives a short Q&A** here. Goal: end with `resolve.json` containing model IDs the user explicitly chose from their own configuration.
277
-
278
- #### 3a. Discover the user's installed providers and models
279
-
280
- Read `~/.config/opencode/opencode.json` and build a candidate map:
281
-
282
- | Source | What to collect |
283
- |---|---|
284
- | `provider.*` keys | Each configured provider (e.g. `zai`, `openai`, `anthropic`). |
285
- | `provider.<key>.models.*` keys | The model keys the user has declared under that provider. |
286
- | Top-level `model` | If the prefix before `/` is not already in `provider.*`, add it as an implicit candidate (e.g. `zai-coding-plan` from `zai-coding-plan/glm-5.1`). |
287
- | `agent.*.model` | Any per-agent overrides — add their provider/model pairs as candidates. |
288
-
289
- If the user has **no providers configured at all**, stop and tell them to add at least one provider with a valid API key to `opencode.json` first — opencode-resolve cannot pick a model that does not exist.
290
-
291
- #### 3b. Ask the user: which provider?
292
-
293
- Print the candidate list and ask. Example wording the LLM should use:
294
-
295
- > _I found these providers in your OpenCode config. Which one should opencode-resolve roles use?_
296
- >
297
- > 1. `zai-coding-plan` — models: `glm-5.1`, `glm-4.7-flash`
298
- > 2. `openai` — models: `gpt-4o`, `gpt-4o-mini`, `o1`, `o1-mini`, `o3-mini`, `gpt-5.5`
299
- > 3. _Other (provide an explicit `provider/model` ID)_
300
-
301
- If exactly one provider candidate exists, skip the question and use it.
302
-
303
- #### 3c. Ask the user: single, two-tier, or three-tier split?
304
-
305
- The default recommendation is **C (three-tier bronze/silver/gold)** — opencode-resolve has three qualitatively distinct workloads (read-only scout → write/patch → reason/judge) and three matching tiers cost about the same as two-tier but read role costs more accurately. Fall back to B if the user only has two models, A only when they have one.
306
-
307
- > _Recommended: **three-tier** — a cheap scout model for `explorer`, a mid coder for `coder`, and a strong reasoner for `resolver`/`reviewer`/`deep-reviewer`/`planner`. Choose:_
308
- >
309
- > **C. Three-tier — bronze (scout) + silver (coder) + gold (reasoner) — recommended**
310
- > B. Two-tier — fast + strong (when you only have two models)
311
- > A. Single model for all roles (only if you have one model or want maximum simplicity)
312
-
313
- Default to C if the user just hits enter or says "recommended". Only fall back if they don't have enough distinct models. Same-provider split is fully valid (e.g. `openai/gpt-4o-mini` / `openai/gpt-5.3-codex` / `openai/o4-mini`, or `zai/glm-4.7-flash` / `zai-coding-plan/glm-5.1` / `zai/glm-5`).
314
-
315
- #### 3d. Ask the user: which model(s)?
316
-
317
- Show only the models under the provider picked in 3b.
318
-
319
- - For **single-tier (A)** — ask one question:
320
- > _Which model should every role use?_ → list models from the chosen provider.
321
- - For **split (B)** — ask two questions, in order:
322
- > _Pick the **fast** model for `coder` and `explorer`:_ → list models.
323
- >
324
- > _Pick the **strong** model for `resolver`, `reviewer`, `deep-reviewer`:_ → list models.
325
-
326
- Confirm each pick back to the user before writing the file. Example:
327
-
328
- > _I'll pin `coder` and `explorer` to `zai-coding-plan/glm-5.1`, and `resolver`/`reviewer`/`deep-reviewer` to `openai/gpt-5.5`. Proceed?_
329
-
330
- #### 3d-bis. Skip `maxParallelSubagents` unless the user explicitly wants a hard cap
331
-
332
- The default flow does **not** write `maxParallelSubagents` to `resolve.json`. The resolver prompt ships with soft fan-out guidance — fan out coders when work is genuinely independent, back off on rate-limit errors, explorer is unrestricted, reviewer/deep-reviewer/planner are singletons by nature. This matches how oh-my-openagent (per-model semaphore, default no real cap) and OpenCode core (no built-in concurrency rule) handle the same concern, and avoids overconstraining a model that's already aware of rate limits.
333
-
334
- Only ask about `maxParallelSubagents` if the user explicitly mentions wanting to cap fan-out. Common case: GLM coding-plan users who want to **guarantee** they never burst beyond 1 or 2 coder calls. Suggested wording:
335
-
336
- > _(optional, ask only if relevant)_ _Your `coder` model is GLM — the coding-plan throttles under bursts. Pin `maxParallelSubagents: 1` for strict serial coder dispatch?_
337
-
338
- Otherwise, omit the field entirely.
339
-
340
- #### 3e. Write `~/.config/opencode/resolve.json`
341
-
342
- **Three-tier (C, recommended)** — use the `bronze`/`silver`/`gold` aliases:
103
+ Create `~/.config/opencode/resolve.json`:
343
104
 
344
105
  ```json
345
106
  {
@@ -347,679 +108,284 @@ Otherwise, omit the field entirely.
347
108
  "preserveNative": true,
348
109
  "context7": true,
349
110
  "commands": false,
350
- "models": {
351
- "bronze": "<provider>/<scout-model>",
352
- "silver": "<provider>/<coder-model>",
353
- "gold": "<provider>/<reasoner-model>",
354
- "explorer": "bronze",
355
- "coder": "silver",
356
- "resolver": "gold",
357
- "reviewer": "gold",
358
- "deep-reviewer": "gold",
359
- "planner": "gold"
360
- },
111
+ "models": {},
361
112
  "agents": {
362
- "coder": { "enabled": true, "mode": "subagent" },
363
- "resolver": { "enabled": true },
364
- "explorer": { "enabled": true, "mode": "subagent" },
365
- "reviewer": { "enabled": true, "mode": "subagent" },
366
- "deep-reviewer": { "enabled": true, "mode": "subagent" },
367
- "planner": { "enabled": true, "mode": "subagent" },
368
- "architect": { "enabled": false },
369
- "gpt-coder": { "enabled": false },
370
- "debugger": { "enabled": false },
371
- "researcher": { "enabled": false }
372
- },
373
- "autoApprove": true,
374
- "autoUpdate": true
113
+ "coder": { "enabled": true, "mode": "subagent" },
114
+ "resolver": { "enabled": true },
115
+ "explorer": { "enabled": true, "mode": "subagent" },
116
+ "reviewer": { "enabled": true, "mode": "subagent" },
117
+ "deep-reviewer": { "enabled": true, "mode": "subagent" },
118
+ "planner": { "enabled": true, "mode": "subagent" }
119
+ }
375
120
  }
376
121
  ```
377
122
 
378
- **Two-tier (B)** collapse bronze and silver if the user has only two models:
123
+ Refresh the OpenCode cache and restart:
379
124
 
380
- ```json
381
- "models": {
382
- "silver": "<provider>/<coder-model>",
383
- "gold": "<provider>/<reasoner-model>",
384
- "explorer": "silver",
385
- "coder": "silver",
386
- "resolver": "gold",
387
- "reviewer": "gold",
388
- "deep-reviewer": "gold",
389
- "planner": "gold"
390
- }
125
+ ```sh
126
+ opencode plugin opencode-resolve --global --force
127
+ opencode
391
128
  ```
392
129
 
393
- **Single-tier (A)** every role on one model:
130
+ If OpenCode still loads an old plugin copy:
394
131
 
395
- ```json
396
- "models": {
397
- "gold": "<provider>/<single-model>",
398
- "explorer": "gold",
399
- "coder": "gold",
400
- "resolver": "gold",
401
- "reviewer": "gold",
402
- "deep-reviewer": "gold",
403
- "planner": "gold"
404
- }
132
+ ```sh
133
+ export OPENCODE_CACHE_ROOT="${XDG_CACHE_HOME:-$HOME/.cache}/opencode"
134
+ rm -rf "$OPENCODE_CACHE_ROOT/packages/opencode-resolve@latest"
135
+ opencode plugin opencode-resolve@latest --global --force
405
136
  ```
406
137
 
407
- Replace every `<provider>/<model>` placeholder with the **exact** ID strings the user picked. **Do not** add `maxParallelSubagents` unless the user explicitly asked for a hard cap (see 3d-bis).
408
-
409
- Replace every `<provider>/<model>` placeholder with the **exact** ID strings the user picked in 3b/3d — no inventing, no autocompletion, no version drift. If you cannot map the picked model to a `provider/model` string, ask the user to clarify rather than guessing.
410
-
411
- > Each enabled agent carries an explicit `enabled: true` so the file is self-documenting. The `enabled` array remains authoritative; the per-agent flag just removes ambiguity for humans reading the file.
138
+ ## Recommended Skills
412
139
 
413
- > If `resolve.json` already exists, **do not overwrite it silently**. Show the user the existing content first, summarize what would change, and ask whether to overwrite, merge, or abort.
140
+ For a broader OpenCode setup, try [awesome-opencode-skills](https://github.com/jshsakura/awesome-opencode-skills). It installs a large OpenCode Skills collection for specialized development, infrastructure, security, data, and documentation tasks.
414
141
 
415
- ### Step 4 — Restart OpenCode and verify
416
-
417
- Close and reopen OpenCode, then confirm the install worked:
142
+ macOS / Linux:
418
143
 
419
144
  ```sh
420
- opencode run "list available agents"
145
+ curl -sL https://raw.githubusercontent.com/jshsakura/awesome-opencode-skills/main/install.sh | bash
421
146
  ```
422
147
 
423
- The output **must** include `resolver` and `coder` (and `reviewer` if enabled). Two failure modes to check explicitly:
424
-
425
- | Symptom | Cause | Fix |
426
- |---|---|---|
427
- | Only OpenCode's built-in `explore` / `general` appear | Plugin didn't load | Re-run `opencode plugin opencode-resolve --global --force`; verify `"opencode-resolve"` is in `opencode.json` `plugin` array as a string. |
428
- | Agents appear but fail when invoked with "model not found" | A pinned model ID in `models` doesn't exist | Re-open `resolve.json`, replace the offending ID with one the user actually has, restart. |
429
- | The user said split but only one tier shows up | `models` block missing `fast` or `strong` | Re-run Step 3 from 3d. |
430
-
431
- Internal specialist subagents (`coder`, `explorer`, `reviewer`, `deep-reviewer`, `planner`) are subagent-only and won't appear in the primary picker — `resolver` is the default user-facing resolve agent.
432
-
433
- ### Why this template
434
-
435
- | Setting | Why |
436
- |---|---|
437
- | `enabled: ["coder", "resolver", "explorer", "reviewer", "deep-reviewer", "planner"]` | Fixed core path (resolver→coder) plus OpenCode-native internal specialist subagents injected by default |
438
- | `autoApprove: true` | Compatibility/readability flag; actual low-friction behavior comes from base permissions plus the `permission.ask` bash classifier |
439
- | no `maxParallelSubagents` by default | Keeps the resolver on soft fan-out guidance; GLM profile is token-efficient but does not impose a hard concurrency cap unless you set one |
440
- | `agents.coder.mode = "subagent"` | Coder stays on the fixed resolver→coder path instead of becoming a user-facing primary role |
441
- | `agents.{explorer,reviewer,deep-reviewer}.mode = "subagent"` | Internal specialists are subagent-only — never user-facing primary roles |
442
- | `context7: true` | Plugin auto-registers Context7 MCP — no manual MCP config needed |
443
- | `models` aliases | Empty by default — all roles inherit the OpenCode default model. Pin role-specific models only when you have measured a benefit |
444
- | Other agents disabled | `architect`, `gpt-coder`, `debugger`, `researcher` off by default. Enable when needed |
445
-
446
- ### What happens when you call the resolver
447
-
448
- 1. **Classify** — Resolver classifies the work as quick, normal, deep, or risky.
449
- 2. **Inspect** — Reads only relevant files using local tools. No broad exploration.
450
- 3. **For trivial work** — Resolver applies the small edit directly. No subagent needed.
451
- 4. **Implement** — Dispatches `coder` with exact file paths and focused instructions.
452
- 5. **Verify** — Runs the cheapest meaningful check first (targeted test, type check, or lint).
453
- 6. **Recover** — If issues remain, dispatches `debugger` or `coder` again with a focused fix. After repeated consecutive failures, stop and report the blocker instead of claiming completion.
454
- 7. **Report** — Returns a concise evidence summary: what changed, verification results, and any remaining blockers.
455
- 8. **Internal specialists** — When justified: dispatch `explorer` (scope genuinely unknown), `reviewer` (verification gap on non-trivial changes), or `deep-reviewer` (risky/security/high-impact only). These are available by default as subagents but are not the core path.
456
-
457
- ---
458
-
459
- ## Default Behavior
460
-
461
- | Item | Default |
462
- |---|---|
463
- | Enabled agents | `coder`, `resolver`, `explorer`, `reviewer`, `deep-reviewer`, `planner` |
464
- | Core path | `resolver` → `coder` (fixed-role verified loop) |
465
- | Internal subagents | `explorer`, `reviewer`, `deep-reviewer` (subagent-only, dispatched when justified) |
466
- | Primary agent for new tasks | `resolver` (`mode: "all"`) |
467
- | Agent model | Inherits top-level OpenCode `model` |
468
- | Native `plan` / `build` | Preserved untouched |
469
- | Project context sources | `HARNESS.md`, `AGENTS.md`, `CLAUDE.md`, `CONVENTIONS.md`, `.opencode/context`, `.claude/context`, `context/`, `thoughts/` |
470
- | Context7 MCP preset | Added automatically when `context7: true` |
471
- | Optional commands | Disabled |
472
- | `autoApprove` | `true` (compatibility/readability flag; bash routing is handled by the permission hook) |
473
- | Repeated-failure behavior | Diagnose, retry with a different fix, pivot to architect after heavy failure, then report blockers instead of claiming completion |
474
-
475
- ---
476
-
477
- ## Project Context Sources
478
-
479
- opencode-resolve can discover committed project knowledge without loading the whole repository into the prompt. The resolver sees the available sources and should read only the documents relevant to the current task.
480
-
481
- Detected top-level knowledge files:
482
-
483
- | Source | Purpose |
484
- |---|---|
485
- | `HARNESS.md` | Build, verification, infrastructure, deployment, and project traps |
486
- | `AGENTS.md` | Agent behavior, delegation rules, review expectations, local workflow |
487
- | `CLAUDE.md` | Existing AI coding guidance used by other tools |
488
- | `CONVENTIONS.md` | Code style, naming, architecture, and repository conventions |
489
-
490
- Detected context directories:
491
-
492
- | Source | Behavior |
493
- |---|---|
494
- | `.opencode/context/` | OpenCode/OAC-style team pattern docs |
495
- | `.claude/context/` | Claude-style shared context docs |
496
- | `context/` | Generic project context docs |
497
- | `thoughts/` | Agentic-style persistent knowledge: architecture, tickets, research, plans, reviews |
498
-
499
- For context directories, the plugin lists `.md`, `.mdx`, `.txt`, `.json`, `.jsonc`, `.yaml`, and `.yml` files up to a bounded depth and count. `thoughts/archive/` is intentionally skipped because archived notes are often stale or misleading.
500
-
501
- Local runtime state is intentionally ignored by git:
148
+ Windows PowerShell:
502
149
 
503
- ```text
504
- .opencode/resolve-state.json
505
- .opencode/*.local.json
150
+ ```powershell
151
+ irm https://raw.githubusercontent.com/jshsakura/awesome-opencode-skills/main/install.ps1 | iex
506
152
  ```
507
153
 
508
- Committed context such as `.opencode/context/` and `thoughts/` is not ignored.
509
-
510
- ---
511
-
512
154
  ## Configuration
513
155
 
514
156
  The plugin reads the first config file it finds:
515
157
 
516
- | Priority | Path |
517
- |---:|---|
518
- | 1 | `.opencode/resolve.json` (project) |
519
- | 2 | `opencode-resolve.json` (project) |
520
- | 3 | `~/.config/opencode/resolve.json` |
521
- | 4 | `~/.config/opencode/opencode-resolve.json` |
522
-
523
- Inline plugin options in `opencode.json` override file config.
524
-
525
- Config precedence:
526
-
527
- ```text
528
- built-in defaults → first config file found → inline plugin options
529
- ```
530
-
531
- Minimal config (matches defaults):
532
-
533
- ```json
534
- {
535
- "enabled": ["coder", "resolver", "explorer", "reviewer", "deep-reviewer", "planner"],
536
- "autoApprove": true,
537
- "context7": true,
538
- "commands": false
539
- }
540
- ```
158
+ 1. `.opencode/resolve.json`
159
+ 2. `opencode-resolve.json`
160
+ 3. `~/.config/opencode/resolve.json`
161
+ 4. `~/.config/opencode/opencode-resolve.json`
541
162
 
542
- Inline form inside `opencode.json`:
163
+ Inline plugin options in `opencode.json` override file config. You can also point at a custom file:
543
164
 
544
165
  ```json
545
166
  {
546
167
  "plugin": [
547
168
  [
548
169
  "opencode-resolve",
549
- {
550
- "enabled": ["coder", "resolver", "explorer", "reviewer", "deep-reviewer", "planner"],
551
- "autoApprove": true,
552
- "context7": true,
553
- "commands": false
554
- }
170
+ { "config": ".opencode/resolve.json" }
555
171
  ]
556
172
  ]
557
173
  }
558
174
  ```
559
175
 
560
- Strict validation rejects unknown agent names, misspelled keys, invalid modes, invalid permission values, and wrong value types — typos fail fast.
561
-
562
- ---
563
-
564
- ## Configuration Reference
565
-
566
- Every accepted top-level option:
567
-
568
- | Key | Type | Default | Purpose |
569
- |---|---|---|---|
570
- | `profile` | `"mix" \| "gpt" \| "glm"` | `"mix"` | Top-level operating profile. `mix` is the explicit default; `gpt` and `glm` apply provider-specific prompts, enabled-agent defaults, and chat parameters. |
571
- | `tier` | `"bronze" \| "silver" \| "gold"` | _none_ | Optional enabled-agent preset. `bronze` is minimal, `silver` is standard, `gold` enables the full specialist set. |
572
- | `enabled` | `string[]` | `["coder", "resolver", "explorer", "reviewer", "deep-reviewer", "planner"]` | Which resolve agents to inject. Core path: resolver→coder. Internal specialists (coder, explorer, reviewer, deep-reviewer, planner) are subagent-only. Per-agent `agents.<name>.enabled` overrides this. |
573
- | `preserveNative` | `boolean` | `true` | Native `plan`/`build` are always preserved. Accepted for readability. |
574
- | `context7` | `boolean` | `true` | When true, registers the Context7 MCP server unless already configured. |
575
- | `commands` | `boolean` | `false` | When true, adds `resolve`, `resolve-code`, `resolve-review` commands. |
576
- | `autoApprove` | `boolean` | `true` | Compatibility/readability flag. Current behavior is controlled by built-in base permissions and the `permission.ask` bash classifier; the flag does not rewrite permissions. |
577
- | `autoUpdate` | `boolean` | `true` | Best-effort npm version check and OpenCode plugin cache refresh notice. Set false to disable. |
578
- | `maxParallelSubagents` | `positive integer` | _unset_ | Optional prompt-level cap on simultaneous coders. When unset, the resolver uses soft fan-out guidance and backs off on rate-limit errors. GLM profile does not impose a hard cap unless you set one. |
579
- | `models` | `object` | `{}` | Alias map. Keys are agent names or provider-neutral aliases including `bronze`/`silver`/`gold`, `gpt-*`, `glm-*`, `fast`, `strong`, `mini`, `codex`, `quick`, `deep`, `glm`, `gpt`. Values are model ids or other aliases. |
580
- | `agents` | `object` | `{}` | Per-agent overrides (see below). |
581
- | `config` | `string` | _none_ | Custom path to a config file (relative to the project or absolute). |
582
-
583
- Per-agent options inside `agents.<name>`:
584
-
585
- | Key | Type | Notes |
586
- |---|---|---|
587
- | `enabled` | `boolean` | Force-enable or force-disable this agent regardless of top-level `enabled`. |
588
- | `model` | `string` | Model id or alias. Resolved against the top-level `models` map. |
589
- | `mode` | `"subagent" \| "primary" \| "all"` | OpenCode agent mode. |
590
- | `description` | `string` | Override the default description shown to other agents. |
591
- | `prompt` | `string` | Override the default system prompt. (For `resolver`, this also disables the templated parallel-rule prompt.) |
592
- | `color` | `string` | UI color. |
593
- | `maxSteps` | `positive integer` | Per-invocation step budget. |
594
- | `tools` | `Record<string, boolean>` | Toggle individual OpenCode tools. |
595
- | `permission` | `object` | Permission overrides — see below. |
596
-
597
- Permission keys (each takes `"ask"`, `"allow"`, or `"deny"`):
598
-
599
- `edit`, `bash`, `webfetch`, `doom_loop`, `external_directory`.
600
-
601
- `permission.bash` may also be a per-command map:
602
-
603
- ```json
604
- {
605
- "permission": {
606
- "bash": { "npm test": "allow", "rm -rf": "deny" }
607
- }
608
- }
609
- ```
610
-
611
- A fully-annotated reference config ships with the package as [`opencode-resolve.reference.jsonc`](./opencode-resolve.reference.jsonc) — copy the keys you need into your `resolve.json` (without the comments).
176
+ Precedence:
612
177
 
613
- ---
614
-
615
- ## Auto Approval
616
-
617
- `autoApprove` (default `true`) is now a compatibility/readability flag. It is accepted in config so older `resolve.json` files continue to load, but the current harness does **not** rewrite permissions from `"ask"` to `"allow"`.
618
-
619
- Low-friction autonomous behavior comes from two explicit defaults:
620
-
621
- | Permission | Current default behavior |
622
- |---|---|
623
- | Write-agent `edit` / `webfetch` | `allow` |
624
- | Write-agent `bash` | `ask`, routed through the plugin's `permission.ask` classifier |
625
- | Safe bash commands | Auto-allowed by classifier |
626
- | Dangerous bash commands | Auto-denied by classifier |
627
- | Unknown bash commands | Left as `ask` for OpenCode/user handling |
628
- | Read-only agent `edit` / `bash` | `deny`; write-capable plugin tools also block read-only agents |
629
-
630
- You may leave the flag in config for intent clarity:
631
-
632
- ```json
633
- {
634
- "autoApprove": false
635
- }
636
- ```
637
-
638
- > **Trust note:** low-friction write-agent permissions assume you trust the workspace and configured model. Use a sandbox or VM for untrusted code. Bash remains classifier-routed rather than blindly allowed.
639
-
640
- ---
641
-
642
- ## Parallel Subagent Limit
643
-
644
- `maxParallelSubagents` is optional. When omitted, the **resolver** uses soft fan-out guidance: dispatch coders for genuinely independent work and back off on rate-limit errors. Set it only when you want the resolver prompt to carry an explicit per-role concurrency cap. GLM profile is token-efficient but uncapped by default.
645
-
646
- | Value | Behavior |
647
- |---|---|
648
- | `1` | Strictly one coder at a time. |
649
- | `2` | Up to two coders concurrently. Useful when fanning out genuinely independent work. |
650
- | `N > 2` | Up to N coders concurrently. Use sparingly to avoid context waste. |
651
-
652
- Override per project or per user:
653
-
654
- ```json
655
- { "maxParallelSubagents": 1 }
656
- { "maxParallelSubagents": 2 }
657
- { "maxParallelSubagents": 4 }
178
+ ```text
179
+ built-in defaults -> first config file found -> inline plugin options
658
180
  ```
659
181
 
660
- > **Important soft limit, not a hard cap.** The limit is woven into the resolver's system prompt only. There is no runtime interceptor that blocks excess dispatches. Capable instruction-following coding models generally respect the directive, but if a model misbehaves, dispatches above the limit will go through. Pair this with `maxSteps` to bound total iterations if you want a stricter ceiling.
661
-
662
- The limit is templated into the prompt at config-load time, so restart OpenCode to pick up the new value. If you provide a custom `agents.resolver.prompt`, the templated rule is skipped and your prompt wins entirely.
182
+ Full commented reference: [opencode-resolve.reference.jsonc](./opencode-resolve.reference.jsonc)
663
183
 
664
- ---
184
+ ### Top-Level Options
665
185
 
666
- ## Upgrade & Migration
667
-
668
- When you upgrade to a newer version of `opencode-resolve`, the `postinstall` script runs an **additive migration** on your existing `~/.config/opencode/resolve.json`:
669
-
670
- - Adds new top-level keys (currently `autoApprove`) with their defaults if they are absent.
671
- - **Never** modifies keys you have already set.
672
- - **Never** rewrites your `enabled` list, `models` map, or `agents` overrides.
673
- - If `enabled` is set and does not include `"resolver"`, prints a one-line tip suggesting you add it. Your file is left untouched.
674
- - In an interactive reinstall, asks whether to update the existing file or back it up and run fresh setup. In non-interactive automation, use `OPENCODE_RESOLVE_REINSTALL=fresh` for a fresh reinstall or `OPENCODE_RESOLVE_REINSTALL=update` to preserve and migrate.
675
-
676
- ### Adaptive first-install preset
677
-
678
- When `resolve.json` does **not** exist, postinstall inspects your OpenCode model configuration and writes a provider-adapted `models` block:
679
-
680
- | Detected provider | Preset |
681
- |---|---|
682
- | Interactive terminal | Always prompts for `mix` / `gpt` / `glm`, asks for three-tier model picks, and in `mix` asks whether to enable `gpt` and `glm` primary agents |
683
- | Non-interactive install | Auto-detects providers from opencode.json and writes a model-adapted preset with `resolver`, `gpt`, and `glm` enabled |
684
- | Legacy opt-in | Set `OPENCODE_RESOLVE_AUTO_PRESET=1` to allow non-interactive provider-adapted presets |
685
- | GLM/ZAI detected | Adds the ZAI MCP bootstrap without copying API keys |
686
-
687
- To change presets at any time, edit `models` in `resolve.json` directly or run reinstall with `OPENCODE_RESOLVE_REINSTALL=fresh`.
688
-
689
- Skip the migration entirely with:
690
-
691
- ```sh
692
- OPENCODE_RESOLVE_SKIP_POSTINSTALL=1 npm install -g opencode-resolve
693
- ```
694
-
695
- ---
186
+ | Key | Type | Default | Purpose |
187
+ | --- | --- | --- | --- |
188
+ | `profile` | `mix` / `glm` / `gpt` | `mix` | Prompt/profile preset. |
189
+ | `tier` | `bronze` / `silver` / `gold` | unset | Enables the matching tier preset when configured. |
190
+ | `enabled` | agent name array | default agents | Which resolve agents to inject. |
191
+ | `models` | object | `{}` | Model aliases and per-role model pins. |
192
+ | `agents` | object | `{}` | Per-agent overrides. |
193
+ | `preserveNative` | boolean | `true` | Keep native OpenCode agents unless explicitly overridden. |
194
+ | `context7` | boolean | `true` | Register Context7 MCP if missing. |
195
+ | `commands` | boolean | `false` | Add `/resolve`, `/resolve-code`, and `/resolve-review`. |
196
+ | `autoApprove` | boolean | `true` | Backward-compatible config flag; current permissions remain explicit. |
197
+ | `autoUpdate` | boolean | `true` | Allow additive config migrations during install/update. |
198
+ | `language` | `auto` / `en` / `ko` | `auto` | Prompt language preference. |
199
+ | `maxParallelSubagents` | positive integer | unset | Optional prompt-level soft limit for concurrent coder dispatch. |
200
+
201
+ ### Agent Overrides
202
+
203
+ Each `agents.<name>` entry can set:
204
+
205
+ | Key | Values |
206
+ | --- | --- |
207
+ | `enabled` | boolean |
208
+ | `model` | model id or alias |
209
+ | `mode` | `subagent`, `primary`, `all` |
210
+ | `description` | string |
211
+ | `prompt` | string |
212
+ | `color` | string |
213
+ | `maxSteps` | positive integer |
214
+ | `tools` | object of tool booleans |
215
+ | `permission` | `edit`, `bash`, `webfetch`, `doom_loop`, `external_directory` |
216
+
217
+ Permission values are `ask`, `allow`, or `deny`. `permission.bash` may also be a command-pattern map.
696
218
 
697
219
  ## Model Setup
698
220
 
699
- `opencode-resolve` does not pin any provider-specific model by default. All resolve agents inherit your top-level OpenCode `model` use a single efficient model if it gives the best token-per-result efficiency. Only pin role-specific models when you have measured a benefit.
221
+ By default, `models` is empty and resolve agents inherit OpenCode's top-level `model`. Pin role-specific models only when you have a reason to split cost, speed, or reasoning depth.
700
222
 
701
- Model resolution order for each resolve agent:
223
+ Model resolution order for each agent:
702
224
 
703
225
  1. `agents.<name>.model`
704
- 2. `models.<name>` alias mapping
705
- 3. top-level OpenCode `model`
706
- 4. OpenCode's own fallback when no model is configured
707
-
708
- ### Use default model for everything (recommended)
709
-
710
- ```json
711
- {
712
- "enabled": ["coder", "resolver", "explorer", "reviewer", "deep-reviewer"],
713
- "models": {}
714
- }
715
- ```
226
+ 2. `models.<name>`
227
+ 3. OpenCode top-level `model`
228
+ 4. OpenCode fallback behavior
716
229
 
717
- ### Role-specific aliases (when measured benefit exists)
230
+ Example three-tier setup:
718
231
 
719
232
  ```json
720
233
  {
721
- "enabled": ["coder", "resolver", "explorer", "reviewer", "deep-reviewer"],
722
234
  "models": {
723
- "fast": "openai/gpt-5-mini",
724
- "strong": "openai/gpt-5.3-codex",
725
- "coder": "fast",
726
- "resolver": "strong"
727
- }
728
- }
729
- ```
730
-
731
- ### Pin one role directly
732
-
733
- ```json
734
- {
735
- "agents": {
736
- "resolver": {
737
- "model": "openai/gpt-5.3-codex"
738
- }
235
+ "bronze": "zai-coding-plan/glm-4.5",
236
+ "silver": "zai-coding-plan/glm-5.1",
237
+ "gold": "openai/gpt-5.5",
238
+ "explorer": "bronze",
239
+ "coder": "silver",
240
+ "resolver": "gold",
241
+ "reviewer": "gold",
242
+ "deep-reviewer": "gold",
243
+ "planner": "gold"
739
244
  }
740
245
  }
741
246
  ```
742
247
 
743
- ### Mixed setup (OpenCode config + resolve models)
248
+ Supported model alias keys:
744
249
 
745
- Native OpenCode agents such as `plan` and `build` are configured through the top-level OpenCode `agent`, not through `opencode-resolve`.
746
-
747
- ```json
748
- {
749
- "model": "openai/gpt-5-mini",
750
- "agent": {
751
- "plan": {
752
- "model": "openai/gpt-5.3-codex"
753
- }
754
- },
755
- "plugin": [
756
- [
757
- "opencode-resolve",
758
- {
759
- "enabled": ["coder", "resolver", "explorer", "reviewer", "deep-reviewer"]
760
- }
761
- ]
762
- ]
763
- }
250
+ ```text
251
+ fast, strong, mini, codex, quick, deep, glm, gpt,
252
+ bronze, silver, gold,
253
+ gpt-bronze, gpt-silver, gpt-gold,
254
+ glm-bronze, glm-silver, glm-gold,
255
+ and every supported agent name
764
256
  ```
765
257
 
766
- In this setup, `plan` uses `openai/gpt-5.3-codex`; native `build`, resolve `coder`, and resolve `resolver` all use `openai/gpt-5-mini`.
767
-
768
- ### Supported model alias keys
769
-
770
- | Alias | Purpose |
771
- |---|---|
772
- | `fast` | Provider-neutral alias for a fast/cheap model |
773
- | `strong` | Provider-neutral alias for a strong/expensive model |
774
- | `mini` | Provider-neutral alias for a mini/efficient model |
775
- | `codex` | Provider-neutral alias for a codex-style coding model (legacy) |
776
- | `bronze` / `silver` / `gold` | Three-tier scout / coder / reasoner aliases |
777
- | `gpt-bronze` / `gpt-silver` / `gpt-gold` | GPT-specific three-tier aliases for mixed setups |
778
- | `glm-bronze` / `glm-silver` / `glm-gold` | GLM-specific three-tier aliases for mixed setups |
779
- | `quick` | Legacy alias (equivalent to `fast`) |
780
- | `deep` | Legacy alias (equivalent to `strong`) |
781
- | `glm` | Legacy alias (backward compatibility) |
782
- | `gpt` | Legacy alias (backward compatibility) |
783
-
784
- Aliases only resolve when defined in `models`. Agent names (`coder`, `resolver`, etc.) are also valid alias keys.
785
-
786
- ---
787
-
788
- ## Agent Reference
789
-
790
- | Agent | Default | Mode | Edit | Bash | WebFetch | Purpose |
791
- |---|:---:|---|---|---|---|---|
792
- | `resolver` | Yes (core) | `all` | allow | ask (classifier-routed) | allow | Context-efficient orchestrator. Decomposes work into verified checkpoints, dispatches coder, verifies each, and reports blockers when repeated recovery fails. |
793
- | `codex` | No | `all` | allow | ask (classifier-routed) | allow | Codex-optimized primary resolver. Legacy — prefer `gpt` for new GPT setups. |
794
- | `gpt` | No | `all` | allow | ask (classifier-routed) | allow | GPT-optimized primary resolver with the same verified resolve-loop style as `resolver`. Enabled by first-install GPT/mix presets or explicitly. |
795
- | `glm` | No | `all` | allow | ask (classifier-routed) | allow | GLM-optimized primary resolver with the same verified resolve-loop style as `resolver`. Enabled by first-install GLM/mix presets or explicitly. |
796
- | `coder` | Yes (core) | `subagent` | allow | ask (classifier-routed) | allow | Focused implementer. Smallest correct patch. Reads only needed files. |
797
- | `explorer` | Yes (subagent) | `subagent` | **deny** | **deny** | allow | Internal fast codebase scout. Resolver dispatches when scope is genuinely unknown; prefers local read/grep/glob for narrow scope. |
798
- | `reviewer` | Yes (subagent) | `subagent` | **deny** | **deny** | allow | Internal verification-gap auditor. Resolver dispatches for post-change verification gaps on non-trivial changes. |
799
- | `deep-reviewer` | Yes (subagent) | `subagent` | **deny** | **deny** | allow | Internal thorough review for risky/security/architecture changes. Resolver dispatches ONLY for high-impact work. |
800
- | `planner` | Yes (subagent) | `subagent` | **deny** | **deny** | allow | Explicit-plan specialist. Resolver dispatches only when the user asks for a plan/decomposition/strategy. |
801
- | `architect` | No | `subagent` | **deny** | **deny** | allow | Design and task decomposition. |
802
- | `gpt-coder` | No | `subagent` | allow | ask (classifier-routed) | allow | Stronger-reasoning implementation fallback. |
803
- | `debugger` | No | `subagent` | allow | ask (classifier-routed) | allow | Reproduction and root-cause analysis. |
804
- | `researcher` | No | `subagent` | **deny** | **deny** | allow | Codebase and documentation research. |
805
-
806
- `bash: ask` is intentional for write agents: the plugin's `permission.ask` hook auto-allows known safe commands, auto-denies dangerous commands, and leaves unknown commands for OpenCode/user handling.
807
-
808
- Supported modes:
809
-
810
- | Mode | Meaning |
811
- |---|---|
812
- | `subagent` | Available only as a subagent |
813
- | `primary` | Available as a primary agent |
814
- | `all` | Available as both primary and subagent |
258
+ ## Agents
815
259
 
816
- Supported permission values: `ask`, `allow`, `deny`.
260
+ | Agent | Default | Mode | Edit | Bash | Web | Role |
261
+ | --- | --- | --- | --- | --- | --- | --- |
262
+ | `resolver` | yes | `all` | allow | ask | allow | Primary orchestrator. |
263
+ | `coder` | yes | `subagent` | allow | ask | allow | Focused implementation and verification. |
264
+ | `explorer` | yes | `subagent` | deny | deny | allow | Fast read-only codebase scout. |
265
+ | `reviewer` | yes | `subagent` | deny | deny | allow | Read-only verification-gap review. |
266
+ | `deep-reviewer` | yes | `subagent` | deny | deny | allow | Read-only review for risky/high-impact changes. |
267
+ | `planner` | yes | `subagent` | deny | deny | allow | Read-only planning when explicitly useful. |
268
+ | `gpt` | no | `all` | allow | ask | allow | GPT-optimized primary resolver. |
269
+ | `glm` | no | `all` | allow | ask | allow | GLM/ZAI-optimized primary resolver. |
270
+ | `codex` | no | `all` | allow | ask | allow | Legacy Codex-optimized primary resolver. |
271
+ | `architect` | no | `subagent` | deny | deny | allow | Design/decomposition helper. |
272
+ | `gpt-coder` | no | `subagent` | allow | ask | allow | Stronger implementation helper. |
273
+ | `debugger` | no | `subagent` | allow | ask | allow | Failure reproduction/root-cause helper. |
274
+ | `researcher` | no | `subagent` | deny | deny | allow | Codebase/docs research helper. |
817
275
 
818
- Supported model alias keys: `fast`, `strong`, `mini`, `codex`, `quick`, `deep`, `glm`, `gpt`, `bronze`, `silver`, `gold`, `gpt-bronze`, `gpt-silver`, `gpt-gold`, `glm-bronze`, `glm-silver`, `glm-gold`, and every supported agent name. Aliases only resolve when defined in `models`.
276
+ ## Permissions
819
277
 
820
- `preserveNative` is accepted for readability, but native `plan` and `build` are always preserved. The plugin never rewrites built-in OpenCode agents.
278
+ Resolve agents keep bash at `ask` by default. The plugin's permission hook auto-allows common safe read/test commands and denies obviously dangerous patterns such as force pushes, shell-eval injection, and remote script pipes. Unknown commands remain `ask`.
821
279
 
822
- ### Resolver orchestration rules
280
+ `autoApprove` is accepted for compatibility with older configs, but current behavior is controlled by explicit agent permissions and the command classifier.
823
281
 
824
- The resolver uses a context-efficient approach with checkpointed execution and repeated-failure recovery:
282
+ Use a sandbox or VM for untrusted repositories.
825
283
 
826
- - **Classify** the work as quick, normal, deep, or risky before planning.
827
- - **Inspect only relevant files** using local tools — avoid broad exploration.
828
- - For trivial work, apply edits directly — no subagent needed.
829
- - Dispatch **coder** with focused file/behavior instructions.
830
- - Run the **cheapest meaningful verification** first.
831
- - Retry from verification logs if issues remain; on verification failure, diagnose root cause before re-dispatching a coder with a different fix.
832
- - After repeated consecutive failures, stop and report the blocker instead of claiming completion; after heavy failure counts, pivot to `architect` for a different strategy.
833
- - Use **explorer** only when scope is genuinely unknown and local read/grep/glob are insufficient (internal subagent, not core path).
834
- - Use **reviewer** only when a verification gap exists on non-trivial changes (internal subagent, not core path).
835
- - Use **deep-reviewer** only for risky, security-sensitive, architectural, or high-impact changes (internal subagent, not core path).
836
- - Return a concise evidence summary when resolved or blocked.
837
- - Honor the `maxParallelSubagents` per-role limit for context efficiency.
284
+ ## Parallel Subagents
838
285
 
839
- ---
286
+ `maxParallelSubagents` is optional. When omitted, the resolver uses soft guidance: dispatch coder only for genuinely independent work, and back off when rate limits appear.
840
287
 
841
- ## Optional Commands
288
+ When set, the value is inserted into the resolver prompt. It is not a runtime semaphore. Restart OpenCode after changing it. A custom `agents.resolver.prompt` replaces the templated rule.
842
289
 
843
- Set `commands: true` to add helper subtask commands:
290
+ ## Context7
844
291
 
845
- | Command | Description |
846
- |---|---|
847
- | `resolve` | Run the `resolver` agent end-to-end on the current task |
848
- | `resolve-code` | Run the `coder` agent for focused implementation |
849
- | `resolve-review` | Run the `reviewer` agent for a read-only audit |
850
-
851
- ---
852
-
853
- ## Context7 Integration
854
-
855
- When `context7: true` (the default), the plugin automatically registers the [Context7](https://context7.com) MCP server at startup:
292
+ When `context7: true`, the plugin registers Context7 MCP if `mcp.context7` is not already present:
856
293
 
857
294
  ```json
858
295
  {
859
- "type": "remote",
860
- "url": "https://mcp.context7.com/mcp"
296
+ "mcp": {
297
+ "context7": {
298
+ "type": "remote",
299
+ "url": "https://mcp.context7.com/mcp"
300
+ }
301
+ }
861
302
  }
862
303
  ```
863
304
 
864
- This gives resolve agents access to Context7's documentation tools through OpenCode's MCP integration — no manual MCP configuration needed.
865
-
866
- To disable Context7 registration (e.g. you already have it configured, or you don't want it):
305
+ Disable it with:
867
306
 
868
307
  ```json
869
- {
870
- "context7": false
871
- }
308
+ { "context7": false }
872
309
  ```
873
310
 
874
- If `mcp.context7` is already present in your OpenCode config, the plugin does not overwrite it.
311
+ ## Project Context
875
312
 
876
- ---
313
+ The plugin exposes committed project context without stuffing the entire repo into prompts. It detects:
877
314
 
878
- ## Keeping Up to Date
315
+ - `HARNESS.md`
316
+ - `AGENTS.md`
317
+ - `.opencode/context`
318
+ - `.claude/context`
319
+ - `context/`
320
+ - `thoughts/`
321
+ - package manager and common verification commands
322
+ - TypeScript projects
879
323
 
880
- > **OpenCode caches the last version it downloaded.** To get a new release you must explicitly refresh.
324
+ Resolvers are instructed to read only relevant context documents.
881
325
 
882
- ```sh
883
- # Upgrade via npm
884
- npm install -g opencode-resolve@latest
885
-
886
- # Refresh the OpenCode cache
887
- opencode plugin opencode-resolve --global --force
888
-
889
- # Restart OpenCode
890
- ```
891
-
892
- If the version still does not change, OpenCode is reusing its package cache. Hard-refresh that one plugin entry:
893
-
894
- Linux/macOS:
326
+ ## Upgrade
895
327
 
896
328
  ```sh
897
- export OPENCODE_CACHE_ROOT="${XDG_CACHE_HOME:-$HOME/.cache}/opencode"
898
- rm -rf "$OPENCODE_CACHE_ROOT/packages/opencode-resolve@latest"
329
+ npm install -g opencode-resolve@latest
899
330
  opencode plugin opencode-resolve@latest --global --force
900
- node -e "console.log(require(process.env.OPENCODE_CACHE_ROOT + '/packages/opencode-resolve@latest/node_modules/opencode-resolve/package.json').version)"
901
331
  ```
902
332
 
903
- Windows PowerShell:
333
+ Pin a specific version in `opencode.json` and refresh that exact version:
904
334
 
905
- ```powershell
906
- $OpenCodeCacheRoot = if ($env:XDG_CACHE_HOME) { Join-Path $env:XDG_CACHE_HOME "opencode" } else { Join-Path $env:LOCALAPPDATA "opencode" }
907
- $PluginCache = Join-Path $OpenCodeCacheRoot "packages\opencode-resolve@latest"
908
- Remove-Item -Recurse -Force $PluginCache -ErrorAction SilentlyContinue
909
- opencode plugin opencode-resolve@latest --global --force
910
- $Pkg = Join-Path $PluginCache "node_modules\opencode-resolve\package.json"
911
- node -e "console.log(require(process.argv[1]).version)" $Pkg
335
+ ```json
336
+ { "plugin": ["opencode-resolve@<version>"] }
912
337
  ```
913
338
 
914
- After upgrading, `postinstall` runs additive migration on your `resolve.json` — new keys are added, existing keys are never modified.
915
-
916
- ### Pinning a specific version
917
-
918
339
  ```sh
919
- npm install -g opencode-resolve@0.1.3
920
- opencode plugin opencode-resolve --global --force
340
+ opencode plugin opencode-resolve@<version> --global --force
921
341
  ```
922
342
 
923
- ---
924
-
925
- ## Local Development
926
-
927
- From this repository:
343
+ ## Development
928
344
 
929
345
  ```sh
930
346
  npm install
931
- npm run hooks:install
932
- npm test
933
- npm run install:local
934
- ```
935
-
936
- `install:local` builds the plugin, links it into the OpenCode global plugin directory, and creates `~/.config/opencode/resolve.json` if it does not exist.
937
-
938
- `hooks:install` sets this checkout's `core.hooksPath` to `.githooks`. The tracked hooks are intentionally strict:
939
-
940
- | Hook | Gate |
941
- |---|---|
942
- | `pre-commit` | `npm run typecheck`, `npm test`, `npm run coverage` |
943
- | `pre-push` | full `pre-commit` gate plus `npm pack --dry-run` before anything reaches the remote |
944
-
945
- Manual local install:
946
-
947
- ```sh
948
347
  npm run build
949
- mkdir -p ~/.config/opencode/plugins
950
- ln -sf "$PWD/dist/index.js" ~/.config/opencode/plugins/opencode-resolve.js
348
+ npm test
349
+ npm run coverage
951
350
  ```
952
351
 
953
- Local plugin files are loaded automatically by OpenCode.
954
-
955
- ---
956
-
957
- ## Verification
958
-
959
- Run the normal checks:
352
+ Local install from this checkout:
960
353
 
961
354
  ```sh
962
- npm run typecheck
963
- npm test
964
- npm run coverage
965
- npm run build
355
+ npm run install:local
966
356
  ```
967
357
 
968
- The test suite executes the built plugin and verifies default agent injection, `autoApprove` behavior, model aliases, file config, plugin option overrides, optional commands, Context7 preservation, and native `plan`/`build` preservation.
969
-
970
- Before publishing:
358
+ Git hooks:
971
359
 
972
360
  ```sh
973
- npm run typecheck
974
- npm test
975
- npm run coverage
976
- npm audit --audit-level=moderate
977
- npm publish --dry-run
361
+ npm run hooks:install
978
362
  ```
979
363
 
980
- `npm pack` and `npm publish` run `npm test` first through the `prepack` script.
981
-
982
- ---
364
+ Verification covered by tests includes agent injection, config loading, model aliases, permissions, optional commands, Context7 preservation, native agent preservation, and postinstall behavior.
983
365
 
984
366
  ## Release
985
367
 
986
- Releases are published by GitHub Actions when a version tag is pushed.
987
-
988
- Required repository secret:
989
-
990
- | Secret | Description |
991
- |---|---|
992
- | `NPM_TOKEN` | npm automation token with publish access |
993
-
994
- Tag release flow:
368
+ 1. Update `package.json` version.
369
+ 2. Run `npm run prepush`.
370
+ 3. Commit and tag:
995
371
 
996
372
  ```sh
997
- npm version patch
998
- git push origin main --follow-tags
373
+ git add package.json package-lock.json README.md README.ko.md
374
+ git commit -m "release: vX.Y.Z"
375
+ git tag vX.Y.Z
376
+ git push origin main --tags
999
377
  ```
1000
378
 
1001
- You can also run the `Publish to npm` workflow manually from GitHub Actions and choose `patch`, `minor`, `major`, or a specific version.
1002
-
1003
- The release workflow runs `npm ci`, `npm run typecheck`, `npm test`, and `npm publish --access public --provenance`.
1004
-
1005
- ---
379
+ The publish workflow runs tests and publishes to npm.
1006
380
 
1007
381
  ## Design Rules
1008
382
 
1009
- - Do not overwrite native `plan` or `build` agents.
1010
- - Core path is fixed: `resolver` (context-efficient planner/judge) → `coder` (implementer).
1011
- - Internal specialist subagents (`explorer`, `reviewer`, `deep-reviewer`) are injected by default as OpenCode-native subagents — they inherit OpenCode's composition philosophy — but are not the default execution path and are never user-facing primary roles.
1012
- - Resolver prefers local read/grep/glob for narrow scope; dispatches `explorer` only when scope is genuinely unknown.
1013
- - Resolver dispatches `reviewer` only for verification gaps on non-trivial changes.
1014
- - Resolver dispatches `deep-reviewer` only for risky, security-sensitive, architectural, or high-impact changes.
1015
- - Reviewer and deep-reviewer are read-only — fixes always go through `coder` or `resolver`.
1016
- - Repeated verification failures trigger diagnosis, a different fix strategy, and blocker reporting instead of silent loop continuation. Large tasks are decomposed into verified checkpoints.
1017
- - The resolver honors `maxParallelSubagents` for context efficiency.
1018
- - Search and inspect before editing. Make the smallest correct change. Verify when practical.
1019
- - Read only needed files. Avoid broad exploration. Targeted verification, not full suites.
1020
-
1021
- ---
383
+ - Do not replace OpenCode native agents; preserve them unless explicitly overridden.
384
+ - Keep the default config small.
385
+ - Keep bash permission conservative.
386
+ - Keep migrations additive.
387
+ - Do not add runtime dependencies unless the benefit is clear.
1022
388
 
1023
389
  ## License
1024
390
 
1025
- [MIT](./LICENSE)
391
+ MIT