Inspiration
AI coding agents (like Claude, Cursor, GitHub Copilot, Codex) operate with stateless or flat-context memory. Across sessions and PRs, they frequently forget architectural decisions (ADRs), past SEV-1 incident post-mortems, and complex multi-hop call chains. As a result, agents suggest breaking changes to critical architectural boundaries or repeat past production outages.
What it does
CodeContext Graph solves this by embedding Relate by Neo4j (relate-db 1.0.1) as a zero-server, in-process, persistent property-graph memory engine directly inside AI agent workflows and CI pipelines.
It models codebase architecture with rich schema:
- Nodes:
File,Symbol(functions, classes, methods),Decision(ADRs),Incident(SEV post-mortems), andRule(governance policies). - Edges:
DEFINES,CALLS,GOVERNED_BY,DOCUMENTED_IN,CAUSED_INCIDENT.
Key Features:
- Python AST Ingestor + Live Self-Ingestion: Ingests codebases into property graphs with zero configuration. It self-ingests its own repository in ~500ms.
- 5 Multi-Hop Cypher Tools & MCP Server: Exposes Model Context Protocol (MCP) tools for Claude Desktop / Cursor:
blast_radius: Multi-hop recursive graph traversal showing all transitive callers and downstream impact.why_exists: Correlates any function or class directly to underlying ADRs and architectural rationale.incident_root_cause: Highlights whether modified symbols were implicated in prior SEV-1 production incidents.query_cypher: Raw Cypher execution with read-only safety validation.record_memory: Enables agents to persist new architectural decisions dynamically.
- Unified Git PR Diff Guardrail:
- Analyzes git diffs, traverses call chains in the Relate graph, flags missing ADRs/tests/SEV incident regressions, computes a 0-100 Risk Score, and outputs GitHub Actions PR review comments.
- Includes ready-to-use GitHub Actions workflow (
.github/workflows/codecontext-guardrail.yml).
- FastAPI Interactive Graph & Cypher Playground: Web dashboard for visual inspection and interactive Cypher queries.
Verified Benchmarks
- Cold Ingestion: Ingests 9 files / 48 symbols (64 nodes, 122 relationships) in 505.24 ms
- Cypher Query Latency: 50 multi-hop Cypher queries benchmarked at p50 = 0.80 ms, p95 = 1.41 ms
- PR Diff Guardrail: End-to-end blast-radius calculation and risk scoring runs in 4.13 ms
- Test Suite: 4/4 passing pytest test suites verifying full integration.
How we built it
Built using pure Python, relate-db (Relate by Neo4j embedded engine), FastAPI, Uvicorn, Model Context Protocol (MCP) SDK, Pytest, and Playwright.