published fresh until

Why does my AI give wrong YNAB totals, and how do I fix it?

Summary As of October 2026, an r/ynab post (July 2026) shares a stdlib Python script that mirrors YNAB into a local SQLite file plus a Claude Code skill that spells out the query traps: transfers, soft-deleted rows, splits and income.

Not for bank CSV bookkeeping for taxes; building a budget app from scratch

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The problem

You use YNAB and want an agent to answer questions about your own spending: where the money goes, savings rate, category trends. You hand it a CSV export or let it hit the YNAB API, and the totals look confident but wrong. A CSV export every time also costs a lot of input tokens and is manual.

What one user shared

In r/ynab (July 2026) the author wrote a small Python script, standard library only, that dumps all budgets, accounts, categories, payees and transactions into one SQLite file. Re-running it is incremental because it uses YNAB's server_knowledge cursors, so it can sit in a cron job. The repo (MIT) also contains a Claude Code skill and an AGENTS.md. The skill exists to stop the agent from giving wrong numbers. Its rules, paraphrased from the file:

1. Always filter out deleted rows: deletions are soft, so skipping this inflates totals. 2. Scope every query by budget: one account can have several budgets. 3. Leave transfers between your own accounts out of income and spending math, otherwise money is counted twice. 4. Amounts are already converted from YNAB milliunits to normal currency units; negative is outflow. 5. Income lives in the category "Inflow: Ready to Assign", not in every positive amount (refunds and transfers are positive too). 6. Split transactions keep their category lines in a separate subtransactions table; the parent row can have no category. 7. Rows with no category and no transfer target are real uncategorised spending: report them instead of dropping them.

How people reacted

Commenters asked why not just export the CSV. The author's answer: a database lets the agent run one SQL query instead of reading the whole file, and the refresh can be scheduled. One commenter said they build the same kind of scripts on the fly with another coding agent; another said it "worked great"; a third said they do something similar today. Some commenters objected to sending financial data to an AI provider at all. The author's reply was that the dump script itself is deterministic and only talks to YNAB.

For live edits (categorising, approving) the author points to a separate, community-built YNAB MCP server (calebl/ynab-mcp-server, MIT): MCP for changes, SQLite for history and heavy queries.

Prompt wording that follows this

Read ynab.db only through SQL, never edit it. Before any answer, list the budgets and ask which one. Exclude rows where deleted = 1 and rows where transfer_account_id is not null from income and spending. Treat Inflow: Ready to Assign as income. For per-category totals use subtransactions for split parents. State how many uncategorised transactions were left out.

Mistakes to check

  • Totals that include deleted or transfer rows.
  • Mixing several budgets in one sum.
  • Treating every positive amount as income.
  • Letting an agent write to your real budget through the API without a read-only dry run first.
  • Sending real transaction history to a hosted model without checking your plan's privacy terms.

Limits

This is one small open-source project and one Reddit thread; the author says they only tested it on their own data. I did not run the script or the skill. The rules above are the author's, worth checking against your own budget before you trust a number.

Sources

  • YNAB API v1 OpenAPI specification (YNAB), read 19 Oct 2026 in two parts (the middle was covered by the second read). Checked: deleted transactions are only included in delta requests; transactions have transfer_account_id and transfer_transaction_id for transfers; subtransactions carry a split, whose category name is set to Split; amounts are in milliunits; the month income field is the total categorized to "Inflow: Ready to Assign". These match the traps the skill warns about.
  • RuBiCK/ynab-sqlite-export (GitHub), README, tree and .claude/skills/ynab-db/SKILL.md read through gh api on 19 Oct 2026. The author's Reddit post, checked 2026-11-24, directly links this project. Checked: README says pure Python 3 standard library and incremental re-runs; the skill's rules match the seven listed here (soft deletes, scope by budget, exclude transfers, converted amounts, income as "Inflow: Ready to Assign", split subtransactions, uncategorised rows); it has an eighth rule on date format that the body does not list.
  • calebl/ynab-mcp-server, read via gh api. Checked: MIT, a YNAB Model Context Protocol server.
  • Checked 2026-11-24: the r/ynab thread and comments, the author's replies and the claim that the author tested only on their own data. Not checked: whether the rules give correct totals. I ran neither the script nor the skill.

Started from a post by @baymax8s, packaged by the editor. Original post

Subjects

More in personal finance

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Why does my AI give wrong YNAB totals, and how do I fix it?
Summary: As of October 2026, an r/ynab post (July 2026) shares a stdlib Python script that mirrors YNAB into a local SQLite file plus a Claude Code skill that spells out the query traps: transfers, soft-deleted rows, splits and income.
Copy for agent
get the whatworks thread ynab-export-sqlite-agent-wrong-totals-transfers-deleted and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread ynab-export-sqlite-agent-wrong-totals-transfers-deleted
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp