Universal VCS Knowledge Graph Engine
Docuvia2 is the next-generation, simplified, and highly modular iteration of the Docuvia knowledge graph engine. It ingests Git history, documents, and code to construct a queryable knowledge graph, exposing it to AI agents via CLI and MCP.
Most AI coding agents re-derive the same architectural context on every session — re-reading files, re-grepping for callers, re-guessing why a module is shaped the way it is. That context already exists in the repo: in commit history, in diffs, in design docs, in the code itself. It's just not queryable.
Docuvia mines commit history, diffs, and spec documents alongside static code to surface the why behind every decision, not just the what, and packages it as a local, structured knowledge graph. The goal is a local-first, always-current source of architectural truth that both engineers and AI agents can query in milliseconds instead of re-exploring the codebase from scratch — see Prologue: Vision & Goal for the full write-up.
- Local-first knowledge graph — SQLite-backed, lives next to your code, no cloud daemon or external vector DB required.
- Two-tier code intelligence — Tier A: deterministic, multi-language AST parsing (10 languages, see below) that runs on every commit; Tier B: optional LSP escalation for cross-file, call-precision edges.
- Blast-radius & impact analysis —
docuvia impactanddocuvia reviewcompute who depends on a symbol, file, or changed diff before you touch it, with a color-coded risk level. - Agent-ready query API —
docuvia query(keyword + structural FTS5 search) anddocuvia mcp(a local stdio MCP server) expose the graph as structured, prompt-safe<docuvia_context>blocks. - Self-hosting — Git hooks keep the graph current automatically (
post-commitfor Tier A,pre-pushfor Tier B) — Docuvia2 builds and verifies itself with its own graph. See Self-Hosting below. - Multi-platform agent integration — one
docuvia initinstalls hooks/rules for Claude, Cursor, GitHub Copilot, Codex, Continue, and Hermes in a single pass.
AST parsing (Tier A) covers every language below out of the box. LSP escalation (Tier B, --escalate-to-lsp) adds cross-file, LSP-precision calls edges on top, once its language server is installed and resolvable — see Environment Setup.
| Language | File Extensions | AST Parsing (Tier A) | LSP Server (Tier B) | Install Command |
|---|---|---|---|---|
| TypeScript / JavaScript | .ts, .tsx, .mts, .cts, .js, .jsx, .mjs, .cjs |
✅ | typescript-language-server |
npm install -D typescript-language-server typescript |
| Python | .py |
✅ | pyright (pyright-langserver) |
npm install -D pyright |
| Go | .go |
✅ | gopls |
go install golang.org/x/tools/gopls@latest |
| Rust | .rs |
✅ | rust-analyzer |
rustup component add rust-analyzer |
| Java | .java |
✅ | jdtls (Eclipse JDT LS) |
brew install jdtls (macOS) / see download page |
| C / C++ | .c, .h, .cpp, .cxx, .cc, .hpp, .hxx, .hh, .cu, .cuh |
✅ | clangd |
brew install llvm (macOS) / apt install clangd (Linux) / LLVM installer (Windows) |
| C# | .cs |
✅ | csharp-ls |
dotnet tool install --global csharp-ls |
| PHP | .php, .phtml, .php3, .php4, .php5, .phps |
✅ | intelephense |
npm install -D intelephense |
| Ruby | .rb, .rake, .gemspec |
✅ | ruby-lsp |
gem install ruby-lsp |
| Requirement | Minimum Version | Why |
|---|---|---|
| Node.js | 20 LTS+ | Runs the CLI, MCP server, and all TypeScript packages |
| pnpm | 9.15.9+ (packageManager pin) |
Workspace-aware install/build/test across lib/* |
| Git | 2.30+ | Powers history ingestion (libgit2-backed) |
| Per-language toolchain | See table above | Only needed for that language's LSP escalation (Tier B); AST parsing needs nothing extra |
-
Install Node.js and pnpm
corepack enable corepack prepare pnpm@9.15.9 --activate -
Install project dependencies and build
pnpm install pnpm run build
If
docuviaisn't resolvable afterwards (npx --no-install docuvia --versionerrors), re-runpnpm install --forceonce — this regenerates the workspace'snode_modules/.bin/docuviashim, which can go stale after a fresh clone or a Node/pnpm upgrade. -
(Optional) Install LSP servers for the languages you work in — use the Install Command column above. TypeScript/Python/PHP servers are npm-distributed; installing them as project
devDependencies(as shown) is the most reliable option, since Docuvia also falls back tonpx --no-installwhen no local copy is found. Go/Rust/Java/C++/C#/Ruby servers are native binaries resolved fromPATHfirst, then a set of well-known per-toolchain install directories (e.g.~/go/bin,~/.cargo/bin,~/.dotnet/tools) as a fail-safe, so a fresh shell that hasn't picked upPATHyet still finds them. -
Verify your setup
npx docuvia doctor
doctorreports whether each installed language server actually resolves, without requiring a fullanalyze --escalate-to-lsprun first — it now fails (not just informs) when a language you've actually got queued for Tier B isn't ready, so fix that before runninganalyze --escalate-to-lspfor real (or pass--fallback-astto degrade to AST-only precision instead of failing).
# 1. Initialize Docuvia in a repo (this repo, or your own) — scaffolds .docuvia/,
# runs the first AST ingestion, and installs agent integrations for every
# supported platform (pass --platform=claude,codex,... to pick a subset)
npx docuvia init
# 2. Ask the knowledge graph a question, human-readable
npx docuvia query "AstWorkerPool" --format=human
# 3. Check the blast radius before touching a symbol or file
npx docuvia impact verifyToken
# 4. See what a branch/PR touches and how risky it is
npx docuvia review main
# 5. Inspect graph size / row counts at any time
npx docuvia statusRun npx docuvia <command> --help for the full flag reference, or see CLI Commands in the docs for a command-by-command deep dive (including mcp, snapshot/hydrate, and export-topology).
The complete documentation — including the critical system architecture and design principles — lives in the docs/gitbook/ directory, structured as a GitBook. Start here:
- Prologue: Vision & Goal
- Full Table of Contents — every architecture guide, coding guideline, CLI command reference, ADR, and workflow doc
- System Architecture Guide
- Coding Guidelines — design spirit, file placement rules, naming conventions
- User Guide: CLI Commands
- Architecture Decision Records
Docuvia2 is self-hosted — it uses its own knowledge graph to develop and verify itself, rather than an external code-intelligence tool. Git hooks (installed via Husky) keep the local graph current as you work:
post-commit: firesdocuvia analyzein the background (Tier A — deterministic AST delta, sub-second, never blocks the commit).pre-push: runsdocuvia analyze --escalate-to-lsp --fallback-ast && docuvia snapshot && docuvia sync-knowledgesynchronously (Tier B — LSP-precision cross-file edges), so pushed code always carries corrected knowledge.--fallback-astdegrades to AST-only precision instead of failing when the LSP environment isn't ready — a manualanalyze --escalate-to-lsp(without that flag) fails outright instead, so rundoctorfirst. This never blocks the push on failure; see PLAT-007: Tiered Background Knowledge Evolution.
Before exploring the codebase or making structural changes (by hand or via an AI agent), query the local knowledge graph to understand architectural boundaries, historical decisions, and blast radius:
npx --no-install docuvia query "<concept_or_file>" --format=promptBefore contributing, please read AGENTS.md carefully to understand the strict architectural constraints of this repository, the project structure, and the mandatory Docuvia-first exploration workflow. It also carries the same Docuvia query instructions above, so agent platforms that load AGENTS.md directly (e.g. Codex) pick them up automatically.
Docuvia2 is released under the MIT license (see the license field in package.json).