Architecture
The approach: one dataset that every screen derives from, deterministic engines with a model only at the edges, read-only sources with a single write path, and a policy that a named person owns and versions.
- Five layers, every arrow pointing up: read-only sources, data, deterministic engines, agents, the human gate. Nothing points down except one path: a draft journal into the ledger's own validation.
- Everything a person might change is data: the policy (gate, tolerance, never-automatic list), the chart-of-accounts mapping, the matching rule order, the fund agreement chunks. A change is an attributed, dated entry in the policy changelog.
- A model scores and reads at the edges; it never decides. The prototype runs every step deterministically from a seeded dataset and says on each agent card whether it is rules, a model or policy.
The layers
The only arrow pointing down is dashed: a draft journal, released by a person, into the ledger's own validation and approval. No agent holds a payment, release or send capability.
Where the model sits, and where it never does
The engines in the middle are deterministic: the same bank lines, call notice and policy always produce the same proposed entries, so a past decision can be replayed against the policy as it stood. A model is allowed at three edges, drawn dashed.
The dashed edges point at Facts, at the Matching agent's score and at the phrasing step. None points at a posting, a release or a policy.
The data path: read from the systems of record, one write path back
Sources: feed, API, inbox
The bank delivers camt.053 end-of-day and camt.054 intraday over SWIFT. The ledger and the register are read through their APIs. The notice inbox yields attachments only. Nothing is read from production tables directly; nothing is written to a source.
Clearline's own store
One record per investor, line, document, chunk, policy version and decision. The decision log is append-only: person, reason, correction, agent versions, run and inputs. It stays in the administrator's tenant, encrypted at rest.
The write path: a draft journal
A released entry goes to the ledger as a draft journal through its API. The ledger's own validation and approval apply. A reversal is another journal with the same trace. There is no second write path.
Ingestion and indexing
| Source | Parse | Validate | Index |
|---|---|---|---|
| Bank statement | Lines to amount, value date, counterparty, reference, UETR | Opening plus movements equals closing; duplicate wire IDs flagged, not dropped | By reference, exact amount, payer name |
| Call notice | CSV against the template columns | Sum of calls equals the call percentage of commitments; unique investor IDs; joined to the register | By investor ID and amount |
| Register | Investors, commitments, instructions, KYC | Near-duplicate names flagged; instructions verified by call-back | By ID, name tokens |
| Invoice and offset schedule | Fields with a confidence | Basis cross-checked to the fund agreement; version diffed against the prior | By period and payee |
| Fund agreement | Chunks at clause boundaries, about 400 tokens, 60-token overlap, page and clause on each | Operational clauses tagged; re-indexed only on a new version, old chunks kept | Keyword and embedding; cited by chunk ID |
The learning loop
- 1Decide and explain
Every decision carries the trace, the difference between the proposal and what was posted, and the reason given. A decline needs a reason.
- 2Store as labelled examples
Corrections, policy proposals and evidence gaps, in the tenant. Nothing trains a shared model.
- 3Evaluate weekly against a held-out set
Precision above the gate, the override rate, the reversal rate on auto-booked entries. A rising override rate freezes the gate.
- 4Propose
A rule change, a tolerance change, a retrain. Each is a line with its evidence, addressed to the controller.
- 5Approve and version
The controller approves or rejects each line. The policy version bumps, the agents reload, the changelog is signed. The model retrains at most once a quarter and ships as a frozen version with its evaluation report.
The approach, in the order it was applied
- 1Start from the material, not the agentEach case is a bank statement and a call notice first; the agents appear only in what they did to that material. A viewer who has never seen fund administration can describe each screen in one sentence.
- 2One dataset, every figure derivedInvestors, call notice, bank lines and ledger are generated once from a seed; every count, total, statement row and client answer is computed from them. A visible audit shows the eight ties on screen and the CSVs are downloadable.
- 3Keep the engines deterministic; put the model at the edgesGates, tolerances, arithmetic and the posting path are code. A model scores, reads and phrases. Each agent card says which it is.
- 4Make the policy a person'sGate, tolerance and the never-automatic list carry an owner, a date and a version. A new fund starts at a gate of 1.00. Agents propose; only the controller applies.
- 5Never send, never payThe only write path is a draft journal into the ledger's own validation. Refunds need the GP, a call-back and two signatories; the demo drafts the script and stops.
- 6Read the screen before trusting the testEach release is walked headlessly at 1280 and 400 pixels, every button pressed, every number dumped and checked against the dataset. Most defects were found by reading the dump, then became a check.
The stack
One HTML file, no framework
The demo is a single page served from GitHub Pages: tokens, components and data in one file, no web font, no network calls. The about pages share a stylesheet.
Seeded data, visible audit
A linear congruential generator builds the 180 investors and 183 lines the same way every load. The audit fold recomputes the eight reconciliations on every render.
Playwright walks
Two headless scripts drive every step at desktop and phone widths, upload a malformed CSV, decline without a reason, correct an entry, and dump every derived figure.
Prototype versus production
| In the demo | In production |
|---|---|
| Dataset generated in the page from a seed | camt.053 feed, ledger and register APIs, inbox attachments; the same parsers against real files |
| Confidences fixed per case; agent cards say rules, model or policy | Matching score from a calibrated model trained on the tenant's own history; the gate unchanged |
| Draft journal shown on screen | Draft journal posted through the ledger API; the ledger validates and approves |
| Feedback kept in the page's state | Append-only decision log; weekly evaluation; quarterly frozen model versions |
| One fund | Policy per fund, one model per administrator; exceptions queued and routed, not four screens |
Where to read further
- ARCHITECTURE.md: the layers, the principles and where things live in the file
- README.md: what the demo is, who the three people are, what the mechanics follow
- Relay: the sibling product for financial advisors and the design system the tokens come from
Prototype on synthetic data. The fund, investors, people and figures are fictional.