From 1e65a65b2015c40ca0b4557bf4339a2d47b2a64c Mon Sep 17 00:00:00 2001 From: "bert.hausmans" Date: Tue, 5 May 2026 23:24:46 +0200 Subject: [PATCH] chore(claude): add SessionStart compact context injector inject-sprint-context.sh fires on SessionStart with matcher=compact and emits branch, last 10 commits, and the top of BACKLOG.md so Claude resumes with sprint context after auto-compaction. Output capped at ~600 tokens. --- .claude/hooks/inject-sprint-context.sh | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 .claude/hooks/inject-sprint-context.sh diff --git a/.claude/hooks/inject-sprint-context.sh b/.claude/hooks/inject-sprint-context.sh new file mode 100755 index 00000000..da9b40f8 --- /dev/null +++ b/.claude/hooks/inject-sprint-context.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +set -euo pipefail + +cd "$CLAUDE_PROJECT_DIR" 2>/dev/null || exit 0 + +branch="$(git branch --show-current 2>/dev/null || echo unknown)" +recent="$(git log --oneline -10 2>/dev/null || echo '(git log unavailable)')" + +backlog_excerpt="(BACKLOG.md not found)" +if [ -f dev-docs/BACKLOG.md ]; then + # First 40 lines, capped at ~3500 chars to stay well under 600 tokens for the whole output. + backlog_excerpt="$(head -n 40 dev-docs/BACKLOG.md | head -c 3500)" +fi + +cat <