Emerald

v0.5.0
io.github.kfireliyahu/emerald Checked 59 minutes ago Published 4 days ago

The database under the chat: a local SQLite file a model asks for rows, not notes to re-read.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

formats Declared formats

What kinds of thing this document holds — every format declared in it, with its columns, their types, units, bounds and enum members, and the prose the author wrote around them. The columns are declared per document: `start_here` ends with one line per format, enough to write a row, and this is the whole declaration. Name a `format` for its full column list; omit it for the list of what is declared. Reads the file; never modifies it.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
formatstringOne declared format by name, for its full column list.

declare_format Declare a new format

Bring a **new** kind of thing into a document: a format, compiled to a real table with real types and checks. Call `formats` first. Each column has a `snake_case` `name`, a `type` — one of `text`, `integer`, `real`, `date`, `boolean`, `enum`, `money`, `link`, `quantity`, `decimal`, `month`, `instant`, `links`, `percent`, `time`, `enums`, `elsewhere`, `file` — and optionally a `unit` (`g`, `kcal`), `required`, `unique` (no two rows share it — a name a row is known by; text, integer, decimal, date, month or link), `values` for an enum or enums, `minimum`/`maximum`, a `scale` for a `decimal…

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
aggregatesarrayWhat this format works out from the rows of another that point at it. Each has a `name` in `snake_case`, an `of` — one of sum, count, average, minimum, maximum, latest, earliest — an `over_format`…
claimsarrayWhat is claimed about one of these, proved or failed on every row. Each has a `name` in `snake_case`, an `expression` — one `=` with arithmetic over this format’s own numeric columns on either sid…
columnsarrayThe columns, in the order they should read. Up to 64. `text` — Words. A name, a note, a code — anything not measured. `integer` — A whole number, with no fractional part at all. `real` — A num…
commitbooleanWrite it. Omit or false for the dry run.
computedarrayComputed columns, worked out rather than typed, each `{ name, works_out, note }`: a claim’s expression with no `=` — `price * (1 + vat)`, `amount in g`, `link.column`, an aggregate’s name, anoth…
constraintsarrayRules across the columns of one row, each `{ rule, note }` — `rule` is one of `x is required when kind is A, B`, `x is required only when kind is A, B` (and empty otherwise), `at most one of a, b, c…
formatstringThe name of the format, `snake_case` — `ingredient`. It names the table.
formatsarraySeveral new formats, each `{ format, title, columns, … }`.
notesstringProse about the format. Kept verbatim, never parsed. Optional but wanted.
rollupsarrayFigures per month over this format’s rows, each `{ name, works_out, note }`: `sum of minutes by month of done_on or started_on and project where status is DONE` — sum, count, average, minimum or m…
rule_setsarrayRows of this format as rules setting a link of another, each `{ name, sets, note }`: `note.topic from target when title matches pattern by kind (EXACT equals, PART contains) first by priority, recorde…
titlestringWhat a person calls one of these — `Ingredient`.

connect_formats Connect two formats

Join two formats this document **already** declares: a `link` column on `format`, so each of its rows belongs to one row of `target` — each `recipe_line` belongs to one `recipe` — and, optionally, a total on `target` along it (an `aggregate`): `recipe.total_kcal`, the sum of `amount_g / 100 * ingredient.kcal` over the lines that name it. This is how a format gets a total of another declared after it, which `declare_format` cannot do. Name an existing link as `column` to add only the total. **It only adds**: a link may be empty, so rows already there lose nothing; `required: true` on a form…

ParameterTypeDescription
format *stringThe format that gets the link — the many side, `recipe_line`.
path *stringAbsolute path to a .emd file on this machine.
target *stringThe format each row belongs to one of — `recipe`, the one side.
aggregateobjectThe total `target` keeps of the rows that name it: a `name` in `snake_case`, an `of` — one of sum, count, average, minimum, maximum — a `works_out` expression over each of those rows in their own…
columnstringThe link column’s name, `snake_case`. Defaults to the target’s name, suffixed if taken. Name an existing link to it to add only the total.
commitbooleanWrite it. Omit or false for the dry run.
found_bystringHow the link fills itself while empty: `date in period` (this date’s month) or `date on paid_on` (the same day). No row or two is refused by name; a link a person set stays.
notestringWhat the link means. Kept with the declaration, word for word.
requiredbooleanEvery row must name one. Refused on a format that already has rows.

extend_format Change a format

Change a format this document **already** declares, as its table does: add `columns`, `claims`, `computed` columns, `unique`, `constraints`, `rollups` and `aggregates` as `declare_format` takes them; `rename`, `change` or `remove` what it has; `order` the columns. A rename keeps its values. Refused, naming the rows: a `required` column on rows, removing a column holding values, a list the rows do not fit, a type or unit change over values. Writes nothing until `commit: true`.

ParameterTypeDescription
format *stringThe format to change, by name.
path *stringAbsolute path to a .emd file on this machine.
aggregatesarrayNew totals, as `declare_format` takes them. A `count` needs no `works_out`.
changearrayColumns it has, named, with what changes: `{ name, type: "enum", values }`.
claimsarrayNew claims, each with a `name`, an `expression` with one `=`, an optional `tolerance` and a `note` — as `declare_format` takes them.
columnsarrayThe new columns, after the ones it has. Up to 64. `text` — Words. A name, a note, a code — anything not measured. `integer` — A whole number, with no fractional part at all. `real` — A number…
commitbooleanWrite it. Omit or false for the dry run.
computedarrayNew computed columns, as `declare_format` takes them.
constraintsarrayNew row constraints, each `{ rule, note }` as `declare_format` takes them — refused, naming the rows, while any row already breaks one.
orderarrayEvery column, new ones too, once each, in order.
removearrayNames of columns, claims, totals, computed columns, rollups or rule sets.
renameobject`{ old: new }`.
rollupsarrayNew rollups, as `declare_format` takes them.
rule_setsarrayNew rule sets.
uniquearrayColumns it already has that should become unique — refused, naming the repeated values, while two rows share one.

delete_format Remove a format and every row in it

Remove a declared format: its declaration, its table and **every row in it**. Refused while another format links to it or folds its rows. The dry run says how many rows go; show that to the user, and call again with `commit: true` only on a plain yes. To remove some rows, use `delete_format_rows` instead.

ParameterTypeDescription
format *stringThe format to remove, by name.
path *stringAbsolute path to a .emd file on this machine.
commitbooleanRemove it. Omit or false for the dry run.

format_rows Rows of a declared format

The rows this document holds of one declared format. Ask `formats` first for the column names — they belong to the document. `match` filters on exact values (text and enum members case-insensitively; a list column, the rows holding the one named), `search` a substring in every column as shown (a price as 12.90, a link by its row’s name) but yes/no, and `order` sorts by any column, computed too — by default the one a row is named by, which is its first text column. Narrow `columns` to get a table of just those — a computed column (a total, or one worked out from the row) by its name too…

ParameterTypeDescription
format *stringThe declared format, by name. `formats` lists them.
path *stringAbsolute path to a .emd file on this machine.
columnsarrayColumn names to show, as a table — stored or computed. Omit for every column.
descendingbooleanSort the other way. Defaults to false.
limitnumberRows to return. Defaults to 25, at most 200.
matchobjectColumn name to the value it must equal. Text and enum columns match without regard to case; money or a quantity, a range: `10..50 ILS`. A list is any of them (`[planned, in_progress]`; a list column h…
offsetnumberRows to skip first — the `offset` a cut-short answer hands back for the rest.
orderstringA declared column to sort by. Defaults to the column a row is named by — its first text column — which is what the screen sorts by too. Ordering by the generated id shuffles, since an id is genera…
searchstringA substring, in every column as shown but yes/no.
valuesstringA column: each value it holds and how many rows, under the other filters.
viewstringA saved view’s name: its match, search, order and columns, under any given here.

export_format_rows Export a format’s rows to JSON

Writes the rows `format_rows` would match to a JSON file, the same bytes every time: empty columns left out, money as text beside `<column>_currency`, a link as its row’s name. No `format`: every saved export. Never modifies the document.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
checkbooleanWrite nothing; say if current.
columnsarrayColumns to write, computed too.
descendingbooleanSort the other way.
formatstringThe declared format, by name.
idsbooleanEach row’s id as `id`.
linkobjectA link to the linked column it is written as: `{milestone: "ref"}`.
matchobjectAs `format_rows`.
nestarrayChild formats folded in: each row’s children, as an array under `as` (default its name), by `order`; `descending`, `columns` too. `format` is `child.link` when it links here twice. One level.
orderstringA column to sort by.
searchstringAs `format_rows`.
tostringThe file, inside the document’s folder.

show_format A declared format’s rows, drawn as the app draws them

Shows the person one declared format as the app draws it — its table, its list (one line per row, a tick, grouped as `arrange_views view:list` says), or its board, roadmap or ready-to-start list when the format has one; or the agenda, every dated format’s rows from today; or a dashboard (no `format`: the document’s) — in the conversation, in a client that draws MCP Apps; the answer’s first line says whether this client said it draws them. Call it when they ask to see a format, or some of its rows: `match` and `search` filter exactly as `format_rows` does, and the view draws only thos…

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
columnsobjectColumns its lines draw, by format: `{unit:[title,state]}`. A roadmap’s `match` takes `unit.state`.
formatstringThe declared format, by name. `formats` lists them. The agenda takes none.
matchobjectColumn name to the value it must equal. Text and enum columns match without regard to case; money or a quantity, a range: `10..50 ILS`. A list is any of them (`[planned, in_progress]`; a list column h…
searchstringA substring, in every column as shown but yes/no.
viewstringtable, board, list, roadmap, ready, agenda (default table), dashboard, or a saved view’s name.

format_problems What looks wrong in declared formats

What the engine can see is wrong in a format’s rows, without a rule anybody wrote: a link empty where most rows fill it, rows the same in every column, claims failed or unchecked. `read_onto_format` says it after every read. Reads only.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
formatsarrayBy name. Omit for every one.

search_document Search the whole document

Every row of every format, and the rest of the file, that holds any of `terms`: each hit by format, row and column, columns searched as shown. One call where `format_rows`’ `search` is one a format. Or `denylist`, a `--replace-text` file: the scan before a document is shared — hits only, a term named by its line, and the file’s bytes checked for a deleted value. Reads only.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
denyliststringInstead of `terms`: a denylist’s absolute path, `literal==>x` or `regex:pattern==>x` a line.
termsarrayWords or phrases, any case, up to 50.

start_here What to start from

Call first. Answers the questions this document’s own views say a session starts from — what is ready to start, what is open, the latest entries — each with the `format_rows` call that lists it whole; then what a row of each format looks like, enough to write one; and where new work begins: `formats`, then `read_onto_format` (files or a folder of notes) or `declare_format`. Read-only.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.

format_rollup A rollup of a declared format

A rollup a format declares, run: a figure per month, and per linked row. `formats` lists them. A month with a row that cannot answer is `unchecked`, naming it; money stays per currency. Reads only.

ParameterTypeDescription
format *stringThe declared format, by name.
path *stringAbsolute path to a .emd file on this machine.
fromstringFirst month, `YYYY-MM`.
limitnumberGroups. Default 25.
rollupstringBy name; optional when there is one.
tostringLast month, `YYYY-MM`.

apply_rules Apply a rule set

Run a rule set over every row it sets — a write applies it by itself. A person’s value is never touched; a tie is named. With `link`, fill that link’s empty cells by its `found_by` instead; a set link is never moved, and a row with no match or two is named. Dry run until `commit: true`.

ParameterTypeDescription
format *stringThe format whose rows are the rules — or, with `link`, the one the link is on.
path *stringAbsolute path to a .emd file on this machine.
commitbooleanWrite it. Omit or false for the dry run.
linkstringA link column found by a date (`found_by`): fill the rows where it is empty.
rule_setstringBy name; optional when there is one.

record_format_rows Record rows of a declared format

Write rows into a declared format — **a list of them in one call**. The columns belong to the document — `start_here` lists them, `formats` in full — and a key the format has not got refuses the batch rather than being dropped, because a figure you believe you stored and did not is worse than one you know is missing. A `money` column takes the amount in major units beside its own `<column>_currency` key, and a `quantity` column takes the figure beside a `<column>_unit` key naming a unit this document knows — `amount: 200` with `amount_unit: ml`. A `link` takes the row’s id, its name…

ParameterTypeDescription
format *stringThe declared format, by name.
path *stringAbsolute path to a .emd file on this machine.
rows *arrayOne object per row, keyed by declared column name. Up to 200 in a call.
commitbooleanOmit or true to write; false for a preview that writes nothing.
viewstringAn input view: its defaults fill left-out fields.

update_format_rows Correct rows of a declared format

Change columns of rows already stored — **a list of edits in one call**. Each names its row by `id` or by `where` (`{ref: "INV-0042"}`, which survives another writer; a text document renews ids on every write), and the `values` to change. `expect` (`{state: "planned"}`) refuses the batch unless the row still holds that, so two sessions cannot both take one row. Every column not named is left exactly as it was, which is the difference between this and the app: `#/formats/<name>` shows a person every column and writes every column, and this corrects three of thirty across a batch. A required c…

