Skip to content

About

Inner-Entity is fork of LewdLeah's Inner-Self, an AI Dungeon mod that grants memory, goals, secrets, planning, and self-reflection capabilities to the characters living in your story! Inner-Entity adds Named Entity Recognition (NER) and Optimized Context (by XloSky) to Inner-Self.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Β 
Β 

Latest commit

Β 

History

178 Commits

Folders and files

Repository files navigation

Inner Entity 🎭

Inner Entity Hero Banner

Autonomous Character Minds for AI Dungeon (Pure Modular v3.0.0)

Based on Inner Self Companion: Entity Cards Specification: CSCP v1.2.0 License: MIT

  • 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)

Overview

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.


Key Features

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:


Script Manager Setup (Solo or Multi-Slot β€” No AID-Getopt Needed)

  • Solo (Character Minds only): Load Inner Entity (bL_qS9DsI5wI) by itself. aid-getopt (v1.2.0) and loadCSCP() are bundled directly inside src/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)
  • No AID-Getopt slot required: AID-Getopt is now a developer library only and does not need to be added to your adventure or scenario Script Manager.

Scenario Script Installation Guide

  1. Open the AI Dungeon website on desktop.
  2. Edit an existing scenario or create a new one.
  3. Open the DETAILS tab at the top.
  4. Scroll down to Scripting and toggle ON β†’ Scripts Enabled.
  5. Select EDIT SCRIPTS.

1. Library Tab

Open src/library.js, copy the entire file, and paste it into your empty Library tab.

2. Input 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);

3. Context Tab

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);

4. Output Tab

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);
  1. 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.


Gameplay & Configuration

In-Game Story Cards

When your adventure begins, Inner Entity creates:

  1. 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.
  2. 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.)

Slash Commands (/ie or /is)

  • /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.

For Scenario Creators

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,
    };
});

Pure Modular Architecture & Build

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).

Local Development & Build Commands

# 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 test

Unit Testing

  • unittest/test_lifecycle.js β€” Lifecycle hooks, SysConfig/SysTask categories, duplicate cleanup, lore collision guard, 6B NPC backup respawn, and MainSettings.
  • 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 / IE x OC=true/false) + dynamic slot enable/disable/reorder tests.

Credits & Attributions

  • 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.

About

Inner-Entity is fork of LewdLeah's Inner-Self, an AI Dungeon mod that grants memory, goals, secrets, planning, and self-reflection capabilities to the characters living in your story! Inner-Entity adds Named Entity Recognition (NER) and Optimized Context (by XloSky) to Inner-Self.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages