Feature: built-in task queue for headless batch execution

Resolved 💬 3 comments Opened Mar 9, 2026 by stackbilt-admin Closed Apr 24, 2026

Problem

Claude Code excels at interactive sessions but has no built-in way to queue multiple tasks for unattended execution. Common scenarios:

  • Queue 5 tasks before leaving for lunch
  • Run a batch of test-writing tasks overnight
  • Execute a sequence of dependent refactoring steps

The current approach requires building a task runner from scratch: queue management, polling, session spawning, result collection, branch lifecycle, error handling.

What a Minimal Built-in Could Look Like

# Add tasks to queue
claude queue add "Write tests for src/auth.ts" --repo ./my-project --branch auto
claude queue add "Document the API endpoints" --repo ./my-project --branch auto

# View queue
claude queue list

# Execute queue
claude queue run              # Run until empty
claude queue run --max 3      # Run at most 3
claude queue run --loop       # Poll and run continuously

# Check results
claude queue status

Each task would:

  1. Run in a headless claude -p session with configurable --max-turns
  2. Optionally create an isolated git branch (--branch auto)
  3. Report structured completion status (see #32620)
  4. Respect safety hooks (see #32621)

Why Built-in > External

I built an external task runner (cc-taskrunner) and have executed 80+ autonomous tasks with it. The core loop is ~400 lines of bash doing what should be 10 lines of CLI commands. The hard parts that a built-in would solve for free:

  • Session spawning — handling env var isolation, working directory, output capture
  • Branch lifecycle — stash/pop protection, branch creation, return to main
  • Result parsing — extracting structured output from JSON responses
  • Completion detection — distinguishing "done" from "hit turn limit" from "stuck"

These are all things the Claude Code process already knows how to do — the task runner just needs to orchestrate them.

Prior Art

  • cc-taskrunner — bash-based autonomous task queue with safety hooks (my project, Apache 2.0)
  • ralph-claude-code — autonomous loop until PRD complete
  • Claude Squad — multi-agent tmux manager with worktrees
  • Pilot — ticket-based autonomous pipeline

The ecosystem demand is clear — multiple independent implementations solving the same gap.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