Make the expensive part cheaper by doing less of it
Four engineering write-ups share one theme: cost and reliability improved when teams shrank what each component had to do. Meta thinned its agent router, Cloudflare cut its AI reviewer bill by fixing prompt caching, GitHub filtered by time before aggregating, and D1 kept its control plane off the query path.
AI & Agent Engineering
Agent architecturevendor-reported
Meta keeps its agent router thin and puts domain reasoning in 14 subagents
Meta describes a 1,300-line orchestrator that routes 20+ workflows to 14 specialized subagents for data column onboarding. Its first single agent with all domain knowledge degraded as context grew; the orchestrator now follows a fixed 7-step protocol where only the delegation step uses LLM reasoning.
Why it matters
It is a concrete case of more context making an agent worse, and of routing treated as deterministic code rather than model judgment. The success figures are Meta's own, from one internal pipeline.
Do this week
Audit your top-level agent: list each decision it makes, and move any routing or sequencing decision into plain code or a workflow template, leaving domain reasoning to scoped subagents.
Cloudflare cut its AI code review cost 68% by fixing prompt caching and call counts
Cloudflare reports its average AI review fell to $0.77 from $2.43. Per its post, about 40% of the saving came from code changes, such as sharing one cached prompt prefix across repositories and cutting tool calls, and the rest from model and effort choices.
Why it matters
Most spend was cache writes and reads on repeated context, so cost followed call count and prefix design more than model price. Cloudflare notes its before-and-after steps are not controlled experiments.
Do this week
This week, log tokens for the first request of each agent session and check how often a shared prefix hits the cache. Keep repository-specific text after the shared part of the prompt.
GitHub rebuilt star history to filter by week before aggregating, cutting 2,511 requests to about 24
GitHub added an endpoint returning up to 30 weeks of daily star counts without identities. It translates page and per_page into an indexed created_at range before grouping, so react/react needs about 24 requests instead of about 2,511.
Why it matters
Applying LIMIT and OFFSET after grouping shrank responses but not the work the database did. GitHub also found a pagination bug that counted all stars on every request.
Do this week
Review one paginated aggregate query with EXPLAIN. If grouping runs before the range filter, push the indexed range down first, and look for per-request COUNT queries behind your pagination.
Cloudflare explains how the D1 control plane scales to millions of databases
Cloudflare says live D1 databases grew 15x over one year and 65x over two as of October 8, 2026. Query traffic stays off central components, with Workers KV for routing metadata, Hyperdrive for Postgres access, and precomputed aggregations.
Why it matters
Many small databases per tenant or preview environment is a growing pattern. The post separates data plane, control plane and background work, a useful way to decide what may depend on a single region.
Do this week
Sort your own operations into data plane, control plane and asynchronous work, then find any hot-path call that still depends on a central single-region component.
Measure your agent prompt cache hit rate on first requests
For one day, record input, cache-write and cache-read tokens for the first LLM call of every agent session, plus a hash of the first system block as sent.
Why. Cloudflare found only 14% to 26% of first requests hit a shared prefix because repo-specific text sat before the cache breakpoint.
Measure. First-call cache hit rate and cost per session before and after moving variable text behind the shared prefix.
Classic / essential read
Is High Quality Software Worth the Cost?
Martin Fowler · 13 min
It gives managers a plain argument for internal quality: it makes new features faster, so the usual quality versus cost trade-off does not hold for software.
One lesson. When you defend time for refactoring, frame it as delivery speed over months, not as polish.
Pick one expensive component this week, whether an agent, a query or a control-plane call, and ask what it is doing that something cheaper or simpler could do instead.
Get this every morning.
Free. Same issue for everyone. One click to unsubscribe.