GitHub
Assistant

The assistant

Ledgeline has an optional chat assistant. It answers questions about Ledgeline and hledger from their manuals, reads your books to answer questions about them, builds tables and charts from exact figures, and proposes changes to your journal that you approve or reject. Every approved change can be undone.

The assistant is off until you set it up. Until then nothing in the app mentions it except Settings → Assistant, which says it is off and how to turn it on. There is no button, menu item or shortcut for it.

It talks to a language model that you choose. The recommended setup is a model running on your own computer or your own network, so your books never leave your machines. Hosted services such as OpenAI, Anthropic, Google Gemini and OpenRouter work too. They start with Help access only: a third-party service can answer general questions but doesn’t see your financial details.

Turning it on

The assistant needs a profile: a model server, the model to use on it, and how much the assistant may do with it. You add profiles in Settings → Assistant, or by hand in ui-prefs.toml. Both end up in the same place, the [ai] table of your global ui-prefs.toml. Profiles are never stored in a books folder, so books you share through git or a synced folder never carry your model server’s address.

The open books use the first of these that exists:

With several profiles and no default, the assistant is off unless the books pick one. Settings says so.

A model on your own machine

Any server that speaks the OpenAI Chat Completions protocol works, and so does Ollama’s own protocol. These three are the common ones:

ServerStart itProfile kindAddress
llama.cppllama-server -m model.gguf --port 8080openai-compatiblehttp://127.0.0.1:8080/v1
Ollamaollama serve, after ollama pull of a modelollamahttp://127.0.0.1:11434
LM StudioStart its local server from the appopenai-compatiblehttp://127.0.0.1:1234/v1

Ollama also answers the OpenAI protocol at http://127.0.0.1:11434/v1, so the openai-compatible kind works with it as well. vLLM and other OpenAI-compatible servers work the same way.

The smallest working setup is one profile in ui-prefs.toml, in Ledgeline’s config folder:

[ai]
default = "local"

[ai.profiles.local]
name = "Qwen on this Mac"
kind = "openai-compatible"
url = "http://127.0.0.1:8080/v1"
model = "qwen3-30b"
access = "propose"

local is the profile’s id. model must be a name the server lists. A local profile with no access line gets Propose. The [ai] section of the settings files page lists every key.

In Settings

Settings → Assistant does the same without editing a file. It is the last tab. Click it, press its number key if it has one, or open Settings with ?tab=assistant. The number keys follow the tabs you can see.

  1. Click Add profile.
  2. Give it a name. The id is made from the name. It is how ledgeline.toml refers to the profile, and it can’t be changed later.
  3. Choose the kind and enter the server address. The form says “This server is on your network” for a local address, and warns when it isn’t.
  4. Enter the model name. Ledgeline suggests the models the server has (see Model suggestions).
  5. Choose what the assistant may do, and how many tool rounds one answer may take, then click Add profile.
  6. Click Check. Ledgeline asks the server which models it has and what the chosen one can do, and reports what it found: whether the server answered, whether your model is one of the ones it lists, and whether the model takes tool calls.
  7. With more than one profile, click Make default on the one to use.

When the assistant is on, the top of the tab says which profile it is using and which key opens it.

Model suggestions

You don’t have to know the model’s exact name. About half a second after you stop typing the server address, Ledgeline asks that server which models it serves. The Model field then offers them as you type, and says “Found 12 models”, say.

Asking saves nothing. The profile is only written when you click Add profile or Save. If the server doesn’t answer, the form says nothing and you type the name yourself.

A few rules decide when Ledgeline asks:

If your ui-prefs.toml is a symbolic link managed by a dotfiles tool, Ledgeline won’t write to it. Add the profile to your dotfiles by hand instead.

Local or hosted

Ledgeline decides from the address whether a server is local or hosted:

A hosted server must use https. A plain http address that isn’t local is refused.

If you run your own model server under a public name, tick This is my own server in the profile, or add network = "local" to it. Ledgeline then treats it as local, with local defaults and no third-party warnings. Only do this for a server you run yourself. It applies to names only: a public IP address is always hosted, and so are the four hosted service kinds.

Hosted services

The OpenAI, Anthropic, Google Gemini and OpenRouter kinds always talk to the service’s own address, so a profile of one of those kinds has no url. They need an API key (see API keys).

[ai.profiles.claude]
name = "Claude"
kind = "anthropic"
model = "claude-sonnet-5-5"   # the service's model id

