fix: clarify whole-file vs. extracted fragments in the context summary #47
No reviewers
Labels
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
brooktrails/pr-reviewer!47
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/context-summary-fragment-detail"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Two visible changes plus a prompt tightening:
file)". Less ambiguous about whether the bot saw the literal full
contents.
question — typically a path:start-end line range — so a reader can
tell which bytes the bot actually saw, not just what it asked
about. Falls back to the question-only format when the extractor
produced no note.
The extract sub-pass's tool-schema description and system prompt are
tightened to require the path:start-end format explicitly (e.g.
"foo.go:5-34"), with a comma-separated list when the excerpt spans
multiple non-contiguous regions. Previously the prompt just asked for
"line range covered, or why nothing was found" and the LLM was free
to write things like "the auth handler block" — informative but
not jump-to-line-able.
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com
Automated review by pr-reviewer v0.19.0 | Full Review | Claude Sonnet 4 | tracking id
r-f46d48-5fc52cThis is an AI-generated review and may contain mistakes.
Status: ✅ Completed
✅ Verdict: Approve — Clean refactoring that improves clarity and enforces better structure in LLM prompts while maintaining backward compatibility.
Complexity: moderate
Code Review
This PR makes three coherent improvements to how the context summary displays repository fragments:
Changes Summary
path:start-endformat for line rangesTechnical Assessment
Prompt Engineering (prompts.go)
The addition to
ExtractFragmentPromptis well-crafted:Schema Updates (tools.go)
The
notefield description inemitExcerptSchema()is much more precise than the previous "line range covered, or why nothing was found" - this should lead to more consistent LLM output formatting.Display Logic (format.go)
The
FormatContextSummarychanges are solid:frag.Noteis empty (maintains backward compatibility)Test Coverage (format_test.go)
Excellent test additions:
TestFormatContextSummaryQueryWithoutNotespecifically validates the fallback behaviorBenefits
Potential Concerns
The changes look safe:
The only minor consideration is that this increases coupling between the extraction prompt, the display logic, and the specific
path:start-endformat - but this is reasonable given the benefits and the format is well-documented in multiple places.Verdict
This is a thoughtful improvement that enhances both user experience and system reliability. The implementation is clean, well-tested, and maintains backward compatibility.
📚 Context used in this review
Project guidance files:
CLAUDE.md4476952cf30840345c1d