Skip to main content

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:

  1. Detects your git repository (or current directory)
  2. Builds a shallow repo snapshot — it does not index your whole codebase
  3. Runs prompt optimization (Ponytail ruleset) and token compression
  4. Reuses cached results when nothing important changed
  5. Launches the selected CLI with FORGE_CONTEXT and FORGE_CONTEXT_FILE set

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.


image image

License

MIT

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

forgeoptimizer-1.0.0.tar.gz (248.4 kB view details)

Uploaded Source

Built Distribution

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

forgeoptimizer-1.0.0-py3-none-any.whl (229.0 kB view details)

Uploaded Python 3

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

Hashes for forgeoptimizer-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7474646706aed203ad7c77010d06ac0f10d3938897b8f69a4f5053beee1c3f9d
MD5 78bcbee9e24bd9e005733d15c565f945
BLAKE2b-256 6141cc66585ab956c4667ae3352339aa8e94603b28bd9ca6224c3884be61c158

See more details on using hashes here.

Provenance

The following attestation bundles were made for forgeoptimizer-1.0.0.tar.gz:

Publisher: ci.yml on mdshzb04/Forge

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

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

Hashes for forgeoptimizer-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1689dd7305625e3e6054caff3b395696fbd20edbaaa749a0405d420e0287d784
MD5 020d5bcd2b1600c89af648a7aa210cf2
BLAKE2b-256 b19a1545d9bd320f9ed19d891e8884042eaefd1089aa4e9fbe43075ef9fec5f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for forgeoptimizer-1.0.0-py3-none-any.whl:

Publisher: ci.yml on mdshzb04/Forge

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