Skip to content
 
 

Repository files navigation

SillyTavern zTracker

Overview

A SillyTavern extension that helps you track your chat stats with LLMs using connection profiles.

Forked from SillyTavern WTracker.

Highlights (since the fork)

  • Optional Sequential generation (generate trackers in smaller steps).
  • Modules let one chat run separate trackers for different use cases, each with its own schema, prompts, generation, injection, and auto-generation settings.
  • Modules can chain in other Modules' tracker history as generation context via Include Module History, in addition to their own self-history.
  • The extension settings are grouped into Tracker Generation and Tracker Injection sections so generation tuning and prompt-context embedding are easier to find.
  • Regenerate only what you need from the parts menu (one section, one list item like a character, or even one field).
  • Clear and recreate stale tracker sections with a cleanup action when several parts are wrong at once.
  • Manual tracker generation now shows a message-local status badge while the full tracker or a parts-menu update is in flight, so the active tracker job stays visible even if the initiating control scrolls away.
  • Filter World Info used for tracker generation (allow only selected lorebooks/entries when needed).
  • Exclude specific characters from Auto Mode directly from the character panel when you do not want zTracker to auto-generate trackers for them.
  • Optional embed recent tracker snapshots into normal generations for better continuity (either full JSON or a compact plain-text format).
  • Tracker generation now preserves speaker labels in prompt context where available, so turns like Tobias: and Bar: stay clearer for pronoun-heavy scenes.
  • Normal instruct-mode chat interception also preserves speaker labels when SillyTavern stores them on source messages instead of flattening them directly into turn content.

zTracker follows the SillyTavern chat type of whichever connection it is currently using for tracker generation. In Connection Source = Use current active SillyTavern connection mode, zTracker resolves tracker-generation connection state from the live SillyTavern runtime, including the currently active prompt selectors and any host-exposed active connection changes. In Connection Source = Use selected saved connection profile mode, zTracker uses the pinned saved profile you selected in zTracker settings.


Modules

In Extensions -> zTracker, use Modules when you want more than one tracker in the same chat, such as a scene tracker plus an agenda tracker. Each Module has its own schema presets, prompt templates, system prompt source, connection settings, generation behavior, injection settings, and auto-generation toggle.

The original single tracker is upgraded into the Default Module the first time this version runs. That settings format upgrade is one-way. Existing saved tracker data, current-chat schema choices, and character auto-mode exclusions are preserved under the Default Module.

You can add, clone, reorder, delete, export, and import Modules from the settings panel. Export downloads a .json file with the Module's full configuration (schema presets, prompts, system prompt, connection, generation, and injection settings); Import reads such a file back through a file picker. Deleting a Module also removes that Module's saved tracker data from the current chat history.

When more than one Module is enabled, the message truck button opens a Module chooser for manual generation. Disabling a Module removes it from generation, injection, and that chooser, but already-saved tracker blocks stay visible until you delete them.

Chaining tracker history across Modules

Each Module has an Include Module History list under Tracker Generation that controls which Modules' past tracker snapshots are pulled into that Module's own generation context, separate from Tracker Injection's embedding into normal generations. Every Module always has a self entry for its own history, which stays bound to that Module's raw message window like before. Chained entries (for other Modules that generate earlier than the current one) are not limited by that window at all - they are found directly from chat history and included as extra context ahead of the window. A count of 0 on any entry (self or chained) means that entry contributes nothing.

A Module can only chain in another Module that is listed earlier in the Generation Order view (a dedicated list of all Modules in generation order, since Modules already generate in that order for each message). If a chained Module is later disabled or reordered so it is no longer earlier, that entry goes dormant (shown with a warning icon) and stops contributing until you fix the order, re-enable the Module, or remove the entry. Chained snapshots are always formatted using the referenced Module's own Tracker Injection settings (header, virtual-character mode, transform preset).

Installation

Install via the SillyTavern extension installer:

https://github.com/Zaakh/SillyTavern-zTracker

FAQ

I'm having API error.

Your API/model might not support structured output. Change Prompt Engineering mode from Native API to JSON, XML, or TOON.

zTracker UI buttons / schema popup are broken (template 404).

In Extensions → zTracker, enable Debug logging and use the Diagnostics panel (stethoscope button) to print template URL checks to the console. This helps confirm whether SillyTavern can access the extension’s HTML templates.

Connection source for tracker generation