A hosted profile starts at Help, which sends the service your question and the manual sections the assistant looks up, and nothing about your books. Raising it needs your explicit confirmation; see What the assistant may do.

On iPhone and iPad

The iOS app has its own assistant settings, separate from your Mac’s. Set a profile up in the app’s Settings › Assistant, then open the chat from the menu’s Assistant item.

A phone or iPad doesn’t run a model server, so a profile that points at localhost or 127.0.0.1 does nothing there. The app leaves such profiles out and notes this in Settings, and if that leaves none, the assistant is off. Use one of these instead:

The app has no hledger, so a few things differ from the desktop:

What the assistant may do

Each profile has an access level. Each level includes the one before it.

LevelWhat the model sees and doesDefault for
HelpAnswers questions about Ledgeline and hledger. Sees the manuals and your question, not your books.Hosted profiles
ReadAlso reads your books to answer: transactions, payees, amounts and account names.
ProposeAlso reads the books’ files as written, and proposes changes to your books. Nothing is written until you approve it.Local profiles

Ledgeline enforces the level itself. The model is only told about the tools its level allows, and a call to any other tool is refused, so a model can’t gain access by asking for it.

At Help, the model is told nothing about your books, not even your account names. From Read up, it also gets a short summary of them: the main journal’s file name, how many transactions there are and over which dates, the commodities, and the top-level accounts. The summary has no amounts and no payees.

Raising a hosted profile above Help shows a warning first. It names the service and says that the transactions, payees, amounts and account names the assistant reads to answer you are sent to it, under its own data retention policy. You confirm with Allow read access.

Raising a hosted profile to Propose shows a second, stronger warning: a third party’s model would choose edits to your books, and it reads whatever it needs to write them. You can Allow proposals, or Use Read instead. Every change still waits for your approval either way, but for changes a model on your own machine or network is the safer choice.

Writing access = "read" or access = "propose" into a hosted profile in ui-prefs.toml by hand skips these warnings. The file is yours, so Ledgeline takes it as your decision.

API keys

Hosted services need an API key, and a local server can take one too if you set it up that way. Enter it in the profile’s API key field. Ledgeline keeps it in your operating system’s keychain, the same place it keeps bank sync’s access keys, and never writes it to a file or shows it again. A profile with a saved key says “key saved”. Remove key deletes it, and deleting the profile deletes its key too.

On a system with no keychain Ledgeline can use, Settings says that API keys can’t be stored on this computer, so services that need one won’t work there. Local servers without a key still work.

Choosing for one ledger

A ledger can make one of two choices for itself, under [ai] in its own ledgeline.toml:

[ai]
# Use this profile from ui-prefs.toml for these books.
profile = "local"
[ai]
# Never offer the assistant for these books.
enabled = false

profile picks one of the profiles in your ui-prefs.toml by id, as the default for these books. If no profile has that id, the books use the default as usual. It doesn’t stop you picking another profile for a chat. enabled = false turns the assistant off for these books whatever else is set, and is the only way to keep it away from a ledger entirely.

A books folder can make only these two choices. A ledgeline.toml travels with the books, so somebody else may have written it, and it can’t add a profile, name a server or model, or change an access level. Anything else under its [ai] is ignored.

Ledgeline never writes [ai] in ledgeline.toml; edit the file by hand. Settings → Assistant shows what the open books’ file says.

Using it

When the assistant is on, a chat button appears at the right of the top bar.

Type a question and press Send. Stop ends an answer early. The chat header shows the profile in use, whether it is local or hosted, and its access level. New chat starts over, and Changes lists the changes the assistant has made to these books (see Undo).

As the assistant works, the chat shows each step. “Used totals” lines expand to the request it made. “Sent to profile: …” lines expand to exactly what that tool returned to the model, so you can see what left Ledgeline. For a hosted profile these lines are marked “third party”. Some models also show their reasoning under Thinking.

Each tool call gets 60 seconds.

Choosing the profile for a chat

With more than one profile, the chat header has a profile list in place of the name. A chat starts on the profile the books use (see Turning it on), and you can pick any other for this chat. The pick lasts until you quit Ledgeline, so New chat keeps it, and it never changes the default in Settings. A key-based service shows in the list only once its key is saved. A ledger that says enabled = false offers none.

Picking another profile always starts a new chat. The conversation so far stays behind, so a chat that read your books through a model on your own machine is never handed to a hosted one. If the chat has messages, Ledgeline asks first. Changes it proposed that you haven’t approved are dropped, as with New chat, and attached files aren’t carried over. Your last message is put back in the box, unsent, so pressing Enter asks the other model the same question.

