Skip to content

date: 2026-06-22 tags: [git, web-env, harness, conventions, hooks] status: active graduated_to:

A stale work branch silently disables repo-resident guardrails (docs + their hooks)

Symptom — Filed 25 GitHub issues that didn't follow the mandatory PR/issue writing standard, and earlier in the same session rebuilt the brainstorm review-surface flow from memory (dropping its HTML+JSON review pages). Neither was caught until the maintainer flagged it — even though the repo has a hook whose whole job is to surface the standard when an issue body is written.

Root cause — The work branch was 35 commits behind main, so the guardrails that live in the repo weren't present on the branch: docs/agents/pr-writing.md (the standard), its .claude/hooks/pr-writing-reminder.sh PreToolUse hook that injects a pointer on issue_write/create_pull_request, and the newer brainstorm SKILL.md. git fetch origin main updates the remote-tracking ref but does not change the working tree — so the docs the agent reads, the hooks that fire, and the skill versions it runs all still came from the stale branch. The maintainer's "get fresh main" was actioned as fetch-and-skim, not rebase.

Fix — Before authoring issues/PRs or running a convention/hook-driven skill, put the branch on fresh main so its docs, hooks, and skills are current:

git fetch origin main && git rebase origin/main
ls docs/agents/pr-writing.md .claude/hooks/pr-writing-reminder.sh   # confirm guardrails are present

This session: rebased claude/590-brainstorm-qya266 (6 brainstorm commits replayed clean), then the pr-writing reminder hook + doc were finally present.

Guard — Convention (the enforcing hook can't guard its own absence — a stale branch removes the very nudge that would have caught this). When a task says "get fresh main", rebase, don't just fetch, and verify the relevant guideline doc + hook exist locally before writing. Belongs alongside the web-env git learnings; candidate for a .claude/rules/ line if it recurs.