Autonomous agents with memory and context — patent filed with the USPTO

Hospitals · Revenue cycle

Compliance between care delivered and care billed

A denial you can see coming: the line the payer refuses to pay comes back, it bothers someone, and someone appeals. The silent loss is a different animal — the line billed below what the contract agreed, month after month, with nobody on the other side complaining. That money is never denied. It is simply never asked for.

The agent audits what was billed against the chart and against the contract: it names the line the documentation does not support, with the reason and the math shown. Repricing, renegotiating or fixing the process stays a hospital decision.

A manager and a nurse reviewing a screen together at the nursing station, he holding a stack of paperwork, with a ward and a patient visible behind them.
The loss that never comes back

The three mismatches that disappear at closing

A hospital bill passes through three different versions of the truth before it turns into money: what happened at the bedside, what the system billed, and what the contract with that payer — the health plan on the other side — says it is worth. When the three do not agree, the difference shows up as a denial. Or it does not show up at all.

Mismatch 1

Care delivered vs. billed

The procedure happened, it is written in the patient chart, and it never made it onto the bill. Or the opposite: the line is on the bill and no matching entry exists in the chart — which is exactly the entry the payer's audit will ask to see.

  • Delivered and not billed: it drops off the bill and never becomes revenue.
  • Billed with no record: it becomes a technical denial at the first audit.
  • Quantity mismatch: room days, supplies and OR time do not always add up against each other.
Mismatch 2

Billing vs. reference table

The line is on the bill, but pointing at the wrong version of the reference. A surgical tier swapped, an approach that changes the fee, a drug priced from an old edition of the table, a generic supply where the contract asks for the agreed brand.

  • Outdated edition: the reference moved on and the hospital catalog did not.
  • Wrong tier: the code is right and the tier is not — the gap is small and it repeats thousands of times.
  • Surgical approach: the same procedure is worth different amounts depending on the approach recorded.
Mismatch 3

Table vs. contract

This is the expensive one. The market reference says one number; the contract you signed with that payer says another, because it carries its own escalation index, negotiated bundles, exceptions by specialty and effective dates. Billing at the generic reference here means billing below what was agreed.

  • Escalation index: applied in the contract and never reflected in the item catalog.
  • Bundle: what sits inside it and what you may charge separately changes from payer to payer.
  • Effective date: the amendment started in March and the system is still billing January's number.

A denial is the loss that complains. A line billed below contract is the loss that says thank you and walks away.

0.9% of lines leave billed below contract — it used to be 6.2%
3 Brazilian reference price tables checked on every bill — CBHPM, Simpro and Brasíndice — with no manual work
14 contracted payers, each with its own contract, its own edit rules and its own effective dates

The example hospital, the same one across this section

A mid-to-large hospital network · 28 outpatient specialties · around 60,000 outpatients a year · roughly 2,500 consultation slots offered per week · official WhatsApp carrying about 23,000 conversations a month · 14 contracted payers.

It is the same profile used in billing and denials, in claims transmission and in schedule and capacity — so the orders of magnitude on each page can be read side by side.

Reference in force

The right table, in the right version, against the right contract

In most hospitals, keeping CBHPM, Simpro and Brasíndice current is people work: someone downloads, someone compares, someone types in the difference. And someone forgets, because it is nobody's main job.

What the agent audits, line by line

This is not a sample check: it is an audit. For every line of every bill closed in the period, the agent checks whether the clinical record supports what was billed and builds a three-way comparison — and only flags a mismatch, with the line and the reason, when the three sides disagree.

  • The line as it was billed: code, tier, surgical approach, quantity, date and provider, read straight off the bill.
  • The reference in force on the date of care: not today's — the one that applied on the day the procedure happened.
  • That payer's contract: the agreed price, the escalation index applied, the bundle, the exceptions by specialty and the effective date of the amendment.

When a reference moves to a new edition, what changes is not the process: it is the return value of one call. The agent starts comparing against the new edition from its effective date onward, and whatever was billed before keeps being judged by the edition that applied that day.

The agent's tools

No table lives in the model's memory

