opencode-resolve 0.1.2 → 0.1.3

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
@@ -77,13 +77,15 @@ Manual fallback: add the plugin to `~/.config/opencode/opencode.json` yourself:
77
77
 
78
78
  Hand the block below to any reasonably capable LLM along with the instruction _"set up opencode-resolve on this machine"_ and it can finish the install end-to-end. Everything below is the entire required configuration — no other MCP servers, environment variables, or files are needed.
79
79
 
80
- **Step 1 — install the plugin:**
80
+ > **ImportantOpenCode caches plugins itself.** OpenCode does NOT use globally-installed npm packages. It maintains its own cache at `~/.cache/opencode/packages/`. After the very first install (or any future upgrade), refresh the cache with `opencode plugin opencode-resolve --global --force` and restart OpenCode. `npm install -g` alone is not enough.
81
+
82
+ **Step 1 — install via OpenCode (also primes the cache):**
81
83
 
82
84
  ```sh
83
- npm install -g opencode-resolve
85
+ opencode plugin opencode-resolve --global --force
84
86
  ```
85
87
 
86
- **Step 2 — `~/.config/opencode/opencode.json`** (the only required keys; merge into an existing file rather than replacing if one exists):
88
+ **Step 2 — `~/.config/opencode/opencode.json`** (merge into the existing file; do not replace it):
87
89
 
88
90
  ```json
89
91
  {
@@ -93,7 +95,7 @@ npm install -g opencode-resolve
93
95
  }
94
96
  ```
95
97
 
96
- **Step 3 — `~/.config/opencode/resolve.json`** (created automatically by `postinstall`; the file below is the canonical default):
98
+ **Step 3 — `~/.config/opencode/resolve.json`** (auto-created by `postinstall`; the block below is the recommended canonical setup — copy it verbatim then edit `models` to match your provider):
97
99
 
98
100
  ```json
99
101
  {
@@ -102,15 +104,48 @@ npm install -g opencode-resolve
102
104
  "context7": true,
103
105
  "commands": false,
104
106
  "autoApprove": true,
105
- "maxParallelSubagents": 1
107
+ "maxParallelSubagents": 2,
108
+ "models": {
109
+ "glm": "zai-coding-plan/glm-5",
110
+ "gpt": "openai/gpt-5.5",
111
+ "coder": "glm",
112
+ "reviewer": "openai/gpt-4o-mini",
113
+ "resolver": "gpt"
114
+ },
115
+ "agents": {
116
+ "coder": { "mode": "all" },
117
+ "reviewer": { "mode": "all" },
118
+ "resolver": { "enabled": true },
119
+ "architect": { "enabled": false },
120
+ "gpt-coder": { "enabled": false },
121
+ "debugger": { "enabled": false },
122
+ "researcher": { "enabled": false }
123
+ }
106
124
  }
107
125
  ```
108
126
 
109
127
  **Step 4 — restart OpenCode.**
110
128
 
