In earlier lessons you ran Claude without an interface. Now, four ways to keep it working on its own while you are not pressing Enter.
/goal — until the condition is met
/goal npm test exits with code 0, a new test in test/links.test.js checks links with ?query, existing tests are not changed, the fix is committed; or stop after 8 turns
Claude starts right away. After every turn, a separate evaluator model reads the conversation and decides whether the condition is met. If not, Claude keeps going. It stops when the condition is met, judged impossible, an error happens, or you type /goal clear.
The evaluator sees only the conversation. Hence the rules for a good condition:
- name a check whose result will show up in the output: "
npm testexits with code 0“, not ”the code is clean"; - say what must not change;
- end with a turn limit.
/loop — on an interval
/loop 1m run npm test and append a line to .practice/loop-log.txt with the time and the number of failing tests. Do not change any other files.
The task repeats every minute while the session is idle — between your requests, never in the middle of a Claude answer. It stops when you cancel it (“cancel the npm test loop”) or when it expires.
Cloud scheduled task — in the cloud
/schedule in 5 minutes run npm test and reply with the number of passing and failing tests. Do not change files, do not commit, do not push.
A cloud scheduled task (until recently called a routine) runs in the cloud — on a schedule, through the API, or on a GitHub event. It is a full cloud session that does not stop for approvals and acts in your name: its commits and pull requests are signed by your GitHub user. To list them — /schedule list.
Agent view — several background sessions
claude agents --permission-mode manual --model sonnet
One screen for background sessions. Each request you type starts a separate session, which keeps running after you close the screen. Before its first file edit, a session moves into its own in .claude/worktrees/, so parallel tasks do not get in each other’s way. Rows are grouped into Working, Needs input and Completed; Space peeks at what a session is doing, → attaches to it.
Quick check
You set /goal 'make the code beautiful'. The loop has been running for twenty turns. Why?
Careful
A loop fires while you are away too, sending the whole session context each time — watch your spending with /usage. A cloud scheduled task by default gets every connection on your claude.ai account, including write access: remove the ones it does not need right after creating it. And a green run status only means the session started and finished without an infrastructure failure — open the run and read what actually happened.
Practice in the terminal