FLESHNOTE / DOCS / ENTITY SYSTEM

Entity System Architecture

CORE ENGINE

The foundational relational graph linking manuscript prose directly to structured worldbuilding data: characters, locations, customizable lore concepts, and clue-driven plot twists.

The Entity as the Atomic Unit of Worldbuilding #

In FleshNote, an Entity is not a static note card or an isolated wiki article. It is an active, relational data model integrated directly into the ProseMirror writing canvas via the {{type:id|text}} markup syntax.

Entities provide the contextual metadata required for FleshNote's specialized writing systems:

  • Inline Mark Tracking: Auto-completes when typing @ in the editor and maintains live bi-directional links.
  • Dynamic Context Synchronization: As you type or move the cursor, sidebars automatically refresh to show the inspected entity's lore filtered by the active chapter or paragraph time.
  • Sensory & Appearance Matrices: Feeds the Janitor NLP engine to calculate character co-occurrences and sensory density.

Entity Taxonomy & Unique Superpowers #

FleshNote organizes worldbuilding data into distinct domains, each equipped with specialized relational capabilities:

1. Character Entities (`characters`)

GOLD // #d4a052

Characters are the primary agents of narrative prose. Beyond standard bios, roles, statuses, and aliases, characters possess temporal superpowers:

  • Time-Anchored Knowledge States: Discrete facts tracked by who knows what and when they learned it. Lenses filter information based on the active chapter or world time.
  • Dynamic Relationship Turning Points: Unidirectional (subjective feelings like trust/spite) and mutual social bonds (married, allies) that evolve at specific chapters or dates.
  • Time Gutter Paragraph Reactivity: Setting a paragraph time override (e.g. a flashback) automatically shifts the active world time and updates the character's visible knowledge in real-time.
  • Live Age Calculator: Computes the character's exact in-world age against the custom world calendar.
➔ Deep Dive: Knowledge States & POV ➔ Deep Dive: Relationship Dynamics

2. Location Entities (`locations`)

GREEN // #5c9e6e

Locations represent the spatial environment of the story, organized into an intuitive tree with atmospheric inheritance:

  • Hierarchical Nesting (Self-Referencing Tree): Locations reference a parent_location_id with built-in cyclic protection and drag-and-drop tree reordering.
  • 5-Level Cascading Weather Inheritance: Setting "Heavy Blizzard" on a parent region (e.g. The Northern Reach) automatically cascades down to all child rooms and points of interest unless explicitly overridden.
  • Cursor-Synchronized Weather Context: Moving your cursor in the editor refreshes the Location Inspector to display the exact weather condition at that story moment.
➔ Deep Dive: Hierarchical Locations & Weather

3. Lore Items & Flexible Concepts (`lore_entities`)

BLUE // #5c8ec4

Generic Catch-All Classification: Rather than forcing writers into rigid schemas (e.g., hardcoding distinct tables for spells vs artifacts vs religions), FleshNote uses an open-ended lore model.

  • Custom User Categories: Writers define their own arbitrary categories (e.g. artifact, magic_spell, organization, relic, concept, vehicle, deity) via project configuration.
  • Unrestricted Creativity: The system adapts to any genre or worldbuilding complexity without code changes while preserving full linkification, autocomplete, and appearance tracking.
  • Dedicated Inspector Fields: Provides fields for rules, origin, limitations, aliases, and notes.

4. Foreshadowings & Plot Twists (`twists` & `foreshadowings`)

CRIMSON // #c45c5c

Replaces the Deprecated "Secrets" & "Danger Phrases" System: Legacy versions attempted to track secrets via keyword scans. This has been completely replaced by a structured, two-part clue-and-reveal lifecycle.

  • Clue Tracking & Quick Jumps: Authors highlight foreshadowing breadcrumbs ({{foreshadow:ID|clue}}) in chapters leading up to the reveal chapter ({{twist:ID|reveal}}).
  • Twist Spacing Warnings Engine: Heuristic analysis alerts the writer if clues are clustered too close together or if a "desert gap" leaves readers without hints for thousands of words.
  • Reader Experience Visualization: Multi-lane Plot Planner trajectory lines display clue distribution to audit pacing for complex mysteries.
➔ Deep Dive: Twists & Foreshadowing
Group & Faction Entities (Roadmap / Low Priority): backend/routes/groups.py contains basic entity scaffolding for factions and rosters. In future releases, Groups will receive a deep overhaul with time-varying member lists (tracking character joins/exits across timeline dates), faction agendas, and organizational hierarchy.

Cross-System Interconnections #

Entities are tightly interwoven across every layer of FleshNote:

Subsystem Interaction with Entity Graph Underlying Mechanism
TipTap Editor Inline linking, autocomplete menu, 300ms dead-link cleanup. {{type:id|text}} markdown marks translated to HTML span.entity-link.
Global Rename Wizard Full-text search and replace across all md/*.md chapter files. /api/project/entities/scan-references with exact vs unique fuzzy match dialog.
Entity Merging Combines duplicate entities, merges alias arrays, and updates text tags. /api/project/entities/merge regex-replaces old IDs across all chapters.
The Janitor NLP Entity co-occurrence matrix, character appearance tracking. Extracts entity IDs from chapter AST to compute co-presence and sensory correlation.
Plot Planner Character arc tracks, twist trajectories, and location timelines. Renders visual marker lanes tied to entity IDs along the narrative chapter axis.
Multi-Device Sync Field-level Last-Writer-Wins (LWW) conflict resolution. change_log tracks UUID-keyed modifications using Hybrid Logical Clocks.
On This Page