Example Workflows
These are real workflows you can run through any AI agent connected to Treeline — Claude Desktop, Claude Code, OpenClaw, or any MCP client.
Financial Overview
Section titled “Financial Overview”“What’s my financial snapshot?”
The agent runs tl status to get account balances, then queries for recent transaction volume and trends.
“What’s my net worth and how has it changed over the last 6 months?”
SELECT DATE_TRUNC('month', snapshot_time) as month, SUM(CASE WHEN a.classification = 'asset' THEN b.balance ELSE -b.balance END) as net_worthFROM balance_snapshots bJOIN accounts a USING (account_id)GROUP BY monthORDER BY month DESCLIMIT 6Spending Analysis
Section titled “Spending Analysis”“How much did I spend on groceries last month?”
SELECT SUM(-amount) as totalFROM transactionsWHERE amount < 0 AND tags @> ['groceries'] AND posted_date >= DATE_TRUNC('month', now()::TIMESTAMP::DATE - INTERVAL '1 month') AND posted_date < DATE_TRUNC('month', now()::TIMESTAMP::DATE)“What are my top 10 spending categories this month?”
SELECT category, SUM(-amount) as spent, COUNT(*) as txn_countFROM ( SELECT UNNEST(tags) as category, amount FROM transactions WHERE amount < 0 AND posted_date >= DATE_TRUNC('month', now()::TIMESTAMP::DATE))GROUP BY categoryORDER BY spent DESCLIMIT 10“Show me all transactions over $200 this week”
SELECT posted_date, description, amount, account_nameFROM transactionsWHERE ABS(amount) > 200 AND posted_date >= now()::TIMESTAMP::DATE - INTERVAL '7 days'ORDER BY ABS(amount) DESCTransaction Management
Section titled “Transaction Management”“Tag all Uber and Lyft transactions as transport”
The agent finds matching transactions and uses the tag tool:
SELECT transaction_id FROM transactionsWHERE description ILIKE '%uber%' OR description ILIKE '%lyft%'Then applies the tag to all matching IDs.
“Find duplicate transactions”
SELECT description, amount, posted_date, COUNT(*) as occurrencesFROM transactionsGROUP BY description, amount, posted_dateHAVING COUNT(*) > 1ORDER BY posted_date DESC“What transactions are untagged?”
SELECT posted_date, description, amount, account_nameFROM transactionsWHERE tags IS NULL OR ARRAY_LENGTH(tags) = 0ORDER BY posted_date DESCLIMIT 20Budget Tracking
Section titled “Budget Tracking”“Am I on track with my budget this month?”
If you have a budget-targets skill, the agent reads your targets and compares against actual spending:
SELECT tag, SUM(-amount) as spentFROM ( SELECT UNNEST(tags) as tag, amount FROM transactions WHERE amount < 0 AND posted_date >= DATE_TRUNC('month', now()::TIMESTAMP::DATE))GROUP BY tagORDER BY spent DESC“Which categories am I overspending in compared to last month?”
WITH this_month AS ( SELECT tag, SUM(-amount) as spent FROM ( SELECT UNNEST(tags) as tag, amount FROM transactions WHERE amount < 0 AND posted_date >= DATE_TRUNC('month', now()::TIMESTAMP::DATE) ) GROUP BY tag),last_month AS ( SELECT tag, SUM(-amount) as spent FROM ( SELECT UNNEST(tags) as tag, amount FROM transactions WHERE amount < 0 AND posted_date >= DATE_TRUNC('month', now()::TIMESTAMP::DATE - INTERVAL '1 month') AND posted_date < DATE_TRUNC('month', now()::TIMESTAMP::DATE) ) GROUP BY tag)SELECT t.tag, t.spent as this_month, l.spent as last_month, t.spent - l.spent as differenceFROM this_month tJOIN last_month l USING (tag)WHERE t.spent > l.spentORDER BY difference DESCRecurring Transactions
Section titled “Recurring Transactions”“What are my recurring monthly charges?”
SELECT description, ROUND(AVG(amount), 2) as avg_amount, COUNT(*) as occurrences, MIN(posted_date) as first_seen, MAX(posted_date) as last_seenFROM transactionsWHERE amount < 0GROUP BY descriptionHAVING COUNT(*) >= 3 AND MAX(posted_date) >= now()::TIMESTAMP::DATE - INTERVAL '60 days'ORDER BY avg_amount ASCBank Sync
Section titled “Bank Sync”“Sync my accounts and tell me what’s new”
The agent runs sync, then queries for recently posted transactions:
SELECT posted_date, description, amount, account_nameFROM transactionsORDER BY posted_date DESCLIMIT 20Data Export
Section titled “Data Export”“Export all my 2025 transactions to CSV”
tl query --format csv "SELECT * FROM transactions WHERE posted_date BETWEEN '2025-01-01' AND '2025-12-31' ORDER BY posted_date" > 2025-transactions.csv“Give me a monthly income vs. expenses breakdown for this year”
SELECT strftime('%Y-%m', posted_date) as month, SUM(CASE WHEN amount > 0 THEN amount ELSE 0 END) as income, SUM(CASE WHEN amount < 0 THEN -amount ELSE 0 END) as expenses, SUM(amount) as netFROM transactionsWHERE posted_date >= '2026-01-01'GROUP BY monthORDER BY month