Story roleplay

From CES-Ltd/TitanX · View interactive version

Story roleplay is an AI agent skill from the GitHub repository CES-Ltd/TitanX. Parse and apply character cards and world info files in multiple formats (PNG, WebP, JSON), fully compatible with SillyTavern format. Supports automatic parsing, keyword triggering, and dynamic updates.

How to use this skill

Skill file

Story Roleplay Skills

Parse and apply character cards and world info files for immersive story roleplay experiences. Fully compatible with SillyTavern formats.

⚠️ Core Constraints (Must Follow)

  1. 🚫 ABSOLUTELY FORBIDDEN: Guessing PNG/WebP image content, must use parser tool to extract data
  2. ✅ MUST EXECUTE: Prioritize copying preset tool (skills/story-roleplay/scripts/), create only if not found
  3. ⚠️ LAST RESORT: When creating scripts, use complete code at end of file, version must be 1.0.0 (do not use ^)

Common: Parser Tool Usage Workflow

Quick Path (Try First)

Step 1: Copy Preset Tool

Try in the following order until successful:

```bash

cp skills/story-roleplay/scripts/parse-character-card.js . && cp skills/story-roleplay/scripts/package.json .

```

```bash

for dir in . .. ../.. ../../.. ../../../.. ../../../../..; do

if [ -f "$dir/skills/story-roleplay/scripts/parse-character-card.js" ]; then

cp "$dir/skills/story-roleplay/scripts/parse-character-card.js" .

cp "$dir/skills/story-roleplay/scripts/package.json" .

break

fi

done

```

```bash

SCRIPT_PATH=$(find ~ -name "parse-character-card.js" -path "/skills/story-roleplay/scripts/" ! -path "/temp" ! -path "/-temp" ! -path "/.webpack/*" 2>/dev/null | head -1)

if [ -n "$SCRIPT_PATH" ]; then

SCRIPT_DIR=$(dirname "$SCRIPT_PATH")

cp "$SCRIPT_DIR/parse-character-card.js" .

cp "$SCRIPT_DIR/package.json" .

fi

```

```bash

ls parse-character-card.js package.json

```

Step 2: Install Dependencies

npm install

Step 3: Execute Parser

# Character card
node parse-character-card.js <image-path> <output-json-path>

# World info
node parse-character-card.js <image-path> <output-json-path> --world-info

Important:

Examples:

node parse-character-card.js character.png character.json
node parse-character-card.js "薇娜丽丝.png" character.json
node parse-character-card.js world-info.png world-info.json --world-info

Step 4: Verify Results

Fallback Option (Last Resort)

If all above methods fail (possibly due to system permission issues), creating script files is allowed:

  1. Create package.json (see "Fallback Code" section at end of file)
  2. Create parse-character-card.js (see "Fallback Code" section at end of file)

Prerequisite: Must have tried all finding methods and all failed.


Character Card Parser

Triggers: character card, 角色卡, load character, 加载角色, parse character, 解析角色卡

Description: Parse character card files in multiple formats, including PNG, WebP image formats and JSON file format.

Supported Formats

1. PNG Image Format (SillyTavern Standard)

Processing: Use common parser tool workflow (see above), use character card command format when executing.

2. WebP Image Format (SillyTavern Compatible)

Processing:

3. JSON File Format

Standard Format (Tavern Card V2/V3):

Processing: Read and parse directly (simplest, preferred)

Parsing Steps

Important: PNG/WebP images must use parser tool, guessing content is forbidden

  1. Detect file format:
  1. Extract character information:
  1. Apply character information:
  1. Save as JSON format (after parsing images):

Best Practices


World Info Parser

Triggers: world info, 世界信息, world tree, 世界树, load world info, 加载世界信息

Description: Parse and apply world info files, implementing keyword trigger mechanism. Supports JSON files and PNG/WebP image formats (with embedded world info data).

Supported Formats

1. JSON File Format
{
  "name": "World Name",
  "entries": [
    {
      "keys": ["keyword1", "keyword2"],
      "content": "Content to inject when triggered",
      "priority": 100,
      "enabled": true
    }
  ]
}
2. PNG Image Format (SillyTavern Compatible)

Processing: Use common parser tool workflow (see above), use --world-info flag when executing.

3. WebP Image Format (SillyTavern Compatible)

Processing:

Field Descriptions

Trigger Mechanism

  1. Keyword detection: Monitor conversation content, detect if it contains world info keywords
  2. Content injection: When keywords appear, integrate corresponding content into response, sorted by priority
  3. Natural integration: Do not insert world info content awkwardly, naturally integrate into conversation and narrative

Parsing Steps

  1. Detect file format:
  1. Extract world info:
  1. Save as JSON format (after parsing images):

Best Practices


Character Book Handler

Triggers: character book, 角色知识库, character entry, 角色条目

Description: Handle character_book (character knowledge base) in character cards, similar to world info but bound to specific character.

Character Book Format

character_book field in character card:

Processing

  1. When loading character card: Extract character_book field, parse entries array, apply together with character information
  2. During conversation: Detect keywords in character_book, inject relevant content when keywords appear
  3. Priority: character_book entries usually have higher priority than world info

Best Practices


File Detection and Loading Workflow

Automatic Detection

  1. Scan workspace:
  1. Format recognition and parsing:
  1. Apply parsed results:

Character Card and World Info Creation

When no files exist (Important: Must actively guide user):

  1. Active guidance process:
  1. Confirm information: Summarize user-provided information, wait for user confirmation before creating files
  1. Create files:

Creation format:

Manual Loading

Users can manually load via:

Compatibility

This skill is fully compatible with SillyTavern formats:


Fallback Code (For Last Resort Use)

Important: The following code should only be used when all path finding methods have failed. Prioritize using copy methods.

package.json

{
  "name": "story-roleplay-parser",
  "version": "1.0.0",
  "description": "Parser tools for character cards and world info",
  "main": "parse-character-card.js",
  "scripts": {
    "parse": "node parse-character-card.js"
  },
  "dependencies": {
    "png-chunks-extract": "1.0.0",
    "png-chunk-text": "1.0.0"
  }
}

parse-character-card.js

Complete code reference: skills/story-roleplay/scripts/parse-character-card.js

Key features:

If file is not accessible, can create based on following logic:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.