TwinProject & Packs
TwinProject governs facility project lifecycle from initial blueprint mobilisation through live plant upgrades. Every project is stored as a portable .twinproj container backed by cryptographically signed.twinpack catalogues, content-addressed evidence blobs, and non-blocking revision control.
Blueprint Provisioning & Portable Archives
Projects start from a signed domain blueprint rather than a blank canvas or copied folder. Instantiating a blueprint atomically writes the project manifest, pins required packs, seeds hierarchy constraints, and binds initial study lenses so engineering teams start immediately with valid rules and catalogues.
Every uploaded drawing, specification, or study evidence file is stored content-addressed by SHA-256 digest and linked via provenance links. Exporting a .twinproj supports two profiles: Working Config for active engineering exchange and Handover Archive with Evidence for immutable commissioning and regulatory submission.
# Verify signatures against trust.toml and install a pack into a new corpus generation
twinctl pack install \
./packs/com.twinctl.domain.grid.substation-1.0.0.twinpack \
./packs/com.twinctl.domain.datacentre.bundle-1.0.0.twinpack \
--trust /etc/twinctl/trust.toml \
--store /var/lib/twinctl/corpus.db
# Inspect installed corpus generations and pinned digests
twinctl pack list --store /var/lib/twinctl/corpus.db
# Roll back immediately to the previous active corpus generation if required
twinctl pack rollback --store /var/lib/twinctl/corpus.db# Open a portable .twinproj archive or directory into the running server
twinctl project open ./campus-hall-b2.twinproj --api-url http://127.0.0.1:8080
# Save project state to a bound S3, Azure Blob, GCS, or local storage location
twinctl project save proj_01j8k2m4 --name "Pre-FAT Baseline"
# Export a self-contained handover archive with evidence and audit provenance
twinctl project export proj_01j8k2m4 --out ./campus-hall-b2-handover.twinprojSigning & Pinning Domain, Equipment, PLC & Standards Packs
Engineering content is packaged into versioned .twinpack archives across four primary categories:
- Domain Packs: Facility hierarchy rules, expansion pods, UI vocabulary projections, and scenario templates for Data Centres, Power Stations, and Nuclear plants.
- Equipment Packs: Parametric switchgear, UPS, PDU, CDU, chiller, relay, and sensor models with electrical/thermal ratings and schematic symbols.
- PLC Device Packs: Self-contained controller definitions combining rack/I/O assembly, hardware quirks, runtime compilation targets, and reference HIL cases.
- Standards Packs: Machine-verifiable compliance clauses, line-span citations, statutory inspection intervals, and applicability predicates.
Each .twinpack carries an Ed25519 signature, software bill of materials metadata, and an anti-rollback generation counter. Installations verify signatures against built-in roots and local trust.tomlpolicies before activating a corpus generation. Projects pin exact pack versions in their manifest so builds and simulations remain reproducible years after handover.
Non-Blocking Branching & 3-Way Semantic Diff
Exclusive check-in locks halt engineering teams whenever one discipline modifies shared equipment. TwinProject replaces file locking with lightweight, non-blocking branches inside the project manifest. While peers continue authoring on main, a standards or controls engineer forks an isolated Test Copy branch with a persistent banner confirming that live operations remain untouched.
Rather than comparing raw text or XML lines, TwinProject computes a 3-way semantic engineering diff keyed by canonical asset identity and equipment designation across three trees: Base (common ancestor),Candidate (incoming branch or pack upgrade), and Local main. Disjoint asset edits merge without conflict; overlapping edits to the same parameter or terminal connection surface side-by-side for explicit review.
Sandboxed Catalogue Rebase
Upgrading a pinned pack from v1.x to v2.x executes inside the sandboxedplan → preview → apply rebase engine:
- Plan: Resolves transitive pack dependencies, validates caller pack entitlements, and verifies ABI compatibility across protocol drivers.
- Preview: Evaluates the 3-way semantic diff against
Local mainwithout mutating the approved baseline. Any stale revision or overlapping attribute change surfaces an explicit conflict list. - Apply: Enforces fail-closed validation against missing items, withdrawn pack revisions, or unresolved equipment mismatches before rewriting pins and relinking live site assets in one audited transaction.
/api/v1/projects/{id}/packs/rebaseBearer tokenRebase a project's pinned pack items to the active corpus generation.
Moves selected or all drifted pins onto active-generation revisions, re-runs synthesis checks, relinks affected site assets, and returns the structured rebase outcome.
| Parameter | In | Type | Description |
|---|---|---|---|
id * | path | string | Canonical project identifier. |
items | body | array | Specific item identifiers to move to active-generation revisions; omit to rebase all drifted pins. |
Request body
{
"items": [
"com.twinctl.domain.datacentre.power:equipment_type/mv-breaker-4000a"
]
}Response
{
"upgraded": [
{
"item": "com.twinctl.domain.datacentre.power:equipment_type/mv-breaker-4000a",
"from": 1,
"to": 2
}
],
"relinked_assets": ["BRK-HALL-A", "BRK-HALL-B"],
"pins": [],
"report": {
"packs": [
{
"pack": "com.twinctl.domain.datacentre.power",
"from": "1.0.0",
"to": "1.1.0",
"delta": {
"from_version": "1.0.0",
"to_version": "1.1.0",
"added": [],
"changed": [
{
"id": "com.twinctl.domain.datacentre.power:equipment_type/mv-breaker-4000a",
"from": "rev 1",
"to": "rev 2"
}
],
"removed": [],
"unchanged": 42
}
}
],
"dropped_packs": [],
"affected_instances": ["BRK-HALL-A", "BRK-HALL-B"]
}
}Production Shadow Cutover Gating
Promoting an approved Change Package onto an operating site traverses a fail-closed cutover gate rather than a blind download:
- Protocol ABI Preflight: Checks every pinned driver and emulator adapter version epoch against the live runtime registry before opening field connections.
- Read-Only Production Shadow: Runs the candidate configuration alongside live plant telemetry in read-only mode, streaming live divergence residuals (
Δ = |candidate − active|) over Server-Sent Events. Any residual exceeding thresholdεfreezes promotion and identifies the exact drifting asset. - Guardrail Cutover & Atomic Rollback: Guardrail
plan → applystages Slot B and executes a single-scan bumpless handover with zero missed control scans, retaining one-action atomic rollback to the armedKnown-Goodsnapshot.
/api/v1/projects/{id}/upgrades/{upgrade_id}/shadowBearer tokenRecord Production Shadow parity and WCET timing qualification for a staged live upgrade.
Records shadow parity verification against a staged live upgrade record, advancing the upgrade to live_shadow_verify before Train A/B cutover.
| Parameter | In | Type | Description |
|---|---|---|---|
id * | path | string | Canonical project identifier. |
upgrade_id * | path | string | Staged live upgrade identifier. |
shadowVerified * | body | boolean | Whether production shadow parity verification passed. |
wcetHeadroomPct | body | number | Measured worst-case execution time headroom percentage. |
summary | body | string | Verification summary recorded on the upgrade audit history. |
Request body
{
"shadowVerified": true,
"wcetHeadroomPct": 42.5,
"summary": "Shadow residual check passed across baseline load"
}Response
{
"projectId": "proj_01j8k2m4",
"upgradeId": "upg_01j8k7p2",
"tenantId": "tenant-default",
"kind": "pack",
"targetId": "com.twinctl.domain.datacentre.power",
"fromVersion": "1.0.0",
"toVersion": "1.1.0",
"stage": "live_shadow_verify",
"preflightOk": true,
"shadowVerified": true,
"wcetHeadroomPct": 42.5,
"rollbackReady": true,
"revision": 3,
"history": [],
"createdAtUtc": "2026-12-01T10:00:00Z",
"updatedAtUtc": "2026-12-01T10:05:00Z"
}