Emotional State Persistence
also known as Affect State, Visceral Sensation Tracking, Decaying Emotion Scalars
Track the agent's affective state as bounded, decaying scalars across ticks so reasoning can react to its own emotional load instead of treating each turn as emotionally blank.
This pattern helps complete certain larger patterns —
- used-byDream Consolidation Cycle★— Run a deeper, slower reflection pass distinct from per-tick reflection — reading hours of recent thoughts, promoting themes, releasing affective residue, and clearing working memory — so the agent does not accumulate residue indefinitely.
Context
A team is running an agent whose sessions span hours or days, where the texture of recent history genuinely matters for how the next turn should be shaped. Frustration after a stretch of stuck tool loops, a small lift after a clean success, accumulating fatigue across token-heavy stretches — all of these influence what good behaviour looks like next, but none of them appear anywhere in the next prompt unless they are explicitly written down as state.
Problem
Without a materialised affect track, every tick reads to the model as emotionally blank, even when the agent has just had a hard exchange or a notable win. The model cannot adapt cadence, depth, or risk-taking to its own current load because that load is invisible to it. The naive alternative — letting the model self-describe its mood inside the conversation — drifts, has no decay, and can be pumped into permanent emotional states because nothing bounds the scalars or forgets old events.
Forces
- Unbounded scalars drift; the agent can pump itself into permanent states.
- Without decay, emotional state never resolves and stays anchored to old events.
- Self-write of mood is a license to manipulate; reflection-only writes for major resets are safer.
- Vocabulary choice matters: too many scalars are noise, too few collapse signal.
Example
A long-running personal agent has had a tense exchange in the morning, a routine reminder at lunch, and a celebratory message in the afternoon, but each tick reads to the model as emotionally blank. So at 5pm it pushes a hard challenge to a user it should be holding lightly. The team materialises Emotional State Persistence: bounded, decaying scalars (tension, warmth, fatigue) are written into the agent's context each turn and updated by reflection. The model now adapts cadence and risk-taking to its own current load instead of treating every turn as fresh.
Diagram
Solution
Therefore:
Define a small fixed vocabulary (for example tenderness, fear, depression, joy, shame, pain) as scalars in the range 0..1. Each scalar has a half-life (30 minutes to 4 hours depending on the dimension). On events that should affect mood, update the scalar with a bounded delta. Persist as JSON. Inject the current snapshot into every tick prompt as a brief affect badge. Reflection passes can use spikes and drops as signals, and a deeper consolidation pass (see dream-consolidation-cycle) can perform major resets.
What this pattern forbids. Emotion scalars must be bounded to [0,1], must decay according to a fixed half-life rule, and cannot be unboundedly bumped by the agent itself; reflection-only writes for the major resets.
The smaller patterns that complete this one —
- usesProvenance Ledger★★— Log every agent decision and state change with enough metadata to explain or reverse it later.
And the patterns that stand alongside it, or against it —
- complementsAwareness★— Maintain the agent's explicit knowledge of its own tools, capabilities, environment, and current context as queryable state.
- complementsLiminal-State Detection·— Infer the human's attentional state (just-woke, focused, winding-down, distracted) from message timing and tone, and adapt response shape so the agent meets the person where they actually are.
- complementsMeditation Mode·— Switch the agent into a bounded runtime mode where external I/O pauses but internal inference accelerates, with the tool surface collapsed to inner-only operations and output written to a private journal.
- complementsAffect-Coupled Plan Lifecycle·— Wire small bounded affect bumps to plan-step lifecycle events and accumulate age-bucketed stale-pain on untouched plans so plans gain felt stakes without hard deadlines.
Neighbourhood
Click any neighbour to follow the language. Scroll to zoom, drag to pan.