From retriever
Executes planned Retriever processing runs inline or in background. Decides execution mode via run-status, spawns subagents, and drives claim/complete/heartbeat loops against processing DB.
npx claudepluginhub sdemyanov/retrieverThis skill uses the workspace's default tool permissions.
> Operates under `retriever:routing`. If the user's intent actually fits a different tier — another `retriever:*` skill, a Tier 2 slash, a Tier 3 `tools.py` subcommand, or (last resort) direct DB access — stop and re-route against the ladder before continuing.
Handles /from-run slash commands to list processing runs, scope results to a specific run ID, or clear scoping in Retriever. Runs python tools.py and outputs tables or states directly.
Implements Python background jobs with task queues (Celery, RQ), workers, idempotency, and state machines for async tasks like emails, reports, and media processing.
Processes thousands of documents asynchronously using Google's Gemini Batch API for cost-effective bulk extraction on LLM tasks with 24-hour job windows.
Share bugs, ideas, or general feedback.
Operates under
retriever:routing. If the user's intent actually fits a different tier — anotherretriever:*skill, a Tier 2 slash, a Tier 3tools.pysubcommand, or (last resort) direct DB access — stop and re-route against the ladder before continuing.
Use this skill when the user wants to execute a planned Retriever processing run inline or in the background.
The processing DB is the source of truth. This skill decides whether to:
The Python CLI does not own a --background flag.
Expected user inputs:
run_id, or enough context to identify onerun-status --budget-seconds 35.run.worker.recommended_execution_mode as the default:
inline means stay in the current conversationbackground means spawn a subagent unless the user explicitly wants inline executionrun.worker.recommended_execution_mode is backgroundWhen unsure, inspect run-status --budget-seconds 35 first.
For long unattended runs, use the supervision hints from run-status:
run.supervision.should_schedule_wakeuprun.supervision.wake_interval_secondsrun.supervision.suggested_worker_countrun.supervision.spawn_additional_worker_countrun.supervision.max_parallel_workersIf should_schedule_wakeup is true, keep a thread wake alive on the suggested interval (currently 60 seconds). Stop scheduling wakes when it becomes false.
For unattended long runs, use a thread heartbeat automation attached to the current conversation.
When to create or update it:
run.supervision.should_schedule_wakeup is trueHow to configure it:
run.supervision.wake_interval_seconds<run_id>run-statusWhen to stop it:
run.supervision.should_schedule_wakeup is falsecompleted, failed, or canceledDo not build a second supervisor inside Python. The heartbeat is the wake mechanism; the skill remains the orchestrator.
Cowork/bash commands may be killed around 45 seconds. Prefer the bounded facade:
python3 skills/tool-template/tools.py run-job-step <workspace> --run-id <RUN_ID> --budget-seconds 35
run-job-step performs exactly one safe orchestration step:
next_recommended_commands for the next bounded actionIf the result contains a non-empty batch, process those items and call complete-run-item or fail-run-item for each one. Then call run-job-step again if the run still needs work.
Do not use execute-run for normal Cowork execution. That command remains the legacy direct executor for deterministic tests and future external-provider work.
Whether running inline or in a subagent, use the same small-batch loop.
The low-level orchestration command is:
prepare-run-batch --run-id ... --claimed-by ... --budget-seconds 35 --launch-mode ... [--worker-task-id ...] [--max-batches ...] [--limit ...]It returns:
run statusworker hintsbatch of run items with their execution contexts already loadedRead worker.next_action:
process_batch: work the returned batchfinalize_ocr: call finalize-ocr-runfinalize_image_description: call finalize-image-description-runhandoff: stop this worker cleanly and let a fresh inline step or subagent continuestop: stop the worker loop cleanlyIf worker.stop_reason is canceled, exit immediately.
For each item in batch:
batch[i].context.execution.task_promptbatch[i].context.execution.completion_template as the exact shape for completioncomplete-run-item ... or fail-run-item ...Use these supporting commands during the loop:
heartbeat-run-items --run-id ... --claimed-by ... between long batchesfinish-run-worker --run-id ... --claimed-by ... --worker-status ... before the worker exitsrun-status --run-id ... --budget-seconds 35 whenever you need an external progress checkfinalize-ocr-run --run-id ... when worker.next_action says finalize_ocrfinalize-image-description-run --run-id ... when worker.next_action says finalize_image_descriptionUse small batches only. The worker hints expose:
worker.recommended_batch_sizeworker.recommended_max_batches_per_workerworker.after_batch_actionworker.should_exit_after_batchprepare-run-batch already reflects cancellation in worker.next_action / worker.stop_reason.worker.stop_reason becomes canceled, stop claiming work and exit cleanly.cancel-run --force and inspect the returned force_stop_task_ids.In background mode:
run_idclaimed_by worker id--worker-task-id when availableprepare-run-batch in a loopworker.recommended_max_batches_per_worker batches before returningfinish-run-worker --worker-status completed|stopped|failed before it exitsThe main conversation should use run-status to inspect progress. Do not stream per-document OCR or extraction output back into chat.
Use a few durable workers, not one subagent per document.
run.supervision.spawn_additional_worker_count guide how many extra subagents to start on a wake.run.supervision.max_parallel_workers.On each wake:
run-status.run.supervision.should_schedule_wakeup is false:
run.supervision.recommended_action is finalize_ocr or finalize_image_description:
run-statusrun.supervision.recommended_action is spawn_background_worker:
run.supervision.spawn_additional_worker_count subagentsrun.supervision.max_parallel_workersrun_idclaimed_bylaunch_mode=backgroundrun.supervision.recommended_action is wait:
run.supervision.recommended_action is stop:
The agent may choose the exact worker count dynamically, but it must stay within the runtime bounds from run.supervision.
If prepare-run-batch returns next_action = handoff, stop this worker with finish-run-worker --worker-status stopped and let a fresh subagent continue from the DB state.
In inline mode:
run-job-step batch at a timenext_recommended_commandsfinish-run-worker --worker-status stopped