Content is user-generated and unverified.

Dynamic World Info Systems

Using Outlets and Regex Triggers for Intelligent Prompt Injection


1. Introduction

This guide presents a systematic approach to creating dynamic, context-aware prompt injection systems in SillyTavern using World Info entries, outlets, and regex triggers. The techniques described enable sophisticated narrative control without cluttering the base prompt with conditional information.

The core insight is that LLMs tend to surface information present in their context. By controlling when information enters the context rather than relying on the model to withhold it, we achieve more reliable narrative control.

1.1 The Core Problem

Large Language Models are fundamentally "helpful explainers" — they see information and want to surface it. This creates challenges when:

  • Characters should have secrets they don't reveal prematurely
  • Context should shift based on narrative conditions
  • Information should unlock progressively based on trust or story beats
  • Different scenarios require different character behaviors

1.2 The Solution: Gated Context Injection

Instead of putting secrets in the prompt and hoping the model withholds them, we keep information OUT of context until conditions are met. The outlet system combined with regex triggers creates a gating mechanism where content only enters the prompt when narrative conditions fire.


2. Understanding the Outlet System

The outlet feature in SillyTavern's World Info system provides manual injection points for dynamically assembled content.

2.1 How Outlets Work

  • World Info entries with "Outlet" position store content under a named label
  • Content is NOT automatically injected into the prompt
  • You pull content manually using {{outlet::YourName}} macros
  • Multiple entries can share the same outlet name — they combine
  • Combined entries are sorted by their insertion order and separated by newlines

2.2 Placement Rules

Outlet macros CAN be placed in:

  • Custom prompt blocks in the Prompt Manager
  • Advanced Formatting prompt fields

Outlet macros CANNOT be placed in:

  • Character card fields (Description, Personality, Scenario) — parsed too early
  • Author's Note editor
  • Inside other World Info entries (no nesting)
  • Inside another outlet's content

2.3 Technical Constraints

  • Outlet names are case-sensitive: {{outlet::Tools}}{{outlet::tools}}
  • Leading/trailing spaces in names are ignored
  • Empty outlets resolve to empty string (no error)
  • Entries missing outlet names are skipped

3. Regex Trigger Fundamentals

SillyTavern supports JavaScript regex syntax for World Info keys, enabling pattern-based activation rather than simple keyword matching.

3.1 Syntax Requirements

  • Use / delimiters: /pattern/flags
  • Include /i flag for case-insensitivity
  • Use non-capturing groups: (?:...) not (...)
  • Commas are allowed inside regex (unlike plaintext keys)

3.2 Common Patterns

PatternPurpose
(?:word1|word2|word3)Match any of listed alternatives
(?:optional )?Make segment optional
{{char}}Placeholder for character name
{{user}}Placeholder for user name
\x01Message separator in scan buffer
[^\x01]*?Match within single message

3.3 Per-Message Matching

SillyTavern prefixes each message with character name: and separates them with \x01. This enables targeting specific speakers:

regex
/\x01{{user}}:[^\x01]*?keyword/i

↑ Match only USER saying "keyword"

regex
/\x01{{char}}:[^\x01]*?keyword/i

↑ Match only CHARACTER saying "keyword"


4. Architecture Patterns

4.1 The Slot Architecture

Create a prompt template with named "slots" that outlets feed into:

[System Prompt]
[Character Defs] (native)
{{outlet::char_augments}}      ← Custom block
[Scenario] (native)
{{outlet::scene_state}}        ← Custom block
[Chat History]
{{outlet::active_directives}}  ← Custom block

4.2 State Machine Pattern

Use inclusion groups to create mutually exclusive states where only one can be active:

  • Entry A: Default state (Constant, high weight)
  • Entry B: Triggered state (Keyword, higher weight, sticky)
  • Both share same inclusion group — only one activates
  • Prioritize Inclusion ensures triggered state wins when conditions met

4.3 Progressive Unlock Pattern

Use timed effects to gate content by conversation length:

  • Delay: Entry cannot activate until N messages exist
  • Sticky: Entry stays active for N messages after triggering
  • Cooldown: Entry cannot re-trigger for N messages after expiring

