Skip to main content

Autonomous AI build system. Describe what you want. Belief builds it, tests it, deploys it, and learns.

Project description

๐Ÿง  Belief Engine v2.0

An autonomous AI system that turns a sentence into deployed software.

Describe what you want. Belief Engine builds it, tests it, deploys it, and learns from every build.

python3 -m belief.cli \
  --goal "Build a bookmark manager API with FastAPI โ€” CRUD with tags, GET /random. SQLite." \
  --deploy docker_local \
  --deploy-name bookmarks

# 240 seconds later โ†’ http://localhost:8000

How It Works

You: "Build a todo app with Click"
  โ†“
11 AI agents collaborate in a convergence loop:
  intake โ†’ research โ†’ planner โ†’ architect โ†’ skeleton โ†’ builder
  โ†’ covenant enforce โ†’ import fix โ†’ tester โ†’ executor โ†’ debugger
  โ†’ synthesizer โ†’ validator (real pytest) โ†’ water cycle โ†’ deploy
  โ†“
Working software, tested, Dockerized, deployed.

The engine doesn't just generate code โ€” it builds, tests, debugs, deploys, and learns. Every build deposits knowledge into ChromaDB soil. Patterns from successes, antipatterns from failures, and covenants from repeated mistakes feed future builds. Build 51 is smarter than build 1.

Key Numbers

Metric Value
Files 74 Python files
Lines ~18,650
Builds completed 51+
Nutrients learned 135+
Covenants self-learned 7
Cost per build $0.18 (was $0.87)
Build time ~240s
LLM calls in validator 0 (fully deterministic)

What Makes This Different

It Learns From Every Build

ChromaDB-backed metabolization. Patterns, antipatterns, skeletons, and covenants accumulate in "soil" with FSRS confidence decay. Nutrients that aren't reinforced fade. The system forgets what it doesn't use.

Incompleteness Drives Convergence

Latios finds what's missing. Latias protects what matters. The tension between them drives builds forward โ€” the "remainder" after each operation seeds the next.

Covenants Are Structural, Not Suggestions

Self-learned rules enforced via AST validators โ€” not prompt injection. When the engine learned that from __future__ import annotations breaks SQLAlchemy's Mapped types, it didn't just add a note. It added a deterministic AST check that removes the offending line automatically. Zero LLM tokens. Permanent fix.

Real Tests, Not Imagination

The validator runs actual pytest in a sandbox. Real pass/fail. Real error messages. Weighted scoring: smoke tests = 3x weight, functional = 2x, edge cases = 1x, environment errors (missing deps) = 0x.

Skeleton-First Architecture

Typed interfaces generated deterministically before any implementation. Models โ†’ ABCs โ†’ implementations โ†’ servers. Parallel generation within each dependency level.

SEED Self-Improvement

Every 5 builds, the engine analyzes its own failure patterns and proposes improvements to its own agents. Propose-only mode โ€” human approval required.

Architecture

belief/
  agents/          โ€” 11+ LangGraph agents (intake โ†’ validator)
  validators/      โ€” AST covenant enforcers (deterministic, zero LLM)
  memory/          โ€” ChromaDB metabolization (nutrients, soil, decay)
  refinement/      โ€” Water cycle (analyze โ†’ fix โ†’ revalidate)
  deploy/          โ€” Docker + Railway deployment + health monitoring
  codebase/        โ€” Brownfield support (Agentless localization, patcher)
  languages/       โ€” Multi-language (Python, TypeScript adapters)
  evolution/       โ€” SEED self-improvement engine
  polarity/        โ€” Latios/Latias incompleteness engine
  models/          โ€” Pydantic models (state, artifacts, skeleton, contracts)
  hardening.py     โ€” Budget limits, rate limiter, security scanner, audit log
  graph.py         โ€” LangGraph pipeline wiring
  llm.py           โ€” Anthropic API client with prompt caching + JSON repair

Quick Start

git clone https://github.com/metafiopy-tech/belief-engine.git
cd belief-engine
pip install -e ".[dev]"
cp .env.example .env   # Add your ANTHROPIC_API_KEY

# Build something
python3 -m belief.cli --goal "Build a URL shortener with FastAPI and SQLite"

# Build + deploy
python3 -m belief.cli --goal "Build a REST API" --deploy docker_local --deploy-name myapi

# Check what the engine has learned
python3 -c "
from belief.memory.soil import Soil
from pathlib import Path
soil = Soil(Path('~/.belief-engine/soil'))
print(f'Nutrients: {soil.count()}')
print(f'By type: {soil.count_by_type()}')
"

