The Data Architecture

“Three systems, one story.”

Writers Factory uses three distinct data systems that work together to manage your creative process. Understanding what each stores—and when—helps you understand where your work lives.


The Three Systems

graph TB
    subgraph Architecture ["WRITERS FACTORY DATA ARCHITECTURE"]
        direction LR
        
        RG[("RESEARCH GRAPH<br/>(Ingredients)")]
        style RG fill:#e1f5fe,stroke:#01579b
        
        FKB[("FOREMAN KB<br/>(Decisions)")]
        style FKB fill:#fff3e0,stroke:#e65100
        
        KG[("KNOWLEDGE GRAPH<br/>(Story Facts)")]
        style KG fill:#e8f5e9,stroke:#1b5e20
        
        %% Content
        RG --- C1["Characters<br/>Worlds<br/>Themes<br/>Plots<br/>Voices"]
        FKB --- C2["Genre Profile<br/>Voice Calib.<br/>Project State<br/>Selections"]
        KG --- C3["Entities<br/>Relationships<br/>Timeline<br/>Facts"]
        
        %% Stages
        subgraph Stages
            S1[BEFORE<br/>Learning Engine] --- RG
            S2[DURING<br/>All Phases] --- FKB
            S3[AFTER<br/>Writing] --- KG
        end
    end

1. Research Graph: Your Ingredients

Purpose: Store every research ingredient from your NotebookLM exports.

When it’s used: Learning Engine phases 1-5 (before writing)

What it stores:

  • Character variants (flaws, lies, arcs, archetypes)
  • World variants (rules, locations, secrets, tone)
  • Theme variants (questions, theses, symbols)
  • Plot variants (beats, structures, midpoints)
  • Voice variants (rhythms, metaphors, anti-patterns)

Key Insight: Contradictions Are Allowed

The Research Graph is a library, not a bible. You might have:

  • 3 different protagonist concepts
  • 2 conflicting magic systems
  • Multiple thematic angles

This is good! Creativity requires options. The Research Graph stores them all without forcing you to choose.

How Ingredients Become Story

When you run the Connection Point:

  1. Concept Generation reads all ingredients
  2. Cross-pollination finds compatible combinations
  3. You select your preferred concept
  4. Selected ingredients move to the Story Bible (canonical files)

Unused ingredients stay in the Research Graph—available for inspiration, secondary characters, or future projects.


2. Foreman KB: Your Decisions

Purpose: Store your creative decisions and project state.

When it’s used: Throughout the entire workflow

What it stores:

Category Examples
genre_calibration Primary genre, secondary genre, blend ratio, pacing
voice_calibration POV, tense, voice type, reference sample, metaphor domains
project_state Current mode, work order, chapter progress
selections Which concept you chose, which variants you preferred

Key Insight: Decisions, Not Content

The Foreman KB doesn’t store your prose or your Story Bible content. It stores the decisions that shape how content is generated:

  • “This project is Fantasy/Romance at 60/40”
  • “Use third person limited, past tense”
  • “Match this reference sample”
  • “Avoid these anti-patterns”

These decisions are injected into AI prompts at runtime.

Voice Bundle Example

When you complete Voice Calibration, the KB stores:

Category: voice_calibration
─────────────────────────────
pov              → third_person_limited
tense            → past
voice_type       → literary
metaphor_domains → ["nature", "machinery"]
reference_sample → "The rain fell like needles..."

When you enter DIRECTOR mode, _get_voice_bundle_context() reads these entries and builds the prompt injection.


3. Knowledge Graph: Your Story Facts

Purpose: Track entities, relationships, and facts from your written manuscript.

When it’s used: Writing phases (DIRECTOR and EDITOR modes)

What it stores:

  • Entities: Characters, locations, objects mentioned in your prose
  • Relationships: Who knows whom, who loves/hates whom
  • Facts: What happened, when, where
  • Timeline: Chronological order of events
  • Threads: Foreshadowing, callbacks, unresolved tension

Key Insight: Built From Your Writing

