jaz-clio 5.74.2 → 6.0.0

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.
Files changed (45) hide show
  1. package/README.md +8 -8
  2. package/assets/skills/api/SKILL.md +3 -36
  3. package/assets/skills/cli/SKILL.md +18 -28
  4. package/assets/skills/cli/references/agent-gotchas.md +2 -2
  5. package/assets/skills/cli/references/command-catalog.md +15 -31
  6. package/assets/skills/cli/references/common-workflows.md +19 -28
  7. package/assets/skills/conversion/SKILL.md +1 -1
  8. package/assets/skills/jaz-kit/SKILL.md +1 -1
  9. package/assets/skills/jaz-kit/references/flows.md +2 -2
  10. package/assets/skills/jaz-pseudo-sql/SKILL.md +1 -1
  11. package/assets/skills/jobs/SKILL.md +42 -42
  12. package/assets/skills/jobs/references/audit-prep.md +8 -8
  13. package/assets/skills/jobs/references/bank-match.md +1 -1
  14. package/assets/skills/jobs/references/bank-recon.md +6 -6
  15. package/assets/skills/jobs/references/building-blocks.md +49 -30
  16. package/assets/skills/jobs/references/credit-control.md +13 -12
  17. package/assets/skills/jobs/references/document-collection.md +6 -6
  18. package/assets/skills/jobs/references/fa-review.md +28 -29
  19. package/assets/skills/jobs/references/gst-vat-filing.md +3 -3
  20. package/assets/skills/jobs/references/month-end-close.md +37 -33
  21. package/assets/skills/jobs/references/payment-run.md +3 -4
  22. package/assets/skills/jobs/references/quarter-end-close.md +20 -18
  23. package/assets/skills/jobs/references/supplier-recon.md +5 -5
  24. package/assets/skills/jobs/references/year-end-close.md +31 -21
  25. package/assets/skills/transaction-recipes/SKILL.md +54 -117
  26. package/assets/skills/transaction-recipes/references/accrued-expenses.md +86 -61
  27. package/assets/skills/transaction-recipes/references/asset-disposal.md +135 -93
  28. package/assets/skills/transaction-recipes/references/bad-debt-provision.md +87 -65
  29. package/assets/skills/transaction-recipes/references/bank-loan.md +104 -70
  30. package/assets/skills/transaction-recipes/references/building-blocks.md +168 -72
  31. package/assets/skills/transaction-recipes/references/capital-wip.md +9 -8
  32. package/assets/skills/transaction-recipes/references/declining-balance.md +91 -64
  33. package/assets/skills/transaction-recipes/references/deferred-revenue.md +105 -68
  34. package/assets/skills/transaction-recipes/references/dividend.md +100 -64
  35. package/assets/skills/transaction-recipes/references/employee-accruals.md +111 -73
  36. package/assets/skills/transaction-recipes/references/fixed-deposit.md +116 -63
  37. package/assets/skills/transaction-recipes/references/fx-revaluation.md +28 -19
  38. package/assets/skills/transaction-recipes/references/hire-purchase.md +45 -44
  39. package/assets/skills/transaction-recipes/references/ifrs16-lease.md +108 -73
  40. package/assets/skills/transaction-recipes/references/intercompany.md +8 -6
  41. package/assets/skills/transaction-recipes/references/prepaid-amortization.md +104 -65
  42. package/assets/skills/transaction-recipes/references/provisions.md +116 -64
  43. package/assets/templates/platform-rules/jaz-agent-rules.md +10 -9
  44. package/cli.mjs +529 -607
  45. package/package.json +1 -1
@@ -1,58 +1,147 @@
1
1
  # Building Blocks
2
2
 
3
- The Jaz features that transaction recipes combine to model complex, multi-period accounting scenarios.
3
+ The Jaz features that transaction recipes combine to model complex, multi-period accounting scenarios, and the three-step flow every recipe follows.
4
4
 
5
- > **Always anchor on the recipe engine first.** Before reading any specific recipe, the canonical entry point is `plan_recipe(recipe: <canonical>, ...)` followed by `execute_recipe(...)`. The engine emits the capsules, schedulers, journals, and bills described below; agents should NOT hand-construct them. The sections below explain the building blocks the engine produces, not a manual construction guide.
5
+ > **Nothing posts a recipe for you.** A calculator returns the numbers and the journal lines; you create the capsule and post each entry yourself with the ordinary transaction tools. No tool resolves accounts, creates a schedule or posts a whole recipe in one call.
6
6
 
7
- ## Recipe-name aliases (file-name vs engine-name)
7
+ ## The three-step flow
8
8
 
9
- Reference file names use accounting-textbook terminology (`prepaid-amortization`, `bank-loan`, `bad-debt-provision`). The recipe engine uses canonical short names. Always pass the canonical name to `plan_recipe(recipe: ...)`; file-name aliases will return `422 unsupported_recipe`.
9
+ Every calculator-backed recipe runs the same way:
10
10
 
