NarrativeGenerationTask
An iterative, multi-phase engine for generating long-form narratives with consistent characters, settings, and visual assets.
{
"subject": "The Last Martian",
"target_word_count": 5000,
"number_of_acts": 3,
"scenes_per_act": 3,
"writing_style": "cinematic thriller",
"tone": "suspenseful",
"point_of_view": "third person limited",
"generate_scene_images": true,
"generate_cover_image": true,
"narrative_elements": {
"theme": "isolation",
"conflict": "man vs nature"
}
}
Scene 1: The Red Dust
Setting: Ares Base Alpha | Characters: Elias Thorne
The wind didn't howl on Mars; it hissed. Elias Thorne pressed his gloved hand against the reinforced polycarbonate of the hab-dome...
Test Workspace: NarrativeGenerationTask
Explore the generated artifacts, including narrative_data.json, scene illustrations, and character reference portraits.
Configuration Parameters
| Field | Type | Description |
|---|---|---|
subject* |
String | The core subject or scenario to develop into a narrative. |
target_word_count |
Int | Desired length (Default: 5000). |
number_of_acts |
Int | Structural acts, typically 3 or 5 (Default: 3). |
scenes_per_act |
Int | Average scenes per act (Default: 3). |
writing_style |
String | e.g., 'literary', 'thriller', 'technical' (Default: 'literary'). |
tone |
String | e.g., 'dramatic', 'humorous', 'suspenseful' (Default: 'dramatic'). |
point_of_view |
String | e.g., 'first person', 'third person limited'. |
detailed_descriptions |
Boolean | Include vivid sensory details (Default: true). |
include_dialogue |
Boolean | Include character dialogue (Default: true). |
generate_scene_images |
Boolean | If true, uses DALL-E/Midjourney to visualize each scene. |
generate_cover_image |
Boolean | Generates a visual seed for the entire narrative. |
revision_passes |
Int | Number of self-editing passes per scene (Default: 2). |
Task Execution Lifecycle
Phase 1: Narrative Analysis
The agent performs a deep reasoning pass to establish themes, character arcs, and world-building constraints based on the subject and input files.
Phase 2: Multi-Level Outlining
Generates a high-level act structure, then expands each act into detailed scene summaries including purpose, emotional arcs, and character states.
Phase 3: Iterative Generation
Writes scenes one by one. Each scene receives the full context of previous "Key Moments" and "Character States" to ensure continuity. Optional revision passes improve prose quality.
Phase 4: Final Assembly & Data Export
Compiles the full narrative into a single document and exports all metadata, including character arcs and scene statistics, to narrative_data.json.
Embedded Execution
Invoke the Narrative engine programmatically using the UnifiedHarness.
import com.simiacryptus.cognotik.plan.tools.writing.NarrativeGenerationTask
import com.simiacryptus.cognotik.plan.tools.writing.NarrativeGenerationTask.NarrativeGenerationTaskExecutionConfigData
import com.simiacryptus.cognotik.plan.tools.writing.NarrativeGenerationTask.Companion.NarrativeGeneration
// 1. Define the Job
val executionConfig = NarrativeGenerationTaskExecutionConfigData(
subject = "The Silicon Uprising",
target_word_count = 10000,
writing_style = "cyberpunk",
tone = "noir",
generate_cover_image = true,
generate_scene_images = true,
revision_passes = 2
)
// 2. Run via Harness (Headless/Serverless mode)
harness.runTask(
taskType = NarrativeGeneration,
typeConfig = TaskTypeConfig(), // Default static config
executionConfig = executionConfig,
workspace = File("./output/stories"),
autoFix = true
)
💡 Pro Tip: Visual Consistency
When generate_cover_image is enabled, the engine uses the generated cover as a visual seed for all subsequent character and scene illustrations, ensuring stylistic coherence across the entire narrative.