heath-ledgerAI bookkeeping agent for Mercury bank accounts. Pulls transactions, categorizes them (rule-based + AI), and generates Excel workbooks with P&L, Balance Sheet...
Install via ClawdBot CLI:
clawdbot install wrannaman/heath-ledgerAI bookkeeping skill for Mercury bank accounts.
scripts/init_db.mjs β creates DB + seeds ~90 universal vendorβcategory rulesscripts/connect_mercury.sh [entity_name] β discovers accountsscripts/connect_stripe.sh β connect Stripe for exact revenue + feesscripts/pull_stripe_revenue.sh β pull monthly revenue datascripts/pull_transactions.sh scripts/categorize.sh β rule-based first, AI for unknownsscripts/set_category.shscripts/generate_books.sh [output_path] Get from Mercury Dashboard β Settings β API Tokens. The token gives read-only access to transactions.
Without Stripe API: Mercury shows net Stripe deposits (revenue minus fees). The system estimates gross revenue using a configurable fee rate (default 2.3% + $0.30).
With Stripe API: You get exact gross revenue, exact fees, and proper refund tracking. Always prefer this when available.
To connect: scripts/connect_stripe.sh
Then pull data: scripts/pull_stripe_revenue.sh
The P&L generator automatically uses Stripe data when available, falling back to Mercury estimates otherwise.
Configure per-entity via the entity_settings table:
| Setting | Default | Description |
|---------|---------|-------------|
| accounting_basis | accrual | accrual or cash β cash basis uses posted dates only |
| month_offset | 1 | Fiscal year month offset (1 = calendar year) |
| stripe_fee_rate | 0.023 | Stripe percentage fee for gross-up calculation |
| stripe_fee_fixed | 0.30 | Stripe fixed fee per transaction |
| amortization_monthly | null | Monthly amortization amount for acquired assets |
scripts/connect_mercury.sh [name] discovers accounts, creates entityscripts/pull_transactions.sh scripts/categorize.sh [max_transactions] β rule-based first, then AI for unknownsscripts/set_category.sh [subcategory] scripts/generate_books.sh [output_path] All scripts are in scripts/. Run with bash or node. Database is SQLite at data/heath.db.
| Script | Purpose |
|--------|---------|
| init_db.mjs | Create/migrate SQLite database + seed rules |
| connect_mercury.sh | Connect Mercury API, discover accounts |
| pull_transactions.sh | Pull transactions for date range |
| categorize.sh | Categorize transactions (rules + AI) |
| set_category.sh | Manually set category for a transaction |
| add_rule.sh | Add/update a categorization rule |
| generate_books.sh | Generate Excel workbook |
| list_entities.sh | List all entities |
| connect_stripe.sh | Connect Stripe API to an entity |
| pull_stripe_revenue.sh | Pull Stripe balance transactions by month |
| status.sh | Show entity status (accounts, tx counts) |
See references/chart-of-accounts.md for the full chart with P&L sections and cash flow classifications.
Heath Ledger gets smarter over time through a layered rule system:
entity_id = NULL) β apply to all entitiesusage_count β heavily-used rules are more reliablesource field tracks provenance: seed, ai, human, manualconfidence: 0.95-1.00.85 and can be promotedAfter categorizing ~5,000 transactions across 2 entities, the system now auto-categorizes ~95% of transactions without AI. Each new entity benefits from all previous learnings.
Mercury deposits from Stripe are net amounts (revenue minus ~2.9% + $0.30 fees). Without the Stripe API:
Deel combines platform fees and contractor payroll in one transaction stream. Pattern:
The categorize.sh script calls the host agent's model via stdin/stdout JSON protocol. It sends transaction batches and expects category assignments back. The script writes a prompt to stdout that the agent should process and return results for.
When AI confidence < 0.85, transactions are flagged as ambiguous for user review.
Generated Mar 1, 2026
A SaaS company uses Mercury for banking and Stripe for payments. This skill automates pulling transactions, categorizing revenue and expenses (like AWS costs and software subscriptions), and generating monthly financial statements (P&L, Balance Sheet, Cash Flow) for investor reporting. Connecting Stripe API ensures accurate revenue and fee tracking.
A consulting business with Mercury accounts needs quarterly books for tax purposes. The skill pulls bank transactions, categorizes client payments and operational expenses (e.g., marketing, office supplies), and produces Excel workbooks. Rule-based categorization learns from recurring vendors to reduce manual review over time.
An e-commerce retailer uses Mercury for business banking. This skill helps generate annual financial statements by categorizing sales deposits, inventory purchases, and shipping costs. Without Stripe API, it estimates gross revenue from net deposits; with Stripe, it pulls exact data for precise P&L analysis.
A freelancer with a Mercury account needs to track income and expenses for tax deductions. The skill pulls transactions, uses AI and rules to categorize items like software tools and client payments, and allows manual corrections via set_category.sh. It simplifies bookkeeping without deep accounting knowledge.
A non-profit using Mercury for donations and expenses uses this skill to generate financial statements for grant reporting. It categorizes donation inflows and program expenses, with accrual or cash basis accounting options. The learning system improves accuracy as more transactions are processed.
Businesses with recurring revenue via subscriptions (e.g., software, memberships). This skill categorizes monthly Stripe deposits as revenue and tracks expenses like hosting and salaries. It supports accrual accounting for deferred revenue recognition and generates P&L statements to monitor profitability.
Firms billing clients for hourly or project-based services. The skill categorizes client payments as revenue and expenses like software and contractor wages. It uses cash or accrual basis to match revenue with service periods, aiding in cash flow management and financial reporting.
Businesses selling physical or digital products online. This skill tracks sales revenue (via Stripe or Mercury deposits), categorizes costs like inventory and shipping, and handles fee estimation without Stripe API. It generates balance sheets to monitor inventory assets and cash flow statements.
π¬ Integration Tip
Always connect the Stripe API if available for exact revenue and fee data, as Mercury only shows net deposits. Use the set_category.sh script to manually correct ambiguous transactions, which improves rule-based categorization over time.
Query Copilot Money personal finance data (accounts, transactions, net worth, holdings, asset allocation) and refresh bank connections. Use when the user asks about finances, account balances, recent transactions, net worth, investment allocation, or wants to sync/refresh bank data.
Stripe API integration with managed OAuth. Manage customers, subscriptions, invoices, products, prices, and payments. Use this skill when users want to process payments, manage billing, or handle subscriptions with Stripe. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Requires network access and valid Maton API key.
QuickBooks API integration with managed OAuth. Manage customers, invoices, payments, bills, and run financial reports. Use this skill when users want to interact with QuickBooks accounting data. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway).
Advanced financial calculator with future value tables, present value, discount calculations, markup pricing, and compound interest. Use when calculating investment growth, pricing strategies, loan values, discounts, or comparing financial scenarios across different rates and time periods. Includes both CLI and interactive web UI.
Track expenses via natural language, get spending summaries, set budgets
Query and manage personal finances via the official Actual Budget Node.js API. Use for budget queries, transaction imports/exports, account management, categorization, rules, schedules, and bank sync with self-hosted Actual Budget instances.