Template Inheritance & Custom Overrides
StudioBrain resolves templates through a layered system where more specific definitions override more general ones. This lets the platform ship sensible defaults while giving users full control over their entity schemas.
Resolution Order
When StudioBrain needs the template for an entity type (e.g. character), it checks multiple sources in order. The last match wins — later layers override earlier ones.
Catalog (studiobrain-templates repo)
└── Core (_Templates/Core/) ← built-in, read-only
└── Standard (_Templates/Standard/) ← from packs/catalog
└── Custom (_Templates/Custom/) ← your overrides
└── User (inline frontmatter overrides)| Layer | Source | Purpose | Who Manages |
|---|---|---|---|
| Catalog | studiobrain-templates GitHub repo, installed on demand via catalog installs | Curated official templates from Biloxi Studios | Biloxi Studios |
| Core | _Templates/Core/ in the project | Built-in base templates (read-only, auto-updated) | System |
| Standard | _Templates/Standard/ in the project | Templates installed from packs or the catalog | System / marketplace |
| Custom | _Templates/Custom/ in the project | User overrides for any Standard or Core template | User |
| User | Inline frontmatter on individual entity files | Per-entity field overrides | User |
How Overrides Work
To override a template, create a file with the same entity_type in a higher-priority directory. For example, to customize the Character template:
- The catalog provides
CHARACTER_TEMPLATE.mdwith fields likename,age,backstory,traits. - Installing it from the catalog copies it into
_Templates/Standard/CHARACTER_TEMPLATE.md. - You create
_Templates/Custom/CHARACTER_TEMPLATE.mdwith your version — perhaps adding afactionfield and removingage. - StudioBrain uses your Custom version because Custom takes precedence over Standard.
You only need to include the fields you want in your Custom override. The override replaces the entire template definition for that entity type — it does not merge fields from multiple layers.
User-Level Overrides
Individual entity files can override specific template fields in their own frontmatter. This is useful for one-off entities that need extra fields without changing the template for all entities of that type.
---
entity_type: character
name: Kira Volkov
# Extra field not in the template:
military_rank: Commander
---The extra military_rank field is stored and displayed alongside the template-defined fields. It does not affect other Character entities.
Catalog Installs and Upgrades
The official catalog is the studiobrain-templates repo. Catalog entries (templates, rules, skills, layouts, and other definition kinds) are installed on demand — there is no background sync service and no CATALOG_* environment variables.
| Route | What it does |
|---|---|
POST /api/catalog/:kind/:id/download | Fetches the entry from the upstream repo, writes it into the project directory (templates go to _Templates/Standard/), and records the install in catalog_installs |
POST /api/catalog/:kind/:id/upgrade | Line-based three-way merge of your local copy against the current upstream and the version you installed, so your edits are preserved |
GET /api/catalog/installs, GET /api/catalog/sync/status | Installed entries and sync status |
POST /api/catalog/sync/run | Admin-only “Sync now” trigger; a no-op, since installs fetch upstream themselves |
These filesystem-backed routes run in the self-hosted/native server. On the Cloudflare edge (api.studiobrain.ai), download, upgrade, installs and status answer 501 naming the missing capability, and the catalog is browsed and applied through GET /api/template-packs and POST /api/template-packs/apply instead (see Template Packs).
If you have a file with the same name in _Templates/Custom/, it continues to take precedence over the updated Standard copy.
Three-Way Merge of Overlays (Cloud)
StudioBrain Cloud only. Tenant overlays are stored in the
template_overlaystable (one row perentity_typeand tenant, withbase_version,customizations,merged_fieldsandpending_conflicts) in the project’s database.
When the Standard template an overlay was forked from changes, a per-field three-way merge reconciles your customizations with the new base:
| Scenario | Outcome |
|---|---|
| New field added in the new base only | AutoMerge — you get the new field |
| Field removed from the new base | Removed from the merged result |
| Only you changed the field | UserOnly — your value is kept |
| Neither side changed the field | NoOp — passes through |
| Both sides changed the field | Conflict — your value wins, and the conflict is recorded in pending_conflicts |
Conflicts never block: your customizations are always preserved.
Endpoints
GET /api/templates/updates # status for every overlay
GET /api/templates/updates/:entity_type # status for one overlay (null if none)
GET /api/templates/updates/:entity_type/conflicts # pending conflicts
POST /api/templates/updates/:entity_type/merge # run the three-way merge and persist
POST /api/templates/updates/:entity_type/resolve # clear one pending conflictMerge body:
{
"new_base": { "field_name": "value" },
"base": { "field_name": "value" }
}base is optional and defaults to the stored merged_fields. The response is the merge report with added, removed, conflicts, and per-field field_diffs.
Resolve body:
{ "field_name": "some_field", "resolution": "base" }resolution must be base, user, or custom. Resolving clears that field from pending_conflicts; the merged fields were already written by /merge.
Cloud Edition: Overlay Resolution
StudioBrain Cloud only. Core uses filesystem-only resolution as described above.
On StudioBrain Cloud, tenant customizations are stored as overlay rows (template_overlays, managed through /api/templates/custom/:entity_type) in the project database instead of files in _Templates/Custom/. Cloud users edit templates through the UI exactly the same way; the overlay layer exists so customizations do not need filesystem access.
Community Content
Community-contributed content comes from the separate studiobrain-community-plugins repository (its plugin catalog is read from plugins/index.json).
Community content is not covered by StudioBrain support. Review community templates before installing, especially if they include generation rules that will influence AI output.
Creating a Custom Override
On a self-hosted or desktop project:
- Find the template you want to override in
_Templates/Standard/(or browse the marketplace). - Copy it to
_Templates/Custom/with the same filename. - Edit the frontmatter fields to match your needs.
# Example: customize the Character template
cp _Templates/Standard/CHARACTER_TEMPLATE.md _Templates/Custom/CHARACTER_TEMPLATE.md
# Edit _Templates/Custom/CHARACTER_TEMPLATE.md to add/remove fieldsTo revert to the Standard version, delete your Custom file. On Cloud, delete the overlay instead (DELETE /api/templates/custom/:entity_type).
Next Steps
- Template System Overview — What templates are and how they work
- AI Generation Rules — Constraints that guide AI content generation
- Template Packs — Installing bundled template sets