Regina is an intake and case-preparation system for health programmes that work through community clinics, field posts and remote clinicians. It takes a patient's account the way it arrives, in typed text, recorded voice or a photographed note, asks the few questions still needed, and prepares an evidence-linked case that a qualified clinician claims, reviews and signs. Regina does the repetitive preparation between a fragmented account and a human decision. The clinical judgement, and the responsibility for care, stay with people.
Everything in this repository is synthetic: every organisation, site, person, patient, credential, report and attachment was written for it. The worked example is a fictional central Nepal flood response in September 2026.
Node 22 or 24 and npm 10.
npm ci
npm run check # biome, tsc -b, import boundaries
npm test # vitest
npm run build # tsc -b, then the web bundle
npm run dev # API on :8787, web on :5173, no credentials, no model callsLocal runs use committed replay fixtures: the synthetic world is seeded into memory, every model
answer is replayed from packages/agents/fixtures, and nothing leaves the process. Open the web
address and press Try Regina. npm run walkthrough drives the same product path over HTTP and
prints a pass/fail table. scripts/verify-clean-clone.sh proves a fresh clone checks, tests and
builds.
Access is three separate, visible states. Regina records them; it never infers one from another.
| State | Who sets it | What it says |
|---|---|---|
| Identity confirmed | The workspace | This account belongs to the person it names |
| Credential attested | The person's organisation | The organisation vouches for the profession and specialties |
| Operation authorised | The workspace administrator | What this person may do here, for which sites, in which languages, until when |
An authorisation carries a preset, and a preset carries default capabilities and a default scope.
Capabilities can be added per person; receive_reviews is the usual addition for an intake
account that must read signed reviews for its sites.
| Preset | Default capabilities | Default scope | Home screen |
|---|---|---|---|
| Administrator | manage_workspace, view_usage, view_public_impact |
coordination | Workspace |
| Intake | conduct_intake, view_public_impact |
capture | New intake |
| Reviewer | review_cases, view_public_impact |
advisory | Case pool |
| Guest | view_public_impact |
coordination, read only | Public impact |
Only a reviewer who holds a case's lease reads its packet and evidence. An administrator never
does. The rules live in packages/domain/src/organization.ts and
packages/application/src/access.ts.
npm run eval # both systems over the 31-case corpus, offline, deterministic
npm run eval:fixtures # regenerate the replay fixtures; a byte-for-byte no-op when nothing changed
npm run eval:documents:fetch # fetch the published benchmark page the committed gold names
npm run eval:documents # score the document reader against the gold transcription| What | Where |
|---|---|
| Corpus and metric definitions | evals/src/corpus.ts, evals/src/scoring.ts |
| Replay results, per case and as a report | evals/results/replay/ |
| Live ground truth recorded on AWS | evals/results/agentcore/ground-truth.jsonl |
| Handwritten document benchmark and its gold | evals/benchmark-documents/ |
| Replay fixtures the local world answers from | packages/agents/fixtures/, evals/fixtures/ |
The headline results and how each metric is computed are in
docs/evaluation.md. The benchmark page itself is fetched, never committed;
its gold transcription stays marked draft until a person approves it.
The deployed stack is one CDK app in infra/lib/regina-stack.ts. Every service below has one
adapter or handler that talks to it, and nothing else does.
| Service | Purpose | Code |
|---|---|---|
| Bedrock AgentCore Runtime | Runs the seven specialist agents and the coordinator | apps/api/src/runtime/agentcore-server.ts, packages/adapters/src/agentcore/ |
| Bedrock, Amazon Nova | The model behind each specialist | packages/agents/src/models/bedrock.ts |
| Lambda | The API, the preparation worker, the lease sweep and the initialiser | apps/api/src/runtime/lambda.ts, apps/api/src/workers/ |
| SQS FIFO | One job per intake plan and per preparation, retried once at most | packages/adapters/src/sqs/ |
| DynamoDB | Cases, evidence spans, packets, offers, leases, reviews, events, projections | packages/adapters/src/dynamodb/ |
| S3 | Evidence objects and the web bundle | packages/adapters/src/s3/ |
| Transcribe | Recorded accounts to text | packages/adapters/src/transcribe/ |
| Cognito | Team sign-in | apps/api/src/auth/cognito.ts, scripts/cognito-users.ts |
| API Gateway and CloudFront | One address for the API and the web app | infra/lib/regina-stack.ts |
| KMS | Encryption of the table and the evidence bucket | infra/lib/regina-stack.ts |
| SSM Parameter Store | The intake webhook secret | apps/api/src/runtime/secrets.ts |
| EventBridge Scheduler | Runs the lease sweep | infra/lib/regina-stack.ts |
| CloudWatch Logs | Application and audit logs, identifiers only | infra/lib/regina-stack.ts |
Deployment, limits, cost and teardown are in docs/deployment.md.
| Path | Contents |
|---|---|
packages/domain |
Pure concepts and deterministic policy; imports only zod |
packages/application |
Use cases and the ports they are written against |
packages/agents |
The specialist agents, the coordinator, hooks, gates and the graph |
packages/adapters |
One directory per external system, plus memory |
packages/integrations |
Native and Kobo intake, webhook signatures, FHIR, HXL, EMT MDS |
packages/seed |
The synthetic world, its stories and sample reports |
apps/api |
The Hono API, the runtime server and the Lambda handlers |
apps/web |
The React and Vite product |
evals |
Corpus, harness, scoring, fixtures, results |
infra |
The CDK stack |
scripts |
Development, walkthrough, provisioning and release checks |
Regina separates model-driven work from deterministic control. Agents propose. Domain code decides
consent, authorisation, evidence hashing, state transitions, contradictions, readiness, urgency,
eligibility, leases, capacity and disclosure. docs/architecture.md has the
boundaries, the agent flow, the trust model, the storage layout and the API surface.
SECURITY.md has the threat boundaries and how to report a vulnerability.
Eight pure TypeScript primitives in packages/domain were adapted from Gloria, the same author's
earlier open clinical-intake project: hash, evidence, facts, contradictions,
verification, documents, packet and trajectory. Gloria is not a dependency. Everything
else here is new.
Apache-2.0. See LICENSE.