AI coding costs rise when an agent is allowed to investigate without a context budget. The visible charge may be tokens or a subscription. The larger cost is repeated file discovery, stale project memory, retries and human review after the agent touched the wrong part of the codebase.
The control is to choose the context mode, exploration limit and acceptance test before the session begins.
The bill has four parts
- Context cost: files, logs, history, tool output and summaries loaded into the task.
- Exploration cost: searches and reads before useful work starts.
- Correction cost: retries after wrong assumptions or incomplete scope.
- Review cost: human time required to understand and verify the patch.
A cheaper model can still create an expensive workflow. Measure cost per accepted change, not cost per request.
Choose one of three context modes
File-scoped change
Use when the affected files and expected behavior are known. Provide the exact files, the bug or change, constraints and test expectation.
Mapped investigation
Use when dependencies are uncertain. The first output is an impact map: likely files, data flow, risks, tests and questions. Code begins after approval.
Maintained project context
Use when the same codebase returns repeatedly. Keep a short, owned file with architecture, commands, conventions, risky areas and forbidden changes.
The Context Budget Card
- Task and expected behavior.
- Initial files or services the agent may inspect.
- Evidence required to expand scope.
- Maximum searches or investigation steps before a checkpoint.
- Files or systems the agent may modify.
- Risk class: UI, data, authentication, payment, permissions, infrastructure or production.
- Required tests and reviewer.
- Stop rule: when the agent must return an impact report instead of continuing.
Worked example
A validation-message edit may be one component. If the schema and API share the validation source, a file-scoped patch may be safe. If the behavior spans frontend, API, a shared package and tests, the agent should switch to mapped investigation before writing.
Review against the budget
- Did the agent stay inside scope?
- Did it explain each expansion?
- Did it change unrelated behavior?
- Are project-memory assumptions current?
- Do tests cover the affected path?
- Can the reviewer understand the patch without reconstructing the session?
- Was sensitive code or configuration minimized?
The operating rule
Use the narrowest context that can solve the task safely, then widen only when evidence shows the boundary is wrong. Context is not free because the interface hides the meter.
Before you bolt on another tool, it is worth knowing whether your business runs on systems or on you. I put together a free 2-minute assessment that gives you a straight read on exactly that, and the first thing to fix. Take the free assessment.
Ready to make your AI actually reliable?
Book a diagnosis and we will map the highest-leverage fixes for your business.
Book a diagnosisSharper signal. Smarter decisions.
Join our newsletter for our best thinking on AI and systems, delivered straight to your inbox - no noise.


