# Worker Implementation Prep — PREP-POLICY-ENGINE-33-101-WORKER-IMPLEMENTATI Status: Draft (2025-11-20) Owners: Policy Guild Scope: Define worker execution contract that consumes orchestrator jobs (32-101). ## Dependencies - Job schema from 32-101. - Overlay + batch context schemas (30-001, 31-002). ## Draft execution contract - Worker input: job document with `context_id`, `batch_items`, `policy_profile_hash`, `callbacks`. - Output record: `{job_id, worker_id, started_at, completed_at, results[]}` where each result mirrors change-event format `{component_purl, advisory_id, status, trace_ref}`. - Idempotency: result hash over sorted results; retries compare hash and skip duplicate emission. - Metrics: `policy_worker_jobs_total{result}`, `policy_worker_duration_seconds` (histogram), `policy_worker_results_total{status}`. ## Acceptance - Save schema draft at `docs/modules/policy/schemas/policy-worker-result@draft.json` and sample result at `docs/modules/policy/samples/policy-worker-result@draft.json`. - Confirm dedupe strategy with Scheduler/Orchestrator. ## Handoff Prep artefact for PREP-POLICY-ENGINE-33-101-WORKER-IMPLEMENTATI. Finalize once job schema is fixed and dedupe/metric names are agreed.