setup-opencode-ralph-rlm
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSetup OpenCode Ralph RLM
设置 OpenCode Ralph RLM
Use this skill to install Ralph RLM into a target repository and make it usable from OpenCode as the model.
ralph-rlm/supervisor使用此技能将 Ralph RLM 安装到目标仓库,并使其能够从 OpenCode 中以 模型使用。
ralph-rlm/supervisorWorkflow
工作流
-
Inspect the target repository.
- Confirm the working directory is the project root.
- Identify the package manager and test command from lockfiles and scripts.
package.json - Check for existing ,
opencode.json, and.opencode/ralph.json..opencode/plugins/ - If the repo already has OpenCode or Ralph config, read references/config-files.md before editing.
-
Install the Ralph package if the project can accept a dev dependency.
- Prefer the package manager already used by the repo.
- Package name: .
@doeixd/opencode-ralph-rlm - If the user only wants a one-time setup, use instead.
npx @doeixd/opencode-ralph-rlm setup - Do not require Bun for end users; the published CLI is a Node binary.
-
Run setup from the project root.bash
npx @doeixd/opencode-ralph-rlm setup --worktree .Usefirst when the repo already has OpenCode config. Use--dry-runonly when the user explicitly wants generated Ralph files overwritten. See references/cli.md for command flags and expected output.--force -
Review generated files.
- should re-export
.opencode/plugins/ralph-worker.ts.@doeixd/opencode-ralph-rlm/worker-plugin - should inject
.opencode/plugins/ralph-session-bridge.tsandx-opencode-session-id.directory - starts the provider automatically when OpenCode loads (so the user need not run
.opencode/plugins/ralph-autostart.tsby hand). Skipped ifservewas used; disable at runtime withsetup --no-autostart.RALPH_AUTOSTART=0 - should have a realistic
.opencode/ralph.json.verify.command - includes
.opencode/ralph.json— the named-plan layout. Protocol files (plans: { dir: ".ralph-rlm/plans", active: "default" },PLAN.md, …) will live underRLM_INSTRUCTIONS.md, not the repo root..ralph-rlm/plans/<name>/prints the active plan'sopencode-ralph-rlm plan-pathlocation.PLAN.md - may include
.opencode/ralph.jsonandfff.enabled; leave the defaults unless the project cannot load optional native dependencies.fff.scanTimeoutMs - should preserve existing providers and include
opencode.json.provider["ralph-rlm"]
-
Adjustif auto-detection guessed poorly.
verify.command- Bun projects usually use or
["bun", "run", "test"].["bun", "run", "verify"] - npm projects usually use .
["npm", "test"] - Rust projects usually use .
["cargo", "test"] - Python projects usually use .
["python", "-m", "pytest"]
- Bun projects usually use
-
Ask whether to add Ralph guidance to the project agent instructions.
- Look for
.opencode/ralph.json, thenagentMdPath, thenAGENT.md.AGENTS.md - Ask the user before creating or editing the guidance file.
- If they agree, append a short Ralph section; use references/agent-guidance.md for wording.
- Look for
-
Run diagnostics.bash
npx @doeixd/opencode-ralph-rlm doctor --worktree .A provider warning is expected until the provider is running. For failures, read references/troubleshooting.md. -
Set up models — discover what the user already has first; only ask if nothing usable is found.There are two model decisions:
- Supervisor — the LLM the provider calls for orchestration (planning interview, tool routing, status). Needs reliable function/tool-calling.
- Worker — the model spawned OpenCode sessions use to write code. Workers run through OpenCode, so they already use OpenCode's providers/auth.
Discover existing credentials/models before configuring anything:- — which providers are authenticated.
opencode auth list - — available model ids (e.g.
opencode models,opencode/deepseek-v4-flash-free).anthropic/claude-*
Supervisor: if the user has a keyed provider authenticated in OpenCode (e.g. Google, OpenCode Zen), the provider auto-detects it — no separate key needed. So usually you do nothing here. Only set(+RALPH_SUPERVISOR_API_KEY/RALPH_SUPERVISOR_MODEL) orRALPH_SUPERVISOR_BASE_URL.opencode/ralph-provider.jsonif the user wants a specific provider/model, or if no keyed provider is authenticated.supervisorWorker: leaving it unset is fine — workers use OpenCode's configured default model. To run coding on a free model, recommend (don't force) setting.opencode/ralph-provider.json+worker.providerIDto a free OpenCode model such asworker.modelID/opencode. Confirm with the user before writing it.deepseek-v4-flash-freeIf nothing usable is found (no authenticated provider, no key): direct the user to authenticate before launching, e.g.:bashopencode auth loginor set. Do not start the provider expecting the supervisor to work until at least one credential path exists. See references/config-files.md.RALPH_SUPERVISOR_API_KEY -
Re-open OpenCode — the provider auto-starts; then verify the supervisor is ready.
- With the auto-start plugin installed (default), the provider launches automatically when OpenCode loads — no manual needed. OpenCode loads providers and plugins at startup, so quit and re-open the OpenCode TUI for the
servemodel + plugins to take effect.ralph-rlm/supervisor - Check readiness: —
curl http://127.0.0.1:8787/api/healthshould besupervisor.ready(it shows the resolvedtrue,modele.g.source, and the provideropencode-auth:google). If unreachable, the provider may still be starting (give it a moment) or auto-start was disabled — then start it manually:versionbashnpx @doeixd/opencode-ralph-rlm serve --worktree . - If you just updated Ralph, restart so the new version loads. The provider is idempotent (one instance per port, reused), and 's pre-flight refuses to start a duplicate — if it reports an existing provider of a different version, stop the old one first.
serve - Then select the model.
ralph-rlm/supervisor
- With the auto-start plugin installed (default), the provider launches automatically when OpenCode loads — no manual
-
Suggest planning before the first loop.
- A loop is only as good as its . Recommend planning the goal with the supervisor (it runs an interview before
PLAN.md) or via thestart_loopskill, rather than delegating a one-line goal cold.interview-and-create-plan
-
检查目标仓库。
- 确认当前工作目录为项目根目录。
- 根据锁文件和 的 scripts 识别包管理器和测试命令。
package.json - 检查是否已存在 、
opencode.json和.opencode/ralph.json。.opencode/plugins/ - 如果仓库中已有 OpenCode 或 Ralph 配置,请在编辑前阅读 references/config-files.md。
-
如果项目可以添加开发依赖,则安装 Ralph 软件包。
- 优先使用仓库已经在使用的包管理器。
- 软件包名称:。
@doeixd/opencode-ralph-rlm - 如果用户只需要一次性设置,请改用 。
npx @doeixd/opencode-ralph-rlm setup - 最终用户不需要安装 Bun;已发布的 CLI 是 Node 二进制文件。
-
从项目根目录运行设置命令。bash
npx @doeixd/opencode-ralph-rlm setup --worktree .如果仓库中已有 OpenCode 配置,请先使用。仅当用户明确希望覆盖生成的 Ralph 文件时,才使用--dry-run。 有关命令参数和预期输出,请参阅 references/cli.md。--force -
检查生成的文件。
- 应重新导出
.opencode/plugins/ralph-worker.ts。@doeixd/opencode-ralph-rlm/worker-plugin - 应注入
.opencode/plugins/ralph-session-bridge.ts和x-opencode-session-id。directory - 会在 OpenCode 加载时自动启动 provider(因此用户无需手动运行
.opencode/plugins/ralph-autostart.ts)。如果使用了serve,则会跳过此项;可在运行时通过setup --no-autostart禁用。RALPH_AUTOSTART=0 - 应包含合理的
.opencode/ralph.json。verify.command - 包含
.opencode/ralph.json,即命名计划布局。协议文件(plans: { dir: ".ralph-rlm/plans", active: "default" }、PLAN.md等)将位于RLM_INSTRUCTIONS.md下,而不是仓库根目录。.ralph-rlm/plans/<name>/会打印当前计划的opencode-ralph-rlm plan-path位置。PLAN.md - 可能包含
.opencode/ralph.json和fff.enabled;除非项目无法加载可选的原生依赖,否则应保留默认值。fff.scanTimeoutMs - 应保留现有 providers,并包含
opencode.json。provider["ralph-rlm"]
-
如果自动检测对的猜测不准确,则进行调整。
verify.command- Bun 项目通常使用 或
["bun", "run", "test"]。["bun", "run", "verify"] - npm 项目通常使用 。
["npm", "test"] - Rust 项目通常使用 。
["cargo", "test"] - Python 项目通常使用 。
["python", "-m", "pytest"]
- Bun 项目通常使用
-
询问是否将 Ralph 指引添加到项目的 agent instructions 中。
- 依次查找 中的
.opencode/ralph.json、agentMdPath和AGENT.md。AGENTS.md - 在创建或编辑指引文件前,先征得用户同意。
- 如果用户同意,则追加一小段 Ralph 内容;相关措辞请参阅 references/agent-guidance.md。
- 依次查找
-
运行诊断。bash
npx @doeixd/opencode-ralph-rlm doctor --worktree .在 provider 启动之前出现 provider 警告属于预期现象。 如有失败,请参阅 references/troubleshooting.md。 -
设置模型——首先发现用户已有的配置;仅在未找到任何可用配置时才询问。这里有两个模型决策:
- Supervisor——provider 为编排工作而调用的 LLM(规划访谈、工具路由、状态管理)。需要可靠的 function/tool-calling。
- Worker——OpenCode 启动的会话用于编写代码时所使用的模型。Worker 通过 OpenCode 运行,因此已经使用 OpenCode 的 providers/auth。
配置任何内容之前,先发现现有凭据和模型:- ——查看已认证的 providers。
opencode auth list - ——查看可用的模型 ID(例如
opencode models、opencode/deepseek-v4-flash-free)。anthropic/claude-*
Supervisor:如果用户已经在 OpenCode 中认证了带密钥的 provider(例如 Google、OpenCode Zen),provider 会自动检测到它——无需单独的 key。因此通常不需要执行任何操作。仅当用户希望指定特定的 provider/model,或者没有认证任何带密钥的 provider 时,才设置(以及RALPH_SUPERVISOR_API_KEY/RALPH_SUPERVISOR_MODEL),或在RALPH_SUPERVISOR_BASE_URL中设置.opencode/ralph-provider.json。supervisor**Worker:**保持未设置也可以——Worker 会使用 OpenCode 已配置的默认模型。如果希望使用免费模型运行编码任务,建议(不要强制)将中的.opencode/ralph-provider.json和worker.providerID设置为免费的 OpenCode 模型,例如worker.modelID/opencode。写入前请与用户确认。deepseek-v4-flash-free如果未找到任何可用配置(没有已认证的 provider,也没有 key):指导用户先完成认证,然后再启动,例如:bashopencode auth login或设置。在至少存在一条可用凭据路径之前,不要启动 provider 并期望 supervisor 正常工作。请参阅 references/config-files.md。RALPH_SUPERVISOR_API_KEY -
重新打开 OpenCode——provider 会自动启动;随后验证 supervisor 已准备就绪。
- 安装自动启动插件后(默认行为),provider 会在 OpenCode 加载时自动启动——无需手动运行 。OpenCode 会在启动时加载 providers 和 plugins,因此需要退出并重新打开 OpenCode TUI,
serve模型和 plugins 才会生效。ralph-rlm/supervisor - 检查就绪状态:——
curl http://127.0.0.1:8787/api/health应为supervisor.ready(其中会显示解析后的true、来源model,例如source,以及 provider 的opencode-auth:google)。如果无法访问,provider 可能仍在启动(请稍候),或者自动启动已被禁用——此时请手动启动:versionbashnpx @doeixd/opencode-ralph-rlm serve --worktree . - **如果刚刚更新了 Ralph,**请重启以加载新版本。provider 是幂等的(每个端口对应一个实例,可重复使用),并且 的预检会拒绝启动重复实例——如果它报告存在不同版本的 provider,请先停止旧实例。
serve - 然后选择 模型。
ralph-rlm/supervisor
- 安装自动启动插件后(默认行为),provider 会在 OpenCode 加载时自动启动——无需手动运行
-
建议在首次循环前进行规划。
- 循环的效果取决于其 的质量。建议让 supervisor 协助规划目标(它会在
PLAN.md之前进行访谈),或使用start_loopskill,而不是直接委派一个只有一句话的目标。interview-and-create-plan
- 循环的效果取决于其
Notes
注意事项
- The setup command is intentionally conservative: it skips existing managed files unless is passed.
--force - is the portable command. The binary installed by the package is named
npx @doeixd/opencode-ralph-rlm ....opencode-ralph-rlm - Worker search uses optional acceleration when available. If it is unavailable,
@ff-labs/fff-nodefalls back automatically; setrlm_greponly when native search causes local issues.RALPH_FFF_DISABLED=1 - Node can run some files directly in recent versions, but Node refuses TypeScript files under
.ts; the npm package should ship compiled JavaScript for the CLI.node_modules - Do not hand-copy the legacy v0.1 plugin or tell users to call .
ralph_spawn_worker - For supervisor LLM credentials, prefer environment variables first:
RALPH_SUPERVISOR_API_KEYRALPH_SUPERVISOR_MODEL
- Use only when repo-local supervisor/worker defaults are needed.
.opencode/ralph-provider.json
- setup 命令有意采用保守策略:除非传入 ,否则会跳过已有的受管理文件。
--force - 是可移植命令。软件包安装的二进制文件名为
npx @doeixd/opencode-ralph-rlm ...。opencode-ralph-rlm - Worker 搜索在可用时会使用可选的 加速。如果该依赖不可用,
@ff-labs/fff-node会自动回退;仅当原生搜索引发本地问题时,才设置rlm_grep。RALPH_FFF_DISABLED=1 - 较新版本的 Node 可以直接运行部分 文件,但 Node 拒绝运行
.ts下的 TypeScript 文件;npm 软件包应随 CLI 一并提供编译后的 JavaScript。node_modules - 不要手动复制旧版 v0.1 插件,也不要让用户调用 。
ralph_spawn_worker - 对于 supervisor LLM 凭据,优先使用环境变量:
RALPH_SUPERVISOR_API_KEYRALPH_SUPERVISOR_MODEL
- 仅当仓库需要本地 supervisor/worker 默认配置时,才使用 。
.opencode/ralph-provider.json