Inspiration
A small seller who sells on WhatsApp gets orders as chat messages and payments as mobile money confirmation texts. Nothing links them. At night the seller scrolls both, ticks things off by hand, and fake confirmations slip through. We wanted a tool for these sellers that does the matching, explains each decision in one plain sentence, and never touches the money without leaving a trace. It fits the Frankenstein category: a chat message and an SMS were never meant to meet, so we stitch them together and bolt them onto an accounting ledger that cannot forget.
What it does
The seller (or a helper) pastes an order and a payment confirmation. A strict deterministic parser reads them, a scoring engine suggests the pair and explains why in plain words, and the seller confirms, rejects, matches by hand, cancels an order or sets a record aside. Advisory rules flag duplicate transaction ids, name mismatches, old messages reused and overpayments. Every decision becomes balanced entries in an append-only double-entry ledger, and a "books balance" check re-verifies the whole book. Corrections are reversals: nothing is ever edited. Live demo, made-up data only: ledger.nkap.dev. Open source, Apache 2.0.
How we built it
With Kiro, spec-first:
- Specs: one spec for the whole product (
.kiro/specs/chat-ledger/): 10 requirements, a design, 14 tasks. - Design stops: before each task's code, Kiro wrote a design stop that I reviewed, listing the guards it would try to break.
- Steering: 3 steering files (
tech,security,product) read in every interaction. - Hooks: 4 hooks in 3 files, added late (after task 13): a template lint on save, a migration reminder, and a commit guard for the project's rules.
- Property tests: random sequences of payments, orders and decisions run against a real PostgreSQL, checking the books after every step.
- Mutation checks by hand: guards broken on purpose to prove the tests notice.
- A register of more than 180 numbered decisions, each naming a weakened defense and its compensation.
- Not used: no MCP configuration.
Stack: Java 21, Spring Boot 4.1, PostgreSQL 16 (row-level security, database triggers that keep the ledger append-only), Thymeleaf and htmx, Flyway, Testcontainers, jqwik, Docker, Cloudflare Tunnel.
Challenges we ran into
Supervised mode asks for review after every write, so we moved to Autopilot with review at the end. The free plan paused us during the Spring Boot upgrade. Kiro repeated one procedural mistake three times, running dependent steps in parallel, until it committed to separate calls. A concurrency test failed one run in a few: a manual match racing with the engine's own suggestion raised an error instead of a clean refusal. Kiro refused to rerun the test until it was green, kept the database index as the guard, and fixed the service. CI also hit a rate limit from the package repository: Kiro would not change the build without approval and named the defense it was weakening.
Accomplishments that we're proud of
- A public demo that runs end to end, with a 25-check smoke test and a books check that balances after every action.
- More than 700 automated tests, including property tests against a real database and mutation checks done by hand.
- Database-level guards: the ledger is append-only, cancelling an order reverses its posting in the same transaction, and the database itself refuses inconsistent states.
- A written register of every weakened defense and its compensation, instead of hiding trade-offs.
- Kiro surprised us by finding and fixing a real race condition, and by stopping to ask rather than quietly weakening CI.
What we learned
A spec and a design stop before each task catch problems that a prompt alone would not: the guards were designed before the code. Kiro is most useful when it is allowed to say "this failed and I will not hide it". Reviewing every write is exhausting, so the review has to move to the places where it matters: design stops, diffs and tests. And a security trade-off that is written down with its compensation is easier to trust than one nobody mentions.
What's next for chat-ledger
The optional AI extractor for messy messages and a signed machine API (both described as future work, not built), correcting an order's total, and a reviewed French interface. The project is open source so other sellers and builders can reuse it.
Built With
- cloudflare
- docker
- flyway
- htmx
- java
- jqwik
- kiro
- postgresql
- spring-boot
- testcontainers
- thymeleaf