> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gu1.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Synergy

> Which triggers allow which actions, and which actions may follow each other—same rules as the API and Workflow Builder — in the gu1 workflow automation engine.

The product enforces **synergy** so that automations stay valid:

1. **Trigger → action:** If an action appears in **`ALLOWED_TRIGGERS_BY_ACTION`**, only those triggers may use it.
2. **Action → next action:** If an action appears in **`ALLOWED_NEXT_ACTIONS`**, only the listed actions may come **immediately after** it in the ordered sequence (steps or graph traversal).

If an action is **not** in those maps (or the map entry is missing), the default is **permissive**: any trigger and almost any next action.

<Info>
  **Source of truth:** `packages/shared/src/workflow-synergy.ts` (`ALLOWED_TRIGGERS_BY_ACTION`, `ALLOWED_NEXT_ACTIONS`). The API and UI call the same validation.
</Info>

## Rule 1 — Allowed Triggers per Action

| Action                                                                             | Allowed triggers                                                                                                                                                                                                                                                  |
| ---------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `create_investigation`                                                             | `alert_created`, `rule_triggered`                                                                                                                                                                                                                                 |
| `generate_checklist`, `assign_to`, `add_note`                                      | `alert_created`, `investigation_created`, `investigation_status_changed`, `investigation_updated`                                                                                                                                                                 |
| `start_investigation`, `change_status`, `change_priority`, `set_stage_role_access` | `investigation_created`, `investigation_status_changed`, `investigation_updated`                                                                                                                                                                                  |
| `set_entity_status`, `run_risk_matrix`                                             | `entity_created`, `create_entity_flow`, `alert_created`, `investigation_created`, `investigation_status_changed`, `investigation_updated`, `transaction_created`, `rule_triggered`, `kyc_approved`, `kyc_rejected`, `kyc_validation_finished`, `manual_execution` |
| `run_basic_enrichment`                                                             | `manual_execution`, `entity_created`, `create_entity_flow`                                                                                                                                                                                                        |
| `run_enrichment`, `run_shareholders_flow`                                          | `entity_created`, `create_entity_flow` (`run_shareholders_flow` also allows `manual_execution`)                                                                                                                                                                   |
| `create_kyc_validation`                                                            | `entity_created`, `create_entity_flow`, `alert_created`, `rule_triggered`, `kyc_approved`, `kyc_rejected`, `kyc_validation_finished`, `manual_execution`                                                                                                          |
| `request_transaction_approval`, `set_transaction_status`                           | `transaction_created`, `rule_triggered`, `manual_execution`, `scheduled`                                                                                                                                                                                          |

**Default permissive:** `send_webhook`, `send_push_notification`, `create_alert`, and any action **not listed above** accept **any** trigger.

**Notable:** `scheduled` is **not** in the allowed list for `set_entity_status`, `run_risk_matrix`, `run_enrichment`, `create_kyc_validation`, etc. Design scheduled automations that only use actions permitted for `scheduled`.

## Rule 2 — Allowed Next Action (Immediate Successor)

Only the **immediate** pair is checked. For **graphs**, the engine orders actions (e.g. BFS from the trigger) and validates the same pairs.

| Previous action                                                                                                                  | May be followed immediately by                                                                                                                                                                      |
| -------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `run_enrichment`                                                                                                                 | `run_risk_matrix`, `set_entity_status`, `create_alert`, `send_webhook`, `send_push_notification`, `create_kyc_validation`                                                                           |
| `run_basic_enrichment`                                                                                                           | `run_shareholders_flow`, `run_risk_matrix`, `set_entity_status`, `create_alert`, `send_webhook`, `send_push_notification`, `create_kyc_validation`                                                  |
| `run_shareholders_flow`                                                                                                          | `run_risk_matrix`, `set_entity_status`, `create_alert`, `send_webhook`, `send_push_notification`, `create_kyc_validation`                                                                           |
| `run_risk_matrix`                                                                                                                | `set_entity_status`, `create_alert`, `send_webhook`, `send_push_notification`, `create_kyc_validation`                                                                                              |
| `set_entity_status`                                                                                                              | `run_risk_matrix`, `create_alert`, `send_webhook`, `send_push_notification`, `create_kyc_validation`                                                                                                |
| `create_alert`                                                                                                                   | `send_webhook`, `send_push_notification`, `create_investigation`                                                                                                                                    |
| `create_kyc_validation`                                                                                                          | `set_entity_status`, `create_alert`, `send_webhook`, `send_push_notification`, `run_risk_matrix`                                                                                                    |
| `create_investigation`                                                                                                           | `assign_to`, `add_note`, `change_status`, `change_priority`, `set_stage_role_access`, `send_webhook`, `send_push_notification`, `generate_checklist`, `start_investigation`                         |
| `set_stage_role_access`                                                                                                          | `assign_to`, `assign_load_balanced`, `add_note`, `change_status`, `change_priority`, `start_investigation`, `set_stage_role_access`, `send_webhook`, `send_push_notification`, `generate_checklist` |
| `start_investigation`, `change_status`, `change_priority`, `assign_to`, `assign_load_balanced`, `add_note`, `generate_checklist` | `assign_to`, `assign_load_balanced`, `add_note`, `change_status`, `change_priority`, `set_stage_role_access`, `send_webhook`, `send_push_notification`, `generate_checklist`                        |
| `request_transaction_approval`                                                                                                   | `set_transaction_status`, `send_webhook`, `send_push_notification`                                                                                                                                  |
| `set_transaction_status`                                                                                                         | `request_transaction_approval`, `send_webhook`, `send_push_notification`                                                                                                                            |

**Default permissive:** If an action is **not** in this table, **any** action may follow.

## Typical Chains (Examples)

* **Onboarding:** `run_enrichment` → `run_risk_matrix` → `set_entity_status` → `create_alert` / `create_kyc_validation`.
* **Alert triage:** `create_investigation` → `assign_to` → `change_status` → `send_webhook`.
* **Payments:** `request_transaction_approval` → `set_transaction_status` → `send_webhook`.

Errors on save usually mean **trigger ↔ action** or **action → next action** failed validation.

***

**Maintenance:** When changing synergy in code, update `workflow-synergy.ts` first, then this page.
