Skip to content

feat(#804): PostToolUse git-commit hook — scoped mini-briefing for changed files#813

Merged
magicpro97 merged 1 commit into
mainfrom
feat/i804-post-commit-hook
May 31, 2026
Merged

feat(#804): PostToolUse git-commit hook — scoped mini-briefing for changed files#813
magicpro97 merged 1 commit into
mainfrom
feat/i804-post-commit-hook

Conversation

@magicpro97
Copy link
Copy Markdown
Owner

Summary

Implements #804. New PostCommitBriefingRule fires on postToolUse when the bash tool runs a git commit command, then emits a scoped additionalContext mini-briefing with past mistakes/patterns for the committed files.

Changes

  • hooks/rules/post_commit_briefing.py (new): PostCommitBriefingRule — queries knowledge_entries by code_location and content LIKE for changed files, emits lean additionalContext block (max 8 entries). Silent when no relevant entries found.
  • hooks/rules/init.py: registers PostCommitBriefingRule in 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 entries
  • Output is additionalContext (LLM-injected) — not plain stdout noise
  • Fail-open: any exception returns None, never blocks the dispatch chain

Tests

  • python3 test_security.py: 13 passed ✅
  • python3 test_fixes.py: all passed ✅

Closes #804

Copilot AI review requested due to automatic review settings May 31, 2026 07:20
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@magicpro97 magicpro97 force-pushed the feat/i804-post-commit-hook branch 2 times, most recently from c1b05f0 to 412cbd0 Compare May 31, 2026 08:50
…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>
@magicpro97 magicpro97 force-pushed the feat/i804-post-commit-hook branch from 412cbd0 to cd1235f Compare May 31, 2026 09:02
@magicpro97 magicpro97 merged commit 4178883 into main May 31, 2026
32 of 34 checks passed
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.

feat(hooks): PostToolUse git-commit hook — auto-inject scoped briefing for changed files

2 participants