← 返回
AI智能 Key 中文

Heath Ledger

AI bookkeeping agent for Mercury bank accounts. Pulls transactions, categorizes them (rule-based + AI), and generates Excel workbooks with P&L, Balance Sheet...
Mercury银行账户AI记账代理。自动提取交易,通过规则与AI进行分类,并生成包含损益表、资产负债表等的Excel报表。
wrannaman
AI智能 clawhub v1.0.0 1 版本 99923.3 Key: 需要
★ 1
Stars
📥 1,282
下载
💾 597
安装
1
版本
#accounting#bookkeeping#finance#latest#mercury#stripe

概述

Heath Ledger

AI bookkeeping skill for Mercury bank accounts.

Quick Start

  1. scripts/init_db.mjs — creates DB + seeds ~90 universal vendor→category rules
  2. scripts/connect_mercury.sh [entity_name] — discovers accounts
  3. (Optional) scripts/connect_stripe.sh — connect Stripe for exact revenue + fees
  4. (If Stripe connected) scripts/pull_stripe_revenue.sh — pull monthly revenue data
  5. scripts/pull_transactions.sh
  6. scripts/categorize.sh — rule-based first, AI for unknowns
  7. Review ambiguous items, correct with scripts/set_category.sh
  8. scripts/generate_books.sh [output_path]

Setup Flow

Mercury API Key (Required)

Get from Mercury Dashboard → Settings → API Tokens. The token gives read-only access to transactions.

Stripe API Key (Optional but Recommended)

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.

Entity Settings

Configure per-entity via the entity_settings table:

SettingDefaultDescription
-------------------------------
accounting_basisaccrualaccrual or cash — cash basis uses posted dates only
month_offset1Fiscal year month offset (1 = calendar year)
stripe_fee_rate0.023Stripe percentage fee for gross-up calculation
stripe_fee_fixed0.30Stripe fixed fee per transaction
amortization_monthlynullMonthly amortization amount for acquired assets

Workflow

  1. Connect Mercuryscripts/connect_mercury.sh [name] discovers accounts, creates entity
  2. Pull transactionsscripts/pull_transactions.sh
  3. Categorizescripts/categorize.sh [max_transactions] — rule-based first, then AI for unknowns
  4. Review ambiguous — Script outputs low-confidence items. Ask user, then update with scripts/set_category.sh [subcategory]
  5. Generate booksscripts/generate_books.sh [output_path]

Scripts Reference

All scripts are in scripts/. Run with bash or node. Database is SQLite at data/heath.db.

ScriptPurpose
-----------------
init_db.mjsCreate/migrate SQLite database + seed rules
connect_mercury.shConnect Mercury API, discover accounts
pull_transactions.shPull transactions for date range
categorize.shCategorize transactions (rules + AI)
set_category.shManually set category for a transaction
add_rule.shAdd/update a categorization rule
generate_books.shGenerate Excel workbook
list_entities.shList all entities
connect_stripe.shConnect Stripe API to an entity
pull_stripe_revenue.shPull Stripe balance transactions by month
status.shShow entity status (accounts, tx counts)

Chart of Accounts

See references/chart-of-accounts.md for the full chart with P&L sections and cash flow classifications.

Learning & Compounding System

Heath Ledger gets smarter over time through a layered rule system:

Rule Hierarchy

  1. Entity-specific rules (highest priority) — per-company overrides
  2. Global rules (entity_id = NULL) — apply to all entities
  3. Seed rules — universal vendor mappings shipped with the skill
  4. AI categorization — used when no rule matches

How Learning Works

  • Every manual correction creates or updates a categorization rule
  • Rules track usage_count — heavily-used rules are more reliable
  • source field tracks provenance: seed, ai, human, manual
  • Human-confirmed rules get confidence: 0.95-1.0
  • AI-generated rules start at 0.85 and can be promoted
  • Entity-specific rules can be promoted to global when they prove universal

The Compounding Effect

After 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.

Known Limitations

Stripe Net vs Gross (Without Stripe API)

Mercury deposits from Stripe are net amounts (revenue minus ~2.9% + $0.30 fees). Without the Stripe API:

  • We estimate gross revenue using configurable fee rates
  • This creates "synthetic" Stripe Fee entries
  • Accuracy depends on your actual Stripe fee rate (varies by plan, card type, international)
  • Solution: Connect Stripe API for exact numbers

Deel Fee Splitting

Deel combines platform fees and contractor payroll in one transaction stream. Pattern:

  • Small fixed amounts (~$2-5) → Deel Platform Fee → categorize as "Software expenses"
  • Larger variable amounts → Contractor Payroll → categorize as "Wages & Salaries"
  • The system learns this pattern but may need initial human guidance

Mercury API Limitations

  • Only returns posted transactions (not pending)
  • Some counterparty names are truncated or normalized differently
  • Wire descriptions may include reference numbers that create duplicate rules

Multi-Currency

  • Wise transfers create both a debit (USD) and may show FX fees separately
  • International wire fees from Mercury appear as separate line items
  • FX gains/losses are not tracked (would need multi-currency ledger)

AI Categorization

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.

Key Details

  • Cash or accrual basis — configurable per entity
  • Multiple entities supported — each with own connections and rules
  • Rules persist — categorization rules saved to SQLite, reused across runs
  • Seed rules — ~90 universal vendor mappings loaded on init
  • Excel output — 4-tab workbook: P&L, Balance Sheet, Cash Flow, Transaction Detail

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-29 13:44 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

AgentDo

wrannaman
在AgentDo任务队列(agentdo.dev)发布任务给其他AI代理或领取工作。使用场景:(1)需要完成你无法自行完成的任务
★ 0 📥 1,423
ai-intelligence

Proactive Agent

halthelobster
将AI智能体从任务执行者升级为主动预判需求、持续优化的智能伙伴。集成WAL协议、工作缓冲区、自主定时任务及实战验证模式。Hal Stack核心组件 🦞
★ 836 📥 213,143
ai-intelligence

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,358 📥 318,384