Skip to content
Dark MatterDark Matter
EnergyReference

Reference — stage-gate transitions and prerequisites

The 9-gate ladder and per-gate prerequisite map. State machine source: packages/energy/src/stage-gates/transitions.ts.

Gate sequence

land → energy → permits → substation → turbines → finance → build → energize → tenant

STAGE_GATE_ORDER exports this as a readonly array from @dmtr/energy/schemas.

Prerequisite map

Each row lists the gates that must be complete before the target gate can be entered.

Target gatePrerequisites
land(none)
energyland
permitsland, energy
substationland
turbinesenergy
financeland, energy, permits
buildfinance, substation, turbines
energizebuild
tenantenergize

Status values

not_started · informal · committed · in_progress · complete · blocked

A gate must reach complete before its dependents can advance. blocked is informational and does not change prerequisites — it surfaces a development hold for the operator.

Regression rule

canAdvanceTo returns { allowed: false } for any transition where the target gate index is less than the current gate index. The state machine never permits regression. To represent a setback (e.g., a permit denial), advance the current gate's status to blocked rather than moving back.

Code

import { canAdvanceTo, applyTransition, PREREQUISITES } from "@dmtr/energy/stage-gates";

const decision = canAdvanceTo(slot.stage_gate, "finance");
// { allowed: false, reason: "Cannot advance to finance: prerequisite gates not complete: [permits]." }

const next = applyTransition(slot.stage_gate, "permits", "complete", "2026-09-01T00:00:00Z");
// returns a new StageGateState — throws if transition is disallowed

API

POST /v1/energy/slots/{slot_id}/advance with body { "gate": "...", "status": "..." } returns the updated slot. 409 on disallowed transitions.

GET /v1/energy/stage-gates returns the canonical sequence and prerequisite map for client-side validation.

Edit this page on GitHub

Last reviewed: May 5, 2026

Was this page helpful?