Skip to main content
Glama

CI Python MCP License

Forgehand is a small, model-agnostic MCP server for delegating complete coding tasks to an OpenAI-compatible local model. Each step receives bounded current state, deterministic repository facts, and only the latest observation — never the accumulated chat transcript.

Bounded batch reads let the worker inspect up to eight scoped files in one model round-trip without turning the conversation transcript into memory.

Em português

O Forgehand é um servidor MCP (stdio) em Python para delegar uma tarefa de código inteira a um modelo local com API compatível com a da OpenAI. O Codex planeja e revisa. O modelo local implementa num worktree Git separado, só nos caminhos que o contrato da tarefa declara, e roda apenas os comandos aprovados, sem shell. A cada passo ele recebe o estado atual, fatos do repositório e a última observação, em vez do histórico inteiro da conversa. No fim, devolve um recibo com o diff, os testes, as incertezas e os tokens gastos.

Num microbenchmark com o mesmo contrato, o loop conversacional original gastou 25.826 tokens do modelo local, e o Forgehand, 10.708 (58,54% a menos), para a mesma alteração em um arquivo. Ficou 5,52% mais lento, porque o modelo precisou repetir algumas saídas estruturadas. É uma medição preliminar e vale só para os tokens do modelo local.

Limite: não há sandbox do sistema operacional. Os comandos aprovados herdam a rede e as permissões da máquina, então aprove só comandos em que você confia.

Stack: Python 3.11 ou superior, Git, MCP, Pydantic, httpx, PyYAML e SQLite. Para instalar, veja o Quick start. O projeto adapta, sob licença MIT, o codex-hermes-worker (detalhes em NOTICE).

Related MCP server: cc-delegate

Why

Cloud coding agents are excellent architects and reviewers. They are also an expensive place to repeat file reads, compiler runs, failed tests, and mechanical edits. Forgehand moves that inner loop to your machine and returns a compact receipt with the patch, tests, token usage, and uncertainties.

You → Codex → one task contract → Forgehand → one local model
          ↑                         │
          └──── compact receipt ────┘

Quick start

Requirements: Python 3.11+, Git, Codex, and one local server exposing an OpenAI-compatible /v1/chat/completions endpoint with structured JSON output.

python -m pip install "forgehand-local @ git+https://github.com/JVCSampaio/forgehand.git"
forgehand init
forgehand repo add /path/to/your/repository
forgehand doctor
codex mcp add forgehand -- forgehand mcp

The default example is Ornith 1.5 9B at http://127.0.0.1:1234/v1. Choose any compatible local model during setup:

forgehand init --model your-model-id --worker-name "My local worker" --force

Then ask Codex:

Use Forgehand to update the parser. Only modify src/parser and tests/parser. Require the approved parser tests to pass, inspect the final diff, and review the result. I acknowledge that approved commands inherit host permissions and network.

Codex can call four MCP tools: forgehand_health, forgehand_delegate, forgehand_tasks, and forgehand_result.

Open the private, read-only dashboard at any time:

forgehand dashboard

It binds only to 127.0.0.1, hides full repository paths, and reports measured local-worker usage. It never presents those numbers as estimated Codex savings.

What stays bounded

  • exact Git roots must be registered by the user;

  • every task runs in a detached worktree;

  • the worker can access only declared repository-relative paths;

  • commands are supervisor-provided argv arrays selected by ID, without a shell;

  • host commands require an explicit risk acknowledgement in every task contract;

  • required command IDs must all exit zero before success is accepted;

  • common credential-bearing environment variables and interactive Git prompts are removed;

  • state, observation, output, steps, changed files, and retries have hard limits;

  • repeated commands on an unchanged tree are rejected, and action-rejection budgets stop unproductive local loops early;

  • implementation contracts can set requires_changes=true so an empty diff cannot be reported as success;

  • full logs and diffs stay local; compact receipts return to the supervisor;

  • Codex review is always required before integration.

Forgehand does not provide an OS-level process sandbox. Approved commands still inherit the host network stack and OS permissions, even though they run without a shell and with a scrubbed environment. Only approve commands you trust. See the task contract and security model.

Token evidence

In one same-contract microbenchmark, the original conversational worker loop used 25,826 local-worker tokens. Forgehand used 10,708 — 58.54% fewer — while producing the same one-file change. Forgehand was 5.52% slower in that run because the worker needed several structured-output retries.

This is preliminary local-worker evidence, not a promise of 58.54% Codex, API, credit, cost, or latency savings. See Token accounting.

Design

Forgehand is inspired by the bounded-state execution described in SKILL.state. It adds coding-specific controls: transactional SQLite revisions, typed state operations, deterministic Git facts, scoped tools, worktree isolation, durable artifacts, and per-attempt usage.

History is archived, not attended.

Forgehand deliberately ships without self-evolving skills, multi-model routing, an unrestricted shell, or automatic cloud fallback. Experimental learning belongs in a separate optional project until it demonstrates net savings.

Status

Forgehand is alpha software. Use it on repositories with version control, inspect every patch, and rerun critical validation yourself.

License and attribution

MIT licensed. Forgehand evolved from ideas and MIT-licensed work in RANJIANG23/codex-hermes-worker. See NOTICE for attribution.

Available Tools

4 tools
forgehand_delegateA

Run one complete implementation task with bounded files and commands.

The repository must be registered first. Scope contains the only paths the worker may read or edit. Commands are supervisor-authored argv arrays invoked by ID without a shell, but inherit host permissions and network. Set the risk acknowledgement explicitly whenever commands are present. Required command IDs must all exit zero before the worker can return success.

Inputs: scope (required), objective (required), repository_root (required), acceptance_criteria (required), +10 more. Returns: object

forgehand_healthA
Read-onlyIdempotent

Return active worker, safety limits, registered repositories, and paths.

Inputs: no named parameters. Returns: object

forgehand_resultA
Read-onlyIdempotent

Return one compact task receipt by ID.

Inputs: task_id (required). Returns: object

forgehand_tasksA
Read-onlyIdempotent

List compact receipts for recent tasks without loading raw logs or diffs.

Inputs: limit. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: health reports status, delegate starts execution, tasks lists receipts, and result retrieves one receipt by ID. There is no meaningful overlap or ambiguity between them.

    Naming Consistency4/5

    All tools use the same forgehand_ prefix and snake_case style, but the second segment is inconsistent in form: delegate is a verb while health, tasks, and result are nouns. The pattern is still predictable and readable.

    Tool Count5/5

    Four tools is well-scoped for a focused task-execution server. The set covers status, submission, listing, and retrieval without unnecessary extras or obvious bloat.

    Completeness4/5

    The core submit-to-retrieve workflow is covered along with health/status, but there is no cancellation tool, and repository registration appears to be a prerequisite handled outside the MCP surface. These are minor gaps for a one-shot task runner.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Delegate coding tasks to external AI coding agents in isolated git worktrees with independent verification, enabling any MCP client to orchestrate multi-agent workflows.
      5
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Delegates heavy development tasks from a supervisor to an autonomous worker on a cheaper model via MCP, with isolated git worktrees and provider-agnostic support.
      3
      1
      MIT