Phase 7d-1: Claude-Custom Main Protection

phase-postgres-7d1-claude-custom-protection Phase

Goal: Prevent untracked changes from accumulating in ~/claude-custom on main. Changes to hooks, schemas, plugins, and settings must go through proper git workflow — not silently pile up as dirty state.
Owner: Betty Sue (config is her domain) or Dev agent
Repo: claude-custom
Depends on: Nothing (independent of 7d API work, can run in parallel)

Problem

~/.claude/ directories (hooks, plugins, schemas, agents, skills) are symlinks into ~/claude-custom/. Any process that modifies these files creates uncommitted changes in the git repo. Current offenders:
  • Betty Sue has config write permission — edits hooks/schemas during sessions
  • Plugin auto-updates modify plugins/blocklist.json, plugins/known_marketplaces.json
  • Dev agents occasionally check out feature branches in claude-custom instead of worktrees
  • Hook fixes applied directly to main without commit
Result: 5 dirty files on main right now. Switching branches carries the dirt. Coming back to main still has it. Changes are untracked and at risk of being lost.

Current Dirty State (2026-03-07)

Also: ~/.claude/schemas symlink was missing (just fixed manually). Needs to be added to the repo's setup/README.

Proposed Solutions

Option A: Pre-session git-clean check (hook)

A session-start hook that checks ~/claude-custom for dirty state and warns/blocks. Pros: immediate visibility. Cons: doesn't prevent the dirt, just catches it.

Option B: Post-session auto-commit (hook)

A session-end hook that auto-commits changes to a config-updates branch for review. Pros: nothing is lost. Cons: noisy, needs cleanup.

Option C: Revoke Betty Sue's direct config write + gitignore auto-updated files

Remove Betty Sue's exception for config writes. All config changes go through dev agent PR workflow. Add plugins/blocklist.json and plugins/known_marketplaces.json to .gitignore (they're auto-generated). Pros: clean separation. Cons: slower config iteration.

Option D: Hybrid — gitignore auto-files + pre-session dirty check

Gitignore the auto-updated plugin files. Add a session-start hook that checks for dirty state in tracked files and requires resolution before proceeding. Betty Sue keeps config write permission but must commit or stash before spawning agents.

Acceptance Criteria

  • Auto-updated files (plugin blocklists) don't show up as dirty
  • Intentional config changes are properly committed (not left floating)
  • Session start warns or blocks if claude-custom has uncommitted tracked changes
  • The schemas symlink setup is documented so it doesn't get lost again
  • bug-claude-custom-worktree-pollution — previous incident where dev agent polluted main
  • sop-claude-config-development — SOP for config changes
  • project-claude-config — project page