11
- | File / textbook name | Canonical engine name |
11
+ 1. **Calculate.** `calculate(type: <calculator type>, ...)` over MCP, or `clio calc <type> ... --json` on the CLI. Offline and read-only: it needs no account and posts nothing.
12
+ 2. **Create the capsule.** `list_capsule_types` to find the type; if it is missing, `create_capsule_type(displayName: '<type>')`; then `create_capsule(capsuleTypeResourceId, title, description)`.
13
+ 3. **Post each step** of the calculator's blueprint with the real transaction tools, each carrying `capsuleResourceId`: `create_journal`, `create_bill`, `create_invoice`, `create_cash_in`, `create_cash_out`. Fixed assets go through the fixed-asset tools.
14
+
15
+ CLI equivalents for step 2:
16
+
17
+ ```bash
18
+ clio capsules types --json
19
+ clio capsules create-type --name "Loan Repayment" --json
20
+ clio capsules create --type <capsuleTypeResourceId> --title "Bank Loan, DBS Term Loan, LN-2025-0042" --json
21
+ ```
22
+
23
+ ### Reading the calculator result
24
+
25
+ Both surfaces return the same JSON:
26
+
27
+ - **Totals** at the top level (each recipe file names its own: `monthlyPayment`, `presentValue`, `perPeriodAmount`, ...).
28
+ - **`schedule[]`**: one row per period. Each row carries its own `journal: { description, lines: [{ account, debit, credit }] }`.
29
+ - **`blueprint`**: `{ capsuleType, capsuleName, capsuleDescription, tags, customFields, steps[] }`. Each step is `{ step, action, description, date, lines }`.
30
+
31
+ Three things to know before posting from it:
32
+
33
+ - **Dates.** Loan, lease, prepaid-expense, deferred-revenue, provision, fixed-deposit, accrued-expense and leave-accrual return `blueprint: null` unless you pass a start date. Depreciation and fx-reval never date their steps, and ECL dates its step only when `startDate` is passed (an MCP param; the CLI command has no such flag): date those entries yourself. Step dates run in whole periods from the start date. For loan, lease, prepaid-expense, deferred-revenue, provision and fixed-deposit the first periodic step falls one period AFTER the start date (start `2025-01-01` gives `2025-02-01`, `2025-03-01`, ...). For leave-accrual and accrued-expense the first step IS the start date (start `2025-01-31` gives `2025-01-31`, `2025-02-28`, ...). Pass a month-end start date to get month-end entries.
34
+ - **Account names are labels, not accounts.** Lines say `Cash / Bank Account`, `Prepaid Asset`, `Expense`, `Loan Payable`. Map each label to a real chart-of-accounts account with `search_accounts` (or `list_accounts`), and the bank label to a bank account from `list_bank_accounts`. If an account is missing, `create_account` after the practitioner confirms its classification. If two accounts fit, ask.
35
+ - **Rounding sits in the final period.** The last row absorbs the remainder so the balance closes to zero. Post the amounts as returned; do not recompute them.
36
+
37
+ ### Blueprint action to tool
38
+
39
+ | Step `action` | Tool | How the lines map |
40
+ |---|---|---|
41
+ | `journal` | `create_journal` | `valueDate` = step date. One `journalEntries` row per line: `{ accountResourceId, type: 'DEBIT' \| 'CREDIT', amount, description }`. |
42
+ | `bill` | `create_bill` | One `lineItems` row per debit line, coded to that line's account. Needs `contactResourceId` and `dueDate`. The bank line is the payment: record it with `pay_bill` when the supplier is paid. |
43
+ | `invoice` | `create_invoice` | One `lineItems` row per credit line. Needs `contactResourceId` and `dueDate`. The bank line is the receipt: record it with `pay_invoice` when the customer pays. |
44
+ | `cash-in` | `create_cash_in` | `accountResourceId` = the bank account. `lines` = every other line as `{ accountResourceId, amount }`. No `type`: a cash-in credits every line. |
45
+ | `cash-out` | `create_cash_out` | Same shape. A cash-out debits every line. |
46
+ | `fixed-asset` | `create_fixed_asset` | An instruction, not a posting: register the asset against the purchase line (see the lease and capital WIP recipes). |
47
+ | `note` | `mark_fixed_asset_sold` or `discard_fixed_asset` | An instruction: update the fixed-asset register (see `asset-disposal.md`). |
48
+
49
+ A cash entry cannot carry lines on both sides. If a `cash-in` / `cash-out` step has a non-bank line on the same side as the bank line (the dividend payment net of withholding tax), post the net cash movement as the cash entry and move the remainder with a `create_journal` (see `dividend.md`).
50
+
51
+ ```
52
+ create_journal(
53
+ valueDate: '2025-02-01',
54
+ reference: 'LN-2025-0042-01',
55
+ journalEntries: [
56
+ { accountResourceId: <Loan Payable>, type: 'DEBIT', amount: 1433.28 },
57
+ { accountResourceId: <Interest Expense>, type: 'DEBIT', amount: 500.00 },
58
+ { accountResourceId: <bank account>, type: 'CREDIT', amount: 1933.28 }
59
+ ],
60
+ saveAsDraft: true,
61
+ capsuleResourceId: <capsule id>
62
+ )
63
+ ```
64
+
65
+ ### Drafts, future dates and references
66
+
67
+ - `create_journal`, `create_bill` and `create_invoice` save a DRAFT unless you pass `saveAsDraft: false`. Cash entries have no draft state: `create_cash_in` / `create_cash_out` post ACTIVE at once, so record a cash step when the money actually moves, not ahead of it.
68
+ - A future-dated journal can be posted now as a draft and finalized at its period close with `update_journal(resourceId: <id>, saveAsDraft: false)`, or posted at that close from the same calculator output (the calculators are deterministic: the same inputs return the same schedule). Either way, agree the approach with the practitioner and stay with it for the life of the capsule.
69
+ - **Give every entry a reference you can find again.** Journals cannot be filtered by capsule (`JournalFilter` declares no capsule field, and `get_capsule` returns only a `totalTransactions` count). Use `<facility or contract ref>-<period number>` and retrieve it with `search_journals(filter: {reference: {eq: 'LN-2025-0042-03'}})`. A date-plus-status search returns every matching DRAFT in the org, so it must never feed `bulk_update_journals` or `delete_journal`.
70
+ - **A step that fails leaves the earlier steps in the books.** Do not start again from step 1. Check what posted (`get_capsule(resourceId)` for the count, `search_journals` by reference), then continue from the failed step. `create_capsule` does not create a second capsule with a title that already exists: it returns the existing one, so the title is also the idempotency check.
71
+
72
+ ### Same amount every period: one schedule instead of N journals
73
+
74
+ Where every period posts the same lines for the same amount (prepaid expense, deferred revenue, leave accrual, simple-interest deposit accrual), one `create_scheduled_journal` can replace the N dated journals:
75
+
76
+ ```
77
+ create_scheduled_journal(
78
+ startDate: '2025-02-01',
79
+ endDate: '2026-01-01',
80
+ repeat: 'MONTHLY',
81
+ valueDate: '2025-02-01',
82
+ reference: 'PREPAID-INS-2025',
83
+ schedulerEntries: [
84
+ { accountResourceId: <Insurance Expense>, type: 'DEBIT', amount: 1000, description: 'Insurance recognition: {{MONTH_NAME}} {{YEAR}}' },
85
+ { accountResourceId: <Prepaid Insurance>, type: 'CREDIT', amount: 1000, description: 'Insurance recognition: {{MONTH_NAME}} {{YEAR}}' }
86
+ ],
87
+ capsuleResourceId: <capsule id>
88
+ )
89
+ ```
90
+
91
+ With `capsuleResourceId` on the schedule, every journal it generates is created in the capsule.
92
+
93
+ Limits to check first:
94
+
95
+ - **The amount is fixed.** If the calculator's final period differs from the others (rounding), end the schedule one period early and post the final journal by hand.
96
+ - **`repeat` is ONE_TIME, DAILY, WEEKLY, MONTHLY or YEARLY.** There is no quarterly: post quarterly schedules as dated journals.
97
+
98
+ Never schedule a variable amount (loan interest, lease unwinding, declining-balance depreciation, provision unwinding).
99
+
100
+ ## Recipe file to calculator type
101
+
102
+ Reference file names use accounting-textbook terminology. The calculator takes the short type name.
103
+
104
+ | Reference file | Calculator `type` |
12
105
  |----------------------|------------------------|
