jaz-clio 3.0.0 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: api
3
- version: 3.0.0
3
+ version: 3.0.2
4
4
  description: Complete reference for the Jaz/Juan REST API — the accounting platform backend. Use this skill whenever building, modifying, debugging, or extending any code that calls the API — including API clients, integrations, data seeding, test data, or new endpoint work. Contains every field name, response shape, error, gotcha, and edge case discovered through live production testing.
5
5
  license: MIT
6
6
  compatibility: Requires Jaz/Juan API key (x-jk-api-key header). Works with Claude Code, Claude Cowork, Claude.ai, and any agent that reads markdown.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: conversion
3
- version: 3.0.0
3
+ version: 3.0.2
4
4
  description: Accounting data conversion skill — migrates customer data from Xero, QuickBooks, Sage, MYOB, and Excel exports to Jaz. Covers config, quick, and full conversion workflows, Excel parsing, CoA/contact/tax/items mapping, clearing accounts, TTB, and TB verification.
5
5
  ---
6
6
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: jobs
3
- version: 3.0.0
4
- description: 10 accounting jobs for SMB bookkeepers and accountants — month-end, quarter-end, and year-end close playbooks plus 7 ad-hoc operational jobs (bank recon, GST/VAT filing, payment runs, credit control, supplier recon, audit prep, fixed asset review). Each job is a step-by-step blueprint with API calls, recipe references, calculator commands, and verification checks. Paired with an interactive CLI blueprint generator (clio jobs).
3
+ version: 3.0.2
4
+ description: 10 accounting jobs for SMB bookkeepers and accountants — month-end, quarter-end, and year-end close playbooks plus 7 ad-hoc operational jobs (bank recon, GST/VAT filing, payment runs, credit control, supplier recon, audit prep, fixed asset review). Each job is a step-by-step blueprint with API calls, recipe references, calculator commands, and verification checks. Bank recon pairs with `clio calc bank-match` for automated pre-matching. Paired with an interactive CLI blueprint generator (clio jobs).
5
5
  license: MIT
6
6
  compatibility: Works with Claude Code, Claude Cowork, Claude.ai, and any agent that reads markdown. For API payloads, load the jaz-api skill. For individual transaction patterns, load the transaction-recipes skill.
7
7
  ---
@@ -79,7 +79,9 @@ Work through each unreconciled item. There are four resolution paths.
79
79
 
80
80
  The bank record matches an invoice payment, bill payment, or journal already in the books. This is the ideal case — the transaction exists, it just hasn't been linked to the bank record.
81
81
 
82
- **How to find the match:** Search cashflow transactions for the same amount and approximate date:
82
+ **For large volumes:** Use `clio calc bank-match --input data.json --json` to auto-match bank records to transactions before manual review. The calculator finds 1:1, N:1, 1:N, and N:M matches with confidence scores. See the [bank-match reference](../../transaction-recipes/references/bank-match.md) for input format and algorithm details.
83
+
84
+ **How to find the match manually:** Search cashflow transactions for the same amount and approximate date:
83
85
 
