Skip to content

Conversation

galligan
Copy link
Contributor

The text formatter was loading llms.txt content without considering which
flavor (txt vs full) the search hit came from. This caused line number
mismatches and incorrect snippets when searching against llms-full.txt.

Changes:

  • Modified cache key to include flavor: alias:flavor format
  • Updated load_llms_lines() to accept flavor parameter
  • Use storage.flavor_file_path() instead of llms_txt_path()
  • Extract flavor from SearchHit.flavor field with txt fallback

Now snippets correctly display content from the same flavor file that was
searched, fixing the issue where all text results showed identical/incorrect
snippets.

Fixes #232

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

The text formatter was loading llms.txt content without considering which
flavor (txt vs full) the search hit came from. This caused line number
mismatches and incorrect snippets when searching against llms-full.txt.

Changes:
- Modified cache key to include flavor: alias:flavor format
- Updated load_llms_lines() to accept flavor parameter
- Use storage.flavor_file_path() instead of llms_txt_path()
- Extract flavor from SearchHit.flavor field with txt fallback

Now snippets correctly display content from the same flavor file that was
searched, fixing the issue where all text results showed identical/incorrect
snippets.

Test coverage:
- Added text_formatter_uses_correct_flavor_for_snippets() integration test
- Verifies text output contains snippets from searched flavor, not wrong flavor
- Tests both directions: full→full and txt→txt

Fixes #232
@galligan galligan force-pushed the gt/fix-text-formatter-flavor-mismatch branch from 8ec98e9 to c1a02b7 Compare September 30, 2025 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix(cli): text formatter displays identical/incorrect snippets for all search results
1 participant