# AI coding memory, new vendors and suggested rules

> How the bank triage looks up a vendor it has never seen, remembers how you code each counterparty, applies reusable coding skills, explains a code with similar past transactions, proposes rules you edit before they act, writes transactions from plain language or documents, and closes a short-paid invoice with the shortfall written off.

Source: /help/en/bank/ai-coding-memory-and-suggested-rules

The bank triage of Phase C proposed a booking for every new line. Milestone D5 gives it a memory and a few agents around it. Nothing here posts by itself: every item below is a proposal a person confirms, and every write the agents make is a change batch you can undo from Compliance → Batches.

## 1. New vendors and the Uncertain bucket (F-CATEG-002)

When a new bank line names a counterparty with **no contact, no alias and no memory**, Classify now looks it up before it proposes: the shared cache first, then the web (with the AI add-on; without it a built-in list of UAE vendors such as DEWA, Etisalat, du, ADNOC, Salik, Careem, Amazon.ae, Talabat and Emirates NBD answers). The answer is the vendor's display name, website, category and a suggested account family, with a confidence.

- **New vendors**: the lookup answered. The proposal carries the account from the suggested family and the contact to create; the line shows the website and the category. Confirming creates the contact through the counterparty resolver (one alias per statement spelling) and posts as usual.
- **Uncertain**: the lookup found nothing, or was not sure. Pick the account and the counterparty yourself; the line stays in this bucket until you do.

Bank → **Look up** on any line repeats the lookup (`POST /bank/vendors/lookup`, MCP `lookup_vendor`). Answers are kept in `vendor_lookups`; a web answer is shared across organisations, your own decisions never are.

## 2. Client memory and coding skills (F-CATEG-016)

**Memory is per client file.** Every proposal you confirm, every line you categorise and every bill or expense the Composer creates writes `client_memory`: the vendor (or customer, or description) key, the account, the VAT category and the dimensions, with a confidence of 0.95 that wins over every pattern and every skill. Settings → Accounting → **Coding skills and memory** → Memory lists it; **Clear memory** empties it (the next decisions rebuild it).

**Skills are procedures.** A skill is a named list of mappings: *vendor contains "ejari" → 6100 Rent, VAT O*, *description contains "salik" → 6220*. Save one from Settings → Accounting → Coding skills and memory → **New skill**, or let the assistant write one. Scopes:

| Scope | Who writes it | Who reads it |
|---|---|---|
| Firm | A firm, for every client it manages | The firm and each client (read only) |
| This client | The client file | The client file |
| Only me | A member, for their own work | That member |

A client cannot edit a firm skill: **Fork for this client** copies it (the copy remembers its origin and version) and the client edits the copy. The assistant (D4) and the agents read the skills as procedures in their prompt and name the skill in the proposal's reason.

**When you choose differently.** A proposal that came from a skill carries the skill's account. Confirm it with another account and the triage shows **The skill says otherwise** with two buttons: **Update the skill** changes the mapping (version + 1; a firm skill is forked for the client first) or **Only this client** keeps your choice in memory and leaves the skill alone. Open divergences wait in the banner and in the settings card until decided (`POST /coding-memory/decide`).

## 3. Why this code (F-CATEG-017)

Beside every proposal, **Why this code?** opens a popover with where the code came from (memory, a skill, a lookup or the provider's reason) and the **similar transactions**: past bank lines, bills and expenses that look like this one by payee and description (trigram similarity) and amount closeness, each with how it was coded, who decided it and when, and a link. The same list is the MCP tool `find_similar_transactions` and `GET /transactions/similar?payee=&description=&amount=`, so the assistant and an agent justify a code the way you would.

## 4. Suggested rules you edit before they act (F-CATEG-004)

Three or more lines of one vendor key booked the same way, or a run of confirmed proposals, make the provider suggest a rule. Bank → Rules → **Suggested rules** shows each suggestion with the **pattern** behind it: the lines and the field each condition came from. Three choices:

- **Create rule**: the rule is created as the provider wrote it (never applied by itself; a rule proposes, you confirm).
- **Edit before accepting**: the rule editor opens with the suggestion's name, conditions and actions, and a **preview of the lines it would hit today**; save creates the rule from the edited suggestion.
- **Dismiss and never suggest again**: the vendor key is remembered in `rule_suggestion_dismissals`; the next run skips it. The list of never-again keys sits under the suggestions with **Allow again**.

## 5. From text or document: the Composer (F-CATEG-014)

Journals, Bills and Expenses have **From text or document**. Type what happened, one transaction per sentence, or attach documents from the hub (a multi-invoice PDF becomes several bills). The provider answers **drafts** (journal entries, bills, expenses, invoices, deposits, credit notes), each with a confidence and a reason, and **questions** when a figure, a date or a party is missing; answer them and draft again.

```
rent AED 60,000 for 12 months from 1 Jan, paid from Emirates NBD
bill from Gulf Supplies 2,500 for stationery on 2026-03-05
expense 120 taxi Careem
```

The first sentence becomes a balanced entry (debit 1330 Prepaid expenses, credit 1100 the bank) with a **schedule proposal** (a 12-month prepaid you confirm on the Schedules page); the second a bill coded the way this vendor was coded before; the third an expense. **Preview** on a draft shows the D2 change preview (items, period impact, warnings) before anything is written. **Confirm** posts the drafts through their own functions as **one change batch** (undo it from Compliance → Batches). Invoices and credit notes open in the invoice editor instead, because validation lives there. The assistant uses the same method: ask it to "draft a bill from Gulf Supplies for 2,500" and approve the card.

Without the AI add-on a deterministic parser handles the sentences above and documents with readable text; scanned PDFs need the model.

**Start from a past transaction or a skill.** Under the text, **Or start from a past transaction** lists your ten most recent posted entries: tick one or more and each becomes a draft with the same accounts, VAT and dimensions (a draft marked *Copied from a past transaction*). With one entry ticked, the sentence above sets the amount and the date (*same again for 2,500 on 2026-04-01*): the lines scale and the draft is dated as you wrote. Choose a **Coding skill** and its mappings code the sentences they match (*Coded by a skill*): the account, the VAT and the class, department and location of the mapping. Over the API and the assistant the same call takes `sourceTransactionIds` (bank lines, journal entries or bills) and `skillId`.

## 6. The short-payment agent (F-AR-004)

A customer wires 990 against an invoice of 1,000: their bank kept 10. Settings → Accounting → **Short payments** sets a **tolerance** (an amount, a percent of the open amount, or both; zero keeps the agent off), the **write-off account** (default: the bank charges account) and what happens when a short receipt is matched:

- **Ask** (default): Classify now puts a proposal in the Matches group naming the invoice, the shortfall and the account. Confirm it and the invoice is settled in full: the payment books 1,000 against the receivable, 990 to the bank and 10 to the write-off account (the fee leg of a payment).
- **Auto**: the match books by itself.

Either way the write-off is a **change batch** (tool `short_payment_agent`, kind agent) with an audit row; **undo** from Compliance → Batches reopens the invoice and unmatches the line. A receipt short by more than the tolerance is left alone: record a partial payment or raise the tolerance. Over the API, `POST /bank/transactions/{id}/match` with an amount above the receipt is refused with `short_payment_over_tolerance` when the shortfall exceeds the tolerance.

## 7. In the API and the MCP server

| What | REST | MCP tool |
|---|---|---|
| Look up a vendor | `POST /bank/vendors/lookup` | `lookup_vendor` |
| Similar transactions | `GET /transactions/similar` | `find_similar_transactions` |
| Suggested rules | `PATCH /bank/rule-suggestions/{id}`, `POST …/dismiss {forever}`, `POST /bank/rule-suggestions/preview` | `list_categorisation_rules` and the app |
| Skills | `GET/POST/PATCH/DELETE /coding-skills`, `POST /coding-skills/{id}/fork` | `list_coding_skills`, `save_coding_skill`, `fork_coding_skill` |
| Memory | `GET /coding-memory`, `DELETE /coding-memory`, `POST /coding-memory/decide` | `list_coding_memory` |
| Composer | `POST /compose` (drafts), `POST /compose/apply` | `compose_transactions` (preview), `apply_composed_drafts` |
| Short payments | `POST /bank/short-payments/propose`, `PATCH /ledger/settings {shortPayment}` | `update_ledger_settings` |

Every call runs as you under row-level security, every write is a batch, and every refusal names its code and the next step. Detected schedules have their own section in [Prepaids, accruals and loans](/help/en/accounting/prepaids-accruals-and-loans).

## Walkthrough

1. Settings → Accounting → Short payments: tolerance 25 AED and 5 %, account 6330, mode Ask. Save.
2. Bank: import a statement with a Salik top-up, a line from a vendor nobody knows and a receipt 10 AED short of an open invoice. **Classify now**.
3. Read the New vendors bucket (Salik with its website), the Uncertain bucket, and the short-payment proposal in Matches. Open **Why this code?** on Salik.
4. Confirm Salik: the contact is created. Settings → Coding skills and memory → Memory shows the key.
5. New skill "Client coding": vendor contains "zqx" → 6130. Import another ZQX line, confirm it with 6110, and decide **Update the skill**; the skill is now version 2.
6. Bank → Rules: open a suggestion's pattern, **Edit before accepting**, read the preview, save. Dismiss another **never again**.
7. Journals → **From text or document**: paste the rent sentence, Draft, Preview, **Confirm**; open Compliance → Batches and undo it, then Schedules → Proposals.
8. Post the short-payment proposal; open the batch it created and undo it: the invoice is open again.
9. Journals → **From text or document** again: tick the rent entry under **Or start from a past transaction**, type *same again for 2,500 on 2026-04-01*, Draft: one draft marked *Copied from a past transaction*, 2,500 on the same accounts, dated 1 April. Choose the skill *Client coding*, type *bill from ZQX Holdings 1,000 for stationery*, Draft: the bill is coded 6130 and marked *Coded by a skill*.
10. Settings → Coding skills and memory: give the ZQX mapping a class. Import a ZQX line and **Classify now**: the proposal shows the class chip under the account; confirm it and the memory keeps the class.