Tool rounds

Answering one message usually takes the assistant a few rounds of lookups: search the manual, run a report, narrow the result, then answer. Each profile sets the most rounds one answer may take, under Tool rounds. The default is 10, and it can be anything from 0 to 50.

When the rounds run out, the assistant answers with what it has found so far. Raise the limit if answers keep stopping short, or lower it to keep a slow model from working on one question for too long.

Sometimes a model’s reply arrives empty, with no text and no lookup. This usually means the model asked for a lookup in a form its server couldn’t read, and the server dropped it. The chat says so, and the model is asked to try again, at most twice per message. Each retry uses one round. If the reply is still empty, the answer stops with an error. Trying again often works; a different model may work better.

A model can also stop after announcing a lookup, such as “Now let me check the purchase:”, without making it. The usual cause is the same, a lookup the server couldn’t read. When a reply ends like that and rounds remain, the chat says so and the model is asked to make the lookup or give its answer. This happens at most once per message, and uses one round.

At 0 the assistant is a plain chat. It gets no tools at all, not even the manuals, and answers from the model’s own knowledge and what you type. It can’t see your books at any access level.

Answers are formatted text, with a few limits for safety. Images in an answer are never loaded; they show as [image: …]. Links show their full address as text and aren’t clickable.

What it can reach

The model never runs anything on your computer. There is no shell, no general file access and no network access. Everything it does goes through a fixed set of tools built into Ledgeline, each with the same checks as the rest of the app.

At Help:

At Read, also:

The assistant tries these roughly in that order: Ledgeline’s reports first, then totals and transactions, and a raw hledger report only when nothing else fits.

totals and transactions take account names loosely. “groceries” finds expenses:food:groceries, and “food” finds expenses:food and everything under it. A type such as expenses, income or assets picks every account of that type, going by the type: you declared (or, if you didn’t, the account’s name, as hledger does). Each answer starts with a line saying which accounts matched, how many transactions there were and their total, so you can check it read the question the way you meant. Dates are a period such as 2026, 2026-03, 2026q1, lastmonth or thisyear, or a from and to date. As in hledger, the to date isn’t included.

At Propose, also:

Reading the files themselves is for making changes, so it comes with Propose. At Read, answers come from the tools above, which read the books the way Ledgeline does.

These limits keep the tools contained:

The help tools search the hledger manual built into your own hledger program, and the pages of this manual, which are built into Ledgeline. Nothing is fetched from the internet. Without hledger, only this manual is searched. Help answers draw on the hledger manual, Ledgeline’s own pages and the Accounting basics guide, so general bookkeeping questions get answered offline too; the assistant never fetches web pages.

Reading Ledgeline reports

From Read up, the assistant can read the same reports you see in Ledgeline, so its figures match your screens. It prefers them to a raw hledger report when one fits. The reports it can read are:

This is a fixed list, and the assistant can’t reach any other part of the app through it. No report on it writes a file, changes a setting, updates prices, reaches the network or shows your keys, so nothing the assistant reads this way can change anything. Prices, bank sync, settings, rules and imports aren’t on the list.

The assistant uses these reports to answer you. They don’t become tables you can open. For those it runs hledger reports or searches transactions.

Tables and charts

The assistant doesn’t type the figures in its tables and charts. When a tool returns rows (an hledger report, a search for transactions), Ledgeline keeps them as a dataset with exact amounts. The model can then ask for a new dataset made from one it has: filtered, narrowed to some columns, grouped and totalled, pivoted, sorted, cut to the top few with the rest as “other”, bucketed by week, month, quarter or year, given a running total, or compared before and after. Ledgeline does that arithmetic with exact decimals. The model only picks the steps.

When the assistant shows you a result, it opens as a tab in the results pane. A chat line for each dataset has Show to open it, and in the side panel a link opens the full view where the results are. A result can be:

Every result ends with where it came from, such as the hledger command and the steps after it. Copy command copies the hledger command so you can run it yourself.

Export .xlsx saves a result as an Excel workbook. The first sheet holds the table, laid out like the reports’ exports, with amounts as numbers rather than text. A Notes sheet records the title, each step that made the result, the hledger command, and when you exported it. A chart can also be saved with Download PNG or Download SVG.