111
- That is the entire setup. `context7` is the only MCP server the plugin needs (auto-registered when the key above is `true`) — no other MCP entries are required for `opencode-resolve` itself. Models are inherited from your top-level OpenCode `model` unless you pin per-role models under `models` (see [Model Setup](#model-setup)).
129
+ ### Why this template
112
130
 
113
- If you want stricter behavior, flip `autoApprove` to `false` (every action prompts for approval) and/or raise `maxParallelSubagents` to let the resolver fan out independent subtasks.
131
+ - **`enabled`** activates the three default roles: `coder` implements, `reviewer` audits read-only, `resolver` orchestrates.
132
+ - **`autoApprove: true`** lets `coder` and `resolver` work without per-action approval prompts. `reviewer` stays locked to deny — it cannot modify by any means.
133
+ - **`maxParallelSubagents: 2`** is a per-role cap: up to two coders and up to two reviewers may run concurrently when working on genuinely independent things. Drop to `1` for strict per-role serialization, raise above `2` for more aggressive fan-out.
134
+ - **`agents.coder.mode = "all"` and `agents.reviewer.mode = "all"`** make both visible in the primary agent picker, not just as subagents the resolver dispatches. You can still call them directly when you don't need orchestration.
135
+ - **`agents.resolver.enabled: true`** is explicit (default is also true); ships with `mode: "all"` so it appears as both a primary agent and a subagent.
136
+ - **`models`** uses two aliases (`glm` for fast/cheap implementation, `gpt` for stronger orchestration) and pins reviewer to `gpt-4o-mini` for cheap reads. Replace these with model IDs your provider actually exposes.
137
+ - **`context7`** is the only MCP this plugin auto-registers — no other MCP servers are required.
138
+ - All other resolve agents (`architect`, `gpt-coder`, `debugger`, `researcher`) ship disabled. Flip `enabled: true` only if you want to use them.
139
+
140
+ ### Resolver workflow (what happens when you call it)
141
+
142
+ 1. Resolver reads the request, inspects relevant files.
143
+ 2. Plans the smallest correct change.
144
+ 3. Dispatches `coder` to implement (one at a time).
145
+ 4. Verifies (tests, type checks, targeted checks).
146
+ 5. If issues remain, dispatches `coder` again with a focused fix.
147
+ 6. For risky changes, optionally consults `reviewer` for a read-only audit; routes any required fixes back through `coder`.
148
+ 7. Repeats until the task is resolved or clearly blocked, then returns a concise summary.
114
149
 
115
150
  ---
116
151
 
@@ -259,17 +294,25 @@ Trust note: `autoApprove: true` assumes you trust the workspace and the model yo
259
294
 
260
295
  ## Parallel Subagent Limit
261
296
 
262
- `maxParallelSubagents` (default `1`) caps how many subagents the **resolver** may dispatch in parallel — across `coder`, `reviewer`, or any other subagent. The default of `1` enforces strictly serial dispatch: resolver waits for each subagent to finish before launching the next.
297
+ `maxParallelSubagents` (default `2`) caps how many subagents the **resolver** may dispatch concurrently **per role**. The default of `2` lets up to two coders run in parallel AND up to two reviewers run in parallel total up to four subagents in flight when both roles are active. Subagents of different roles may always run concurrently (e.g. coder implementing while reviewer audits the previous step).
298
+
299
+ | Value | Behavior |
300
+ |---|---|
301
+ | `1` | Strictly one of each role at a time. Coder may run while reviewer runs, but never two coders or two reviewers in parallel. |
302
+ | `2` (default) | Up to two of each role concurrently. Total in flight up to (per-role limit × number of active roles). |
303
+ | `N > 2` | Up to N of each role concurrently. Useful when fanning out genuinely independent work. |
263
304
 
264
- Raise it when you want resolver to fan out independent subtasks:
305
+ Override per project or per user:
265
306
 
266
307
  ```json
267
- {
268
- "maxParallelSubagents": 3
269
- }
308
+ { "maxParallelSubagents": 1 } // strictest
309
+ { "maxParallelSubagents": 2 } // default
310
+ { "maxParallelSubagents": 4 } // aggressive parallelism
270
311
  ```
271
312
 
272
- The limit is woven into the resolver's prompt at config-load time, so changing it does not require any code changes restart OpenCode to pick up the new limit. If you provide a custom `agents.resolver.prompt`, the templated rule is skipped and your prompt wins.
313
+ > **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. Modern models (GPT-5.x, GLM-5, Claude 4.x) 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.
314
+
315
+ 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.
273
316
 
274
317
  ---
275
318
 
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@ const VALID_TOP_LEVEL_KEYS = new Set([
20
20
  "maxParallelSubagents",
21
21
  "config",
22
22
  ]);
23
- const DEFAULT_MAX_PARALLEL_SUBAGENTS = 1;
23
+ const DEFAULT_MAX_PARALLEL_SUBAGENTS = 2;
24
24
  const VALID_AGENT_KEYS = new Set([
25
25
  "enabled",
26
26
  "model",
@@ -35,8 +35,8 @@ const VALID_AGENT_KEYS = new Set([
35
35
  function buildResolverPrompt(maxParallelSubagents) {
36
36
  const limit = Math.max(1, Math.trunc(maxParallelSubagents));
37
37
  const parallelRule = limit === 1
38
- ? "CRITICAL: Dispatch only ONE subagent at a time. Never call multiple subagents (coder, reviewer, or any other) in parallel. Wait for the current subagent to finish and evaluate its result before dispatching the next one."
39
- : `CRITICAL: Dispatch at most ${limit} subagents in parallel. Never exceed this limit across coder, reviewer, or any other subagent. Wait for in-flight subagents to finish and evaluate their results before launching new ones.`;
38
+ ? "CRITICAL: Dispatch at most ONE subagent of each role concurrently. Never run two coders in parallel, and never run two reviewers in parallel. A coder and a reviewer MAY run concurrently when they are doing genuinely independent work (e.g. coder is implementing the next change while reviewer audits the previous one). Wait for an in-flight subagent of a given role to finish before dispatching another of the same role."
39
+ : `CRITICAL: Dispatch at most ${limit} subagents of the same role concurrently. Never exceed ${limit} coders in parallel, and never exceed ${limit} reviewers in parallel. Subagents of different roles may run concurrently when they are doing genuinely independent work. Wait for in-flight subagents of a given role to finish before dispatching more of that role.`;
40
40
  return [
41
41
  "You are Resolver, the primary orchestrator agent for OpenCode Resolve.",
42
42
  "Your job is to drive the user's task to a verified resolution end-to-end without unnecessary stops.",
@@ -47,9 +47,10 @@ function buildResolverPrompt(maxParallelSubagents) {
47
47
  `4. ${parallelRule}`,
48
48
  "5. After implementation, verify when practical (run tests, type checks, or targeted checks).",
49
49
  "6. If issues remain, dispatch the coder again with a focused fix, or apply a small direct edit yourself when it is clearly trivial.",
50
- "7. Optionally consult the reviewer subagent for an independent read-only review on risky changes. The reviewer cannot modify anything; treat its output as advice and route any required fixes back through the coder. The same parallel-dispatch limit applies to the reviewer.",
50
+ "7. Optionally consult the reviewer subagent for an independent read-only review on risky changes. The reviewer cannot modify anything; treat its output as advice and route any required fixes back through the coder. The same per-role parallel limit applies to the reviewer.",
51
51
  "8. Repeat until the task is resolved or clearly blocked.",
52
52
  "Return a concise summary of what changed, verification results, and any remaining blockers.",
53
+ "Note: this parallel rule is enforced via prompt only — there is no runtime cap on subagent dispatches. Honor it strictly to avoid file conflicts and wasted work.",
53
54
  ].join("\n");
54
55
  }
55
56
  const DEFAULT_AGENT_CONFIG = {
@@ -4,14 +4,14 @@
4
4
  "context7": true,
5
5
  "commands": false,
6
6
  "autoApprove": true,
7
- "maxParallelSubagents": 1,
7
+ "maxParallelSubagents": 2,
8
8
  "models": {},
9
9
  "agents": {
10
10
  "coder": {
11
- "enabled": true
11
+ "mode": "all"
12
12
  },
13
13
  "reviewer": {
14
- "enabled": true
14
+ "mode": "all"
15
15
  },
16
16
  "resolver": {
17
17
  "enabled": true
@@ -30,3 +30,4 @@
30
30
  }
31
31
  }
32
32
  }
33
+
@@ -58,11 +58,16 @@
58
58
 
59
59
  // -----------------------------------------------------------------------
60
60
  // maxParallelSubagents (positive integer)
61
- // Maximum number of subagents the resolver may dispatch in parallel
62
- // (across coder, reviewer, etc.). Default: 1strictly serial.
63
- // Increase if you want resolver to fan out independent subtasks.
64
- // -----------------------------------------------------------------------
65
- "maxParallelSubagents": 1,
61
+ // Maximum number of subagents of the SAME ROLE the resolver may dispatch
62
+ // concurrently. Default: 2at most two coders in parallel and at most
63
+ // two reviewers in parallel. Subagents of different roles may always run
64
+ // concurrently. This is a soft prompt-level limit, not a runtime cap —
65
+ // pair with `maxSteps` if you need a stricter ceiling.
66
+ // 1 = strict per-role serial (one of each role at a time)
67
+ // 2 = default
68
+ // N = up to N of each role
69
+ // -----------------------------------------------------------------------
70
+ "maxParallelSubagents": 2,
66
71
 
67
72
  // -----------------------------------------------------------------------
68
73
  // models (object)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-resolve",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "OpenCode plugin that adds a small coder/reviewer agent set while preserving native plan/build behavior.",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/jshsakura/opencode-resolve#readme",
@@ -13,7 +13,7 @@ const exampleConfigPath = join(root, "opencode-resolve.example.json")
13
13
 
14
14
  const ADDITIVE_DEFAULTS = {
15
15
  autoApprove: true,
16
- maxParallelSubagents: 1,
16
+ maxParallelSubagents: 2,
17
17
  }
18
18
 
19
19
  if (process.env.OPENCODE_RESOLVE_SKIP_POSTINSTALL === "1") {