Skip to content

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

@magicpro97

Description

@magicpro97

User Story

As a developer using sk, I want the system to auto-fire a mini-briefing after I commit code, surfacing only knowledge entries that touch the files I just modified.

Background

Cognee's Claude Code plugin captures tool calls via PostToolUse and injects relevant context back. sk has code-index --git-diff and a hooks system. Missing: when git commit completes, run git diff HEAD~1..HEAD --name-only, look up knowledge entries for changed files, emit scoped mini-briefing.

Acceptance Criteria

  • New hook handler in hooks/ triggered when git commit tool completes
  • Parse changed file paths from git diff HEAD~1..HEAD --name-only
  • Query knowledge_entries WHERE code_location LIKE '%<changed_file>%'
  • Emit compact mini-briefing (max 500 tokens) scoped to changed files
  • Suppress if no relevant entries found (no noise)
  • Tests in tests/

Complexity: M | Impact: H

Files: hooks/ (new handler), test_fixes.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions