Copilot Money
Query local data from the Copilot Money Mac app to analyze transactions, spending patterns, account balances, investments, and budgets. Data is stored in both SQLite (transactions, balances) and Firestore LevelDB cache (recurring names, budgets, investments).
Database Location
CODEBLOCK0
Schema
Transactions Table
Primary table for all financial transactions.
| Column | Type | Description |
|---|
| id | TEXT | Primary key |
| date |
DATE | Transaction date |
| name | TEXT | Merchant/transaction name |
| original_name | TEXT | Raw name from bank |
| amount | DOUBLE | Transaction amount (positive = expense) |
| iso
currencycode | TEXT | Currency (e.g., "USD") |
| account_id | TEXT | Linked account reference |
| category_id | TEXT | Category reference |
| pending | BOOLEAN | Whether transaction is pending |
| recurring | BOOLEAN | Whether transaction is recurring |
| recurring_id | TEXT | Links to recurring definition (see Firestore) |
| user_note | TEXT | User-added notes |
| user_deleted | BOOLEAN | Soft-deleted by user |
accountDailyBalance Table
Daily balance snapshots per account.
| Column | Type | Description |
|---|
| date | TEXT | Snapshot date |
| account_id |
TEXT | Account reference |
| current_balance | DOUBLE | Balance on that date |
| available_balance | DOUBLE | Available balance |
Firestore Cache (LevelDB)
Additional data is stored in Firestore's local LevelDB cache, not in the SQLite database.
Location:
CODEBLOCK1
Collections
| Collection | Description |
|---|
| INLINECODE0 | Linked bank accounts/institutions |
| INLINECODE1 |
Historical security prices |
|
investment_performance | TWR (time-weighted return) per holding |
|
investment_splits | Stock split history |
|
securities | Stock/fund metadata |
|
users/.../budgets | Budget definitions (amount, category_id) |
|
users/.../recurrings | Recurring transaction definitions |
|
amazon | Amazon order matching data |
Recurring Definitions
| Field | Description |
|---|
| name | Display name (e.g., "Water / Sewer", "Rent") |
| match_string |
Transaction name to match (e.g., "CHECK PAID") |
| plaid
categoryid | Category ID for the recurring |
| state | "active" or "inactive" |
Data Not in SQLite
- - Recurring names - human-readable names like "Rent", "Netflix"
- Budget amounts - monthly budget per category
- Investment data - holdings, prices, performance, splits
- Account/institution names - Chase, Fidelity, etc.
- Category names - Restaurants, Travel, Groceries, etc.
Extracting Data from LevelDB
List all recurring names:
CODEBLOCK2
List all collections:
CODEBLOCK3
Find category names:
CODEBLOCK4
Common Queries
Recent Transactions
CODEBLOCK5
Monthly Spending Summary
CODEBLOCK6
Spending by Category
CODEBLOCK7
Search Transactions
CODEBLOCK8
List Recurring Transactions
CODEBLOCK9
Usage
Use sqlite3 to query the database:
CODEBLOCK10
For formatted output:
CODEBLOCK11
Notes
- - Category IDs are opaque strings - group by them for analysis (names are in Firestore cache)
- Amounts are positive for expenses, negative for income
- Filter
user_deleted = 0 to exclude deleted transactions - Both databases are actively used by the app; read-only access is safe
- SQLite has
recurring_id linking to Firestore recurring definitions - Use
strings on LevelDB files to extract human-readable data from Firestore cache
Copilot Money
从Copilot Money Mac应用查询本地数据,分析交易、消费模式、账户余额、投资和预算。数据存储在SQLite(交易、余额)和Firestore LevelDB缓存(重复名称、预算、投资)中。
数据库位置
~/Library/Group Containers/group.com.copilot.production/database/CopilotDB.sqlite
表结构
Transactions表
所有金融交易的主表。
DATE | 交易日期 |
| name | TEXT | 商户/交易名称 |
| original_name | TEXT | 银行原始名称 |
| amount | DOUBLE | 交易金额(正数=支出) |
| iso
currencycode | TEXT | 货币(例如USD) |
| account_id | TEXT | 关联账户引用 |
| category_id | TEXT | 类别引用 |
| pending | BOOLEAN | 交易是否待处理 |
| recurring | BOOLEAN | 交易是否重复 |
| recurring_id | TEXT | 关联重复定义(参见Firestore) |
| user_note | TEXT | 用户添加的备注 |
| user_deleted | BOOLEAN | 用户软删除 |
accountDailyBalance表
每个账户的每日余额快照。
| 列名 | 类型 | 描述 |
|---|
| date | TEXT | 快照日期 |
| account_id |
TEXT | 账户引用 |
| current_balance | DOUBLE | 当日余额 |
| available_balance | DOUBLE | 可用余额 |
Firestore缓存(LevelDB)
额外数据存储在Firestore的本地LevelDB缓存中,而非SQLite数据库。
位置:
~/Library/Containers/com.copilot.production/Data/Library/Application Support/firestore/FIRAPP_DEFAULT/copilot-production-22904/main/*.ldb
集合
| 集合 | 描述 |
|---|
| items | 关联的银行账户/机构 |
| investment_prices |
历史证券价格 |
| investment_performance | 每项持仓的TWR(时间加权收益率) |
| investment_splits | 股票拆分历史 |
| securities | 股票/基金元数据 |
| users/.../budgets | 预算定义(金额、category_id) |
| users/.../recurrings | 重复交易定义 |
| amazon | 亚马逊订单匹配数据 |
重复定义
| 字段 | 描述 |
|---|
| name | 显示名称(例如水费/排污费、租金) |
| match_string |
要匹配的交易名称(例如CHECK PAID) |
| plaid
categoryid | 重复交易的类别ID |
| state | active或inactive |
不在SQLite中的数据
- - 重复名称 - 人类可读的名称,如租金、Netflix
- 预算金额 - 每个类别的月度预算
- 投资数据 - 持仓、价格、表现、拆分
- 账户/机构名称 - 摩根大通、富达等
- 类别名称 - 餐厅、旅行、杂货等
从LevelDB提取数据
列出所有重复名称:
bash
for f in ~/Library/Containers/com.copilot.production/Data/Library/Application\ Support/firestore/FIRAPP_DEFAULT/copilot-production-22904/main/*.ldb; do
strings $f 2>/dev/null | grep -B10 ^state$ | grep -A1 ^name$ | grep -v ^name$ | grep -v ^--$
done | sort -u | grep -v ^$
列出所有集合:
bash
for f in ~/Library/Containers/com.copilot.production/Data/Library/Application\ Support/firestore/FIRAPP_DEFAULT/copilot-production-22904/main/*.ldb; do
strings $f 2>/dev/null
done | grep -oE documents/[a-z_]+/ | sort | uniq -c | sort -rn
查找类别名称:
bash
for f in ~/Library/Containers/com.copilot.production/Data/Library/Application\ Support/firestore/FIRAPP_DEFAULT/copilot-production-22904/main/*.ldb; do
strings $f 2>/dev/null
done | grep -iE ^(groceries|restaurants|shopping|entertainment|travel|transportation|utilities)$ | sort -u
常用查询
近期交易
sql
SELECT date, name, amount, category_id
FROM Transactions
WHERE user_deleted = 0
ORDER BY date DESC
LIMIT 20;
月度支出汇总
sql
SELECT strftime(%Y-%m, date) as month, SUM(amount) as total
FROM Transactions
WHERE amount > 0 AND user_deleted = 0
GROUP BY month
ORDER BY month DESC;
按类别支出
sql
SELECT category_id, SUM(amount) as total, COUNT(*) as count
FROM Transactions
WHERE amount > 0 AND user_deleted = 0 AND date >= date(now, -30 days)
GROUP BY category_id
ORDER BY total DESC;
搜索交易
sql
SELECT date, name, amount
FROM Transactions
WHERE name LIKE %SEARCH
TERM% AND userdeleted = 0
ORDER BY date DESC;
列出重复交易
sql
SELECT DISTINCT name, recurring_id
FROM Transactions
WHERE recurring = 1 AND user_deleted = 0
ORDER BY name;
使用方法
使用sqlite3查询数据库:
bash
sqlite3 ~/Library/Group\ Containers/group.com.copilot.production/database/CopilotDB.sqlite YOUR_QUERY
格式化输出:
bash
sqlite3 -header -column ~/Library/Group\ Containers/group.com.copilot.production/database/CopilotDB.sqlite YOUR_QUERY
注意事项
- - 类别ID是不透明字符串 - 按它们分组进行分析(名称在Firestore缓存中)
- 金额正数为支出,负数为收入
- 过滤userdeleted = 0以排除已删除的交易
- 两个数据库均由应用主动使用;只读访问是安全的
- SQLite有recurringid关联到Firestore重复定义
- 在LevelDB文件上使用strings命令提取Firestore缓存中的人类可读数据