Custom Content
Fork built-in models and templates or write from scratch to create custom content. Use the local registry at ~/.miravo/ and content resolution layers.
Create custom models and templates by forking built-in content or writing from scratch.
Content Resolution
Section titled “Content Resolution”Miravo resolves models and templates through three layers in priority order:
- Current directory —
.twin.yamland.miravo.yamlfiles in the working directory - Local registry —
~/.miravo/registry/local/{models,templates}/ - Built-in — Shipped with Miravo via the
@miravo/contentpackage
A model in the current directory overrides the same name in the local registry, which overrides built-in content.
Fork Built-in Content
Section titled “Fork Built-in Content”The miravo fork command copies built-in content to the local registry for customization.
Fork a Model
Section titled “Fork a Model”miravo fork model centrifugal-pumpCreates ~/.miravo/registry/local/models/centrifugal-pump.twin.yaml. Edit this file to customize parameters, members, generators, faults, or lifecycle.
Fork a Template and Its Models
Section titled “Fork a Template and Its Models”miravo fork template smart-factoryCopies the template and all referenced models to the local registry.
Fork Models Only
Section titled “Fork Models Only”miravo fork template smart-factory --models-onlyCopies only the models referenced by the template, not the template file itself.
Overwrite Existing
Section titled “Overwrite Existing”By default, fork skips files that already exist. Use --force to overwrite:
miravo fork model centrifugal-pump --forceWrite From Scratch
Section titled “Write From Scratch”Custom Model
Section titled “Custom Model”Create a .twin.yaml file in your working directory or local registry:
schema_version: "2"model: name: my-sensor description: "Custom temperature/humidity sensor"
parameters: temp_center: type: float default: 22.0 unit: degC
members: temperature: kind: variable data_type: Double access: read unit: degC generator: type: noise center: "$param.temp_center" stddev: 0.3
humidity: kind: variable data_type: Double access: read unit: "%RH" generator: type: mean-reverting-noise mean: 45 tau: 20 sigma: 2Custom Template
Section titled “Custom Template”Create a .miravo.yaml file:
kind: MiravoTemplateversion: "1"name: "My Custom Plant"description: "Custom sensor array"
namespace: enterprise: MyCompany site: test-lab
areas: - name: floor-1 lines: - name: zone-a twins: - model: my-sensor count: 10 variation: 0.1
settings: tick_interval_ms: 1000 time_multiplier: 1Run it:
miravo start --template ./my-plant.miravo.yamlLocal Registry Structure
Section titled “Local Registry Structure”~/.miravo/ registry/ local/ models/ # Custom .twin.yaml files templates/ # Custom .miravo.yaml files state/ # Persisted simulation snapshots daemon/ # Background process registryThe base directory is configurable with MIRAVO_HOME:
MIRAVO_HOME=/data/miravo miravo startValidate Without Running
Section titled “Validate Without Running”Use --dry-run to validate a template and its referenced models without starting the simulation:
miravo start --template ./my-plant.miravo.yaml --dry-runThis catches schema errors, missing models, invalid parameter references, and member ordering issues.