Skip to content

fix(hooks): make the recall opener survive tool use#527

Merged
plind-junior merged 1 commit into
testfrom
fix/banner-survives-tool-use
Jul 19, 2026
Merged

fix(hooks): make the recall opener survive tool use#527
plind-junior merged 1 commit into
testfrom
fix/banner-survives-tool-use

Conversation

@plind-junior

@plind-junior plind-junior commented Jul 18, 2026

Copy link
Copy Markdown
Member

real-world verification found the last gap: on tool-heavy prompts the model explored the codebase first and dropped the soft "open your reply with" phrasing from its final message — recall ran but was invisible. all three banners now state the opener as a hard output contract ("your final reply MUST open with the exact words … even if you use tools or explore the codebase first").

verified in production before this pr: on a live project, the exact prompt that previously failed now opens with "From vouch memory:", grounds in cited ids, and still does its tool exploration afterwards. tests updated to pin the strengthened phrasing; full gate green (pytest, mypy, ruff).

Summary by CodeRabbit

  • Bug Fixes
    • Improved Claude responses when no relevant vouch context is found, including a consistent fallback message.
    • Strengthened response-opening instructions so the required vouch memory notice remains clear even when tools or code exploration are used.

real-world test: on tool-heavy prompts the model explored the codebase
and dropped the soft "open your reply with" instruction from its final
message, so recall ran invisibly — the exact symptom the banners exist
to kill. verified on a live project: memory-shaped prompts opened with
"From vouch memory:", tool-heavy ones did not.

state the opener as a hard output contract in all three banners: the
final reply MUST open with the exact words, even if the model uses
tools or explores first. re-verified end-to-end on the same project —
the previously-failing prompt now opens with "From vouch memory:",
grounds in cited ids, and still does its tool exploration afterwards.
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 769ba8d1-f713-4487-b416-8ce265e1f0e2

📥 Commits

Reviewing files that changed from the base of the PR and between 756ff19 and 280b4c7.

📒 Files selected for processing (2)
  • src/vouch/hooks.py
  • tests/test_hooks.py

Walkthrough

build_claude_prompt_hook now injects mandatory exact opener instructions for empty and non-empty retrieved context, including tool-use persistence and an irrelevant-context fallback. Tests update assertions for the stricter memory-banner wording.

Changes

Claude prompt contract updates

Layer / File(s) Summary
Strengthen injected opener contracts
src/vouch/hooks.py
Empty-context prompts require Nothing in vouch on this., while standard prompts require From vouch memory: and define the irrelevant-context fallback.
Update opener assertions
tests/test_hooks.py
Tests require the stricter MUST open with the exact words From vouch memory: wording in both scenarios.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • vouchdev/vouch#518: Both changes modify build_claude_prompt_hook behavior for empty or absent injected context.

Suggested labels: retrieval

Suggested reviewers: tet-9

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main change: strengthening the recall opener so it persists through tool use.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/banner-survives-tool-use

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added tests tests and fixtures size: XS less than 50 changed non-doc lines ci: passing ci is green labels Jul 18, 2026
@plind-junior
plind-junior merged commit 093c623 into test Jul 19, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci: passing ci is green size: XS less than 50 changed non-doc lines tests tests and fixtures

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant