Managing Entities
Entities are the core data objects in StudioBrain. Each entity represents something in your world — a character, location, faction, item, quest, or any other type defined by a template. This guide covers the template system, creating and editing entities, validation with rules, and organizing your project.
Entity Types
StudioBrain ships with 15 built-in entity type templates. Each type is defined by a template file in _Templates/Standard/, and you can add your own.
| Entity Type | Template File | Description |
|---|---|---|
| Character | CHARACTER_TEMPLATE.md | People, NPCs, key figures — with identity, physical description, personality, relationships, skills, and dialogue samples |
| Location | LOCATION_TEMPLATE.md | Places, venues, landmarks — with atmosphere, notable features, associated NPCs, and faction control |
| District | DISTRICT_TEMPLATE.md | City zones and neighborhoods — with population, threat level, governing factions, and economic status |
| Faction | FACTION_TEMPLATE.md | Organizations, groups, gangs — with leadership, goals, territory, members, and political dynamics |
| Brand | BRAND_TEMPLATE.md | In-world companies and products — with industry, parent company, subsidiaries, and marketing |
| Item | ITEM_TEMPLATE.md | Objects, weapons, gear, technology — with type, rarity, stats, and vendor information |
| Job | JOB_TEMPLATE.md | Occupations and professions — with salary, required skills, and faction affiliation |
| Quest | QUEST_TEMPLATE.md | Missions and objectives — with requirements, rewards, stages, and related NPCs |
| Campaign | CAMPAIGN_TEMPLATE.md | Multi-quest story arcs — with linked quests, progression, and narrative structure |
| Event | EVENT_TEMPLATE.md | World events and incidents — with dates, participants, consequences, and impact |
| Dialogue | DIALOGUE_TEMPLATE.md | Branching conversation trees — with speakers, choices, conditions, and outcomes |
| Timeline | TIMELINE_TEMPLATE.md | Chronological event sequences — with dates, milestones, and linked entities |
| Style Bible | STYLE_BIBLE_TEMPLATE.md | Visual and narrative style guides — with tone, aesthetic, references, and constraints |
| Universe | UNIVERSE_TEMPLATE.md | Top-level world definitions — with setting, rules, themes, and global lore |
| Assembly | ASSEMBLY_TEMPLATE.md | Grouped entity collections — for organizing related entities into curated sets |
How Entity Types Work — The Template System
Templates are the foundation of StudioBrain. They define the structure of every entity type, and the entire system — from the editor UI to the AI generation to the TypeScript type safety — builds on top of them.
What Templates Do
A template is a Markdown file with YAML frontmatter that lists every field an entity of that type can have. When StudioBrain reads your project:
- Templates define fields — Every field you see in the Visual Editor comes from a template. Text fields, arrays, entity references, nested objects, production status — all declared in the template.
- Types auto-generate — The backend reads templates and generates TypeScript interfaces and Zod validation schemas automatically. This means the frontend has compile-time type safety for every entity field.
- UI renders dynamically — The Visual Editor renders form fields based on the template definition. No UI code changes are needed to support new fields or entity types.
- AI understands structure — Templates are included as context when the AI generates content, so it knows exactly what fields to produce and what format to use.
Template File Format
Every template follows the same structure: YAML frontmatter containing field definitions, followed by a Markdown body describing the entity type.
Here is a simplified excerpt from the Character template:
---
# METADATA
template_version: "2.0"
id: "[snake_case_name]"
entity_type: "character"
created_date: "[YYYY-MM-DD]"
last_updated: "[YYYY-MM-DD]"
status: "active"
# PRODUCTION STATUS TRACKING
production_status:
general: "concept"
game_uefn: "none"
tv_showrunner: "none"
notes: ""
# PRIMARY IMAGE
primary_image: ""
# BASIC IDENTITY
name: "[Generate Full Name]"
nickname: "[Generate Nickname]"
age: "18"
gender: "[male/female/non-binary]"
species: "human"
# TEMPORAL INFORMATION
birth_year: null
death_year: null
key_dates: []
current_age_reference_year: 1998
# PHYSICAL DESCRIPTION
height: "[Height in feet/inches]"
build: "[slim/average/muscular/heavyset]"
hair_color:
name: ""
hex: ""
eye_color:
name: ""
hex: ""
distinguishing_features:
- "[Unique physical feature 1]"
# RELATIONSHIPS
faction: "[Faction affiliation or independent]"
family: []
friends: []
enemies: []
romantic: []
# PERSONALITY & PSYCHOLOGY
personality_traits:
- "[Core trait 1]"
- "[Core trait 2]"
fears: []
motivations: []
secrets: []
# SKILLS & ABILITIES
primary_skills: []
secondary_skills: []
special_abilities: []
# AI GENERATION HELPERS
ai_profile_description: ""
ai_voice_style: ""
ai_bio_summary: ""
dialogue_samples: []
---
# [Character Full Name]
## Background
[Narrative content goes here...]
## Personality
[Free-form description...]
## Defining Moment
[Pivotal event that shaped the character...]Key things to notice:
- Every field is declared — the template acts as the schema. The placeholder values (like
"[Generate Full Name]") serve as hints for both human creators and AI generators. - Nested objects are supported — fields like
hair_colorwithnameandhexsub-fields, orproduction_statuswith multiple tracking fields. - Arrays are supported —
personality_traits,friends,dialogue_samples, etc. - Entity references — Fields like
factionandprimary_locationreference other entities by ID. - Markdown body — Below the YAML frontmatter, free-form narrative content provides rich descriptions that go beyond structured fields.
Field Types in Templates
Templates support the following field types, determined by the YAML value format:
| YAML Pattern | Field Type | Editor Widget |
|---|---|---|
field: "" | Text (string) | Single-line text input |
field: 0 | Number | Number input |
field: null | Optional value | Text input, nullable |
field: "option_a" with comment listing options | Enum / Select | Dropdown selector |
field: [] | Array of strings | Array editor (add/remove items) |
field: with nested keys | Object | Grouped sub-fields |
field: with - key: value items | Array of objects | Complex array editor |
Adding a New Entity Type
One of StudioBrain’s most powerful features is that adding a new entity type requires zero code changes. To create a custom entity type:
-
Create a template file in
_Templates/Standard/:_Templates/Standard/VEHICLE_TEMPLATE.md -
Define the fields in YAML frontmatter:
--- template_version: "1.0" id: "[snake_case_name]" entity_type: "vehicle" created_date: "[YYYY-MM-DD]" last_updated: "[YYYY-MM-DD]" status: "active" production_status: general: "concept" primary_image: "" name: "[Vehicle Name]" vehicle_type: "[car/truck/motorcycle/aircraft/boat]" manufacturer: "[Brand reference]" year: 0 top_speed: "" fuel_type: "" condition: "[pristine/good/worn/damaged/wrecked]" owner: "[Character reference]" location: "[Location reference]" special_modifications: [] --- # [Vehicle Name] ## Description [Physical description and history of this vehicle...] -
Regenerate types — Run the type generator (this happens automatically on
npm run dev):npm run generate:types -
Start using it — The new “Vehicle” entity type appears in the sidebar, the Visual Editor renders all your fields, the AI Workshop understands the schema, and TypeScript types are available for any custom UI components.
Production Status Tracking
Every template includes a production_status block that tracks an entity’s progress across multiple pipelines:
| Field | Purpose | Values |
|---|---|---|
general | Overall content status | concept, in_progress, needs_work, narrative_done, art_done, complete |
game_uefn | Game/UEFN pipeline | none, planned, in_progress, review, published, live |
tv_showrunner | TV/showrunner pipeline | none, planned, in_progress, review, episode, current, archived |
notes | Free-form production notes | Any text |
The Production Status component block in the Visual Editor provides a visual pipeline tracker for these fields.
Validation and Rules
Rules files in the _Rules/ directory define constraints for AI generation and power the Validation Panel in the entity editor. There are 16 rules files covering entity-specific and cross-cutting concerns.
How Rules Work
Each rules file is a Markdown file with YAML frontmatter containing:
system_prompt— Context provided to the AI when generating content for this entity type. This shapes the AI’s understanding of tone, setting, and constraints.rules— A list of individual validation rules, each with an ID, category, priority, and validation type.
Here is a simplified excerpt from CHARACTER_RULES.md:
---
system_prompt: "Generate a character for the universe. Characters should
reflect the era's culture while showing impact of corporate environmental
neglect. Balance humor with genuine trauma."
entity_type: character
template_reference: CHARACTER_TEMPLATE.md
rules:
- id: char_001
category: identity
priority: critical
rule: Every character MUST have a primary_location
validation_type: error
- id: char_002
category: naming
priority: critical
rule: Character IDs must use lowercase_with_underscores format
validation_type: error
- id: char_003
category: relationships
priority: high
rule: Friends always use nicknames when available
validation_type: warning
- id: char_004
category: timeline
priority: critical
rule: No modern technology references
validation_type: error
- id: char_005
category: tone
priority: high
rule: Characters must balance dark humor with genuine trauma
validation_type: warning
---Rule Priorities
| Priority | Meaning | Behavior |
|---|---|---|
| Critical | Must be followed | Entity is flagged with an error; AI generation rejects violations |
| High | Should be followed | Warning displayed; AI uses as strong guidance |
| Medium | Recommended | Suggestion displayed; AI uses as soft guidance |
| Low | Nice to have | Informational; AI may consider |
Validation Types
| Type | Display | Meaning |
|---|---|---|
| error | Red indicator | Critical issue that should be fixed before the entity is considered complete |
| warning | Yellow indicator | Non-critical issue that may affect consistency or quality |
| info | Blue indicator | Suggestion or informational note |
The Validation Panel
The Validation Panel appears in the entity editor and checks your entity data against the rules defined for its type. It shows:
- Errors (red) — Critical issues such as missing required fields, invalid ID formats, or rule violations
- Warnings (yellow) — Non-critical issues such as suggested fields that are empty or style inconsistencies
- Info (blue) — Informational notes and suggestions
When all fields pass validation, the panel shows a green “All fields valid” indicator.
Each validation issue includes:
- The field path that has the problem
- A description of what needs to change
- A clickable link to navigate directly to the field in the editor
Available Rules Files
| Rules File | Entity Scope | Key Rules |
|---|---|---|
CHARACTER_RULES.md | Characters | Location required, ID format, timeline consistency, faction speech patterns |
LOCATION_RULES.md | Locations | Atmosphere, brand presence, NPC associations |
DISTRICT_RULES.md | Districts | Territory boundaries, faction control, population |
FACTION_RULES.md | Factions | Leadership, goals, territory, member dynamics |
BRAND_RULES.md | Brands | Product lines, marketing, corporate hierarchy |
ITEM_RULES.md | Items | Rarity, stats, vendor requirements |
JOB_RULES.md | Jobs | Skills, faction affiliation, salary |
DIALOGUE_RULES.md | Dialogues | Conversation flow, personality expression, speech patterns |
CONTENT_RULES.md | All entities | Global content standards and quality |
GENERATION_RULES.md | All entities | AI generation behavior and output format |
IMAGE_GENERATION_RULES.md | Image generation | Visual style, prompt structure, consistency |
VOICE_GENERATION_RULES.md | Voice generation | Voice profiles, pronunciation, emotion |
STORY_RULES.md | Narrative content | Story structure, pacing, themes |
TIMELINE_RULES.md | Timelines | Chronological ordering, date validation |
UNIVERSE_RULES.md | Universes | World-level lore, setting rules |
WORLD_LORE_RULES.md | All entities | Cross-entity lore consistency |
The Fix Dialog
Clicking the Fix button (wrench icon) on a validation issue opens the Fix Dialog, which offers three tiers of automated repair:
| Fix Tier | Description | Cost |
|---|---|---|
| Auto-fix (Rule-based) | Instant fixes for formatting, missing dates, and common structural issues | Free |
| Local AI (Qwen) | Uses your local Qwen model for context-aware fixes that understand the entity | Free (requires local AI setup) |
| Premium AI | Uses cloud AI providers (OpenAI, Anthropic, etc.) for sophisticated, lore-aware fixes | Uses BrainBits or API credits |
The Fix Dialog presents a diff view (side-by-side comparison) so you can review exactly what changes will be made before applying them.
Creating a New Entity
- Navigate to the entity type list page (e.g., Characters in the sidebar).
- Click the New button in the top-right corner.
- Fill in the required fields — at minimum, the entity needs a name.
- Click Save to create the entity file.
The entity is stored as a Markdown file in the project directory. For example, a character named “Rex Marshall” creates:
Characters/rex_marshall/CH_rex_marshall.mdThe file follows the structure defined by the entity’s template, with your field values filled in and the Markdown body section ready for narrative content.
Entity Data Structure
Every entity is backed by a Markdown file with two parts, defined by its template:
Frontmatter Fields
Structured data stored as YAML key-value pairs. These are the fields you see in the Visual Editor. The available fields come from the entity’s template:
---
name: Rex Marshall
nickname: Rex
age: "34"
gender: male
species: human
faction: the_syndicate
primary_location: downtown_district
personality_traits:
- resourceful
- cynical
- loyal
production_status:
general: wip
game_uefn: concept
tv_showrunner: draft
relationships:
- entity: sara_chen
type: ally
description: Trusted partner from the old days
---Markdown Body
Free-form narrative content that follows the frontmatter, separated by ---:
---
name: Rex Marshall
...
---
# Rex Marshall
## Background
Rex Marshall grew up in the corporate districts before a
scandal forced him underground. Now he works as muscle
for The Syndicate, though his loyalties are more complex
than they appear.
## Defining Moment
The night of the Blackout Incident changed everything...The Markdown body sections are also defined by the template — each template includes section headings (Background, Personality, Defining Moment, etc.) that guide content creation.
Editing Entities
Visual Editor Tab
The Visual Editor presents your entity’s fields in an organized, form-based layout. Sections are defined by layout JSON files and the entity’s template. Field types include:
- Text fields — Single-line inputs for names, titles, IDs
- Textarea fields — Multi-line inputs for descriptions and notes
- Select/Dropdown fields — Choosing from predefined options (e.g., status, type, condition)
- Array fields — Lists of strings (e.g., skills, equipment, traits)
- Complex array fields — Lists of objects (e.g., relationships with entity reference, type, and description)
- Entity reference fields — Link to other entities with inline search and auto-complete
- Number fields — Numeric values for ages, counts, scores
- Nested object fields — Grouped sub-fields (e.g., hair_color with name and hex)
- Rating selectors — Numeric scales for attributes like threat level or influence
YAML Editor Tab
For power users, the YAML tab gives you direct access to the raw frontmatter in a full Monaco code editor with syntax highlighting, auto-completion, and error detection. Changes validate in real-time.
Markdown Editor Tab
The Markdown tab provides a rich editor for the entity’s narrative body content. You can write and preview Markdown with support for headings, lists, tables, code blocks, links, and images.
Component Blocks
Layout sections can contain component blocks — rich interactive widgets that go beyond simple form fields:
| Block | Purpose |
|---|---|
| Entity Assets | Upload and manage images, set primary image, assign asset roles |
| Entity Timeline | View and manage chronological events |
| Entity Chat | AI-powered conversational editing panel (ask questions, request changes) |
| Entity Relationships | Auto-discovered relationship links rendered as grouped cards |
| Production Status | Visual pipeline status editor across general, game, and TV tracks |
| Primary Image | Hero image display with placeholder fallback |
| Markdown Content | Rendered Markdown body preview |
| Workflow Trigger | ComfyUI workflow integration for image generation |
Plugin blocks can also be placed in layouts, extending the editor with custom functionality.
Organizing Entities
Search and Filtering
Each entity list page includes:
- Text search — Filter entities by name or content
- Category filters — Filter by type-specific categories (e.g., faction type, item rarity, production status)
- Sort options — Sort by name, date created, date modified, or other fields
Cross-Entity Search
The Cross-Entity Search page (accessible from the sidebar) lets you search across all entity types at once. This is useful for finding references to a character across locations, factions, items, and quests.
Relationship Graph
The Relationship Graph provides a visual network view of all entity connections. Nodes represent entities and edges represent relationships. You can:
- Pan and zoom the graph
- Click nodes to navigate to entities
- Filter by entity type or relationship type
- See relationship strength and direction
Recycle Bin
Deleted entities are moved to the Recycle Bin rather than permanently destroyed. From the Recycle Bin you can restore entities or permanently delete them.
Entity File Naming Conventions
StudioBrain uses consistent file naming conventions for each entity type:
| Entity Type | Prefix | Example |
|---|---|---|
| Character | CH_ | CH_rex_marshall.md |
| Location | LOC_ | LOC_neon_mile.md |
| District | DST_ | DST_old_quarter.md |
| Faction | FAC_ | FAC_the_syndicate.md |
| Brand | BR_ | BR_nexus_corp.md |
| Item | ITEM_ | ITEM_plasma_blade.md |
| Job | JOB_ | JOB_enforcer.md |
| Quest | QST_ | QST_find_the_cure.md |
| Campaign | CMP_ | CMP_outbreak_saga.md |
| Event | EVT_ | EVT_blackout_incident.md |
| Dialogue | DLG_ | DLG_interrogation.md |
| Timeline | TL_ | TL_outbreak_history.md |
| Style Bible | STY_ | STY_visual_guide.md |
| Universe | UNI_ | UNI_city_of_brains.md |
| Assembly | ASM_ | ASM_main_cast.md |
Entity IDs always use lowercase_with_underscores format.
Next Steps
- AI Workshop — Generate and refine content using AI with template and rules context
- Sync & Collaboration — Sync entities across desktop and cloud
- Settings & Configuration — Template management and plugin configuration
- Using Plugins — Extend the entity editor with plugin panels