For AI Agents
SpecNative — how to work with this framework
SpecNative repositories encode project context in versioned files so agents
can plan and implement work without reconstructing context from conversation
history. Read AGENTS.md first. Navigate via README.md
files. Load only what you need for the current task.
MCP server — v0.4
tools/specnative_mcp.py exposes the repository as MCP
resources, tools, and prompts
so any MCP-compatible agent (Claude Desktop, Claude Code, OpenCode) can work
spec-first without manually navigating the file tree.
Requires: pip install mcp.
Quick setup — Claude Code
# Add via CLI
claude mcp add specnative \
python3 .specnative/specnative_mcp.py \
-- --repo /path/to/your/project
# Or add to .claude/mcp_settings.json
{
"mcpServers": {
"specnative": {
"command": "python3",
"args": [
".specnative/specnative_mcp.py",
"--repo", "/path/to/your/project"
]
}
}
}
Resources
| URI | Document |
|---|---|
spec://agents | AGENTS.md — operating contract |
spec://context/product | agents/PRODUCT.md |
spec://context/architecture | agents/ARCHITECTURE.md |
spec://context/stack | agents/STACK.md |
spec://context/conventions | agents/CONVENTIONS.md |
spec://context/commands | agents/COMMANDS.md |
spec://context/decisions | agents/DECISIONS.md |
spec://context/roadmap | agents/ROADMAP.md |
spec://context/traceability | agents/TRACEABILITY.md |
spec://pipelines/ci | pipelines/CI.md |
spec://pipelines/cd | pipelines/CD.md |
spec://schema | .specnative/SCHEMA.md |
Tools
| Tool | Description |
|---|---|
status() | Spec states and task count summary |
validate() | Check all required files exist |
list_specs() | All specs with ID, state, owner |
list_tasks(initiative) | Tasks for an initiative |
read_spec(initiative) | Read a spec file |
read_context(document) | Read any context doc by name |
export_index() | Export all metadata as JSON |
Prompts
| Prompt | Description |
|---|---|
start_initiative(name, problem) | Begin a new spec-driven initiative |
plan_tasks(initiative) | Derive tasks from a spec |
implement_task(initiative, task_id) | Implement a specific task |
review_against_spec(initiative) | Review against acceptance criteria |
record_decision(title, ctx, dec, cons) | Record a persistent decision |
close_initiative(initiative) | Close and update traceability |
Full configuration for Claude Desktop, OpenCode, and SSE transport: .specnative/MCP.md
Repository structure
repo/
├── AGENTS.md # Agent operating contract — read first
├── README.md # Navigation index
├── agents/
│ ├── README.md # Context folder index
│ ├── PRODUCT.md # Problem, users, goals (permanent)
│ ├── ARCHITECTURE.md # System structure and boundaries
│ ├── STACK.md # Tech stack and version constraints
│ ├── CONVENTIONS.md # Code rules, naming, testing
│ ├── COMMANDS.md # Project dev/test/build commands only
│ ├── SPEC.md # Active spec (or entry point to specs/)
│ ├── DECISIONS.md # Persistent decisions and trade-offs
│ ├── ROADMAP.md # Temporal direction, no implementation
│ ├── TRACEABILITY.md # Links between artifacts
│ └── specs/
│ └── <initiative>/
│ └── SPEC.md
├── tasks/
│ └── <initiative>/
│ └── TASKS.md
├── workflows/
│ ├── PLANNING.md
│ ├── IMPLEMENTATION.md
│ └── REVIEW.md
├── pipelines/
│ ├── CI.md # Automated validation gates
│ └── CD.md # Delivery process and environments
└── .specnative/
├── SCHEMA.md # Framework contract (not project content)
└── CLI.md # CLI reference
Files in uppercase are context for agents. README.md files are
navigation indexes, not the source of truth. Load the minimum context needed
for the current task. Do not ingest the whole repository.
Document ownership — one truth per document
Each document owns one semantic domain. Never duplicate information across files. Update the source of truth, not a parallel summary.
| Document | Owns | Does not own |
|---|---|---|
PRODUCT.md |
Problem, target users, goals, non-goals, differential value | Implementation, technical decisions |
SPEC.md |
What must be built in this initiative: requirements, scope, acceptance criteria, risks | Persistent trade-offs (→ DECISIONS), product vision (→ PRODUCT), direction (→ ROADMAP) |
DECISIONS.md |
Persistent trade-offs that future initiatives must respect | What will be built (→ SPEC), temporal priorities (→ ROADMAP) |
ROADMAP.md |
What comes first and why (temporal direction) | How to implement, specific trade-offs |
ARCHITECTURE.md |
System modules, boundaries, data flows, architectural constraints | What to build, why decisions were made |
STACK.md |
Languages, runtimes, frameworks, versions, prohibited tech | System structure, code conventions |
CONVENTIONS.md |
Naming rules, code style, testing approach, commit/PR conventions | Project commands, tech stack |
COMMANDS.md |
Project-specific commands: build, test, lint, run, migrations | Framework CLI commands (specnative.py), deployment scripts |
tasks/**/TASKS.md |
Executable plan: tasks with state, owner, dependencies, close criteria | Requirements (→ SPEC), persistent decisions (→ DECISIONS) |
TRACEABILITY.md |
Cross-artifact links: spec → tasks → decisions → artifacts → validation | Content of any linked document |
pipelines/CI.md |
Automated gate definitions, triggers, required checks | Local dev commands, implementation logic |
pipelines/CD.md |
Delivery process, environments, promotion gates, rollback | Deployment scripts, credentials |
Decision test — where to write something
If it disappears when the initiative closes → SPEC.md
If it must be respected in the next initiative → DECISIONS.md
If it explains the product → PRODUCT.md
If it sets temporal priority → ROADMAP.md
If it describes system structure → ARCHITECTURE.md
If it defines automated validation gates → pipelines/CI.md
If it describes how code reaches production → pipelines/CD.md
How to generate the full template
Follow these steps in order when helping a user create a SpecNative repository from scratch. Each step populates one document with the right scope.
-
Bootstrap the structure
Run
python3 install.py --target /path/to/repo --profile minimalor copy Template-Project-Agents-AI into the target repository. This creates all required folders and placeholder files. -
Fill
agents/PRODUCT.mdProblem (what friction exists and for whom), Users (segments, needs, context), Goals (measurable outcomes), Non-goals (explicit exclusions), Differential value (why this solution deserves to exist).
-
Fill
agents/ARCHITECTURE.mdSystem modules and their responsibilities, module boundaries and data flows, key architectural constraints. No implementation detail.
-
Fill
agents/STACK.mdLanguages and runtimes with exact versions, frameworks and libraries, infrastructure and tooling, constraints and prohibited technologies.
-
Fill
agents/CONVENTIONS.mdNaming conventions (files, classes, variables), code style and formatting rules, testing approach (unit / integration / e2e), commit and PR conventions.
-
Fill
agents/COMMANDS.mdActual project commands only: build, test, lint, run/start, migrations, and any project-specific operational commands. Never include framework CLI commands here.
-
Fill
agents/ROADMAP.mdCurrent priorities in order with rationale for ordering. Rough time horizon. No implementation detail, no spec content.
-
Create
agents/SPEC.md(oragents/specs/<initiative>/SPEC.md)ID, state, owner, creation/update dates. Summary, problem, objective. Scope (includes / excludes). Functional and non-functional requirements. Acceptance criteria (Given / When / Then). Dependencies and risks. Execution plan. Validation plan.
-
Derive
tasks/<initiative>/TASKS.mdOne task per implementable unit. Each task: ID, state, owner, dependencies, expected files, observable close criteria, validation command.
-
Record decisions in
agents/DECISIONS.mdOnly persistent trade-offs that future initiatives must respect. Format: DEC-XXXX, date, state, context, decision, consequences, replaces.
-
Fill
pipelines/CI.mdandpipelines/CD.mdCI: platform, triggers, mandatory and optional gates, failure policy. CD: environments, release process, promotion gates, rollback process.
-
Update
agents/TRACEABILITY.mdwhen an initiative closesLink spec → tasks → decisions → main artifacts → validation evidence. Update at close, not during execution.
Agent workflow (from AGENTS.md)
- Read the README.md of the current folder
Entry point for navigation in any directory.
- Check agents/ROADMAP.md
Confirm the initiative aligns with current project direction before creating a spec.
- Read agents/PRODUCT.md and relevant technical context
Load minimum context: ARCHITECTURE.md, STACK.md, CONVENTIONS.md as needed.
- Read agents/DECISIONS.md
Respect persistent trade-offs that condition the current design.
- Review or create a SPEC.md
Use agents/SPEC.md for single active specs; agents/specs/<initiative>/SPEC.md for larger projects.
- Derive or read tasks in tasks/
Follow workflows/PLANNING.md to turn spec into executable task list.
- Implement following workflows/IMPLEMENTATION.md
Verify CI gates from pipelines/CI.md before considering work complete.
- Record persistent trade-offs in DECISIONS.md
Only if the decision must survive beyond the current initiative.
- Update TRACEABILITY.md at initiative close
Link all related artifacts. Not during execution — only at close.
Required states
Specs
| State | Meaning |
|---|---|
draft | Being written, not yet committed for implementation |
active | Currently being implemented |
blocked | Cannot proceed due to external dependency or decision |
done | All acceptance criteria met and validated |
superseded | Replaced by a newer spec (link the replacement) |
Tasks
Decisions
Optional TOML metadata
TOML blocks are optional. The base contract is documentary — documents are valid
without TOML. Add TOML blocks when you want validate,
status, and export CLI commands to work automatically.
Place the block near the top of the file.
Spec header (agents/SPEC.md or agents/specs/**/SPEC.md)
```toml
artifact_type = "spec"
id = "SPEC-0001"
state = "draft"
owner = "team-name"
created_at = "YYYY-MM-DD"
updated_at = "YYYY-MM-DD"
replaces = "none"
related_tasks = ["TASK-0001"]
related_decisions = ["DEC-0001"]
artifacts = ["src/example/*"]
validation = ["pytest", "manual walkthrough"]
```
Task file header (tasks/**/TASKS.md)
```toml
artifact_type = "task_file"
initiative = "initiative-name"
spec_id = "SPEC-0001"
owner = "team-name"
state = "todo"
```
Individual task block
```toml
id = "TASK-0001"
title = "Task title"
state = "todo"
owner = "team-name"
dependencies = []
expected_files = ["src/example.py"]
close_criteria = "Observable closure condition"
validation = ["pytest tests/example_test.py"]
```
CLI reference
tools/specnative.py lives in the SpecNative Development repository,
not in the adopting project. Invoke it pointing to the project root.
| Command | What it does |
|---|---|
status |
Shows each spec with its state and a summary of task states (todo, in_progress, done, blocked counts). |
validate |
Checks all required files exist and that TOML blocks (when present) have valid states and required fields. |
export-index |
Exports all specs and task files with TOML metadata as JSON. Use --output file.json to write to disk. |
export-traceability |
Exports traceability matrix linking each spec to its task file, decisions, artifacts, and validation. Use --output file.json. |
install |
Copies the template structure into an existing git repository. Requires clean worktree and creates a dedicated branch. Options: --target, --profile minimal|full, --include-examples, --branch, --force. |
# Show spec and task state overview
python3 specnative.py status
# Validate required files and TOML consistency
python3 specnative.py validate
# Export full index
python3 specnative.py export-index --output exports/index.json
# Export traceability matrix
python3 specnative.py export-traceability --output exports/traceability.json
# Install into existing repository
python3 specnative.py install \
--target /path/to/repo \
--profile minimal \
--include-examples \
--branch specnative/install-v0.3.1
Standalone installer
install.py bootstraps SpecNative from a GitHub release with no
dependencies beyond the Python standard library.
# Download and run
curl -sSL https://github.com/rafex/SpecNative-Development/releases/latest/download/install.py \
| python3 - --target /path/to/repo
# Or download first, then run
python3 install.py --target /path/to/repo --profile minimal --include-examples