Forge is a local-first AI software builder. It turns a structured .forge/spec.md
file into a working codebase through a deterministic task graph, specialist model
routing, API contracts, verification, and policy-controlled file writes.
For teams comparing AI app builders: Forge is an inspectable, local-first alternative to prompt-only generators. It is built around specs, agents, audit logs, model routing, and a small API plane that can be run privately.
The current production-ready MVP focuses on:
- Forge Spec API primitives inside markdown specs
- local model support through Ollama or OpenAI-compatible providers
- role-based model routing for backend, frontend, tester, reviewer, and deploy tasks
- a REST control plane for builds, tasks, contracts, artifacts, models, and events
- deterministic validation before and after model generation
- optional dashboard and durable queued worker mode for the local REST API
Core architecture is implemented and test-green. This is a local-first MVP for technical review and iteration; generated application quality still depends on the configured model.
pytest -q
# expected: all tests pass- Python 3.10+
pip- Optional: Ollama for local-model testing
- Optional: OpenAI/Anthropic/Together credentials for cloud fallback
git clone https://github.com/nebullii/forge
cd forge
python -m pip install -e .For test/development work:
python -m pip install -e ".[dev]"
pytest -qStart Ollama:
ollama servePull at least one modern local model:
ollama pull qwen3:latestRecommended options if your machine can handle them:
ollama pull gpt-oss:20b
ollama pull gemma3:12b
ollama pull llama3.1:8bRun Forge setup or create config manually:
forge setupExample ~/.forge/config.yaml:
providers:
- name: ollama
base_url: http://localhost:11434
model: qwen3:latest
profiles:
primary:
model: qwen3:latest
capabilities: [code, reasoning, local]
coder:
model: qwen3:latest
capabilities: [code, reasoning, local]
reviewer:
model: llama3.1:8b
capabilities: [review, reasoning, local]
model_routing:
planner: ollama:primary
builder: ollama:coder
backend: ollama:coder
frontend: ollama:coder
tester: ollama:coder
test: ollama:coder
ci: ollama:coder
deploy: ollama:coder
reviewer: ollama:reviewer
security: ollama:reviewerCheck readiness:
forge doctor -p ollamaRun the built-in smoke evals. These validate the Spec API parser and task graph compiler without calling a model.
forge eval smoke --scenario crm-basic
forge eval smoke --scenario api-only-crud
forge eval smoke --scenario frontend-contractsArtifacts are written to:
.forge/evals/
Create a project:
forge new freelancer-crm -t web-app
cd freelancer-crmReplace .forge/spec.md with:
# Project: Freelancer CRM
.project
spec_api_version: 0.1
type: web_app
stack: react_fastapi_sqlite
.auth.email_password
sessions: jwt
roles: user
.db.model Client
fields:
name: string required
email: email required
status: enum[lead,active,inactive]
.api.resource clients
model: Client
actions: list, create, update, delete
auth: required
.ui.table client_list
source: GET /api/clients
columns: name, email, status
.ui.form create_client
submit: POST /api/clients
fields: name, email, status
.test.case client_crud
covers: clientsValidate and compile the spec:
forge spec validate
forge spec compile --output .forge/compiled-spec.jsonExpected outputs:
- validation succeeds
.forge/compiled-spec.jsonexists.forge/task-graph.jsonis created duringforge build
Build with a local model:
forge build -p ollama -vRun the generated project:
forge devExport contracts:
forge contracts export --format openapiFrom a Forge project directory:
forge serve --port 4123In another terminal:
curl -s http://127.0.0.1:4123/api/health
curl -s http://127.0.0.1:4123/api/tasks
curl -s http://127.0.0.1:4123/api/models/health
curl -s -X POST http://127.0.0.1:4123/api/builds \
-H 'Content-Type: application/json' \
-d '{"provider":"ollama","no_review":true}'
curl -s http://127.0.0.1:4123/api/builds
curl -s http://127.0.0.1:4123/api/eventsEvent stream:
curl -N http://127.0.0.1:4123/api/events/stream?once=trueRun a specific task:
curl -s -X POST http://127.0.0.1:4123/api/tasks/backend.clients/run \
-H 'Content-Type: application/json' \
-d '{"provider":"ollama","no_review":true}'Retry a failed task:
curl -s -X POST http://127.0.0.1:4123/api/tasks/backend.clients/retry \
-H 'Content-Type: application/json' \
-d '{"provider":"ollama","no_review":true}'Use this when explaining Forge to teams evaluating AI software builders:
Forge is a local-first agentic software builder. A developer writes a spec, Forge compiles it into a task graph, then specialist agents generate, verify, and audit the project. It supports private Ollama models, OpenAI-compatible providers, guarded file writes, resumable state, and a REST/API plane for builds, tasks, contracts, artifacts, models, and events.
Forge is strongest when the buyer cares about:
- private or local model execution
- auditable agent behavior
- spec-driven project generation
- enterprise controls around file writes and model routing
- API access instead of a closed app-only workflow
Spec API primitives are structured directives inside .forge/spec.md.
Supported MVP primitives:
.project.auth.email_password.db.model.api.resource.ui.page.ui.table.ui.form.test.case.deploy.target
Rules:
spec_api_versiondefaults to0.1..api.resource actionsmust use supported actions:list,get,create,update,delete..ui.table sourcemust look likeGET /api/resource..ui.form submitmust use a write method likePOST /api/resource..db.modelfields use supported types likestring,email,integer,boolean,money,json, orenum[...].
More detail: docs/spec-api.md
.forge/spec.md
-> Spec API parser
-> deterministic task graph
-> specialist model routing
-> structured agent output contract
-> artifact bus and contract registry
-> firewall-checked writes
-> review and deterministic verification
-> build state, events, audit logs
Spec API builds skip the broad LLM planning step. Forge compiles primitives into tasks locally, then routes each task to the configured role model.
Spec API tasks require models to return JSON:
{
"status": "success",
"files": [
{
"path": "relative/path",
"content": "complete file contents"
}
],
"contracts": {
"api": [],
"models": [],
"events": []
},
"uses_contracts": [],
"notes": [],
"requires": []
}Backend tasks must include at least one API, model, or event contract.
Inside generated projects:
.forge/spec.md Product spec and Spec API primitives
.forge/rules.md Build rules
.forge/policy.yaml Policy and approval settings
.forge/task-graph.json Compiled Spec API task graph
.forge/build-state.yaml Resumable build state
.forge/contracts.json Persisted contracts
.forge/openapi.json Optional OpenAPI export
.forge/build_audit.jsonl Build audit log
.forge/control_audit.jsonl REST control-plane audit log
.forge/verification.json Verification report
forge new <name> [-t template]
forge templates
forge setup
forge doctor [-p provider]
forge spec validate
forge spec compile [-o output.json]
forge build [-p provider] [--model model] [-v]
forge build --feature "add feature"
forge dev
forge contracts export --format openapi
forge serve --port 4123
forge serve --port 4123 --ui
forge worker --once
forge eval smoke --scenario crm-basicCheck that Ollama is running:
ollama serve
ollama listIf no model is installed:
ollama pull qwen3:latestRun:
forge spec validateCommon issues:
- unsupported primitive name
.api.resourcereferences a model that does not exist- invalid endpoint format, such as
clientsinstead ofGET /api/clients - unsupported field type
- unsupported
spec_api_version
Spec API tasks require structured JSON. If a model returns markdown fences or
prose, use a stronger code model or lower-temperature local model. For Ollama,
prefer qwen3:latest, gpt-oss:20b, gemma3:12b, or another current
code-capable model available on your machine.
REST task execution respects dependencies. For example, frontend tasks wait for backend tasks because they need API contracts.
Check tasks:
curl -s http://127.0.0.1:4123/api/tasksExport and inspect contracts:
forge contracts export --format openapi
cat .forge/openapi.jsonFrontend calls must match backend contracts exactly.
Run all tests:
pytest -qRun focused tests:
pytest tests/test_specapi.py tests/test_orchestrator.py tests/test_agent_contracts.py -q- Spec API versions
0.1and0.2are accepted;0.2is currently forward-compatible with0.1. - Local model quality still matters.
- Non-Spec API builds still support the legacy planner-first path.
- REST jobs run in-process by default; pass
{"queue": true}to the REST API and runforge workerfor durable local worker execution. - SSE is available for event streaming, and
forge serve --uiserves a local dashboard.
For a concise architecture and readiness summary, see docs/review-brief.md.
MIT