Chapter 2 — Project templates
The Rules / Memory / Knowledge skeleton, ready to adapt
Chapter 2 argues that most disappointing AI-agent performance is an environment problem rather than a model problem, and proposes a three-part structure: rules (how the agent works), memory (where the project stands), and knowledge (what the project knows). This page holds the files that implement it.
What you will produce. A project directory that an agent can work in without being re-briefed every session: rules it reads, a memory it updates, and a knowledge base it draws on. You will populate it across the rest of the book.
Download
The complete directory structure with all templates in place. Unzip it, rename the folder, and start filling in memory/CURRENT.md.
Or take the files individually:
| File | Dimension | What it does |
|---|---|---|
AGENTS.md |
Rules | Project-wide behavioral expectations: scope of agent authority, file conventions, verification requirements |
analysis/AGENTS.md |
Rules | Analysis-specific refinements: where scripts live, class-level metrics, seed discipline |
writing/AGENTS.md |
Rules | Manuscript-specific refinements: voice, citation integrity, file handling |
memory/CURRENT.md |
Memory | Current direction, priorities, active assumptions, next steps |
memory/DECISIONS.md |
Memory | Append-only decision log with rationale and rejected alternatives |
memory/PROMPTLOG.md |
Memory | Revision history of prompt-based instruments |
kb/README.md |
Knowledge | Map of the knowledge base so an agent knows which file is authoritative |
README.md |
— | Human-facing project overview |
The structure at a glance
project/
├── AGENTS.md # Rules: how the agent works
├── README.md
├── memory/ # Memory: where the project stands
│ ├── CURRENT.md
│ ├── DECISIONS.md
│ ├── PROMPTLOG.md
│ └── runs/ # dated notes for specific analyses
├── kb/ # Knowledge: what the project knows
│ ├── README.md
│ ├── concepts/
│ ├── literature/{theory,methods,empirical}/
│ ├── data-docs/
│ └── codebooks/ # codebooks AND promptbooks
├── data/{raw,interim,processed,external}/
├── analysis/ # + its own AGENTS.md
│ ├── scripts/ notebooks/ validation/
├── writing/ # + its own AGENTS.md
└── outputs/{figures,tables,memos}/
The minimum viable version
If the full skeleton feels like too much for a project that has not started yet, Chapter 2 (§2.6.1) recommends three files. Create these and nothing else:
AGENTS.mdwith your file conventions, basic verification expectations, and instructions for handling uncertainty.memory/CURRENT.mdwith your current research direction, one or two open questions, and immediate next tasks.kb/README.mdwith a brief map of what materials you have and where they are.
Those three let any agent answer the three questions that orient a session: How should I work here? What is the project currently doing? What materials should I use?
Adapting the templates
- Rules should be specific enough to act on. “Be careful with the data” is a wish. “Do not modify files in
data/raw/; save intermediate outputs todata/interim/with a date prefix; after any coding task inspect a random sample of at least 20 records” is a configuration. - Keep memory selective. It is not a transcript. Record decisions, direction changes, and dead ends, not every exchange.
- Do not collapse the three. The most common failure is one long file mixing instructions, notes, and source material. An agent then cannot tell which text should constrain its behavior, which is history, and which is evidence.
- Promptbook vs. promptlog. The promptbook (in
kb/codebooks/) is the current instrument. The promptlog (inmemory/) is its history. Collapsing them makes it impossible to tell which prompt is authoritative.
Tool compatibility
These are plain Markdown files, readable by any assistant, editor, or human. A root AGENTS.md is read automatically by several current coding agents; where a tool expects a different filename, a one-line file pointing to AGENTS.md usually suffices. The structure outlasts any particular tool, which is the point of keeping it in plain text.
Where to go next
- Setting up the computing environment: Getting started
- The first exercise that populates these folders: Chapter 4 resources
- Where promptbooks come from: Prompting and its failure modes