Tool-agnostic validation framework for the Manifest-driven AI Development (MAID) methodology. Validates that code artifacts align with declarative manifests.
Project description
MAID Runner
A tool-agnostic validation framework and Python library for the Manifest-driven AI Development (MAID) methodology. MAID Runner validates that code artifacts align with declarative YAML manifests, ensuring architectural integrity in AI-assisted development. Integrates with ArchSpec for spec-to-code pipelines.
Why MAID Runner?
LLMs generate code based on statistical likelihood, optimizing for "plausibility" rather than architectural soundness. Without intervention, this leads to "AI Slop" -- code that is syntactically valid but architecturally chaotic.
MAID Runner enforces three-stream validation:
- Acceptance (WHAT): Immutable tests from specifications define system behavior
- Structural (SKELETON): AST-level verification that code matches manifest contracts
- Unit (HOW): Implementation-level tests verify internal correctness
This transforms AI from a "Junior Developer" requiring reactive code review into a "Stochastic Compiler" that translates rigid specifications into implementation details.
Supported Languages
| Language | Extensions | Parser | Key Features |
|---|---|---|---|
| Python | .py |
AST (built-in) | Classes, functions, methods, attributes, type hints, async/await, decorators |
| TypeScript/JS | .ts, .tsx, .js, .jsx |
tree-sitter | Classes, interfaces, type aliases, enums, namespaces, generics, JSX/TSX |
| Svelte | .svelte |
tree-sitter | Components, props, exports, script blocks, reactive statements |
Quick Start
# Install
pip install maid-runner # or: uv pip install maid-runner
# Initialize MAID in your project
maid init
# Interactive guide
maid howto --section quickstart
Installation
Claude Code Plugin (Recommended)
/plugin marketplace add aidrivencoder/claude-plugins
/plugin install maid-runner@aidrivencoder
From PyPI
pip install maid-runner # Python only (core — no tree-sitter)
pip install maid-runner[all] # All language support (TypeScript, Svelte)
pip install maid-runner[typescript] # TypeScript/JS only
pip install maid-runner[watch] # File watching for TDD mode
Multi-Tool Support
maid init # Claude Code (default)
maid init --tool cursor # Cursor IDE
maid init --tool windsurf # Windsurf IDE
maid init --tool generic # Generic MAID.md
CLI Reference
| Command | Purpose | Key Options |
|---|---|---|
maid validate [manifest] |
Validate manifest against code | --mode behavioral|implementation, --no-chain, --coherence, --json, --watch, --watch-all |
maid test |
Run validation commands from manifests | --manifest <path>, --watch, --watch-all, --fail-fast, --json |
maid snapshot <file> |
Generate manifest from existing code | --output-dir, --force |
maid snapshot-system |
Aggregate all active manifests | --output, --manifest-dir |
maid manifests <file> |
List manifests referencing a file | --manifest-dir, --quiet |
maid files |
Show file tracking status | --manifest-dir, --quiet |
maid graph |
Knowledge graph operations | query, export, analyze |
maid coherence |
Run coherence checks | --checks, --exclude, --json |
maid schema |
Display manifest JSON Schema | |
maid init |
Initialize MAID in project | --tool claude|cursor|windsurf|generic|auto |
maid howto |
Interactive methodology guide | --section intro|principles|workflow|quickstart|patterns|commands|troubleshooting |
maid manifest create <file> |
Create manifest for a file | --goal, --artifacts, --dry-run |
Exit codes: 0 = success, 1 = validation failure, 2 = usage error. Use --quiet for automation.
Run maid howto --section commands for detailed usage and examples.
Common Workflows
# Validate all manifests (chains enabled by default)
maid validate
# Validate a single manifest
maid validate manifests/add-auth.manifest.yaml
# Validate without chain merging
maid validate manifests/add-auth.manifest.yaml --no-chain
# Validate behavioral tests
maid validate manifests/add-auth.manifest.yaml --mode behavioral
# Validate with coherence checks
maid validate --coherence
# TDD watch mode (single manifest)
maid test --manifest manifests/add-auth.manifest.yaml --watch
# Multi-manifest watch (entire codebase)
maid test --watch-all
# Run all validation commands
maid test
# JSON output for CI/CD
maid validate --json
File Tracking
When validating with manifest chains (default), MAID Runner reports file compliance status:
- UNDECLARED: Files not in any manifest (no audit trail)
- REGISTERED: Files tracked but incomplete (missing artifacts/tests)
- TRACKED: Files with full MAID compliance
Manifest Structure (v2 YAML)
schema: "2"
goal: "Implement email validation"
type: feature
files:
create:
- path: validators/email_validator.py
artifacts:
- kind: class
name: EmailValidator
- kind: method
name: validate
of: EmailValidator
args:
- name: email
type: str
returns: bool
read:
- tests/test_email_validation.py
validate:
- pytest tests/test_email_validation.py -v
V1 JSON manifests are auto-converted when loaded.
Validation Modes
| Mode | Files | Behavior |
|---|---|---|
| Strict | files.create |
Implementation must EXACTLY match declared artifacts |
| Permissive | files.edit |
Implementation must CONTAIN declared artifacts |
Artifact Kinds
Common: class, function, method, attribute
TypeScript-specific: interface, type, enum, namespace
Development Workflow
Phase 1: Goal Definition
Define the high-level feature or bug fix.
Phase 2: Planning Loop
- Create manifest:
maid manifest create <file> --goal "Description" - Create behavioral tests in
tests/ - Validate:
maid validate <manifest> --mode behavioral - Iterate until validation passes
Phase 3: Implementation Loop
- Implement code per manifest
- Validate:
maid validate <manifest> - Run tests:
maid test --manifest <manifest> - Iterate until all tests pass
Phase 4: Integration
Verify complete chain: maid validate and maid test pass for all active manifests.
Library API
MAID Runner provides a Python library API for direct integration with tools, CI/CD, and custom scripts.
Basic Validation
from maid_runner import validate, validate_all
# Validate a single manifest
result = validate("manifests/add-auth.manifest.yaml")
if result.success:
print("All checks passed")
else:
for error in result.errors:
print(f"{error.code.value}: {error.message}")
# Validate all manifests in directory
batch = validate_all("manifests/")
print(f"{batch.passed}/{batch.total_manifests} passed")
Manifest Chain Operations
from maid_runner import ManifestChain
chain = ManifestChain("manifests/")
for m in chain.active_manifests():
print(f"{m.slug}: {m.goal}")
artifacts = chain.merged_artifacts_for("src/auth/service.py")
Loading and Saving Manifests
from maid_runner import load_manifest, save_manifest
manifest = load_manifest("manifests/add-auth.manifest.yaml") # YAML v2 or JSON v1
print(manifest.goal)
save_manifest(manifest, "manifests/copy.manifest.yaml")
Snapshot Generation
from maid_runner import generate_snapshot
manifest = generate_snapshot("src/auth/service.py")
print(f"Found {len(manifest.all_file_specs[0].artifacts)} artifacts")
JSON Output for Tool Integration
from maid_runner import validate
result = validate("manifests/add-auth.manifest.yaml")
print(result.to_json()) # Structured JSON output
Custom Validator Registration
from maid_runner import ValidatorRegistry, BaseValidator, CollectionResult
class GoValidator(BaseValidator):
@classmethod
def supported_extensions(cls):
return (".go",)
def collect_implementation_artifacts(self, source, file_path):
return CollectionResult(artifacts=[], language="go", file_path=str(file_path))
def collect_behavioral_artifacts(self, source, file_path):
return CollectionResult(artifacts=[], language="go", file_path=str(file_path))
ValidatorRegistry.register(GoValidator)
MAID Ecosystem
| Tool | Purpose |
|---|---|
| MAID Agents | Automated workflow orchestration using Claude Code agents |
| MAID Runner MCP | MCP server exposing validation to AI agents |
| MAID LSP | Language Server Protocol for real-time IDE validation |
| MAID for VS Code | VS Code/Cursor extension with manifest explorer and diagnostics |
| Claude Plugins | Plugin marketplace including MAID Runner |
| ArchSpec | AI-powered spec generation with MAID manifest export |
Development Setup
# Install dependencies
uv sync
uv sync --group dev
# Run tests
uv run python -m pytest tests/ -v
# Code quality
make format # Auto-fix formatting
make lint # Check style
make type-check # Type checking
Project Structure
maid-runner/
├── docs/ # Documentation
├── manifests/ # Task manifests (YAML v2)
├── tests/
│ ├── core/ # Core module tests
│ ├── validators/ # Validator tests
│ ├── coherence/ # Coherence check tests
│ ├── graph/ # Knowledge graph tests
│ ├── compat/ # Compatibility tests
│ ├── cli/ # CLI tests
│ ├── integration/ # Integration tests
│ └── e2e/ # End-to-end tests
├── maid_runner/
│ ├── core/ # Manifest loading, validation, chain, types
│ ├── validators/ # Language-specific artifact collectors
│ ├── graph/ # Knowledge graph (manifest relationships)
│ ├── coherence/ # Architectural coherence checks
│ ├── compat/ # V1 JSON backward compatibility
│ ├── cli/commands/ # CLI command modules
│ └── schemas/ # JSON Schema (v1, v2)
├── examples/ # Example scripts
└── .claude/ # Claude Code configuration
Testing
uv run python -m pytest tests/ -v # All tests
uv run python -m pytest tests/core/ -v # Core tests
uv run python -m pytest tests/validators/ -v # Validator tests
maid test # MAID validation commands
Requirements
- Python 3.10+
- Core:
jsonschema,pyyaml - Optional:
tree-sitter,tree-sitter-typescript(TypeScript/JS support),tree-sitter-svelte(Svelte support) - Dev:
black,ruff,mypy,pytest
Contributing
This project dogfoods MAID methodology. All changes require:
- A manifest in
manifests/ - Behavioral tests in
tests/ - Passing structural validation
- Passing behavioral tests
See CONTRIBUTING.md and CLAUDE.md for guidelines.
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 maid_runner-2.2.0.tar.gz.
File metadata
- Download URL: maid_runner-2.2.0.tar.gz
- Upload date:
- Size: 94.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fa0f8eb638006e25bd3492beed5071b3c1480d2726a0ee2b9a9ae444b924046
|
|
| MD5 |
2f85dcabc89be7054566fc484672cc60
|
|
| BLAKE2b-256 |
5be8c1ce6702f1e0bf64d9080509f44a976674ff66fc83e12c6796ba5c1b31f1
|
Provenance
The following attestation bundles were made for maid_runner-2.2.0.tar.gz:
Publisher:
publish.yml on mamertofabian/maid-runner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
maid_runner-2.2.0.tar.gz -
Subject digest:
5fa0f8eb638006e25bd3492beed5071b3c1480d2726a0ee2b9a9ae444b924046 - Sigstore transparency entry: 1222652482
- Sigstore integration time:
-
Permalink:
mamertofabian/maid-runner@b9f8584415af20a31503538cd283039c7a3c27f6 -
Branch / Tag:
refs/tags/v2.2.0 - Owner: https://github.com/mamertofabian
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b9f8584415af20a31503538cd283039c7a3c27f6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file maid_runner-2.2.0-py3-none-any.whl.
File metadata
- Download URL: maid_runner-2.2.0-py3-none-any.whl
- Upload date:
- Size: 122.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d009a5e5519d83e48b15b4d3fc9b915470a8da3553b39ef9927d9ea0460b8cb
|
|
| MD5 |
bf67c1c9ab3d9e8737fcb8cf83df73f8
|
|
| BLAKE2b-256 |
999f708e24691b5e3c4a5681bc901f1fe0f5f4817410a2d80b7f138fb90a6514
|
Provenance
The following attestation bundles were made for maid_runner-2.2.0-py3-none-any.whl:
Publisher:
publish.yml on mamertofabian/maid-runner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
maid_runner-2.2.0-py3-none-any.whl -
Subject digest:
4d009a5e5519d83e48b15b4d3fc9b915470a8da3553b39ef9927d9ea0460b8cb - Sigstore transparency entry: 1222652531
- Sigstore integration time:
-
Permalink:
mamertofabian/maid-runner@b9f8584415af20a31503538cd283039c7a3c27f6 -
Branch / Tag:
refs/tags/v2.2.0 - Owner: https://github.com/mamertofabian
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b9f8584415af20a31503538cd283039c7a3c27f6 -
Trigger Event:
push
-
Statement type: