one more thing before you automate a loop:
learn the work first. you build a better loop when you understand what it's replacing.
mattpocockuk's teach skill is good for that:
npx skills add mattpocock/skills --skill teach
then paste this:
/teach me how to run claude code as a durable loop, not a one-shot chat. i keep asking for a change, taking the diff, closing the session. i want the loop skills: when to persist a session, what goes in CLAUDE.md vs .claude/rules vs a skill, when to reach for /goal or routines, and how to verify before calling anything done.
it asks about your codebase first, then writes a MISSION.md and a curriculum, and teaches against your real project.