Composer Mode: Keep Business Logic Intact

When I restructure mid-sized to large codebases, I let O3 generate a detailed plan, which I then save as a markdown file. Next, using composer/agent mode, I prompt it to execute the plan step by step. The issue arises when a task breaks my test suite (which is acceptable); after several iterations, composer loses sight of the goal to merely restructure the code without altering any business logic.

Does anyone have any suggestions on how to ensure that composer always adheres strictly to this objective, even when operating in a “YOLO mode”?

Ask it to write down business rules into .md files for docu. then reference those. Also state in cursor rules to not modify business logic when creating tests.

Havent found a one-fixes-all solution. Sometimes its unrelated things that cause it to stray away from focus: context length (chat/composer session length), non-issues that for beginners may be issues but for experienced devs are not (config files with non-standard settings)…