Software factory is a conversion funnel for AI agents A practitioner analysis argues that counting pull requests is a vanity metric for AI coding agents and that teams should instead measure a software factory's customer acquisition cost (CAC) — the token, compute and human cost of getting one change safely into production. In a worked example, a single change touching a few services, a database and a third-party API cost $380, of which tokens plus AI review bots ($35 across two tries) were under 10%, with almost all of the bill coming from human time and CI. The author recommends keeping context lean, making agents fail early when end-to-end verification is impossible, keeping CI light, and using feature flags and fast rollbacks rather than relying on staging. I spent a few years at a mobile app company where paid ads were the main growth channel, and a lot of the engineering effort went into optimizing the conversion funnel. From the moment a user clicked an ad, every interaction was instrumented and every step of the user journey was designed to drive paid subscriptions. If that funnel is leaking, you don’t double your ad budget. You look at where users are dropping off, form hypotheses, run A/B tests, and iterate until your unit economics improve. This is growth engineering 101. It’s also common sense. Unfortunately, common sense disappeared from the tech industry as soon as AI agents became a thing. I keep seeing companies double their ~~ad~~ token budgets to crank out more PRs so their CTOs can brag about PR volume on podcasts. Meanwhile, half those PRs are garbage, and the other half are stuck in CI pipelines that have been engineered to death to compensate for everything that’s broken elsewhere in the process. Before spending another dollar on a turnkey software factory, a context graph, a fleet of cloud agents, or yet another AI code review bot, I’d want to know how much of the code my agents already write makes it to production, what it costs to get it there, and where the rest gets stuck. TL;DR - PR volume is a vanity metric. Measure your factory’s CAC across token, compute, and human cost instead. Measure CAC → stop-counting-prs-measure-cac - Make agents fail early, on purpose. Keep context lean, and have agents stop before writing code if there’s no way to verify end to end. Context → 1-context-keep-it-lean - Your dev environment is the biggest leak. Without one, agents will add thousands of mocked unit tests before telling you your seeding is broken. Development → 2-development-verify-before-the-pr - Keep CI light and give staging a real job. Review proof bundles instead of doing QA, and let staging verify what couldn’t run locally. Review → 3-review-keep-ci-light-check-the-proof · Staging → 4-staging-send-traffic-not-prayers - Design rollouts like you have no staging. Use feature flags and fast rollbacks, and have watch agents turn failures into local seed scenarios. Rollout → 5-rollout-activation-isnt-retention - Your job as a leader is driving down CAC. Instrument the funnel, watch agent traces, and fix the top drop-off every week. Improve the factory → your-job-is-to-improve-the-factory Stop counting PRs, measure CAC Counting PRs is like counting app installs. Real users churn when onboarding breaks, so your funnel shows the problem. Agents don’t churn. They keep pushing commits until someone rescues the branch or merges it broken, and your PR count goes up either way. Measure your software factory’s CAC instead: what it costs to get one change safely into production and keep it there. Compute covers devboxes, CI, and staging. Includes retries, PR rescues, AI review bots, and rollbacks. Typically, I split the factory into five stages: context, development, review, staging, and rollout. Your setup might differ, so adapt it to your own process a software factory should reflect how your team actually ships software . I keep context separate from development because it’s more than code search: specs, tickets, docs, and service ownership often live outside the repos. Each stage gets its own conversion rate and its own line on the bill. Here’s what one ordinary change touching a few services, a database, and a third-party API costs when you can’t prove it works locally: Hey, your PR count went up, though. ¯\ ツ /¯ Even with real session costs and AI review bots $35 across two tries , tokens are still under 10% of the $380 bill. Almost all of it is human time and CI. Still, most of the industry’s budget is pouring into the top of the funnel: context graphs, MCPs, skills, loop engineering, harness engineering, agent swarms. Vendors will happily sell you all of it. Meanwhile, the real cost sits further down the funnel, in the boring parts you have to build yourself. 1. Context: keep it lean Of the five stages, this is the one I’d spend the least on. Models keep getting better at finding their way around a codebase, and a lot of today’s context engineering is going to age badly. Even before it goes stale, sprawling AGENTS.md files, elaborate prompt packs, and comments written specifically for agents can make agents worse at their jobs. Keep a short README or AGENTS.md as a table of contents pointing to your repos and docs, keep it next to the code, and prune it regularly. Stale docs are worse than no docs. On a growth team, if a button needs a tooltip to explain what it does, you fix the button. Docs written for agents are the tooltip layer of your codebase. Before adding another instruction, see if you can rename something, improve the types, reorganize a folder, or enforce the convention with a lint rule. And you don’t have to guess whether the extra context helps. Run your evals with and without it, the way you’d A/B test a tooltip in your onboarding flow. You might find that deleting half your AGENTS.md improves conversion. Only go further if agents keep grepping in circles or editing the wrong services. At that point, repo standardization, lightweight CLI or MCP gateways, or an internal context graph mapping services, ownership, and dependencies can help. Maybe I’m wrong and context ends up being the moat. For now, keep it lean and put the money into things that will still work three model generations from now. Before an agent writes code, ask for a plan showing how it will verify the change end to end against the running stack unit tests don’t count . Every session starts from scratch, so it hits missing env vars or broken setup right away. If it has no way to verify the change, make it churn right there and log what’s missing. That’s $2 in tokens instead of $380 later. Your stages don’t work in a vacuum Once an agent starts writing code, development, review, staging, and rollout shouldn’t operate in isolation. Think of them as a Swiss cheese model: every layer has blind spots, so each one should catch the class of bugs the previous layer couldn’t see. When teams build them in a vacuum, they end up duplicating slow checks everywhere or leaving gaps nobody finds until production. Let each stage do its own job, and let a flagged rollout catch whatever still slips through so you can patch the hole back in dev. 2. Development: verify before the PR For most teams, this is the biggest leak in the funnel, and the dev environment is what actually makes agentic development work. If you’ve already invested in a great dev environment for your engineers, you have a massive head start. The companies reporting real gains from coding agents spent years building internal dev tooling, with pre-warmed devboxes https://stripe.dev/blog/minions-stripes-one-shot-end-to-end-coding-agents and sandboxed environments https://builders.ramp.com/post/why-we-built-our-background-agent that spin up in seconds. If you can’t boot the stack, seed the right data, and prove a change works, you don’t have a dev environment, you have a vibe coding platform. An agent will happily add thousands of mocked unit tests before it ever tells you that you need better seeding. Human engineers have compensated for broken dev environments with tribal knowledge for years, asking whoever happens to have a working seed script in Slack. Agents don’t have that option. They mock the database, stub external APIs, and push commits to see what CI thinks. Teams scaling coding agents are running into the same problems: CI usage exploding https://posthog.com/blog/10k-prs-a-month as agents use CI as a compiler, and test suites quadrupling https://linear.app/blog/ci-bottleneck-reworked with mocked unit tests nobody wants to maintain. Unlike context scaffolding, a working dev environment doesn’t rot every time a new model drops, and you shouldn’t build a separate one for agents. Your engineers and agents should boot the same stack, seed the same customer states, and run the same checks the only difference is credentials and permissions . Start small: one command to boot a user flow, a seed-scenario command for your most annoying domain state, and a pre-PR verification script whose checks CI re-runs independently. Before opening a PR, the agent runs the real user journey locally against that stack and generates a short proof bundle to attach to the PR: $ ./scripts/verify-pre-pr --flow checkout 1/6 env-boot stack + payment/email fakes ready 11.4s 2/6 seed checkout: auth, catalog, billing, orders, notifications agree 2.1s 3/6 lint+types 0 errors, 0 disabled rules 3.8s 4/6 e2e 14 seeded cases coupon, tax region, card decline : 14/14 pass 19.6s 5/6 ui checkout clicked through against local stack, recording saved 14.2s 6/6 data-diff +1 order, +1 invoice row, +1 receipt email fake , 0 stray writes not local real card charge provider sandbox , real email delivery - staging-------------------------------------------------------------------------done wrote proof-checkout.md sha 4f8c2a1 Whatever couldn’t run locally needs to be just as visible as what passed. Otherwise you’re approving a green PR without realizing real card charges and emails were never tested. When laptops stop keeping up or you start running parallel background sessions, move that same workflow onto pre-warmed ephemeral devboxes. 3. Review: keep CI light, check the proof When you can verify changes locally, CI stops having to do everything. Right now, CI keeps coming up as the top bottleneck for teams scaling coding agents. Runner bills are jumping an order of magnitude, and traditional CI pipelines are choking on agent commit volume. A big chunk of that spend isn’t even real testing: every PR has to survive half a dozen review bots, each commenting asynchronously and re-triggering the whole build over and over. Over-engineered CI is what happens when you ask the PR stage to compensate for both sides of the funnel: a dev environment upstream that can’t verify changes locally, and a staging environment downstream that nobody trusts. So teams bolt on heavy E2E suites, security scanners, and a stack of AI review bots until every PR feels like an obstacle course. As much as possible, a PR should be opened small and ready to merge. Keep CI and review light. Audit every bot and slow check sitting in your PR pipeline today and ask whether it belongs upstream in the dev environment or downstream in staging. Require the proof bundle in your PR template, keep CI limited to re-running that verification script against the commit, and strip out automated reviewer noise. Double the PRs hitting a team, add a few AI review bots writing paragraphs on each one, and you’ve made the oldest mistake in lifecycle marketing: send someone ten emails a day and they stop opening any of them. Nobody has the attention span to review 800 lines of plausible-looking boilerplate three times a day. Eventually you see green checks and hit approve, which is how even a team building the models shipped a regression past multiple human reviews, automated reviews, and unit tests https://www.anthropic.com/research/april-23-postmortem . With a proof bundle attached, I can spend five minutes checking how the system behaves and thinking about the design. Without one, I spend 40 minutes undoing mocks and reproducing customer state, doing QA and calling it code review. Whenever the same review comment keeps coming up, turn it into a lint rule or test and move it upstream. Once proof bundles are solid, low-risk changes don’t need an engineer’s eyes at all. Auto-merge them, and limit any AI reviewer left in the loop to checks you can’t write as a linter. 4. Staging: send traffic, not prayers Staging should mirror production as closely as possible. Infra-as-code made cloning the infrastructure the easy part, yet at most companies I’ve worked at, staging is still a ghost town. There’s no real traffic, the databases are stale or empty, and the only test data comes from ad-hoc scripts someone runs when they need it. Nobody trusts it, so everyone YOLOs straight to prod. Unlike a local dev environment, you can’t just insert rows directly into staging databases. Staging is shared, persistent, and sits behind PII boundaries, and half the fields you need to test an expired trial date, a legacy plan, a stuck payout aren’t exposed via your public APIs. That forces you to bake dedicated, non-prod seeding endpoints into your services. Do it. It’s worth it. Remember your unit economics: every time an engineer has to log into an admin tool, click through five screens to create a test subscription, and manually verify a webhook, those minutes go straight onto your CAC. Automating staging setup, synthetic traffic generation, sanitized prod-to-staging pipelines, traffic replay, and shadow traffic diffing compounds across every agent and every change. It also covers the blind spot of scenario seeding, which can only test edge cases somebody thought to write down. For riskier changes, you can spin up an ephemeral per-PR preview environment. For each change, staging’s job is to work through the not local list in the proof bundle instead of re-testing what already passed locally, backed by a staging E2E suite engineers actually trust quarantine flakes fast . If engineers still bypass it, interview them the way you’d interview churned users. 5. Rollout: activation isn’t retention In growth terms, getting a PR merged and verified in staging is activation. Whether the change actually survives production is retention. By this stage, your change has cleared dev, review, and staging, so your confidence should be high. Still, shit happens. Even code that passes 98% of its integration tests https://www.anthropic.com/research/migrating-api-to-rust can hit production inputs nobody thought of. A useful mental model sounds counterintuitive after everything above: what if you had no PR review and no staging? Could you YOLO a change straight to prod and still trust that you’d get alerted right away and roll it back in seconds? Working toward that forces you to get the basics right: feature flags you can flip off in seconds instead of reverting a commit and redeploying , error and latency alerts tied to deploys, canaries, incremental rollouts, and automated rollbacks when error rates spike. Once a flag flips off, have a watch agent turn the failing requests into a new local seed scenario so the bug gets caught in dev next time: bash $ check-health --window 15m --auto-rollback rollout 10% flag=new checkout flow p99=42ms ok 5xx=0.01% ok rollout 50% SPIKE 5xx rate=0.41% threshold <0.10% auto-flip flag=new checkout flow - OFF 0 humans paged watch-agent 212/212 failing requests from orgs on plan=legacy 2022 watch-agent wrote seed-scenario checkout-legacy-plan + trace - .factory/regressions/checkout.json I haven’t pushed this to the max myself yet. Right now I mostly have an agent babysit the deploy, watch the logs for a few hours, and move on. That’s not enough, though. I want to ship persistent agents with my features, watching both production health and feature adoption like a PM would. Maybe every feature eventually gets its own owner agent. Once a software factory gets efficient enough, shipping stops being the bottleneck and deciding what to build takes over. You end up needing a product factory too, and they might be the same system. The coding agent’s job is temporary. It ships the code and hands off a persistent agent hooked into real user behavior, feeding back what’s working and what needs to change next. But I digress. I’ll write more about that as I figure it out. Your job is to improve the factory I keep seeing CTOs brag about how much code they ship personally with AI and flex their massive monthly token spend. That’s a red flag for me. As an engineering leader right now, you have a ton of work to do changing how your company builds and ships software. Your job is to improve the factory, bring down its CAC, and turn shipping software into a reliable, high-yield production line. Your product counterparts decide what goes on the line and turn that output into business outcomes. That’s how you actually win. I’d start with measurement, and I wouldn’t overcomplicate it. If you’re treating your software factory like a product, instrument it with whatever product analytics tool you already pay for Mixpanel, Amplitude, PostHog and emit normal funnel events at each stage. Find the biggest drop-off and tackle it first. You can also get a quick read by looking at all your unmerged PRs. A pile of open or abandoned PRs is a dead giveaway. Look at why they’re stuck and you’ll know immediately where to invest your time. Watching user session recordings is nobody’s favorite job, but it beats spending hours debating why an onboarding step has a 30% drop-off rate. Five replays later you realize people can’t find the right button. Do the same with agent traces. Watch where agents stall, where engineers have to step in, and what you can automate next. Every rescue is a bug report on the factory. Earlier, we made agents churn at the context stage when they couldn’t find a way to verify their changes end to end. That’s your funnel’s drop-off report. Read it every morning the way a growth team reads its metrics. Every entry is a concrete leak: a service nobody can boot, a customer state nobody has seeded, a third-party API without a fake. Rank them by how often they block work and fix the top one every week. Production rollbacks feed the same loop, straight back into development. The watch agent from rollout already did the hard part: seed-scenario checkout-legacy-plan goes into the repo, and the next agent working on checkout hits that edge case locally instead of at 50% of production traffic. This is where starting from scratch finally works in your favor. When a human engineer learns something painful about your codebase, it usually stays in their head. Encode the same lesson in a seed scenario or a lint rule, and every new agent session gets it. Here’s what happens to the unit economics once you start fixing the leaks: CAC per change $380 - $80 PRs per change 3 - 1 400 changes / month $152k - $32k At 400 changes a month, the difference in the sketch below comes to $120k. Tokens and review bots dropped by $20 $35 to $15 , while human time and CI dropped by $280. The PR dashboard says productivity dropped by two thirds. Sketches are mine.