Combine with recursion: Trust Level 2 activates from Trust Level 1's content appearing.


5. Managing Character Secrets

5.1 The Fundamental Principle

Secrets aren't data to store — they're behavioral patterns to model, plus gated content that only enters context at the right narrative moment.

5.2 Techniques

5.2.1 Behavioral Framing

Instead of stating the secret, describe how the character ACTS around it:

BAD:

Sarah murdered her brother.

GOOD:

Sarah carries a secret she has never spoken aloud. She deflects, 
changes subject, or becomes defensive if conversation approaches 
her brother or her past.

5.2.2 Negative Space Framing

Define what the character DOESN'T do:

{{char}} DOES NOT:
- Volunteer information about past unprompted
- Explain motivations or backstory directly
- Answer questions about [topic] honestly until [condition]

{{char}} DOES:
- Deflect with humor or redirect questions
- Give partial truths that satisfy without revealing
- Show discomfort through body language, not exposition

5.2.3 Split Persona

Keep the character card minimal (behavioral scaffolding only). All actual lore lives in World Info entries with strict trigger conditions.


6. Complete Example: Name Revelation System

6.1 Entry 1: Default State (Constant)

FieldValue
Key(leave empty)
Strategy🔵 Constant
PositionAfter Char Defs
Inclusion Groupname_state
Group Weight100

Content:

{{char}} has not shared her real name. She introduces herself as "V" 
and deflects or ignores direct questions about her full name. She 
treats it as unimportant, changes the subject, or makes a joke if pressed.

6.2 Entry 2: Willing Revelation Trigger

FieldValue
Key/(?:{{char}}|she) (?:finally )?(?:tells|shares|reveals) (?:her )?(?:real )?name/i
Optional Filtertrust, earned, deserve, friend, saved, love
Filter LogicAND ANY
Strategy🟢 Keyword
PositionOutlet
Outlet Namename_reveal
Inclusion Groupname_state
Group Weight200
Prioritize Inclusion✅ Enabled
Sticky999

Content:

{{char}}'s real name is Vivienne Ashford. She has chosen to share this 
with {{user}}. This is significant — she does not give her name lightly. 
She may say it quietly, without ceremony, or frame it as a gift.

6.3 Entry 3: Forced Discovery Trigger

FieldValue
Key/(?:finds?|discovers?|sees?|reads?) (?:her )?(?:real )?(?:name|identity|ID)/i
Strategy🟢 Keyword
PositionOutlet
Outlet Namename_reveal
Inclusion Groupname_state
Group Weight200
Prioritize Inclusion✅ Enabled
Sticky999

Content:

{{char}}'s real name is Vivienne Ashford. {{user}} has discovered this 
without it being freely given. {{char}} may react with guardedness, 
embarrassment, anger, or resignation depending on context.

6.4 Entry 4: Post-Reveal State (Recursive)

FieldValue
KeyVivienne Ashford
Strategy🟢 Keyword
Delay until recursion✅ Enabled
Non-recursable✅ Enabled
PositionAfter Char Defs

Content:

{{user}} knows {{char}}'s real name is Vivienne. She accepts being 
called Vivienne by {{user}}, though she still uses "V" with others.

6.5 Custom Prompt Block (Prompt Manager)

FieldValue
NameIdentity Reveals
RoleSystem
PositionIn-Chat
Depth1
Content{{outlet::name_reveal}}

6.6 How It Works

  1. Default: Constant entry fires every message — "she goes by V, deflects name questions"
  2. Willing reveal: Regex catches narrative moment ("she tells her name") BUT only fires if emotional context words present (trust, saved, love, etc.)
  3. Forced reveal: Alternative path — user discovers it through documents/investigation
  4. Inclusion group ensures only ONE state active — default OR revealed, never both
  5. Sticky: 999 makes revelation permanent for rest of conversation
  6. Post-reveal entry catches recursive activation from the revealed name appearing

The secret never exists in context until earned or discovered.


7. Regex Pattern Library

These patterns detect narrative moments by matching the atmosphere and lead-up rather than explicit statements.

7.1 Trust/Vulnerability Triggers

