Long threads bury the original constraint list; ask for a short recap before more edits.
Keep the recap to goals, allowed paths, and failing tests ? drop chatty history.
Start the next edit turn from that recap so the agent does not reopen closed decisions.
If it still drifts, paste the recap into AGENTS.md for the session.
Smoke-test one small change after compacting before a large refactor.
Change one variable at a time and confirm what actually helped.
If a company policy is involved, rule that out before chasing client settings.
Write the working steps into a short checklist for next time.
Export or screenshot a good setup so reinstalls are faster.
If it still flakes, retest on a clean network such as phone hotspot.