feat(#804): PostToolUse git-commit hook — scoped mini-briefing for changed files#813
Merged
Conversation
c1b05f0 to
412cbd0
Compare
…anged files - New hooks/rules/post_commit_briefing.py: PostCommitBriefingRule registered as a postToolUse rule for the bash tool - _get_changed_files(): git diff HEAD~1..HEAD --name-only to get commit diff - _get_entries_for_files(): queries knowledge_entries by code_location + content LIKE - Emits lean additionalContext mini-briefing (max 8 entries) scoped to changed files - Silent when no relevant entries found (no noise) - Fail-open: any exception returns None, never blocks dispatch chain - Registered in hooks/rules/__init__.py alongside other postToolUse rules Closes #804 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
412cbd0 to
cd1235f
Compare
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
Implements #804. New
PostCommitBriefingRulefires onpostToolUsewhen the bash tool runs agit commitcommand, then emits a scopedadditionalContextmini-briefing with past mistakes/patterns for the committed files.Changes
PostCommitBriefingRule— queriesknowledge_entriesbycode_locationandcontent LIKEfor changed files, emits leanadditionalContextblock (max 8 entries). Silent when no relevant entries found.PostCommitBriefingRulein the postToolUse section.Behaviour
_get_changed_files():git diff HEAD~1..HEAD --name-only_get_entries_for_files(): matches by full path and basename; limits to first 10 files, max 8 entriesadditionalContext(LLM-injected) — not plain stdout noiseNone, never blocks the dispatch chainTests
python3 test_security.py: 13 passed ✅python3 test_fixes.py: all passed ✅Closes #804