Deep dive · advanced topics · ~30 minInternal talk · August 2026
WIP — draft

AI Graph Engineering.

Knowledge graphs, agent graphs — and when either is worth it.

knowledge retrieval workflow
2
Agenda

Three parts, half an hour

PartTopicNote
01What graphs buy youthe evidence, including where graphs lose
02Implementing it in Claude Codemost important part
03When a graph earns itworked example + decision rules

Every claim is date-stamped August 2026 and sourced — see the closing Sources slide, and deck09-facts.md for per-claim citations.

3
Buzzword · where this came from

The third buzzword in three years

prompt engineering
2023
context engineering
mid-2025
loop engineering
June 2026
graph engineering
July 2026
  • July 18, 2026. Peter Steinberger: "Are we still talking loops or did we shift to graphs yet?" — 2.9M views.
  • Within 48 hours: three competing definitions, copycat posts, and a fabricated study citing a non-existent $3.1M Stanford grant.
  • Four days later LangChain's rebuttal: "loops are just simple graphs." The practice is three years old. The word is three weeks old.

The fake grant is the cautionary tale. This is the version that checks the receipts — sources on every claim, warning labels on the single-source ones.

4
Buzzword · which graph?

Which graph do you mean?

Knowledge graph service database team DEPENDS_ON OWNED_BY

entities → typed real-world relationships. What the system knows.

Retrieval graph (GraphRAG) community passage · doc 12 passage · doc 47

entities, passages, communities → search links. How the LLM finds evidence.

Workflow graph agent gate pass tool retry

agents, tools, gates → allowed transitions. What the app does.

GNN learned aggregation

data items → learned aggregation. A model that learns from graph data — out of scope today.

GNNs are research-stage outside one relational-prediction niche, so they're out of scope today. The other three turn up in a single system all the time. Safest response to "graph engineering": ask which graph.

01

What the graphs buy you

The honest evidence — where graphs beat vectors and loops, and where they quietly fail.

6
Evidence · where vectors run out

Where vector RAG runs out

Multi-hop

Recall@5 averages 73.4% → 87.8% with graph-guided retrieval, across MuSiQue, HotpotQA and 2Wiki.

Temporal

49–59% vs 30.7% on time-scoped questions (MultiHop-RAG). The biggest documented graph advantage.

Global

Contextual summarization 64.4 vs 51.3 — 13 points, when the answer is smeared across the corpus.

If the answer sits in a single chunk, vectors are fine and far cheaper. The graph only starts paying past the first hop.

7
Evidence · GraphRAG anatomy

Anatomy of GraphRAG

documents raw corpus chunks split + embed LLM extraction entities · relations Leiden communities, nested summaries one per community ~4–6 LLM calls per chunk · ≈75% of indexing cost AT QUERY TIME local match entities, then walk their neighbourhood detail questions about specific things global map-reduce across every community summary corpus-level themes — and the expensive one DRIFT global entry point, then local refinement both, in one query

Indexing runs 20–100× an embedding-only pipeline. The graph locates and organises evidence — the selected evidence still gets serialised into a finite context window.

8
Evidence · the bill

The bill, eighteen months apart

$33,000 → $33

Indexing one ~5GB corpus: early 2024 versus mid-2025. Roughly 1000×, driven by LazyGraphRAG deferring all LLM summarization to query time.

  • LazyGraphRAG index cost = 0.1% of full GraphRAG — roughly what plain vector RAG costs. Index-time work is noun-phrase extraction plus co-occurrence stats.
  • At a mid query budget it outperforms Global Search at 4% of its query cost; at a low budget, comparable quality at 700× lower query cost.

⚠ The $33,000 → $33 figure is a single practitioner write-up. The 99.9% index-cost reduction is Microsoft's own published number — quote that one, caveat the first.

9
Evidence · the honest scoreboard

The honest scoreboard

Query shapeWinnerNumbers
Simple fact lookuptie60.9 chunk vs 60.1 graph
Complex reasoning, up to ~2 hopsgraph53.4 vs 42.9
Temporal / time-scopedgraph49–59% vs 30.7%
Contextual summarizationgraph64.4 vs 51.3
Null query — no answer existsvectors, by a mileplain RAG abstains 96%; GraphRAG-Global 19.27%
Retrieval latencyvectorsgraph ~8× slower (14,434s vs 1,724s)

Past roughly 2 hops the advantage fades — the paths stop landing in the retrieved subgraph. ⚠ An ICLR 2026 lead (arXiv:2506.05690) goes further: "GraphRAG frequently underperforms vanilla RAG on many real-world tasks."

10
Evidence · null queries

Null queries: the fluent wrong answer

question with no answer in the corpus the case nobody benchmarks vector RAG top-k nearest chunks similarity scores come back weak weak evidence is visible “I can’t find this.” abstains 96% GraphRAG global map-reduce over community summaries summaries always return material something to synthesize, always fluent, confident — wrong abstains 19.27% invents an answer ~4 times out of 5 same question · opposite failure modes — the graph’s pipeline has no “nothing here” path

Numbers from the scoreboard (arXiv:2502.11371): plain RAG abstains 96%, Community-GraphRAG Global 19.27%. Without an abstention gate, that single row disqualifies global search for anything customer-facing.

11
Evidence · memory graphs

Memory graphs: facts don't die

  • A vector store returns what is similar, not what is true now. Both questions land in the same query and only one gets answered.
  • Graphiti / Zep edges carry four timestamps: t_created and t_expired for system time, t_valid and t_invalid for event time.
  • A contradiction closes the old edge's validity window. Nothing is deleted, so the history stays queryable and auditable.
window closed, not deleted Alice —works_at→ Acme t_valid Mar · t_invalid Jul contradiction open — true now Alice —works_at→ Globex t_valid Jul · t_invalid — Mar Jul now one graph, two questions: "now" and "in March"
12
Evidence · benchmark theatre

Benchmark theatre

  • Apr 2025 — Mem0's paper claims SOTA over Zep on LoCoMo.
  • May 2025 — Zep's rebuttal, "Lies, Damn Lies, & Statistics", claims 84%. An arithmetic error is found; Zep corrects to 75.14%. Mem0 then re-runs Zep's fixed pipeline: 58.44% — below Mem0's own score.
  • Aug 2025 — Letta runs GPT-4o-mini with plain filesystem tools (grep, open, search): 74.0%. It beats both specialised memory systems.
  • 2026 audits6.4% of LoCoMo's answer key is wrong (99 of 1,540, Penfield Labs). The LLM judge accepts 62.8% of intentionally wrong answers.

⚠ MemPalace claimed 100% on LoCoMo, collected 5,400 GitHub stars in 24 hours, and was caught tuning on the dev set within 48. Tsinghua's MemoryBench (20k cases): "none of the advanced memory systems consistently outperform RAG baselines using full task context." Distrust every vendor benchmark slide — including this one.

13
Evidence · workflow graphs

Workflow graphs — and the argument about them

state
node
conditional edge
checkpoint
+
Send fan-out
LangChain

"Loops are just simple graphs." Production agents need cycles, not DAGs. Jul 2026

CrewAI

"Graph-based systems become debugging nightmares in production." DocuSign switched off one: 14× less code, 75% faster lead time.

Anthropic

"Find the simplest solution possible, and only increase complexity when needed." Building Effective Agents

The convergent rule: control, repeatability or compliance → explicit graph. Ill-defined problem where the path doesn't matter → autonomous loop.

14
Evidence · receipts

The receipts

40h → 15h

LinkedIn customer-service KG-RAG, six months in production (SIGIR 2024): mean resolution time 40h → 15h, p90 87h → 47h, median −28.6%, retrieval MRR 0.522 → 0.927.

Vendor-claimedClaim
Klarna80% cut in resolution time
Uber~21,000 developer-hours saved
Anthropic multi-agent research+90.2% over single-agent Opus 4 on an internal eval, at ~15× token cost

⚠ Only the LinkedIn result is peer-reviewed. Everything in the lower table is a vendor blog post — directionally useful, not proof.

02

Implementing it in Claude Code

The most important part. Every pattern from part 01, wired into the tool you already run daily.

16
Claude Code · graph DB via MCP

A graph DB in one command

# Neo4j's official MCP server — three tools, nothing else claude mcp add --transport stdio \ -e NEO4J_URI=bolt://127.0.0.1:7687 \ -e NEO4J_USERNAME=neo4j -e NEO4J_PASSWORD= \ -e NEO4J_READ_ONLY=true \ -- neo4j-mcp neo4j-mcp # exposes: get-schema · read-cypher · write-cypher
  • Memgraph ships run_query + get_schema; FalkorDB ships @falkordb/mcpserver with its own read-only mode.
  • Kuzu was archived Oct 10, 2025 — the embedded graph DB a lot of people had standardised on, frozen at v1.4.1. Community forks (Bighorn, Ladybug) appeared within days. Pick your graph vendor like you pick a database.

Start read-only. The best model on CypherBench executes correct Cypher 61.58% of the time; sub-10B models are under 20%. Use Cypher templates, not free-form generation, and don't hand write access to a text-to-Cypher loop on day one.

17
Claude Code · building the graph

Claude Code as the graph builder

  • Realistic pattern: Claude Code drives neo4j-graphrag-python (its pipeline has an explicit entity-resolution stage) or LightRAG. You review the ontology, it writes the plumbing.
  • The separate Data-Modeling MCP validates an LLM-proposed model and renders it as a Mermaid schema diagram before any data flows.
  • Entity resolution, not extraction, is where production graphs rot — the merge decisions on the right are the actual hard part.
  • Start schema-free to explore; fold the discoveries into a canonical ontology once you can define what "precise" means for the domain.
payments-prod logs PAY-SVC monitoring CMDB #4711 inventory merge: one entity payments service payments-test same prefix, different thing not merged extraction is the demo — resolution is what rots

An extraction audit found 2.4% anomalous triples of 6,014, 0.65% pure hallucination — and downstream LLMs trust graph output over the source prose that contradicts it.

18
Claude Code · the MCP token tax

The MCP token tax

# historically — every server, every turn tool schemas (all servers) › loaded into context each turn graph server idle? you paid anyway # v2.1.220+ — deferred tool loading, on by default tool names only › schemas fetched when a tool is needed "alwaysLoad": true › opts one server back out
  • This is deck 05's fixed-overhead lesson applied to graphs: a chatty graph server used to cost you on every turn, including the turns that never touched it.

Version-gated — check claude --version. Older than 2.1.220, count your MCP servers before adding another one.

19
Claude Code · memory spectrum

The memory spectrum

CLAUDE.md
auto memory
memory MCP
Graphiti MCP
Cognee plugin
CLAUDE.mdStatic, cache-friendly, paid every turn.
Auto memoryMEMORY.md index (first 200 lines / 25KB), topic files loaded on demand.
Memory MCPEntities, relations and observations in a JSONL file; 8 tools; string search only — no time, no semantics.
Graphiti MCPTemporal edges, search_memory_facts with time filters; FalkorDB or Neo4j behind it.
CogneeFull pipeline — graph plus vector store — built from lifecycle hooks while you work.

Each step buys capability with complexity and a second bill. Pick the leftmost thing that answers your actual failure mode.

20
Claude Code · hooks as edges

Hooks are edges

session lifecycle SessionStart UserPromptSubmit PostToolUse Stop SessionEnd what we know the ask tool results turn result distil + flush knowledge graph entities · relations · temporal edges — built while you work
  • claude plugin install cognee-memory@cognee — three verbs (remember / recall / forget) plus five lifecycle hooks. Auto-distils every 150 tool calls or 60s idle, with per-client dataset isolation.

⚠ The hidden cost: Cognee's extraction and embedding calls bill against its own configured provider, separate from your Claude plan.

21
Claude Code · when markdown wins

