-
Notifications
You must be signed in to change notification settings - Fork 14
Experience Buffer
The Experience Buffer is a core component in the system's learning and neurogenesis (neuron creation) module that functions as a memory for recent, significant events. It maintains a time-ordered log of the squid's context and uses this data to identify recurring patterns, which helps the system decide when and how to create new, functionally specialized neurons.
TIP: View the experience buffer using the Debug menu
The experience buffer is technically implemented as the ExperienceBuffer class, which operates in two main ways: maintaining a rolling log and tracking pattern recurrence.
-
Rolling Log (deque): The buffer uses a deque (double-ended queue) to store a fixed, limited number of recent experiences (default maximum is 50 experiences). When a new experience is added, the oldest one is automatically discarded, ensuring the buffer only contains the latest, most relevant context.
-
Pattern Tracking: When an experience is added, it is processed to generate three levels of pattern signatures, which are counted to track how often similar events occur:
-
Specific Pattern: The most detailed signature, identifying a precise combination of
trigger,outcome, and primary motivational neuron state. -
Parent Pattern: A broader pattern used for hierarchical grouping.
-
Core Pattern: A minimal pattern used for "fuzzy matching" or identifying basic event categories.
The system analyses these counts to determine if a situation is a novel event or a recurring pattern, which heavily influences whether a new neuron is created, or if an existing neuron is strengthened.
Each recorded experience is captured as an ExperienceContext object, which is a snapshot of the squid's state and environment at the moment a significant event (the trigger) occurs.
-
trigger_type- The general category of the event:novelty,stress, orreward. -
outcome- The result of the experience:positive,negative, orneutral. -
active_neuronsA dictionary of all current neuron activations (e.g., {hunger: 20,anxiety: 85}). -
recent_actionsA list of recent actions taken by the squid (e.g., [approach_plant,hide]). -
environmental_stateKey external facts at the time (e.g., {food_count: 0,has_rock: True}).
🦑 Raise digital squids whose brains grow & rewire themselves through Hebbian learning and Neurogenesis