Parse and apply character cards and world info files for immersive story roleplay experiences. Fully compatible with SillyTavern formats.
skills/story-roleplay/scripts/), create only if not found1.0.0 (do not use ^)Step 1: Copy Preset Tool
Try in the following order until successful:
Method 1 (Highest Priority): Relative path (if workspace is under project root):
cp skills/story-roleplay/scripts/parse-character-card.js . && cp skills/story-roleplay/scripts/package.json .
Method 2: Search upward for project root (up to 5 levels):
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
Method 3: Global search (exclude temp directories):
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
Verify: Confirm files copied
ls parse-character-card.js package.json
Step 2: Install Dependencies
npm install
node_modules was createdStep 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
npm install firstIf all above methods fail (possibly due to system permission issues), creating script files is allowed:
package.json (see "Fallback Code" section at end of file)parse-character-card.js (see "Fallback Code" section at end of file)Prerequisite: Must have tried all finding methods and all failed.
Triggers: character card, 角色卡, load character, 加载角色, parse character, 解析角色卡
Description: Parse character card files in multiple formats, including PNG, WebP image formats and JSON file format.
chara (v2) or ccv3 (v3)Processing: Use common parser tool workflow (see above), use character card command format when executing.
chara (v2) or ccv3 (v3)Processing:
Standard Format (Tavern Card V2/V3):
name, description, personality, scenario, first_mes, system_prompt
character_book (character knowledge base)Processing: Read and parse directly (simplest, preferred)
Important: PNG/WebP images must use parser tool, guessing content is forbidden
Detect file format:
Extract character information:
name: Character namedescription: Character descriptionpersonality: Personality traitsscenario: Scenario settingfirst_mes: First message (used as opening)system_prompt: System prompt (character behavior rules)character_book: Character knowledge base (similar to world info)Apply character information:
Save as JSON format (after parsing images):
character.json in workspaceTriggers: 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).
{
"name": "World Name",
"entries": [
{
"keys": ["keyword1", "keyword2"],
"content": "Content to inject when triggered",
"priority": 100,
"enabled": true
}
]
}
naidata (SillyTavern standard)Processing: Use common parser tool workflow (see above), use --world-info flag when executing.
Processing:
keys: Keyword array, triggers when these words appear in conversationcontent: Content to inject when triggeredpriority: Priority (higher number = higher priority)enabled: Whether enabled (true/false)Detect file format:
--world-info flagExtract world info:
entries arrayentries field)Save as JSON format (after parsing images):
world-info.json in workspace--world-info flag)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 field in character card:
name: Character knowledge base nameentries: Entry array, each entry contains keys, content, priority, enabled
Scan workspace:
character.png, character.webp, character.json, *.character.json
world-info.png, world-info.webp, world-info.json, world.json
Format recognition and parsing:
Apply parsed results:
When no files exist (Important: Must actively guide user):
Active guidance process:
Confirm information: Summarize user-provided information, wait for user confirmation before creating files
Create files:
character.json with all character informationworld-info.json with relevant entriesCreation format:
Users can manually load via:
This skill is fully compatible with SillyTavern formats:
naidata)Important: The following code should only be used when all path finding methods have failed. Prioritize using copy methods.
{
"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"
}
}
Complete code reference: skills/story-roleplay/scripts/parse-character-card.js
Key features:
chara or ccv3)naidata)If file is not accessible, can create based on following logic:
png-chunks-extract to extract PNG chunkspng-chunk-text to decode tEXt chunkschara/ccv3 for character cards, naidata for world info)