r/opencodeCLI • u/m-ritter • 6d ago
Having a second agent review the plan before OpenCode writes any code
When an agent builds straight from a prompt, the misunderstandings show up late, as a diff that touches files nobody meant to change or skips a case that seemed obvious. By then the fix is a debugging session.
Splitting the work into a plan step and a build step works much better. The agent first asks what done means, reads the relevant code and writes a plan: the files it will touch, the steps, what is out of scope, and the checks that prove each point. Before I approve it, a different installed agent reads that plan cold and lists what is missing or risky, so the gaps get answered while they are still cheap.
After approval the build runs test first in small slices. Agents that did not write the code then check the result against every agreed point and record evidence, and I approve the finished change before a pull request opens. Nothing gets merged or pushed without my yes.
I built QualityLayer around this loop, and it runs natively in OpenCode. I'm the developer: https://github.com/maxritter/qualitylayer
3
u/SirRobinBlibs 6d ago
A cold second agent is useful, but only if it has to reject something. I'd give the reviewer a short fail checklist (scope creep, missing tests, files outside the plan) and require it to either request changes or sign the plan, not just say it looks good.
I'd also keep that review in a fresh session so it doesn't see the first agent's chain of thought, otherwise it tends to agree with the plan it just watched being written.
1
u/Senior-Assumption864 6d ago
do you keep the reviewer in a fresh session every time or only for bigger changes?
1
u/ChemicalExcellent463 6d ago
i use a different model in a fresh session too, but cap plan review at 5 rounds. how many rounds does a plan usually take before you approve it?
0
u/[deleted] 6d ago
[removed] — view removed comment