From claude-commands
Enforces mandatory exit protocol for CharacterCreationAgent modal to prevent premature story mode transitions. Defines allowed exit choices and state machine rules.
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-commands:character-creation-modal-exitThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
This skill documents the mandatory exit protocol for CharacterCreationAgent modal mode to prevent premature story mode transitions.
This skill documents the mandatory exit protocol for CharacterCreationAgent modal mode to prevent premature story mode transitions.
CHARACTER CREATION IS A MODAL DIALOG - The user CANNOT exit until they select a specific planning_block choice.
CharacterCreationAgent modal lock activates when:
custom_campaign_state.character_creation_in_progress == True
AND
custom_campaign_state.character_creation_completed == False
While locked:
Character creation modal can ONLY exit via these specific planning_block choice selections:
1. God Mode Review Stage:
{
"planning_block": {
"choices": {
"start_adventure": {
"text": "Start Adventure",
"description": "Confirm this character and begin the story"
}
}
}
}
2. Manual Creation Complete:
{
"planning_block": {
"choices": {
"play_character": {
"text": "PlayCharacter",
"description": "Finish character creation and start adventure"
}
}
}
}
3. Character Creation Cancellation:
{
"planning_block": {
"choices": {
"cancel_creation": {
"text": "Cancel Character Creation",
"description": "Exit without saving character"
}
}
}
}
When user selects an exit choice:
custom_campaign_state.character_creation_in_progress = False
custom_campaign_state.character_creation_completed = True
custom_campaign_state.character_creation_stage = "complete"
Symptom: God mode template campaigns skipped character review and went straight to story mode.
Root Cause: LLM was ignoring character_creation_stage: "review" and resetting to "concept" when user said "Let's create my character!"
Example Failure:
Initial state: character_creation_stage = "review"
User: "Let's create my character!"
LLM (WRONG): "Let me reset to concept stage..."
Result: Offered AIGenerated/StandardDND/CustomClass menu instead of review
Enhanced character_creation_instruction.md with explicit protocol:
Key Changes:
character_creation_stage firstPrompt Enhancement:
**🚨 DO NOT RESET TO "concept" OR "mechanics" STAGES 🚨**
- Even if user says "Let's create my character!" or "I want to create my character"
- The character IS ALREADY CREATED - they just need to REVIEW and CONFIRM it
**MANDATORY BEHAVIOR IN REVIEW STAGE**:
1. ALWAYS check `character_creation_stage` FIRST before deciding what to do
2. IF stage == "review":
- Present the PRE-POPULATED character for review
- Use narrative tag: `[CHARACTER CREATION - Review]` (NOT "Concept")
- Show character stats from `player_character_data`
3. REQUIRED CHOICES (exactly these two):
- start_adventure: "Start Adventure"
- edit_character: "Edit Character"
Created test: testing_mcp/creation/test_god_mode_skip_bug.py
Before fix: 0/1 passed (LLM reset to concept stage) After fix: 1/1 passed (LLM stays in review stage with correct choices)
Evidence: /tmp/your-project.com/worktree_creation/god_mode_character_skip_bug/iteration_002/
cd ~/projects/worktree_creation
python testing_mcp/creation/test_god_mode_skip_bug.py
Expected Result:
✅ Has [CHARACTER CREATION] tag: True
✅ character_creation_stage: review (NOT concept!)
✅ Planning block choices: ['start_adventure', 'edit_character']
✅ Has finish character choice: True
python testing_mcp/creation/test_character_creation_three_flows_real.py
Expected Result:
custom_state = game_state.get("custom_campaign_state", {})
in_progress = custom_state.get("character_creation_in_progress")
completed = custom_state.get("character_creation_completed")
stage = custom_state.get("character_creation_stage")
if in_progress and not completed:
print(f"🔒 Modal locked in stage: {stage}")
elif completed:
print(f"✅ Character creation complete")
else:
print(f"❓ Ambiguous state - check for bugs")
# Get first LLM response
story_ref = campaign_ref.collection('story')
entries = story_ref.order_by('timestamp').stream()
for entry in entries:
data = entry.to_dict()
if data.get('actor') == 'gemini':
debug_info = data.get('debug_info', {})
raw_response = debug_info.get('raw_response_text', '')
if raw_response:
parsed = json.loads(raw_response)
planning_block = parsed.get('planning_block', {})
choices = planning_block.get('choices', {})
# Check for exit choices
has_start_adventure = 'start_adventure' in choices
has_play_character = 'play_character' in choices
if has_start_adventure or has_play_character:
print("✅ Exit choice available")
else:
print("⚠️ No exit choice - user is stuck!")
break
# WRONG
if "let's start" in user_input.lower():
character_creation_completed = True # NO!
User saying "Let's start" is ambiguous - they might mean:
CORRECT: Only exit when user SELECTS the planning_block exit choice.
# WRONG
if god_mode_template and character_data:
character_creation_completed = True # NO!
# User never saw the character!
CORRECT: Always show review step, even for god mode templates.
# WRONG - No way for user to exit!
{
"narrative": "[CHARACTER CREATION] Your character is ready!",
"planning_block": {
"thinking": "Character is complete",
"choices": {} # EMPTY!
}
}
CORRECT: ALWAYS provide at least one exit choice when character is ready.
$PROJECT_ROOT/prompts/character_creation_instruction.md - Character creation prompt (lines 97-141)$PROJECT_ROOT/agents.py - Modal lock logic (lines 2793-2805)testing_mcp/creation/test_god_mode_skip_bug.py - Bug reproduction testtesting_mcp/creation/test_character_creation_three_flows_real.py - Comprehensive flow testAdded to project CLAUDE.md:
## Character Creation Modal Exit
Character creation is a MODAL DIALOG - user cannot exit until selecting specific planning_block choice:
- God Mode Review: "Start Adventure" choice
- Manual Creation: "PlayCharacter" choice
- Cancellation: "Cancel Character Creation" choice
See `.claude/skills/character-creation-modal-exit.md` for complete protocol.
Bug Reproduction Evidence:
/tmp/your-project.com/worktree_creation/god_mode_character_skip_bug/iteration_001/
/tmp/your-project.com/worktree_creation/god_mode_character_skip_bug/iteration_002/
Production Campaign with Bug:
https://mvp-site-app-s7-i6xf2p72ka-uc.a.run.app/game/Wf1OZ1E6UYxP1kRFRppsWf1OZ1E6UYxP1kRFRppsnpx claudepluginhub jleechanorg/claude-commands --plugin claude-commandsDesigns modal agents that lock users into character creation or level-up flows until explicit exit choices are selected, preventing accidental escapes.
Maintains narrative continuity across long roleplay or collaborative fiction sessions (>5 turns) using structured scratch files for character voice, world-state, and fact tracking. Activates when continuity errors would damage immersion.