ParameterTypeDescription
edits *arrayOne entry per row. Up to 200 in a call.
format *stringThe declared format, by name.
path *stringAbsolute path to a .emd file on this machine.
commitbooleanOmit or true to write; false for a preview that writes nothing.

delete_format_rows Remove rows of a declared format

Remove rows from a declared format by id — **a list of them in one call**. **Refused while any other row still links to one of them** — the dry run names those rows; re-link or clear them first. The app removes one row at a time from `#/formats/<name>`; this is how thirty go at once, after printing every one of them in full. Writes nothing until `commit: true`; a copy of the document is taken first, and it is the only way back.

ParameterTypeDescription
format *stringThe declared format, by name.
ids *arrayRow ids, as `format_rows` printed them. Up to 200.
path *stringAbsolute path to a .emd file on this machine.
commitbooleanRemove them. Omit or false for the dry run.

claim_units Claim units

In a document that keeps the `development` pack, take units by `ref`: `planned` to `in_progress` with `taken_by`, the git `branch` they are taken on and `started` (default today), the batch refused unless every one is still planned. With `take_over`, take units already `in_progress` from that taker — a session that stopped mid-unit — refused unless each is held by exactly that taker; `started` is reset and the taker replaced is kept on `taken_over_from`. Writes on this call; `commit: false` previews instead.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
taken_by *stringWho takes them: the host’s name for its session.
units *arrayRefs, up to 50.
branchstringThe git branch they are taken on.
commitbooleanOmit or true to write; false for a preview that writes nothing.
startedstring`YYYY-MM-DD`; today if left out.
take_overstringThe `taken_by` whose claim this replaces, for units already in progress.

land_units Land units

