M

Graph engineering: the 12-step roadmap from note-taker to graph builder.

10 min readView source ↗

Cover image

Everyone's building a second brain. Almost no one builds the part that makes it work.

Open your notes folder right now. If it's a flat pile of files, here's what happens every time you ask Fable 5 one question: it reads all of them.

That's 5,000 notes and 800,000 tokens burned to hand you one answer. slow, expensive, and half the time it still grabs the wrong file.

That's not a brain. It's a haystack you taught your AI to search.

A second brain is only as good as the graph underneath it. This is the 12-step roadmap to that graph - from a pile the model drowns in to a structure it walks in milliseconds.

> the pile: all 5,000 notes read to answer one question the tokens: ~800,000 per answer, billed at $50 / million out the graph: 3 files read, answer back in under a second the delta: 40% cheaper on a real build, and right far more often

before we go further, so you don't miss the rest of this:

follow me here @kingwilliam_. that is the only "ask" in this article. everything below is the actual system.

Everyone screenshots the wrong layer - the glowing web of dots, the graph view. one builder running this at scale put it best:

> "the pretty graph is for you. the index is for the model. only one of them makes it faster."

That's the whole game. The poster on the wall versus the engine under the hood.

Graph engineering is building the engine: the router, the index, the nodes, the edges, and the code that walks them.

12 steps. 3 tiers. The layer that decides whether your second brain thinks or just sits there looking impressive.


Part 1 · what a graph is

1. [ A graph is a routing structure, not a picture ]

Four parts. A router the model reads first, an index it scores against, nodes that hold the knowledge, edges that point between them.

That's it. Memory, skills, live data - all just ways of shaping one of those four.

The galaxy of dots you posted is decoration. It proves connections exist. It does nothing to stop the model reading 5,000 files to answer one question.

Same notes, different structure, completely different brain.

2. [ The whole graph lives in one folder ]

Everything that shapes retrieval sits in one directory. Learn this layout and you can read anyone's second brain in ten seconds:

brain/
├─ CLAUDE.md      # the router - read every session, kept tiny
├─ index.md       # one line per node: name, link, description
├─ nodes/         # your notes, one idea per file
│  ├─ billing-rules.md
│  └─ client-acme.md
├─ skills/        # reusable retrieval + write workflows
│  └─ save-note/SKILL.md
└─ state/         # what survives between sessions
   └─ STATE.md

One rule keeps a graph clean: you should be able to say why every file exists.

Can't explain a node? It shouldn't have one.

