Feature: Pluggable component support for character card fields #19

Open
opened 2025-12-10 01:38:56 +00:00 by blightbow · 1 comment
Owner

Summary

Add well-known pluggable component keys for character card fields, enabling future character card import to map fields to reorderable prompt components.

Background

SillyTavern character cards contain multiple fields that become distinct prompt sections:

  • description → Character description
  • personality → Personality traits
  • scenario → Current situation
  • mes_example → Few-shot dialogue examples
  • system_prompt → System instructions
  • post_history_instructions → Injected near recent messages

Rather than adding new static component IDs (which caused the ID 500 < ID 0 ordering bug in early planning), these should be pluggable components that users can reorder freely.

SillyTavern Default Order

From PromptManager.js:2097-2146:

main (system prompt)
worldInfoBefore          ← Before character details
personaDescription       ← User's persona
charDescription          ← Character description
charPersonality          ← Character personality
scenario                 ← Current scenario
enhanceDefinitions       ← Optional enhancement prompt
nsfw                     ← Content settings
worldInfoAfter           ← After character details
dialogueExamples         ← mes_examples
chatHistory              ← Conversation
jailbreak                ← post_history_instructions

Implementation

Well-Known Pluggable Keys

PLUGGABLE_KEYS = {
    "world_info_before": "Triggered lore, before character details",
    "persona_description": "User's persona (from card or config)",
    "char_description": "Character description from card",
    "char_personality": "Character personality from card",
    "scenario": "Current scenario from card",
    "world_info_after": "Triggered lore, after character details",
    "dialogue_examples": "Few-shot examples from card",
}

Component Categories

Category ID Range Behavior
Static 0, 1000, 2000... Fixed, immutable boundaries
Character Card 1001-1999 Pluggable, reorderable between character_context and semantic_memories
World Info Variable Injected before/after specific components
Depth-Based N/A Inserted INTO conversation_history

Files to Modify

  • prompt_components.py - Add PLUGGABLE_KEYS dict
  • prompt_contexts.py - Update default configs for new keys

Future Work

This enables:

  • Character card import (maps card fields to pluggable components)
  • Workbench reordering of character details
  • Per-context enabling/disabling of card fields

Dependencies

  • Requires #(component reordering bug) to be fixed first for reordering to actually work
## Summary Add well-known pluggable component keys for character card fields, enabling future character card import to map fields to reorderable prompt components. ## Background SillyTavern character cards contain multiple fields that become distinct prompt sections: - `description` → Character description - `personality` → Personality traits - `scenario` → Current situation - `mes_example` → Few-shot dialogue examples - `system_prompt` → System instructions - `post_history_instructions` → Injected near recent messages Rather than adding new static component IDs (which caused the ID 500 < ID 0 ordering bug in early planning), these should be **pluggable components** that users can reorder freely. ## SillyTavern Default Order From `PromptManager.js:2097-2146`: ``` main (system prompt) worldInfoBefore ← Before character details personaDescription ← User's persona charDescription ← Character description charPersonality ← Character personality scenario ← Current scenario enhanceDefinitions ← Optional enhancement prompt nsfw ← Content settings worldInfoAfter ← After character details dialogueExamples ← mes_examples chatHistory ← Conversation jailbreak ← post_history_instructions ``` ## Implementation ### Well-Known Pluggable Keys ```python PLUGGABLE_KEYS = { "world_info_before": "Triggered lore, before character details", "persona_description": "User's persona (from card or config)", "char_description": "Character description from card", "char_personality": "Character personality from card", "scenario": "Current scenario from card", "world_info_after": "Triggered lore, after character details", "dialogue_examples": "Few-shot examples from card", } ``` ### Component Categories | Category | ID Range | Behavior | |----------|----------|----------| | **Static** | 0, 1000, 2000... | Fixed, immutable boundaries | | **Character Card** | 1001-1999 | Pluggable, reorderable between character_context and semantic_memories | | **World Info** | Variable | Injected before/after specific components | | **Depth-Based** | N/A | Inserted INTO conversation_history | ### Files to Modify - `prompt_components.py` - Add `PLUGGABLE_KEYS` dict - `prompt_contexts.py` - Update default configs for new keys ## Future Work This enables: - Character card import (maps card fields to pluggable components) - Workbench reordering of character details - Per-context enabling/disabling of card fields ## Dependencies - Requires #(component reordering bug) to be fixed first for reordering to actually work
Author
Owner

Dependency Note: This feature requires #16 (component reordering bug) to be fixed first, otherwise reordering pluggable components in the workbench will have no effect on actual LLM prompts.

**Dependency Note:** This feature requires #16 (component reordering bug) to be fixed first, otherwise reordering pluggable components in the workbench will have no effect on actual LLM prompts.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
blightbow/evennia_ai#19
No description provided.