Dev.to · 3 min read

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

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

PaulusAI 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: Appraise. An event like 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. Scale. Intensities are multiplied by 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. Fold in. Each emotion adds its PAD signature to the mood, scaled by 0.5. For a task success, pleasure rises by roughly +0.2. Decay. Each turn, mood moves 15% of the way back toward a personality baseline, here about +0.04 pleasure. Every mood reading can be traced to the appraisal that caused 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: Should mood change behavior, or only tone? Right now the mood vector shapes how the agent sounds. Should it also affect decisions, such as how much it asks before acting, how cautious it is with tools, or which memories it recalls first? What should count as surprising? The code has an unexpectedness input that can boost intensity by up to 1.5x, but no event sets it yet. How would you detect surprise: prediction error, a novel tool result, or an owner reaction that differs from the usual? If any of this interests you, open an issue with your idea or a question. The mood code is small enough to start with. Repo: https://github.com/Pavel6625/PaulusAI

This is a summary aggregated from Dev.to. Read the complete article on the original site:

Read full article at Dev.to

More AI & Machine Learning News