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:
Development:
uv tool install .
Release:
uv tool install forgectx
The command is forge.
Convenience Wrappers vs. Core MCP Runtime
Forge provides two primary interfaces to connect with your AI coding tools:
- Convenience Wrappers (
forge claude,forge cursor, etc.): Commands that automatically prepare/optimize context, update local and global configurations, and launch the target AI CLI under an optimized environment. - Core MCP Runtime (
forge mcp): The standard Model Context Protocol (MCP) interface that compatible AI clients communicate with over stdio.
Commands
| Command | Type | Description |
|---|---|---|
forge claude |
Wrapper | Launch Claude Code with optimized context and auto-registered MCP |
forge codex |
Wrapper | Launch Codex CLI with optimized context and auto-registered MCP |
forge cursor |
Wrapper | Launch Cursor CLI with optimized context and auto-registered MCP |
forge opencode |
Wrapper | Launch OpenCode CLI with optimized context and auto-registered MCP |
forge commandcode |
Wrapper | Launch CommandCode CLI with optimized context and auto-registered MCP |
forge antigravity |
Wrapper | Launch Antigravity CLI with optimized context and auto-registered MCP |
forge mcp |
Core Runtime | Start the stdio Model Context Protocol (MCP) server |
forge start |
Daemon | Start the background context optimization daemon |
forge graph build |
Tool | Build a full knowledge graph via Graphify (optional) |
forge --version |
Tool | Show version |
[!NOTE] When launching convenience wrappers, prompts or extra positional arguments are not supported directly (e.g.
forge claude "some prompt"is blocked). Run the wrapper command without arguments to launch the tool's interactive session directly. Use the--refreshoption to bypass the cache:forge claude --refresh
Model Context Protocol (MCP) Integration
Forge automatically registers its MCP server globally and project-locally for launched clients (updating ~/.claude.json, ~/.cursor/mcp.json, and project .mcp.json files).
Exposed Tools
Forge exposes the following schema tools over MCP:
get_optimized_context— Retrieve the fully optimized and token-compressed repository context.get_summary— Retrieve a summary of the repository layout, size, and file list.get_dependency_graph— Retrieve module/file import relationships.file_lookup— Query individual file contents.symbol_lookup— Find definition locations of symbols (classes/functions).semantic_search— Keyword/phrase search across codebase chunks.
[!IMPORTANT] Client Behavior Notice: While Forge exposes these tools to the MCP client, whether and when they are invoked depends entirely on the AI client's internal orchestration logic. Forge makes these capabilities available, but the client decides which tool to call.
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/Forge
cd Forge
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 v0.1.0
git push origin v0.1.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-0.1.0.tar.gz.
File metadata
- Download URL: forgeoptimizer-0.1.0.tar.gz
- Upload date:
- Size: 272.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb19558af1779788ac83703ff979ce6abf07420b9432785e9501e0ceac577728
|
|
| MD5 |
f10d7efde0b76c59bd21ed622d6f0685
|
|
| BLAKE2b-256 |
34e2b0c841d65f3d09f7255ffd0bf742e447ddfd7881c48ac955df3577d0bcf0
|
Provenance
The following attestation bundles were made for forgeoptimizer-0.1.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-0.1.0.tar.gz -
Subject digest:
fb19558af1779788ac83703ff979ce6abf07420b9432785e9501e0ceac577728 - Sigstore transparency entry: 2082008056
- Sigstore integration time:
-
Permalink:
mdshzb04/Forge@6daeaaef2ca1162525e7b1b2692e6b94b7380226 -
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@6daeaaef2ca1162525e7b1b2692e6b94b7380226 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file forgeoptimizer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: forgeoptimizer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 239.8 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 |
1b75f2159e1ba876bdaacad0758c7c0db82130928dcaee1cf50caaa07e218eb2
|
|
| MD5 |
02c07e246cc598c71ef2228526eb72cd
|
|
| BLAKE2b-256 |
0a9b22b03dd78fe6e0cba5886e2196d1c73dc0c19954ee307e5d123c60742d15
|
Provenance
The following attestation bundles were made for forgeoptimizer-0.1.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-0.1.0-py3-none-any.whl -
Subject digest:
1b75f2159e1ba876bdaacad0758c7c0db82130928dcaee1cf50caaa07e218eb2 - Sigstore transparency entry: 2082008059
- Sigstore integration time:
-
Permalink:
mdshzb04/Forge@6daeaaef2ca1162525e7b1b2692e6b94b7380226 -
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@6daeaaef2ca1162525e7b1b2692e6b94b7380226 -
Trigger Event:
workflow_dispatch
-
Statement type: