gate: instructions_gate check 6 — the auto-memory index (R-229)
gates / gates (push) Successful in 15s

MEMORY.md is the larger half of what loads before a word is typed (8.4k tokens vs the root
CLAUDE.md's 6.6k) and is the one instruction file nobody hand-edits, so nothing was watching it.

Three deliberately different outcomes, each pinned by a test: over-ceiling FAILS (auto-memory
drops content past the limit with no error), an orphan WARNS (the store is outside git), and an
absent store PASSES while PRINTING its reason -- asserted on the reason text, because a pass with
no reason is indistinguishable from a gate that stopped running.

39 assertions (was 20). Red-proof run against the real store, not a fixture.
This commit is contained in:
2026-08-06 10:48:59 +02:00
parent 3a9dd81e18
commit f27aed87cd
3 changed files with 265 additions and 1 deletions
+28
View File
@@ -1,3 +1,31 @@
## instructions_gate.py — check 6: the auto-memory index (2026-08-06, R-229)
**The bigger half of what loads was watched by nothing.** Measured at the workspace root, the
hand-written root `CLAUDE.md` is 6.6k tokens and `MEMORY.md` is 8.4k — and `MEMORY.md` is the one
instruction file nobody hand-edits, because Claude writes it.
Check 6 asserts the index is within its line and byte ceilings and that every top-level topic file is
referenced. **Its three outcomes are deliberately different**, and each has a test proving the
difference is the intended one:
- **Over the ceiling FAILS.** Content past the auto-memory limit is dropped with **no error** — a
silent truncation with no observable at all.
- **An orphan WARNS.** The store lives outside git and changes between sessions; a hard failure
would block pushes for something no commit can fix.
- **An absent store PASSES *and prints why*.** A deliberate exception to check 1's "a missing input
is a FAILURE, never a skip" — the store is machine-local by design, so a clone on any other host
legitimately has none. The reason is printed in the tally, and a test asserts on that text rather
than on `rc == 0`, because **a pass with no reason is indistinguishable from a gate that stopped
running.** That printed reason is the only thing that made the exception safe to grant.
Two load-bearing negatives: a file reachable only via `[[wikilink]]` is **indexed, not orphaned**
(counting it would push someone to add a duplicate row), and `archive/` contents are set aside on
purpose and are never orphans.
Suite: **39 assertions, 0 failures** (was 20). Companion red-proof against the **real** store, not a
fixture — ceiling lowered 200 → 100, the gate went red naming the real file and count
(`.claude-memory/MEMORY.md: 150 lines, ceiling 100`), ceiling restored, gate and suite green again.
## repo_gates.py — `instructions` registered, and the repo that owns the gate now runs it (2026-08-06, R-229)
`instructions_gate.py` **lives in this repo's `scripts/`** and was registered in `controller_gates.py`