fix(hooks): raise state-line-guard MAX_LINES from 60 to 120

Operator decision 2026-08-14: the STATE.md convention's line limit moved
from ~60 to ~120 (global CLAUDE.md already updated). Re-bases every
selftest fixture and boundary value that encoded 60 as a literal,
including section 8's ratchet fixtures, so they still exercise the
ratchet rather than degenerating into a flat gate at the new threshold.
Re-verified the real-tree justification at 120: 13 files over the limit,
one at 1496 (was 23 over 60, one at 1405 — left as historical record).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0194eV8b6BXNv6aKLovP8TP6
This commit is contained in:
Kjell Tore Guttormsen 2026-08-14 21:35:31 +02:00
commit 44fb34ab72
3 changed files with 60 additions and 43 deletions

View file

@ -2,7 +2,8 @@
// Hook: pre-state-line-guard.mjs
// Event: PreToolUse (Write|Edit)
// Purpose: block a Write/Edit that would push a STATE.md past the documented
// ~60-line convention (global CLAUDE.md's Kontinuitets-system section).
// ~120-line convention (global CLAUDE.md's Kontinuitets-system section;
// raised from ~60 by operator decision 2026-08-14).
//
// PreToolUse, not PostToolUse: org-ops' work order (20260814T144553Z) asked
// for a PostToolUse hook, but PostToolUse fires AFTER the tool already ran
@ -41,8 +42,9 @@
// MAX_LINES and larger than the file's CURRENT line count (0 for a file
// that doesn't exist yet). A file already over the limit is the normal
// starting point for a trim, not an edge case - measured on the real
// tree 2026-08-14, 23 of the machine's STATE.md files were already over
// 60 lines, one at 1405. Comparing only against MAX_LINES (no ratchet)
// tree 2026-08-14 at the 120-line threshold, 13 of the machine's
// STATE.md files were already over 120 lines, one at 1496. Comparing
// only against MAX_LINES (no ratchet)
// would deny every incremental trim of those files that doesn't land at
// <=60 in one shot - the opposite of what a guard meant to make trimming
// possible should do. The ratchet still blocks what the guard exists to
@ -54,7 +56,7 @@
import { readFileSync } from 'node:fs';
import { basename } from 'node:path';
const MAX_LINES = 60;
const MAX_LINES = 120;
function allow() {
process.exit(0);