# Sillytavern Rolecard Performance

> Measure, compare, and gate large SillyTavern rolecards using deterministic size, prompt, worldbook, regex, helper-script, embedded-media, and captured runtime budgets. Use when Codex needs a performance audit, regression baseline, release budget, or smallest optimization plan without silently deleting card behavior.

- Skill: `liarmttt/sillytavern-rolecard-performance` (Agent Skill, multi-file: 11 files)
- Install (CLI): `npx skillmds@latest add liarmttt/sillytavern-rolecard-performance`
- Raw SKILL.md: https://api.skillmd.com/api/skills/liarmttt/sillytavern-rolecard-performance/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: liarmttt (https://skillmd.com/u/liarmttt)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/liarmttt/sillytavern-rolecard-performance

---


# SillyTavern Rolecard Performance

<!-- tw-guidance-entry:begin -->
## Shared communication

Apply [TW plain-language and guidance rules](../consult-tavernweave-library/references/communication-and-guidance.md) 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.
<!-- tw-guidance-entry:end -->

Use `$consult-tavernweave-library` with the `sillytavern-rolecard-performance` route for A0, the large-card guide, and motion/performance references when writing. Keep library advice, static metrics, browser samples, and real SillyTavern evidence as distinct gates.

Turn “the card feels heavy” into reproducible static metrics and separately captured
runtime evidence. Do not optimize by deleting content before ownership is known.

## Establish the artifact and baseline

Resolve the manifest-selected rolecard JSON and its maintained component sources.
Record exact file identity, version, byte size, and approved baseline. If the only
artifact is PNG, use the existing card pipeline to extract or identify its payload;
do not treat the image container size as JSON structure evidence.

Read [static-budget-contract.md](references/static-budget-contract.md) before setting
thresholds. Read [runtime-sampling.md](references/runtime-sampling.md) when browser or
SillyTavern timings are available.

## Measure without exposing content

Run:

```powershell
node scripts/measure-rolecard-performance.mjs --card candidate.json --out candidate-report.json
```

The report contains counts, byte totals, and metric paths only. It must not echo
prompt text, scripts, URLs, data URIs, or embedded media.

Measure the approved baseline with the same script version and input surface. Avoid
comparing a source component tree with an assembled card unless the budget explicitly
defines that cross-surface comparison.

## Apply declared budgets

Run:

```powershell
node scripts/check-performance-budget.mjs --report candidate-report.json --budget budget.json --baseline baseline-report.json
```

Block hard-limit violations and growth beyond declared deltas. A baseline is not a
waiver: a metric over its hard limit remains a failure even when it did not grow.

## Validate captured runtime samples

Use `scripts/validate-runtime-sample.mjs` only on timings captured from a named real
environment. Keep first render, swipe/edit rerender, chat switch, control-center open,
and media activation as separate scenarios. Never manufacture samples from static
file size or Node execution time.

## Diagnose ownership before optimization

Map every large surface to its owner: prompt fields, worldbook entries, regexes,
helper scripts, embedded assets, remote loaders, duplicate card payloads, or host UI.
Propose the smallest reversible change and state its semantic risk. Preserve stable
IDs, bindings, ordering, activation rules, fallbacks, and unknown fields.

Route component-only changes to `sillytavern-component-update`; route rebuilt cards to
`sillytavern-card-pipeline`; route live jank or lifecycle defects to
`sillytavern-runtime-debug`.

## Report

Report candidate and baseline identities, metric deltas, hard-limit failures, runtime
sample environment, suspected owners, proposed smallest changes, and open real-host
acceptance gates.

## Resources

- [static-budget-contract.md](references/static-budget-contract.md): stable metrics,
  baseline policy, and optimization boundaries.
- [runtime-sampling.md](references/runtime-sampling.md): captured scenario format and
  percentile policy.
- `scripts/measure-rolecard-performance.mjs`: redacted structural measurement.
- `scripts/check-performance-budget.mjs`: limits and regression comparison.
- `scripts/validate-runtime-sample.mjs`: captured percentile gate.

