Inspiration

The Frankenstein theme asked us to build the monster. Ours is not a monster of code — it is the monster every AI coding session already builds: features generated faster than anyone can vouch for them. Real transplants have a protocol: screen the organ, get consent, record the procedure, and be able to reverse. We asked: why doesn't AI-generated software?

What it does

GRAFT is a small living application — the Creature. You type a wish in plain language. A Doctor agent writes an EARS spec and builds the feature as an organ (manifest, HTML bundle, properties). An immune system screens it in four stages — static analysis, manifest checks, behavioral checks, property checks — and a rejection comes back with a specific reason and source line, giving the Doctor up to two repair rounds. A passing organ still waits: nothing installs until you click Transplant. The organ then runs inside a sandboxed iframe with a strict CSP, talking to the Creature only through the Nerve API. Every state change is written to a hash-chained SQLite ledger before it happens, the chain is verifiable on demand, and any organ can be amputated in one click — restoring the prior state and removing its links. Organs can also be stitched into chimeras by wiring one organ's output port to another's input port.

In the demo video, two wishes are typed verbatim and grown live: a counter widget with an output port, and a celebrate widget that confettis when the counter hits 10.

How we built it

Entirely in the Kiro IDE, spec-first: 8 specs with EARS requirements (several tagged [PBT]), 7 steering documents — the most important being our "Laws of Anatomy", numbered safety rules loaded by every workflow step and both custom agents — 2 custom agents (graft-doctor, and red-team, which wrote the 96-organ attack corpus under a clean-room rule), and 5 hooks that run immune tests, web tests, docs-sync and preflight checks on changes. MCP (context7 + playwright) is configured in .kiro/settings/mcp.json.

The code is a pnpm-workspace monorepo: nerve (the typed port/message contract), doctor (llm / crew / replay providers, streaming over SSE), immune (the four-stage scanner), ledger (canonical JSON + SHA-256 chain), immune-cli, a Fastify + better-sqlite3 server, and a React + Vite theatre interface. Property-based tests with fast-check pin the ledger chain and reversibility invariants. The demo was recorded from the running app with Playwright and narrated with Gemini TTS — no copyrighted music.

Challenges we ran into

  • Tuning a fail-closed immune system. Law L7 says an error inside the immune system means rejection — safe, but the strictness rejects all 14 benign corpus organs (they use window.parent). We published the numbers — 73.7% of attacks caught, weaknesses included — instead of hiding them.
  • Ledger-first discipline. The browser cannot compute hashes, so the server owns the chain head; the entry must be written before the state change it describes. Getting SSE streaming, consent gates and append order all consistent was the hardest concurrency work.
  • Our own steering law caught us. The tagline said "Software that grows. Safely." Law L8 forbids promising safety. It became "Software that grows. Accountably."
  • Honesty is a feature. 3 tests fail today (documented), the Crew provider was never run against a live Gateway, and replayed output is labeled as replay (Law L9). The README and SUBMISSION files state all of it.

What we learned

That numbered rules (the Laws of Anatomy) scale better than vibes: they are loadable context for every step and agent, and they measurably changed outcomes. That spec-driven organs needed fewer immune rejections than vibe-coded ones in our small experiment. And that the most valuable part of an AI-built app is not the code the AI writes — it is the machinery that decides whether that code deserves to run.

GRAFT reduces risk. It does not guarantee safety. The sandbox is the real boundary.

Built With

  • content
  • fast-check
  • fastify
  • gemini-api
  • hash-chain-ledger
  • iframe-sandbox
  • kiro
  • kiro-agents
  • kiro-hooks
  • kiro-mcp
  • kiro-specs
  • kiro-steering
  • node.js
  • playwright
  • pnpm
  • policy
  • property-based-testing
  • react
  • security
  • server-sent-events
  • sqlite
  • typescript
  • vite
  • vitest
  • zod
Share this project:

Updates

Submission history