Skip to content

How It Works

End-to-end overview from "you code with AI" to "your teammate's coding AI gets your decisions."

Data Flow

┌─────────────────────────────────────────────────┐
│                DATA SOURCES                      │
│  AI Chat Transcripts    Source Code    Docs      │
└────────┬──────────────────┬────────────┬─────────┘
         ▼                  ▼            ▼
┌─────────────────────────────────────────────────┐
│              INGESTION LAYER                     │
│  Session Ingestion    Joern CPG     Cold Start   │
│  (segment → extract)  (structure)   (LLM infer)  │
└────────┬──────────────────┬────────────┬─────────┘
         ▼                  ▼            ▼
┌─────────────────────────────────────────────────┐
│            MEMGRAPH (Graph DB)                   │
│  CodeEntity ◄──ANCHORED_TO──► DecisionContext    │
│  CALLS/CONTAINS edges    CAUSED_BY/DEPENDS_ON    │
└───────────────────────┬─────────────────────────┘

┌─────────────────────────────────────────────────┐
│            MCP SERVER (9 tools)                  │
│  Five-slot retrieval + progressive disclosure    │
└───────────────────────┬─────────────────────────┘

┌─────────────────────────────────────────────────┐
│  Claude Code / Cursor / any MCP-compatible AI    │
│  Gets decision context while editing code        │
└─────────────────────────────────────────────────┘

Step by Step

1. Code Structure is Analyzed

Joern parses your source code into a Code Property Graph (CPG) — which functions exist, who calls whom, what files contain what. This skeleton is what decisions anchor to.

2. Decisions are Extracted

analyze (the main building block) reads each function, queries the graph for callers/callees, calls the LLM, and outputs structured decisions. Highly configurable via templates.

Session ingestion reads Claude Code transcripts, segments conversations into logical topics, and extracts specific decisions with rationale, rejected alternatives, and code anchors.

3. Decisions are Stored in the Graph

Each decision becomes a DecisionContext node indexed through five slots: code anchor, keywords, decision links, metadata, and semantic embedding.

4. Your Coding AI Queries the Graph

When you edit code, the coding AI queries Context Chain through MCP. It finds relevant decisions by walking the graph from the current code location, matching keywords, and following decision chains.

5. The Graph Improves Over Time

The refinement pipeline runs overnight: sharpens anchors, normalizes keywords, detects stale decisions, connects related decisions across sessions, and flags coverage gaps.

What Makes This Different

Traditional docs are written once and go stale. Context Chain captures decisions continuously.

Code comments explain what code does. Context Chain records why it was written that way, what was rejected, and how decisions relate across the codebase.

Other context tools capture knowledge at the repo level. Context Chain anchors to specific functions and tracks staleness automatically.

Released under the Apache 2.0 License.