Your coding agent shipped forty commits this weekend. Ask it why the retry budget is three.


You set the loop running on Friday.

Generate, critique, revise. Tools wired in. Three worktrees, three sub-agents, a reducer at the end. Textbook loop engineering — exactly what every write-up this year told you to build.

Monday morning: forty commits, a green test suite, a summary that reads beautifully.

Then you ask the only question that matters.

Why is the retry budget three?

Nobody knows.

Not you — you were asleep. Not the loop — its context window closed on Friday night and took the reasoning with it. Not the commit log — it records that MAX_RETRIES = 3 was written. It does not record that an agent tried five, watched the rate limiter trip, and settled on three.

The artifact survived. The decision evaporated.

That gap is the entire subject of my new book, and it is not a graph problem. It looks like one. It gets solved with graph-shaped tools. But the thing that’s actually broken is memory — and we have no discipline for it.


The shrug at the end of every loop-engineering post

Everyone is building loops right now, and the advice has converged on five pieces: automations, tools, worktrees, skills, sub-agents.

Good list. Genuinely. And every version of it ends with the same shrug:

…and you’ll want some kind of memory. A scratchpad. A NOTES.md. Whatever.

That shrug is the whole problem.

We have prompt engineering. We have context engineering. We now have “graph engineering” trending. What we don’t have is memory engineering — a discipline that treats what the system remembers as a designed, typed, queryable, gated artifact rather than as exhaust from the run.

Here is the inversion the book is built on:

The memory is not the sixth piece of the loop. It is the thing the loop exists to produce.

Code is the side effect. The spec is the durable artifact. The memory is the durable artifact. It’s one move applied at three depths — and most teams stop at the first.

Get that inversion wrong and scaling the model scales the failure. A better model gives you more diff you can’t read, more locally-justified iterations, and a smoother slide into approving work you don’t understand. Those aren’t model-capability problems. They’re architecture problems — specifically, problems about where memory and evaluation live.


The ladder: what actually comes after loops

There’s a progression, and each rung exists to move exactly one thing out of the model’s head and into the world.

🔁 Loop — externalizes iteration and evaluation. Use it when the output can be checked.

⛓️ Chain — externalizes task order. Use it when the sequence is stable.

🐝 Swarm — externalizes parallel search and roles. Use it when subtasks are genuinely independent.

🌳 DAG — externalizes experiment lineage. Use it when alternatives must stay alive. 🕸️ Knowledge graph — externalizes facts, provenance, and cross-session memory. Use it when facts must survive the session.

Read it top to bottom: time → space → history → meaning.

Each rung fixes a limitation the previous one created. The loop only knows the current attempt. The swarm produces branches nobody tracks. The DAG records what changed and never what is true.

The progression isn’t mandatory — it’s directional. But you can’t skip rungs. A knowledge graph fed by unevaluated workers is a beautifully organised pile of unverified claims.

Notice what the ladder actually is, though. It isn’t a taxonomy of graph structures. It’s a taxonomy of what your system is allowed to forget at each level. That’s memory engineering wearing a graph costume.


The finding that surprised me most: there are two graphs, not one

Every serious agentic system needs two graphs, and collapsing them destroys both.

The work graph answers what happened. Immutable history. Machine-written, fast, concurrent, append-only. Runs, attempts, diffs, evaluations, rejected branches.

The knowledge graph answers what is true. An in-force belief set. Curated, gated, slow. Invariants, vocabulary, decisions, principles.

Collapse them toward work and you get a gorgeous event log with no node for “totals are non-negative integers” — so nothing can honor it, and nothing can check it.

Collapse them toward knowledge and you get a clean ontology that can’t tell you which run introduced a change or what the previous definition was.

They’re different mathematical objects with different write disciplines, different concurrency models, and different failure modes. Exactly two predicates bridge them. Most “agent memory” products ship one graph and inherit both failure modes.

The second surprise came from holding the lattice from The Clarity Forge — five node types, five named edges — against Semantic Spacetime’s four fundamental relations. Four of the five predicates mapped cleanly.

The fifth mode had nothing. The lattice has no similarity relation at all.

That single gap explains four of its six documented failure modes: duplicate nodes nobody detects, vocabulary drift, retrieval that degrades to grep, and — the dangerous one — the inability to distinguish an orphaned invariant from one that is being silently violated.