3. [ Graph vs pile vs system. Three floors, don't stack them wrong ]

The pile is notes in a folder with no map. Ask it anything, it reads everything.

The graph is that same knowledge with a router, an index, and edges. Ask it anything, it reads three files.

The system is a graph with memory that compounds. Every session leaves the next one sharper.

Most "my second brain is a mess" pain is these three tangled together. Untangle them and the whole thing gets fast.

4. [ The default second brain is a hoarder, not a librarian ]

Point Fable 5 at a folder and yes, it "works." It finds things by reading the entire pile on every query.

40 notes? Fine. 4,000 notes? Now every question scans your whole life and bills you at $50 per million output tokens.

A hoarder owns everything and finds nothing. A librarian owns the same books and hands you one in seconds.

The next eight steps make Fable 5 the librarian.


Part 2 · build the graph

5. [ The router. CLAUDE.md, kept brutally short ]

CLAUDE.md is read at the start of every session. It's a map, not a manual: "billing lives here, this client lives there."

The killer mistake: it grows into a novel. Every session then drags that novel into context before it does a thing.

Under 500 tokens. Facts and directions only. The knowledge lives in the nodes.

→ router prompt:

Turn my CLAUDE.md into a pure router, under 500 tokens. List where each
kind of question goes - not the answers - plus one standing rule: read
index.md first, open only the top node, follow one edge if it points
elsewhere. Move everything that's actual content out into nodes/.

6. [ The index. One line per node. This is the secret ]

The index is how the model knows where an answer lives without opening a thing. One line per node: name, link, one sentence.

# index
- billing-rules.md | rates, refunds, dunning | how we bill and when
- client-acme.md    | Acme account            | contacts, scope, gotchas
- voice.md          | writing voice           | tone rules + banned words

Build one habit from day one: every new note gets a line here, automatically, forever.

A current index makes retrieval cheap for life. An index that drifts turns your graph back into a pile.

→ index prompt:

Set up index.md that catalogues every node in one line: name, link, one
sentence. Make saving a note auto-append its index line so the catalogue
can never drift from reality.

7. [ Nodes. One idea per file. No exceptions ]

A node does one job. Small, sharp, named so the title alone tells you what's inside.

The enemy is the mega-note - the 4,000-word file that touches ten topics. To use one line of it, the model swallows all ten.

Split by idea. Small nodes are cheap to open. Fat ones bleed tokens.

8. [ Edges. Pointers, not the pretty picture ]

An edge is a link inside a node to another node. That's the real graph - the pointer, not the visual.

A node answers half your question and links to the one that finishes it. The model follows one edge instead of ransacking the vault.

Link what a node depends on, nothing else. Ten sharp edges is a graph. Fifty is noise wearing a graph's clothes.

9. [ Retrieval as code, not model calls. The move nobody makes ]

Here's why their graph stays slow: they let the model do the finding. But finding needs zero intelligence. It's a scoring problem, and it belongs to code.

The ladder:

1. strip the question to keywords, drop the filler
2. score every node from index.md alone - open nothing
3. open only the top node, not three, not "just in case"
4. read only the section that answers, not the whole file
5. follow one edge if that section points elsewhere
6. now the model runs - once, evidence already in hand

Steps 1 through 5 run in milliseconds, because they're code, not model turns. The model fires once, at the very end.

One real build of this cut cost 40% versus default and came back faster.

The model isn't reading your library anymore. Your code hands it the one page it needs.

→ retrieval-as-code prompt:

Build retrieval as deterministic code, not model calls: strip my question
to keywords, score nodes from index.md WITHOUT opening files, open only the
single best node, read only the section that answers, follow one edge if
needed. The model runs once, at the end, with the evidence attached.

Part 3 · make it compound

10. [ Prove it. Make the graph beat the pile on the clock ]

Don't trust it. Race it. Same questions through a fresh default session and through your graph, side by side.

→ prove-it /goal:

/goal don't stop until retrieval is clearly faster and cheaper than a flat
folder, proven by tests you run yourself. Same questions both ways, compare
tokens with /context and wall-clock time, verify the answers are correct,
show me a table. Keep optimising until the graph wins.

That /goal flips Fable 5 from a tool you babysit into one that grades itself. It tests, catches its own misses, and keeps going while you're gone.

11. [ Add memory. What the model forgets, the graph remembers ]

The model wipes clean between runs. The graph doesn't have to.

A state file logs what was tried, what worked, what died. Every run ends by writing to it and starts by reading it.

When a lesson is general, it graduates from the state file into a skill. That's the honest meaning of "self-improving" - not a model that learns, but a graph that accumulates.

12. [ Ship it. Portable, and yours ]

The value was never Fable 5. It's the router, the index, the edges, the rules - plain text in a folder you own.

Every serious model reads markdown, follows a router, walks an index. Unplug Fable 5 tomorrow, plug in whatever's next, lose nothing.

Models are engines. Your graph is the car. Engines get swapped. The car stays yours.


[ The graph mistakes that keep your AI slow ]

  • Running on the flat pile. No router, no index. The model reads everything to answer anything.
  • A bloated router. A CLAUDE.md that turned into a manual. Cut it to 500 tokens of pointers.
  • No index. Without it the model can't guess where an answer lives, so it opens files blind.
  • Mega-nodes. One giant file it has to swallow whole to use one line of. Split by idea.
  • Letting the model do the finding. Finding is a code job. Save the model for the thinking.
  • No memory. Every run restarts from zero. The state file is what makes tomorrow resume.
  • Building the graph before you have notes. Empty structure is busywork. Write first, then engineer.

Conclusion:

The graph view gets the screenshots. The index does the work.

Everyone falls in love with the galaxy of dots. It's a poster.

Every decision that makes your AI fast or slow, cheap or ruinous, sharp or vague lives one floor beneath it: the router you wrote, the index you kept honest, the edges you drew, the code that finds before the model thinks.

Build that floor and everything above it compounds. The model reads three files instead of 5,000. The bill drops. The answers sharpen.

Self-improvement was never in the model. It's in the graph you build around it.

Pick the one thing you're not doing - probably the index, or code-before-model retrieval - and add it today. Keep the graph small enough to explain. Then get out of the way.

p.s. if you build one thing off this, make it the index. not the router, not the pretty edges - the index. it's the cheapest step here and the one every other step scores against. get that honest and the graph gets fast almost by itself.


bookmark this before it gets buried. if it was useful, send it to one person still dragging their AI through a pile of files.

Related articles