Skip to main content

ANRS: AI-Native Repo Spec

A practical specification for structuring AI-friendly code repositories.

License Version Standard

English | 中文


What is ANRS?

ANRS (AI-Native Repo Spec) is a vendor-neutral specification that defines how to structure a repository so that AI agents can work within it safely and effectively.

When AI agents operate in traditional codebases, they often lose track of their current task, hallucinate commands, or modify unrelated files. ANRS solves this by providing a standard set of boundaries and context:

  • Explicit State (state.json) — Replaces fragile chat history. The AI always reads this file first to know "what task I am doing" and "what step I am on."
  • Defined Skills (skills/) — Replaces open-ended guessing. The AI is restricted to documented checklists, preventing undefined behaviors.
  • Mandatory Harness (.anrs/harness/) — Replaces blind commits. AI-generated code must pass checks and tests before task completion.

Note: ANRS is a specification, not a runtime tool. It's a standardized folder structure (.anrs/) plus execution protocols that any AI tool can follow.


Design Principles

  • Deterministic Execution — AI follows a fixed loop: Read → Plan → Execute → Verify.
  • Atomic Changes — Code and state update together. Always rollback-safe.
  • Vendor Neutral — Works with Cursor, Claude, Codex, and others.
  • Layered Verification — Security → Lint → Test → Risk. Gate before commit.
  • Learn from Failures — Failed attempts are archived for future reference.

Architecture Overview

                    ANRS Framework

    State (SSOT)  →  Orchestrator  →  Skills
         ↑              |              |
         |              v              v
         |           Harness  ←───  Code
         |              |
         |         [ PASS? ]
         |          /     \
         |        YES      NO
         |         |        |
         └── Commit       Reflection → Retry

Execution Workflow

1. READ STATE    → .anrs/state.json
2. LOAD PLAN     → .anrs/plans/active/{task_id}.md
3. SELECT SKILL  → .anrs/skills/index.json
4. EXECUTE       → Follow SKILL.md checklist
5. RUN HARNESS   → L1 (Static) → L2 (Tests) → L3 (Stability)

PASS → Atomic commit → Update state → Done
FAIL → Reflect → Retry (max 3) → Escalate to human

Quick Start

pip install anrs
cd your-project
anrs init                    # Standard setup
anrs adapter install cursor  # Add AI adapter

This creates:

your-project/
├── .anrs/
│   ├── ENTRY.md      # AI reads this first
│   ├── state.json    # Current state (SSOT)
│   ├── config.json   # Configuration
│   ├── scratchpad.md # Temporary notes
│   └── plans/        # Task plans
│       ├── active/   # Current tasks
│       ├── backlog/  # Future tasks
│       └── templates/
└── .cursorrules      # AI adapter

Option 2: Explore the Source

git clone https://github.com/artsyne/anrs.git
cd anrs
ls -la spec/      # Protocol specification templates
ls -la cli/       # CLI tool source code

Option 3: Configure Your AI Platform

ANRS provides ready-to-use adapters with multi-mode support (build/plan/review):

Platform Modes Quick Start
Cursor build, plan anrs adapter install cursor
Claude Code build, plan, review anrs adapter install claude-code
Codex build, plan, review anrs adapter install codex
OpenCode build, plan, review anrs adapter install opencode

See adapters documentation for manual setup and mode switching.


Core Concepts

State (SSOT) — .anrs/state.json — Single Source of Truth for task state. AI reads this before any action.

Entry Point — .anrs/ENTRY.md — AI agent entry point. Defines rules, constraints, and available skills.

Skills — .anrs/skills/ — Registered action templates with input/output schemas and constraints.

Harness — .anrs/harness/quality_gate.py (full level) or anrs harness command — Multi-layer evaluation gate (Security → L1: static → L2: tests → L3: stability).


Key Files Reference

File Description
.anrs/ENTRY.md AI agent entry point
.anrs/state.json Current execution state
.anrs/config.json Project configuration
.anrs/plans/active/ Active task plans
.anrs/harness/ Quality gate evaluators (full level)

Documentation


License

MIT License — See LICENSE for details.

Metadata

Release files for anrs 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for anrs 0.1.3
File Size Uploaded
anrs-0.1.3.tar.gz 64.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for anrs 0.1.3
File Interpreter ABI Platform
anrs-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 135.8 kB

Release files / anrs-0.1.3.tar.gz

Download URL anrs-0.1.3.tar.gz
Size 64.4 kB
Tags Source
SHA-256 checksum
How to use checksums
44bee5783730d99b3afeddb8f138595a1b6c2b79e4538048b1d79f4dd33fc199
BLAKE2b-256 checksum
How to use checksums
0f7c74387dc030aad8d0682742494c658c7368bea26192597080d39ea3033441
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / anrs-0.1.3-py3-none-any.whl

Download URL anrs-0.1.3-py3-none-any.whl
Size 71.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
28b7d93c74d0503a4a8b64613f4dbe5fb589cf41f15b2540d1317eec8e241895
BLAKE2b-256 checksum
How to use checksums
020ec35d047743f2798d13070cdc21f6914e8c1a0ab62153da0275ef10a10102
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page