References and contracts arrive as API calls declared in the agent's configuration. What it cannot call, it does not know — and when a call fails, it records the failure and leaves that line out of the conclusion instead of filling the gap with whatever looks plausible.

api_get_bills_in_period api_get_bill_items api_get_reference_table api_get_payer_contract api_get_payer_edit_rules api_get_payer_remittance
  • Tools declared one by one, with no implicit access
  • Read by default: the agent does not change the bill
  • Every run leaves an audit trail: what was queried, what was decided, what was written

The three references do not answer the same question. That is why checking only one never settles it — and why the contract always has the last word.

The three Brazilian reference price tables, the question each one answers, and what the payer contract can change about them
Reference Answers the question Where it usually slips What the contract can change
CBHPM What the procedure and the professional fee are worth Surgical tier, anesthetic tier and approach recorded differently from what was done Percentage over the tier, exceptions by specialty and items inside a bundle
Simpro What a supply or medical product is worth An old edition in the catalog, and a generic item where the contract asks for the agreed brand Discount or markup factor per supply line
Brasíndice What a drug is worth, by presentation Unit splitting and a swapped presentation — the same drug at two prices The splitting rule and the price basis adopted in the contract
Payer contract What that item is worth to that payer An amendment in force on paper and absent from the system catalog Escalation index, effective date, bundle and everything above

The right-hand column is what turns a table check into a contract check. Without it, the hospital verifies whether a line is correct — not whether it is what was agreed.

Before the batch goes out

Simulate the edits instead of waiting for the denial

A payer's rules are knowable — the ones that already caused denials under that contract, the ones that show up every month on the remittance advice, the ones the payer's own manual publishes. The agent runs the bill against those rules before the claim goes out in TISS, the ANS-mandated Brazilian claims exchange standard, and hands back the list of what would likely be denied, with the reason. A compliance deviation caught before the batch goes out is a denial that never happens: preventing costs less than appealing.

1

It reads the closed bill

At the scheduled time, the Squad calls api_get_bills_in_period and drills down to the line: code, tier, quantity, date, provider and the matching clinical record.

2

It checks reference and contract

For each line, it compares the billed amount against the reference in force on the date of care and against what that payer's contract agreed. What is left is the set of lines where the three sides do not close.

3

It runs the payer's edits

Over what is left, it applies the known edits for that contract — the automated checks a payer runs against your claim, both the ones that produced denials before and the ones the payer publishes — and marks what is likely to fall, with the reason spelled out.

4

It hands the list back before you send

The list reaches billing while the batch is still in the house. Fixing it now costs one review; fixing it later costs an appeal, a deadline and cash.

Below, the run exactly as it is recorded: every call, every decision, and every line the agent left out for missing data. Nothing runs where the manager cannot see it.

Hal-AI · Compliance Squad run 04:00 routine
Running Batch compliance · 04:00 routine Step 4 of 6
04:00:02Context loaded — scope: bills closed in this cycle, 5 payers with a batch in preparation 04:00:07api_get_bills_in_period(cycle="current", status="closed") 04:01:22api_get_bill_items(bill) — lines read bill by bill 04:03:40api_get_reference_table(name="CBHPM", in_force="date_of_care") 04:03:44api_get_reference_table(name="Simpro") · api_get_reference_table(name="Brasindice") 04:04:10api_get_payer_contract(payer) — 5 contracts, with amendment and effective date 04:06:55641 lines mismatched across billed amount, reference and contract 04:07:18api_get_payer_edit_rules(payer) — known rules per contract 04:09:319 lines with no matching clinical record — set aside for human review 04:09:441 payer contract with no amendment published in the catalog — its lines stay out of the conclusion 04:10:02Likely-edit list assembled, with a reason per line 04:10:05Publishing the cycle review
641 mismatches · 9 lines with no record · 1 incomplete contract running on the server
Incomplete contract in the catalog the agent does not conclude on what it could not read Out of the conclusion without the amendment in force, that payer's lines come out marked as not assessed — never as compliant
Rendering of the run screen.

Fixing it first costs one review

A line fixed before transmission goes back into the batch and travels on. The same line denied later becomes a process: find the evidence, build the appeal, respect the contractual deadline, watch the next remittance advice and hope it comes back.

