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.7
.specnative/specnative_mcp.py exposes the repository as MCP
resources, tools, and prompts
so any agent works spec-first without navigating files manually.
Installed automatically with its own venv. Supports stdio and SSE transport.
Quick setup — Claude Code
# Add via CLI (from project root)
claude mcp add specnative \
"$(pwd)/.specnative/.venv/bin/python3" \
"$(pwd)/.specnative/specnative_mcp.py" \
-- --repo "$(pwd)"
# Or add to .claude/mcp_settings.json
{
"mcpServers": {
"specnative": {
"command": "/your/project/.specnative/.venv/bin/python3",
"args": ["/your/project/.specnative/specnative_mcp.py",
"--repo", "/your/project"]
}
}
}
Resources
| URI | Document |
|---|---|
spec://agents | AGENTS.md — meta-index and MCP reference |
spec://session | spec-native/SESSION.md — active work state |
spec://context/product | spec-native/PRODUCT.md |
spec://context/architecture | spec-native/ARCHITECTURE.md |
spec://context/stack | spec-native/STACK.md |
spec://context/conventions | spec-native/CONVENTIONS.md |
spec://context/commands | spec-native/COMMANDS.md |
spec://context/decisions | spec-native/DECISIONS.md |
spec://context/roadmap | spec-native/ROADMAP.md |
spec://context/traceability | spec-native/TRACEABILITY.md |
spec://pipelines/ci | spec-native/pipelines/CI.md |
spec://pipelines/cd | spec-native/pipelines/CD.md |
spec://schema | .specnative/SCHEMA.md |
Tools — query
| 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 (includes session) |
export_index() | Export all metadata as JSON |
context_snapshot(initiative?) | Full context dump for new-agent onboarding |
Tools — multi-agent continuity
| Tool | Description |
|---|---|
resume() | Read SESSION.md and return structured continuity summary |
checkpoint(initiative, task_id, intent, next_steps, …) | Save active work state before pausing or switching agents |
update_task(initiative, task_id, state, notes?) | Update task state in TASKS.md directly from MCP |
log_decision(title, context, decision, consequences) | Append a new decision to DECISIONS.md |
Tools — project definition
| Tool | Description |
|---|---|
health_check() | Scan spec-native/ for empty docs, missing files, stale session, specs without tasks |
suggest_next() | Top 3 recommended actions based on roadmap and current state |
refine_document(document, what_changed, new_content) | Overwrite a context doc with new content |
read_template(document) | Return expected empty structure for any spec-native/ document (11 types) |
update_section(document, section_heading, content) | Update or add a single section without touching the rest of the file |
Tools — archetypes (v0.7)
| Tool | Description |
|---|---|
list_archetypes() | List all archetypes: built-in and user-defined in .specnative/archetypes/ |
read_archetype(name) | Preview all documents of an archetype before applying |
apply_archetype(name, force?) | Write archetype documents to spec-native/; skips already-filled docs unless force=True |
Tools — templates (v0.7)
| Tool | Description |
|---|---|
list_templates(type?) | List spec templates and/or decision snippets: built-in + local in .specnative/templates/ |
apply_spec_template(template, initiative) | Create spec-native/specs/{initiative}/SPEC.md from a template |
apply_decision_snippet(name) | Append a decision snippet to DECISIONS.md with auto DEC-XXXX numbering |
Prompts
| Prompt | Description |
|---|---|
init_project_guided(name, problem, users, goals, …) | Fill all core docs from developer interview answers |
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 |
handoff(summary, next_steps, decisions?) | Generate structured SESSION.md handoff for next agent |
record_decision(title, ctx, dec, cons) | Record a persistent decision |
close_initiative(initiative) | Close and update traceability |
Full configuration for OpenCode, Claude Desktop, Codex, and SSE transport: .specnative/MCP.md
Repository structure
repo/
├── AGENTS.md # Meta-index: what is SpecNative, MCP reference — read first
├── spec-native/
│ ├── README.md # Context folder navigation 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
│ ├── DECISIONS.md # Persistent decisions and trade-offs
│ ├── ROADMAP.md # Temporal direction, no implementation
│ ├── TRACEABILITY.md # Links between artifacts
│ ├── SESSION.md # Active work state (multi-agent continuity)
│ ├── 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
├── .claude/commands/ # Slash commands: /spec-init /spec-update /spec-status /spec-handoff
├── codex.toml # Codex CLI prompt commands
├── opencode.json # OpenCode MCP + commands + instructions
└── .specnative/
├── SCHEMA.md # Framework contract (not project content)
├── MCP.md # MCP server configuration per agent
├── specnative_mcp.py # MCP server (installed automatically)
├── archetypes/ # Custom archetypes (user-defined)
│ └── README.md
└── templates/ # Reusable spec templates + decision snippets
├── specs/ # Spec templates (.md with +++ front matter)
└── decisions/ # Decision snippets (.md with +++ front matter)
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. SESSION.md persists active work state across agents.
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. All documents live under spec-native/.
| Document | Owns | Does not own |
|---|---|---|
spec-native/PRODUCT.md |
Problem, target users, goals, non-goals, differential value | Implementation, technical decisions |
spec-native/specs/*/SPEC.md |
What must be built in this initiative: requirements, scope, acceptance criteria, risks | Persistent trade-offs (→ DECISIONS), product vision (→ PRODUCT), direction (→ ROADMAP) |
spec-native/DECISIONS.md |
Persistent trade-offs that future initiatives must respect | What will be built (→ SPEC), temporal priorities (→ ROADMAP) |
spec-native/ROADMAP.md |
What comes first and why (temporal direction) | How to implement, specific trade-offs |
spec-native/ARCHITECTURE.md |
System modules, boundaries, data flows, architectural constraints | What to build, why decisions were made |
spec-native/STACK.md |
Languages, runtimes, frameworks, versions, prohibited tech | System structure, code conventions |
spec-native/CONVENTIONS.md |
Naming rules, code style, testing approach, commit/PR conventions | Project commands, tech stack |
spec-native/COMMANDS.md |
Project-specific commands: build, test, lint, run, migrations | Framework CLI commands (specnative.py), deployment scripts |
spec-native/tasks/**/TASKS.md |
Executable plan: tasks with state, owner, dependencies, close criteria | Requirements (→ SPEC), persistent decisions (→ DECISIONS) |
spec-native/TRACEABILITY.md |
Cross-artifact links: spec → tasks → decisions → artifacts → validation | Content of any linked document |
spec-native/SESSION.md |
Active work state: current agent, initiative, task, intent, next steps | Spec content, decisions, product vision |
spec-native/pipelines/CI.md |
Automated gate definitions, triggers, required checks | Local dev commands, implementation logic |
spec-native/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 → specs/*/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
If it is the active work state right now → SESSION.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 team. This creates all required folders, placeholder files, agent commands, and configures opencode.json and codex.toml automatically. -
Initialize project context — guided
Use
/spec-init(Claude Code),spec-initprompt (OpenCode/Codex), orpython3 specnative.py init(CLI without agent). The wizard interviews the developer and fills all five core documents. -
Fill
spec-native/PRODUCT.mdProblem (what friction exists and for whom), Users (segments, needs, context), Goals (measurable outcomes), Non-goals (explicit exclusions), Differential value. Use
refine_document('product', …)to update via MCP. -
Fill
spec-native/ARCHITECTURE.mdSystem modules and their responsibilities, module boundaries and data flows, key architectural constraints. No implementation detail.
-
Fill
spec-native/STACK.mdLanguages and runtimes with exact versions, frameworks and libraries, infrastructure and tooling, constraints and prohibited technologies.
-
Fill
spec-native/CONVENTIONS.mdNaming conventions (files, classes, variables), code style and formatting rules, testing approach (unit / integration / e2e), commit and PR conventions.
-
Fill
spec-native/COMMANDS.mdActual project commands only: build, test, lint, run/start, migrations. Never include framework CLI commands here.
-
Fill
spec-native/ROADMAP.mdCurrent priorities in order with rationale. Rough time horizon. No implementation detail, no spec content.
-
Create
spec-native/specs/<initiative>/SPEC.mdID, 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. Use MCP prompt
start_initiative(). -
Derive
spec-native/tasks/<initiative>/TASKS.mdOne task per implementable unit. Each task: ID, state, owner, dependencies, expected files, observable close criteria, validation command. Use MCP prompt
plan_tasks(). -
Record decisions in
spec-native/DECISIONS.mdOnly persistent trade-offs that future initiatives must respect. Format: DEC-XXXX, date, state, context, decision, consequences, replaces. Use MCP tool
log_decision()for quick inline recording. -
Fill
spec-native/pipelines/CI.mdandpipelines/CD.mdCI: platform, triggers, mandatory and optional gates, failure policy. CD: environments, release process, promotion gates, rollback process.
-
Use
checkpoint()at each session pauseCall
checkpoint(initiative, task_id, intent, next_steps)before ending any session. The next agent — regardless of tool — callsresume()to continue exactly from here. -
Update
spec-native/TRACEABILITY.mdwhen an initiative closesLink spec → tasks → decisions → main artifacts → validation evidence. Update at close, not during execution. Use MCP prompt
close_initiative().
Agent workflow (from AGENTS.md)
- Check for active session
Call
resume()— if SESSION.md state is not idle, read what the previous agent left and continue from there. - Load minimum context
Call
context_snapshot()for a full dump, or read individual docs viaread_context(). - Check spec-native/ROADMAP.md
Confirm the initiative aligns with current project direction before creating a spec.
- Read spec-native/DECISIONS.md
Respect persistent trade-offs that condition the current design.
- Review or create a SPEC.md in spec-native/specs/
Use MCP prompt
start_initiative()for new initiatives. - Derive or read tasks in spec-native/tasks/
Follow spec-native/workflows/PLANNING.md or use MCP prompt
plan_tasks(). - Implement following spec-native/workflows/IMPLEMENTATION.md
Use
update_task()to mark tasks in_progress and done. Verify CI gates from spec-native/pipelines/CI.md. - Record persistent trade-offs with
log_decision()Only if the decision must survive beyond the current initiative.
- Checkpoint before pausing
Call
checkpoint(initiative, task_id, intent, next_steps)before every session end. - Update TRACEABILITY.md at initiative close
Link all related artifacts. Use MCP prompt
close_initiative().
Required states
SESSION.md
Updated by checkpoint() and handoff().
Reset to idle by close_initiative().
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.
SESSION.md uses +++ TOML front matter (not a ```toml block).
Spec header (spec-native/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 (spec-native/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 — invoke it from the project root.
Use init and update when no agent is available.
| Command | What it does |
|---|---|
init [--target .] [--force] |
Interactive wizard: interviews the developer in the terminal and fills spec-native/ core documents with real project content. Alternative to /spec-init when no agent is available. |
update [--target .] [--doc NAME] |
Runs a health check, shows gaps, and guides iterative refinement. Use --doc product|stack|architecture|conventions|commands|roadmap to target one document. |
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. |
export-traceability |
Exports traceability matrix linking each spec to its task file, decisions, artifacts, and validation. |
# Interactive project setup (no agent needed)
python3 specnative.py init
# Detect gaps and refine iteratively
python3 specnative.py update
python3 specnative.py update --doc stack
# 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
Archetypes & templates (via MCP tools)
# List available archetypes (built-in + local)
list_archetypes()
# Preview an archetype before applying
read_archetype('java-hexagonal')
# Apply to spec-native/ (skips filled docs)
apply_archetype('java-hexagonal')
apply_archetype('java-hexagonal', force=True) # overwrite all
# List templates
list_templates() # both spec + decision
list_templates('spec')
list_templates('decision')
# Create SPEC.md from template
apply_spec_template('feature-rest-endpoint', 'user-auth')
# Append decision to DECISIONS.md (auto DEC-XXXX)
apply_decision_snippet('jwt-authentication')
Built-in archetypes
| Name | Stack | Pattern | Documents |
|---|---|---|---|
java-hexagonal |
Java 21 + Spring Boot 3 | Hexagonal / Ports & Adapters | ARCHITECTURE, STACK, CONVENTIONS, COMMANDS, DECISIONS, ROADMAP |
Built-in spec templates
| Name | For |
|---|---|
feature-rest-endpoint | New REST endpoint initiative |
db-migration | Database migration with Flyway/Liquibase |
module-refactor | Module or layer refactoring |
Built-in decision snippets
| Name | For |
|---|---|
jwt-authentication | JWT for stateless authentication |
hexagonal-ports | Domain/infrastructure separation via ports |
database-choice | Database technology selection |
Standalone installer
install.py bootstraps SpecNative from a GitHub release with no
dependencies beyond the Python standard library. Installs agent commands,
configures opencode.json and codex.toml, and sets up the MCP venv.
# Minimal — AI context layer only
curl -sSL https://github.com/rafex/SpecNative-Development/releases/latest/download/install.py \
| python3 - --target /path/to/repo --profile context
# Team (default) — full lifecycle + CI/CD
curl -sSL https://github.com/rafex/SpecNative-Development/releases/latest/download/install.py \
| python3 - --target /path/to/repo --profile team
# Repair broken MCP (no branch, no worktree check)
python3 install.py --reinstall --target /path/to/repo