02.1: Prompt Items
This content is not available in your language yet.
Prompt items form the top of the context list, establishing the LLM’s identity framing and behavioral rules.
Flow and ownership
Section titled “Flow and ownership”The contributor buildPromptContextItems in src/utils/text/context/templates.ts emits up to four system-role items depending on channel configuration and impersonation status:
- System prompt slot (
SYSTEM_HUMANIZER_RULES):- In standard turns, this slot contains the server’s configured
system_promptor the built-inDEFAULT_SYSTEM_PROMPT. - When the active channel has a prompt override configured in
replacemode, the channel prompt replaces this slot’s content. - When a SillyTavern preset is active,
presetOwnsSystemPromptskips both the configuredsystem_promptand the default, so the preset’s system blocks control the prompt. Areplace-mode channel prompt still fills the slot. - During user impersonation, this slot instead holds
impersonatedUserPrompt.
- In standard turns, this slot contains the server’s configured
- Channel prompt block (
SYSTEM_CHANNEL_PROMPT):- When the active channel has a prompt override configured in
appendmode, the channel prompt is emitted as a distinct block immediately after the system prompt. Under SillyTavern preset reassembly, this block accompanies themainmarker so it remains adjacent to the system prompt.
- When the active channel has a prompt override configured in
- Persona prompt block (
SYSTEM_PERSONA_PROMPT):- Emits the persona’s distinctive prompt instructions (
personaPrompt). Omitted during user impersonation.
- Emits the persona’s distinctive prompt instructions (
- Personality attributes (
SYSTEM_PERSONALITY):- Emits the persona’s personality traits (
tomoriAttributes, joined by newlines). Omitted during user impersonation.
- Emits the persona’s personality traits (
Transforms and expansion
Section titled “Transforms and expansion”Before emission, every prompt text undergoes macro and mention expansion:
- Capability and tool macros:
toolPromptMacroResolver.expandprunes inactive{{if capability:...}}and{{if tool:...}}conditionals, and substitutes active tool names such as{short_term_memory_tool}or{memory_tool}. A macro whose tool the turn does not expose renders as “an unavailable tool” rather than the tool’s name, because a model shown a tool it cannot call tends to write the call out as chat text. Conditionals and macros both resolve against provider capabilities and the turn’s Deliberate Tool Mode allowlist, so seeded prompts wrap every macro in a matching{{if tool:...}}block. - Mention normalization:
convertMentionsresolves<@id>,<#id>, and{bot}/{user}tokens. Because prompt items instruct the model rather than addressing a specific user, the user name argument is fixed to"User".
Constraints and rationale
Section titled “Constraints and rationale”- Impersonation isolation: Impersonation turns emit only the impersonated user prompt. Persona prompts, attributes, and default humanizer rules are suppressed so the model adheres strictly to the target identity.
- Channel override scope: Channel overrides alter only the system prompt slot. They never alter or overwrite persona prompts or personality attributes.
- Prompt tag stability: Distinct metadata tags (
SYSTEM_HUMANIZER_RULES,SYSTEM_CHANNEL_PROMPT,SYSTEM_PERSONA_PROMPT,SYSTEM_PERSONALITY) allow SillyTavern preset reassembly to map each block to its corresponding preset marker (main,charDescription,charPersonality).
Source pointers
Section titled “Source pointers”src/utils/text/context/templates.ts:buildPromptContextItemsandDEFAULT_SYSTEM_PROMPT.src/utils/cache/channelPromptCache.ts:getCachedChannelPromptchannel override lookup.src/utils/tools/toolPromptMacros.ts:toolPromptMacroResolverconditional and macro evaluation.src/utils/text/context/mentionNormalizer.ts:convertMentionsmention conversion.