· iWork Technologies Team · Thought Leadership
How Senior Review Prevents AI-Generated Tech Debt
AI coding agents write code that works today and costs you next year unless someone with judgment reviews it. Here is the review protocol, the gates and the handoff practices that keep agent-built software maintainable.

The most common complaint about AI-generated code is that it is “almost right, but not quite.” The second most common one arrives months later: the code works, but nobody wants to change it.
That second problem is tech debt, and AI coding agents can produce it quickly. Not because the code is bad line by line, but because agents optimize for the task in front of them. They do not carry the long view of the system, and they will not push back when a shortcut makes the ticket pass.
Senior review is where the long view comes back in. This post describes what that review looks like in practice, the gates around it, and what it means for the people who maintain the software after launch.
How agents create debt
Agent-generated debt has a recognizable shape:
- Duplication. The agent writes a new helper instead of finding the one that already exists.
- Pattern drift. Each change follows a slightly different convention, so the codebase slowly stops looking like one system.
- Dependency creep. A new package is added to solve a small problem the standard library already handles.
- Shallow tests. Tests that confirm the code runs, not that it does the right thing.
- Silent failure. Errors caught and logged, then ignored, because that made the happy path work.
Each one is small. Accepted a hundred times, they add up to a codebase that is expensive to change.
The review checklist
Our senior engineers review every agent change before it merges. The review is not a skim. It asks a consistent set of questions:
- Is this the right change? Does it solve the problem in the ticket, and only that problem?
- Does it fit the architecture? Right module, right layer, existing patterns followed.
- Is anything duplicated? Search for existing helpers, types and components before accepting new ones.
- Are errors handled honestly? Failures surface to the caller or the user; nothing is swallowed.
- Are the tests meaningful? They check behavior and edge cases, and no existing assertion was weakened to make CI pass.
- Is it secure? Input validated, no secrets in code, access checks in place.
- Will the next person understand it? Clear names, small functions, a comment where the reason is not obvious.
If the answer to any of these is no, the change goes back to the agent with specific direction, or the senior rewrites the part that matters.
An illustrative before/after review
The example below is illustrative. It was written for this post and is not taken from any client’s code.
An agent is asked to add a discount to an order total. Its first draft:
// Illustrative example only: agent's first draft
export async function getOrderTotal(orderId: string) {
try {
const order = await db.orders.find(orderId);
let total = 0;
for (const item of order.items) {
total += item.price * item.qty;
}
if (order.coupon === 'SAVE10') {
total = total * 0.9;
}
return total;
} catch (e) {
console.log(e);
return 0;
}
}
It works for the ticket’s example. The senior reviewer’s comments:
- A failed database call returns a total of 0. That is a silent failure that could let an order through for free.
- The coupon code is hard-coded. A pricing module already exists with a
applyDiscountfunction. - Totals are calculated with floating point; the codebase uses integer cents everywhere else.
- No test covers a missing order or an unknown coupon.
The revised change, after review:
// Illustrative example only: after senior review
import { applyDiscount } from '~/pricing/discounts';
import { OrderNotFoundError } from '~/orders/errors';
export async function getOrderTotalCents(orderId: string): Promise<number> {
const order = await db.orders.find(orderId);
if (!order) throw new OrderNotFoundError(orderId);
const subtotalCents = order.items.reduce((sum, item) => sum + item.priceCents * item.qty, 0);
return applyDiscount(subtotalCents, order.coupon);
}
Plus tests for an unknown coupon, a missing order and an empty basket. The diff is smaller, it reuses what exists, and it fails loudly. That is the difference review makes.
Architecture decision records
Reviewers can only hold the line on architecture if the architecture is written down.
Keep architecture decision records (ADRs) in the repository: short documents that record a decision, the options considered and why one was chosen. “We use integer cents for money.” “Background jobs go through the queue, never direct calls.” “New services expose a REST API, not direct database access.”
ADRs help in two ways. Reviewers can point to them instead of re-arguing a decision in every PR. And agents can read them as part of their context, so the first draft is more likely to follow the rule.
Dependency hygiene
Every dependency is code you did not write and now have to maintain.
- New dependencies need a reason. A reviewer approves each one explicitly, not as part of a larger diff.
- Prefer what is already there. If the codebase already has a library for dates or HTTP, use it.
- Keep them current. Scheduled upgrades in small steps are cheaper than a large upgrade every few years.
- Audit in CI. Known vulnerabilities fail the build rather than appearing in a report nobody reads.
Test gates
Review is a person’s judgment. Gates are the rules that apply even when that person is busy.
- CI runs on every change. Build, lint, type checks and tests, with no manual bypass.
- Test changes are reviewed as carefully as code. A deleted or weakened assertion needs a stated reason.
- Critical paths have required tests. Changes there do not merge without coverage.
- Nothing merges without senior sign-off. The gate is a person, backed by the pipeline.
Maintainability after launch
Tech debt shows its cost after the build team moves on. So the handoff is designed from the start, not at the end.
You own the repo from the first commit
Every engagement starts with an NDA and an IP assignment to you, and the code lives in your repositories from day one. There is no transfer step where something can go missing, and no point at which you depend on us to access your own code.
Documentation that lives with the code
READMEs that let a new engineer run the system, ADRs for the decisions, and runbooks for operations. If you take a full handover, this is what your team works from.
Agent-assisted maintenance, reviewed the same way
After launch, agents keep helping: fixes, dependency upgrades and keeping tests current. Those changes go through exactly the same senior review and CI gates as the original build. The standard does not drop because the product shipped.
The point of all this is simple. AI coding agents make it cheap to write code. Senior review makes sure what gets written is still cheap to change.
Where to start
If you are worried about what agent-generated code will cost you next year, start by looking at how changes are reviewed today.
Our Free AI Readiness Audit is a 30-minute call on your codebase and delivery process. To see where the review gate sits at every step of our process, read how we work.



