← Back to the demo list
Automatisms and effect continuity
automatizms.js · episodic_memory.js

The effect is computed once in closeLastFrame; the same number is stored in the EM frame and in the automatism’s Usefulness update — without recalculations and mismatches.

Continuity of Evaluation
EM Frame
effect = clamp(Δdiff)
=
Default automatism of the branch
addUsefulnessSample(id, effect)
usefulness is averaged by count

If feedbackAutomatizmId is set on the frame (waiting after an automatism), the sample goes into it; otherwise it goes into Automatizms_getDefaultAutomatizmForBranch(perceptionNodeId).

Creating an Automatism from an Action-Image
After the reflex fires, EpisodicMemory_setLastFrameActionFromActionId registers OD in the frame and calls Automatizms_createAutomatizm(branchId, actionsImageId). The record is unique by the pair (branch, OD). The first automatism on a branch is set as default (setDefaultAutomatizm).
From Reflex to the First Automatizms
Genetic or conditional reflexstartAction → the frame stores the reaction (OD) → an automatism is created with zero usefulness and count = 0 until the first close.
When the frame is closed, the same effect from the EM frame is averaged into usefulness — this is the “first” numeric estimate of utility for the (branch + action) pair.
Then the default automatism participates in FO as a candidate when the branch is activated; accumulated utility reflects success/failure of repeating episodes.
Why This Matters
Unified metric: episode memory and automatism training rely on the same effect value — easier to align behavior and debugging.
Default branch automatism is a compact representation of “what usually worked on this branch” for consciousness; usefulness growth from positive episodes strengthens trust in that action.