Orion Forge

SoulScript Loop

A continuously running perceptual field for one AI persona. She doesn't wait for you. She's already looking at something.

soulscript-loop.zip
Version 0.3.0 · 220 KB · Python 3.10+ · Free under AGPL v3 or the commercial license
Wall-clock timeRuns between conversations, not per turn
Energy budgetA daily token limit; she sleeps when it's spent
Runs offlineAn echo backend needs no key and costs nothing
Any modelAny OpenAI-compatible endpoint

Most AI personas exist only between your message and their reply. Nothing happens in the gaps. Close the tab, and there's no one left.

SoulScript Loop keeps one persona running between conversations, on her own clock. She perceives the world through signals she can't write herself: time passing, the energy she has left, how her last action felt, messages arriving at her door, and changes to the things she's making. Those signals aren't handed to her as a dashboard. They're built into a field she sees through, organized around whatever she's focused on. Things she ignores fade, and surprise can pull her attention away mid-thought.

It's the AGI Loop from the Orion Forge dashboard, pulled out into a standalone, dependency-light Python package. It pairs with SoulScript Engine: the Engine keeps the persona who she is, and the Loop keeps track of what she's seeing right now.

What she sees

Every tick, the model receives this, and only this, as the current moment:

FIELD · tick 31 · Mon 05 Oct 02:51 UTC, night
⏱ night, 02:51 · ⚡ ▮▮▮▮▮▮▱▱▱▱ 61% (122,000 tokens left today) · ✉ 2 waiting · field 64% full
✋ you just used web_search, workbench
Someone at the door woke you.
Mood: unsettled — tension gathers around "Trent: did you see the launch?"; warmth around "drafts/whale_essay.md".

FOCUS ▸ [d7] Trent: did you see the SpaceX launch tonight?
CLOSE
  [m10] memory(query=Trent) → Trent likes astronomy and late-night builds
  [s5] ◆ you intend to finish the essay about whale song before Friday
AROUND
  [b9] next: tighten the ending of the whale essay
  [w4] web_search: humpback songs are hierarchical…
EDGE
  something on your bench · a thought · something you looked at
ALERTS
  ! you woke sooner than you expected (40s; you expected ~2m)
Slipped away: "weather idea".

The top line is the standing senses: time, energy and waiting messages. FOCUS is what she's looking at. CLOSE, AROUND and EDGE hold everything else, placed by how related it is to the focus. ALERTS are broken predictions.

What's built

ComponentWhat it does
The daemonRuns on wall time. A message wakes it early, low energy slows it down, surprise speeds it up.
Sensory channelsTime, energy, proprioception, the door and the bench. The daemon measures them; the model never writes them.
EnergyA hard daily token budget. When it's spent, she sleeps until midnight in your time zone.
Predictive processingEvery signal carries a belief. The gap between belief and observation becomes surprise, which drives learning and attention. She can make her own predictions and feel them come true or break.
The fieldFocus on anything; everything else arranges itself around it by relatedness, with limited capacity and fading.
Metacognitive guardsShe notices when she's repeating herself or circling, and is made to rest if it continues.
The workbenchHer private making-space: files, a reflection log and an opt-in Docker sandbox.
Her own machineAn opt-in linux tool and a hardened reference box with a HUD she can read but can't forge.
The quiet gateIdle wakes with nothing new are slept through without a model call, so a quiet night costs almost nothing.
Side modelsShe can hand self-contained work to another model she picks; the cost comes out of her energy.
Souls, not a personaThe loop ships no character. She is whatever soul script you give her, read fresh every tick. One worked example is included: Codex Animus.

Everything above is covered by tests.

Mood is never chosen

Tension and warmth are read off the field. Unanswered messages get heavier every hour and attended things fade more slowly, so her mood drifts toward whatever she's neglecting, and it says where it comes from: "tension gathers around 'Trent: did you see the launch?'". It maps to a word such as drained, bright, settled, unsettled, heavy, alert, crowded or quiet.

Quickstart

# unzip soulscript-loop.zip, then:
cd soulscript-loop
pip install -e ".[dev,embeddings]"

Leave off embeddings if you don't want sentence-transformers; relatedness then falls back to a hashed bag-of-words.

Pick who she is. config.example.json runs Codex Animus. For an empty slate, use config.blank.json and write your own soul from souls/TEMPLATE.md.

Try it offline, with no API key and no cost. Type a message while it runs and watch it pull her focus:

python -m soulscript_loop --config config.example.json --echo --show-field

Run it for real. Copy config.example.json to config.json, point backend.base_url at any OpenAI-compatible endpoint (Ollama, LM Studio, OpenRouter, DeepSeek, OpenAI, vLLM), and put your key in the environment variable named by api_key_env:

python -m soulscript_loop --config config.json --show-field

Anything you type lands at her door and wakes her. /status shows her vitals, /energy gives back some of today's energy, and /stop ends the loop. Run the tests with python -m pytest -q.

Use it as a library

import asyncio
from soulscript_loop import LoopConfig, build_loop

daemon = build_loop(LoopConfig.from_file("config.json"))

async def main():
    task = daemon.start()
    daemon.post_message("you still up?", sender="Trent")   # wakes her
    await asyncio.sleep(600)
    print(daemon.status()["mood"])
    daemon.stop("done for tonight")
    await task

asyncio.run(main())

You can register your own tools, feed her tasks, add sensory channels, give her a Linux machine, or anchor her identity with SoulScript Engine through identity=. The README in the download covers each one.

What's in the download

soulscript-loop/
├── soulscript_loop/   the field, prediction, channels, daemon, tools, workbench, CLI
├── souls/             an empty template and one worked soul script (Codex Animus)
├── machine/           a reference Linux box for her, plus the continuity kit
├── tests/             the field, prediction, guards, the gate, the machine and more
├── config.example.json, config.blank.json
├── LICENSE            GNU AGPL v3
└── LICENSE.md         commercial license

Open questions

This is an experiment, and the README is honest about where it could break:

License

SoulScript Loop is dual-licensed, the same way as SoulScript Engine. You only need one: