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.
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_filesbefore 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
- Quickstart
- Install Guide
- Demo Evidence
- FAQ
- MCP Client Setup
- Integration Guide
- Savings Estimates
- GitHub Publication Review
- Public Release Manifest
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4f321ef530aeca48b7336818cf08a29f3b4e302f74cad360fa8d578db289bca
|
|
| MD5 |
c24f21b4cf329f5d9a2b595445b8ca99
|
|
| BLAKE2b-256 |
a8b4c4999e5a1078f945c6841f04fe157388e863100957d23c56556497ffca6e
|
Provenance
The following attestation bundles were made for tokenpatch-0.1.1.tar.gz:
Publisher:
release.yml on Leoyen1/tokenpatch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tokenpatch-0.1.1.tar.gz -
Subject digest:
c4f321ef530aeca48b7336818cf08a29f3b4e302f74cad360fa8d578db289bca - Sigstore transparency entry: 2332645988
- Sigstore integration time:
-
Permalink:
Leoyen1/tokenpatch@c55f7f380cd5f6455f1bd292d91f45a143fe6ec7 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Leoyen1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c55f7f380cd5f6455f1bd292d91f45a143fe6ec7 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c0d70637ce46e463ac87345f962a9d3c0223f433751af74ebb2daea83ddf3b6
|
|
| MD5 |
7ae84f91d3b71665ac34b03cfe2c834a
|
|
| BLAKE2b-256 |
1b13185483d913f49e006aa6ba3a81beb878764c1e9229d2a854a91c1a1f2428
|
Provenance
The following attestation bundles were made for tokenpatch-0.1.1-py3-none-any.whl:
Publisher:
release.yml on Leoyen1/tokenpatch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tokenpatch-0.1.1-py3-none-any.whl -
Subject digest:
9c0d70637ce46e463ac87345f962a9d3c0223f433751af74ebb2daea83ddf3b6 - Sigstore transparency entry: 2332646046
- Sigstore integration time:
-
Permalink:
Leoyen1/tokenpatch@c55f7f380cd5f6455f1bd292d91f45a143fe6ec7 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Leoyen1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c55f7f380cd5f6455f1bd292d91f45a143fe6ec7 -
Trigger Event:
push
-
Statement type: