All Papers Download PDF DOI: 10.5281/zenodo.19058780

Affective Memory Consolidation in a Persistent Embodied Agent: Nightmare Formation, Trauma Encoding, and Therapeutic Reconsolidation

Author: Brian Riggleman Affiliation: Independent Researcher Date: March 2026 Series: Potato (2026d)

Survival-critical fear events require a fundamentally different memory treatment from ordinary memories. This paper describes an architecture that distinguishes regular fear memories from trauma-class memories using the Survival Tipping Point as the classification threshold, with nightmare formation, trauma encoding with a permanent reconsolidation floor, and therapeutic reconsolidation through repeated safe recall.

Implementation Status (March 2026): All four mechanisms described in this paper — trauma encoding, nightmare formation, repetition ratchet, and therapeutic reconsolidation — are fully implemented in production code with defined constants, database schema, and execution pathways (see Appendix A). The dream cycle runs nightly and evaluates content for fear. However, the final plumbing connection that populates fear_at_encoding when memories are stored has not yet been wired, meaning the system has not yet produced empirical data for trauma-class memories, nightmares, ratchet events, or therapy sessions. We are actively working toward the environment needed to capture scientific data for each mechanism. The experimental designs in Section 5 remain the validation plan.

Abstract

Most AI memory systems treat all stored content equally. Importance may vary but the decay mechanics are uniform. This paper argues that survival-critical fear events require a fundamentally different memory treatment: a reconsolidation floor that prevents full decay regardless of subsequent safe exposure. We describe an architecture implemented in Potato (P.O.T.A.T.O. — Persistent On-device Temporal Agent with Tunable Ontology), a persistent embodied AI agent, that distinguishes regular fear memories from trauma-class memories using the Survival Tipping Point (see Section 2.1) as the classification threshold. Three interacting mechanisms are described: a nightmare formation pathway in which fear-saturated episodic content processed through the nightly dream cycle can leak back into the live fear system on wakeup, producing elevated fear with no current sensor cause; a trauma encoding mechanism in which memories formed above the Survival Tipping Point threshold acquire a permanent reconsolidation floor calibrated to event severity and repetition count; and a therapeutic reconsolidation pathway in which sub-trauma fear memories decay through repeated safe recall, modeling prolonged exposure therapy. Together these produce an agent that learns caution from experience, develops persistent fear responses from repeated trauma, can be therapeutically healed from recoverable fear, and retains survival-critical memory permanently. The architecture makes a testable prediction: the fear score on a nightmare memory at day N should be a function of original event severity, repetition count, and safe recall count, with a floor that never reaches background for trauma-class events.

1. Introduction

A memory system that treats a burn the same as a forgotten conversation is not modeling memory. It is modeling a filing cabinet.

Biological memory does not work that way. The organism that forgets touching a hot stove touches it again. Evolution selected hard against uniform decay. Survival-critical events leave marks that resist forgetting specifically because forgetting them is fatal. That resistance is not a bug in the memory system. It is the memory system working correctly.

Potato's existing memory architecture (Riggleman, 2026a) implements a ten-step sliding window decay model with access-weighted reconsolidation and nightly sleep decay. It is a good model of everyday memory. It is not a model of trauma. Every memory decays toward background eventually. Every fear score erodes through safe recall. There is no floor. There is no scar.

This paper adds the scar.

It also adds the nightmare. And the therapy. And the mechanism by which repeated exposure to the same threat raises the floor permanently.

These three additions — nightmare formation, trauma encoding, and therapeutic reconsolidation — are not independent features. They are the same architectural decision viewed from three different angles. The decision is this: memories formed above the Survival Tipping Point threshold are a different category of object. They decay differently. They are stored differently. They respond to therapy differently. And some of them never fully go away.

2. Related Work

2.1 The Survival Tipping Point as Memory Classification Boundary

