Spec-as-Source Framework: AI-driven development where specifications are the source of truth.
Project description
Specular
Specular is a "Spec-as-Source" AI coding framework. It treats rigorous, SRS-style specifications as the source of truth and uses LLMs to compile them into executable code.
Key Features
- Spec-as-Source: Code is a build artifact. You edit the Spec, not the Python/JS file.
- Contracts over Code: Define what you want (Functional Requirements) and constraints (Non-Functional Requirements).
- Self-Healing: An autonomous loop (
attempt_fix) analyzes test failures and patches code to resolve discrepancies. - Multi-Provider: Supports Google Gemini and Anthropic Claude via a pluggable provider system.
- Agent-Native: Also available as an MCP server for AI agents.
Installation
# Requires Python 3.10+ and uv
git clone https://github.com/symbolfarm/specular.git
cd specular
uv sync
Quick Start
# Set your API key
export GEMINI_API_KEY="your-key-here"
# Create a new spec
specular create calculator "A simple calculator with add and multiply"
# Edit src/calculator.spec.md to define your requirements...
# Compile to code
specular compile calculator
# Run the generated tests
specular test calculator
# If tests fail, auto-fix
specular fix calculator
CLI Reference
specular list List all specs in src/
specular create <name> <desc> Create a new spec from template
specular validate <name> Check spec structure
specular compile <name> Compile spec to code + tests
specular test <name> Run tests for a spec
specular fix <name> Auto-fix failing tests
specular build Compile all specs in dependency order
--incremental Only recompile changed specs
--parallel Compile independent specs concurrently
LLM Providers
Google Gemini (default)
export GEMINI_API_KEY="your-key-here"
export SPECULAR_LLM_MODEL="gemini-2.0-flash" # optional
Anthropic Claude
export SPECULAR_LLM_PROVIDER="anthropic"
export ANTHROPIC_API_KEY="your-key-here"
export SPECULAR_LLM_MODEL="claude-sonnet-4-20250514" # optional
MCP Server (for AI Agents)
Specular can run as an MCP server for Claude Desktop or other AI agents:
"specular": {
"command": "uv",
"args": ["run", "specular-mcp"],
"env": {
"GEMINI_API_KEY": "your-key-here"
}
}
Or use the CLI: specular mcp
Development
uv run pytest # Run tests
uv run ruff check src/ # Lint
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 specular_ai-0.1.0.tar.gz.
File metadata
- Download URL: specular_ai-0.1.0.tar.gz
- Upload date:
- Size: 101.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62ebb9e24380611c65b8a2eb1c97b621acf1adc6c5d9ab4a9b0929598a52f08c
|
|
| MD5 |
78d85360a257408a948d5b5048bca8f3
|
|
| BLAKE2b-256 |
df0a6ad72c1f5daf802ca379b8a671cb520b7ee5956ce02347838547486c1d43
|
File details
Details for the file specular_ai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: specular_ai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 29.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cdc54cbaf732df7f8eb74b4a589a10650d01b05c89717fdc3215fa98842e9022
|
|
| MD5 |
08ad596f6e20c27785e36a7c0263a817
|
|
| BLAKE2b-256 |
4cc913a4b369becb5e97b12da783191af90721190ba35b4bc65c46b64f85b3c4
|