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)
LayerSourcePurposeWho Manages
Catalogstudiobrain-templates GitHub repo, synced via CatalogSyncCurated official templates from Biloxi StudiosBiloxi Studios
Core_Templates/Core/ in the projectBuilt-in base templates (read-only, auto-updated)System
Standard_Templates/Standard/ in the projectTemplates installed from packs or the catalogSystem / marketplace
Custom_Templates/Custom/ in the projectUser overrides for any Standard or Core templateUser
UserInline frontmatter on individual entity filesPer-entity field overridesUser

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:

  1. The catalog provides CHARACTER_TEMPLATE.md with fields like name, age, backstory, traits.
  2. CatalogSync copies it into _Templates/Standard/CHARACTER_TEMPLATE.md.
  3. You create _Templates/Custom/CHARACTER_TEMPLATE.md with your version — perhaps adding a faction field and removing age.
  4. 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.

Template Versioning

Templates include a template_version field in their frontmatter:

template_version: "2.1"

When CatalogSync pulls an updated template from the catalog, StudioBrain compares the version against the locally installed copy. If the catalog version is newer, a notification appears in the UI prompting the user to update. Updates never happen automatically — the user must accept the new version.

⚠️

Accepting a template version update overwrites the Standard version. If you have a Custom override in _Templates/Custom/, it continues to take precedence and the update has no visible effect until you remove or update your Custom version.

Cloud Edition: DB-Backed Resolution

StudioBrain Cloud only. Core uses filesystem-only resolution as described above. The database layer below is added by the cloud extension and does not exist in core.

On StudioBrain Cloud (multi-tenant SaaS), template resolution adds a database layer above the filesystem:

DB tenant override (per-tenant customization)
  └── DB system templates (catalog entries in database)
        └── Filesystem (same Standard/Core/Custom/User layers)
LayerSourceScope
DB tenant overridetemplate_entities table, scoped by tenantPer-team / per-project
DB systemtemplate_entities table, system-wideAll tenants
FilesystemStandard/Core/Custom directoriesFallback when DB has no entry

Cloud users interact with templates through the UI exactly the same way. The database layer is transparent — it exists so that multi-tenant deployments can store per-team customizations without filesystem access.

CatalogSync

CatalogSync is the service that pulls templates, rules, skills, layouts, and plugins from the studiobrain-templates GitHub repository into the local project.

How It Works

  1. On startup, CatalogSync clones (or pulls) the studiobrain-templates repo into ~/.studiobrain/catalog/.
  2. It creates symlinks from _Templates/Standard/ and _Rules/ to the cached catalog directories, so the template discovery system finds catalog content at the paths it expects.
  3. A background task refreshes the catalog every 1 hour (configurable via the start_periodic_sync interval).
  4. New or updated templates, rules, skills, and layouts are upserted into the marketplace registry database.

What Gets Synced

Content TypeCatalog PathDiscovery Method
Entity templatestemplates/Standard/*.mdScan for *_TEMPLATE.md with YAML frontmatter
Document templatestemplates/Standard/Documents/*.mdSame scan, template_category: document
Map templatestemplates/Standard/Maps/*.mdSame scan, template_category: map
Layoutstemplates/Layouts/*.layout.jsonScan for *.layout.json
Rulesrules/*_RULES.md and rules/Standard/*.yamlScan for both Markdown and YAML formats
Skillsskills/*.yaml and skills/Standard/*.yamlScan for YAML files with skill_id field
Pluginsplugins/*/plugin.jsonScan for directories with plugin.json manifests

Community Content

Community-contributed content comes from the separate studiobrain-community-plugins repository. CatalogSync reads its index.json to discover community templates, rules, layouts, and plugins.

Community plugins must use the WASM runtime. Community templates, rules, and layouts have no runtime restriction. All community content is tagged with _source: "community" in the registry.

Community content is not covered by StudioBrain support. Review community templates before installing, especially if they include generation rules that will influence AI output.

Configuration

CatalogSync reads its configuration from environment variables:

VariableDefaultDescription
CATALOG_CACHE_DIR~/.studiobrain/catalogLocal directory for the cloned catalog repo
CATALOG_REPO_URLhttps://github.com/BiloxiStudios/studiobrain-templates.gitGit URL of the official templates repo
CATALOG_PLATFORMcoreEdition filter: core, desktop, or cloud
COMMUNITY_CACHE_DIR~/.studiobrain/community-catalogLocal directory for the community repo

Offline Behavior

If network access is unavailable, CatalogSync uses the previously cached content silently. Template discovery, entity creation, and all other features continue to work with the cached catalog. The background sync retries on the next interval.

Creating a Custom Override

To customize any template for your project:

  1. Find the template you want to override in _Templates/Standard/ (or browse the marketplace).
  2. Copy it to _Templates/Custom/ with the same filename.
  3. Edit the frontmatter fields to match your needs.
  4. Save. StudioBrain picks up the change immediately — no restart required.
# 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 fields

To revert to the Standard version, delete your Custom file.

Next Steps