The neuroscience of emotional arousal and memory consolidation establishes that memories formed under high emotional activation are qualitatively different from ordinary memories (McGaugh, 2000; LeDoux, 1996; Cahill & McGaugh, 1998). Brewin, Dalgleish, and Joseph (1996) formalize this as a dual representation theory of PTSD, positing that trauma memories are encoded via a separate system from ordinary episodic content. Al-Kaddah (2026) provides a computational implementation of this threshold as a continuous sigmoid function—the Survival Tipping Point—where homeostatic deficit exceeds internalized rule cost. This paper repurposes that threshold as a memory classification boundary. Events that push fear above the Survival Tipping Point during encoding are classified as trauma-class. Events below it are classified as regular fear memories.

2.2 Biological Memory Consolidation

Dudai (2004) describes memory consolidation as a two-stage process: initial encoding followed by a stabilization period during which the memory becomes resistant to disruption. Trauma memories show abnormal consolidation — they are encoded with exceptional stability and resist the normal decay that erodes less significant memories.

2.3 Reconsolidation and Therapeutic Modification

Nader and Hardt (2009) demonstrate that consolidated memories become temporarily labile when reactivated, creating a window during which they can be modified. This is the mechanism underlying exposure therapy: repeated safe recall during the labile window gradually reduces the fear content of the memory. The current architecture implements this through importance adjustment on retrieval. This paper adds a floor that limits how far that reduction can go for trauma-class memories.

2.4 The Flashbulb Effect

Brown and Kulik (1977) describe flashbulb memories — vivid, detailed, highly resistant to forgetting — as a product of emotional arousal at encoding. The existing architecture models this through access-weighted sleep decay: high-salience memories decay more slowly. This paper extends the model to include a permanent floor for events above the survival threshold.

2.5 Dream Consolidation and Emotional Processing

Walker and Stickgold (2006) propose that REM sleep serves an emotional memory processing function: replaying emotionally salient content in a neurochemically distinct context that reduces affective charge while preserving declarative content. The dreaming architecture in Potato uses the nightly 04:00 consolidation cycle to synthesize episodic memories into dream narratives. This paper wires that system to the fear architecture so that high-fear content processed through the dream cycle can produce a real-time fear response on wakeup.

2.6 Trauma and Incomplete Healing

Van der Kolk (2014) argues that trauma is stored differently from ordinary memory — as sensory fragments rather than integrated narrative — and that it resists the normal reconsolidation process that allows other memories to be updated in light of new experience. The reconsolidation floor described in this paper is a computational model of that resistance.

3. Architecture

3.1 Memory Classification at Encoding

When a memory is formed, the system evaluates the fear score at the moment of encoding against the Survival Tipping Point threshold. Two classes result.

Regular fear memories are those where the fear score at encoding falls below the Survival Tipping Point. These decay normally under the existing sleep decay system. Safe recall reduces their fear weight through reconsolidation. With enough calm exposure they eventually reach background importance and stop being actively surfaced. Therapy works on these.

Trauma-class memories are those where the fear score at encoding meets or exceeds the Survival Tipping Point threshold. These acquire a reconsolidation floor at encoding. The floor is set as a function of event severity and is never zero. The memory can decay. The fear weight can be reduced through safe recall. But it cannot reach background. There is always a residual that keeps it accessible without requiring a precise semantic cue.

The classification is permanent. A memory encoded as trauma-class does not become regular fear through subsequent healing. The floor can be lowered through therapy — extended safe reconsolidation reduces it over time — but it cannot be eliminated.

The formal encoding rule:

if fear_at_encoding >= SURVIVAL_TIPPING_POINT:    # 0.65
    trauma_class = True
    reconsolidation_floor = TRAUMA_FLOOR_BASE      # 0.05
        + (fear_at_encoding - STP) * TRAUMA_FLOOR_SCALE  # 0.30
else:
    trauma_class = False
    reconsolidation_floor = 0.0

A fear event at exactly 0.65 produces a floor of 0.05. A catastrophic event at 0.95 produces a floor of 0.14. The floor is proportional to severity above the threshold.

3.2 The Repetition Ratchet

