Module 3 · Agent Tools, Knowledge, Memory & Research Design · scripted
The Table of Contents
Overview
Now face the constraint that makes all this fetching necessary. The LLM has no memory, so every conversation begins in rediscovery: whatever context the task needs must be built up on the wall, again, from nothing — and there is no other door but the conversation. That makes findability an economic problem: given this task, how does the right context — and only the right context — reach the wall at minimum cost? This lesson is about the oldest answer civilization has: an entry point. A table of contents is a small, always-present map, written for a reader who knows nothing — which is every agent, every morning.
Where this fits
The information is out there in the library; the problem is locating it. An index answers "where is it" at a cost set by the depth of the tree, not the size of the collection.
Where this fits
Every conversation begins in rediscovery
Return to the hardest fact we know, and read it this time as an engineering constraint. The LLM has no memory. Every prompt is a rediscovery — the whole situation, reconstructed from the words on the wall. And every new conversation starts from absolute zero: whatever context the task needs must be built up, again, from nothing. Look at the bill:
The bootstrap bill
A fresh conversation, before it can do any useful work, must come to hold:
| About the task | About the world |
|---|---|
| what the task is | what the domain's rules are |
| what the constraints are | where the relevant things live |
| what's been done already | which tools exist |
| what "correct" looks like |
…and it must acquire all of this THROUGH the conversation — there is no other door. Whether we push it in up front, or the agent pulls it in on demand, the question is the same —
given this task, how do we FIND the right context — and only the right context — at minimum cost?
That question needs an architecture, not a trick. Think of how a human might do this. How do we help humans do this with books?
How a human does it
You need one fact from a 400-page policy handbook: the meal allowance for travel abroad. Nobody — nobody — reads the book.
How a human finds one fact in 400 pages
You read 3.5 pages of 400 — and every page you read was CHOSEN, by you, the one person who knows what you're looking for.
Now the same walk, performed by an agent with three plain tools:
You have the following tools available for use:
- get_toc( doc )
- read_overview( doc, chapter )
- read_section( doc, section )
Task: What's the meal allowance for conference travel to Japan?
get_toc(doc = "policy-handbook")1. Employment basics … 2. Facilities … 7. Travel and Expenses …
12. Data governance … [14 chapters, one line each]read_overview(doc = "policy-handbook", chapter = "7")7.1 booking rules · 7.2 domestic travel rates · 7.3
international per-diem (by country group) · 7.4 exceptions and
approvalsread_section(doc = "policy-handbook", section = "7.3")[2 pages: country groups, rates table — Japan: group A,
940 kr/day, meals covered at 60%…]Japan is per-diem group A: 940 kr/day with meals at 60% — so 564 kr/day for meals on conference travel.
The principle
Don't bring the book to the reader. Bring the reader a table of contents — and let every page that enters the conversation be one the task CHOSE.
Why trees: the mathematics of not reading everything
What you just watched has a shape — a tree: one root, branches, sub-branches, leaves. Here is the handbook drawn as one. The green nodes are the path the lookup chose; every other branch was never read:
The handbook as a tree
Trees are not just tidy; they have mathematics, and the mathematics is the whole reason this works. Two numbers govern everything: the branching factor (entries per level) and the depth (hops to a leaf):
The arithmetic of an index
10 entries per level, 3 levels deep —
10 entries per level, 6 levels deep —
Growth is exponential in depth; lookup cost is LINEAR in it. Doubling the library adds ONE hop — not double the reading.
And now say it in the currency this course cares about, because this is the property no other context structure we've met can offer:
The bounded-wall guarantee
The wall cost of a lookup is bounded by the DEPTH of the tree — not by the SIZE of the corpus. depth × (lines per index page) = the whole bill. The library behind the index can grow a thousandfold, and the conversation's cost for finding any one thing stays flat. The tree is how a small wall commands an unbounded shelf.
Knowledge graphs, and why the tree is the default
You will hear a great deal about knowledge graphs — entities, relations, edges everywhere. They are genuinely useful, and they are one of many representations. But when the task is "let an agent find what it needs," the humble tree should be your default, and the reasons are exactly the properties graphs give up:
Tree vs. graph, as navigation architecture
| Tree | General graph | |
|---|---|---|
| where do I start? | the root — always one, always known | …good question |
| cost of a lookup | bounded — at most the depth | unbounded — paths wander, cycles loop |
| can I estimate cost before building? | yes — branching factor and depth tell you everything | rarely — it depends on connectivity |
| does the model already know the conventions? | deeply — books, folders, outlines | conventions vary per graph |
The rule that falls out:
The default rule
If the knowledge CAN be a tree, make it a tree.
Where reality refuses — a topic that truly belongs in two
places — add a cross-reference link, the way books have
always done ("see also §7.4").
Reach for richer structures only when the RELATIONS are
the knowledge. Navigation wants a root.The filesystem is a tree you already have
Here is the practical gift waiting at the end of this idea: you do not need to build this architecture. Every computer ships with it. Folders contain files and subfolders; those contain more; one structure, arbitrarily deep — and, critically, the model has read millions of well-organized projects. The conventions — a README at the root, names as labels, nesting as decomposition — are trained in. Hand an agent an organized folder and it already knows how to walk it:
You have the following tools available for use:
- list_files_in_folder( path )
- read_file( path )
Task: You've been given the folder for our fjord-monitoring project. Find the calibration procedure for the salinity sensors.
list_files_in_folder(path = ".")README.md · data/ · instruments/ · reports/ · admin/read_file(path = "README.md")"Fjord monitoring project. data/ = raw exports by month.
instruments/ = per-instrument docs and procedures. reports/ =
weekly summaries. admin/ = contracts, access."list_files_in_folder(path = "instruments/")salinity-array/ · temperature-chain/ · weather-station/read_file(path = "instruments/salinity-array/calibration.md")[the procedure: monthly calibration, reference solution, the
two-reading rule…]Writing the tree: knowledge that outlives the conversation
So far the agent has been the tree's reader. Now the move that completes the architecture: the agent can be its author. A conversation that did real work — decisions made, dead ends found, results established — usually preserves it, if at all, as a transcript. But a transcript is a terrible representation of knowledge: the decisions are buried in the walking. The better move, and it costs a few tool calls:
You have the following tools available for use:
- write_file( path, content )
Task: Good stopping point — capture where we are for whoever picks this up.
write_file(path = "notes/INDEX.md", content = "START HERE.
Project state as of 2026-09-18:
· GOAL: see notes/goal.md (unchanged)
· DECIDED: mixed models over ANOVA — why: notes/decisions.md
· DEAD ENDS: two approaches ruled out — notes/dead-ends.md
· OPEN: reviewer 2's power question — notes/open-questions.md
· DATA: cleaned set at data/v3/ — do NOT use v2 (unit bug)")OK. notes/INDEX.md written.write_file(path = "notes/decisions.md", content = "[each
decision, three lines: what, why, what it rules out]")The two directions
READ the tree: bootstrap this conversation from the
structure someone left.
WRITE the tree: leave the structure the next conversation
will bootstrap from.
An agent that does both has something an LLM cannot have:
a memory — kept in folders, addressed by an index,
paid for only when walked.Choosing the structure: how would you train a human?
One question remains: facing a new domain, how do you decide what the tree should be — what the branches are, what lives at the leaves? Here is the heuristic that almost never fails: ask how the discipline trains a brand-new human. Every mature field has already invented, tested, and debugged its training architecture on generations of confused beginners:
Pre-validated trees, everywhere
| Field | The tree it grew |
|---|---|
| medicine | protocols and checklists — indexed by situation, one page each, drill-down to the rare cases |
| a lab | the SOP binder — one procedure per tab, the front page is the index of tabs |
| operations | the runbook — symptom → page → steps, written to be read at 3 a.m. |
| a kitchen | the recipe canon and the station layout — what to make, and where everything is |
Every one of these is a tree with an entry point, grown to train zero-knowledge humans fast. Steal it: the folders and files are already designed — they're just not written down as folders and files yet.
The training heuristic
When you don't know how to structure a domain's context, ask: how would we train a new employee to do this? The structures that teach humans are pre-validated context architectures. You rarely need to invent the tree — the discipline already grew one.
- Find the cross-cutting concern in your field — the topic that honestly belongs under three branches at once. Does a "see also" link solve it, or is this the case where the tree genuinely fails?
- In Example 3, what did the agent choose NOT to write down? Propose one rule for what earns a line in INDEX.md — and what should stay buried in the transcript.
Take a real corpus from your research world — a regulation, a methods literature, your own project's accumulated material. (1) Design its tree: the root index, the branching factor, the depth; justify both numbers. (2) Walk two realistic lookups on paper, counting the wall cost at every hop. (3) Write the INDEX.md — the actual text — that would make a zero-knowledge agent (or a new student) productive in three reads. (4) Name the discipline whose human-training structure you just stole, and what you changed.