# How I Used Kiro Specs, Steering, and Hooks to Stitch Excel to the Z3 Theorem Prover (ProofSheet — Kiroween 2026)

> Source: <https://dev.to/vatsrounak/how-i-used-kiro-specs-steering-and-hooks-to-stitch-excel-to-the-z3-theorem-prover-proofsheet--44f1>
> Published: 2026-12-04 21:38:33+00:00

**Recommendation:** When a formal verifier finds a counterexample but times out proving minimality, return the counterexample with an explicit "minimality not proven" label instead of discarding it as unverified.
More in the playbook "Verifying model output": <https://wpnews.pro/playbooks/output-verification>

*This post is being written as part of the **Kiroween 2026 hackathon** (Kiroween Hackathon 2026).*

Every quarter, RevOps and deal-desk teams ship updated Excel pricing workbooks after spot-checking five or ten sample deals. Everything looks fine — until a real customer hits an edge-case combination of seat tier, annual billing, and referral stacking that quietly blows past a discount cap or sells below gross-margin floor.

Most modern tools try to audit spreadsheets by pasting formulas into an LLM and hoping it does the math right. For the **Frankenstein** category at Kiroween 2026, I built **ProofSheet by Aletric** using the opposite philosophy: stitch the world's most ubiquitous business tool (**Microsoft Excel `.xlsx`**) directly to a formal theorem prover (** Microsoft Z3 SMT solver**), so pricing policies are mathematically proven rather than guessed.

`.kiro/`):
Building a compiler from Excel formulas to Z3 SMT constraints is unforgiving. One floating-point rounding shortcut, one missed division-by-zero branch, or one dropped timeout check can turn a formal verifier into a silent false pass — which is worse than having no verifier at all.

Using **Kiro** changed how I approached building this from day one. Instead of vibe-coding features and hoping tests would catch architectural drift later, I used four Kiro primitives together:

`.kiro/specs/excel-z3-compiler/`)
Before writing the compiler, I locked down `requirements.md`, `design.md`, and checkbox `tasks.md` in Kiro. The spec fixed the exact pricing domain (`1` to `5,000` seats, annual billing, referral — **20,000 discrete deals**), exact rational representation (cents and basis points), and strict verdict semantics:

`*_witness.xlsx` workbook and a minimality proof when Z3 proves no smaller seat count breaks the rule)`UNSAT` across the entire declared domain)`.kiro/steering/z3-safety.md`)
My favorite Kiro feature on this build was **file-scoped steering**. Alongside `product.md` (always included) and `tech.md`, I created `.kiro/steering/z3-safety.md` scoped specifically to `backend/compiler/**/*.py`. Every time an agent touched compiler code, Kiro automatically enforced four non-negotiable invariants:

`40.0%` or `20.0%`).` Unable to verify`.`=100/(B4-250)` failing at `250` seats in cell `B24`).`.kiro/hooks/proofsheet-verdict-smoke.json`)
To make sure no refactor quietly broke an existing verdict, I wired a `PostTaskExec` Kiro hook that automatically runs `test_verdict_matrix.py` and `test_unable.py` after task execution. If a change alters any verdict across the three revisions (`original`, `cap-only`, `repaired`) or breaks an `Unable to verify` case, it fails immediately.

Once the spec and contracts were locked, I split independent modules across parallel agents — separating the workbook loader from the formula parser, and later splitting the FastAPI backend (`backend/web/`), React/Vite UI (` frontend/`), deployment setup (` Dockerfile`), and regression test suites with clean file ownership.

Midway through the build, we hit a subtle formal-methods edge case: what if Z3 finds a valid violating deal (`SAT`) quickly, but times out on the *follow-up* query trying to prove minimality? A naive wrapper would discard the counterexample and return `Unable to verify`.

We revised the spec and compiler so a valid counterexample is never lost — ProofSheet still returns the violating deal, explicitly labeling it *"Counterexample (minimality not proven)"* instead of *"Proven minimal deal"*, backed by dedicated regression tests in `backend/tests/test_verify_minimization.py`.

By submission time, ProofSheet shipped as a single Dockerized FastAPI + React/TypeScript web app live at [proofsheet.aletric.com](https://proofsheet.aletric.com) with:

`101 seats`, annual billing, referral -> `$55.00` quote, `45.0%` discount, `11.2%` margin on `original`; `18.6%` margin still failing on `cap-only`; both policies proven on `repaired`).`.xlsx` workbooks
Next for ProofSheet at [Aletric](https://aletric.com): CEGIS Auto-Heal (where an LLM proposes formula repairs while Z3 proves the fix satisfies every policy *and* preserves existing compliant deal prices), natural-language rule translation with human confirmation, and a Z3 MCP server.

Try it live at **[https://proofsheet.aletric.com](https://proofsheet.aletric.com)** — and check out the full `.kiro/` folder and build log in the [GitHub repo](https://github.com/vatsrounak/ProofSheet).
