FORGE, a terminal AI harness engine for coding-agent workflows.
Project description
FORGE Engine
FORGE is a terminal-based AI coding-agent harness that lets LLMs autonomously work on software tasks inside a sandboxed environment. It gives the model a fixed set of tools — read, write, list, and run commands — then independently verifies completion rather than trusting the model's own claim.
Works with any OpenAI-compatible API (OpenRouter, Ollama, local LLMs, etc.).
Available on PyPI: forge-engine
Installation
pip install forge-engine
Launch from any terminal:
forge
Quick Start
# Set your API key (defaults to OpenRouter)
export OPENROUTER_API_KEY="your-api-key"
# Launch interactive mode
forge
# Or run a one-shot task with verification
forge --task "Fix the bug in calc.py" --verify pytest
Using a Local Model
forge --base-url http://localhost:11434/v1 --model qwen2.5-coder:7b
Features
- Sandboxed Execution — Confines all file and command operations to a project directory. Blocks path traversal and absolute paths.
- Independent Verification — Runs
pytest,npm test, or any command to confirm the model's work is correct. The model cannot bypass verification. - Agentic Loop — Up to 40 turns per task. The model iteratively reads, writes, runs commands, and decides when it's done.
- Interactive CLI — Rich terminal UI with live streaming, code diffs, and slash commands for managing sessions.
- Session Persistence — Saves sandbox root, verification command, and model selection per project.
- One-Shot Mode — Scriptable single-task execution with
--taskand--verifyflags. - Model Agnostic — Works with any OpenAI-compatible API: OpenRouter, Ollama, vLLM, or any custom endpoint.
Slash Commands
| Command | Behavior |
|---|---|
/cwd <path> |
Change the active sandbox root to <path> |
/verify <command> |
Set the verification command (pytest, npm test, etc.) |
/model <name> |
Swap the LLM model without restarting |
/new-react <name> |
Scaffold a Vite React app with one command |
/clear |
Reset the session transcript (keeps settings) |
/help |
List all commands |
/exit or /quit |
Exit cleanly |
Architecture
┌─────────────────────────────────────────────────────┐
│ forge CLI │
│ (interactive / one-shot mode) │
└──────────┬──────────────────────────┬───────────────┘
│ │
┌──────▼──────┐ ┌───────▼────────┐
│ Orchestrator │ │ Sandbox │
│ (agent loop) │◄────────►│ (filesystem │
│ │ │ + commands) │
└──────┬───────┘ └────────────────┘
│
┌──────▼───────┐
│ LLM Client │────► OpenAI-compatible API
│ (transcript)│ (OpenRouter / Ollama / etc.)
└──────────────┘
| Module | Responsibility |
|---|---|
harness/orchestrator.py |
Agentic loop — manages turns, tool calls, guardrails |
harness/tools.py |
Tool definitions and dispatch (read, write, list, run, complete) |
harness/sandbox.py |
Path and command confinement to a project root |
harness/transcript.py |
Conversation history — compaction, trimming, metadata |
harness/verifier.py |
Runs a verification command and reports pass/fail |
harness/llm_client.py |
OpenAI-compatible chat-completions HTTP client |
harness/cli.py |
Interactive terminal UI with rich rendering |
harness/session.py |
Persists session state to .qwenagent-session.json |
Verification Flow
- Model calls
task_complete→ harness doesn't trust it - Verifier runs the configured command (
pytest,npm test, etc.) - If verification passes → task is accepted
- If verification fails → model gets the failure output and can try again
- If no verification command is set → auto-detects
pytest/npm test/make test, or prompts you
Development
# Clone and install in editable mode
git clone https://github.com/Devakesavan/Forge-Engine.git
cd Forge-Engine
pip install -e .[test]
# Run tests
python3 -m pytest -q
Contributing
Contributions are welcome. Please keep changes focused on one behavior at a time and ensure tests pass:
pip install -e .[test]
python3 -m pytest -q
License
MIT License — see LICENSE for details.
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 forge_engine-0.1.1.tar.gz.
File metadata
- Download URL: forge_engine-0.1.1.tar.gz
- Upload date:
- Size: 17.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad796a5ee3dd51faace85b7310f9bae6310e9b748b38bd72c20eb18454875e0b
|
|
| MD5 |
c9e53e3f1ca53baf06b28d04104ff28f
|
|
| BLAKE2b-256 |
df1b1c62975688c26b51f992ea44940271172f42f54acd78878b010315f4b220
|
File details
Details for the file forge_engine-0.1.1-py3-none-any.whl.
File metadata
- Download URL: forge_engine-0.1.1-py3-none-any.whl
- Upload date:
- Size: 21.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d2629472201eed8252c2311a24ec0a3477a22163a9b56dc06949aaf5b24f037
|
|
| MD5 |
00b0178c4db0dd9fc61acac1dac3d6cb
|
|
| BLAKE2b-256 |
1b0241df113562cde5723f7f62ba8efc276c0eb7191222bc0e39184d8ead7f8b
|