The assistant still writes numbers in its answers. Ledgeline compares every amount in an answer with what the tools returned in this conversation and with what you typed. A number found in neither gets a dotted underline, with the note “Not from your books”. This catches the worst case, a total the model made up. It can’t catch everything, such as a real number quoted for the wrong thing.

Charting a table yourself

You don’t need to ask the assistant for a chart. Every table result has a Table and Chart toggle at the top. Chart draws one straight away, with no model involved, and shows three controls:

The first chart puts the first date or text column across the bottom and plots every number column. It is a line over dates and bars over anything else. Ledgeline refuses what it would refuse the assistant, such as a text column as values or a pie of more than eight slices, and says why. Table goes back, and your choices are kept if you switch again. Export and downloads work as they do for the assistant’s own charts.

Charting a table from an answer

Sometimes the assistant writes a table into its answer instead of opening one. Each such table has an Open in results button under it, which opens it as a table result, so Chart and Export .xlsx work on it too. Ledgeline reads a column as numbers when every filled cell is one ($1,234.56, -40 EUR, (12), 12.5%), as dates when every cell is a date, and as text otherwise.

These figures are the ones the assistant typed, not ones Ledgeline worked out from your books, and the result says so where it shows where it came from. Numbers the books don’t contain are already marked in the answer. A table from an answer can’t be saved as a report, because there are no steps to run again. Ask the assistant to build it from your books if you want to keep it.

Saved reports

A result you want again next month can be kept as a saved report. Click Save as report on a result in the full Assistant view, give it a name, and click Save. Ledgeline keeps how the result was made, not its numbers, so running it later uses your books as they are then.

A saved report holds three things:

Periods stay as they were asked for. A report of “this year” covers this year whenever you run it, and a fixed date stays fixed.

Only results that started from totals, transactions, an hledger report or the account list can be saved. Answers drawn from Ledgeline’s own reports aren’t tables, so there is nothing to save. A result Ledgeline can’t remake says so when you try.

Running a saved report

The Saved reports list sits above the results in the full Assistant view (g a). Reports made on the books you have open come first. One made on other books shows an Other books badge, and you can still run it here.

Before a run, Ledgeline checks that the open books have every account the report asks for. If some are missing, it runs nothing, and says which accounts these books lack rather than showing you an empty table.

Saving, listing, running and changing saved reports all need the assistant to be on for the books you have open, even though a run reaches no model.

Saved reports are kept in ai-recipes.toml in Ledgeline’s config folder, never in your books folder.

Proposed changes

At Propose, the assistant can’t change your books directly. It can only propose a change, which Ledgeline checks and shows you, and nothing is written until you approve it.

A proposal is a list of edits of a fixed set of kinds:

An edit to an existing transaction names it by its position and by its date and description. If the transaction has changed since the assistant read it, the edit is refused rather than applied to the wrong entry. One proposal can hold up to 200 edits.

Before changing a transaction’s postings, the assistant can look the transaction up (show_transaction): its journal text, and each posting numbered the way the edits count them, with the amount hledger works out for a posting you left blank.

For the three changes asked for most, the assistant has shortcuts that take only what you’d say yourself, and Ledgeline builds the full proposal from them:

When your books declare their accounts, the shortcuts declare any new account too, with the type of the one it replaces. Each shortcut’s proposal also carries the checks that should hold, such as “the number of transactions doesn’t change” for a recategorize. Shortcut proposals are staged, checked and shown exactly like any other.

A proposal that can’t be staged never reaches you. Ledgeline tells the assistant which edit was wrong and how: an edit of the wrong shape gets the shape it should have had, and one that doesn’t apply gets the posting or amount that went wrong, or how much the transaction is out of balance. Every problem is listed at once, and the assistant is told to fix just those and try again. You see each attempt in the chat as a refused tool call.

The checks

Ledgeline applies the proposal to a copy of your books in memory and checks the result. Your files aren’t touched. The proposal card lists every check under two headings.

Checks are the ones every proposal gets:

Separately, an amount in a commodity your books don’t have is refused before the proposal is staged, unless the proposal declares that commodity. So is an amount or a price with no currency at all (a house priced at 410000 rather than $410,000.00), when your books use currencies.

Promised by the assistant are the checks the proposal declares for itself, saying what must not change:

Ledgeline checks each promise by running hledger on the books before and after and comparing exact amounts. Where hledger can’t run (the iOS app, or books that include a file by an absolute path), Ledgeline checks balance and posting promises itself, with the same query language and exact amounts. It can’t value at market prices that way, so a market-value promise counts as failed there. Any promise that can’t be checked counts as failed.

