opencode-foreman
Provides git worktree-based task isolation and branch management: creates per-task worktrees and branches, merges or discards branches when finishing tasks, and cleans up worktrees.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@opencode-foremanStart a worktree task with gpt-5.5 to implement docs/plan.md"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
opencode-foreman
A Claude Code plugin that makes Claude the foreman and opencode the worker. Claude splits work, briefs opencode sessions, reviews their output, sends fixes back, and merges. The heavy implementation tokens are spent on whatever model you run in opencode.
It ships:
An MCP server (
server/foreman.ts) with these tools:list_modelsstart_tasktask_statuswait_tasksend_messagelist_taskscancel_tasktask_detailsfinish_task
The
opencode-foremanskill, which teaches Claude the dispatch → review → fix → merge loop. It is a replacement for subagent-driven development.
Requirements
Node ≥ 23.6. The server is plain
.tsrun by Node's built-in type stripping, with no npm dependencies and no build step.opencodeon PATH, already working with your models.git (for worktree tasks).
Related MCP server: opencode-mcp
Install
/plugin marketplace add KoonPaT/claude-code-foreman
/plugin install opencode-foreman@claude-code-foremanRestart Claude Code. /mcp should then list opencode-foreman.
How it works
The opencode server. The MCP talks to an
opencode serveatFOREMAN_OPENCODE_URL(defaulthttp://127.0.0.1:4096). If nothing answers there, it starts one detached and leaves it running. Workers survive Claude restarts, and several Claude windows share one server.Tasks. Each task is one opencode session, and the task id is the session id. Sessions are tagged (
[foreman]title prefix plus metadata), solist_tasksstill works after a restart.Status.
start_taskandsend_messagereturn immediately.wait_taskblocks until any of the given tasks finishes. A task's status is one of:runningdoneneeds_input: the worker ended with aQUESTION:lineerror
Permissions. Workers run unattended with a per-session ruleset. The ruleset denies
git push,npm publish,sudo, destructiverm -rf, writes outside the task directory, and interactive questions. A denied command is reported back and never hangs the task. Your own opencode config is untouched. The bash deny list is a best-effort pattern match, not a sandbox: a determined worker can still find a way to write or push.Worktrees. With
worktree: true, the task runs in its own git worktree at<repo>/../<repo>.foreman/<slug>, on the branchforeman/<slug>.finish_taskmerges or discards the branch and removes the worktree. A conflicting merge is aborted cleanly and the worktree is kept.
Usage
Just ask Claude, naming a model if you want one:
ใช้ opencode model opencodex/gpt-5.5 ทำหน้า login ตามแผนนี้ แล้วให้ opencode/big-pickle review
Use opencode with opencodex/gpt-5.5 to implement the plan in docs/plan.md, two tasks in parallel.
If you name no model, Claude asks you to pick one. To control the choices,
set your favorites in ~/.claude/settings.json:
"env": { "FOREMAN_MODELS": "opencodex/gpt-6-luna,opencodex/tokenme/google/gemma-4-31b-it" }list_models shows them first, under favorites:.
Watching workers
Every start_task returns a web: URL and a watch: command for the new
session. Open the web: URL in a browser to watch the worker live, or run
the watch: command (opencode attach <url> --session <id>) to attach.
list_tasks gives a quick summary of running and finished tasks.
Tests
npm test # unit + MCP protocol + git tests
FOREMAN_E2E=1 node --test test/e2e.test.ts # real opencode, free model opencode/big-pickleLicense
This server cannot be deployed
Maintenance
Related MCP Connectors
Hosted coding agent: start, follow up on and stop tasks that can open GitHub pull requests.
Deploy, monitor, and manage your OpenClaw AI assistants via natural language.
Shared workspace where Claude, ChatGPT, Codex and Grok share files, tasks, decisions and handoffs.
Create projects, nodes, and tasks in UluP Spaces by conversation with Claude.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables Claude to create, manage, and clean up git worktrees automatically, including dependency installation and GitHub PR creation.5MIT
- AlicenseAqualityBmaintenanceEnables Claude Code to delegate tasks to OpenCode subagents asynchronously, with tools for starting tasks, polling status, and fetching results.7111 npm5MIT
- AlicenseAqualityBmaintenanceEnables Claude Code to run cursor-agent tasks in isolated git worktrees, manage asynchronous and parallel jobs, review diffs, and safely apply changes back to the repository.1614 npmMIT
- AlicenseNot gradedqualityCmaintenanceEnables Claude Code and Claude Desktop to delegate coding tasks to any model available in OpenCode while Claude remains the orchestrator, planning work, reviewing diffs, and running tests. Supports synchronous and async delegation, model selection, session continuation, and permission-aware execution.5MIT