AI
What does a UserPromptSubmit hook actually do for a vague 'where was I?' prompt?
A captured `claude --print` session against the demo app, with a UserPromptSubmit hook that appends the current branch, last 3 commits, and `git diff --stat` to every prompt as additional context. The user prompted 'Summarize what work is currently in flight in this repo' with two real uncommitted changes on disk (a `cancelAllForCitizen` stub method and a `describe.skip` test placeholder). Claude's thinking block named 'git status and recent commits' as its source, then ran 2 Bash calls to read the actual diff content, then produced a one-paragraph summary. The article shows the wire format of the hook's injection, the events.jsonl gap (UserPromptSubmit fires with zero visible system events), and the Bash-matcher footgun where `git -C /path diff` failed to match the `Bash(git diff:*)` allow rule because of the `-C` flag prefix.