Principles/02 of 06

Nothing is ever lost.

Mandala is built on event sourcing. Most software stores how things are now and overwrites it when something changes. Mandala stores every change, as a signed fact, and works out how things are now from that history. The past is never overwritten, because the past is the data.

Planet Express · three weeks after the Moon run

Lumon writes to say only one crate of waffle irons arrived, and that the delivery was never confirmed.

Hermes opens the delivery. Six facts, in order: requested by Mira for him, crate one checked by Bender, crate two checked by Bender, paid, confirmed by Leela, shipped by Fry. Each one signed.

Nobody has to remember. Nobody could have tidied it up afterwards, either. Hermes sends Lumon the six lines.

09:04 · 14 OctAI✓ verified
Mira asked to pay Tyrell Corporation $7,240 for invoice #2041.
signed by Mira, on behalf of Hermes, for Planet Express
under rule · Second approver for large payments
whoMira, the accomplice
on behalf ofHermes
forPlanet Express
when14 Oct, 09:04
under ruleSecond approver
sealMira’s own seal
01 · Event sourcing

History is the truth. State is derived.

Each action is a new fact: who acted, for whom, when, under which rule, with which details. A record’s current state is what its facts add up to. The table you look at, the totals and the search index are all views, kept current as facts arrive.

action→signed fact→state→tables · totals · search
Facts, as they are certified
  1. v1RequestMira, for HermesLumon Industries · Moon · 120 units · 2 crates
  2. v2CheckCrateBendercrate 1 of 2
  3. v3CheckCrateBendercrate 2 of 2
  4. v4PayHermespaid
  5. v5ConfirmLeelanot the one who asked
  6. v6ShipFryto the Moon
Projections, kept current
Delivery · tablegeneration 4,812
customerdestinationunitsstatus
Lumon IndustriesMoon120Shipped
Los Pollos HermanosAlbuquerque40Requested
Duff BrewerySpringfield200Confirmed
By status · totals

1 requested · 1 confirmed · 1 shipped

Search · text index

“moon” → Lumon Industries

A read pins generation 4,812 and sees it whole while new facts keep arriving.| where status == Requested→ Los Pollos Hermanos · 2 ms
02 · What comes with it

Three things you don’t have to build.

todayWhat was true, and when

Open any record and read the facts that made it, in order, each with its time and its signature. “Why is it like this?” always has an answer, and so does “what did it say on the 3rd?”.

todayUndo that doesn’t erase

A mistake is corrected with a new action, such as voiding a transaction. The mistake and the correction both stay. You get the right state and the honest story.

todayAudit without extra work

There is no separate audit log to switch on, and none to forget. The history is the audit: who did it, for whom, under which rule.

todayNew views over old facts

A view is only ever derived. Add one later and it is built over everything already recorded, including the years before you thought of it.

todayA past that can’t be quietly rewritten

Each fact names the one before it on the same record. Changing the past would break every link after it.

comingQuestions about a moment

Asking a query for “the price in force when this order was sent” in one line. The time-series mode that does it is built in Karma’s engine and not yet released.

03 · On disk

What a fact looks like.

Nothing mysterious: one line per fact in a journal on your own disk. Each write returns a receipt, and a write sent twice returns the same receipt, so a flaky network never records a thing twice.

Honest about the exception

A contract chooses how strongly each kind of record is written. Payments, stock and approvals wait for the disk. Chat traces and drafts may be acknowledged first and written within 100 ms, so a crash can lose at most that last instant of them. The compiler refuses that weaker class for anything about money, stock, identity or approvals.

Deleting is your right

Nothing is lost by accident. Leaving is still yours: delete the folder and it’s gone.

A receipt, as the journal keeps itone line per fact
{  "at_ms": 1791983040000,  "tenant": "planet-express",  "namespace": "com.planetexpress.delivery",  "subject": "delivery-lumon-0412",  "id": "9f3c2a71…e81d",  "version": 1,  "assertion": "b41e07d9…3a6c",  "actor": "mira",  "action": "Request",  "args": { "customer": "Lumon Industries", "destination": "Moon", "units": 120, "crates": 2, "credit_terms": false }}

The real shape, with the cast’s values. actor is whose signature it carries, here Mira’s own; assertion is the signed fact it receipts; version counts the record’s facts.

Status

What works today, and what’s coming.

today

Signed facts and receipts for every write to your records; state, tables, totals and text search derived from them; retries that return the original receipt; corrections as new actions; contract upgrades that move records across as recorded actions.

in progress

Fast restarts for homes that already have a history: today a restart rebuilds the views from the facts, which proves the principle and costs time. Saved checkpoints remove the wait.

coming

As-of and latest-value queries from your contracts (built on a branch, not released). Version history for every document, as part of bringing Medha onto Karma (designed, not built). Today your documents are files; their history is whatever you keep, such as git.

Most systems remember where things stand. Mandala remembers how they got there.

Doesn’t the history grow forever?

It grows, slowly: facts are small. A busy personal Mandala stays under a gigabyte after months. Views are kept ready, so reading doesn’t get slower as history gets longer.

Is this a public ledger?

No. It is a private history on your own machines. Trust without blockchain explains the difference.

Where is the detail?

On the Karma page: projections, signed facts, durability and guarantees.