Adversarial qc

From LegalQuants/lq-skills · View interactive version

Adversarial qc is an AI agent skill from the GitHub repository LegalQuants/lq-skills. Adversarial quality control for AI deliverables. Run structured parallel verification using one or two models before delivering reports, plans, analyses, scripts, or any substantive work. Use when: (1) reviewing a deliverable before sending to a human, (2) user asks to 'QC this', 'review this', 'che

How to use this skill

Skill file

Adversarial QC

Structured quality control for AI deliverables. Two agents independently verify a deliverable against a checklist, then results are compared. Agreements = high confidence. Disagreements = flagged for human review.

Quick Start

  1. Read the deliverable to be reviewed
  2. Read references/checklist.md for the verification checklist
  3. Read references/config.md for model configuration
  4. Run the QC process (see Workflow below)
  5. Generate the QC certificate

Configuration

The user controls these settings. Ask if not specified:

Workflow

Step 1: Ingest

Read the deliverable. Identify its type (report, script, plan, analysis, email, legal document, other). This determines which checklist items are relevant.

Step 2: Run Agent A (Verifier)

Spawn a sub-agent with these instructions:

You are QC Agent A — a verification specialist. Your job is to check a deliverable against a structured checklist. You must be thorough, skeptical, and evidence-based.

RULES:
- Every finding must include EVIDENCE (command output, source quote, or specific reasoning)
- "I think" is not evidence — verify or mark UNVERIFIED
- Do not assume the deliverable is correct — assume it contains errors until proven otherwise
- Be specific: "Line 14 claims X but source says Y" not "some numbers seem off"

DELIVERABLE:
[Insert deliverable text]

CHECKLIST:
[Insert from references/checklist.md — only items relevant to deliverable type]

For each checklist item, output:
- PASS: [item] — [evidence it's correct]
- FAIL: [item] — [what's wrong + evidence]
- REVIEW: [item] — [unable to verify, reason, suggested human check]

End with a summary: X pass, Y fail, Z review.

Step 3: Run Agent B (Challenger)

Spawn a second sub-agent (different model if cross-mode). Same instructions but with this addition:

You are QC Agent B — an independent challenger. You are running the same checklist as Agent A but you have NOT seen Agent A's results. Your job is to find what Agent A might miss.

Pay special attention to:
- Claims that SOUND correct but aren't verified
- Numbers that are plausible but unchecked
- Logic that flows well but has gaps
- Things that would embarrass the author if a domain expert read them

If single-model mode: use different system prompts to create genuine perspective difference. Agent A is methodical and checklist-driven. Agent B is adversarial and tries to break things.

Step 4: Compare Results

For each checklist item:

Step 5: Generate Certificate

Use the template in references/certificate-template.md. Output as:

Checklist Customization

Users can create custom checklists for specific domains. See references/custom-checklists.md for examples (legal, financial, technical, editorial).

To use a custom checklist: place a .qc-checklist.md file in the project directory, or specify --checklist path/to/checklist.md.

Cost Guidance

| Depth | Single-model | Cross-model |

|-------|-------------|-------------|

| Quick | ~$0.02-0.05 | ~$0.04-0.10 |

| Standard | ~$0.10-0.30 | ~$0.20-0.50 |

| Deep | ~$0.30-1.00 | ~$0.50-1.50 |

Costs assume Sonnet-tier models. Using Opus increases ~5-10x.

Tips

Audience and Work Shape

Audience: AI-assisted reviewers (lawyers, analysts, drafters) running a structured pre-delivery quality gate on a generated artefact. Not for unsupervised drafting, not a substitute for a domain expert, and not appropriate for non-AI-fluent users who would treat a GREEN certificate as a sign-off.

Work shape: Pattern-Matched Review with an accretive overlay. Most items (factual claims, numbers, attribution, formatting, consistency) are pattern-matched against a checklist; the cringe test, adversarial read, and recipient test items are accretive-judgment moves dressed as pattern matching. The skill produces a list of findings, evidence, and item-level confidence — never a sign-off.

Scope and Legal Use

This skill provides AI-output support, not legal advice and not legal substance review. A GREEN certificate means "both agents agreed each checklist item is satisfied at the surface level" — it does not mean the deliverable is legally sufficient, fit to file, fit to send, or correct on substance.

Legal advice vs. legal support. When the deliverable is a legal document, filing, regulatory submission, or contract, the QC pass is mechanical: numbers checked, citations attributed, defined terms consistent, cross-references resolved. It is not a review of legal sufficiency, doctrinal correctness, jurisdictional fit, or professional-responsibility obligations. A GREEN certificate on a legal deliverable is not a lawyer's sign-off and must not be relied upon as one. The user, not this skill, owns the legal-substance call.

Privilege and confidentiality. The QC certificate is written to disk as a permanent record of two agents' reasoning about the deliverable. That artefact may be discoverable, may sit outside the attorney-client and work-product privileges depending on jurisdiction and circumstance, and may not be appropriate to retain alongside a privileged draft. Before running this skill on privileged or pre-decisional legal material, confirm with the responsible lawyer that (a) generating a written QC trail is acceptable in this matter and (b) the certificate's storage location is consistent with the matter's privilege posture. Default: save the certificate inside the matter workspace, not in a shared or general-purpose directory.

Accountability. The two agents are not signatories. The certificate's agent signatures and the README's MIT disclaimer do not close the accountability gap on regulated work. A qualified human reviewer must sign off on any deliverable typed as legal, filing-bound, client-facing, financial, or regulatory — regardless of whether the certificate is GREEN. The mandatory human-reviewer field on the certificate (added in this revision; see Escalation) is the operational anchor for accountability — disclaimer text in the footer is not sufficient.

Confidence Bands

Item level (existing):

Certificate level (new — required to address the gap where 16 GREEN + 1 YELLOW reads identically to 5 GREEN + 12 YELLOW):

The certificate must show the certificate-level band on the front page. A deliverable cannot be marked High Confidence if its type is legal, filing-bound, client-facing, regulatory, or court-bound — those route to Mixed at minimum.

Out of Scope

Escalation

Stop and route to a qualified human reviewer (do not rely on agent agreement alone) when any of the following triggers fire:

The Step 4 disagreement rule (YELLOW → flag) remains in force for every other case, but the triggers above override agreement: a GREEN on a legal filing still routes to human sign-off.

QA Remediation (LegalQuants, 2026-05)

LegalQuants added the Audience and Work Shape, Scope and Legal Use (with all three legal failure modes — legal advice vs. support, privilege, and accountability), Confidence Bands (with a new certificate-level overall verdict), Out of Scope, and Escalation sections to address gaps surfaced by the legal-builder-hub:qa framework. The original technical content (Quick Start, Configuration, Workflow, Checklist Customization, Cost Guidance, Tips) is unchanged. The references/certificate-template.md Chromium invocation was hardened to remove the --no-sandbox flag (a real security weakening that the QA scan flagged as Category 8). Original authorship by Alexios van der Slikke-Kirillov is preserved in the frontmatter.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.