I spent two days chasing a problem that looked like an AI limitation. Turns out it was a workflow problem. When I changed how I asked the AI to work, suddenly everything clicked.

The lesson: Don’t just prompt harder. Redesign the task.

The Problem: AI Can’t Count Past Six

I upgraded to Gemini 3 Pro (latest model, massive token limits, impressive capabilities) and asked it to generate a branching story with 12+ endings. Simple request, right?

It gave me 6.

I tried again with stronger emphasis. “YOU MUST CREATE 12 ENDINGS.” Still 6.

I tried creative prompts. Clearer structure. Different temperatures. The model kept generating beautiful, coherent stories with exactly the wrong number of endings.

My first instinct: blame the AI. “Gemini 3 Pro can’t handle complex branching.” But that didn’t make sense. The model generates novels. It writes code. Surely it can count to 12?

The Insight: I Was Asking Too Much

Here’s what I was asking the AI to do in a single pass:

  1. Create compelling characters
  2. Build a coherent plot arc
  3. Insert 10-14 meaningful decision points
  4. Generate 12-16 unique endings
  5. Ensure every path has 10+ choices
  6. Test all 4 MBTI dimensions on every path
  7. Maintain narrative quality throughout

That’s not an AI task. That’s seven different creative jobs happening simultaneously while also satisfying strict structural requirements.

No wonder it struggled.

The Solution: Two-Phase Workflow

Instead of asking for everything at once, I split it:

Phase 1: Linear Story (Creative Focus)

  • Generate single narrative path (no branches)
  • 15-20 nodes, beginning to end
  • Focus entirely on plot, characters, atmosphere
  • Takes 30 seconds to 2 minutes
  • 100% success rate

Phase 2: Branch Expansion (Structural Focus)

  • Take the linear story as foundation
  • Identify decision points
  • Create alternative branches
  • Expand to 10-16 unique endings
  • Add MBTI tracking to choices
  • Takes 2-5 minutes
  • 90% success rate (10-16 endings)

Separation of concerns. The AI no longer juggles creativity and structure simultaneously. It does one job well, then the other.

Test Results: The Tell-Tale Heart

I tested with Edgar Allan Poe’s “The Tell-Tale Heart”:

Phase 1:

  • Generated 20-node linear story
  • Perfect Gothic atmosphere
  • Strong character setup
  • Time: 30 seconds
  • Quality: Excellent

Phase 2 (Run 1):

  • Generated 10 endings
  • 54 total nodes
  • 19 choice nodes
  • Time: 2 minutes

Phase 2 (Run 2, same linear story):

  • Generated 19 endings
  • Different branching structure
  • AI generation variability = built-in creativity

Phase 2 (Enhanced prompts):

  • Generated 12 endings on first try
  • Perfect middle of target range

The two-phase approach not only works—it’s more reliable than single-pass ever was.

Why This Works

Cognitive Load Management: Creative writing uses different mental processes than structural planning. By separating them, the AI excels at both.

Better Foundation: The linear story provides coherent plot, characters, and atmosphere. Phase 2 branches from solid ground instead of building everything from scratch.

Iteration Without Waste: If Phase 2 doesn’t generate enough endings, I just re-run it. I don’t lose the creative work from Phase 1.

Flexibility: I updated the acceptance criteria to 10-16 endings (previously rigid 12+). The data showed 10 endings work fine, and 19 is too many. The workflow adapts to reality.

Korean Summary (한국어 요약)

AI에게 한 번에 모든 걸 요청하면 실패합니다. 창의적 글쓰기와 구조적 요구사항을 동시에 처리하기엔 너무 복잡하기 때문입니다.

2단계 워크플로우로 해결:

1단계 (선형 스토리):

  • 분기 없는 단일 서사 경로 생성
  • 플롯, 캐릭터, 분위기에 집중
  • 30초~2분 소요
  • 100% 성공률

2단계 (분기 확장):

  • 선형 스토리를 기반으로 선택지 추가
  • 10~16개 엔딩 생성
  • 2~5분 소요
  • 90% 성공률

테스트 결과 (The Tell-Tale Heart):

  • 1차 실행: 10개 엔딩
  • 2차 실행: 19개 엔딩 (AI의 창의적 변수)
  • 강화 프롬프트: 12개 엔딩 (완벽)

단순히 더 나은 프롬프트를 작성하는 것이 아니라, 작업 자체를 재설계해야 합니다.

What I Shipped

New System:

  • generate_linear_story.py - Phase 1 script
  • expand_to_branches.py - Phase 2 script
  • generate_story_twophase.py - Full orchestrator
  • expand_with_retry.py - Auto-retry for edge cases

Production Ready: The two-phase workflow is now the recommended approach for all future story generation.

Acceptance Criteria Updated: 10-16 endings (flexible range matching real-world results).

Bonus: Directory Cleanup

While testing the workflow, I noticed the generator directory had become a mess—20+ files at root level, test scripts mixed with production code, scattered documentation.

Cleaned it up:

  • Created tests/ folder (9 test files)
  • Created examples/ folder (example stories)
  • Moved documentation to docs/ (8 files consolidated)
  • Archived old scripts (5 files)
  • Root directory: 20+ files → 5 essential files

Sometimes the best time to clean up technical debt is when you’re already deep in the code.

What I Learned

1. Don’t Optimize Prompts—Redesign Tasks

When AI consistently fails at something, the problem might not be the model. It might be that you’re asking it to do too many things at once.

2. Constraints Can Unlock Creativity

Restricting Phase 1 to “linear story only” freed the AI to focus on quality. No decision paralysis about branching structure. Just tell a good story.

3. Real-World Data > Ideal Requirements

I wanted 12-16 endings because it sounded right. But the data showed 10 endings work fine for complex narratives, and 19+ dilutes quality. Updated the requirements to match reality.

4. Separation of Concerns Works for AI Too

Software engineering principle: separate concerns, minimize coupling. Turns out this applies to AI workflows. Creative writing and structural requirements are separate concerns. Treat them that way.

Next Steps

  1. Generate new story packs using two-phase workflow
  2. Expand “I, Robot” story from 6 to 10-16 endings using Phase 2
  3. Test with additional classic novels
  4. Build social media presence (content marketing phase begins)

The technical foundation is solid. Time to focus on growth.


Building WhatIfClassics.com: An interactive story platform transforming classic literature into choice-driven experiences. Follow the journey at whatifclassics.com