Skip to main content

beancount-io

bea is the command-line interface for Beancount.io. Create and edit plain-text Beancount ledgers, import bank exports, validate accounts, run BQL queries, and generate financial reports. Local bookkeeping needs no Beancount.io account. Optional AI assistance and hosted ledger management use your Beancount.io credentials.

The Python distribution is beancount-io; its executable is bea. Run bea --version and bea COMMAND --help to check the version and options you have installed.

Contents

Install

Install bea once. You do not install Beancount, Beanquery, or Fava yourself — bea manages a separate engine environment automatically.

# Installs software; needs Homebrew or uv plus network.
brew install bex-co/tap/bea      # macOS and Linuxbrew — dual venv at install time
uv tool install beancount-io     # anywhere with uv and Python 3.12+ — engine on first use

Optional Beangulp and Beanprice stay out of that base install. Enable them explicitly into the managed engine when you need ingest helpers or quote fetching:

# Needs network once. System libmagic is optional (python-magic importers only).
bea engine enable beangulp    # then: bea import --ofx … / bea ingest …
bea engine enable beanprice   # then: bea price …  (not bea add price)

bea import --csv and bea add price work without those features; bea import --ofx needs Beangulp. The beancount-* ledger skills for Claude Code and Codex run on this single bea installation and never ask you to install Beancount separately — see the skills installation guide and the first-query walkthrough.

Channel When the engine appears After that
Homebrew During brew install (frontend + engine venvs in the keg) Local commands work offline
PyPI (uv tool / pipx) First local command that needs the ledger engine Same environment is reused offline

bea upgrade updates the frontend through its package manager and refreshes the matching engine. If a first-use or upgrade provision fails, retry a local command such as bea check once the network is available — do not pip install beancount.

Which bea is running?

A shell can resolve a different bea than you expect. This happens when an older install sits earlier on PATH, or when a coding agent runs commands in a login shell that rebuilds PATH. Diagnose from the shell that actually runs the command. For an agent, that means asking it to run these steps, not running them in your own terminal.

# Needs an installed bea; reads only, except the last line's check.
type -a bea              # every bea on PATH, in resolution order
bea --version            # the version this shell selects
bea engine status        # the engine it would use: managed, first-use, override, checkout
BEA=/absolute/path/to/the/bea/you/verified
"$BEA" --version && "$BEA" --file main.bean check
  • An old executable shows an older --version, or a different first path in type -a. Call the verified absolute path, as in the last line, or fix PATH in the shell's startup files. For an agent session, give it that absolute path to use for every command.
  • An unprovisioned engine shows the expected version, but engine status reports not provisioned; provisions on first use. That is not a version problem: the first local command, such as bea check, sets the engine up once the network is available.

The default installation omits AI dependencies. For bea ask, install the extra (or run it without replacing your bea):

# Installs software; needs uv plus network.
uv tool install 'beancount-io[ask]'
uvx --from 'beancount-io[ask]' bea ask --help

Quick start

bea --no-input init books --currency USD --date 2026-08-01 \
  --opening-balance "Assets:Checking 1000"
cd books
bea add transaction "Coffee" --date 2026-08-02 \
  --posting "Expenses:Dining 12.50" --posting "Assets:Checking"
bea check
bea format -i main.bean
bea list transaction --limit 10
bea report balance-sheet

The purchase leaves 987.50 USD in checking: the currency comes from the account and Beancount fills in the balancing posting. For a bank export, see the import guide; for your first month end to end, follow the tutorial.

Already keep a Beancount ledger? bea init --existing PATH reads it, writes an AGENTS.md beside it for coding agents, lists what needs attention (plugins and options Beancount 3 does not load), and changes no ledger file. See bring an existing ledger.

Command map

Command Purpose
bea init [DIRECTORY] Create a local ledger with common accounts, or a setup preset (--preset personal@1, plus --module investments@1 and other modules); --agent-files also writes AGENTS.md for coding agents; --existing describes books you already keep and writes only their AGENTS.md, changing no ledger file
bea add TYPE Append one of eleven directive types
bea update TYPE Rewrite entries in place; recategorize the import review queue
bea import SOURCE Preview or apply a bank CSV (--csv), OFX/QFX (--ofx), or importer (--config)
bea ingest OP Beangulp identify/extract/archive (needs bea engine enable beangulp)
bea price Managed price status/refresh/export, or fetch quotes via bean-price (needs bea engine enable beanprice; not bea add price)
bea list TYPE Inspect directives and filter transactions
bea check Validate the complete ledger
bea format [PATH…] Format to stdout (safe default); --in-place / -i rewrites, -o writes elsewhere
bea query [BQL] Run a query or start the interactive BQL shell
bea doctor OP Beancount's eleven diagnostic operations, plus the agent-guidance check
bea example Generate an example ledger history
bea treeify Render an account column in any text as a tree
bea report TYPE Overview, income statement, balance sheet, trial balance, holdings, register, capital gains, cash flow, or budget versus actual; --format csv for a spreadsheet
bea balance [ACCOUNT…] Trial-balance subtrees for matching accounts
bea ask [QUESTION] Ask about a local ledger through the hosted AI service
bea cloud … Sign in and manage hosted ledgers
bea engine status|enable Inspect or enable optional engine features (Beangulp / Beanprice)
bea upgrade [--check] Check for an update or invoke the owning package manager

