The Loop That Remembers
Graph Engineering for Multi-Agent Development Everyone is building loops. Generate, critique, revise. Tools, worktrees, skills, sub-agents. The five pieces are well understood and widely documented — and every version of the list ends with a shrug: and you'll want some kind of memory, a scratchpad, a NOTES.md.
That shrug is the whole problem.
The memory is not the sixth piece of the loop. It is the thing the loop exists to produce.
This mini book takes that inversion seriously and follows it all the way down. It picks up where The Clarity Forge left off — with lat.md/, the lattice of ADRs, vocabulary, invariants, patterns, and principles — and finishes the job: turning a directory of Markdown files into a queryable, typed, provenance-bearing metagraph that many agents read from and write to at once, wired into every stage of the OpenSpec pipeline.
What You Get
- The two-graph distinction — why every serious agentic system needs a work graph (what happened) and a knowledge graph (what is true), why collapsing them destroys both, and the exactly two predicates that bridge them.
- The ladder — loop, chain, swarm, DAG, knowledge graph — with what each one externalises and a six-question decision procedure for picking a rung.
- A complete schema — twelve node types, eleven authored predicates across two planes, two derived relations, four layers, and five graph invariants you can write a linter against.
- Lattice metagraphs — why the forge lattice was a metagraph from day one, the three reification patterns that matter, and how to implement it in Markdown plus 300 lines of indexer instead of a database that does not exist.
- Semantic Spacetime for the lattice — the four fundamental relations, the discovery that the forge's five predicates are blind in exactly one direction, and pragmatic proximity as the mechanism that serves seven pipeline stages from one graph.
- The seven-step context builder — bounded, typed, time-filtered retrieval under a token budget, with stable edge IDs so answers can cite.
- The grounded evaluator — replacing "looks good" with a structured verdict that names the missing edge.
- The rewired pipeline — every forge stage with its graph reads and writes, and an archive command extended from mint → touch → resolve to mint → touch → resolve → link → check.
- Swarm coordination via promise theory — write scopes, correlated errors, reducer contracts, and why worktree isolation is necessary and nowhere near sufficient.
- A six-step build path with an exit criterion at every step, from one reflective loop on Day 1 to a graph-grounded swarm by Month 2.
- A full chapter on when not to build any of this.
Who It Is For
- Engineers running Claude Code, Cursor, Codex, or any coding agent unattended, who have noticed that the loop ships code and loses reasoning.
- Teams whose
lat.md/ lattice has outgrown grep — more than a hundred nodes, more than one writer. - Anyone who has come back to forty green commits and could not say why the retry budget is three.
- Knowledge-graph practitioners who want the agentic-workflow application rather than another survey.
This is a field guide. Every schema is implementable, every prompt is runnable, and the whole thing runs on Markdown files if you want it to — the graph index is disposable and rebuilds in seconds.
What It Is Not
It is not a survey of agent frameworks, a defence of any graph database, or an argument that every team needs a knowledge graph. Chapter 12 spends most of its length arguing the opposite, because the failure mode of this decade is not too little structure — it is structure adopted for its own sake.
If a NOTES.md and a disciplined ADR log already let you trace every important output to an objective, a plan, an artifact, a source, a graph path, an evaluator decision, and a bounded execution record, then you are done, and this book will tell you so.
The Series
📖 Clarity Engineer: Code Is the Side Effect — the discipline.
🔨 The Clarity Forge — the pipeline. 🕸
The Loop That Remembers — the memory.
Also relevant: Semantic Space Time for AI Agent Ready Graphs, Beyond Context Graphs, Temporal Aware AI memory, and LadybugDB for Edge Agent AI memory.
About the Author
Volodymyr Pavlyshyn writes and builds at the intersection of agent orchestration, knowledge representation, and the durable artifacts that make software teams legible to themselves. He is the author of Clarity Engineer, The Clarity Forge, and a series of books on graph-based memory for AI agents.