After using plot chains they are cleared and not persisted anywhere. Plot consumption will be implemented for sleep as the info function info_new_abstract_semantic — plot handling (add in infofunctions.js).

Using passive-mode chains to grow abstraction semantics

1. Conceptual basis
In passive mode the system builds association chains, moving from one EP frame to another. These chains are potentially new combinations of "condition → stimulus → action → effect" not seen before in experience. They are ideal material for:

Enriching existing abstractions with new semantic links

Creating new abstractions from combinations of known elements

Forming higher-order mental rules

2. Extracting chains from passive mode

2.1. Fantasy chain structure
Each chain built during passive thinking should be stored on the cycle:

text
fantazmingChain = [
  {
    sourceStimulusId: number,      // source stimulus (FinalImageId)
    actionImageId: number,         // Beast response action
    responseStimulusId: number,    // operator answer (new stimulus)
    effect: number,                // effect from this step in the source frame
    episodeFrameId: number,        // source EP frame id
    confidence: number             // confidence (from frame count)
  },
  // ... further links
]

2.2. Chain value detector
When a chain ends (length limit or no continuation), assess its value for semantic growth:

Value criteria:

Chain length: 2–3 links are most useful for new links

Total effect: positive total effect suggests a potentially useful strategy

Combination novelty: absence of "stimulus → action → stimulus" in existing abstractions

Transition contrast: sharp context shifts (e.g. fear to joy) yield stronger semantic links

3. Enriching existing abstractions

3.1. Finding abstractions to enrich
For each chain link, resolve matching abstractions:

text
function findAffectedAbstractions(chainLink):
  // 1. Perception abstraction for stimulus
  perceptionAbs = findAbstractPerceptionByStimulus(chainLink.sourceStimulusId)

  // 2. Action abstraction for Beast action
  actionAbs = findAbstractActionByActionImage(chainLink.actionImageId)

  // 3. Perception abstraction for response stimulus
  responseAbs = findAbstractPerceptionByStimulus(chainLink.responseStimulusId)

  return { perceptionAbs, actionAbs, responseAbs }

3.2. Adding semantic links
For each abstraction found, add a link in semanticStructure.frames:

For perception abstraction of stimulus:

Add a rule linking current stimulus to the action that led to the new stimulus

Condition key: (perceptionNodeId, situationId) from link context

Effect: link effect (or whole-chain total)

For action abstraction:

Add a rule linking this action to its outcome (new stimulus)

Average effect with existing records for same (branch, situation)

For perception abstraction of response stimulus:

Add reverse link: this stimulus can be reached via this action from this context

Strengthen stimulus importance from effect

3.3. Updating abstraction importance

text
function updateAbstractionSignificance(abstraction, effect, context):
  // Reuse averaging from AbstractImages_upsertSemanticRuleFromEpisodeFrame
  // Difference: mark rule as "fantasy" (ruleKind = 'fantasy')
  // to separate real experience from generated

  if (abstraction.semanticStructure.frames has matching key):
    average effect with previous value
  else:
    create new record with effect
    set ruleKind = 'fantasy'
    set confidence = effect * chainLength / 10 (credibility factor)

4. Creating new abstractions

4.1. Composing new abstractions
Fantasy chains allow abstractions that did not exist in experience:

New abstraction types:

Composite stimulus: combination of source and response stimuli

text
newAbstraction = {
  type: 'composite',
  components: [chainLink.sourceStimulusId, chainLink.responseStimulusId],
  relation: 'leads_to',
  weight: total_chain_effect
}

Transitive action: action sequence leading to an outcome

text
newAbstraction = {
  type: 'sequence',
  actions: [link1.actionImageId, link2.actionImageId, ...],
  finalEffect: total_chain_effect,
  contexts: [link_contexts]
}

Abstract situation: generalization of contexts where the chain works

text
newAbstraction = {
  type: 'situation',
  baseStates: [unique_base_states_from_chain],
  emotions: [unique_emotions_from_chain],
  commonStimulus: chainLink.sourceStimulusId
}

4.2. Registering new abstractions
Create via existing API:

text
function createAbstractionFromChain(chain, type):
  abstractionId = Abstractions_create({
    type: type,
    sourceChain: chain,
    createdAt: Date.now(),
    confidence: calculateConfidence(chain),
    semanticStructure: buildSemanticStructureFromChain(chain)
  })

  linkAbstractionToSources(abstractionId, chain)

5. Forming mental rules

5.1. From chain to mental rule
Each successful fantasy chain can seed a mental automatism:

Mental rule structure:

text
mentalRule = {
  perceptionNodeId: first_link_context,
  stimulusImageId: first_link_stimulus,
  abstractionId: created_abstraction_id,
  meanEffect: total_chain_effect / chain_length,
  count: 1,
  chain: fantazmingChain  // keep for possible expansion
}

5.2. Registering in mental automatism system

text
function registerMentalRuleFromChain(chain, cycle):
  // 1. Create mental action image (MentalActionImage)
  maiId = MentalActionImages_getOrCreate(
    sourceActionImageId: chain[0].actionImageId,
    abstractActionIds: [extract_action_abstractions_from_chain],
    maSequence: serialize_chain_to_string
  )

  // 2. Create or update mental automatism
  automatizmId = MentalAutomatizms_create({
    themeId: cycle.createdThemeId,
    situationId: cycle.createdSituationId,
    branchId: getBranchIdFromContext(chain),
    mentalActionImageId: maiId,
    usefulness: calculateChainUsefulness(chain),
    isDefault: false  // fantasy automatism is not default
  })

  // 3. Tie to abstraction semantic structure
  for each abstraction in chain:
    AbstractImages_upsertSemanticRuleFromEpisodeFrame(
      abstraction,
      build_frame_from_link(link)
    )

6. Semantic growth loop via passive mode
Suggested loop integrated in consciousness dispatcher:

Accumulation: passive thinking accumulates fantasy chains

Each successful info_fantasizming iteration appends a link to cycle.fantazmingChain

At length limit (3–5 links) chain is complete

Validation: assess chain value

If total effect > threshold (e.g. >3) → chain is useful

If chain has combinations not in EP → high value

If chain loops (repeats links) → low value

Semantic processing:

Enrich abstractions (ruleKind: 'fantasy')

Create new abstractions (composites, sequences, situations)

Form mental rules

Integration into active thinking:

Fantasy rules usable in active mode with lower priority

On confirmation by real experience (effect from real EP frame) change ruleKind to 'episodic'

On refutation (negative effect) lower confidence; rule may be removed

7. Success criteria
Mechanism effectiveness can be tracked by:

New abstractions per time unit (should grow with experience)

Share of fantasy rules confirmed by real experience (target >30%)

Length of successful fantasy chains (from 2–3 to 5–7 links)

Faster solution search in novel situations using fantasy abstractions
