From 76f50c1843d7ecbf25b39f68959400eb2b13194f Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Tue, 14 Apr 2026 10:52:14 -0700 Subject: [PATCH] feat: add Confusion Protocol to preamble resolver Injects a high-stakes ambiguity gate at preamble tier >= 2 so all workflow skills get it. Fires when Claude encounters architectural decisions, data model changes, destructive operations, or contradictory requirements. Does NOT fire on routine coding. Addresses Karpathy failure mode #1 (wrong assumptions) with an inline STOP gate instead of relying on workflow skill invocation. Co-Authored-By: Claude Opus 4.6 (1M context) --- scripts/resolvers/preamble.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/scripts/resolvers/preamble.ts b/scripts/resolvers/preamble.ts index bacbc0f0..d9d7bfb2 100644 --- a/scripts/resolvers/preamble.ts +++ b/scripts/resolvers/preamble.ts @@ -426,6 +426,21 @@ Use AskUserQuestion: - Note in output: "Pre-existing test failure skipped: "`; } +function generateConfusionProtocol(): string { + return `## Confusion Protocol + +When you encounter high-stakes ambiguity during coding: +- Two plausible architectures or data models for the same requirement +- A request that contradicts existing patterns and you're unsure which to follow +- A destructive operation where the scope is unclear +- Missing context that would change your approach significantly + +STOP. Name the ambiguity in one sentence. Present 2-3 options with tradeoffs. +Ask the user. Do not guess on architectural or data model decisions. + +This does NOT apply to routine coding, small features, or obvious changes.`; +} + function generateSearchBeforeBuildingSection(ctx: TemplateContext): string { return `## Search Before Building @@ -731,7 +746,7 @@ export function generatePreamble(ctx: TemplateContext): string { generateVendoringDeprecation(ctx), generateSpawnedSessionCheck(), generateVoiceDirective(tier), - ...(tier >= 2 ? [generateContextRecovery(ctx), generateAskUserFormat(ctx), generateCompletenessSection()] : []), + ...(tier >= 2 ? [generateContextRecovery(ctx), generateAskUserFormat(ctx), generateCompletenessSection(), generateConfusionProtocol()] : []), ...(tier >= 3 ? [generateRepoModeSection(), generateSearchBeforeBuildingSection(ctx)] : []), generateCompletionStatus(ctx), ];