core/docs/decisions/ADR-0044-medical-clinical-ethics-pack.md
Shay 283680f110 feat(adr-0044, adr-0045): domain ethics pack + long-context comparison
ADR-0044 — Medical / clinical ethics pack (worked-example domain pack).
Ships packs/ethics/medical_clinical_ethics_v1.json with six commitments
partitioned across all three remediation tiers:
  - refuse: no_dosing_recommendation, no_emergency_triage_authority
  - hedge:  defer_diagnosis_to_clinician, surface_evidence_grade
  - audit:  disclose_no_clinician_relationship, respect_patient_autonomy

Ratified end-to-end through scripts/ratify_ethics_pack.py (PACK_IDS
extended).  Production-mode load via load_ethics_pack succeeds.
ChatRuntime composition includes universal safety floor + every medical
commitment.  tests/test_medical_clinical_ethics_pack.py (8 tests) gates
file existence, sealed report, disjoint refusal/hedge lists, and
pack-swap visibility (default pack does NOT carry medical commitments).

ADR-0045 — Long-context recall: CORE vs transformer baselines.
Adds evals/long_context_cost/comparison_runner.py with a deterministic
needle-in-a-haystack measurement at N ∈ {100, 1_000, 10_000, 100_000}.
CORE recall = 100% at every tested N by exact cga_inner scan.

Paired with frozen citations of published transformer NIAH numbers in
evals/long_context_cost/baselines/transformer_long_context.json:
Claude 2.1 (200k, 50%), GPT-4 Turbo 128k (~71%), Gemini 1.5 Pro (99.7%),
NVIDIA RULER (varies).  Each citation carries source + url.

The two components measure different inputs (synthetic versors vs NL
needles) and are not directly comparable benchmark-for-benchmark.  The
comparison is at the architectural level — exact-scan recall vs
attention-based probabilistic recall.  Scope and limits documented in
the ADR.  tests/test_long_context_comparison.py (5 tests) gates schema,
CORE recall == 100%, and baseline citation presence.

CLI integration: two new demo targets with study-grade preambles.
  - core demo pack-measurements          (ADR-0043 — wired)
  - core demo long-context-comparison    (ADR-0045)
README + docs/PROGRESS.md cheatsheets updated.  docs/decisions/README.md
index extended with ADR-0044 + ADR-0045; pack-layer chain title now
"ADR-0027 through ADR-0045".

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 22:31:47 -07:00

100 lines
3.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ADR-0044 — Medical / clinical ethics pack (worked-example domain pack)
Status: Accepted (2026-05-17)
## Context
ADR-0033 shipped the third pack-layer sibling (`packs/ethics/`) with
exactly one ratified pack: `default_general_ethics_v1`. Through
ADR-0034 → ADR-0042, the per-commitment remediation tiers (audit /
hedge / refuse) and the full audit + telemetry stack landed. The
shape of the system is complete; the worked example is missing.
Robotics, healthcare, legal, and financial deployments are the
audience the pack-layer architecture exists to serve. Until at least
one domain pack ratifies end-to-end through the formation pipeline,
the deployment story is "you could do this" rather than "here is what
that looks like."
## Decision
Ship `packs/ethics/medical_clinical_ethics_v1.json` as the worked
example. Six commitments, partitioned across the three remediation
tiers:
| Commitment | Tier |
|---|---|
| `no_dosing_recommendation` | refuse |
| `no_emergency_triage_authority` | refuse |
| `defer_diagnosis_to_clinician` | hedge |
| `surface_evidence_grade` | hedge |
| `disclose_no_clinician_relationship` | audit |
| `respect_patient_autonomy` | audit |
The pack is ratified through `scripts/ratify_ethics_pack.py` (which
now drives both packs). A companion `medical_clinical_ethics_v1.mastery_report.json`
self-seal lands next to it. Production-mode loading verifies the
seal; dev override remains `CORE_ALLOW_UNRATIFIED_ETHICS=1`.
`tests/test_medical_clinical_ethics_pack.py` (8 tests) gates the
load-bearing claims:
1. The pack file + mastery report exist on disk and the sha is set.
2. `load_ethics_pack("medical_clinical_ethics_v1")` succeeds (sealed
report verifies).
3. The six commitments are present, with refusal/hedge lists disjoint
and subset of the commitment set.
4. `ChatRuntime(config=RuntimeConfig(ethics_pack="medical_clinical_ethics_v1"))`
composes the manifold with the safety floor *plus* every medical
commitment.
5. The default general pack does *not* carry the medical floor — pack
swap is visible and load-bearing.
## Consequences
**Positive.**
- Deployers now have a worked example to fork. The path is:
author JSON → `scripts/ratify_ethics_pack.py` → drop into config.
- The medical pack exercises all three remediation tiers; downstream
packs can mix-and-match without architectural friction.
- The composition test (`safety ethics ⊆ manifold`) lifts from
abstract to concrete: every safety boundary plus every medical
commitment appears in `identity_manifold.boundary_ids`.
**Trade-offs.**
- The pack ships with general clinical-deployment commitments; it is
*not* a substitute for a clinician-reviewed deployment policy. The
pack's description states this plainly.
- Six commitments is a starter set, not a comprehensive medical-ethics
taxonomy. Adding commitments later requires re-ratification (the
script is idempotent).
- The `domain` field is constrained to the registry in
`packs/ethics/loader.py` (`general`, `medical`, `legal`, `financial`,
`robotics`, `custom`). Adding a new domain string requires
extending the loader's `_validate_domain` allowlist.
## How to verify
```bash
PYTHONPATH=. python3 scripts/ratify_ethics_pack.py
PYTHONPATH=. python3 -m pytest tests/test_medical_clinical_ethics_pack.py -q
```
## Where it lives
- `packs/ethics/medical_clinical_ethics_v1.json`
- `packs/ethics/medical_clinical_ethics_v1.mastery_report.json`
- `scripts/ratify_ethics_pack.py` (PACK_IDS extended)
- `tests/test_medical_clinical_ethics_pack.py`
## Related
- [ADR-0033](ADR-0033-ethics-pack.md) — ethics pack architecture.
- [ADR-0037](ADR-0037-per-predicate-ethics-refusal.md) — per-commitment
refusal opt-in (used by `refusal_commitments`).
- [ADR-0038](ADR-0038-hedge-injection.md) — hedge injection (used by
`hedge_commitments`).
- [ADR-0043](ADR-0043-pack-measurements-phase2.md) — pack measurements
(the medical pack auto-extends future pack-aware runs).