Trying to exclude a directory in my project so that it is never included in the index_repository
I’m using VSCode Insider and I’m trying to exclude a directory in my project so that it is never included in the index_repository. I also created a file: .cgrignore with the following contents:
backup_old_reference/** /backup_old_reference/ backup_old_reference
After running index_repository, it’s still in the index and I just can’t exclude it.
Can you advise how to do this?
Maybe this could fix it for you when it's merged? https://github.com/DeusData/codebase-memory-mcp/issues/31
I think you can workaround this issue as follows:
- Remove the MCP server temporarily from the agent's MCP config
- close your IDE/agent process and check if codebase-memory-mcp is not running in task manager anymore. If it's still running: kill the process.
- navigate to the codebase-memory-mcp .cache folder, e.g.
C:\Users\{user}\.cache\codebase-memory-mcpon Windows - delete all files in this folder and keep the folder open so you can check if nothing is recreated when you restart your IDE/code agent.
- Restart your IDE/code agent and check if no files are created in the .cache folder at this time. If nothing appears you're good.
- re-add the MCP server to the config and save it. Depending on your IDE/code agent it might instantly connect to the MCP server and trigger an index in which case you'll see new files created in the .cache folder. If nothing happens > restart IDE/code agent and check again.
If the .cgrignore file is correct it won't index the excluded folder. If this still doesn't work you can try another workaround and add a cwd parameter to the codebase_memory command to another folder that's 1 down in the tree from your root like:
command = "D:\\Dev\\MCP\\codebase-memory-mcp\\codebase-memory-mcp.exe"
cwd = "D:\\Project-Root\\src"
So if your backup folder is in root with a bunch of other config stuff and .gitignore and build artifact folders you can exclude them like this and set the cwd to the folder where your actual app files live.
I am working on this, comes today in a new release. Just need to test everything. Sorry for the wait
I am working on this, comes today in a new release. Just need to test everything. Sorry for the wait
Okay, thx.
This is resolved in v0.4.7 which introduces layered ignore file support:
-
.gitignoresupport — the indexer now respects your existing.gitignorepatterns. Ifbackup_old_reference/is in your.gitignore, it will be excluded from indexing automatically. -
.cbmignore(new) — a dedicated ignore file that stacks on top of.gitignore. Place a.cbmignoreat your repo root with gitignore-style patterns to exclude directories specifically from codebase-memory-mcp indexing without affecting your git config:backup_old_reference/ -
.cgrignorestill works for backwards compatibility, but.cbmignoreis the recommended approach going forward as it supports the full gitignore syntax (globstar, negation, directory-only patterns).
After upgrading to v0.4.7, reindex your project and the excluded directories will be removed from the graph automatically.
Release: https://github.com/DeusData/codebase-memory-mcp/releases/tag/v0.4.7