Abstractions and Semantic Structure
abstract_images.js
EM Frame Close
When closeLastFrame computes effect, AbstractImages_cloneFromEpisodeFrame runs: for the pair (branch node, stimulusImageId) it creates or strengthens a perception clone by averaging meanImportance and count based on the episode effect. If actionImageId is non-zero, an action clone is also updated for (node, OD). If actionImageId === 0, the action clone is not built, but perception clones and semantics are still updated.
Two Types of Clones
AbstractPerceptionImages
key: branch + stimulus FinalImage
Hard situation image → flexible clone with accumulated significance
AbstractActionImages
key: branch + action image
Only if there was a real action in the frame
semanticStructure
Each clone record has semanticStructure: { frames: [ … ] }. Snapshots of rules are stored by conditions (perceptionNodeId, situationId): ruleKind is either episodic (best episode by the larger effect) or teacher (an operator reply stimulus exists; prioritized over episodic for the same condition pair). Updates use AbstractImages_upsertSemanticRuleFromEpisodeFrame separately for the perception clone and the action clone.
{ frames: [ { perceptionNodeId, situationId, ruleKind, stimulusImageId, actionImageId, effect?, responseStimulusImageId? } ] }
Link to Mental Automatizms
Level 3 uses AbstractImages_findRuleFrameMatchingContext to find a matching rule frame in semanticStructure for the current FO context. On success, and under a positive scenario, the motor is started via the episodic circuit. After the operator reply, when it matches the structure frame, AbstractImages_applyEpisodeEffectToSemanticContextAbstractions runs and, if effect > 0, MentalAutomatizms_tryCreateFromSemanticStructureRule (levels 2/3). Mental rules in mental_automatism.js can depend on abstractPerceptionId or abstractActionId.
Arbitrarily Modifiable Abstractions
In this module’s concept (comments in abstract_images.js), hard perception/action images from the core get clone representation in the “understanding area”: future rules, fantasy additions, and chains of mental operations can be attached to these clones without redoing the raw sensory input. Episodes record pointers to abstractions; rules become more flexible than purely motor chains.
Adaptability to New Conditions
For a new (branch, situation) pair, a new frame is added to semanticStructure or an existing one is updated by the episodic/teacher selection rules. Accumulated meanImportance and the effect history let the system pick a different stable rule when the context changes, without rebuilding hard images. Negative experience weakens weights (via the effect-application pipeline to abstractions); positive experience strengthens them and can create a mental automatism — the creature adapts behavior and hypothesis debugging faster to new conditions.