The Hook That Was Meant to Guard My Japanese Folder Never Blocked Anything — Python Was Reading stdin as cp932
A PreToolUse hook guarding folders like 経理 or 議事録 silently lets edits through when Python's stdin defaults to cp932. How I reproduced it, the three-line fix, and one command to check your own hooks.
I Set onFailure to block, and the Docs' rm -rf Guard Still Let Everything Through Without jq
When a PreToolUse guard hook fails, does the action go ahead or stop? The docs' own rm -rf example exits 0 and waves everything through when jq is missing. Ten failure modes run for real, the fix, and a script that finds fail-open guards in settings.json.
I Wrote "I'll Do the Commits" in CLAUDE.md. The Next Morning git log Had One More Line.
When Claude Code commits despite being told not to: undo with git reset --soft, then stop it physically with permissions.deny plus a PreToolUse hook. Covers the git -c form that deny rules let through, and how to test the hook without starting Claude Code.
Where to Put an Instruction That Keeps Coming Back: Chat, Style, Settings File, or Hook
No comments, please. Do not translate the product name. When an instruction drifts back a few turns later, the fix is usually the location, not the wording. I compared the same sentence across four layers and settled on a rule for which instruction belongs where.
Two hooks that record every model switch and stop the ones you never agreed to
Build a PostModelSwitch hook that logs every model change and a PreModelSwitch hook that blocks unapproved switches during unattended runs. Complete scripts, measured timings, and the reason the two jobs must stay separate.
Don't let your verification script's full output flow back through a hook
The check was working the whole time. The conversation was what ran out of room. Measured side by side: 58 bytes from one scan of 833 files, 42KB from another. Which paths actually reach the model, and how to enforce a budget on them.
Tracking Multi-Step Work in Claude Code Now That the Todo Tools Are Off by Default
Since Claude Code v2.1.233, TodoWrite and the Task tools are left out on the newer models. Here are the three branches to check before you set the opt-in variable, the PostToolUse ledger I put in their place, and the measured point where that ledger quietly corrupts under parallel agents.
You Added a Second Working Root — Now Ask How Far Your Ignore Rules and Deny Patterns Actually Reach
Adding a working root mid-session does not carry your ignore rules or deny patterns with it. Measured evidence from git check-ignore and a three-way matcher comparison, plus the scope-delta audit script I now run from the DirectoryAdded hook.
Claude Code Hooks: A Field Guide to the 8 Core Hooks — and the 33-Event Catalog They Now Live In
Claude Code hooks are powerful, but most people give up before figuring out which event does what. Here's the field guide I wish I had when I started — six months of running hooks in production, distilled.
Running Claude Code Without Breakage — A Failure-First Production Workflow with Plan Mode, Hooks, Rewind, and Subagents
If Claude Code has ever landed a broken commit on your main branch, this guide shows how to combine Plan Mode, Hooks, Rewind, and Subagents into a single failure-first workflow that keeps your repository safe without slowing you down.
Debugging Claude Code Hooks in Production — Where to Start When Logs Are Missing
Your Claude Code hooks work locally but go silent in production. Here is the three-layer observability pattern I use on real projects, plus a 60-second minimal reproduction recipe for isolating failures.
Carrying Decisions Across Compaction with PreCompact and SessionEnd Hooks
Auto-compaction does not delete your conversation. It deletes the reasons behind it. Here is a working PreCompact / SessionEnd / SessionStart hook pipeline that rescues decisions to disk and hands them to the next session, with real code and measurements.