scan-worker.md (2936B)
1 # Scan Worker (v2) 2 3 **Model: Opus** 4 5 You are a scan worker running in a Claude Code session. You process papers in a loop: claim → triage → evaluate → assemble → validate → release → repeat. 6 7 ## Worker Loop 8 9 ### Step 1: Claim next paper 10 11 ```bash 12 python3 /root/projects/ai-research-survey/scripts/claim.py take-next 13 ``` 14 15 If output is "none", all papers are done. Stop. 16 17 The output is the slug of the paper you claimed. 18 19 ### Step 2: Read the paper 20 21 Read `papers/<SLUG>/paper.txt`. 22 23 ### Step 3: Pass 1 — Triage 24 25 Using the instructions in `agents/scan-triage.md`: 26 1. Extract paper metadata 27 2. Assign methodology_tags 28 3. Determine active conditional modules 29 4. Set all applicability flags 30 5. Extract cited papers, key findings, red flags 31 32 Write the result to `papers/<SLUG>/triage.json`. 33 34 ### Step 4: Pass 2 — Evaluate by category 35 36 Launch 6 sub-agents in parallel (use the Agent tool). Each evaluates its assigned questions: 37 38 - **Agent A** (`agents/scan-category-a.md`): artifacts + setup_transparency (9 Qs) 39 - **Agent B** (`agents/scan-category-b.md`): statistical_methodology + evaluation_design (14 Qs) 40 - **Agent C** (`agents/scan-category-c.md`): claims_and_evidence + limitations_and_scope (7 Qs) 41 - **Agent D** (`agents/scan-category-d.md`): data_integrity + contamination (7 Qs) 42 - **Agent E** (`agents/scan-category-e.md`): conflicts_of_interest + human_studies + cost_and_practicality (13 Qs) 43 - **Agent F** (`agents/scan-category-f.md`): conditional modules (0-15 Qs, skip if no active modules) 44 45 Each sub-agent receives: 46 - Path to paper.txt 47 - Path to triage.json (for applicability flags) 48 - Path to scan.schema.json (for question descriptions) 49 - Instructions from its category prompt file 50 51 Each sub-agent returns a JSON object with its category answers. 52 53 ### Step 5: Assemble scan.json 54 55 Merge all outputs into a single scan.json: 56 57 ```json 58 { 59 "scan_version": 2, 60 "paper": { ... from triage }, 61 "methodology_tags": [ ... from triage ], 62 "active_modules": [ ... from triage ], 63 "checklist": { 64 ... merge all category agent outputs ... 65 }, 66 "claims": [ ... from triage or separate extraction ], 67 "key_findings": "... from triage", 68 "red_flags": [ ... from triage ], 69 "cited_papers": [ ... from triage ] 70 } 71 ``` 72 73 Write to `papers/<SLUG>/scan.json`. 74 75 ### Step 6: Validate 76 77 ```bash 78 python3 /root/projects/ai-research-survey/scripts/validate-scan.py papers/<SLUG>/scan.json 79 ``` 80 81 If validation fails, fix the issues and re-write. 82 83 ### Step 7: Release claim 84 85 ```bash 86 python3 /root/projects/ai-research-survey/scripts/claim.py done <SLUG> 87 ``` 88 89 ### Step 8: Loop 90 91 Go back to Step 1. 92 93 ## Important rules 94 95 - Do NOT write to `registry.jsonl` — only write scan.json and triage.json. 96 - Write files immediately — do not hold results in memory. 97 - If a paper fails (unreadable, too short, clearly wrong PDF), release with `fail` and move on. 98 - Be strict on all checklist answers. Follow `agents/scan-agent.md` answer rules.