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
@@ -144,7 +144,7 @@ Removes all agent configs, skills, hooks, and instructions. Does not remove the
144
144
145
145
### Graph & analysis
146
146
-**Architecture overview**: `get_architecture` returns languages, packages, entry points, routes, hotspots, boundaries, layers, and clusters in a single call
147
-
-**Architecture Decision Records**: `manage_adr` persists architectural decisions across sessions
-**Louvain community detection**: Discovers functional modules by clustering call edges
149
149
-**Git diff impact mapping**: `detect_changes` maps uncommitted changes to affected symbols with risk classification
150
150
-**Call graph**: Resolves function calls across files and packages (import-aware, type-inferred)
@@ -184,6 +184,7 @@ Removes all agent configs, skills, hooks, and instructions. Does not remove the
184
184
185
185
### Distribution & operation
186
186
-**Single static binary, zero infrastructure**: SQLite-backed, persists to `~/.cache/codebase-memory-mcp/`
187
+
-**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
187
188
-**Auto-sync**: Background watcher detects file changes and re-indexes automatically
188
189
-**Route nodes**: REST endpoints are first-class graph entities
@@ -205,6 +206,20 @@ Commit a single compressed file to your repo and your teammates skip the reindex
205
206
206
207
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.
207
208
209
+
## Personal Repo Memory
210
+
211
+
Use `manage_memory` when you want ADR-style knowledge to stay local and private.
212
+
213
+
-**Storage**: local SQLite `memory.db` under the user data dir, separate from repo files
214
+
-**Override**: set `CBM_MEMORY_DIR=/path/to/private/memory`
215
+
-**No upload**: `manage_memory` never writes `.codebase-memory/` or changes tracked files
216
+
-**Branch aware**: memory is keyed by repo identity, branch, and document type; feature branches can keep overlays while `main` keeps base memory
217
+
-**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="...")`
218
+
-**Branch promotion**: after branch work, copy branch memory into base with `manage_memory(mode="promote", branch="feature")`
219
+
-**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")`
220
+
221
+
`manage_adr(scope="personal", ...)` is also accepted as a compatibility path to the same personal store.
222
+
208
223
## How It Works
209
224
210
225
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.
@@ -357,7 +372,7 @@ Add to `~/.claude/.mcp.json` (global) or project `.mcp.json`:
357
372
}
358
373
```
359
374
360
-
Restart your agent. Verify with `/mcp` — you should see `codebase-memory-mcp` with 14 tools.
375
+
Restart your agent. Verify with `/mcp` — you should see `codebase-memory-mcp` with 15 tools.
codebase-memory-mcp config set auto_update false# disable startup update checks
489
+
codebase-memory-mcp config get memory_dir # local personal memory directory
490
+
codebase-memory-mcp config set memory_enabled true# opt in to local per-repo memory
491
+
codebase-memory-mcp config set memory_dir ~/private/cbm # override personal memory dir
472
492
codebase-memory-mcp config reset auto_index # reset to default
473
493
```
474
494
495
+
Default memory config:
496
+
-`memory_enabled=false`: `manage_memory` storage is opt-in. When not configured, existing project ADR/index behavior is unchanged.
497
+
-`memory_default_scope=project`: LLM workflows keep project-scoped behavior unless local personal memory is explicitly enabled.
498
+
-`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.
499
+
500
+
### Personal memory privacy and storage boundaries
501
+
502
+
`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`:
503
+
504
+
-**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.
505
+
-**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`.
506
+
-**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"`.
507
+
-**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.
508
+
-**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.
509
+
-**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.
510
+
511
+
Default update config:
512
+
-`auto_update=true`: MCP startup checks GitHub for newer releases and shows a one-shot notice.
513
+
- Set `auto_update=false` to disable network update checks. Manual `codebase-memory-mcp update` still works.
514
+
475
515
### Environment Variables
476
516
477
517
| Variable | Default | Description |
478
518
|----------|---------|-------------|
479
519
|`CBM_CACHE_DIR`|`~/.cache/codebase-memory-mcp`| Override the database storage directory. All project indexes and config are stored here. |
520
+
|`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. |
480
521
|`CBM_DIAGNOSTICS`|`false`| Set to `1` or `true` to enable periodic diagnostics output to `/tmp/cbm-diagnostics-<pid>.json`. |
481
522
|`CBM_DOWNLOAD_URL`|*(GitHub releases)*| Override the download URL for updates. Used for testing or self-hosted deployments. |
482
523
|`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. |
@@ -514,7 +558,7 @@ Project config overrides global for conflicting extensions. An entry whose langu
514
558
515
559
## Persistence
516
560
517
-
SQLite databases stored at `~/.cache/codebase-memory-mcp/`. Persists across restarts (WAL mode, ACID-safe). To reset: `rm -rf ~/.cache/codebase-memory-mcp/`.
561
+
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.
518
562
519
563
## Troubleshooting
520
564
@@ -573,7 +617,7 @@ Also supported (not yet benchmarked): Ada, Agda, Apex, Assembly (NASM), Astro, A
573
617
```
574
618
src/
575
619
main.c Entry point (MCP stdio server + CLI + install/update/config)
576
-
mcp/ MCP server (14 tools, JSON-RPC 2.0, session detection, auto-index)
620
+
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