Skip to content
Sacred Accident #29

Genre signal is plumbed as STATE, not parsed from TEXT. When the structured truth exists upstream — a persona brief, a selected substyle, a rolled palette — the downstream consumer must receive it directly. Re-parsing it from prose is a silent-bypass class-of-bug.

Surfaced:Build 3280 (Genre Routing WAR ROOM — operator-reported 2026-05-25). User submitted Surprise Mode prompt "A funk rock song inspired by Red Hot Chili Peppers"; system produced "Intimate folk ballad with fingerpicked acoustic guitar, male baritone vocals, 70 BPM in 4/4 time, key of G major" — a complete genre-routing collapse. A 100-expert forensic WAR ROOM with four parallel agents identified four converging failure modes: (1) Surprise Mode at use-surprise-flow.ts:275 dispatched only the composed prompt text, discarding the structured palette.artistBrief that already held funk-rock genre intent. (2) SuperPrompt at superprompt/route.ts:91 INSTRUCTED Sonnet to preserve the artist verbatim in paragraph 1 but had zero programmatic enforcement — Sonnet routinely paraphrased "Red Hot Chili Peppers" into "California funk-rock pioneers", silently scrubbing the INSPIRED_BY regex window. (3) post-forge-pipeline.ts:241 populated the SuperStyle "rawPrompt" field with the already-enhanced text, so SuperStyle's artist-extraction also saw the paraphrased artifact, fell through to Haiku reading the lyrics, and chose folk-ballad to match the lyric mood. (4) genre-profile.ts:335 used substring `.includes("rap")` matching that false-positive-fired on common words like "wrap", "rapper", "therapy" — a third independent detector with a different algorithm than the word-boundary detector at genre-modes.ts:3825.

The anti-pattern this names

Every multi-stage LLM pipeline that uses an enhancement step (SuperPrompt, query rewriter, summarizer, translator) eventually produces this pattern: the enhancement is allowed to paraphrase the structured signal (artist name, genre token, locale, persona), and downstream consumers that re-extract via regex silently no-op when the paraphrase succeeds. The structured truth exists upstream in EVERY case (database lookup, curated library, user dropdown selection, deep-link query param) — the system just chose not to plumb it through. The audit shape is consistent: the operator submits a prompt naming a specific artist or genre, the model rewrite step turns the proper noun into a descriptor phrase, the downstream artist-lock returns null, and the default attractor (folk-ballad for slow lyrics, hip-hop for fast verses, pop for repeated hooks) wins. Single-layer fixes leave the class alive in adjacent rewrite stages; the cure is structural — promote the structured signal to a typed argument, demote text-parsing to a fallback.

The check

The four shipped fixes operationalize the rule: (a) B3276 Surprise Mode persona handoff — use-surprise-flow.ts:275 now passes `personaName + personaBrief` alongside the composed prompt; the forge's B2557 persona short-circuit at forge-stream.ts:362-372 bypasses regex extraction entirely when structured state is present. (b) B3277 rawPrompt end-to-end — added `rawPrompt?: string` to SongSeed (types.ts:21), threaded through forge-effects.ts → forge-v2-effect-deps.ts → buildForgeBody → request-preflight → forge-stream-session, so downstream extraction reads the original user paste, not the SuperPrompt-paraphrased artifact. (c) B3278 word-boundary matching — genre-profile.ts:335 migrated from substring `.includes()` to word-boundary `\b…\b` regex; "therapy / wrapping / lollipops / rocky" no longer false-positive-fire. (d) B3279 integrity ratchet — scripts/check-genre-routing-integrity.ts ships 15 canonical fixtures (8 happy-path genre arcs + 4 false-positive-resistance cases + 3 artist-extraction patterns) wired into check:all; every fixture is a regression that cannot silently recur. Relationship to SA#28: SA#28 is the UI-side discipline (surface implicit state at the point of action); SA#29 is the source-side discipline (plumb structured state directly to the consumer). Together they close the implicit-state-as-attack-surface class at both ends. Canonical phrasing: `BRAND.sacredAccident29`.

Share this discipline

Genre signal is plumbed as STATE, not parsed from TEXT. When the structured truth exists upstream — a persona brief, a selected substyle, a rolled palette — the downstream consumer must receive it directly. Re-parsing from prose is a silent-bypass class-of-bug. — Sacred Accident #29

Why this gets its own permalink

Each Sacred Accident is a discipline this codebase operates under — a rule named on the public record, enforced in the build pipeline, and cited in every commit that advances the moat it protects. Permalinking each one turns the discipline into a teaching artifact: a buyer or partner who reads this page can cite the exact principle we operate under without grepping our docs.

Canonical phrasing: BRAND.sacredAccident29 · Doc: docs/SACRED-ACCIDENTS.md