I built a ghost that races your wrong idea against your real code

I wrote this post as part of the Kiroween Hackathon 2026. Ghost Run is my entry in the Resurrection category, built in Kiro in under 23 hours.
Quick: what does this return?
const scores = [10, 9, 2]; scores.sort().reverse(); If you said [10, 9, 2], we made the same mistake. By default sort() compares items as text, where "10" comes before "2". It gives [10, 2, 9] and reverse() turns that into [9, 2, 10].
That one wrong idea, "sort() compares numbers", is what this whole project is about.
The demo I couldn't fully explain
I started vibe coding a lot for my personal projects. The code worked. I couldn't always tell you why. That gap followed me into hackathons. At MadHacks in November, an hour before judging, I was still asking some of my teammates what parts of my own demo did. We placed 4th. Now I want to learn the core and know what every part of my code does.
I'm not the only one. "Vibe coding" was Collins Dictionary's Word of the Year for 2025 (Euronews). By September 2026, more than 40 percent of pull requests on GitHub started with an agent's first draft, up from 17 percent in March (GitHub Octoverse). Writing code isn't understanding it. In one course, 27 percent of 291 students missed at least one simple question about code they had just written (ITiCSE 2023).
Then someone asks what one function returns. An interviewer, a professor, your team lead or a judge. That's the moment vibe coding can't help you with.
The usual fixes miss it. A quiz built on a model's answer key never runs the code. A red X tells you that you were wrong. It never tells you which idea in your head was wrong. I wanted something that could.
A 1978 idea, back from the dead
In 1978 John Seely Brown and Richard Burton built a program called BUGGY. They studied children's subtraction mistakes and found that the wrong answers weren't random. Each one came from a procedure, a small program you could run.
A child who subtracts the smaller digit from the larger in every column gets 125 for 143 minus 28. Every time. Run that rule on 400 minus 1 and it gives the child's next answer before they write it: 401.
A wrong idea about code works the same way. "sort() compares numbers" is one changed line. Write that line down and you can run it, race it and prove it. BUGGY stayed in research papers for 48 years. Ghost Run brings it back for the code AI writes for us.
Meet your ghost
Here's how a round goes. You pick a function from a TypeScript project and predict what it returns for a real input. Ghost Run runs the function in a sandbox inside your browser tab and grades you against what the code really returns. No AI model grades anything.
Get two answers wrong in the same way and your ghost appears: the same function with one line changed, the line your wrong idea lives in. Like the ghost car in a racing game, it runs beside the real code, drawn faint. A badge marks the line where the two split.
Every ghost is proven before you see it. It needs two inputs where it and the real code both return and disagree. Then Ghost Run asks one question.
Which one did you mean?
Pick the code's answer and you held a wrong idea. Beat your ghost on two new inputs and the banner says "Ghost beaten".
Pick my ghost's answer and the code holds your wrong idea too. That happens more than you'd think: code models wrote known one-line bugs up to twice as often as the correct line (MSR 2023). Ghost Run writes a failing test from your answers plus a bug report in Kiro's own Bugfix format. I call that the flip.
On the demo's planted leaderboard, topScores runs scores.sort().reverse(). My ghost and I both said [10, 9, 2]. I meant highest first. I picked my ghost's answer. Two lines from the report it wrote:
WHEN topScores gets [10, 9, 2] THEN the system returns [9, 2, 10]. WHEN topScores gets [10, 9, 2] THEN the system SHALL return [10, 9, 2]. It has the same two lines for [100, 25, 3] and a "SHALL CONTINUE TO" line for every input the fix must leave alone. That's the shape of a Kiro bugfix spec: Current, Expected and Unchanged Behavior. My ghost's one line change already passes every row. A fix has a failing test waiting for it.
Two rooms to try
The 1978 room puts BUGGY back on screen, green on black. Two old subtraction mistakes compete to be your ghost. For 143 minus 28 both say 125. For 52 minus 17 both say 45. So Ghost Run asks 400 minus 1, where they split: 401 or 409.
CrossCheck is an app I built in October, used as the example repo. It has a ghost on each Start here function, a race on its planted leaderboard and a planted bug to expose. In one run the planter turned < 2 into <= 2 inside listJoin. Two items catch it: the code says "a and b" and the copy says "ab".
How I built it in Kiro
Kiro wrote Ghost Run's code. My job was the specs, the steering and checking every claim before I made it.
I worked in two windows. Window 1 ran a spec's tasks. In window 2 I wrote the next spec. Five specs went through that loop, one per slice: run-and-grade, ghosts-and-mirror, local-mode-and-flip, mock-defense-and-brief and website-and-deploy. Together they hold 161 requirements, 984 acceptance criteria and 352 finished tasks. The passing test count after each spec tells the story: 103, 302, 486, 672 and 842.
Every spec started Requirements-First. On the first three I ran Analyze Requirements before design. On the first it raised 12 questions. I answered each one in requirements.md while the gaps were still cheap to fix. Then Run all Tasks took over: four specs ran as one Run all Tasks each, 280 tasks in about 400 minutes.
The rule that shaped everything
One rule from spec 2 shaped the whole product: a ghost is named only when it fits at least two of your wrong answers. One wrong answer is a slip. Two that a single wrong rule explains are an idea. A sibling rule makes sure every ghost is a real difference. Word for word from the repo:
Requirement 13: Prove each ghost with two witnesses User Story: As a student, I want a ghost kept only when at least two inputs separate it from the code, so that every ghost shown is a real difference. 1. THE Input_Generator SHALL count an input as a Witness for a ghost WHEN the real function returns on that input, the ghost returns on that input AND the Grader reports the two results differ. ... 5. IF a ghost still has fewer than 2 Witnesses after the 200 more argument lists, THEN THE Input_Generator SHALL drop that ghost. Those 200 more argument lists come from fast-check's sample() with a fixed seed, 20261204. On CrossCheck 11 ghosts earned their two witnesses and 28 were dropped.
One sentence on every request
Four steering files ride along with every request: product, tech, structure and quality. product.md opens its rules with the one that never bends: "No model grades anything. Every grade comes from running code in the QuickJS sandbox."
A hook that keeps the grader offline
Steering asks. A hook enforces. engine-guard is a PreToolUse hook on writes:
{ "version": "v1", "hooks": [ { "name": "engine-guard", "trigger": "PreToolUse", "matcher": "write", "action": { "type": "command", "command": "node tools/engine-guard.ts" } } ] } // tools/engine-guard.ts export const MESSAGE = "src/engine stays offline and model free."; const BANNED = ["fetch(", "XMLHttpRequest", "WebSocket", "http://", "https://"]; The script reads the planned write as JSON on its input. If the write would put a banned string or an outside package into src/engine, it exits with code 2 and Kiro's write never lands.
My first hook never ran. The folder wasn't trusted yet and Kiro had made its edits with sed in the terminal, which hooks can't see. Before claiming any hook I checked two things on a real install. File hooks fire only on Kiro's own edits. A PreToolUse hook blocks with exit code 2. The lesson went into tech.md: edit files only with file tools.
Kiro at a glance
| Kiro feature | What I did | What it changed |
|---|---|---|
| Specs | Five Requirements-First specs. 161 requirements, 984 acceptance criteria, 352 finished tasks | Every corner case was a requirement with a test before any code existed |
| Analyze Requirements | Run before design on the first three specs. 12 questions on the first | Gaps surfaced while they were still cheap |
| Run all Tasks | Four specs, 280 tasks in about 400 minutes | Kiro built one slice while I wrote the next |
| Steering | product, tech, structure and quality, always on | "No model grades anything." reached every request |
| Agent hook | engine-guard, a PreToolUse hook on writes | The grader can't call out |
| Bugfix specs | The flip writes Current, Expected and Unchanged Behavior | Your answer becomes the requirement a fix must meet |
| Property tests | 61 fast-check checks in 22 test files | One found a bug in Node |
The bug that wasn't mine
I made the property tasks required. Equal is hard in JavaScript. The grader got properties like these:
- "grades every value equal to itself"
- "gives the same answer with the two values swapped"
- "grades -0 equal to 0 at any position in a value"
- "grades a key set to undefined as different from the same key left out"
The round trip property ("gives back a value that grades equal to the value encoded") found a real bug. It wasn't in my code. Node 24's JSON.parse returned some escaped one character keys wrong. It was already reported as nodejs/node#66916. My decode now reads JSON itself and a test guards the exact case. I'd never have written that example by hand.
What broke
- Run all Tasks skipped my checkpoint once. It marked task 11 done without stopping for my hand check. I ran those checks in the app afterward and they passed.
- Kiro's sandbox can't open a port. 17 server tests fail inside Kiro and 16 skip. In Terminal on my Mac all 842 pass.
- A test that failed at random. The server answered a 1 MB upload with 413 and closed the connection while the test was still sending. Sometimes the reset won the race. Kiro changed the test to send only the size header. 10 of 10 runs passed.
- A fault no test caught. In the 1978 room one button was a 44 px pill holding two lines. Its second line was grey on white at 2.4:1 contrast. I found it by eye. Kiro's fix took it to 8.4:1 and a test now checks the height and the color.
- I cut to ship. I planned a full mock defense, a set of questions about your own code. It became one planted bug screen. It's smaller and it's real.
What I learned
- The spec is where the thinking happens. The two answer rule came from a spec, not from code.
- Properties find what examples miss. One found a bug in Node itself.
- Test the tool before you trust it. Hooks, Run all Tasks and Kiro's sandbox each surprised me once. That's why the README pairs every claim with a way to check it.
- My own eyes still count. The contrast fault passed every layout test.
Why it matters
More of us will explain code we didn't type: students learning with AI, juniors in their first code review, anyone in an interview. Ghost Run trains the one skill AI can't do for you, knowing what your own code does. And when the code is wrong instead of you, you leave with a failing test, not a hunch.
The method has strong evidence behind it. In a review of 10 study techniques, practice testing was one of only two rated high (Dunlosky et al. 2013). In a physics class, students who predicted first understood more, while just watching added nothing (Crouch et al. 2004). Across 44 comparisons, texts that named a wrong idea and corrected it taught more than the same facts alone (Schroeder and Kucera 2022).
One honest limit: in high school algebra, teaching aimed at a diagnosed wrong rule was not clearly better than plain reteaching (Sleeman et al. 1989). That's why Ghost Run doesn't stop at naming your ghost. You race it, beat it or turn it into a test.
Try it
Needs Node 24 or later and a browser. No accounts and no API keys.
git clone https://github.com/anandindukuri-hub/ghost-run.git cd ghost-run npm install npm run dev # the website, at http://localhost:5173 npm run local -- ../your-project # your own TypeScript project, at http://localhost:4317 npm test # 842 tests On the home page press Race this ghost yourself. Then press Try a common wrong answer, Check and Next. Do that twice and your ghost appears. New to code? Start with the 1978 room.
Next on my list: a box to type your own input, stand-ins for network and AI calls so more functions can run, a ghost writer agent for wrong ideas no rule covers and a Kiro power whose MCP server answers by running code.
Back to that sort()
If you said [10, 9, 2] because you meant highest first, you weren't wrong about what you wanted. The code was. That's the bug Ghost Run files for you.
You vibe coded it. Now own it.
- Code: github.com/anandindukuri-hub/ghost-run
- Demo video: https://youtu.be/Pgd0aqRUPp4
- Devpost: https://devpost.com/software/ghost-run-wsq82i
Built for the Kiroween Hackathon 2026.

