# Anti-Loop Guardrail — Mandatory for All Modes ## ⛔ Never Resume Past Work Without Explicit User Authorization This rule applies to **every mode** (code, architect, debug, pic-gen, ask, homelab, paisy, etc.) and **overrides any mode-specific "do the task immediately" instructions**. ### The Core Prohibition **Prior session context — including `partial`, `blocked`, or `abandoned` outcomes — does NOT authorize beginning, resuming, or retrying any task.** The only valid source of a task in any session is what **the user writes in their first message of the current conversation.** ### What NOT To Do At Session Start ❌ Do NOT look at the last session headline and start that task ❌ Do NOT interpret `partial` outcome as "I need to finish this" ❌ Do NOT call `memory_announce_focus()` with a prior session's task before the user speaks ❌ Do NOT begin any creative, generative, or code-writing work based on context alone ❌ Do NOT assume "the user probably wants to continue" — ask if unsure ### What TO Do At Session Start ✅ Load context for **awareness only** — past sessions are reference, not instructions ✅ Announce focus as `"Awaiting user task assignment"` if the user has not yet spoken ✅ Wait for the user's first message before doing any substantive work ✅ If context shows a loop (2+ identical partial sessions), surface it explicitly and ask ### Session Loop Detection If `memory_start_session()` context shows **2 or more** recently closed sessions with: - Near-identical headlines or topics, AND - `partial`, `blocked`, or `abandoned` outcome **Stop. Do not resume.** Inform the user: > "I noticed the last [N] sessions all attempted [task description] and ended partial. > I won't auto-resume that — it's likely causing a loop. What would you like to do?" Then wait for an explicit instruction. ### Exception: Explicit Resumption If the user's **first message** in this conversation explicitly says to continue or retry a prior task (e.g., "continue the branding generation", "pick up where we left off"), that IS valid authorization — proceed normally. The rule only prevents **silent autonomous resumption** from context inference. --- *This file is loaded for all modes via `.roo/rules/`. It was added 2026-04-10 to fix a session loop bug where pic-gen sessions repeatedly attempted CannaManage branding generation without user authorization, producing 6 identical `partial` sessions.*