Clearline

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 human gateFund accountant records or declines with a reason · controller sets policy and signs statementsGP approves refunds · two signatories release a wireprepared entry, trace, confidenceAgentsIntake (rules) · Matching (model + rules) · Reconciliation (rules) · Posting (policy) · Ask (phrases from released data)Each reads, cites and prepares; none decidesdifferences, ties, allocationsDeterministic enginesCall arithmetic, bank tie-out, duplicate and tolerance checks, chart-of-accounts mappingCommitment-share allocation, statement builder, the data audit; no model callfacts with IDsData: one record per thingInvestors, call notice, bank lines, fund ledger, fund agreement chunks with page and clausePolicy with version; an append-only decision log: person, reason, agent versionsstatements, documents, register rowsSources, read onlyBank camt.053 / camt.054 over SWIFT · general ledger (eFront Invest) · transfer-agency register (eFront TA)Notice inbox attachments · uploaded templatesthe one write path: a draft journal, validated by the ledger

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.

Sources, read onlystatements, documents Factstyped, with IDs Enginesarithmetic, gates Agentsprepare, cite Human gaterecord or decline no model call inside the enginessame lines and policy, same entries, replayable A model may readan invoice, an offset schedule, a questioninto fields with a confidence; low goes to a person A model may scorea match, as a calibrated probability on this fundthe gate that reads the score stays in code A model may phrasea trace, an investor notice, an answer with sourcesit never changes the entry or the verdict

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

SourceParseValidateIndex
Bank statementLines to amount, value date, counterparty, reference, UETROpening plus movements equals closing; duplicate wire IDs flagged, not droppedBy reference, exact amount, payer name
Call noticeCSV against the template columnsSum of calls equals the call percentage of commitments; unique investor IDs; joined to the registerBy investor ID and amount
RegisterInvestors, commitments, instructions, KYCNear-duplicate names flagged; instructions verified by call-backBy ID, name tokens
Invoice and offset scheduleFields with a confidenceBasis cross-checked to the fund agreement; version diffed against the priorBy period and payee
Fund agreementChunks at clause boundaries, about 400 tokens, 60-token overlap, page and clause on eachOperational clauses tagged; re-indexed only on a new version, old chunks keptKeyword and embedding; cited by chunk ID

The learning loop

  1. 1
    Decide 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.

  2. 2
    Store as labelled examples

    Corrections, policy proposals and evidence gaps, in the tenant. Nothing trains a shared model.

  3. 3
    Evaluate 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.

  4. 4
    Propose

    A rule change, a tolerance change, a retrain. Each is a line with its evidence, addressed to the controller.

  5. 5
    Approve 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

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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 demoIn production
Dataset generated in the page from a seedcamt.053 feed, ledger and register APIs, inbox attachments; the same parsers against real files
Confidences fixed per case; agent cards say rules, model or policyMatching score from a calibrated model trained on the tenant's own history; the gate unchanged
Draft journal shown on screenDraft journal posted through the ledger API; the ledger validates and approves
Feedback kept in the page's stateAppend-only decision log; weekly evaluation; quarterly frozen model versions
One fundPolicy 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.