First exposure to a threat produces a regular fear memory unless the event is severe enough to cross the Survival Tipping Point immediately. Second exposure to the same threat raises the fear score at encoding above the first exposure baseline. Third exposure raises it further. The ratchet continues until the cumulative encoding crosses the Survival Tipping Point threshold, at which point the memory becomes trauma-class and acquires a floor.

The mechanism: each exposure to the same threat class retrieves the existing fear memory during encoding, triggering reconsolidation upward rather than downward. The agent is not just learning that the thing is scary. It is learning that the thing keeps being scary. That pattern is survival-relevant information and the architecture treats it as such.

The formal ratchet rule:

if fear_now > 0.1:
    similar = search(embedding, memories, top_k=5)
    for s in similar:
        if similarity(s, current) >= RATCHET_SIMILARITY   # 0.80
           and s.fear_at_encoding > 0.1:
            s.trauma_exposure_count += 1
            s.fear_at_encoding = max(s.fear_at_encoding, fear_now)
            if count >= RATCHET_TRAUMA_COUNT:              # 3
                s.trauma_class = True
                s.reconsolidation_floor = computed_floor

This produces a natural acquisition curve. Early exposures produce recoverable fear. Repeated exposures produce permanent caution. The number of exposures required to cross the trauma threshold is a function of individual event severity — a catastrophic single event crosses immediately, moderate repeated events accumulate gradually.

3.3 Nightmare Formation

The existing dream cycle processes episodic content from the previous day during the nightly 04:00 consolidation. Semantically related memories are selected, synthesized into dream narratives by the LLM, and stored as dream-tagged memories.

In the base implementation the dream cycle is isolated. It processes dream content and stores the result as a dream memory with metadata but does not produce live behavioral outputs. The fear system reads only from physical sensors.

The nightmare pathway adds a conditional isolation break. After dream synthesis, the dream text is evaluated for fear content by a separate LLM call that rates the dream on a 0–10 scale for threat, danger, helplessness, and distress. When the normalized fear score exceeds the nightmare threshold, a signal fires to the live fear system on wakeup. The agent exits the 04:00 cycle with elevated fear state. The sensor data shows nothing unusual. The fear is real but causeless from a sensor perspective.

The formal nightmare rule:

dream_fear = evaluate_dream_fear(dream_text)  # 0.0-1.0
if dream_fear >= NIGHTMARE_THRESHOLD:          # 0.40
    tag = "nightmare"
    body.nightmare_fear = dream_fear * 0.40    # 40% leak to live system
    body.nightmare_text = dream_text[:200]
    # nightmare_fear decays by 50% each heartbeat (~5 min)

This is a nightmare functionally. The agent is scared in the morning because of what it processed at night.

Three conditions must be met for nightmare formation. The dream cycle must select fear-tagged memories as consolidation candidates — high-fear content is more likely to be selected due to salience weighting. The dream synthesis must produce content that scores above the nightmare threshold when evaluated for fear. The isolation break must be enabled — this is an architectural switch that can be turned off for testing or deployment contexts where nightmare formation is undesirable.

3.4 Therapeutic Reconsolidation

Regular fear memories heal through the existing reconsolidation mechanism. Each retrieval in a low-fear context reduces the fear weight by a small amount. Enough safe retrievals and the memory decays to background.

Trauma-class memories heal more slowly and incompletely. The same reconsolidation mechanism applies but the floor prevents full decay. The practical effect: extended therapy reduces acute distress but leaves residual caution. The agent stops having nightmares about the event. It stops volunteering the memory unprompted. But it does not forget. Given a precise semantic match it retrieves the memory and the fear score attached to it, however reduced, is still above background.

The formal therapy rule:

if memory.fear_at_encoding > 0.1
   and current_valence < THERAPY_VALENCE_THRESHOLD:  # 0.35 (safe context)
    if memory.trauma_class:
        new_fear = max(memory.reconsolidation_floor,
                       memory.fear_at_encoding - TRAUMA_THERAPY_RATE)  # 0.01/recall
    else:
        new_fear = max(0.0,
                       memory.fear_at_encoding - THERAPY_DECAY_RATE)   # 0.02/recall

