Alchemy framework formally verifies DDD aggregate invariants and cross-instance decisions

samgoodwin89 · x · 2026-11-21

samgoodwin89 demonstrates Alchemy's formal verification for domain-driven design: aggregates declare invariants (e.g. Purse.NeverNegative: balance >= 0) that are proven never invalidated, and decisions state what must hold across all instances they write, with Alchemy proving it for every state and input. The screenshot shows a real catch: when ChargeBoth is given the same purse as both first and second, the double charge drives the balance to -1 and the vitest test flags Purse.NeverNegative: violated — self-interaction edge cases surfaced automatically.

Related event: Alchemy merges formal verification: invariants as code(7 posts)→

Original post →

More from coding & agent

coding & agent channel →