Contained indexing: manual re-index only, dedup projects, lower RAM on 16GB#625
Open
Andy11-cpu wants to merge 2 commits into
Open
Contained indexing: manual re-index only, dedup projects, lower RAM on 16GB#625Andy11-cpu wants to merge 2 commits into
Andy11-cpu wants to merge 2 commits into
Conversation
2682180 to
f6fc7cd
Compare
Stop registering the git watcher on every MCP initialize unless auto_watch is explicitly enabled (default false). Re-index only via index_repository or when auto_watch is turned on after a manual index. Also deduplicate project DBs by canonical/git identity, tier RAM budget to 25% on 16GB machines, and make install hooks opt-in via --hooks. Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: Andy11-cpu <canada11@duck.com> Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: Andy11-cpu <canada11@duck.com> Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: Andy11-cpu <canada11@duck.com> Co-authored-by: Cursor <cursoragent@cursor.com>
f6fc7cd to
3450263
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
auto_watchconfig (default false). The git watcher no longer registers on every MCPinitializefor already-indexed projects — this was causing background re-index storms even whenauto_indexwas false.index_repository, or whenauto_watch trueis set after a manual index.cbm_find_existing_project_namematches canonical/git identity so the same repo opened from different paths reuses one index.--hooks(PreToolUse Grep/Glob augmenter no longer installed by default).Motivation
On a 16GB Windows machine with multiple indexed projects, the MCP server reserved ~8GB RAM and pegged CPU from watcher-driven re-indexing plus hook-augment spawning on every Grep/Glob.
Setup on any machine (fork branch)
Branch:
fix/contained-indexingonAndy11-cpu/codebase-memory-mcpOption A — Build from source (recommended until merged)
Windows (MSYS2 / llvm-mingw, same as CI):
Linux / macOS:
WSL (Linux binary, not Windows exe):
cd /mnt/c/path/to/codebase-memory-mcp sudo apt-get install -y build-essential zlib1g-dev make -f Makefile.cbm cbmOption B — Official release + manual config (partial fix only)
v0.8.1 does not include the
auto_watchgate. You can still reduce pain until this PR merges:MCP config
Point your agent at the patched binary (not v0.8.1 from AppData until you replace it):
Cursor —
~/.cursor/mcp.json:{ "mcpServers": { "codebase-memory-mcp": { "command": "/absolute/path/to/codebase-memory-mcp/build/c/codebase-memory-mcp" } } }On Windows use forward slashes, e.g.
C:/Users/you/Projects/codebase-memory-mcp/build/c/codebase-memory-mcp.exeClaude Code —
~/.claude/.mcp.json(samecommandpath).Restart the agent after editing MCP config.
Verify the patch is active
On MCP connect with existing indexes, logs should show
watcher.skip(reason:auto_watch_disabled), notwatcher.watch.Agent skill — "update quicklook"
Copy this skill to the other machine so you can re-index on demand by saying "update quicklook":
Cursor:
~/.cursor/skills/update-quicklook/SKILL.mdClaude Code:
~/.claude/skills/update-quicklook/SKILL.mdMinimal skill content (or copy from this fork's docs after merge):
Daily workflow (after setup)
CLI equivalent:
MCP tools (from agent):
index_repository,list_projects,index_status,search_graph,trace_path, etc.What NOT to do
config set auto_index trueconfig set auto_watch trueinstall --hooks.dbfiles (e.g.monaithvsmonaith-current) — this PR dedups by git identityTest plan
make -f Makefile.cbm testpasses (CI)watcher.skip, notwatcher.watch)index_repositoryupdates graph; no duplicate.dbfor same canonical repomem.initshows ~4096budget_mbon 16GB hostinstallwithout--hooksleaves agent settings.json unchangedFork: https://github.com/Andy11-cpu/codebase-memory-mcp/tree/fix/contained-indexing