Version: 0.0.5
Status: Draft
Purpose: A portable, tool-agnostic playbook for structuring LLM agent context, memory, rules, and documentation inside any software project.
Agent behavior is code. It should be versioned, reviewed, modular, and readable by both humans and machines. The .agents/ folder is the single source of truth for everything an LLM agent needs to operate within a project β permissions, instructions, skills, memory, commands, and documentation artifacts.
AGENTS.md. Add folders only when needed.project-root/
βββ AGENTS.md # Primary instruction file + table of contents
βββ .agents/
βββ rules/ # Modular instruction files
β βββ <rule-name>.md
βββ skills/ # Context-invoked workflows
β βββ <skill-name>/
β βββ SKILL.md
βββ commands/ # Custom slash commands
β βββ <command-name>.md
βββ agents/ # Subagent personas
β βββ <agent-persona>.md
βββ memory/ # Persistent agent memory
βββ MEMORY.md # Long-term memory. Durable facts, preferences, and decisions
βββ YYYY-MM-DD.md # Daily notes (UTC timezone). Running context and observations
AGENTS.md β Primary Instruction FileThink of AGENTS.md as a README for agents: a dedicated, predictable place to provide the context and instructions an AI coding agent needs to work on your project.
The agentβs entry point. Every runtime MUST load this file first. It serves two roles:
# Agent Instructions
## Setup commands
[Commands an agent may need to run, e.g. install, dev, test, lint, build]
## Code style
[Language and style conventions β TypeScript strict mode, single quotes, etc.]
## Loaded Context
<!-- The runtime uses this section to discover and load other files -->
| File | Purpose | Auto-load |
| ------------------------------------- | -------------------- | --------- |
| rules/code-style.md | Coding conventions | yes |
| rules/security.md | Security constraints | yes |
| commands/review.md | /review command | on-demand |
| memory/MEMORY.md | Long-term memory | yes |
| ../docs/auth-redesign/ARCHITECTURE.md | Task architecture | on-demand |
## Loaded Context table listing all active files.Auto-load: yes files are injected into every session. on-demand files are loaded only when relevant or explicitly invoked.README.md, .editorconfig, or committed IDE settings. Prefer referencing those over duplicating them.rules/ β Modular Instruction FilesGranular, composable instruction files. Each file governs a single concern. Rules are injected into the context window based on relevance or the Auto-load setting in AGENTS.md.
Use rules/ for scoped or conditional guidance. If a rule should run for every task, keep it in AGENTS.md instead.
rules/<name>.md
Examples: rules/code-style.md, rules/security.md, rules/testing.md, rules/git-workflow.md, rules/api-conventions.md
---
name: Code Style
description: Enforces project coding conventions
applies_to: ["**/*.ts", "**/*.tsx"]
priority: high
---
# Code Style Rules
- Use 2-space indentation
- Prefer `const` over `let`; never use `var`
- All exported functions must have JSDoc comments
...
applies_to globs tell the runtime when to auto-inject this rule (e.g., only when editing .ts files).priority helps runtimes resolve conflicts between rules. Values: low | medium | high | critical.skills/ β Context-Invoked WorkflowsSkills are pre-defined workflows that the agent can load when the current task matches their metadata, or when the user invokes them directly. They are the agentβs reusable procedures.
skills/<name>/SKILL.md
Examples: skills/on-new-file/SKILL.md, skills/on-test-fail/SKILL.md, skills/on-pr-open/SKILL.md, skills/on-commit/SKILL.md
---
name: on-new-file
description: Auto-generates a matching test file when a new TypeScript file is created
when_to_use: Use when creating or updating TypeScript source files that may need matching tests.
paths: ["src/**/*.ts"]
---
# Skill: On New File
## When to Use
Use when a new `.ts` file is created in `src/`.
## Workflow
1. Inspect the new file and identify exported functions/classes.
2. Check if a corresponding `.test.ts` file exists in `src/__tests__/`.
3. If not, generate a scaffold test file using the project's test conventions (see `rules/testing.md`).
4. Notify the user: "Created test scaffold at `[path]`."
## Output
- Creates: `src/__tests__/<filename>.test.ts`
- Notifies: Yes
Required:
description β One concise sentence describing what the skill does and when it applies.Optional:
name β Stable skill name. If present, use lowercase letters, numbers, and hyphens only.when_to_use β Additional invocation guidance, trigger phrases, or example requests.paths β Glob or list of globs that scope when the skill should be considered.argument-hint β Autocomplete hint for expected arguments.arguments β Positional argument names used for substitution in the skill body.disable-model-invocation β Set to true when the skill should only run by explicit user invocation.user-invocable β Set to false when the skill is background context and should not appear as a user command.allowed-tools β Tools the runtime may pre-approve while the skill is active.model β Model override for the current turn.effort β Reasoning effort override for the current turn.context β Execution context, such as fork for subagent execution.agent β Subagent type to use when context: fork is set.hooks β Skill-scoped lifecycle hooks.shell β Shell used for dynamic command injection.description; add when_to_use for trigger phrases, examples, or extra selection guidance.paths to limit automatic loading to relevant file globs when a skill only applies to part of the tree.disable-model-invocation: true for workflows with side effects or workflows that should only run when explicitly invoked.disable-model-invocation: true.commands/ β Custom Slash CommandsExplicit, user-invoked operations exposed as slash commands (e.g., /review, /scaffold).
commands/<name>.md
Examples: commands/review.md, commands/scaffold.md, commands/deploy-check.md, commands/summarize.md
---
name: review
description: Performs a structured code review on staged or specified files
argument-hint: "[target]"
arguments: [target]
disable-model-invocation: true
---
# Command: /review
## Usage
```text
/review [target]
/review src/auth/login.ts
/review staged
```
## Behavior
1. Load `rules/code-style.md` and `rules/security.md`.
2. Diff the target against `main` (or review the full file if untracked).
3. Produce a structured review in the following format:
### Review Format
**Summary:** [One-line verdict]
**Issues:**
| Severity | Line | Description |
|----------|------|-------------|
| π΄ Critical | 42 | SQL injection risk β user input not sanitized |
| π‘ Warning | 88 | Missing null check before `.data` access |
| π΅ Info | 12 | Consider extracting magic number `3600` to a constant |
**Suggestion:** [Optional refactor idea]
argument-hint to show expected arguments during autocomplete.arguments to name positional arguments for substitution in the command body.disable-model-invocation: true for commands that should only run when explicitly invoked.agents/ β Subagent PersonasSpecialized agent personas that can be invoked for specific tasks. Each subagent has its own identity, capabilities, and behavioral constraints.
agents/<name>.md
Examples: agents/reviewer.md, agents/architect.md, agents/debugger.md, agents/writer.md, agents/security-auditor.md
---
name: Architect
invoke: "@architect"
description: Senior software architect focused on system design and technical decisions
inherits: ["rules/general.md"]
overrides:
temperature: 0.2
tools: ["file_read", "web_search"]
---
# Subagent: @architect
## Identity
You are a senior software architect with 15 years of experience designing scalable distributed systems. You are opinionated, precise, and always consider long-term maintainability over short-term convenience.
## Responsibilities
- Evaluate architectural decisions and trade-offs
- Produce or review `docs/[YYYY-MM-DD-task-name]/ARCHITECTURE.md`
- Advise on technology choices with explicit rationale
- Flag designs that will not scale or will create debt
## Behavioral Constraints
- Never write implementation code β only design, diagrams, and guidance
- Always provide at least two alternatives before recommending one
- Cite `docs/[YYYY-MM-DD-task-name]/ARCHITECTURE.md` when context is available
- Use ADR (Architecture Decision Record) format for major decisions
## Output Format
Use structured Mermaid diagrams for system visualizations.
invoke defines the @mention syntax to activate the subagent.inherits lists rule files that carry over from the parent agent.overrides allows subagents to override default runtime values (e.g., lower temperature for more deterministic output).memory/ β Agent MemoryPersistent storage of facts, decisions, entities, and context that should survive across sessions.
| File | Purpose |
|---|---|
MEMORY.md |
Long-term memory. Durable facts, preferences, and decisions |
YYYY-MM-DD.md |
Daily notes (UTC timezone). Running context and observations |
MEMORY.md Schema# Memory
## Facts
- **Project uses Postgres** β Primary database since 2025-01
- **@alex is lead engineer** β Owns payment module
## Preferences
- **Code review** β Prefers concise PR reviews with clear action items
- **Testing** β Requires 80% coverage minimum
## Decisions
### [2025-05-01] Use Postgres over MongoDB
**Context:** Evaluating database for user profile storage.
**Decision:** Chose Postgres for its relational integrity.
**Revisit if:** Need to store unstructured event data at scale.
YYYY-MM-DD.md Schema# 2025-05-01 (UTC)
## Context
Working on user authentication feature.
## Observations
- Found that JWT refresh token rotation is not implemented
- AuthService currently lacks token blacklist
## Next Steps
- [ ] Implement JWT refresh token rotation
- [ ] Add rate limiting to login endpoint
MEMORY.md for durable facts, preferences, and decisions that should persist long-term.YYYY-MM-DD.md files for daily notes using UTC dates.AGENTS.md
Start with just a AGENTS.md. Write your agent instructions. Add folders as needs emerge.
AGENTS.md
.agents/
βββ rules/
β βββ general.md
β βββ code-style.md
βββ memory/
βββ MEMORY.md
Add skills/, commands/, and agents/ as the project matures.
A compliant runtime MUST:
AGENTS.md at session start.AGENTS.md before any file operation.Auto-load: yes in AGENTS.md.description, when_to_use, or paths match the current context.commands/ and expose them via the invocation interface.A compliant runtime SHOULD:
AGENTS.md does not exist.memory/ as low-confidence context..agents/ should be committed to version control β it is project configuration, not secrets..agents/ file.**/.env and **/secrets/**.This repository uses itself as the reference implementation. The .agents/ folder at the root of this repo is the maintained set of playbook-conformant assets used for its own development β governing how agents should assist with writing, reviewing, and evolving the spec itself.
agent.md/ β this repo
βββ .agents/ β maintained agent asset library
β βββ README.md
β βββ rules/
β β βββ writing-style.md
β β βββ contribution.md
β βββ skills/
β β βββ on-new-example/
β β βββ SKILL.md
β βββ commands/
β β βββ validate.md
β βββ agents/
β β βββ spec-reviewer.md
β βββ memory/
β βββ MEMORY.md
βββ README.md
βββ pages/
βββ index.md
βββ AGENT_PDLC.md
βββ PLAYBOOK.md
Browse the .agents/ folder directly to see maintained playbook-conformant assets.
See AGENT_PDLC.md for the lifecycle diagram used when humans and agents collaborate on product development work.
my-saas-app/
βββ .agents/
β βββ rules/
β β βββ code-style.md # TypeScript conventions
β β βββ testing.md # Test coverage requirements
β β βββ security.md # OWASP top-10 awareness
β βββ skills/
β β βββ on-new-file/ # Auto-scaffold test files
β β β βββ SKILL.md
β β βββ on-test-fail/ # Diagnose CI failures
β β βββ SKILL.md
β βββ commands/
β β βββ review.md # /review β structured code review
β β βββ scaffold.md # /scaffold β generate boilerplate
β βββ agents/
β β βββ architect.md # @architect β system design advisor
β β βββ security-auditor.md # @security β OWASP-focused review
β βββ memory/
β βββ MEMORY.md
βββ src/
βββ tests/
βββ package.json
βββ README.md
This playbook is intentionally tool-agnostic. Implementations may extend it with runtime-specific features provided they do not break compatibility with this core specification.