Headless Mode Question Explained
This worked Loop Engineering practice question tests Goal and Loop Commands. Try the answer first, then review why A is the best choice.
Short answer
The correct answer is A. Runs one prompt in a fresh non-interactive session, then exits.
The CLI reference describes -p as printing a response without interactive mode. Each cron fire starts a new session that has none of the previous conversation, and the only repeat is your crontab. This can work as a loop if your crontab, the task file, and your own checks supply the limits, the fresh check, and the stop rule. Plan for permissions too. In a Manual mode -p run, a call that needs approval, such as a file edit, is denied unless a rule, a mode, or a hook approves it. The correct answer is A. Runs one prompt in a fresh non-interactive session, then exits
The Question
You put claude -p "Read tasks.md and complete the first unchecked task" in your system crontab for every ten minutes, hoping for an unattended loop. What does each cron fire actually do?
Why A is correct
The CLI reference describes -p as printing a response without interactive mode. Each cron fire starts a new session that has none of the previous conversation, and the only repeat is your crontab. This can work as a loop if your crontab, the task file, and your own checks supply the limits, the fresh check, and the stop rule. Plan for permissions too. In a Manual mode -p run, a call that needs approval, such as a file edit, is denied unless a rule, a mode, or a hook approves it. The correct answer is A. Runs one prompt in a fresh non-interactive session, then exits
Why the other options are wrong
A -p run is its own process. It does not find or attach to an interactive session, and your open session never sees the prompt.
/loop is a bundled skill for an open, idle session. Nothing in -p creates a schedule; the only repeat here is cron.
A -p run skips interactive mode and waits for no keyboard input. A call that needs approval is denied, not left waiting for you.
Key idea: Goal and Loop Commands
Loop engineering is a practice skill. Open Claude Code in a throwaway folder, write one small task in a file, and run it with /loop or /goal while you watch. If you doubt an answer, test it against a real run in that folder.
Ready to test the full skill?
Take the free Loop Engineering quiz and find the exact basics to review next. No signup required.
Practice related questions
Same skill area or adjacent concept. Use these after reviewing the explanation.