Skip to main content

Transform your codebase into a structured semantic knowledge graph for AI agents and developers.

Project description

code-nexus

Transform your codebase into a structured semantic knowledge graph for AI agents and developers.

code-nexus is a local-first, open-source engine that parses your repository into a queryable knowledge graph with rich temporal context from Git history. It provides:

  • For AI Agents: A Model Context Protocol (MCP) server that enables Claude Code and other AI tools to query your codebase structurally instead of via text search—reducing token usage by up to 80% on architectural queries.
  • For Developers: An interactive, time-traveling visual map of your code that helps you understand blast radius, code ownership, and architectural dependencies.

Features

AST-Powered Code Understanding

  • Parses Python, TypeScript/JavaScript, and Rust with tree-sitter
  • Extracts files, classes, functions, and module-level symbols
  • Identifies imports, function calls, and inheritance relationships

🔍 AI Agent-First Design

  • MCP-compliant query tools: search_nodes, get_node_signature, get_downstream_dependencies, get_upstream_callers, get_blast_radius_report
  • Context pruning engine: automatically filters non-essential code to minimize token usage
  • Agent session persistence: track inspection history across restarts
  • Temporal MCP tools: get_node_history, get_graph_at_commit

⏱️ Git-Integrated Temporal Context

  • Commit history overlay: tracks churn, ownership, and last-modified metadata per node
  • Time-travel slider: visualize how your architecture evolved
  • Diff-patch snapshots: efficiently replay historical graph states

📊 Interactive Visualization

  • WebGL 3D graph rendering of up to 10,000 nodes at 60 FPS
  • Blast radius highlighting: click a node to see everything that depends on it
  • Analytical overlays: complexity heatmaps, churn scoring, ownership visualization

🔌 Plugin System

  • Extend the graph with custom metadata via Python plugins
  • Hook into node creation and graph-ready events
  • Drop plugins into plugins/ directory—no configuration needed

Zero External Dependencies

  • Local SQLite storage (graph lives in .codenexus/graph.db)
  • No network calls, no cloud services
  • Single command to start: code-nexus start .

Quick Start

Installation

pip install code-nexus

Or use Docker:

docker run -v $(pwd):/repo code-nexus:latest code-nexus start /repo

Usage

For Developers (Interactive UI):

cd your-repo
code-nexus start .

Opens http://localhost:7842 in your browser.

For AI Agents (MCP Server):

cd your-repo
code-nexus mcp .

Configure your MCP client (e.g., Claude Code):

{
  "mcpServers": {
    "code-nexus": {
      "command": "code-nexus",
      "args": ["mcp", "."]
    }
  }
}

Sync with Latest Commits:

code-nexus sync .

Re-runs the git overlay on an existing graph to pick up new commits without a full re-index.

Tech Stack

Layer Technology Why
Parsing tree-sitter + Python Industry-standard AST extraction, 70+ grammar support
Graph Engine rustworkx (in-memory) 3–100x faster than NetworkX for large graphs
Persistence SQLite (WAL mode) Zero external dependencies, portable, concurrent reads
Agent Protocol MCP (Model Context Protocol) Standard for AI agent tooling
Frontend React + react-force-graph-3d WebGL rendering for massive graphs
API FastAPI + Uvicorn Lightweight, production-ready

Architecture

See ARCHITECTURE.md for detailed system design, database schema, MCP tool specifications, and performance targets.

At a glance:

code-nexus start .
    ├─ Ingestion Engine (parallel AST parsing)
    │   └─ Outputs: rustworkx graph + SQLite persistence
    ├─ FastAPI Server
    │   ├─ MCP Server (stdio + HTTP/SSE)
    │   └─ REST/WebSocket API for UI
    ├─ React Frontend (3D graph visualization)
    └─ File Watcher (incremental updates)

Performance Targets

