liveBook · Manning

Context graph

As explained in Context Engineering

A graph representation of the artifacts and runtime events that shape an AI system’s behavior during an interaction, task, or workflow.

A context graph represents the artifacts and runtime events that shape an AI system’s behavior during an interaction, task, or workflow. Nodes capture context elements; edges describe how those elements relate. section 8.3.3

The graph makes relational failures visible. A stale memory may override newer evidence, retrieved passages may contradict each other, or a tool result may arrive after the model has committed to an answer. Logs and traces can show successful steps while missing a structurally wrong context assembly. section 8.3.3 section 8.3.2

Start with a small vocabulary of nodes and edges:

  • Nodes: user requests, sessions, prompt templates, instruction versions, retrieved documents, memory records, tool invocations, model calls, guardrail decisions, evaluation results, deployments, and human reviews. section 8.3.3
  • Edges: uses, retrieves, cites, depends_on, blocked_by, evaluated_by, supersedes, belongs_to, and approved_by. section 8.3.3
Listing 8.1 Context graph fragment reconstructed for the stale pricing incident
(request:R-8842)      -[uses]->          (prompt:support_reply@v7)
(request:R-8842)      -[retrieves]->     (doc:pricing_2025_q3 index=legacy)
(request:R-8842)      -[invokes]->       (tool_call:catalog.list_plans t+1.9s)
(request:R-8842)      -[uses]->          (model_call:M-1 t+1.4s)
(model_call:M-1)      -[cites]->         (doc:pricing_2025_q3)
(model_call:M-1)      -[evaluated_by]->  (eval:groundedness score=0.91)
(doc:pricing_2025_q3) -[superseded_by]-> (doc:pricing_2026_q2)

This fragment links a pricing answer to an outdated document and shows that the current catalog tool call did not feed the model call. The high groundedness score reflects faithfulness to the supplied context, not its freshness. section 8.3.3

A context graph does not initially require a separate graph database. Its value is in making relationships available for diagnosis: the pricing incident separates a stale fallback index from an orchestration race, even though the answer was grounded in the context the model received. section 8.3.3 section 8.3.2

How Context Engineering covers it

How deep it goes
Defines initial node and edge types and reconstructs an incident, without requiring a separate graph database initially.
Examples
Reconstructs a stale pricing answer using document-version, model-call, tool-call, and evaluation relationships.
What you can do after
Diagnose context failures by inspecting stale dependencies, missing tool-result links, and evaluation results together.
How it connects
Connects runtime observability with retrieval, memory, tool calls, groundedness evaluation, and orchestration.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Context Engineering. The section links point to the parts of the book it draws on.