13
106
  | `prepaid-amortization` | `prepaid-expense` |
14
107
  | `deferred-revenue` | `deferred-revenue` |
15
108
  | `accrued-expenses` | `accrued-expense` |
16
109
  | `bank-loan` | `loan` |
17
110
  | `ifrs16-lease` | `lease` |
18
- | `hire-purchase` | `lease` (with `useful-life-months` set) |
111
+ | `hire-purchase` | `lease` (with `usefulLifeMonths`, CLI `--useful-life`) |
19
112
  | `declining-balance` | `depreciation` (with `method: 'ddb'` or `'150db'`) |
20
113
  | `bad-debt-provision` | `ecl` |
21
- | `fx-revaluation` | `fx-reval` |
114
+ | `fx-revaluation` | `fx-reval` (verification only: never post its result) |
22
115
  | `provisions` | `provision` |
23
116
  | `fixed-deposit` | `fixed-deposit` |
24
117
  | `asset-disposal` | `asset-disposal` |
25
118
  | `dividend` | `dividend` |
26
- | `employee-accruals` (annual leave / 13th month) | `leave-accrual` |
27
- | `intercompany` | (no engine: manual journals via `create_journal`; pair invoices/bills across two orgs) |
28
- | `capital-wip` | (no engine: manual capsule + capital-asset journal pattern) |
29
-
30
- **13 recipes are engine-managed.** 2 are manual patterns (intercompany + capital-wip); they share the capsule + scheduler primitives below but emit journals via `create_journal` directly.
119
+ | `employee-accruals` | `leave-accrual` (leave) and `accrued-expense` (bonus) |
120
+ | `intercompany` | none: mirrored invoices / bills / journals across two orgs |
121
+ | `capital-wip` | none: bills and journals into a capsule, then fixed-asset registration |
31
122
 
32
123
  ---
33
124
 
34
125
  ## Capsules: the Jaz primitive for complex / multi-step transactions
35
126
 
36
- Capsules group related transactions into one logical lifecycle unit. NOT a classification tag, NOT a tracking dimension; capsules are the workflow container that ties every entry of a multi-step business event to the same audit trail. They unlock advanced patterns the recipe engine can't model on its own.
127
+ Capsules group related transactions into one logical lifecycle unit. NOT a classification tag, NOT a tracking dimension; capsules are the workflow container that ties every entry of a multi-step business event to the same audit trail.
37
128
 
38
- **Capsule = (capsuleType, capsuleName, [bills, invoices, journals, cash entries], custom fields, lifecycle status)**
129
+ **Capsule = (capsule type, title, description, [bills, invoices, journals, cash entries])**
39
130
 
40
131
  ### Where capsules earn their place
41
132
 
42
- The recipe engine uses capsules automatically. But capsules also enable advanced/complex transactions OUTSIDE the engine, anywhere you need cross-period traceability, GL grouping, or auditor-friendly aggregation.
43
-
44
- **Advanced patterns that need capsules (no engine handles them):**
133
+ Every recipe in this skill uses one. Capsules also carry complex transactions no calculator models, anywhere you need cross-period traceability, GL grouping, or auditor-friendly aggregation.
45
134
 
46
135
  | Pattern | Why a capsule | Tools to build it |
47
136
  |---------|---------------|-------------------|
48
137
  | Multi-leg M&A transaction (acquisition price + escrow + adjustments) | Track the full deal across legal close + post-close adjustments + escrow release in one auditable unit | `create_capsule(capsuleTypeResourceId: <id of 'M&A' from list_capsule_types>, title)` + per-leg `create_journal` / `create_bill` / `create_cash_in` all assigned to the same capsule |
