Mid-Gen Lorebook Injector
Monitors generation for Lorebook keywords (including complex A & B logic) and restarts generation immediately to force context injection.
Description
Normally, the AI only recognizes your Lorebook entries that are already activated/in-context BEFORE you hit Send.
IF the AI Model happens to mention an activation key word to a currently inactivated/not-in-context Lorebook during text generation, it will not activate said Lorebook until AFTER text generation stops/finishes. Therefore in these situations, it hasn't actually read/seen that specific entry yet, so it might start making up random/inaccurate details about it!
This script monitors the token stream for inactive Lorebook keywords (including complex Advanced Condition Regex A & B logic). When a new key is detected mid-generation, it interrupts the process, to allow the triggered Lorebook to activate & enter the AI's visible context aka it injects the relevant Lorebook info, and then continues streaming. In short it enables mid-generation Lorebook context injection, eliminating the one-turn latency usually required for Lorebook activation.
Note: It comes with a toggle and supports existing entries with Advanced Conditions.
I'm not 100% sure if it only works when you want it to or not aka false triggers. I believe I worked out all the kinks.
Scope Information
You can use either. If not all your stories are Lorebook heavy, just use on a Per Story basis.
License & Attribution
Similar Scripts
Character Commentator
Get Hypebot messages from the characters in the current story.
RPG Stats V2
Automatically detects +/- patterns and updates stats accordingly
Automatic Chapter Summaries (by Lane)
Whether undo/redo operations across chapter boundaries automatically remove/re-add the appropriate entries. (Potentially slow operation).
Mid's Memory Manager
global memory management and chunk-based local memory building