Chapter 22 · CLI
/goal, /loop, schedules and routines: sustained operation
Four mechanisms let Claude Code work over time: goal steering toward an outcome, loop repeating, schedules firing prompts by time, and routines for standing automation. Distinguishing sustained operation from one-shot tasks matters.
Video
Steps
- goal sets an outcome the session steers toward and helps hold direction in a long session; phrase a measurable goal.
- loop repeats an action on a cadence; it fits monitoring or staged work, with an explicit stop condition.
- Scheduled tasks run a prompt at a set time; check what runs when so usage does not pile up unnoticed.
- Routines turn a recurring process into automation; start small, verify the result, then expand.
Common pitfall: Sustained automation without oversight is a risk: a wrong scheduled task repeats the mistake until someone notices.
Hands-on exercise: Set a short goal in a trial session and see how it affects behavior. Review existing scheduled tasks and record what runs.
Filmed demo · Video is added in the media phase
Recap
Comprehension check
What should every sustained automation include?
Recap
- Goal holds direction in long sessions
- Loops and schedules with stop conditions
- Start routines small and verify