feat(preamble): inject <gstack-qid:...> marker convention into question-tuning resolver

Plan-tune cathedral T14. Per D18 progressive markers, the PreToolUse
enforcement hook only fires when the AUQ question text contains a
<gstack-qid:foo-bar> marker the hook can extract. Without a marker, the
hook logs the fire as observed-only and skips enforcement (hash IDs drift
with prose so they're never used as preference keys).

The high-leverage retrofit point is the preamble's Question Tuning section,
not 10 individual skill templates. Updating scripts/resolvers/question-tuning.ts
adds the marker convention to every tier-≥2 skill in one change — agents
running ANY of the 30+ tier-≥2 skills now embed the marker by default when
the question matches a registered question_id.

Two convention additions in the preamble:
1. "Embed the question_id as a marker (<gstack-qid:{id}>) somewhere in the
   rendered question." With explanation that the marker is the only path
   for the PreToolUse hook to enforce preferences.
2. "Embed the option recommendation via the (recommended) label suffix on
   exactly one option per AUQ." Documents the D2 parser contract: label
   first, prose fallback, refuse-on-ambiguous.

Net cost: ~700 bytes added to the preamble per generated skill. Plan-review
preamble budget ratcheted from 39000 → 40000 (test/gen-skill-docs.test.ts)
with a comment explaining the cathedral T14 expansion is load-bearing.

Regenerated 42 SKILL.md files via `bun run gen:skill-docs`. The token
ceiling warning on ship/SKILL.md (~41K tokens) is pre-existing; this PR
doesn't change ship's preamble materially.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-05-27 07:53:52 -07:00
parent 66f27cfcc5
commit e82efc0d38
44 changed files with 225 additions and 45 deletions
+5 -1
View File
@@ -323,10 +323,14 @@ describe('gen-skill-docs', () => {
// Ratcheted 36500 → 39000 in the contributor wave when #1205 added the
// \\u-escape CJK rule (rule 12 + self-check item) to the AskUserQuestion
// preamble.
// Ratcheted 39000 → 40000 in plan-tune cathedral T14: question-tuning
// resolver gained the <gstack-qid:...> marker convention + the
// (recommended) label requirement (D2 + D18 — both load-bearing for
// hook enforcement). Adds ~700 bytes.
for (const skill of reviewSkills) {
const content = fs.readFileSync(skill.path, 'utf-8');
const preamble = extractPreambleBeforeWorkflow(content, skill.markers);
expect(Buffer.byteLength(preamble, 'utf-8')).toBeLessThan(39_000);
expect(Buffer.byteLength(preamble, 'utf-8')).toBeLessThan(40_000);
}
});