MAXIM
Imagination
Real-Time Entity Design from Novel Percepts
The Concept
Biological Inspiration
Imagination fires during low-arousal idle states — the same way you don't daydream while fighting. When the brain encounters something unfamiliar, it constructs a mental model from prior experience to reason about the novel entity before physically interacting with it. The Default Network, which activates during rest and mind-wandering, gates this process.
When the agent encounters a novel entity mentioned in percept text that has no existing SEM component, the imagination system designs one in real-time. The result is a fully functional entity with sensors, affordances, and failure modes — registered ephemerally for the session as an observable scene entity the agent can sense.
Why This Matters
Without imagination, the agent can only sense entities that were pre-authored as YAML components. Narration that mentions a "rusted padlock" or "crystal chandelier" would have no sensors or failure modes — the agent could only talk about them. Imagination closes this gap by designing components on-the-fly, making novel entities observable and substrate-encodable.
The Pipeline
Each stage is a gate. If any gate fails, the pipeline short-circuits gracefully — the agent falls back to verbal-only interaction with the entity. The trigger fires each turn after the agent has updated its state on the percept, before it decides what to do.
Entity Extraction
Lightweight NLP heuristics extract entity-like noun phrases from narration text. No external model required — this runs on pure string processing.
Extracted
Physical objects, creatures, weapons, environmental features, items, vehicles, NPCs
Examples: "rusty padlock", "crystal chandelier", "ancient tome", "iron golem"
Filtered Out
Abstract concepts, body parts, clothing, emotions, time references, generic pronouns
Examples: "courage", "left arm", "leather boots", "dread", "morning"
Two strategies work in parallel:
- Sentence-level intro patterns — catches "You see a rusty gate", "A massive golem blocks the path", "There is a glowing orb"
- Head-noun scanning — matches against a curated indicator vocabulary of entity-like words (weapon, creature, door, chest, etc.)
ComponentIndex: Two-Layer Lookup
Before imagining anything, each candidate phrase is checked against the ComponentIndex to see if an existing component already covers it:
Layer 1: Alias Table
Exact match against component names and the synonyms each component declares in its YAML.
"sword" → weapons/rusty_sword
Layer 2: Embedding Similarity
Cosine similarity against every component's signature embedding, accepted above a threshold. Catches paraphrases the alias table can't.
"old iron door" → environments/rusty_gate
If either layer finds a match, imagination is skipped for that phrase. This prevents duplicate components under different names. The catalog it searches is documented in the component library reference.
Gates
Three gates prevent imagination from firing at inappropriate times:
Mention Threshold
A one-off phrase ("you notice a crack in the wall") won't spawn an entity. Repeated mentions signal narrative importance.
DN Arousal Gate
Only fires during low-arousal idle states. Blocked when the Default Network is inhibited or recent interesting events occurred. You don't daydream while fighting.
Energy Budget
Skipped when LLM energy is critically low. Falls back gracefully to verbal-only interaction with the entity.
The thresholds are configuration; see the imagination reference.
EntityDesigner
When all gates pass, the EntityDesigner makes a single LLM call to generate a complete SEM component specification from the entity phrase and surrounding narrative context. It first infers a structural archetype (humanoid, creature, weapon…) and merges that archetype's body-part vocabulary into the generated spec, which cuts down on hallucinated modulator names.
Quick Validation
The spec is validated against the SEM protocol: required fields present, sensor ranges valid, modulator params typed, failure triggers well-formed. Invalid specs are discarded — the agent falls back to verbal interaction. The Asset Foundry is the batch equivalent, with gauntlet testing.
Bookkeeping
Imagined entities live in a separate overlay from the persistent component registry. During the session the entity is visible to lookups, added to the ComponentIndex for dedup, and registered as an observe-only scene entity: the agent can sense it but cannot call its affordances directly as tools. It interacts using its own body’s tools, while the imagined affordance names are encoded through the substrate path for concept transfer (EC → ATL → NAc eligibility) — the same lifecycle as pre-authored scene entities, described in the tools reference. A session-scoped cache shared by the agent and the orchestrator stores successes and failures alike, so a phrase both extract fires one design call, and a failed validation for "vague smoke" won't retry every turn.
At session end the overlay and cache are cleared, but the learning is not thrown away. Every episode and causal link from an imagined entity carries imagined=True provenance, and on discard those links get a 50% confidence decay. The agent retains partial learning ("chandeliers can collapse") with appropriately reduced confidence compared to verified real-world interactions; if a later encounter confirms the pattern, confidence rebuilds through standard Rescorla-Wagner updates.
Integration with Bio-Systems
Imagined entities participate in the full bio-pipeline, just like pre-authored ones:
Hippocampus
Episodes from imagined interactions are captured with imagined=True metadata.
NAc
Causal links form from affordance outcomes. 50% confidence decay at session end.
PainBus
Failure modes fire pain signals through the same cascade as real entities.
Cerebellum
Forward models train on imagined affordance outcomes via Rescorla-Wagner.
ATL
Semantic concepts form from imagined entity interactions (modality-tagged).
Acting Coach
Exploration directives include imagined entity affordances in the meta-prompt.
Reference on pymaxim.bio
This page is the design story. Install steps, CLI flags, configuration, and the current evidence live in the docs: