Codegraphx (cgx)
@techcraze00
CodeGraphX (CGX) — a local, token-efficient codebase graph engine & MCP server for AI coding agents. Tree-sitter parsing, a bi-temporal SQLite semantic graph, O(1) symbol lookup, and impact/blast-radius tracing so agents answer 'what breaks if I change this?' in a few hundred tok
Overview
What is CodeGraphX?
CodeGraphX (CGX) is a local, token-efficient codebase graph engine for AI coding agents and human developers. It parses source code with Tree-sitter, stores a bi-temporal semantic graph in SQLite, and serves it over a CLI and an MCP server.
How to use CodeGraphX?
Install with npm install -g codegraphx, then run cgx init to index the codebase. Query symbols with cgx query <symbol> or trace impact with cgx impact. The MCP server (cgx-mcp) exposes six tools for AI agents, with zero-config auto-indexing on first start.
Key features of CodeGraphX
- Persistent, queryable graph of code symbols and relationships
- O(1) symbol lookup via Bloom filter
- Recursive upstream/downstream impact tracing
- Cross-language call graph linking (frontend to backend routes)
- Bi-temporal history: query codebase as of any commit
- Token-optimized output in TOON format for AI agents
Use cases of CodeGraphX
- Identifying blast radius of a function change before refactoring
- Providing structural context to AI agents without scanning files
- Detecting dead imports, circular dependencies, and syntax errors
- Comparing task descriptions against actual code changes for verification
- Understanding cross-language API contracts between frontend and backend
FAQ from CodeGraphX
How does CodeGraphX differ from a Language Server or grep?
A Language Server answers "go to definition" for editors; grep finds text, not structure. CodeGraphX answers structural, whole-repo reasoning questions like blast radius and dependency cycles, optimized for AI agents with token-efficient output.
Is CodeGraphX cloud-based or local?
100% local. No cloud, no telemetry, no network — code never leaves the machine.
What languages does CodeGraphX support?
Python, JavaScript, JSX, TypeScript, TSX, HTML, and CSS. It extracts functions, classes, calls, imports, and framework-specific patterns (Flask/FastAPI, Express, fetch/axios).
How do I update the graph after code changes?
Run cgx init or cgx scan to perform a full re-index (unchanged files are served from cache). Use cgx watch for automatic re-indexing on file changes.
What are the runtime requirements?
Node.js version 18 or higher, running in a CommonJS environment.