Phase 8c-1: Claude-custom mid-session write protection

phase-postgres-8c1-claude-custom-write-protection Phase

Goal: Prevent direct edits to ~/claude-custom files while on main. Extends the SessionStart dirty check (7d-1, PR #61) to block mid-session writes.
Owner: Betty Sue (config files are her domain)

Problem

The check-claude-custom-clean.sh SessionStart hook catches dirty state when a session begins, but nothing prevents Betty Sue from editing ~/.claude/hooks/* files directly on main mid-session. This happened during the bug-merge-hook-silent-error fix -- edit landed on main, had to be stashed and branched retroactively.

Solution

Add a PreToolUse hook on Write|Edit that checks:
  • Is the target file inside ~/claude-custom (resolved through symlinks)?
  • Is ~/claude-custom currently on main?
  • If both yes → block with "Create a branch in ~/claude-custom first"

Deliverables

  • New hook script: block-claude-custom-main-edit.sh
  • Hook registered in settings.json under PreToolUse matcher Write|Edit
  • bug-merge-hook-silent-error — the incident that exposed this gap
  • 7d-1 (PR #61) — SessionStart dirty check (the first half of this protection)