SpecNative Repository-native agent engineering

Spec-Driven Development / Agent-Driven Development

Make the repository the context system, not the prompt.

SpecNative Development is a development model where specifications, architecture rules, conventions, and decisions live in stable repository files so agents can plan and implement work with less runtime ambiguity.

  • Specification-first instead of prompt-first
  • Repository-native context instead of session-local context
  • Works with Codex, Claude Code, OpenCode, and similar agents
Product Problem, users, goals
Architecture Boundaries and constraints
Specification Required behavior
Tasks Executable plan

Concept

What changes in a SpecNative workflow

The shift is straightforward: instead of rebuilding project context inside a conversation, the repository encodes the context once and the agent navigates it deterministically.

Prompt-centric workflow

  1. User describes the feature and the project state in a prompt.
  2. Agent reconstructs context from chat history and partial file reads.
  3. Important constraints may be omitted, duplicated, or outdated.
  4. Next session often repeats the same explanation.

Repository-centric workflow

  1. User requests work against an existing spec or initiative.
  2. Agent reads repository navigation and source documents.
  3. Architecture, conventions, and decisions already exist as inputs.
  4. Each session starts from the same durable context surface.

Execution model

Intent becomes a specification. Specifications are decomposed into tasks. Architecture and decisions constrain the plan. Code and tests realize the result.

Human Intent Request or change Specification Required behavior Tasks / Plan Executable units Implementation Code and tests Architecture + Stack + Conventions + Decisions Constraints applied to planning and implementation

v0.7

What the framework provides

The template consolidates all project context under spec-native/, exposes the repository as an MCP server, ships ready-to-use agent commands, and now includes archetypes and templates so new projects start with real content instead of placeholders.

Archetypes

Pre-filled spec-native/ for common stacks and patterns. apply_archetype('java-hexagonal') writes ARCHITECTURE, STACK, CONVENTIONS, COMMANDS, DECISIONS, and ROADMAP in one call. Add your own in .specnative/archetypes/.

Spec templates & decision snippets

apply_spec_template('feature-rest-endpoint', 'user-auth') creates a ready-to-fill SPEC.md. apply_decision_snippet('jwt-authentication') appends DEC-XXXX to DECISIONS.md. Reusable across projects.

MCP server

.specnative/specnative_mcp.py exposes the repository as typed resources (spec:// URIs), tools, and prompts for Claude Code, Claude Desktop, OpenCode, and Codex. Installed automatically with its own venv.

Native agent commands

/spec-init, /spec-update, /spec-status, /spec-handoff — installed automatically in every profile. Available as slash commands in Claude Code, prompts in OpenCode, and codex --prompt in Codex.

Multi-agent continuity

spec-native/SESSION.md persists active work state in git. checkpoint() saves where you are; resume() tells the next agent — whether Claude Code, Codex, or Cursor — exactly what to do next.

Init & update wizard

specnative init interviews the developer and fills context documents in minutes. specnative update runs a health check, detects gaps, and guides iterative refinement.

Unified context folder

Everything lives in spec-native/: product docs, specs, tasks, workflows, pipelines, and the session state. One entry point, zero navigation friction for any agent.

Standalone installer

install.py bootstraps SpecNative into an existing repository from a GitHub release. Four profiles: context, spec, team, platform. No dependencies beyond stdlib.

Motivation

Why teams adopt this model

Prompt engineering does not scale

Long prompts become a brittle substitute for architecture, decisions, and operational rules that should already exist in version control.

Context is usually transient

Agents often inherit shallow session state instead of stable product and system context with explicit ownership.

Repositories are not AI-native by default

Source layouts optimize for code storage, not for deterministic navigation, decision tracking, or specification lookup.

Repeated explanation wastes time and tokens

Teams repeatedly restate the same product rules, architectural boundaries, and coding conventions across sessions.

Structure

Repository layout for agent-guided work

All project context lives under spec-native/ — one entry point for any agent. AGENTS.md is the universal meta-index that explains SpecNative, points to spec-native/, and documents how to use the MCP server.

repo/
├── AGENTS.md               # Meta-index: what is SpecNative, MCP reference
├── spec-native/
│   ├── 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
│   ├── DECISIONS.md        # Persistent decisions and trade-offs
│   ├── ROADMAP.md          # Temporal direction
│   ├── 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
│       └── CD.md
├── .claude/commands/       # /spec-init, /spec-update, /spec-status, /spec-handoff
├── codex.toml              # Codex prompt commands
├── opencode.json           # OpenCode MCP + prompts
└── .specnative/
    ├── SCHEMA.md
    ├── MCP.md
    └── specnative_mcp.py   # MCP server (auto-installed)

Navigation files

README.md files route both humans and agents to the correct context instead of duplicating all project knowledge.

Source documents

Files such as PRODUCT.md, SPEC.md, ARCHITECTURE.md, and DECISIONS.md hold the durable truth.

Execution artifacts

Task files break specs into implementable units with state, owners, dependencies, and closure criteria.

Framework infrastructure

.specnative/ holds the framework contract and CLI reference, separate from project content so adopters can update one without touching the other.

Reading strategy

Agents should navigate, not ingest the whole repository. Start with local navigation, then load only the documents needed for the current task.

Current folder entry point Local README navigation Relevant source docs minimal context Plan task model Implement code + tests

Runtimes

How to use the method with OpenCode, Claude Code, and Codex

SpecNative is not tied to one agent runtime. The repository is the stable layer. The runtime is the execution layer. The integration pattern is to give each tool a thin bootstrap into the same repository context.

OpenCode

Terminal, desktop, IDE

OpenCode provides primary and subagents, configurable permissions, and ACP/editor integrations. It fits well when you want plan/build separation around a repository-native workflow.

Recommended pattern

  • Use a plan-style agent to read specs and propose work without edits.
  • Use a build-style agent to implement once the spec and task path are clear.
  • Keep repository rules in AGENTS.md and folder README.md files.
  • Restrict write and bash permissions until the reading path is validated.
{
  "$schema": "https://opencode.ai/config.json",
  "agent": {
    "plan": {
      "permission": {
        "edit": "deny",
        "bash": { "*": "ask" }
      }
    },
    "build": {
      "permission": {
        "edit": "allow",
        "bash": { "*": "ask", "git status *": "allow" }
      }
    }
  }
}

MCP + prompts (auto-configured)

// opencode.json — generated automatically by install.py
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "specnative": {
      "type": "local", "enabled": true,
      "command": ["./.specnative/.venv/bin/python3",
                  "./.specnative/specnative_mcp.py"]
    }
  },
  "prompts": {
    "spec-init":    { "description": "Guided project setup" },
    "spec-update":  { "description": "Detect gaps, refine docs" },
    "spec-status":  { "description": "Quick health check" },
    "spec-handoff": { "description": "Handoff for next agent" }
  }
}

