⚡ 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:

  1. 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,500ms hard worker.terminate()), scrubbing frame-by-frame at 0.5x–2x speed without ever freezing the UI.
    • Procedural Acoustic Stethoscope: Translates execution throughput into a 64–168 BPM heartbeat 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 a D3–G#3–D4 medieval 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.
  2. 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 OPEN wards while cluster availability rebounds from ~40% meltdown to 99.8% SLA.
  3. 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 .kiro spec 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.

How we built it — The Five-Engine Frankenstein Chimera

GALVANIC stitches five fundamentally incompatible computing paradigms into a cohesive zero-latency browser studio:

  1. Engine 1 — Hand-Authored .wat -> Binary .wasm Physics & Shannon Entropy Kernel (src/wasm/): Written in raw WebAssembly Text Format (galvanic_physics.wat) and compiled via wabt into public/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.
  2. Engine 2 — Compiler AST Vivisector & Deterministic Chaos Queueing Engine (src/engines/ast-vivisector/, src/engines/chaos-requiem/): Combines sucrase TypeScript type erasure, acorn + acorn-walk static control-flow analysis, astring lossless try/finally AST probe rewriting (supporting async/await, ES6 classes, generators, and destructuring), hermetic Web Worker execution, and a Mulberry32 deterministic discrete-event microservice simulator.
  3. Engine 3 — Zero-GC Dual-Pipeline WebGL2 Bio-Shaders + Canvas2D Engraving Fallback (src/engines/bio-shader/): Custom #version 300 es GLSL shaders render etched brass astrolabes, fBm noise-displaced Tesla arcs, and harmonic SDF cardiac chambers—paired with webglcontextlost / webglcontextrestored recovery and an automatic retina Canvas2D copperplate fallback (?renderer=canvas2d).
  4. Engine 4 — Procedural WebAudio 4-Voice Synthesizer (src/engines/audio-stethoscope/): 100% real-time mathematical waveform synthesis (OscillatorNode, BiquadFilterNode, DynamicsCompressorNode, and an algorithmic stereo Gothic cathedral ConvolverNode impulse generator) with click-free AudioParam.setTargetAtTime envelopes and zero external audio files.
  5. Engine 5 — Native Node.js stdio MCP 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/):

  1. Three Formal EARS Spec Packages (/.kiro/specs/):
    • We decomposed the system into three formal specification suites: chimera-telemetry-core, code-vivisector-engine, and sensory-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 through design.md into tasks.md.
  2. Eight Formal Mathematical Correctness Properties (Vitest + fast-check, 960+ Randomized Runs):
    • In design.md, we distilled 8 universal invariants verified continuously by fast-check (120 randomized runs per property = 960+ randomized trials):
      • P1: WASM step_organ_layout spatial boundedness in [-0.88, +0.88] (NaN/Infinity immunity) & 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 stackDepth retention.
      • P4: AST instrumentation Object.is return-value equivalence across generated functions, async promises, classes, and destructuring.
      • P5: Unreachable post-terminator dead-code detection & deterministic watchdog halting on unbounded loops.
      • P6: Surgical Defibrillation monotonic vitality improvement & randomized OrderLedger billing equivalence across refactored specimens.
      • P7: Circuit-Breaker & Singleflight failure suppression across arbitrary Mulberry32 chaos seeds.
      • P8: End-to-end stdio MCP determinism & 100% metric parity between mcp-server and browser engines.
  3. Multi-Mode Kiro Steering (/.kiro/steering/):
    • Deployed 5 steering documents across all 3 official inclusion modes: product.md, tech.md, and structure.md (inclusion: always) enforce unidirectional chimera-core boundaries and zero external credentials; shader-wasm-dsp-rules.md (inclusion: fileMatch on src/{wasm,engines}/**/*) bans per-frame heap allocations inside requestAnimationFrame loops and enforces setTargetAtTime audio smoothing; gothic-ui-audit-ritual.md (inclusion: manual) governs our 15.8:1 WCAG AAA Victorian obsidian & brass aesthetic—zero cartoon Halloween clichés.
  4. Dual-Generation Agent Hooks with Exit-Code-2 Guardrails (/.kiro/hooks/):
    • Authored both Kiro IDE *.kiro.hook files and Kiro CLI hooks.json (version: "v1"), automatically running fast-check property suites on engine saves and executing scripts/verify-kiro-compliance.mjs --strict-exit2 on PreToolUse / PreTaskExec to prevent .kiro/ from ever being ignored or drifting out of sync.
  5. Native MCP Integration (/.kiro/settings/mcp.json):
    • Connected galvanic-forensic-mcp directly back into Kiro (galvanic_autopsy_code, galvanic_simulate_chaos, galvanic_verify_kiro_specs), creating a self-verifying feedback loop.

Challenges we ran into

  • Lossless AST Instrumentation Across Modern JS/TS Idioms: Wrapping concise arrows, async functions returning Promises, ES6 derived constructors (super()), early-returning function* generators, and top-level destructuring without altering evaluation semantics or leaking call-stack depth required carefully structured try/finally AST rewrites and randomized fast-check differential testing against native Function evaluation.
  • Zero-Freeze Runaway Loop Containment: Malicious or accidental mutual recursion can lock a browser tab in milliseconds. Combining injected __g_loop / __g_probe soft counters (20,000 steps) inside an isolated Web Worker with a main-thread 1,500ms hard worker.terminate() timer keeps WebGL2 shaders running at a silky 60fps even while halting infinite seizures.
  • Cross-Platform stdio MCP Parity: Windows drive-letter casing (c:\ vs C:\) in process.argv[1] vs fileURLToPath(import.meta.url) initially caused silent child-process exits when spawning MCP over stdio. Adding fs.realpathSync normalization and dedicated child_process.spawn E2E 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-core engine 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-check runs 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-core to 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/scipy procedural 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 in THIRD_PARTY_NOTICES.md.

Built With

Share this project:

Updates

Submission history