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:

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:

  1. 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.
  2. 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 --refresh option 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.


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-0.1.0.tar.gz (272.3 kB view details)

Uploaded Source

Built Distribution

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

forgeoptimizer-0.1.0-py3-none-any.whl (239.8 kB view details)

Uploaded Python 3

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

Hashes for forgeoptimizer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fb19558af1779788ac83703ff979ce6abf07420b9432785e9501e0ceac577728
MD5 f10d7efde0b76c59bd21ed622d6f0685
BLAKE2b-256 34e2b0c841d65f3d09f7255ffd0bf742e447ddfd7881c48ac955df3577d0bcf0

See more details on using hashes here.

Provenance

The following attestation bundles were made for forgeoptimizer-0.1.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-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

Hashes for forgeoptimizer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1b75f2159e1ba876bdaacad0758c7c0db82130928dcaee1cf50caaa07e218eb2
MD5 02c07e246cc598c71ef2228526eb72cd
BLAKE2b-256 0a9b22b03dd78fe6e0cba5886e2196d1c73dc0c19954ee307e5d123c60742d15

See more details on using hashes here.

Provenance

The following attestation bundles were made for forgeoptimizer-0.1.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