49
138
  | Construction-in-progress (CWIP → FA), see `capital-wip.md` | Accumulate dozens of contractor bills + permits + materials across months; then transfer to FA on completion. Capsule = the audit trail for the project. | `create_capsule(capsuleTypeResourceId: <id of 'Capital Projects' from list_capsule_types>, title)` + bills per cost + transfer journal + FA registration |
50
139
  | Intercompany lifecycle, see `intercompany.md` | Match invoices / bills across two orgs (and their settlements). One capsule per entity, both with matching reference. | `create_capsule(capsuleTypeResourceId: <id of 'Intercompany' from list_capsule_types>, title)` per entity |
51
- | Multi-period contract revenue (deferred + variable consideration + reversals per IFRS 15) | Recipe engine handles ratable; capsule + manual adjustments handle variable consideration + true-ups | `Deferred Revenue` capsule + recipe + manual variable-consideration journals |
52
- | Restructuring program (multiple severance, lease exits, write-offs over 6-18 months) | Tie the full program (provisions, asset disposals, severance accruals, settlement cash-outs) to one capsule for board / auditor reporting | `create_capsule(capsuleTypeResourceId: <id of 'Restructuring' from list_capsule_types>, title)` + provisions recipe + asset-disposal recipe + manual severance journals |
53
- | Insurance claim (loss event → claim filed → cash received → asset write-off / replacement) | Track the full claim lifecycle across multiple periods | `create_capsule(capsuleTypeResourceId: <id of 'Insurance Claim' from list_capsule_types>, title)` + asset-disposal recipe + cash-in receipt + manual gain/loss journal |
54
- | Litigation provision lifecycle (initial recognition → settlement negotiations → final payment or release) | IAS 37 provision + interim remeasurements + eventual settlement, all in one trail | `create_capsule(capsuleTypeResourceId: <id of 'Provisions' from list_capsule_types>, title)` + provision recipe + manual remeasurement journals + settlement cash-out |
55
- | Customer write-off campaign (specific impairment of a major debtor) | Group the customer's outstanding invoices + the credit notes that write them off + the resulting cash recovery (if any) | `create_capsule(capsuleTypeResourceId: <id of 'Bad Debt Write-off' from list_capsule_types>, title)` + customer credit notes + apply_credits_to_invoice + any later cash recovery |
140
+ | Multi-period contract revenue (deferred + variable consideration + reversals per IFRS 15) | The deferred-revenue calculator handles the ratable part; manual adjustments in the same capsule handle variable consideration + true-ups | `Deferred Revenue` capsule + the ratable journals + manual variable-consideration journals |
141
+ | Restructuring program (multiple severance, lease exits, write-offs over 6-18 months) | Tie the full program (provisions, asset disposals, severance accruals, settlement cash-outs) to one capsule for board / auditor reporting | `create_capsule(capsuleTypeResourceId: <id of 'Restructuring' from list_capsule_types>, title)` + provision entries + asset-disposal entries + manual severance journals |
142
+ | Insurance claim (loss event → claim filed → cash received → asset write-off / replacement) | Track the full claim lifecycle across multiple periods | `create_capsule(capsuleTypeResourceId: <id of 'Insurance Claim' from list_capsule_types>, title)` + asset-disposal entries + cash-in receipt + manual gain/loss journal |
143
+ | Litigation provision lifecycle (initial recognition → settlement negotiations → final payment or release) | IAS 37 provision + interim remeasurements + eventual settlement, all in one trail | `create_capsule(capsuleTypeResourceId: <id of 'Provisions' from list_capsule_types>, title)` + provision entries + manual remeasurement journals + settlement cash-out |
144
+ | Customer write-off campaign (specific impairment of a major debtor) | Group the customer's outstanding invoices + the credit notes that write them off + the resulting cash recovery (if any) | `create_capsule(capsuleTypeResourceId: <id of 'Bad Debt Write-off' from list_capsule_types>, title)` + customer credit notes + `apply_credits_to_invoice` + any later cash recovery |
56
145
  | Foreign subsidiary investment lifecycle (subscription + dividends received + investment impairment + eventual disposal) | Long-running investment account with multiple economic events over years | `create_capsule(capsuleTypeResourceId: <id of 'Investments' from list_capsule_types>, title)` + journals per event |
57
146
 
58
147
  ### How to use capsules well
@@ -61,7 +150,7 @@ The recipe engine uses capsules automatically. But capsules also enable advanced
61
150
 
62
151
  1. **One capsule per LIFECYCLE, not per period.** A 5-year loan = ONE capsule (not 12 per year). A construction project = ONE capsule (not one per contractor bill). The capsule's job is to span the full lifecycle.
63
152
 
64
- 2. **Use Capsule Types as the search axis, not Capsule Name.** Capsule names are unique per instance ("FY2025 Office Insurance"); types are reusable ("Prepaid Expenses"). `search_capsules(filter: {status: {eq: 'ACTIVE'}}) (capsule type is not filterable; see `jobs/references/building-blocks.md` § Filter limits)` returns ALL prepaid capsules across history.
153
+ 2. **Use Capsule Types as the grouping axis, not the title.** Titles are unique per instance ("FY2025 Office Insurance"); types are reusable ("Prepaid Expenses"). Capsule type is not a search filter: `search_capsules(filter: {status: {eq: 'ACTIVE'}})` returns the active capsules, and you narrow on each row's `type` / `capsuleType.name` (see `jobs/references/building-blocks.md` § Filter limits).
65
154
 