zTracker can now choose where tracker-generation connection settings come from:

  • Use current active SillyTavern connection: resolve tracker-generation connection data from the live SillyTavern runtime, including the currently active prompt selectors and any host-exposed active connection changes.
  • Use selected saved connection profile: keep tracker generation pinned to a specific saved SillyTavern connection profile.

This is useful when you want tracker generation to automatically follow your current SillyTavern connection during experimentation, while still keeping the option to pin zTracker to a dedicated extraction profile when needed. If you rely on live unsaved host changes, do a quick smoke test after SillyTavern upgrades.

System prompt selection for tracker generation

zTracker can now choose the system prompt used during tracker generation:

  • From active SillyTavern presets: use the currently active host prompt settings.
  • From selected connection profile: use the prompt selectors stored on the chosen zTracker connection profile. For Chat Completion profiles, zTracker uses the profile preset. For Text Completion profiles, zTracker uses the profile's instruct, context, and system-prompt slots.
  • From saved ST prompt: pick a saved SillyTavern system prompt specifically for tracker extraction.

On startup, zTracker installs a recommended versioned system prompt preset such as zTracker-1.3.1 if it does not already exist. You can select it in Extensions → zTracker → System Prompt Source, and edit it later in SillyTavern's own System Prompt manager. Older zTracker prompt presets are not deleted automatically.

This is especially useful for smaller models: you can keep your roleplay-oriented system prompt for normal chat, while using a lean extraction-oriented prompt for tracker generation.

Sequential generation & per-part regeneration

In Extensions → zTracker, enable Sequential generation to have zTracker generate tracker fields one-by-one (smaller, sequential requests).

If you want to avoid low-context tracker updates at the start of a chat, set Skip First X Messages in Extensions → zTracker. A value of 0 keeps the old behavior; higher values prevent first-time tracker generation on early messages until the threshold is reached. Explicit full redo of an already existing tracker still works there.

If character-card prose is adding noise to extraction, enable Skip character card in tracker generation in Extensions → zTracker. The setting is off by default, and when enabled it makes tracker generation ignore character-card prompt fields such as description, personality, and scenario.

If the model seems to over-weight who said a line instead of the scene content itself, change Conversation role handling in Extensions → zTracker from Preserve user and assistant roles to Treat all chat turns as assistant. This only changes how zTracker labels chat turns during tracker-generation requests; it does not affect normal chat generation or tracker snapshot injection.

If a specific character should never trigger zTracker automatically, open that character's panel and click the zTracker truck toggle in the avatar action row. This excludes that character from Auto Mode only; manual tracker generation from message controls still works.

When a tracker is rendered on a message, use the tracker controls:

  • Regenerate Tracker (rotate icon) regenerates the whole tracker.
  • Parts menu (list icon) lets you regenerate an individual top-level field (e.g. time, location, topics) without regenerating everything.
  • Cleanup (eraser icon) lets you clear several wrong tracker targets at once, then either leave them pending or recreate them in one coordinated run.

While a manual full tracker generation or regeneration is running, zTracker shows a message-local Updating tracker badge above the target message. Auto Mode keeps using its existing Generating tracker before reply hold indicator instead.

For array parts (e.g. characters), the parts menu also exposes:

  • Per-item regeneration (by stable identity when available).
  • Per-field regeneration inside an item (e.g. regenerate characters (Silvia).outfit).

While one of those menu actions is running, zTracker shows a message-local Updating tracker from menu badge above the target message. This keeps the active job visible without hijacking the main send button or implying that normal chat generation is paused.

If several related tracker values are wrong at once, use Cleanup instead of fixing them one by one. You can select top-level parts, whole array items, or specific item fields, then choose either:

  • Clear and recreate selected targets to remove stale values before regenerating them.
  • Clear selected targets only to leave them blank and marked as pending until you want to retry later.

Pending cleanup targets stay visible in the tracker UI so you can see which sections were intentionally cleared and still need attention.

Tracker templates now escape normal tracker values by default. If you previously relied on raw HTML inside tracker data fields, update the template to opt out deliberately instead of assuming those values will render as live markup. When a saved tracker can no longer render with the current template, zTracker keeps the stored data and shows a message-local warning so you can repair the template or tracker JSON without losing the underlying tracker.

Optional (advanced): you can annotate your JSON schema preset to help zTracker keep interdependent sections ordered and array items stable:

  • x-ztracker-dependsOn: top-level part ordering hints for sequential generation.
  • x-ztracker-idKey: which string field to use as the array-item identity for per-item regeneration (defaults to name).