In a document that keeps the `development` pack: a unit’s closing pass in one call, for a list of units by `ref`: their new `decisions` (date, milestone, scope and `state: live` default to the unit’s), the unit to `built` with `landed` (default today), `files` and `decision` (default its first new one), its `review_entries` (`state: open` default), `close_milestone`, its git `commit` (refused without one unless `same_commit: true`) and `branch` (refused off the claim’s unless `other_branch`), its builder’s `report`, `accept_entries` (open review entries it proves, by their `do`’s sta…

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
commitbooleanOmit or true to write; false for a preview that writes nothing.
inboxarrayInbox row ids of landing proposals, or `{id, other_branch}`.
unitsarrayUp to 50.

dispatch_plan Dispatch plan

In a document that keeps the `development` pack, before handing units out: for unit refs (every ready unit if left out), which can run at once and which share a path in their `paths` — one per line — and so go one after another, beside any unit in progress; a unit with no paths is unknown, never safe. Then each one’s brief, the units it waits on and the decisions it names. Read-only.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
unitsarrayRefs, up to 50. Omit for every ready unit.

record_units Add or correct a unit of measure, or set the currency

Teach this document a unit it does not know — `slice`, `IU`, a tablespoon that is 20 ml in this kitchen. A unit is what a declared column says its figures are in and what a claim's `in` converts into, so a conversion the document cannot make is a conversion this fixes. **The engine converts inside a dimension and never across one**: grams to kilograms is arithmetic, millilitres to grams needs a density, and a density is a column of the format rather than a unit. A symbol the document already has is corrected — its factor and its note, never what it measures. `currency` sets the document’…

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
commitbooleanWrite it. Omit or false for the dry run.
currencystringThe document’s currency, a three-letter code: `ILS`.
unitsarrayOne object per unit. Up to 64 in a call; none for a setting alone.
week_starts_onstringA day by name: `sunday`.

read_onto_format Read a file onto a declared format

Read what the user already keeps onto a declared format: any .csv, .xlsx (or .xls) or .json of rows, a file row per table row; or **a folder of Markdown notes**, a note per row: `title`, `file`, each frontmatter key, `inline tags`, `body links` and `body`, with a link read from `[[name]]` or `[text](file.md)`; a body link naming no row is left out and named, the note still read; a hidden file is not read; links between notes of one folder are filled; `items` reads list items or table rows onto another format, each linked to its note. **Dry-runs by default**: the reader with each key’s header…

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
columnsobjectColumn number → key of the format, from what the user confirmed, or → null to read nothing from that column. Applied over the reader the dry run showed, so send only what changes; a column not nam…
commitbooleanWrite it. Omit or false for the dry run.
date_orderstringHow a written date is ordered: one of dmy, mdy, ymd. Inferred from the file when omitted.
filestringAbsolute path to the file to read: one of .xlsx, .xls, .csv, a .json file of rows (an array of objects, or an object holding one), a Markdown note (.md), or **a folder of notes** — every .md file in…
filesarrayInstead of `format` and `file`: each `{ file, format }`, plus that file’s own columns.
fixedobjectKey → one value for every row of this file. A currency for a `money` column, a unit for a `quantity` one, or the row a `link` points at, by id or unique name.
formatstringThe declared format to read onto, by name. Not with `files`.
headerobject`{ format, link, cells, fixed }`: the one row of another format this file writes and every line links to through `link`. `cells` is key → [row, column], **a position, never a value**, from 0; a nega…
header_rownumberForce the header row, from 0, when the guess is wrong — exports often have a preamble.
itemsstring"list" or "table": a folder’s list items or table rows as rows of `format`, each linked to its note’s row (read the notes in the same `files`, or before).
recursivebooleanA folder of notes: its subfolders’ notes too (not a hidden one), with a `folder` column, the path under it.
remove_gonebooleanRead again: remove rows whose line is gone (else named, kept). Per file in `files`.
separatorsobjectKey → what splits one cell into several members, for a column holding several of a list (`enums`): `{ "tags": "," }` reads `vegan, quick` as two. Never guessed; without one a cell is one member, and…
sheetstringWhich sheet, or key of a .json object; defaults to the first.
understringWith `items`: only those under this heading.

supersede_reading Take back what one file wrote

Take back the rows one file wrote onto a declared format — **exactly those rows and no others**. Called with no `reading`, it lists every file read onto the format with when, and how many rows each still has. **Dry-runs by default** and writes nothing until `commit: true`. **The reader is kept** (forgetting one is `readers`), so supersede → correct the file → read it again is one call each. This is how a file read twice stops being two copies; a file is matched by its bytes, never row by row.

ParameterTypeDescription
format *stringThe declared format, by name.
path *stringAbsolute path to a .emd file on this machine.
commitbooleanDo it. Omit or false for the dry run.
readingstringThe reading to take back, by id. Omit to list what this format has read.

readers A format’s readers

List a declared format’s readers — one per kind of file it has read — or name and forget them. Dry-runs until `commit: true`. Forgetting takes back no row.

ParameterTypeDescription
format *stringThe format, by name.
path *stringAbsolute path to a .emd file on this machine.
commitbooleanDo it. Omit or false for the dry run.
forgetarrayReader ids.
renamearray`{ reader, name }`, by id; an empty name restores the file’s.

keep_copy Back up a document now

Backs the document up now: a copy as it is, in Emerald’s folder, named for what it comes before (`work.before-20261006T120512-cleanup.emd`), and says where. A read or batch of 100+ rows keeps one by itself; ask before anything else worth undoing. The last 3 are kept, apart from the rolling copies.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
beforestringWhat it comes before, in a few words: `the cleanup`.

store_document_as Store a document as text or as SQLite bytes

Writes the document again as `text` (diffs in git) or as `sqlite` bytes, and every later write keeps that shape — the app’s Save as text. Refused when the text would not carry it — a document keeping the ledger, for one. Writes nothing until `commit: true`.

ParameterTypeDescription
as *stringHow the file is stored from now on.
path *stringAbsolute path to a .emd file on this machine.
commitbooleanWrite it. Omit or false for the dry run.

arrange_views Arrange a format’s views

How the app shows a format: on its entry, a column’s `show_as`, `header` line, `hidden`, `new_entry` and the `order`; a board’s lanes; a table column’s `width`; a column’s `setting` in a list, a roadmap, a ready list or a start-here question; `view: saved`, a `name` and what it keeps (`today` stays that phrase) — on one saved, only what is given changes; `match:{}`, `search:""`, `order:""`, `columns:{}` empty one — or `rename`, or `delete: true`; `kind: input` takes `fields`, `defaults`, `default`, `widths`; `view: dashboard` `add`s, `size`s, `order`s and `remove`s blocks (no `form…

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
settings *arrayUp to 200.
commitbooleanWrite it; omit for the dry run.

create_document Create an Emerald document

Create a new .emd document at a path that does not exist yet; never overwrites. It keeps the `packs` named and no other, and **none when omitted**: a document starts empty and holds what the person declares. Name a pack only when the work is what it is for — `development` for a project’s memory, `ledger` for their finances. With no path the user may be shown a form; otherwise ask them.

ParameterTypeDescription
languagestringThe person’s language, for a new ledger’s category names (default `en`).
packsarrayThe packs the document starts with, by id; `[]` for none. One of: `development` (a project’s memory: milestones, units, decisions, open questions, an inbox), `exports` (saved exports), `ledger` (per…
pathstringFull path for the new document, ending in .emd. Omit to ask the user.

keep_packs Keep packs in a document

Keep packs in an existing document (the Packs screen’s *Keep … here*): declares the pack’s formats it lacks, adds missing optional columns to those it holds, renames a column the pack renamed with its values, changes no row; a pack kept already is brought up to date this way, its formats’ and columns’ notes and views’ settings too wherever the document still holds an earlier build’s — one a person changed is kept, and the dry run names it. Refused, naming the column, where a format of the same name is not the pack’s. Dry run until `commit: true`.

ParameterTypeDescription
packs *arrayThe packs to keep, by id. One of: `development` (a project’s memory: milestones, units, decisions, open questions, an inbox), `exports` (saved exports), `ledger` (personal finance, from statements,…
path *stringAbsolute path to a .emd file on this machine.
commitbooleanKeep them. Omit or false for the dry run.
languagestringThe person’s language, for a new ledger’s category names (default `en`).

document_info Emerald document info

Describe an Emerald document (a .emd file): whether this plugin will serve it, the formats it declares with how many rows each holds, and — when it keeps the ledger — its accounts, transactions, categories and reporting currency. Call it when a tool refuses a document — every tool refuses one whose schema does not match, and this is the one that says so in a sentence the user can act on. Reads the file; never modifies it.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.

category_tree Category tree

The document category taxonomy: every category full path (Living → Utilities → Electricity), its id, its kind and its Plan bucket. Read this before suggesting a category for anything — the ids here are what the write tools take, and two categories may share a short name.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
include_archivedbooleanInclude archived categories. Default false.

uncategorized_merchants Uncategorized merchants

The uncategorized backlog, grouped by merchant: how many rows each merchant has, and what the user has already categorized other rows of the same merchant under. Ordered by the largest single-currency outflow, which is not printed. Start a "help me categorize" conversation here.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
account_idstringRestrict to one account. Ids come from `accounts` in `document_info`.
fromstringInclusive start of the charge-date range, as YYYY-MM-DD.
include_amountsbooleanPrint what each merchant adds up to. Off by default: the backlog is already ordered by it, and naming a category needs the merchant rather than the sum. Ask for it only when the user wants the spendin…
limitnumberMerchants to return. Default 50, maximum 500.
searchstringMatched against the merchant as written, the normalized merchant, and the provider label.
tostringInclusive end of the charge-date range, as YYYY-MM-DD.

transactions Transactions

A filtered page of the ledger, plus the totals over every matching row — not just the page. Filter by date range, account, category, uncategorized-only, merchant search and amount bounds; sort by date, charge date, merchant, category or amount. Use this to answer "what did I spend at X" and to show the evidence behind any figure.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
account_idstringRestrict to one account. Ids come from `accounts` in `document_info`.
category_idstringRestrict to one category. Ids come from `category_tree`.
directionstringASC or DESC. Default DESC.
fromstringInclusive start of the charge-date range, as YYYY-MM-DD.
include_subcategoriesbooleanRead `category_id` as a parent and include its children. Default false, matching the app own picker, where choosing Utilities means Utilities.
limitnumberRows to return. Default 50, maximum 500.
maxnumberLargest amount, by magnitude, in major units of the document currency.
minnumberSmallest amount, by magnitude, in major units of the document currency. 200 matches a 200 refund as well as a 200 charge.
searchstringMatched against the merchant as written, the normalized merchant, and the provider label.
sortstringOne of DATE, CHARGED, MERCHANT, CATEGORY, AMOUNT. Default DATE.
tostringInclusive end of the charge-date range, as YYYY-MM-DD.
uncategorizedbooleanOnly rows with no category. Overrides `category_id`.

month_summary Month summary

One month already added up: income, expenses, balance, savings rate; how each compares with last month, the three-month average and the same month last year; the category breakdown rolled up to parents; the fixed-versus-variable split; and where the income came from. A card purchase counts in the month it was bought, and a month is partial until the card statements covering it are read. Saved is what was put aside from the month's own money, never more than it left over; the paycheck's pension and study fund are a line beside it. Defaults to the last finished month. Every figure comes from the…

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
monthstringThe month as YYYY-MM. Defaults to the last finished month.

year_summary Year summary

One year already added up: income, expenses, balance and savings rate; averages over the complete months only; the best and worst month by balance; a month-by-month table where a month with no data reads as nothing rather than as zero; and what the paychecks say about gross, tax and payroll savings. On the same basis as month_summary: a card purchase in the month it was bought, saved what each month put aside from its own money. Defaults to the current year.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
yearnumberFour-digit year. Defaults to the current year.

fixed_expenses Bills

The bills the document tracks: what each is expected to cost, its amortized monthly equivalent, its cadence, whether the amount is fixed or variable, what it is matched against in the ledger, and whether the user marked it cuttable. Active ones by default.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
include_inactivebooleanInclude ended bills. Default false.

debts Debts

Every debt with its principal, what has been paid, what is outstanding, how far along it is and when it projects to be paid off — plus the totals and what card installments still commit the user to. Open debts by default.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
include_closedbooleanInclude closed debts in the table. Default false.

savings Savings

Goals and where the money is: net worth — the one figure Overview shows, with its parts (in the bank, in accounts with holdings, locked, pension and hishtalmut funds, owed) — each goal balance broken into the four ways money got there, and the monthly expense figure the emergency-fund target is measured against. Open goals by default.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
include_closedbooleanInclude closed goals. Default false.

goal_projection Goal projection

What each open goal will hold in N months, by plain addition of the amount Plan puts toward it each month (no interest counted), and what a month would have to be to reach it on its date. The same view as the Goals screen.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
monthsnumberHow many months ahead. Default 12.

debt_projection Debt projection

What each open debt will have left in N months, by plain addition of its monthly payment and the extra Plan puts toward it (no interest counted), and when it is paid off with and without the extra. The same view as the Debts screen.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
monthsnumberHow many months ahead. Default 12.

fixed_expense_candidates Recurring charges the ledger suggests

What looks like a recurring bill in the imported transactions but has not been confirmed as one: the merchant, the typical charge and its amortized monthly share, the cadence, how many months it was seen in, how much the amount and the day move, and how confident the detector is. Merchants already tracked or previously dismissed are excluded. This is the question `fixed_expenses` answers the other half of — that one lists what is already committed. Reads the document; changes nothing.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
ending_atstringThe newest month of the window, as YYYY-MM. Default this month.
include_dismissedbooleanAlso list the merchants that were said no to.
window_monthsnumberHow many months of history to look at, 2–24. Default 3. A window cannot see a cadence longer than itself: use 12 to find yearly charges.

track_fixed_expenses Track recurring charges as bills

Turn recurring charges into tracked bills — **several in one call**. An entry either names a `merchant` from fixed_expense_candidates, in which case the charge, cadence and category come from the detector unless overridden, or gives a `name` and an `expected_amount` for a bill the ledger cannot see, like an annual premium paid by standing order elsewhere. **Dry-runs by default**: it returns what it would track and writes nothing until called again with commit true. Confirming the same merchant twice updates the row already covering it rather than adding a second. The document is copied to a…

ParameterTypeDescription
expenses *arrayOne entry per bill. Up to 100 in a call.
path *stringAbsolute path to a .emd file on this machine.
commitbooleanDefault false. False previews the batch; true writes it.
ending_atstringThe newest month of that window, as YYYY-MM. Default this month.
window_monthsnumberThe lookback used to re-find the candidates, matching the one you listed them with. Default 3.

dismiss_fixed_expense_candidates Say no to suggested recurring charges

Record that these merchants are not recurring bills, so the detector stops offering them — to this conversation and to every later one. A dismissal lasts until it is cleared; pass restore to clear it and let the merchant be suggested again. Writes immediately: it changes no transaction, no category and no bill.

ParameterTypeDescription
merchants *arrayNormalized merchant names, exactly as `fixed_expense_candidates` printed them.
path *stringAbsolute path to a .emd file on this machine.
restorebooleanDefault false. True clears these dismissals instead of making them.

plans Plans: bill choices and buckets

The Plan screen as rows: each plan with what every bill does to it (out of net, part of the split, or ignored) and its buckets — what each is for (a goal, a debt, a category, a fund, an account or nothing) and how it is sized. Ids are here for `set_plan`, `set_fixed_expense_roles` and `edit_fixed_expenses`. The worked-out figures for a month are `plan_month`.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
plan_idstringOne plan. Default: all of them.

plan_month Work a plan out for a month, and use it

One plan worked out for one month: net pay, the bills out of net, what is left to split, each bucket’s amount and share, what it actually got lately, when a goal is reached at this rate, money with no job to do — and what *using* the plan for that month would write (a planned deposit into a goal, a planned payment on a debt). **Dry-runs by default**, which is also how you read it; `commit: true` writes those suggestions and gives the month this plan. `months` instead gives a list of months this plan and writes nothing else, and `back_to_default` puts months of this plan back on the default…

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
back_to_defaultarrayMonths as YYYY-MM of this plan to put back on the default plan.
commitbooleanDefault false. False shows the month and writes nothing; true uses the plan.
monthstringThe month as YYYY-MM. Default this month.
monthsarrayMonths as YYYY-MM to give this plan. Records nothing.
only_bucketsarrayBucket ids from `plans`. Default: all.
plan_idstringIds come from `plans`. Default: the default plan.
yearnumberA year, e.g. 2026: read the year against the plan instead. Each month counts on the plan it is on.

set_fixed_expense_roles Say what each bill does to a plan

For each bill, per plan: `net` (comes out of net pay before the split), `split` (is one share of the split, drawn on the bar) or `ignore` (this plan leaves it out). **A list in one call.** A bill the paycheck already took (a pension deduction) is outside the choice and refused. An expense with no choice made is ignored. This is the Plan screen’s switch on every row. **Dry-runs by default**: it shows each change and writes nothing until `commit: true`; the document is copied to a timestamped .bak first. Ids come from `plans`.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
roles *arrayOne entry per bill and plan. Up to 100 in a call.
commitbooleanDefault false. False previews; true writes.

set_plan Create, change or delete plans

What the Plan screen does to a plan — **a list of entries in one call**. Per entry: `plan_id` for an existing plan, or `create: true` with `name` (and `copy_of`, a plan id, to start from its sizes and its choices for the bills); then any of `name`, `make_default`, `basis` ({kind: LAST_PAYCHECK | AVERAGE_LAST_N | SPECIFIC_PAYCHECK | CUSTOM_AMOUNT, amount, months, paycheck_id}) — a bonus month is a plan whose basis is an amount — and `buckets`, **the plan’s whole list of buckets** as the screen’s bar has it: each {bucket_id (existing) or name (new), points_at: {kind: goal | debt | cate…

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
plans *arrayOne entry per plan. Up to 100 in a call.
commitbooleanDefault false. False previews; true writes.

start_plan Start a first plan with 50 / 30 / 20

The Plan screen’s *Start with 50 / 30 / 20*, for a document with no plan yet: half the take-home pay to needs, 30% to wants and 20% to saving, each share divided among the top-level categories by what went out under each over the last three months the ledger holds. Answers every category with its share, its part, what that comes to a month and why. `shares` changes any of them — {category: needs | wants | saving | none}, a category by id or name — and a category the starter cannot place has to be given one before anything is made. **Dry-runs by default**; `commit: true` makes the plan. O…

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
commitbooleanDefault false. False previews; true makes the plan.
sharesobjectA top-level category (id or name) to the share it counts as: needs, wants, saving, or none to leave it out.

edit_fixed_expenses Edit, end or stop tracking bills

Change bills that exist — **a list in one call**. Per entry: `name`, `expected_amount` (the whole charge, major units — a yearly premium is the year’s figure), `cadence`, `category_id` (null clears), `is_discretionary`, `day_of_month` (null clears), `ended_on` (YYYY-MM-DD or "today": it keeps its history and drops out of every plan); or, alone, `stop_tracking: true`, which removes it and what every plan said about it — its charges stay on Transactions. How it is recognised in the ledger is not changed here. Adding is `track_fixed_expenses`; what it does to a plan is `set_fixed_expense_…

ParameterTypeDescription
edits *arrayOne entry per bill. Up to 100 in a call.
path *stringAbsolute path to a .emd file on this machine.
commitbooleanDefault false. False previews; true writes.

paychecks Paychecks

Every paycheck recorded in the document — gross, net, the employer’s own contributions, total compensation, the effective tax rate, what payroll put away, and whether each itemization reconciles to its net. Plus the salary months with no paycheck at all, per-year totals, and **the deduction-type vocabulary with its ids**, which is what a line of a new paycheck has to name. Reads the document; changes nothing.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
include_linesbooleanAlso print each listed paycheck’s itemization, line by line. Default false.
limitnumberHow many paychecks to list, newest salary month first. Default 24, maximum 500. The yearly totals and the vocabulary are never capped.

record_paychecks Record paychecks

Write paychecks into the document — **several in one call**, one entry per paycheck. Each needs the salary month, the payment date, gross and net; an itemization is optional, and each of its lines names a deduction type by id from `paychecks`. Read a paycheck PDF or photo yourself and this is where what it says goes. **Dry-runs by default**: it returns what it would record, including whether each paycheck’s itemization reconciles to its net, and writes nothing until called again with commit true. Nothing here deduplicates — a second paycheck for a salary month is allowed, because a 13th…

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
paychecks *arrayOne entry per paycheck. Up to 60 in a call.
commitbooleanDefault false. False previews the batch; true writes it.

set_deduction_types Make, rename, order and remove deduction types, and say what each counts as and pays into

Everything the deduction types screen does, for **several types in one call**: **make** a type (its name, what the paycheck calls it, its kind), **rename** one, change its kind, **remove** one, put the list in **order**, and say what each type **counts as** (out of net, saving — the two flags every paycheck figure turns on) and what it **pays into** — a fund or a goal for a saving line, a debt (a payroll loan) for a loan repayment. **This link is how a fund finds its paycheck lines**: a pension line is a deposit into a fund only because its type names the fund, and `funds` checks those dep…

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
commitbooleanDefault false. False previews; true writes.
orderarrayTypes by id or by name — the names they will have after this call, new ones included. These come first in the list, in this order, and the rest follow as they are.
typesarrayOne entry per deduction type, up to 60 in a call. With `type` it changes or removes that type; without it, it makes a new one, which needs `name` and `kind`.

funds Pension and hishtalmut funds

Every pension, study fund, provident fund and managers’ insurance the document tracks: the latest transcribed balance and how old it is, the management fee as stated and as measured against what was actually charged, what the dormant ones cost a year, and — the point of the feature — **whether the paychecks and the fund’s own report agree about what was deposited**. A fund finds its paycheck lines through the deduction types that pay into it — `set_deduction_types` sets that link. Name one with fund_id to also get its readings, its return window by window, and the working behind that…

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
fund_idstringNarrow to one fund and add its working — readings, returns, and the expected-versus-actual table behind the deposit verdict. Ids come from this same tool.
include_archivedbooleanInclude archived funds. Default false. A fund can be archived with a gap still open in it, so ask for them when chasing one.

record_fund_readings Record fund balances from a report

Transcribe what a pension, hishtalmut, provident or managers’-insurance report says into the document — **several readings in one call**. Each entry names a fund by fund_id or by name, and carries one reading: the balance and its date, plus whatever else the report printed. A name that matches no fund creates it, once per batch, so four quarterly reports for one fund are four entries naming the same fund. **Leave out anything the report did not state** — an empty field means "not stated", and a 0 would be read as a stated zero. **Dry-runs by default**: it returns what it would write and…

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
readings *arrayOne entry per reading. Up to 60 in a call.
commitbooleanDefault false. False previews the batch; true writes it.

create_goals Create goals

Add goals — **several in one call**. A goal has a name; a target amount and a target date are optional, and an open-ended goal is a real answer. Its kind is optional and drives nothing (EARMARKED when left out, as the goal form makes it); how many months of expenses the bank should hold is the cushion (`set_cushion`). **Dry-runs by default**; the document is copied to a timestamped .bak before anything is written. **The goal form’s one question is `default_holding`**: a bank account’s Cash, a place kept by hand or a new one takes `already_there`; a holding a broker’s rows buy is follow…

ParameterTypeDescription
goals *arrayOne entry per goal. Up to 60 in a call.
path *stringAbsolute path to a .emd file on this machine.
commitbooleanDefault false. False previews the batch; true writes it.

record_deposits Record savings movements

Record money moving in a goal — **several in one call**. Six modes: DEPOSIT, WITHDRAWAL, TRANSFER between holdings, OPENING for what was already there when tracking started, and GAIN / LOSS for what the market did. **The mode carries the direction; the amount is always positive.** OPENING, GAIN and LOSS are in the balance but are not money the user set aside, so they are kept out of the savings rate. **Dry-runs by default**; the document is copied to a timestamped .bak first. Editing and deleting a movement are app-only. A DEPOSIT here is money **set aside** by hand, still inside the bank; d…

ParameterTypeDescription
deposits *arrayOne entry per movement. Up to 60 in a call.
path *stringAbsolute path to a .emd file on this machine.
commitbooleanDefault false. False previews the batch; true writes it.

set_place_accounts Name the account a place’s money is shown by

Say which account each place on Net worth is — the bank account, the broker, the savings account whose statements show its money — **several in one call**. A place *links* to an account and is not merged with it: a deposit or cash at home has no statements and names none (`account: null` takes a link away). A card cannot be named, and an account is named by one place at most. The account gets its own cash holding in the place, made with the link — or `cash_holding` picks one already there, such as the holding goal deposits already land in. Unlinking keeps the holding. A bank account or c…

ParameterTypeDescription
links *arrayOne entry per place. Up to 60 in a call.
path *stringAbsolute path to a .emd file on this machine.
commitbooleanDefault false. False previews; true writes.

record_holding_readings Record what a statement says a holding is worth

Write what a statement printed each holding was worth on a day — **a list in one call**. Transcribed, never fetched: there is no price feed. `value` is the worth as printed, in major units; `quantity`, `cost_basis` and `price` are optional and each is a check: the cost against what the rows that name the holding put in by that day, the quantity against their quantities, quantity × `price` against the value (a price printed in agorot is divided by 100 first — the check catches it when it is not). An account’s own cash holding takes a value only, checked against the account’s running ba…

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
readings *arrayOne entry per holding and day. Up to 200 in a call.
commitbooleanDefault false. False previews; true writes.

set_goal_deposit_categories Point goals at their deposits

Say what feeds each goal, **several in one call**. **One feed per goal, never both**, so nothing counts twice: either a **Money moved category** — a transaction categorized under it is a deposit into the goal, read from the bank — or, with `from_holding: true`, **the rows that name its default holding**: every buy or sale of that holding inside an account that holds things (`set_transaction_holdings`) is a deposit, and the bank transfer that brought the cash there feeds nothing — or, with `from_transfers: true`, **the confirmed transfers into the bank or cash account whose own Cash is it…

ParameterTypeDescription
goals *arrayOne entry per goal. Up to 60 in a call.
path *stringAbsolute path to a .emd file on this machine.
commitbooleanDefault false. False previews the batch; true writes it.

set_cushion Set the cushion

Set the cushion. **What is in the bank** is the latest statement balance of the bank accounts that count — **every bank account and cash, until `accounts` unticks it**; **each goal saved in one of them holds its part** (its deposits into that account’s own cash holding), and **the cushion is what is left**, against a target of `months` of bills plus the Plan `buckets` (Groceries, say) counted beside the bills. No goal is the cushion and setting it makes none. Goals holding more than an account, or than the whole, is a failed check, never shrunk to fit. Every answer ends with the split as i…

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
accountsarrayBank accounts whose balance counts toward what is in the bank, or stops counting. A card or an account with holdings never counts.
bucketsarrayPlan buckets to count in the cushion, or to stop counting. Ids or names from `plans`.
commitbooleanDefault false. False previews; true writes.
monthsnumberHow many months of bills, above 0 and at most 24, to two places. e.g. 3.

pause_goals Pause goals

Pause goals for a number of months, or start them again, **several in one call**. A paused goal is skipped by the projection and gives its monthly amount back to what is left in Plan for those months; it is not deleted and keeps its history. `months` counts this month: 1 skips this month only. 0 starts the goal again. Plan's own bucket is left alone. **Dry-runs by default**; the document is copied to a timestamped .bak first.

ParameterTypeDescription
goals *arrayOne entry per goal. Up to 60 in a call.
path *stringAbsolute path to a .emd file on this machine.
commitbooleanDefault false. False previews; true writes.

close_goals Close goals

Close goals, or reopen them, **several in one call** — the screen's *Close this goal* and its question. A closed goal keeps its history and takes nothing more. **A goal that still holds money needs `spent`**: `true` when the money was spent on what it was for — the withdrawal of everything it holds is recorded, its why *spent on the goal*, and it closes in the same write, so the bank stops counting that money as the goal's; `false` closes it and the money stays held. A goal that follows its holding's rows cannot be closed as spent while it holds money: a sale there is its money out. `reope…

ParameterTypeDescription
goals *arrayOne entry per goal. Up to 60 in a call.
path *stringAbsolute path to a .emd file on this machine.
commitbooleanDefault false. False previews; true writes.

settle_set_aside Is it still set aside?

Answer, for a goal, whether money **set aside** (promised to it but still inside the bank) is still there. A set-aside amount nobody has confirmed for more than 90 days is the one that is asked about; `goal_projection` lists them. `still_there: true` records today against them so they are not asked about again for 90 days. `false` withdraws them from the goal, with the reason written, so the balance stops counting money that is gone. Several goals in one call. **Dry-runs by default**; the document is copied to a timestamped .bak first.

ParameterTypeDescription
goals *arrayOne entry per goal. Up to 60 in a call.
path *stringAbsolute path to a .emd file on this machine.
commitbooleanDefault false. False previews; true writes.

suggest_goal_amounts Suggest a split

Suggest each goal's monthly amount: goals by nearest date (no kind of goal goes first), each taking what gets it there on its date until what Plan has for goals runs out (what they take now plus what is left after every bucket). A goal with no date is sized as a year of what is missing; a reached, target-less or paused goal gets nothing. The preview is the suggestion; `commit: true` writes it through the same rule a typed amount on Goals uses, so the rest of the split moves with it. **Dry-runs by default**; the document is copied to a timestamped .bak first.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
commitbooleanDefault false. False shows the suggestion; true writes it.

set_goal_amounts Set what goes toward goals and debts each month

Set the monthly amount toward a goal, or the extra on a debt: the Plan bucket for it, in the default plan. The difference comes from (or goes back to) Plan's Everything else, as on the Goals and Debts screens; a goal or debt with no bucket gets one. **Dry-runs by default**; the document is copied to a timestamped .bak first.

ParameterTypeDescription
amounts *arrayOne entry per goal or debt. Up to 60 in a call.
path *stringAbsolute path to a .emd file on this machine.
commitbooleanDefault false. False previews; true writes.

set_opening_balances Set accounts' opening balances

Say what each bank or cash account **held before its first statement**, and the day that stands for everything before — **several in one call**. A document cannot read this off a file. The answer shows the check it buys: opening, plus what the statements moved since, has to equal the balance the last statement ended on, and the row says by how much when it does not. `clear: true` forgets one. A credit card has none. **Dry-runs by default**; the document is copied to a timestamped .bak first.

ParameterTypeDescription
accounts *arrayOne entry per account. Up to 30 in a call.
path *stringAbsolute path to a .emd file on this machine.
commitbooleanDefault false. False previews the batch; true writes it.

create_debts Create debts

Add debts — **several in one call**. A debt is the original principal plus a stream of payments; **the balance is derived, never stored**, so there is nothing here that sets one. Optionally set how payments are discovered: a merchant pattern for a standing order, or a category. **Dry-runs by default**; the document is copied to a timestamped .bak first. Editing, closing and deleting a debt are app-only, as is promoting a card installment group.

ParameterTypeDescription
debts *arrayOne entry per debt. Up to 60 in a call.
path *stringAbsolute path to a .emd file on this machine.
commitbooleanDefault false. False previews the batch; true writes it.

record_debt_payments Record debt payments

Record payments against a debt — **several in one call**. The amount is a magnitude; the direction is known. A payment is **all principal** unless it names an interest portion, because v1 has no amortization schedule. Paying more than is outstanding is allowed and is flagged. **Dry-runs by default**; the document is copied to a timestamped .bak first. Payments the app discovered at import are a separate thing and are confirmed in the app.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
payments *arrayOne entry per payment. Up to 60 in a call.
commitbooleanDefault false. False previews the batch; true writes it.

guide_status Guide: what to set up, and what is done

In a document that keeps the ledger: the places worth setting up, in order — reading statements and paychecks, making the list of categories yours, giving each merchant a category, the bills, the plan, the opening balance and the cushion — with which are done and what the document shows for each, and the tool that does each one. The same list and the same checks as the app’s Guide me. Call it after create_document, or when the user asks what is left to set up. Reads the document; changes nothing.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.

update_account Rename an account or set its last 4 digits

Give an account a real name and the last 4 digits of its card or number. The digits are what matches an imported statement to the right account, and what identifies a card charge on a bank statement, so they are worth asking for. Account ids come from document_info.

ParameterTypeDescription
account_id *stringThe account to change.
path *stringAbsolute path to a .emd file on this machine.
kindstringOne of CREDIT_CARD, BANK, CASH, HOLDINGS, if it was created as the wrong one. HOLDINGS is an account with holdings — a broker, a savings account; `set_place_accounts` then names it from the place it…
last4stringThe last four digits, as digits.
namestringA name the user will recognise, e.g. "Cal – Visa 1234".

choose_categories Archive or restore categories

Put categories away, or bring them back. Give `archive_ids` and `restore_ids` to say exactly which — these work at any time. On a document that holds no account and no transaction yet, `keep_ids` is also accepted and archives everything not listed, which is the fast way to trim the shipped list; it is refused afterwards, when one forgotten id would archive a category out from under a year of transactions. Archiving is not deleting — the history stays and comes back with it — and system categories are never touched. Ids come from category_tree. On a document that already holds work it tak…

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
archive_idsarrayCategories to put away. Their transactions keep pointing at them.
keep_idsarrayEmpty document only: every id to keep. Everything else is archived. Refused once the document holds an account or a transaction.
restore_idsarrayArchived categories to bring back.

create_category Create categories

Add categories the document does not have — **a list of them in one call**. `choose_categories` only keeps or archives the ones already there, so this is what answers "none of these fit". Give a `parent_id` or `parent_name` to put it under another, in which case it takes the parent’s kind and `kind` is ignored. Categories nest three levels at most (Living → Utilities → Electricity): a top-level category is a heading — Living, Lifestyle, Income — and a Plan bucket for it counts everything under it. Entries are applied in order, so a parent and its children go in the same call. If a…

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
categoriesarrayOne entry per category. Up to 100 in a call.

edit_categories Rename, colour, move, merge, archive or delete categories

Change categories that exist — **a list of edits in one call**. Per entry: `name`, `parent_id` (any category of its kind with room — three levels at most — or null for the top level), `move` (up or down), `archived`, `monthly_target` (major units, null clears — the category’s Plan bucket in the plan in use: one figure, shared with Plan), `color` (category-1 … category-11, null for automatic), `icon`, or, alone in the entry, `merge_into` (a category id) or `delete: true` — with `move_to` (a category id of the same kind) when rows, rules, subcategories, Plan buckets, bills, debts o…

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
commitbooleanDefault false. False previews and writes nothing; true makes the changes.
editsarrayOne entry per category. Up to 100 in a call.

set_excluded_from_totals Leave rows out of the totals, or count them again

Leave transactions out of every total — **a list of ids in one call** — or count them again with `excluded: false`. A row left out stays in the ledger and is shown marked; it is simply not summed. This is what the Transactions screen’s row menu does: a card bill the bank statement shows as one charge is the same money as the card statement’s rows, and counting both doubles the month. **Dry-runs by default** and says how much it would take off the totals; commit with `commit: true` after the user has said yes. The document is copied to a timestamped .bak first. Ids come from `transactio…

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
transaction_ids *arrayUp to 2000 transaction ids, from `transactions`.
commitbooleanDefault false. False previews and writes nothing; true makes the change.
excludedbooleanDefault true: leave them out. False counts them in the totals again.

set_transaction_notes Add, edit or clear notes on transactions

Write the note on a transaction — **a list in one call**. An empty `note` clears it. This is the row menu’s *Add a note*: a line about one charge that is worth remembering. **Dry-runs by default**; commit with `commit: true` after the user has seen the table. Ids come from `transactions`.

ParameterTypeDescription
notes *arrayOne entry per transaction. Up to 2000 in a call.
path *stringAbsolute path to a .emd file on this machine.
commitbooleanDefault false. False previews and writes nothing; true makes the change.

set_transaction_holdings Say what a transaction’s cash turned into

Name the holding a transaction bought or sold, and how much of it — **a list in one call**. Such a row is cash turning into a holding inside one account (a broker buying a fund, a savings account opening a deposit): it counts in neither came in, went out nor moved, and the holding’s quantity is the sum of its rows’ quantities. `quantity` is a count of the thing, never money — bought is positive, sold negative, up to six places. `holding: null` clears both. The holding must sit at a place that names the row’s own account, or at one that names none, and is never an account’s own cash…

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
rows *arrayOne entry per transaction. Up to 500 in a call.
commitbooleanDefault false. False previews; true writes.

transfers Transfers between the person’s own accounts

Lists the transfers between two of the person’s own accounts that imports have found: a row leaving one account and the same amount arriving in another within a few days. Undecided ones by default; `answer` reads the transfers or the rows that are not one. An answered transfer is neither income nor spending. `answer_transfers` answers them.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
answerstringWhich to list. Default undecided.

answer_transfers Answer transfers between the person’s own accounts

Answers the pairs `transfers` lists — **a list in one call**. `transfer`: one transfer between two of the person’s accounts, so neither row is income or spending (the end on an ordinary account counts as money moved, the end on an account with holdings is in no total). `not_a_transfer`: two rows that only looked like one; both stay what they were and are never suggested again. `undecided` takes an answer back. **Dry-runs by default**; the document is copied to a timestamped .bak first.

ParameterTypeDescription
pairs *arrayOne entry per pair. Up to 500 in a call.
path *stringAbsolute path to a .emd file on this machine.
commitbooleanDefault false. False previews; true writes.

count_card_charges Count a card payment with no statement as spending

The card payments in a bank statement for a card this document has no statement of — that month of card spending is otherwise missing. Without `cards`, lists them. With `cards` (the last four digits, or `unknown`), counts each card’s payments as the spending they stand for, so Home stops asking; the rows already count, so no figure moves. Reading the card’s statement later still makes them card payments to answer. **Dry-runs by default**; the document is copied to a timestamped .bak first.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
cardsarrayLast four digits per card, or `unknown`.
commitbooleanDefault false. False previews; true writes.

set_no_pay_months Say a month had no pay

Says months had no pay — between jobs, unpaid leave — so no paycheck is missing for them: Home stops asking "No paycheck for …" and `paychecks` stops listing them as gaps. `no_pay: false` takes it back. Stores the answer only; no paycheck and no figure. **Dry-runs by default**; the document is copied to a timestamped .bak first.

ParameterTypeDescription
months *arraySalary months, as YYYY-MM.
path *stringAbsolute path to a .emd file on this machine.
commitbooleanDefault false. False previews; true writes.
no_paybooleanDefault true. False takes the answer back.

set_card_payers Say which bank rows pay a card

Say that a bank merchant pays a credit card — **a list in one call**. Give the bank `transaction_id` and the `card_account_id` it pays (ids from `document_info`); omit the card to take the answer back. This is *This pays a card* on a Transactions row and on a By merchant row. Optionally `counts` says whether those bank rows count in the totals: false leaves them out, because the card’s own rows already hold that money. **Dry-runs by default**; commit with `commit: true` once the user has said yes.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
payments *arrayOne entry per bank merchant. Up to 200 in a call.
commitbooleanDefault false. False previews and writes nothing; true makes the change.

skip_merchants Skip merchants for now, or put them back

Set merchants aside in the By merchant queue — **a list in one call** — or put them back with `skip: false`. "I do not know what this is" is a real answer to a cryptic bank transfer; a skip writes nothing to any transaction. Names are the normalized ones `uncategorized_merchants` prints. **Dry-runs by default**; commit with `commit: true`.

ParameterTypeDescription
merchants *arrayNormalized merchant names, exactly as `uncategorized_merchants` printed them.
path *stringAbsolute path to a .emd file on this machine.
commitbooleanDefault false. False previews and writes nothing; true makes the change.
skipbooleanDefault true: set them aside. False puts them back in the queue.

assign_category Assign categories to transactions

Categorize the transactions with no category — **many merchants in one call**. Send every merchant-to-category decision you have worked out as one `assignments` list rather than calling this once per merchant. **Dry-runs by default**: it returns what the whole batch would change and writes nothing until you call it again with commit true, so show the user the table and let them answer once. Rows categorized by hand are never touched, rows assigned by a rule are left to the rule, and every row it does change is marked AI so the batch stays findable. The document is copied to a timestamped .ba…

ParameterTypeDescription
assignments *arrayOne entry per category-and-scope. Up to 200 in a call.
path *stringAbsolute path to a .emd file on this machine.
commitbooleanDefault false. False previews the whole batch and writes nothing; true makes it.

note_merchant_suggestions Note what was suggested about merchants

Remember what this conversation suggested for merchants that were **not** categorized — a category the user declined, or a name nobody could identify — so the next conversation does not ask about the same names again. Shown in the Asked about column of uncategorized_merchants, cleared automatically when a merchant is categorized. Writes immediately: it changes no transaction, no category and no rule.

ParameterTypeDescription
path *stringAbsolute path to a .emd file on this machine.
suggestions *arrayOne entry per merchant. Up to 200 in a call.

create_rule Create a categorization rule

Create a standing rule that categorizes matching transactions into a category, now and on every future import. **This is the widest write here** — it reaches the whole history — so it needs two calls: the first returns the transactions the rule would match plus a confirmation token, and the second must quote that token back. Show the user the matches before you commit; the token expires the moment the match set changes. Rows categorized by hand are never touched.

ParameterTypeDescription
category_id *stringThe category the rule assigns. Ids come from `category_tree`.
path *stringAbsolute path to a .emd file on this machine.
account_idstringRestrict the rule to one account.
amount_maxnumberRestrict by amount, as a magnitude in major units.
amount_minnumberRestrict by amount, as a magnitude in major units.
apply_to_existingbooleanDefault true: also categorize the transactions it already matches. False creates the rule for future imports only.
commitbooleanDefault false. True requires `confirmation` from the preview.
confirmationstringThe token the preview printed. Required to commit.
kindstringOne of EXACT_MERCHANT, CONTAINS, REGEX, PROVIDER_CATEGORY, AMOUNT_RANGE, ACCOUNT. Default CONTAINS, which survives the branch numbers and spacing that vary between two statements of the same shop.
namestringOptional. Defaults to the pattern, which is the name of most rules.
patternstringWhat the rule matches on. Required for every kind but ACCOUNT and AMOUNT_RANGE.

statement_preview Look at a statement file

Read a card or bank statement (.xlsx, .xls, .csv) and report what is in it: which sheet, where the header row is, what each column looks like and what the app guesses it is, the first rows verbatim, and whether a reader already recognises these columns. Changes nothing — call this before import_statement so the user can confirm the columns. **The user maps the columns; the app only guesses**, so show them this and ask.

ParameterTypeDescription
file *stringAbsolute path to the statement file. One of .xlsx, .xls, .csv.
path *stringAbsolute path to a .emd file on this machine.
amount_conventionstringOne of SIGNED_SINGLE, POSITIVE_IS_CHARGE, SEPARATE_DEBIT_CREDIT. Read from the roles when omitted.
columnsobjectTry columns without importing: column number → role.
header_rownumberForce the header row number, when the guess is wrong.
sheetstringWhich sheet, when the file has more than one. Defaults to the first.

import_statement Import a statement

Import a card or bank statement into an account, through the app’s own pipeline: the same parse, the same dedupe by natural key, the same rules applied on commit. **Dry-runs by default** — it reports what it would import and how the parse compares with the total the file prints for itself, and writes nothing until commit is true. **A file whose printed total does not reconcile is refused**, because importing over it puts numbers in the ledger the file itself says are wrong. Re-importing the same statement is safe: duplicates are matched and skipped.

ParameterTypeDescription
file *stringAbsolute path to the statement file. One of .xlsx, .xls, .csv.
path *stringAbsolute path to a .emd file on this machine.
account_idstringThe account to import into. Ids come from `document_info`. Or `new_account`.
amount_conventionstringOne of SIGNED_SINGLE, POSITIVE_IS_CHARGE, SEPARATE_DEBIT_CREDIT. Usually read from the roles you map — state it only when a single amount column needs saying which sign is a charge.
columnsobjectColumn number → role, from what the user confirmed in `statement_preview`. Omit when a reader already recognises the file.
commitbooleanDefault false. False previews the import and writes nothing.
header_rownumberForce the header row number, when the guess is wrong.
ignore_printed_totalbooleanImport even though the parse disagrees with the total the file prints. Default false, and it should stay false unless the user is certain the file’s own figure is wrong.
new_accountobjectInstead of `account_id`, on a document that has no account for this file yet: the account the statement is for, made on commit — or found, when one of that kind already has these last 4 digits, as t…
save_mapping_asstringKeep these columns as a reader under this name, so the next statement of the same shape imports without asking.
sheetstringWhich sheet, when the file has more than one.

record_holdings_statement Record a statement of an account with holdings

Write what a broker’s (or any account with holdings’) statement printed — **the whole file in one call**: its movements onto the account, and its holdings table as dated readings. **You read the file** — a PDF, usually — and send what it printed; nothing here parses it. Each row is the **value date**, the description as printed, the signed `amount` (a buy negative, a deposit or a sale positive; a fee printed in its own column is already inside the amount), and `cash_after`, the cash balance the statement printed after it. A buy or a sale also names the `holding` and the `quantity` (b…

ParameterTypeDescription
as_of *stringThe day the holdings table is for, YYYY-MM-DD.
file *stringAbsolute path to the statement file you read. Hashed, so the same file is known again.
path *stringAbsolute path to a .emd file on this machine.
account_idstringThe account with holdings. Or `new_account`.
cashnumberThe cash line of the holdings table, in major units.
commitbooleanDefault false. False previews; true writes.
currencystringDefaults to the document’s currency.
fromstringThe first day of the period the statement printed, when it printed one.
holdingsarrayThe holdings table, one entry per holding but the cash. Up to 100.
new_accountstringInstead of `account_id`: the name of the account to make, e.g. the broker’s name.
placestringThe place on Net worth that names the account, when it names none yet — by id or name; made when new. Defaults to one with the account’s name.
rowsarrayEvery movement, in the order printed. Up to 400.

frame_copy The document, for a view drawn in the conversation

Not for a model: a view drawn in the conversation calls it with its own key to fetch its document, and any other call is refused. Read rows with `format_rows`.

ParameterTypeDescription
key *stringThe drawn view’s own key.
path *stringAbsolute path to a .emd file on this machine.
sincestringThe stamp of the copy the view holds; no copy comes back while it still holds.