AI Coding Agents Need Product Context, Not Just Repo Context
AI Coding Agents Need Product Context, Not Just Repo Context
Repo Context Is Necessary but Incomplete
When people talk about giving AI coding agents context, they usually mean one of these things:
- the repository
- the current branch
- the open issue
- maybe a design doc
That is better than nothing, but it still leaves the agent operating in a very narrow frame.
The model can answer:
- what the code does
- where a symbol is used
- how to make a local change
- what tests are likely to fail
But it usually cannot answer:
- why this feature matters right now
- what business outcome it supports
- what decision already constrained the implementation
- what risk the team is actively trying to avoid
That missing layer is what I mean by product context.
The Difference Between Code Context and Product Context
Here is the simplest way I know to break it down.
| Layer | What it answers | Typical source |
|---|---|---|
| Code context | How is this built? | repo, tests, types, docs |
| Work context | What am I changing? | issue tracker, PRs, acceptance criteria |
| Product context | Why does this matter? | outcomes, decisions, signals, risks |
Most AI workflows stop at the first layer. Better workflows reach the second.
The systems that will actually change how teams build software need the third.
What Goes Wrong Without Product Context
The failure mode is usually not spectacular. It is worse than that. It is subtle.
The AI does something reasonable.
Examples:
- It refactors a flow that the business is actively measuring in an experiment.
- It closes a ticket once the tests pass, even though legal approval is still pending.
- It "simplifies" a workflow by removing behavior that exists for a specific customer segment.
- It fixes a symptom instead of the actual priority because it cannot see the roadmap pressure around the work.
All of those are locally rational. None of them are globally correct.
The Shape of Product Context
The most useful model I have found is a lightweight knowledge tree.
At the top, you have the things the business actually cares about.
- outcomes
- hypotheses
- decisions
- risks
- signals
Below that, you connect the delivery layer.
- initiatives
- epics
- features
- issues
- pull requests
And below that, you connect the code reality.
- repositories
- files
- services
- ownership boundaries
- deployments
That produces a graph where any unit of work can be explained through the stack.
For example:
{
"workItem": "PLN-184",
"title": "Add outcome health scoring to dashboard",
"supportsOutcome": "Reduce time-to-priority-decision",
"linkedDecisions": [
"Decision 42: dashboard should show signals, not vanity metrics",
"Decision 44: health score must explain itself"
],
"activeRisks": [
"Scoring model may look deterministic without enough evidence",
"Dashboard density already high on smaller screens"
],
"implementationAreas": [
"apps/web/src/features/outcomes",
"packages/scoring-engine",
"services/signals"
]
}That is the kind of context an AI agent can actually use.
What the Agent Should Know Before It Starts
Before an AI agent edits code, I want it to understand five things.
1. The Outcome Behind the Work
Not just the ticket title. The actual business objective.
If the outcome is "reduce abandonment during onboarding," the agent will treat a copy change, validation change, and UI restructuring differently than if the outcome is "support enterprise admin workflows."
2. The Decisions Already Made
Teams constantly pay a tax for forgotten decisions.
The agent should know:
- what was chosen
- what alternatives were rejected
- why that choice was made
- whether the decision is still active
That prevents the model from reinventing arguments the team already settled.
3. The Current Risks
Every meaningful feature has active risk:
- delivery risk
- technical risk
- UX risk
- compliance risk
- stakeholder risk
If the agent cannot see those, it cannot prioritize correctly.
4. The Acceptance Criteria
This is the bridge between planning language and code behavior.
The criteria need to be concrete enough that the model can verify whether the change is done.
5. The Ownership Boundary
Even a good agent should know where not to wander.
That means clear ownership for services, packages, and files tied to the work item.
Retrieval Beats Dumping
One trap in context engineering is trying to give the model everything at once.
That does not scale. It also degrades signal quality.
The better pattern is:
- identify the work item
- fetch the directly connected outcome, decisions, and risks
- fetch only the implementation areas relevant to that work
- inject a compact summary before the task begins
- keep the deeper graph searchable through tools if the agent needs more
This is retrieval as an operating model, not just a search feature.
How This Changes the Agent's Behavior
Once the agent has product context, the quality shift is obvious.
Without product context, the agent tends to optimize for:
- local correctness
- compile success
- test pass rate
- superficial task completion
With product context, it starts optimizing for:
- the right slice of work
- consistency with prior decisions
- risk-aware implementation choices
- useful escalation when something is ambiguous
That is the point where the AI starts behaving less like a code autocomplete system and more like a teammate.
A Concrete Example
Say the ticket is:
Add a "health score" to the dashboard for each outcome.
Repo context tells the AI:
- where the dashboard code lives
- how existing cards are rendered
- where scoring utilities might belong
Product context tells the AI:
- the score is meant to accelerate PM decision-making
- the team explicitly rejected opaque scoring in a previous decision
- the design must explain why the score is high or low
- there is an active risk that users may over-trust the score if evidence is hidden
That changes the implementation.
Instead of just rendering 78%, the agent is more likely to build:
- a visible explanation of contributing signals
- supporting copy that frames the score as directional
- an interface that surfaces confidence or evidence level
- tests around explanation rendering, not just numeric output
Same ticket. Very different result.
Why Issue Trackers Alone Are Not Enough
A lot of teams assume the issue tracker already contains the context.
It usually does not.
Issues tend to be:
- too tactical
- inconsistently written
- detached from decisions
- detached from business outcomes
- detached from real-time risk signals
An issue is a useful node in the graph. It is not the graph.
The Operational Model I Want
For AI development to work well at team scale, I want this flow:
- A work item is selected.
- Product context is assembled automatically.
- The AI receives a compact briefing before it acts.
- The AI can query deeper context through tools when needed.
- Decisions, blockers, and risks discovered during the work are written back into the system.
That last step matters as much as the first four.
If the AI consumes context but never contributes back to it, the system decays.
The Briefing Format Matters
One thing I learned quickly: the structure of the context bundle matters almost as much as the content.
This works well:
Outcome: Reduce time-to-priority-decision for PMs.
Task: Add health scoring to dashboard outcome cards.
Acceptance criteria:
- score visible on each card
- score explains itself through supporting signals
- mobile layout remains readable
Active decisions:
- avoid vanity metrics
- explanations required for derived scores
Active risks:
- false precision may erode trust
- card density may hurt mobile readability
Ownership boundary:
- apps/web/src/features/outcomes/**
- packages/scoring-engine/**This does not work well:
- dumping raw issue comments
- injecting entire docs verbatim
- mixing strategic context with unrelated repo trivia
- giving the model ten different priorities at once
Good context is shaped context.
The Bigger Shift
The industry has spent a lot of energy on whether AI can write good code.
That is the wrong ceiling.
The harder question is whether AI can make good engineering decisions inside the reality of a product team.
That requires more than repository access. It requires durable product context:
- outcomes
- decisions
- risks
- signals
- ownership
Once that layer exists, the code quality improves too, because the code is now being written in the right frame.
That is why I believe the future of AI development is not just better models. It is better context systems around the models.