Feature Request: Configurable .codegraph/ data directory location
Summary
Currently, CodeGraph always creates its .codegraph/ directory (SQLite database, config, etc.) inside the project root. There is no way to store this data elsewhere.
Problem
Having .codegraph/ live in the project root has a few downsides:
- It pollutes the project directory with tool-generated artifacts
- It requires adding
.codegraph/ to .gitignore in every project
- Some setups (monorepos, read-only mounts, strict repo hygiene policies) make writing to the project root undesirable
Proposed Solution
Add a configuration option to specify a custom data directory, for example:
- A
--data-dir <path> flag for CLI commands (init, index, sync, serve, etc.)
- Or an environment variable like
CODEGRAPH_DATA_DIR
- Or a global config in
~/.config/codegraph/ that maps project paths to storage locations
The MCP server's directory-walking logic (currently looking for .codegraph/ up the directory tree) could fall back to a user-defined location if no .codegraph/ is found in the project tree.
Workaround
Currently the only clean workaround is a symlink:
mkdir -p ~/.local/share/codegraph/my-project
ln -s ~/.local/share/codegraph/my-project /path/to/project/.codegraph
This works but is manual and not portable across machines.
Use Case
Any developer who wants to keep their project directories clean of generated/local-only artifacts, similar to how tools like .gradle, .yarn/cache, or VS Code's jsconfig allow overriding cache/data locations.
Feature Request: Configurable
.codegraph/data directory locationSummary
Currently, CodeGraph always creates its
.codegraph/directory (SQLite database, config, etc.) inside the project root. There is no way to store this data elsewhere.Problem
Having
.codegraph/live in the project root has a few downsides:.codegraph/to.gitignorein every projectProposed Solution
Add a configuration option to specify a custom data directory, for example:
--data-dir <path>flag for CLI commands (init,index,sync,serve, etc.)CODEGRAPH_DATA_DIR~/.config/codegraph/that maps project paths to storage locationsThe MCP server's directory-walking logic (currently looking for
.codegraph/up the directory tree) could fall back to a user-defined location if no.codegraph/is found in the project tree.Workaround
Currently the only clean workaround is a symlink:
This works but is manual and not portable across machines.
Use Case
Any developer who wants to keep their project directories clean of generated/local-only artifacts, similar to how tools like
.gradle,.yarn/cache, or VS Code'sjsconfigallow overriding cache/data locations.