
forge-delegate
io.github.MuhamadBarzaniPublished by GitHub account MuhamadBarzaniv1.2.4Updated Oct 29, 2026
Delegate coding tasks from Claude Code, Codex or opencode to any model opencode can run.
Overview
Delegates coding work from Claude Code, Codex or opencode to other models via opencode, keeping the main agent's context small.
- What you can do
- Delegate coding tasks to another model that works autonomously through opencode's tool loop, inline or as a background job
- Poll background delegations or list them, and ask another model for a second opinion by direct API call
- List available local, keyless, direct-API and agentic models
- Read and change the delegation configuration at runtime (default model, directory, autoApprove, profiles)
- Report token usage and, where prices are known, cost per delegation and in totals
- When to use it
- Useful when a primary agent should hand off high-volume, low-risk work such as tests, boilerplate, mechanical edits, lint or type fixes and docstrings to a cheaper or free model, while keeping architecture and security-sensitive code on the main agent.
- Requirements
- Runs locally over stdio as an npm package (npx forge-delegate setup). Needs Node.js 18 or newer and opencode v2 or newer; the installer can fetch opencode. Free opencode models need no auth; other providers must be logged in through your own opencode (opencode auth login), and Ollama needs the Ollama app running. Setup registers the server with the chosen agents.
Installation
In SourceWeft
- Open forge-delegate in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
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
Source: README.md at commit 0161a7a
Tools
0Version history
1- v1.2.4LatestOct 29, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts