Knowledge graphs, agent graphs — and when either is worth it.
| Part | Topic | Note |
|---|---|---|
| 01 | What graphs buy you | the evidence, including where graphs lose |
| 02 | Implementing it in Claude Code | most important part |
| 03 | When a graph earns it | worked 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.
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.
entities → typed real-world relationships. What the system knows.
entities, passages, communities → search links. How the LLM finds evidence.
agents, tools, gates → allowed transitions. What the app does.
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.
The honest evidence — where graphs beat vectors and loops, and where they quietly fail.
Recall@5 averages 73.4% → 87.8% with graph-guided retrieval, across MuSiQue, HotpotQA and 2Wiki.
49–59% vs 30.7% on time-scoped questions (MultiHop-RAG). The biggest documented graph advantage.
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.
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.
Indexing one ~5GB corpus: early 2024 versus mid-2025. Roughly 1000×, driven by LazyGraphRAG deferring all LLM summarization to query time.
⚠ 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.
| Query shape | Winner | Numbers |
|---|---|---|
| Simple fact lookup | tie | 60.9 chunk vs 60.1 graph |
| Complex reasoning, up to ~2 hops | graph | 53.4 vs 42.9 |
| Temporal / time-scoped | graph | 49–59% vs 30.7% |
| Contextual summarization | graph | 64.4 vs 51.3 |
| Null query — no answer exists | vectors, by a mile | plain RAG abstains 96%; GraphRAG-Global 19.27% |
| Retrieval latency | vectors | graph ~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."
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.
⚠ 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.
"Loops are just simple graphs." Production agents need cycles, not DAGs. Jul 2026
"Graph-based systems become debugging nightmares in production." DocuSign switched off one: 14× less code, 75% faster lead time.
"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.
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-claimed | Claim |
|---|---|
| Klarna | 80% 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.
The most important part. Every pattern from part 01, wired into the tool you already run daily.
@falkordb/mcpserver with its own read-only mode.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.
neo4j-graphrag-python (its pipeline has an explicit entity-resolution stage) or LightRAG. You review the ontology, it writes the plumbing.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.
Version-gated — check claude --version. Older than 2.1.220, count your MCP servers before adding another one.
search_memory_facts with time filters; FalkorDB or Neo4j behind it.Each step buys capability with complexity and a second bill. Pick the leftmost thing that answers your actual failure mode.
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.
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.
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."
Treat this as the default you have to beat, not a position you have to hold. The counter-evidence is on the next slide.
| Repo / study | Result | Factor |
|---|---|---|
| Next.js monorepo | 739,352 → 15,049 tokens | 49× |
| FastAPI | token reduction on the same task set | 3.7× |
| Express.js | graph overhead lost to plain reading | <1× |
| Six-repo average | tree-sitter + SQLite code-graph MCP | 8.2× |
| Head-to-head (arXiv:2603.27277) | ~1,000 vs ~10,000 tokens/query — but quality 83% vs 92% | 10× |
⚠ 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.
.claude/agents/*.md, with name / description / model / tools frontmatter.claude -p --output-format json, composed by a script; --resume <id> to continue one./rewind — file snapshots per prompt, last 100. SDK forkSession: true is time travel.Name the parts and the graph is already there. You've just been calling it Claude Code.
parallel() adds a barrier when you need one. pipeline() deliberately doesn't.if / else — routing logic you can read, diff and test.The closest native thing to a scripted LangGraph. Full treatment in deck 03, Agentic Engineering — dynamic workflows.
Don't reach here first. Slides 24–25 cover most real needs — and CrewAI's "debugging nightmares" line was about exactly this layer.
Token savings and performance improvement from the API memory tool plus context editing, on Anthropic's 100-turn benchmark. No graph involved.
The pattern of this whole deck: the boring alternative is the baseline your graph has to beat.
One worked example, the failure math, and a table you can hold a design review against.
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.
At 85% accuracy per hop, a five-hop chain is wrong more often than it's right. Structure is not free reliability.
Make each node strong before you add another edge. More topology cannot rescue an unreliable step.
| Situation | Reach for |
|---|---|
| Q&A over docs, single-hop | vector or hybrid RAG. No graph. |
| Multi-hop, entity-centric, temporal, auditable | knowledge graph + hybrid retrieval |
| Cross-session agent memory | files first; a graph when facts contradict or age |
| Repo context | agentic grep; a code-graph MCP past ~500 files |
| Agent control flow | loop 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.
Graphs win exactly where you'd predict — multi-hop, temporal, audit. They lose on cost, latency and null queries.
You already own the primitives: MCP servers, hooks, subagents, workflows. No new framework required for most of it.
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.
Per-claim citations: deck09-facts.md (internal research doc, 9 Aug 2026). Flagged ⚠ single-source or vendor-sourced: the $33,000 → $33 cost cliff, the per-repo code-graph numbers, LangGraph's ~400-company adoption figure, and the Klarna / Uber / Rakuten claims.