You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+50-6Lines changed: 50 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@
16
16
17
17
**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.
18
18
19
-
High-quality parsing through [tree-sitter](https://tree-sitter.github.io/tree-sitter/) AST analysis across all 158 languages, enhanced with [**Hybrid LSP** semantic type resolution](#hybrid-lsp) for Python, TypeScript / JavaScript / JSX / TSX, PHP, C#, Go, C, C++, Java, Kotlin, and Rust — 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.
19
+
High-quality parsing through [tree-sitter](https://tree-sitter.github.io/tree-sitter/) AST analysis across all 158 languages, enhanced with [**Hybrid LSP** semantic type resolution](#hybrid-lsp) for Python, TypeScript / JavaScript / JSX / TSX, PHP, C#, Go, C, C++, Java, Kotlin, and Rust — producing a persistent knowledge graph of functions, classes, call chains, HTTP routes, and cross-service links. 15 MCP tools. Zero dependencies. Plug and play across 11 coding agents.
20
20
21
21
> **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://arxiv.org/abs/2603.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.
22
22
@@ -37,7 +37,7 @@ High-quality parsing through [tree-sitter](https://tree-sitter.github.io/tree-si
37
37
-**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.
38
38
-**Built-in graph visualization** — 3D interactive UI at `localhost:9749` (optional UI binary variant).
39
39
-**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.
40
-
-**14 MCP tools** — search, trace, architecture, impact analysis, Cypher queries, dead code detection, cross-service HTTP linking, ADR management, and more.
40
+
-**15 MCP tools** — search, trace, architecture, impact analysis, Cypher queries, dead code detection, cross-service HTTP linking, ADR and personal memory management, and more.
41
41
42
42
## Quick Start
43
43
@@ -136,7 +136,7 @@ Removes all agent configs, skills, hooks, and instructions. Does not remove the
136
136
137
137
### Graph & analysis
138
138
-**Architecture overview**: `get_architecture` returns languages, packages, entry points, routes, hotspots, boundaries, layers, and clusters in a single call
139
-
-**Architecture Decision Records**: `manage_adr` persists architectural decisions across sessions
-**Louvain community detection**: Discovers functional modules by clustering call edges
141
141
-**Git diff impact mapping**: `detect_changes` maps uncommitted changes to affected symbols with risk classification
142
142
-**Call graph**: Resolves function calls across files and packages (import-aware, type-inferred)
@@ -176,6 +176,7 @@ Removes all agent configs, skills, hooks, and instructions. Does not remove the
176
176
177
177
### Distribution & operation
178
178
-**Single static binary, zero infrastructure**: SQLite-backed, persists to `~/.cache/codebase-memory-mcp/`
179
+
-**Personal memory**: Local repo knowledge lives in `manage_memory` under the user data dir; it is never written to the repo unless you explicitly export artifacts
179
180
-**Auto-sync**: Background watcher detects file changes and re-indexes automatically
180
181
-**Route nodes**: REST endpoints are first-class graph entities
@@ -197,6 +198,20 @@ Commit a single compressed file to your repo and your teammates skip the reindex
197
198
198
199
The result is similar in spirit to graphify's `graphify-out/` directory, but as a single compressed file with explicit two-tier export, integrity-checked import, and zero merge friction.
199
200
201
+
## Personal Repo Memory
202
+
203
+
Use `manage_memory` when you want ADR-style knowledge to stay local and private.
204
+
205
+
-**Storage**: local SQLite `memory.db` under the user data dir, separate from repo files
206
+
-**Override**: set `CBM_MEMORY_DIR=/path/to/private/memory`
207
+
-**No upload**: `manage_memory` never writes `.codebase-memory/` or changes tracked files
208
+
-**Branch aware**: memory is keyed by repo identity, branch, and document type; feature branches can keep overlays while `main` keeps base memory
209
+
-**LLM workflow**: call `manage_memory(mode="get")` at session start, investigate with graph tools if empty/stale, then update with `manage_memory(mode="update", content="...")`
210
+
-**Branch promotion**: after branch work, copy branch memory into base with `manage_memory(mode="promote", branch="feature")`
211
+
-**Maintenance**: list entries with `manage_memory(mode="list")`, remove one branch/doc with `manage_memory(mode="delete", branch="...")`, inspect paths with `manage_memory(mode="settings")`
212
+
213
+
`manage_adr(scope="personal", ...)` is also accepted as a compatibility path to the same personal store.
214
+
200
215
## How It Works
201
216
202
217
codebase-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.
@@ -349,7 +364,7 @@ Add to `~/.claude/.mcp.json` (global) or project `.mcp.json`:
349
364
}
350
365
```
351
366
352
-
Restart your agent. Verify with `/mcp` — you should see `codebase-memory-mcp` with 14 tools.
367
+
Restart your agent. Verify with `/mcp` — you should see `codebase-memory-mcp` with 15 tools.
codebase-memory-mcp config list # show all settings
459
475
codebase-memory-mcp config set auto_index true# auto-index on session start
460
476
codebase-memory-mcp config set auto_index_limit 50000 # max files for auto-index
477
+
codebase-memory-mcp config set auto_update false# disable startup update checks
478
+
codebase-memory-mcp config get memory_dir # local personal memory directory
479
+
codebase-memory-mcp config set memory_enabled true# opt in to local per-repo memory
480
+
codebase-memory-mcp config set memory_dir ~/private/cbm # override personal memory dir
461
481
codebase-memory-mcp config reset auto_index # reset to default
462
482
```
463
483
484
+
Default memory config:
485
+
-`memory_enabled=false`: `manage_memory` storage is opt-in. When not configured, existing project ADR/index behavior is unchanged.
486
+
-`memory_default_scope=project`: LLM workflows keep project-scoped behavior unless local personal memory is explicitly enabled.
487
+
-`memory_dir=<user data dir>`: global user-home memory DB location, override with config or `CBM_MEMORY_DIR`. The path must be absolute and outside the source repo.
488
+
489
+
### Personal memory privacy and storage boundaries
490
+
491
+
`manage_memory` is opt-in, local-only personal storage. It is intentionally separate from project indexes and source repos. Enable it with `codebase-memory-mcp config set memory_enabled true` or by passing an external config with `memory_enabled=true`:
492
+
493
+
-**Where data lives:** one SQLite DB named `memory.db` under `memory_dir`. Defaults are macOS `~/Library/Application Support/codebase-memory-mcp`, Linux `~/.local/share/codebase-memory-mcp`, Windows `%LOCALAPPDATA%/codebase-memory-mcp`. `CBM_MEMORY_DIR` or `config set memory_dir ...` can override this with an absolute path outside the repo.
494
+
-**Repo boundary:** write/read/delete operations are rejected when `memory_dir` is relative or inside the current project root. The tool reports `storage_boundary_error` and does not create `memory.db`.
495
+
-**No external transmission:**`manage_memory` does not upload memory, does not write to git, does not call network APIs, and does not sync to the repo. Responses redact repo identity and storage keys. Paths are redacted unless `reveal_paths=true` is passed to `mode="settings"`.
496
+
-**No sensitive-data logging:** memory content, storage keys, repo IDs, and memory paths are not logged by the memory tool. Content is returned only to the caller for explicit `get`/`sections` requests.
497
+
-**Delete semantics:**`mode="delete"` removes only the selected repo/branch/doc row from `memory.db`. It does not delete other branches, other repos, the DB file, SQLite free pages, filesystem backups, or user copies.
498
+
-**Promote/sync semantics:**`mode="promote"` is a local-only copy from the current branch doc to the base branch doc in the same `memory.db`. `mode="sync"` is disabled and returns `sync_disabled`; there is no network sync feature.
499
+
500
+
Default update config:
501
+
-`auto_update=true`: MCP startup checks GitHub for newer releases and shows a one-shot notice.
502
+
- Set `auto_update=false` to disable network update checks. Manual `codebase-memory-mcp update` still works.
503
+
464
504
### Environment Variables
465
505
466
506
| Variable | Default | Description |
467
507
|----------|---------|-------------|
468
508
|`CBM_CACHE_DIR`|`~/.cache/codebase-memory-mcp`| Override the database storage directory. All project indexes and config are stored here. |
509
+
|`CBM_MEMORY_DIR`| macOS: `~/Library/Application Support/codebase-memory-mcp`; Linux: `~/.local/share/codebase-memory-mcp`; Windows: `%LOCALAPPDATA%/codebase-memory-mcp`| Override local personal memory storage with an absolute path outside the repo. `manage_memory` writes `memory.db` here and does not touch the repo. |
469
510
|`CBM_DIAGNOSTICS`|`false`| Set to `1` or `true` to enable periodic diagnostics output to `/tmp/cbm-diagnostics-<pid>.json`. |
470
511
|`CBM_DOWNLOAD_URL`|*(GitHub releases)*| Override the download URL for updates. Used for testing or self-hosted deployments. |
471
512
|`CBM_LOG_LEVEL`|`info`| Set the minimum log level. Accepted values (case-insensitive): `debug`, `info`, `warn`, `error`, `none` — or their numeric equivalents `0`–`4` matching the internal enum. Logs go to stderr; stdout is reserved for MCP JSON-RPC. |
@@ -497,7 +541,7 @@ Project config overrides global for conflicting extensions. Unknown language val
497
541
498
542
## Persistence
499
543
500
-
SQLite databases stored at `~/.cache/codebase-memory-mcp/`. Persists across restarts (WAL mode, ACID-safe). To reset: `rm -rf ~/.cache/codebase-memory-mcp/`.
544
+
Project index SQLite databases are stored at `~/.cache/codebase-memory-mcp/`. Personal memory is stored separately in the user data dir or an absolute, repo-external `CBM_MEMORY_DIR`. Both persist across restarts (WAL mode, ACID-safe). To reset indexes: `rm -rf ~/.cache/codebase-memory-mcp/`. To reset personal memory, remove `memory.db` from `manage_memory(mode="settings", reveal_paths=true)` output.
501
545
502
546
## Troubleshooting
503
547
@@ -556,7 +600,7 @@ Also supported (not yet benchmarked): Ada, Agda, Apex, Assembly (NASM), Astro, A
556
600
```
557
601
src/
558
602
main.c Entry point (MCP stdio server + CLI + install/update/config)
559
-
mcp/ MCP server (14 tools, JSON-RPC 2.0, session detection, auto-index)
603
+
mcp/ MCP server (15 tools, JSON-RPC 2.0, session detection, auto-index)
<p><code>manage_adr</code> persists architectural decisions alongside the graph, so design rationale survives across sessions and teammates.</p>
731
+
<p><code>manage_adr</code> persists project ADRs; <code>manage_memory</code> is opt-in and stores personal repo memory in a local <code>memory.db</code> under the user data directory or <code>CBM_MEMORY_DIR</code>. Personal memory paths must be absolute and outside the source repo; the tool does not upload, sync to the network, write to git, or log memory content.</p>
Copy file name to clipboardExpand all lines: docs/llms.txt
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@
7
7
- License: MIT, open source.
8
8
- Languages: 158 (158 vendored tree-sitter grammars compiled into the binary).
9
9
- Hybrid LSP type resolution: 9 language families (Python, TypeScript/JavaScript/JSX/TSX, PHP, C#, Go, C/C++, Java, Kotlin, Rust) — a lightweight C implementation of language type-resolution algorithms, structurally inspired by and compatible with major language servers including tsserver, pyright, gopls, Roslyn, Eclipse JDT, and rust-analyzer.
- Semantic search: natural-language code discovery via bundled nomic-embed-code embeddings (768-dim, compiled into the binary); 11-signal combined scoring; fully local, no API key.
- Cross-repo intelligence: CROSS_* edges link nodes across multiple repos indexed in one store; multi-galaxy 3D layout and cross-repo architecture summary.
0 commit comments