The 7 Optimization Moves

The engine went through a research-driven optimization cycle that cut costs 55% and improved quality:

Move What Impact
1 Real pytest validator Accurate verdicts from execution, not LLM guessing
2 AST covenant enforcers SQLAlchemy bugs die permanently โ€” deterministic fixes
3 Prompt caching + Haiku routing $0.42 โ†’ $0.18 per build (55% reduction)
4 Repo map in tester/debugger Phantom imports eliminated โ€” tests import real modules
5 Contract-first generation API contracts are source of truth for code AND tests
6 Architect/editor debugger Sonnet diagnoses across all files, Haiku applies fixes
7 Safety infrastructure Resource limits, audit logging, SEED approval gates

Build Tiers

Tier Description Status
1 Single file scripts โœ…
2 MCP servers, simple APIs โœ…
3 Package-structured apps (6-15 files) โœ…
4 Multi-component systems โœ…
5 Distributed microservices โœ…
6 Multi-language (Python + TypeScript) โœ…
7 Extend existing codebases โœ…
8 Autonomous deploy + monitor + heal โœ…

The Food Chain

Every build decomposes its results into atomic nutrients:

Soil โ†’ Plant โ†’ Caterpillar โ†’ Bird โ†’ Soil
Build 1 โ†’ Nutrients โ†’ Build 2 โ†’ More Nutrients โ†’ Build 3 โ†’ ...
Nothing is lost. Everything is transformed.
  • Patterns โ€” what worked (verified by passing builds)
  • Antipatterns โ€” what failed and why (linked to concrete errors)
  • Skeletons โ€” file structures that produced clean code
  • Covenants โ€” immutable rules from repeated failures (currently 7)

Deploy CLI

# List previous builds
python3 -m belief.deploy --list

# Deploy a specific build
python3 -m belief.deploy --target docker_local --name myapp

# Health check
python3 -m belief.deploy --health http://localhost:8000

Tech Stack

  • Python 3.14 on macOS Apple Silicon
  • LangGraph for agent orchestration
  • Anthropic Claude (Sonnet 4.6 for reasoning, Haiku 4.5 for mechanical tasks)
  • ChromaDB for metabolization memory
  • Docker for deployment
  • Railway for cloud deployment (optional)

Model Routing

Agent Model Role
Research, Planner, Architect, Builder, Debugger Sonnet 4.6 Deep reasoning
Intake, Tester, Gap Analyst, Synthesizer, Validator, Latios, Executor Haiku 4.5 Mechanical tasks
Skeleton, Covenant Enforcer, Import Fix, Validator (core) None Deterministic (zero tokens)

Prompt caching provides 90% savings on repeated system prompts. Combined with Haiku routing, builds cost $0.15-0.25 compared to $0.87 before optimization.

License

MIT

Author

Built by Fio

"90% of anything buildable already exists as composable pieces. The intelligence is in finding, routing, and stitching โ€” not generating."

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

belief_engine-2.2.1.tar.gz (200.6 kB view details)

Uploaded Source

Built Distribution

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

belief_engine-2.2.1-py3-none-any.whl (237.0 kB view details)

Uploaded Python 3

File details

Details for the file belief_engine-2.2.1.tar.gz.

File metadata

  • Download URL: belief_engine-2.2.1.tar.gz
  • Upload date:
  • Size: 200.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for belief_engine-2.2.1.tar.gz
Algorithm Hash digest
SHA256 07e1fb8d9fc2dd1482091ad45dc4e2f3abedb4d7fbeeb7f2487b869af8f6e74a
MD5 4dd372df7f7df77b8c3a5b779189f57f
BLAKE2b-256 1fee69b760116edabe81f9430b820969677ec70ebf24f53e5e2de90d44b03c03

See more details on using hashes here.

File details

Details for the file belief_engine-2.2.1-py3-none-any.whl.

File metadata

  • Download URL: belief_engine-2.2.1-py3-none-any.whl
  • Upload date:
  • Size: 237.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for belief_engine-2.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b2a4142b1be2b7f4ceab30629dc3bd12e4e56a14bb949433af2df550421fbf30
MD5 652a1dd1d69496c7e5523e575a4ee07e
BLAKE2b-256 c0f5ac6758de07641a96204c7095ec4462bee6374844071cecc228437e0aa4da

See more details on using hashes here.

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