When markdown wins

  • Small, stable facts belong in CLAUDE.md or auto memory. Cache-friendly, zero latency, no second bill, no extra service to run.
  • Graph memory earns it when facts are many, entity-shaped, contradicting, or time-dependent. Those four words are the whole test.
  • Letta's result is the null hypothesis: GPT-4o-mini plus grep scored 74.0% on LoCoMo. Beat the filesystem before you buy a graph.
CLAUDE.md the whole file, every turn cache-friendly · zero ops vs Alice Acme Globex Q3 closed Jul only what the query touches pay-per-query · a second bill same facts, billed differently

Deck 05's lesson, inverted: every line of CLAUDE.md is paid every turn; a graph flips that to pay-per-query. Neither is free — they're billed differently, and you should know which shape your workload has.

22
Claude Code · code graphs, house line

Code graphs: the house line

"Agentic search generally works better. It is also simpler and doesn't have the same issues around security, privacy, staleness, and reliability."

Boris Cherny, Claude Code. Early versions shipped RAG with a local vector DB; it was ripped out. His elaboration: "it outperformed everything. By a lot."

  • Formalised as just-in-time context (Anthropic engineering, Sept 29, 2025): glob → grep → read, at the moment of need.
  • No index to go stale, no second copy of your source to leak, no re-index on every commit.

Treat this as the default you have to beat, not a position you have to hold. The counter-evidence is on the next slide.

23
Claude Code · code graphs, counter-evidence

Code graphs: the counter-evidence

Repo / studyResultFactor
Next.js monorepo739,352 → 15,049 tokens49×
FastAPItoken reduction on the same task set3.7×
Express.jsgraph overhead lost to plain reading<1×
Six-repo averagetree-sitter + SQLite code-graph MCP8.2×
Head-to-head (arXiv:2603.27277)~1,000 vs ~10,000 tokens/query — but quality 83% vs 92%10×
  • Break-even lands around 500+ files. Hybrid is what actually ships: Sourcegraph (SCIP graph + embeddings + text), Cursor (semantic + lexical lifts agent evals up to 23.5% over grep alone), aider's repo map (tree-sitter + PageRank).

⚠ The per-repo numbers are one author's benchmarks — unusually honest ones, since they include the repo where the graph lost. Both things are true: grep wins small, graphs win monorepos, and the graph is slightly dumber on holistic questions.

24
Claude Code · control flow mapping

You already own a graph runtime

