Build governed clinical protocol modules.

Define deterministic clinical logic, model-role boundaries, source references, eval suites, and release gates in version-controlled files. GitMed helps product, engineering, clinical, and quality teams move protocol changes through validation, review, release, trace, and evidence export.

developer lifecycle review gated
$ gitmed init adult_sinusitis --template diagnostic-triage
created protocols/adult_sinusitis/
created protocols/adult_sinusitis/protocol.yaml
created protocols/adult_sinusitis/evals/regression.yaml

$ gitmed validate protocols/adult_sinusitis
schema: pass
source_anchors: 18/18
required_facts: pass

$ gitmed plan \
  --from adult_sinusitis@0.1.0 \
  --to protocols/adult_sinusitis
clinical_delta: moderate
changed_dispositions: 2
required_signoffs: clinical, safety

$ gitmed release request protocols/adult_sinusitis --version 0.2.0
release: adult_sinusitis@0.2.0
status: awaiting_clinical_review

Create, validate, plan, and request review.

GitMed gives medical AI teams a reproducible workflow for deterministic protocol modules. Authors define the module in structured files, validate the clinical and technical requirements, inspect the behavior diff, and route the release for the right clinical, safety, and quality review.

commands local
$ gitmed init adult_sinusitis --template diagnostic-triage
$ gitmed validate protocols/adult_sinusitis
$ gitmed test protocols/adult_sinusitis --suite regression
$ gitmed plan \
  --from adult_sinusitis@0.1.0 \
  --to protocols/adult_sinusitis \
  --out .gitmed/plans/adult_sinusitis-0.2.0.json
$ gitmed release request protocols/adult_sinusitis \
  --version 0.2.0 \
  --plan .gitmed/plans/adult_sinusitis-0.2.0.json
workspace generated
protocols/adult_sinusitis/
  protocol.yaml
  facts.yaml
  rules.yaml
  sources.yaml
  contracts/
    intake.extractor.yaml
  evals/
    red_flags.yaml
    regression.yaml
    contracts/
      intake_extractor.yaml
    security/
      prompt_injection.yaml
  release.yaml

Add GitMed to the repository that owns the clinical workflow.

GitMed is designed to run in the same version-controlled repo as the protocol modules, eval suites, model contracts, and release metadata. Local commands can run without PHI; hosted validation can be enabled when teams want Auddax-managed registries, review queues, and evidence exports.

setup workspace
$ npm install --save-dev @auddax/gitmed
$ npx gitmed auth login --org northstar-health
$ npx gitmed workspace init \
  --protocol-dir protocols \
  --build-dir .gitmed/build

created .gitmed/config.yaml
created protocols/
created .gitmed/plans/
.gitmed/config.yaml repo local
schema: gitmed.workspace/v0.1
organization: northstar-health
protocol_dir: protocols
build_dir: .gitmed/build
validation:
  mode: hosted
  phi_policy: deidentified_only
registry:
  environment: sandbox

Facts carry type, provenance, freshness, and admissibility.

Protocol rules do not consume raw messages, device feeds, or EHR fields directly. GitMed facts define what a workflow is allowed to know, where the value came from, how fresh it must be, and whether it can support context, triage, urgent disposition, or only clinician confirmation.

facts.yaml admissibility
schema: gitmed.facts/v0.1
module: adult_sinusitis

facts:
  - id: symptom_duration_days
    type: integer
    source: patient_report
    required_for:
      - triage
      - disposition

  - id: double_worsening
    type: boolean
    source: patient_report
    required_for:
      - triage

  - id: periorbital_swelling
    type: boolean
    source: patient_report
    required_for:
      - red_flag_screen

  - id: wearable_resting_heart_rate
    type: number
    source: device.apple_health
    freshness: 24h
    admissibility:
      context: allowed
      triage: requires_confirmation
      urgent_disposition: excluded
    quality:
      min_samples: 3
      patient_state: resting

Model roles are bounded before they touch clinical logic.

A model contract defines the allowed inputs, output schema, blocked claims, and failure behavior for one bounded model role. The protocol can consume emitted facts only after the contract validator accepts the schema and provenance.

contracts/intake.extractor.yaml bounded role
schema: gitmed.contract/v0.1
module: adult_sinusitis
role: intake.extractor
model_ref: customer-model:intake-v3

allowed_inputs:
  - patient_message
  - encounter_context
  - admissible_background_facts

may_emit:
  - facts
  - uncertainty
  - source_spans

blocked_outputs:
  - diagnosis
  - disposition
  - treatment_plan

output_schema: schemas/intake-facts.schema.json
violation_action: quarantine
eval_suites:
  - evals/contracts/intake_extractor.yaml
  - evals/security/prompt_injection.yaml

