Skip to main content

Open-source design-controlled development infrastructure for medical device and SaMD teams — includes dhfkit

Project description

MedHarness

AI harness and DHF tooling for medical device software teams.

MedHarness is an open-source framework for building AI-driven engineering workflows on IEC 62304 / FDA-regulated software projects. It combines two things:

  1. medharness — a CI harness that structures how AI agents (Claude Code) interact with a Design History File: pre-computing context, enforcing approval gates, persisting decisions, and generating audit-ready evidence.

  2. dhfkit — a standalone DHF engine for managing items, enforcing traceability (UC → CRS → SRS → SWDD → TC), validating schema, and generating specification documents.

License: MIT Python 3.11+

Harness engineering: Rather than prompting an AI to "do compliance," MedHarness pre-computes the DHF context, injects it into the agent environment, defines approval gates the agent must pass through, and captures the agent's decisions back into the DHF — so the engineer controls the loop, not the agent.


Install

# From source (not yet on PyPI):
git clone https://github.com/itercharles/MedHarness
cd MedHarness
pip install -e .

Verify:

medharness --help
dhfkit --help

Quick Start

medharness init

Interactively scaffolds two repos:

  • DHF repoDHF/config/, item YAML templates, spec/plan Jinja2 templates, GitHub Actions workflows for CR analysis, design, and CI validation
  • Product repo filesCLAUDE.md, engineering-control.yml, cr-complete.yml, Claude Code skills (.claude/skills/)

How it works

A Change Request flows through five AI-assisted stages, each enforced by GitHub Actions:

Issue → cr-analyze (AI spec) → cr-design (AI DHF items) → cr-develop (AI code) → cr-complete

At each stage MedHarness:

  • Pre-computes DHF context (medharness dhf context overview) and injects it as $DHF_CONTEXT
  • Runs Claude with --dangerously-skip-permissions inside the DHF repo
  • Commits transitions back to the DHF (medharness dhf item transition --commit --push)
  • Stores session IDs in PR comments for iterative review (medharness ci claude-session put/get)

CLI surface

medharness init

# DHF operations (run from DHF repo with --dhf DHF)
medharness --dhf DHF dhf item list|get|create|update|delete|transitions|transition
medharness --dhf DHF dhf validate schema|traceability
medharness --dhf DHF dhf doc list|generate|export
medharness --dhf DHF dhf test list
medharness --dhf DHF dhf context overview|implementation
medharness --dhf DHF dhf config doc-types

# CI gates (run from product repo)
medharness ci dhf-validate --dhf DHF
medharness ci test-coverage --dhf DHF
medharness ci evidence bundle --dhf DHF --out-dir ...
medharness ci artifacts generate --dhf DHF --out-dir ...

# GitHub Actions helpers
medharness ci github-event --github-output "$GITHUB_OUTPUT"
medharness ci claude-session put <pr_number> <session_id>
medharness ci claude-session get <pr_number>

# CR workflow
medharness cr workflow intake-github-issue-ci
medharness cr workflow complete-from-github-pr

Python API

Use dhfkit directly in product repo automation without shelling out:

from medharness.client import DHFClient

client = DHFClient(Path("../my-project-DHF/DHF"))
cr = client.get_item("CR-034")
context = client.get_cr_context("CR-034")   # {"cr": {...}, "spec": "..."}
client.transition_item("CR-034", "in_review", performed_by="alice")

Or use dhfkit standalone (no dependency on medharness):

from dhfkit.local_adapter import LocalDHFAdapter

adapter = LocalDHFAdapter(Path("DHF"))
items = adapter.list_items("SRS")

Repository layout

Directory Purpose
medharness/ CLI harness, CI gates, CR workflows, init scaffolding
dhfkit/ DHF engine: items, lifecycle, traceability, document generation
dhfkit/templates/ Starter DHF scaffold — config, specs, plans, sample items
docs/ Architecture, ADRs, compatibility contracts, roadmap

dhfkit has no dependency on medharness and can be used standalone.


Docs


License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

medharness-0.1.0.tar.gz (108.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

medharness-0.1.0-py3-none-any.whl (143.1 kB view details)

Uploaded Python 3

File details

Details for the file medharness-0.1.0.tar.gz.

File metadata

  • Download URL: medharness-0.1.0.tar.gz
  • Upload date:
  • Size: 108.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for medharness-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d45a82f1afebb7033c73b809f8911912ff370f65eafd37c156a470b64471b6a0
MD5 217fc51c511f0d272c3f7368d5348a77
BLAKE2b-256 ef7f41c7ac6d42d404178acb994018653e0cd58dca4cc85f5ccc1b417300bc21

See more details on using hashes here.

Provenance

The following attestation bundles were made for medharness-0.1.0.tar.gz:

Publisher: release.yml on itercharles/MedHarness

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file medharness-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: medharness-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 143.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for medharness-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 130483f28b0e8a0068fb6bf06b60fe60c33a4adff29300293b144211bbe2d534
MD5 c2c83907da2feaf193b2b97e0d814709
BLAKE2b-256 02b450ca15ab05c00ae6934f84921b43124abc707f2e0f6baef7ef216fcfeff5

See more details on using hashes here.

Provenance

The following attestation bundles were made for medharness-0.1.0-py3-none-any.whl:

Publisher: release.yml on itercharles/MedHarness

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page