plugins/healthcare/skills/contracts/skills/sweep/SKILL.md
Fan out over the scoped document set via the saved sweep workflow. Workers full-read their shard and write findings + citations directly via cli.ts. Recall over precision — never skip a scoped doc.
npx skillsauth add anthropics/healthcare sweepInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Scope already happened. Every scoped document gets full-read; workers never skip, never block, never guess. Cost is not a concern; wall-clock is — fan wide.
bun <CLI> sql "SELECT sd.doc_id, v.uri, v.family, length(v.content) AS chars
FROM scope_documents sd
JOIN v_corpus_documents v ON v.id=sd.doc_id
AND v.corpus=(SELECT corpus FROM runs WHERE run_id='<RUN_ID>')
WHERE sd.scope_id=<s> ORDER BY sd.rank"
Shard count: target the Workflow concurrency cap — currently min(16, cpu cores − 2), floor 1 (getconf _NPROCESSORS_ONLN; if unsure, use 16) — or one shard per document when there are fewer docs than the cap. Balance shards by total chars, not doc count (the query returns chars) — the heaviest shard is the straggler everyone waits on. Keep families together (a worker reading a base contract should also read its amendments). Hard ceiling ~300k chars per shard (a worker holds its whole shard in context): when the corpus doesn’t fit in cap-many shards under the ceiling, make more — queued shards beat overflowed context. A single long document (>~150k chars) gets its own shard marked hunter:true (greps for the brief’s terms; doesn’t read linearly).
Call the saved workflow by path — do not author a script inline. Everything run-specific goes in args (a JSON object value, not a string):
Workflow({
scriptPath: "<ROOT>/workflows/sweep.js",
args: {
cli: "<CLI>",
run_id: "<RUN_ID>",
brief: <brief_id>,
round: <round>,
scope_id: <scope_id>,
model: "<worker model — omit for the default (opus); set from $ANT_CONTRACTS_MODEL_WORKER if the user exported it, e.g. 'claude-sonnet-5'>",
rubric: "<the brief's rubric, verbatim>",
rules: "<content of <ROOT>/workflows/reader.md — Read it verbatim>",
shards: [{label:"s00", doc_ids:[1,2,3]}, {label:"s01", doc_ids:[4,5], hunter:true}, …]
}
})
The script handles the reader prompt, schema, and rescue pass. If you need to deviate (different rules, custom rescue logic), Read <ROOT>/workflows/sweep.js, edit a copy, and pass that as script instead — but default to the saved one.
Workers wrote directly; nothing to merge. Reconcile coverage:
bun <CLI> sql "SELECT * FROM v_coverage_gaps WHERE run_id='<RUN_ID>'"
Everything's a gap → the workflow died at launch; re-call it. Partial gaps → some workers crashed; launch a small targeted Workflow for those doc_ids. No gaps → proceed to queue-triage.
tools
Extract plain text from a document file - PDF, DOCX, XLSX, PPTX, RTF, or plain text/markdown/HTML. Use when a binary document needs to be turned into text, for example a contract PDF or an EHR DocumentReference attachment. Other skills (fhir) invoke scripts/extract.ts directly; the contracts MCP server bundles its own copy (servers/documents/src/extract.mjs) so its bundle stays self-contained — port fixes to both.
testing
Answer a question across a corpus of contract documents with verified citations. Use when the user asks what a contract says, which contracts have a clause, what changed between amendments, or any question that needs reading and citing across a set of contract files. The corpus must be on the local filesystem (see README).
tools
Connect to a hospital's FHIR R4 server (Epic, Oracle Health/Cerner, MEDITECH, athenahealth, or any SMART-on-FHIR endpoint), pull a patient's clinical data and notes, and extract structured findings. Use when users say "connect to the EHR", "connect to Epic/Cerner", "pull notes for patient X", "what do the last 6 months of notes say about Y", or any task that starts from a live EHR rather than pasted text.
tools
Assign CPT and HCPCS Level II procedure codes from clinical documentation the way a professional coder builds the claim. Use when users say "code this encounter for procedures", "what CPT codes apply", "assign HCPCS codes", "code this op note", or when turning visit notes or operative reports into claim-ready procedure codes.