Source: OpenCode agents and permissions docs

Claude Code

CLI and agent teams

Claude Code reads AGENTS.md and supports custom slash commands via .claude/commands/. SpecNative installs four commands automatically so the developer can start with /spec-init on day one.

Recommended pattern

  • Use /spec-init to fill context documents the first time.
  • Use /spec-status to check active work at the start of each session.
  • Use /spec-handoff before ending a session so the next agent can resume.
  • Encode domain flows as MCP prompts (start_initiative, plan_tasks).
# Built-in slash commands (from .claude/commands/)
/spec-init     # Interview developer, fill spec-native/ docs
/spec-update   # Detect gaps, guide iterative refinement
/spec-status   # Session + specs + tasks + alerts
/spec-handoff  # Generate SESSION.md handoff for next agent

# MCP setup (auto-installed)
claude mcp add specnative \
  "$(pwd)/.specnative/.venv/bin/python3" \
  "$(pwd)/.specnative/specnative_mcp.py" \
  -- --repo "$(pwd)"

Source: Claude Code overview

Codex

Local, IDE, GitHub, cloud

Codex reads AGENTS.md and works best when the repository already exposes constraints clearly. SpecNative gives Codex a stable context surface and installs ready-to-use prompts via codex.toml.

Recommended pattern

  • Start every session with codex --prompt spec-status to check active work.
  • Delegate work by naming the spec or initiative, not by rewriting the context.
  • Use resume() MCP tool to continue from the last agent's checkpoint.
  • Use codex --prompt spec-handoff before closing to save session state.
# codex.toml — generated automatically by install.py
[mcp_servers.specnative]
command = "./.specnative/.venv/bin/python3"
args    = ["./.specnative/specnative_mcp.py"]
type    = "stdio"

# Ready-to-use prompts:
# codex --prompt spec-init
# codex --prompt spec-update
# codex --prompt spec-status
# codex --prompt spec-handoff

Sources: Codex cloud docs, Codex product overview

Implementation Flow

How a feature request becomes code

01

Define the capability

Write the behavior, scope, constraints, and acceptance criteria in a spec.

02

Read constraints

Load architecture, stack, conventions, and prior decisions before planning.

03

Generate tasks

Break the spec into implementation units that can be validated.

04

Implement and validate

Produce code, tests, and document updates that satisfy the spec.

Adoption

How to introduce SpecNative in a real codebase

Start small

Add AGENTS.md, a root README.md, and a single agents/SPEC.md for one active initiative.

Define durable truths

Move product intent, architecture, stack rules, commands, and conventions into repository files with clear ownership.

Route agents, do not brief them from scratch

Give the runtime a short entry instruction that tells it where to look, not a long project summary.

Expand only when needed

Introduce initiative folders, explicit task files, and workflow documents as project complexity increases.

Resources

Repository and references