66
155
  3. **Tie capsule entries back for the auditor.** `generate_general_ledger(startDate, endDate, groupBy: 'CAPSULE')` groups the period's GL rows by capsule, so each capsule's full lifecycle reads as one block. Auditor sample-test: pick 3 capsules per type from that report and pull the underlying documents (bills, invoices, journals) by their resource ids.
67
156
 
@@ -69,12 +158,14 @@ The recipe engine uses capsules automatically. But capsules also enable advanced
69
158
 
70
159
  ```
71
160
  create_capsule(
72
- capsuleTypeResourceId: <type id from search_capsule_types>,
161
+ capsuleTypeResourceId: <type id from list_capsule_types>,
73
162
  title: 'Bank Loan, DBS Term Loan, LN-2025-0042, FY2025',
74
163
  description: 'SGD 100,000 5-year term loan, 6% p.a. Bank: DBS Bank. Facility ref: LN-2025-0042.'
75
164
  )
76
165
  ```
77
166
 
167
+ `title` is required and must be non-empty. The calculator's `blueprint.capsuleName` and `blueprint.capsuleDescription` (the workings) are a ready-made title and description; add the contract or facility reference to the title so it is unique.
168
+
78
169
  Then assign entries to it via `capsuleResourceId` on the create call:
79
170
  ```
80
171
  create_journal(..., capsuleResourceId: <capsule id>)
@@ -84,34 +175,40 @@ create_cash_in(..., capsuleResourceId: <capsule id>)
84
175
  create_cash_out(..., capsuleResourceId: <capsule id>)
85
176
  ```
86
177
 
178
+ `move_transaction_capsules(businessTransactionResourceIds: [...], oldCapsuleResourceId: <from>, newCapsuleResourceId: <to>)` moves an entry from one capsule to another: it needs a source capsule, so it cannot pick up an entry that has none. An entry posted without a capsule gets one by updating it: `quick_fix_transactions(entity: <'invoices' | 'bills' | 'journals' | 'cash-entries' | ...>, resourceIds: [<entry id>], attributes: {capsuleResourceId: <capsule id>})` for one entry, or a Ledger Find & Fix preview (`preview_ledger_find_fix`, level `TRANSACTIONS`) when several entries need it.
179
+
87
180
  **Search and audit patterns:**
88
181
 
89
182
  ```
90
- search_capsules(filter: {status: {eq: 'ACTIVE'}}) # capsule type is not filterable; narrow on the row's `type` / `capsuleType.name`
91
- # All open loan capsules: feed into year-end-close.md Y6 reclassification
92
- **STOP: not selectable by filter.** Journals carry no capsule or fixed-asset link in either direction (`JournalFilter` declares neither; a journal row has no such field even at `view: 'full'`; `GET /capsules/{id}` returns only a `totalTransactions` count, measured 2026-09-07). A date+status search returns every matching DRAFT in the org, so it must never feed `bulk_update_journals` or `delete_journal`. Surface the capsule and its expected count to the practitioner and let them identify the journals.
93
- # Full GL for one capsule, the auditor's view
94
- generate_general_ledger(startDate, endDate, groupBy: 'CAPSULE') # GL rows grouped by capsule
95
- # Period activity grouped by capsule, the practitioner's view
183
+ search_capsules(filter: {status: {eq: 'ACTIVE'}})
184
+ # All open capsules; narrow on the row's `type` / `capsuleType.name` (capsule type is not filterable)
185
+ generate_general_ledger(startDate, endDate, groupBy: 'CAPSULE')
186
+ # GL rows grouped by capsule: the auditor's and the practitioner's view
96
187
  ```
97
188
 
189
+ Journals carry no capsule link you can filter on in either direction, so a capsule's journals cannot be selected by search. Find them by the references you gave them.
190
+
98
191
  **Capsule lifecycle:**
99
192
 
100
- - Created on first use (recipe `execute_recipe` or manual `create_capsule`).
193
+ - Created when the event starts (step 2 of the flow).
101
194
  - ACTIVE while events accumulate.
102
- - CLOSED when the lifecycle ends (loan paid off, lease term ends, project complete). a manual `update_capsule(title: '<original> [CLOSED]')` (the API has no `status` field for capsules; closure is informational only).
195
+ - Closed when the lifecycle ends (loan paid off, lease term ends, project complete): a manual `update_capsule(resourceId: <id>, title: '<original> [CLOSED]')`. The API has no `status` field you can set on a capsule; closure is informational only.
103
196
  - Closed capsules remain searchable + reportable; they're an auditor's friend.
104
197
 
105
- ### Recipe-engine capsules vs manually-created capsules
198
+ ### Undoing a capsule
106
199
 
107
- The recipe engine creates ONE capsule per `execute_recipe` call. For complex transactions where you need MULTIPLE recipes against ONE business event, create the capsule manually FIRST, then pass `capsuleResourceId` into each recipe + manual entry:
200
+ - A capsule that holds any transaction cannot be deleted: `delete_capsule` answers 422 "capsule associated with transactions".
201
+ - Deleting a capsule's last transaction removes the capsule with it. To take down a mistaken setup, delete (or move) its transactions; the capsule goes when the last one does. Both verified 2026-10-02.
202
+
203
+ ### Several calculators, one business event
204
+
205
+ A capsule is not tied to one calculator. For a business event that needs several, create ONE capsule first and post every calculator's steps into it:
108
206
 
