Skip to content

Commit 289a56a

Browse files
committed
feat: fully hide ralph_*/rlm_* tools from normal sessions via dedicated agent
Plugin config hook denies ralph_*/rlm_* globally and re-allows them only in a new 'ralph-worker' agent (now the default worker.agent); engine spawns workers under it. Verified live against opencode serve: normal session = tools hidden (NO_SUCH_TOOL), worker agent = tools usable + full coding tools intact. Removed worker.agent:build from example/scaffold (build now denies these tools). 104 tests pass.
1 parent 60ece46 commit 289a56a

14 files changed

Lines changed: 77 additions & 10 deletions

File tree

.opencode/ralph-provider.example.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"maxToolRounds": 8
66
},
77
"worker": {
8-
"agent": "build",
98
"providerID": "opencode",
109
"modelID": "deepseek-v4-flash-free"
1110
}

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ All notable changes to this project are documented here.
44

55
Format based on [Keep a Changelog](https://keepachangelog.com/).
66

7+
## [0.3.7] - 2026-06-24
8+
9+
### Changed
10+
11+
- **`ralph_*` / `rlm_*` tools are now hidden from normal OpenCode sessions** (not just inert). The worker plugin's `config` hook denies them globally and re-allows them only in a dedicated **`ralph-worker`** agent that workers run under (the new default `worker.agent`). Verified live: a normal session reports the tools as unavailable; a worker session can use them and still has full coding tools. The 0.3.6 session-scoped gate/prompt remain as defense-in-depth.
12+
- Do not set `worker.agent` (e.g. to `build`) — that agent has the Ralph tools denied; workers must use `ralph-worker`. The example/scaffold configs no longer set it.
13+
714
## [0.3.6] - 2026-06-24
815

916
### Fixed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ Model: Attempt 2. Last verify failed. Worker idle. …
162162
- **Exit criterion:** `verify.command` in `.opencode/ralph.json` (single source of truth for “done”).
163163
- **Memory:** protocol files in the active plan dir (`.ralph-rlm/plans/<name>/`, or repo root in legacy mode) — not chat history.
164164
- **Workers:** fresh OpenCode session per attempt; engine spawns via SDK.
165-
- **Worker plugin:** gates `edit`/`bash` until `ralph_load_context()`; provides FFF-accelerated `rlm_grep`, `rlm_file_search`, `rlm_glob`, and `rlm_slice`.
165+
- **Worker plugin:** gates `edit`/`bash` until `ralph_load_context()`; provides FFF-accelerated `rlm_grep`, `rlm_file_search`, `rlm_glob`, and `rlm_slice`. Its `ralph_*` / `rlm_*` tools are **hidden from your normal OpenCode sessions** — they're denied globally and re-enabled only in the dedicated `ralph-worker` agent that workers run under.
166166
- **Permissions:** bash/edit prompts appear in the **worker session** TUI (answer there).
167167

168168

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@doeixd/opencode-ralph-rlm",
3-
"version": "0.3.6",
3+
"version": "0.3.7",
44
"description": "Ralph RLM v0.2: OpenCode supervisor provider + loop engine + worker plugin",
55
"type": "module",
66
"workspaces": [

packages/engine/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@doeixd/opencode-ralph-rlm-engine",
33
"private": true,
4-
"version": "0.3.6",
4+
"version": "0.3.7",
55
"description": "Ralph RLM loop engine — verify, rollover, OpenCode SDK worker lifecycle",
66
"license": "MIT",
77
"repository": {

packages/engine/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ export {
193193

194194
export {
195195
loadWorkerSpawnConfig,
196+
RALPH_WORKER_AGENT,
196197
type WorkerSpawnConfig,
197198
} from "./worker-spawn.js";
198199

packages/engine/src/setup.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,8 @@ export async function setupProject(options: SetupOptions): Promise<SetupResult>
317317
maxToolRounds: 8,
318318
},
319319
worker: {
320-
agent: "build",
320+
providerID: "opencode",
321+
modelID: "deepseek-v4-flash-free",
321322
},
322323
}),
323324
options,

packages/engine/src/worker-spawn.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ import path from "node:path";
22
import { fileExists, readTextFile } from "./fs.js";
33
import type { EngineTemplates } from "./templates.js";
44

5+
/**
6+
* OpenCode agent workers run under. A dedicated agent (defined by the worker
7+
* plugin's `config` hook) lets us hide the `ralph_*` / `rlm_*` tools from normal
8+
* sessions (denied globally) while re-allowing them here.
9+
*/
10+
export const RALPH_WORKER_AGENT = "ralph-worker";
11+
512
export type WorkerSpawnConfig = {
613
agent: string;
714
systemPrompt: string;
@@ -38,7 +45,7 @@ export async function loadWorkerSpawnConfig(
3845
templates.workerSystemPrompt;
3946

4047
const config: WorkerSpawnConfig = {
41-
agent: fromEnv.agent || worker.agent?.trim() || "build",
48+
agent: fromEnv.agent || worker.agent?.trim() || RALPH_WORKER_AGENT,
4249
systemPrompt,
4350
};
4451

packages/provider/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@doeixd/opencode-ralph-rlm-provider",
33
"private": true,
4-
"version": "0.3.6",
4+
"version": "0.3.7",
55
"description": "Ralph RLM OpenAI-compatible supervisor provider (Nitro)",
66
"license": "MIT",
77
"repository": {

packages/provider/server/routes/api/health.get.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default defineHandler(async () => {
1616
return {
1717
healthy: true,
1818
provider: "@doeixd/opencode-ralph-rlm",
19-
version: "0.3.6",
19+
version: "0.3.7",
2020
opencode: {
2121
baseUrl: runtime.baseUrl,
2222
...opencode,

0 commit comments

Comments
 (0)