That is the difference between adjusting one line and opening a whole recovery cycle — which takes two days to assemble, and used to take eleven.

Nine out of ten edits, before the batch leaves

The simulation anticipates nine out of every ten edits the payer would raise. The tenth is the one that teaches: it enters as a new rule for that contract and gets simulated from the next cycle onward.

Batches rejected for a technical inconsistency fall from 14% to 0.8% when validation and compliance run before transmission, and the billing window shrinks from twelve days to two.

Cycle mismatches

The mismatches, by payer and by line

The dashboard does not show bills: it shows mismatches. Each row is a payer with something open in the cycle, the type of mismatch that dominates it, how many lines are involved and how big the gap is on the line.

Hal-AI · Cycle compliance Current cycle · 14 payers
Mismatches in this cycle Five of the fourteen contracted payers have something open this cycle. No patient data appears on this screen. Export review
Current cycle

Mismatches by type

Mismatches in the cycle641 Table vs. contract336 Billing vs. reference244 Care vs. billing61

336 + 244 + 61 = 641 mismatched lines in the cycle.

Payers with something open — 5 of 14

Cycle mismatches by payer: dominant mismatch type, number of lines involved, gap on the line and assigned severity. No column carries patient identification.
Payer Dominant mismatch Most frequent line Lines Gap on the line Severity
Payer A Table vs. contract Surgical procedure · tier 312 −6.2% High
Payer B Billing vs. reference Supply · old edition 148 −3.8% High
Payer C Billing vs. reference Drug · presentation 96 −2.1% Medium
Payer D Care vs. billing Recorded and not billed 61 line missing Medium
Payer E Table vs. contract Room day · bundle 24 −0.9% Low
Mismatched lines in the cycle — 312 + 148 + 96 + 61 + 24 641

Lines that need a person — 9 open

Billed with no matching record
Payer B · supply on a surgical bill
care vs. billing 6 lines
The line is on the bill and the agent found no matching clinical record. It stays out of the batch until someone checks it.
open for 1 cycle
Contract with no published amendment
Payer F · March amendment
table vs. contract not assessed
The amendment exists in legal and is not in the catalog. That payer's lines come out as not assessed, never as compliant.
blocks the conclusion
Patient data does not enter the aggregate dashboard the columns are payer, mismatch type, line, quantity and severity Audit trail on every figure on this screen keeps the call it came from, the timestamp and the lines behind it

What you are looking at

The bars split the mismatches into the three types, with the parts printed underneath: 336 of table against contract, 244 of billing against reference and 61 between care and billing. The table opens that up by payer, with the gap each one carries on the line and the severity the agent assigned.

Below it, the two cases that never become a number: the line billed with no matching record, and the contract whose amendment is not in the catalog.

The advantage

Nobody opened a payer portal, downloaded a table or cross-checked a spreadsheet to get here. The review that today occupies dedicated people becomes an overnight run, and what shows up in the morning is only the part that needs a decision — 641 rows ranked by severity, not the whole bill.

This kind of work is around 1,400 hours a month the operation no longer spends, and acknowledgement checking goes from nine dedicated posts to three. Doubling the number of bills stops meaning doubling the team that checks them.

Only at Hal-AI

Notice what the screen refuses to do: the payer with no published amendment is not called compliant for lack of information — it comes out marked as not assessed. The agent would rather declare the hole than close the number.

And notice what it does not show: no patient data. The aggregate dashboard works with payer, line, quantity and severity, and every figure keeps the call it came from, for anyone who wants to redo the math.

Contract × system

What contracting negotiated and what the system bills

In most hospitals these are two separate worlds. The contract is negotiated at a table, signed and filed — and billing keeps running on the catalog that was already there. Nobody got it wrong on purpose; there is simply no one whose job is to cross the two every month.

How the mismatch is born

  • The amendment is signed and stays with legal; nobody tells the item catalog
  • The escalation index is applied in the negotiation spreadsheet, not in the system's table
  • The negotiated bundle changes what you may charge separately, and billing follows the old rule
  • The check is a sample: you can look at a hundred lines, not six hundred thousand
  • The gap is small on each line — which is why nobody sees it, and why it lasts for years

