-
-
Kiro Spec-Driven Engineering — 3 EARS specs, 8 Correctness Properties & 960+ fast-check runs
-
Isolated Worker Watchdog — Runaway recursion containment & medieval tritone alarm bell
-
Mode II: Chaos Requiem — Distributed retry storm & adaptive circuit breaker (99.8% SLA)
-
Mode I: Code Vivisector — Live AST tumor detection, dead-code striping & 60fps WebGL2 organ
-
Surgical Defibrillation — Side-by-side refactored cure with -75% McCabe complexity drop
⚡ Live Studio (Zero Setup · 15s Instant Play): https://zhouhongbao-cpu.github.io/galvanic/ 📦 Public GitHub Repository (Root
/.kiro+ MIT License): https://github.com/ZhouHongbao-cpu/galvanic 🎬 Official Demo Video (2m45s · 1080p): https://youtu.be/nAm8kM5_sb4
Inspiration
Two centuries ago, Luigi Galvani’s bio-electric experiments—and Mary Shelley’s Frankenstein—imagined electrical currents awakening dormant tissue on the dissecting table. Today, software engineers still diagnose legacy monoliths, exponential call-stack storms, and cascading microservice outages practically blindfolded: squinting at flat stack traces, dead log files, and silent flamegraphs.
We asked a radical Frankenstein question: What if you could place live TypeScript/JavaScript code—or an entire distributed cloud architecture—onto an 1890s Victorian obsidian dissecting table, strike it with bio-electric telemetry, see its cyclomatic tumors beat in 60fps WebGL2 shaders, literally hear its call-stack harmonics and tight-loop crackles through a procedural stethoscope, and heal it side-by-side with one-click Surgical Defibrillation?
Meet GALVANIC—a zero-setup, client-side software forensics chimera built from the ground up with Kiro Spec-Driven Engineering.
What it does
With zero sign-ups and zero external credentials, judges and developers can open GALVANIC in any browser and experience live multi-sensory diagnostics in under 15 seconds:
Mode I —
Code Vivisector(Live Source Autopsy, Time-Travel & Surgical Defibrillation):- Paste any TypeScript or JavaScript snippet (or click one of 4 curated amber specimens: The Exponential Plague, The Necrotic Monolith, Infinite Seizure, and Quadratic Thrombosis).
- Instantly exposes McCabe cyclomatic complexity tumors (rendered as inline CodeMirror badges and irregular crimson cardiac chambers) and calcified post-return dead code (striped directly on the dissecting slab).
- Executes instrumented code inside an isolated Web Worker time-travel sandbox with a dual circuit-breaker watchdog (
20,000-step soft budget +1,500mshardworker.terminate()), scrubbing frame-by-frame at0.5x–2xspeed without ever freezing the UI. - Procedural Acoustic Stethoscope: Translates execution throughput into a
64–168 BPMheartbeat bass, call-stack depth into D-harmonic-minor pipe organ chords inside a 2.2s Gothic cathedral reverb, inner-loop heat into band-passed Geiger crackles, and runaway seizures into aD3–G#3–D4medieval tritone alarm bell—visualized live on a 2048-point Cathode Oscilloscope (WAVE&FFT). - One-Click Surgical Defibrillation: Splits the altar into twin chambers—placing pathological tissue beside its refactored cure (including a live-editable cure pane and an automated AST dead-code & guard-clause purifier for custom snippets) to prove exact return-value parity alongside dramatic drops in complexity and execution steps.
Mode II —
Chaos Requiem(Distributed Microservice Outage Organ):- Driven by the exact same domain-agnostic
src/chimera-core/backbone, switching to Chaos Requiem repurposes our WebAssembly physics, WebGL2 shaders, and WebAudio stethoscope to simulate Midnight Cache Stampedes, Cascading Retry Apocalypses, and Poison Message Backpressure Floods. - Toggle Resilience Wards (Three-State Adaptive Circuit Breakers, Singleflight Request Coalescing, and Dead-Letter Quarantine) in real time to watch failing dependencies isolate cleanly into amber
OPENwards while cluster availability rebounds from~40%meltdown to99.8%SLA.
- Driven by the exact same domain-agnostic
Autonomous Kiro MCP Server & Forensic Exports:
- Ships a zero-credential Model Context Protocol (MCP) stdio server (
mcp-server/index.mjs, pre-wired in.kiro/settings/mcp.json) so Kiro agents can run static code autopsies, chaos simulations, and.kirospec audits directly inside the agent loop. - One-click export of Victorian Copperplate SVG, 2x Retina (
1800×1040) PNG Forensic Autopsy Certificates, and zero-backend FNV-1a checksummed Base64URL Permalinks.
- Ships a zero-credential Model Context Protocol (MCP) stdio server (
How we built it — The Five-Engine Frankenstein Chimera
GALVANIC stitches five fundamentally incompatible computing paradigms into a cohesive zero-latency browser studio:
- Engine 1 — Hand-Authored
.wat-> Binary.wasmPhysics & Shannon Entropy Kernel (src/wasm/): Written in raw WebAssembly Text Format (galvanic_physics.wat) and compiled viawabtintopublic/wasm/galvanic_physics.wasm(1,981 bytes, plus an embedded byte-identical synchronous fallback). Computes pairwise Coulomb repulsion, Hooke synaptic springs, damped semi-implicit Euler integration strictly clamped within[-0.88, +0.88], and exact telemetry Shannon entropy $H = -\sum p_i \log_2(p_i)$ in linear memory. - Engine 2 — Compiler AST Vivisector & Deterministic Chaos Queueing Engine (
src/engines/ast-vivisector/,src/engines/chaos-requiem/): CombinessucraseTypeScript type erasure,acorn+acorn-walkstatic control-flow analysis,astringlosslesstry/finallyAST probe rewriting (supportingasync/await, ES6 classes, generators, and destructuring), hermetic Web Worker execution, and aMulberry32deterministic discrete-event microservice simulator. - Engine 3 — Zero-GC Dual-Pipeline
WebGL2Bio-Shaders +Canvas2DEngraving Fallback (src/engines/bio-shader/): Custom#version 300 esGLSL shaders render etched brass astrolabes, fBm noise-displaced Tesla arcs, and harmonic SDF cardiac chambers—paired withwebglcontextlost/webglcontextrestoredrecovery and an automatic retinaCanvas2Dcopperplate fallback (?renderer=canvas2d). - Engine 4 — Procedural
WebAudio4-Voice Synthesizer (src/engines/audio-stethoscope/): 100% real-time mathematical waveform synthesis (OscillatorNode,BiquadFilterNode,DynamicsCompressorNode, and an algorithmic stereo Gothic cathedralConvolverNodeimpulse generator) with click-freeAudioParam.setTargetAtTimeenvelopes and zero external audio files. - Engine 5 — Native Node.js
stdioMCP Server (mcp-server/index.mjs): Dual-framing (NDJSON +Content-Length) JSON-RPC 2.0 MCP server sharing 100% algorithmic parity with the browser engines.
How we used Kiro — Spec-Driven Engineering at Full Depth
Stitching five low-level engines without memory corruption, audio clicks, infinite-loop browser hangs, or metric divergence between browser and CLI would have been chaos with ad-hoc prompting. Kiro’s Spec-Driven Development (SDD) turned our chimera into a mathematically verified architecture (inspectable at the repository root in /.kiro/):
- Three Formal EARS Spec Packages (
/.kiro/specs/):- We decomposed the system into three formal specification suites:
chimera-telemetry-core,code-vivisector-engine, andsensory-organ-and-chaos-requiem. - Across
requirements.md, we authored 41 formal EARS acceptance clauses spanning all five canonical patterns (THE <System> SHALL,WHEN,WHILE,WHERE,IF ... THEN), traced 1:1 throughdesign.mdintotasks.md.
- We decomposed the system into three formal specification suites:
- Eight Formal Mathematical Correctness Properties (
Vitest + fast-check, 960+ Randomized Runs):- In
design.md, we distilled 8 universal invariants verified continuously byfast-check(120randomized runs per property = 960+ randomized trials):- P1: WASM
step_organ_layoutspatial boundedness in[-0.88, +0.88](NaN/Infinityimmunity) & Shannon entropy bounds $0 \le H \le \log_2(K)$. - P2: FNV-1a Base64URL Permalink round-trip UTF-8 identity & fuzz/tamper resilience.
- P3: Peak-preserving trace downsampling monotonicity & maximum
stackDepthretention. - P4: AST instrumentation
Object.isreturn-value equivalence across generated functions,asyncpromises, classes, and destructuring. - P5: Unreachable post-terminator dead-code detection & deterministic watchdog halting on unbounded loops.
- P6: Surgical Defibrillation monotonic vitality improvement & randomized
OrderLedgerbilling equivalence across refactored specimens. - P7: Circuit-Breaker & Singleflight failure suppression across arbitrary
Mulberry32chaos seeds. - P8: End-to-end
stdioMCP determinism & 100% metric parity betweenmcp-serverand browser engines.
- P1: WASM
- In
- Multi-Mode Kiro Steering (
/.kiro/steering/):- Deployed 5 steering documents across all 3 official inclusion modes:
product.md,tech.md, andstructure.md(inclusion: always) enforce unidirectionalchimera-coreboundaries and zero external credentials;shader-wasm-dsp-rules.md(inclusion: fileMatchonsrc/{wasm,engines}/**/*) bans per-frame heap allocations insiderequestAnimationFrameloops and enforcessetTargetAtTimeaudio smoothing;gothic-ui-audit-ritual.md(inclusion: manual) governs our15.8:1WCAG AAA Victorian obsidian & brass aesthetic—zero cartoon Halloween clichés.
- Deployed 5 steering documents across all 3 official inclusion modes:
- Dual-Generation Agent Hooks with Exit-Code-2 Guardrails (
/.kiro/hooks/):- Authored both Kiro IDE
*.kiro.hookfiles and Kiro CLIhooks.json(version: "v1"), automatically runningfast-checkproperty suites on engine saves and executingscripts/verify-kiro-compliance.mjs --strict-exit2onPreToolUse/PreTaskExecto prevent.kiro/from ever being ignored or drifting out of sync.
- Authored both Kiro IDE
- Native MCP Integration (
/.kiro/settings/mcp.json):- Connected
galvanic-forensic-mcpdirectly back into Kiro (galvanic_autopsy_code,galvanic_simulate_chaos,galvanic_verify_kiro_specs), creating a self-verifying feedback loop.
- Connected
Challenges we ran into
- Lossless AST Instrumentation Across Modern JS/TS Idioms: Wrapping concise arrows,
asyncfunctions returning Promises, ES6 derived constructors (super()), early-returningfunction*generators, and top-level destructuring without altering evaluation semantics or leaking call-stack depth required carefully structuredtry/finallyAST rewrites and randomizedfast-checkdifferential testing against nativeFunctionevaluation. - Zero-Freeze Runaway Loop Containment: Malicious or accidental mutual recursion can lock a browser tab in milliseconds. Combining injected
__g_loop/__g_probesoft counters (20,000steps) inside an isolated Web Worker with a main-thread1,500mshardworker.terminate()timer keeps WebGL2 shaders running at a silky 60fps even while halting infinite seizures. - Cross-Platform
stdioMCP Parity: Windows drive-letter casing (c:\vsC:\) inprocess.argv[1]vsfileURLToPath(import.meta.url)initially caused silent child-process exits when spawning MCP overstdio. Addingfs.realpathSyncnormalization and dedicatedchild_process.spawnE2E tests guaranteed rock-solid cross-platform execution.
Accomplishments that we're proud of
- Delivering two complete, production-grade engineering tools (Code Vivisector and Chaos Requiem) powered by one unified
chimera-coreengine and five stitched low-level technologies—running 100% client-side in under 15 seconds with zero setup. - Achieving zero-GC real-time 60fps WebGL2 rendering paired with a procedural 4-voice WebAudio stethoscope that makes algorithmic complexity and circuit-breaker containment genuinely audible.
- Proving 8 formal Correctness Properties across 960+ randomized
fast-checkruns with full EARS traceability in/.kiro/.
What we learned
Spec-Driven Development in Kiro shines brightest when stitching domains that rarely speak to each other—compilers, WebAssembly linear memory, GPU shaders, DSP audio, and distributed queueing theory. Writing formal Correctness Properties before optimizing low-level code caught subtle edge cases (such as nested closure cyclomatic double-counting and refactored edge-case billing parity) long before they could reach production.
What's next for GALVANIC
- Multi-Language WASM Tree-Sitter Frontends: Extending
chimera-coreto dissect Python, Rust, and Go ASTs in the browser. - OpenTelemetry Trace Replay: Importing live production OTLP JSON spans directly into Chaos Requiem to replay and sonify real cloud incidents.
- VS Code & Kiro Extension Companion: Streaming live workspace diagnostics into an embedded GALVANIC organ panel during active coding sessions.
Open-Source License & Transparency Disclosure
- License: Released under the OSI-approved MIT License (
LICENSE). - 100% Clean Copyright Ledger: All typography (
Cinzel Decorative,Cormorant Garamond,JetBrains Mono) is locally bundled under SIL Open Font License 1.1 (@fontsource/*). All WebGL2 shaders, SVG crests, WebAudio stethoscope voices, and demo soundtrack waves (numpy/scipyprocedural synthesis) are 100% original code with zero third-party copyrighted audio samples. Intro/endcard Victorian concept plates in the demo video were generated via Muse AI (muse.ai) and composited with live 1080p browser recordings. Full attributions are documented inTHIRD_PARTY_NOTICES.md.
Built With
- acorn
- codemirror
- fast-check
- glsl
- kiro
- model-context-protocol
- node.js
- playwright
- react
- typescript
- vite
- vitest
- webassembly
- webaudio-api
- webgl2