GENERATED VIEW · PRIVATE ARCHIVE · DO NOT SERVE
RobCo Industries · Archive Museum

self-improving-code.md



MEMORY

memory/localmode-1060dea9-0dc3-42b4-958d-2a6f7a6c0c58/self-improving-code.md

sha256 51acb74b6b4d5cc9 · 2180 bytes · original held in the private archive

--- name: self-improving-code description: "Standing principle — code should be self-improving; when fixing a CLASS of bug add a guard so it can't recur; add tests proactively when warranted" metadata: node_type: memory originSessionId: 0b7c5f41-bb34-4ab4-93be-fdb363f5eb40 --- The owner wants the codebase to be SELF-IMPROVING (stated 2026-06-29: "remember this should be self-improving code. Add tests when you see fit"). When I fix a class of issue, don't just fix the instances — add a GATE GUARD / test that prevents the whole class from recurring. I have explicit latitude to add tests/guards proactively whenever warranted, not only when a feature strictly requires it. **Why:** it generalizes the escape-ratchet idea — anything that slips past a layer gets a check added at that layer in the same fix — into a project-wide habit. The owner keeps finding fresh instances of the same root cause (e.g. the "element squeezed to ~0 width wraps one piece per line" bug, which surfaced in several unrelated places). The right response is a systemic fix plus a guard that bans the bad pattern going forward, so the class is closed permanently. **How to apply:** every class-fix ships with a gate guard in both runners asserting the correct pattern / banning the bad one. Fold "add a recurrence guard" into the spec of any class-level fix. Pair with [[melee-scope-rule]] — same philosophy. The enforcement protocols themselves live in `CLAUDE.md` + `rules/`, not here. **Extension — flaws found DURING testing/verification (owner 2026-06-29):** when a flaw, gap, or footgun surfaces while testing or verifying — not just in shipped code — it must be FIXED and covered by a NEW regression test in the same commit. NEVER just work around it in the test harness and leave the underlying flaw unfixed. The illustrative case: a manual `setItem` got clobbered by the `beforeunload` flush because it wasn't guarded, and the tempting move was to patch the harness instead of the bug. **The owner watches the session transcripts and will catch work-arounds.** *Corrected 2026-07-20: stripped protocol numbers and the RULES.md citation; the doctrine is unchanged.*
STAMP · generated for RELEASE v2.8.5 commit 06e5180 (06e51801b38a) · archive input-tree hash c07fbfbdd2e1ddeb · 754 files · no wall-clock timestamp (regenerates identically when nothing changed).