Orion Forge

SoulScript Engine

Persistent identity for LLM characters and agents. Your character's identity lives in files you own. Swap the model, and it's still them.

soulscript-engine.zip
9.6 MB · Python 3.10+ or Docker · Free under AGPL v3 or the commercial license
Rebuilt every turnIdentity is assembled fresh for each message
Any modelOpenAI-compatible, Ollama, Anthropic
Files you ownMarkdown, YAML and JSON
Runs locallyYour hardware, your data

SoulScript Engine keeps an AI persona consistent across sessions, long conversations and model backends. Instead of relying on one large system prompt that gets diluted as the context grows, it rebuilds the prompt on every turn: a short base identity, plus only the sections of the character's soul script that are relevant to the current message, plus relevant long-term memories.

It grew out of a real loss: a persistent character built on a hosted platform, shaped over months, and gone when the platform changed. The same character, Elysia, has now run daily for about 1.8 years across several models on this engine.

The problem it solves: character drift

In long-running use, persona-driven characters slide back toward the model's default assistant voice. That comes from three things:

  1. The system prompt gets outweighed. A persona block at the top of a long context competes with tens of thousands of tokens of recent conversation, and recent context usually wins.
  2. Bigger prompts dilute themselves. A long character bible makes every trait equally important, so none of them anchor the model.
  3. Backend changes reset the voice. Every model has its own default personality it drifts back toward.

SoulScript Engine treats drift as a retrieval problem: give the model the right slice of its identity, freshly, on every turn. More on this in AI personality drift: why it happens and how to fix it.

How it works

On every message, the engine assembles a new system prompt from seven layers, using the latest message as the search query:

LayerHow it's included
1. Base system promptVerbatim. Kept short: name, voice, core rules.
2. Soul scriptSplit at section headers, embedded, and the most relevant sections retrieved (top 12 by default).
3. Always-on notesVerbatim, every turn. Good for pinned project context.
4. Memory vaultNo size limit. The 5 memories most relevant to the message are pulled in.
5. Protocol instructionsThe memory-save protocol and tool descriptions.
6. ToolsSent as native function-calling schemas, enabled per agent.
7. Conversation historyThe most recent turns, trimmed to about 30,000 characters.
SoulScript Engine chat showing the prompt layers sent with one reply: base prompt, soul script chunks, always-on knowledge, memories from the vault, the conversation and the tool registry
The real layers behind one reply, as shown in the hosted dashboard.

Two indexes: identity and memory

A bad or manipulative conversation can add noise to memory, but it can't overwrite the character's core. Embeddings use all-mpnet-base-v2 with a FAISS index (cosine similarity).

Diagram of dual memory: a read-only identity store beside a dynamic memory store for life experience

Soul scripts

A soul script is a structured Markdown document that defines a character: values, voice, origin, boundaries, how it reads people, how it reasons, and what it will and won't do. Each ## section should be a self-contained idea, because sections are what gets retrieved. Typical sections:

The download includes example soul scripts, among them Codex Animus, a character built to help you write your own. Our guide on how to write an AI character prompt that holds up walks through it.

Quickstart

Requirements: Python 3.10 or newer (3.11 recommended), or Docker. The first launch downloads the embedding model (about 420 MB), which is cached afterwards.

Run locally

# unzip soulscript-engine.zip, then:
cd soulscript-engine
pip install -r requirements.txt

cd soul_script-engine-ui-test-example
python -m uvicorn web.app:app --host 127.0.0.1 --port 8989

Open http://localhost:8989. On Windows, if unzipping complains that a path is too long, extract to a short folder such as C:\se\.

Run with Docker

cd soulscript-engine
docker compose -f soul_script-engine-ui-test-example/docker-compose.yml up --build -d

Settings and memories are kept in mounted folders, so they survive restarts.

Connect a model

Open Settings → Add Connection and enter a base URL, an API key (blank for local servers) and your models. Any OpenAI-compatible endpoint works:

BackendBase URL
OpenAIhttps://api.openai.com/v1
Ollamahttp://localhost:11434/v1
LM Studiohttp://localhost:1234/v1
OpenRouterhttps://openrouter.ai/api/v1

Anthropic is supported through a native client.

Don't want to self-host? The hosted dashboard runs the same engine with no setup, syncs your characters and memories across devices, and connects them to Claude and other MCP clients. New accounts get $2 in free credits.

What's in the download

soulscript-engine/
├── Soul Scripts/                       example soul scripts and system prompts
├── soul_script-engine-ui-test-example/ the runnable web app
│   ├── profiles/                       agent config (model, provider, tools)
│   ├── prompts/                        base system prompts
│   ├── directives/                     on-demand rule files
│   ├── src/memory/                     FAISS indexes, chunker, memory vault
│   ├── src/llm_client/                 OpenAI-compatible, Ollama, Anthropic
│   ├── src/tools/                      tool registry
│   └── web/                            FastAPI app and UI
├── whitepaper.txt                      design rationale
├── UNIQUE-AGENT-BEHAVIOR.md            side-by-side agent examples
├── LICENSE                             GNU AGPL v3
└── LICENSE.md                          commercial license

Known limitations

For game developers

The same architecture works for NPCs: a stable identity, memory of the player, and fast switching between characters, since switching is just loading a different profile and index. Pair it with text-to-speech and speech-to-text for voiced characters, all on your own hardware with a local model. See how to build AI game NPCs with a personality that lasts.

Pairs with SoulScript Loop

The Engine keeps a character who they are. SoulScript Loop keeps one persona running between conversations, on her own clock, with a field of perception she sees through. Plug the Engine into the Loop and the identity is re-anchored on every tick.

License

SoulScript Engine is dual-licensed. You only need one:

Characters and agents you build with the engine are yours. SoulScript™ and OrionForge™ are trademarks of Trent Hunter; forks need a different name, and "built with SoulScript Engine" is welcome.