Repository layout
Memory system layout
The.agents/ directory holds the structured memory system used for session logging and auto-consolidation:
Key files explained
AGENTS.md — your project's source of truth
AGENTS.md — your project's source of truth
AGENTS.md is the most important file in the system. It is committed to version control, shared across your whole team, and loaded into the agent’s prompt at the start of every session.What it contains:- Project name, stack, and package manager
- Build, test, lint, and dev server commands
- One-line architecture overview (one line per directory)
- Compressed project knowledge: patterns, boundaries, and gotchas in pipe-delimited shorthand
- Numbered rules the agent follows on every turn
- Pointers to
agent_docs/for deeper references
./agent-context init to get the template.What the agent does with it: Reads it at the start of every session, before doing any work. Every rule, pattern, and gotcha in this file is applied on every turn — no lookup required.The 120-line limit: Frontier LLMs reliably follow about 150-200 instructions. Claude Code’s system prompt uses ~50. That leaves ~120 for your project context. Going over doesn’t give you more coverage — it gives you instructions that get quietly deprioritized. Keep this file under 120 lines.Cursor, Copilot, Codex, and Windsurf all read
AGENTS.md directly. Claude Code reads CLAUDE.md, which the init script creates as a symlink to AGENTS.md — so you maintain one source of truth for all agents..agents.local.md — your personal scratchpad
.agents.local.md — your personal scratchpad
.agents.local.md is your private, gitignored scratchpad. It never gets committed to version control and is local to you — not shared with your team.What it contains:- Your personal preferences (tone, code style, planning style)
- Settled patterns specific to how you work
- Gotchas the agent has hit in past sessions
- Dead ends — approaches tried and failed, with reasons
- A “Ready to Promote” section where the agent flags stable patterns
- A session log, with one entry per session appended at the end
scripts/agents-local-template.md. You customize the preferences section once, then the agent maintains the rest.What the agent does with it: Reads it at session start alongside AGENTS.md. Appends a session log entry at the end of each session (with your approval). Compresses it when it hits 300 lines and flags patterns that have recurred across 3+ sessions in the “Ready to Promote” section.agent_docs/ — deep references loaded on demand
agent_docs/ — deep references loaded on demand
agent_docs/ holds deeper reference material that the agent reads only when the task requires it. This keeps the always-loaded context in AGENTS.md lean and focused on what matters every session.What it contains:| File | Contents |
|---|---|
conventions.md | Full code patterns, naming conventions, file structure decisions |
architecture.md | System design, data flow, key architectural decisions |
gotchas.md | Extended known traps with full explanations and context |
AGENTS.md’s compressed knowledge isn’t enough for the task at hand. For most day-to-day tasks, the agent never needs to open agent_docs/..agents/ — the structured memory system
.agents/ — the structured memory system
The
.agents/ directory is the memory system’s home. It is gitignored and local to you.local.md — the indexThe index is capped at 200 lines (~25KB). It doesn’t store content directly — it stores pointers to topic files, with a one-line summary for each entry (~150 chars max). The agent reads this at session start to know what memory topics exist and where to find them.logs/ — daily append-only logsEach day gets its own file (e.g., 2026-03-25.md). The agent appends session entries here. These files are never edited — only appended to. During auto-consolidation, entries from daily logs are promoted to topic files and the logs are pruned.topics/ — curated knowledgeTopic files (patterns.md, gotchas.md, preferences.md) are de-duplicated, dated, and merged during consolidation. Unlike daily logs, topic files are curated — they represent settled, reviewed knowledge. Auto-consolidation runs when ≥24 hours have passed since the last consolidation and ≥5 sessions have accumulated.Who creates it: The init script creates the directory. The agent creates and maintains the files inside it.What the agent does with it: Reads local.md (the index) and relevant topic files at session start. Appends to today’s daily log at session end. Triggers consolidation when the conditions are met.Auto-consolidation achieves roughly a 9:1 compression ratio (107 KB → 11.6 KB validated). This keeps the memory system from growing unbounded while preserving what matters.
Other files
agent-context is the CLI. Use it to initialize the system, validate AGENTS.md, and promote flagged patterns. Run ./agent-context init to set up a new project, ./agent-context validate to check file health, and ./agent-context promote to review patterns flagged for promotion.
scripts/init-agent-context.sh is a thin wrapper around agent-context init for backwards compatibility with npx skills add installs. If you installed via npx skills, use this script instead of the CLI directly.
CLAUDE.md is a symlink to AGENTS.md, created by the init script. Claude Code reads CLAUDE.md rather than AGENTS.md directly. The symlink means you maintain one file — AGENTS.md — and all agents read it, regardless of what filename they expect.