Skip to main content

Stop Patching Your AI Product

Every patch adds complexity. Every workaround adds debt. At some point, the cost of maintaining patches exceeds the cost of rebuilding. Most teams cross that point 6 months before they admit it.

Robert Ta's Self-Model
Robert Ta's Self-Model CEO & Co-Founder 847 beliefs
· · 8 min read

TL;DR

  • AI products accumulate patches at 3-5x the rate of traditional software because the gap between demo and production creates more edge cases, and each patch increases the complexity of the next
  • The real cost of patching is not just technical debt,it is team morale, deploy confidence, and the inability to onboard new engineers into a codebase nobody fully understands
  • Teams cross the patch-versus-rebuild threshold an average of 6 months before they acknowledge it, and every month of delay makes the rebuild harder

Patching an AI product instead of rebuilding it compounds technical and human debt at a rate that makes the eventual rebuild 1.3x harder for every month of delay. AI products accumulate patches at 3-5x the rate of traditional software because the gap between demo and production creates more edge cases, and each patch increases the complexity of the next. This post covers why AI products patch faster, how to recognize the threshold where patching costs more than rebuilding, and the human toll that patch-heavy codebases take on engineering teams.

0
patches found in a typical 2-year-old AI product codebase
0%
of engineer time spent understanding existing code vs writing new code
0 months
average delay between crossing the rebuild threshold and acknowledging it
0x
harder the rebuild becomes for every 6 months of additional patching

Why AI Products Patch More

All software accumulates patches. But AI products do it faster, for structural reasons.

The demo-production gap is enormous. A traditional SaaS product demo is a subset of the real product. An AI product demo is often a fundamentally different thing,a carefully crafted prompt with cherry-picked examples running against a specific model version. The gap between the demo and production is a chasm, and patches are the bridge.

AI behavior is non-deterministic. The same input can produce different outputs across model versions, temperature settings, and even API calls. Each surprising output generates a bug report, and each bug report generates a patch. Traditional software has deterministic edges. AI products have probabilistic ones, and the patch surface is correspondingly larger.

The stack is deeper and less standardized. An AI product stack includes retrieval, embedding, prompt construction, model invocation, output parsing, safety filtering, caching, and monitoring. Each layer interacts with every other layer. Each interaction is a potential edge case. And unlike web frameworks, there are no mature patterns for how these layers should compose.

Edge cases are discovered by users, not tests. In traditional software, edge cases are often predictable,null inputs, boundary conditions, concurrent access. In AI products, edge cases are whatever the model happens to hallucinate, whatever context combination the retrieval layer surfaces, whatever unexpected interpretation the user applies. They are discovered in production, patched in production, and accumulate in production.

The Anatomy of a Patch

Let me trace how a single production issue becomes a patch, and how that patch increases the cost of the next one.

A user reports that the AI gave a contradictory response. The engineer investigates and finds that the context retrieval pulled two conflicting pieces of information. The fix: add a deduplication step to the retrieval results.

The deduplication step introduces a latency increase. Another user reports slow responses. The fix: add a cache for deduplicated results.

The cache occasionally serves stale results. A user reports getting an outdated answer. The fix: add a cache invalidation check based on a timestamp comparison.

The timestamp comparison breaks for a user in a different timezone. The fix: normalize timestamps to UTC before comparison.

Four patches. Each individually reasonable. Each adding a conditional branch, a new dependency, and a new failure mode. The original retrieval function, which was 15 lines, is now 60 lines with 4 branches, a cache, and a timezone handler. And none of this addresses the root cause: the retrieval layer has no concept of information consistency.

The Patching Cycle

  • ×Bug discovered in production
  • ×Patch applied: add conditional branch
  • ×Patch creates new edge case
  • ×New patch applied: another conditional
  • ×Repeat until nobody understands the function

The Rebuild Approach

  • Root cause identified: architectural gap
  • Layer redesigned with the edge case class in mind
  • New architecture handles the category of problems, not just this instance
  • Future edge cases in this category are handled by design
  • Function remains comprehensible

The Human Cost

Technical debt is measurable. Human debt is not, and it is often worse.

I surveyed an engineering team before a rebuild engagement. The results were consistent with what I have seen across multiple teams:

4 of 6 engineers described their codebase as something they were afraid to touch. Not a codebase they disliked or found inelegant,one they were actively afraid of. They had learned through painful experience that changes in one area cause failures in unrelated areas, and the only safe approach was to patch in place and touch as little as possible.

5 of 6 engineers spent more time understanding existing code than writing new code. Not reading documentation or learning the architecture,tracing the execution path through patches to understand what a function actually does, as opposed to what its name suggests it does. This is the tax that patches impose on every subsequent change.

3 of 6 had considered leaving. Not because of the work itself, but because of the constant cognitive overhead of maintaining a system they could not improve. Engineers want to build. Patch maintenance is the opposite of building.

patch-archaeology.ts
1// What the function looks like after 18 months of patchesThis is real (anonymized)
2async function generateResponse(input, userId, opts = {}) {
3 // PATCH-2024-03: Fix duplicate responses
4 const deduped = deduplicateContext(input.context);
5 // PATCH-2024-05: Cache for dedup performance
6 const cached = opts.noCache ? null : await cache.get(cacheKey(deduped));
7 if (cached && !isStale(cached)) return cached; // PATCH-2024-06
8 // PATCH-2024-07: Timezone normalization for staleness check
9 // PATCH-2024-09: Skip guardrails for enterprise tier
10 const skipGuardrails = opts.enterprise || user.tier === 'enterprise';
11 // PATCH-2024-11: Handle model fallback when primary times out
12 // ... 280 more lines of patches ...
13 // Root cause never addressed: no structured user context model
14}

The Threshold

There is a specific point where patching becomes more expensive than rebuilding. Every team crosses it. Most teams do not recognize it until 6 months later.

The threshold has three indicators:

Time to patch exceeds time to build. When fixing a bug takes longer than implementing a new feature because understanding the patch landscape requires more effort than the fix itself, you have crossed the threshold.

Patches create more patches. When every fix introduces a new edge case that requires its own fix, the debt is compounding. The codebase is fighting you.

New engineers cannot contribute for months. When onboarding an engineer requires them to learn not just the architecture but the history of patches,which ones depend on which others, which comments are still accurate, which environment variables are still relevant,the institutional knowledge has become too expensive to transfer.

The Way Out

Stopping patches does not mean ignoring bugs. It means changing the response to bugs.

When a bug is discovered, ask: is this a problem with the implementation or with the architecture? If it is an implementation bug,a typo, a missing null check, a wrong constant,patch it. These are cheap fixes with no cascading effects.

If it is an architectural bug,the system does not have the right information to make the right decision,do not patch it. Log it. Add it to the rebuild list. And accept the temporary user impact of a known issue over the permanent cost of a patch that will need its own patches.

This requires discipline and organizational buy-in. Product managers need to accept that some bugs will persist until the rebuild. Engineers need to resist the urgency of production issues. Leadership needs to invest in the rebuild timeline.

But the alternative,continuing to patch until the codebase is unmaintainable, the team is demoralized, and the rebuild is unavoidable anyway,is worse. Every month of delay makes the rebuild 1.3x harder.

0x
harder the rebuild becomes per month of additional patching
0%
of AI startups report difficulty onboarding new engineers due to patch complexity
0 of 6
engineers on a typical AI team describe their codebase as something they fear

Trade-offs and Limitations

The stop patching advice has real limits.

You cannot stop patching production-critical issues. Security vulnerabilities, data loss bugs, and compliance violations need immediate fixes regardless of the architectural implications. The stop patching principle applies to feature bugs and performance issues, not safety-critical ones.

Not every patched codebase needs a rebuild. Some products are in maintenance mode with low change frequency. If the team is not trying to ship new features, the cost of patches is low because nobody is navigating the complexity. Rebuilds make sense for products that need to evolve.

Rebuilds carry their own risks. A poorly executed rebuild can produce the same problems in a new codebase. The rebuild is only as good as the architectural principles you bring to it. If you rebuild without clear interface boundaries, confidence-weighted user models, and feedback loop architecture, you will end up patching again in 12 months.

Organizational patience is limited. Telling stakeholders that bugs will persist until the rebuild tests organizational trust. Some teams do not have the political capital to pause patching, even when continuing is more expensive. In those cases, targeted partial rebuilds of the worst layers can provide relief without requiring full organizational buy-in.

What to Do Next

  1. Count your patches. Search your codebase for comments containing PATCH, FIX, HACK, WORKAROUND, TEMPORARY, and TODO. Count them. If the number exceeds your engineer count times 10, you are deep in patch debt.

  2. Survey your team on codebase confidence. Ask three questions: are you afraid to touch any part of the codebase, do you spend more time reading patches than writing new code, and have you considered leaving due to codebase quality? The answers will tell you the human cost of your patch strategy.

  3. Talk to us about the rebuild path. We help AI teams stop patching and start rebuilding,with a structured sprint that replaces the patchwork with clean architectural layers. See if it is time to stop patching.


Every patch makes the next one harder. At some point, the only way forward is to stop going sideways. Start the rebuild conversation.

References

  1. 2016 survey of 2,000 Americans by Reelgood and Learndipity Data Insights
  2. Scientific American explains
  3. cold start problem
  4. Progress Software describes this core tension well
  5. New America analysis of AI agents and memory

Building AI that needs to understand its users?

Talk to us →
The Clarity Mirror

What did this article change about what you believe?

Select your beliefs

After reading this, which resonate with you?

Stay sharp on AI personalization

Daily insights and research on AI personalization and context management at scale. Read by hundreds of AI builders.

Daily articles on AI-native products. Unsubscribe anytime.

Robert Ta

We build in public. Get Robert's weekly newsletter on building better AI products with Clarity, with a focus on hyper-personalization and digital twin technology. Join 1500+ founders and builders at Self Aligned.

Subscribe to Self Aligned →