You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6dbe2d8
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ flowchart LR
40
40
C -.->|feedback + session id, new worker| W
41
41
```
42
42
43
-
The main thread spawns the background `opencode-worker` (Haiku, no edit tools). The worker resolves model and mode (read-only tasks pass `auto: false`), writes a self-contained brief, calls the MCP `delegate` tool, checks the git diff and runs tests or build, retries at most twice with the same session, otherwise reports reject. Its report has model, session id, changed files, verification and verdict, under 200 words. A timed-out run is not retried; the worker reports the session id so you can continue.
43
+
The main thread spawns the background `opencode-worker` (Haiku, no edit tools). The worker resolves model and mode (read-only tasks pass `auto: false`), writes a self-contained brief, calls the MCP `delegate` tool, checks the git diff and runs tests or build, retries at most twice with the same session, otherwise reports reject. Its report has model, session id, changed files, verification and verdict, under 200 words. A timed-out run isn't retried; the worker reports the session id so you can continue.
44
44
45
45
The main thread never calls `delegate` itself: a hook denies it. For each `delegate` call, the MCP server runs:
46
46
@@ -54,15 +54,15 @@ The run uses your existing OpenCode auth, config, agents and permission rules.
54
54
55
55
Built-in subagents (`general-purpose`, `claude`, `Explore`, `Plan`, `claude-code-guide`, `statusline-setup`) are rewritten to `claudelegate:opencode-worker` on Haiku. `Explore`, `Plan` and `claude-code-guide` become read-only. Custom, project, user, plugin, reviewer and SDD agents stay on Claude.
56
56
57
-
To opt out, set`OPENCODE_DELEGATE_ROUTE` to `0`, `false`, `no` or `off` (this also disables the main-thread guard), or put `[no-opencode]`in a single prompt. Routing is also skipped when `opencode` or `jq`cannot be found.
57
+
To opt out, set`OPENCODE_DELEGATE_ROUTE` to `0`, `false`, `no` or `off` (this also disables the main-thread guard), or put `[no-opencode]`in a single prompt. Routing is also skipped when `opencode` or `jq`can't be found.
58
58
59
59
A hook denies `delegate` and `delegate_async` calls from the main thread. Calls from inside a subagent pass because Claude Code sends `agent_id` only there. The MCP server sends `instructions` that make delegation the default.
| read-only | Review, question, summary, second opinion | `--agent plan` (no `--auto`) |
67
67
68
68
| Input | Behaviour |
@@ -71,9 +71,9 @@ A hook denies `delegate` and `delegate_async` calls from the main thread. Calls
71
71
| exact `provider/model` | Used as is |
72
72
| loose name (`grok 4.7`) | Resolved against `opencode models`; a named version must match exactly (4.7 never becomes 4.6) |
73
73
| ambiguous loose name | `delegate` returns the candidates and the worker picks the one that fits the task best |
74
-
|`provider/model#variant`| Variant preserved, e.g. `xai/grok-4.7#high`|
74
+
| `provider/model#variant` | Variant preserved, for example `xai/grok-4.7#high` |
75
75
76
-
There are no built-in default models. Write mode passes `--agent build` because `default_agent` is often `plan`. Without `--auto` headless runs auto-reject permissions, which makes `plan` safe. The `</dev/null` redirect is required: with an open stdin pipe, `opencode run` waits forever.
76
+
The plugin has no built-in default models. Write mode passes `--agent build` because `default_agent` is often `plan`. Without `--auto` headless runs reject permission requests automatically, which makes `plan` safe. The `</dev/null` redirect is required: with an open stdin pipe, `opencode run` waits forever.
77
77
78
78
## Continuing and parallel work
79
79
@@ -88,14 +88,14 @@ Continue by spawning `claudelegate:opencode-worker` again with the session id an
88
88
| `OPENCODE_DELEGATE_DEFAULT_MODEL` | unset | Model when none is given; unset or empty means OpenCode's configured default |
89
89
|`OPENCODE_DELEGATE_AUTO`|`true`| Default for`auto`;`0`, `false`, `no`, `off` disable it |
90
90
|`OPENCODE_DELEGATE_TIMEOUT`|`1800`| Seconds before a run is killed |
91
-
| `OPENCODE_DELEGATE_MAX_OUTPUT` | `40000` | Maximum response characters returned |
91
+
|`OPENCODE_DELEGATE_MAX_OUTPUT`|`40000`|Response character limit |
92
92
|`OPENCODE_DELEGATE_THINKING`|`true`| Include reasoning blocks in output |
93
93
|`OPENCODE_DELEGATE_CWD`| process cwd | Base working directory |
94
-
| `OPENCODE_DELEGATE_PREFERRED_PROVIDERS` | none | Comma-separated provider order when a model has several providers |
94
+
|`OPENCODE_DELEGATE_PREFERRED_PROVIDERS`| none | Comma-separated provider order when a model has more than one provider|
95
95
96
96
The variables are read by the MCP server unless noted. These are the only variables the plugin honours.
97
97
98
-
## Standalone MCP server
98
+
## Standalone server
99
99
100
100
The MCP server is also published to npm as `@lehcode/claudelegate` (needs Bun). Register it in any MCP client with command`bunx` and args `["@lehcode/claudelegate"]`. See `examples/claude_desktop_config.json`.
101
101
@@ -113,13 +113,13 @@ Tests are fixture-based and need no running services.
113
113
114
114
### `src/`
115
115
116
-
`src/index.ts` is the MCP server entry point, `dist/index.js` is a committed bundle built with `bun run build`, and CI fails if it is stale, so rebuild and commit `dist/` after changing `src/`. The plugin cache has no `node_modules`, which is why the bundle is committed.
116
+
`src/index.ts` is the MCP server entry point, `dist/index.js` is a committed bundle built with `bun run build`, and CI fails if it's stale, so rebuild and commit `dist/` after changing `src/`. The plugin cache has no `node_modules`, which is why the bundle is committed.
117
117
118
118
## Releasing
119
119
120
120
Automated by release-please (`.github/workflows/release.yml`). Conventional commits merged to `main` open or update a release PR that bumps `package.json`, `.claude-plugin/plugin.json` and `.claude-plugin/marketplace.json` and writes `CHANGELOG.md`. Merging it creates the `vX.Y.Z` tag and GitHub release and publishes to npm via trusted publishing (OIDC, no token, provenance automatic). Never edit versions by hand.
121
121
122
-
The first publish is manual (`npm publish --access public`), then add a trusted publisher on npmjs.com for repository `lehcode/claudelegate`, workflow `release.yml`. Optional: `RELEASE_PLEASE_TOKEN` secret (PAT or app token with `contents` and `pull-requests` write), because release PRs made with the default `GITHUB_TOKEN` do not trigger CI.
122
+
The first publish is manual (`npm publish --access public`), then add a trusted publisher on npmjs.com for repository `lehcode/claudelegate`, workflow `release.yml`. Optional: `RELEASE_PLEASE_TOKEN` secret (PAT or app token with `contents` and `pull-requests` write), because release PRs made with the default `GITHUB_TOKEN` don't trigger CI.
0 commit comments