Global options come before the command; --file selects the root ledger:

bea --file main.bean check
bea --json list transaction --limit 100
bea --json query "SELECT account, sum(position) GROUP BY account" -o balances.json
bea doctor region --help

Every flag, default, and help string is listed in the generated command reference.

Managed price includes

In bea 0.3.0 and later, sign in with bea cloud login (or set BEA_TOKEN for automation), choose a pair at Live Prices, then add one line to value a holding in every bea command:

include "https://beancount.io/prices/BTC-USD"

bea price status shows each source's freshness, bea price refresh re-resolves on demand and exits nonzero if any source fails, --offline reads the cache only, --strict-prices fails the load on a stale, unavailable or failing source, and bea price export snapshots portable local includes for stock Beancount and Fava — which cannot fetch the URL themselves. The usage guide has the full contract.

Exit codes

Code Meaning
0 Success, including previews and intentional duplicate skips
1 Ledger, schema, formatting-check, or other runtime failure
2 Bad arguments, missing file or input, missing optional dependencies
3 Authentication or permission failure, including a read-only destination
4 Conflict: concurrent change, import review required, or uncertain remote write

The usage guide documents the full contract: JSON error shape, cloud HTTP mapping, prompts, and output exceptions.

Learn more

  • Tutorial: your first month, from init to a month-end report.
  • Usage: the contract — targets, JSON envelope, exit codes, prompts, environment.
  • Importing: no-code CSV and OFX import, rules, and Python importers.
  • Reference: every command's usage, arguments, and options, generated from the code.
  • BQL cookbook: 22 tested query recipes for humans and agents, each executed by CI.

Development

# Clones the repo and syncs dependencies; needs git and network.
git clone https://github.com/bex-co/beancount-io.git
cd beancount-io/cli
uv sync --all-groups
uv run bea --help
make check-all

Python 3.12+, Typer, and Pydantic for the beancount-io frontend. The frontend never loads Beancount, Beanquery, or Fava. The single beancount-io wheel bundles helper/Fava sources as resources; a child process runs them with automatically managed upstream dependencies. Retain NOTICE.fava and LICENSE.engine. src/cli/ holds command UX; src/bea_engine/ and src/fava/ are engine-side; tests/ the pytest suite; docs/ the guides above; openapi/v1.json the pinned contract for hosted commands. make check-all is the handoff gate: lint, deadcode, format-check, typecheck, test, spec-check, and docs-check. Do not hand-edit generated API clients, command stubs, docs/REFERENCE.md, or lockfiles; keep scratch files under tmp/. See the package guide for architecture boundaries and contribution rules. Optional Beangulp/Beanprice are enabled with bea engine enable (see Usage); the customer-facing beancount-* ledger skills live in skills/ and target this same single installation.

Releases

Releases ship to PyPI and Homebrew from cli-vX.Y.Z tags; the release guide holds the tagging procedure and one-time credentials setup.

License

Frontend: MIT © Beancount.io. Bundled ledger helper: GPL-2.0-only; vendored Fava retains its MIT notice. Vendored Fava attribution is preserved in NOTICE.fava.

Metadata

Release files for beancount-io 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for beancount-io 0.4.0
File Size Uploaded Provenance Actions
beancount_io-0.4.0.tar.gz 2.6 MB With provenance Details for beancount_io-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for beancount-io 0.4.0
File Interpreter ABI Platform Actions
beancount_io-0.4.0-py3-none-any.whl Python 3 none any Details for beancount_io-0.4.0-py3-none-any.whl

Total release size: 4.0 MB

Release files / beancount_io-0.4.0.tar.gz

Download URL beancount_io-0.4.0.tar.gz
Size 2.6 MB
Tags Source
SHA-256 checksum
How to use checksums
6d3672e88798ad02336b4fe8adb2266117751d11ff62a39b8f0fce2a489d6ed3
BLAKE2b-256 checksum
How to use checksums
7b2bdef29728380ef0ed12eabf8de3fe09752d87734a80a92eebfb8b2cc1f8c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Release files / beancount_io-0.4.0-py3-none-any.whl

Download URL beancount_io-0.4.0-py3-none-any.whl
Size 1.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
ce0e66bbb3bfd7bb991c5bc8b0442483c6124ec637c4f99cfe846f3d8cacf54e
BLAKE2b-256 checksum
How to use checksums
2be0743209e53b39092e52f6e436c88752a63a5be895ed5db49f5619e330f843
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Security for beancount-io 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for beancount_io-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page