Problem
Smart mode (--diff) includes irrelevant sibling files from the same directory and misses direct import dependencies of changed files. It also over-selects chunks from tangentially related files.
Observed behavior
- Irrelevant sibling files included:
InlineLyricsPanel, LyricsView, SeekBar, SleepTimerModal, VolumeControls, useAlbumColors — zero connection to the diff
- Direct dependencies missed:
FavoriteButton.tsx and useFavorites.ts — newly imported in ArtistDetailPage.tsx but not selected
- Over-selection of chunks:
player.store.ts pulled in almost entirely (4 chunks, ~800 lines) when only ~10 lines related to sendSignal are relevant
- Token budget: smart mode produces 28K tokens vs 10K for
--full, with an ideal target of ~12-15K
Root cause hypothesis
Scoring over-weights directory proximity (sibling files) and under-weights import graph proximity. Files in the same folder get high scores regardless of actual semantic relevance to the diff, while direct imports added in the diff are not sufficiently boosted.
Reproduction
- Repository:
nikolay-e/yay-tsa
- Commits:
0fe7132..119b0f0
- TreeMapper version: 1.4.3
treemapper . --diff 0fe7132..119b0f0
Expected behavior
Smart mode should:
- Prioritize files connected via import graph (direct dependencies of changed files)
- Reduce weight of directory proximity when there is no import/reference relationship
- Select only relevant chunks from large files (e.g. ~10 lines from
player.store.ts, not ~800)
- Stay within a reasonable token budget (~12-15K for this diff)
Problem
Smart mode (
--diff) includes irrelevant sibling files from the same directory and misses direct import dependencies of changed files. It also over-selects chunks from tangentially related files.Observed behavior
InlineLyricsPanel,LyricsView,SeekBar,SleepTimerModal,VolumeControls,useAlbumColors— zero connection to the diffFavoriteButton.tsxanduseFavorites.ts— newly imported inArtistDetailPage.tsxbut not selectedplayer.store.tspulled in almost entirely (4 chunks, ~800 lines) when only ~10 lines related tosendSignalare relevant--full, with an ideal target of ~12-15KRoot cause hypothesis
Scoring over-weights directory proximity (sibling files) and under-weights import graph proximity. Files in the same folder get high scores regardless of actual semantic relevance to the diff, while direct imports added in the diff are not sufficiently boosted.
Reproduction
nikolay-e/yay-tsa0fe7132..119b0f0treemapper . --diff 0fe7132..119b0f0Expected behavior
Smart mode should:
player.store.ts, not ~800)