<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by ZenStatement Labs on Medium]]></title>
        <description><![CDATA[Stories by ZenStatement Labs on Medium]]></description>
        <link>https://medium.com/@ZenStatementLabs?source=rss-cea8c59c3357------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*y9XqhO8tViGKw9QySyL56g.png</url>
            <title>Stories by ZenStatement Labs on Medium</title>
            <link>https://medium.com/@ZenStatementLabs?source=rss-cea8c59c3357------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 04:58:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ZenStatementLabs/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Introducing ZenStatement Billing MCP]]></title>
            <link>https://medium.com/@ZenStatementLabs/introducing-zenstatement-billing-mcp-5a34690226e6?source=rss-cea8c59c3357------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a34690226e6</guid>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[ai-finance]]></category>
            <dc:creator><![CDATA[ZenStatement Labs]]></dc:creator>
            <pubDate>Thu, 30 Jul 2026 12:28:09 GMT</pubDate>
            <atom:updated>2026-07-30T12:28:09.294Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A governed, read-only interface for investigating billing outcomes from Claude Desktop.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vDtyYmUhl7NW0geiDA1WJQ.png" /></figure><p>A billing question can sound deceptively simple:</p><p><em>Why does the June invoice amount differ from the calculated charge for the same customer and period?</em></p><p>It is now possible to ask that question directly from Claude Desktop through ZenStatement Billing MCP. But connecting an AI client to Billing data does not, by itself, produce a useful answer.</p><p>The same commercial event can appear as a configured price, an original calculated amount, a post-adjustment amount, an invoice line, and an invoice total. All are legitimate numbers. They are not interchangeable.</p><p>For the June mismatch, an analysis of the original calculated amount may be technically correct. If a waiver reduced the charge before the invoice was prepared, however, the relevant comparison is the final amount and its invoice-line mapping. Comparing the invoice with the original calculation answers a nearby question, not the finance user’s question.</p><p>That distinction shaped ZenStatement Billing MCP. It gives an authorized Claude Desktop user read-only access to Billing analysis, but it is designed to resolve the financial meaning of a question before it treats a number as the answer.</p><h3>A Correct Query Can Be Financially Wrong</h3><p>The difficult part of billing analysis is usually not finding an amount. It is selecting the amount that represents the business stage the user has asked about.</p><p>In the invoice-mismatch example, several lines of investigation can look reasonable:</p><ul><li>What pricing was configured for the customer?</li><li>What amount did the calculation originally produce?</li><li>What amount remained after billing treatment?</li><li>What did the invoice ultimately contain?</li></ul><p>Each question has a valid purpose. The first explains setup. The second explains calculation. The third explains the charge after waivers, caps, credits, or other treatment. The fourth explains what the customer was billed.</p><p>The problem begins when those stages are treated as one dataset because they share a customer, period, and currency. They are connected stages in a lifecycle, not duplicate representations of the same fact.</p><p>This is why financial correctness is stricter than query correctness. A query can confirm that an amount exists. It cannot decide whether that amount is the right basis for an explanation.</p><p>For the June mismatch, the underlying path may look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JHCdHHra2fthoWEpfxx0Bg.png" /><figcaption><em>Figure 1. One billing question can lead to four financially valid but semantically different answers. The correct path depends on the business meaning of the question.</em></figcaption></figure><p>The relevant path is determined by the meaning of the question, not by the first source that contains an amount.</p><h3>Resolve the Right Business Knowledge</h3><p>Before analysing live Billing data, the MCP needs to turn the user’s wording into a clear financial question.</p><p>For an invoice mismatch, that means resolving the amount, period, level of detail, currency, and lifecycle stage. Does “calculated charge” mean the original calculation or the final amount after adjustments? Does June mean the calculation date or the invoice cycle? Is the user asking about one charge, one invoice line, or an invoice total?</p><p>This may sound like ordinary analytics hygiene. In billing, it is the main technical problem. A date that is correct for a calculation can be wrong for an invoice. A price configuration that is active today may be wrong for a historical period. A calculated charge may be valid and approved but still not be part of the invoice under review.</p><p>Billing MCP brings business knowledge into the analysis for this reason. It can retrieve the relevant definitions, lifecycle guidance, and adjustment rules, then use the Billing data available to the user to verify the result. The knowledge layer is not a separate document search. It informs what the MCP should look for and what it should compare.</p><p>For the representative mismatch, the investigation needs enough context to establish a path like this:</p><p>The aim is not to load every rule or every piece of metadata into the conversation. It is to retrieve the smallest useful amount of context: which amount is invoice-facing, which period rule applies, which treatment can change the amount, and what relationship should be checked.</p><p>This also explains why a short clarification is sometimes the right response. If “invoice amount” could mean a total or a particular line, there is no reliable default. Asking one precise follow-up is better than presenting a confident answer based on the wrong comparison.</p><h3>Safety Boundary</h3><p>Prompt instructions can guide an AI client, but they cannot be the only control in a financial data workflow.</p><p>An assistant may request more data than the question requires, attempt an unsupported operation, or form an analysis around an incorrect scope. Those restrictions need to hold at the Billing boundary, not only in the instructions given to the model.</p><p>Billing MCP therefore treats data access as a bounded capability. It is read-only: it cannot create, update, approve, void, or delete Billing records. The connection resolves the user’s Billing scope server-side. The client does not select the tenant or data boundary it can inspect.</p><p>The analytical path is bounded as well. It accepts supported read-only queries, limits returned results, and records session and analysis activity. The answer is presented in finance language, without exposing the underlying warehouse structure.</p><p>There is an important division of responsibility here. The analysis workflow is designed to retrieve the right business context and verify assumptions before it explains a result. The execution boundary enforces the conditions that must remain true even when that reasoning is incomplete: authorized scope, read-only operation, and bounded results.</p><p>That is what makes Billing MCP useful for investigation without making Claude Desktop another place where billing records can be changed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7kCK1eKiUcs7MUckLolY9w.png" /><figcaption><em>Figure 2. The controlled analysis path separates business grounding and bounded exploration from guarded execution and inspectable delivery.</em></figcaption></figure><h3>Connect Claude Desktop to Billing</h3><p>The first supported Billing MCP connection is Claude Desktop. Setup is intentionally short:</p><ol><li>In ZenStatement Settings, generate a dedicated API key with the <strong>Billing</strong> scope.</li><li>Copy the key when it is shown. It is not displayed again.</li><li>Select <strong>Check how to connect</strong> and download the Billing connector file.</li><li>Open the `.mcpb` file in Claude Desktop and enter the API key when prompted.</li></ol><p>The connector handles the installation flow. The API key determines the Billing access available to the connection. The detailed setup guide covers credential handling and troubleshooting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8ui7VRyT8-HmkYIyW2wJUQ.png" /><figcaption><em>Figure 3. Generate a dedicated API key and select the Billing scope.</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*reoAGYzcIX4zro8f8tFvww.png" /><figcaption><em>Figure 4. Download the Billing connector, install it in Claude Desktop, and provide the API key.</em></figcaption></figure><h3>Questions Finance Teams Can Ask</h3><p>The useful questions are specific about the period, the billing object, and the decision behind the analysis:</p><p><em>Which customers had the highest final invoiced amount in May?</em></p><p><em>Compare the original and final calculated charge for Acme in May. Were any waivers or maximum caps applied?</em></p><p><em>Which calculated charges approved for May are not yet associated with an invoice batch?</em></p><p><em>Trace this calculated charge through to its invoice outcome. Did a credit note or FX conversion reduce the final billed amount?</em></p><p><em>Why did the April usage file fail header validation? Which required fields are missing or invalid?</em></p><p>These examples are deliberately framed as finance questions, not requests for a particular query. The MCP may still ask for a customer, currency, file, charge, or period where that detail changes the financial meaning of the result.</p><h3>The Lesson</h3><p>Giving an AI client access to Billing data is necessary. It is not sufficient.</p><p>The system also needs to be correct about the financial contract behind the question: the lifecycle stage, period, amount definition, treatment, and relationship path that make an answer meaningful.</p><p>ZenStatement Billing MCP is not an unrestricted natural-language-to-SQL connector. It is a governed, read-only interface for investigating Billing outcomes from Claude Desktop, with the business context and safety boundary needed to make those investigations useful.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a34690226e6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your Reconciliation Agent Doesn’t Need a Smarter Model. It Needs a Harness.]]></title>
            <link>https://medium.com/@ZenStatementLabs/your-reconciliation-agent-doesnt-need-a-smarter-model-it-needs-a-harness-dab4fa72ebf9?source=rss-cea8c59c3357------2</link>
            <guid isPermaLink="false">https://medium.com/p/dab4fa72ebf9</guid>
            <category><![CDATA[agentic-ai-architecture]]></category>
            <category><![CDATA[ai-in-finance]]></category>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[financial-services]]></category>
            <dc:creator><![CDATA[ZenStatement Labs]]></dc:creator>
            <pubDate>Tue, 28 Jul 2026 12:11:50 GMT</pubDate>
            <atom:updated>2026-07-28T12:11:50.430Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HawtNLX6sbiF6gnE_763DQ.png" /></figure><p>In financial operations, it’s one rounding error away from a missed settlement, a wrong refund, and an audit trail nobody can reconstruct three weeks later.</p><p>Eighteen months building agents that read, reconcile, and explain financial data across messy, ever-changing files: bank statements, marketplace settlements, OMS exports. None of the recurring failures ever traced back to which model we called.</p><p><strong>TL;DR:</strong> The model is a commodity. What makes an agent trustworthy with real financial data is everything built around it. Files get tracked through their processing state. Domain knowledge gets retrieved before the agent acts. Reconciliation is scaffolded so the model isn’t improvising a join key from scratch. Failures are typed instead of swallowed. Memory stays scoped instead of sprayed. The system knows when to stop and hand a decision to a person. Eleven lessons follow. The operating system around the model is the product.</p><p>Finance files are not clean. Headers start on row four. The same file has three header formats buried inside it. Month over month, a source changes its columns without telling anyone. Negative numbers show up in parentheses, currency symbols sit inside “numeric” columns, and a repeated header row occasionally gets read as data. None of this is exotic it’s the default shape of raw financial data before any cleansing runs. An agent that reasons about the business question and the raw file shape at the same time gets one of them wrong. In this domain, wrong isn’t a chatbot hallucination. It’s a number on someone’s balance sheet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iLPlIlHk534QHqc8sfnzTg.png" /><figcaption>Multi-Agent Orchestration</figcaption></figure><h4>Lesson 1: File state is the product</h4><p>Users ask for things in business language: reconcile these two files, explain this variance, show me the top drivers. None of that is answerable until the agent knows exactly what state a file is in. File processing isn’t a preamble to the real work it’s staged like its own pipeline: upload, header detection, schema detection, transform, into a managed state. Each stage produces an artifact the next stage can trust instead of re-deriving it.</p><p>The alternative is what most teams do by default: hand the raw file to the model every time and ask it to figure things out fresh. That works until the file has a second header format buried in row 400, and the agent silently miscounts rows. The fix isn’t a smarter model. It’s not asking the same question twice. Once a file’s shape is established, every later step reads from that shape instead of rediscovering it.</p><h4>Lesson 2: Parsing is where the reasoning happens</h4><p>Parsing looks like plumbing the boring step before the interesting one. In financial data, it’s the opposite: parsing is the first reasoning the system does, and if it’s wrong, nothing downstream can be right. A misplaced header row inflates a reconciliation count. A date parsed in the wrong format drifts every period comparison. An amount column that stays a string fails aggregation, sometimes silently.</p><p>This is why file reading, table extraction, schema detection, and transformation stay as separate steps instead of one blended guess. Each step narrows ambiguity before the model has to act on it, and each produces something inspectable when a downstream number looks off. A bigger context window doesn’t fix a bad extraction. Clean structure has to be built, not assumed.</p><h4>Lesson 3: The knowledge base is the domain layer</h4><p>Clean files still aren’t enough, because the same word means different things depending on who’s using it. “Sales” in an order-management export isn’t “sales” in a marketplace settlement file. A refund shows up as a positive number with a status flag in one system and a negative number in another. A bank payout might be a settlement, a reimbursement, or a rolled-up transfer covering fifty underlying transactions, and the column name doesn’t tell you which.</p><p>That’s what the knowledge base is for. Not a document store on the side, but the layer that tells the agent what it’s looking at before it tries to analyze or reconcile anything. It carries what a source represents. Which tables are trusted for which question. How a metric is actually defined. Which joins are safe. Which business assumptions have already been agreed. Retrieval pulls in the handful of facts that matter for the task at hand, rather than dumping the whole domain into the prompt. Skip this layer and the agent has to infer too much from column names and sample rows and a wrong inference looks exactly as confident as a right one.</p><h4>Lesson 4: Reconciliation needs deterministic scaffolding before the model touches it</h4><p>Reconciliation looks like a join at small scale. At the scale that matters millions of rows, thousands of parameters, hundreds of revenue channels it’s a mess of near-matches. A booking ID buried inside another field. A voucher number that only exists for some rows. Amount signs that flip between systems. Duplicate keys on one side that need aggregating before any comparison is fair.</p><p>Letting a model improvise a matching strategy here is unsafe. We tested this directly, across several frontier models, with different temperature and sampling settings. Letting the model choose its own join key and matching logic produced under 90% accuracy on real reconciliation cases. A high-overlap but semantically weak key looks completely plausible right up until it’s wrong.</p><p>So the model doesn’t get to choose first. Candidate keys are scored deterministically name similarity, value overlap, containment, cardinality, entropy, type compatibility, trial joins before any matching runs. Many-to-many joins and purely temporal keys get penalized automatically. The model still matters after that: it explains the logic, handles edge cases, writes the report. But it’s operating inside a search space that statistical evidence has already narrowed, not one it invented from scratch.</p><h4>Lesson 5: Let scoring decide between SQL and code, not the model</h4><p>Once a join key is scored, something else has to decide how the match actually runs, and that decision isn’t the model’s either. The same scoring pass ranks candidate keys and routes the reconciliation to whichever engine fits the data.</p><p>One high-confidence key, no cascade needed: the job goes to SQL. Pre-aggregate each side to the join grain, full outer join, label the status, done. The query is its own audit trail and cheap to re-run next month. Everything messier no confident key, a cascade across two or three fallback keys, fuzzy matching, composite logic goes to code execution, which is also the default whenever the signal is weak. Both paths emit the same structured result and the same human-readable report, so the engine underneath stays invisible to the user. The rule is just to score first, then send the clean case to the auditable query and the messy case to the procedure that can actually handle it.</p><h4>Lesson 6: Spend context on what the current step needs</h4><p>Agent instructions grow fast alongside all of this: file rules, reconciliation rules, SQL rules, governance rules, memory rules. Stuff all of it into every prompt and the agent gets slower, pricier, and more confused. The fix is a small, always-on core with detailed guidance loaded only when a task needs it. File work pulls in file-processing guidance. Reconciliation pulls in matching and sign-handling guidance. SQL analysis pulls in query guidance. Context is a scarce resource. Spend it on what the current step needs, not on what every possible step might need.</p><h4>Lesson 7: A failure is still a product decision</h4><p>In a workflow like this, an error is not neutral. It changes what the user trusts and what the system is allowed to do next. A blank error message leaves someone guessing whether their data got touched or their result is half-finished. Agent failures rarely look like normal application failures, either. A file might upload but never get schema-detected. A model might produce malformed JSON after doing genuinely useful reasoning. A query might time out after writing a partial result.</p><p>Treating all of that as one generic “something failed” throws away the system’s ability to recover. Each failure becomes a typed state that answers three questions: what’s safe to trust, what didn’t finish, and what happens next. Most of these never reach the user, because the harness heals what’s mechanically fixable. A rejected query comes back with the exact reason, gets repaired, and reruns. Malformed output gets re-requested instead of crashing the turn. There’s a hard cap on retries either way.</p><p>But mechanical failure and low-confidence uncertainty are different problems, and only one of them should trigger a retry. Retrying a bad cast makes sense, because there’s a correct query to converge on. Retrying an ambiguous join key doesn’t — it just produces a different plausible wrong answer. When the signal is weak, the system stops spending attempts and hands the decision to a person. Governance has to be able to interrupt this loop mid-run, not report on it afterward, because the risky step is often several tool calls past the user’s original request.</p><h4>Lesson 8: Context engineering is the actual moat</h4><p>Once every team can call the same frontier model, the model stops being anyone’s advantage. What’s left what actually separates a trustworthy agent from one that produces confident nonsense is the layer of context wrapped around it. Which file is current. Which schema got approved. How this business defines “net revenue.” Which reconciliation rule got agreed three weeks ago. That layer is the one thing a competitor can’t copy, because it’s made of one company’s own data and decisions. The model is rented. The context layer is owned.</p><p>That layer isn’t one thing. Conversational context tracks what the user has already decided. Definitional context holds what the business words actually mean. Semantic context knows how a number is really computed, not just what it’s labeled. Structural context knows the real columns, types, and keys. Provenance context knows where a value came from. Get all five right, in the right order, and an ordinary model looks sharp. Miss one and it guesses.</p><p>Underneath all of it, the system keeps the full conversation as a durable, auditable trail but only ever puts a rolling, relevance-ranked summary in front of the model. It also enforces a strict trust order: a live instruction outranks an old summary, and an approved schema outranks a fresh guess.</p><h4>Lesson 9: Memory is a learning loop, not a transcript</h4><p>Context decides what the agent knows in one turn. Memory is what makes it better at one customer’s world over months, without retraining anything. That matters here because a customer’s file quirks and metric definitions were never in any model’s training data. The base layer is unglamorous: every exchange gets stored, searchable by meaning rather than position. On top of that sits reflection, periodically distilling the accumulated history into durable beliefs: which column actually holds the trustworthy amount, which two files always reconcile on a specific reference field.</p><p>None of that gets to override ground truth. If a learned belief conflicts with the approved schema or the actual data in front of the agent, the live evidence wins and the belief gets corrected. Reflection also runs on a cooldown rather than after every message, because constant re-learning adds noise, not signal.</p><h4>Lesson 10: Evaluation is not optional</h4><p>Generic correctness checks don’t catch the failures that matter here. The real regressions are operational: does key scoring avoid a tempting-but-invalid key, does the system aggregate duplicates before comparing amounts, does a temporal-only key get demoted, do read-only guardrails actually block a mutating query before it runs. These are the bugs that produce plausible-but-wrong answers, which are the only kind that matter in this domain.</p><p>We pulled together more than a thousand real reconciliation and analysis scenarios: different file pairs, key structures, sign conventions, edge cases that quietly break matching. We distilled them into a focused set of evals rather than a sprawling test pile nobody maintains. Each one pins down a behavior the system depends on, so a regression fails loudly before a customer ever sees it.</p><h4>Lesson 11: Artifacts are the trust boundary</h4><p>A good response here isn’t a paragraph. It’s a file: a reconciliation result, an exception list, a chart-ready dataset. Every output gets written as a managed artifact with metadata attached, so a result can be downloaded, inspected row by row, and handed to someone else without anyone having to trust a summary on faith. The artifact is the evidence. The text around it is narration.</p><p>It pays off in system design too. Once outputs have a stable shape, nothing downstream the frontend, the governance layer, the next workflow needs to know which agent produced the result. It just needs the artifact and the explanation attached to it.</p><h3>What doesn’t get commoditized</h3><p>Some of this scaffolding will matter less as models improve fewer malformed outputs to catch, maybe better native handling of messy files. What won’t stop mattering is the part that encodes one company’s world: their files, their metric definitions, their tolerance for risk. Calling an API is available to anyone. Building a harness that lets a model operate safely inside someone else’s finance function is not.</p><p>Link : <a href="https://www.linkedin.com/posts/ai-agents-for-financial-data-ugcPost-7483780811507482624-johq/?utm_source=share&amp;utm_medium=member_desktop&amp;rcm=ACoAAAYsyEIBguFup3zcfuRCI-LDc1_KGharEFw">full whitepaper</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dab4fa72ebf9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Teaching Your Logs to Debug Themselves]]></title>
            <link>https://medium.com/@ZenStatementLabs/teaching-your-logs-to-debug-themselves-1c1aacdc45db?source=rss-cea8c59c3357------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c1aacdc45db</guid>
            <category><![CDATA[ai-data]]></category>
            <category><![CDATA[ai-in-finance]]></category>
            <category><![CDATA[ai-in-reconciliation]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[finance-and-banking]]></category>
            <dc:creator><![CDATA[ZenStatement Labs]]></dc:creator>
            <pubDate>Fri, 24 Jul 2026 07:44:30 GMT</pubDate>
            <atom:updated>2026-07-24T07:44:30.364Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3dWO1vkwH3CEj8WxYvle2A.png" /></figure><p><em>How we built an AI-powered log intelligence system that turns noisy alerts into actionable insight.</em></p><p>Every engineering team hits the same wall as it grows: there are simply too many logs. A single misbehaving service can flood your channels with hundreds of stack traces a day. Somewhere in that noise is the one error that actually matters but by the time a human finds it, the on-call engineer is already numb to the pings. This is alert fatigue, and it quietly costs teams hours of debugging time and a fair amount of sanity.</p><p>We wanted to find out how much of that grind could be handled by software. So we built an AI-Powered Log Intelligence &amp; Auto-Remediation System a service that watches production logs, uses a large language model to understand what went wrong, and decides what to do about it. This post is a tour of what it does, how it’s put together, and what we learned along the way.</p><h3>What it actually does</h3><p>At its core the system is a pipeline. An error happens in a production service, Grafana (backed by Loki) fires an alert, and that alert lands on a webhook. From there, the pipeline takes over:</p><ul><li><strong>Ingest</strong> — the raw Grafana webhook is validated and accepted without blocking the alerting system (processing happens asynchronously).</li><li><strong>Parse</strong> — Go stack traces are parsed into structured frames: the error message, the failing file and line, the error type (panic, error, fatal), and normalized timestamps.</li><li><strong>Enrich</strong> — each error gets a fingerprint hash for deduplication, a count of how often it’s been seen recently, the affected endpoint, and when configured the actual source code pulled read-only from GitHub around the failing line.</li><li><strong>Classify</strong> — a Gemini model on Vertex AI reads the enriched context and classifies the error as a validation_error, code_bug, infra_issue, or unknown, along with a confidence score and a recommended action.</li><li><strong>Act</strong> — based on the classification and confidence, the system notifies developers in Slack, raises a critical alert for SRE, opens a Jira ticket, or simply logs it quietly.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0g5DaicuoT4cwDMD9YuneQ.png" /><figcaption><em>The pipeline: an alert flows left to right, and every step is recorded in PostgreSQL.</em></figcaption></figure><p>Everything is persisted to PostgreSQL the logs, the analysis, the actions taken so there is a full audit trail of every decision the system made and why.</p><h3>A concrete example</h3><p>Suppose the billing service throws a panic deep inside a charge-calculation job. Instead of a wall of raw stack frames landing in a channel, the team sees a tidy Slack message like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VEpcx2Y0NoAk__ELGigc3A.png" /><figcaption><em>What the on-call engineer actually sees in Slack — triaged, scored, and deduplicated.</em></figcaption></figure><p>That single message answers the three questions an engineer asks first: what kind of problem is it, how sure are we, and is this new or something we’ve been ignoring for a week? The “Similar Errors” count alone is often enough to turn a shrug into a priority.</p><h3>The design choices that mattered</h3><ul><li><strong>Context beats cleverness. </strong>The LLM never sees just an error string. We feed it the stack trace, the deduplication count, the endpoint, and real source code fetched around the failing line. Context is the single biggest lever against LLM hallucination.</li><li><strong>Confidence thresholds. </strong>The system only takes strong action above a configurable confidence threshold (0.85 by default). Low-confidence guesses get logged, not escalated.</li><li><strong>Feature flags everywhere. </strong>Every capability LLM classification, root-cause analysis, patch generation, PR creation sits behind a feature flag. You can turn the AI on for one service, watch it, and expand only when you trust it.</li><li><strong>Deduplication by design. </strong>A fingerprint hash means the same recurring error doesn’t generate the same ticket a hundred times. It’s counted, not repeated.</li><li><strong>Safety rails. </strong>GitHub access is read-only, webhooks are authenticated with a bearer token, secrets live in environment variables, and every action is written to an audit log.</li></ul><h3>Closing the loop: how it gets better</h3><p>We also wanted a clear way to see how well the system was doing, and to keep improving it while it ran. Instead of making that a separate project, we built the feedback into the same flow that already handles the alerts.</p><ul><li><strong>Feedback through Slack reactions. </strong>When the system posts an alert, engineers can react with a thumbs up or thumbs down to say whether the classification was right. We store that as a simple valid or invalid signal against the error, so leaving feedback takes a second and doesn’t need a separate tool.</li><li><strong>Agreement across the team. </strong>We count these reactions per error instead of acting on a single one. A classification is only treated as confirmed or rejected once enough people agree, so one accidental reaction doesn’t change the result.</li><li><strong>A daily summary. </strong>Every morning the system sends a short report of the previous day: how many errors came in, how they were classified, how many tickets were raised, and how the feedback split between valid and invalid. If unclassified errors start going up or confidence starts dropping, we can catch it early.</li><li><strong>Adjusting the confidence cut-off. </strong>The system only acts on its own above a set confidence level, which we started at 0.85. Because we store the confidence next to the actual feedback, we can check whether that level is set right and adjust it based on real results rather than guessing.</li><li><strong>Testing before we change anything. </strong>Once we have a set of errors with confirmed labels, we can reuse them to test changes. Before switching the model or editing a prompt, we re-run that set and compare the results, so a change that makes classification worse gets caught before it goes live.</li><li><strong>Learning from past errors. </strong>Over time, the errors we have already confirmed can be fed back into the prompts as examples, and later the fixes that actually get merged can be reused as well. The goal is for the system to get more accurate the longer it runs.</li></ul><p>None of this needs a data science team. It is mostly a feedback table and a daily report, plus the habit of checking the numbers before making changes, which keeps it simple to maintain.</p><h3>Where it’s headed</h3><p>The system was built in phases, and only the first is doing the heavy lifting today. The roadmap is deliberately incremental, because trust has to be earned before software is allowed to touch code:</p><ul><li><strong>Phase 1 — </strong>classification, notifications, and context enrichment. Shipping today.</li><li><strong>Phase 2 — </strong>deeper root-cause analysis using retrieved code and exact file/line identification.</li><li><strong>Phase 3 — </strong>patch suggestion, where the model proposes a fix as a unified diff with its own confidence score.</li><li><strong>Phase 4 — </strong>automated pull requests, always behind human approval and rate limits — never autonomous deploys.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QWOROs9WNceiluA2bif8sg.png" /><figcaption><em>The rollout is deliberately incremental — trust is earned before software is allowed to touch code.</em></figcaption></figure><p>That last guardrail is worth repeating: fully autonomous production code deployment is explicitly a non-goal. The aim was never to replace developers it’s to hand them a triaged, explained, deduplicated problem instead of a raw stack trace at 2 a.m.</p><h3>What we took away</h3><p>The interesting part of this project wasn’t the model — it was everything around the model. Parsing logs cleanly, enriching them with real code context, deduplicating aggressively, and wrapping the whole thing in confidence thresholds and feature flags is what makes an LLM trustworthy enough to sit in a production alerting path. The AI is the easy 20%; the plumbing and the guardrails are the other 80%.</p><p>If your team is drowning in logs, you probably don’t need a smarter human staring at dashboards. You need a system that reads the boring 95% for you and taps you on the shoulder for the 5% that counts.</p><p><em>Built with Go, PostgreSQL, Vertex AI (Gemini), Grafana + Loki, Slack, and GitHub.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c1aacdc45db" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building an API Gateway as a Small Org Why It Pays Off Early]]></title>
            <link>https://medium.com/@ZenStatementLabs/building-an-api-gateway-as-a-small-org-why-it-pays-off-early-9eae49453241?source=rss-cea8c59c3357------2</link>
            <guid isPermaLink="false">https://medium.com/p/9eae49453241</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[reconciliation]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[ai-in-finance]]></category>
            <category><![CDATA[api-gateway]]></category>
            <dc:creator><![CDATA[ZenStatement Labs]]></dc:creator>
            <pubDate>Thu, 25 Jun 2026 20:18:04 GMT</pubDate>
            <atom:updated>2026-06-25T20:18:04.569Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*89sHq3gfChDAHxB3oAza7Q.png" /></figure><p>At some point, every growing software team faces the same invisible tax.</p><p><strong>TL;DR:</strong> An API gateway is a single front door between the internet and your backend services. Instead of every service handling its own security, logging, and identity checks, the gateway does it once, and every service behind it gets those things for free. Most advice says gateways are for big platforms. We think a small team should build one earlier than feels necessary because the work it removes lands on fewer shoulders, and the payoff compounds with every service you add.</p><h3>1. The pain before the gateway</h3><p>There’s a quiet moment in the life of a small backend team usually around the third or fourth microservice, when not having a shared front door starts to cost more than building one.</p><p>We hit it. Five services in, each one had grown its own JWT validation, its own CORS rules, its own way of logging who the user was. A single user session crossing three services produced three different shapes of log line. When a security header had to go out, it went out five times. When we found an auth bug in one service, the first question was always the same: which of the other four had quietly copied the same code?</p><p>None of this was a crisis. It was worse. It was friction that grew with every new service and every new engineer.</p><p>So we built an API gateway. This post covers why a small team should think about doing the same sooner than seems necessary, what the gateway looks like on AWS, and a few engineering ideas that fell out of the work.</p><h3>2. Why a small org actually needs one</h3><p>Think of it like a building with several offices. Before the gateway, each office had its own security guard, its own sign-in sheet, its own rules about who got in. Change the procedure a new ID requirement, say and you had to brief every guard one by one. Miss a guard, and that door was open.</p><p>The standard advice says gateways are for large platforms with many teams and many services. We disagree, gently, in the other direction.</p><p>A small team has fewer people to absorb the work a gateway removes. So each engineer it frees up matters more. The reasons are unglamorous:</p><p>A security patch is one engineer-hour, not five. A CSP or CORS change is a one-line edit in one repo, not a string of PRs across the mesh.</p><p>Tracing gets wired once and stays wired. The gateway is the natural starting point for every trace, so nobody has to remember to add it service by service.</p><p>Product engineers stop thinking about auth. Time spent on token validation is time not spent on the product and on a small team, that’s usually the only person who could have spent it there.</p><p>Adding a new service becomes a routes-table edit, not a sprint of plumbing.</p><p>The gateway is a fixed cost that keeps paying off with every microservice you add afterward. On a small team, there’s no spare headcount to cover that cost any other way.</p><h3>3. Where the gateway sits in AWS</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DAD2wSBSBO7mUkNCsEEgDw.png" /></figure><p>Two ALBs do the work at two tiers. The internet-facing ALB forwards all public traffic to the gateway, never straight to a microservice. The internal ALB sits behind the gateway and can only be reached from inside the private VPC.</p><p>That second point is the most important decision in the whole design, and it’s a network decision, not an application one. Because the internal ALB is private, no microservice can be reached from the public internet. Ever. Even if someone got past the gateway’s own auth, they’d still hit a closed private network. Defense in depth starts at the network boundary.</p><p>The gateway runs as a single Go binary on ECS ARM64/Graviton, for cost-per-request reasons. Traces flow out over OpenTelemetry.</p><h3>4. The constraints, and the three rules that came out of them</h3><p>The constraints were small-team constraints: a heavy bet on AWS and Go already in place, a team that owns several other things, and a hard rule that whatever we built stay boring and small.</p><p>Three rules followed, and we’ve held to them since.</p><p><strong>Thin gateway.</strong> Cross-cutting concerns only: identity, security, observability, routing. No business logic, no feature flags, no rate limiting yet. The moment it carries product code, every product is blocked on the gateway.</p><p><strong>Header-driven identity.</strong> The gateway authenticates once against IAM, then stamps identity headers onto the request before forwarding. Downstream services read the headers and trust the boundary. They don’t call IAM themselves.</p><p><strong>Allowlist, never wildcard.</strong> CORS origins, exempt routes, and HTTP methods (GET, POST, PUT, DELETE, OPTIONS PATCH is rejected everywhere) are all explicit lists. Wildcards hide too much, and they get read too fast.</p><h3>5. The middleware pipeline</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NTRlmjspZLSENQeMz6aIPQ.png" /></figure><p>Every request runs through this chain in strict order. Fail any layer and the request is rejected; it never reaches the next one. The order isn’t random. Cheap checks run first telemetry, headers, method, CORS and the expensive identity check runs last. Security headers get applied even to error responses. The worst time to forget X-Frame-Options is on a 401 page.</p><p>No stage holds state across requests. That’s what lets the gateway scale sideways on ECS, with no coordination between instances.</p><h3>6. Three engineering ideas worth unpacking</h3><h3>6a. Two-stage identity at the edge</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5FHGt73GJZgqYNJo_NJNKg.png" /></figure><p>Identity is enforced in two stages, both handed off to a dedicated internal IAM service. Keeping the logic in IAM, not the gateway, is what makes IAM the real source of truth. Stage one validates the bearer token. Stage two asks IAM whether this user can call this specific route which means the gateway first has to pull a tenant ID out of the request.</p><p>A few routes are exempt on purpose: health checks, IAM’s own routes (the bootstrap problem), login and OTP, webhooks, signup, and a handful of self-serve endpoints.</p><p>On success, the gateway stamps an identity envelope onto the forwarded request. Downstream services trust it and never call IAM.</p><h3>6b. The health-check route bug</h3><p>The exemption list started out matching health checks with a substring check against the path. It worked. It also quietly exempted any route whose path happened to contain that substring on purpose or not.</p><p>The fix was a compiled regular expression with proper path anchoring. The real lesson is bigger than the fix: exemption logic is security-adjacent code. A loose substring match there is a real risk. Any exemption, anywhere in the codebase, deserves the same review discipline as the auth code itself.</p><h3>6c. Reading the body twice without breaking downstream</h3><p>The authorization stage often needs to look inside a POST or PUT body to find the tenant ID. But the body still has to reach the backend untouched. The fix: buffer the body in memory, read and parse what’s needed, then put a fresh reader back over the same bytes before proxying. The backend never knows it was read twice.</p><h3>7. Build, ship, run the delivery path</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SDD1wuwM1O8SmAIzW-HLLA.png" /></figure><p>A merge triggers CI, which builds with Buildx for arm64 and pushes to ECR. The ECS Deployment Controller shifts traffic across the cluster — zero downtime, automatic rollback on a failed health check.</p><p>One thing worth flagging: the ALB’s health check wires straight to the gateway. Get the exemption logic from 6b wrong, and the gateway can take itself off the network.</p><h3>8. Tradeoffs and operational realities</h3><p><strong>Single point of failure.</strong> Every public request goes through it. We soften that with multiple ECS tasks, graceful shutdown on SIGTERM, and solid health checks. But the concentration risk is structural, and worth naming.</p><p><strong>Trust boundary.</strong> Downstream services trust the gateway’s identity headers, which means nothing behind it may ever be publicly reachable. The network isolation is the real enforcer.</p><p><strong>The exemption list grows.</strong> Every new public endpoint adds a row. Exemption lists are security code, and they get audited like security code.</p><h3>9. What it bought us long-term</h3><p>A few months in, the compound returns showed up.</p><p>One change wired distributed tracing end-to-end across every service, with no service team touching anything. One change rolled out a new CSP across every product surface at once. New services now launch without re-implementing auth integration is a few lines in a routes table.</p><p>When a security review turns up a new requirement, there’s exactly one place to land it. Anything on the roadmap rate limiting, dynamic policy, gateway-managed API keys, schema validation, metrics lives in one stack instead of being filed against five services.</p><h3>10. For other small organizations</h3><p>The point isn’t “build an API gateway.” There are stages where it’s overkill and stages where it’s overdue.</p><p>The point is that cross-cutting concerns get more expensive every time you defer them, and the cost compounds invisibly across every service you add and every engineer you onboard. Nobody sees the full bill.</p><p>A gateway is one way, not the only way, to make that cost visible and fix it in one place. In our case it was a fairly small Go service on AWS ECS. The size of the bet was never the point. The fact that it kept paying off with every service added afterward was. We’d build it again, earlier.</p><p><em>Zenstatement is building infrastructure for modern finance teams. If you’re working through similar architecture decisions, we’re happy to talk.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9eae49453241" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[50 GB Settlement Files Were Breaking Our Pipeline. Here’s What We Built Instead.]]></title>
            <link>https://medium.com/@ZenStatementLabs/50-gb-settlement-files-were-breaking-our-pipeline-heres-what-we-built-instead-4a36a92032f5?source=rss-cea8c59c3357------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a36a92032f5</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[ai-in-finance]]></category>
            <category><![CDATA[filesystem]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[ai-reconciliation]]></category>
            <dc:creator><![CDATA[ZenStatement Labs]]></dc:creator>
            <pubDate>Tue, 16 Jun 2026 17:54:42 GMT</pubDate>
            <atom:updated>2026-06-16T17:54:42.281Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iL4ZdjIf-DKUsdWqEc6Q2A.png" /></figure><p>A 15 GB CSV arrives at 2am. Settlement data from a payment network pipe-delimited, with metadata rows above the actual header, and a few multiline quoted fields that break the C tokenizer. The matching job is scheduled for 6am. The close window opens at 8am.</p><p>If the file takes four hours to parse, or crashes mid-read and has to retry, finance misses the window. Month-end close slips.</p><p>This is production reality. It’s the file type we ingest every day.</p><p><strong>TL;DR:</strong> Single-machine tools can’t safely parse 10–50 GB vendor files. We built a two-phase pipeline Dask cleanses the raw file in parallel chunks, hands it off as Parquet, and Spark writes it to an Iceberg warehouse. A ~12 GB file that used to risk running out of memory now lands in under nine minutes.</p><h3>The files finance actually receives</h3><p>The engineering assumption is that data arrives clean. The finance reality is that it doesn’t.</p><p>Enterprise reconciliation teams get settlement files from payment networks, marketplaces, and banking counterparties. These files regularly run mbs to 10s of GBs or 100 of GBs. They come with non-standard delimiters, duplicate column names, repeated header rows embedded in the data, and in some cases multiple sub-reports concatenated into a single file. Parsing them is not a data warehousing problem. It’s a parsing correctness problem.</p><p>The standard tool for fast CSV parsing pandas.read_csv with the C engine is not safe above a few gigabytes on a typical production worker. It loads the dataset into memory before you can transform anything. A 15 GB CSV expands larger once data types and index structures are allocated. On most workers, the process dies. And even if it doesn’t, it’s slow.</p><p>Spark’s CSV parser handles structured data well. But point it at a file with multiline quoted fields and stacked sub-reports and it fails in ways that are difficult to debug. The error messages tell you something went wrong — not where, not why, not what the file looked like when it broke.</p><p>We needed something that could parse hostile files without crashing, and do it fast enough to hit a 6am downstream job.</p><h3>The two-phase split</h3><p>Parsing a messy 15 GB CSV is a different problem from writing clean, columnar data to a lakehouse at warehouse scale. Forcing a single tool to do both creates a system that does neither well. Dask is built for parallel, out-of-core reads on file-based data. Spark is built for distributed analytics and columnar storage. We split the pipeline at the point where those strengths diverge.</p><p><strong>Phase one: Dask reads and cleanses.</strong> dask.dataframe.read_csv loads the file in partitions never holding the full dataset in RAM at once. Column renames, null removal, type coercion, and repeated-header removal run via map_partitions in parallel across CPU cores. We force the Python CSV engine rather than the faster C engine. Python is slower on clean files. It’s the only engine that handles multiline quoted fields and EOF errors without crashing — both of which show up regularly in production settlement exports.</p><p><strong>Phase two: Columnar handoff to Spark.</strong> When cleansing is done, to_parquet converts the Dask DataFrame using up to 32 distributed workers, repartitioned into roughly 200 chunks of 128–256 MB each. Snappy compression is applied with row groups sized at 512,000 rows the granularity Spark reads efficiently. Temporary storage targets /dev/shm (RAM disk) when the worker has at least 15 GB free; it falls back to /tmp on EBS otherwise.</p><p>Spark then reads the Parquet directory with mergeSchema enabled, so column additions across file generations are handled automatically. The resulting DataFrame is enriched with metadata file UUID, ingestion timestamp, sheet name and written to the Iceberg raw layer via WAP (write-audit-publish) append. After the write, the pipeline runs a verification query: the written row count must exactly match the extracted row count. Mismatches halt the pipeline. There are no silent partial loads.</p><h3>Why Parquet in the middle</h3><p>The handoff format matters more than it looks.</p><p>Parquet is exactly what Spark and Iceberg expect: columnar, compressed, with row groups pre-sized for parallel reads. Passing data through Parquet eliminates redundant serialization. It also removes format mismatch as a failure mode by the time Spark sees the data, it’s already in the shape Spark wants.</p><p>The alternative having Spark own the full pipeline, CSV parsing included would reduce operational components. But it would mean asking Spark to handle file shapes it wasn’t designed for, and debugging failures in a system that conflates two different problems.</p><p>Isolated failure modes are worth the extra component. When Dask fails, the problem is in file parsing. When Spark fails, the problem is in the warehouse write. That separation is useful when someone is triaging an incident without a debugger.</p><h3>What the timing actually looks like</h3><p>For a ~12 GB settlement file, the pipeline breaks down like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jvbodoUfa-hTnQ5hTpVB0Q.png" /></figure><p>The Spark conversion stage dominates expected, because that’s where the most parallel I/O occurs. For files in the 10–15 GB range, total ingest-to-Iceberg-raw runs in the single-digit to low-tens-of-minutes range. The per-stage breakdown also makes it straightforward to distinguish a network-bound S3 download from a CPU-bound partition problem.</p><h3>The trade-offs we accepted</h3><p>Two systems instead of one means more operational components: a distributed Dask client, temporary Parquet storage, a Spark cluster. That’s real overhead.</p><p>The Python CSV engine is 2–3x slower than the C engine on clean files. We accepted that cost because clean files are not what we actually receive.</p><p>A fresh Dask client per file adds a few seconds of startup overhead. It prevents inter-file state leakage in multi-tenant environments. We decided isolation was worth the startup time.</p><p>None of these were obvious calls. But each trade-off was deliberate taken because the alternative created a failure mode that was worse.</p><h3>The lesson that doesn’t go away</h3><p>Partition sizing matters more than core count. Wrong partition counts — too many tiny files, or too few oversized ones create I/O imbalance regardless of how many workers you throw at it. Empirically tuned 128–256 MB Dask partitions with 512k-row Parquet row groups have more impact on throughput than adding the next CPU.</p><p>And fail explicitly. A job that raises a detailed exception and reruns cleanly is better than one that silently drops rows and passes verification by coincidence. Every parse failure in our pipeline surfaces the file name, engine configuration, and the nature of the malformed input. That’s the minimum context an operations team needs to act without opening a debugger.</p><p>If your reconciliation pipeline is running on pandas and the files are already at the boundary of what it can handle, the file sizes will grow before the tooling does. If you’re working through similar ingest problems or building on top of an Iceberg lakehouse we’d be glad to hear how you approached it.</p><p><em>ZenStatement Labs · June 2026</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a36a92032f5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How We Benchmarked AI for Financial Reconciliation (And What We Had to Build First)]]></title>
            <link>https://medium.com/@ZenStatementLabs/how-we-benchmarked-ai-for-financial-reconciliation-and-what-we-had-to-build-first-f8b30b218b7e?source=rss-cea8c59c3357------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8b30b218b7e</guid>
            <category><![CDATA[ai-benchmarking]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[agentic-ai-in-finance]]></category>
            <category><![CDATA[ai-reconciliation]]></category>
            <dc:creator><![CDATA[ZenStatement Labs]]></dc:creator>
            <pubDate>Fri, 12 Jun 2026 05:41:46 GMT</pubDate>
            <atom:updated>2026-06-12T06:36:25.604Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qr26RjdOtAXiCC4OmRBp_A.png" /></figure><p>Most AI benchmarks are somebody else’s problem dressed up as yours.</p><p>Coding ability. Logical reasoning. Summarisation. These make for clean leaderboards. They tell you almost nothing about whether a model can match a $998 Stripe settlement to a $1,000 order after a processing fee, across 67,000 records, without posting a single wrong entry to your books.</p><p>No benchmark existed for that. So we built one.</p><p><strong>TL;DR:</strong> We ran 1.37 million synthetic transactions across 11 reconciliation scenarios, testing four models Creo (our own engine), GPT-5.5, Claude Sonnet 4.6, and Gemini 3.1 Pro. This post is about how we designed the test, what decisions we made, and why. The results are in the full report. What matters here is whether the methodology holds up.</p><h3>The problem with borrowing benchmarks</h3><p>Reconciliation is a matching problem: given two datasets, determine which records belong together. The closest equivalent in machine learning is entity resolution. But financial reconciliation has one important difference.</p><p>Most matching tasks treat missed matches and incorrect matches as comparable errors. Finance doesn’t. A missed match simply requires manual review. A false match creates an incorrect accounting entry that may not surface until reconciliation or audit, making it far more expensive to fix. That single asymmetry shaped our benchmark. It influenced the metrics we chose, how we interpreted model performance, and ultimately what we considered “good” reconciliation.</p><h3>Building the benchmark (new section)</h3><p>Building the benchmark turned out to be less about prompting models and more about building an evaluation system we could trust. Before we could compare a single model, we had to answer a more fundamental question: if two models produced different results, how would we know whether the difference came from the models or from the benchmark itself?</p><p>That meant building every part of the evaluation pipeline before running the first test. We generated synthetic enterprise datasets that reflected real reconciliation workflows without exposing customer data. For every scenario, we created a manually verified ground truth the answer key against which every model would be evaluated. We standardised the task description, ran each model under identical conditions, normalised their outputs into a common format, and scored every prediction against the same evaluation criteria.</p><p>Each component served a specific purpose. Synthetic data let us model real-world complexity safely. Ground truth eliminated ambiguity about what the correct answer was. Standardised execution ensured we were comparing models rather than prompts. And a common scoring framework meant every result was evaluated consistently, regardless of how the model presented its output.</p><p>Only after those pieces were in place did we begin asking the more interesting questions: What should success look like? What kinds of scenarios expose real operational weaknesses? And how do you distinguish a model that finds more matches from one you would actually trust with your books?</p><h3>Choosing the right metrics</h3><p>Given the false-positive cost, we built the evaluation around Precision as the primary metric.</p><p><strong>Precision</strong> of everything the model flagged as a match, what fraction was actually correct captures the thing that matters most operationally. A model with 99% recall and 70% precision sounds impressive until you realise it’s posting wrong entries on 30% of its output.</p><p><strong>Recall </strong>of all the true matches that existed, how many did the model find matters too, but it maps to a different cost: manual review backlog, not book errors.</p><p><strong>F1</strong> is the harmonic mean of the two. We reported it because it penalises being bad at either, which gives a single comparable number across scenarios. But we never let a good F1 obscure a bad Precision, you’ll see in the results where a model posted a higher F1 than Creo on one scenario while carrying materially worse Precision. That’s not a win.</p><p><strong>Pass Rate</strong> was the fourth metric: how many of the 11 scenarios did a model handle consistently, defined as average accuracy above 80% across all match types within a scenario. This matters because a tool that works on gaming settlements and fails on D2C payouts is not infrastructure you can rely on. It’s a tool that works in good conditions.</p><h3>Designing scenarios that actually stress the models</h3><p>This was the hardest part.</p><p>The temptation in benchmark design is to use clean, representative data. Clean data produces high scores on everything and tells you nothing. We had to construct scenarios that exposed the failure modes that show up in real enterprise reconciliation and we had to do it without using client data.</p><p>We modelled 11 scenarios from synthetic datasets across four categories: e-commerce order reconciliation, payment gateway settlements, OMS logistics, and ERP-to-POS. Each scenario was built to reflect a specific class of operational complexity.</p><p><strong>Schema heterogeneity.</strong> Payment gateway files from Stripe, Razorpay, and PayPal each use different column names, date formats, and fee representations. A general-purpose model has no built-in knowledge of these schemas. To stress this, we constructed scenarios where the two sides of the reconciliation used structurally different formats with no shared field names.</p><p><strong>Amount variance.</strong> Settlement amounts almost never equal order amounts. Processing fees, chargeback reversals, tax adjustments, and promotional discounts all change the figure before settlement. In the D2C brand vs. marketplace scenario, 41% of records required tolerance-based matching meaning the correct match exists, but the amounts don’t match exactly. A model that only matches on exact amounts will miss 4 in 10 records. A model that matches too loosely will create false positives.</p><p><strong>Dataset size and context.</strong> For large files, tens of thousands of records, general-purpose models can’t process the whole thing in one pass. We split those files into batches of approximately 200 records and combined results. This is a real limitation: context is lost between batches, and matches that span records far apart in the file can be missed. The finance-specific tool processed full files without batching. We made this difference explicit in the methodology because it’s a structural constraint, not a prompt design choice.</p><p><strong>Clean data as a control.</strong> The Gaming settlement scenario was intentionally high-volume, well-structured, and low-variance. All four models scored 100% on it. That’s the point. It shows the benchmark isn’t broken, and it shows where the gap between general-purpose and domain-specific tools actually appears not on clean data, but on messy data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wv4k-5zeVqN5El7MKffbyQ.png" /><figcaption>Scoreboard of each scenario with models</figcaption></figure><p><strong>ZenStatement built both this benchmark and Creo, one of the four tools it scores. <br></strong>Here’s what we did to limit it.</p><p>Ground truth for each scenario was a manually verified set of correct matches, built by ZenStatement’s reconciliation team before any model was run. The answer key was fixed. Models were scored against it, not adjusted for it.</p><p>All models ran under the same conditions: same files, same task description, no special instructions or few-shot examples from the test data, temperature set to 0 for deterministic output.</p><p>We’ve made the full dataset and evaluation code available on request. If you want to rerun the benchmark on the general-purpose models or on a different domain-specific tool you can. We’d welcome it.</p><p>The case for the results isn’t “trust us.” It’s: the methodology is transparent enough to challenge. If you think the batching approach disadvantaged the general models unfairly, or that better prompt design would close the gap on specific scenarios, run it and show us. We’re genuinely interested in where that argument holds.</p><h3>What the results exposed</h3><p>Two findings were surprising, not just confirmatory.</p><p>The first: on the D2C payout scenario and the Fashion brand settlement scenario, both Claude and Gemini returned zero correct matches. Not low precision zero. Every flagged match was wrong. If a finance team had posted that output directly, every entry would have needed to be reversed manually.</p><p>What caused it wasn’t model capability in the general sense. Both scenarios involved small datasets with complex, multi-deduction fee structures the kind where settlement amounts reflect several rounds of adjustments off the original order value. The models matched on surface similarity between records that looked alike but weren’t financially equivalent. Without a built-in concept of what an acceptable variance looks like, and without schema knowledge to distinguish the fields that matter from the fields that don’t, the models optimised for the wrong signal.</p><p>The second finding was the one scenario where a general-purpose model appeared to win: OMS Forward/Reverse Logistics. Claude and Gemini returned a combined F1 of 92%, versus Creo’s 89%. Three points higher on paper. But that 92% was built on aggressive matching — more true matches found, and more wrong ones included. At the transaction volumes involved, even a small wrong-match rate compounds into hundreds of incorrect entries. A score that looks better on the headline number can mean more work in practice, not less.</p><h3>Designing for the Real World</h3><p>The pass threshold of 80% is a reasonable working definition of “reliable enough to deploy,” but it’s a choice, not a law. A stricter threshold say, 90% would change the pass counts. We chose 80% because that’s roughly where the operational cost of human review starts to exceed the cost of running the tool, based on our experience with finance teams. A different team with a different risk tolerance might draw the line elsewhere.</p><p>The batching approach for general-purpose models was the most defensible option available, but it’s not how a well-engineered production deployment would work. A dedicated engineering effort could likely improve the general model results on large-file scenarios through smarter chunking and cross-batch reconciliation logic. We didn’t test that. What we tested is what most finance teams would actually do when deploying a general-purpose model for this task.</p><p>Benchmarking a matching task correctly turns out to require most of the same discipline as building the matching task itself: you have to understand the domain’s failure modes before you can design tests that expose them. The interesting finding isn’t just which model won. It’s that clean, structured data produces high scores on everything and that the only way to know whether a tool will hold up in production is to test it on the data that looks like production.</p><p>If you are interested in the benchmark findings, scenario-wise breakdowns, and methodology, download the full report here. If you want the to review the dataset or evaluation code, email us at hello@zenstatement.com.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8b30b218b7e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>