Repository navigation
ideation: split treatment-options-engine — neutral governed-derived-model delta stays; clinical half moved to MedxFactory (ruled 2026-09-07) - #772
Conversation
…odel delta stays; clinical half moved to MedxFactory (ruled 2026-09-07) The staged fragment declared `Repository context: SPLIT, deliberately` and then interleaved both halves in one 696-line file. Brett (convener) ruled 2026-09-07 (ideation-split sheet Q2[A]) that the split be made editorially: the neutral `governed-derived-model` delta stays here, the realized clinical corpus/engine content moves to MedxSoft/MedxFactory ideation/staging/treatment-plan-generation/treatment-options-engine-clinical.md. Kept here, verbatim: `## Why`, `### The neutral half — a MODIFIED governed-derived-model`, the three `xspec:candidate target=governed-derived-model` fenced blocks, the neutral `Impact` bullets, idea note 7, the neutral `Related work` entries, and the NEUTRAL half of `Exit`. Moved: the corpus recon, claims 3/4/7, `### The MedxFactory half`, `Build order`, idea notes 1-6, conflicts 1 and 3-6, all ten open questions, the five MedxFactory `Related work` entries, and the MEDX half of `Exit`. Both sides: claims 1/2/5/6, the `Impact` recommendation-object bullet and conflict 2 keep the neutral RULE here and the full clinical illustration there; the `Impact` "Affected code" bullet is split by repository. No real-patient clinical scenario language remains in this file. Lane: provenance-autonomous-merge
There was a problem hiding this comment.
Hi @brettheap! 👋
Your private repo does not have access to Sourcery.
Please upgrade to continue using Sourcery ✨
There was a problem hiding this comment.
🟡 Changes recommended
The “Claims” section currently uses non-sequential ordered-list markers that won’t render with visible gaps on GitHub, and the new cross-repo pointers should be clickable links for navigability and consistency.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR applies an editorial split to the staged ideation doc for “treatment-options-engine”, leaving openxFactory with only the neutral governed-derived-model delta (recommendation member role + evidence-floor + editorial weights) and replacing the clinical corpus/engine material with pointers to its new home in MedxSoft/MedxFactory.
Changes:
- Re-authors the header (
Summary:,Topics:,Repository context:) to describe only the neutralgoverned-derived-modeldelta owned by openxFactory. - Removes (from this repo) the clinical corpus verification, build order, conflicts, open questions, and related clinical content; adds a “Moved to MedxFactory” map section.
- Updates the impact/related-work/exit narrative to reflect the split and retain only neutral governance rules in this file.
File summaries
| File | Description |
|---|---|
| ideation/staging/treatment-options-engine/treatment-options-engine.md | Splits the staged topic doc so openxFactory retains only the neutral governed-derived-model delta and links out to the moved clinical half in MedxSoft/MedxFactory. |
Review details
Suppressed comments (1)
ideation/staging/treatment-options-engine/treatment-options-engine.md:166
- Same as above: consider making the referenced MedxSoft/MedxFactory path a clickable Markdown link so readers can jump directly to the moved content.
Clinical corpus and engine content moved 2026-09-07 to MedxSoft/MedxFactory
`ideation/staging/treatment-plan-generation/treatment-options-engine-clinical.md`
(see that repo). It was never fenced as candidate prose here: those
- Files reviewed: 1/1 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| 1. **We are building it.** This is a build decision, not an exploration. The | ||
| six steps above are the capability description, not a menu. | ||
| 2. **The engine PROPOSES; a clinician DECIDES.** The output is a ranked list of | ||
| options with cited reasons. Nothing about it selects, orders, prescribes, or | ||
| cycles a regimen. The Omnigent constitutional `execute_final_action: false` | ||
| and `access_secrets: false` hold unchanged, and the treatment-plan gate stays | ||
| human-reviewed. This is the governance boundary of the whole topic and it is | ||
| not a dial. | ||
| 3. **The rebalance trigger is a chart OBSERVATION, never a timer and never an | ||
| automatic rerun.** "The patient is not responding" is a charted clinical | ||
| fact that a human enters; the engine reruns because that fact appeared, not | ||
| because weeks elapsed. A rebalance that fires on its own would be the system | ||
| cycling regimens, which claim 2 forbids. | ||
| 4. **Every line of every output cites a root-truth record.** The filter chain is | ||
| an argument, and each step of the argument names the accepted record that | ||
| licenses it. A step with nothing to cite does not run silently — it is | ||
| surfaced as a gap. | ||
| 5. **On-label first; off-label is a separate MODE, not a widened default.** | ||
| Off-label results carry their evidence grade prominently and are structurally | ||
| un-mixable with on-label results. One list containing both, sorted together, | ||
| is the failure this claim exists to prevent. | ||
| 6. **The interaction-severity weights are EDITORIAL POLICY, governed | ||
| separately.** Labels state interactions but do not grade them on any common | ||
| scale, and almost never state positive ones. Severity numbers and combination | ||
| weights are therefore our judgement, versioned, human-reviewed, and VISIBLE | ||
| in every output that used them — never buried in a scoring function. | ||
| 7. **The backfill fetches nothing new.** Adverse-reaction (SPL §6) and | ||
| mechanism-of-action (SPL §12.1) extraction runs over the custody XMLs already | ||
| pinned by digest under `var/root-truth-sources/`. Same recipe, same sources, | ||
| same review gate — new sections of documents we already hold. | ||
|
|
||
| ## Current state, verified against the live corpus (2026-08-26) | ||
|
|
||
| Added-by: Claude Opus 5 (session, Brett's direction) · 2026-08-26 | ||
|
|
||
| Measured in `/home/brett/projects/MedxFactory-worktrees/corpus-main` on | ||
| 2026-08-26. Several of these correct the shape the capability was described | ||
| with, and the corrections change what the deltas have to be. | ||
|
|
||
| - **6,506 records over 1,302 distinct `medication_*` concepts**, with 1,298 | ||
| custody SPL XMLs (261 MB) under `var/root-truth-sources/`. Against the | ||
| prescribable RxNorm ingredient set (5,803 `medication_*` rows), the corpus | ||
| covers about 22% of ingredients. | ||
| - **The claim-type enum is CLOSED AT TEN**, in | ||
| `scripts/root_truth/validate_root_truth.py:24-25`: `indication`, `dosing`, | ||
| `contraindication`, `interaction`, `monitoring`, `target`, | ||
| `biomarker_association`, `efficacy`, `adverse_effect`, | ||
| `diagnostic_criterion`. **`adverse_effect` ALREADY EXISTS** (3 records), so | ||
| the adverse-reaction work is a BACKFILL under an existing member, not a new | ||
| claim type. `mechanism_of_action` does NOT exist; the nearest member is | ||
| `target` (1 record), and whether MoA is `target` or an eleventh member is | ||
| Q7 below — an eleventh member breaks a deliberately closed enum. | ||
| - **Claim-type distribution is five fat types and five thin ones**: monitoring | ||
| 1,301 / indication 1,300 / interaction 1,299 / dosing 1,299 / | ||
| contraindication 1,298, then adverse_effect 3, efficacy 2, | ||
| biomarker_association 2, target 1, diagnostic_criterion 1. One record per | ||
| claim type per drug family, essentially. | ||
| - **The drug-to-condition edge does not exist.** Of 6,510 grounded pairs, | ||
| 6,505 are `medication_*` and exactly FIVE are `condition_*` (0.08%). | ||
| Indications are one prose blob per family — `RT-SIMVASTATIN-IND-0001` carries | ||
| six distinct indication limbs in a single `claim` string. "List all drugs | ||
| indicated for condition X" is therefore **not answerable from the corpus at | ||
| all** today; it is not slow or partial, it is absent. This is gap 1 and it is | ||
| the load-bearing one. | ||
| - **The condition namespace already has TWO id conventions**, and they | ||
| collide. The generated ICD-10 table (`icd10cm-fy2026.json`, 98,184 rows) | ||
| emits `condition_a00_0`-style ids keyed off the code; the curated | ||
| `examples/terminology/tables/conditions.yaml` emits readable slugs like | ||
| `condition_essential_hypertension`; and the generated manifest states that | ||
| curated keys are SKIPPED at generation time, so curated wins. The five | ||
| condition pairs in the corpus contain both conventions | ||
| (`condition_c74_0` and `condition_essential_hypertension`). A structured | ||
| `indicated_for: [condition_*]` field must decide which convention it writes | ||
| before it writes a single row (Q4). | ||
| - **The evidence-grade vocabulary is already multi-valued**, contrary to the | ||
| "everything is `regulatory_label`" shorthand: 6,499 `regulatory_label`, | ||
| 3 `retrospective_cohort_study`, 2 `clinical_practice_guideline`, | ||
| 2 `public_health_guidance`. The off-label mode's floor-lowering therefore | ||
| has grades to lower TO — the vocabulary exists, it is just barely populated. | ||
| - **There is no drug-class field anywhere** in the record schema, the templates, | ||
| or the terminology tables. | ||
| - **`medx.domain.policy.plan_authoring_models` is at version `1`**, pinning | ||
| `claude-fable-5` for `generation`, `critique`, and — additively, per | ||
| `add-root-truth-interim-corpus` — `claim_extraction`. Its own position | ||
| `policy-revision-is-governed` says the admissible set changes "only through an | ||
| OpenSpec change; no runtime, session, or operator override widens the pins". | ||
| So re-pinning extraction to a cheaper tier for the backfill is a **policy | ||
| version bump through OpenSpec**, not a runtime switch. Recommended anyway on | ||
| cost — see the build order. | ||
| - **`treatment-plan-generation` is already promoted in MedxFactory** with nine | ||
| requirements, including "Charted diagnoses are the only plan entry points", | ||
| "Every clinical claim cites patient evidence from the pinned run", "Every | ||
| rationale statement declares its knowledge basis", "Generation runs as a | ||
| governed job on the closed worker plane", "Consent is checked at job start | ||
| with a distinct purpose", and "Admissible authoring models are pinned by | ||
| policy". **The engine is not greenfield** — most of its governance envelope | ||
| already exists (Q8). | ||
| - **MedxFactory's `governed-derived-model` conformance declares exactly ONE | ||
| family**, `dream_simulation`, at tier `governed`, with dials | ||
| `identity: synthetic`, `scope: domain`, `truth_store: patient_truth_model`, | ||
| `promoting_authority: clinician_of_record`, `person_modeling: | ||
| synthetic_only`. A treatment-options family is a SECOND family whose dials | ||
| differ on the two that matter most: it is `scope: subject` and it models a | ||
| real, identified patient (Q9). | ||
| six-step capability description is the capability description, not a menu — | ||
| the six steps are clinical and moved with the MedxFactory half. | ||
| 2. **A recommendation member PROPOSES; a named human DECIDES.** The output is a | ||
| ranked list of options with cited reasons. Nothing about it selects, orders, |
| Clinical corpus and engine content moved 2026-09-07 to MedxSoft/MedxFactory | ||
| `ideation/staging/treatment-plan-generation/treatment-options-engine-clinical.md` | ||
| (see that repo). What left, in the original's own section order: the |
Lane: provenance-autonomous-merge
The ruling
Brett (convener) ruled 2026-09-07, ideation-split sheet Q2[A]: EDITORIALLY
SPLIT
ideation/staging/treatment-options-engine/treatment-options-engine.md.The file self-declared
Repository context: SPLIT, deliberately— openxFactoryowns the neutral
governed-derived-modeldelta, MedxFactory owns the realizedclinical corpus/engine — and then interleaved both halves across 696 lines. The
neutral remainder STAYS here; the clinical half moves to MedxSoft/MedxFactory
ideation/staging/treatment-plan-generation/(an existing topic there),cross-linked both ways. Text was moved, not rewritten; nothing was invented.
Companion PR (the receiving side): https://github.com/MedxSoft/MedxFactory/pull/27
Heading → destination
64aad02e)Staged:prefix dropped — it is a supporting fragment, not the topic's primary doc)Status:/Kind:(3–4)Summary:(5–15)Topics:(16–18)Repository context:(19–29)Staging ID:(30)Staging ID:)Captured:(31)Source:(32–41)Target capabilities:neutral clause (42–46a)Target capabilities:Medx-targets clause (46b–51)Target capabilities:## Last proposal attempt (round-trip provenance)(53–59)## Claimsintro (63–65)## Current state, verified against the live corpus (2026-08-26)(98–170)## Whyincl.xspec:candidatefence (172–206)## What changesheading (208)### The neutral half — a MODIFIED governed-derived-modelincl. fence (210–240)### The MedxFactory half — corpus, tables, engineheading (242)### The MedxFactory halfbody (247–288)## Build order(290–308)## Impactheading +xspec:candidatefence (310, 312, 333)xspec:markers)## Idea notes (pre-document, non-documented)heading (335)## Conflictsheading (384)## Open questionsheading (430)## Related workheading +Added-by:(652, 654)governed-derived-model(656–658)omnigent-domain-overlay(670–672)workflow-gate-contract(673–674)## Exitheading + intro (676, 678)Both-sides paragraphs (neutral rule here, full clinical illustration there)
Eight paragraphs are genuinely both a neutral rule and a clinical illustration.
In each, the RULE (with the example reduced to one generic line) stays in
openxFactory and the FULL clinical illustration goes to MedxFactory verbatim.
capability description, not a menu." openxFactory keeps the build decision;
the six clinical steps moved with the
Source:block.keeps it as "A recommendation member PROPOSES; a named human DECIDES", with
"selects, orders, prescribes, or cycles a regimen" generalized to "selects,
orders, executes, or repeats an external action" and "the treatment-plan gate"
to "the domain's own decision gate". The constitutional
execute_final_action: false/access_secrets: falsesentence is unchanged.openxFactory keeps "Floor-conforming first; a relaxed floor is a separate MODE",
same structure, same closing sentence.
openxFactory keeps "Ranking weights the truth store does not supply are
EDITORIAL POLICY", with the one-line generic example "A truth store states
facts but rarely grades them on a common scale" replacing the SPL-label
sentence. The versioned/human-reviewed/VISIBLE clause is unchanged.
## Impact— "Affected code" bullet (320–323) — SPLIT rather thanduplicated: openxFactory keeps
openxFactory/scripts/validate-derived-models.py; MedxFactory keepsmodels/derived-model-conformance.yaml,scripts/root_truth/andscripts/terminology/. Each side names the other's half in one clause.## Impact— recommendation-object bullet (329–332) — the flaggedreal-patient sentence ("The dream/simulation family is synthetic and internal;
this one is about a real patient, in front of a prescriber"). openxFactory
keeps the rule with the one-line generic example "A synthetic, internal family
is one thing; a family whose ranked output a named human acts on is another",
and "a clinician reads" → "a human reads". The closing
theoretical→operative-protection sentence is unchanged.
## Conflicts— conflict 2 (393–401) — "Editorial weights versus thecorpus's own no-invented-facts doctrine." openxFactory keeps it as "versus a
truth store's own…", with "Every root-truth record cites a source digest" →
"Where every record in a truth store cites a source", "A severity table" →
"A weights table", "our judgement" → "judgement", and "the ordering of clinical
options" → "the ordering of the options". The reconciliation-not-absence-of-
tension sentence is unchanged.
## Related work—workflow-gate-contractbullet (673–674) —genericized in place on the openxFactory side only (not duplicated):
"where the clinician's decision is recorded; the engine's output arrives at
this gate" → "where the human decision is recorded; a recommendation output
arrives at this gate". The neutral doc's own
## Impactalready words thesame fact as "
workflow-gate-contractis where the human decision lives".Line arithmetic
Source measured at
opensoft/openxFactory@64aad02eideation/staging/treatment-options-engine/treatment-options-engine.md=696 lines (unchanged between
64aad02eand today'sorigin/main).The 7 lines that appear verbatim on both sides are structural, not content:
the
## Idea notes (pre-document, non-documented),## Conflicts,## Open questions,## Related workand## Exitheadings, theAdded-by: Claude Opus 5 (session, Brett's direction) · 2026-08-26attribution line under
## Related work, and the## Exitintro line"Two changes, sequenced, neutral first."
The 61 not carried byte-for-byte are 27 blank separators (re-supplied
literally on both sides) plus 34 non-blank lines that were re-authored per
side: the H1 (1),
Status:/Kind:(3–4, re-emitted identically as literalson both sides),
Repository context:…Captured:(19–31), the Medx-targetstail of
Target capabilities:(46–51), the## Claimsheading (61,re-emitted identically on both sides), the "Not fenced as candidate prose"
meta (244–245), the
Impact"Affected code" bullet (320–323), and theomnigent-domain-overlay/workflow-gate-contractRelated workpair(670–674).
Output totals. openxFactory
treatment-options-engine.md= 253 lines(115 verbatim + 138 authored: the rewritten header, the
## Moved to MedxFactorymap, seven inline pointers, four neutralized claims, oneneutralized
Impactbullet, one neutralized conflict, and blanks).MedxFactory
treatment-options-engine-clinical.md= 598 lines(527 verbatim + 71 authored: the header, the
## Split provenancesection,the Medx-side
Impact"Affected code" bullet, the back-pointerRelated workbullet, one added
Exitsentence, and blanks). MedxFactorytreatment-plan-generation/topic.mdgains 9 lines (a pointer in## Relationships).696 → 253 + 598 = 851, i.e. +155, entirely: the second header block
(one file's header became two), the two pointer maps, the 7 duplicated
structural headings, and the eight both-sides paragraphs held as neutral rule
on one side + clinical illustration on the other.
Validation
OPENSPEC_TELEMETRY=0 openspec validate --all --strict→ 98 passed, 1failed (99 items) — the documented baseline. The single failure is
change/disposition-codexfactory-declared-renames, pre-existing onorigin/mainand untouched by this PR (noopenspec/path is modified).scripts/doc-health.py --single-repo .run for the six families this changecould plausibly disturb —
staged-topic-template,tag-hygiene,status-validity,proposal-origin,location-conformance,staged-candidate-aging. No finding namestreatment-options-engineinany of them. In particular the three
<!-- xspec:candidate target=governed-derived-model -->fences all stillresolve (tag-hygiene clean for this file), and the fragment still satisfies
the staged-topic outline template (it keeps
## Idea notes,## Conflictsand
## Open questionssections). Every finding those families do emit is apre-existing warning/error against a different file.
from the moved half → 0 hits each:
in front of a prescriber,the patient is not responding,adverse reaction,SPL §6,mechanism-of-action similarity. A broader sweep is also 0 forprescriber,clinician,drug,medication,off-label,adverse,SPL,RxNorm,ICD-10,MED-RT,RxClass,rebalance,indicated,contraindicat,interaction,dosing,regimen,prescrib,chart.The only surviving hits for
patient(1) andclinical(19) are thecapability names
one-patient-integration-contracts/patient-consent-instrumentinside the moved-note, the pointer prose "theclinical half", and the original neutral sentence "a clinical, financial, or
operational domain most wants to derive". No real-patient clinical
scenario language remains.
Rule 6
No
openspec/changes/path is touched — Rule 6 (landing window) does notapply. Only
ideation/staging/moves here.Follow-ups this PR deliberately does NOT make
Per the task's instruction,
ideation/staging/INDEX.mdandideation/cross-reference.yamlare left alone (the later removal PR re-runsthe bootstrap). What will need the pointer update:
ideation/staging/INDEX.mdline 77 — the single-row summary fortreatment-options-engine(Delta column, "Files: 1", and the whole narrativecell, which still describes the corpus recon, the ten open questions and the
Medx build order as living here).
ideation/staging/INDEX.mdlines 2128–2210 — the## treatment-options-enginedetail section:
Repository context,Source,Claim,Corpus recon 2026-08-26,Build order, theFiles:list (the one-line description oftreatment-options-engine.mdstill says "10 open questions… the Medx-sidedelta in unfenced prose… a build-order section, 6 idea notes, 6 conflicts"),
and the
Open questions (10, all open)block.ideation/cross-reference.yaml— currently carries no entry for this topicat all (grep for
treatmentreturns nothing in the.yaml, the.md, orrouting-index.yaml), so the bootstrap will seed it fresh from the newheaders. Nothing to correct, only to generate.
docs/notebook-projection-migration-evidence-2026-08-24.md:274records thetopic as
MISSING [staged] openxFactory: treatment-options-engine— a datedevidence record, correctly left as-is.
Judgement calls
Staging ID:are unchanged (treatment-options-engine,openxFactory:staging:treatment-options-engine). The inventory's own questionasked whether the neutral remainder should be renamed once the Medx half
leaves; the ruling as given did not answer it, and a rename would break the
durable Staging ID and the INDEX anchor. Left for the convener.
and 6 under their original numbers; 3, 4 and 7 are absent. Renumbering would
break the by-number cross-references that survive on both sides (e.g. this
file's
Related workstill says "what makes claim 2 enforced"). The gap isexplained in the
## Claimsintro.Summary:,Topics:andSource:are re-authored on the openxFactoryside — the originals are wholly clinical and moved verbatim. The neutral
replacements are assembled from this document's own neutral prose (
## Whyand
### The neutral half); Brett's "we will build this" quote is preserved.xspec:candidatefences are dropped in the MedxFactory copy —MedxFactory carries no
xspec:markers anywhere (grep→ 0), and the targetis an openxFactory capability.