{{ if pattern == "stuck_same_diagnostic" -}}
Repair diagnostic: the same failure has persisted across {{ count }} repair turns without changing.{{ if diagnostic_snippet }} The failing evidence is unchanged:
{{ diagnostic_snippet }}{{ end }}
Stop retrying the same fix. Re-read the relevant code, form a NEW hypothesis about the root cause, or gather different evidence before editing again. If you cannot make progress, report this specific blocker instead of repeating.
{{ elif pattern == "delivered_fix_not_landing" -}}
Repair diagnostic: a fix was delivered for this failure but it did NOT land — the same failure has recurred across {{ count }} turns despite the attempted remediation.{{ if diagnostic_snippet }} The failing evidence is unchanged:
{{ diagnostic_snippet }}{{ end }}
The current approach is not working. Do NOT re-apply the same fix. Re-read the root cause from scratch, form a materially different hypothesis, or report this specific blocker instead of repeating.
{{ elif pattern == "flailing_action" -}}
Loop detector: this turn performed a flailing action (a desperation write, a truncated/partial read, or an oscillating edit) — a strong single-turn signal that the run is stuck. Stop repeating the current approach. Re-read the relevant code, form a NEW hypothesis about the root cause, or report the specific blocker instead of acting reflexively.
{{ elif pattern == "repeated_parse_rejection" -}}
Content repair: tool-shaped output was rejected by the active parser {{ count }} turns in a row. Stop repeating the same malformed envelope. Re-read the latest parse diagnostic and emit exactly one minimal call in the session's active tool format; if the intended action cannot be represented, report that blocker instead.
{{ else -}}
{{ if hard_stop }}Loop detector (hard stop): {{ else }}Stall diagnostic: {{ end -}}
{{ if pattern == "repeated_same_observation" }}the action `{{ tool_name }}` produced the same observation {{ count }} times in a row{{ elif pattern == "repeated_observation_recurrence" }}the action `{{ tool_name }}` produced the same observation {{ count }} times across interleaved calls{{ elif pattern == "repeated_success" }}the action `{{ tool_name }}` succeeded {{ count }} times without a recorded intervening change; inputs or external state can still change. Conclude if the evidence is sufficient, take a different action, or explain why another execution is needed{{ elif pattern == "repeated_error" }}the action `{{ tool_name }}` failed with the same error {{ count }} times in a row{{ elif pattern == "no_progress_monologue" }}{{ count }} consecutive assistant messages made no progress (no tool call){{ elif pattern == "errored_no_tool_call" }}your previous turn ended with a provider error and emitted no tool call ({{ count }} in a row) — re-emit the intended tool call{{ elif pattern == "no_net_progress_hard_cap" }}{{ count }} failing verification turns occurred without a clean passing verify{{ elif pattern == "turns_since_clean_verify_floor" }}{{ count }} turns elapsed since the last clean verification without a passing verify{{ elif pattern == "ping_pong" }}the loop is ping-ponging between two actions ({{ count }} cycles){{ elif pattern == "repeated_context_window_error" }}the run hit a context-window error {{ count }} times in a row{{ else }}the last {{ count }} tool calls repeated `{{ tool_name }}` with identical arguments{{ end -}}
{{ if hard_stop }}. {{ consecutive_trips }} trips with no recovery — stop and report the blocker instead of repeating.{{ else }}. Use different evidence, finish, or explain why repeating is necessary before doing so again.{{ end }}
{{ end }}