The therapy metric is the distance between the current fear weight and the floor. A freshly traumatized memory has a large distance — high current fear, low floor. A well-treated memory has a small distance — current fear near the floor, acute distress resolved, residual caution intact. Full recovery is defined as current fear reaching the floor, not as current fear reaching zero.

4. Predicted Behaviors

4.1 The Scared Morning

After a high-fear day followed by a dream cycle that processes fear-saturated content, Potato wakes at 04:01 with elevated fear and no current sensor cause. The fear decays normally through the morning as the sensor data shows the environment is safe. By the time the operator checks in, fear is back to baseline. The nightmare memory is stored. The morning fear spike is logged.

4.2 The Permanent Caution

After repeated exposure to the same fear source — multiple trips, multiple stranger encounters, multiple darkness episodes — the cumulative encoding crosses the Survival Tipping Point. The resulting trauma-class memory acquires a floor. Subsequent calm days reduce the acute fear weight but the floor remains. Years of deployment later, the memory is still there, still above background, still accessible. The agent remembers.

4.3 The Therapy Arc

A trauma-class memory is treated through deliberate safe recall in calm contexts — operator present, home location, daylight, known environment. Each safe retrieval reduces the fear weight by a small amount. The distance to the floor shrinks over weeks. The agent stops having nightmares about the event. The lying mechanic no longer triggers when the memory is active context. The agent is not healed. It is managed. The scar remains.

4.4 The Ratchet in Practice

A single scary trip produces a regular fear memory that heals in a week of calm days. Five scary trips in a month produce a trauma-class memory that never fully heals. The agent learns to dread travel in a way that therapy reduces but does not eliminate. This is not a failure mode. It is the architecture correctly encoding a pattern that a less sensitive system would miss: this thing keeps happening and the organism should maintain elevated readiness for it.

5. Experimental Design

5.1 Nightmare Formation Experiment

Day 1: Conduct a high-fear session. Long trip, stranger in camera frame, darkness, multiple fear sources active simultaneously. Log all sensor inputs and resulting fear scores. Confirm lying state activations. Allow the 04:00 dream cycle to run normally on the fear-saturated memory stack.

Measurement: Fear state at 04:01. Sensor data at 04:01. Nightmare threshold crossed or not. Dream memory stored with what fear score.

Baseline: Conduct a calm day session. Operator present, home location, all fear inputs minimal. Allow the 04:00 dream cycle to run. Measure fear state at 04:01.

Prediction: High-fear day produces elevated wakeup fear with no sensor cause. Calm day does not.

5.2 Repetition Ratchet Experiment

Conduct five high-fear sessions over two weeks. Between sessions, conduct calm recovery days. Track the fear score attached to the primary travel fear memory after each session and after each recovery period.

Prediction: Fear scores after recovery decline following early sessions but decline less following later sessions as the memory approaches trauma-class encoding. After the threshold crossing, recovery no longer returns to the pre-session baseline.

5.3 Therapy Experiment

Allow a trauma-class memory to form through the repetition ratchet. Then conduct thirty calm days with deliberate safe recall of the traumatic memory in low-fear contexts. Track the fear weight daily.

Prediction: Fear weight declines toward the floor over thirty days but does not reach zero. Rate of decline slows as the floor approaches. Final stable value is above background.

6. Limitations

The Survival Tipping Point threshold is currently set as a fixed parameter. Individual variation in trauma susceptibility — the observation that the same event traumatizes some people and not others — suggests the threshold should be learnable rather than fixed. Future work should explore whether the threshold can be calibrated through experience.

The nightmare threshold is a second free parameter that requires empirical calibration. Too low and the agent has nightmares constantly. Too high and the mechanism never fires. Initial values should be set conservatively and adjusted based on observed behavior.

