Source Included

Claude Code Setup Pack

FSL-1.1-MIT, source available

The rules, guardrail hooks, memory system and approval gate used daily across 40+ Claude Code projects.

Run it

npm test
cp hooks/* ~/.claude/hooks/
PreToolUse hook on a Bash callExample run, 20 Nov 2026

pdftotext "invoice-pack.pdf" out.txt

Blockedexit 2

No page renders exist for this PDF, so nothing has been looked at.

Render every page first, then look at them:

python render-all-pages.py "invoice-pack.pdf"

Then Read each PNG it lists. Text extraction cannot see handwriting, and a scan with no text layer returns silence that reads as absence.

Why it existsSix wrong conclusions from PDFs never opened; three findings were handwritten.

hooks/look-before-ocr.sh fed real hook JSON; the incident is from the README

What it does

Eight guardrail hooks and three helpers. They block em and en dash characters in any write, warn on ghost-written first-person copy, refuse PDF text extraction until every page was rendered and looked at, and downscale images over 1400 px before they are read.

The full description

A memory system that survives new sessions and context compaction: the git state, the last files edited and the last commands are frozen at compaction and replayed when the session starts again.

An approval gate for anything that sends, posts, pays or deletes. It is dry by default, and every approval is single-use, scoped and expiring.

What each hook caught

Every hook exists because something went wrong once. The incident, from the README, and what the hook does about it now:

The incident and what the hook does now
The incidentWhat the hook does now
Oversized images broke long sessions for goodimage-size-guard blocks full-page screenshots and downscales any image over 1400 px before it is read.
Every hook silently enforced nothing for three daysjq was missing. The shared reader now uses Python and fails loud when it cannot read its input.
An agent sent emails from a queue it was only asked to draftThe approval gate is dry by default: single-use, scoped, expiring approvals, a per-run cap and a kill switch.
Mid-task position lost after every compactionprecompact-state freezes the git state, last files and last commands; session-start replays them after the compaction.

Source: claude-code-setup/README.md, the incident behind each hook; npm test, 18 Nov 2026, re-run 20 Nov 2026