Status
direction
Conceptual layer
② Context store and Plant Box ops
Repo layer
L2 universal-repositary, L1 edge
Source
architecture section 7.3, section 13 degraded modes · D20 · ADR 008 · Index: README.

1. L2 production tables#

One migration in universal-repositary/packages/migrate/sql/, extending the existing context and outcome records (telemetry.stop_event, features.process_batch, features.quality_status, features.shift_roster).

Table: 16 rows by table
TableSchemaOne row perIdempotent key
fast_readingtelemetryBatch of fast readings for one asset (compressed)plant, asset, batch start, sequence
billet_pushtelemetryBillet pushedplant, line, push time, counter
forged_parttelemetryPart forgedplant, line, part time, counter
part_linkfeaturesBillet-to-part link with method and confidencepart
part_flagfeaturesFlag or score on a partpart, flag, model version
time_binfeaturesPart and time windowplant, line, part, bin start
ht_basketfeaturesHeat-treatment basket and its recordplant, furnace, quench time
ht_testfeaturesStrength test linked to a chargeplant, charge, sample
rejection_rowfeaturesRegister row with match statusplant, source ref, row hash
twin_statefeaturesTwin checkpointplant, line, asset, event time
write_logledgerWrite request and result, hash-chainedwriter, sequence
follow_throughledgerOutcome of each action or signalaction
missed_savingsledgerExpected loss and outcomeaction
param_rowbaselinesVersioned parameter rowcontext, version
param_promotionbaselinesPromotion recordcontext, version
part_aliasgraphRaw part name to part keyplant, raw name

Every insert is an upsert on its key. fast_reading is kept at least 13 months so a full-year replay is possible; records and the write log are never compacted by Stamped. Producers and consumers per table: 07.

2. Topics#

All under stamped/v1/{org}/{plant}/; the full registry with publishers, readers and ACLs is in 07.

TopicBrokerContent
fast/{line}/{asset}/{signal}Plant onlyFast readings
twin/state/{line}Plant onlyPlant state and forecasts
twin/write/requestPlant only, twin publishesWrite requests
writer/write/resultPlant only, writer publishesResults and refusals
twin/heartbeatPlant only, twin publishesHeartbeat for the writer
records/{type}Plant to cloud, bufferedRecord rows, versioned JSON Schema
messages/outPlant only, twin to L5 relayAlerts, actions, signals
control/inPlant only, sync agent publishesVerified config bundle from the cloud

Schemas live in contracts/ with contract tests on both sides.

3. Deployment#

ModeCloudPlant BoxAllowed
Cloud onlyTwin, L2–L6Edge agentReplay; messages only if the link is reliable
HybridL2–L6, scheduled L3, L4Edge agent, sync agent, broker, twin, writer, L5 relayMandatory from AL2

Plant BoxPlant-side computer for the fast loop (direction; D4) (D4): fanless industrial PC on a UPS, with an imaged spare on site. Images are signed; the twin is Nuitka-compiled; the writer and edge agent are Go binaries. No updates during a shift with writes on; the writer starts switched off after any update. L2 hosting follows D20.

4. Security#

Zones and conduits in the style of IEC 62443: plant OT (PLCs, SCADA) ↔ Stamped Plant Box (read conduit for readers; write conduit for the writer only, to allow-listed tags) ↔ Stamped cloud (outbound only from the plant). The writer has its own PLC credentials; broker ACLs let only the twin publish write requests and only the writer read them. Remote support is a time-limited outbound tunnel a plant person switches on. No secrets in git.

5. Monitoring targets#

Twin loop p99 under 100 ms; fast-tag freshness under 2 s; signals event-to-phone under 5 s; P1 alerts under 5 min; zero writer read-back failures; no heartbeat gap over 5 s; edge buffer drains within an hour of link return; rising register match rate; about 1 alert per person per hour.

6. Replay#

Months of plant history replay through the twin in shadow, on event time, from a harness in intelligence-evals. Output per line, role and threshold: forecast error, interval coverage, alerts, actions and signals per person per shift, flag shares, expected value per procedure.

7. Test strategy#

LayerPass condition
UnitNormal CI
Reference testsRewritten modules match analysis-script outputs within tolerance
Shadow replayBudgets per role met; forecast and coverage targets met; no floods
Fault injectionGaps, frozen values, restarts, lost heartbeat, read-back mismatch, operator override, clock jumps, broker restart, part change mid-run: no stale message; writer restores and stops
Writer against plant-simForbidden writes refused; limits hold; override wins; restore on stop
Contract testsProducers and consumers agree
Template checkNo hold, release, accept, reject or bypass wording

No write path reaches a real PLC before its simulator and fault-injection tests pass.

8. Low-data lines#

Lines with only push and part counters run a low-data mode: stop and start detection, stop/Ready/first-part messages, and first-parts-after-a-stop flags. No heater twin, no temperature flags, no writes. Each line is its own site-pack entry with mode: low_data, so upgrading it later is configuration.

9. Runbooks#

SituationAutomaticPerson
Plant box downPLC watchdog drops the machine switch; operator values stand; no signalsSwap to the spare; writes stay off until re-enabled
Cloud link downPlant box keeps running; signals still go out; records bufferCheck the buffer drains
PLC program changedWriter sees the checksum or tag map change and switches offRepeat site checks for affected tags
Register lateMatching waits; P3 to adminQuality head sends it; thresholds stay on the last approved version
Model driftAffected tag drops from AL3 to AL2Stamped team reviews the refit
Clock jumpWriter stops; state uncertainFix time sync; re-enable writes
Alert floodOne summary per person; P3 to adminAdmin checks for a broken tag; may shelve with reason
Page history: last 3 changes
  1. 2026-10-07 docs(technical): rewrite fast-loop/; all architecture diagrams in house style 7330f47
  2. 2026-10-03 docs(fast-loop): interfaces and ownership; one topic registry; control-today wording; amend ADR-033 and ADR-036 df796e9
  3. 2026-10-03 docs(decisions): add ADR-033..038 (twin runtime, fast read path, plant-side writer, message classes, alerts and quality-to-lot link, part-keyed parameters), fast-loop technical set, rebuilt index with renumbering map; fix bare-number link text and ranges 22e2872

Diagram

100%

Search the architecture