Treeline Money
Chat with your finances. Ask questions like "What's my net worth?", "How much did I spend on groceries?", or "Am I over budget?" and get instant answers from your own financial data.
Quick Start
CODEBLOCK0
First Time Setup
For agents: If tl commands fail with "command not found", the CLI needs to be installed. OpenClaw handles installation automatically via the skill metadata. Start with demo mode so users can try queries immediately.
Verify the CLI is available with tl --version. Start with demo mode so users can try queries immediately.
Optional: Download the desktop app for visual exploration of your data.
Demo Mode
Demo mode loads sample data so users can try queries without connecting a bank:
CODEBLOCK1
To switch to real data later:
CODEBLOCK2
Demo data is separate from real data.
CLI Behavior Notes
- -
tl demo on prints a success message — if it seems to hang, wait a few seconds (first run initializes the database) - Use
tl demo status to verify demo mode is enabled - Some commands may take a few seconds on first run due to database initialization
- If you see errors about missing tables, try
tl demo on again
Connecting Real Data
When the user is ready to move beyond demo mode, direct them to set up a data source with the guides linked below.
Data source options:
- - SimpleFIN ($1.50/month, US & Canada)
- Lunch Flow (~$3/month, global)
- CSV Import (free)
Setup guides: Bank Sync · CSV Import
Once set up, use tl sync to pull bank transactions or tl import to load a CSV.
What is Treeline?
Treeline Money is a local-first personal finance app. All your data stays on your device in a local DuckDB database. No cloud accounts, no subscriptions required (sync services are optional), full SQL access to your financial data.
Encrypted Databases
Encrypted databases work automatically when unlocked — the encryption key is stored in the OS keychain.
If you see "database is encrypted and locked" errors, tell the user to unlock it themselves before continuing:
- - Open the Treeline desktop app and unlock from there, or
- Run
tl encrypt unlock in their own terminal
Do not attempt to unlock the database or handle credentials. Unlocking must be done by the user directly, outside this conversation. Once unlocked, the key persists in the keychain until the user locks it.
Response Formatting
Format all responses for mobile/chat:
- - Use bullet points, not markdown tables
- Round numbers for readability ($1,234 not $1,234.56)
- Lead with the answer, details second
- Keep responses concise — chat isn't a spreadsheet
- Use line breaks to separate sections
Example good response:
CODEBLOCK3
Example bad response:
| Account | Type | Balance |
|---------|------|---------|
| My 401k Account | asset | 85234.56 |
...
CLI Commands
Read commands (run freely)
These commands are read-only and safe to run autonomously:
CODEBLOCK5
Note: tl query and tl sql open the database in read-only mode by default. They cannot modify data unless --allow-writes is passed (see write commands below).
Use tl status for quick balance checks — it's faster than a SQL query.
Write commands (ask the user first)
These commands modify local data. Always ask the user for confirmation before running them.
CODEBLOCK6
Tip: --dry-run variants are read-only and safe to run without confirmation. Use them to preview before asking the user to confirm the actual operation.
Use tl compact if the user mentions slow queries — it optimizes the database.
CSV Import Details
INLINECODE14 auto-detects column mappings from CSV headers. Most bank CSVs work out of the box:
CODEBLOCK7
The --account / -a flag accepts an account name (case-insensitive, substring match) or UUID.
Always preview first with --dry-run to verify columns were detected correctly:
CODEBLOCK8
All import flags (all optional except --account):
| Flag | Purpose | Example |
|---|
| INLINECODE19 | Override date column | INLINECODE20 |
| INLINECODE21 |
Override amount column |
--amount-column "Amt" |
|
--description-column | Override description column |
--description-column "Memo" |
|
--debit-column | Use debit column (instead of amount) |
--debit-column "Debit" |
|
--credit-column | Use credit column (instead of amount) |
--credit-column "Credit" |
|
--balance-column | Running balance (creates snapshots) |
--balance-column "Balance" |
|
--flip-signs | Negate amounts (credit card CSVs) |
--flip-signs |
|
--debit-negative | Negate positive debits |
--debit-negative |
|
--skip-rows N | Skip N rows before header |
--skip-rows 3 |
|
--number-format |
us,
eu, or
eu_space |
--number-format eu |
|
--profile NAME | Load a saved profile |
--profile chase |
|
--save-profile NAME | Save settings as profile |
--save-profile chase |
|
--dry-run | Preview without importing |
--dry-run |
|
--json | JSON output |
--json |
Common patterns for agents:
CODEBLOCK9
Duplicate transactions are automatically detected and skipped on re-import via fingerprinting.
User Skills
Treeline supports user-created skills for personal financial knowledge. Use tl skills list --json to discover existing skills and tl skills read <path> to read them.
Creating skills: When you learn something reusable about the user's finances — tag conventions, account meanings, tax categories, budget targets — ask if they'd like to save it as a skill for future conversations. To create one, write a SKILL.md file to ~/.treeline/skills/<name>/SKILL.md (use tl skills path to get the directory). Follow the Agent Skills standard (agentskills.io).
Quick Reference
Net Worth
CODEBLOCK10
Account Balances
CODEBLOCK11
True Spending (Excluding Internal Moves)
Default pattern (exclude internal moves):
CODEBLOCK12
Spending by Tag
CODEBLOCK13
Recent Transactions
tl query "
SELECT t.description, t.amount, t.transaction_date, a.name as account
FROM transactions t
JOIN accounts a ON t.account_id = a.account_id
ORDER BY t.transaction_date DESC
LIMIT 10
" --json
Database Schema
Core Tables
accounts
| Column | Description |
|---|
| INLINECODE54 | UUID primary key |
| INLINECODE55 |
Account display name |
|
classification |
asset or
liability |
|
account_type |
credit,
investment,
Loan,
other, or null |
|
institution_name | Bank/institution name |
|
currency | Currency code (e.g.,
USD) |
|
is_manual | Boolean — manually added vs synced |
sysbalancesnapshots — Source of truth for balances
| Column | Description |
|---|
| INLINECODE68 | UUID primary key |
| INLINECODE69 |
FK to accounts |
|
balance | Balance at snapshot time |
|
snapshot_time | When recorded |
|
source |
sync,
manual, etc. |
transactions
| Column | Description |
|---|
| INLINECODE75 | UUID primary key |
| INLINECODE76 |
FK to accounts |
|
amount | Signed (negative = expense) |
|
description | Transaction description |
|
transaction_date | When it occurred |
|
posted_date | When it cleared |
|
tags | Array of tags |
Tags vs Categories
Tags are the primary concept in Treeline — transactions can have multiple tags.
Categories come from the budget plugin (plugin_budget), which maps tags to budget categories. Not all users have this plugin.
Plugin System
Plugins have their own DuckDB schemas: INLINECODE83
Discovering Installed Plugins
CODEBLOCK15
Common Plugin Schemas
plugin_budget.categories — Budget categories
| Column | Description |
|---|
| INLINECODE84 | UUID primary key |
| INLINECODE85 |
YYYY-MM format |
|
type |
income or
expense |
|
name | Category name |
|
expected | Budgeted amount |
|
tags | Array of tags to match |
plugin_goals.goals — Savings goals
| Column | Description |
|---|
| INLINECODE93 | UUID primary key |
| INLINECODE94 |
Goal name |
|
target_amount | Target amount |
|
target_date | Target date |
|
completed | Boolean |
|
active | Boolean |
plugin_subscriptions — Detected recurring charges
plugin_cashflow — Cash flow projections
pluginemergencyfund — Emergency fund tracking
Check tl skills list for user-specific plugin preferences.
Common Patterns
Getting Current Balances
Always use latest snapshot:
CODEBLOCK16
Working with Tags
Tags are arrays:
CODEBLOCK17
Date Filters
CODEBLOCK18
Budget vs Actual
SELECT
c.name,
c.expected,
COALESCE(SUM(ABS(t.amount)), 0) as actual,
c.expected - COALESCE(SUM(ABS(t.amount)), 0) as remaining
FROM plugin_budget.categories c
LEFT JOIN transactions t ON t.tags && c.tags
AND t.amount < 0
AND t.transaction_date >= (c.month || '-01')::DATE
AND t.transaction_date < (c.month || '-01')::DATE + INTERVAL '1 month'
WHERE c.month = strftime(current_date, '%Y-%m')
AND c.type = 'expense'
GROUP BY c.category_id, c.name, c.expected
Question Mapping
| User asks | Approach |
|---|
| "Net worth?" | Net worth query |
| "Balances?" |
Account balances query |
| "How much in [X]?" | Filter by
name ILIKE '%X%' |
| "How much did I spend?" | True spending query (exclude internal moves) |
| "Spending on [tag]?" | Filter by tag |
| "Am I over budget?" | Budget vs actual (requires budget plugin) |
| "Recent transactions" | Order by date DESC, limit |
| "Savings?" | Filter accounts by name/type |
| "Retirement?" | Filter by 401k, IRA, retirement keywords |
| "Import CSV" / "Upload transactions" | Guide through
tl import — preview first with
--dry-run |
| "Import from [bank name]" | Use
tl import with appropriate flags for that bank's CSV format |
Tips
- 1. Always use
--json for parseable output - Amounts are signed — negative = expense
- Use
classification for asset/liability - Balances live in snapshots, not the accounts table
- Check
tl skills list for user-specific account meanings and tag conventions
Privacy Note
All data is local (~/.treeline/treeline.duckdb). Never share transaction descriptions or account details outside the conversation unless explicitly asked.
Treeline Money
与你的财务对话。 提出诸如我的净资产是多少?、我在食品杂货上花了多少钱?或我超预算了吗?等问题,并从你自己的财务数据中获得即时答案。
快速开始
bash
1. 安装 CLI(OpenClaw 会自动处理)
2. 启用演示模式(示例数据)
tl demo on
3. 尝试使用
tl status
首次设置
对于代理: 如果 tl 命令失败并显示command not found,则需要安装 CLI。OpenClaw 通过技能元数据自动处理安装。从演示模式开始,以便用户可以立即尝试查询。
使用 tl --version 验证 CLI 是否可用。从演示模式开始,以便用户可以立即尝试查询。
可选: 下载桌面应用以可视化探索你的数据。
演示模式
演示模式加载示例数据,以便用户无需连接银行即可尝试查询:
bash
tl demo on
稍后切换到真实数据:
bash
tl demo off
演示数据与真实数据是分开的。
CLI 行为说明
- - tl demo on 会打印一条成功消息——如果看起来卡住了,请等待几秒钟(首次运行会初始化数据库)
- 使用 tl demo status 验证演示模式是否已启用
- 由于数据库初始化,某些命令在首次运行时可能需要几秒钟
- 如果看到关于缺少表的错误,请再次尝试 tl demo on
连接真实数据
当用户准备好超越演示模式时,引导他们使用下方链接的指南设置数据源。
数据源选项:
- - SimpleFIN(每月 1.50 美元,美国和加拿大)
- Lunch Flow(约每月 3 美元,全球)
- CSV 导入(免费)
设置指南:银行同步 · CSV 导入
设置完成后,使用 tl sync 拉取银行交易或使用 tl import 加载 CSV。
什么是 Treeline?
Treeline Money 是一款本地优先的个人理财应用。你所有的数据都保存在你设备上的本地 DuckDB 数据库中。无需云账户,无需订阅(同步服务是可选的),完全支持 SQL 访问你的财务数据。
加密数据库
加密数据库在解锁状态下自动工作——加密密钥存储在操作系统密钥链中。
如果你看到数据库已加密且被锁定的错误,请告诉用户自行解锁后再继续:
- - 打开 Treeline 桌面应用并从那里解锁,或者
- 在他们自己的终端中运行 tl encrypt unlock
不要尝试解锁数据库或处理凭据。 解锁必须由用户直接在此对话之外完成。解锁后,密钥会保留在密钥链中,直到用户将其锁定。
响应格式
将所有响应格式化为移动端/聊天格式:
- - 使用项目符号,而不是 Markdown 表格
- 对数字进行四舍五入以提高可读性($1,234 而不是 $1,234.56)
- 先给出答案,再提供细节
- 保持响应简洁——聊天不是电子表格
- 使用换行符分隔各部分
好的响应示例:
你的净资产为 $125k
资产:$180k
- - 退休金:$85k
- 储蓄:$25k
- 活期存款:$10k
- 房屋净值:$60k
负债:$55k
不好的响应示例:
| 账户 | 类型 | 余额 |
|---|
| 我的 401k 账户 | 资产 | 85234.56 |
...
CLI 命令
读取命令(可自由运行)
这些命令是只读的,可以安全地自主运行:
bash
tl status # 快速账户摘要及余额
tl status --json # 同上,但输出 JSON 格式
tl query SQL --json # 运行任何 SQL 查询(数据库以只读模式打开)
tl sql SQL --json # 与 tl query 相同(别名)
tl backup list # 列出可用的备份
tl doctor # 检查数据库健康状况
tl demo status # 检查演示模式是开启还是关闭
注意: tl query 和 tl sql 默认以只读模式打开数据库。除非传递 --allow-writes 参数,否则它们无法修改数据(请参见下面的写入命令)。
使用 tl status 进行快速余额检查——它比 SQL 查询更快。
写入命令(先询问用户)
这些命令会修改本地数据。在运行它们之前,务必先请求用户确认。
bash
tl query SQL --allow-writes --json # 以写入权限运行 SQL 查询
tl sql SQL --allow-writes --json # 同上(别名)
tl sync # 从银行集成同步账户/交易
tl sync --dry-run # 预览将要同步的内容(只读,可安全运行)
tl import FILE -a ACCOUNT # 从 CSV 导入交易
tl import FILE -a ACCOUNT --dry-run # 预览导入而不实际应用(只读,可安全运行)
tl import FILE -a ACCOUNT --json # 输出 JSON 格式,便于脚本处理
tl backup create # 创建备份
tl backup restore NAME # 恢复备份
tl compact # 压缩数据库(回收空间,优化性能)
tl tag groceries --ids ID1,ID2 # 为交易应用标签
tl demo on|off # 切换演示模式(示例数据)
提示: --dry-run 变体是只读的,无需确认即可安全运行。在请求用户确认实际操作之前,使用它们进行预览。
如果用户提到查询速度慢,请使用 tl compact——它可以优化数据库。
CSV 导入详情
tl import 会自动从 CSV 表头检测列映射。大多数银行 CSV 开箱即用:
bash
tl import bank_export.csv --account Chase Checking
--account / -a 标志接受账户名称(不区分大小写,子字符串匹配)或 UUID。
始终先使用 --dry-run 进行预览,以验证列是否正确检测:
bash
tl import bank_export.csv -a Checking --dry-run --json
所有导入标志(除 --account 外均为可选):
| 标志 | 用途 | 示例 |
|---|
| --date-column | 覆盖日期列 | --date-column Post Date |
| --amount-column |
覆盖金额列 | --amount-column Amt |
| --description-column | 覆盖描述列 | --description-column Memo |
| --debit-column | 使用借方列(代替金额) | --debit-column Debit |
| --credit-column | 使用贷方列(代替金额) | --credit-column Credit |
| --balance-column | 运行余额(创建快照) | --balance-column Balance |
| --flip-signs | 取反金额(信用卡 CSV) | --flip-signs |
| --debit-negative | 取反正的借方金额 | --debit-negative |
| --skip-rows N | 在表头之前跳过 N 行 | --skip-rows 3 |
| --number-format | us、eu 或 eu_space | --number-format eu |
| --profile NAME | 加载已保存的配置文件 | --profile chase |
| --save-profile NAME | 将设置保存为配置文件 | --save-profile chase |
| --dry-run | 预览而不导入 | --dry-run |
| --json | JSON 格式输出 | --json |
代理的常见模式:
bash
步骤 1:查找账户 UUID
tl status --json
步骤 2:预览导入
tl import transactions.csv -a 550e8400-e29b-41d4-a716-446655440000 --dry-run --json
步骤 3:执行导入
tl import transactions.csv -a 550e8400-e29b-41d4-a716-446655440000 --json
重复交易会通过指纹识别自动检测并在重新导入时跳过。
用户技能
Treeline 支持用户创建用于个人财务知识的技能。使用 tl skills list --json 发现现有技能,使用 tl skills read 读取它们。
创建技能: 当你了解到关于用户财务的可复用信息时