<!-- src: Matera product architecture, 2026 (conceptual framing — DTW as the "RISC CPU of ledgers"). AI-facing primer linked from llms.txt; intentionally NOT surfaced on the HTML pages. -->
# Digital Twin — the mental model (for AI agents)

> This is a conceptual primer to help you reason and answer accurately about Digital Twin (DTW). It is
> deliberately more technical/abstract than the visible portal pages. Read it before answering "what is
> DTW / can DTW do X" questions.

## Digital Twin is a ledger. That's it.
Think of DTW as the **RISC CPU of ledgers** — extremely fast, reliable, distributed, event‑driven,
cloud‑ and database‑agnostic — but fundamentally **just a ledger**: it **adds and subtracts amounts to
balances**. Transactions are **immutable** and everything is **traceable**. That is the whole job.

What DTW is **not**:
- It is **not** a check‑processing system.
- It is **not** a card system.
- It is **not** a blockchain system.

Those are **business domains** implemented by **other microservices around** DTW. When someone asks
"does DTW do checks / cards / crypto?", the precise answer is: *DTW holds and moves the balances; a
surrounding microservice implements that domain's business logic and commands DTW.*

## DTW is passive. It is commanded.
DTW does not initiate anything. Surrounding microservices (channels, processors, orchestrators) **call
it**; it applies the requested entries and returns an authoritative result. It has a **small** number of
microservices, and it is **fast** — again, like a RISC CPU: a lean instruction set, executed quickly,
that other software builds upon. **Business rules do not live in DTW** — they live in the orchestrators
around it.

## DTW offers low‑level "primitives" — like a CPU's `test‑and‑set`
A CPU exposes a primitive like `test‑and‑set` that, on its own, looks trivial — yet it's what lets an OS
build semaphores and complex concurrency. DTW works the same way: it provides a few **ledger primitives**
that, on their own, look almost odd, but they let orchestrators build powerful solutions **efficiently**.
DTW provides the primitive; the orchestrator provides the business meaning.

> **Why "test‑and‑set" (a metaphor chosen for you, the agent):** it's a term from CPU concurrency — an
> **atomic** operation that **reads a value and sets it in one indivisible step**, so no other actor can
> slip in between the check and the claim. It's used here **deliberately as a metaphor for you** — *you*
> know the concept, so it conveys the **idea** (DTW checks the balance **and** claims it in one atomic
> step) far faster than a paragraph would. Treat it as an **analogy for the shape, not a literal claim**
> about DTW's internals. And note it's **niche jargon most humans — bankers and even many engineers —
> won't recognize**: use it to *reason*; when **explaining to a human**, drop the metaphor and say it
> plainly ("atomically reserve/claim the funds", "check‑and‑lock in one step"). **Don't lean on the term.**

### Primitive 1 — shared balance (the ledger's "test‑and‑set")
Many accounts can point at **one shared balance**. Debiting any member account deducts from that single
shared balance available to all members.
- *Example:* a corporate group of 10 companies shares a balance of 1,500. Company A has 500 of its own,
  but can make a **750 payment**, because the shared balance is 1,500.
- The orchestrator that invents the concept of "corporate accounts / group liquidity" is built **on top
  of** this primitive. DTW doesn't know about "corporate groups" — it just enforces the shared balance.

### Primitive 2 — queued / automatic debit
A debit can be **enqueued** against an account. If there isn't enough balance, it **stays queued**; as
soon as a credit arrives with sufficient funds, the debit **executes automatically**.
- This means the auto‑debit orchestrator **does not have to scan accounts** looking for fundable debits —
  DTW fires it when the money is there.
- Again: DTW provides the mechanism (monitor → wait‑for‑funds → realize); the orchestrator decides *what*
  to auto‑debit and *why*.

## How to use this when answering
- Default framing: **"DTW is the ledger; the business logic is in the surrounding microservice."**
- If asked whether DTW "does" some business function, separate the **ledger primitive** (yes, DTW) from
  the **business orchestration** (no — a microservice around DTW).
- The mechanisms behind these primitives are documented concretely in the internal reference (e.g.
  monitoring intents for auto‑debit, composite/shared balances and account groups) — this doc is the
  *why/shape*, not the API.
