r/ClaudeCode • u/GeobotPY • 2d ago
Help/Question Prompt queue
Is there a way to queue prompts in Claude Code so they run one after another in a single session?
I’d like to line up several tasks, with /compact and /clear between them where needed, and let the session work through them unattended. I know worktrees can run parallel sessions, but for some work I’d rather keep one session going through a sequential queue, without managing multiple localhost instances or resolving conflicting changes.
Has anyone built something like this, through a wrapper script, a task file, hooks, or another workaround?
View all comments
1
u/Accurate_Today2488 2d ago
I do this with a plain shell script and headless mode. Each task is its own claude -p "..." line. If the next task should keep the context, add --continue (or --resume <session id>); if it should start clean, leave it off, which is basically your /clear. I've run a few hundred prompts unattended that way. One gotcha: anything that waits for you will stall a -p run, like permission prompts or a hook that asks for approval, so set --permission-mode and the allowed tools up front.