citations

$npx mdskill add anthropics/healthcare/citations

``` bun $ANT_CONTRACTS_CLI cite <doc_id> <brief_id> <by> - [start end] [--near <off>] <<'Q' <quote> Q ```

SKILL.md

.github/skills/citationsView on GitHub ↗
---
name: citations
description: How to mint a citation. Every fact FKs to a citations row; citations verify against documents.content (never disk) at insert time and are immutable after.
---

# Citations

```
bun $ANT_CONTRACTS_CLI cite <doc_id> <brief_id> <by> - [start end] [--near <off>] <<'Q'
<quote>
Q
```

Quote goes on **stdin** (the `-` arg) via a **quoted heredoc** — the
`'Q'` quotes disable all shell expansion, so `$500,000`, `$(…)`,
backticks, `"Term"`, `it's` survive unchanged. `--near <offset>` picks the occurrence
closest to where you were reading — pass it whenever the quote is short
or boilerplate. `created_by` is your worker label. The trigger
re-verifies on insert; a bad cite ABORTs.

Sweep workers: prefer `bun $ANT_CONTRACTS_CLI find` (see the sweep skill) — it
does cite + finding + link in one transaction.

## Two paths

- **Exact** — the quote is a contiguous substring of `documents.content`.
  Don't supply offsets; `cite` locates it. Aim for this — quote what's
  literally there, including the document's whitespace and quote marks.
- **Judged** — tables, two-column definition schedules, anything where
  the contiguous string genuinely doesn't exist. **You** verify, then cite:
  spawn an Agent with `model: "haiku"`, pass the span and the quote, prompt
  *"Is every value/label/term in QUOTE faithfully present in PASSAGE with
  the same meaning? Paraphrases are NOT present. Reply {present, reason}."*
  If present, write the verdict:
  ```
  bun $ANT_CONTRACTS_CLI write audits '{"run_id":"'$ANT_CONTRACTS_RUN_ID'","kind":"citation_judge","result":"<reason, one line>"}'
  ```
  then re-cite with the span and `--audit <id>`. The trigger requires that
  audit FK for `kind='judged'`.

## What makes a good quote

- **Verbatim from the document.** Not your summary of it.
- **Complete.** A definition or enumeration ending in a colon followed by
  (a)/(b)/(i) sub-items — quote **through** the sub-items. Stopping at the
  colon omits the operative content and is useless evidence.
- **Self-locating.** Include enough surrounding words that the quote is
  unambiguous in the document (a bare "5.5%" appears in fifty places).
- **The right family.** A clause from another deal's copy of shared
  template terms is the wrong source for deal-specific figures, even if
  the wording matches. Cite from the target family's own documents.

## After minting

`cite` returns `{id, kind, start_off, end_off}`. Link it:

```
bun $ANT_CONTRACTS_CLI write finding_citations '{"finding_id":<f>,"citation_id":<c>}'
```

(or `queue_citations` / `claim_citations` / `knowledge_citations` as fits.)

More from anthropics/healthcare

SkillDescription
contractsAnswer 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).
fhir-developer-skill>
icd10-cm-skillExtract billable ICD-10-CM diagnosis codes from a clinical note the way a professional coder builds the claim. Use when users say "code this encounter", "assign ICD-10 codes", "what diagnosis codes apply", "code this chart", or when turning clinical documentation into claim-ready diagnosis codes.
knowledge-harvestAfter a run completes, propose durable facts learned during the run for the knowledge index. A human ratifies — always. Proposals ride the queue.
prior-auth-review-skillAutomate payer review of prior authorization (PA) requests. This skill should be used when users say "Review this PA request", "Process prior authorization for [procedure]", "Assess medical necessity", "Generate PA decision", or when processing clinical documentation for coverage policy validation and authorization decisions.
queue-triageAfter a sweep round, dedupe and triage worker unknowns into the human queue. Self-resolve the obvious (visibly); blocking items end the round.
reformulateTurn the user's question into a versioned BRIEF (rubric, stated assumptions, done-criteria, scope intent). Use before any sweep. Consults the knowledge index and may pre-scan a few documents to sharpen terms.
sweepFan 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.
synthesizeAfter sweep rounds settle, turn findings into a report with cited claims, run a sampled semantic audit, and surface knowledge proposals. Analysis happens via scripts, never mental math.