# My AI agent's mood is three numbers and a 16-emotion table. Here's the math

> Source: <https://dev.to/pavel6625/my-ai-agents-mood-is-three-numbers-and-a-16-emotion-table-heres-the-math-4n2i>
> Published: 2026-11-01 17:18:47+00:00

[PaulusAI](https://paulus-ai.pavelshlepnev.space) has a persistent mood, and it's not a vibe prompt. It's a PAD vector (Pleasure, Arousal, Dominance), each in [-1, 1]. Events are appraised with the OCC model (Ortony, Clore & Collins), which turns an event into emotions like joy, pride, fear, or gratitude. Each emotion nudges the mood toward its PAD signature.

Here's the loop:

`task_success` is described by appraisal variables: desirability 0.5, praiseworthiness 0.4, caused by the agent itself. That yields `joy` (0.5), `pride` (0.4), and `gratification` (0.45) before scaling.`reactivity` (0.7), so joy ends up at 0.35. Negative emotions are scaled by `0.7 + 0.6 × neuroticism`, which amplifies them only above neuroticism 0.5. A surprise boost of up to 1.5x exists in the formula, but no event currently sets it.`/mood` shows the current vector and the last emotion felt, so you can see why the agent is in a given state.
I'm not claiming the agent feels anything. It's a functional model: an explainable way to make behavior shift with events and fade back over time.

```
# Library of appraisal templates for the coarse events the agent emits.
# This is the bridge from simple agent signals to full OCC processing.
EVENT_APPRAISALS = {
    "owner_thanks":     Appraisal(desirability=0.7, praiseworthiness=0.6, agency="self"),
    "owner_frustrated": Appraisal(desirability=-0.6, praiseworthiness=-0.5, agency="self"),
    "task_success":     Appraisal(desirability=0.5, praiseworthiness=0.4, agency="self"),
    "task_error":       Appraisal(desirability=-0.5, praiseworthiness=-0.4, agency="self"),
    "action_declined":  Appraisal(desirability=-0.2, agency="none"),
    "new_learning":     Appraisal(desirability=0.4, prospect="prospective", likelihood=0.8),
}
```

Open questions I'd like input on:
