/beancount:buildfrom beancount
This skill should be used when the user wants their Beancount journal rebuilt or checked — "rebuild the ledger", "update the journal", "build the beancount file", "why does the journal fail its check", "which transfers did not pair", "apply my review decisions" — or right after new statements were extracted with statement-extract. It runs `beancount-kit build`, which regenerates the whole journal from durable inputs and writes it only when Beancount's own check passes. The journal is never edited by hand.
Ships in beancount. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
The journal is a build artifact. Every fact in it comes from an input the consumer keeps:
| Input | Holds | Edited by |
|---|---|---|
canonical JSONL (statement-extract/1) | transactions, statement closings, loan snapshots | statement-extract, never by hand |
ledger.toml | account map, transfer settings, category→account overrides, gaps | the operator, rarely |
| rules CSV | pattern rules → Plaid DETAILED category (checked against plaid-pfc's pin; an invented name refuses) | the operator |
| decisions CSV | one row per Key: category override, note, service link, accepted suggestion | the operator |
accounts.toml (optional) | figures read off the lender's screen | the operator |
The consumer keeps all of these in its data store, never in a repo. The ledger.toml
format is documented at the top of lib/beancount_kit/config.py; the rules and decisions
columns are documented at the top of lib/beancount_kit/rules.py and inputs.py.
KIT="${CLAUDE_PLUGIN_ROOT}/scripts/beancount-kit"
"$KIT" build <jsonl files or folders>... --ledger ledger.toml --rules rules.csv \
--decisions decisions.csv [--accounts accounts.toml] [--budgets budgets.csv] \
[--statements <folder>] --out "$BEANCOUNT_JOURNAL"
--check-only builds and checks without writing.--emit-pairs F writes [[out_key, in_key, kind], ...]; --emit-rows F writes the
rows in pairing order (columns A–L) for an oracle comparison.$BEANCOUNT_PYTHON, the interpreter that has beancount.| Field | Means |
|---|---|
pairs | matched transfer pairs by kind: exact, fee, conversion, cross-currency |
review | entries flagged ! on Expenses:Uncategorized |
unpaired_must_pair | rows whose rule required a partner and found none (now in review) |
transfer_residue | own-account legs with no partner. They post to transfers.external (so Assets:Transfers always nets to zero) and each Key is listed below the line; a partner found by a later build pairs them back |
rows_dropped_overlap | rows a lower-ranked source (a PDF) printed on days a bank export already covers; each file is listed as overlap:. Their statement closings are still asserted |
bridges | holes bridged by a labelled Equity:Gaps pad, each listed as gap bridged: with its date range |
assertions_skipped_overlap | statement closings not asserted because a later statement prints a row dated on or before them (no day boundary separates the two); each is listed. Never padded or adjusted |
budgets / queries / documents | Fava budgets, saved queries and statement links written (see below) |
documents_missing | statements with no file of the recorded sha256 under --statements |
check_errors | Beancount errors; non-zero means nothing was written |
The journal is rebuilt every time, so nothing is typed into it. Each feature has one home:
| Feature | Home | Written as |
|---|---|---|
| Fava extensions | ledger.toml [[fava_extension]] name (module) + optional config string, e.g. name = "fava_dashboards" (its dashboards.tsx sits next to the journal) | custom "fava-extension" "<module>" ["<config>"] |
| Fava options | ledger.toml [fava], e.g. default-page = "income_statement" | custom "fava-option" "<key>" "<value>" |
| Saved queries (Query tab) | generic ones in lib/beancount_kit/queries.toml; personal ones in ledger.toml [[query]] name + sql; a personal query of the same name replaces a generic one | query "<name>" "<sql>" |
| Budgets | a CSV with from, account, period, amount[, currency] (--budgets); period is daily, weekly, monthly, quarterly or yearly; a row with no amount is skipped | custom "budget" <account> "<period>" <amount> <cur> |
| Statement PDFs | --statements <folder>: each statement links to the file whose sha256 its extract recorded (by content: recorded names are masked) | document <account> "<absolute path>" at the statement's closing date |
| Need | ledger.toml / flag | Effect |
|---|---|---|
| Exchange rates | --prices <folder> of *.beancount price lines (e.g. pricehist fetch bankofcanada USD/CAD -o beancount); [pegs] AED = { base = "USD", rate = 3.6725 } derives a pegged currency | price directives; Fava converts every currency to the operating one |
| An asset no statement covers (a house) | [[snapshot]] account, date, amount [, currency, revalue] | first figure opens from opening balances; each later change books to revalue |
| A loan read as screen snapshots (a mortgage) | interest = "<expense account>" on its [[account]] | the gap between two snapshots that payments do not explain books to interest |
| Payments that reduce a loan, not spending | [categories] key scoped to the paying account: "LOAN_PAYMENTS_MORTGAGE_PAYMENT@<label>" = "<liability account>" | the payment moves money to the liability; the same category elsewhere is unchanged |
Every categorised entry also carries rule: "<priority>", the Category rules row that decided
it (absent when a decision row did). The generic "Rows by rule" query groups by it.
Measured 2026-11-01 (Fava 1.30): a journal with all four loads with 0 errors, including paths
that contain spaces.
Put every statement file into the cache: QFX, CSV and PDF, overlapping or not, already
synced or not. The cache is keyed by file sha256, so a file added twice is one file. The build
decides, per account and per day (lib/beancount_kit/survive.py):
| Situation | What the build does |
|---|---|
| Two bank exports overlap (re-download, "last 30 days") | Union; the bank's own IDs dedupe them, and a late-posted row is kept |
| A PDF covers days a bank export covers | The export owns those days; the PDF's rows there are dropped and reported |
| A PDF covers days nothing else covers | Its rows are kept: it fills exactly those days, cut at whole days |
| The PDF and the export disagree about a day | The PDF's printed closing is still asserted, so the build fails |
| Days no statement covers, between covered stretches | A pad from Equity:Gaps bridges the hole, labelled gap: "not recorded: <from> to <to>" |
A statement for an account ledger.toml does not map | The build refuses: map the account (a replaced card number is a new ref) |
The name for this is source precedence (MDM "survivorship"): when sources overlap, a
ranked rule picks which copy of a fact wins, and the bank's printed balances prove it.
Rejected: matching rows across sources by a date window and amount (beangulp
heuristic_comparator, beancount-import's matcher), because banks post identical charges on
one day and a fuzzy matcher merges them; beancount-import also edits the journal, which here is
derived.
history)"$KIT" history <jsonl...> --ledger L --rules R --decisions D --out "$(dirname "$BEANCOUNT_JOURNAL")/history.jsonl"
decision (a Review decisions row);rule (ref = the rule's priority, note = the rule's note);none.plaid-pfc's suggest and eval.coverage)"$KIT" coverage <jsonl files or folders> # exit 3 on a balance break or a conflicting Key
rows_resolved_overlap, not a failure.noduplicates plugin catches exact duplicates only."$KIT" groups --out groups.csv # group, pattern, count, total, first, last, sample, accounts
pattern.<SIC>), and no open merchant-name dataset exists."$KIT" suggest --evaluate # holdout accuracy on entries already categorised
"$KIT" suggest --out suggestions.csv # key,suggestion for every entry flagged "!"
* (paired transfers excluded) with smart_importer's
predictor, and predicts the category of each flagged entry. It never writes the
journal.suggestion column with accept unticked.
It counts only once the operator ticks accept; then rebuild.--evaluate is an upper bound: rule-labelled entries are easier than the flagged ones.
Measured 2026-11-01: 92.9% on the holdout, about 3 in 15 right on a spot check of flagged
entries. Prefer groups.smart_importer in $BEANCOUNT_PYTHON; doctor reports whether it is there.metrics)When the consumer has an OTLP endpoint, send the ledger's health right after a build that wrote the journal. It pushes ratios and counts only (savings rate, budget pace, import freshness, review backlog, loader errors), never an amount or an account name:
"$KIT" metrics --journal "$BEANCOUNT_JOURNAL" --push
The three BEANCOUNT_KIT_OTLP_* values come from the consumer's secret store at run time,
never from a file. On nix-config that is
secret exec BEANCOUNT_KIT_OTLP_ENDPOINT=grafana:otlp:endpoint BEANCOUNT_KIT_OTLP_INSTANCE=grafana:otlp:instance BEANCOUNT_KIT_OTLP_TOKEN=grafana:otlp:token -- "$KIT" metrics --push.
Without them, run metrics without --push to read the same numbers locally. A failed push
never fails the build.
| Code | Meaning | Do |
|---|---|---|
| 0 | written, or unchanged | — |
| 2 | bad input or wrong schema | fix the input named |
| 3 | refused: check errors, unmapped account, one Key with two values, a decision for a Key no input carries | read the listed items; fix the input, never the journal |
ledger.toml; the next build would erase a hand edit.[[gap]] and its reason.~ 0.00). Beancount's default would pass a figure one
cent off. A cent that no statement explains, e.g. interest rounded between two statements
the bank never issued, is a [[gap]] with its reason, never a looser tolerance.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub kattakath/skills --plugin beancount3 skills in this plugin
/favaThis skill should be used when the user wants to see their Beancount journal in a browser — "open Fava", "show me the ledger", "net worth chart", "balance sheet", "income statement", "start/stop Fava", "is Fava running". It starts Fava on demand, read-only, on 127.0.0.1, and stops it when the review is done.
/queryThis skill should be used when the user asks a question their Beancount journal can answer — "what did I spend on groceries last month", "net worth today", "balance of my card", "which transactions need review", "spending by category this year", "show the transfer residue", "find transaction {key}". It answers with bean-query (BQL) against the journal, using tested recipes, and never edits the journal.
Other plugins' skills for the same job