The Cheapest Token Is the One You Never Spend
Agentic development needs a shared source of truth. When agents stop re-deriving the codebase, cost drops, speed rises, and answers stay consistent.
Published July 23 2026 · 6 min. read
There's a pattern our industry keeps relearning. The fastest way to do something is usually to not do it at all. We figured that out with caching, then with CDNs, then with materialized views. We're about to figure it out again with AI agents, and the bill for ignoring it is going to be a lot bigger this time. Think about what actually happens when you ask a coding agent a question about your codebase. It goes and reads your codebase. It opens files, walks directories, traces call graphs, and rebuilds an understanding of your system from raw source. Then you ask a second question and it does most of that work over again. Run a dozen agents across a few thousand repositories and you're paying, over and over, for the same understanding to be reconstructed from scratch. It's like hiring a brilliant consultant and making them reread the entire company wiki before they'll answer any email. Tokens are the units of text a model reads and writes, and they are what you pay for. Context is the material a model has to load into its working memory before it can answer. This context is the relevant pieces of your codebase and architecture. Rereading the codebase for every question means paying for the same context, in tokens, again and again. That's fine when you have one agent and one question. It falls apart the moment you scale it, and enterprises are scaling it fast. Soon you'll have hundreds of agents asking millions of questions against tens of thousands of repos. At that point the token bill stops being a line item you can wave away. It becomes the thing that decides whether your agentic program ships or stalls. ## Putting this to the test We ran a Proof of Value (POV) with a Fortune 500 customer on a large, eight-year-old monorepo, and then repeated the exercise across open-source repositories to quantify our hypothesis. We selected the top 10 security and software architecture questions that real teams ask, and that Claude also asks when implementing a feature: 1. Where are the hardcoded secrets? 2. Which authentication, authorization, and input validation frameworks are implemented? 3. How many APIs exist, and which frameworks are being used? 4. Which APIs expose PII without authentication? 5. What violates PCI DSS requirements? 6. Where do we stand against the OWASP Top 10? 7. Are we exposed to any recent zero-day vulnerabilities? 8. Which single dependency upgrade would eliminate the most vulnerabilities? 9. What are the trust boundaries? 10. Which data stores are being used? We then answered each question in two different ways: 1. The first way was a frontier model doing what it does best: reading the code and reasoning from a blank slate. 2. The second way pointed that same model at Apiiro's Data Fabric through a simple MCP interface, so instead of rebuilding an understanding of the application it could query one that already existed. The [Data Fabric](/platform) is two continuously updated graphs working together: The [Software Graph](/platform/data-fabric/software-graph), built on Apiiro's patented Deep Code Analysis, discovers, inventories, and visualizes the customer's evolving software architecture from code to runtime, including its APIs, AI assets, open-source and internal packages, secrets, and sensitive data flows. The [Risk Graph](/platform/data-fabric/risk-graph), an open risk engine, ingests, correlates, and deduplicates findings from Apiiro's own AI-native scanners and third-party tools, overlaying them onto the Software Graph as customer-specific risk intelligence. Together they form the organization's context and memory layer, and they stay current with every code change.  *Without a shared source of truth, every agent re-interrogates every repository on every task, so the work and the token cost compound with each new agent, prompt, and repo.*  *With Apiiro Data Fabric, agents query one always-current Software Graph and Risk Graph instead of re-reading the source. The Data Fabric answers once and stays current with every commit.* The results proved the hypothesis that **using a deterministic method to build and understand context allowed the same model to generate results using fewer tokens.**  | Metric | Code analysis, from scratch | Apiiro Data Fabric | Delta | | --- | --- | --- | --- | | Cost across 10 questions | $30.69 | $2.89 | ~91% cheaper (10.6×) | | Total tokens | 197K | 64K | ~68% fewer | | Input tokens | 141K | 48K | ~66% fewer | | Output tokens | 56K | 16K | ~71% fewer | | Wall-clock time | 35.8 min | 16.1 min | ~55% faster | **Roughly a tenth of the cost. Two-thirds fewer tokens. Half the time.**     The numbers I keep coming back to aren't the averages, though. It's the variance. The from-scratch runs swung from a few cents to nearly twelve dollars on a single question, depending on how far the agent decided to wander through the code that day. The Data Fabric answered every question inside a tight, predictable band. If you've ever tried to budget for an agentic workflow, you know which of those two behaviors you can actually plan around. ## Determinism is the real prize The predictable and reduced cost is already a strong proof point for the approach, but the most important part is consistency in output. When an agent rebuilds its understanding from raw source every time, its answer is only as stable as the path it happened to take through the code. Change the prompt order, swap the model version, resize the context window, and the "understanding" shifts underneath you. For brainstorming, that's a feature. For security, compliance, and anything you intend to automate and trust, it's a problem you can't build on. **You cannot run a reliable program on a foundation that reinterprets reality on every request.** A graph changes the deal. When the answer to "how many APIs expose PII without authentication" comes from a pre-computed model of the application, the agent isn't guessing its way to an answer. It's retrieving one that's already grounded in specific components, with lineage you can audit. Ask the same question twice and you get the same answer every time. However, the graph isn't a simple static cache. The graph is dynamic on every change to software and risk providing an up-to-date map to allow the model to deliver the consistency needed. In fairness, a frontier model reading the code directly can still surface incredibly rich line-level detail on individual questions. What the graph changes is the economics and the reach: consistent answers, far lower cost, and coverage of runtime and compliance questions that reading source alone cannot reach. ## What this means for how we build The scarce resource in agentic systems was never intelligence. The models are already remarkable and getting cheaper by the quarter. The scarce resource is grounded context, delivered efficiently. If you are putting agents to work across your teams, the principle follows from the benchmark, whether you build the plumbing or buy it. Compute the expensive understanding once and serve it to every agent, rather than paying to rebuild it on every invocation. Expose it through open interfaces like MCP or a CLI with skills, so your coding agent, your CI agent, and your security harness all draw from the same source of truth and the same knowhow. Then let the model spend its tokens on judgment, which is the one thing it's uniquely good at, instead of on rediscovery, which is expensive and adds no value. A 10× cut in per-query cost is the difference between running an agent on your ten most critical repos and running it across all ten thousand. A two-thirds reduction in tokens is the difference between a pilot and a standard. And determinism is the difference between an impressive demo and a workflow you'd actually let touch production. AI alone does not secure your agentic development. Memory and context do. We spent the last couple of years marveling at what agents can generate. We'll spend the next couple making them dependable and affordable at scale, and that won't be won with a bigger model. It'll be won with grounded truth, a fabric that already knows your software from code to runtime so your agents don't have to keep asking. The cheapest token really is the one you never spend. Learn more about the [Apiiro Data Fabric, Software Graph, and Risk Graph](/platform).
Wes Dobry