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.

已驗證STDIO僅桌面開發者工具AI 與機器學習

概覽

AI 產生的概覽

把 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 會把伺服器註冊到所選代理。
安裝前請注意
autoApprove 預設為 true,委派會以已授予工具權限的方式非互動執行,可能修改檔案:請只指向可信的儲存庫並審閱變更,或把 autoApprove 設為 false。伺服器沿用 opencode 的憑證,本身不儲存 API 金鑰。用量會記錄到本機用量檔,啟動器會自動安裝同一主版本內的新版本,除非設定 FORGE_AUTO_UPDATE=0。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 forge-delegate,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

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.

┌──────────────────┐   MCP (stdio)   ┌──────────────────┐   opencode run   ┌──────────────────┐│ Claude / Codex / │ ──────────────► │ forge-delegate   │ ───────────────► │ opencode + cheap  ││ opencode (primary)│                │  (this server)   │    --model cheap │      model        │└──────────────────┘ ◄────────────── └──────────────────┘ ◄─────────────── └──────────────────┘        result: text + session + token usage

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):

bash
npx -y forge-delegate setup --model "opencode/deepseek-v4.1-flash-free" --targets "claude,codex,opencode"

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 at docs/index.html. install.sh's FORGE_DELEGATE_REPO default (and the raw URL inside it) matters only if you self-host the fallback installer.

Working on a checkout yourself? node cli.mjs setup does the same thing.

setup will:

  1. Register the MCP server with each agent you chose (--targets claude,codex,opencode).
  2. Set your default model (--model) so calls can omit model.
  3. Install the auto-update launcher (published installs; skipped for a git checkout).
  4. 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 run print 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

--scopeClaude CodeCodexopencode
user (default)~/.claude.json — all projects~/.codex/config.toml — all projects~/.config/opencode/opencode.json — all projects
project.mcp.json in the project (needs one-time approval).codex/config.toml in the project (loads for trusted projects only)opencode.json in the project

Try it free — zero signup

opencode ships free no-auth models under opencode/:

bash
npx -y forge-delegate setup --model "opencode/deepseek-v4.1-flash-free" --targets "claude,codex"

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

ToolWhat it doesContext cost
ask_modelSecond opinion from another model (direct API, no file access)Small
delegateModel works autonomously via opencode's own tool loop — inline by default; background:true returns a job id to poll via check_delegationTiny→Medium
check_delegationPoll a background job (or list all with no id)Tiny
list_modelsList local/keyless, direct-API, and agentic modelsSmall
get_delegate_configRead current configuration (default model, directory, autoApprove, profiles)Tiny
set_delegate_configChange configuration at runtime — no reinstallTiny

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

✅ Delegate — high volume, low risk⛔ Keep on the primary agent
Tests for well-specified behaviorArchitecture, system design, choosing abstractions
Boilerplate & scaffolding (CRUD, DTOs, fixtures, mocks)Security-sensitive code (auth, crypto, secrets, permissions)
Mechanical edits across many files (renames, prop propagation, imports)Concurrency, performance-critical paths, subtle correctness
Lint / formatting / type-error fixesAmbiguous / underspecified requirements needing judgment
Docstrings, comments, README / changelog sectionsPublic API / interface design, breaking changes
Straightforward data transforms / migrations with a clear specDebugging unknown root causes
Obvious glue code / format conversionsAnything costly or hard to detect if wrong

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:

  1. From your agent via the MCP tools get_delegate_config / set_delegate_config.
  2. Terminal CLI: forge-delegate config get, forge-delegate config set --model <m> --timeout <s> --dir <path> --autoApprove false, forge-delegate config path.
  3. setup flags: --model, --targets, --scope, --project-dir.
  4. Edit the file directly.
FieldDescriptionDefault
defaultModelprovider/model used when a call omits modelunset
defaultAgentopencode agent used for delegationsunset
defaultVariantdefault reasoning-effort variantunset
autoApproveauto-approve permissions so headless delegations don't blocktrue
timeoutMsper-delegation timeout900000 (env FORGE_OPENCODE_TIMEOUT)
defaultDirectorydefault working directory for delegationsunset (server cwd)
profilesnamed presets { name: { model, agent, variant, autoApprove, directory } }{}

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 via opencode auth login <provider>.
  • Direct API from opencode logins — provider/model for OpenAI-compatible providers.
  • Custom providers — OpenAI-compatible providers defined in opencode.json (@ai-sdk/openai-compatible + baseURL), callable as provider/model.
  • Ollama (local) — ollama:llama3, local:qwen2.5-coder, no key needed.

Safety notes

  • autoApprove: true runs delegations non-interactively with tool permissions granted — point them at repositories you trust and review the diffs. Set autoApprove: false to 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; see forge-delegate stats.

CLI

text
forge-delegate --version  Print the installed versionforge-delegate setup      Register with Claude Code / Codex / opencodeforge-delegate serve      Start the MCP server (used internally)forge-delegate config     get | set | pathforge-delegate status     Show version, update mode, opencode logins, usageforge-delegate stats      Show detailed usage statistics

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:

  1. npm run prepublishOnly — syntax-checks all entry files (runs automatically on publish).
  2. npm pack --dry-run — confirm the tarball contains only launcher.mjs, cli.mjs, server.mjs, lib.mjs, install.sh, docs/, skills/, README.md (via the files field), not node_modules.
  3. Bump version in package.json (and the root version in package-lock.json).
  4. npm login && npm publish — the bin field makes npx 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
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.2.4最新Oct 29, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分