cd /news/artificial-intelligence/ai-agent-memory-starts-with-a-docume… Β· home β€Ί topics β€Ί artificial-intelligence β€Ί article
[ARTICLE Β· art-65156] src=dev.to β†— pub= topic=artificial-intelligence verified=true sentiment=Β· neutral

AI Agent Memory Starts with a Documentation Table of Contents

A developer proposes that AI agent memory should be structured like a book's table of contents, using hierarchical directories and README indexes to help agents quickly find relevant documents. The approach organizes documentation by role (spec, architecture, test) and allows single files to be promoted into directories as subjects grow, enabling agents to ignore irrelevant content without reading entire files.

read6 min views1 publishedJul 19, 2026

Good project memory for AI agents is not a larger pile of documents. It is a hierarchical table of contents that helps an agent reach the right document quickly and ignore irrelevant ones. Directories identify document roles and parent topics, filenames name individual entries, and each README.md

routes the agent to the next level. When a subject grows, a single file can be promoted into a directory with its own README and supporting documents. Paths, filenames, README indexes, and headings can therefore work like a book, letting an agent find the relevant specs, architecture, tests, and plans without reading the entire project.

When documents are mixed in one directory or stored under names such as NOTES.md

and FINAL.md

, an agent cannot tell which file contains the current spec, architecture, or test strategy without opening it. When the path exposes the role, as in docs/spec/CLI_INTERFACE.md

, docs/arch/CLI_ARCHITECTURE.md

, and docs/test/CLI_INTERFACE.md

, the table of contents distinguishes the spec, architecture, and tests before any body is loaded.

Good project memory does not expose everything all the time. Paths and indexes help an agent find what the current task needs and exclude documents with different roles before reading them.

We rarely read a book from the first page to the last when looking for one answer. We inspect the table of contents and move to the relevant part and chapter. Project documentation can follow the same model.

docs/
β”œβ”€β”€ README.md                         # Table of contents for the whole book
β”œβ”€β”€ concept/                          # Part 1: Core concepts
β”‚   β”œβ”€β”€ README.md                     # Part 1 index
β”‚   └── CONTEXT_CURATION.md           # Chapter: Context curation
β”œβ”€β”€ spec/                             # Part 2: Product behavior
β”‚   β”œβ”€β”€ README.md                     # Part 2 index
β”‚   β”œβ”€β”€ PROJECT_INITIALIZER.md        # Chapter 1: Project initialization
β”‚   └── cli/                          # Chapter 2: CLI
β”‚       β”œβ”€β”€ README.md                 # Chapter 2 index
β”‚       └── CONFIG_COMMAND.md         # Chapter 2, section 1: config command
β”œβ”€β”€ arch/                             # Part 3: Architecture and constraints
β”‚   β”œβ”€β”€ README.md                     # Part 3 index
β”‚   └── DOCS_STRUCTURE.md             # Chapter: Documentation structure
└── test/                             # Part 4: Tests
    β”œβ”€β”€ README.md                     # Part 4 index
    └── CLI_INTERFACE.md              # Chapter: CLI regression tests

Read this structure as a route through nested indexes. spec/

is the top-level index for product specs, and PROJECT_INITIALIZER.md

is one entry beneath it. When the CLI subject grows, cli/

becomes a new child index and cli/README.md

routes readers within it. CONFIG_COMMAND.md

is one entry in that child index. In book terms, these correspond to Part 2, Part 2 Chapter 1, Part 2 Chapter 2, and Part 2 Chapter 2 Section 1.

Full path Role in the table of contents Book notation
docs/README.md
Top-level index for the whole book Full table of contents
docs/spec/README.md
Area index for product behavior Part 2 index
docs/spec/PROJECT_INITIALIZER.md
Project initialization entry Part 2, Chapter 1
docs/spec/cli/README.md
Child index for CLI documents Part 2, Chapter 2 index
docs/spec/cli/CONFIG_COMMAND.md
config command entry Part 2, Chapter 2, Section 1
docs/arch/DOCS_STRUCTURE.md
Architecture of the documentation system A chapter in Part 3
docs/test/CLI_INTERFACE.md
Test strategy for CLI behavior A chapter in Part 4

