
forge-delegate
io.github.MuhamadBarzani由 GitHub 账号 MuhamadBarzani 发布v1.2.4更新于 Oct 29, 2026
Delegate coding tasks from Claude Code, Codex or opencode to any model opencode can run.
概览
把 Claude Code、Codex 或 opencode 中的编码任务委派给其他模型,让主代理的上下文保持精简。
- 可以做什么
- 把编码任务委派给另一个模型,由 opencode 的工具循环自主执行,可内联返回或作为后台任务运行
- 轮询或列出后台委派任务,并通过直接 API 调用向其他模型征求第二意见
- 列出可用的本地、免密钥、直接 API 与代理式模型
- 在运行时读取和修改委派配置(默认模型、目录、autoApprove、预设)
- 报告每次委派及累计的 token 用量,并在提供商提供价格时报告费用
- 适用场景
- 适合让主代理把测试、样板代码、机械式批量修改、lint 或类型修复、文档字符串等量大且低风险的工作交给更便宜或免费的模型,而把架构和安全敏感代码留在主代理上。
- 运行要求
- 以 npm 包形式通过 stdio 在本机运行(npx forge-delegate setup)。需要 Node.js 18 或更高版本以及 opencode v2 或更高版本,安装程序可代为获取 opencode。免费的 opencode 模型无需认证;其他提供商需先在你自己安装的 opencode 中登录(opencode auth login),Ollama 需运行 Ollama 应用。setup 会把服务器注册到所选代理。
安装
在 SourceWeft 中
- 打开 控制台中的 forge-delegate,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
forge-delegate
MCP server that delegates coding work from your primary agent (Claude Code, Codex, or opencode) to other AI models, so your main agent's context stays small. The high-volume typing happens in another model's context, usually a cheaper or free one, and only a summary comes back. Full agentic delegation via opencode for real work; direct API calls for second opinions.
Your main agent (the expensive one) keeps architecture, critical logic, and hard decisions. The cheap model grinds through the high-volume, low-risk work (boilerplate, repetitive edits, tests, lint/type fixes) and reports back.
Quick start
Web configurator — pick model/targets/scope and get a ready-to-paste command (https://muhamadbarzani.github.io/forge-delegate/). The model picker is backed by the live models.dev catalog — searchable, with free/cheap filters and real prices, so you're picking from actual available models rather than guessing.
npx (recommended — works everywhere, no bash needed):
That's it — npx bootstraps the package, and setup registers the MCP server with the agents
you chose, sets your default model, and installs a small launcher that keeps the server up to
date. Works on Windows (cmd/PowerShell), macOS, and Linux — no bash needed.
Run setup without flags and it walks you through the choices interactively (defaults in
[brackets], Enter accepts). For the default model it lists every model your opencode can run
and you pick one by number or name; pass any of the flags to skip that prompt. In an automated/non-terminal
run it just uses sensible defaults.
GitHub Pages: enable it with Settings → Pages → Deploy from a branch →
main//docs. The configurator lives atdocs/index.html.install.sh'sFORGE_DELEGATE_REPOdefault (and the raw URL inside it) matters only if you self-host the fallback installer.Working on a checkout yourself?
node cli.mjs setupdoes the same thing.
setup will:
- Register the MCP server with each agent you chose (
--targets claude,codex,opencode). - Set your default model (
--model) so calls can omitmodel. - Install the auto-update launcher (published installs; skipped for a git checkout).
- For Codex, raise the MCP timeouts (
startup_timeout_sec,tool_timeout_sec) above Codex's 10s/60s defaults so inline delegations aren't cut off.
Routing and cost-policy guidance is injected by the MCP server itself into the agent's context
via MCP instructions — no memory-file (CLAUDE.md/AGENTS.md) editing needed.
Then restart your agent and confirm the server is connected: /mcp in Claude Code,
codex mcp, or opencode.
What you need
- Node.js ≥ 18 and opencode v2 or newer installed (the installer can fetch opencode for you).
v2 removed the CLI flags older versions relied on for working directories and variants, and an
unknown flag makes
opencode runprint help and exit successfully — so a pre-v2 binary fails silently. The server checks at startup and warns instead. - Free
opencode/*models (e.g.opencode/deepseek-v4.1-flash-free) need no auth — zero setup. - Any other provider (deepseek, openai, google, ollama, …) must be logged into your
opencode first — that's a step you do in your own opencode, not something forge-delegate
handles:
opencode auth login <provider>. forge-delegate reuses your opencode's credentials and never stores API keys. (Ollama needs no key, just the Ollama app running.)
Windows
Use the npx route — no bash needed (works in cmd/PowerShell). All three targets, including
native Windows Codex CLI, are supported.
Scope
Try it free — zero signup
opencode ships free no-auth models under opencode/:
Other free options: opencode/mimo-v2.6-flash-free, opencode/nemotron-3.5-lightning-free. Free tiers are
rate-limited; switch anytime with forge-delegate config set --model <m>.
Tools
delegate is the context-saver: the external model gets its own tool loop executed by
opencode locally. File contents never touch your main agent's context. Fast tasks return
inline; long ones are auto-backgrounded by Claude Code (past ~2 min). Other hosts wait for an
inline call, so the agent is told to pass background:true there for anything long.
Each delegation's result ends with the tokens it used and, when the provider reports prices,
its cost. forge-delegate stats totals both per model.
When to delegate
Full guide: docs/DELEGATION.md
The delegate-work skill
Setup also installs the skill for Claude Code (~/.claude/skills/delegate-work/, or
<project>/.claude/skills/ under --scope project) and for Codex (~/.agents/skills/delegate-work/,
or <project>/.agents/skills/). Skip it with --no-skill.
It exists because MCP server instructions are injected once at session start and
get buried as the context fills — by turn 30 they lose to whatever is in front of the
model. A skill description is re-matched against every user turn, so the delegation
triggers ("write tests for", "rename X everywhere", "fix the lint errors") stay live
for the whole session instead of decaying.
Configuration
Stored in ~/.forge-delegate/config.json, read fresh on every call — change it anytime without
reinstalling. Four ways:
- From your agent via the MCP tools
get_delegate_config/set_delegate_config. - Terminal CLI:
forge-delegate config get,forge-delegate config set --model <m> --timeout <s> --dir <path> --autoApprove false,forge-delegate config path. setupflags:--model,--targets,--scope,--project-dir.- Edit the file directly.
Every delegation tool also accepts per-call model, directory, agent, autoApprove, and
profile overrides. Per-call values beat profile values beat config defaults.
Models
- opencode provider — free no-auth models (
opencode/deepseek-v4.1-flash-free, ...) plus anything you have logged in viaopencode auth login <provider>. - Direct API from opencode logins —
provider/modelfor OpenAI-compatible providers. - Custom providers — OpenAI-compatible providers defined in
opencode.json(@ai-sdk/openai-compatible+baseURL), callable asprovider/model. - Ollama (local) —
ollama:llama3,local:qwen2.5-coder, no key needed.
Safety notes
autoApprove: trueruns delegations non-interactively with tool permissions granted — point them at repositories you trust and review the diffs. SetautoApprove: falseto require manual approval.- This server never stores API keys — provider auth lives in opencode's own auth store.
- Usage is logged to
~/.forge-delegate/usage.jsonl; seeforge-delegate stats.
CLI
setup on a published install writes ~/.forge-delegate/launcher.mjs and registers that path
instead of npx. The launcher keeps a private install under ~/.forge-delegate/pkg, asks npm
for the newest release at most every 6 hours, and installs newer same-major versions
automatically. Installs use npm install --ignore-scripts, go through a staging directory, and
fall back to the last good version if anything fails. A new version lands on the next agent
start; the download itself happens in the background so startup is never delayed.
Disable automatic updates with FORGE_AUTO_UPDATE=0. A major release (2.0.0) is never
installed automatically — re-run npx -y forge-delegate setup to take it deliberately.
The launcher is also the CLI entry point: node ~/.forge-delegate/launcher.mjs status reports
the running version and update mode, and --version prints the version.
npx installs configured by hand are not covered by the launcher: npx keeps its cached copy
forever, so clear it with rm -rf ~/.npm/_npx and restart. Running
npx -y forge-delegate@latest setup migrates an npx install to the launcher; @latest gets its
own npx cache slot, and if it still starts an old version, clear the cache first.
Publishing (npm)
The primary install is npx -y forge-delegate setup, so the package must be on npm. Checklist:
npm run prepublishOnly— syntax-checks all entry files (runs automatically on publish).npm pack --dry-run— confirm the tarball contains onlylauncher.mjs,cli.mjs,server.mjs,lib.mjs,install.sh,docs/,skills/,README.md(via thefilesfield), notnode_modules.- Bump
versioninpackage.json(and the rootversioninpackage-lock.json). npm login && npm publish— thebinfield makesnpx forge-delegate …work.
Also make sure the GitHub repo exists at MuhamadBarzani/forge-delegate with Pages enabled on
/docs (configurator) — the raw.githubusercontent.com install URL and the configurator's
hardcoded URL point there.
License
MIT
来源:README.md,提交 0161a7a
工具
0版本历史
1- v1.2.4最新Oct 29, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分