Inspiration

Lending rules are fixed, but after a default a good lender gets more careful. We wanted that behaviour without letting it touch the rules themselves. The idea came from our research project XRPLife, where a model of the worm C. elegans runs on a public ledger: there, serotonin changes how much activity flows, never which connections carry it. Kiroween gave us the excuse to stitch that mechanism onto a rule book.

What it does

Ferret guards a pool of play money that advances cash on invoices. Every request passes twelve ordered checks (duplicate, analysis, amounts, term, advance rate, concentration per debtor, absolute cap, liquidity) and gets a yes or a no with a stable reason in the field log. Ferret has a mood: a debtor pushing past a ceiling or an advance defaulting makes it wary, then feral, and its ceilings tighten. In the demo a default takes the share one debtor may hold from 30 % to 25.5 % and the longest term from 90 to 77 days. Repayments and buybacks calm it, and time makes it forget. The mood changes the ceilings, never the rules. The visitor plays lender, supplier and debtor at once.

How we built it

  • Steering first: product, tech and structure files set the non-negotiables (integer arithmetic only, zero runtime dependencies, the reference folder read-only, the case replay as the central test).
  • Spec first: four specs with EARS requirements (mood 11, invoice-pool 14 with the twelve checks in order, server 13, field-log-ui 13), each with requirements, design and tasks before any code.
  • An independent judge: a Python reference written outside Kiro generated 4,926 random events across 120 scenarios with the expected decision and state after each. Kiro's TypeScript engine replayed them with zero mismatch on the first run. Four unit tests Kiro had written were wrong about their own expectations; the engine was right.
  • MCP: the judge is exposed as an MCP tool (replay_events) so Kiro can ask what must happen instead of guessing.
  • Hooks and an agent: tests run on every engine edit, a guard reverts any change under reference/, a spec-sync hook, and an "immunologist" reviewer agent that checks integer arithmetic, the mood boundary and import direction.

Challenges we ran into

The free tier: 50 credits a month and a fifteen-minute throttle after a burst of large reads. The fix was discipline: short prompts, small read lists, one spec at a time, and never letting the agent open the 4 MB case file. In non-interactive mode Kiro drafts in chat unless told, in so many words, to write to disk.

Accomplishments that we're proud of

4,926 random events, zero mismatch between two independent implementations, on the first run. A live app anyone can try with play money.

What we learned

Spec mode earns its cost when the spec is a contract with a judge: requirements became tests, and the differential replay settled every disagreement in one command.

What's next for Ferret

Two more burrows on the same engine: pay by evidence, and a conditional escrow. Then a real ledger behind the book.

Prior work, disclosed

The idea of a rule engine with ceilings comes from our earlier invoice-advance prototypes (1 and 5 November 2026, inside the submission period, another repository); none of their code is included. The Python reference judge in reference/ was written on 11 November 2026 with a different AI assistant (Claude Code) and is used only as a test judge. The mood model is a transposition of a measurement from our research project XRPLife, cited as inspiration; none of its code is included. Everything under src/, tests/ and .kiro/ was built in Kiro from the specs. The developer did not drive Kiro by hand: on their instruction, an AI assistant (Claude Code) wrote the prompts to Kiro CLI, ran the tests between calls and committed the results.

Built With

Share this project:

Updates

Submission history