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.
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.
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
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.
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.
AGENTS.md β Entry PointThe 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/ β InstructionsComposable, 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.
rules/code-style.mdrules/security.mdrules/testing.mdFront matter controls when a rule is injected:
---
applies_to: ["**/*.ts"]
priority: high
---
.agents/skills/ β Context-Invoked WorkflowsSkills are reusable procedures the agent can load when the current task matches their metadata, or when the user invokes them directly.
skills/on-new-file/SKILL.md β use when creating source files that need matching testsskills/on-test-fail/SKILL.md β use when diagnosing failing tests or CIskills/on-commit/SKILL.md β use when preparing a commitUse 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 CommandsExplicit, user-invoked operations. Registered by the runtime and exposed via its invocation interface.
commands/review.md β /review β structured code reviewcommands/scaffold.md β /scaffold β generate boilerplatecommands/deploy-check.md β /deploy-check β pre-deployment checklist.agents/agents/ β Subagent PersonasSpecialized agents for specific roles. Invoked by @mention. Each carries its own identity, constraints, and optional permission overrides.
agents/architect.md β @architect β system design and ADRsagents/reviewer.md β @reviewer β code review and qualityagents/security-auditor.md β @security β OWASP-focused audit.agents/memory/ β Persistent MemoryStructured, append-only files that persist facts across sessions. Treated as low-confidence context β informative, not authoritative.
memory/MEMORY.md β Long-term memory. Durable facts, preferences, and decisionsmemory/YYYY-MM-DD.md β Daily notes (UTC timezone). Running context and observationsAGENTS.md
Write your agent instructions. Thatβs it.
AGENTS.md
.agents/
βββ rules/
β βββ general.md
βββ memory/
βββ MEMORY.md
project-root/
βββ .agents/
β βββ rules/
β βββ skills/
β βββ commands/
β βββ agents/
β βββ memory/
βββ AGENTS.md
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 playbook is intentionally tool-agnostic. Runtimes may extend it provided they do not break compatibility with the core specification.