refactor(ms-ai-architect): R14 — persona ut av plugin-flaten, og de seks stedene som produserte den

Nøytral arkitekt-ramme (ratifisert 15.09) i SKILL.md-ene, 23 kommandoer, 70 redaksjonelle
forekomster i ref-korpuset, README/CLAUDE.md/NOTICE og A11Y-rapportens proveniens-linje.
Hver av de 70 avgjort i kontekst: dialog fikk ny taler, proveniens ny opphavspåstand.

Ordren navnga fem produsent-steder; den live sjette manglet. `PROMPT_TEMPLATE` settes i
generate-skills.sh:27 og leses ALDRI — prompten er en heredoc i samme script. Å rette bare
prompt-template.md ville latt generatoren re-minte personaen ved neste KB-kjøring.

Ny G4-klausul i check-cosmo-gate.mjs: persona i leveranseflaten = 0, derivasjonsregisteret
pinnet per fil PÅ TALL (et filnavn-unntak er blindt for hva fila senere inneholder).
Registeret utvidet med README.md 3 — versjonstabellens rader er historikk, ikke leveranse.
Den ene genitiv-formede produktlinja adjudiseres på cosmos-db-URL-en i samme rad; regelen
er målt lukket (8 tvetydige linjer totalt, 33 URL-linjer, 2 persona-klassifiserte, begge
produkt) og hvitvasker ikke bar `Cosmo`. classifyCosmo urørt — baselinene hviler på den.
R3 godtar nå R14-utført (0) men ingenting imellom: et halvveis sveip felles fortsatt.

Bevis: gate PASSED + NETTET VALIDERT BEGGE VEIER · 1137/1137 · validate-plugin 250/0/0 ·
begge --dry-drivere 0 · Layer B 45/45 OK (kjent-positiv feller, exit 1).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-09-15 23:15:27 +02:00
commit ced0c5f46d
80 changed files with 400 additions and 152 deletions

View file

@ -519,3 +519,78 @@ export function neutralizeLabels(content, { relPath = '' } = {}) {
});
return { content: out.join('\n'), changes };
}
// ================================ R14: the delivery surface ================================
//
// R13 emptied the reference corpus's headings, R13b its mechanical labels and cells. R14 is
// the rest of the plugin: SKILL.md files, 23 commands, the 70 editorial occurrences, and the
// six sites that PRODUCE new persona on every KB generation. What stays behind is the
// DERIVATION REGISTER below — statements that are true about the past.
//
// WHY A SEPARATE COUNTER AND NOT classifyCosmo. One line outside the corpus defeats the R13
// classifier: `docs/ref-kb-gold-reconciliation-2026-06.md:93` reads "Cosmos multi-region
// writes (active-active)", which the Norwegian-genitive rule scores as persona because
// PRODUCT_FOLLOWERS was enumerated over a corpus that contains no English product prose.
// The verdict was settled by the `/azure/cosmos-db/` URL in the same table row, so that is
// the discriminator applied here — a rule, not a filename exemption.
//
// The rule is CLOSED, not open-ended. Measured over all tracked `*.md` on 2026-09-15: only 8
// lines have the ambiguous `Cosmos <lowercase>` shape at all, and only 33 lines carry a
// cosmos-db URL; of those 33, exactly 2 classify as persona and BOTH are genuinely the
// product. It is also not a laundering channel: the URL only excuses the GENITIVE shape, so a
// bare `Cosmo` on a line that happens to cite cosmos-db still counts as persona.
//
// classifyCosmo itself is deliberately NOT changed: the G1/G3/R1/R3 baselines are measured
// with it, and moving a classifier under a committed baseline is how a gate stops proving
// anything.
/**
* Persona occurrences in DELIVERY content classifyCosmo plus the adjudicated product rule.
* @param {string} content
* @returns {number}
*/
export function personaInDeliveryContent(content) {
let n = 0;
for (const line of String(content ?? '').split('\n')) {
const citesProduct = /cosmos-db|cosmosdb/i.test(line);
for (const m of line.matchAll(/cosmo/gi)) {
const rest = line.slice(m.index);
if (!isPersonaOccurrence(rest)) continue;
// Only the genitive shape is excused by the URL. A bare `Cosmo` is the persona
// whatever else the line cites.
if (citesProduct && /^Cosmos[ \t]/.test(rest)) continue;
n++;
}
}
return n;
}
/**
* The derivation register: files whose persona mentions are TRUE statements about the past
* and must survive R14. Two classes history (CHANGELOG and the README version table, which
* CLAUDE.md forbids rewriting: v1.0.0 really did ship the persona, and v1.16.5 really did
* remove `For Cosmo` from two files) and derivation records (the plans, briefs and the
* measurement document that record why the decisions were taken).
*
* PINNED ON COUNTS, NEVER ON FILENAMES. A filename exemption is blind to what the file later
* comes to contain; a count moves the moment a new persona line is added, so it still fells
* the gate. The set is closed under its own documentation: the measurement document counts
* itself, which is why the register can be committed at all.
*
* Counts measured 2026-09-15 with personaInDeliveryContent the same function G4 uses, so
* the register's population matches the field it is subtracted from.
*/
export const DERIVATION_REGISTER = {
'CHANGELOG.md': 6,
'README.md': 3,
'docs/cosmo-removal-brief-2026-06.md': 32,
'docs/devils-advocate-audit-2026-06-18.md': 1,
'docs/kb-mechanism-redesign-brief.md': 1,
'docs/kb-refresh-backlog-2026-06.md': 3,
'docs/r14-persona-gate-measurement-2026-09.md': 32,
'docs/ref-kb-correctness-program-2026-06.md': 4,
'docs/ref-kb-direction-note-2026-06.md': 6,
'docs/ref-kb-workflow-plan-2026-06.md': 25,
'docs/skill-validation-routine-brief-2026-07.md': 2,
'docs/spor1-authority-selection.md': 3,
};