What the agent does about it

  • Reads the registered contract and the billed line in the same pass, with nothing left to memory
  • Compares by effective date: the rule that applied on the day of care, not today's
  • Adds up the gap by line and by payer, and prints the parts next to the total
  • Checks the whole set, not a sample — line by line, bill by bill
  • Puts a number on the gap and hands the decision back to whoever negotiates

What comes out is a reading contracting and billing can look at together: how much each payer is leaving on the table per line, in percentage points against what was agreed.

Hal-AI · Gap against the agreed price Average per payer
Average gap per line between the agreed price and the billed price source: api_get_payer_contract × api_get_bill_items
The color is a suggestion, not a decision the agent separates what looks like catalog from what looks like contract Math shown per line every bar opens into the lines behind it, with code, contract and unit gap
What contracting asks
  • How much is this payer paying below what it signed?
  • Which lines concentrate the gap?
  • Is the March amendment already live in billing?
  • Which contract is worth reopening first?
What billing asks
  • Which lines will fall to the edits in this batch?
  • Which reference is out of date in the catalog?
  • What changed since the last review?
  • What is still open, and whose is it?

Both questions are asked in plain language to HAL Copilot, over the same data that feeds the dashboard. See how the dashboard is published

Review ritual

The same meeting you already have, with the math already done

This is not a new committee, and not one more report for someone to assemble the night before. The Squad wakes at the agreed time, redoes the period's check and publishes the review: what changed since the last one, what was fixed and what is still open. Then it emails billing, contracting and the board, on the authorized list.

What the review carries, always in the same order

  • What changed: new mismatches in the period, kept apart from the ones that were already there.
  • What was fixed: the line, who fixed it, and the cycle the fix started to apply.
  • What is still open: with the number of cycles that line has been open — this is usually where the meeting stops.
  • What stayed out of the conclusion: a contract with no amendment, a line with no record, a call that failed. Declared, never omitted.
  • The math in the open: every total arrives with its parts printed, so nobody has to trust the sum.

Because the structure is the same on every run, August's review compares with July's without anyone redoing the scope to line the two readings up.

Who does the work

A Squad, not a person with a deadline

A Squad is an orchestrator agent: it wakes at the scheduled time, queries the APIs, decides what belongs in the review, publishes the document in HTML and PDF and sends it to a closed recipient list. Every run is recorded, with a simulation mode and a stop button.

  • Runs on its own, at the agreed time, with nobody asking
  • Closed recipient list, checked before the send
  • An incomplete document is refused, not published half-done
  • Every figure in the email exists in the document

How Squads work

A review is only worth having if it turns into work. Every mismatch that survives the check becomes an item with a cause, an owner and a deadline — and it crosses the board until it closes.

Hal-AI · Compliance action plan Weekly plan · 6 items
Open2
High severity
Payer A · surgical tier below contract
table vs. contract312 lines
Cause: the percentage over the tier in the amendment in force was never replicated in the catalog.
Billing · due in 5 days Open
Blocks the conclusion
Payer F · amendment missing from the catalog
contractnot assessed
Cause: amendment signed in March and never published in the billing system.
Contracting · due in 3 days Open
Being fixed2
Payer B · supply on an old edition
billing vs. reference148 lines
Cause: catalog pointing at a previous edition of the supply table.
Billing · due tomorrow Being fixed
Payer C · drug presentation
billing vs. reference96 lines
Cause: unit splitting recorded under a presentation other than the agreed one.
Pharmacy · due in 7 days Being fixed
Waiting on the payer1
Payer D · lines recorded and not billed
care vs. billing61 lines
Cause: a disagreement over what sits inside the bundle.
Contracting · waiting for a reply On hold
Closed this cycle1
Payer E · room day inside a bundle
table vs. contract24 lines
Catalog fixed in the previous cycle. This week's review found no repeat.
Billing · closed Closed
Review published and sent weekly routine · billing, contracting and the board Sent 6 items in the action plan · 2 open · 2 being fixed · 1 waiting on the payer · 1 closed
Rendering of the tracking board. Payers anonymized.
1

A mismatch becomes an item