109
207
  ```
110
208
  # Restructuring program example:
111
209
  1. create_capsule(capsuleTypeResourceId: <id of 'Restructuring' from list_capsule_types>, title: 'FY2025 Restructuring')
112
- 2. execute_recipe(recipe: 'provision', ...) # severance provision (creates its own capsule)
113
- 3. execute_recipe(recipe: 'asset-disposal', ...) # office equipment write-off (creates its own capsule)
114
- move_transaction_capsules(businessTransactionResourceIds: [...], oldCapsuleResourceId: <recipe capsule>, newCapsuleResourceId: <restructuring capsule>) # optional: regroup
210
+ 2. calculate(type: 'provision', ...) # severance provision: post its steps with capsuleResourceId: <restructuring capsule>
211
+ 3. calculate(type: 'asset-disposal', ...) # office equipment write-off: post its journal with the same capsuleResourceId
115
212
  4. create_journal(..., capsuleResourceId: <restructuring capsule>) # lease termination penalty
116
213
  ```
117
214
 
@@ -119,7 +216,7 @@ All entries land in one capsule; auditor reviews the whole restructuring as one
119
216
 
120
217
  ### When NOT to use a capsule
121
218
 
122
- - Single-period one-shot entries (e.g.}, monthly utility bill); use a tag instead. Capsules are overkill.
219
+ - Single-period one-shot entries (e.g., monthly utility bill); use a tag instead. Capsules are overkill.
123
220
  - Operating expenses that aren't part of a multi-step event; tag for analysis, no capsule.
124
221
  - Bank reconciliation: bank entries don't need capsules; they belong to specific transactions.
125
222
 
@@ -127,37 +224,30 @@ All entries land in one capsule; auditor reviews the whole restructuring as one
127
224
 
128
225
  ---
129
226
 
130
- ## How recipes use capsules (engine pattern)
131
-
132
- The recipe engine creates one capsule per `execute_recipe` call. The pattern:
133
- - Capsule type comes from `capsuleType` in the recipe input
134
- - Capsule title = `<capsuleName>` + `(<startDate>)` for collision avoidance on repeat runs
135
- - All bill / invoice / journal / cash entries the recipe creates get the new capsule's resourceId
136
- - Manual journal recipes (intercompany, capital-wip) follow the same pattern but you create the capsule + assign journals manually
137
-
138
- **Capsule Types** are labels that categorize capsules. Pass these exact strings; the engine and `search_capsules` filter rely on character-for-character match.
139
-
140
- Engine-emitted (canonical strings; match exactly):
141
- - Accrued Expenses (accrued-expense recipe)
142
- - Asset Disposal (asset-disposal recipe)
143
- - Deferred Revenue (deferred-revenue recipe)
144
- - Depreciation (depreciation recipe, covers SL, DDB, 150DB)
145
- - Dividends (dividend recipe)
146
- - ECL Provision (ecl recipe)
147
- - Employee Benefits (leave-accrual recipe)
148
- - Fixed Deposit (fixed-deposit recipe)
149
- - FX Revaluation (fx-reval recipe; verification only, do not execute_recipe)
150
- - Hire Purchase (lease recipe with `usefulLifeMonths > termMonths`)
151
- - Lease Accounting (lease recipe, IFRS 16)
152
- - Loan Repayment (loan recipe)
153
- - Prepaid Expenses (prepaid-expense recipe)
154
- - Provisions (provision recipe)
155
-
156
- Practitioner-created (manual `create_capsule(capsuleTypeResourceId: <id of 'X' from list_capsule_types>, title)`, no engine):
227
+ ## Capsule types
228
+
229
+ **Capsule Types** are labels that categorize capsules. Each calculator names the type its recipe belongs under in `blueprint.capsuleType`. Use that string as the type's display name so capsules group consistently across the org:
230
+
231
+ - Accrued Expenses (`accrued-expense`)
232
+ - Asset Disposal (`asset-disposal`)
233
+ - Deferred Revenue (`deferred-revenue`)
234
+ - Depreciation (`depreciation`: covers SL, DDB, 150DB)
235
+ - Dividends (`dividend`)
236
+ - ECL Provision (`ecl`)
237
+ - Employee Benefits (`leave-accrual`)
238
+ - Fixed Deposit (`fixed-deposit`)
239
+ - FX Revaluation (`fx-reval`: verification only, nothing is posted, so no capsule is created)
240
+ - Hire Purchase (`lease` with a useful life: `usefulLifeMonths`, CLI `--useful-life`)
241
+ - Lease Accounting (`lease`, IFRS 16)
242
+ - Loan Repayment (`loan`)
243
+ - Prepaid Expenses (`prepaid-expense`)
244
+ - Provisions (`provision`)
245
+
246
+ No calculator (create the type yourself):
157
247
  - Intercompany
158
248
  - Capital Projects
159
249
 
160
- > **Naming drift to watch for:** the file `accrued-expenses.md` (plural) covers the engine recipe `'accrued-expense'` (singular) which emits the capsule type `'Accrued Expenses'` (plural). Same content; the recipe name follows the engine convention while the file + capsule type follow the accounting convention. Pass capsule type strings exactly as listed above.
250
+ > **Naming drift to watch for:** the file `accrued-expenses.md` (plural) covers the calculator type `accrued-expense` (singular), whose capsule type is `Accrued Expenses` (plural).
161
251
 
162
252
  **Reporting:** Capsules are the **only enrichment that supports group-by** in the General Ledger. Grouping by capsule shows the complete lifecycle of a multi-step transaction in one view.
163
253
 
