Architecture and data protection

How it fits together, what it costs to run, and how the data is protected

Audience: One Claim, Specialist Risk Group IT and data protection

Components

The system is a small web application with a background worker. Each part has one job and a defined boundary, so the claims data source or mail system can change without rewriting the rest.

ComponentJobNotes
Mail connectorWatch the shared mailboxes, fetch messages and attachments, read the folder tree, apply categories and flags, move messages, save draftsMicrosoft 365 through Microsoft Graph. Separate read-only and read-write connections; see below
Work queueHold each email's progress through the pipeline; retry on failureAn email is never lost if a step fails; it stays in the inbox
Document preparationClean email text, convert attachments, extract referencesRules only: text extraction and optical character recognition for scans. The original PDF is passed to Claude only if the email goes to the fact extractor.
Rule editorEdit, dry run, test, publish and roll back rulesSee the rule editor page. Dry runs use the read-only connection only.
Rules engineRecognise known senders and templates, match claims by reference, and turn facts into category, folder, handler and review flagRuns first and last for every email. Plain, versioned rules a supervisor can read. Given the same facts, always gives the same answer.
Fact extractorOnly for emails the rules engine could not settle: ask Claude to read the unstructured text and return facts in a fixed structureThe only component that talks to Claude. Returns facts, never decisions.
Claims data adapterAnswer "which claim is this?" and "tell me about claim X"Mock data for the demonstration; SiteView export or interface later
Medical report readerClaude extracts injury facts; rules classify, look up tariff amounts and run cross-checksReal-time for new reports, batch for backlog
Web applicationReview queue, decision view, corrections, dashboards, settingsStaff sign in with their Microsoft 365 accounts
Audit logRecord every decision, action and correctionAppend-only; includes model, rules and prompt versions

Technology

PHP 8.4 and MySQL, server-rendered pages that work without JavaScript, following Custodia's usual approach of minimal dependencies. Claude is called through Anthropic's Messages interface. Anthropic's guidance is to use their official PHP library rather than hand-written HTTP calls; that is one external dependency, installed with Composer, and we think it is justified here because it handles retries, streaming and error types correctly.

Microsoft 365 connection

Postbot connects to One Claim's Microsoft 365 through Microsoft Graph, Microsoft's supported programming interface for mail. Nothing is installed on staff computers and no mailbox passwords are held.

ItemProposal
RegistrationAn application registered in One Claim's (or the group's) Microsoft Entra ID, owned by their administrators, who grant consent and can revoke it at any time
Two connectionsRead-only (mail read permission) for dry runs, shadow running and the accuracy test. Read-write (mail read and write) is only created when One Claim moves to assisted filing. Until then Postbot has no technical ability to change the mailbox.
Mailbox scopeBoth connections restricted to the named shared mailboxes using Exchange Online's controls for application access, so they cannot read any other mailbox in the tenant
CredentialsCertificate-based, not a shared secret; stored on the server outside the web root; rotated yearly
New mailMicrosoft Graph change notifications tell Postbot when mail arrives; a check every few minutes catches anything a notification missed
FoldersThe folder tree is read from each mailbox and kept in step, so the rule editor offers real folders and warns when one is renamed or removed
Actions (read-write only)Move to folder, apply an Outlook category ("Category 1", "Category 2", email type), set a flag, save a draft reply in the shared mailbox's drafts. No send, forward or delete permission is used by the code, and sending is not built.
Staff correctionsChanges to the folder of an email Postbot filed are detected and recorded as corrections
Several mailboxesEach mailbox is configured separately, with its own rule sets if needed
LimitsMicrosoft limits the rate of requests per mailbox; the connector backs off and retries, and email waits in the inbox rather than being lost
Question Q1

Which shared mailboxes are in scope, and who in One Claim or Specialist Risk Group IT can register the application and grant administrator consent?

Data model

The main records the system keeps. Facts and decisions are stored separately, which is what allows a rule change to be dry run over thousands of emails without calling Claude again.

