Inspiration
Every file in a large codebase was shaped by many engineers over years. Each change was made for a reason — a money-safety fix, a security lock, a pricing correction — but that reasoning lives in commit history almost nobody reads. When an engineer leaves, the why leaves with them, and the next person quietly reintroduces a bug that was fixed on purpose. I wanted to make a codebase remember why.
What it does
Point Patchwork at a GitHub pull request. For each changed file it pulls the file's full history from the GitHub API (who shaped it, and the reasons recorded in commit messages), reconstructs the knowledge behind that area of the code, and reviews your change against that history with an AI engine — warning you, before you merge, if your change undoes a decision someone made on purpose, and citing the exact commit each warning comes from.
It works on real repos: run it on expressjs/express and it catches that lowering the body-parser version would reintroduce a documented CVE fix — and it names the commit.
The Frankenstein angle
Patchwork stitches together the expertise of every engineer who shaped an area of the code into one assistant that guards it — a creation assembled from many contributors' knowledge, built in an inventor's workshop. Nothing supernatural; just history, made to speak at the moment it matters.
How we built it
Zero runtime dependencies: node:http, fetch, and the GitHub REST API. The flow: GitHub API (diff + per-file history) to a shared buildKnowledge() (contributors + the why) to reviewChange() (Google Gemini, grounded strictly in that history, never invented) to severity-ranked, cited warnings in a workshop-themed web UI. The AI sits behind one interface and degrades to a heuristic review when the model is unavailable — fail-open on availability, fail-closed on truth.
How we used Kiro
Patchwork was developed spec-first with Kiro; the full evidence is committed in the repo's /.kiro directory.
- Spec-driven development (.kiro/specs): the feature was written as requirements (EARS-style), a design doc, and a task list before any code — every module traced back to a requirement, versus unstructured vibe coding.
- Steering docs (.kiro/steering): product, tech, and structure rules (including a hard theme boundary) so the agent matched our conventions without being told each time.
- Agent hooks (.kiro/hooks): a dogfood-review hook that runs Patchwork's own idea on each source save, and a syntax-guard hook that runs node --check after each turn.
- MCP (.kiro/settings/mcp.json): a GitHub server and a fetch server, so the agent could read repositories and the web while building.
- Kiro IDE + CLI: used the IDE agent and also launched it from the terminal with kiro chat --mode agent against the open workspace.
- What the agent built: Kiro's agent implemented a real feature end to end — a history-grounded next step on every warning. It explored the project, ran the test suite (4/4 passing), changed the engine and UI, and kept the tests green, all from one prompt following the steering docs.
Challenges we ran into
Keeping the AI honest (it may only warn from the provided history and must cite the commit), and a deployment routing issue that a clean, fresh service instance resolved.
What we learned
Writing the spec and steering docs first — even when it feels slow — is what turns the agent from a fast autocomplete into something that builds what you actually meant.
What's next for Patchwork
Automatic review on every pull request via a webhook, and richer per-area knowledge cards.
Built With
- api
- gemini
- github
- javascript
- node.js
- render