Agent Playbook

A portable, tool-agnostic file structure playbook for LLM agents in software projects.

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.


Why This Exists

Every team using LLM agents invents their own folder structure. Instructions live in random .md files, prompts are buried in config, and memory is nowhere. When the runtime changes or someone new joins the project, nothing is discoverable.

This playbook gives agents β€” and the humans working alongside them β€” a consistent, predictable home.


Folder Structure

project-root/
β”œβ”€β”€ .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 file + table of contents

Core Principles

Co-location β€” Agent files live alongside the code they govern. No external dashboards or separate repos.

Modularity β€” Each concern has its own folder. Adopt only what you need; leave the rest out.

Composability β€” Rules, skills, and subagents can be shared and reused across projects like packages.

Portability β€” Tool-agnostic. Works with Claude, Cursor, GitHub Copilot, or any custom runtime.

Progressive disclosure β€” Start with a single AGENTS.md. Add folders only when you have a reason.


Agent PDLC

The Agent PDLC is the working loop for humans and agents building software together: intake, framing, context loading, planning, building, verification, refinement, capture, and learning.

Use it when you want the agent to help with product development work without turning the process into prompt roulette with a meeting invite. It makes intent, context, verification, and learning explicit before the next request arrives.

See the Agent PDLC diagram.


Quick Reference

AGENTS.md β€” Entry Point

The agent’s system prompt and manifest. Every runtime loads this first. Contains a ## Loaded Context table that tells the runtime what else to load and when.

.agents/rules/ β€” Instructions

Composable, single-concern instruction files for scoped or conditional guidance. Each rule file targets a specific area: code style, testing conventions, security policy, git workflow. If a rule should run for every task, move it into AGENTS.md instead.

Front matter controls when a rule is injected:

---
applies_to: ["**/*.ts"]
priority: high
---

.agents/skills/ β€” Context-Invoked Workflows

Skills are reusable procedures the agent can load when the current task matches their metadata, or when the user invokes them directly.

Use description and when_to_use to explain when a skill applies. Use paths to scope a skill to matching files, and disable-model-invocation: true for workflows that should only run when explicitly invoked.

.agents/commands/ β€” Slash Commands

Explicit, user-invoked operations. Registered by the runtime and exposed via its invocation interface.

.agents/agents/ β€” Subagent Personas

Specialized agents for specific roles. Invoked by @mention. Each carries its own identity, constraints, and optional permission overrides.

.agents/memory/ β€” Persistent Memory

Structured, append-only files that persist facts across sessions. Treated as low-confidence context β€” informative, not authoritative.


Adoption

Start here (< 5 minutes)

AGENTS.md

Write your agent instructions. That’s it.

Playbook setup

AGENTS.md
.agents/
β”œβ”€β”€ rules/
β”‚   └── general.md
└── memory/
    └── MEMORY.md

Full setup

project-root/
β”œβ”€β”€ .agents/
β”‚   β”œβ”€β”€ rules/
β”‚   β”œβ”€β”€ skills/
β”‚   β”œβ”€β”€ commands/
β”‚   β”œβ”€β”€ agents/
β”‚   └── memory/
└── AGENTS.md

Runtime Compliance

A compliant runtime MUST:

  1. Always load AGENTS.md at session start.
  2. Enforce permissions defined in AGENTS.md before any file operation.
  3. Auto-inject all files marked Auto-load: yes in AGENTS.md.
  4. Load skills whose description, when_to_use, or paths match the current context.
  5. Register commands from commands/ and expose them via the invocation interface.
  6. Respect subagent boundaries β€” a subagent must not exceed the parent agent’s permissions.

A compliant runtime SHOULD:


Security


References


This playbook is intentionally tool-agnostic. Runtimes may extend it provided they do not break compatibility with the core specification.