Chris F

Start every agent at the map

Chris F ·

In short: most of what my AI agents spent was not thinking. It was finding their way around. Now every agent reads two short map files before it touches anything, and leaves a full report in a worklog when it is done. The next agent starts from that report instead of from zero.

Flow: top map, then repo map, then the job; the job writes a worklog and a short reply; the next agent starts from the worklog.
The whole loop: read two short maps first, write one full report last.

Context

I run Claude Code at home on a pile of my own projects: a robot side project, a few household tools, an ideas journal, some experiments. That is a couple dozen git repos on one laptop, plus a small always-on box in the house that runs a code forge and CI.

When I started, every new agent session went the same way. It listed directories. It opened a README. It grepped for something, opened three wrong files, then found the right one. On a good day that took a few minutes. On a bad day it took a big slice of the context window, and the real work started with the agent already half full of file listings.

I asked Claude whether a search engine over all my docs would help. The honest answer was: maybe later, but the cheap fix is a map. Most of the cost was re-learning the layout, not searching. A person joining a team gets a "here is where things live" walkthrough on day one. My agents were getting dropped in a field with a flashlight.

Before: list directories, open a README, grep and open wrong files, then find the right file with the context half full. After: read the top map, read the repo map, open the right file.
Before and after: the exploring steps the map replaced.

The second half of the problem was the other end of the job. Agents wrote long final reports into the chat. I don't read walls of text on my phone, and the next agent couldn't see them at all, because each session starts fresh. The report existed for about ten minutes and then it was gone.

Shakey, a tall boxy research robot with a camera head on a wheeled base, in a museum case.
Maps for robots are an old idea. Shakey, built at SRI between 1966 and 1972, planned its moves on a model of its rooms; the A* search algorithm was invented for it.
Photo: Carlo Nardone, CC BY-SA 2.0, via Wikimedia Commons (cropped (museum sign removed) and resized)

Detail

Two levels of map

There is one top-level map for the whole projects folder, and one map per repo.

The top map is a single Markdown file. It has a small text graph of how the repos relate, then a table with one line per directory: what it is, how big it is, and where it is mirrored. A trimmed example:

| Directory    | What                                  | Size  | Mirror |
|--------------|---------------------------------------|-------|--------|
| robot        | robot software, sim, devlog sources   | big   | forge  |
| home         | household projects                    | 1 M   | forge  |
| ideas        | ideas journal                         | 400 K | forge  |
| blog         | this blog's drafts and build script   | small | forge  |

Each repo then has its own MAP.md: what lives where, which files are generated (so nobody edits them by hand), and the rules that matter in that repo. "This folder holds other people's names, never publish it." "This README is generated by a script, edit the script." The kind of thing a new teammate would otherwise learn by breaking it.

One top-level projects map points to a MAP.md in each repo: robot, home, ideas and blog. Each repo map says what lives where, what is generated, and the rules.
Two levels: one map for the whole folder, one per repo.

The rule in every agent brief is one line:

Start at ~/projects/MAP.md, then the repo's MAP.md. Fix the map if you find it wrong.

That last sentence matters. A map nobody maintains is worse than no map, because the agent trusts it. So whoever notices the drift fixes it in the same commit as the work.

Flow: the agent reads the map and does the work; if the map is wrong it fixes it in the same commit. A script refreshes the generated block, and a CI check fails when it is stale.
Two guards against a stale map: the agent fixes drift as it goes, and CI checks the generated part.

Generated where it can be

Part of each repo map is generated: a file tree with sizes and a list of entry points. A small script writes that part and can also check it, so CI fails when the map no longer matches the files:

repo-map write    # refresh the generated block in MAP.md
repo-map check    # exit 1 if the generated block is stale

The hand-written part stays short. If a map grows past a screen or two, it is turning into documentation, and the agent will skim it the same way it skimmed the README.

Worklogs: the full report goes in a file

Every agent writes its full report to a dated file in a worklog folder, which is committed with the work:

worklog/2026-11-25/0057-blog-drafts.md

Its reply to me in chat is capped at about 15 lines: what changed, where the report is, and anything I need to decide. The long version, with commands run, numbers and dead ends, is in the file. When the next agent picks up the same thread, its brief just points at that file. It does not need the previous conversation at all.

An agent finishes a job and writes a dated worklog file plus a short chat reply. The next agent's brief points at the file, and I can read the folder weeks later.
The full report goes in a file in git; the chat reply stays about 15 lines.

This also gave me something I didn't plan for: a history. Weeks later I can open a day's folder and see what was tried and why it was dropped. That turned out to be as useful for me as for the agents.

Lessons

Try it

You don't need my setup for this. If you use any coding agent on more than one repo:

  1. Write a top-level MAP.md with one line per project. Ten minutes.
  2. Add a MAP.md to your busiest repo: where things live, what is generated, the two or three rules that bite.
  3. Tell the agent, in whatever standing instructions it reads, to start there and fix the map when it is wrong.
  4. Give it a folder for full reports, and ask for short replies that point to them.

The first session after I did this, the agent went straight to the right file. That was the whole point.


Drafted with Claude.