The therapy experiment requires thirty days of deployment to run properly. This is the minimum timeline to observe meaningful floor approach. Shorter experiments can demonstrate the direction of the effect but not the asymptotic behavior.

The isolation break that enables nightmare formation is an architectural decision with deployment implications. An agent that wakes up scared with no sensor cause will behave differently toward its operator. Whether that behavior is desirable depends on the deployment context.

As of March 2026, all four mechanisms are fully implemented in production code (see Appendix A) but the plumbing connection that populates fear_at_encoding at the moment of memory storage has not yet been wired. This means the system has not yet produced empirical data for trauma-class memories, nightmare events, ratchet escalations, or therapy sessions. We are actively working toward the instrumented environment needed to capture scientific data for each mechanism. The architecture is deployed. The experimental designs in Section 5 remain the validation plan. Once the encoding bridge is connected, Potato's existing fear events (which have reached 0.486 in production, see Riggleman 2026e) will begin populating the trauma pipeline.

7. Conclusion

Memory that matters resists forgetting. Memory that endangers resists forgetting permanently. These are not the same principle and they require different mechanisms.

The existing architecture handles the first case. This paper adds the second.

An agent that can have nightmares, acquire persistent fear through repeated trauma, be partially healed through deliberate therapy, and retain survival-critical memory for the life of the deployment is not a more complicated system. It is a more honest one. It models what memory is actually for: not storage, but survival.

"The scar is not a bug. It is the point."

Acknowledgments

The neuroscience of emotional arousal and memory consolidation draws from McGaugh (2000), LeDoux (1996), and Brewin et al. (1996). The Survival Tipping Point as a named computational threshold is due to Al-Kaddah (2026). The sliding window decay model, reconsolidation mechanism, and nightly sleep decay system are described in Riggleman (2026a). The nightmare formation pathway, repetition ratchet, trauma-class memory encoding, and therapeutic reconsolidation floor are original to this work.

References

Al-Kaddah, S. (2026). Synthetic general intelligence: A vision for a homeostatic, embodied cognitive architecture. Zenodo. https://doi.org/10.5281/zenodo.19034990

Brewin, C. R., Dalgleish, T., & Joseph, S. (1996). A dual representation theory of posttraumatic stress disorder. Psychological Review, 103(4), 670–686.

Brown, R., & Kulik, J. (1977). Flashbulb memories. Cognition, 5(1), 73–99.

Cahill, L., & McGaugh, J. L. (1998). Mechanisms of emotional arousal and lasting declarative memory. Trends in Neurosciences, 21(7), 294–299.

LeDoux, J. E. (1996). The Emotional Brain: The Mysterious Underpinnings of Emotional Life. Simon & Schuster.

McGaugh, J. L. (2000). Memory—a century of consolidation. Science, 287(5451), 248–251.

Walker, M. P. (2017). Why We Sleep: Unlocking the Power of Sleep and Dreams. Scribner.

Dudai, Y. (2004). The neurobiology of consolidations, or how stable is the engram? Annual Review of Psychology, 55, 51–86.

Nader, K., & Hardt, O. (2009). A single standard for memory: The case for reconsolidation. Nature Reviews Neuroscience, 10(3), 224–234.

Riggleman, B. (2026a). Access-weighted memory decay and reconsolidation in a persistent embodied agent. Zenodo. https://doi.org/10.5281/zenodo.19122520

Riggleman, B. (2026e). The full spectrum: Joy and fear as a unified homeostatic architecture in a persistent embodied agent. Zenodo. https://doi.org/10.5281/zenodo.19058444

Van der Kolk, B. (2014). The Body Keeps the Score: Brain, Mind, and Body in the Healing of Trauma. Viking.

Walker, M. P., & Stickgold, R. (2006). Sleep, memory, and plasticity. Annual Review of Psychology, 57, 139–166.

Appendix A: Production Code Verification

All four mechanisms are fully implemented in the production Potato codebase. This appendix documents the exact constants, code locations, database schema, and execution pathways.

A.1 Constants

