All posts
Product

Why your AI coding agent builds the wrong feature

AI coding agents build the wrong feature because they can read your files but not your product. They don't know who a feature is for, which similar code path customers use, or what must not change, so they guess. Re-reading the repo doesn't fix it. Ensemble keeps product knowledge next to the code for agents to query before they build, and runs every change at a link so someone who knows the product can check it.

4 min read

What "the wrong feature" looks like

The wrong feature is usually a plausible one: it works, it passes review at a glance, and it solves a slightly different problem.

It's rarely broken code. Modern agents write code that runs. The failures are subtler:

  • A second version of something that exists. You ask for a discount field at checkout. The agent adds one to a new checkout component, because it didn't recognize that the existing checkout lives under a different name.
  • The right change for the wrong people. You ask for an annual billing option for team admins. Every user sees it, including members who can't change billing.
  • A change to the path nobody uses. The repo still contains the old settings page behind a feature flag. The agent edits it. Customers never see the change.
  • Collateral changes. While adding the toggle, the agent "tidies up" individual checkout, which you needed left alone.

Each of these can survive a quick code review, because the code itself looks reasonable. The problem only shows up when someone who knows the product uses it.

Why the agent can't tell

File search finds code, but it can't tell which code matters to your product.

An agent starts a task by searching the repository for relevant files. It finds matches and builds a picture from what it reads. That picture contains structure (functions, components, routes) but not meaning. Nothing in BillingToggle.tsx says "only admins should ever see this," and nothing in legacy/settings/ says "customers stopped using this in March."

The facts that decide what's right live somewhere else:

  • in people's heads ("team plans never show tax ID"),
  • in old tickets and pull request discussions,
  • in usage data showing which path customers actually hit,
  • in decisions that were made once and never written down.

When those facts are missing, the agent falls back on the most typical answer, based on the millions of codebases it learned from. Typical is often wrong for your product.

A stronger model doesn't fix this on its own. It reasons better about the facts it has, but it still guesses about facts it was never given.

What product context is

Product context is what a feature is for, who uses it, which code implements it, and what it touches, kept current alongside the code.

It's different from documentation in one important way: it has to update when the code does. A style guide PDF or a wiki page written last year describes a product that no longer exists. An agent that trusts a stale doc is worse off than one that reads the code, because it's confidently wrong.

Useful product context answers questions like:

  • What does this feature do, and who is it for?
  • Which code implements it? Which is the live path?
  • What else does it touch?
  • How was a similar change made before?

How Ensemble gives the agent product context

Ensemble indexes your codebase into a graph, generates product knowledge from it, and re-indexes whenever a protected branch changes.

Before an agent builds, it asks. "What does the billing feature do, and which code implements team plans?" "How was a similar ticket solved?" Ensemble answers from the index, not from a fresh crawl, and every answer is tied to the commit it describes, so the agent knows how current it is.

This works in two places:

  • In Ensemble Studio, where PMs, designers and founders describe changes in the browser and see them running.
  • In Claude Code, Cursor and other agents, through Ensemble's MCP server. See MCP servers for codebase context.

Coming next: correcting Ensemble like you'd correct a teammate. Tell it "team plans never show tax ID," and every future change takes that into account.

How to prevent wrong builds today

Three habits help with any agent, with or without Ensemble:

  1. Write specs that name the user and what must not change. Those two lines prevent most wrong builds. Use the five-part spec template.
  2. Tell the agent to look before it edits. "Find where team billing is implemented and explain it before changing anything" catches the wrong-path problem early.
  3. Check the result running, not just in the diff. A preview of the right screen is the fastest proof.

How you know it built the right thing

The proof is a preview of the right screen, not a longer explanation.

Open the preview link and do what a user would do. Sign in as the admin. Sign in as a member. Check the path customers actually use. If it's right, it's obvious in seconds. See how to review a pull request without running it locally.

FAQ

Is this a prompt engineering problem?

Only partly. Better prompts help, but you can't paste a product's history into every prompt. The durable fix is a source of product knowledge the agent can query on every task, plus a running copy of the change that someone who knows the product can click.

Will a better model stop building the wrong thing?

Not by itself. A stronger model reasons better about the facts it has, but it still guesses about facts it was never given.

What about an AGENTS.md or CLAUDE.md file?

Keep one for conventions. A static file goes stale and can't hold what every feature does. Ensemble's context is generated from the code and re-indexed as it changes.

Can I see what Ensemble knows about my product?

You see it through answers, not as a wiki to edit. Each answer is tied to the commit it describes.


Ensemble turns every change into a running copy of your real app, with its services and data, at a private link anyone on the team can open. What is Ensemble?

Stop shipping the hard way

Agents write the code. Ensemble runs it. Everyone clicks it: product people in the browser, agents in parallel, engineers deciding what merges.

Start free