Metric Target Conditions
100k LOC ingestion < 30s M1 Mac, 4 workers, SSD
500k LOC ingestion < 60s M1 Mac, 4 workers, SSD
Incremental update < 2s Single file changed
MCP structural query < 100ms Graph in memory
Context pruning < 500ms Graph in memory
UI rendering 60 FPS 10,000 nodes, WebGL
Token reduction > 80% vs full-file injection

Available MCP Tools (Phase 1)

Tool Purpose
search_nodes(query, type?, language?) Fuzzy search for nodes by name
get_node_signature(node_id) Retrieve node metadata and location
get_downstream_dependencies(node_id, depth?) Find all nodes that depend on this node
get_upstream_callers(node_id, depth?) Find all nodes that this node depends on
get_node_history(node_id, limit?) Get commit history for a node (Phase 2)
get_agent_session_history(session_id) Retrieve prior agent actions in this session
record_agent_action(session_id, node_id, action) Log agent inspection/modification for persistence

Roadmap

Phase 1 (Alpha) — Core MCP Engine & UI

  • ✅ AST parsing (Python, TypeScript, Rust)
  • ✅ Parallel ingestion pipeline
  • ✅ SQLite persistence
  • ✅ 3D WebGL Graph UI with Blast Radius & Overlays
  • ✅ MCP server (stdio transport)

Phase 2 (Beta) — Temporal Intelligence

  • ✅ Git overlay with diff-patch snapshots
  • ✅ Context pruning engine
  • ✅ Time-travel slider
  • ✅ Blast radius risk scoring
  • get_node_history & get_graph_at_commit MCP tools

Phase 3 (v1.0) — Ecosystem

  • 🔲 Plugin system launch
  • 🔲 VS Code / JetBrains extensions
  • 🔲 Cursor contextProvider adapter
  • 🔲 GitHub Actions blast-radius reports
  • 🔲 Anonymous telemetry (opt-in)

Phase 4+ (Beyond)

  • WASM plugin sandboxing
  • Cross-repository dependency mapping
  • GitHub/GitLab API enrichment

Contributing

See CONTRIBUTING.md for:

  • Language parser development guide
  • Plugin authoring guide
  • Development setup
  • Testing framework

Privacy & Security

100% local processing. No code, paths, or symbols leave your machine.

Zero external dependencies. Graph storage is a single SQLite file inside your repo (.codenexus/).

⚠️ Plugins are not sandboxed in Phase 1–3. They run with the same OS permissions as code-nexus. WASM sandboxing is a Phase 4 goal. Only load plugins you trust.

License

MIT License © 2026 Sneh Nagrecha

See LICENSE for details.

Support


Built with ❤️ to help AI and humans navigate code together.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

code_nexus-0.2.0.tar.gz (99.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

code_nexus-0.2.0-py3-none-any.whl (493.7 kB view details)

Uploaded Python 3

File details

Details for the file code_nexus-0.2.0.tar.gz.

File metadata

  • Download URL: code_nexus-0.2.0.tar.gz
  • Upload date:
  • Size: 99.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for code_nexus-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a6dc352de7da83610eb62ec51686dbbd2d990a2defc25ff0af63dd382d05bc59
MD5 09188213bc9d15532d9e67a9296f2b4e
BLAKE2b-256 5e236662ce20b653041c7daa6c12145bc5ed804897a531135a97614d362987c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for code_nexus-0.2.0.tar.gz:

Publisher: publish.yml on snagrecha/code-nexus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file code_nexus-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: code_nexus-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 493.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for code_nexus-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9fb04e93539a7d4e00cb6a95e16a0b9883a1896027eaacbbbe34b5b1c2ec98e9
MD5 dab52687b0e8b81959b8d5caf79aea5a
BLAKE2b-256 2ceefa17e1944c3cb3406c6cc2dc4ed47ca949f9be5dec2502a63e4ae0d38535

See more details on using hashes here.

Provenance

The following attestation bundles were made for code_nexus-0.2.0-py3-none-any.whl:

Publisher: publish.yml on snagrecha/code-nexus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page