Repository navigation
detect_changes loses impacted symbols when the indexed project is a subdirectory of a normal Git repository #1951
Description
Version
codebase-memory-mcp 0.10.8
Platform
Windows 11 Pro build 26200, x64, NTFS
What happened?
detect_changes finds the changed Git file but resolves zero seed symbols when the Codebase Memory project root is a subdirectory of an otherwise normal standalone Git repository.
This does not require a linked Git worktree. The same repository and same change work correctly when Codebase Memory indexes the Git root itself.
Repository layout:
repo/ <- normal Git root (.git directory)
game/ <- Codebase Memory project root
src/
math.ts
use.ts
use.ts imports and calls addOne() from math.ts.
With repo/game indexed as cbm-subdir-repro, changing repo/game/src/math.ts gives:
base: HEAD
changed_files: 1
game/src/math.ts
seed_symbols: 0
impacted_total: 0
Git reports paths relative to the Git root (game/src/math.ts), while graph paths for the subdirectory project are relative to the project root (src/math.ts). The path coordinate systems therefore do not match when seeding the impact traversal.
Control
Indexing the exact same repository from the Git root instead (repo/ as cbm-root-repro) and running the exact same detect_changes request gives:
base: HEAD
changed_files: 1
game/src/math.ts
seed_symbols: 1
impacted_total: 1
cbm-root-repro.game.src.use (game/src/use.ts):
useIt Function 1
So Git diff detection and graph impact traversal both work; only the Git-root -> indexed-subdirectory path normalization loses the seed symbols.
Minimal reproduction
mkdir repo/game/src
cd repo
git init
git config user.email repro@example.com
git config user.name repro
Set-Content game/src/math.ts 'export function addOne(x: number): number { return x + 1; }'
Set-Content game/src/use.ts 'import { addOne } from "./math"; export function useIt(): number { return addOne(4); }'
git add .
git commit -m initial
codebase-memory-mcp cli --json index_repository --repo-path "$PWD/game" --name cbm-subdir-repro --mode fast
Set-Content game/src/math.ts 'export function addOne(x: number): number { return x + 2; }'
codebase-memory-mcp cli --json detect_changes --project cbm-subdir-repro --scope impact --direction inbound --depth 2 --since HEADFor the control, index $PWD as a second project and repeat detect_changes; it returns the useIt caller as expected.
Expected behavior
detect_changes should translate Git-root-relative changed paths into the indexed project's coordinate system before looking up seed symbols. A subdirectory index should provide the same impact result as a root index for files within that subdirectory.
Related issues
#659 is similar in symptom but specifically concerns linked Git worktrees and was closed after worktree-root handling. This reproduction is a normal standalone repository with a .git directory at the parent root and still reproduces on 0.10.8.
#1357 is a separate default-branch resolution issue.
Confirmations
- Reproduced with a synthetic two-file repository; no proprietary code is needed.
- Reproduced on current stable release 0.10.8.
- Searched existing issues; I did not find this normal subdirectory-index case.
Activity
DeusData commentedon Sep 25, 2026
Thank you @quakquak86 for such a clear and careful report. The side-by-side control (same repo indexed from the root vs. from
game/) pointed straight at the cause.You were exactly right: git reports changed paths relative to the repository root (
game/src/math.ts), while the graph stores paths relative to the indexed project root (src/math.ts), so the seed lookup never matched. #2334 asks git where the project root sits inside the worktree (rev-parse --show-prefix) and converts every diff/status path, plus the hunk ranges used for line-scoped seeding, into the project's own coordinates. On your reproduction a subdirectory index now gives the same result as a root index:seed_symbols: 1, withuseItas the impacted caller. One visible consequence: changes outside the indexed subdirectory no longer appear inchanged_files, because that project has no graph nodes for them. Thanks again!Merge pull request #2334 from DeusData/fix/issue-1951
fix(mcp): translate Git-root paths for subdirectory projects in detec…
DeusData commentedon Sep 30, 2026
Thank you again for reporting this, @quakquak86! The fix is now on
mainin e2f9fcc (merged via #2334), and it will ship in the next release.