Forge — AI optimization runtime. Fast prompt and token optimization for Claude Code, Codex, Cursor, OpenCode, and CommandCode CLI.
Project description
Forge
Forge is an AI optimization runtime. It prepares your repository context at light speed — prompt optimization and token compression — then launches the AI CLI you already use.
Install:
uv tool install forgectx
The command is forge.
What it does
When you run forge claude, forge codex, forge cursor, forge opencode, or forge commandcode, Forge:
- Detects your git repository (or current directory)
- Builds a shallow repo snapshot — it does not index your whole codebase
- Runs prompt optimization (Ponytail ruleset) and token compression
- Reuses cached results when nothing important changed
- Launches the selected CLI with
FORGE_CONTEXTandFORGE_CONTEXT_FILEset
Wrappers feel instant because Forge skips full graph builds during normal use.
Commands
| Command | Description |
|---|---|
forge claude |
Launch Claude Code with optimized context |
forge codex |
Launch Codex CLI with optimized context |
forge cursor |
Launch Cursor CLI with optimized context |
forge opencode |
Launch OpenCode CLI with optimized context |
forge commandcode |
Launch CommandCode CLI with optimized context |
forge graph build |
Optionally build a full knowledge graph via Graphify |
forge --version |
Show version |
Pass through any flags your CLI supports:
forge claude -- "fix the failing test in tests/test_foo.py"
forge codex --help
forge cursor --refresh
Use --refresh to bypass Forge's context cache.
Optional: knowledge graph
If you want a full codebase knowledge graph (separate from the fast wrapper path):
uv tool install graphifyy
forge graph build
Graphify runs only when you ask for it — not on every forge claude / codex / cursor invocation.
Environment variables
Wrappers export:
| Variable | Purpose |
|---|---|
FORGE_CONTEXT |
Optimized text context |
FORGE_CONTEXT_FILE |
Path to the optimized context file |
FORGE_REPO_ROOT |
Detected repository root |
Development
git clone https://github.com/mdshzb04/ForgeCli
cd ForgeCli
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest
ruff check forgecli tests
Release
Push a version tag to publish to TestPyPI and PyPI:
git tag v1.0.0
git push origin v1.0.0
Publish jobs run only on v* tags. On regular pushes to main, those jobs show as Skipped — that is expected, not a failure.
Configure GitHub environments testpypi and pypi with PyPI trusted publishing for package name forgectx.
License
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 forgeoptimizer-1.0.0.tar.gz.
File metadata
- Download URL: forgeoptimizer-1.0.0.tar.gz
- Upload date:
- Size: 248.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7474646706aed203ad7c77010d06ac0f10d3938897b8f69a4f5053beee1c3f9d
|
|
| MD5 |
78bcbee9e24bd9e005733d15c565f945
|
|
| BLAKE2b-256 |
6141cc66585ab956c4667ae3352339aa8e94603b28bd9ca6224c3884be61c158
|
Provenance
The following attestation bundles were made for forgeoptimizer-1.0.0.tar.gz:
Publisher:
ci.yml on mdshzb04/Forge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
forgeoptimizer-1.0.0.tar.gz -
Subject digest:
7474646706aed203ad7c77010d06ac0f10d3938897b8f69a4f5053beee1c3f9d - Sigstore transparency entry: 2071583198
- Sigstore integration time:
-
Permalink:
mdshzb04/Forge@5ca3ef9393de055c3316d12d340c8158ff6b56ca -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mdshzb04
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@5ca3ef9393de055c3316d12d340c8158ff6b56ca -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file forgeoptimizer-1.0.0-py3-none-any.whl.
File metadata
- Download URL: forgeoptimizer-1.0.0-py3-none-any.whl
- Upload date:
- Size: 229.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1689dd7305625e3e6054caff3b395696fbd20edbaaa749a0405d420e0287d784
|
|
| MD5 |
020d5bcd2b1600c89af648a7aa210cf2
|
|
| BLAKE2b-256 |
b19a1545d9bd320f9ed19d891e8884042eaefd1089aa4e9fbe43075ef9fec5f5
|
Provenance
The following attestation bundles were made for forgeoptimizer-1.0.0-py3-none-any.whl:
Publisher:
ci.yml on mdshzb04/Forge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
forgeoptimizer-1.0.0-py3-none-any.whl -
Subject digest:
1689dd7305625e3e6054caff3b395696fbd20edbaaa749a0405d420e0287d784 - Sigstore transparency entry: 2071583224
- Sigstore integration time:
-
Permalink:
mdshzb04/Forge@5ca3ef9393de055c3316d12d340c8158ff6b56ca -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mdshzb04
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@5ca3ef9393de055c3316d12d340c8158ff6b56ca -
Trigger Event:
workflow_dispatch
-
Statement type: