Rules and conditions for forming episodic memory (EM) frames
1. General episodic memory layout
EM is an array of frames in strict chronological order. Order is not shuffled; only in-place updates and deletions are allowed without breaking sequence.
Rule (episode frame):
Stimulus (FinalImage) → response action (action image, AI) → effect (Effect) → operator response stimulus (if any).
Frame contents:
perceptionNodeId— ID of the terminal branch of the perception tree (conditions);stimulusImageId— ID of the stimulus image (FinalImage) that triggered the reaction;actionImageId— ID of the response action image (AI);effect— differencegetDiffImportance()“after” minus “before” (before stimulus activation);responseStimulusImageId— ID of the operator’s response stimulus image (if it appeared during the waiting period).
Response action + response stimulus form a “teacher” rule: how the operator responds to Beast’s action.
Response waiting time — response_waiting_period in pulses (default 15). Timeout closure in EpisodicMemory_onPulse. Frames with unfilled effect remain for optimization.
2. Conditions for starting EM frame formation
EM frame formation starts only through the orientation reflex (OR). A frame is created when: OR fired, OR conditions hold (OR_well_known threshold, etc.), and no waiting period is active (otherwise the stimulus is treated as a response). save_episodic_memory is called from OR; the frame and progress bar are created on every such OR firing (not only in test mode).
3. Frame lifecycle
Creation (on OR fire):
- The previous open frame is closed (if any and the waiting period has not expired — the current stimulus is recorded as response; otherwise the frame closes without a response stimulus).
- An “empty” frame is appended to EM:
perceptionNodeId,stimulusImageId,diffBefore(getDiffImportance()before stimulus activation, fromPrevDiffForEpisode),actionImageId = null,effect = null,responseStimulusImageId = null. - Pulse counter and
EpisodicMemory_waitingStartedAtare set; closure by pulses inEpisodicMemory_onPulse. The progress bar is visible only when waiting is active in this session.
Filling with response action:
When Beast performs a reaction (genetic or conditioned),actionImageIdis written to the last frame viaEpisodicMemory_setLastFrameActionFromActionId(actionId). ThestimulusImageIdalready stored in the frame is used (so the frame fills even with delayed reaction or cleared stimuli).Frame completion:
- Response stimulus during waiting: OR first checks
isInWaitingPeriod(). If true — the stimulus counts as the operator’s answer,closeLastFrameWithResponse(winnerId)is called. OR_well_known for the response stimulus is not checked. - Waiting expires without response stimulus: in
EpisodicMemory_onPulsethe frame closes. IfactionImageId === null, the frame is removed; otherwise it remains with computedeffect.
- Response stimulus during waiting: OR first checks
During the waiting period any stimulus is treated only as the operator’s response (samplesCount is not checked).
4. Orientation reflex (OR) and EM conditions
Check order: (1) No active stimuli — exit silently (deactivation). (2) No branch / no winner — exit. (3) Register in semantic memory. (4) First isInWaitingPeriod() — if true, close frame with answer; OR_well_known does not apply. (5) Then check samplesCount >= OR_well_known to start a new process. (6) Otherwise — save_episodic_memory; frame and progress bar are always created. Waiting only when waitingStartedAt != null (a loaded open frame does not imply “in waiting”).
5. EM formation test mode
Enabled with the “t” button in the “Active perception-tree branch” block. Flag: global.EpisodicMemory_testMode.
In test mode:
- On deactivation (no active stimuli) no message is shown.
- On refusal to create a new frame (when waiting is not active) reasons are shown; response stimulus during waiting is not checked against OR_well_known.
- no tree functions or images; branch not found; no winner; weak experience (samplesCount < OR_well_known) — only for starting a new process.
- On start of frame formation — “EM frame formation started. Stimulus: (details). Waiting for answer or reaction.”
- On recording response action (Beast reaction) — “Stimulus image activated: (details). Triggering reaction: (details). Response waiting period started.”
- On response stimulus during waiting — “Stimulus during waiting: (details). Episode frame completed and saved.”
- On period expiry without reaction — frame is removed and: “No reaction to stimulus (details). Episodic memory is not formed.”
In test mode an EM frame is also created when semantic significance exists (runEpisodic = !hasSignificance || EpisodicMemory_testMode) so the process can be observed step by step.
6. Conditioned reflexes in the context of the orientation reflex
Rule: if a stimulus triggered the orientation reflex, the conditioned reflex formation process does not run for it.
Mechanism:
- When OR fires it blocks genetic (or conditioned) reflex execution for 2 pulses (
OR_BLOCK_PULSES). The reflex does not run immediately but is queued (delayedReflexes). - When enqueued and when the delayed reflex later runs, the event records flag
noConditionalReflex: true. - When the delayed reflex runs,
startActionreceives optionnoConditionalReflex: true. With this optionsynonyms_onGeneticActionFiredis not called — the conditioned (synonym) reflex subsystem gets no signal to form or strengthen a conditioned reflex for that stimulus.
Thus a stimulus that attracted OR (i.e. whose reflex was delayed) does not participate in conditioned reflex formation; conditioned reflexes form only for stimuli whose reflex fired without OR blocking.
7. Summary of key constants and flags
| Parameter | Description | Default |
|---|---|---|
response_waiting_period |
Response waiting duration (in pulses) | 15 |
OR_well_known |
Threshold to start a new OR/EM process (not for response stimulus) | 10 |
EpisodicMemory_testMode |
Step-by-step messages for EM formation | false |
OR_BLOCK_PULSES |
Pulses to block reflex after OR | 2 |
Implementation files: _10_Episodic_memory/episodic_memory.js, _8_Hippocampus/orientation_reflex.js, _5_Genetic__reflexes/genetic_reflexes_engine.js.