84
86
  ```
85
87
  POST /api/v1/cashflow-transactions/search
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: transaction-recipes
3
- version: 3.0.0
4
- description: 16 IFRS-compliant recipes for complex multi-step accounting in Jaz — prepaid amortization, deferred revenue, loan schedules, IFRS 16 leases, hire purchase, fixed deposits, asset disposal, FX revaluation, ECL provisioning, IAS 37 provisions, dividends, intercompany, and capital WIP. Each recipe includes journal entries, capsule structure, and verification steps. Paired with 10 financial calculators that produce execution-ready blueprints with workings.
3
+ version: 3.0.2
4
+ description: 16 IFRS-compliant recipes for complex multi-step accounting in Jaz — prepaid amortization, deferred revenue, loan schedules, IFRS 16 leases, hire purchase, fixed deposits, asset disposal, FX revaluation, ECL provisioning, IAS 37 provisions, dividends, intercompany, and capital WIP. Each recipe includes journal entries, capsule structure, and verification steps. Paired with 11 financial calculators (10 IFRS-compliant + bank reconciliation matcher) that produce execution-ready blueprints with workings.
5
5
  license: MIT
6
6
  compatibility: Works with Claude Code, Claude Cowork, Claude.ai, and any agent that reads markdown. For API payloads, load the jaz-api skill alongside this one.
7
7
  ---
@@ -117,6 +117,10 @@ Each recipe includes: scenario description, accounts involved, journal entries,
117
117
 
118
118
  16. **[Capital WIP to Fixed Asset](references/capital-wip.md)** — Cost accumulation in CIP account during construction/development, transfer to FA on completion, auto-depreciation via Jaz FA module.
119
119
 
120
+ ### Utility — Reconciliation
121
+
122
+ 17. **[Bank Reconciliation Matcher](references/bank-match.md)** — 5-phase cascade algorithm matching bank records to cashflow transactions. Finds 1:1, N:1, 1:N, and N:M matches with confidence scores. *Paired calculator: `clio calc bank-match`*
123
+
120
124
  ## How to Use These Recipes
121
125
 
122
126
  1. **Read the recipe** for your scenario — understand the accounts, journal entries, and capsule structure.
@@ -130,7 +134,7 @@ Each recipe includes: scenario description, accounts involved, journal entries,
130
134
 
131
135
  ## Financial Calculators (CLI)
132
136
 
133
- The `jaz-clio` includes 10 IFRS-compliant financial calculators. Each produces a formatted schedule + per-period journal entries + human-readable workings. Use `--json` for structured output with a complete **blueprint** — capsule type/name, tags, custom fields, workings (capsuleDescription), and every step with action type, date, accounts, and amounts.
137
+ The `jaz-clio` CLI includes 11 financial calculators (10 IFRS-compliant + bank reconciliation matcher). The IFRS calculators each produce a formatted schedule + per-period journal entries + human-readable workings. Use `--json` for structured output with a complete **blueprint** — capsule type/name, tags, custom fields, workings (capsuleDescription), and every step with action type, date, accounts, and amounts.
134
138
 
135
139
  All calculators support `--currency <code>` and `--json`.
136
140
 
@@ -173,6 +177,11 @@ clio calc ecl --current 100000 --30d 50000 --60d 20000 --90d 10000 --120d 5000 -
173
177
 
174
178
  # IAS 37 provision PV + discount unwinding schedule
175
179
  clio calc provision --amount 500000 --rate 4 --term 60 [--start-date 2025-01-01] [--currency SGD] [--json]
180
+
181
+ # ── Reconciliation Calculator ─────────────────────────────────
182
+
183
+ # Bank reconciliation matcher — 5-phase cascade (1:1, N:1, 1:N, N:M)
184
+ clio calc bank-match --input bank-data.json [--tolerance 0.01] [--date-window 14] [--max-group 5] [--json]
176
185
  ```
177
186
 
178
187
  ### Blueprint Output (`--json`)
