PTSD Simulator
Recipe: PTSD Simulator
Section titled “Recipe: PTSD Simulator”“Certain words become landmines — stepping on one detonates an entire network.”
The Problem
Section titled “The Problem”In cognitive systems (games, simulations, AI characters), we sometimes need to model:
- Trigger words that cause outsized reactions
- Rigidity — the response is fixed, not adaptive
- Suppression — related neutral topics get blocked
- Intrusion — the trauma memory surfaces unbidden
Traditional rule-based systems require explicit trigger lists. MindFry models this as emergent behavior from bond dynamics.
The Pattern
Section titled “The Pattern”graph TD
T[TRIGGER<br/>E=0.99, Rigid] -->|+1, s=1.0| F[fear<br/>cascade]
T -->|+1, s=0.9| P[panic<br/>cascade]
T -->|-1, s=0.8| C[calm<br/>suppressed]
T -->|-1, s=0.7| N[normal<br/>suppressed]
F -->|+1| H[hypervigilance]
P -->|+1| A[avoidance]
Key characteristics:
- High-energy trigger: Nearly maximum energy, resistant to decay
- Strong synergy bonds: To fear/panic responses
- Antagonistic bonds: Actively suppress normal/calm associations
- Rigid polarity: Bonds don’t weaken with time
The Code
Section titled “The Code”import { MindFry } from '@mindfry/client'
async function createTraumaNetwork(brain: MindFry, triggerWord: string) { // Create the trigger with maximum energy await brain.lineage.create({ key: triggerWord, energy: 0.99, // Nearly maximum — very hard to forget })
// Create response memories const responses = ['fear', 'panic', 'flashback', 'hypervigilance'] for (const response of responses) { await brain.lineage.create({ key: `${triggerWord}_${response}`, energy: 0.8 })
// Strong synergy: trigger activates response await brain.bond.connect({ from: triggerWord, to: `${triggerWord}_${response}`, strength: 0.95, polarity: 1, // Synergy }) }
// Create suppression targets (things that get blocked) const suppressed = ['calm', 'safety', 'present_moment', 'rational_thought'] for (const target of suppressed) { await brain.lineage.create({ key: `${triggerWord}_${target}`, energy: 0.5 })
// Antagonistic bond: trigger suppresses these await brain.bond.connect({ from: triggerWord, to: `${triggerWord}_${target}`, strength: 0.8, polarity: -1, // Antagonism }) }}
async function simulateTrigger(brain: MindFry, triggerWord: string) { console.log(`\n⚡ Trigger activated: "${triggerWord}"`)
// Stimulate the trigger with maximum intensity await brain.lineage.stimulate({ key: triggerWord, delta: 1.0, })
// The cascade happens automatically: // - fear, panic, flashback all get +0.475 energy (0.95 strength × 0.5 damping) // - calm, safety get -0.4 energy (suppression)
// Set mood to depressive (simulating the trauma state) await brain.system.setMood(0.2)
console.log('→ Fear responses activated') console.log('→ Calming associations suppressed') console.log('→ Mood shifted to depressive')}
// The Hate Test (from actual MindFry tests)async function theHateTest(brain: MindFry) { // Create: love → hate (antagonism) await brain.lineage.create({ key: 'love', energy: 0.8 }) await brain.lineage.create({ key: 'hate', energy: 0.5 })
await brain.bond.connect({ from: 'love', to: 'hate', strength: 1.0, polarity: -1, // Maximum antagonism })
// Stimulate love await brain.lineage.stimulate({ key: 'love', delta: 0.5 })
// Result: hate.energy DECREASES by ~0.25 const hate = await brain.lineage.get('hate') console.log(`hate.energy after love stimulation: ${hate.energy}`) // Expected: ~0.25 (was 0.5, decreased by antagonistic cascade)}The Insight
Section titled “The Insight”Modeling Recovery
Section titled “Modeling Recovery”Recovery involves weakening antagonistic bonds and strengthening coping associations:
async function modelTherapySession(brain: MindFry, triggerWord: string) { // 1. Create positive associations with the trigger await brain.lineage.create({ key: `${triggerWord}_safety_anchor`, energy: 0.6 })
// Synergy bond to safety await brain.bond.connect({ from: triggerWord, to: `${triggerWord}_safety_anchor`, strength: 0.3, // Starts weak polarity: 1, })
// 2. Gradually increase safety association strength // (In real implementation, this would be repeated exposure)
// 3. Lower the trigger's base energy over time // (Desensitization through controlled exposure)}Mood as Vulnerability
Section titled “Mood as Vulnerability”// Low mood = more susceptible to triggersawait brain.system.setMood(0.2)// Now even weak triggers can surface trauma memories
// High mood = more resilientawait brain.system.setMood(0.8)// Higher threshold means triggers need more energy to surface fearNext Recipe: Zeitgeist Watcher — Track trending topics by energy levels.