daily-fix: agent-spec-size ratchet in pre-commit
Highlight text on any card (body, plan, or an event) to anchor a comment, or leave a whole-task comment here. Mention @claude to summon a reply.
No comments yet.
Overview / Motivation
Auto-filed by /daily 2026-07-23 (transcript sweep). Incident chain: .claude/agents/research-pm.md regrew past its 47,000-byte grandfather ratchet cap via a DIRECT-TO-MAIN commit (47,861 B), redding test_workflow_lint_default_exits_zero in every Step 9c gate fleet-wide until #1618 trimmed it (fix commit 8ede3ddb1b). The lint caught it only downstream — at other sessions' gates — because the direct-to-main path runs no Step 9c.
Goal
Catch agent-spec-size ratchet breaches AT COMMIT TIME: add the size-cap check to the pre-commit hook set so a direct-to-main workflow-surface edit fails on the committer's machine instead of redding the fleet.
Workflow gap
- Bug observed: the AGENT_SPEC_SIZE ratchet is enforced by
workflow_lint.py's no-flags run (Step 9c gates +test_workflow_lint_default_exits_zero), but the pre-commit config carries no such hook — a direct-to-main edit (the incident's path) bypasses every gate and turns the breach into fleet-wide red. - Why it is a workflow gap: direct-to-main workflow-surface edits are a supported path (orchestrator workflow fixes commit directly); the enforcement point must sit on the commit, not only on other sessions' gates.
- Confidence: high
- verified-at-filing:
grep -n "agent_spec_size\|AGENT_SPEC" .pre-commit-config.yaml→ 0 hits (absence claim, in-target); incident fix commit8ede3ddb1brev-parse-verified; currentwc -c .claude/agents/research-pm.md= 46,785 B (under cap post-#1618) (2026-07-24 UTC).
Proposed change (refine in planning)
Add a pre-commit hook (files-scoped to .claude/agents/*.md) invoking the existing workflow_lint.py agent-spec-size check (or a thin wrapper) so any staged agent file over its ratchet cap blocks the commit with the cap + measured size named.
Scope / surfaces
- Primary target:
.pre-commit-config.yaml(+ aworkflow_lint.pyentrypoint flag if needed)
Constraints / invariants
- The hook must be fast (single-file stat class, no full lint run); recursion guard applies.
Provenance
-
fingerprint: 7e5383b890db
-
workflow_fix_target: .pre-commit-config.yaml