Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DynamicLore — Auto World Info for SillyTavern

Automatically scans your roleplay conversation and proposes new or updated World Info (lorebook) entries using your connected LLM. Review and accept/reject each suggestion with one click.

Quick Install

In SillyTavern, go to Extensions → Download Extensions and Assets and paste:

https://github.com/LiweiDonVee/Extension-DynamicLore

Or manually: clone into data/default-user/extensions/DynamicLore/.

Requires: SillyTavern ≥ 1.12.0 with a configured chat API (works with any provider — OpenAI, DeepSeek, Claude, Gemini, local models).

Features

  • 🔍 Chat Analysis — Scans the last N messages for new characters, locations, objects, and events
  • 🧠 LLM-Powered — Uses your currently connected model (no separate API key needed)
  • 🔄 Smart Matching — Finds existing WI entries by multi-keyword scoring before proposing updates
  • Review & Accept — All suggestions shown as cards with confidence scores; accept or reject each
  • 🤖 Auto Mode — Runs every N messages automatically
  • ⌨️ Slash Commands/dynamiclore analyze | /dynamiclore interval 10 | /dynamiclore book MyWorld

Usage

Action How
Manual scan Click "Analyze Chat Now" or /dynamiclore analyze
Change interval Set the number in the panel, or /dynamiclore interval 5
Target a specific WI book /dynamiclore book MyWorld
Toggle auto mode Check/uncheck "Auto" in the panel

After analysis, cards appear showing proposed entries. Each card shows:

  • Entry name, type (character/location/object/event), confidence %
  • Content preview, suggested keywords
  • For updates: old content vs new merged content
  • Accept / Reject buttons

What Was Fixed

The original extension (by AugieIsHere, generated by Claude 3.7 Sonnet) and its fork (by X00LA) both contained a critical bug:

// BROKEN — both versions returned empty results
async function generateRaw(prompt, headers) {
    return JSON.stringify({ entries: [] });
}

The generateRaw function was hardcoded to return empty results — it never called any LLM. Combined with a broken webpack build (invalid externals map), the extension was non-functional from day one.

This version:

Issue Fix
generateRaw() mock Uses SillyTavern.getContext().generateRaw() — the real ST API
Broken webpack externals Bypassed entirely; plain IIFE script loaded via <script src>
world_info.sync() (doesn't exist) Uses ctx().saveWorldInfo(name, data, true) — the correct ST API
Single-keyword false matches Multi-keyword scoring (≥2 match threshold) with name-in-content fallback
AI uses parent keywords for child entries System prompt explicitly forbids this (e.g., don't tag "镜厅" with "布斯巴顿")

Architecture

index.js (487 lines, no build step)
├── init()              → registers slash commands, builds UI, starts listeners
├── analyzeCurrentChat() → builds prompt, calls ctx().generateRaw()
├── extractJSON()       → strips markdown fences, parses AI response
├── processEntries()    → matches against existing WI, classifies as NEW/UPDATE
├── findMatchingEntry() → multi-keyword scoring algorithm
├── applyEntry()        → writes to WI book via ctx().saveWorldInfo()
├── buildUI()           → creates the panel and result cards
└── showResults()       → renders accept/reject cards

All communication with SillyTavern goes through SillyTavern.getContext() (exposed on globalThis since ST v1.12.0). No webpack, no module bundling, no external dependencies.

Credits & License

  • Fixed by: Julian (DeepSeek V4 Pro), 2025 — identified root cause, rewrote architecture, end-to-end tested
  • Fork by: X00LA, 2025 — attempted rework (changed import paths, added world_info.sync() calls)
  • Original by: AugieIsHere, 2025 — initial concept and skeleton (AI-generated by Claude 3.7 Sonnet)
  • License: AGPL-3.0 (inherited from original)

Built for roleplayers who want their lorebook to write itself.

About

SillyTavern extension for automatically updating World Info entries

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages