Optional. Use when the user explicitly requests it. Always specify --project.
Add:
./scrapai queue add <url> --project NAME [-m "instruction"] [--priority N]Bulk add:
./scrapai queue bulk <file.csv|file.json> --project NAME [--priority N]List:
./scrapai queue list --project NAME # 5 pending/processing (default)
./scrapai queue list --project NAME --limit 20 # more items
./scrapai queue list --project NAME --all --limit 50 # include completed/failed
./scrapai queue list --project NAME --status pending # filter by status
./scrapai queue list --project NAME --count # just the count
./scrapai queue list --project NAME --status failed --count # count by statusClaim next:
./scrapai queue next --project NAMEUpdate status (ID is globally unique, no --project needed):
./scrapai queue complete <id> [--spider <name>] [--force]
./scrapai queue fail <id> [-m "error message"]
./scrapai queue retry <id>
./scrapai queue remove <id>queue complete verifies before marking done: the spider must exist in the DB
and final_spider.json must exist on disk (under
DATA_DIR/<project>/<spider>/analysis/). If either is missing it refuses and
leaves the item unchanged. The spider name is derived from the URL's domain
(dots/dashes → underscores); pass --spider <name> if the spider has a
different name, or --force to skip both checks.
Cleanup:
./scrapai queue cleanup --completed --force --project NAME
./scrapai queue cleanup --failed --force --project NAME
./scrapai queue cleanup --all --force --project NAMEJSON format (see templates/queue-template.json):
[
{"url": "https://site1.com", "custom_instruction": "Focus on research articles", "priority": 5},
{"url": "https://site2.com", "priority": 10},
{"url": "https://site3.com", "custom_instruction": "Include all news sections", "priority": 1}
]CSV format (see templates/queue-template.csv):
url,custom_instruction,priority
https://site1.com,Focus on research articles,5
https://site2.com,,10
https://site3.com,Include all news sections,1Required columns:
url- Website URL (required)custom_instruction- Special instructions for this site (optional)priority- Higher number = higher priority (optional). Items omitting priority fall back to the file's--priorityvalue (default: 5).
./scrapai queue next --project NAME— claim next item- Note: ID, URL, project, custom_instruction
- If custom_instruction exists: use it to override CLAUDE.md defaults
- Run Phases 1-4. Include
"source_url": "<queue_url>"in final_spider.json. - Import spider with
--projectmatching queue project. - On success:
./scrapai queue complete <id> - On failure:
./scrapai queue fail <id> -m "error description"
Process up to 5 sites at once — never more. Have more than 5 queued? Batch them (12 → 5 + 5 + 2), finishing one batch before starting the next.
- Start the browser service first:
./scrapai browser start. The parallel agents then share one warm browser (Cloudflare solved once) instead of each cold-starting their own. - Spawn one agent per site, each running Phases 1-4 from CLAUDE.md against its own queue item.
- Phases stay sequential within each site — parallelism is across sites, not across phases. Each agent runs 1 → 2 → 3 → 4 in order.
- On success the agent runs
queue complete <id>; on failurequeue fail <id> -m "reason". Surface failures as they happen and report per batch.
When queue next returns a custom_instruction, use it to override CLAUDE.md defaults during analysis.
Example: instruction "Focus only on research articles" narrows scope against the default collect-everything policy → only create rules for research article URL patterns, skip other content sections. Use such instructions only when the user explicitly wants a subset; the default remains to collect every section and subsection.
- User says "Add this website: X" → process immediately (Phases 1-4), no queue
- User says "Add X to the queue" →
queue addonly, do NOT process - User says "Process next" →
queue nextthen Phases 1-4
NEVER omit --project when importing spiders from queue. Without it, spider defaults to "default" project, mixing data across projects. Always match the queue item's project.