Learning page

How the AI works

LedgerGuard uses Claude for judgement: reading tone, choosing the next step, ranking evidence, turning questions into filters. Anything involving money, thresholds or sending is handled by plain code and by you. The model proposes; code bounds it; you approve.

Claude decidesCode enforcesYou decidePayPal call

1. Invoice chaser

  1. Code enforcesGather context

    Amount, due date, days overdue, country, past payment speed, recent client messages.

  2. Claude decidesChoose the next action

    Wait, remind, offer a split, offer Pay Later, or escalate, plus a tone and a suggested fee %.

  3. Code enforcesApply guardrails

    Cap the fee at 1.5% (7+ days only), drop it for split or Pay Later, block escalation before 14 days, compute exact amounts.

  4. Claude decidesWrite the draft

    Claude writes the email using only the figures code gave it.

  5. You decideApprove or ignore

    Approving marks the draft; you copy and send it yourself. Paid invoices cancel pending drafts.

Late fee by days overdue (what code allows, whatever the model suggests)
Fee is 0% before 7 days overdue, up to 1.5% from 7 days; escalation allowed from 14 days.0% fee≤ 1.5% fee≤ 1.5% · escalation allowed07 days14 daysdays overdue →

Split example: USD 1,450.00 → USD 725.00 now + USD 725.00 within 14 days, no fee.

2. Dispute defense

  1. PayPalDispute arrives

    CUSTOMER.DISPUTE.CREATED webhook, or Sync reads /v1/customer/disputes.

  2. Code enforcesSearch evidence

    Full-text search over that client's contracts, milestones, delivery notes and messages.

  3. Claude decidesRank evidence, flag gaps

    Claude scores relevance; code keeps only real ids and clamps scores to 0–1.

  4. Claude decidesDraft the statement

    A short factual response that cites evidence ids in brackets.

  5. You decideApprove & submit

    Only this click calls provide-evidence, and a second submission is refused.

3. Ask the ledger

You ask

“past-due invoices over $1000”

Claude fills a schema
{"conditions":[
 {"field":"status","op":"in","value":["due","overdue_3","overdue_7"]},
 {"field":"amount","op":"gt","value":1000},
 {"field":"currency","op":"eq","value":"USD"}]}
Code validates & sums

Allow-listed fields and ops only. Rows filtered, totals computed per currency. No SQL is ever generated.

Allowed fields: number, client, country, currency, status, amount, days_overdue, issue_date, due_date, paid_at. Up to 10 conditions.

The guardrails, in plain words

Late fee cap

At most 1.5% of the invoice, and only from 7+ days overdue. The fee amount is computed by code, never written by the model.

No fee with flexibility

If the action is a split payment or Pay Later, any fee is dropped.

Escalation threshold

Escalation is allowed only from 14+ days overdue; earlier it becomes a plain reminder.

Before the due date

No firm tone, no split, Pay Later or escalation; only a friendly reminder.

Exact split math

Two installments: first = amount ÷ 2 rounded to cents, second = amount − first, so they always sum to the total.

Draft check

A draft that mentions a fee the policy removed is replaced with a safe template.

Evidence ids

Ranked evidence must use ids that exist; relevance scores are clamped to 0–1.

Ledger filters

Questions become a JSON filter checked against an allow-list of fields and operators. Never SQL. Invalid output falls back to a rule parser.

Human approval

Reminders stay drafts. Evidence goes to PayPal only after Approve and confirm, and only once.

Open the demo Back to overview