@@ -0,0 +1,290 @@
1
+ # Bank Reconciliation Matcher
2
+
3
+ ## Scenario
4
+
5
+ Your company has 150 unreconciled bank records and 400 cashflow transactions in the books. Manually matching them by amount, date, and description takes hours. The bank-match calculator automates this — it runs a 5-phase cascade algorithm that finds 1:1, N:1, 1:N, and N:M matches with confidence scores, leaving only genuinely unmatched items for manual review.
6
+
7
+ **Pattern:** Utility calculator — produces match proposals for the bank reconciliation job
8
+
9
+ **When to use this calculator:**
10
+ - Bank reconciliation catch-up with a large backlog of unreconciled items
11
+ - Monthly recon where you want to pre-match before reviewing
12
+ - Automated reconciliation pipelines (use `--json` output)
13
+ - Investigating potential matches before committing them in Jaz
14
+
15
+ **When NOT to use this calculator:**
16
+ - Already reconciled — no unreconciled items to match
17
+ - Single-item matching — just search by amount and date manually
18
+ - Cross-entity matching — this operates within a single bank account
19
+
20
+ ---
21
+
22
+ ## Algorithm: 5-Phase Cascade
23
+
24
+ Each phase runs in order. Items matched in an earlier phase are removed from the pool before the next phase runs. This prevents double-matching.
25
+
26
+ ### Phase 0: Normalize & Index
27
+
28
+ Converts all amounts to integer cents (eliminates floating-point issues), computes day offsets from a reference date, normalizes contact names and descriptions to lowercase tokens. Builds lookup indexes for fast matching.
29
+
30
+ ### Phase 1: Exact 1:1 Hash Join
31
+
32
+ Finds perfect matches — same amount (to the cent), same contact name, same date. These are matched with `exact` confidence. Uses hash-based lookup for O(n) performance.
33
+
34
+ ### Phase 2: Fuzzy 1:1 Greedy Assignment
35
+
36
+ For remaining items, scores every bank record against every candidate transaction using a weighted composite score:
37
+
38
+ | Signal | Weight | How It Works |
39
+ |--------|--------|-------------|
40
+ | **Text** | 0.55 | Cross-field similarity between contact/reference/description fields |
41
+ | **Date** | 0.30 | Exponential decay with 5-day half-life (14-day window default) |
42
+ | **Type** | 0.15 | Occam's razor — prefers simpler match types (1:1 over N:1) |
43
+
44
+ Amount must be within tolerance (default: $0.01). Pairs are assigned greedily (best score first) with a regret check — if a candidate is significantly better for another bank record, it skips and lets the better pairing win. Threshold: score >= 0.70 for strong 1:1 match.
45
+
46
+ **Confidence mapping:**
47
+ - `exact` — perfect amount + contact + date (Phase 1 only)
48
+ - `high` — score >= 0.70
49
+ - `medium` — score >= 0.40
50
+ - `low` — score < 0.40
51
+
52
+ ### Phase 3: N:1 Subset-Sum (Multiple Transactions → One Bank Record)
53
+
54
+ A single bank record might represent several transactions batched together (e.g., a bank deposit covering 3 customer payments). This phase uses DFS with suffix-sum pruning to find subsets of transactions that sum to the bank record amount (within tolerance).
55
+
56
+ - Max subset size: configurable (default 5, max 10)
57
+ - Searches within same-direction candidates
58
+ - Scores the group using aggregate text similarity and average date proximity
59
+
60
+ ### Phase 4: 1:N Reverse Subset-Sum (Multiple Bank Records → One Transaction)
61
+
62
+ The reverse case — a single transaction might correspond to multiple bank records (e.g., a payment was split across bank entries). Same DFS algorithm, reversed: finds subsets of bank records that sum to a transaction amount.
63
+
64
+ ### Phase 5: N:M Two-Set Matching (Within Contact Groups)
65
+
66
+ For remaining unmatched items, groups bank records and transactions by contact name. Within each contact group, enumerates combinations where bank record subsets match transaction subsets (within tolerance). This catches complex split scenarios that Phases 3-4 miss.
67
+
68
+ ---
69
+
70
+ ## CLI Usage
71
+
72
+ ```bash
73
+ # From file
74
+ clio calc bank-match --input bank-data.json [--json]
75
+
76
+ # From stdin (pipe from API output)
77
+ cat bank-data.json | clio calc bank-match --json
78
+
79
+ # With options
80
+ clio calc bank-match --input data.json --tolerance 0.05 --date-window 7 --max-group 3 --currency SGD --json
81
+
82
+ # Analysis mode — all possible matches per record
83
+ clio calc bank-match --input data.json --find-all --json
84
+ ```
85
+
86
+ ### Options
87
+
88
+ | Option | Default | Description |
89
+ |--------|---------|-------------|
90
+ | `--input <file>` | stdin | JSON file with bank records + transactions |
91
+ | `--tolerance <amount>` | 0.01 | Amount tolerance in functional currency |
92
+ | `--date-window <days>` | 14 | Max days apart for matching candidates |
93
+ | `--max-group <k>` | 5 | Max subset size for N:1/1:N/N:M (max: 10) |
94
+ | `--currency <code>` | null | Functional/reporting currency label |
95
+ | `--find-all` | false | Return all possible matches per record (analysis mode) |
96
+ | `--json` | false | Output as structured JSON |
97
+
98
+ ---
99
+
100
+ ## Input Format
101
+
102
+ ```json
103
+ {
104
+ "bankRecords": [
105
+ {
106
+ "id": "BR-001",
107
+ "amount": 2500.00,
108
+ "date": "2025-01-15",
109
+ "contact": "Acme Corp",
110
+ "reference": "TRF-88812",
111
+ "description": "Payment for INV-001"
112
+ }
113
+ ],
114
+ "transactions": [
115
+ {
116
+ "id": "TXN-001",
117
+ "direction": "PAYIN",
118
+ "amount": 2500.00,
119
+ "date": "2025-01-14",
120
+ "contact": "Acme Corporation",
121
+ "reference": "INV-001",
122
+ "type": "INVOICE_PAYMENT"
123
+ }
124
+ ],
125
+ "options": {
126
+ "tolerance": 0.01,
127
+ "dateWindowDays": 14,
128
+ "maxGroupSize": 5,
129
+ "currency": "SGD"
130
+ }
131
+ }
132
+ ```
133
+
134
+ ### Bank Record Fields
135
+
136
+ | Field | Required | Description |
137
+ |-------|----------|-------------|
138
+ | `id` | Yes | Unique identifier (bank record resourceId) |
139
+ | `amount` | Yes | Signed amount (positive = cash-in, negative = cash-out) |
140
+ | `date` | Yes | Value date (YYYY-MM-DD) |
141
+ | `contact` | No | Counterparty name from bank feed |
142
+ | `reference` | No | Bank reference / description |
143
+ | `description` | No | Additional description text |
144
+ | `currency` | No | Transaction currency (for cross-currency matching) |
145
+
146
+ ### Cashflow Transaction Fields
147
+
148
+ | Field | Required | Description |
149
+ |-------|----------|-------------|
150
+ | `id` | Yes | Unique identifier (cashflow transaction resourceId) |
151
+ | `direction` | Yes | `PAYIN` (cash-in) or `PAYOUT` (cash-out) |
152
+ | `amount` | Yes | Absolute amount (always positive — direction indicates sign) |
153
+ | `date` | Yes | Value date (YYYY-MM-DD) |
154
+ | `contact` | No | Contact name from Jaz |
155
+ | `reference` | No | Document reference (e.g., INV-001) |
156
+ | `type` | No | Transaction type (e.g., INVOICE_PAYMENT, BILL_PAYMENT) |
157
+ | `currency` | No | Transaction currency |
158
+ | `crossCurrency` | No | True if this is a cross-currency transaction |
159
+
160
+ ---
161
+
162
+ ## Output Format (`--json`)
163
+
164
+ ```json
165
+ {
166
+ "type": "bank-match",
167
+ "currency": "SGD",
168
+ "inputs": {
169
+ "recordCount": 150,
170
+ "transactionCount": 400,
171
+ "tolerance": 0.01,
172
+ "dateWindowDays": 14,
173
+ "maxGroupSize": 5
174
+ },
175
+ "matches": [
176
+ {
177
+ "matchType": "1:1",
178
+ "confidence": "exact",
179
+ "score": 1.0,
180
+ "bankRecords": [{ "id": "BR-001", "amount": 2500.00, "date": "2025-01-15" }],
181
+ "transactions": [{ "id": "TXN-001", "amount": 2500.00, "date": "2025-01-14" }],
182
+ "bankTotal": 2500.00,
183
+ "transactionTotal": 2500.00,
184
+ "variance": 0.00,
185
+ "signals": { "text": 0.85, "date": 0.92, "type": 1.00 },
186
+ "reason": "Exact: amount $2,500.00, contact 'Acme Corp', date 2025-01-15"
187
+ }
188
+ ],
189
+ "unmatchedRecords": [],
190
+ "unmatchedTransactions": [],
191
+ "summary": {
192
+ "totalRecords": 150,
193
+ "totalTransactions": 400,
194
+ "matched1to1": 120,
195
+ "matchedNto1": 15,
196
+ "matched1toN": 5,
197
+ "matchedNtoM": 2,
198
+ "unmatchedRecordCount": 8,
199
+ "unmatchedTransactionCount": 42,
200
+ "matchRate": 0.947,
201
+ "totalMatchedAmount": 485000.00,
202
+ "totalUnmatchedAmount": 12500.00
203
+ },
204
+ "timing": {
205
+ "phase0Ms": 2,
206
+ "phase1Ms": 1,
207
+ "phase2Ms": 8,
208
+ "phase3Ms": 12,
209
+ "phase4Ms": 6,
210
+ "phase5Ms": 3,
211
+ "totalMs": 32
212
+ },
213
+ "workings": "Bank Match Workings\n..."
214
+ }
215
+ ```
216
+
217
+ ### Match Types
218
+
219
+ | Type | Meaning | Example |
220
+ |------|---------|---------|
221
+ | `1:1` | One bank record matches one transaction | Single invoice payment |
222
+ | `N:1` | Multiple transactions match one bank record | Batch deposit (3 payments in 1 bank entry) |
223
+ | `1:N` | Multiple bank records match one transaction | Split payment (1 payment across 2 bank entries) |
224
+ | `N:M` | Multiple bank records match multiple transactions | Complex group match within a contact |
225
+
226
+ ---
227
+
228
+ ## Worked Example
229
+
230
+ **Setup:** A Singapore company reconciling their DBS Current account for January 2025. They have 5 unreconciled bank records and 8 cashflow transactions.
231
+
232
+ **Input (bank records):**
233
+ - BR-001: +$2,500.00 on Jan 15, "Acme Corp — TRF"
234
+ - BR-002: -$800.00 on Jan 18, "Office Supplies"
235
+ - BR-003: +$5,200.00 on Jan 20, "CustomerX batch payment"
236
+ - BR-004: -$25.00 on Jan 31, "Monthly service charge"
237
+ - BR-005: +$3,000.00 on Jan 22, "CustomerY"
238
+
239
+ **Input (transactions):**
240
+ - TXN-001: PAYIN $2,500.00 on Jan 14, contact "Acme Corporation", ref "INV-001"
241
+ - TXN-002: PAYOUT $800.00 on Jan 17, contact "Staples SG", ref "BILL-015"
242
+ - TXN-003: PAYIN $2,200.00 on Jan 19, contact "CustomerX Pte Ltd", ref "INV-010"
243
+ - TXN-004: PAYIN $3,000.00 on Jan 19, contact "CustomerX Pte Ltd", ref "INV-011"
244
+ - TXN-005: PAYIN $3,000.00 on Jan 21, contact "CustomerY Ltd", ref "INV-020"
245
+
246
+ **Results:**
247
+
248
+ | Match | Type | Confidence | Bank | Txn | Reason |
249
+ |-------|------|-----------|------|-----|--------|
250
+ | 1 | 1:1 | exact | BR-001 ($2,500) | TXN-001 ($2,500) | Amount + contact match |
251
+ | 2 | 1:1 | high | BR-002 ($800) | TXN-002 ($800) | Amount match, date 1 day apart |
252
+ | 3 | N:1 | high | BR-003 ($5,200) | TXN-003 + TXN-004 ($2,200 + $3,000) | Batch deposit: 2 invoices = 1 bank entry |
253
+ | 4 | 1:1 | high | BR-005 ($3,000) | TXN-005 ($3,000) | Amount + contact match |
254
+
255
+ **Unmatched:** BR-004 ($25 service charge) — no transaction in books. Create a cash-out journal for bank fees.
256
+
257
+ **Match rate:** 80% of records matched (4/5), 80% of matched amount.
258
+
259
+ ---
260
+
261
+ ## Cross-Currency Matching
262
+
263
+ When bank records and transactions are in different currencies, the calculator applies a wider tolerance based on FX variance:
264
+
265
+ - Default FX tolerance: 5% of the amount (`fxTolerancePct: 0.05`)
266
+ - Transactions flagged with `crossCurrency: true` get the wider tolerance
267
+ - If `exchangeRates` are provided in options, the calculator converts to functional currency for comparison
268
+
269
+ ```json
270
+ {
271
+ "options": {
272
+ "currency": "SGD",
273
+ "exchangeRates": { "USD": 1.35, "EUR": 1.45 },
274
+ "fxTolerancePct": 0.05
275
+ }
276
+ }
277
+ ```
278
+
279
+ ---
280
+
281
+ ## Integration with Bank Recon Job
282
+
283
+ This calculator is designed to work as a pre-matching step in the `clio jobs bank-recon` workflow:
284
+
285
+ 1. **Pull data:** Fetch unreconciled bank records + cashflow transactions from Jaz API
286
+ 2. **Run matcher:** `clio calc bank-match --input data.json --json`
287
+ 3. **Review matches:** High/exact confidence matches can be auto-reconciled; medium/low need manual review
288
+ 4. **Resolve unmatched:** Use Path B/C/D from the bank recon job for remaining items
289
+
290
+ **Performance:** <50ms for 500 records x 2,000 transactions. Scales linearly for Phases 0-2, exponentially bounded for Phases 3-5 (controlled by `--max-group`).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jaz-clio",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "Clio — Command Line Interface Orchestrator for Jaz AI",
5
5
  "type": "module",
6
6
  "bin": {