regex
/(?:you )?(?:saved|protected|trusted) (?:my )?(?:life|everything|me)/i
regex
/(?:I )?(?:owe|trust) (?:you|him|her)/i
regex
/(?:never told|haven't shared|no one knows) (?:anyone|anybody|a soul)/i

7.2 Intimacy/Connection Triggers

regex
/(?:met|held|caught|searched) (?:her|his|their) (?:eyes|gaze|look)/i
regex
/(?:looked|stared|gazed) (?:at|into) (?:her|his|their|{{user}})/i
regex
/(?:long |heavy |comfortable )?silence/i

7.3 Physical State Triggers

regex
/(?:{{char}}|she|he) (?:was |seemed )?(?:wounded|bleeding|exhausted|crying)/i
regex
/(?:fire|embers) (?:crackled|burned|died)/i
regex
/(?:alone|quiet|still) (?:together|now|finally)/i

7.4 Hesitation/Delivery Triggers

regex
/(?:hesitated|paused|took a breath|swallowed hard)/i
regex
/voice (?:was |went )?(?:quiet|soft|low|small)/i

7.5 Scene Type Triggers

Combat:

regex
/(?:attacks?|swings?|dodges?|parries?|casts?|fires?)/i

Location change:

regex
/(?:enters?|arrives?|walks? into|steps? into) (?:the )?/i

Time shift:

regex
/(?:morning|afternoon|evening|night|dawn|dusk)/i

8. LLM Prompt Templates for Generating Regex

Use these templates with any LLM to generate context-appropriate regex triggers.

8.1 Base Instruction Block

Include this with all prompts:

You are creating regex trigger keys for SillyTavern World Info entries. 
These triggers detect narrative moments in roleplay/fiction to dynamically 
inject context.

FORMAT REQUIREMENTS:
- Use JavaScript regex syntax with / delimiters
- Always include /i flag for case-insensitivity
- Use non-capturing groups: (?:...) not (...)
- Use (?:word1|word2|word3) for alternatives
- Use (?: )? for optional segments
- Support {{char}} and {{user}} as literal placeholders
- Keep patterns under 200 characters when possible
- Avoid overly specific phrases - target common language patterns

OUTPUT FORMAT for each regex:
1. Pattern name
2. The regex
3. What it catches (3-5 example phrases)
4. False positive risks
5. Suggested Optional Filter words (AND ANY)

Focus on words/phrases that PRECEDE or ACCOMPANY the target moment, 
not explicit statements of it.

8.2 Template: Emotional State Detection

[Insert Base Instruction Block]

TASK: Generate regex triggers for detecting when a character enters 
or displays [EMOTIONAL STATE].

Target emotion: [INSERT: anger / fear / sadness / joy / shame / 
               guilt / jealousy / love / despair / hope]

Consider:
- Physical manifestations (body language, voice changes, breathing)
- Behavioral shifts (what they start/stop doing)
- Environmental reflections (pathetic fallacy)
- Dialogue markers (tone shifts, word choice)
- Internal state words others might observe

Generate 3-5 regex patterns ranging from subtle to overt detection.

8.3 Template: Relationship Milestone Detection

[Insert Base Instruction Block]

TASK: Generate regex triggers for detecting [RELATIONSHIP MILESTONE] 
moments between characters.

Target milestone: [INSERT: first meeting / growing trust / betrayal / 
                 reconciliation / confession of feelings / physical 
                 intimacy / breaking up / forming alliance / rivalry emerging]

Consider:
- Dialogue patterns typical of this moment
- Physical proximity/distance language
- Emotional vocabulary surrounding this transition
- Actions that typically accompany this beat
- Time/silence markers

Generate 3-5 regex patterns that catch the LEAD-UP and the MOMENT itself.

8.4 Template: Scene Type Detection

[Insert Base Instruction Block]

TASK: Generate regex triggers for detecting when the narrative enters 
a [SCENE TYPE].

Target scene type: [INSERT: combat / chase / investigation / negotiation / 
                  heist / escape / ritual / travel / rest/camp / 
                  celebration / funeral / trial / training / stealth]

Consider:
- Verbs specific to this activity
- Objects/tools commonly mentioned
- Environmental descriptors
- Temporal markers (pacing words)
- Character positioning language
- Tension/stakes vocabulary

Generate 4-6 regex patterns covering scene initiation, active scene, 
and scene conclusion.

8.5 Template: Character State Detection

[Insert Base Instruction Block]

TASK: Generate regex triggers for detecting when a character is in 
[PHYSICAL/MENTAL STATE].

Target state: [INSERT: wounded / exhausted / intoxicated / sick / 
             dying / unconscious / restrained / hidden / disguised / 
             armed / hungry / cold / lost]

Consider:
- Direct descriptions of the condition
- Behavioral symptoms
- Limitations on action
- Other characters' reactions
- Recovery/worsening language

Generate 3-5 regex patterns for state onset, active state, and 
state resolution.

8.6 Template: Power Dynamic Shifts

[Insert Base Instruction Block]

TASK: Generate regex triggers for detecting [POWER DYNAMIC] moments.

Target dynamic: [INSERT: submission / dominance / surrender / defiance / 
               manipulation / intimidation / protection / rescue / 
               capture / liberation]

Consider:
- Positional language (above/below, standing/kneeling)
- Voice/volume markers
- Eye contact and gaze patterns
- Physical control vocabulary
- Dialogue patterns of each role
- Transition moments between states

Generate 3-5 regex patterns that catch these dynamics emerging or shifting.

8.7 Template: Information Exchange Detection

[Insert Base Instruction Block]

TASK: Generate regex triggers for detecting [INFORMATION TYPE] being shared.

Target information type: [INSERT: secret / lie / confession / warning / 
                        threat / promise / plan / backstory / revelation / 
                        deception discovered]

Consider:
- Pre-confession hesitation language
- Trust/distrust vocabulary
- Delivery markers (whispered, admitted, blurted)
- Recipient reaction patterns
- Secrecy/privacy indicators
- Consequence acknowledgment

Generate 3-5 regex patterns for the buildup, the exchange, and the aftermath.

8.8 Template: Environmental/Atmosphere Detection

[Insert Base Instruction Block]

TASK: Generate regex triggers for detecting [ATMOSPHERE/SETTING] 
in the narrative.

Target atmosphere: [INSERT: danger approaching / safety/sanctuary / 
                  romantic tension / horror/dread / mystery / wonder/awe / 
                  melancholy / chaos / calm before storm]

Consider:
- Sensory descriptors (sound, light, temperature, smell)
- Weather and time-of-day markers
- Space descriptors (enclosed, open, high, deep)
- Character perception language
- Pacing indicators (slow, sudden, gradual)
- Symbolic/metaphoric patterns

Generate 4-6 regex patterns for atmosphere establishment and intensification.

8.9 Template: Genre-Specific Beats

[Insert Base Instruction Block]

TASK: Generate regex triggers for detecting common beats in [GENRE] fiction.

Target genre: [INSERT: noir / fantasy / sci-fi / horror / romance / 
             thriller / western / military / slice-of-life / mystery]

Identify 5 signature scene types or moments specific to this genre, 
then generate 1-2 regex patterns for each.

Consider:
- Genre-specific vocabulary and jargon
- Trope indicators
- Setting markers unique to genre
- Character archetype language
- Plot beat patterns
- Tonal markers

8.10 Template: Dialogue Pattern Detection

[Insert Base Instruction Block]

TASK: Generate regex triggers for detecting [DIALOGUE PATTERN] in conversation.

Target pattern: [INSERT: interrogation / flirtation / argument / 
               negotiation / comfort / command / plea / sarcasm / 
               evasion / storytelling]

Consider:
- Question structures
- Response patterns
- Turn-taking markers
- Emotional subtext indicators
- Power balance in exchange
- Non-verbal interjections (sighs, pauses, laughter)

Generate 3-5 regex patterns that catch this conversational mode activating.

IMPORTANT: These should catch the PATTERN, not specific content. 
Focus on structural markers.

8.11 Meta-Template: Custom Scene Analysis

[Insert Base Instruction Block]

TASK: I will describe a specific narrative moment. Analyze it and 
generate regex triggers.

MY SCENE DESCRIPTION:
[INSERT: 2-3 sentence description of the moment you want to detect]

Please:
1. Identify the core narrative function of this moment
2. List 10-15 words/phrases commonly used BEFORE this moment
3. List 10-15 words/phrases commonly used DURING this moment
4. Generate 3-5 regex patterns from most subtle to most explicit
5. Suggest Optional Filter words for precision
6. Identify what FALSE POSITIVES might occur and how to mitigate

9. Best Practices and Troubleshooting

9.1 Design Principles

  1. Target atmosphere, not explicit statements. Catch the LEAD-UP to moments, not just the moment itself.
  2. Use Optional Filters liberally. They add precision without adding regex complexity.
  3. Keep base character cards minimal. Put conditional content in World Info.
  4. Test patterns against false positives. Common words trigger too often.
  5. Use inclusion groups for mutually exclusive states. Don't let contradictory information coexist.
  6. Make sticky values intentional. 999 = permanent. Lower values for temporary states.

9.2 Common Mistakes

  • Putting secrets directly in character cards (model will surface them)
  • Using overly specific regex that rarely fires
  • Using overly broad regex that fires constantly
  • Forgetting the /i flag (case sensitivity breaks matches)
  • Using capturing groups (...) instead of non-capturing (?:...)
  • Placing outlet macros in character card fields (won't expand)
  • Nesting outlets inside other outlets (not supported)
  • Mismatched outlet name capitalization
  • Forgetting to create the custom prompt block that calls the outlet

9.3 Debugging Tips

  • Use SillyTavern's WI debug mode to see which entries fire
  • Test regex patterns at regex101.com (set to JavaScript flavor)
  • Start with broader patterns, then narrow with Optional Filters
  • Check outlet names for case sensitivity issues
  • Verify custom prompt blocks are enabled and positioned correctly
  • Use the "Alert on overflow" setting to catch budget issues

10. Quick Reference

10.1 World Info Entry Fields

FieldPurpose
KeyTrigger keywords or regex patterns
Optional FilterAdditional required/excluded keywords
Strategy🔵 Constant / 🟢 Keyword / 🔗 Vector
PositionWhere content inserts (or Outlet for manual)
Outlet NameLabel for manual {{outlet::X}} retrieval
Inclusion GroupMutual exclusion grouping
Group WeightSelection probability within group
Prioritize InclusionUse Order instead of Weight for selection
StickyMessages to stay active after trigger
CooldownMessages before can re-trigger
DelayMinimum messages before can trigger

10.2 Regex Quick Reference

PatternMeaning
(?:a|b|c)Match a OR b OR c
(?:word )?Optional "word "
\sAny whitespace
\w+One or more word characters
.*?Any characters (non-greedy)
[^\x01]*?Within single message
/iCase-insensitive flag
{{char}}Character name placeholder
{{user}}User name placeholder

10.3 Outlet Macro Syntax

{{outlet::OutletName}}

Place in: Custom Prompt Manager blocks, Advanced Formatting fields

Cannot place in: Character cards, Author's Note, inside WI entries

10.4 Timed Effects Summary

EffectValueBehavior
StickyNEntry stays active for N messages after triggering
CooldownNEntry cannot re-trigger for N messages after expiring
DelayNEntry cannot trigger unless N messages exist in chat

11. Example Narrative Test

This paragraph should trigger the name revelation system:


She sat with her back against the cold stone, bandaging the gash on her arm. He'd carried her three miles through the woods after the ambush. Neither of them had spoken since.

The fire crackled between them. Outside, rain. Inside, just breathing.

"You didn't have to come back for me," she said.

"Yes I did."

She looked up. Met his eyes. Held them longer than she meant to.

"No one's ever—" She stopped. Swallowed hard. The words felt strange in her mouth, rusted from disuse.

"Vivienne," she said, voice quiet. "My name. It's Vivienne."


Triggers activated:

  • met his eyes
  • fire crackled
  • voice quiet
  • swallowed hard
  • Optional filter context: alone, wounded, trust (implied) ✓

The regex catches the atmosphere of revelation, not just explicit "tells her name" language.


Guide compiled from SillyTavern documentation and practical experimentation with dynamic World Info systems.

Content is user-generated and unverified.
    Dynamic World Info Guide: SillyTavern Regex & Outlet Systems | Claude