A small subject starts as one indexed file. When it grows, it becomes a directory with a README.md

and its own child entries. The filename names the entry, while the full path is its address from the top-level index.

A directory does more than group documents by topic. It tells an agent how to interpret the information inside.

concept/

explains mental models and core concepts.spec/

defines the product's current specs.arch/

explains architectural rationale, structure, and technical constraints.test/

records regression tests and manual test procedures.report/

preserves evidence from research and measurement.plan/

records the intent of active work.archive/

preserves completed work and historical context.Consider this path:

docs/spec/cli/CONFIG_COMMAND.md

This document describes the CLI config command in the current product specs.

Paths change the meaning even when documents cover the same subject.

docs/arch/CLI_ARCHITECTURE.md
docs/test/CLI_INTERFACE.md
docs/archive/plan/cli-refactor/README.md

The first explains architecture, the second explains testing, and the third records historical work. Their paths reveal role and freshness even when their bodies use similar terms.

The following filenames distinguish files but do not explain their contents.

DOCUMENT_1.md
NOTES_NEW.md
FINAL_V2.md
MISC.md

These names expose scope before the files are opened:

PROJECT_INITIALIZER.md
CLI_INTERFACE.md
LOAD_SNAPSHOT.md
VALIDATION_ARCHITECTURE.md

A good filename works like a chapter title that is meaningful in the table of contents. Dotdotgod uses kebab-case for directories and UPPER_SNAKE_CASE for durable Markdown documents. README.md

is the predictable entry point for every directory.

CONFIG_COMMAND.md

is more useful than API_1.md

because it names behavior and domain instead of writing order. Stable, specific names let people and agents use the same vocabulary when finding and referencing documents.

Each directory's README.md

is a local index rather than a generic introduction.


- `CLI_INTERFACE.md`: user-facing CLI specs
- `PROJECT_INITIALIZER.md`: project initialization behavior
- `cli/`: detailed specs for individual CLI commands
- `plan-mode/`: plan mode and staged execution specs

An agent can read this README and choose the next document without opening every file in the directory. This is why adding, moving, or renaming a document should update the nearest README in the same change.

Do not begin with a complex hierarchy. If a subject has one document, start with one file.

docs/spec/PAYMENT.md

When the domain grows into multiple documents, promote it to a directory.

docs/spec/payment/
β”œβ”€β”€ README.md
β”œβ”€β”€ LIST_API.md
β”œβ”€β”€ SUMMARY_API.md
└── REFUND_POLICY.md

payment/README.md

becomes the intermediate index between the spec area and its individual documents. An agent narrows the search in four steps:

docs/README.md

.docs/spec/README.md

.docs/spec/payment/README.md

.The amount of possible context grows with the project, but an index keeps the context required for the current task small.

When changing the current behavior of a CLI command, inspect docs/spec/cli/

first. Read docs/arch/

when implementation constraints matter, docs/test/

when regression coverage matters, and docs/archive/

only when a historical decision is relevant.

The documentation structure answers two questions:

Good project memory is not a system that injects every document into every prompt. It provides a route to relevant information and a boundary that excludes irrelevant information.

It is natural to begin project-memory design by asking what to store. First ask whether the information has a useful address.

Directories divide the book into parts, filenames name chapters, README indexes route readers, and headings narrow a document into sections.

Designing documentation for AI is not cosmetic file organization. It is designing a table of contents that lets an agent reach the chapter required by the current question without reading the whole project.

── more in #artificial-intelligence 4 stories Β· sorted by recency
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain β€” perfect for shipping the agent you just read about.

$git push zahid main
β†’ Live at https://your-agent.zahid.host βœ“
Get free account β†’ Pricing
from €0/mo Β· no card required
LIVE [news/ai-agent-memory-star…] indexed:0 read:6min 2026-07-19 Β· β€”