Every finding that survives the check gets a probable cause, an owner and a deadline. With no owner, a finding is just a complaint in the shape of a table.

2

The item crosses the board

Open, being fixed, waiting on the payer, closed. The agent moves the item when the data moves; deciding what to do about it stays with people.

3

The next review checks it

Whatever was called fixed is tested again in the following cycle. If it repeats, the item reopens with its history attached — and the cause recorded earlier becomes a question.

4

The meeting gets short

You arrive at the table with what changed, what closed and what is stuck, already ranked by money. Meeting time goes back to being decision time instead of fact-finding.

Transparency

What the agent does not do

Compliance is a subject where overpromising gets expensive. The limits are worth saying before the contract, not after.

It does not change contracts and does not negotiate with payers

It reads the registered contract, compares it with what was billed and shows the gap. Reopening a negotiation, accepting a number, repricing a line or changing commercial policy are hospital decisions, made by people with the mandate to make them. The agent never speaks to a payer on anyone's behalf.

It does not touch the patient chart and does not create clinical records

When a line shows up billed with no matching record, the agent names the evidence that is missing, sets the case aside for a person and leaves it out of the conclusion. It does not write in the chart, does not complete a note, and does not assume the procedure happened because the bill says so. A clinical record is an act of whoever delivered the care.

It gives no medical guidance and does not judge clinical decisions

Compliance here is administrative and contractual. The agent has no opinion on indication, does not debate clinical decisions and does not judge whether the procedure was the right one. It compares what was recorded, what was billed and what was agreed — nothing beyond that.

It does not close a number it could not check

A contract with no published amendment, a reference it could not read, an API call that failed: all of it comes out declared as not assessed, with the reason written down. The agent refuses an incomplete document instead of quietly completing it — and what it did not read never becomes “compliant”.

It does not work outside the scope it was given

Tools are declared one by one in the agent's configuration, with purpose and legal basis defined before the connection is made. What was not handed to it does not exist in its universe, and every run leaves an audit trail: what was queried, what was decided and what was written.

Integrations, LGPD (Brazil's data protection law) and the audit trail for the hospital section · Platform security controls

Questions

Questions from whoever owns the revenue cycle

Who keeps CBHPM, Simpro and Brasíndice up to date?

The reference arrives as an API call declared in the agent's configuration, with its effective dates attached. When an edition changes, the agent starts comparing against the new one from the date it applies, and whatever was billed before keeps being judged by the edition that applied that day. There is no spreadsheet for anyone to download, and no difference to type in.

If reading a reference fails, the agent records the failure and leaves those lines out of the conclusion. It never fills in what it could not read.

Can the agent fix the line on the bill and resend it by itself?

Not in the default configuration. The audit is its job: it flags the mismatch, names the evidence that is missing and writes the probable cause, leaving the line ready for correction — the bill is changed by billing, with the permission they already hold in the hospital's system. Write tools, where they exist, are declared one by one and fall under the same audit trail.

How does it know each payer's edit rules?

Three ways, all declared: the rules the payer publishes, loaded into the Knowledge Vault for that contract; that hospital's denial history with that payer, read by API; and whatever the previous review learned, when an edit nobody predicted happened and became a new rule from the next cycle onward.

That is why the simulation improves over time: the set of known rules grows with what the contract itself has already shown.

Does this replace the hospital's bill audit team?

The bill audit is its job: it reads the whole set against the clinical record, the reference and the contract, and hands back every line with the evidence that is missing and the probable cause, ranked by severity and by money. What changes is the desk: instead of checking a sample and spotting the pattern afterwards, it decides on findings that arrive finished. The decision on each case stays human — including the decision to disagree with what the agent flagged.

Does patient data show up anywhere in this process?

Not in the aggregate dashboard: the columns are payer, mismatch type, line, quantity and severity. The line-by-line check happens inside the access scope agreed in the contract, with purpose and legal basis defined before any connection is made, and every run leaves a record of what was queried, what was decided and what was written.

Bring us one billing cycle and we will show you where it leaks

With a closed period, the contracts registered and the references in force, we can design the check for your case — and show how much of what you bill sits below what you signed.