2.32 Graph Engineering Methodology — The Full ADR-270 Spec
In Plain EnglishA hoarder AI reads all 5,000 books every time you ask a question — 800,000 tokens burned per answer. A librarian AI keeps an index card catalog: score the cards, pull the one book, read the one chapter. That catalog is the graph. This page is the complete ADR-270 methodology reference: how agents find things (knowledge graph) and how agents execute work (workflow graph).
A hoarder AI reads all 5,000 books every time you ask a question — 800,000 tokens burned per answer. A librarian AI keeps an index card catalog: score the cards, pull the one book, read the one chapter. That catalog is the graph. This page is the complete ADR-270 methodology reference: how agents find things (knowledge graph) and how agents execute work (workflow graph).
The complete reference for the two-layer graph engineering paradigm adopted in ADR-270: the @kingwilliam_ knowledge graph (Router → Index → Nodes → Edges → retrieval-as-code) and the @AnatoliKopadze workflow graph (Fake Edge Test, Verifier Node, Fan-In Guard, Graph Spec format). This is the full spec that how-we-work summarizes in two paragraphs.
Section A The Librarian Analogy
Imagine two AIs. The first is a hoarder. Every time you ask it a question, it walks into a library of 5,000 books and reads every single one before answering. That costs about 800,000 tokens per answer — slow, expensive, and mostly irrelevant.
The second is a librarian. It keeps an index card catalog. You ask a question, it scores the cards without opening a single book, pulls the one book that matters, reads only the relevant chapter, and answers. That costs 3 files read and a fraction of the tokens — fast, cheap, and precise.
That catalog is the graph. The index cards are the Index. The books are the Nodes. The cross-references written on the cards are the Edges. The librarian's brain is the Router. And the whole system — score, open, read, follow, answer — is Retrieval-as-Code.
Section A Two Layers: Knowledge Graph + Workflow Graph
Graph engineering is not one thing. It is the same paradigm applied to two different problems:
How agents FIND information. The problem: a flat pile of 5,000 notes burns ~800,000 tokens per answer. The solution: Router → Index → Nodes → Edges → retrieval-as-code. The model never scans the repo. It strips the query to keywords, scores the index without opening files, opens only the top node, reads only the relevant section, follows at most one edge, then runs the model once. Result: 3 files read, answer in under a second, 40% cheaper.
How agents EXECUTE work. Nodes are jobs (one agent, one task, one input, one output). Edges are real dependencies — an arrow only counts when something real passes along it. The Fake Edge Test removes false sequential dependencies and reveals parallelism. The Verifier Node ensures no worker verifies its own work. The Fan-In Guard prevents synthesis on partial results.
Both layers were adopted in ADR-270 on 2026-07-25. The knowledge graph tells agents where to look. The workflow graph tells agents what to do next. Together they replace "the model guesses" with "the code retrieves and the graph routes."
Section B The 4 Parts: Router / Index / Nodes / Edges
A graph has exactly four parts. Nothing else is required. The "galaxy of dots" visualizations are decoration — they help humans feel good, but they do not make the model faster.
Under 500 tokens. A map, not a manual. Knowledge lives in nodes, not in the router. The router's only job is to say "start here" and point to the index.
One line per node: name | link | one sentence. This is the secret. The model scores the index without opening any files. Auto-updates on commit. If you build one thing, make it the index.
No mega-notes. Fat nodes bleed tokens. One folder, one idea per node. If a node has more than one topic, split it. The model should read one section, not swallow a 300-line file to find one line.
Links from one node to another. 10 maximum. 10 sharp edges = a graph. 50 edges = noise. Edges are how the model follows a thread without re-searching.
One folder
Everything retrieval-shaping lives in one directory: router / index / nodes/ / skills/ / state/. Do not scatter the graph across the repo. One folder means the model knows where to look, and the auto-index script knows where to walk.
Section B Retrieval-as-Code
Retrieval is a code job, not a model job. The model should never "find" anything. The code finds; the model reads and answers.
Section B The 7 Failure Modes
These are the seven ways a graph fails. Each one is a specific, observable anti-pattern. If your system exhibits any of these, the graph is not working.
-
1Running on the flat pile — no router, no index
The model scans everything because there is no map. This is the default state and the most expensive failure.
-
2Bloated router — CLAUDE.md became a manual (>500 tokens)
The router is a map, not an encyclopedia. When knowledge lives in the router, the model reads the manual every time instead of the one node it needs.
-
3No index — model opens files blind
Without an index, the model guesses which files to open. It opens the wrong ones, or too many, or gives up and hallucinates.
-
4Mega-nodes — one giant file to swallow for one line
A 300-line file with 29 headings forces the model to read 300 lines to find one answer. Fat nodes bleed tokens and slow retrieval.
-
5Letting the model do the finding — finding is a code job
When the model decides which files to open, it uses attention, not precision. Code should score the index; the model should read what code retrieves.
-
6No memory — every run restarts from zero
Without a state file, the model wipes between runs. Lessons learned are lost. The graph must remember what worked and what died.
-
7Building the graph before you have notes — empty structure is busywork
A perfect folder hierarchy with no content is not a graph. Build the index only after you have nodes worth indexing.
Section B The Two-Tier Retrieval Model
ADRs are historical truth. Knowledge nodes are current truth. They cannot share the same retrieval tier.
READMEs, skills, specs. Current truth. Graph-indexed, scorer-ranked. The model retrieves from this tier when it needs to know how something works now.
Architecture Decision Records. Historical truth. Edge-linked as provenance from knowledge nodes only. ADRs must NOT appear in the main INDEX.md. They are linked FROM knowledge nodes via edges, not co-mingled.
The CLAUDE.md rule "never scan the ADR folder" is already the right instinct. ADR-270 encodes it as architecture: ADRs are provenance, not retrieval targets. When a knowledge node changes because of an ADR, the node links to the ADR as an edge. The ADR itself never competes with current truth in the index.
Section B Workflow Graph: Kopadze
The workflow graph applies the same node-and-edge paradigm to execution. A node is one job. An edge is a real dependency. The graph reveals where parallelism is hidden behind false sequential assumptions.
The Fake Edge Test
YES → real edge, keep sequential. NO → fake edge, run in parallel. You will find 2–3 fake edges in almost any workflow. Every fake edge is wasted time thrown away for free.
The Verifier Node
Never let a worker verify its own work. The verification node:
- Gets ONE finding — never the worker's full chat history.
- Has fresh context — it has NOT seen the work it is judging.
- Runs 3 skeptics in parallel: (1) is it correct? (2) is it current? (3) is the source real?
- PASS = majority of skeptics approve. FAIL = drop before it reaches the final answer.
This maps directly onto PA's verification gate: PA checks real output before reporting to Eugin, never trusting agent claims at face value.
The Fan-In Guard
const results = (await parallel(jobs)).filter(Boolean);
if (results.length < jobs.length) {
flag(`WARNING: ${jobs.length - results.length} of ${jobs.length} nodes returned nothing`);
}
// never synthesize on a partial set and call the report complete
A node that quietly dies returns null. Check the count before merging. Never synthesize on incomplete results. This is why the swarm-decision-analysis skill has a fan-in gate.
Graph Spec Format
How to write workflow instructions that a dispatcher can execute without ambiguity:
▸ GRAPH SPEC
GOAL: [what you want]
PARALLEL JOBS (run at once):
1. [job 1]
2. [job 2]
3. [job 3]
MERGE: [what to do with results]
HUMAN GATE: [pause point if needed]
VERIFY: [verification node description]
SAVE: [where to persist output]
When NOT to use a graph
- Single linear task with no parallelism available.
- When the overhead of graph setup > time saved.
- When you don't have enough jobs to justify fan-out.
Section C Gap Analysis: RAIA (Real estate Artificial Intelligence Agent) + Hermes
The swarm verdict (2026-07-25) assessed both systems against the 4-part graph model. These tables are the ground truth for what exists today.
RAIA (Real estate Artificial Intelligence Agent) (/root/projects/raia/)
| Component | File | State |
|---|---|---|
| Router | CLAUDE.md (62 lines) | Correct |
| Philosophy | soul.md | Correct — separate from router |
| Index | INDEX.md (manual, folder-level) | Exists, does not auto-update |
| State file | STATE.md §8 session log | Correct |
| Nodes | 03_technology/*/README.md | Fat — multi-topic (03_security: 29 H2s/338 lines; 12_documents: 29 H2s/341 lines) |
| Edges | ADR cross-references (informal prose) | No structured convention |
| Retrieval as code | Nothing | Does not exist |
| Auto-index | Nothing | Does not exist |
Hermes (/root/.hermes/)
| Component | Equivalent | State |
|---|---|---|
| Router | SOUL.md per profile | Correct |
| Index | skills_list() API | Programmatic, auto-updates |
| Nodes | skills/ directory | Near-perfect — one skill = one idea |
| Edges | related_skills: frontmatter | Sparse — ~43% of skills have zero edges |
| State | kanban.db + MEMORY.md | Correct |
| Retrieval as code | Nothing | Does not exist |
Section C The 3-Phase Transition Plan
ADR-270 is adopted incrementally. No pause in active development. The graph convention is encoded into tooling and enforced over time.
Phase 0 — Instrumentation (Days 1–2, ~6h) — COMPLETE
| Task | What | Effort | Owner | Status |
|---|---|---|---|---|
| T1 | Auto-index script — walks RAIA (Real estate Artificial Intelligence Agent) READMEs, emits one-line-per-node INDEX.md + pre-commit hook | 3h+1h | Programmer | Done |
| T2 | 4-property header (Scope/Status/Edges/Owner) on all 15 RAIA (Real estate Artificial Intelligence Agent) tech READMEs + enforce related_skills: in Hermes validator | 4–6h | Programmer | Done |
| T3 | Batch backfill related_skills: on ~30 zero-edge Hermes skills | 1h | Programmer | Done |
Exit criteria met: INDEX.md auto-updates on commit. All Hermes skills ≥1 edge. Meta-standard header on all RAIA (Real estate Artificial Intelligence Agent) tech READMEs.
Phase 1 — Scorer (Days 3–5, ~8h) — PENDING
| Task | What | Effort |
|---|---|---|
| T4 | Design scorer metrics (Eugin defines thresholds) | 2h |
| T5 | Implement scorer as Hermes cron logging retrieval patterns per session | 4h |
| T6 | Instrument RAIA (Real estate Artificial Intelligence Agent) CLAUDE.md to log node opens → STATE.md §8 | 1h |
| T7 | First scorer report after 5–7 sessions | auto |
Exit criteria: Ranked list of retrieval failures. Data to make node-split decisions.
Phase 2 — Surgical Splits (Days 8–12, ~6–10h) — PENDING scorer data
- Split top 3–5 worst nodes per scorer data.
- Re-score to confirm improvement.
- One README split per sprint, not a project.
Phase 3 — Steady State (ongoing)
| Convention | Enforcement |
|---|---|
| New RAIA (Real estate Artificial Intelligence Agent) nodes: 4-property header required | PR checklist |
New Hermes skills: scope: + related_skills: + status: | Validator |
| INDEX.md regenerated on commit | Pre-commit hook |
| Scorer runs weekly, flags degraded nodes | Hermes cron |
| Split trigger: >200 lines AND >3 distinct topics AND scorer flags | Scorer alert |
Section C Unified 4-Property Node Contract
Same four properties, different format per system. The index format is the unification layer.
name: skill-name
description: "One sentence — what this skill does."
related_skills: [skill-a, skill-b] # REQUIRED — min 1, max 10
**Scope:** One-sentence description of exactly what this system does.
**Status:** Active | Stub | Deprecated
**Last verified:** YYYY-MM-DD
**Related:** [03_security/README.md], [ADR-227], [04_datastores/README.md]
**Owner:** Coding agent (PR-gated)
What does NOT unify: index mechanism (API vs markdown), node granularity targets, state mechanism, retrieval tooling.
Section C Granularity & Edge Density Rules
>200 lines AND >3 distinct topics AND scorer flags = split. All three conditions must be true. Splitting without scorer data is vanity refactoring.
≥1, ≤10 edges per node. Zero-edge nodes are flagged by the scorer. More than 10 edges is noise — the model cannot choose.
Section C What Is NOT Adopted
ADR-270 is a partial adoption. These three ideas from the source material were explicitly rejected:
- Unified file format across systems. Hermes uses YAML frontmatter; RAIA (Real estate Artificial Intelligence Agent) uses README header blocks. The 4 properties are the same, but the format is system-appropriate. The index format is the unification layer, not the file format.
- 12-step rigidity. The 12 steps are a roadmap, not a checklist. We adopt the 4-part structure and the retrieval-as-code pattern, not the full ceremony.
- ADRs-as-nodes. ADRs are historical truth (Tier 2). They are not retrieval targets. They are linked from knowledge nodes as provenance edges only.
Section C Purist Node-Split Target Specs
These are the target architectures for the three worst RAIA (Real estate Artificial Intelligence Agent) nodes, to be executed after the scorer confirms the split decision. Each split produces a router README plus focused child nodes.
03_security/README.md (338 lines, 29 H2s) → 6 nodes
auth-guard-layer.md— BOLA pattern, requireStaffAssetAccessbyok-key-management.md— BYOK, AES-256-GCM, rotationsuperuser-access-policy.md— staff access, SaaS superuserrls-patterns.md— RLS policies, 401/403/404, UUID validationci-lint-enforcement.md— lint gates, CI enforcementREADME.md(router node) — ELI5 + edges to 5 nodes above
12_documents/README.md (341 lines, 29 H2s) → 8 nodes
lifecycle-model.md— Active/Archive/AI-HITL statesintelligence-layers.md— computed vs stored facts principleagent-contract.md— what agents can ask, events emittedper-type-rules.md— per document_type operative rulesjurisdiction-matrix.md— per-jurisdiction mandatory doc requirementsthreshold-gates.md— when each intelligence phase goes livebuild-sequence.md— build order, backend prerequisitesREADME.md(router node) — edges to 7 nodes above
04_datastores/README.md (283 lines, 25 H2s) → 5 nodes
entity-linking-architecture.md— dual-layer linking, Layer 1 vs 2core-tables.md— table inventory, column definitions, FKsrls-policies.md— RLS pattern (ADR-227), role hierarchyoperational-gotchas.md— failure modes, sync drift patternsREADME.md(router node) — edges to 4 nodes above
Hermes Skills — Edge Densification
~30 skills with zero related_skills: need minimum 3 edges each. Priority: coding-workflow ↔ systematic-debugging ↔ test-driven-development ↔ requesting-code-review.
Section C Sources
- @kingwilliam_ — knowledge graph: "Graph engineering: the 12-step roadmap from note-taker to graph builder" (2026-07-25). Designated foundational methodology for RAIA (Real estate Artificial Intelligence Agent) + Hermes.
- @AnatoliKopadze — workflow graph: "Graph Engineering explained: what it is, when to use it and when not to" (2026-07-25). Eugin: "Valid — should enrich our Graph Engineering."
- Summary page: 2.31 How We Work — The EstateAigents Production Workflow — the two-paragraph summary of this spec.
- ADR-270: Graph-Structured Knowledge Management — Partial Adoption. Phase 0 approved 2026-07-25. ADR-267 (Eugin authors) will encode the full convention.
August 2026 Gap Analysis — Where RAIA (Real estate Artificial Intelligence Agent) Stands vs the Paper (August 2026)
The Karpathy/Anthropic paper synthesis (compiled July 2026) maps a clear progression for agentic systems: loop → chain → swarm → DAG → knowledge graph. Each stage adds capability: loops give iteration, chains give sequencing, swarms give parallelism, DAGs give explicit dependency graphs, and knowledge graphs give persistent typed memory that agents can traverse rather than re-derive. The table below scores RAIA (Real estate Artificial Intelligence Agent) against each layer as of the August 2026 session.
| Layer | What the paper describes | RAIA (Real estate Artificial Intelligence Agent) status |
|---|---|---|
| Loop | Single agent iterates | ✅ Live — Hermes profiles, kanban dispatcher |
| DAG visualisation | See the graph | ✅ Live — AgentGraphPanel, React Flow, copper/amber theme |
| Provenance edges | Record handoffs between agents | ✅ Built today — tbl_agent_graph_edges + sync-edges route (2026-08-10) |
| Shared memory via graph | Agents query a typed entity graph | ❌ Not built — agents still get context via prompts, not graph traversal |
| Ratchet loop | Auto keep/revert on metric improvement | ❌ Not built — Haiku M0 at 69.8% FAIL, Gemini Pro at 74.1% PASS; shadow comparison paused |
| DAG-based experiment lineage | Commit graph for agent experiments | ❌ Not built |
The most impactful next step is a post-run hook that automatically writes edges to tbl_agent_graph_edges when each agent run completes — eliminating the manual Sync Edges button. This makes the graph self-updating. Once self-updating edges exist, the provenance data is continuous and accurate enough to support experiment lineage tracking (DAG-based experiment lineage) without any additional infrastructure.
3 of 6 paper layers are now live or built. The three unbuilt layers (shared memory, ratchet loop, DAG lineage) all depend on the provenance edge data that was added today — making the August 10 session a genuine inflection point: the graph went from decorative (it showed topology) to functional (it records real handoffs).