When only the assistant’s own promises fail, either the change or the promise is wrong, and the assistant is told to work out which. Often it’s the promise: one that claims something the change alters on purpose. For example, turning a house into a priced commodity changes its market value but not its cost. The assistant may narrow or drop such a promise, but it must say why in the proposal’s reason, which you see on the card.

A proposal can also carry a note, which is advice rather than a check and never blocks approval. When a change leaves an account your books declare with nothing posted to it, the note names it, and the assistant is told to remove the declaration unless you want to keep it.

Below the checks the card shows the diff for each file that would change.

Approving

If every check passes, the card offers Approve, Send back… and Discard.

If any check fails, the proposal can’t be approved. There is no “approve anyway”. The card says “A check failed, so this can’t be approved”, shows what failed (for a balance, the months and accounts that differ), and offers only Send back… and Discard.

Send back… returns the proposal to the assistant with the failed checks and any comment you add under “What should change?”. The assistant revises it, and the new version is staged and checked again from the start. Send it back too when a check passes but the change is wrong, or when the assistant promised the wrong thing, such as “no balances change” for a change that is meant to move money.

To approve only part of a proposal, untick the edits you don’t want. The button changes to Approve 2 of 5, say, and the edits you kept are checked again on their own before anything is written.

Approving writes the files the same way the rest of Ledgeline does, only if they haven’t changed on disk since they were read. If your books changed after the proposal was checked, because you edited them or a sync brought something in, Ledgeline doesn’t write. It checks the proposal again against the books as they are now, and the card says: “The books changed since this was checked. It has been checked again; review it before approving.”

Accounts and comments

Many books keep their account lines, and comments about them, in a file of their own. Proposals keep those in step with the transactions:

The diff shows these files too, and all the checks apply as usual.

Undo

Every approved change can be undone. After you approve, the card shows Applied and an Undo button. Changes in the chat header lists the changes the assistant made to the books you have open, newest first, each with Undo.

Ledgeline keeps the last 50 changes, and they survive quitting the app, so you can undo a change you made yesterday. They are kept in the ai-changesets folder in Ledgeline’s config folder, never in your books folder. Each holds the earlier contents of the files it changed, so that folder holds copies of parts of your journal.

Undo puts each file back exactly as it was before the change, but only if the file still holds exactly what the change wrote. If you, a sync or another program has changed one of the files since, undo refuses, names the files, and changes nothing. That means an older change can’t be undone once a newer one has written to the same file, until the newer one is undone first.

There is no git integration. If your books are in git, your own history works alongside this as usual.

Big changes

A change to hundreds of transactions, written out one edit at a time by a model, is likely to contain mistakes. For those, the assistant proposes a bulk edit instead: an hledger query that picks the transactions, plus one operation that Ledgeline applies to each of them. The operations are:

The model only has to get one query and one operation right. The card still lists every transaction it changes, the diff still shows every line, and all the checks still apply. A bulk edit can touch up to 2,000 transactions.

A house as a commodity

Say your books track a house as assets:home:cost plus assets:home:unrealized, with an entry every so often that moves the unrealized gain to match a new valuation. You ask the assistant to track the house as a commodity with prices instead. It can propose:

  1. declare a commodity HOUSE;
  2. change the purchase so it buys 1 HOUSE @ $500,000.00 into assets:home;
  3. a bulk edit over every transaction touching assets:home:unrealized, turning each revaluation into a P price for HOUSE at the home’s value on that date;
  4. a P price on the purchase date, so the house has a value from the start.

And it promises: assets at market value unchanged at every month end, liabilities unchanged at every month end, and only assets:home and the unrealized equity account touched.

The revaluation entries were the only postings to assets:home:unrealized and the unrealized equity account, so the same proposal can remove those declarations and correct the comments that describe the old way.

If the assistant forgets the price on the purchase date, hledger can’t value the house for the months before the first revaluation, so market-value assets change for those months. That promise fails, the card shows which months differ, and the proposal can’t be approved until it is fixed. Reports at cost will change after this kind of edit. Net worth at market value is what must stay the same.

Ledgeline writes amounts in edits without thousands separators ($520000.00), as it does for every edit.

Attachments

Reading PDFs and emails, such as turning a receipt or an invoice into a transaction or a split, isn’t available yet. For now, paste the text into your message. A message can be up to 64 KiB.

Privacy

Choosing a model

Assistant models has the results of Ledgeline’s tests for each model tried so far.