NodesSubagents — .claude/agents/*.md, with name / description / model / tools frontmatter.
GatesHooks — PreToolUse can block or rewrite a call, Stop can refuse to end the turn. 12 events.
EdgesThe orchestrator's own routing prompt is your conditional edge.
DAG nodesclaude -p --output-format json, composed by a script; --resume <id> to continue one.
CheckpointsSessions plus /rewind — file snapshots per prompt, last 100. SDK forkSession: true is time travel.
orchestrator routing prompt = conditional edges hook PreToolUse: block/rewrite subagent A subagent B subagent C Stop can refuse to end the turn not done — loop checkpoints — one per prompt · /rewind · forkSession = time travel

Name the parts and the graph is already there. You've just been calling it Claude Code.

25
Claude Code · workflows

Workflows: a scripted graph

// workflows (v2.1.154+) — // a graph that reads as a script const findings = await pipeline( files, // fan out, no barrier f => agent(`review ${f}`), // node r => agent(`verify: ${r}`) // next stage );
  • parallel() adds a barrier when you need one. pipeline() deliberately doesn't.
  • Conditional edges are plain if / else — routing logic you can read, diff and test.
files[] fan out · no barrier agent: review f1 agent: verify r1 unchanged prefix → agent: review f2 agent: verify r2 agent: review f3 agent: verify r3 cached on resume findings ≤ 16 concurrent

The closest native thing to a scripted LangGraph. Full treatment in deck 03, Agentic Engineering — dynamic workflows.

26
Claude Code · when you outgrow it

When you outgrow it: SDK + LangGraph

  • The Claude Agent SDK ships no graph engine, by design. That's a decision, not a gap.
  • Need durable typed state, human-in-the-loop interrupts, or time travel across a fork? The 2026 consensus hybrid: LangGraph as the outer state machine, Agent SDK agents inside the nodes.
  • Day-long jobs wrap Temporal around both. LangGraph 1.0 went GA Oct 22, 2025; ⚠ adoption figure of ~400 companies on LangGraph Platform is the vendor's own.
Temporal — when jobs run for days LangGraph — outer state machine durable typed state · checkpoint every super-step · time travel via fork node SDK agent interrupt() human gate node SDK agent conditional edge — router function, may loop END

Don't reach here first. Slides 24–25 cover most real needs — and CrewAI's "debugging nightmares" line was about exactly this layer.

27
Claude Code · the cheaper alternative

Try the boring thing first

84% / 39%

Token savings and performance improvement from the API memory tool plus context editing, on Anthropic's 100-turn benchmark. No graph involved.

  • The memory tool is client-side file operations (GA). Context editing clears stale tool results out of the window automatically.
  • Managed Agents memory (public beta, Apr 2026) adds audit trails and rollback. ⚠ Rakuten's 97% error-rate reduction is a vendor claim.

The pattern of this whole deck: the boring alternative is the baseline your graph has to beat.

03

When a graph earns it

One worked example, the failure math, and a table you can hold a design review against.

29
Decide · worked example

Worked example: an incident copilot

question identify entities traverse knowledge graph similar past incidents join & rank provenance · access · depth cap insufficient evidence — go again sufficient draft diagnosis human approval gate publish / execute revise
KnowledgeService / Database / Deployment / Incident / Runbook nodes; DEPENDS_ON, AFFECTS, OWNED_BY edges with provenance and time validity.
RetrievalBounded, typed traversal from matched entities, plus a vector search for similar past incidents.
ControlDeterministic code owns access control, depth caps and stop rules. The LLM extracts, interprets and drafts.

Three of the four graphs in one system. It's auditable because the paths are explicit — and you evaluate each layer separately, so a fluent answer can't hide a bad graph.

30
Decide · the failure math

The failure math

0.85⁵ ≈ 44%

At 85% accuracy per hop, a five-hop chain is wrong more often than it's right. Structure is not free reliability.

  • "A graph of weak nodes is just slop produced in parallel."
  • The same decay hits retrieval hops and agent hand-offs alike — which is exactly why graphs stop helping past ~2 hops on the benchmarks in part 01.
each hop: 85% right hop 1 85% hop 2 72% hop 3 61% hop 4 52% hop 5 44% 50% — a coin flip end-to-end accuracy, compounding per hop

Make each node strong before you add another edge. More topology cannot rescue an unreliable step.

31
Decide · the table

The decision table

SituationReach for
Q&A over docs, single-hopvector or hybrid RAG. No graph.
Multi-hop, entity-centric, temporal, auditableknowledge graph + hybrid retrieval
Cross-session agent memoryfiles first; a graph when facts contradict or age
Repo contextagentic grep; a code-graph MCP past ~500 files
Agent control flowloop first; explicit graph for compliance or repeatability
Everything else"Keyword search is all you need" — Amazon hit 94.5% of RAG faithfulness with zero vector store (AAAI 2026)

Graphs are becoming one tool the agent picks per query, not the retrieval backbone. Durable niches: multi-hop relationship reasoning, temporal and audit requirements, entity-centric domains — fraud, dependencies, org structures, support.

32
Close · recap

Which graph — and does it beat grep?

01 evidence
02 Claude Code
03 decision
01 Evidence

Graphs win exactly where you'd predict — multi-hop, temporal, audit. They lose on cost, latency and null queries.

02 Claude Code

You already own the primitives: MCP servers, hooks, subagents, workflows. No new framework required for most of it.

03 Decision

Beat the boring baseline first: grep, markdown, the memory tool. Then buy the graph, for the query shape that needs it.

One sentence to take into a design review: ask which graph, then make it beat grep.