{% if not matches_intent %}
Heads up:
{% if mismatch_reason %}{{ mismatch_reason }}{% else %}The captured flow may not match the stated intent.{% endif %}
{% if closest_match_intent %}
Closest plausible alternative intent: {{ closest_match_intent }}
{% endif %}
{% endif %}
{# T13 routing: D3.a vs D3.b. The spec routes by confidence + the
existence of a closest_match_intent:
* High confidence (> 0.5) AND a closest_match_intent -> D3.b path:
the LLM is fairly sure about a single alternative, so we surface
a Confirm / Use alternative / Refine / Re-record / Generic stack
(the original T9 layout).
* Low confidence (<= 0.5) OR no closest_match_intent ->
D3.a "stuck state": the LLM can't suggest one alternative
confidently, so we render three explicit buttons (Re-record /
Help me describe differently / Continue with generic report)
per phase-2-redesign.md ยง 9.
``matches_intent=True`` always uses the simple Confirm / Refine /
Re-record / Generic stack regardless of confidence -- the user
and LLM agree, no stuck-state UX needed. #}
{% set is_stuck_state = (not matches_intent) and ((confidence is not none and confidence <= 0.5) or not closest_match_intent) %}
{% if is_stuck_state %}
{# D3.a stuck state: three explicit buttons, no confirm path. #}
{% else %}
{# D3.b / matches_intent=True: full action stack with Confirm. #}
{% if closest_match_intent and confidence is not none and confidence > 0.5 %}
{% endif %}