The AI That Builds Itself: Recursive Claude Spawning via Meta-MCP
Project description
Context Foundry
"Generate probabilistically, validate deterministically."
Autonomous AI development platform that spawns fresh Claude instances to research, design, build, test, and deploy complete software projects. Walk away and come back to production-ready code.
Version 2.5.0 | Quick Start | Documentation | Features
What is Context Foundry?
Context Foundry is an autonomous development platform with three main components:
| Component | Description |
|---|---|
| MCP Server | Model Context Protocol server that exposes build tools to Claude Code |
| Daemon (cfd) | Background service managing build queues, resource limits, and process monitoring |
| CLI Tools | Terminal interface for monitoring builds and managing the system |
Unlike traditional AI coding assistants that require constant supervision, Context Foundry runs complete build pipelines autonomously:
You: "Build a weather dashboard with React"
[Walk away for 10 minutes]
Result: Complete app deployed to GitHub, tests passing
Core Philosophy
Context Foundry combines probabilistic AI generation with deterministic validation:
- Probabilistic: AI agents generate code freely using their full capabilities
- Deterministic: Code-level validators verify outputs, checksums detect unauthorized changes, phase contracts enforce handoffs
This hybrid approach makes autonomous operation reliable. See Architecture for details.
Key Features
Build Pipeline
| Feature | Description |
|---|---|
| 8-Phase Workflow | Scout -> Architect -> Builder -> Test -> Docs -> Deploy -> Feedback |
| Self-Healing Tests | Automatically fixes test failures through redesign/rebuild cycles |
| Parallel Execution | AI decides when to spawn parallel agents for faster builds |
| Incremental Builds | Smart change detection rebuilds only what changed |
Pattern Learning
| Feature | Description |
|---|---|
| Context Codex | SQLite database tracking issues, solutions, and build metrics |
| Skills Library | Reusable code implementations with success rate tracking |
Infrastructure
| Feature | Description |
|---|---|
| Daemon Service | Background process with task queue, resource limits, watchdog |
| Mission Control TUI | Terminal interface for real-time build monitoring |
| BAML Type Safety | Structured JSON outputs with schema validation |
| Deterministic Enforcement | Post-phase validators, checksum verification, state machine |
Extensions
Extensions let you specialize Context Foundry for specific domains. Think of them as giving the AI a business case, architectural blueprints, and success criteria before asking it to build something complex.
Create an extension by adding domain-specific patterns, example implementations, and validation rules to extensions/<your-domain>/. The AI will reference these during builds to produce domain-appropriate solutions.
Architecture
Context Foundry
┌─────────────────────────────────────────────────────────────────┐
│ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ MCP Server │ │ Daemon │ │ CLI / TUI │ │
│ │ │ │ (cfd) │ │ │ │
│ │ - Build API │ │ - Queue │ │ - Monitor │ │
│ │ - Patterns │ │ - Watchdog │ │ - Dashboard │ │
│ │ - Skills │ │ - Resources │ │ - Logs │ │
│ └──────┬──────┘ └──────┬──────┘ └─────────────┘ │
│ │ │ │
│ └────────┬─────────┘ │
│ │ │
│ ┌────────▼────────┐ │
│ │ Phase Executor │ │
│ │ │ │
│ │ Scout ──────────┼──▶ scout_report.json │
│ │ Architect ──────┼──▶ architecture.json │
│ │ Builder ────────┼──▶ source code │
│ │ Test ───────────┼──▶ test-report.md │
│ │ Deploy ─────────┼──▶ GitHub repo │
│ └────────┬────────┘ │
│ │ │
│ ┌────────▼────────┐ │
│ │ Validators │ ◀── Deterministic Enforcement │
│ │ │ │
│ │ - File checks │ │
│ │ - Checksums │ │
│ │ - BAML schemas │ │
│ └─────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
Each phase spawns a fresh Claude instance with isolated context, preventing token bloat and ensuring consistent quality across long builds.
Quick Start
1. Install
npm install -g context-foundry
This installs the package and automatically configures Claude Code. (Alternative: pip install context-foundry && cf setup)
2. Build Something
In Claude Code, just ask in natural language:
"Use CF to build a weather dashboard with React"
Walk away. Come back to deployed code on GitHub.
See Quick Start Guide for detailed setup instructions.
CLI Tools
Mission Control TUI
cf # Launch interactive terminal UI
Daemon Management
cfd start # Start the daemon
cfd status # Check status
cfd logs <job-id> # View build logs
cfd list # List active builds
cfd stop # Stop the daemon
MCP Tools Available
| Tool | Description |
|---|---|
autonomous_build_and_deploy |
Full build pipeline: research -> design -> build -> test -> deploy |
delegate_to_claude_code |
Spawn fresh Claude instance for subtasks |
delegate_to_claude_code_async |
Non-blocking delegation with progress tracking |
search_skills |
Find reusable code implementations |
save_skill |
Save successful implementation as reusable skill |
create_evolution_task |
Create self-improvement task |
get_daemon_status |
Check daemon health and resource usage |
See MCP Tools Reference for complete documentation.
Documentation
| Guide | Description |
|---|---|
| Quick Start | Get running in 5 minutes |
| User Guide | Detailed usage instructions |
| Architecture | How it works under the hood |
| Features | Complete feature reference |
| Innovations | Technical breakthroughs explained |
| Phase Handoff Flow | Inter-phase data contracts |
| Troubleshooting | Common issues and fixes |
| FAQ | Frequently asked questions |
File Structure
context-foundry/
├── tools/
│ ├── mcp_server.py # MCP server entry point
│ ├── mcp_utils/ # Build orchestration, delegation, patterns
│ ├── prompts/phases/ # Phase-specific system prompts
│ ├── evolution/ # Daemon, self-improvement, safety
│ ├── cli.py # Main CLI (cf command)
│ └── cfd # Daemon CLI script
├── extensions/ # Domain-specific extensions
├── npm/ # npm package wrapper
├── docs/ # Documentation
└── CLAUDE.md # Instructions for AI agents
Contributing
We welcome contributions. See Contributing Guide for details.
License
MIT License. See LICENSE for details.
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
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 context_foundry-2.5.3.tar.gz.
File metadata
- Download URL: context_foundry-2.5.3.tar.gz
- Upload date:
- Size: 670.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8da43bca025552545b76a54d84c12e1064029ddc9ad6eefd89dd5ec4b6609efa
|
|
| MD5 |
6946c361692f5eafebfeada2c812e79e
|
|
| BLAKE2b-256 |
0799fb435df450e38e736a19ecb27df584116ebf1f6d94ea8a093fd121a83e08
|
File details
Details for the file context_foundry-2.5.3-py3-none-any.whl.
File metadata
- Download URL: context_foundry-2.5.3-py3-none-any.whl
- Upload date:
- Size: 611.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
580b6f8dd8be8490e96b0a8465228155968fef81147b0312f0a70cea2bdcd7dd
|
|
| MD5 |
6e554d389ac73d7095a77b45e8d7c917
|
|
| BLAKE2b-256 |
541f6e3f01079b62c4e9711e2aa26784ffcaddcaa08759c65eeb0c48cf021896
|