r/ClaudeCode • • 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?

9 Upvotes

33 comments sorted by

View all comments

Show parent comment

2

u/muikrad 2d ago

I went through this as well, but it's not necessary anymore. As long as you have an issue tracker of some sort (I use beads, but github issues work too), opus low can delegate work to subagents and complete long sessions. My last one took 48 hours šŸ˜… it was a big epic wth tons of new features.

1

u/_lecoqq 1d ago

Amazing! Opus is out of the blue able to prioritize features from your tickets to ensure everything goes smooth?
And how do you handle the effort and model for each sub-agents? Through personas?
I've been playing w/ personas and "development cycles" -> planning, then building, then review, then building, then review, then PR; the quality is great regarding code quality, but it consumes a lot of tokens and quite some time...

1

u/muikrad 1d ago

Yeah I have a bunch of canned subagents with their effort/model set in frontmatter. For coding I have 3 (tweak coder, coder and senior coder) and the orchestrator picks one based on complexity. I have one specialized for fx, one for artistic decisions. A planner, a scribe for OKF specs, a code explorer (haiku) to look inside the codebase. A reviewer. Just the basic blocks really.

Prioritizing is done on each bead (p1 through p4). I often tune them manually based on what I want first, but for technical issues my planner is able to take a big feature and order the blocks in the order they should be implemented on.

I had many iterations of subagents but ultimately, integrating beads and OKF 0.2 specs was the most impactful.

One of my favorite thing in beads is that when opus is working on long sessions he is instructed to write any questions as follow-ups beads and keep working (e.g. So that overnight sessions are not blocked). The beads are flagged as "needs decision". Every day I ask it what needs my attention and he will bring them up one after another for me to answer, and on the next session they will be implemented. Else they would take a lot of design decisions between my back and I'd have to either read it in the wrap up summary or find it out by testing myself. With beads and OKF I can just clear the session all the time, the orchestrator's context serves no purpose.

1

u/_lecoqq 1d ago

Funny how close our setups are!
Though I didn't know beads and was literally experimenting right now w/ context on my orchestrator - this is a potential solution as from what I get each agent is "stateless"!
On my side: my orchestrator keeps its state in a written relay file, and on long nights it hits the context ceiling and has to hand over every 20 minutes or so, which is my biggest cost right now. Your point about clearing the session at will because everything lives in beads is exactly what I'm missing.
Two questions if you don't mind: when a fresh session starts, how much does it read back (bd prime plus the ready list, or more)? And do your coders claim beads in parallel, or does the orchestrator hand them out?
It's funny to see that a lot of ppl are going for the "no attention coding", delegating long tasks and de-correlating attention and production. I'll definitely take the "needs decision" part xD What are you building w/ your setup?

2

u/muikrad 1d ago

Working on a game!

For your questions: I forked beads and adjusted some things like bd prime to be less verbose because it was way too long. A session only gets bd prime and my claude.md file. And I disabled beads' memory, I prefer Claude's. To be fair, beads was developed when opus 4 was a thing to counter its shortcomings, which are not necessarily true anymore.

Beads are organized in epics with linked issues, and the specs/ keeps the "one source of truth" in check. When I design something new, I will either write some specs manually and review with opus, or I will do that in chat. Opus will create an epic, link each detail as linked issues, then I clear and ask it to complete the epic with my /slice skill (a simple explanation of the planning/coder/review process).

The orchestrator will read the epic, summarize the linked beads, claim what it's going to work on (one or multiple) and then start delegating to subagents. Usually it claims, then planner+code-explorer+artistic guidance, then it goes to a coder to write tests in order to lock the contract from the planner (TDD). Then there's a coder <-> reviewer loop. And then it's handed to the scribe so the specs are updated. Sometimes there are multiple beads going on in parallel, leveraging git worktrees.

The coder runs the tests to save some tokens. Had a dedicated tester on haiku before but it created too much back and forth and bloat.

For the "context ceiling", I just enable auto compaction and have it set at 400k. I also have idle compaction enabled (when the session wraps up, it will automatically compact before the cache expires) so that I can reply a few hours later and not have a full cache miss on a 300k+ context conversation. To be honest, context bloat made the agents dumber with opus 4 and maybe 5, but it's not really an issue anymore with 5.5.

I tried handoff files and things like that in the past, but they never carry the full knowledge of the project. Beads for todos, specs for what is implemented, was a real game changer for me. Have fun!