The Context Graph Protocol: Typed, Budgeted, Provenance-Carrying Context Retrieval for LLM Agents
Mac Anderson · Context Graph Protocol contributors · July 2026
Abstract
Large-language-model agents assemble their working context from retrieval pipelines that return opaque strings: nothing states where a passage came from, what it costs against the context window, whether it is still true, or how to cite it. We present the Context Graph Protocol (CGP), an open wire protocol that replaces the blob with a typed unit of exchange — the frame — carrying kind, relevance, canonical token cost, provenance, temporal validity, and a citation label. Frames relate to one another through labelled edges, making context a graph a host can traverse by anchor proximity. The protocol defines an eight-envelope NDJSON binding over stdio and streamable HTTP, an explicit capability handshake, a deterministic budget-accounting rule that renders budget honesty machine-checkable, a consent model for data egress, and three content representations that let large context travel by hash without sacrificing verifiability. Conformance is falsifiable by construction: a seven-check suite is validated against fourteen single-fault misbehaviour modes, and four independent implementations — Rust, TypeScript, Python, and Go — pass the same oracle. We argue that deterministic, canonical-order composition converts provider prompt caches from an accident into a contract, with a worked example showing a ~7× reduction in context tokens over a twenty-turn session.
Contents
- Introduction: the blob-pipe problem
- Design principles
- The frame model
- The wire protocol
- Budget honesty
- Consent and data flow
- Deterministic composition and context reuse
- Conformance as falsification
- Related work
- Status and governance
Cite this report
@techreport{anderson2026contextgraph,
title = {The Context Graph Protocol: Typed, Budgeted,
Provenance-Carrying Context Retrieval for LLM Agents},
author = {Anderson, Mac and {Context Graph Protocol contributors}},
institution = {Context Graph Protocol Project},
number = {CGP-TR-2026-01},
year = {2026},
month = {7},
url = {https://context-graph-protocol.vercel.app/research}
}