Narrative Theory as Code
The core innovation of the [[denote:20251019T134950][drama project]]: converting classical narrative theory into executable validators.
Concept
Instead of hoping generated stories follow dramatic principles, test them programmatically using narrative theory as the specification.
Think of it as test-driven story development where literary theory provides the test suite.
Theory → Code Mappings
Aristotle’s Poetics
Unity of Action:
class AristotelianUnityValidator:
def validate(self, sketch):
# Check single coherent action
# Check appropriate magnitude (not too few/many events)
# Return pass/fail + feedback
Peripeteia (Reversal):
class PeripeteiaValidator:
def validate(self, sketch):
# Check each character arc has reversal of fortune
# Score = coverage across all arcs
Anagnorisis (Recognition):
class AnagnorisisValidator:
def validate(self, sketch):
# Check characters have moment of recognition/discovery
# Score = coverage across all arcs
Propp’s Morphology
Character Spheres: - Villain, Donor, Helper, Princess, Dispatcher, Hero, False Hero - Validate characters fill required spheres - Check functions (31 narrative functions) appear in sequence
Todorov’s Grammar
Narrative Sequence: - Equilibrium → Disruption → Resolution - Validate proposition sequences - Check temporal coherence
Genette’s Narratology
- Order: Analepsis (flashback), prolepsis (flash-forward)
- Focalization: POV consistency
- Voice: Narrative voice coherence
Implementation
Source material: Todorov’s “Grammaire du Décaméron” (full text in ~/proj/drama/seeds/todorov.txt)
Validators in: ~/proj/drama/src/drama/validators/narrative/
Multiple Test Types
- Structural - Pydantic schemas enforce Aristotelian rules
- LLM Judge - Fresh LLM evaluates without generation context
- Internal - Generating LLM checks its own work
- Constraint Propagation - Failed tests trigger corrective generation
Granularities
- Micro: Individual propositions (“does this action advance the arc?”)
- Meso: Scene/course level (“does this dinner course contain reversal?”)
- Macro: Complete arcs (“did each guest achieve anagnorisis?”)
Why This Matters
Narrative theory often feels abstract and subjective. By encoding it as tests, we make it: - Concrete: Clear pass/fail criteria - Reproducible: Same story always gets same result - Iterative: Generate → Test → Fix → Re-test
We can also analyze what works: which narrative structures pass tests most reliably? Which LLM strategies produce better dramatic arcs?
Example
sketch = generate_sketch(premise="A mysterious dinner party")
results = [
AristotelianUnityValidator().validate(sketch),
PeripeteiaValidator().validate(sketch),
AnagnorisisValidator().validate(sketch),
]
if all(r.passed for r in results):
proceed_to_spec_generation(sketch)
else:
refine_sketch_based_on_feedback(sketch, results)
Related Notes
- [[denote:20251019T134950]] - Drama Project
- Multi-Stage Story Generation with Validation - Multi-Stage Generation
Status: Seedling | Created: 2025-10-19