/** * Reframe tier management - escalation strategies for ineffective steering. */ /** Get reframe guidance based on current tier */ export function getReframeGuidance( tier: number, ineffectivePattern?: { detected: boolean; similarCount: number; secondsSinceLastSteer: number } ): string { if (!ineffectivePattern?.detected && tier === 0) return ''; const tierGuidance: Record = { 0: '', 1: `šŸ”„ REFRAME TIER 1 — DIRECTIVE: The agent needs clearer direction. Be extremely specific about the next single action to take.`, 2: `šŸ”„ REFRAME TIER 2 — SUBGOAL: The agent is stuck on the full goal. Break this into a smaller, verifiable milestone. Tell it to complete just that one piece.`, 3: `šŸ”„ REFRAME TIER 3 — PIVOT: The current approach isn't working. Suggest a completely different strategy or implementation path. Challenge any assumptions.`, 4: `šŸ”„ REFRAME TIER 4 — MINIMAL SLICE: Strip to absolute essentials. Ask: "What's the smallest working version you can deliver right now?" Push for tangible output.`, }; const stagnation = ineffectivePattern?.secondsSinceLastSteer ?? 0; const stagnationNote = stagnation > 0 ? ` (${stagnation}s since last steer)` : ''; const patternNote = ineffectivePattern?.detected ? `\n⚠ INEFFECTIVE PATTERN DETECTED: Last ${ineffectivePattern.similarCount} steering messages were similar or no progress in${stagnationNote}. Escalate your approach.` : ''; return tierGuidance[tier] + patternNote; }