Skip to content

--diff smart mode over-weights directory proximity, under-weights import graph #35

@nikolay-e

Description

@nikolay-e

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:

  1. Prioritize files connected via import graph (direct dependencies of changed files)
  2. Reduce weight of directory proximity when there is no import/reference relationship
  3. Select only relevant chunks from large files (e.g. ~10 lines from player.store.ts, not ~800)
  4. Stay within a reasonable token budget (~12-15K for this diff)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions