DEV Community

Cover image for ClawbackMD: local Gemma drafts for AI-assisted insurance denials
Wal
Wal

Posted on

ClawbackMD: local Gemma drafts for AI-assisted insurance denials

Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle Submission 💸

This is a submission for the Hacktoberfest Open-Source AI Challenge: Week 2 — Side Hustle

What I Built

ClawbackMD drafts appeal packets for insurance denials that look AI-written on the payer side. You pick a denied claim, it reads the synthetic chart + payer policy, and it returns a verdict, quote-backed evidence, an editable letter, and peer-to-peer talking points.

The model is optional. Default store is in-memory (no Docker). If Ollama/Gemma is down, cached human-reviewed drafts still demo the flow.

Every letter is a draft. The UI asks for separate clinical and billing review logs. That is a demo attestation, not an e-signature and not NPI-bound.

Who Would Pay

Hospital billing / RCM teams who already lose hours to AI-assisted denials. A local open-weight draft that only cites verbatim chart quotes is something a small billing shop could run on a laptop without sending PHI to a hosted API.

Demo

Repo: https://github.com/walsoup/clawbackmd
Live demo: https://clawbackmd.vercel.app

npm install
cp .env.example .env.local
npm run dev
Enter fullscreen mode Exit fullscreen mode

Optional model:

ollama pull gemma3
ollama serve
Enter fullscreen mode Exit fullscreen mode

Five synthetic claims load on first open. Generate a draft on CLM-001 (appeal) and CLM-005 (documentation gap — query attending).

How It Works

Open-weight path: Gemma via any OpenAI-compatible endpoint (lib/llm.ts), usually local Ollama.

Guardrails in lib/validate.ts:

  1. Evidence and policy quotes must be verbatim substrings of the source note/policy.
  2. Letter sentences with clinical atoms (labs, grades, durations, CPTs) must appear in validated evidence or claim facts; ungrounded sentences are stripped.
  3. The LLM may cite payer policy codes only. CFR / statute cites are attached server-side from plan_type, not invented by the model.
  4. uphold_denial means documentation gap — query the attending — not automatic write-off.

UI uses the Linen design system (linen surface, forest primary, hairlines).

Why Open Innovation Matters

  • PHI stays local. Chart text never has to leave the machine if you run Gemma on Ollama.
  • Cost. No per-token bill for a drafting loop billing staff would run all day.
  • Swappable model. Point LLM_BASE_URL / LLM_MODEL at another OpenAI-compatible endpoint without rewriting the app.
  • Fail closed on quotes. If the model invents a finding, validators drop it instead of shipping a confident fake.

Tradeoff: a weak local model needs the cached drafts and the quote scrubber. That is intentional for a demo that must not invent clinical facts.

Code

https://github.com/walsoup/clawbackmd

Top comments (0)