Bookkeeper
by @h4gen
Automates invoice intake from Gmail, extracts data via OCR, verifies payment in Stripe, and creates reconciliation-ready accounting entries in Xero.
clawhub install bookkeeperπ About This Skill
name: autonomous-bookkeeper description: Meta-skill for pre-accounting automation by orchestrating gmail, deepread-ocr, stripe-api, and xero. Use when users need invoice intake from email, structured field extraction, payment verification, and accounting entry creation with reconciliation-ready status. homepage: https://clawhub.ai user-invocable: true disable-model-invocation: false metadata: {"openclaw":{"emoji":"ledger","requires":{"bins":["python3","npx"],"env":["MATON_API_KEY","DEEPREAD_API_KEY"],"config":[]},"note":"Requires local installation of gmail, deepread-ocr, stripe-api, and xero."}}
Purpose
Automate preparatory bookkeeping from incoming email to accounting records.
Core objective: 1. detect invoice email, 2. extract structured invoice data, 3. verify payment event, 4. create accounting entry and reconciliation status.
This is orchestration logic across upstream tools; it is not a replacement for financial controls.
Required Installed Skills
gmail (inspected latest: 1.0.6)deepread-ocr (inspected latest: 1.0.6)stripe-api (inspected latest: 1.0.8)xero (inspected latest: 1.0.4)Install/update:
npx -y clawhub@latest install gmail
npx -y clawhub@latest install deepread-ocr
npx -y clawhub@latest install stripe-api
npx -y clawhub@latest install xero
npx -y clawhub@latest update --all
Required Credentials
MATON_API_KEY (for Gmail, Stripe, Xero through Maton gateway)DEEPREAD_API_KEY (for OCR extraction)Preflight:
echo "$MATON_API_KEY" | wc -c
echo "$DEEPREAD_API_KEY" | wc -c
If missing, stop before any bookkeeping action.
Inputs the LM Must Collect First
company_base_currencyinvoice_keywords (default: invoice, rechnung, receipt, quittung)vendor_rules (for example AWS -> Hosting expense account)date_tolerance_days for matching (default: 3)amount_tolerance (default: exact, or configurable small tolerance)auto_post_policy (manual-review, auto-if-high-confidence)attachment_policy (store-link, attach-binary-if-supported)Do not auto-post financial records without explicit policy.
Tool Responsibilities
Gmail (gmail)
Use for intake and attachment discovery.
Relevant behavior:
has:attachment, subject:invoice, sender filters)DeepRead OCR (deepread-ocr)
Use for extracting structured fields from invoice PDFs/images.
Relevant behavior:
queued -> completed/failed)hil_flag and reason for uncertaintyStripe (stripe-api)
Use for payment-side verification.
Relevant behavior:
Xero (xero)
Use for accounting record creation and payment/reconciliation visibility.
Relevant behavior:
ACCPAY for payable bills)Canonical Signal Chain
Stage 1: Inbox detection
Scan Gmail for candidate invoice emails.
Recommended query pattern:
has:attachment (subject:invoice OR subject:rechnung OR subject:receipt OR subject:quittung)from:aws)Output:
Stage 2: Attachment extraction
For each invoice candidate attachment: 1. send file to DeepRead OCR with invoice schema 2. wait for async completion (webhook preferred; polling fallback) 3. parse structured result
Minimum extracted fields:
Quality gate:
hil_flag=true, route to review queue before posting.Stage 3: Payment verification
Use Stripe to check whether corresponding payment occurred.
Matching policy:
If multiple candidates match, mark as ambiguous_match and require review.
Stage 4: Accounting write
Use Xero for booking.
Default payable flow:
1. ensure vendor contact exists (create if needed)
2. create bill entry (Type: ACCPAY) with line item category (for example Hosting)
3. mark as paid/reconciled state only when Stripe verification is confident
4. include reference fields: invoice number, source message ID, payment reference
Attachment handling:
Stage 5: Traceability updates
After successful processing:
Scenario Mapping (AWS Invoice)
For the scenario "AWS invoice by email -> Xero + card match":
1. Gmail finds AWS email with PDF attachment.
2. DeepRead OCR extracts structured fields (vendor/date/total/tax/invoice number).
3. Stripe check confirms payment event around invoice date and amount.
4. Xero creates payable entry (ACCPAY) under Hosting category.
5. Record is marked paid only after confident match; source PDF linked/attached per policy.
Data Contract
Normalize to one transaction record before posting:
{
"source": {
"gmail_message_id": "...",
"sender": "billing@aws.amazon.com",
"attachment_name": "invoice.pdf"
},
"invoice": {
"vendor": "AWS",
"invoice_number": "INV-123",
"invoice_date": "2024-05-01",
"total": 53.20,
"tax": 0.00,
"currency": "USD",
"ocr_confidence_ok": true
},
"payment_match": {
"provider": "stripe",
"matched": true,
"transaction_id": "ch_...",
"amount": 53.20,
"date": "2024-05-01"
},
"accounting": {
"system": "xero",
"entry_type": "ACCPAY",
"category": "Hosting",
"status": "Paid"
}
}
Output Contract
Always return:
IntakeSummaryExtractionSummaryhil_flag statusPaymentVerificationAccountingActionReviewQueueQuality Gates
Before auto-posting:
hil_flag unresolvedIf any gate fails, return Needs Review and do not auto-post.
Guardrails
Failure Handling
Known Limits from Inspected Upstream Skills
Treat these limits as mandatory operator disclosures.