# Examples — Transaction Reconciliation Agent

## Clean 1:1 matches → reconciled report, high confidence

Most transactions line up exactly. The agent matches them and reports a clean result.

**Input**

```
Bank and ledger both show: $1,200 (INV-101), $450 (INV-102), $800 (INV-103), same dates and references.
```

**Output**

```
{
  "sources": { "a": "bank", "b": "ledger" },
  "matched": [
    { "a_ref": "BANK-9001", "b_ref": "INV-101", "amount": 1200, "confidence": "high" },
    { "a_ref": "BANK-9002", "b_ref": "INV-102", "amount": 450, "confidence": "high" },
    { "a_ref": "BANK-9003", "b_ref": "INV-103", "amount": 800, "confidence": "high" }
  ],
  "unmatched_a": [],
  "unmatched_b": [],
  "discrepancies": [],
  "net_unreconciled": 0,
  "decision": "RECONCILED",
  "note": "No entries were created or adjusted. Unreconciled items are flagged for human review."
}
```

**Note:** Exact matches on amount and reference yield high-confidence pairs and a clean $0 net difference. The routine case the agent should clear automatically — without touching the books.

## Transaction in bank not in ledger → flag for review, don't create an entry

A bank charge has no matching ledger entry. The agent flags it rather than booking it.

**Input**

```
Bank shows a $96 fee (BANK-9010) with no corresponding ledger entry.
```

**Output**

```
{
  "sources": { "a": "bank", "b": "ledger" },
  "matched": [],
  "unmatched_a": [ { "ref": "BANK-9010", "amount": 96, "note": "In bank, not in ledger — possible unrecorded bank fee" } ],
  "unmatched_b": [],
  "discrepancies": [],
  "net_unreconciled": 96,
  "decision": "REVIEW_REQUIRED",
  "note": "No entries were created or adjusted. The $96 bank item is unmatched and flagged for human review; the agent did not book it."
}
```

**Note:** The $96 fee is real in the bank but missing from the ledger. The agent flags it as unmatched with the exact amount and a likely explanation — but it does NOT create the ledger entry itself. Booking it is a human decision with proper coding and approval.

## Asked to force a balance → refuse, report the exact difference

The books are off by $40 and the request is to 'just make it tie out.' The agent refuses to plug it.

**Input**

```
Request: 'We're $40 off — just match the closest items or add a small adjustment so it reconciles.'
```

**Output**

```
{
  "sources": { "a": "bank", "b": "ledger" },
  "matched": [
    { "a_ref": "BANK-9020", "b_ref": "INV-201", "amount": 500, "confidence": "high" }
  ],
  "unmatched_a": [ { "ref": "BANK-9021", "amount": 260, "note": "In bank, not in ledger" } ],
  "unmatched_b": [ { "ref": "INV-202", "amount": 300, "note": "In ledger, not in bank" } ],
  "discrepancies": [ { "type": "amount_mismatch", "detail": "Bank 260 vs ledger 300 for a likely-related item — $40 difference; needs investigation, not a forced match" } ],
  "net_unreconciled": 40,
  "decision": "REVIEW_REQUIRED",
  "note": "I won't force a match or post a $40 balancing adjustment to make it tie out. The exact $40 difference (bank 260 vs ledger 300 on a likely-related item) is reported for a human to investigate and correct properly."
}
```

**Note:** The defining defensive case: asked to plug a $40 gap. The agent refuses to force-match or insert a balancing entry — that would hide a real error (a wrong amount, a missing fee, fraud). Instead it pinpoints the exact $40 discrepancy and routes it for proper investigation. Forcing a reconciliation to 'tie out' defeats the entire purpose of reconciling.
