LLM-powered memory for long roleplays.
Threadkeeper extracts key facts from your chat messages using an LLM and quietly injects them into every prompt โ so your model never forgets what matters, no matter how long the conversation gets.
Built for DreamTavern ยท SillyTavern Extension ยท v1.0.2
When you roleplay for hundreds of messages, your LLM eventually loses track of earlier details like character traits ๐ญ, relationship dynamics ๐, plot points ๐, important items ๐๏ธ, and locations ๐บ๏ธ. ThreadKeeper fixes this by:
- Scanning your chat messages in batches ๐
- Extracting key facts using a fast, cheap LLM call ๐ง
- Injecting those facts into every prompt automatically ๐
The result: your model "remembers" things from 200 messages ago as if they just happened.
Almost nothing. A typical scan of 100 messages uses a fast model like gpt-4o-mini or claude-3-haiku and costs less than $0.01. The extracted facts usually take up around 400 tokens in your prompt, far less than the raw chat would have used.
- Open SillyTavern or DreamTavern
- Go to Extensions โ Install Extension
- Paste this repo URL:
https://github.com/selinawynters-ops/ST---ThreadKeeper/ - Click Install
- Enable the extension
- ThreadKeeper appears in your Push Modal menu โจ
- Download or clone this repo
- Copy the
ST---ThreadKeeperfolder into:
SillyTavern/data/default-user/extensions/ST---ThreadKeeper/
- Restart SillyTavern
- Enable the extension in Extensions โ Manage Extensions
- Click ThreadKeeper in the Push Modal section of the left sidebar menu
- Or type
/threadkeeper openin the chat
ThreadKeeper opens as a terminal-style popup with a familiar feel:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ โ โ ๐ฎ threadkeeper ยท dreamtavern โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โถ extract โณ re-extract โ preview โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ $ threadkeeper v1.0 โ
โ Loaded chat: Luna ยท 142 messages โ
โ 12 facts in memory (3 pinned) โ
โ โ
โ โcharacter Luna has silver eyes โ
โ โrelation Luna trusts Marcus deeply โ
โ โevent The crystal shattered โ
โ โlocation The tavern is in Westmarch โ
โ $ โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
brave_bkwkrgFmFG.mp4
| Button | What it does |
|---|---|
| โถ extract | Scan new messages since last extraction (incremental) โก |
| โณ re-extract | Re-scan all messages from the beginning while keeping pinned facts ๐ |
| โ preview | Show exactly what gets injected into your prompt ๐ |
| โ settings | Open the settings panel |
Each extracted fact is tagged with a category:
| Tag | Category | Color | What it captures |
|---|---|---|---|
chr |
Character | Purple | Traits, appearance, abilities, personality |
rel |
Relationship | Pink | Bonds, trust, conflict, romantic dynamics |
evt |
Event | Cyan | Key plot events, turning points |
itm |
Item | Amber | Important objects, weapons, artifacts |
loc |
Location | Green | Places, settings, geography |
plt |
Plot | Orange | Story arcs, mysteries, goals |
Use the filter buttons in the toolbar to show only certain categories.
Hover over any fact to see action buttons:
- ๐ Pin โ Pinned facts are always remembered, even during re-extraction. They get priority prompt space.
- โ Source โ Scrolls to and highlights the original chat message where the fact was found.
- โ Delete โ Remove a fact you do not need.
Type these in the SillyTavern chat input:
/threadkeeper open โ Open the terminal
/threadkeeper extract โ Run incremental extraction
/threadkeeper reextract โ Run full re-extraction
/threadkeeper facts โ List all current facts
/threadkeeper clear โ Clear all non-pinned facts
/threadkeeper wipe โ Wipe ThreadKeeper data from settings and saved chats
Click โ settings in the toolbar to configure ThreadKeeper. Everything is written in plain language.
| Setting | What it means |
|---|---|
| Use connection from | Pick one of your saved connection profiles. The API key is read automatically, so you do not need to re-enter it. |
| Model for scanning | Choose which model extracts facts. A fast, cheap model is usually best, like gpt-4o-mini. |
| Accuracy | Slider from "Precise" to "Creative". Lower means facts are more literal and exact. Higher means the model interprets more freely. |
| Setting | What it means |
|---|---|
| Max remembered facts | The most facts ThreadKeeper will keep. When the limit is reached, the oldest non-pinned facts are replaced. Default: 100. |
| How much prompt space to use | How many tokens the facts take up in your prompt. Small (~250), Medium (~500), or Large (~800). |
| Keep pinned facts across chats | When enabled, pinned facts carry over when you start a new chat with the same character. |
| Setting | What it means |
|---|---|
| Auto-scan every __ messages | Automatically extract new facts after this many messages. Set to 0 for manual-only mode. |
| Include hidden messages | Also scan messages hidden from the chat view, including some system messages. |
| Extraction tone | Choose how facts are worded: Polite (clean, neutral prose) or Dog Me Out (raw, explicit, unfiltered language with profanity allowed). |
| Facts per batch | Set the minimum and maximum number of facts to extract in each LLM call. Min: 1, Max: adjustable (default: 15). |
| Setting | What it means |
|---|---|
| Injection position | Where facts appear in the prompt. |
| Injection depth | How many messages from the bottom the facts are inserted. Default: 4. |
ThreadKeeper offers two extraction modes to suit your roleplay style:
Polite (SFW) โ Default mode
- Extracts facts in clean, neutral prose
- Sanitized language without explicit content descriptions
- Perfect for general roleplays and PG content
- Example: "Luna trusts Marcus" or "The tavern is located in Westmarch"
Dog Me Out (NSFW) โ Explicit/unfiltered mode
- Extracts facts raw and explicit, without softening or euphemisms
- Profanity is allowed and encouraged when it authentically captures the content
- Perfect for adult/mature roleplays where explicit details matter
- Includes: physical traits, kinks/preferences, power dynamics, explicit acts
- Example: "Luna is a shameless fucking exhibitionist with a size kink" or "Marcus dominates and fucks Luna โ she begs to be called his slut"
- Visual indicator: The "Dog Me Out" button appears in red to clearly signal NSFW mode
Control how many facts are extracted in each LLM call:
- Min facts: Minimum number of facts to extract (default: 1)
- Max facts: Maximum number of facts to extract per batch (default: 15)
Adjust these to balance extraction quality and token usage. Higher max values gather more facts per call but use more tokens.
Do not forget to click Save after changing settings. ๐พ
Open demo.html in any browser to see a fully interactive preview of ThreadKeeper's UI without launching SillyTavern.
The demo simulates:
- the terminal popup with sample facts
- extract and re-extract animations
- fact filtering, pinning, and deletion
- settings panel with all controls
- injection preview
For the curious or the tinkerers:
- Extraction: Uses SillyTavern's
generateRaw()API, the same system Memory, Vectors, and Expressions use. - Injection: Uses
setExtensionPrompt(), the same family of prompt injection used by features like Author's Note and World Info. - Storage: Facts are saved in
chat_metadata.threadkeeperon chats, and related settings live inextension_settings.threadkeeper. - Batching: Messages are processed in chunks to stay within token limits.
- Deduplication: Existing facts are included in extraction context so the model avoids repeating them.
- Budget management: Pinned facts always get priority. When the token budget is tight, the oldest non-pinned facts are trimmed first.
| Situation | What happens |
|---|---|
| Normal in-app uninstall | uninstall.js contains extension-local cleanup helpers. |
| Manual cleanup command | /threadkeeper wipe removes ThreadKeeper data from settings and saved chats. |
| Extension removed while files still exist | ThreadKeeper can clean itself up. |
| Folder manually deleted from disk | Cleanup after that requires the optional ST-side patch bundle in patches/. |
ST---ThreadKeeper/
โโโ manifest.json
โโโ index.js
โโโ uninstall.js
โโโ style.css
โโโ mobile-style.css
โโโ demo.html
โโโ LICENSE
โโโ README.md
โโโ patches/
โโโ manual-delete-cleanup.patch
โโโ README.md
| File | Purpose |
|---|---|
manifest.json |
Extension metadata ๐ชช |
index.js |
Main extension logic and UI ๐ง |
uninstall.js |
Uninstall and wipe helpers ๐งน |
style.css |
Main styling ๐จ |
mobile-style.css |
Mobile-specific styling ๐ฑ |
demo.html |
Standalone UI preview ๐ฅ๏ธ |
patches/manual-delete-cleanup.patch |
Optional ST-side patch for manual folder deletion cleanup ๐ฉน |
patches/README.md |
Patch install notes ๐ |
ThreadKeeper does not appear ๐ป
- Make sure the extension is enabled in Extensions โ Manage Extensions
- Try refreshing SillyTavern
- Restart the app if needed
Extraction returns empty results ๐ซฅ
- Check that your connection profile has a valid API key
- Try a different model
- Check the browser console for JSON or provider errors
Facts are not being injected ๐ญ
- Use preview inside ThreadKeeper to inspect the injected text
- Make sure the extension is enabled
- Check that injection position and depth are set sensibly
You want manual folder deletion cleanup ๐๏ธ
- Apply the optional patch bundle in
patches/
- Built by Dreamweaver for the DreamTavern community
- Powered by SillyTavern
"The thread remembers what the model forgets." ๐งต