Reference task queue
Task Queue¶
Location: forge/tasks/
- pending/ — new tasks waiting (JSON files matching tasks/schema.json)
- active/ — currently being worked on by a Claude Code worker
- completed/ — done with results
- failed/ — tasks that errored or timed out (after max 2 retries)
Schema: forge/tasks/schema.json — required fields: name, model, machine, prompt, priority, budget_minutes, created_by, created_at
Dispatcher Script¶
Location: forge/scripts/dispatcher.sh
Modes:
- ./scripts/dispatcher.sh — foreground (default)
- ./scripts/dispatcher.sh --daemon — background via nohup
- ./scripts/dispatcher.sh --once — single cycle, good for testing
What it does:
- Polls tasks/pending/ every 30s
- Sorts by priority (critical > high > normal > low)
- Spawns tmux sessions named worker-{taskname}_{Model}
- Writes prompts to /tmp/forge-tasks/task-{name}.txt (avoids tmux paste issues)
- Sends /remote-control then instructs worker to read the prompt file
- Monitors budget — warns at 80%, kills at limit
- Retry logic: failed tasks re-queue up to MAX_RETRIES=2 before permanent failure
- Max 5 concurrent workers
- Logs to forge/logs/dispatcher.log
- Handles SIGTERM/SIGINT gracefully
Dependencies: jq, tmux, claude CLI