Skip to main content

Bounded, auditable AI code patch execution for existing coding agents.

Project description

TokenPatch

Bounded, auditable AI code patch execution for existing coding agents.

tokenpatch.com · Quickstart · Install · Demo evidence

tokenpatch lets Codex, Cursor, Claude Code, CLI agents, and MCP clients keep their configured strong model in charge, then route bounded implementation patches to a cheaper executor such as DeepSeek V4 Pro.

The metric is not just request cost. tokenpatch focuses on cost per applied AI coding patch.

What is TokenPatch?

TokenPatch is an open-source execution layer for small, well-defined AI coding changes. It does not replace your primary coding agent. The primary agent plans and reviews; TokenPatch executes an eligible patch with explicit file boundaries, a recovery checkpoint, patch validation, and task-level cost records.

TokenPatch is best suited to narrow, testable work where allowed files and acceptance criteria can be stated before execution. It is not a generic model proxy, a full observability platform, or a substitute for engineering review.

Canonical product definition: tokenpatch.com/what-is-tokenpatch.

tokenpatch report snapshot

Quick Start

The first public release is BYOK-first. Bring your own DeepSeek API key.

pip install git+https://github.com/Leoyen1/tokenpatch.git
tokenpatch bootstrap

Set executor credentials in your app's MCP environment settings, shell, or ~/.tokenpatch/config.toml:

MMDEV_EXECUTOR_PROVIDER=deepseek_byok
DEEPSEEK_API_KEY=your-deepseek-key
DEEPSEEK_BASE_URL=https://api.deepseek.com
DEEPSEEK_EXECUTOR_MODEL=deepseek-v4-pro

Then ask inside Codex, Claude Code, Cursor, or another coding agent:

tp: change the page title. Only modify index.html.

Check the result:

tokenpatch metrics
tokenpatch report

What You Get

  • Keep using Codex, Claude Code, Cursor, or your own agent.
  • Route bounded implementation work to a lower-cost executor.
  • Check allowed_files before applying patches.
  • Create local recovery checkpoints before AI edits.
  • Report actual executor cost, all-strong baseline estimate, savings ratio, and cost per applied patch.
  • Keep GPT/Claude keys in your existing coding app; tokenpatch only needs executor credentials for App Mode.

Example Report Signal

Task: change page title, only modify index.html
All-strong estimate: $0.42
tokenpatch actual: $0.08
Saved: 81%
Patch applied: yes
Tests: passed

The numbers above are an illustrative demo snapshot, not a universal guarantee. Real savings depend on task size, retries, model pricing, cache behavior, and review strategy.

How It Works

Strong model plans and reviews
        |
        v
tokenpatch creates a bounded executor task
        |
        v
DeepSeek V4 Pro writes the patch
        |
        v
tokenpatch checks allowed_files, applies the patch, and reports cost

Works With

  • Codex App and Codex CLI
  • Claude Code
  • Cursor
  • VS Code / Cline / other MCP-capable agents
  • Terminal workflows and CI

You can ask in any language. The docs, UI labels, metrics, and structured reports are English-first.

TokenPatch and Aider

Aider is an interactive terminal pair programmer. TokenPatch is a bounded execution layer that sits alongside a primary coding agent. Choose Aider for an evolving coding conversation; choose TokenPatch when the requirement and allowed files are already known and you want checkpointed execution plus cost evidence. The tools can also be used together.

See the sourced comparison: TokenPatch vs Aider.

BYOK First, Hosted Credits Later

The open-source client works today with your own DeepSeek API key.

Hosted tokenpatch.com credits are planned later for users who cannot easily get, recharge, or manage a DeepSeek key directly. The hosted path is optional and private beta first. tokenpatch should not be described as an official DeepSeek reseller or as endorsed by DeepSeek.

Docs

Common Commands

tokenpatch bootstrap
tokenpatch do "Implement a small change" --allowed-file path/to/file
tp do "Implement a small change" --allowed-file path/to/file
tokenpatch metrics
tokenpatch report

Advanced commands such as plan, run, validate, review, checkpoint, memory, web, and mcp are documented in the Quickstart and Install Guide.

Compatibility note: legacy mmdev internals remain for older scripts, but the public project name is tokenpatch.

Development

git clone https://github.com/Leoyen1/tokenpatch
cd tokenpatch
python -m pip install -e ".[test,web]"
python -m pytest -q

CI runs unit tests and example tests through GitHub Actions.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tokenpatch-0.1.1.tar.gz (90.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tokenpatch-0.1.1-py3-none-any.whl (83.9 kB view details)

Uploaded Python 3

File details

Details for the file tokenpatch-0.1.1.tar.gz.

File metadata

  • Download URL: tokenpatch-0.1.1.tar.gz
  • Upload date:
  • Size: 90.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for tokenpatch-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c4f321ef530aeca48b7336818cf08a29f3b4e302f74cad360fa8d578db289bca
MD5 c24f21b4cf329f5d9a2b595445b8ca99
BLAKE2b-256 a8b4c4999e5a1078f945c6841f04fe157388e863100957d23c56556497ffca6e

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenpatch-0.1.1.tar.gz:

Publisher: release.yml on Leoyen1/tokenpatch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tokenpatch-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: tokenpatch-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 83.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for tokenpatch-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9c0d70637ce46e463ac87345f962a9d3c0223f433751af74ebb2daea83ddf3b6
MD5 7ae84f91d3b71665ac34b03cfe2c834a
BLAKE2b-256 1b13185483d913f49e006aa6ba3a81beb878764c1e9229d2a854a91c1a1f2428

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenpatch-0.1.1-py3-none-any.whl:

Publisher: release.yml on Leoyen1/tokenpatch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page