{"id":50331800,"url":"https://github.com/rupurt/baggins","last_synced_at":"2026-05-29T10:01:59.546Z","repository":{"id":348340677,"uuid":"1197532968","full_name":"rupurt/baggins","owner":"rupurt","description":"The medical billing bot","archived":false,"fork":false,"pushed_at":"2026-03-31T20:01:38.000Z","size":265,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-31T20:15:26.510Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rupurt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-03-31T16:54:09.000Z","updated_at":"2026-03-31T20:01:42.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/rupurt/baggins","commit_stats":null,"previous_names":["rupurt/baggins"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/rupurt/baggins","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rupurt%2Fbaggins","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rupurt%2Fbaggins/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rupurt%2Fbaggins/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rupurt%2Fbaggins/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rupurt","download_url":"https://codeload.github.com/rupurt/baggins/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rupurt%2Fbaggins/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33646428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-29T02:00:06.066Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-05-29T10:01:58.403Z","updated_at":"2026-05-29T10:01:59.540Z","avatar_url":"https://github.com/rupurt.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Baggins\n\nMedical billing assistant platform built as an agentic system to maximize **total paid to the provider** for medical practices.\n\n`baggins` (Billing Agentic Graph and Intelligence Network System) is designed for medical practices that need a practical, production-grade pipeline that can:\n\n- Ingest clinical data generated before, during, and after a patient interaction\n- Translate notes into billing-ready claims with consistent coding quality\n- Detect avoidable payer failures before submission\n- Learn from denials, remediations, and payment outcomes to improve future claim outcomes\n- Use a recursive context engine to run a best-in-class medical verifier before submission\n\nThe project will be executed as a set of sequenced Keel missions, each delivering measurable capability and reducing risk before scaling further.\n\n## Vision\n\nThe goal is not to maximize raw claim volume.  \nThe objective is to maximize **total paid reimbursements** by improving claim acceptance and payment while reducing denials and costly write-offs.\n\nTarget outcomes:\n\n- Total paid dollars increase over time\n- Reduction in preventable denials\n- Faster claims cycles and better appeals quality\n- Higher first-pass acceptance and cleaner claim narratives\n\n## Core architecture\n\n### Ingestion\n\nThe system ingests:\n\n- Physician notes and reports before the visit (history, pre-procedure indications)\n- Clinical documentation during the visit (assessment, procedure details, orders, dictation)\n- Post-visit notes and updates (lab results, addenda, discharge summaries)\n- Patient registration and insurance payloads\n- Historical payer outcomes and remittance data\n\n### Processing model\n\n- The system uses Rust microservices connected by the `transit` message streaming platform.\n- Services exchange normalized clinical and billing events.\n- A recursive context engine orchestrated through [`paddles`](https://github.com/spoke-sh/paddles) (agentic mech-suite) coordinates claim-review loops and escalates for human review when confidence is low.\n- Verification decisions call the local/remote model layer powered by [`sift`](https://github.com/rupurt/sift), enabling private on-device evaluation and cloud model fallback as needed.\n\n### Verification stack\n\n- `paddles` is the orchestration backbone for mission-goal workflows and recursive validation passes.\n- `sift` is the model execution layer for claim verification, explanation generation, and adjudication scoring.\n- The medical verifier is implemented as a repeatable recursion loop that:\n  - extracts evidence from notes and encounter context\n  - proposes claim actions\n  - validates actions against policy and payer rules\n  - requests additional evidence if confidence is weak\n  - only commits claims when policy and payment-relevance checks pass\n\n### Design principles\n\n- Deterministic message contracts for all claim-relevant events\n- Audit-first design for HIPAA, governance, and payer compliance\n- Every claim decision should be explainable by source evidence\n- Human-in-the-loop override path at every high-risk stage\n\n## Nix development environment\n\nThis repo includes a Nix flake that provides a Rust-enabled shell.\n\n```bash\nnix develop\n```\n\nThis shell provides:\n\n- Rust toolchain (`rustc`, `cargo`, `rustfmt`, `clippy`)\n- Common build dependencies for Rust services\n- Git and utility tools needed for local development\n\n## Keel missions\n\nWe will run implementation in ordered Keel missions. Each mission has clear acceptance criteria and a production-oriented deliverable.\n\n### Mission 0 — Foundation and guardrails\n\n- Stand up repo structure and CI basics\n- Define event schema versioning rules for `transit`\n- Add data-retention and security policy\n- Add `paddles` orchestration bootstrap and `sift` runtime adapter interfaces (local + remote inference)\n- Add contributor onboarding in docs and initial developer workflows\n\nAcceptance criteria:\n- New engineer can run `nix develop` and build an empty Rust workspace\n- CI runs lint + format checks\n- Security and compliance checklist exists and is versioned\n- Recursive verifier interfaces are defined and can complete a dry-run check\n\n### Mission 1 — Clinical ingestion fabric\n\n- Implement ingestion microservice for pre/during/post visit notes\n- Add adapters for source systems (EHR exports, note files, HL7/FHIR-friendly payloads)\n- Normalize notes into structured `EncounterContext` events\n- Route all source data through `transit` topics with dead-letter handling\n\nAcceptance criteria:\n- 95% of non-empty note batches produce one normalized context event\n- Rejected payloads are explainably quarantined for review\n\n### Mission 2 — Medical coding and evidence extraction agent\n\n- Build the core coding agent:\n  - maps conditions, procedures, and modifiers\n  - builds CPT/ICD evidence chain from note spans\n  - tracks uncertainty and confidence per code assignment\n- Add a reviewer dashboard payload that shows missing evidence areas\n- Integrate coding outputs into the recursive verifier through `paddles`\n- Run `sift`-backed quality checks for unsupported claims and payer risk flags\n\nAcceptance criteria:\n- Claim-line candidate quality score above baseline for test notes\n- Every recommended code has traceability to note evidence\n- Verifier loop can auto-reject low-confidence claims and request correction context\n\n### Mission 3 — Claim assembly and validation service\n\n- Generate claim payload from context + coding output\n- Implement payer-specific rule validation\n- Enforce hard business constraints before submission\n\nAcceptance criteria:\n- Zero invalid claim payloads reaching submission in regression test set\n- Rejection-free payload coverage improved versus baseline\n\n### Mission 4 — Coverage and eligibility preflight agent\n\n- Add eligibility and authorization checks before claim finalization\n- Surface missing coverage gaps as blocking items\n- Emit `EligibilityFailure` events when required data is missing\n\nAcceptance criteria:\n- Reduced avoidable denials from ineligibility/authorization misses\n- Audit log captures every preflight check and decision\n\n### Mission 5 — Denial prevention and smart editing service\n\n- Introduce deny-list and correction suggestions for common failure patterns\n- Create retry-safe editing workflows\n- Implement payer feedback ingestion for post-submit updates\n\nAcceptance criteria:\n- Return rate from first denial class improves\n- Fewer “non-recoverable” denial escalations\n\n### Mission 6 — Appeals and recovery automation\n\n- Add automated response builder for remediable denials\n- Route high-confidence appeals into auto-submission\n- Route ambiguous cases to staff review with evidence bundles\n\nAcceptance criteria:\n- Measurable reduction in aged unresolved denials\n- Improved recovery dollars on remapped claims\n\n### Mission 7 — Payment optimization learning loop\n\n- Build feedback sink for remittance and payment-posting outcomes\n- Add metrics to compare expected value vs actual paid by CPT/ICD/payer/provider\n- Train and deploy rule updates from closed-loop outcomes\n\nAcceptance criteria:\n- Monthly net paid uplift tracked and visible\n- Demonstrable increase in paid value for high-impact claims in next cycle\n\n### Mission 8 — Reliability, observability, and ops hardening\n\n- Add distributed tracing across microservices\n- Add replay tooling for failed `transit` events\n- Add SLOs and incident runbooks\n\nAcceptance criteria:\n- End-to-end claim path traceability is available\n- MTTR reduction for event failures and submission issues\n\n### Mission 9 — Clinical rollout and scale\n\n- Pilot with a single specialty and limited payer set\n- Expand to additional practices and specialties incrementally\n- Add regional payer-specific policy packs\n\nAcceptance criteria:\n- Stable uptime and throughput under pilot workload\n- Positive net paid trend before each scale step\n\n## Initial reference architecture\n\nSuggested `transit` topics:\n\n- `encounter.raw`\n- `encounter.normalized`\n- `claims.draft`\n- `claims.validation`\n- `claims.eligibility`\n- `claims.submission`\n- `claims.status`\n- `claims.payment`\n- `claims.denial`\n- `claims.appeal`\n- `model.feedback`\n\n### Service layout\n\n- `ingest-service`: imports physician report + notes and emits normalized encounter events\n- `coding-agent`: extracts coded claims and clinical evidence links\n- `claim-service`: assembles and validates claims\n- `payer-gatekeeper`: runs payer-specific checks and blocks high-risk submissions\n- `submission-service`: submits claim batches and tracks state transitions\n- `recovery-service`: handles denials, corrections, and appeals\n- `learning-service`: updates strategy policies from payment outcomes\n- `verifier-orchestrator`: runs recursive validation workflows across coding, policy, and payer checks\n\n## Quality and safety priorities\n\n- **Accuracy \u003e automation:** system favors safe claims and transparent confidence scoring\n- **Explainability:** every automated decision includes rationale and evidence source\n- **Compliance:** strict audit trail, data minimization, and retention policy alignment\n- **Human oversight:** any low-confidence action must be human-reviewable before irreversible submission\n\n## Risks and controls\n\n- Coding ambiguity (multiple valid billing interpretations)\n- Payer policy drift and contract-specific variations\n- Data variability in notes and dictation quality\n- False automation in high-risk encounters\n\nControls:\n\n- Continuous policy diffing against payer updates\n- Versioned prompt and rule revisions for coding actions\n- Human escalation on confidence thresholds\n- Monthly outcome review with billing leadership\n\n## Repository milestones\n\n- Build each Keel mission as an independently deployable increment\n- Keep services backward-compatible by strict event schema versions\n- Track total provider payment and net paid growth in every release review\n- Expand payer and specialty coverage only after measurable uplift\n\n## Quick start\n\n1. `nix develop`\n2. Start the Baggins API server:\n   `just baggins`\n3. Run interactive UI builds in separate terminals:\n   - Biller interface: `just serve-biller-ui`\n   - Payer interface: `just serve-payer-ui`\n4. Build both front-ends for deployment artifacts:\n   `just build-frontend`\n5. Launch remaining mission pipelines (`keel` / services / topics) as needed.\n\nThe API exposes:\n- `GET /v1/biller/search`\n- `GET /v1/payer/denials/search`\n- `GET /v1/cases/{case_id}`\n- `POST /v1/cases/{case_id}/action`\n- `GET /v1/cases/{case_id}/audit`\n\n---\n\n`baggins` is built for measurable financial impact, not novelty. The Keel mission sequence above is intended to ship clinical value quickly while continuously reducing denial risk and improving reimbursement outcomes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frupurt%2Fbaggins","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frupurt%2Fbaggins","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frupurt%2Fbaggins/lists"}