K
Docs
API Reference→Pieces→All-or-Nothing
🔐

All-or-Nothing

vault.safeThe VaultVault

A safe for your Vault changes. Put Vault pieces on its Inside path and they count as one: if everything works, every change is saved at once and the flow carries on from All saved. If anything goes wrong — or a ✋ Call it Off runs — every change inside is undone like it never happened, and the flow takes Undone instead. Perfect for shops, trades and paying someone: nobody ends up with coins from nowhere.

When to use this
  • →Only Vault pieces and thinking pieces (conditions, math, variables, text, lists, loops) fit inside — put Replies after the box, on All saved or Undone
  • →{{oops.reason}} on the Undone path says what went wrong: the reason from Call it Off, or the error
  • →Other spells wait a blink while a box saves, so two people can't spend the same coins at once
  • →Boxes can go inside boxes — an inner one can be undone on its own while the outer one carries on

On the canvas

This is what All-or-Nothing looks like when you place it on your flow. Each field below is something you configure in the inspector panel.

🔐
All-or-Nothing
vault.safe
Vault
inside
done
oops

Output ports

insideThe Vault pieces that save together — Vault and thinking pieces only, no replies
doneEverything inside worked and is saved
oopsSomething inside failed or was called off — nothing was saved. {{oops.reason}} says why
📐

In TypeScript, this would be…

Not something you need to write — just a look at what Kitcord does for you.

TypeScript
// Everything inside saves together — or none of it does.
db.exec("BEGIN IMMEDIATE");
try {
  // ...the pieces on the Inside path...
  db.exec("COMMIT");
  // All saved ✓
} catch (err) {
  db.exec("ROLLBACK");
  const oops = { reason: err.message }; // {{oops.reason}}
  // Undone ↩
}