A memory system that can’t tell “nobody uses this rule” from “everybody is breaking this rule” isn’t a memory system. It’s a filing cabinet.


The test you can run today, before buying anything

Take the last non-obvious thing your agentic system produced. Fill in the blanks:

This output traces to objective ___, plan ___, artifact ___, source ___, graph path ___, evaluator decision ___, and bounded execution record ___.
  • Fill them by querying something → you have a loop that remembers.

  • Fill them by opening a transcript and reading → you have a loop that logged. Not the same thing.

  • Can’t fill them at all → every agent you add from here makes the forgetting faster and harder to notice.

When that sentence is true, agents add throughput. When it’s false, agents add opacity.

That’s the whole book in one sentence. Everything else — twelve node types, eleven predicates, four layers, five lintable invariants — exists to make that sentence cheap to satisfy.


📖 The book: Graph Engineering — The Loop That Remembers

👉 Get it on Leanpub → leanpub.com/graphengineering

Thirteen chapters on turning lat.md/ from a directory of Markdown files into a queryable, provenance-bearing metagraph that many agents read from and write to at once.

What’s inside:

  • The two-plane schema — twelve node types, eleven authored predicates, two derived relations, four layers, five graph invariants you can write a linter against.

  • Lattice metagraphs — the three reification patterns that matter, implemented in Markdown plus ~300 lines of indexer, instead of a database that doesn’t exist yet.

  • Semantic Spacetime for the lattice — the four fundamental relations, and pragmatic proximity as the one mechanism that serves seven pipeline stages from a single graph.

  • The seven-step context builder — bounded, typed, time-filtered retrieval under a token budget, with stable edge IDs so answers can actually cite.

  • The grounded evaluator — replacing “looks good” with a structured verdict that names the missing edge.

  • Swarm coordination via promise theory — write scopes, correlated errors, reducer contracts, and why worktree isolation is necessary and nowhere near sufficient.

  • Six runnable prompts, a full schema reference, and a one-page field card.

  • A whole chapter arguing you probably shouldn’t build any of this.

And a build path with an exit criterion at every step, because you don’t get to skip a rung:

WhenBuildExit criterionDay 1One reflective loop — store every version, including rejectsMeasured quality improvementDay 2One tool, for one known error class. Not fiveIt reduces that error classWeek 1Planning — only if the task path variesVariable tasks completeWeek 2Two roles: generator and critic, artifact contract at every handoffThe split beats a single agentMonth 1The persistent graphCross-session queries workMonth 2The swarm — define the reducer before the fan-outWall-clock gain, no quality loss


It’s the third book in a series, and the series is the argument

Each book takes the same inversion one level deeper.

📘 Clarity Engineer: Code Is the Side Effect — the discipline. Why engineering judgment, not code, is the real work.

🔨 Clarity Forge — the pipeline. Six stages, seven iron rules, the lat.md/ lattice, and the rule that inverts everything: escalate the spec, not the code.

🕸️ Graph Engineering: The Loop That Remembers — the memory. This one. It gives the pipeline something that survives the session.

The formal grounding, if you want to go deeper on the representation side:


One honest note, since this book is partly about provenance

“Graph engineering” is trending largely on the back of a PDF circulating as Andrej Karpathy’s 12-page drop.

It isn’t. It’s 11 pages, anonymously authored, and its own title page says “independently compiled — not affiliated with Andrej Karpathy and Anthropic — and not endorsed.” The same template has been posted crediting Karpathy, Andrew Ng, “a senior Anthropic engineer,” and “two Anthropic seniors.”

The underlying synthesis is genuinely good, and I cite it throughout — as a third-party synthesis, on its merits, never as a byline.

If we’re going to spend a book arguing that every claim needs a source, that seems like the minimum.


If you read one chapter, read Chapter 12

It spends most of its length arguing you probably shouldn’t build a graph.

If a NOTES.md and a disciplined ADR log already make that traceability sentence true — you’re done. Genuinely. The failure mode of this decade isn’t too little structure; it’s structure adopted for its own sake.

But if you’ve come back to forty green commits and couldn’t say why the retry budget is three, the shrug isn’t going to hold much longer.

Build the loop. Just build the one that writes down why.

📖 Graph Engineering: The Loop That Remembers → leanpub.com/graphengineering

The agent forgets. The graph doesn’t. That line only means something when the memory is an active constraint, not a sticky note.

Originally published on Sovereign Agentic AI on Substack.