SillyTavern Render Regex Pipeline
Shared communication
Apply TW plain-language and guidance rules to user-facing work. Explain terms in context; preserve the user's chosen 新人/入门/熟练/老手 level without inferred changes. 新人 and 入门 receive detailed explanations; every level receives needed and bug explanations unless the user explicitly waives that scope. Soul and prose modes never disable this baseline. Load the shared reference for task entry, level management, or explanation decisions.
Before changing a regex, use $consult-tavernweave-library with the sillytavern-render-regex-pipeline route to load A0 plus the render/regex guides. Preserve the route receipt and keep those guides separate from exact host-version evidence.
Turn regex behavior into an explicit, replayable stage trace. Separate structural validation from offline replacement and real-host acceptance.
Resolve the dialect and target
- Identify the installed SillyTavern and Tavern Helper versions when available.
- Classify the rule as card
RegexScriptDatacamel case or Tavern HelperTavernRegexsnake case. - Preserve the original artifact and run fixtures against a copy.
- Read tavern-regex-contract.md for fields and tri-state rules. Read render-stages.md before claiming stage equivalence.
Use $sillytavern-api-reference for exact target-version behavior. Do not translate
numeric placement codes from memory.
Validate before executing
node scripts/validate-tavern-regex.mjs regex.json
Block invalid JSON, missing IDs, duplicate IDs, invalid depth ranges, contradictory
markdownOnly and promptOnly, or un-compilable patterns. Report deprecated or
unknown fields without deleting them.
Run deterministic fixtures
Define every fixture with input, source or numeric placement, destination, depth, and expected output. Then run:
node scripts/run-regex-fixtures.mjs --regex regex.json --fixtures fixtures.json
The runner evaluates only declared eligibility and JavaScript replacement semantics. It does not emulate macro expansion, Markdown rendering, prompt assembly, trim-string internals, extension order outside the supplied list, or undocumented host behavior.
Trace the stages
node scripts/trace-render-pipeline.mjs --regex regex.json --fixtures fixtures.json
Keep the trace ordered as:
input -> enabled -> source/placement -> destination -> depth -> pattern -> output
When an offline result and SillyTavern disagree, treat the host as authoritative and
record the installed versions, exact imported rule, floor, source, destination, and
console evidence through $sillytavern-runtime-debug.
Report
State the dialect, target versions, fixture pass count, skipped stages, unsupported semantics, and remaining real-host checks.
Resources
scripts/validate-tavern-regex.mjs: validate card and helper regex structures.scripts/run-regex-fixtures.mjs: run deterministic replacement fixtures.scripts/trace-render-pipeline.mjs: emit a stage-by-stage JSON trace.references/tavern-regex-contract.md: field and flag contracts.references/render-stages.md: offline-versus-host stage boundary.