← ClaudeAtlas

structure-at-the-write-sitelisted

Fix for a downstream reader re-deriving a structural fact by pattern-matching prose that the program itself emitted. Use when: (1) a classifier greps an error/cause/log message for keywords to decide severity, retryability, or category; (2) a regex over a message string decides control flow, and adding a new message silently changes the outcome; (3) a status is inferred from an adjacent field that only correlates with it (a stage reached, a timestamp present, a count non-zero); (4) two consumers of the same message disagree about what it means. Root cause is that the site which KNEW the structural facts recorded only their prose summary, so every later reader must guess. Fix: record the facts as a value at the site that knows them, and delete the pattern match.
MrBinnacle/skills · ★ 0 · AI & Automation · score 68
Install: claude install-skill MrBinnacle/skills
# Record the Structure at the Site That Knows It ## Problem Somewhere a function knows three things: what happened, whether the damage is bounded, and what was established about the subject. It writes one sentence containing all three, and returns. Downstream, other code needs those facts back. It cannot ask, so it greps: ```ts const UNBOUNDED = /remaining count unknown|abandoned after|stopped after/; const bounded = !UNBOUNDED.test(cause); ``` This works for exactly the messages that existed when the regex was written. It is not a parsing problem — it is an **information-destruction** problem, and the destruction happened at the write site, several files away from where it hurts. The failure is asymmetric in a way that makes it hard to spot: the pattern match does not error, it returns the *wrong* answer, and by construction it returns the answer that corresponds to "none of the known bad phrases were present" — usually the optimistic one. ## Context / Trigger Conditions - A regex, `includes()`, or `startsWith()` over a message/cause/reason string that decides a boolean, an enum, or a branch. - Severity, retryability, or category derived from an error's *text* rather than its type or code. - A structural fact inferred from a *correlated* field: "it reached stage 3, so the object must exist"; "the timestamp is set, so it succeeded". - Two call sites producing messages for the same condition, only one of which matches the downstream pattern. - **The tell:** you