vx vxlabs.
Case study

cgb - Code Graph Builder

Open-source CLI, library and MCP server that maps how a codebase connects and gives AI coding assistants small, relevant context bundles.

cgb - Code Graph Builder

Overview

AI coding assistants waste a large share of every session reading whole files just to understand how code fits together — the cgb README estimates 50–100K tokens per session. cgb builds a persistent graph of a codebase (dependencies, calls, inheritance) and turns it into compact Markdown context bundles of roughly 1,000–5,000 tokens that contain exactly what the assistant needs.

Key features

  • Dependency and impact analysis: see what a change will touch before you make it
  • Context bundles sized for AI assistants
  • Git change detection with risk scoring and review context
  • Callers, code communities and dead-code detection
  • Wiki generation and embedding-based semantic search
  • Watch mode, an MCP server (with read-only mode) and a VS Code extension
  • Supports 11 languages: TypeScript, JavaScript, Python, C#, Java, Go, Rust, Ruby, PHP, C/C++ and Kotlin

Tech stack

  • TypeScript on Node.js 20+
  • Tree-sitter (WASM) parsers for multi-language analysis
  • better-sqlite3 for the persistent graph
  • Model Context Protocol SDK and chokidar file watching

Get it

MIT licensed. Install from npm as cgb-builder or browse the source on GitHub.

Let's build your AI-ready product.

Tell us what you are working on. We will reply within one business day with ideas, a rough plan and next steps.