opencode-resolve 0.1.7 → 0.1.9
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.ko.md +121 -60
- package/README.md +121 -60
- package/dist/agents.d.ts +27 -0
- package/dist/agents.js +392 -0
- package/dist/config.d.ts +29 -0
- package/dist/config.js +404 -0
- package/dist/hooks/index.d.ts +18 -0
- package/dist/hooks/index.js +493 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +11 -702
- package/dist/state.d.ts +33 -0
- package/dist/state.js +20 -0
- package/dist/tools/index.d.ts +252 -0
- package/dist/tools/index.js +1209 -0
- package/dist/types.d.ts +56 -0
- package/dist/types.js +1 -0
- package/dist/utils.d.ts +33 -0
- package/dist/utils.js +371 -0
- package/opencode-resolve.example.json +8 -2
- package/opencode-resolve.reference.jsonc +107 -27
- package/package.json +10 -2
- package/scripts/install-git-hooks.mjs +28 -0
- package/scripts/install-local.mjs +64 -4
- package/scripts/postinstall.mjs +552 -34
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
>
|
|
11
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.
|
|
12
12
|
|
|
13
|
-
It exposes a **fixed-role verified resolve loop** — **resolver** (context-efficient planner/judge) and **coder** (focused implementer) —
|
|
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.
|
|
14
14
|
|
|
15
15
|
```
|
|
16
16
|
# Paste this into any AI coding assistant for fully guided setup
|
|
@@ -42,6 +42,7 @@ If OpenCode is not installed or not running, opencode-resolve does nothing.
|
|
|
42
42
|
- [Quick Start](#quick-start)
|
|
43
43
|
- [Drop-in setup (give to an LLM)](#drop-in-setup-give-to-an-llm)
|
|
44
44
|
- [Default Behavior](#default-behavior)
|
|
45
|
+
- [Project Context Sources](#project-context-sources)
|
|
45
46
|
- [Configuration](#configuration)
|
|
46
47
|
- [Configuration Reference](#configuration-reference)
|
|
47
48
|
- [Auto Approval](#auto-approval)
|
|
@@ -63,9 +64,10 @@ If OpenCode is not installed or not running, opencode-resolve does nothing.
|
|
|
63
64
|
## Features
|
|
64
65
|
|
|
65
66
|
- **Fixed-role verified resolve loop** — `resolver` (context-efficient planner/judge) + `coder` (focused implementer)
|
|
66
|
-
- **Context-efficient by default** — minimal file reads, smallest patch, targeted verification, checkpointed execution
|
|
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
|
|
67
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
|
|
68
|
-
- **
|
|
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
|
|
69
71
|
- **Context7 MCP** — auto-registers [Context7](https://context7.com) documentation lookup when `context7: true`
|
|
70
72
|
- **Model pinning** — pin different models per role when you have measured a benefit; by default all roles inherit your OpenCode default model
|
|
71
73
|
- **Soft parallel cap** — `maxParallelSubagents` controls how many coders the resolver fans out
|
|
@@ -138,7 +140,7 @@ Example minimal provider setup:
|
|
|
138
140
|
}
|
|
139
141
|
```
|
|
140
142
|
|
|
141
|
-
> No additional API keys
|
|
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.
|
|
142
144
|
|
|
143
145
|
---
|
|
144
146
|
|
|
@@ -154,11 +156,11 @@ The `postinstall` script automatically:
|
|
|
154
156
|
|
|
155
157
|
1. Adds `opencode-resolve` to `~/.config/opencode/opencode.json` `plugin` array (if not already present).
|
|
156
158
|
2. Creates `~/.config/opencode/resolve.json` adapted to your current model provider when the file does not exist:
|
|
157
|
-
- **
|
|
158
|
-
- **
|
|
159
|
-
- **
|
|
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 `codex` and `glm` primary agents.
|
|
160
|
+
- **Non-interactive install** → does not guess model pinning. It writes `profile: "mix"`, leaves `models: {}`, and enables the three primary routes (`resolver`, `codex`, `glm`) so you can pin models explicitly afterward.
|
|
161
|
+
- **GLM/ZAI model detected** → still adds the non-secret local ZAI MCP bootstrap.
|
|
160
162
|
|
|
161
|
-
Existing `resolve.json` files are **never overwritten
|
|
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`.
|
|
162
164
|
|
|
163
165
|
To skip automatic registration:
|
|
164
166
|
|
|
@@ -190,7 +192,7 @@ If `postinstall` didn't register the plugin, add it to `~/.config/opencode/openc
|
|
|
190
192
|
opencode
|
|
191
193
|
```
|
|
192
194
|
|
|
193
|
-
You should now see `resolver`
|
|
195
|
+
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.
|
|
194
196
|
|
|
195
197
|
---
|
|
196
198
|
|
|
@@ -307,7 +309,7 @@ The default flow does **not** write `maxParallelSubagents` to `resolve.json`. Th
|
|
|
307
309
|
|
|
308
310
|
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:
|
|
309
311
|
|
|
310
|
-
> _(optional, ask only if relevant)_ _Your `coder` model is GLM — the coding-plan throttles under bursts. Pin `maxParallelSubagents:
|
|
312
|
+
> _(optional, ask only if relevant)_ _Your `coder` model is GLM — the coding-plan throttles under bursts. Pin `maxParallelSubagents: 1` for strict serial coder dispatch?_
|
|
311
313
|
|
|
312
314
|
Otherwise, omit the field entirely.
|
|
313
315
|
|
|
@@ -333,7 +335,7 @@ Otherwise, omit the field entirely.
|
|
|
333
335
|
"planner": "gold"
|
|
334
336
|
},
|
|
335
337
|
"agents": {
|
|
336
|
-
"coder": { "enabled": true, "mode": "
|
|
338
|
+
"coder": { "enabled": true, "mode": "subagent" },
|
|
337
339
|
"resolver": { "enabled": true },
|
|
338
340
|
"explorer": { "enabled": true, "mode": "subagent" },
|
|
339
341
|
"reviewer": { "enabled": true, "mode": "subagent" },
|
|
@@ -402,16 +404,16 @@ The output **must** include `resolver` and `coder` (and `reviewer` if enabled).
|
|
|
402
404
|
| 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. |
|
|
403
405
|
| The user said split but only one tier shows up | `models` block missing `fast` or `strong` | Re-run Step 3 from 3d. |
|
|
404
406
|
|
|
405
|
-
Internal specialist subagents (`explorer`, `reviewer`, `deep-reviewer`) are subagent-only and won't appear in the primary picker —
|
|
407
|
+
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.
|
|
406
408
|
|
|
407
409
|
### Why this template
|
|
408
410
|
|
|
409
411
|
| Setting | Why |
|
|
410
412
|
|---|---|
|
|
411
|
-
| `enabled: ["coder", "resolver", "explorer", "reviewer", "deep-reviewer"]` | Fixed core path (resolver→coder) plus OpenCode-native internal specialist subagents injected by default |
|
|
412
|
-
| `autoApprove: true` |
|
|
413
|
-
| `maxParallelSubagents
|
|
414
|
-
| `agents.coder.mode = "
|
|
413
|
+
| `enabled: ["coder", "resolver", "explorer", "reviewer", "deep-reviewer", "planner"]` | Fixed core path (resolver→coder) plus OpenCode-native internal specialist subagents injected by default |
|
|
414
|
+
| `autoApprove: true` | Compatibility/readability flag; actual low-friction behavior comes from base permissions plus the `permission.ask` bash classifier |
|
|
415
|
+
| 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 |
|
|
416
|
+
| `agents.coder.mode = "subagent"` | Coder stays on the fixed resolver→coder path instead of becoming a user-facing primary role |
|
|
415
417
|
| `agents.{explorer,reviewer,deep-reviewer}.mode = "subagent"` | Internal specialists are subagent-only — never user-facing primary roles |
|
|
416
418
|
| `context7: true` | Plugin auto-registers Context7 MCP — no manual MCP config needed |
|
|
417
419
|
| `models` aliases | Empty by default — all roles inherit the OpenCode default model. Pin role-specific models only when you have measured a benefit |
|
|
@@ -424,7 +426,7 @@ Internal specialist subagents (`explorer`, `reviewer`, `deep-reviewer`) are suba
|
|
|
424
426
|
3. **For trivial work** — Resolver applies the small edit directly. No subagent needed.
|
|
425
427
|
4. **Implement** — Dispatches `coder` with exact file paths and focused instructions.
|
|
426
428
|
5. **Verify** — Runs the cheapest meaningful check first (targeted test, type check, or lint).
|
|
427
|
-
6. **
|
|
429
|
+
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.
|
|
428
430
|
7. **Report** — Returns a concise evidence summary: what changed, verification results, and any remaining blockers.
|
|
429
431
|
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.
|
|
430
432
|
|
|
@@ -434,16 +436,52 @@ Internal specialist subagents (`explorer`, `reviewer`, `deep-reviewer`) are suba
|
|
|
434
436
|
|
|
435
437
|
| Item | Default |
|
|
436
438
|
|---|---|
|
|
437
|
-
| Enabled agents | `coder`, `resolver`, `explorer`, `reviewer`, `deep-reviewer` |
|
|
439
|
+
| Enabled agents | `coder`, `resolver`, `explorer`, `reviewer`, `deep-reviewer`, `planner` |
|
|
438
440
|
| Core path | `resolver` → `coder` (fixed-role verified loop) |
|
|
439
441
|
| Internal subagents | `explorer`, `reviewer`, `deep-reviewer` (subagent-only, dispatched when justified) |
|
|
440
442
|
| Primary agent for new tasks | `resolver` (`mode: "all"`) |
|
|
441
443
|
| Agent model | Inherits top-level OpenCode `model` |
|
|
442
444
|
| Native `plan` / `build` | Preserved untouched |
|
|
445
|
+
| Project context sources | `HARNESS.md`, `AGENTS.md`, `CLAUDE.md`, `CONVENTIONS.md`, `.opencode/context`, `.claude/context`, `context/`, `thoughts/` |
|
|
443
446
|
| Context7 MCP preset | Added automatically when `context7: true` |
|
|
444
447
|
| Optional commands | Disabled |
|
|
445
|
-
| `autoApprove` | `true` (
|
|
446
|
-
|
|
|
448
|
+
| `autoApprove` | `true` (compatibility/readability flag; bash routing is handled by the permission hook) |
|
|
449
|
+
| Repeated-failure behavior | Diagnose, retry with a different fix, pivot to architect after heavy failure, then report blockers instead of claiming completion |
|
|
450
|
+
|
|
451
|
+
---
|
|
452
|
+
|
|
453
|
+
## Project Context Sources
|
|
454
|
+
|
|
455
|
+
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.
|
|
456
|
+
|
|
457
|
+
Detected top-level knowledge files:
|
|
458
|
+
|
|
459
|
+
| Source | Purpose |
|
|
460
|
+
|---|---|
|
|
461
|
+
| `HARNESS.md` | Build, verification, infrastructure, deployment, and project traps |
|
|
462
|
+
| `AGENTS.md` | Agent behavior, delegation rules, review expectations, local workflow |
|
|
463
|
+
| `CLAUDE.md` | Existing AI coding guidance used by other tools |
|
|
464
|
+
| `CONVENTIONS.md` | Code style, naming, architecture, and repository conventions |
|
|
465
|
+
|
|
466
|
+
Detected context directories:
|
|
467
|
+
|
|
468
|
+
| Source | Behavior |
|
|
469
|
+
|---|---|
|
|
470
|
+
| `.opencode/context/` | OpenCode/OAC-style team pattern docs |
|
|
471
|
+
| `.claude/context/` | Claude-style shared context docs |
|
|
472
|
+
| `context/` | Generic project context docs |
|
|
473
|
+
| `thoughts/` | Agentic-style persistent knowledge: architecture, tickets, research, plans, reviews |
|
|
474
|
+
|
|
475
|
+
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.
|
|
476
|
+
|
|
477
|
+
Local runtime state is intentionally ignored by git:
|
|
478
|
+
|
|
479
|
+
```text
|
|
480
|
+
.opencode/resolve-state.json
|
|
481
|
+
.opencode/*.local.json
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
Committed context such as `.opencode/context/` and `thoughts/` is not ignored.
|
|
447
485
|
|
|
448
486
|
---
|
|
449
487
|
|
|
@@ -470,7 +508,7 @@ Minimal config (matches defaults):
|
|
|
470
508
|
|
|
471
509
|
```json
|
|
472
510
|
{
|
|
473
|
-
"enabled": ["coder", "resolver", "explorer", "reviewer", "deep-reviewer"],
|
|
511
|
+
"enabled": ["coder", "resolver", "explorer", "reviewer", "deep-reviewer", "planner"],
|
|
474
512
|
"autoApprove": true,
|
|
475
513
|
"context7": true,
|
|
476
514
|
"commands": false
|
|
@@ -485,7 +523,7 @@ Inline form inside `opencode.json`:
|
|
|
485
523
|
[
|
|
486
524
|
"opencode-resolve",
|
|
487
525
|
{
|
|
488
|
-
"enabled": ["coder", "resolver", "explorer", "reviewer", "deep-reviewer"],
|
|
526
|
+
"enabled": ["coder", "resolver", "explorer", "reviewer", "deep-reviewer", "planner"],
|
|
489
527
|
"autoApprove": true,
|
|
490
528
|
"context7": true,
|
|
491
529
|
"commands": false
|
|
@@ -505,13 +543,16 @@ Every accepted top-level option:
|
|
|
505
543
|
|
|
506
544
|
| Key | Type | Default | Purpose |
|
|
507
545
|
|---|---|---|---|
|
|
508
|
-
| `
|
|
546
|
+
| `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. |
|
|
547
|
+
| `tier` | `"bronze" \| "silver" \| "gold"` | _none_ | Optional enabled-agent preset. `bronze` is minimal, `silver` is standard, `gold` enables the full specialist set. |
|
|
548
|
+
| `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. |
|
|
509
549
|
| `preserveNative` | `boolean` | `true` | Native `plan`/`build` are always preserved. Accepted for readability. |
|
|
510
550
|
| `context7` | `boolean` | `true` | When true, registers the Context7 MCP server unless already configured. |
|
|
511
551
|
| `commands` | `boolean` | `false` | When true, adds `resolve`, `resolve-code`, `resolve-review` commands. |
|
|
512
|
-
| `autoApprove` | `boolean` | `true` |
|
|
513
|
-
| `
|
|
514
|
-
| `
|
|
552
|
+
| `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. |
|
|
553
|
+
| `autoUpdate` | `boolean` | `true` | Best-effort npm version check and OpenCode plugin cache refresh notice. Set false to disable. |
|
|
554
|
+
| `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. |
|
|
555
|
+
| `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. |
|
|
515
556
|
| `agents` | `object` | `{}` | Per-agent overrides (see below). |
|
|
516
557
|
| `config` | `string` | _none_ | Custom path to a config file (relative to the project or absolute). |
|
|
517
558
|
|
|
@@ -549,19 +590,20 @@ A fully-annotated reference config ships with the package as [`opencode-resolve.
|
|
|
549
590
|
|
|
550
591
|
## Auto Approval
|
|
551
592
|
|
|
552
|
-
`autoApprove` (default `true`)
|
|
593
|
+
`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"`.
|
|
553
594
|
|
|
554
|
-
|
|
555
|
-
|---|---|---|
|
|
556
|
-
| Default `"ask"` | becomes `"allow"` | stays `"ask"` |
|
|
557
|
-
| Default `"deny"` | stays `"deny"` | stays `"deny"` |
|
|
558
|
-
| User explicit `"ask"` | stays `"ask"` | stays `"ask"` |
|
|
559
|
-
| User explicit `"allow"` | stays `"allow"` | stays `"allow"` |
|
|
560
|
-
| User explicit `"deny"` | stays `"deny"` | stays `"deny"` |
|
|
595
|
+
Low-friction autonomous behavior comes from two explicit defaults:
|
|
561
596
|
|
|
562
|
-
|
|
597
|
+
| Permission | Current default behavior |
|
|
598
|
+
|---|---|
|
|
599
|
+
| Write-agent `edit` / `webfetch` | `allow` |
|
|
600
|
+
| Write-agent `bash` | `ask`, routed through the plugin's `permission.ask` classifier |
|
|
601
|
+
| Safe bash commands | Auto-allowed by classifier |
|
|
602
|
+
| Dangerous bash commands | Auto-denied by classifier |
|
|
603
|
+
| Unknown bash commands | Left as `ask` for OpenCode/user handling |
|
|
604
|
+
| Read-only agent `edit` / `bash` | `deny`; write-capable plugin tools also block read-only agents |
|
|
563
605
|
|
|
564
|
-
|
|
606
|
+
You may leave the flag in config for intent clarity:
|
|
565
607
|
|
|
566
608
|
```json
|
|
567
609
|
{
|
|
@@ -569,18 +611,18 @@ Turn it off when you want the conservative ask-every-time behavior:
|
|
|
569
611
|
}
|
|
570
612
|
```
|
|
571
613
|
|
|
572
|
-
> **Trust note:**
|
|
614
|
+
> **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.
|
|
573
615
|
|
|
574
616
|
---
|
|
575
617
|
|
|
576
618
|
## Parallel Subagent Limit
|
|
577
619
|
|
|
578
|
-
`maxParallelSubagents`
|
|
620
|
+
`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.
|
|
579
621
|
|
|
580
622
|
| Value | Behavior |
|
|
581
623
|
|---|---|
|
|
582
624
|
| `1` | Strictly one coder at a time. |
|
|
583
|
-
| `2`
|
|
625
|
+
| `2` | Up to two coders concurrently. Useful when fanning out genuinely independent work. |
|
|
584
626
|
| `N > 2` | Up to N coders concurrently. Use sparingly to avoid context waste. |
|
|
585
627
|
|
|
586
628
|
Override per project or per user:
|
|
@@ -601,10 +643,11 @@ The limit is templated into the prompt at config-load time, so restart OpenCode
|
|
|
601
643
|
|
|
602
644
|
When you upgrade to a newer version of `opencode-resolve`, the `postinstall` script runs an **additive migration** on your existing `~/.config/opencode/resolve.json`:
|
|
603
645
|
|
|
604
|
-
- Adds new top-level keys (
|
|
646
|
+
- Adds new top-level keys (currently `autoApprove`) with their defaults if they are absent.
|
|
605
647
|
- **Never** modifies keys you have already set.
|
|
606
648
|
- **Never** rewrites your `enabled` list, `models` map, or `agents` overrides.
|
|
607
649
|
- If `enabled` is set and does not include `"resolver"`, prints a one-line tip suggesting you add it. Your file is left untouched.
|
|
650
|
+
- 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.
|
|
608
651
|
|
|
609
652
|
### Adaptive first-install preset
|
|
610
653
|
|
|
@@ -612,11 +655,12 @@ When `resolve.json` does **not** exist, postinstall inspects your OpenCode model
|
|
|
612
655
|
|
|
613
656
|
| Detected provider | Preset |
|
|
614
657
|
|---|---|
|
|
615
|
-
|
|
|
616
|
-
|
|
|
617
|
-
|
|
|
658
|
+
| Interactive terminal | Always prompts for `mix` / `gpt` / `glm`, asks for three-tier model picks, and in `mix` asks whether to enable `codex` and `glm` primary agents |
|
|
659
|
+
| Non-interactive install | Does not guess model pinning; writes `profile: "mix"`, `models: {}`, and enables `resolver`, `codex`, and `glm` as primary routes |
|
|
660
|
+
| Legacy opt-in | Set `OPENCODE_RESOLVE_AUTO_PRESET=1` to allow non-interactive provider-adapted presets |
|
|
661
|
+
| GLM/ZAI detected | Adds the ZAI MCP bootstrap without copying API keys |
|
|
618
662
|
|
|
619
|
-
To change presets at any time, edit `models` in `resolve.json` directly or
|
|
663
|
+
To change presets at any time, edit `models` in `resolve.json` directly or run reinstall with `OPENCODE_RESOLVE_REINSTALL=fresh`.
|
|
620
664
|
|
|
621
665
|
Skip the migration entirely with:
|
|
622
666
|
|
|
@@ -705,6 +749,9 @@ In this setup, `plan` uses `openai/gpt-5.3-codex`; native `build`, resolve `code
|
|
|
705
749
|
| `strong` | Provider-neutral alias for a strong/expensive model |
|
|
706
750
|
| `mini` | Provider-neutral alias for a mini/efficient model |
|
|
707
751
|
| `codex` | Provider-neutral alias for a codex-style coding model |
|
|
752
|
+
| `bronze` / `silver` / `gold` | Three-tier scout / coder / reasoner aliases |
|
|
753
|
+
| `gpt-bronze` / `gpt-silver` / `gpt-gold` | GPT/Codex-specific three-tier aliases for mixed setups |
|
|
754
|
+
| `glm-bronze` / `glm-silver` / `glm-gold` | GLM-specific three-tier aliases for mixed setups |
|
|
708
755
|
| `quick` | Legacy alias (equivalent to `fast`) |
|
|
709
756
|
| `deep` | Legacy alias (equivalent to `strong`) |
|
|
710
757
|
| `glm` | Legacy alias (backward compatibility) |
|
|
@@ -718,17 +765,20 @@ Aliases only resolve when defined in `models`. Agent names (`coder`, `resolver`,
|
|
|
718
765
|
|
|
719
766
|
| Agent | Default | Mode | Edit | Bash | WebFetch | Purpose |
|
|
720
767
|
|---|:---:|---|---|---|---|---|
|
|
721
|
-
| `resolver` | Yes (core) | `all` |
|
|
722
|
-
| `
|
|
723
|
-
| `
|
|
724
|
-
| `
|
|
725
|
-
| `
|
|
726
|
-
| `
|
|
727
|
-
| `
|
|
728
|
-
| `
|
|
729
|
-
| `
|
|
730
|
-
|
|
731
|
-
|
|
768
|
+
| `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. |
|
|
769
|
+
| `codex` | No | `all` | allow | ask (classifier-routed) | allow | Codex-optimized primary resolver with the same verified resolve-loop style as `resolver`. Enabled by first-install GPT/mix presets or explicitly. |
|
|
770
|
+
| `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. |
|
|
771
|
+
| `coder` | Yes (core) | `subagent` | allow | ask (classifier-routed) | allow | Focused implementer. Smallest correct patch. Reads only needed files. |
|
|
772
|
+
| `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. |
|
|
773
|
+
| `reviewer` | Yes (subagent) | `subagent` | **deny** | **deny** | allow | Internal verification-gap auditor. Resolver dispatches for post-change verification gaps on non-trivial changes. |
|
|
774
|
+
| `deep-reviewer` | Yes (subagent) | `subagent` | **deny** | **deny** | allow | Internal thorough review for risky/security/architecture changes. Resolver dispatches ONLY for high-impact work. |
|
|
775
|
+
| `planner` | Yes (subagent) | `subagent` | **deny** | **deny** | allow | Explicit-plan specialist. Resolver dispatches only when the user asks for a plan/decomposition/strategy. |
|
|
776
|
+
| `architect` | No | `subagent` | **deny** | **deny** | allow | Design and task decomposition. |
|
|
777
|
+
| `gpt-coder` | No | `subagent` | allow | ask (classifier-routed) | allow | Stronger-reasoning implementation fallback. |
|
|
778
|
+
| `debugger` | No | `subagent` | allow | ask (classifier-routed) | allow | Reproduction and root-cause analysis. |
|
|
779
|
+
| `researcher` | No | `subagent` | **deny** | **deny** | allow | Codebase and documentation research. |
|
|
780
|
+
|
|
781
|
+
`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.
|
|
732
782
|
|
|
733
783
|
Supported modes:
|
|
734
784
|
|
|
@@ -740,20 +790,21 @@ Supported modes:
|
|
|
740
790
|
|
|
741
791
|
Supported permission values: `ask`, `allow`, `deny`.
|
|
742
792
|
|
|
743
|
-
Supported model alias keys: `fast`, `strong`, `mini`, `codex`, `quick`, `deep`, `glm`, `gpt`, and every supported agent name. Aliases only resolve when defined in `models`.
|
|
793
|
+
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`.
|
|
744
794
|
|
|
745
795
|
`preserveNative` is accepted for readability, but native `plan` and `build` are always preserved. The plugin never rewrites built-in OpenCode agents.
|
|
746
796
|
|
|
747
797
|
### Resolver orchestration rules
|
|
748
798
|
|
|
749
|
-
The resolver uses a context-efficient approach with checkpointed execution
|
|
799
|
+
The resolver uses a context-efficient approach with checkpointed execution and repeated-failure recovery:
|
|
750
800
|
|
|
751
801
|
- **Classify** the work as quick, normal, deep, or risky before planning.
|
|
752
802
|
- **Inspect only relevant files** using local tools — avoid broad exploration.
|
|
753
803
|
- For trivial work, apply edits directly — no subagent needed.
|
|
754
804
|
- Dispatch **coder** with focused file/behavior instructions.
|
|
755
805
|
- Run the **cheapest meaningful verification** first.
|
|
756
|
-
- Retry from verification logs if issues remain
|
|
806
|
+
- Retry from verification logs if issues remain; on verification failure, diagnose root cause before re-dispatching a coder with a different fix.
|
|
807
|
+
- After repeated consecutive failures, stop and report the blocker instead of claiming completion; after heavy failure counts, pivot to `architect` for a different strategy.
|
|
757
808
|
- Use **explorer** only when scope is genuinely unknown and local read/grep/glob are insufficient (internal subagent, not core path).
|
|
758
809
|
- Use **reviewer** only when a verification gap exists on non-trivial changes (internal subagent, not core path).
|
|
759
810
|
- Use **deep-reviewer** only for risky, security-sensitive, architectural, or high-impact changes (internal subagent, not core path).
|
|
@@ -785,7 +836,7 @@ When `context7: true` (the default), the plugin automatically registers the [Con
|
|
|
785
836
|
}
|
|
786
837
|
```
|
|
787
838
|
|
|
788
|
-
This gives
|
|
839
|
+
This gives resolve agents access to Context7's documentation tools through OpenCode's MCP integration — no manual MCP configuration needed.
|
|
789
840
|
|
|
790
841
|
To disable Context7 registration (e.g. you already have it configured, or you don't want it):
|
|
791
842
|
|
|
@@ -830,12 +881,20 @@ From this repository:
|
|
|
830
881
|
|
|
831
882
|
```sh
|
|
832
883
|
npm install
|
|
884
|
+
npm run hooks:install
|
|
833
885
|
npm test
|
|
834
886
|
npm run install:local
|
|
835
887
|
```
|
|
836
888
|
|
|
837
889
|
`install:local` builds the plugin, links it into the OpenCode global plugin directory, and creates `~/.config/opencode/resolve.json` if it does not exist.
|
|
838
890
|
|
|
891
|
+
`hooks:install` sets this checkout's `core.hooksPath` to `.githooks`. The tracked hooks are intentionally strict:
|
|
892
|
+
|
|
893
|
+
| Hook | Gate |
|
|
894
|
+
|---|---|
|
|
895
|
+
| `pre-commit` | `npm run typecheck`, `npm test`, `npm run coverage` |
|
|
896
|
+
| `pre-push` | full `pre-commit` gate plus `npm pack --dry-run` before anything reaches the remote |
|
|
897
|
+
|
|
839
898
|
Manual local install:
|
|
840
899
|
|
|
841
900
|
```sh
|
|
@@ -855,6 +914,7 @@ Run the normal checks:
|
|
|
855
914
|
```sh
|
|
856
915
|
npm run typecheck
|
|
857
916
|
npm test
|
|
917
|
+
npm run coverage
|
|
858
918
|
npm run build
|
|
859
919
|
```
|
|
860
920
|
|
|
@@ -865,6 +925,7 @@ Before publishing:
|
|
|
865
925
|
```sh
|
|
866
926
|
npm run typecheck
|
|
867
927
|
npm test
|
|
928
|
+
npm run coverage
|
|
868
929
|
npm audit --audit-level=moderate
|
|
869
930
|
npm publish --dry-run
|
|
870
931
|
```
|
|
@@ -905,7 +966,7 @@ The release workflow runs `npm ci`, `npm run typecheck`, `npm test`, and `npm pu
|
|
|
905
966
|
- Resolver dispatches `reviewer` only for verification gaps on non-trivial changes.
|
|
906
967
|
- Resolver dispatches `deep-reviewer` only for risky, security-sensitive, architectural, or high-impact changes.
|
|
907
968
|
- Reviewer and deep-reviewer are read-only — fixes always go through `coder` or `resolver`.
|
|
908
|
-
-
|
|
969
|
+
- Repeated verification failures trigger diagnosis, a different fix strategy, and blocker reporting instead of silent loop continuation. Large tasks are decomposed into verified checkpoints.
|
|
909
970
|
- The resolver honors `maxParallelSubagents` for context efficiency.
|
|
910
971
|
- Search and inspect before editing. Make the smallest correct change. Verify when practical.
|
|
911
972
|
- Read only needed files. Avoid broad exploration. Targeted verification, not full suites.
|
package/dist/agents.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ResolveAgentName, ResolveAgentConfig, ModelAlias, TierName } from "./types.js";
|
|
2
|
+
export declare const DEFAULT_MODELS: Partial<Record<ModelAlias, string>>;
|
|
3
|
+
export declare const DEFAULT_ENABLED: ResolveAgentName[];
|
|
4
|
+
export declare const VALID_AGENT_NAMES: readonly ["coder", "reviewer", "resolver", "codex", "glm", "architect", "gpt-coder", "debugger", "researcher", "explorer", "deep-reviewer", "planner"];
|
|
5
|
+
export declare const VALID_AGENT_NAME_SET: Set<string>;
|
|
6
|
+
export declare const DEFAULT_AGENT_CONFIG: Record<ResolveAgentName, Required<Pick<ResolveAgentConfig, "mode" | "description" | "prompt" | "color">> & ResolveAgentConfig>;
|
|
7
|
+
export declare const GLM_CODER_PROMPT: string;
|
|
8
|
+
export declare const GPT_CODER_PROMPT: string;
|
|
9
|
+
export declare function buildGLMResolverPrompt(maxParallelSubagents: number | undefined): string;
|
|
10
|
+
export declare function buildGPTResolverPrompt(): string;
|
|
11
|
+
export declare function buildCodexResolverPrompt(): string;
|
|
12
|
+
export declare function buildResolverPrompt(maxParallelSubagents: number | undefined): string;
|
|
13
|
+
export declare const VALID_MODEL_ALIASES: readonly ["coder", "reviewer", "resolver", "codex", "glm", "architect", "gpt-coder", "debugger", "researcher", "explorer", "deep-reviewer", "planner", "glm", "gpt", "quick", "deep", "fast", "strong", "mini", "codex", "bronze", "silver", "gold", "gpt-bronze", "gpt-silver", "gpt-gold", "glm-bronze", "glm-silver", "glm-gold"];
|
|
14
|
+
export declare const VALID_MODEL_ALIAS_SET: Set<string>;
|
|
15
|
+
export declare const VALID_PROFILES: Set<string>;
|
|
16
|
+
export declare const VALID_TIERS: Set<string>;
|
|
17
|
+
export declare const GLM_ENABLED: ResolveAgentName[];
|
|
18
|
+
export declare const GPT_ENABLED: ResolveAgentName[];
|
|
19
|
+
export declare const TIER_ENABLED: Record<TierName, ResolveAgentName[]>;
|
|
20
|
+
export declare const GLM_AGENT_OVERRIDES: Partial<Record<ResolveAgentName, {
|
|
21
|
+
maxSteps?: number;
|
|
22
|
+
description?: string;
|
|
23
|
+
}>>;
|
|
24
|
+
export declare const GPT_AGENT_OVERRIDES: Partial<Record<ResolveAgentName, {
|
|
25
|
+
maxSteps?: number;
|
|
26
|
+
description?: string;
|
|
27
|
+
}>>;
|