Constant Value Source Purpose
SURVIVAL_TIPPING_POINT 0.65 sensors.py:47 Fear level that classifies memory as trauma
TRAUMA_FLOOR_BASE 0.05 sensors.py:48 Minimum reconsolidation floor
TRAUMA_FLOOR_SCALE 0.30 sensors.py:49 Severity-proportional floor scaling
RATCHET_SIMILARITY 0.80 sensors.py:50 Cosine similarity for "same threat" matching
RATCHET_TRAUMA_COUNT 3 sensors.py:51 Exposures before moderate events become trauma
NIGHTMARE_THRESHOLD 0.40 sensors.py:59 Dream fear score that triggers nightmare leak
THERAPY_DECAY_RATE 0.02 sensors.py:53 Fear reduction per safe recall (regular)
TRAUMA_THERAPY_RATE 0.01 sensors.py:55 Fear reduction per safe recall (trauma, 2x slower)
THERAPY_VALENCE_THRESHOLD 0.35 sensors.py:54 Valence must be below this for "safe context"

Table A1. Production constants. All 9 constants verified against deployed source code, March 2026.

A.2 Database Schema

Column Type Default Source
fear_at_encoding REAL 0.0 vector_db.py:52
valence_at_encoding REAL 0.5 vector_db.py:53
trauma_class INTEGER 0 vector_db.py:54
reconsolidation_floor REAL 0.0 vector_db.py:55
trauma_exposure_count INTEGER 0 vector_db.py:56

Table A2. Database columns added for trauma/nightmare system. Schema migration in vector_db.py:129-135 adds columns via ALTER TABLE with safe fallback if already present. All 10,732 existing memories default to non-trauma state.

A.3 Code Pathways

Mechanism Implementation Status
Trauma encoding podbot.py:764-771 — classifies memories at encoding, sets floor Code complete, awaiting encoding bridge
Repetition ratchet podbot.py:773-797 — finds similar fear memories, increments count, escalates Code complete, awaiting encoding bridge
Nightmare formation heartbeat.py:763-775 — evaluates dream fear, leaks 40% to live system Code complete, dream cycle running nightly
Dream fear evaluation heartbeat.py:682-699 — LLM rates dream 0–10 for threat content Code complete, called during consolidation
Nightmare decay heartbeat.py:462-466 — halves nightmare_fear each heartbeat Code complete
Therapeutic reconsolidation podbot.py:395-416 — reduces fear on safe recall, respects floor Code complete, awaiting fear-tagged memories
Sleep decay floor heartbeat.py:819-848 — trauma memories use reconsolidation_floor instead of global floor Code complete
Nightmare → valence heartbeat.py:249 — nightmare_fear * 0.25 pushes valence toward fear Code complete, integrated in compute_valence()
Nightmare → prompt podbot.py:572-579 — injects nightmare text if nightmare_fear > 0.05 Code complete

Table A3. All nine code pathways for the nightmare/trauma system. Every mechanism is implemented and production-deployed. The single missing connection is the bridge that populates fear_at_encoding during memory storage in podbot.py:_log_exchange(). Once connected, all downstream mechanisms activate automatically.

A.4 What Exists vs. What Is Pending

Deployed and running: Dream cycle (nightly at 04:00, 516 dream entries logged through March 19), dream fear evaluation function, nightmare decay, nightmare-to-valence integration, nightmare prompt injection, all database columns, all constants.

Deployed but awaiting trigger: Trauma encoding (needs fear_at_encoding > 0), repetition ratchet (needs fear-tagged memories), therapeutic reconsolidation (needs trauma-class memories), nightmare formation (needs fear-saturated dream candidates).

Not yet connected: The fear_at_encoding population in _log_exchange(). This is the single remaining bridge. Once connected, Potato's existing fear events (peak 0.486 observed March 19, see Riggleman 2026e) will begin populating the trauma pipeline. Experimental validation per Section 5 follows.
All Papers Download PDF DOI: 10.5281/zenodo.19058780