- Cognitive Minds: Originally created as Inner Self by LewdLeah β€οΈ
- Prompt Caching: Optimized Context patch by XloSky
- Maintainer: Modularized with CSCP v1.2 and maintained by Randy Viosca (@Random_Variable)
Inner Entity (v3.0.0) is a pure modular character-cognition script built on LewdLeah's Inner Self and XloSky's Optimized Context compatibility patch. Starting in v3.0.0, Inner Entity ships cleanly as a single Minds engine (src/library.js) and pairs effortlessly with standalone Entity Cards (v3.0.0) and AID-Modules (v1.2.0) in AI Dungeon's Script Manager.
Simulated NPCs build, reflect upon, and maintain their own private mental state (goals, secrets, opinions, private plans) while optional companion scripts generate structured lore in parallel with zero cross-slot collisions.
| Feature | Description |
|---|---|
| Segmented Character Minds | Each NPC maintains their own private mental state, separate from other characters |
| Optimized Context Support | Fully compatible with AI Dungeon's Optimized Context prompt caching via dynamic task cards |
| Smart Trigger Scoring | Narration mentions outweigh dialogue mentions (3:1), preventing absent characters from thinking |
Clean SysConfig / SysTask Cards |
Persistent "Inner Entity [ON|OFF]" (SysConfig) and "Inner Entity Task β do not edit" (SysTask) cards stay isolated from Brain & story lore tabs, clean up UI duplicates automatically, and auto-respawn with your NPC list intact if accidentally deleted |
| CSCP Multi-Slot Coordination | Coordinates seamlessly with standalone Entity-Cards and AID-Modules via CSCP v1.2, pausing NPC thoughts during /ec card generation and reconciling [Disabled] badges cleanly if disabled in Script Manager |
| 100% Backward Compatible | Works with legacy InnerSelf() hooks, MainSettings.InnerSelf / MainSettings.InnerEntity, and /is command aliases |
π§ Architecture & Documentation:
- Dynamic Slot Management & Graceful Degradation Guide: What happens when slots are toggled on/off, reordered, or removed mid-adventure.
- Cross-Slot Protocol (CSCP) Guide: Multi-slot arbitration between AID-Modules, Entity-Cards, and Inner-Entity.
- Execution Flow & Lifecycle Guide: Step-by-step state diagrams and edge conditionals across each turn phase.
- Solo (Character Minds only): Load Inner Entity (
bL_qS9DsI5wI) by itself.aid-getopt(v1.2.0) andloadCSCP()are bundled directly insidesrc/library.js, so zero companion slots are required. - Multi-Slot Stack (with Entity Cards or other CSCP scripts):
- Slot 1:
AID-Modules(jHwEbn7_bYGC,v1.2.0) - Slots 2 & 3 (either order):
Entity Cards(05_w3s9zrrvt,v3.0.0) +Inner Entity (Minds)(bL_qS9DsI5wI,v3.0.0)
- Slot 1:
- No
AID-Getoptslot required:AID-Getoptis now a developer library only and does not need to be added to your adventure or scenario Script Manager.
- Open the AI Dungeon website on desktop.
- Edit an existing scenario or create a new one.
- Open the DETAILS tab at the top.
- Scroll down to Scripting and toggle ON β Scripts Enabled.
- Select EDIT SCRIPTS.
Open src/library.js, copy the entire file, and paste it into your empty Library tab.
Paste the following into your empty Input tab:
// Your "Input" tab should look like this
InnerEntity("input");
const modifier = (text) => {
// Any other input modifier scripts can go here
return { text };
};
modifier(text);Paste the following into your empty Context tab:
// Your "Context" tab should look like this
InnerEntity("context");
const modifier = (text) => {
// Any other context modifier scripts can go here
return { text, stop };
};
modifier(text);Paste the following into your empty Output tab:
// Your "Output" tab should look like this
InnerEntity("output");
const modifier = (text) => {
// Any other output modifier scripts can go here
return { text };
};
modifier(text);- Click the yellow SAVE button in the top right.
Note: Existing scenarios referencing InnerSelf("input"), InnerSelf("context"), and InnerSelf("output") remain fully supported via backward-compatibility aliases.
When your adventure begins, Inner Entity creates:
Inner Entity [ON|OFF](type: "SysConfig"):- Controls NPC mind simulation, thought frequency, trigger distance, and character list.
- At the bottom of the card notes, list your intelligent NPCs on separate lines (e.g.
Leah\nLily\nLydia). - Deleting this card mid-adventure automatically respawns it with all settings and your configured NPC list preserved.
Inner Entity Task β do not edit(type: "SysTask"):- Transient task card used automatically when AI Dungeon's Optimized Context prompt caching is enabled.
(For automated story card generation alongside Inner Entity, pair with standalone Entity-Cards and AID-Modules in AI Dungeon's Script Manager.)
/ie -s,/ie --status,/ie --list: Display all simulated character minds, recent thoughts, and cognitive state./ie -i,/ie --info,/ie --diag: Output complete cognitive engine diagnostics (active NPCs, thought chance, trigger lookback distance, visual indicator, prompt caching tier, Entity-Cards link status)./ie -c,/ie --characters: List configured scenario NPCs registered to develop minds./ie -v,/ie --version: Display script build version (Ver.3_0_0-IE [minds]) and git commit hash./ie -h,/ie --help: Display the in-game command help listing.
At the top of src/library.js, creators can customize scenario defaults via globalThis.MainSettings:
globalThis.MainSettings = (class MainSettings {
static InnerEntity = {
IMPORTANT_SCENARIO_CHARACTERS: "Leah, Lily, Lydia",
IS_INNER_SELF_ENABLED_BY_DEFAULT: true,
FIRST_SECOND_OR_THIRD_PERSON_POV: 2,
PERCENTAGE_OF_RECENT_STORY_USED_FOR_BRAINS: 30,
NUMBER_OF_ACTIONS_TO_LOOK_BACK_FOR_TRIGGERS: 5,
ACTIVE_CHARACTERS_VISUAL_INDICATOR_SYMBOL: "π",
THOUGHT_FORMATION_CHANCE_PER_TURN: 60,
};
});Inner Entity v3.0.0 builds a single offline, deterministic Pure Modular artifact (src/library.js, ~187 KB) bundling only the Minds cognition engine (src/core.js) and aid-getopt (submodules/aid-getopt).
# Clone with aid-getopt submodule
git clone --recurse-submodules https://github.com/viosca/Inner-Entity.git
# Build Pure Modular artifact (src/library.js)
npm run build
# Run lifecycle, CSCP v1.2, and 16-case + dynamic waterfall matrix test suites
npm testunittest/test_lifecycle.jsβ Lifecycle hooks,SysConfig/SysTaskcategories, duplicate cleanup, lore collision guard,6BNPC backup respawn, andMainSettings.unittest/test_cscp_inner_entity.jsβ Multi-VM CSCP v1.2 coordination, duplicate Minds yielding,[Disabled]badge reconciler, and 4-slot ecosystem integration.unittest/test_waterfall_matrix.jsβ 16-permutation waterfall matrix (AM/EC/IExOC=true/false) + dynamic slot enable/disable/reorder tests.
- LewdLeah: Creator of the original Inner Self (January 3, 2026) and Auto-Cards (May 21, 2025). The architecture of segmented memories, autonomous reflection, and card synchronization is LewdLeah's foundational work.
- XloSky: Creator of the Optimized Context patch (build 2.8.0), solving server-side prompt cache discard via dynamic task cards, dialogue-vs-narration trigger weighting, and self-referential thought filtering.
- Randy Viosca (@Random_Variable): Creator of Entity Cards, contributing Named Entity Recognition (NER), token-density calibration for AID's 100-token slider, two-card architecture, model-aware presets, fence cleaners, and maintainer of Inner Entity.
- Community: Pull requests and benchmark contributions by dirtymined13, -Vinny-, and testers across the AI Dungeon community.
