Natalia Connolly and Kevin Madura put Claude Code on a post-merger procurement mess and then checked every answer, they told AI Engineer.
Their test replica was Harbor Health after its acquisition of Summit Health Plan, with hundreds of shared vendors and more than 40,000 contract documents in unlinked databases, Connolly said. The procurement lead wanted to know if the combined company could get better terms from Acme Health Services, how large the savings were and by when Harbor had to act. Claude Code returned clean and plausible tables, but the audit found total annual spend, company split and contract counts correct while total contract value was wrong by about $800,000, Connolly said.
The date was wrong too. Claude Code said December 1 to stop the soonest expiring contract from auto-renewing, while the true deadline was November 1, Connolly said. Waiting would have renewed the contract unwanted. The cause was data, not reasoning. An orphan amendment was floating unlinked to its parent so Claude Code never found the $800,000, and in another pattern two amendments each restated the full value so naive extraction summed three dollar figures to about $17 million when the text said the correct total was $7 million, the most recent restatement.
A master service agreement is the base contract that later statements of work and amendments modify, and that hierarchy was often broken. The pair spent about two weeks building a five-stage pipeline with document intelligence and OCR, classification of agreement type, term and rate extraction that handled tables split across pages, and mapping of services to spend categories, Connolly said. The 40,000 plus contracts then processed overnight. DSPy is a framework for programming language models into repeatable structured outputs, and Madura said they fed contract pages as images through DSPy to preserve charts and rate tiers that naive OCR stripped to bare axes.
With structured tables in place, they had Claude Code build its own shortcuts such as get rate card page and get specific vendor spend, with business logic encoded in code rather than prompts. An MCP server is a standard connector that exposes only approved tools to an agent and blocks everything else, and Madura said packaged tools and views let later agents inherit deal rules and keep access governed. A contract lifecycle management system is the official database where legal is supposed to store vendor names, dates and parent links, but Madura said those systems are almost never maintained so they rebuilt the hierarchy bottom-up by having Claude Code read the text.
Three failure modes remained. The agent pulled a termination clause date when the question required a renewal clause calculation, so external business rules had to be embedded up front. Governed access also hurt when Entity A and Entity B had different permissions, and Claude Code saw a zero or malformed invoice without useful feedback and kept going, Madura said. The team dispatched parallel agents for different savings levers and then reconciled them in a prescriptive workflow to avoid double counting the same vendor savings, but recommendations still failed when management had already started the action three months earlier.
The fix they urge is to spend tokens up front to structure data so Claude Code does not burn tokens rediscovering it, then keep feeding live business context. That matches where procurement AI is proven today, with spend analysis, contract intelligence, supplier risk monitoring and workflow automation as the four working areas per Spendflo. Watch the amendment link and the renewal language first, because a polished answer can cite a real page and still sum the wrong value.




