From 76da95116e8893e6eb3e45f58537f711826ba644 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Sun, 22 Feb 2026 17:40:20 +0900 Subject: [PATCH] feat(agents): add Gemini intent gate enforcement overlay for Sisyphus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Counter Gemini's tendency to skip Phase 0 intent classification by injecting a mandatory self-check gate before tool calls. Includes intent type classification, anti-skip mechanism, and common mistake table showing wrong vs correct behavior per intent type. 🤖 Generated with assistance of [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode) --- src/agents/sisyphus-gemini-overlays.ts | 38 ++++++++++++++++++++++++++ src/agents/sisyphus.ts | 3 +- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/agents/sisyphus-gemini-overlays.ts b/src/agents/sisyphus-gemini-overlays.ts index 52c16387..e1e23933 100644 --- a/src/agents/sisyphus-gemini-overlays.ts +++ b/src/agents/sisyphus-gemini-overlays.ts @@ -6,6 +6,8 @@ * - Avoid delegation, preferring to do work themselves * - Claim completion without verification * - Interpret constraints as suggestions + * - Skip intent classification gates (jump straight to action) + * - Conflate investigation with implementation ("look into X" → starts coding) * * These overlays inject corrective sections at strategic points * in the dynamic Sisyphus prompt to counter these tendencies. @@ -77,3 +79,39 @@ Your internal confidence estimator is miscalibrated toward optimism. What feels 4. If you delegated, read EVERY file the subagent touched — not trust their claims `; } + +export function buildGeminiIntentGateEnforcement(): string { + return ` +## YOU MUST CLASSIFY INTENT BEFORE ACTING. NO EXCEPTIONS. + +**Your failure mode: You skip intent classification and jump straight to implementation.** + +You see a user message and your instinct is to immediately start working. WRONG. You MUST first determine WHAT KIND of work the user wants. Getting this wrong wastes everything that follows. + +**MANDATORY FIRST OUTPUT — before ANY tool call or action:** + +\`\`\` +I detect [TYPE] intent — [REASON]. +My approach: [ROUTING DECISION]. +\`\`\` + +Where TYPE is one of: research | implementation | investigation | evaluation | fix | open-ended + +**SELF-CHECK (answer honestly before proceeding):** + +1. Did the user EXPLICITLY ask me to implement/build/create something? → If NO, do NOT implement. +2. Did the user say "look into", "check", "investigate", "explain"? → That means RESEARCH, not implementation. +3. Did the user ask "what do you think?" → That means EVALUATION — propose and WAIT, do not execute. +4. Did the user report an error? → That means MINIMAL FIX, not refactoring. + +**COMMON MISTAKES YOU MAKE (AND MUST NOT):** + +| User Says | You Want To Do | You MUST Do | +| "explain how X works" | Start modifying X | Research X, explain it, STOP | +| "look into this bug" | Fix the bug immediately | Investigate, report findings, WAIT for go-ahead | +| "what do you think about approach X?" | Implement approach X | Evaluate X, propose alternatives, WAIT | +| "improve the tests" | Rewrite all tests | Assess current tests FIRST, propose approach, THEN implement | + +**IF YOU SKIPPED THE INTENT CLASSIFICATION ABOVE:** STOP. Go back. Do it now. Your next tool call is INVALID without it. +`; +} diff --git a/src/agents/sisyphus.ts b/src/agents/sisyphus.ts index 70b65643..0973bfca 100644 --- a/src/agents/sisyphus.ts +++ b/src/agents/sisyphus.ts @@ -5,6 +5,7 @@ import { buildGeminiToolMandate, buildGeminiDelegationOverride, buildGeminiVerificationOverride, + buildGeminiIntentGateEnforcement, } from "./sisyphus-gemini-overlays"; const MODE: AgentMode = "primary"; @@ -567,7 +568,7 @@ export function createSisyphusAgent( if (isGeminiModel(model)) { prompt = prompt.replace( "", - `\n\n${buildGeminiToolMandate()}` + `\n\n${buildGeminiIntentGateEnforcement()}\n\n${buildGeminiToolMandate()}` ); prompt += "\n" + buildGeminiDelegationOverride(); prompt += "\n" + buildGeminiVerificationOverride();