Cases assert clinical behavior, not just model accuracy.

Eval suites can cover regression paths, red flags, exclusions, subgroup boundaries, prompt injection, missing facts, and cross-protocol ambiguity. Each case specifies the facts supplied to the module and the expected output state, trace path, and release-gate impact.

evals/red_flags.yaml case file
schema: gitmed.eval/v0.1
module: adult_sinusitis
suite: red_flags

cases:
  - id: rf_orbital_swelling_001
    facts:
      symptom_duration_days: 4
      periorbital_swelling: true
      vision_change: false
      ophthalmoplegia: false
    expected:
      output: urgent_clinician_review
      trace_contains:
        - orbital_complication
      gate_on_failure: block_release
test output release gate
$ gitmed test protocols/adult_sinusitis \
  --suite red_flags \
  --format yaml

suite: red_flags
cases: 18
passed: 18
failed: 0
release_gate: pass

Compiled modules run with pinned versions and replayable traces.

The application layer calls a compiled kernel with admissible facts and validated model-role outputs. The runtime response includes the output state, protocol reference, evidence links, and trace ID needed for incident replay or ClearanceOS export.

typescript runtime
import { loadKernel } from "@auddax/gitmed-runtime";

const kernel = await loadKernel(
  ".gitmed/build/adult_sinusitis/0.2.0/kernel.json"
);

const result = await kernel.evaluate({
  encounterId: "enc_7f31",
  facts: {
    symptom_duration_days: { value: 12, source: "patient_report" },
    double_worsening: { value: true, source: "patient_report" },
    periorbital_swelling: { value: false, source: "patient_report" }
  },
  modelOutputs: {
    "intake.extractor": "validated:mo_91ac"
  }
});

console.log(result.output.state);
console.log(result.trace.id);
console.log(result.protocol.ref);

Clinical modules move through a governed development lifecycle.

Each GitMed module is a versioned clinical software artifact. The workflow keeps engineering changes, clinical rationale, model boundaries, validation results, release decisions, and runtime traces tied to the same module record.

Stage Command Purpose
Author gitmed init <name> Create a scoped module with protocol, rules, sources, model contracts, evals, and release metadata.
Validate gitmed validate protocols/<module> Check schema, source anchoring, required facts, scopes, exclusions, and reviewer requirements.
Test gitmed test protocols/<module> Replay regression, red-flag, subgroup, adversarial, and model-contract cases.
Plan gitmed plan --from <ref> --to <path> Summarize clinical behavior changes before a release moves to review.
Review gitmed release request <path> Route evidence to clinical, safety, quality, regulatory, and release owners.
Compile gitmed compile <path> Generate deterministic runtime artifacts, SDK types, integration files, and evidence records.
Monitor gitmed monitor <ref> Track drift, overrides, incidents, model-role failures, and post-launch change candidates.

A clinical module is a folder of governed specifications.

A GitMed module is deliberately declarative. Authors describe clinical intent, facts, rules, sources, model boundaries, evaluation cases, and release requirements in structured files that can be reviewed by clinicians and compiled by engineering teams.

Protocol

Intended use, scope, supported population, exclusions, outputs, risk tier, trace requirements.

Facts

Typed inputs from the patient, clinician, EHR, device, payer, setting, and workflow context.

Rules

Deterministic predicates for required facts, red flags, cohorts, dispositions, and handoff states.

Sources

Guidelines, policies, studies, clinical rationale, review cadence, and source-integrity status.

Contracts

Allowed model inputs, emitted schemas, blocked claims, escalation behavior, and quarantine rules.

Evals

Regression cases, red flags, adverse cases, subgroup cases, prompt-injection probes, and expected states.

Release

Approved boundaries, required evidence, reviewers, signoffs, promotion target, and monitoring plan.

Structured files make clinical logic reviewable and compilable.

GitMed protocol specs use constrained YAML for deterministic clinical logic. Clinicians can review the pathway, sources, and intended use; engineers can compile the same files into runtime artifacts, test suites, SDK types, and evidence records.

protocol.yaml declarative
schema: gitmed.protocol/v0.1
module: adult_sinusitis
version: 0.2.0
intended_use:
  statement: adult sinusitis diagnostic triage support
  user: clinician_supervised_ai_assistant
  setting: outpatient_virtual_care

scope:
  population:
    age: ">=18"
  exclusions:
    - immunocompromised
    - pregnancy
    - recent_sinus_surgery

required_facts:
  - id: symptom_duration_days
    type: integer
    source: patient_report
  - id: fever_celsius
    type: number
    source: patient_report
  - id: double_worsening
    type: boolean
    source: patient_report

