Loop it. Use another agent (from a different company helps) to review the code and documentation and call out any inconsistencies.
I run a bunch of jobs weekly to review docs for inconsistencies and write a plan to fix. It still needs humans in the loop if the agents don’t converge after a few turns, but it’s largely automatic (I baby sat it for a few months validating each change).
The problem with looping is that any hallucination or incorrect assumption in an early loop becomes an amplifying garbage-in-garbage-out problem.