Files
gstack/test/skill-e2e-auq-repetition-cut-ab.test.ts
T
Garry TanandClaude Fable 5 781f46d025 feat(preamble): AskUserQuestion repetition cut — gated, passed NOT-WORSE A/B
Removes the duplicate statements v1.71's compaction left in the
AskUserQuestion Format section: the completeness rule restated in the prose
triad, the auto-decide marker syntax stated twice, the Conductor-flakiness
explanation stated twice, and the self-check's full triad restatement. Every
verbosity floor and all 14 format pins stay (Layer 0 green).

The gate this decision rested on ran before landing (new periodic
skill-e2e-auq-repetition-cut-ab.test.ts, pre-cut ref 3263fffe vs this
render, same harness as auq-verbose-vs-carved-ab): POST 7/7 format elements,
substance 5 — identical to PRE. No degradation; the load-bearing-repetition
hypothesis did not hold for these duplicates.

Net: -236 bytes per tier-2+ skill (~9.7KB corpus). Golden ship baselines
re-captured for the deliberate change.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-28 02:00:50 +00:00

111 lines
4.3 KiB
TypeScript

/**
* AUQ no-degradation A/B: pre-cut vs post-cut AskUserQuestion Format — periodic,
* paid, SDK capture.
*
* The AskUserQuestion Format preamble section stated several of its rules more
* than once (the completeness rule three times, the auto-decide marker twice,
* the tool-not-prose rule three times). The repetition cut removes the
* duplicate statements while keeping every floor and all 14 format pins
* (Layer 0, auq-format-always-loaded.test.ts, proves presence deterministically).
*
* The risk under test: repetition may be load-bearing for RUNTIME compliance —
* a model may follow rules better because they repeat. This A/B is the gate
* that decision rested on (approved 2026-08-25, option A: "the gate outranks
* the approval"): identical prompt, two renders, and the post-cut AUQ must be
* NOT WORSE than the pre-cut AUQ on format elements and recommendation
* substance. Same harness and bar as skill-e2e-auq-verbose-vs-carved-ab.
*
* - PRE : plan-ceo-review/SKILL.md read from git at 3263fffe (the last
* commit before the cut), with the current sections/ (the cut
* touched only the preamble skeleton, not the sections).
* - POST : this worktree's render.
*/
import { test } from 'bun:test';
import { describeE2ETier } from './helpers/e2e-gate';
import * as fs from 'node:fs';
import {
setupPlanCeoDir,
captureModeSelectionAuq,
scoreAuqFormat,
carvedSkill,
verboseSkill,
} from './helpers/auq-sdk-capture';
import { judgeRecommendation } from './helpers/llm-judge';
const describeE2E = describeE2ETier('periodic');
const runId = `auq-cut-ab-${process.env.EVALS_RUN_ID ?? 'local'}`;
const PRE_CUT_REF = '3263fffe';
async function grade(label: string, dir: string) {
const text = await captureModeSelectionAuq({ planDir: dir, testName: `auq-cut-ab-${label}`, runId });
const fmt = scoreAuqFormat(text);
let substance = 0;
if (text.trim()) {
try {
const r = await judgeRecommendation(text);
substance = r.reason_substance;
} catch { /* judge unavailable */ }
}
// eslint-disable-next-line no-console
console.log(
`[AUQ-CUT-AB ${label}] captured=${text.length}B format=${fmt.present}/${fmt.total} ` +
`missing=[${fmt.missing.join(',')}] substance=${substance}`,
);
return { text, fmt, substance };
}
describeE2E('AUQ no-degradation: repetition cut (periodic)', () => {
test(
'post-cut AskUserQuestion Format render is not worse than pre-cut on the same prompt',
async () => {
const post = carvedSkill();
const postDir = setupPlanCeoDir({
skillMd: post.skillMd,
sectionsFrom: post.sectionsFrom,
tmpPrefix: 'auq-cut-ab-post-',
});
const preDir = setupPlanCeoDir({
skillMd: verboseSkill(PRE_CUT_REF),
sectionsFrom: post.sectionsFrom,
tmpPrefix: 'auq-cut-ab-pre-',
});
let p, q;
try {
q = await grade('POST', postDir);
p = await grade('PRE', preDir);
} finally {
fs.rmSync(postDir, { recursive: true, force: true });
fs.rmSync(preDir, { recursive: true, force: true });
}
const summary = [
`POST: format ${q.fmt.present}/${q.fmt.total}, substance ${q.substance}`,
`PRE : format ${p.fmt.present}/${p.fmt.total}, substance ${p.substance}`,
].join('\n');
if (!q.text.trim() || !p.text.trim()) {
throw new Error(
`A/B inconclusive — a side produced no AUQ capture:\n${summary}\n` +
`--- post ---\n${q.text.slice(0, 2000)}\n--- pre ---\n${p.text.slice(0, 2000)}`,
);
}
const formatRegressed = q.fmt.present < p.fmt.present;
const substanceRegressed = q.substance < p.substance - 1; // 1-pt judge tolerance
if (formatRegressed || substanceRegressed) {
throw new Error(
`AUQ DEGRADATION from the repetition cut — the gate outranks the approval; revert the cut:\n${summary}` +
(formatRegressed ? `\n -> post-cut dropped: [${q.fmt.missing.join(',')}]` : '') +
(substanceRegressed ? `\n -> post-cut substance regressed >1 pt` : '') +
`\n--- post AUQ ---\n${q.text}\n--- pre AUQ ---\n${p.text}`,
);
}
// eslint-disable-next-line no-console
console.log('[AUQ-CUT-AB] NO DEGRADATION:\n' + summary);
},
600_000,
);
});