Settings

Output Rules

Use regex-based output rules to rewrite or visually style model replies without changing your core prompt stack.

Output Rules are a post-processing layer for assistant text.

They are useful when the model is basically giving you the right content, but the final presentation is still annoying, noisy, or inconsistent.

This is different from changing the model, the prompt wrapper, or the sampler.

Those systems influence what the model tries to say. Output Rules influence how the result is cleaned up or displayed after the reply already exists.

What Output Rules Are Good For

Use Output Rules when you want to fix recurring formatting patterns such as:

  • stage directions that should look quieter,
  • repeated system-like labels that clutter the reading flow,
  • model habits that always need the same cleanup,
  • recurring narration markers that you want styled consistently,
  • or boilerplate patterns that are easier to rewrite with regex than with prompt surgery.

They are especially useful when the problem is narrow and repeatable.

If the model is fundamentally refusing, losing character, or forgetting context, Output Rules are usually not the first fix. In that case, start with Advanced Features, especially token budget, wrappers, or routing.

Two Rule Modes

Replace Text

Replace rules rewrite matching text before it is rendered.

Use this when you want to normalize a pattern directly.

Examples:

  • removing an unwanted prefix that keeps appearing,
  • converting one repeated formatting pattern into another,
  • cleaning extra markers that the model inserts every time,
  • or standardizing a repeated scene notation style.

This is the stronger mode because it changes the text result.

Style Match

Style rules do not rewrite the matched text. They only change its visual presentation during rendering.

Use this when the text itself is acceptable, but its presentation should feel different.

Supported style variants currently include:

  • Action Beat,
  • Narration,
  • Whisper,
  • System Muted,
  • Accent.

This mode is better when you want to preserve the original wording but change how the reader perceives it on screen.

Rule Scope

Each rule can apply at a different scope.

Global

Global rules apply everywhere.

Choose this for cleanup patterns that should affect the entire app regardless of character or session.

Character

Character rules apply only to one character profile.

Choose this when a formatting habit belongs to a specific imported card, narrator style, or roleplay partner rather than your whole library.

Current Session

Session rules apply only to the currently open chat.

Choose this when you are experimenting or when a formatting rule belongs to one specific scene but would be wrong elsewhere.

Order Matters

Rules run from top to bottom.

That means the rule list is not just organizational. It is behavioral.

If two rules could affect the same pattern, the earlier one gets the first chance to act.

In practice, this means you should usually:

  • put broad cleanup rules near the top,
  • put narrower corrections after them,
  • and move experimental rules carefully if the output starts behaving strangely.

If a rule seems correct in isolation but behaves inconsistently in the live list, order is one of the first things to inspect.

The Main Fields

When you create or edit a rule, the important inputs are:

  • Rule Name: a label for your own organization.
  • Regex Pattern: the expression to match.
  • Flags: the regex flags used for matching.
  • Mode: Replace Text or Style Match.
  • Replacement: used by replace rules.
  • Style Mapping: used by style rules.
  • Scope: Global, Character, or Current Session.
  • Enabled: whether the rule is active right now.

The editor also includes a sandbox preview so you can test a sample input before you rely on the rule in live chats.

Use that preview aggressively. Regex mistakes are often obvious in preview and annoying in production.

A Good Workflow for Safe Rules

  1. Start with one narrow pattern instead of one huge clever expression.
  2. Test it in the sandbox preview with realistic sample text.
  3. Enable it at session scope first if you are not fully sure.
  4. Promote it to character or global scope only after it proves stable.
  5. Re-check rule order if another rule already touches similar text.

This keeps experimentation cheap and reduces the chance that one ambitious regex affects unrelated scenes.

When to Use Output Rules Instead of Prompt Changes

Use Output Rules when:

  • the underlying content is mostly correct,
  • the fix is mechanical and repeatable,
  • the problem shows up in finished text rather than in scene intent,
  • or you want presentation changes without retraining your whole workflow.

Use prompt, sampler, or provider changes when:

  • the model is producing the wrong meaning,
  • the tone is wrong,
  • the scene loses continuity,
  • or the model keeps making larger structural mistakes.

Output Rules are best treated as a finishing layer, not as a substitute for a broken route or a broken prompt stack.

Common Failure Patterns

If Output Rules seem to behave badly, the usual causes are:

  • a regex pattern that matches more than intended,
  • flags that are too broad or too narrow,
  • rule order conflicts,
  • a global rule that should really be character-scoped,
  • or using text replacement to solve what is actually a prompt-level issue.

When that happens, reduce scope first, simplify the pattern second, and only then widen the rule again.