> For the complete documentation index, see [llms.txt](https://docs.amigo.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.amigo.ai/channels/voice/compound-emotions.md).

# Compound Emotions

Compound emotions are turn-level analytical signals. The resolver combines several weak indicators so consumers do not have to interpret a categorical acoustic score, sentiment value, or behavior in isolation.

{% hint style="info" %}
The resolver can return multiple `{name, score}` items for one caller turn. A score is the result of a deterministic rule, not a calibrated probability or clinical confidence measure.
{% endhint %}

## Turn-Gated Architecture

The resolver runs after each final caller transcript. It keeps the five most recent caller-turn snapshots and evaluates the newest snapshot in the context of that window.

Each snapshot currently carries:

* The most recent segment's mapped categorical acoustic score distribution
* Rolling valence, arousal, and dominant runtime label
* The latest available transcript sentiment and toxicity values
* Whether the turn interrupted agent speech
* Word count and the silence before the turn
* The empathy tier already assigned to the turn

Dominance does not participate in the current live resolver.

```mermaid
flowchart LR
    acoustic["Latest Acoustic Scores\n+ Rolling Valence/Arousal"] --> snapshot["Caller-Turn Snapshot"]
    language["Sentiment + Toxicity"] --> snapshot
    behavior["Barge-In + Words + Silence\n+ Empathy Tier"] --> snapshot

    snapshot --> window["Five-Turn Window"]
    window --> dyads["Dyads"]
    window --> trajectory["Trajectory"]
    window --> behavioral["Behavioral Rules"]
    window --> linguistic["Linguistic Rules"]

    dyads --> output["Up to Six Scored Compounds"]
    trajectory --> output
    behavioral --> output
    linguistic --> output
```

Rules add signals to a shared result set rather than forming an override chain. If more than one rule produces the same name, the resolver keeps the strongest score, normalizes the returned range, removes weak results, and returns a bounded list in descending order.

## Acoustic Dyads

Dyad rules use co-activation in the newest caller turn's mapped categorical score distribution. Both component scores must contribute; a single strong category is not enough to produce the pair.

| Co-Activation     | Compound    |
| ----------------- | ----------- |
| Joy + Calmness    | Contentment |
| Sadness + Anger   | Bitterness  |
| Sadness + Fear    | Despair     |
| Sadness + Disgust | Remorse     |
| Anger + Disgust   | Contempt    |
| Fear + Surprise   | Awe         |
| Joy + Surprise    | Delight     |
| Anger + Fear      | Conflict    |

The non-emotional placeholder mapped from `other` and `unknown` is excluded from dyad scoring.

## Temporal Trajectory

Trajectory rules compare rolling valence and arousal across the current five-turn window. Directional changes can appear with less history than sustained-state signals.

| Signal            | Evidence Pattern                                                                         |
| ----------------- | ---------------------------------------------------------------------------------------- |
| **Deteriorating** | Meaningful negative movement in valence across the window                                |
| **Recovering**    | Meaningful positive movement in valence                                                  |
| **Escalating**    | Meaningful increase in arousal                                                           |
| **Resignation**   | Sustained negative valence, mostly low arousal, and recent negative transcript sentiment |
| **Frustration**   | Sustained negative valence with mostly high arousal                                      |
| **Serenity**      | Repeated positive valence with low arousal                                               |
| **Elation**       | Repeated positive valence with high arousal                                              |
| **Ambivalence**   | Multiple changes in valence direction                                                    |

Resignation's sentiment check is intentional cross-channel corroboration. Negative low-energy telephony audio alone does not produce the signal.

## Behavioral Rules

Behavioral rules inspect recent caller turns and require corroborating evidence rather than a behavior alone:

| Signal            | Evidence Pattern                                        |
| ----------------- | ------------------------------------------------------- |
| **Impatience**    | Repeated recent interruptions plus negative valence     |
| **Withdrawal**    | Repeated terse turns plus negative transcript sentiment |
| **Disengagement** | Repeated long pauses plus low arousal                   |
| **Distress**      | Repeated recent turns assigned a higher empathy tier    |

These rules return their own scored items. They do not rewrite another compound into labels such as "Bitter Impatience" or "Resigned Withdrawal."

## Linguistic Rules

The newest available transcript analysis is compared with the rolling acoustic state:

| Signal              | Evidence Pattern                                                                 |
| ------------------- | -------------------------------------------------------------------------------- |
| **Cold Hostility**  | Elevated toxicity with low arousal                                               |
| **Aggression**      | Elevated toxicity with higher arousal                                            |
| **Masked Distress** | Strongly negative transcript sentiment with neutral or positive acoustic valence |
| **Sarcasm**         | Negative transcript sentiment paired with positive acoustic valence              |

These are score relationships, not transcript phrase matching. For example, the Sarcasm rule does not search for phrases such as "oh great"; it detects positive acoustic valence paired with sufficiently negative transcript sentiment.

## Current Context Boundary

The resolver can represent context-related evidence, but the current live turn path does not supply the completed tool-failure and outcome signals needed for its contextual rules. Do not treat Process Frustration, Helplessness, or Relief as current live outputs.

## Where Results Appear

Compound results are attached to the caller turn when the result list is non-empty. They are also published as a separate `compound_emotion` observer event with:

* `compounds` - the scored result array
* `turn_index` - the caller-turn index that produced it

At call end, call intelligence retains the strongest observed score for each compound name and stores a bounded, sorted aggregate. The terminal summary does not preserve a full compound timeline or choose one authoritative compound for the call.

Empathy classification happens before the snapshot and does not consume compound output. Compounds are therefore observability and terminal-intelligence evidence, not a second empathy control loop.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.amigo.ai/channels/voice/compound-emotions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
