Repository navigation
Description
Summary
.claude/hooks/pre-tool.sh:106-111 blocks all force pushes with HOOK_BLOCKED: Force push. No existing guidance in CLAUDE.md or .claude/skills/_shared/ tells agents how to proceed when a legitimate force push is required (e.g., after a clean rebase). CLAUDE_HOOKS_DISABLED=true inside a Bash command doesn't work because the hook reads the env var before Bash executes, at the harness level.
Self-referential evidence: The initial gh issue create for this very issue was blocked by the hook, because the regex at line 108 (git push.*(--force| -f($| ))) has no anchoring and matched the literal strings in the issue body. Creating the issue required writing the body to a file first.
Motivation
During a session with two legitimate force pushes (cleaning contamination off a PR after rebase), I rediscovered the same workaround twice — hand the exact command to the user prefixed with ! so they run it in-session. Documenting this pattern saves every future agent the same friction and discourages CLAUDE_HOOKS_DISABLED=true false starts.
Acceptance Criteria
- AC-1: Add a short section to
CLAUDE.md(or a new.claude/skills/_shared/references/force-push.mdreferenced fromCLAUDE.md) describing the pattern: "when a force push is required, present the command prefixed with!for the user to execute in-session" - AC-2: Include a note that agents must not attempt to bypass the hook; the block is intentional (force-pushing to main/shared branches is destructive)
- AC-3: Reference
pre-tool.sh:106-111so future readers can locate the block definition - AC-4: Prefer
--force-with-leaseover raw force in the documented example - AC-5: (Optional) Consider whether the hook regex at line 108 should avoid matching inside quoted
gh issue/prbodies — same pattern that trips on secrets/credentials at line 75
Additional context
- Low priority — agents can rediscover, but documenting saves time
- Related hook: force-push block is one of several catastrophic blocks in pre-tool.sh lines 68-161
- AC-5 is a nice-to-have bonus since it's a known hook ergonomics pattern already
Complexity
simple
Activity
admarble commentedon Apr 17, 2026
→ PROCEED — Document force-push handoff pattern when
pre-tool.shblocksWorkflow:
spec → exec → qa· 5 ACsPure docs update (CLAUDE.md or
_shared/references/force-push.md).-qomitted — single-file paragraph addition.admarble commentedon Apr 23, 2026
→ PROCEED — Single-paragraph docs add. Current assess rule skips spec for docs-labeled issues.
Workflow:
exec → qa· 5 ACs```
npx sequant run 532 --phases exec,qa
```
⚠ If #533 lands first, spec phase would be included per new default
admarble commentedon Apr 26, 2026
→ PROCEED — Force-push handoff docs, 5 ACs
Workflow:
spec → exec → qaPer #533 merge (
243221f), spec phase is now default ON for docs issues — supersedes prior assess (Apr 23). No-q: single-paragraph addition.fix(#555): detect dashboard-format assess comments via HTML action ma…
admarble commentedon May 2, 2026
Supersedes 3 prior assessments (most recent: 2026-04-26)
Spec — Implementation Plan
Complexity: Simple-fix (docs-only) · Scope: ✅ Single new ref doc + 1-line CLAUDE.md pointer · Workflow:
spec → exec → qa(no-q)Acceptance Criteria with verification
.claude/skills/_shared/references/force-push.mddocuments the!-prefix handoff pattern +CLAUDE.mdpoints to it. (Manual review)CLAUDE_HOOKS_DISABLED=trueinside Bash) don't work — env-var read happens at harness level. (Manual review)pre-tool.sh:106-111. (Manual review)--force-with-lease, not raw--force. (Manual review)pre-tool.sh:108to avoid matching inside quoted issue/PR bodies. Out of scope for this docs-only PR.Implementation outline
.claude/skills/_shared/references/force-push.md, ~30-40 lines): pattern, why bypass fails, line-reference,--force-with-leaseexample, when force push is legitimate.Design Review (simple-fix scope)
Q1 — Where:
.claude/skills/_shared/references/(existing pattern, alongsideprompt-templates.mdandsubagent-types.md). CLAUDE.md gets a pointer — every agent reads it.Q3 — Pattern: Same shape as existing reference docs in
_shared/references/— short, scannable, code-example-led. No new abstractions.Key decisions
_shared/references/pattern. Issue body itself proposes this structure.Conflict risk
None — no active worktrees, no overlap with recently-merged PRs (#555 / #554 touched assess-related files only).
Open questions
admarble commentedon May 3, 2026
Exec — Implementation Complete
Branch:
feature/532-docs-document-force-push-handoff-pattern-when-PR: #563 · Commit:
f6fbf1eAC Coverage
.claude/skills/_shared/references/force-push.md+CLAUDE.mdpointerpre-tool.sh:106-111--force-with-leaseexampleFiles Changed
.claude/skills/_shared/references/force-push.md(new, 38 lines)CLAUDE.md(+4 lines under new "Hooks" section)Checks
npm run lint— passes (0 warnings)npm run build— passes (tsc clean)npm test— skipped (docs-only, no source code touched)Quality Plan Alignment
N/A — no quality plan in spec comment (simple-fix tier).
Live exercise of the documented pattern
The commit + PR + comment flow exercised the documented workaround multiple times:
-F.commitcheck tripped on the same self-referential pattern (the comment body references the commands documented).Both regexes have the same root cause as AC-5: non-anchored matching on tool-input strings. AC-5 covers the force-push regex; this exec also surfaced that line 248 has the identical bug. Filing the AC-5 follow-up will be valuable — recommend expanding its scope to cover both regexes.
Self-Evaluation
admarble commentedon May 3, 2026
QA Review for Issue #532
Branch:
feature/532-docs-document-force-push-handoff-pattern-when-PR: #563 · Commit:
f6fbf1eAC Coverage
.claude/skills/_shared/references/force-push.md+CLAUDE.mdpointerpre-tool.sh:106-111--force-with-leaseexampleCoverage: 4/4 mandatory ACs MET. AC-5 deferred (allowed).
Quality Metrics
Code Review
Strengths:
--force-with-leaseexample, not just prescriptionCLAUDE_HOOKS_DISABLED=truewrong-turnHOOK_BLOCKED: Force push) so search hits itIssues: None.
Suggestions:
pre-tool.sh:248(the no-changes-guard regex) has the same class of bug — non-anchored match on tool-input strings, tripping on quoted body content. Recommend expanding the AC-5 follow-up to cover both regexes.Risk Assessment
Verdict: READY_FOR_MERGE
All mandatory ACs satisfied. Diff is +42 lines docs-only, lint/build/typecheck green. Doc was exercised against the live hook during exec.
Next Steps
docs(#532): document force-push handoff pattern when pre-tool hook bl…
fix(#564): pre-tool.sh regexes skip gh issue/pr body content (#566)