When editing a schema preset's JSON or HTML in Extensions → zTracker, changes stay local until you click a Save icon. Saving either editor now persists the current JSON and HTML preset pair together. The save controls stay disabled while the paired draft is unchanged or invalid, and invalid drafts show an inline error instead of overwriting the saved preset.

In Extensions → zTracker, Default Schema Preset controls which preset definition you are editing and which preset new chats start from. Existing chats keep their own Current Chat Schema Preset, which you can change from the settings UI or Extensions → Modify zTracker schema.

Changing the current chat schema preset is still a lazy switch, not a chat-wide migration. Future full tracker generations in that chat use the current chat schema preset, while existing trackers on older messages keep their saved message schema until you run a full tracker regeneration on that specific message. Parts-menu regeneration continues to use the saved message schema and tells you when a full tracker regeneration is required to move that message onto the current chat schema.

If a dependency-linked array becomes inconsistent during generation, zTracker now logs a warning in the browser console. Example: charactersPresent lists a character name but characters has no matching object for that name.

World Info (lorebooks)

In Extensions → zTracker, you can control World Info during tracker generation: include all (default), exclude all, or allowlist specific lorebook book names (case-insensitive) and/or entry UIDs (numbers). This only affects zTracker tracker generation (button / Auto Mode), not normal SillyTavern generations.

In allowlist mode, zTracker loads the allowlisted lorebooks by name and injects their matching entries into the tracker-generation prompt, even if those lorebooks are not currently active in SillyTavern.

When using Allow only specified books/UIDs, you can click Refresh book list to detect available books, search/select them, and Add them to the allowlist (with quick remove buttons). A manual textarea is still available under “Advanced”.

Embedding tracker snapshots into normal generations

zTracker can optionally embed the last $X$ tracker snapshots into the prompt chat array via its generate_interceptor (controlled by Include Last X zTracker Messages).

You can also control what role those embedded snapshots use (User, System, or Assistant) via Embed zTracker snapshots as. This setting only affects embedding; it does not change how zTracker generates trackers.

For Text Completion chats, assistant-role snapshots stay as assistant turns when zTracker can preserve a clear reply cue, such as SillyTavern's trailing assistant prefill turn or a host-confirmed solo-chat speaker label. When the host cannot confirm a single reply speaker, zTracker only falls back to inlining the snapshot into the final user turn when a standalone terminal assistant block would otherwise leave the prompt framing ambiguous.

If SillyTavern's prompt formatting is producing awkward prefixes like Assistant: Tracker:, enable Inject as virtual character. This uses the embed snapshot header as the injected speaker name and removes the duplicated header prefix from the embedded snapshot body.

In the text-completion-safe terminal assistant fallback, zTracker still keeps the tracker label inside the raw injected content so the prompt can end on the real assistant reply cue. See docs/TRACKER_INJECTION_BEHAVIOR.md for the current behavior matrix, including when that reply cue is host-confirmed versus inferred from prior assistant history.

You can also apply a regex-based transform to the embedded snapshot text (for prompt-friendly formatting) via Embed snapshot transform preset.

You can customize (or remove) the embedded snapshot header via Embed snapshot header.

  • Default (JSON): embeds pretty-printed JSON (no changes).
  • Minimal (top-level properties): embeds one line per top-level property (newline-separated).
  • TOON (compact): embeds tracker snapshots as tab-delimited TOON for lower-token structured context while preserving arrays and nested objects.

Versioning

Developer and maintainer notes (local dev, testing, versioning) are in docs/DEVELOPMENT.md.

For prompt debugging, maintainers can run npm run debug:tracker-context:json, npm run debug:tracker-context:xml, or npm run debug:tracker-context:toon to inspect one live-like tracker-generation request for each supported output mode. The saved request snapshots live under test-output/tracker-context-json.md, test-output/tracker-context-xml.md, and test-output/tracker-context-toon.md; the plain-text transport views live under test-output/tracker-context-json.txt, test-output/tracker-context-xml.txt, and test-output/tracker-context-toon.txt. Running npm run debug:tracker-context:artifacts refreshes only the .txt files so they stay aligned with the currently verified live behavior: the active text-completion connection path flattens tracker-generation messages into one raw prompt string without System:, User:, or Assistant: labels.

Live verification also showed that tracker generation includes character-card prompt content from SillyTavern's buildPrompt(...) step by default. You can now disable that input with the tracker-generation setting above when you want extraction to rely more heavily on recent chat state.

About

A SillyTavern extension that tracking stats with LLMs

Resources

Stars

10 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages