Core Concepts
Reasoning
Memory & Retrieval
Agent Types
Design Patterns
Training & Alignment
Frameworks
Tools
Safety & Security
Evaluation
Meta
Core Concepts
Reasoning
Memory & Retrieval
Agent Types
Design Patterns
Training & Alignment
Frameworks
Tools
Safety & Security
Evaluation
Meta
Generating long, coherent stories is one of the hardest creative tasks for LLMs. Single-model approaches struggle with maintaining character consistency, plot coherence, and discourse structure across thousands of words. StoryWriter (2025) addresses this through a multi-agent framework where specialized agents handle planning, writing, and consistency checking to produce narratively coherent long-form fiction.
StoryWriter decomposes story generation into distinct responsibilities handled by specialized agents:
Outline Agent: Generates a structured sequence of event tuples, each linked to specific characters. It validates each event for plausibility and narrative coherence, providing feedback that shapes subsequent events. This creates the story's backbone – a causally connected chain of events rather than an unstructured prompt.
Planning Agent: Expands individual events into sub-events and performs global chapter assignment. It ensures that key characters and plot elements reappear across chapters, preventing the homogeneity problem where each chapter feels disconnected. The planning agent operates at a global scope, seeing the full story arc.
Coordinator Agent: Oversees narrative architecture during the writing phase. It manages relevant history via the ReIO (Relevant Information Only) mechanism, which summarizes cached writing histories to filter only contextually relevant prior events and characters. The Coordinator evaluates draft output against structural requirements and triggers rewrites when coherence breaks down.
FinalWriter Agent: Focuses exclusively on stylistic uniformity and text quality. After the Coordinator approves structural coherence, the FinalWriter polishes prose, ensuring consistent voice, tone, and style across the entire narrative.
StoryWriter maintains coherence through multiple reinforcing strategies:
Event-Based Outlines: Stories are structured around event tuples rather than free-form summaries. Each event $e_i$ is defined as:
$$e_i = (\text{characters}_i, \text{action}_i, \text{consequence}_i, \text{location}_i)$$
with explicit causal links: $e_i \rightarrow e_{i+1}$ through consequence-to-precondition chaining.
Global Chapter Planning: Rather than generating chapters sequentially in isolation, the planning agent assigns events and characters to chapters from a global perspective, enabling:
ReIO Mechanism: Long stories quickly exceed context windows. ReIO addresses this by maintaining compact summaries of prior writing, filtering to include only information relevant to the current chapter. This prevents context window overflow without losing essential narrative details.
Iterative Rewriting: The Coordinator evaluates each draft segment against the story structure and triggers targeted rewrites rather than accepting first-draft output.
class StoryWriter: def __init__(self, outline_agent, planning_agent, coordinator, final_writer): self.outliner = outline_agent self.planner = planning_agent self.coordinator = coordinator self.writer = final_writer def generate_story(self, premise, num_chapters=10): events = self.outliner.generate_event_sequence(premise) events = self.outliner.validate_and_refine(events) chapter_plan = self.planner.assign_to_chapters( events, num_chapters=num_chapters ) chapter_plan = self.planner.expand_sub_events(chapter_plan) story_chapters = [] writing_history = WritingHistory() for chapter in chapter_plan: relevant_context = writing_history.reio_summarize( current_chapter=chapter ) draft = self.coordinator.write_chapter( chapter_plan=chapter, context=relevant_context ) while not self.coordinator.evaluate_coherence(draft, chapter): feedback = self.coordinator.get_feedback(draft, chapter) draft = self.coordinator.rewrite(draft, feedback) polished = self.writer.polish(draft) story_chapters.append(polished) writing_history.add(chapter, polished) return Story(chapters=story_chapters, outline=events) class WritingHistory: def __init__(self): self.chapters = [] self.summaries = [] def reio_summarize(self, current_chapter): relevant = [] for prev_chapter, summary in zip(self.chapters, self.summaries): shared = set(current_chapter.characters) & set(prev_chapter.characters) if shared or self.has_causal_link(prev_chapter, current_chapter): relevant.append(summary) return "\n".join(relevant)
StoryWriter is evaluated on the HANNA benchmark across six narrative quality criteria:
| Criterion | What It Measures |
|---|---|
| Relevance | Story alignment with the given premise |
| Coherence | Logical consistency across the narrative |
| Empathy | Reader emotional engagement |
| Surprise | Narrative unpredictability and interest |
| Engagement | Overall readability and flow |
| Complexity | Depth of plot and character development |
StoryWriter outperforms baselines including DOC and GPT-4o-mini on relevance and coherence. Ablation studies confirm that removing either the structured outlines or the planning agent degrades quality significantly.