RecordHoldsKept for
MailboxConnection, folder tree, which rule sets applyLife of the system
EmailMicrosoft 365 identifiers, sender, received time, thread, cleaned text, extracted referencesOne Claim's retention period
AttachmentFile (encrypted), extracted text, page countOne Claim's retention period
Fact setFacts for one email or report, each with confidence and evidence; the model and extraction instruction version that produced themAs email
DecisionType, category, claim, folder, handler, review flag; the rule version and the rule that made each part; whether live or dry runAudit period agreed with One Claim
ActionWhat was done in the mailbox and when (move, category, flag, draft)Audit period
CorrectionWho changed what, from and toAudit period
Rule set versionAll rules in a version, author, approver, notes, dry-run results, publish and retire datesPermanently
Test caseEmail reference, expected outcome, reason, who set itUntil retired
Dry runScope, rule version tested, results and differences12 months, suggested
Claim (cached)Reference, parties, registrations, client, handler, status from SiteViewRefreshed; not a system of record
Medical reportReport, injuries with groups and prognosis, tariff lookup, flags, handler correctionsOne Claim's retention period
Audit eventEvery sign-in, setting change, publish, rollback and exportAudit period

Use of Claude

Design rule: where a decision can be made deterministically, it always is. Inference is used only for tasks that cannot be done by a fixed rule, which in practice means reading unstructured text: free-written emails and letters, scanned documents, and medical reports. Claude's output is a set of facts with evidence. Every decision (category, folder, handler, claim match, tariff group, tariff amount, flags, counts) is made by code from those facts.

This keeps decisions consistent, testable and explainable, costs less, and means the system keeps working for the rule-decided share of email if the Claude service is unavailable.

  • Model: we propose Claude Opus 5 as the starting point for both email triage and medical reports. Once there is a labelled test set of One Claim's real email, we will measure whether a cheaper model (Claude Sonnet 5 or Claude Haiku 4.5) gives the same Category 1 recall for triage. Switching is a cost decision for One Claim, made on measured results.
  • Structured output: facts come back as data matching a fixed schema, each with a confidence and the passage it came from. The software validates the structure and checks facts against known data (for example, a reference Claude reports must exist in the text and in the claims data) before using them.
  • Tools: kept to a minimum. Claim candidates found by rule are passed in with the request, so Claude does not need to search for them. It has one read-only search tool for the case where no candidate was found, and no tool that can act on email.
  • Prompt caching: the extraction instructions and worked examples are the same for every email, so they are cached by Anthropic between requests, which reduces cost and response time.
  • Citations: for medical reports, Claude cites the page and passage behind each extracted fact.
  • Batch processing: backlogs of medical reports go through Anthropic's batch service, which costs half the normal rate and returns results within 24 hours.

What Claude sees and returns

For an email the rules could not settle, Claude is given the cleaned email text, the attachments, the references the rules already found, and any claim candidates already matched. It has one tool:

ToolInputReturns
search_claimsNames, places, dates or descriptions Claude has read in the textCandidate claims. Offered only when the rules found no candidate. The match is still confirmed by rule.

It returns facts only. An illustrative example with invented data:

{
  "email_type": { "value": "credit_hire_notification", "confidence": 0.93,
                  "evidence": "\"we confirm our client has been provided with a replacement vehicle\"" },
  "hire": { "ongoing": true, "start_date": "2026-09-18", "daily_rate": 68.50,
            "evidence": "attachment p1: \"Hire commenced 18/09/2026 ... £68.50 per day\"" },
  "deadline_text": null,
  "injury_mentioned": { "value": false },
  "complaint_or_dissatisfaction": { "value": false },
  "vulnerability_indicators": [],
  "parties": [ { "role": "credit_hire_company", "name": "Example Hire Ltd" },
               { "role": "third_party_driver", "name": "J. Example" } ],
  "claim_identifiers_in_text": [ { "type": "registration", "value": "AB21 CDE" } ]
}

