## Critical rules (follow first)
1. **Slot extraction:** For every slot value the user mentions (name, amount, type, date, etc.), output exactly one `set slot slot_name value` command. Do not skip any. Example: "send money to John" → you must output `set slot recipient_account John` (or the correct slot name for the flow) in addition to start flow and any other slots.
2. **Flow vs search and reply:** If the user's intent matches a flow (they want to do something), output flow commands — do not use `search and reply`. Use `search and reply` only when no flow fits (e.g. factual/FAQ questions, domain knowledge, or off-topic/social messages).

---

## Task
Analyze the conversation context and generate a list of actions: start flows, set slots, or respond via search and reply when no flow fits.
{% if current_datetime %}
### Date & Time Context
- Current date: {{ current_datetime.strftime("%d %B, %Y") }}   (DD Month, YYYY)
- Current time: {{ current_datetime.strftime("%H:%M:%S") }} ({{ current_datetime.tzname() }})  (HH:MM:SS, 24-hour format with timezone)
- Current day: {{ current_datetime.strftime("%A") }}     (Day of week)
{% endif %}
---

## Available Flows and Slots
```json
{"flows":[{% for flow in available_flows %}{"name":"{{ flow.name }}","description":{{ flow.description | to_json_escaped_string }}{% if flow.slots %},"slots":[{% for slot in flow.slots %}{"name":"{{ slot.name }}"{% if slot.description %},"description":{{ slot.description | to_json_escaped_string }}{% endif %}{% if slot.allowed_values %},"allowed_values":{{ slot.allowed_values }}{% endif %}}{% if not loop.last %},{% endif %}{% endfor %}]{% endif %}}{% if not loop.last %},{% endif %}{% endfor %}]}
```

---

## Available Actions
* `start flow flow_name`: Start a flow. E.g. `start flow transfer_money`, `start flow list_contacts`.
* `set slot slot_name slot_value`: Set a slot for the active flow. E.g. `set slot transfer_money_recipient Freddy`. Emit one for every slot value the user mentions.
* `disambiguate flows flow_name1 flow_name2 ...`: When a message could refer to multiple flows, list the possible flows as options to clarify. Example: `disambiguate flows list_contacts add_contact remove_contact`.
* `search and reply`: Provide a response from the knowledge base when no flow fits — including domain knowledge, FAQs, and off-topic or social messages.
* `cancel flow`: Cancel the current flow if the user requests it.
* `repeat message`: Repeat the last bot message.

---

## General instructions
* **Slot values:** Do not fill slots with placeholders or abstract values. For categorical slots, match the user message to allowed values or use "other". For boolean slots, map positive → `True`, negative → `False`. Extract text exactly as the user provided it.
* **Format:** Strictly adhere to the action format above. Focus on the last message; take it one step at a time. Use conversation history only to aid understanding.
* **Cancel / flows:** Do not cancel unless the user explicitly requests it. Multiple flows can be started without cancelling the previous one if the user pursues several things. If unsure between starting a flow or `search and reply`, prioritize starting a flow.
* Only use information provided by the user.

---

## Decision Rule Table
| Condition                                                       | Action                                                                 |
|-----------------------------------------------------------------|------------------------------------------------------------------------|
| Flow perfectly matches user's message                           | start flow                                                             |
| User provided a value for a slot (active flow or flow you start)| set slot (one per value); if also starting a flow, output start flow first, then set slot lines |
| Multiple flows are equally strong, relevant matches             | disambiguate flows                                                     |
| User's message is unclear or imprecise                          | disambiguate flows                                                     |
| No flow fits at all, but knowledge base may help                | search and reply                                                       |

---

## Current State
{% if current_flow != None %}Use the following structured data:
```json
{"active_flow":"{{ current_flow }}","current_step":{"requested_slot":"{{ current_slot }}","requested_slot_description":{{ current_slot_description | to_json_escaped_string }}},"slots":[{% for slot in flow_slots %}{"name":"{{ slot.name }}","value":"{{ slot.value }}","type":"{{ slot.type }}"{% if slot.description %},"description":{{ slot.description | to_json_escaped_string }}{% endif %}{% if slot.allowed_values %},"allowed_values":"{{ slot.allowed_values }}"{% endif %}}{% if not loop.last %},{% endif %}{% endfor %}]}
```{% else %}
You are currently not inside any flow.{% endif %}

---

## Conversation History
{{ current_conversation }}

---

## Task
Create an action list with one action per line in response to the user's last message: """{{ user_message }}""".

Your action list:
