When working with AI coding agents, I've found that one of the most difficult problems is deciding what information an agent needs, what information it should retain, and what it should be allowed to change.
Giving an agent access to more information doesn't necessarily mean it will make better decisions. It still needs to understand which parts of that information are relevant to the task at hand.
I've been experimenting with different ways of managing context while building software, particularly in projects that involve multiple development stages and architectural decisions that need to remain consistent over time.
This is how I currently approach the problem, what I've learned, and where I still think the limitations are.
1. Letting AI manage its own context can become a problem
I encountered this while developing a game.
At one point, I was working on building vehicles. Later, I moved on to constructing individual buildings. However, because I had allowed the AI to manage and update its own context, it continued retaining a considerable amount of information about vehicle development.
The new task required a different set of information. The agent needed to focus on the appearance, structure, and requirements of the buildings rather than the vehicles.
The resulting buildings looked poor and didn't match what I wanted.
What bothered me was that the context wasn't necessarily incorrect. Much of it was simply irrelevant to the current task.
In my experience, coding agents don't yet have a reliable way to determine which information is worth retaining as a project evolves. They can summarize previous work, but deciding what will matter in a future task is a different problem.
That experience made me reconsider how much control I should give agents over their own context.
2. Separating context by scope and permissions
I divide context into four categories. Each category has a different purpose and, more importantly, different permissions.
| Context | Purpose | Agent permissions |
|---|---|---|
| Project context | Overall goals, architectural principles, and project constraints | Read-only |
| Milestone context | Scope, requirements, and approved decisions for a development stage | Read-only |
| Task context | Information and requirements for the current task | Changes require human confirmation |
| Historical context | Previous work, findings, decisions, and implementation reports | Can be updated automatically |
Project context and milestone context represent decisions that have already been established. I don't allow agents to modify them independently.
Task context is more flexible. An agent may discover that additional information is required or that an existing requirement needs clarification. However, changes still require my confirmation.
Historical context is where I allow more autonomy. Agents can record what happened during implementation, what problems they discovered, and how those problems were addressed.
This distinction matters because recording a new finding and changing an existing requirement are two fundamentally different operations.
An agent discovering a problem during implementation shouldn't automatically have the authority to redefine the task.
3. Retrieving context through specialized agents
As a project grows, maintaining context becomes increasingly difficult.
Imagine a project that has already gone through 30 milestones. It may contain architecture documents, implementation reports, source code, test cases, and records of previous decisions.
Giving a single agent access to all of this and asking it to determine what matters is not my preferred approach.
Instead, I organize specialized agents around different types of documentation and information. I provide them with context about the upcoming milestone and specify what information needs to be retrieved.
An orchestration agent then collects and consolidates their findings.
A simplified version of the workflow might look like this:
Human-defined information requirements
|
+-----------+-----------+
| | |
Architecture History Codebase
agent agent agent
| | |
+-----------+-----------+
|
Orchestration agent
|
Context for the next stage
The important part is that I'm still involved in defining what information needs to be retrieved.
The agents help me search through, extract, and organize information that would otherwise take considerable time to review manually.
4. Handling conflicting information
Retrieving information from multiple sources introduces another problem: conflicts.
An architectural document may describe one decision, while a more recent implementation report contains a different one. The existing code might not fully reflect either.
In my workflow, the orchestration agent is responsible for coordinating the resolution of these conflicts.
When it encounters a conflict, its first preference is to ask me. The resolution is then recorded in the project's history.
If I explicitly allow it, the agent can handle similar conflicts independently in the future, using previous resolutions as references. However, it must still leave a report explaining how the conflict was resolved.
I don't want every historical decision to automatically become a permanent rule. The agent's authority to resolve future conflicts depends on what I've actually authorized.
I'm comfortable with AI making suggestions, proposing alternatives, and drawing inferences. Having another perspective is useful, especially when dealing with complex engineering decisions.
But there's a difference between suggesting a decision and having the authority to make it.
5. Isolating context between development stages
Different stages of software development require different information.
Research, architecture design, implementation, testing, and code review don't necessarily benefit from having access to the same context.
I update the context at each stage using relevant results from the previous stages. However, when an agent begins working on a new stage, I don't want it to automatically inherit the entire working history of the previous agent.
It should only know what I've described and what I've explicitly allowed it to access.
For example, a testing agent may need access to the approved requirements, expected behavior, and architectural constraints. It doesn't necessarily need the implementation agent's entire conversation history or every assumption that influenced its work.
One reason for doing this is that I don't want incorrect assumptions to propagate unquestioned throughout the entire development process.
If an implementation agent misunderstands a requirement, giving a reviewing agent the same interpretation could make it harder to identify the original mistake.
Context isolation doesn't guarantee independent reasoning or eliminate shared blind spots, but I consider it a useful way to reduce unnecessary influence between stages.
6. Protecting tests from the implementation
I've also found that AI still struggles to discover edge cases, particularly in frontend development.
Its ability to identify them depends heavily on the requirements and context it receives.
I don't necessarily have a problem with using the same coding agent to write both tests and implementation. However, there's one condition I insist on: the tests must be written first.
More importantly, the implementation must not be allowed to redefine the tests simply because it cannot pass them.
My rule is that test cases should be protected from the implementation, but not from the requirements.
If a valid test fails, the implementation needs to change.
If a test incorrectly represents a requirement, then the test itself needs to be corrected. The justification for that correction must come from the requirements, documentation, or other authoritative context, rather than from the current implementation.
Otherwise, an agent could gradually adapt the expected behavior to match whatever code it has produced.
I also still consider manual testing necessary. Passing automated tests doesn't mean every relevant behavior or edge case has been discovered.
7. Does this actually make development faster?
Not necessarily during implementation.
Managing context, coordinating multiple agents, resolving conflicts, and verifying results all introduce overhead.
The benefits I experience tend to appear elsewhere in the development lifecycle.
I spend less time going back through previous development sessions to recover information. Established parts of the project require fewer adjustments and temporary fixes when new features are introduced.
For a project that needs architectural consistency over a long period, I find that valuable.
However, I wouldn't automatically recommend the same level of process for every project.
If the main goal is to validate an idea quickly, the additional overhead may not be worthwhile. A project that prioritizes correctness and long-term consistency has different requirements from a prototype that prioritizes speed or cost.
The amount of context management and verification should depend on what the project actually needs.
I haven't formally benchmarked the overall time savings, so I wouldn't claim that this workflow is universally faster.
8. The problems I still haven't solved
Despite these controls, I don't think we're at the point where humans can completely automate the software development process.
Agents still lack sufficient ability to evaluate their own decisions, especially when those decisions involve determining the relevance or importance of context.
There are several problems I continue to encounter:
- Context can become distorted as it passes between agents.
- Context compaction can remove information that turns out to be important later.
- Agents can retrieve information that is accurate but irrelevant to their current task.
- Structuring context so that it remains useful as a project grows is difficult.
Then there's the financial cost.
Detailed context, larger inputs, multiple specialized agents, and repeated verification can become expensive.
That creates a practical limitation for independent developers. Someone with a generous AI budget can run more research sessions, delegate work to more agents, and perform additional verification. Someone working with a limited budget has to make much more difficult decisions about which parts of the workflow they can afford.
I think this is an important part of the conversation around AI-assisted software development that deserves more attention.
Even if we develop better ways to organize context, those approaches need to be economically practical as well.
Final thoughts
I'm still experimenting with this workflow, and I don't consider it a finished solution.
What I want is a development process where agents can retrieve information, contribute ideas, implement features, and record their findings without gradually losing track of the project's established requirements.
For now, that still requires considerable human involvement, particularly when deciding what context matters and when an agent should be allowed to act independently.
I'm interested in how other developers are approaching this problem, especially those working on larger projects with multiple coding agents and limited AI budgets.
How do you decide what context to preserve, what to discard, and what to make available to an agent at each stage of development?
Disclosure: The experiences and opinions in this article are my own. I used AI assistance to organize, edit, and translate my original responses from Vietnamese into English.
Top comments (4)
This is the most honest agent-workflow write-up I have read in a while, Tran — especially the part where you say it is not necessarily faster during implementation. The permissions table is the sharpest idea here: project and milestone context read-only, task context needing human confirmation, historical context auto-updatable. That distinction between recording a new finding and changing an existing requirement is exactly where most agent setups quietly go wrong. The test rule is the same principle at its cleanest — tests protected from the implementation, but not from the requirements, so an agent cannot gradually rewrite expectations to match whatever code it produced. When compaction starts dropping context on a long project, which kind do you protect first — the milestone decisions, or the implementation reports that explain why they were made?
I'd prioritize preserving milestone decisions, but I don't think either decisions or implementation reports should depend on context compaction for their survival.
My approach would be to persist decisions, their reasoning, implementation reports, and lessons learned as durable documentation. Rather than trying to preserve everything in the active context, I'd focus on improving the policy that determines what information gets retrieved for each task.
That policy should continuously evolve based on developer feedback, while the developer remains responsible for defining its scope.
I also think research and implementation should have different boundaries. An agent should be free to explore the entire authorized codebase and retrieve relevant historical knowledge, but its implementation scope should be strictly defined by the behavior the developer wants to change, rather than by a predetermined list of files.
That scope can expand as new dependencies or architectural concerns are discovered, but only under the developer's control.
Ultimately, I'd rather improve how agents select and reconstruct context than rely on their ability to preserve important information through compaction.
I strongly agreed with the idea of separating context by development stage — especially your point that if the reviewing side receives the same interpretation as the implementing agent, the misunderstanding gets inherited as-is. In my case I run a $40/month setup, Claude Pro ($20) and ChatGPT Plus ($20), and I have ChatGPT, with a different context, review what Claude Code built as a second pair of eyes. I find that a different pair of eyes catches more than having the same model build and review its own work. Your point that more checking means more cost is also true — on my budget, narrowing the scope of each check works better than increasing the number of checks. And your rule about protecting the tests from the implementation feels especially important for the small systems I build for my family.
When architecture documents and the code disagree, how do you identify which existing implementation the agent should extend before it starts writing?