fix: context engine cleanup — N+1 queries, resolution consolidation#4
Merged
devwhodevs merged 1 commit intomainfrom Mar 24, 2026
Merged
fix: context engine cleanup — N+1 queries, resolution consolidation#4devwhodevs merged 1 commit intomainfrom
devwhodevs merged 1 commit intomainfrom
Conversation
…tion - Add find_file_by_basename store method (SQL instead of get_all_files) - Add edge_counts_for_files batch method (single query instead of N+1) - Consolidate file resolution: context_who, context_project, graph CLI all delegate to resolve_file/find_file_by_basename - Fix ProjectContext.total_chars to include children and tasks - Rename char_count to byte_count for accuracy Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Retroactive code review fixes for the v0.4.0 context engine. Performance and maintainability improvements, no feature changes.
find_file_by_basename— SQL LIKE query replacesget_all_files()+ in-memory scan for basename resolution. Used byresolve_file,context_who,context_project, andgraph showCLI.edge_counts_for_files— Single UNION ALL query replaces N+1edge_count_for_filecalls incontext_listandcontext_project.context_who,context_project, and graph CLI all delegate toresolve_file/find_file_by_basenameinstead of duplicated logic.total_charsfix —ProjectContext.total_charsnow includes child notes and task text, not just the main note.char_count→byte_count— Renamed for accuracy (content.len()returns bytes).Test plan
🤖 Generated with Claude Code