Skip to content

dmccreary/context-graph

Repository files navigation

Context Graph: How Organizations Use LLMs Cost Effectively

MkDocs Material for MkDocs GitHub Pages Built with Claude Code Uses Claude Skills Python JavaScript p5.js License: CC BY-NC-SA 4.0

View the Live Site

Read the textbook online at: https://dmccreary.github.io/context-graph/

Overview

Context Graph: How Organizations Use LLMs Cost Effectively is an interactive intelligent textbook on context graphs — enterprise graph data structures designed to get the right content into a large language model's prompt in the fewest tokens.

Context graphs are structured, persistent records of product data, customer data, ontologies, and decision traces — capturing not just what happened inside an enterprise, but why it happened, who approved it, and which precedents justified it. The book's core thesis, drawn from Foundation Capital's analysis of the enterprise AI market, is that the trillion-dollar opportunity is not in building better foundation models — it is in solving the context problem: giving models the right organizational knowledge at the right moment so they can reason, decide, and act on behalf of the business.

The textbook explains what context graphs are, why LLMs desperately need them to work reliably inside organizations, and how practitioners can design, build, and deploy them. The focus throughout is token efficiency and quality of content returned from an LLM. Every modeling decision, retrieval pattern, and architectural choice is evaluated against that pair of constraints.

This is a Level 2+ intelligent textbook in the MkDocs Material format, with a 496-concept learning graph, interactive MicroSims, precise queryable graph schemas, and a pedagogical mascot — Nexus the Spider — to guide readers through the material.

Who This Book Is For

  • Enterprise architects and senior engineers designing AI-powered systems who need a principled approach to organizational memory and context management.
  • AI/ML practitioners and data engineers building LLM-powered applications and struggling with hallucinations, missing context, and poor decision quality in agent workflows.
  • Technical product managers and founders building or evaluating products in the enterprise AI space who want a framework for where context graphs create durable competitive advantage.

No prior knowledge of graph databases, knowledge graphs, or formal ontology is required — these are introduced from first principles.

Getting Started

Clone the Repository

git clone https://github.com/dmccreary/context-graph.git
cd context-graph

Install Dependencies

This project uses MkDocs with the Material theme. A conda environment is recommended:

conda create -n mkdocs python=3.11
conda activate mkdocs
pip install mkdocs mkdocs-material "mkdocs-material[imaging]" mkdocs-glightbox

Serve Locally

Run the site with live reload while you edit:

mkdocs serve

Open your browser to: http://127.0.0.1:8000/context-graph/

Build the Static Site

mkdocs build

Output is written to site/ (gitignored).

Deploy to GitHub Pages

mkdocs gh-deploy

This builds the site and pushes it to the gh-pages branch.

Reading the Book

  • Use the left sidebar to browse chapters in dependency order.
  • Use the search bar (top right) to jump to a specific term.
  • Open the Learning Graph to explore how concepts connect across chapters.
  • Try the MicroSims when you encounter them — they are the fastest way to build intuition for a new schema or retrieval pattern.

Repository Structure

context-graph/
├── docs/                                  # MkDocs documentation source
│   ├── index.md                           # Home page
│   ├── about.md                           # About this book
│   ├── course-description.md              # Seed document for the book
│   ├── chapters/                          # 22 chapters in dependency order
│   │   ├── 01-knowledge-graphs-lpg/
│   │   │   └── index.md
│   │   ├── 02-semantic-layers/
│   │   └── ...                            # through 22-security-vector-search
│   ├── sims/                              # Interactive MicroSims
│   │   ├── graph-viewer/                  # Learning graph viewer (vis-network)
│   │   └── decision-trace-schema/         # Schema explorer
│   ├── learning-graph/                    # Concept graph and analysis
│   │   ├── learning-graph.csv             # Concept dependencies
│   │   ├── learning-graph.json            # vis-network format
│   │   ├── concept-list.md                # 496 concepts
│   │   ├── concept-taxonomy.md            # 12 taxonomy categories
│   │   └── quality-metrics.md             # Graph quality report
│   ├── img/
│   │   ├── cover.png                      # Book cover image
│   │   └── mascot/                        # Nexus the Spider pose set
│   ├── css/                               # Theme overrides
│   └── js/                                # KaTeX init, etc.
├── plugins/
│   └── social_override.py                 # Per-page og:image override
├── mkdocs.yml                             # MkDocs configuration
├── CLAUDE.md                              # Project instructions for Claude Code
├── CONTENT-GENERATION-GUIDE.md            # Rules for content generation skills
└── README.md                              # This file

Reporting Issues

Found a typo, broken link, factual error, or have a suggestion? Please open an issue:

https://github.com/dmccreary/context-graph/issues

Helpful information to include:

  • Page URL or chapter where you found the issue
  • What you expected vs. what you saw
  • For MicroSims: browser and operating system
  • Screenshots when relevant

How to Cite

If you reference this textbook in academic work, technical papers, or internal architecture documents, please use one of the following.

APA (7th edition)

McCreary, D. (2026). Context Graph: How Organizations Use LLMs Cost Effectively. https://dmccreary.github.io/context-graph/

BibTeX

@book{mccreary2026contextgraph,
  title     = {Context Graph: How Organizations Use LLMs Cost Effectively},
  author    = {McCreary, Dan},
  year      = {2026},
  url       = {https://dmccreary.github.io/context-graph/},
  note      = {Interactive intelligent textbook}
}

See the About page for Chicago and MLA formats and chapter-level citation guidance.

License

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (CC BY-NC-SA 4.0).

You are free to:

  • Share — copy and redistribute the material in any medium or format
  • Adapt — remix, transform, and build upon the material

Under the following terms:

  • Attribution — Give appropriate credit with a link to the original
  • NonCommercial — No commercial use without permission
  • ShareAlike — Distribute contributions under the same license

See docs/license.md for full details.

Acknowledgements

This project stands on the shoulders of many open-source communities:

  • MkDocs — Static site generator optimized for project documentation.
  • Material for MkDocs — The responsive, accessible theme that powers the textbook.
  • vis-network — Network visualization library used for the interactive learning graph.
  • p5.js — Creative coding library used for several MicroSims.
  • KaTeX — Fast math typesetting in the browser.
  • Python — Used for the learning graph generation, quality analysis, and book-management scripts.
  • Claude Code by Anthropic — AI-assisted authoring and skill orchestration.
  • Claude Skills — The reusable skill library used to generate chapters, MicroSims, the learning graph, the glossary, FAQs, and references.
  • GitHub Pages — Free hosting for the published site.

The book's framing of the "trillion-dollar context window" draws on Foundation Capital's analysis of the enterprise AI market. Specific industry statistics cited throughout the book are attributed in each chapter's references section.

Contact

Dan McCreary

Questions, suggestions, corrections, or collaboration ideas? Open a GitHub issue or reach out on LinkedIn.

About

An interactive intelligent textbook on the contact graph and how the contact graphs helps organization use LLMs cost effectivly.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages