[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-74698":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":25,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":47,"readmeContent":48,"aiSummary":49,"trendingCount":16,"starSnapshotCount":16,"syncStatus":50,"lastSyncTime":51,"discoverSource":52},74698,"codebase-memory-mcp","DeusData\u002Fcodebase-memory-mcp","DeusData","High-performance code intelligence MCP server. Indexes codebases into a persistent knowledge graph — average repo in milliseconds. 159 languages, sub-ms queries, 99% fewer tokens. Single static binary, zero dependencies.","https:\u002F\u002Fdeusdata.github.io\u002Fcodebase-memory-mcp\u002F",null,"C",3179,324,17,41,0,171,347,921,513,29.54,"MIT License",false,"main",true,[27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],"aider","ast","claude-code","code-analysis","code-intelligence","codex","cursor","cypher","developer-tools","gemini-cli","graph-visualization","kilocode","knowledge-graph","mcp","mcp-server","model-context-protocol","opencode","sqlite","tree-sitter","windsurf","2026-06-12 02:03:27","# codebase-memory-mcp\n\n[![GitHub Release](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fv\u002Frelease\u002FDeusData\u002Fcodebase-memory-mcp?style=flat&color=blue)](https:\u002F\u002Fgithub.com\u002FDeusData\u002Fcodebase-memory-mcp\u002Freleases\u002Flatest)\n[![License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-green)](LICENSE)\n[![CI](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Factions\u002Fworkflow\u002Fstatus\u002FDeusData\u002Fcodebase-memory-mcp\u002Fdry-run.yml?label=CI)](https:\u002F\u002Fgithub.com\u002FDeusData\u002Fcodebase-memory-mcp\u002Factions\u002Fworkflows\u002Fdry-run.yml)\n[![Tests](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Ftests-2812_passing-brightgreen)](https:\u002F\u002Fgithub.com\u002FDeusData\u002Fcodebase-memory-mcp)\n[![Languages](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flanguages-155-orange)](https:\u002F\u002Fgithub.com\u002FDeusData\u002Fcodebase-memory-mcp)\n[![Agents](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fagents-11-purple)](https:\u002F\u002Fgithub.com\u002FDeusData\u002Fcodebase-memory-mcp)\n[![Pure C](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fpure_C-zero_dependencies-blue)](https:\u002F\u002Fgithub.com\u002FDeusData\u002Fcodebase-memory-mcp)\n[![Platform](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FmacOS_%7C_Linux_%7C_Windows-supported-lightgrey)](https:\u002F\u002Fgithub.com\u002FDeusData\u002Fcodebase-memory-mcp\u002Freleases\u002Flatest)\n[![OpenSSF Scorecard](https:\u002F\u002Fapi.scorecard.dev\u002Fprojects\u002Fgithub.com\u002FDeusData\u002Fcodebase-memory-mcp\u002Fbadge)](https:\u002F\u002Fscorecard.dev\u002Fviewer\u002F?uri=github.com\u002FDeusData\u002Fcodebase-memory-mcp)\n[![SLSA 3](https:\u002F\u002Fslsa.dev\u002Fimages\u002Fgh-badge-level3.svg)](https:\u002F\u002Fslsa.dev)\n[![VirusTotal](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FVirusTotal-0%2F72_engines-brightgreen?logo=virustotal)](https:\u002F\u002Fwww.virustotal.com\u002Fgui\u002Ffile\u002F7e6624b345f994afb901475e9120881241f125dfecd36772b5ade8e73485daf9\u002Fdetection)\n[![arXiv](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FarXiv-2603.27277-b31b1b?logo=arxiv)](https:\u002F\u002Farxiv.org\u002Fabs\u002F2603.27277)\n\n**The fastest and most efficient code intelligence engine for AI coding agents.** Full-indexes an average repository in milliseconds, the Linux kernel (28M LOC, 75K files) in 3 minutes. Answers structural queries in under 1ms. Ships as a single static binary for macOS, Linux, and Windows — download, run `install`, done.\n\nHigh-quality parsing through [tree-sitter](https:\u002F\u002Ftree-sitter.github.io\u002Ftree-sitter\u002F) AST analysis across all 155 languages, enhanced with LSP-style hybrid type resolution for Go, C, C++, and TypeScript \u002F JavaScript \u002F JSX \u002F TSX (more languages coming soon) — producing a persistent knowledge graph of functions, classes, call chains, HTTP routes, and cross-service links. 14 MCP tools. Zero dependencies. Plug and play across 11 coding agents.\n\n> **Research** — The design and benchmarks behind this project are described in the preprint [*Codebase-Memory: Tree-Sitter-Based Knowledge Graphs for LLM Code Exploration via MCP*](https:\u002F\u002Farxiv.org\u002Fabs\u002F2603.27277) (arXiv:2603.27277). Evaluated across 31 real-world repositories: 83% answer quality, 10× fewer tokens, 2.1× fewer tool calls vs. file-by-file exploration.\n\n> **Security & Trust** — This tool reads your codebase and writes to your agent configuration files. That is what it is designed to do. If you prefer to audit before running, the [full source is here](https:\u002F\u002Fgithub.com\u002FDeusData\u002Fcodebase-memory-mcp) — every release binary is signed, checksummed, and scanned by 70+ antivirus engines. All processing happens 100% locally; your code never leaves your machine. Found a security issue? We want to know — see [SECURITY.md](SECURITY.md). Security is Priority #1 for us.\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"docs\u002Fgraph-ui-screenshot.png\" alt=\"Graph visualization UI showing the codebase-memory-mcp knowledge graph\" width=\"800\">\n  \u003Cbr>\n  \u003Cem>Built-in 3D graph visualization (UI variant) — explore your knowledge graph at localhost:9749\u003C\u002Fem>\n\u003C\u002Fp>\n\n## Why codebase-memory-mcp\n\n- **Extreme indexing speed** — Linux kernel (28M LOC, 75K files) in 3 minutes. RAM-first pipeline: LZ4 compression, in-memory SQLite, fused Aho-Corasick pattern matching. Memory released after indexing.\n- **Plug and play** — single static binary for macOS (arm64\u002Famd64), Linux (arm64\u002Famd64), and Windows (amd64). No Docker, no runtime dependencies, no API keys. Download → `install` → restart agent → done.\n- **155 languages** — vendored tree-sitter grammars compiled into the binary. Nothing to install, nothing that breaks.\n- **120x fewer tokens** — 5 structural queries: ~3,400 tokens vs ~412,000 via file-by-file search. One graph query replaces dozens of grep\u002Fread cycles.\n- **11 agents, one command** — `install` auto-detects Claude Code, Codex CLI, Gemini CLI, Zed, OpenCode, Antigravity, Aider, KiloCode, VS Code, OpenClaw, and Kiro — configures MCP entries, instruction files, and pre-tool hooks for each.\n- **Built-in graph visualization** — 3D interactive UI at `localhost:9749` (optional UI binary variant).\n- **Infrastructure-as-code indexing** — Dockerfiles, Kubernetes manifests, and Kustomize overlays indexed as graph nodes with cross-references. `Resource` nodes for K8s kinds, `Module` nodes for Kustomize overlays with `IMPORTS` edges to referenced resources.\n- **14 MCP tools** — search, trace, architecture, impact analysis, Cypher queries, dead code detection, cross-service HTTP linking, ADR management, and more.\n\n## Quick Start\n\n**One-line install** (macOS \u002F Linux):\n```bash\ncurl -fsSL https:\u002F\u002Fraw.githubusercontent.com\u002FDeusData\u002Fcodebase-memory-mcp\u002Fmain\u002Finstall.sh | bash\n```\n\nWith graph visualization UI:\n```bash\ncurl -fsSL https:\u002F\u002Fraw.githubusercontent.com\u002FDeusData\u002Fcodebase-memory-mcp\u002Fmain\u002Finstall.sh | bash -s -- --ui\n```\n\n**Windows** (PowerShell):\n```powershell\n# 1. Download the installer\nInvoke-WebRequest -Uri https:\u002F\u002Fraw.githubusercontent.com\u002FDeusData\u002Fcodebase-memory-mcp\u002Fmain\u002Finstall.ps1 -OutFile install.ps1\n\n# 2. (Optional but recommended) Inspect the script\nnotepad install.ps1\n\n# 3. Run it\n.\\install.ps1\n\n```\n\nOptions: `--ui` (graph visualization), `--skip-config` (binary only, no agent setup), `--dir=\u003Cpath>` (custom location).\n\nRestart your coding agent. Say **\"Index this project\"** — done.\n\n\u003Cdetails>\n\u003Csummary>Manual install\u003C\u002Fsummary>\n\n1. **Download** the archive for your platform from the [latest release](https:\u002F\u002Fgithub.com\u002FDeusData\u002Fcodebase-memory-mcp\u002Freleases\u002Flatest):\n   - `codebase-memory-mcp-\u003Cos>-\u003Carch>.tar.gz` (macOS\u002FLinux) or `.zip` (Windows) — standard\n   - `codebase-memory-mcp-ui-\u003Cos>-\u003Carch>.tar.gz` \u002F `.zip` — with graph visualization\n\n2. **Extract and install** (each archive includes `install.sh` or `install.ps1`):\n\n   macOS \u002F Linux:\n   ```bash\n   tar xzf codebase-memory-mcp-*.tar.gz\n   .\u002Finstall.sh\n   ```\n\n   Windows (PowerShell):\n   ```powershell\n   Expand-Archive codebase-memory-mcp-windows-amd64.zip -DestinationPath .\n   .\\install.ps1\n   ```\n\n3. **Restart** your coding agent.\n\nThe `install` command automatically strips macOS quarantine attributes and ad-hoc signs the binary — no manual `xattr`\u002F`codesign` needed.\n\u003C\u002Fdetails>\n\nThe `install` command auto-detects all installed coding agents and configures MCP server entries, instruction files, skills, and pre-tool hooks for each.\n\n### Graph Visualization UI\n\nIf you downloaded the `ui` variant:\n\n```bash\ncodebase-memory-mcp --ui=true --port=9749\n```\n\nOpen `http:\u002F\u002Flocalhost:9749` in your browser. The UI runs as a background thread alongside the MCP server — it's available whenever your agent is connected.\n\n### Auto-Index\n\nEnable automatic indexing on MCP session start:\n\n```bash\ncodebase-memory-mcp config set auto_index true\n```\n\nWhen enabled, new projects are indexed automatically on first connection. Previously-indexed projects are registered with the background watcher for ongoing git-based change detection. Configurable file limit: `config set auto_index_limit 50000`.\n\n### Keeping Up to Date\n\n```bash\ncodebase-memory-mcp update\n```\n\nThe MCP server also checks for updates on startup and notifies on the first tool call if a newer release is available.\n\n### Uninstall\n\n```bash\ncodebase-memory-mcp uninstall\n```\n\nRemoves all agent configs, skills, hooks, and instructions. Does not remove the binary or SQLite databases.\n\n## Features\n\n### Graph & analysis\n- **Architecture overview**: `get_architecture` returns languages, packages, entry points, routes, hotspots, boundaries, layers, and clusters in a single call\n- **Architecture Decision Records**: `manage_adr` persists architectural decisions across sessions\n- **Louvain community detection**: Discovers functional modules by clustering call edges\n- **Git diff impact mapping**: `detect_changes` maps uncommitted changes to affected symbols with risk classification\n- **Call graph**: Resolves function calls across files and packages (import-aware, type-inferred)\n- **Dead code detection**: Finds functions with zero callers, excluding entry points\n- **Cypher-like queries**: `MATCH (f:Function)-[:CALLS]->(g) WHERE f.name = 'main' RETURN g.name`\n\n### Search\n- **Semantic search** (`semantic_query`): vector search across the entire graph, powered by bundled Nomic `nomic-embed-code` embeddings (40K tokens, 768d int8) compiled into the binary — no API key, no Ollama, no Docker. 11-signal combined scoring (TF-IDF, RRI, API\u002FType\u002FDecorator signatures, AST profiles, data flow, Halstead-lite, MinHash, module proximity, graph diffusion).\n- **BM25 full-text search** via SQLite FTS5 with `cbm_camel_split` tokenizer (camelCase \u002F snake_case aware)\n- **Structural search** (`search_graph`): regex name patterns, label filters, min\u002Fmax degree, file scoping\n- **Code search** (`search_code`): graph-augmented grep over indexed files only\n\n### Cross-service linking\n- **HTTP** route ↔ call-site matching with confidence scoring\n- **gRPC, GraphQL, tRPC** service detection with protobuf Route extraction\n- **Channel detection** (`EMITS` \u002F `LISTENS_ON`) for Socket.IO, EventEmitter, and generic pub-sub patterns across 8 languages with constant resolution\n\n### Cross-repo intelligence\n- **`CROSS_*` edges** link nodes across multiple repos indexed under the same store\n- **Multi-galaxy 3D UI layout** for cross-repo architecture visualization\n- **Cross-repo architecture summary** combining services, routes, and dependencies across the indexed fleet\n\n### Edge types (selected)\n- `CALLS`, `IMPORTS`, `DEFINES`, `IMPLEMENTS`, `INHERITS`\n- `HTTP_CALLS`, `ASYNC_CALLS` (cross-service)\n- `EMITS`, `LISTENS_ON` (channels)\n- `DATA_FLOWS` with arg-to-param mapping + field access chains\n- `SIMILAR_TO` (MinHash + LSH near-clone detection, Jaccard scored)\n- `SEMANTICALLY_RELATED` (vocabulary-mismatch, same-language, score ≥ 0.80)\n\n### Indexing pipeline\n- **155 vendored tree-sitter grammars** compiled into the binary\n- **Generic package \u002F module resolution** — bare specifiers like `@myorg\u002Fpkg`, `github.com\u002Ffoo\u002Fbar`, `use my_crate::foo` resolved via manifest scanning (`package.json`, `go.mod`, `Cargo.toml`, `pyproject.toml`, `composer.json`, `pubspec.yaml`, `pom.xml`, `build.gradle`, `mix.exs`, `*.gemspec`)\n- **Infrastructure-as-code indexing** — Dockerfiles, Kubernetes manifests, Kustomize overlays as graph nodes\n- **LSP-style hybrid type resolution** for Go, C, C++, and TypeScript \u002F JavaScript \u002F JSX \u002F TSX (more languages coming) — clean-room reimplementation of tsserver \u002F typescript-go's type resolution algorithms (parameter binding, return-type inference, generic substitution, JSX component dispatch, JSDoc inference for plain JS files)\n- **RAM-first pipeline**: LZ4 compression, in-memory SQLite, single dump at end. Memory released after.\n\n### Distribution & operation\n- **Single static binary, zero infrastructure**: SQLite-backed, persists to `~\u002F.cache\u002Fcodebase-memory-mcp\u002F`\n- **Auto-sync**: Background watcher detects file changes and re-indexes automatically\n- **Route nodes**: REST endpoints are first-class graph entities\n- **CLI mode**: `codebase-memory-mcp cli search_graph '{\"name_pattern\": \".*Handler.*\"}'`\n- **Available on**: npm, PyPI, Homebrew, Scoop, Winget, Chocolatey, AUR, `go install`\n\n## Team-Shared Graph Artifact\n\nCommit a single compressed file to your repo and your teammates skip the reindex.\n\n`.codebase-memory\u002Fgraph.db.zst` is a zstd-compressed snapshot of the knowledge graph that lives next to your source. When you index, the artifact is written or refreshed; when a teammate clones the repo and runs `codebase-memory-mcp` for the first time, the artifact is decompressed and incremental indexing fills in their local diff.\n\n- **Format**: SQLite database, indexes stripped, `VACUUM INTO` compacted, then zstd 1.5.7 compressed (8–13:1 ratio typical)\n- **Two tiers**:\n  - **Best** (`zstd -9` + index strip + `VACUUM INTO`) — written on explicit `index_repository`\n  - **Fast** (`zstd -3`) — written by the watcher for low-latency incremental updates\n- **Bootstrap**: when no local DB exists but the artifact is present, `index_repository` imports the artifact first, then runs incremental indexing — avoiding the full reindex cost\n- **No merge pain**: a `.gitattributes` line with `merge=ours` is auto-created on first export, so concurrent edits don't produce conflicts on the binary artifact\n- **Optional**: never committed unless you want it. Add `.codebase-memory\u002F` to `.gitignore` if you prefer everyone to reindex from scratch.\n\nThe result is similar in spirit to graphify's `graphify-out\u002F` directory, but as a single compressed file with explicit two-tier export, integrity-checked import, and zero merge friction.\n\n## How It Works\n\ncodebase-memory-mcp is a **structural analysis backend** — it builds and queries the knowledge graph. It does **not** include an LLM. Instead, it relies on your MCP client (Claude Code, or any MCP-compatible agent) to be the intelligence layer.\n\n```\nYou: \"what calls ProcessOrder?\"\n\nAgent calls: trace_call_path(function_name=\"ProcessOrder\", direction=\"inbound\")\n\ncodebase-memory-mcp: executes graph query, returns structured results\n\nAgent: presents the call chain in plain English\n```\n\n**Why no built-in LLM?** Other code graph tools embed an LLM for natural language → graph query translation. This means extra API keys, extra cost, and another model to configure. With MCP, the agent you're already talking to *is* the query translator.\n\n## Performance\n\nBenchmarked on Apple M3 Pro:\n\n| Operation | Time | Notes |\n|-----------|------|-------|\n| **Linux kernel full index** | **3 min** | 28M LOC, 75K files → 2.1M nodes, 4.9M edges |\n| Linux kernel fast index | 1m 12s | 1.88M nodes |\n| Django full index | ~6s | 49K nodes, 196K edges |\n| Cypher query | \u003C1ms | Relationship traversal |\n| Name search (regex) | \u003C10ms | SQL LIKE pre-filtering |\n| Dead code detection | ~150ms | Full graph scan with degree filtering |\n| Trace call path (depth=5) | \u003C10ms | BFS traversal |\n\n**RAM-first pipeline**: All indexing runs in memory (LZ4 HC compressed read, in-memory SQLite, single dump at end). Memory is released back to the OS after indexing completes.\n\n**Token efficiency**: Five structural queries consumed ~3,400 tokens via codebase-memory-mcp versus ~412,000 tokens via file-by-file grep exploration — a **99.2% reduction**.\n\n## Installation\n\n### Pre-built Binaries\n\n| Platform | Standard | With Graph UI |\n|----------|----------|---------------|\n| macOS (Apple Silicon) | `codebase-memory-mcp-darwin-arm64.tar.gz` | `codebase-memory-mcp-ui-darwin-arm64.tar.gz` |\n| macOS (Intel) | `codebase-memory-mcp-darwin-amd64.tar.gz` | `codebase-memory-mcp-ui-darwin-amd64.tar.gz` |\n| Linux (x86_64) | `codebase-memory-mcp-linux-amd64.tar.gz` | `codebase-memory-mcp-ui-linux-amd64.tar.gz` |\n| Linux (ARM64) | `codebase-memory-mcp-linux-arm64.tar.gz` | `codebase-memory-mcp-ui-linux-arm64.tar.gz` |\n| Windows (x86_64) | `codebase-memory-mcp-windows-amd64.zip` | `codebase-memory-mcp-ui-windows-amd64.zip` |\n\nEvery release includes `checksums.txt` with SHA-256 hashes. All binaries are statically linked — no shared library dependencies.\n\n> **Windows note**: SmartScreen may show a warning for unsigned software. Click **\"More info\"** → **\"Run anyway\"**. Verify integrity with `checksums.txt`.\n\n### Setup Scripts\n\n\u003Cdetails>\n\u003Csummary>Automated download + install\u003C\u002Fsummary>\n\n**macOS \u002F Linux:**\n\n```bash\ncurl -fsSL https:\u002F\u002Fraw.githubusercontent.com\u002FDeusData\u002Fcodebase-memory-mcp\u002Fmain\u002Fscripts\u002Fsetup.sh | bash\n```\n\n**Windows (PowerShell):**\n\n```powershell\nirm https:\u002F\u002Fraw.githubusercontent.com\u002FDeusData\u002Fcodebase-memory-mcp\u002Fmain\u002Fscripts\u002Fsetup-windows.ps1 | iex\n```\n\n\u003C\u002Fdetails>\n\n### AUR (Arch Linux)\n\n```bash\nyay -S codebase-memory-mcp-bin\n```\n\n```bash\nparu -S codebase-memory-mcp-bin\n```\n\nThe `codebase-memory-mcp-bin` package is available at: https:\u002F\u002Faur.archlinux.org\u002Fpackages\u002Fcodebase-memory-mcp-bin\n\n### Install via Claude Code\n\n```\nYou: \"Install this MCP server: https:\u002F\u002Fgithub.com\u002FDeusData\u002Fcodebase-memory-mcp\"\n```\n\n### Build from Source\n\n\u003Cdetails>\n\u003Csummary>Prerequisites: C compiler + zlib\u003C\u002Fsummary>\n\n| Requirement | Check | Install |\n|-------------|-------|---------|\n| **C compiler** (gcc or clang) | `gcc --version` or `clang --version` | macOS: `xcode-select --install`, Linux: `apt install build-essential` |\n| **C++ compiler** | `g++ --version` or `clang++ --version` | Same as above |\n| **zlib** | — | macOS: included, Linux: `apt install zlib1g-dev` |\n| **Git** | `git --version` | Pre-installed on most systems |\n\n\u003C\u002Fdetails>\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FDeusData\u002Fcodebase-memory-mcp.git\ncd codebase-memory-mcp\nscripts\u002Fbuild.sh                    # standard binary\nscripts\u002Fbuild.sh --with-ui          # with graph visualization\n# Binary at: build\u002Fc\u002Fcodebase-memory-mcp\n```\n\n### Manual MCP Configuration\n\n\u003Cdetails>\n\u003Csummary>If you prefer not to use the install command\u003C\u002Fsummary>\n\nAdd to `~\u002F.claude\u002F.mcp.json` (global) or project `.mcp.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"codebase-memory-mcp\": {\n      \"command\": \"\u002Fpath\u002Fto\u002Fcodebase-memory-mcp\",\n      \"args\": []\n    }\n  }\n}\n```\n\nRestart your agent. Verify with `\u002Fmcp` — you should see `codebase-memory-mcp` with 14 tools.\n\n\u003C\u002Fdetails>\n\n## Multi-Agent Support\n\n`install` auto-detects and configures all installed agents:\n\n| Agent | MCP Config | Instructions | Hooks |\n|-------|-----------|-------------|-------|\n| Claude Code | `.claude\u002F.mcp.json` | 4 Skills | PreToolUse (Grep\u002FGlob\u002FRead reminder) |\n| Codex CLI | `.codex\u002Fconfig.toml` | `.codex\u002FAGENTS.md` | — |\n| Gemini CLI | `.gemini\u002Fsettings.json` | `.gemini\u002FGEMINI.md` | BeforeTool (grep\u002Fread reminder) |\n| Zed | `settings.json` (JSONC) | — | — |\n| OpenCode | `opencode.json` | `AGENTS.md` | — |\n| Antigravity | `mcp_config.json` | `AGENTS.md` | — |\n| Aider | — | `CONVENTIONS.md` | — |\n| KiloCode | `mcp_settings.json` | `~\u002F.kilocode\u002Frules\u002F` | — |\n| VS Code | `Code\u002FUser\u002Fmcp.json` | — | — |\n| OpenClaw | `openclaw.json` | — | — |\n| Kiro | `.kiro\u002Fsettings\u002Fmcp.json` | — | — |\n\n**Hooks** are advisory (exit code 0) — they remind agents to prefer MCP graph tools when they reach for grep\u002Fglob\u002Fread, without blocking the tool call.\n\n## CLI Mode\n\nEvery MCP tool can be invoked from the command line:\n\n```bash\ncodebase-memory-mcp cli index_repository '{\"repo_path\": \"\u002Fpath\u002Fto\u002Frepo\"}'\ncodebase-memory-mcp cli search_graph '{\"name_pattern\": \".*Handler.*\", \"label\": \"Function\"}'\ncodebase-memory-mcp cli trace_call_path '{\"function_name\": \"Search\", \"direction\": \"both\"}'\ncodebase-memory-mcp cli query_graph '{\"query\": \"MATCH (f:Function) RETURN f.name LIMIT 5\"}'\ncodebase-memory-mcp cli list_projects\ncodebase-memory-mcp cli --raw search_graph '{\"label\": \"Function\"}' | jq '.results[].name'\n```\n\n## MCP Tools\n\n### Indexing\n\n| Tool | Description |\n|------|-------------|\n| `index_repository` | Index a repository into the graph. Auto-sync keeps it fresh after that. |\n| `list_projects` | List all indexed projects with node\u002Fedge counts. |\n| `delete_project` | Remove a project and all its graph data. |\n| `index_status` | Check indexing status of a project. |\n\n### Querying\n\n| Tool | Description |\n|------|-------------|\n| `search_graph` | Structured search by label, name pattern, file pattern, degree filters. Pagination via limit\u002Foffset. |\n| `trace_call_path` | BFS traversal — who calls a function and what it calls. Depth 1-5. |\n| `detect_changes` | Map git diff to affected symbols + blast radius with risk classification. |\n| `query_graph` | Execute Cypher-like graph queries (read-only). |\n| `get_graph_schema` | Node\u002Fedge counts, relationship patterns, property definitions per label. Run this first. |\n| `get_code_snippet` | Read source code for a function by qualified name. |\n| `get_architecture` | Codebase overview: languages, packages, routes, hotspots, clusters, ADR. |\n| `search_code` | Grep-like text search within indexed project files. |\n| `manage_adr` | CRUD for Architecture Decision Records. |\n| `ingest_traces` | Ingest runtime traces to validate HTTP_CALLS edges. |\n\n## Graph Data Model\n\n### Node Labels\n\n`Project`, `Package`, `Folder`, `File`, `Module`, `Class`, `Function`, `Method`, `Interface`, `Enum`, `Type`, `Route`, `Resource`\n\n### Edge Types\n\n`CONTAINS_PACKAGE`, `CONTAINS_FOLDER`, `CONTAINS_FILE`, `DEFINES`, `DEFINES_METHOD`, `IMPORTS`, `CALLS`, `HTTP_CALLS`, `ASYNC_CALLS`, `IMPLEMENTS`, `HANDLES`, `USAGE`, `CONFIGURES`, `WRITES`, `MEMBER_OF`, `TESTS`, `USES_TYPE`, `FILE_CHANGES_WITH`\n\n### Qualified Names\n\n`get_code_snippet` uses qualified names: `\u003Cproject>.\u003Cpath_parts>.\u003Cname>`. Use `search_graph` to discover them first.\n\n### Supported Cypher Subset\n\n`query_graph` supports: `MATCH` with labels and relationship types, variable-length paths, `WHERE` with comparisons\u002Fregex\u002FCONTAINS, `RETURN` with property access and `COUNT`\u002F`DISTINCT`, `ORDER BY`, `LIMIT`. Not supported: `WITH`, `COLLECT`, `OPTIONAL MATCH`, mutations.\n\n## Ignoring Files\n\nLayered: hardcoded patterns (`.git`, `node_modules`, etc.) → `.gitignore` hierarchy → `.cbmignore` (project-specific, gitignore syntax). Symlinks are always skipped.\n\n## Configuration\n\n```bash\ncodebase-memory-mcp config list                          # show all settings\ncodebase-memory-mcp config set auto_index true           # auto-index on session start\ncodebase-memory-mcp config set auto_index_limit 50000    # max files for auto-index\ncodebase-memory-mcp config reset auto_index              # reset to default\n```\n\n### Environment Variables\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `CBM_CACHE_DIR` | `~\u002F.cache\u002Fcodebase-memory-mcp` | Override the database storage directory. All project indexes and config are stored here. |\n| `CBM_DIAGNOSTICS` | `false` | Set to `1` or `true` to enable periodic diagnostics output to `\u002Ftmp\u002Fcbm-diagnostics-\u003Cpid>.json`. |\n| `CBM_DOWNLOAD_URL` | *(GitHub releases)* | Override the download URL for updates. Used for testing or self-hosted deployments. |\n\n```bash\n# Store indexes in a custom directory\nexport CBM_CACHE_DIR=~\u002Fmy-projects\u002Fcbm-data\n```\n\n## Custom File Extensions\n\nMap additional file extensions to supported languages via JSON config files. Useful for framework-specific extensions like `.blade.php` (Laravel) or `.mjs` (ES modules).\n\n**Per-project** (in your repo root):\n```json\n\u002F\u002F .codebase-memory.json\n{\"extra_extensions\": {\".blade.php\": \"php\", \".mjs\": \"javascript\"}}\n```\n\n**Global** (applies to all projects):\n```json\n\u002F\u002F ~\u002F.config\u002Fcodebase-memory-mcp\u002Fconfig.json  (or $XDG_CONFIG_HOME\u002F...)\n{\"extra_extensions\": {\".twig\": \"html\", \".phtml\": \"php\"}}\n```\n\nProject config overrides global for conflicting extensions. Unknown language values are silently skipped. Missing config files are ignored.\n\n## Persistence\n\nSQLite databases stored at `~\u002F.cache\u002Fcodebase-memory-mcp\u002F`. Persists across restarts (WAL mode, ACID-safe). To reset: `rm -rf ~\u002F.cache\u002Fcodebase-memory-mcp\u002F`.\n\n## Troubleshooting\n\n| Problem | Fix |\n|---------|-----|\n| `\u002Fmcp` doesn't show the server | Check `.mcp.json` path is absolute. Restart agent. Test: `echo '{}' \\| \u002Fpath\u002Fto\u002Fbinary` should output JSON. |\n| `index_repository` fails | Pass absolute path: `index_repository(repo_path=\"\u002Fabsolute\u002Fpath\")` |\n| `trace_call_path` returns 0 results | Use `search_graph(name_pattern=\".*PartialName.*\")` first to find the exact name. |\n| Queries return wrong project results | Add `project=\"name\"` parameter. Use `list_projects` to see names. |\n| Binary not found after install | Add to PATH: `export PATH=\"$HOME\u002F.local\u002Fbin:$PATH\"` |\n| UI not loading | Ensure you downloaded the `ui` variant and ran `--ui=true`. Check `http:\u002F\u002Flocalhost:9749`. |\n\n## Language Support\n\n155 languages, all parsed via vendored tree-sitter grammars compiled into the binary. Benchmarked against 64 real open-source repositories (78 to 49K nodes):\n\n| Tier | Score | Languages |\n|------|-------|-----------|\n| **Excellent** (>= 90%) | | Lua, Kotlin, C++, Perl, Objective-C, Groovy, C, Bash, Zig, Swift, CSS, YAML, TOML, HTML, SCSS, HCL, Dockerfile |\n| **Good** (75-89%) | | Python, TypeScript, TSX, Go, Rust, Java, R, Dart, JavaScript, Erlang, Elixir, Scala, Ruby, PHP, C#, SQL |\n| **Functional** (\u003C 75%) | | OCaml, Haskell |\n\nAlso supported (not yet benchmarked): Ada, Agda, Apex, Assembly (NASM), Astro, AWK, Beancount, BibTeX, Bicep, Bitbake, Blade, Cairo, Cap'n Proto, Clojure, CMake, COBOL, Common Lisp, Crystal, CSV, CUDA, D, Devicetree, Diff, .env, Elm, Emacs Lisp, F#, Fennel, Fish, FORM, Fortran, FunC, GDScript, .gitattributes, .gitignore, Gleam, GLSL, GN, Go module, Go template, GraphQL, Hare, HLSL, Hyprlang, INI, ISPC, Janet, Jinja2, JSDoc, JSON, JSON5, Jsonnet, Julia, Just, Kconfig, KDL, Lean 4, Linker Script, Liquid, LLVM IR, Luau, Magma, Makefile, Markdown, MATLAB, Mermaid, Meson, Move, Nickel, Nim, Nix, Odin, Pascal, Pkl, PO (gettext), Pony, PowerShell, Prisma, .properties, Protobuf, Puppet, PureScript, Racket, Regex, requirements.txt, ReScript, RON, reStructuredText, Scheme, Slang, Smali, Smithy, Solidity, SOQL, SOSL, Squirrel, SSH config, Starlark, Svelte, Sway, SystemVerilog, TableGen, Tcl, Teal, Templ, Thrift, TLA+, Typst, Verilog, VHDL, Vim script, Vue, WGSL, WIT, Wolfram, XML, Zsh.\n\n## Architecture\n\n```\nsrc\u002F\n  main.c              Entry point (MCP stdio server + CLI + install\u002Fupdate\u002Fconfig)\n  mcp\u002F                MCP server (14 tools, JSON-RPC 2.0, session detection, auto-index)\n  cli\u002F                Install\u002Funinstall\u002Fupdate\u002Fconfig (10 agents, hooks, instructions)\n  store\u002F              SQLite graph storage (nodes, edges, traversal, search, Louvain)\n  pipeline\u002F           Multi-pass indexing (structure → definitions → calls → HTTP links → config → tests)\n  cypher\u002F             Cypher query lexer, parser, planner, executor\n  discover\u002F           File discovery (.gitignore, .cbmignore, symlink handling)\n  watcher\u002F            Background auto-sync (git polling, adaptive intervals)\n  traces\u002F             Runtime trace ingestion\n  ui\u002F                 Embedded HTTP server + 3D graph visualization\n  foundation\u002F         Platform abstractions (threads, filesystem, logging, memory)\ninternal\u002Fcbm\u002F         Vendored tree-sitter grammars (155 languages) + AST extraction engine\n```\n\n## Security\n\nEvery release binary is verified through a multi-layer pipeline before publication:\n\n- **VirusTotal** — all binaries scanned by 70+ antivirus engines (zero detections required to publish)\n- **SLSA Level 3** — cryptographic build provenance generated by GitHub Actions; verify with `gh attestation verify \u003Cfile> --repo DeusData\u002Fcodebase-memory-mcp`\n- **Sigstore cosign** — keyless signatures on all artifacts; bundles included in every release\n- **SHA-256 checksums** — `checksums.txt` published with every release; verified by both install scripts before extraction\n- **CodeQL SAST** — blocks release pipeline if any open alerts remain\n- **Zero runtime dependencies** — no transitive supply chain; all libraries vendored at compile time\n\n### v0.6.1 VirusTotal scans\n\n| Binary | SHA-256 | VirusTotal |\n|--------|---------|-----------|\n| `linux-amd64` | `7e6624b345f994afb901...` | [0\u002F72 ✅](https:\u002F\u002Fwww.virustotal.com\u002Fgui\u002Ffile\u002F7e6624b345f994afb901475e9120881241f125dfecd36772b5ade8e73485daf9\u002Fdetection) |\n| `linux-arm64` | `ac2498c45235c1bf37f8...` | [0\u002F72 ✅](https:\u002F\u002Fwww.virustotal.com\u002Fgui\u002Ffile\u002Fac2498c45235c1bf37f8ef611bdb55c2e615fd445f7045708d7fdf2f9bda5e89\u002Fdetection) |\n| `darwin-arm64` | `3e72c8cb364c431d99f1...` | [0\u002F72 ✅](https:\u002F\u002Fwww.virustotal.com\u002Fgui\u002Ffile\u002F3e72c8cb364c431d99f183a15152db448075b150c755c9bd383fa785875c85d2\u002Fdetection) |\n| `darwin-amd64` | `7836878876c8956f6413...` | [0\u002F72 ✅](https:\u002F\u002Fwww.virustotal.com\u002Fgui\u002Ffile\u002F7836878876c8956f64132864f3122dab8766a26b21f5ae77d89d48f58a7a8219\u002Fdetection) |\n| `windows-amd64` | `d773be23ed0823d58677...` | [0\u002F72 ✅](https:\u002F\u002Fwww.virustotal.com\u002Fgui\u002Ffile\u002Fd773be23ed0823d58677453029160486becb495642cca2a81bc14f099353c46b\u002Fdetection) |\n\nScan links for every release are also included in the GitHub Release notes automatically.\n\n## License\n\nMIT\n","codebase-memory-mcp 是一个高性能的代码智能MCP服务器，能够将代码库索引到持久化的知识图谱中。该项目支持155种编程语言，可以在毫秒级时间内完成平均仓库的索引，并且查询响应时间低于1毫秒，相比传统方法减少了99%的token使用量。它提供了一个单一的静态二进制文件，无需任何外部依赖，易于安装和运行。通过tree-sitter进行高质量的AST分析，生成函数、类、调用链等元素的知识图谱，特别适合需要快速理解和导航大型代码库的场景，如AI编码助手、代码审查工具等。",2,"2026-06-11 03:50:28","high_star"]