Operational framework and patterns for high-quality, AI-assisted software development. This repository provides a single canonical guide (AGENTS.md) and a lightweight workflow for repeatable, auditable, and architecture-first delivery.
- Version: 2.1 (2025-10-25)
- Compatibility: Claude, Cursor, Copilot, Cline, Aider, and all AGENTS.md-compatible tools
- Status: Canonical single-file guide for AI-assisted development
AGENT-ZERO gives teams using AI coding tools a shared contract, state machine, and documentation patterns to ship real software safely:
- Reuse over creation (extend, don’t rewrite)
- Approval gates (no changes applied without explicit consent)
- Architecture-aligned changes (follow patterns, cite sources)
- High signal context (Memory Bank + focused state machine)
See the full spec in AGENTS.md.
Start every session with the compliance banner, then load your Memory Bank and choose a mode:
COMPLIANCE CONFIRMED: Reuse over creation
⚠️ GIGO PREVENTION - User Responsibilities:
📋 Clear task objectives | 🔗 Historical context | 🎯 Success criteria
⚙️ Architectural constraints | 🎖️ You lead - clear input = excellent output
[Continue with Memory Bank loading...]
- Attach MCP servers if present:
.brain/mcp.config.jsonor.mcp.json(see AGENTS.md §2. Session Startup) - Choose a mode and load context:
- Fast Track: monthly tasks README + quick-start
- Standard: core project docs + recent updates
- Deep Dive: architecture, ADRs, legacy cross-reference
Mode checklists and logging format are defined in AGENTS.md §2.
The Four Sacred Rules (summarized):
- No new files without exhaustive reuse analysis
- No rewrites when refactoring is possible
- No generic advice — cite file:line and MB sections
- No ignoring existing architecture/patterns
Details and validation checklists in AGENTS.md §1.
States: PLAN → BUILD → DIFF → QA → APPROVAL → APPLY → DOCS
- PLAN: Produce an implementation plan that cites current code and Memory Bank patterns. Exit only with explicit user approval.
- BUILD: Implement minimally in a sandbox branch, follow patterns, write tests, generate diff. Do not apply changes.
- DIFF: Present unified diff, rationale, integration points, and MB references.
- QA: Run tests, linters, coverage, build. Report structured results.
- APPROVAL: Human gate. Proceed only on explicit approval (“approved” / “looks good”).
- APPLY: Apply changes to the sandbox branch and verify.
- DOCS: Create task docs and update the Memory Bank.
Full details and formats (including report templates) in AGENTS.md §4.
A small, curated set of docs that persist across sessions:
memory-bank/
├── toc.md
├── projectbrief.md
├── productContext.md
├── systemPatterns.md
├── techContext.md
├── activeContext.md
├── progress.md
├── projectRules.md
├── decisions.md
├── quick-start.md
├── database-schema.md
├── build-deployment.md
├── testing-patterns.md
└── tasks/
├── YYYY-MM/
│ ├── README.md
│ └── DDMMDD_*.md
└── YYYY-MM/README.md
- Read frequently; write sparingly, and only with approval (see AGENTS.md §3)
- Cite MB sections in plans and diffs (e.g.,
systemPatterns.md#Service Extension Pattern)
Before building, define a task contract with:
- Context (repo, related work, constraints)
- Expected outcomes and acceptance criteria
- Architectural constraints and security notes
- Instructions (outline → approval → implement)
Budgets: cycles (retry loops), tokens (context), minutes (wall-clock). Track and request extensions when exceeded. See AGENTS.md §5.
Do not proceed past APPROVAL without:
- Tests passing (unit + integration for new workflows)
- Linter clean (warnings allowed with justification)
- Coverage thresholds met (higher for new code)
- Security review completed
Checklists and standards in AGENTS.md §6.
- Sandbox first: never commit directly to
main - Approval gates: do not apply changes without explicit user approval
- Reuse analysis: document why extension is impossible before creating new files
- Citations:
- Code:
path/file.ext:42-58 - Memory Bank:
memory-bank/systemPatterns.md#Section
- Code:
- Documentation:
- Only after code approval (DOCS state)
- Use task doc and monthly README templates in AGENTS.md §6
A field-tested, cross-agent routine for flawless execution:
- Back up your agent configs and guides (e.g., AGENTS.md, CLAUDE.md, WARP.md, CURSOR.md).
- Create symlinks (ln -s) to AGENTS.md so tools share the same canonical files where possible.
- Reboot your agent of choice (e.g., Claude Code). First command:
Examine the code base to create the memory bank according to the AGENTS 2.1 spec. Do not use readme files or other documentation, examine the code and logic. - Clear the session memory to prevent context pollution:
/compactor/clear. - On every subsequent boot, type:
startup. - Provide a specific task (see Sample Task below) and ensure the agent starts in PLAN. Approve or edit the plan.
- Type:
BUILDto implement in a sandbox. - Review the presented diff and rationale. Then type:
QAto run tests, linters, coverage, and build. - When QA passes, type:
Document it. Update the memory bank. - Clear again (
/compactor/clear) and repeat with the next task.
Advanced: Ask your chat agent to create a release plan with milestones and individual task files (YAML), using AGENTS.md as the format source.
This routine has been validated across Claude Code (Sonnet 4.5 1M), Copilot/Codex, Gemini, and others.
A minimal, high-signal task prompt that aligns with AGENTS.md PLAN → BUILD → QA:
Task name: Add a modal to show store details
Context: Users currently see a list of stores, but many need more detail. When the user clicks the store name, they should see a modal with all store details, including a map, contact information, hours, and manager email address.
Desired outcome: User clicks the store name, a detailed modal appears.
Historical context: See the last task that built the list of stores.
Constraints (do/don't): Do not use fake data or stubs, etc. This request is mostly UX, focus specifically on the store detail modal.
Instructions: This is the PLAN process. Create a plan that addresses the user's specific request. Do not write code until the user has approved your plan.
Expected flow:
- PLAN: Agent proposes a structured plan with code citations and reuse strategy.
- BUILD: After explicit approval, implement minimally and generate diff.
- QA: Run tests, linters, coverage, build; report results.
- APPROVAL → APPLY → DOCS: Approve, apply to sandbox branch, then document updates in the Memory Bank.
Optional “Task Contract” expansion (adds acceptance criteria for QA alignment):
## Task: Add a modal to show store details
### Context
- Repository: [path/area]
- Related Work: Last task that built the list of stores
- Constraints: No fake data or stubs; focus on UX for the store detail modal
### Expected Outcomes
- Acceptance Criteria:
1. Clicking a store name opens a modal
2. Modal displays map, contact info, hours, and manager email
3. No regressions to the store list interaction
- Success Metrics: All criteria verified in tests; no UI regressions
- Definition of Done: PLAN approved; BUILD diff presented; QA passed; docs updated
### Instructions
Create a PLAN for approval. Do not write code until the plan is approved.Ready-to-paste prompts for sessions:
startup
BUILD
QA
Document it. Update the memory bank.
/compact
- Detect stalls: two identical diffs in a row
- Protocol: log → halt → diagnose → request direction or agent swap
- Common issues and decision tree in AGENTS.md §8
- Is this tool-specific? No. It works with Claude, Cursor, Copilot, Cline, Aider, and any tool that can follow AGENTS.md.
- Where do I start on a new feature? Begin at PLAN with a Task Contract, load the Memory Bank, propose a reuse-first plan.
- When do I update the Memory Bank? After major features, pattern discovery, or architectural decisions (see “When to Update MB” in AGENTS.md §6).
- Enrich examples for multiple stacks (Node, Python, Go)
- Add reference CI workflows aligned with QA gates
- Optional MCP recipes for common operations
Contributions welcome—follow the state machine and approval gates.
- Canonical spec: AGENTS.md
- State machine and templates: AGENTS.md §4
- Memory Bank structure: AGENTS.md §3
- Quality & Security: AGENTS.md §6
- Field-tested guide (reference): openstudio/AGENTS.md