In DSH’s plugin ecosystem, dynamically injecting prompts for different scenarios is a common requirement. The traditional approach usually writes prompts into the session context, which causes context pollution: the injected content permanently remains in the conversation history, affecting the accuracy of subsequent reasoning and token consumption. dsh-universal-worldbook addresses this issue. It provides a Tavern-style universal worldbook and can perform request-level prompt injection. The injected content exists only in the current request and does not pollute the context.
Core Features¶
- Request-level injection with no contamination: Injection occurs during the
llm/streamrequest rewriting stage. The content exists only in the outbound request copy, is never attached to the Session, and previous injections do not enter subsequent turn contexts. The injection position is always at the front of D0, and cache hits are all before D2. - Flexible triggering mechanism: Supports persistent triggering, keyword matching, and regex matching. Provides the same filter logic as Tavern (match all / match any / not all / not any). Primary keywords are always combined with OR logic. The scan depth is adjustable (1~5).
- lore_lookup tool: Supports index-style entries that declare the existence of child entries. The main Agent can call this tool to query child entry details on demand. Query results are stripped each turn (removed from tool-call/tool-result before D0), so they do not pollute subsequent context.
- D1 turn tracker: Used to anchor the “final content of the previous turn”.
- UI and data management: Provides a Tavern-style UI, supports drag-and-drop reordering, autosave, JSON import/export, scope switches, and hit preview. Data is stored in
DSH_HOME/WorldBook/, compatible with Tavern worldbooks, with code and data separated.
Installation and Enabling¶
The web version installation command is as follows:
dsh plugin --profile web add github:TritiumWang/dsh-universal-worldbook
The desktop version installation command is as follows:
dsh plugin --profile desktop add github:TritiumWang/dsh-universal-worldbook
Typical Usage¶
- Tool-call querying: Configure “index-style” entries to declare the existence of child entries, and register the
lore_lookuptool in the Agent configuration. The Agent can then invoke this tool based on context to retrieve details. - Scan depth adjustment: Adjust the matching scan depth (1~5) using the scan depth slider to control the scan range of the matching logic.
- Prompt customization: Customize prompt content using universal header/footer prompt blocks.
Applicability and Notes¶
- Privacy and permissions: The plugin only reads/writes
DSH_HOME/WorldBooklocally, with no outbound network traffic. Privacy settings includecloud=false,offlineMode=true, andretention=none. - Diagnostics: You can export outbound context snapshots with the environment variable
DSH_UWB_TRACE=1, record an injection journal withDSH_UWB_JOURNAL=1, and record debug logs withDSH_UWB_DEBUG=1. - Data persistence: When upgrading the plugin, data and code are separated, so data is not lost.
dsh-universal-worldbook provides DSH users with a lightweight, pollution-free prompt management solution, achieving dynamic context isolation through the tool-call mechanism.