Skip to main content
Typed Zod schema for agent spend receipts, with four export targets: RFC 4180 CSV, JSON Lines, QuickBooks IIF, and Xero CSV. The schema adopts the costillery receipt shape and augments it with fields the agent-banking standards layer requires: correlationId, agentId, grantId, taxJurisdiction, realizedGainUsdCents. Zero runtime dependencies beyond zod.

Install

npmjs.com/package/@glideco/spend-export

Why a shared schema

The agent-spend ecosystem fragmented early — every receipt-intel package chose its own field names, and two weeks later no two systems agreed on whether the fee field was fee, feeAmount, fee_usd, or omitted. This package pins the canonical column order, enforces ISO 4217 uppercase currency codes (lowercase 'usd' breaks downstream tax-exporter cache keys), and validates MCC codes as exactly 4 ASCII digits (not 'ABCD'). Callers that violate these constraints get a parse error at the boundary rather than a silent wrong export. The realizedGainUsdCents field is bounded to ±$100B per receipt. A stale price-oracle returning a nonsensical value would otherwise push phantom billion-dollar gains into the user’s tax export without any visible warning.

Schema

Exporting

CSV

QuickBooks IIF

IIF fields containing tabs or newlines would inject phantom transaction rows. The exporter strips C0 control characters from every interpolated value before the tab-join.

Xero CSV

JSON Lines + aggregation

Rail vocabulary

The spendRailSchema covers every Glide payment surface: card-mastercard, card-visa, card-amex, card-bridge, x402, mpp-tempo, mpp-stellar, mpp-solana, mpp-lightning, stripe-spt, sepa, ach, wire, self-custody-evm, self-custody-svm, self-custody-xchain.

Reading list