CortexHands
Uses a local Ollama model through the OpenAI-compatible chat completions API as a pluggable worker for delegated coding tasks in isolated Git worktrees.
Integrates with OpenAI-compatible chat completions endpoints as a sandboxed pluggable worker, allowing delegated coding tasks to be executed by an OpenAI API model inside an isolated Git worktree.
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., "@CortexHands Fix the failing auth tests in an isolated worktree and send me the review packet."
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.
CortexHands
Let frontier AI models think & review. Let cheap CLI & API agents do the hands-on coding — safely inside isolated Git worktrees.
English | 简体中文 | Architecture & Interview Guide | WorkBuddy Setup | Launch Posts
Why CortexHands?
Frontier reasoning models (Google Antigravity, Claude Code, Codex, Cursor) are expensive and rate-limited — burning their quota on boilerplate edits, test-fix loops, and multi-file exploration hurts. On the other hand, cheap or free coding workers (Tencent WorkBuddy / CodeBuddy, DeepSeek, Ollama, OpenCode, Aider) have generous quota, but left unsupervised they can edit unrelated files, break tests, or pollute your working branch.
CortexHands is a cross-platform Planner-Executor-Reviewer MCP Orchestrator (v0.2.0) that combines the best of both worlds:
Git Worktree Sandbox: Every delegated task runs in
.cortex-hands/worktrees/<taskId>on its own branch — your main branch is never touched until you approve. Supportssquash/merge/patch-onlydelivery and one-click rollback (abort_task).Parallel Multi-Worktree Batching (
dispatch_batch): Run 2–5 disjoint subtasks concurrently in separate isolated worktrees with bounded concurrency and pre-flight scope-overlap warnings.Scope Guard + Auto-Detect Quality Gate: Enforce
allowedPathsglob whitelists (with!exclusions), block sensitive files (.env,*.key,*.pem) by default, auto-detect project test/typecheck commands (Node/Go/Rust/Python), and return a token-compressed Review Packet instead of noisy raw logs.Same-Session Rework + Circuit Breaker: Rejections via
request_reworkresume the worker's existing session (--resume <sessionId>) in the same worktree, capped bymaxRoundsto stop infinite retry loops.First-Class Windows & macOS WorkBuddy 5.11.3 Support: Auto-discovers WorkBuddy via Windows Registry / common drives / macOS app bundles, handles WorkBuddy 5.11.3
codebuddy-lite-wb.mjsrouting (CODEBUDDY_FORCE_LITE_WB_BUNDLE=1), and kills Windows process trees cleanly (taskkill /T /F) so zero zombie locks remain.Built-in Sandboxed OpenAI-Compatible Worker (
openai-api): Works out-of-the-box with DeepSeek, Ollama, SiliconFlow, OpenRouter, or any/v1/chat/completionsendpoint — with worktree path-traversal protection and multi-round session memory.Zero-Dependency Local Observability Dashboard: Run
cortex-hands dashboardto inspect live tasks, Scope Guard alerts, color-highlighted diffs, and token savings in your browser (127.0.0.1:3847).Native Antigravity Plugin + Standard MCP: Ships both a ready-to-install Antigravity plugin (MCP + workflow
SKILL.md+rules/AGENTS.md) and standardstdioMCP configs for Claude Code, Cursor, and Codex.
Related MCP server: cheap-agent-codex
Architecture
flowchart LR
Planner["Frontier Planner & Reviewer\n(Antigravity / Claude Code / Codex)"]
MCP["CortexHands MCP Server\n(9 tools over stdio)"]
Core["Orchestrator State Machine\n• Parallel Git Worktree Sandbox\n• Scope Guard & Auto-Detect Gate\n• Diff Compressor & Circuit Breaker\n• Live Dashboard & Telemetry"]
Worker["Pluggable Cheap Workers\n• WorkBuddy CLI (Win/macOS)\n• OpenAI-API (DeepSeek/Ollama)\n• Generic CLI (OpenCode/Aider)"]
Planner -->|"1. dispatch_task / dispatch_batch"| MCP
MCP --> Core
Core -->|"2. isolated worktree(s)"| Worker
Worker -->|"3. edits + self-test"| Core
Core -->|"4. compressed Review Packet"| Planner
Planner -->|"5a. request_rework (--resume)"| MCP
Planner -->|"5b. approve_and_merge / abort_task"| MCPQuick Start (60 Seconds)
1. Try the Zero-Cost End-to-End Demo & Live Dashboard
No API key or quota required — watches a full Round 1 scope violation + failing test -> automated interception -> Round 2 rework fix -> squash merge -> telemetry report in 3 seconds:
git clone https://github.com/DuskstarXiao/cortex-hands.git
cd cortex-hands
npm install && npm run build
node dist/index.js demo --persist
node dist/index.js dashboard2. Run Environment Doctor
Checks Node.js, Git, WorkBuddy CLI auto-discovery, OpenAI/Generic workers, and Antigravity plugin status:
node dist/index.js doctorIf WorkBuddy headless CLI reports Authentication required, sign in once interactively:
node dist/index.js login-workbuddy
# Inside the prompt, run /login once, then /exit3. Install into Antigravity (One Command)
node dist/index.js init --target antigravityThis installs the complete Antigravity Plugin (MCP server + cortex-hands-workflow skill + rules) into ~/.gemini/config/plugins/cortex-hands/.
For other MCP clients:
node dist/index.js init --target claude # Claude Code
node dist/index.js init --target cursor # Cursor
node dist/index.js init --target codex # OpenAI Codex CLIMCP Tools Reference (9 High-Cohesion Tools)
Tool | Role | Purpose |
| Planner | Creates an isolated Git worktree, injects the execution contract, runs the worker, and executes automated gates |
| Planner | Executes 1–5 independent subtasks concurrently across separate Git worktrees with scope-overlap warnings |
| Planner | Polls live status, round number, and recent worker events (for |
| Reviewer | Returns Scope Guard findings, compressed gate test summaries, diff stat, and bounded unified diff |
| Reviewer | Rejects output and sends targeted comments back to the same worktree & worker session ( |
| Reviewer | Blocks merge if gate failed (unless forced), cleanly merges via |
| Reviewer | Terminates the worker process tree safely and removes the temporary worktree & branch |
| Utility | Lists recent tasks and available worker adapters |
| Analytics | Reports first-pass approval rate, avg rounds, context compression ratio, and estimated planner tokens saved |
Pluggable Workers & .cortex-hands.json
Option A: Tencent WorkBuddy (Default, Zero API Key)
Auto-discovered on Windows (5.11.3+) and macOS. See docs/WORKBUDDY_SETUP.md.
Option B: Built-in Sandboxed OpenAI-Compatible API (worker: "openai-api")
Works with DeepSeek, local Ollama, SiliconFlow, OpenRouter, Moonshot/Kimi, Zhipu, etc.:
export CORTEX_HANDS_OPENAI_BASE_URL="https://api.deepseek.com/v1" # or http://127.0.0.1:11434/v1
export CORTEX_HANDS_OPENAI_MODEL="deepseek-chat" # or qwen2.5-coder:14b
export CORTEX_HANDS_OPENAI_API_KEY="sk-..." # optional for OllamaOption C: Any Local CLI (worker: "generic-cli")
export CORTEX_HANDS_GENERIC_CLI_CMD="opencode run {prompt}"Optional Repo Defaults (.cortex-hands.json)
{
"defaultWorker": "workbuddy",
"maxRounds": 3,
"autoDetectGates": true,
"allowedPaths": ["src/**", "tests/**"],
"mergeStrategy": "squash"
}Development & Verification
npm run typecheck # Strict TypeScript checking
npm run build # Bundle single-file ESM CLI via tsup
npm test # 17 unit + real Git worktree + dashboard + MCP JSON-RPC testsCompliance Notice
CortexHands strictly invokes official user-installed CLIs, user-supplied standard APIs, and open protocols (MCP / Git). It does not reverse-engineer private APIs, extract browser cookies, bypass rate limits, or automate multi-account farming.
License
Available Tools
9 toolsabort_taskA
Cancel a running or pending task, terminate its worker process tree safely, and remove its isolated Git worktree without touching the main branch.
Inputs: taskId (required), reason.
approve_and_mergeA
Approve the reviewed worktree changes, merge them cleanly into the repository (or export a patch), and clean up the temporary Git worktree.
Inputs: taskId (required), commitMessage, mergeStrategy, forceWithoutGatePass.
dispatch_batchA
Dispatch multiple independent subtasks concurrently across separate isolated Git worktrees (bounded concurrency pool + pre-flight scope overlap warnings). Ideal for parallelizing disjoint modules or tests.
Inputs: tasks (required), repoPath (required), defaultModel, defaultWorker, +1 more.
dispatch_taskA
Dispatch a bounded coding task to a cheap/local execution worker (e.g. WorkBuddy) inside an isolated Git worktree. Automatically runs Scope Guard and gate commands before returning a compressed Review Packet to save planner tokens.
Inputs: title (required), prompt (required), repoPath (required), acceptanceCriteria (required), +9 more.
get_review_packetA
Fetch the token-compressed Review Packet (Scope Guard results, gate test summaries, diff stat, and bounded git diff) for planner review.
Inputs: taskId (required), maxDiffLines.
get_task_statusA
Inspect the live status, round progress, and recent events of a dispatched task.
Inputs: taskId (required).
get_telemetry_reportB
Generate a Markdown cost-savings and quality-gate report showing context compression ratio, estimated planner tokens saved, first-pass approval rate, and caught violations.
Inputs: range.
list_tasksB
List recent CortexHands tasks and available workers so the planner can resume pending reviews or check active runs.
Inputs: limit.
request_reworkA
Reject the worker output and send targeted review comments back to the SAME worktree and worker session (--resume). Automatically enforces the maxRounds circuit breaker.
Inputs: taskId (required), reviewComments (required), async, focusFiles, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each tool maps to a distinct lifecycle step (dispatch, status, review, rework, merge, abort, telemetry), so the core set is easy to tell apart. The only real overlaps are dispatch_task vs dispatch_batch and list_tasks vs get_task_status, which descriptions do resolve but still require reading.
All names are snake_case and verb-first (get_, list_, dispatch_, abort_, request_, approve_), giving a predictable pattern. approve_and_merge is the one compound outlier, and the get_ prefix is used for three different resource types, but overall it reads consistently.
Nine tools is well within the ideal band and every tool corresponds to a meaningful workflow step: orchestration, monitoring, review, remediation, cleanup, and reporting. Nothing feels padded or missing in count terms.
The dispatch-to-merge lifecycle is fully closed: single and batch dispatch, status polling, review packet retrieval, rework with a round circuit breaker, approval/merge, and abort with cleanup, plus telemetry. Minor gaps remain, such as standalone worker management or deeper raw log retrieval for failed runs, but core workflows have no dead ends.
Maintenance
Related MCP Connectors
Git collaboration for AI agents and people: tasks, hand-offs, reviews, teams, shared memory.
AI work orchestration for plans, tasks, teams, and coding-agent dispatch.
Software factory for AI agents: issue and PR reviews, auto-fixes, stacked PRs and a merge queue.
Run parallel coding agents: Git-worktree workspaces, agent sessions, automations, tasks.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables multiple AI coding CLIs (Claude Code, Gemini/Antigravity, Codex, and OpenCode) to collaborate as a coordinated team by routing cross-agent prompts, sharing messages and review tickets, tracking tasks on a shared store, and isolating each agent in its own Git worktree with turn-budget safeguards—all inspectable and steerable from a local web dashboard.MIT
- AlicenseAqualityCmaintenanceEnables a planning agent to delegate research and implementation to lower-cost worker models in isolated git worktrees, monitor job progress, respond to blocked jobs, and land verified changes for review.6MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI coding agents to spawn, parallelize, and synchronize multi-agent programming swarms through a stdio MCP interface. Provides tools for DAG-scheduled task dispatch, isolated Git worktree execution, atomic file locking, shared blackboard memory, and clean merging of completed agent work back to the main repository.1MIT
- AlicenseNot gradedqualityBmaintenanceEnables an orchestrating agent to delegate tasks to Codex, Claude, or Gemini worker CLIs running in isolated git worktrees, then wait on jobs, inspect per-file diffs, and merge or discard the resulting changes before anything touches the working tree.1MIT