Technical DocumentationData, Generation & Output Layers

Data, Generation & Output Layers

Every node in the tree — from Series down to Beat — shares the same three-layer internal structure. This is one of the most important architectural decisions in Writan and distinguishes it from tools that treat a story as a flat text document.

The Three Layers

LayerWhat It IsExamples
Data LayerStructured information that underpins the node. Machine-readable. Never directly read by a reader.Characters, locations, objects, freeform blocks
Generation LayerThe process by which data was transformed into prose. Captures intent, constraints, and intermediate steps.Beat notes, AI prompts used, decisions made and logged
Output LayerThe readable prose. The text a reader will eventually encounter.Finished narrative prose, dialogue

Data Layer: Block Types

The data layer holds an array of blocks, either typed or freeform:

Typed Blocks

// Character block
{
  blockType: 'character',
  name: string,
  role: 'protagonist' | 'antagonist' | 'supporting' | 'minor',
  description: string,
  motivation: string,
  secret: string,
  fear: string,
}
 
// Location block
{
  blockType: 'location',
  name: string,
  description: string,
  atmosphere: string,
}
 
// Object block
{
  blockType: 'object',
  name: string,
  description: string,
  significance: string,
}

Freeform Blocks

{
  blockType: 'freeform',
  label: string,    // writer-defined: "Theme", "Chekhov's Gun", etc.
  content: string,
  tags: string[],
}

Generation Layer

The generation layer records how content was produced:

{
  beatNotes: string,
  aiPrompts: AIPromptEntry[],   // currently defined but not populated
  decisions: DecisionEntry[],   // populated when pips are dismissed
}

The decisions array is actively used — when a pip is dismissed, the dismissal is recorded here as part of the audit trail. The aiPrompts array exists in the schema but is not yet populated by any code path.

The Non-Destructive Principle

Because every node retains its data and generation layers alongside its output, no layer is ever destroyed by the act of writing the next one:

  • Prose written over a beat does not delete the beat notes
  • Pip dismissals are logged with reasons and timestamps
  • The full history of a node’s development is preserved

This is not version history as a feature. It is a fundamental architectural commitment: the story is a process, not a document.