The PHR is built by a small Caladrius team (Giri, Krishna, Preetha and me) working with AI agents; each post ends with what the day meant for each of our areas.
Day 9 was three days of plans and no merges. Day 10, 9 November, was the opposite: 62 pull requests marked merged and
314 commits landed on dev in a single day. By the evening, five pieces of the PHR had become shared Caladrius
packages (forms, auth, Cally, terminology and the server core), a
second app existed in the repository (the PHR Console, for the people who run the PHR), and staff had a way to sign
in that a patient can never use.
This post covers what landed, how a day of that size was kept safe, and the review process that made it possible to merge that much without losing track of any of it.
1. How sixty-two merges happen in a day
Not by sixty-two people. Several agent sessions worked in parallel, each on its own stack of branches from the Day 9 plans: one on the forms filling stack (F1–F6), one on moving the security infrastructure (S1–S2), one on the console and staff sign-in (C1–C2, S2b), one on forms authoring and terminology (A, T). One session acted as reviewer and integrator: it reviewed each PR against its plan step, asked for changes, and decided the merge order.
Every PR followed the same template it had all week: its plan step and class, NHA cases affected (for almost all of these, none, because no screen or ABDM call changed), the checks that were run, and a changelog entry in the same commit.
Then the stacks met a practical problem. Merging about 45 stacked PRs bottom-up means about 45 full CI and security runs in sequence, each one waiting for the last. So I approved a landing PR: one branch built from the tops of the reviewed stacks with plain merges (no rebase, so every commit keeps its history), conflicts resolved (they were changelog-only, both sides kept), and the lockfile regenerated. One CI run, one security run, one merge. Because every included PR’s tip is an ancestor of the landing branch, GitHub marked each of them as merged, so each one still has its own description, review and diff to point to.
The rule I held to: a landing PR may only carry PRs that were already reviewed individually. It’s a way of saving CI time, not a way of skipping review.
2. Moving security code without changing it
The riskiest work of the day was also the least visible: moving the API’s security infrastructure into packages. Day 9’s principle 4 says extraction never changes behaviour, and each PR was written to prove it.
@caladrius/server-core (S1). The logger with field redaction, field encryption, the static-SQL guard, the
key-value client, the audit sealer, env parsers, the error handler, request ids, no-store and the security headers.
- Six modules moved byte-identical.
- The rest changed only to take ports: the key-value client, request id and error handler take the logger as a parameter; the audit sealer takes the app’s seal function.
- The API kept modules at the old paths that bind the package to its logger, so no route and no test import changed.
- Dependencies moved at the same versions; the lockfile only gained the workspace link.
@caladrius/auth (S2a, S2b) and @caladrius/auth-react (S2c). Sessions (RS256 access tokens, single-use refresh
tokens stored as hashes, reuse detection), cookies, the CSRF origin check, ajv validation, RBAC, and then the tiered
rate limiter. The app passes in its audience, cookie names, feature list and stores. ABDM sign-in stayed in the API:
how a patient signs in is product logic. In the browser, the session client (one shared silent refresh on a 401,
signed-out notifications, the error envelope) moved into auth-react; the PHR kept its own error class and its
onboarding-aware route guard.
How do you show a move changed nothing? The existing tests move unchanged and pass. The API’s 966 tests ran through the API’s own modules, including both rate-limit suites, with the same coverage. The packages got their own tests on top (the rate limiter at 98% statement coverage), and each step went in as S1 with an owner-review request and a security changelog entry.
3. Who a session is for
With the code in a package, step S2d added the one new security concept of the day’s auth work: every session now
says who it is for, patient or operator.
That comes from our own records, never from the request, and every route admits only the kind it is meant for. That gives the four layers the Day 9 draft plan proposed.
4. Staff sign-in
Staff sign-in (S2b) landed in four steps, and in the API it’s off unless a setting enables it. Every staff path is a 404 until then, so nothing new was exposed on QA, or to a security audit, before it was ready.
Step 1, the package. Three provider-agnostic entries in @caladrius/auth: single sign-on with the
standard protections, a second factor, and re-authentication for sensitive actions.
Step 2, the tables and roles. Identity providers (a secret is referenced by name only; the value stays in the secret store), user identities, invitations (a hashed token, single use, one open per person), MFA and lockout state, and the step-up time on the session. The roles from the plan arrived: Platform Admin (the old Admin, renamed in place so grants stayed), Installation Admin, Forms Author, Forms Publisher and Auditor.
Step 3, the routes. Staff sign in through the company’s identity provider with multi-factor authentication, with invitations and re-authentication for sensitive actions. Their sessions are deliberately short.
Step 4, an emergency route in. For when the identity provider is down: tightly controlled, and alerted on every use.
5. The PHR Console
The console (apps/console) is a desktop React app on the same stack as the PHR, talking to the same API through its own staff routes, English only.
- Sign-in, through the suite’s one sign-in page. It’s a new shared component in
@caladrius/ui, ported from AI Studio’s live sign-in design, so every Caladrius app greets staff the same way. The console passes its own product label; nothing is stored in the browser. - Users and invitations: staff only, emails masked; an invitation’s one-time link is shown once; changes need a step-up.
- Roles: by the end of the day, the API could change a user’s roles, suspend (which ends their sessions at once) and edit a role’s permission matrix, each through operator session, write right, fresh step-up, closed validation and one transaction with its audit rows.
- Installation: the installation profile from step C1, seeded with today’s values, so the PHR now reads its legal links and brand colours from the database with no visible change.
- Audit: newest first, with filters. A row carries sequence, time, actor, action, resource type and outcome, and never metadata, a resource id or a patient’s account id.
I asked for the console to look exactly like AI Studio’s desktop
app, so staff moving between Caladrius products feel at home. The rule from Day 9 applied: AI Studio’s desktop shell
was copied verbatim into vendor/ first (scanned for emails, phone numbers and secret-looking assignments: none),
then adapted in the console on our @caladrius/ui shell components. The parts specific to AI Studio, its
clinical tools among them, were left out.
The console was built and tested but not deployed that day: it has a container file so it builds, and its own end-to-end specs, but no deploy workflow yet.
6. Forms, end to end
The forms stacks from Sunday evening landed in full, and the console gave them their authoring half.
Filling (F1–F6). @caladrius/forms reads FHIR SDC Questionnaires through one allowlist (a form definition can never
carry an answer) and renders them three ways: a question at a time, a section at a time, or the whole form with a
section list. Some details I liked:
- Built for touch. Choices are 44 px option cards; Yes/No booleans so “not answered” stays possible; question mode moves on only after an answer is tapped, never after a keyboard selection.
- Container queries in pixels. The PHR’s root font scales with the screen, so a
rembreakpoint can never tell a phone from an iPad. A small thing an agent found by measuring. - Scores and safety rules are declared in the form, never inferred: option scores summed into bands, and rules such as “PHQ-9 item 9 above zero, show support”. There’s no FHIRPath engine. The golden forms (PHQ-9, GAD-7, a heart-health and a lung check) had their LOINC codes checked against NLM’s published definitions.
- Submitting never trusts the client. The server rebuilds the answers against the stored form, drops hidden answers, re-checks every rule, computes the scores itself, and writes the response, its values and the audit row in one transaction. Responses and values are encrypted per row.
- Every answer is a value over time, on a common trend page whose behaviour follows Apple’s guidance on charting data (a period control, a headline that states the average at the precision the values were recorded with, a neutral direction, never “better”) on our own design system. Units are converted only where the conversion is exact; a value in a unit that can’t be converted gets its own series, never mixed in. Two different values on one day are both kept and flagged, never averaged.
- Reading biomarkers from reports: a 138-marker panel (130 LOINC codes, each re-checked) and a deterministic reader for the person’s own lab reports, under a consent of its own. Every value it finds is preliminary until the person reviews it, and preliminary values are never scored.
- Cally makes forms for the person, within guardrails: symptom logs, wellbeing check-ins, questions for a visit and the like. It refuses screening or diagnostic instruments, scoring, triage or advice, consent forms and any question asking for an identifier. It needs Cally’s own consent; the request is screened for personal data before it’s sent; the model sees the request, never the person’s records; a daily limit on drafts.
Authoring (A2–A8). In the console, staff now draft, preview, publish and retire forms:
- Copy-on-write versions. Editing an active form creates a new draft version; activating it retires the old one in one transaction. A form that has responses can’t be deleted.
- Publishing needs step-up. Drafting doesn’t; changing what people fill in does.
- Import happens on the server. FHIR Questionnaires, LForms and our own JSON are parsed and checked on the server, can be previewed without writing anything, and are always saved as a draft, never made active.
- A question master: reusable, versioned questions inserted into a form as a copy, with a report of where a copy has drifted from its master.
- Cally-assisted authoring returns proposals only. The assistant has no write port. It returns a checked proposal with a question-by-question diff; the author accepts it by saving through the normal routes, with all their checks, locks and audit. In the earlier implementation the model’s output was applied to the editor in the browser; here a server checks it first.
All authoring routes stay off unless a setting enables them, for the same reason as staff sign-in.
7. Terminology, offline by default
@caladrius/terminology landed as a core, a server router, React pickers and optional adapters, and was mounted in the
API. The defaults are the point:
- Offline by default: a bundled set of common lab codes for India (a LOINC subset) only.
- The national terminology server is used only when enabled; international servers only for staff authoring, off by default.
- A configured server is used only when it’s enabled, the network setting is on, its host is on an allowlist and its secret is set. A test with a counting fake proves no gate leaks a call.
- One audit row per lookup (operation, adapter, outcome) and never the search words or codes.
8. Cally becomes a package, and gets a memory
Cally’s server side and browser side moved into @caladrius/cally and @caladrius/cally-react with no behaviour
change. The browser package has two entry points, and only the chat entry loads the chat framework; a test walks the
import graph and fails if the main entry ever reaches it, so builds without live Cally never download it.
Two features followed:
- Conversation history, encrypted per row and owned by one account (another account’s conversation is a 404). Saving needs an active Cally consent. Limits on size and count, 90-day retention, and withdrawing consent erases saved conversations in the same transaction. Nothing is kept in browser storage.
- The model’s reasoning never reaches the browser. Reasoning models stream their deliberation before the answer. It’s now dropped on the server, from the run stream, and again in the browser as defence in depth. Saved conversations hold only what the person and Cally actually said.
9. Three reviews, and every finding fixed
Three independent security reviews ran on the new code during the day: one on staff sign-in, one on forms authoring and terminology, one on Cally against both security and DPDPA (India’s data protection law). All three were reviewed and fixed the same day. The standard for each fix is the one I’d recommend to anyone: every fix comes with a regression test that fails on the old code, and the reviewer re-ran those tests against the old code to confirm they fail.
It’s an uncomfortable rule for the person fixing, and that’s the point. A test that passes on the old code proves nothing about the fix.
10. And the rest of the day
- Design-system parity. The shared UI packages of the Caladrius design system were compared file by file with AI Studio’s shipped copy: 85 files identical, 18 different. Each difference was classified as a fix good for every app (kept, and listed to offer back later) or PHR behaviour (now opt-in, with the default matching AI Studio). The one real bug: the PHR’s fluid root font size applied to every app, so a desktop app would have shown 23 px text. Now the PHR asks for it; other apps don’t get it.
- The ABDM package split into a generic core any Caladrius app can use and the PHR’s own flows (P1–P4, locker, UHI), moved with history kept. The boundary check gained a fifth rule: a generic package never imports a PHR one. The same PR made the schema export atomic: it now builds in a temporary folder and replaces the committed schemas only when the whole export succeeds, so an outage of the documentation server can no longer delete them.
- A rule changed, per NHA.
AGENTS.md §2.5now says the person’s own ABHA number and ABHA address are shown in full to that person: on their profile, ABHA card, banner and sign-in and linking screens. They’re still masked in logs, audit entries and error payloads, and never shown in full to anyone else. This is the rule Day 6’s masking followed; changing it was one documented decision. - Security CI now runs the full suite on every PR into
dev,qaandmain, and keeps long-lived reports only for evidence runs. - A Me page. The slide-in menu became a full-screen page with the profile card, ABHA details and grouped settings, and two screen audits fixed contrast and wrapping in long languages.
11. What I learned on Day 10
- Speed comes from the plan, safety from the template. Sixty-two merges were possible because every step had been written down on Day 9 with a “done when”, and every PR said which step it was, what class, which NHA cases and which checks.
- “No behaviour change” is a claim you prove, not one you make. Byte-identical moves where possible, ports where not, old import paths kept, the old tests passing unchanged.
- Put the dangerous capability where the model can’t reach it. The authoring assistant has no write port; the emergency account can’t be managed over the web; reasoning is dropped on the server. Each is a capability that simply doesn’t exist on the path an attacker or a confused model would take.
- Off by default is a release strategy. Staff sign-in and forms authoring landed on
devas 404s. They could be reviewed, tested and hardened in place, and switched on only when ready. - A landing PR is fine; skipping review is not. Batching merges saved hours of CI. It only worked because each PR in the batch had been reviewed on its own first.
Next, Day 11 (10 November): the console gets its roles and permissions screens, and the design system goes through a contrast audit.
The team behind Day 10
The PHR is built by a small Caladrius team working with AI agents:
- Giri: CEO; Cally taxonomy and intent framework
- Krishna: development, infrastructure and go-live
- Preetha: narrative engineer, personas
- Manish (me): CTO and CPO, enabling the Caladrius Health AI PHR and the AI Studio framework
Cally: taxonomy and intent (Giri)
Day 10 gave Cally its clearest list yet of what it may and may not do, which is the heart of Giri’s area. For forms, Cally may make symptom logs, wellbeing check-ins and questions for a visit. It refuses screening or diagnostic instruments, scoring, triage or advice, consent forms, and any question that asks for an identifier. The model sees the request, never the person’s records, and the request is screened for personal data first. On the authoring side, Cally’s help comes back as a proposal only: the assistant has no write port, so “change this form” is an intent it can answer but never carry out. Cally also moved into its own package unchanged, gained a conversation history that needs its own consent and is erased when consent is withdrawn, and stopped sending its reasoning to the browser.
Development, infrastructure and go-live (Krishna)
Sixty-two merges in a day is an infrastructure story, and that is Krishna’s area. Several agent sessions worked in
parallel on their own stacks, and about 45 reviewed PRs went in through one landing PR: one CI run and one security run
instead of dozens in sequence, with each PR still marked merged and reviewable. Security CI began running the full suite
on every PR into dev, qa and main. Staff sign-in and forms authoring landed off by default, every path a 404,
so nothing new was exposed on QA before it was ready. The console was built and tested, with a container file, but not
deployed: go-live for it is a later, separate step.
Narrative and personas (Preetha)
Two audiences got attention on Day 10. For staff, the console greets them through one shared sign-in page and looks like AI Studio’s desktop app, so moving between Caladrius products feels familiar. For patients, the forms are built for a thumb: 44 px option cards, Yes and No that still allow “not answered”, and a trend page that states the average plainly and never calls a change “better”. Values read from a lab report stay preliminary until the person has checked them. In Preetha’s area of story and wording, these are choices about tone as much as layout: the app reports, the person decides. The new Me page and two screen audits for long languages carried the same care.
Product and technology direction (Manish)
I approved the landing PR on one condition: it may only carry PRs that were already reviewed individually. Batching saves CI time; it never replaces review. I asked for the console to look exactly like AI Studio’s desktop app, through the copy-first rule. I changed one documented rule, per NHA: a person’s own ABHA number and address are shown to them in full, and stay masked everywhere else. And I held the security reviews to the standard I’d recommend to anyone: every fix comes with a regression test that fails on the old code.
Further reading
- Caladrius Health, the company behind the PHR
- The Caladrius platform brief: AI Studio, Cally, the Health Vault, the design system and security by design
- Caladrius Pulse, our blog, including the ABDM series (What is ABDM?) and the NHCX series (What is NHCX?)