Policy-to-Rules Engine
A two-agent pipeline that turns written payer medical policy into machine-readable claim-editing rules. It then adjudicates claims against those rules, and every approve or deny decision is traced back to the source policy line.
A working recreation you can click through
Policy: Vitamin D Testing (25-Hydroxyvitamin D and 1,25-Dihydroxyvitamin D) Policy Number: LAB-0042 Effective Date: 2025-01-01 CPT codes addressed: - 82306 Vitamin D; 25 hydroxy - 82652 Vitamin D; 1,25 dihydroxy Coverage Indications Testing for 25-hydroxyvitamin D (CPT 82306) is considered medically necessary when ordered for a patient with one of the following conditions: - Chronic kidney disease (N18.x) - Osteoporosis (M81.0) - Osteomalacia (M83.x) - Vitamin D deficiency (E55.9) - Malabsorption syndromes, including celiac disease (K90.0) and Crohn's disease (K50.x) - Chronic liver disease (K70 through K77) - Hypocalcemia (E83.51) or hypercalcemia (E83.52) Frequency Limitations For monitoring of patients with an established covered diagnosis, testing of 25-hydroxyvitamin D is limited to once every 12 months. Exception: For patients with malabsorption syndromes, or who are undergoing active repletion therapy for documented vitamin D deficiency, testing may be performed up to once every 3 months. Non-Covered Indications Routine screening of asymptomatic patients without a covered diagnosis is not covered. This includes general wellness or preventive encounters (for example, Z00.00). Testing for 1,25-dihydroxyvitamin D (CPT 82652) is non-covered except for patients with chronic kidney disease (N18.x) or hypercalcemia (E83.52).
An LLM agent reads the prose on the left and emits structured claim-editing rules.
The policy, the extracted rules, the sample claims and the reimbursement rates are the project's own files, and the adjudication engine is the project's own code, ported line for line and run live in your browser. The extraction step is replayed; the LLM cross-check needs an API key, so it is described rather than run. Nothing is sent anywhere.
Overview
A proof of concept built for a healthcare payment-integrity assessment. It takes a written payer medical policy (prose) and converts it into structured, machine-readable claim-editing rules using an LLM, then runs sample claims against those rules and returns approve/deny decisions — each with a reason tied back to the source policy.
This maps directly to how payment-integrity products convert written clinical and payment policy into executable claim edits.
Problem
Payers write coverage and payment policy in English. Turning that prose into executable claim edits is manual, slow, and error-prone — and when a claim is denied, the reasoning often isn't traceable back to the specific policy language that drove it.
Solution
A deliberately simple two-agent pipeline that demonstrates the core payment-policy-management loop end to end:
- Extraction agent reads a written policy and emits a structured rules JSON object against a defined schema
- Validation agent takes those extracted rules plus a single claim and returns a decision — APPROVE or DENY — with the matched rule and a source-policy reference
The two-agent split shows an agentic design without unnecessary complexity: no database, no auth, no extra services. Every decision is traceable to a source line.
Architecture
Flow
- Written policy (prose) → Extraction agent → structured rules JSON
- Rules JSON + one claim → Validation agent →
{ decision, matched_rule, policy_reference } - UI renders each claim as an APPROVE / DENY card with the reason and the policy line it maps to
Design choices
- Robust JSON handling — both agents are instructed to return raw JSON only; the pipeline still defensively strips code fences and wraps parsing in try/catch
- Traceability first — every adjudication points back to the exact rule and source policy reference
- Screenshare-optimized UI — a clean three-column layout (raw policy → extracted rules → claim results) built for a live demo
Tech Stack
- Backend: Node.js + Express (thin API layer)
- AI: OpenAI SDK with a structured extraction prompt + schema and a separate validation prompt
- Frontend: Plain HTML + vanilla JS single page — three columns, no build step
- Config: API key from
.env, never hardcoded (only.env.examplecommitted)
Demo Walkthrough
- Show the prose policy on the left — payers write coverage policy in English
- Click Extract — an LLM agent converts prose into machine-readable claim edits
- Click Run all claims — walk through the results: a clean approve, denials on diagnosis / frequency / wrong CPT, and an approve under a malabsorption exception
Results
- Demonstrates the first principle behind automated payment policy management: written policy → executable rules → adjudicated claims
- Every decision is traceable to a source policy line
- Delivered with a written report and presentation alongside the working demo
A closer look





- AI product · Decision toolingBlueprint: the Agent Architecture Guide
- Systems engineering · EnergyTransformer Capacity Monitor
- Multi-agent · FinanceDeepDiligence
- Multi-agent · SalesLead Generator Proposal Engine
- Agentic AICornell Personal Assistant
- AutomationJob Listings Tracker
- AutomationInvoice Generator
- GenAI · ConversationalTravel Agent GPT