Written for **Kiroween 2026* — RungScope is my entry in the Resurrection category.*
The Problem
A single wrong wire in factory code can start a dangerous machine. In the 1970s, programmable logic controllers (PLCs) ran factories with relay ladder logic—rungs of contacts and coils drawn like electrical circuits. That logic is still running in industrial plants today, and a mistake in it can hurt people.
Modern tools check application code, but they don't speak ladder logic, and they don't give a proof a plant engineer can read. I wanted to resurrect 1970s relay logic in a browser workbench that proves safety hazards—and backs every result with a cryptographic receipt anyone can verify.
What RungScope Is
RungScope is a zero-backend CRT oscilloscope workbench that resurrects 1970s PLC relay ladder logic and proves safety hazards using a deterministic bounded-BFS formal verifier, SHA-256 proof receipts, and an installable Kiro Power (stdio MCP server).
It ships with three industrial presets, each with its own safety invariant:
| Preset | Hazard | Initial Verdict | States Explored | Depth |
|---|---|---|---|---|
thermal-interlock-race (default) | Heater stays energized during an over-temp fault | VIOLATION | 11 | 5 |
dual-coil-conveyor-hazard | Duplicate coil overrides an open safety guard | VIOLATION | 1 | 1 |
estop-timer-trap | E-stop timer race condition | VIOLATION | 4 | 3 |
You can click any contact on a rung to mutate it live (XIC ↔ XIO) and watch the verdict update in milliseconds. You can also ask Kiro to diagnose and patch the wiring, and the verifier re-checks the fix until it returns a clean receipt.
The Verifier Is Deterministic—Not AI
The safety proof itself uses no AI, no API key, and no network. The same scan produces the exact same answer every time.
The engine runs a bounded breadth-first search (BFS) over the ladder logic state space, checking the safety invariant on every reachable state. When it catches a violation, it returns a concrete counterexample: the blamed rung, the state, and the scan depth. Every receipt includes a SHA-256 circuitDigest, state count, and depth reached:
- Faulty thermal preset:
070906d78e24(VIOLATION, 11 states, depth 5) - Fixed thermal preset:
8b26290593e4(SAFE, 12 states)
Kiro is the builder and the MCP operator. The safety proof itself is deterministic math.
How I Built It with Kiro
I built RungScope end-to-end with Kiro using specs, steering, hooks, and a custom Kiro Power:
- Specs (
.kiro/specs/): Three complete spec trees—plc-verifier,instrument-ui, andlive-editor-fmea—defining requirements, design, and tasks before writing implementation code. - Steering: Scoped steering documents that enforce strict boundaries—keeping the verifier 100% deterministic and keeping the UI honest about what is actually proven.
- Hooks: Agent hooks that enforce the engineering workflow, including a stop hook that blocks stopping unless the test suite is green.
- Kiro Power (
powers/rungscope-verifier): A reusable local Power backed by a stdio MCP server (scripts/mcp-server.mjs) exposing three tools:verify_plc_il,fmea_sweep_il, andlist_presets. Instead of guessing whether factory wiring is safe, Kiro runs a verify → diagnose → patch → re-verify loop until the deterministic verifier returns a clean receipt. - Property-Based & Automated Testing: 933 automated tests across 59 files, powered by Vitest and
fast-check.
I verified the Kiro CLI MCP server directly against the live browser workbench: both the faulty thermal digest (070906d78e24) and the fixed digest (8b26290593e4) match byte for byte.
Making Formal Proofs Readable
The workbench is styled like a 1970s CRT oscilloscope, pairing the waveform trace with an interactive ladder diagram, an animated plant mimic, and a plain-English verdict panel. Every industrial and formal-methods term—rung, causal blame, counterexample, invariant, scan—has built-in plain-English explanations. The goal is that a non-technical reviewer, or a plant engineer who has never touched formal methods, can look at the verdict and immediately see what went wrong and where.
What I Learned
Formal verification sounds academic, but once the verdict is a single plain-English sentence backed by a verifiable receipt, it becomes practical. The hardest part wasn't writing the BFS state-space explorer—it was making the proof readable: a digest, a state count, a depth, and a counterexample, with nothing hidden.
Try It Out
- Live Workbench: rungscope.pages.dev
- GitHub Repository: github.com/alexowoade/rungscope
- Devpost Submission: devpost.com/software/rungscope-1970s-relays-modern-proof
- Demo Video: youtu.be/l4UHKMdHECg