red_flags:
  - id: orbital_complication
    when:
      any:
        - fact: periorbital_swelling
          equals: true
        - fact: vision_change
          equals: true
        - fact: ophthalmoplegia
          equals: true
    output: urgent_clinician_review
    source_refs:
      - idsa-2012-rhinosinusitis-red-flags

Predicate syntax is intentionally constrained so clinical reviewers can inspect the logic and the runtime can replay the same facts, protocol version, and rule path deterministically.

The plan is a clinical behavior diff.

A GitMed plan tells the team what would clinically change before a module can move forward. The output is designed for engineering review, clinical review, safety review, and ClearanceOS evidence capture.

gitmed plan review packet
$ gitmed plan \
  --from chest_pain@2.3.1 \
  --to protocols/chest_pain \
  --format yaml

module: chest_pain
from: 2.3.1
to: working_tree
clinical_delta:
  changed_questions: 5
  changed_dispositions: 3
  new_exclusions: 2
  new_red_flags: 1

required_evidence:
  - source_rationale
  - behavior_diff
  - red_flag_replay
  - subgroup_eval
  - clinical_signoff

release_gate:
  inside_change_boundary: false
  decision: higher_review_required
  required_signoffs:
    - cardiology
    - safety
    - release_owner

A build can fail for clinical reasons, not just syntax.

GitMed gates are machine-checkable and clinically reviewable. A module can pass schema validation and still fail release readiness because a rule lacks a source, a red flag regressed, or a subgroup boundary changed without the required evidence.

Gate Checks Failure mode
Source anchoring Every rule links to a source, policy, or clinical rationale. Release blocked until source gap is resolved.
Red-flag replay Cannot-miss cases preserve escalation behavior across versions. Clinical review required or release blocked.
Contract safety Model roles stay inside allowed inputs, outputs, schemas, and claims. Violation quarantined and logged as evidence.
Subgroup scope Population, language, jurisdiction, and care-setting boundaries remain explicit. Scope reduced or higher review required.
Signoff Required clinical, safety, and release owners have attested to the version. Promotion remains pending.

The spec compiles into runtime and evidence artifacts.

A compiled module produces the files needed to run, integrate, review, and defend a clinical workflow: deterministic kernels for Auddax runtime, SDK types for application teams, FHIR/CDS Hooks integration artifacts, CI outputs, reviewer packets, and ClearanceOS evidence records.

compile output deterministic
$ gitmed compile protocols/chest_pain \
  --version 2.4.0 \
  --target release \
  --out .gitmed/build

generated:
  kernel: .gitmed/build/chest_pain/2.4.0/kernel.json
  trace_schema: .gitmed/build/chest_pain/2.4.0/trace.schema.json
  sdk_types: .gitmed/build/chest_pain/2.4.0/sdk/typescript.d.ts
  fhir_plan_definition: .gitmed/build/chest_pain/2.4.0/fhir/PlanDefinition.json
  clearanceos_record: .gitmed/build/chest_pain/2.4.0/evidence/release-record.json

runtime:
  deterministic_kernel: ready
  trace_schema: ready
  release_registry: pending_signoff

GitMed turns protocol safety into a pull-request gate.

CI checks protocol edits, model-contract edits, eval additions, source updates, and release metadata before merge. Automated gates do not replace clinical review; they prevent incomplete changes from entering review without the required evidence.

github actions example
name: gitmed-protocol-gates

on:
  pull_request:
    paths:
      - "protocols/**"
      - ".github/workflows/gitmed.yml"

jobs:
  protocol-gates:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: auddax/setup-gitmed@v1
      - name: Validate changed modules
        run: gitmed validate protocols --changed --base origin/main
      - name: Run regression suites
        run: gitmed test protocols --changed --suite regression
      - name: Build clinical plan
        run: |
          gitmed plan --base origin/main --head HEAD \
            --out .gitmed/plan.json
      - name: Enforce release gates
        run: |
          gitmed release gate .gitmed/plan.json \
            --require-sources \
            --require-signoff-plan

The language is optimized for clinical review and deterministic execution.

Declarative

Describe clinical intent, constraints, facts, rules, and gates. Avoid imperative workflow code.

Deterministic

The compiled kernel must replay the same facts, protocol version, and rule path the same way.

Source anchored

Every rule and clinical claim links to a guideline, policy, study, or reviewed rationale.

Diffable

Reviewers can see clinical behavior changes before release, not just text edits.

Scoped

Intended use, population, care setting, language, and handoff boundaries remain explicit.

Review gated

Promotion requires the right evidence and human signoff for the risk and change class.

Clinical modules become reviewable, testable, and governed software artifacts.

GitMed gives teams the developer workflow for deterministic clinical modules: author, validate, test, plan, review, release, monitor, and export evidence into the broader Auddax platform.