Compact Knowledge Graph (CKG)

Pre-structured domain knowledge. Zero hallucinations by construction.

Definition

A Compact Knowledge Graph is a pre-structured directed acyclic graph where every node is a typed domain concept and every edge is a typed dependency relationship. CKGs are serialized as CSV and delivered via MCP (Model Context Protocol) tools to AI agent orchestrators as pre-action context.

How It Works

Instead of retrieving text chunks at runtime (RAG), CKG compiles domain knowledge ahead of time into a deterministic graph structure. When an agent needs to act, it queries the dependency structure before dispatching — so every hop is a cited edge, not a guess.

Example: LangChain Core dependency graph
180 modules · 650 typed dependency edges trace_downstream("RunnableSequence") → returns exact 23 dependent modules → before agent writes a single line → blast radius = deterministic, not invisible

Why Graphs, Not Text?

RAG retrieves semantically similar text — which loses the structure that matters. When your domain has real dependencies (what gates what, what breaks if X ships, what depends on what), retrieval can't represent it. CKG encodes it explicitly as typed edges.

Result: Relationship errors become structurally impossible by construction, not just less likely.

Core Features

✓ Typed edges

Every relationship has a type (depends_on, causes, enables, etc.). No free-form connections.

✓ Pre-action context

Agents query the graph before acting, not after. Prevents blind decisions.

✓ Zero hallucinations

Every node is a concept. Every edge is a cited relationship. No generated connections.

✓ Multi-hop stable

F1 stays at 0.77 @ hop 5. RAG accuracy collapses past hop 2.

✓ Fixed token footprint

274 tokens per query, every time. No variance. Deterministic cost.

✓ Git-versionable

CSV serialization means knowledge updates go through version control.

CKG vs RAG vs GraphRAG

From the open CKG benchmark (47 domains, 8,121 queries)

Accuracy (BERT F1) CKG: 0.857 RAG: 0.817 GraphRAG: 0.825
Tokens per query CKG: 274 RAG: 17,900 GraphRAG: ~10,000
Cost per correct answer CKG: $0.000506 RAG: $0.013046 GraphRAG: $0.020098
Hallucination rate CKG: 0% RAG: unknown GraphRAG: unknown
Multi-hop F1 @ depth 5 CKG: 0.772 RAG: collapses GraphRAG: unknown

Built-in Domains

ckg-mcp ships with 53 domains ready to use:

Getting Started

Install ckg-mcp:

$ pip install ckg-mcp

Add to your MCP config:

{ "mcpServers": { "ckg": { "command": "ckg-mcp" } } }

Learn More

What is Retrieval Density Score (RDS)?
Read the benchmark paper (PDF)
GitHub: ckg-mcp
Live demo on Hugging Face

Ready to build with structured knowledge?

Book a benchmark walkthrough