Unlike the Research Graph (imported) and Foreman KB (configured), the Knowledge Graph is extracted from your manuscript.

When you write a scene:

  1. The system extracts entities (“Marcus”, “the casino”)
  2. It identifies relationships (“Marcus entered the casino”)
  3. It tracks state changes (“Marcus is now suspicious”)
  4. It updates the graph

Used for Continuity

The Knowledge Graph prevents contradictions in your prose:

  • Characters who died don’t reappear
  • Objects stay where you put them
  • Relationships remain consistent
  • Timeline stays coherent

How They Work Together

graph TD
    %% Inputs
    NB_Export[NotebookLM Exports]
    Fast_In[Fast Start Answers]
    
    %% Databases
    RG[("RESEARCH GRAPH<br/>(Ingredients)")]
    FKB[("FOREMAN KB<br/>(Decisions)")]
    KG[("KNOWLEDGE GRAPH<br/>(Story Facts)")]

    %% Flow
    NB_Export --> RG
    Fast_In --> RG
    
    RG -- "Learning Engine" --> SB[("Story Bible Files")]
    
    SB --> FKB
    User[User Choices] --> FKB
    Genre[Genre Wizard] --> FKB
    
    FKB -- "Context Injection" --> SceneGen[Scene Generation<br/>(DIRECTOR Mode)]
    
    SceneGen --> KG
    KG -- "Continuity Check" --> Editor[EDITOR Mode]
    
    %% Feedback loops
    KG -.-> SceneGen
    FKB -.-> SceneGen

Example: Writing a Scene

When you ask DIRECTOR mode to write a scene:

  1. From Research Graph: (via Story Bible files)
    • Character psychology
    • World rules
    • Theme
    • Beat context
  2. From Foreman KB:
    • Voice calibration (POV, tense, reference sample)
    • Genre calibration (pacing expectations)
    • Anti-patterns to avoid
  3. From Knowledge Graph:
    • What happened in previous scenes
    • Current character states
    • Unresolved threads
    • Who’s alive, dead, present

All three combine to give the AI complete context for voice-consistent, continuity-aware scene generation.


Comparison Table

Feature Research Graph Foreman KB Knowledge Graph
Purpose Store ingredients Store decisions Store story facts
Source NotebookLM imports User choices, tournaments Manuscript extraction
Contradictions Allowed N/A Forbidden
When populated Phase 1 (Research Setup) Throughout During writing
Storage SQLite SQLite JSON/NetworkX
Persists after Always Always Always

Practical Implications

“Where’s my research?”

If you imported files but can’t find them:

  • Check workspace/research/ for your raw input files
  • Research Graph stores the parsed ingredients, not the files themselves
  • Use the Research panel to browse ingredients

“Where’s my voice calibration?”

Voice calibration is in the Foreman KB, not in files:

  • Stored under category voice_calibration
  • Read by _get_voice_bundle_context() at runtime
  • Persists between sessions

“Why doesn’t the AI remember what happened?”

The Knowledge Graph needs your manuscript:

  • If you haven’t written scenes yet, the graph is empty
  • The AI only knows what’s been extracted from your prose
  • Import existing manuscript to populate the graph

“Can I edit these databases directly?”

Technically yes, but not recommended:

  • Research Graph: Better to re-import fixed markdown files
  • Foreman KB: Better to recalibrate through UI
  • Knowledge Graph: Automatically maintained, manual edits may break consistency

Technical Reference

File Locations

System File Format
Research Graph research_graph.db SQLite
Foreman KB foreman_kb.db SQLite
Knowledge Graph knowledge_graph.json JSON (NetworkX)

Services

System Service File Key Class
Research Graph research_graph_service.py ResearchGraphService
Foreman KB foreman_kb_service.py ForemanKBService
Knowledge Graph graph_service.py KnowledgeGraphService

Two-Track Architecture

How Research Graph feeds concept generation

Voice Calibration

How decisions are stored in Foreman KB

Director Mode

How Knowledge Graph powers continuity


Three systems, working together, so you can focus on writing.