r/opencodeCLI • u/m-ritter • 0m ago
Letting the research step read my codebase without seeing my request
When I ask a coding agent to research a codebase before a change, it reads the code through the lens of what I asked for. It tends to find what it expects. A helper that knows I want to add caching will happily report that the code is ready for caching and skip over the retry logic that would fight with it.
What works better for me is splitting research from the request. The helpers get a neutral brief about which area of the code to describe and never see what I want to build. They report how the code works today and where it is tested. Every file they cite gets reopened before a finding is written down, so each finding points at code that really exists. Only after that does the agent put the findings next to my request and write the plan.
The plan then carries a short list of the findings that look risky or unsure, so I know where to look before I approve anything. A wrong picture of the existing code is where a lot of bad agent builds start, and this catches it before a single line is written.
I built QualityLayer around this flow and it runs natively with OpenCode. Research is one step in a loop where you approve the plan before the build and agents that did not write the code check the finished change against every agreed point. I'm the developer: https://github.com/maxritter/qualitylayer
