Full-Stack Projects
Scene Inference Lab (SCIL)
This project is an experimental NodeJS based web application, that allows you to explore AI assisted story telling or role-playing. I imagine you could create AI players with custom prompting to help you learn foreign languages, too.
(If I remember correctly, the download package has a modification I added for someone learning Korean, with a button on the dialog screen that pops up a Korean keyboard and which keeps a âglossaryâ. You can highlight words in the player dialog and have them be translated into the glossary for you with sample phrases.)
The app uses an SQLite database with an embedding vector extension for semantic queries. It is made to use local LLM models on your computer, rather than online APIs.
In order to test it, you need to have either LM Studio installed locally (API mode) and start its inbuilt server, or have a locally deployed GGUF files (LLM and vector model) on your computer. Edit the .env file in the source tree (see Downloads below) to specify which model files you wish to use and where they are.
Once you run the Node app, you can access its port using your browser.
General Description
Scene Inference Lab is scene-based. You define a âworldâ and its players (called agents), and then craft interactions between them in chunks called âscenesâ. Scenes consist of a number of dialogs or turns between characters (you do or say something, then the agent replies and does something, and so on).
When a scene is finished, you can create an AI generated synopsis. Characters are âsmartâ in the sense that their AI prompts evolve and grow over time, and prior dialogs are injected into your playerâs prompt so their behaviour can be surprisingly dynamic.
The synopses are helpful to reduce the âcontext windowâ that the AI models needs to support, as the worlds get larger. SCIL keeps a tally of the total number of tokens for each dialog in the scene, and when that token exceeds the modelâs capabilites, scene and character synopses are used instead of the full dialogs.
The App is divided into multiple âtoolâ screens.
Generator
Use the Generator first to create your story âworldâ. This information becomes part of each characterâs prompt as âcommon knowledgeâ. If you prefer not to specify your own characters (next step), the AI can randomly generate characters for your, based on your world description.
Scene Editor
A scene is based on the (theatrical) description of a place or situation. A scene consists of dialogs. A dialog is one exchange (prompt-response) between two characters - typically you and an AI agent, but you can simulate multi-player parties in the âgameâ screen (Basic Inference).
Agent Editor
Next, you can specify your characters in the Agent Editor. SCIL dates back a few years, when agentic workflows where not the norm yet. The idea then and now is to run multiple passes of the LLM per turn, refining the output in steps.
Each Character has a Play prompt, which defines how it behaves. It also has a Forward prompt. The Forward prompt evaluates the dialogs and scenes so far, and injects new plans or motivations into the âplanningâ part of your character, and actually modifies the âPlayâ prompt. There is also a checker prompt, which constrains the âstyleâ of the characters output.
Basic Inference
This module is the actual âgameâ. It lets you step through and add to the dialogs in the current scene. Dialogs can be edited, or âreplayedâ.
Style Tuner
The style tuner allows you to step through the dialogs of a scene, and give the AI feedback on how good they remain âin characterâ. You can do this by checking a box, âgreatâ, or by editing what an agent said and telling what was wrong with the response. This will be stored with your checker prompt for the next rounds of dialog.
Vector Expert
SCIL uses an SQLITE plugin for maintaining an (embedding) vector database. What this means is that you can store and retrieve âknowledgeâ based on similar meaning. For example if you feed the dialogs into the DB, you can then ask about the age of one of the characters, and the retrieval query might pick up on fact that at some point, the agent was described as walking with a cane. So it might suggest that they are perhaps elderly. Things like that.
The Vector Export lets you add âloreâ to your world, which the characters can explore (i.e. include in their âstateâ) when you hit the âPlanâ or âWonderâ buttons in the game screen. So for example when you hit âWonderâ, the agent will come up with a piece of knowledge they might want to know, and then that question gets passed to the vector/knowledge database. If an answer is found, it will be added to the agentâs memory.
Downloads
Package includes the NodeJS app, but you will need to download LM Studio or a GGUF model file from HuggingFace for instance. The SQLite DB file and a few built-in prompts for the system are created when you start the server. This app is just a proof-of-concept though, and not user-friendly.