@@ -167,7 +257,7 @@ Practitioner-created (manual `create_capsule(capsuleTypeResourceId: <id of 'X' f
167
257
 
168
258
  ## Schedulers: Recurring Entry Generators
169
259
 
170
- Schedulers automate **fixed-amount** recurring transactions. A scheduler generates one entry per period (monthly, quarterly, annually) until its end date.
260
+ Schedulers automate **fixed-amount** recurring transactions. A scheduler generates one entry per occurrence (daily, weekly, monthly or yearly) until its end date.
171
261
 
172
262
  **Key limitation:** Scheduler amounts are **fixed**: every generated entry has the same amount. This makes schedulers perfect for:
173
263
  - Prepaid amortization ($1,000/month for 12 months)
@@ -178,10 +268,12 @@ But **not suitable** for:
178
268
  - IFRS 16 liability unwinding (interest component changes each period)
179
269
  - Declining balance depreciation (amount changes as book value drops)
180
270
 
181
- **Scheduler + capsule:** When a scheduler has a capsule assigned, every entry it generates is automatically created under that capsule. This is the automation sweet spot for fixed-amount recipes.
271
+ **Scheduler + capsule:** When a scheduler has a capsule assigned, every entry it generates is created under that capsule. Pass `capsuleResourceId` on `create_scheduled_journal` (see "Same amount every period" above).
182
272
 
183
273
  **Dynamic strings:** Scheduler descriptions support `{{YEAR}}`, `{{MONTH}}`, `{{MONTH_NAME}}`, e.g., "Insurance amortization: {{MONTH_NAME}} {{YEAR}}" produces "Insurance amortization: January 2025".
184
274
 
275
+ **Tools:** `create_scheduled_journal`, `create_scheduled_invoice`, `create_scheduled_bill`.
276
+
185
277
  **API:** `POST /scheduled/journals` (manual journal scheduler), `POST /scheduled/invoices`, `POST /scheduled/bills`
186
278
 
187
279
  ---
@@ -190,7 +282,7 @@ But **not suitable** for:
190
282
 
191
283
  Manual journals are multi-line debit/credit entries. Use them when amounts change each period or timing is irregular.
192
284
 
193
- **In variable-amount recipes**, you record one journal per period with calculated amounts (from the amortization table or depreciation schedule). Each journal is assigned to the capsule manually.
285
+ **In variable-amount recipes**, you record one journal per period with the calculated amounts (from the amortization table or depreciation schedule), each carrying the capsule's `capsuleResourceId`.
194
286
 
195
287
  **Requirements:** Minimum 2 lines, debits must equal credits. Journal descriptions should identify the period (e.g., "Loan payment — Month 3 of 60").
196
288
 
@@ -208,6 +300,8 @@ Jaz has built-in fixed asset management with **straight-line depreciation only**
208
300
 
209
301
  **Not suitable for:** Declining balance, units of production, sum-of-years-digits, or any non-straight-line method. Use manual journals instead.
210
302
 
303
+ **Tools:** `create_fixed_asset` (linked to a purchase line), `transfer_fixed_asset` (already-owned asset, no purchase line), `mark_fixed_asset_sold`, `discard_fixed_asset`.
304
+
211
305
  **API:** `POST /fixed-assets`
212
306
 
213
307
  ---
@@ -222,19 +316,21 @@ Apply enrichments to recipe transactions for richer reporting and record-keeping
222
316
  | **Nano Classifiers** | Line item | Classify by department or cost center on each journal line |
223
317
  | **Custom Fields** | Transaction | Record reference numbers (policy #, loan #, lease contract #) |
224
318
 
319
+ The calculator's `blueprint.tags` and `blueprint.customFields` suggest a tag and the reference fields worth recording for each recipe. They are suggestions: apply them yourself on each create call.
320
+
225
321
  **Schedulers inherit tags and nano classifiers**: set them once on the scheduler and all generated entries get them automatically.
226
322
 
227
323
  **Custom fields are not available on schedulers**, only on individual transactions.
228
324
 
229
325
  ### Nano Classifiers: How to Use
230
326
 
231
- 1. **Create a capsule type**: `clio capsules create --name "Department"` → get `resourceId`
232
- 2. **Add classes to the capsule type** via the UI (API for class management is limited)
327
+ 1. **Create the classifier with its classes**: `clio nano-classifiers create --type "Department" --classes Engineering,Sales` → get its `resourceId` (MCP: `create_nano_classifier(type, classes)`).
328
+ 2. **Add classes later** with `clio nano-classifiers update <resourceId> --classes Finance`.
233
329
  3. **Apply to line items**: Add `classifierConfig` array to each line item on create/update:
234
330
  ```json
235
331
  {
236
332
  "classifierConfig": [{
237
- "resourceId": "<capsuleTypeResourceId>",
333
+ "resourceId": "<classifierResourceId>",
238
334
  "type": "invoice",
239
335
  "selectedClasses": [{ "className": "Engineering", "resourceId": "<classResourceId>" }],
240
336
  "printable": true
@@ -1,14 +1,14 @@
1
- # Recipe: Capital Work-in-Progress (CWIP) → Fixed Asset (manual, no engine)
1
+ # Recipe: Capital Work-in-Progress (CWIP) → Fixed Asset (manual, no calculator)
2
2
 
3
- > Multi-month asset construction pattern: accumulate construction costs in `Capital Work-in-Progress` (Non-current Asset) via bills coded to CWIP, then transfer the accumulated cost to a Jaz native FA on completion. No recipe engine: built from primitive `create_bill` + `create_journal` + `create_fixed_asset`. The CWIP-to-FA transfer triggers Jaz's auto-depreciation (SL).
3
+ > Multi-month asset construction pattern: accumulate construction costs in `Capital Work-in-Progress` (Non-current Asset) via bills coded to CWIP, then transfer the accumulated cost to a Jaz native FA on completion. No calculator: built from `create_bill` + `create_journal` + `create_fixed_asset`. The CWIP-to-FA transfer triggers Jaz's auto-depreciation (SL).
4
4
 
5
- ## Why no engine
5
+ ## Why no calculator
6
6
 
7
- CWIP costs accumulate as construction progresses: multiple bills from contractors / suppliers, none of which are predictable in amount or timing. The recipe engine is for KNOWN-shape multi-period flows (loan amortization, lease unwinding); CWIP is INHERENTLY ad-hoc until completion. Once complete, the transfer is a single one-shot journal + FA registration.
7
+ CWIP costs accumulate as construction progresses: multiple bills from contractors / suppliers, none of which are predictable in amount or timing. The calculators model KNOWN-shape multi-period flows (loan amortization, lease unwinding); CWIP is INHERENTLY ad-hoc until completion. Once complete, the transfer is a single one-shot journal + FA registration.
8
8
 
9
- ## Tools, recipes, calculators this recipe uses
9
+ ## Tools this recipe uses
10
10
 
11
- ### Primitive MCP tools (no engine wrapper)
11
+ ### Posting tools
12
12
  - **`create_bill(...)`**, used in step 2 (multiple times during construction): each contractor bill / supplier invoice / permit fee coded to `Capital Work-in-Progress` GL account, NOT to Operating Expense. The asset is BEING BUILT: these are capitalized costs, not period expenses.
13
13
  - **`create_capsule(capsuleTypeResourceId: <id of 'Capital Projects' from list_capsule_types>, ...)`** (step 1): one capsule per construction project, accumulates all bills + the eventual transfer journal.
14
14
  - **`create_journal(...)`** (step 4): the CWIP-to-FA transfer journal (Dr Fixed Asset / Cr Capital Work-in-Progress).
@@ -61,6 +61,7 @@ create_bill(
61
61
  contactResourceId: <contractor / supplier>,
62
62
  reference: '<contractor invoice number>',
63
63
  valueDate: '<actual bill date>',
64
+ dueDate: '<bill due date>',
64
65
  lineItems: [{
65
66
  name: '<description of work>',
66
67
  accountResourceId: <Capital Work-in-Progress GL>,
@@ -98,7 +99,7 @@ generate_general_ledger(accountResourceIds: [<CWIP GL>], startDate: <project sta
98
99
  Confirm the accumulated CWIP balance matches expectations vs the project's estimated cost. Variance > 10% → flag for budget review.
99
100
 
100
101
  ```
101
- **STOP: not selectable by filter.** Journals carry no capsule or fixed-asset link in either direction (`JournalFilter` declares neither; a journal row has no such field even at `view: 'full'`; `GET /capsules/{id}` returns only a `totalTransactions` count, measured 2026-09-07). A date+status search returns every matching DRAFT in the org, so it must never feed `bulk_update_journals` or `delete_journal`. Surface the capsule and its expected count to the practitioner and let them identify the journals.
102
+ **STOP: not selectable by filter.** Journals cannot be searched by capsule or fixed asset (`JournalFilter` declares neither; a journal search row has no such field even at `view: 'full'`; `GET /capsules/{id}` returns only a `totalTransactions` count, measured 2026-09-07). `get_journal` on one journal does return its `capsule` (`{resourceId, type, title}`, verified 2026-10-02), so a candidate can be confirmed one at a time. A date+status search returns every matching DRAFT in the org, so it must never feed `bulk_update_journals` or `delete_journal`. Surface the capsule and its expected count to the practitioner and let them identify the journals.
102
103
  ```
103
104
 
104
105
  Identify unpaid bills attached to the project; payment timing matters for cash-flow planning.
@@ -199,7 +200,7 @@ Close the project capsule (or keep ACTIVE for traceability; the FA still referen
199
200
  | Step 4c | `create_fixed_asset` 422 `cost_mismatch` | Cost passed differs from the transfer journal amount. Both must equal CWIP closing balance. Re-pull `generate_general_ledger` and re-confirm. |
200
201
  | Step 4c | Asset created but Jaz auto-depreciation not running | FA may have been created as DRAFT. `update_fixed_asset(resourceId: <id>, isDraftToActive: true)`. From next month-end, auto-depreciation runs. |
201
202
  | Step 5 | CWIP balance nonzero post-transfer | A bill was posted to CWIP AFTER step 4a, common when contractor sends final invoice late. Two options: (a) extend the project (post the late bill, re-do step 4 transfer for the additional amount + create a SECOND FA OR update the existing FA cost via `update_fixed_asset`); (b) expense the late bill directly to operating expense if immaterial. |
202
- | Project abandoned mid-construction | (process: IAS 16.20 / IAS 36.18 impairment) | If asset will not be completed: write off CWIP balance to Loss on Abandoned Project. `create_journal({capsuleResourceId: <project capsule>, tags: ['abandoned', 'impairment'], notes: '<abandonment date + reason + IAS 36.18 cite>', ...})`: the journal carries the abandonment narrative; the capsule already aggregates every bill + this journal as the audit trail. |
203
+ | Project abandoned mid-construction | (process: IAS 16.20 / IAS 36.18 impairment) | If asset will not be completed: write off CWIP balance to Loss on Abandoned Project. `create_journal({valueDate: <abandonment date>, autoReference: true, journalEntries: [<Dr Loss on Abandoned Project / Cr Capital Work-in-Progress>], capsuleResourceId: <project capsule>, tags: ['abandoned', 'impairment'], notes: '<abandonment date + reason + IAS 36.18 cite>', ...})`: the journal carries the abandonment narrative; the capsule already aggregates every bill + this journal as the audit trail. |
203
204
  | Borrowing costs incorrectly capitalized post-completion | (IAS 23 violation) | Per IAS 23.22, capitalization stops when asset is ready for intended use. Any interest capitalized after completion → expense. Reverse via journal: Dr Interest Expense / Cr Capital Work-in-Progress (or the FA if already transferred). |
204
205
 
205
206
  ---