§01
Overview
- What it is:
@regain/hermes(hermes_version: 2.0.0) — a reference implementation of the eponymous protocol: standardized messages (supervision_request,supervision_response,control_command_v2,control_command_response,audit_event,clinician_feedback,bias_detection), their types/guards/JSON Schema, plus runtime epistemology utilities (HTV composite, calibrated uncertainty, evidence-grade hierarchy, v1→v2 Control-channel migration). Named after Hermes — the messenger between worlds; here, between the clinical-AI agent and the supervision system. The README positions it as the "industry-standard protocol for safe, auditable clinical AI" with a forthcoming certification program (Compatible / Certified / Certified Clinical). - Type / status / role: library (npm package, ESM+CJS,
dist/+src/with conditional exports under Bun) · active / Public Alpha · lead — the user is the primary author (14 of 24 commits = 58%); the US healthtech platform team: Anton Kim <anton@US healthtech platform> (9), Harsh Manwani (1). All phases 1–5 and the npm publication are the user's. - Activity period: 2026-01-25 → 2026-02-13 — a ~3-week sprint "from zero to npm v1.0.x → v2.0.0", live on the registry. Full OSS scaffolding (LICENSE Apache 2.0, README, VISION, GOVERNANCE, CONTRIBUTING, CODE_OF_CONDUCT, TRADEMARK, CERTIFICATION, CHANGELOG, CI badges).
§02
Stack
- Languages: TypeScript 5.7 (strict, ESM-first), JSON Schema (draft-2020-12).
- Frameworks/libraries: Bun (test runner, dev/watch, dual ESM+CJS build via
bun buildwith--format esmand--format cjs); AJV 8 + ajv-formats for runtime schema validation (new Ajv({ allErrors: true, strict: false })for draft-2020-12 compatibility); Biome 1.9 (lint/format);tsc --emitDeclarationOnlyfor declarations; a lefthook-style.githooks/pre-commit(preparerunsgit config core.hooksPath). Conditionalexportsinpackage.json—bun → src/*.ts,import → dist/*.js,require → dist/*.cjs(zero-build DX in Bun projects + classic Node distribution). - Infra/deploy: GitHub Actions CI (
ci.ymlbadge green); published to npm underaccess: publiconregistry.npmjs.org;fix(ci): publish only on version tags(185de71) — releases only on git tags. Homepage/issue tracker —github.com/US healthtech platform/hermes. - Data: no database (this is a library); it does describe audit-event formats with PHI minimization and
AuditRedactionBasefor downstream storage. - Notable tooling: git worktree (hermes-2, hermes-3) used for parallel development of Phases 2 and 3 on the same
mainbranch — a non-trivial workflow initiated by the user (see AI sessions). A trademark bundle (US healthtech platform Hermes™, Popper™, Deutsch™, Hard2Vary™).
§03
What was shipped
24 commits, 5 clearly delineated phases → publication → v2:
- Phase 1 — Core Types (
762a1ed+4361/-0, 28 files): branded types, baseTraceContext/IsoDateTime/HermesVersion/SubjectRef/ProposedInterventionKind/Mode/SupervisionDecision, type guards. - Phase 2 — Supervision Contract (
5927e52+2876/-72, in worktreehermes-2):SupervisionRequest/Response,InputRisk(phi_detected, prompt_injection_suspected),PriorOverride,ProposedIntervention,HealthStateSnapshotRef, cross-domain conflicts (CrossDomainConflict,ConflictEvaluation),ConfidenceLevel/OverrideApplicability/RationaleCategory. - Phase 3 — Epistemology Types (
bbdca0c+1959, in worktreehermes-3):ClaimType+ risk profiles (diagnosis/treatment_rec/escalation→requiresPopper: true),EvidenceGrade(a 10-level hierarchy fromsystematic_reviewdown tocalculated),HTVScore(Hard2Vary 4D: interdependence/specificity/parsimony/falsifiability),UncertaintyCalibration+UncertaintyDriver. The two worktrees are merged (7eaa0d6, PR #1, PR #2). - Phase 4 — Clinical, Imaging & Bias Detection (
b963693+2642):imaging.ts(medical imaging),bias.ts(BiasDetectionType:demographic_override_disparity/intervention_type_bias/clinician_specialty_bias— FDA post-market AI/ML surveillance),feedback.ts(clinician feedback with rationale categories),disclosure.ts. - Phase 5 — Testing, Validation & CI (
6f4faa3+3375): an AJV validator on draft-2020-12, a 1405-line JSON Schema (hermes-message.schema.json), 11 fixture files (sup-request/response, audit-event, clinician-feedback, evidence, htv-score), 41 conformance tests, GitHub Actions,.githooks/pre-commit.package.jsonexports gained./schemaand./fixturessubmodules. - npm publication:
a977689 chore: prepare for npm publication v1.0.0,b9c3791 chore: remove internal docs and spec references(-2977 lines, cleanup of private PRD/specs before the public release — a textbook pre-publish gate), releases1.0.0 → 1.0.1 → 1.0.2 → 1.0.3,a6b9c9c chore: change license from MIT to Apache 2.0(the right choice for clinical software with a trademark strategy). - **A SAL-* feature pack landed immediately after publish:**
c6df831developer docs (docs/DEVELOPER-GUIDE.md,API-REFERENCE.md,EPISTEMOLOGY-GUIDE.md,TESTING.md),bc3d701 feat(SAL-508): auto-refutation types for Popperian prediction failure,a964697ControlCommandV2 + Operational Settings Catalog (621 lines of types, 176 lines of tests),8d082abv1→v2 builders + migration utilities,117cc28AJV schemas + conformance fixtures for Control v2,d017a86 feat: add Control v2 exports, comprehensive tests, and bump to v2.0.0— a major bump in 3 weeks. - Volume: 24 commits; 10,901 LOC TypeScript + 1,405 LOC JSON Schema; fully test-covered (
*.test.tsnext to each module).
§04
Technical challenges
By code / diffs:
- Popper/Deutsch epistemology as code (
src/types/epistemology.ts,src/utils/htv.ts,src/utils/uncertainty.ts): the protocol codifies the philosophy of science — every clinical claim is classified (observation/diagnosis/treatment_rec/escalation...), and high-risk types are required to carryfalsification_criteriainadvocate_clinicalmode. The HTV composite (Hard2Vary, after Deutsch): a weighted sum of interdependence × specificity × parsimony × falsifiability; clamped to [0,1] with range validation. Calibrated uncertainty (computeUncertainty): an additive model over 5 drivers (evidence_grade 0–0.3, htv_score 0–0.3, data_quality 0–0.2, debate_consensus 0–0.1, staleness 0–0.1) →low | medium | high. → Demonstrates turning academic epistemology into a working API. - JSON Schema draft-2020-12 + AJV strict-relax (
src/schema/validator.ts):new Ajv({ strict: false })for draft-2020-12 compatibility; errors are mapped into{path, message}[]; a customHermesValidationErroraggregates the message; a pair of APIs —validateHermesMessage(returns),parseHermesMessage(throws),isValidHermesMessage(type guard). → Sound API design for a library: three runtime contracts on top of one validation. - Idiomatic TypeScript design: branded types (
src/types/branded.ts), readonly-everywhere (DTO-only),as constarrays for runtime enum validation, conditionalexportsfor Bun (zero-build) and Node (ESM+CJS),sideEffects: falsefor tree-shaking. The Phase 1 diff (+4361/-0) lays the foundation right away with guards and tests. - Control Channel v2 with migration (
src/types/control-v2.ts239 lines,src/utils/control-migration.ts192): the move from stringly-typed v1 to fully typed (SettingValue = boolean|string|number|string[]), batched commands, priority-aware (ROUTINE / URGENT / EMERGENCY), idempotency_key, operational modes (NORMAL / RESTRICTED / SAFE_MODE / MAINTENANCE), full state snapshots in the ack. Two-waymapV1ToV2/mapV2SettingToV1with autonomy mapping ('0'→'passive', ...) and a set of removed v1 keys (disable_domain,policy_pack). → A complex but disciplined protocol evolution; behind the SAL-* tickets sits real legacy. - Bias detection as a first-class message type (
src/types/bias.ts302 lines):BiasDetectionType('demographic_override_disparity' et al.),BiasSeverity,BiasAnalysisPeriod,BiasDimensionType— aligned with FDA AI/ML post-market surveillance guidance. → A compliance mindset codified, not bolted on. - A git-worktree workflow for parallel phases (see AI sessions): the user themselves initiated
git worktree add hermes-3for Phase 3, in parallel withhermes-2for Phase 2, merging via PRs (#1, #2) into main. → Mature git command, atypical for most seniors. - Pre-publish hygiene: the
b9c3791 chore: remove internal docs and spec referencescommit deleted 2,977 lines of internal PRD/spec material before the public release — a thoughtful gate to keep Healthcare platform-specific details out of the npm tarball. That is commercial-OSS-strategy thinking.
§05
AI-assisted development
- Sessions found: 5 (
-Users-macbookpro-development-hermes/, 133 messages total). Additional sessions inside thehermes-2/3worktrees are not registered as separate CC projects — they ran through the mainhermesdirectory. - What was done with AI (per the index's
firstPrompt/summary): 1.cf51ad0a— "Study best practices for npm package development with bun.js... create the scaffold" (10 msgs) — package bootstrap. 2.7853e944— "@docs/PLAN-01-phase-1-core.md translate all tasks... into a task list" (31 msgs) — Phase 1 (Core Types). 3.eebcdb59— "Create git worktree hermes-2 and let's switch to working in it" (41 msgs) — Phase 2-3 in the worktree. 4.b7a92f59— "Create git worktree hermes-3 and let's switch to working in it" (27 msgs) — Phase 3 (Epistemology) in parallel. 5.0dc63c85— "@docs/PLAN-04-phase-4-clinical.md break down the tasks... grounded in ...new_unified_health_app/docs/0..." (24 msgs) — Phase 4 (Clinical/Imaging/Bias) with cross-repo context. - AI workflow patterns: plan-driven (PLAN-XX-phase-X-*.md as a contract), task lists are translated by the agent from markdown into TodoWrite, parallel phase-agents inside git worktrees (one of the headline AI-native moves — multiple work streams in a single repo with no conflicts), cross-repo grounding (Phase 4 leans on specs from
new_unified_health_app— the same healthcare monorepo). All 5 phases were executed and shipped in ~3 weeks at high velocity while preserving test coverage and the OSS scaffolding.
§06
Achievements & metrics
- The @regain/hermes npm package in the public npmjs.org registry (Apache 2.0, public alpha), v2.0.0; GitHub
US healthtech platform/hermeswith a green CI badge. - 10,901 LOC TypeScript + 1,405 LOC JSON Schema; 41 conformance tests in Phase 5; per-module tests (
*.test.tsnext to every type / utility). - 5 phases with up-front architectural planning (PLAN-01..05) shipped in ~3 weeks (24 commits, 14 authored by the user).
- The user is the primary author of the protocol that ties
popper(#62/72 user commits, infra/governance),deutsch(reasoning engine),healthcare-crm(product CRM), andlab-processor(Temporal pipeline) into a single US healthtech platform clinical-AI platform.