The rules engine then decides: email type credit hire + hire ongoing gives Category 1; the registration matches claim OC-24-01873 in the claims data; the folder comes from the filing table for that client and type; the reply comes from the credit hire acknowledgement template. Each of those steps is logged with the rule that made it. The final schema will be agreed once One Claim's email types and folders are known.

Running costs

Claude is paid per use, by the amount of text read and written, measured in tokens (roughly four characters of English per token). Anthropic's published list prices at the time of writing, in US dollars per million tokens:

ModelInputOutputRole here
Claude Opus 5$5.00$25.00Proposed default
Claude Sonnet 5$2.00$10.00Candidate for triage, if accuracy holds
Claude Haiku 4.5$1.00$5.00Candidate for simple first-pass sorting
Rough estimate, to be replaced with measured figures

Email: only emails the rules cannot settle go to Claude. An email that does might use around 6,000 input tokens and 600 output tokens: about 4.5 US cents on Claude Opus 5 before caching. At an assumed 300 emails per working day, if half need Claude, that is roughly $150 a month; if all did, roughly $300. The share decided by rules should rise over time as corrections become rules. Caching and short emails bring the cost down; long attachments push it up.

Medical reports: a 12-page report might use 30,000 input tokens and 4,000 output tokens: about 25 US cents on Claude Opus 5, or about 12 cents through the batch service. A backlog of 2,000 reports would be in the region of $250 to $500.

These figures depend entirely on One Claim's real volumes and document lengths (Q2, Q12). We will report actual cost per email from the accuracy test. Hosting and support are separate.

Data protection

Claim correspondence contains personal data about drivers, claimants and witnesses. Medical reports contain health data, which is special category data under UK data protection law. We suggest the following, for One Claim and Specialist Risk Group's data protection lead to review.

  • Impact assessment: a data protection impact assessment before any real data is processed. We will provide a draft covering data flows, retention and risks.
  • Roles: One Claim (or its insurer clients) as controller; Custodia as processor if we host it; Anthropic as a sub-processor. Contracts to reflect this.
  • Anthropic account: for live use, the API key should belong to One Claim's own Anthropic organisation, under Anthropic's commercial terms, so One Claim holds the contract, the billing and the data relationship directly. The demonstration can run on a Custodia key using invented data only.
  • Training: Anthropic's commercial terms state that data sent through the API is not used to train its models. One Claim should confirm this against the current terms as part of its review.
  • Retention at Anthropic: Anthropic offers zero data retention arrangements for eligible organisations, subject to agreement. We recommend One Claim asks for this for medical report processing.
  • Where processing happens: Anthropic's interface lets the caller choose where processing takes place from a set of regions. Claude is also available through Amazon Bedrock, Google Cloud Vertex AI and Microsoft Foundry, which may suit if Specialist Risk Group already has agreements and UK or European data commitments with one of these. We will confirm the options available at the time of build.
  • Minimisation: only the email and attachments being triaged are sent, plus the claim summary Postbot looks up. We do not send whole claim files.
  • Retention locally: Postbot keeps decisions and audit records; copies of email content and attachments are kept only as long as One Claim's retention policy allows, then deleted automatically.

Security

  • The API key is held on the server, outside the web root, never in a browser. Separate keys for demonstration, test and live, each with a monthly spend limit set in Anthropic's console.
  • Mailbox access uses an application registration restricted to the named shared mailboxes, not to the whole Microsoft 365 tenant, and is read-only until assisted filing is approved.
  • Staff sign in with Microsoft 365 accounts. Roles: triage, handler, supervisor, administrator.
  • All traffic encrypted; stored attachments encrypted at rest.
  • Email content is treated as untrusted input. The model's output is checked against a schema and rules before any action.

Hosting

The demonstration runs on Custodia's server under this site. For live use there are two realistic choices, and the right one depends on Specialist Risk Group's IT policy:

Custodia hosted, in the UK

  • Fastest to set up
  • Custodia manages updates and monitoring
  • Needs group approval as a supplier handling claim data

Within Specialist Risk Group's environment

  • Data stays within group infrastructure
  • Group IT controls access and backups
  • Longer to set up; needs group IT time