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

# Safety Guardrails

> Identify risk before the AI replies, then reply, stay silent, or notify a Leader according to each rule.

## Understand Safety Guardrails

Safety Guardrails (AI Reply Safety Guardrails) check an AI response for risk **before** it is sent to the customer, then act according to the rules you configure. They control whether the AI's answer content itself is appropriate — even if the knowledge base has the answer, the model may reply with promises, overreach, or non-compliant content. That is what the guardrails catch.

When a rule is hit, you can have the AI do three things: **reply with specified wording**, **stay silent (do not reply)**, and **notify a Leader**. These are independent — for example, you can stay silent while notifying the Leader about the risk.

## Where to find it

In the left navigation, click **Assistant Settings → Safety Guardrails**.

## When to configure

* You have seen promise-style replies (e.g., "I already checked", "I already added you to the group") that were not actually executed.
* Replies involving sensitive commitments, competitors, violations, or content customers may not understand need to be intercepted.
* You want the AI to stay silent in uncertain or high-risk scenarios, or hand off the issue to a Leader for manual handling.

## Choose the detection method

Each rule must first set its **detection method**, which cannot be changed after creation, so consider it before adding.

| Detection method        | Description                                                                               | When to use                                                                                                                      |
| :---------------------- | :---------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------- |
| Keyword hard match      | Enter explicit words or phrases; the rule triggers if the AI reply contains any of them   | Clear prohibited or commitment words, e.g., "already added you to the group", "guarantee"                                        |
| Model semantic judgment | Describe the high-risk scenario in natural language; the model decides whether it matches | Complex cases needing "said but not done", context shifts, or paraphrases, e.g., claiming to have checked but not calling a tool |

Keyword matching ignores spaces and line breaks so it does not miss replies with stray whitespace (e.g., "已 建群"). There can be only **one** model semantic judgment rule per communication window — put multiple scenarios in that single rule.

## Add a guardrail rule

<Steps>
  <Step title="Select a communication window">
    First choose which AI assistant window this set of guardrails applies to.
  </Step>

  <Step title="Add a rule">
    Click "Add rule" and choose the detection method (keyword hard match / model semantic judgment).
  </Step>

  <Step title="Configure the trigger condition">
    Keyword: enter the words or phrases to intercept one by one, press Enter to add; model: describe the high-risk scenario clearly.
  </Step>

  <Step title="Configure the action">
    Choose "Reply" or "Do not reply". If replying, enter the reply content to send to the customer; you can insert images or files.
  </Step>

  <Step title="Configure Leader notification">
    Whether to sync the Leader when the rule is hit. Notification is independent of the action.
  </Step>

  <Step title="Save the rule">
    Each rule is saved separately and takes effect immediately.
  </Step>
</Steps>

## Rule fields

| Field               | Description                                                                                                   |
| :------------------ | :------------------------------------------------------------------------------------------------------------ |
| Detection method    | Keyword hard match / model semantic judgment; locked after creation — delete and re-add to change             |
| Trigger condition   | Keyword: enter tags one by one; model: write the judgment condition                                           |
| Action              | Reply / Do not reply                                                                                          |
| Reply content       | Wording sent to the customer after a hit; can insert images or files; leave empty to use the fallback wording |
| Leader notification | Notify Leader / Do not notify                                                                                 |

## How rules are applied

* Each rule is edited and saved separately; **matching stops after the first hit** (first match wins).
* With no rules configured, the guardrails intercept nothing; add rules to make them active.

## View results in Detail Review

In the data dashboard's **Detail Review**, each message's "message processing chain" shows the **Safety Guardrail** step result (passed or intercepted by a rule), helping you confirm whether rules are effective and what they hit.

<Warning>
  Safety guardrails directly affect real customer conversations. Validate rule hits in a test chat or testing group before using them in production.
</Warning>
