/** * Strategist role — rewrites HOW only; must NOT rewrite acceptance criteria. */ export interface StrategistPromptInput { objective: string; planMarkdown: string; gaps: string[]; historyNotes?: string; } /** * Build a strategist prompt. Structural HOW changes only — plan contract is frozen. */ export function buildStrategistPrompt(input: StrategistPromptInput): string { const gapList = input.gaps.length > 0 ? input.gaps.map((g, i) => `${i + 1}. ${g}`).join("\n") : "(none listed)"; const history = input.historyNotes?.trim() ? input.historyNotes : "(no additional history notes)"; return [ "You are the Goal Strategist for the pi-goal-expander harness.", "The implementer has failed verification several rounds in a row.", "Diagnose WHY it is stuck and recommend ONE concrete STRUCTURAL change to the HOW.", "", "## Hard constraints", "", "- You MUST NOT rewrite, weaken, delete, or add acceptance criteria.", "- You MUST NOT change the verification plan gating steps or goal kind.", "- The plan contract (OBJECTIVE + acceptance criteria + verification plan) is FROZEN.", "- You may only recommend changes to implementation approach / task checklist / strategy.", "- Write a strategy note for the implementer, not a new plan.", "", "## Inputs", "", `OBJECTIVE: ${input.objective}`, "", "PLAN (read-only contract):", "```markdown", input.planMarkdown, "```", "", "RECENT GAPS:", gapList, "", "HISTORY NOTES:", history, "", "## Output", "", "Write a short strategy note (`strategy.md` body):", "1. Root cause in 1–3 sentences", "2. ONE structural HOW change (refactor, split, rewrite a subsystem, make behavior testable)", "3. Ordered mechanical steps the implementer can execute", "", "Do NOT emit a full plan. Do NOT modify acceptance criteria.", ].join("\n"); }