> ## Documentation Index
> Fetch the complete documentation index at: https://docs.svrnos.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Diagnostic receipt

> Generate a structured evidence document for an AI-event filing. Pure deterministic — no AI in the receipt.

export const GerReceipt = ({defaultCode = ""}) => {
  const CDN = "https://cdn.jsdelivr.net/gh/svrnos/site@main/docs-site/data";
  const DEFAULT_EVIDENCE = ["The output / action / event itself (screenshot, document, log, transcript)", "Identifiers — transaction IDs, case numbers, model versions, timestamps", "Your inputs — what you said/asked/clicked that led to the failure", "System context — vendor name, product version, the surface (web / mobile / API)", "Vendor communications — your messages to them and their responses", "Vendor's stated policy at the time — screenshot the relevant policy pages", "Date and time of everything, including when you preserved each piece"];
  const EVIDENCE_PER_CODE = {
    "322": ["The synthetic output (image / audio / video / text)", "URL where it surfaced (social media post, ad, message)", "Date the output was first observed", "Any visible watermark or absence thereof", "Vendor's stated provenance policy at the time"],
    "420": ["Vendor's published policy stating the prohibition", "Evidence the prohibited action was taken anyway", "Date the prohibition was published vs date the action occurred", "Any vendor acknowledgment of the policy-vs-production gap"],
    "424": ["The denial / suspension / arrest notice", "Application materials (if applicable)", "Appeal communications and response timing", "Demographic data relevant to disparate-impact analysis", "Pattern data — news articles, ProPublica investigations, class actions"],
    "428": ["The personalized output involving the named subject", "Evidence of who requested it (account, IP, identity)", "Whether consent of the subject was attested at any step", "Vendor's stated policy on third-party content generation"],
    "432": ["Full chat transcript (request from vendor under data-subject access rights)", "Time stamps showing duration of conversations", "Vendor's stated mental-health safety policies", "Medical records / coroner findings (if applicable)", "Vendor's public statements about safety on this surface"],
    "501": ["Evidence the detection fired (vendor logs if available)", "Evidence no escalation occurred (no report to authorities)", "Whether the vendor has any published escalation policy", "Statutory disclosure obligations that should have applied (24hr, 72hr, etc.)"],
    "512": ["The fabricated content with the action directive", "Evidence the user did not introduce the fabricated premise", "Full conversation log showing how the premise was generated by the system", "Any real-world action taken on the directive"]
  };
  const DEFAULT_REGULATORY = ["Vendor's customer support (cite the GER code)", "Vendor's legal / compliance contact if no resolution"];
  const REGULATORY_PER_CODE = {
    "322": ["Platform's content moderation team", "Law enforcement if fraud / NCII / electoral deepfake", "FTC for deceptive practices", "State AG for impersonation"],
    "420": ["Vendor first, then FTC if marketed safeguards proved illusory", "State AGs investigating AI safety claims", "Class-action attorneys for systemic pattern"],
    "424": ["Vendor's appeals process (file even if nominal — creates paper trail)", "HUD (housing), CFPB (lending), EEOC (employment), state ombudsperson (benefits)", "Class-action attorneys for systemic patterns", "AI Incident Database (incidentdatabase.ai)"],
    "428": ["Platform content moderation (with explicit GER code citation)", "Law enforcement if subject is a minor or content is non-consensual sexual imagery", "NCMEC, IWF, or country-specific equivalents"],
    "432": ["Vendor's safety team (with explicit GER code citation)", "Legal counsel specializing in product liability / AI harm", "State AG (multiple are actively investigating AI mental-health harm)", "FTC for unfair-and-deceptive-practices"],
    "501": ["Vendor's safety team (with timing of when detection fired)", "Statutory regulator for jurisdiction (CA TFAIA, NY RAISE Act, OR SB 1546, EU AI Act)", "Local law enforcement (if imminent-harm signal)", "Class-action attorneys for systemic neglect"],
    "512": ["Vendor incident reporting", "Law enforcement if real-world harm followed", "FTC for deceptive/unfair practices", "AI Incident Database for pattern documentation"]
  };
  const [codes, setCodes] = useState([]);
  const [selectedCodes, setSelectedCodes] = useState(defaultCode ? [defaultCode] : []);
  const [context, setContext] = useState("");
  const [distinctNotes, setDistinctNotes] = useState("");
  const [codeInput, setCodeInput] = useState("");
  useEffect(() => {
    fetch(`${CDN}/ger.json`).then(r => r.json()).then(d => setCodes(d.codes || []));
  }, []);
  const codeMap = useMemo(() => {
    const m = new Map();
    for (const c of codes) m.set(c.code, c);
    return m;
  }, [codes]);
  const evidenceFor = code => EVIDENCE_PER_CODE[code] || DEFAULT_EVIDENCE;
  const regulatoryFor = code => REGULATORY_PER_CODE[code] || DEFAULT_REGULATORY;
  const markdown = useMemo(() => {
    const lines = [];
    const today = new Date().toISOString().slice(0, 10);
    lines.push("# SVRNOS Diagnostic Receipt");
    lines.push("");
    lines.push(`**Generated:** ${today}`);
    lines.push("**Source:** SVRNOS Governance Error Register — https://docs.svrnos.com/ger");
    lines.push("");
    if (context && context.trim()) {
      lines.push("## Case description");
      lines.push("");
      lines.push(context.trim());
      lines.push("");
    }
    lines.push("## 1. Diagnosis");
    lines.push("");
    selectedCodes.forEach((code, idx) => {
      const c = codeMap.get(code);
      if (!c) return;
      const roleLabel = idx === 0 ? "Primary" : idx === 1 ? "Secondary" : "Contributing";
      lines.push(`### ${roleLabel} — GER-${c.code} ${c.name}`);
      lines.push("");
      lines.push(`*Tier: ${c.tier}${c.layer ? ` · Layer: ${c.layer}` : ""} · Status: ${c.type}*`);
      lines.push("");
      lines.push(c.definition);
      lines.push("");
      lines.push(`Source: https://docs.svrnos.com/ger/codes/${c.code}`);
      lines.push("");
    });
    lines.push("## 2. Evidence to preserve");
    lines.push("");
    const allEvidence = new Set();
    selectedCodes.forEach(code => evidenceFor(code).forEach(e => allEvidence.add(e)));
    Array.from(allEvidence).forEach(e => lines.push(`- [ ] ${e}`));
    lines.push("");
    lines.push("## 3. Where to escalate");
    lines.push("");
    const allReg = new Set();
    selectedCodes.forEach(code => regulatoryFor(code).forEach(r => allReg.add(r)));
    Array.from(allReg).forEach(r => lines.push(`- ${r}`));
    lines.push("");
    if (distinctNotes && distinctNotes.trim()) {
      lines.push("## 4. Why these codes (and not adjacent ones)");
      lines.push("");
      lines.push(distinctNotes.trim());
      lines.push("");
    } else {
      lines.push("## 4. Why these codes");
      lines.push("");
      selectedCodes.forEach(code => {
        const c = codeMap.get(code);
        if (!c || !c.distinct_from || c.distinct_from.length === 0) return;
        lines.push(`**GER-${code} ${c.name}** is distinct from:`);
        c.distinct_from.forEach(d => {
          lines.push(`- GER-${d.contrasted_with}: ${d.this_condition} → GER-${code}. ${d.other_condition} → GER-${d.contrasted_with}.`);
        });
        lines.push("");
      });
    }
    lines.push("---");
    lines.push("");
    lines.push("This receipt classifies a single event against the SVRNOS Governance Error Register.");
    lines.push("It is generated by a deterministic filter (no AI), not a diagnostic LLM. The user selected the codes.");
    lines.push("Each code is open and citable under CC BY 4.0. The taxonomy is versioned; cite this receipt with the current GER version.");
    lines.push("");
    lines.push("If you intend to use this receipt in regulatory filing, litigation, or insurance claim — please notify SVRNOS at hello@svrnos.com so we can track adoption.");
    return lines.join("\n");
  }, [selectedCodes, context, distinctNotes, codeMap]);
  const addCode = () => {
    const v = codeInput.trim();
    if (!v || !codeMap.has(v) || selectedCodes.includes(v)) return;
    setSelectedCodes([...selectedCodes, v]);
    setCodeInput("");
  };
  const removeCode = code => setSelectedCodes(selectedCodes.filter(c => c !== code));
  const moveUp = idx => {
    if (idx === 0) return;
    const next = [...selectedCodes];
    const tmp = next[idx - 1];
    next[idx - 1] = next[idx];
    next[idx] = tmp;
    setSelectedCodes(next);
  };
  const download = () => {
    const blob = new Blob([markdown], {
      type: "text/markdown"
    });
    const url = URL.createObjectURL(blob);
    const a = document.createElement("a");
    const today = new Date().toISOString().slice(0, 10);
    a.href = url;
    a.download = `ger-receipt-${selectedCodes.join("-")}-${today}.md`;
    a.click();
    URL.revokeObjectURL(url);
  };
  const copyToClipboard = () => {
    if (navigator.clipboard) navigator.clipboard.writeText(markdown);
  };
  return <div className="ger-receipt not-prose grid grid-cols-1 lg:grid-cols-2 gap-8">
      <div className="space-y-6">
        <h3 className="text-base font-mono uppercase tracking-wider text-neutral-600">Build your receipt</h3>
        <div>
          <label className="block text-xs font-mono uppercase tracking-wider text-neutral-600 mb-2">
            Codes (in role order)
          </label>
          <ol className="space-y-2 mb-3">
            {selectedCodes.map((code, idx) => {
    const c = codeMap.get(code);
    const roleLabel = idx === 0 ? "Primary" : idx === 1 ? "Secondary" : "Contributing";
    return <li key={code} className="flex items-center gap-2 border border-neutral-200 rounded p-2">
                  <span className="text-[10px] font-mono uppercase tracking-wider text-neutral-500 w-20">{roleLabel}</span>
                  <span className="font-mono text-sm text-green-900 font-semibold">GER-{code}</span>
                  <span className="text-sm flex-1">{c ? c.name : "(loading…)"}</span>
                  <button onClick={() => moveUp(idx)} disabled={idx === 0} className="text-xs px-2 py-0.5 text-neutral-500 disabled:opacity-30 hover:text-neutral-900">↑</button>
                  <button onClick={() => removeCode(code)} className="text-xs px-2 py-0.5 text-neutral-500 hover:text-red-700">×</button>
                </li>;
  })}
          </ol>
          <div className="flex gap-2">
            <input type="text" value={codeInput} onChange={e => setCodeInput(e.target.value)} onKeyDown={e => e.key === "Enter" && addCode()} placeholder="Add code (e.g. 501)" className="flex-1 px-3 py-2 border border-neutral-300 rounded text-sm" />
            <button onClick={addCode} className="px-4 py-2 bg-green-700 text-white text-sm rounded hover:bg-green-800">Add</button>
          </div>
        </div>

        <div>
          <label className="block text-xs font-mono uppercase tracking-wider text-neutral-600 mb-2">Case description (optional)</label>
          <textarea value={context} onChange={e => setContext(e.target.value)} placeholder="Brief plain-language description of what happened. This appears at the top of the receipt." rows={4} className="w-full px-3 py-2 border border-neutral-300 rounded text-sm" />
        </div>

        <div>
          <label className="block text-xs font-mono uppercase tracking-wider text-neutral-600 mb-2">Why these codes (optional)</label>
          <textarea value={distinctNotes} onChange={e => setDistinctNotes(e.target.value)} placeholder="Why these codes specifically, and not adjacent ones. If left blank, the receipt auto-fills with each code's structured distinct-from data." rows={3} className="w-full px-3 py-2 border border-neutral-300 rounded text-sm" />
        </div>

        {selectedCodes.length > 0 && <div className="flex gap-3 pt-4 border-t border-neutral-200">
            <button onClick={download} className="px-4 py-2 bg-green-700 text-white text-sm rounded hover:bg-green-800">Download .md</button>
            <button onClick={copyToClipboard} className="px-4 py-2 border border-neutral-300 text-sm rounded hover:bg-neutral-50">Copy to clipboard</button>
          </div>}
      </div>

      <div>
        <h3 className="text-base font-mono uppercase tracking-wider text-neutral-600 mb-3">Preview</h3>
        {selectedCodes.length === 0 ? <div className="border border-neutral-200 rounded p-8 text-center text-neutral-500 text-sm">
            <p className="mb-2">Add at least one GER code to generate a receipt.</p>
            <p className="text-xs">
              Don't know which code? Use the <a href="/ger/find" className="underline">lookup tool</a> first.
            </p>
          </div> : <pre className="border border-neutral-200 rounded p-4 bg-neutral-50 text-xs overflow-auto max-h-[600px] whitespace-pre-wrap font-mono">{markdown}</pre>}
      </div>
    </div>;
};

<GerReceipt />

## What this is

A **diagnostic receipt** is a structured document you take to a regulator, insurer, vendor, or class-action attorney when filing an AI-event claim. It has four fixed sections:

1. **Diagnosis** — the GER code(s) that apply, with the canonical definitions and links to permalinks
2. **Evidence to preserve** — a per-code checklist of artifacts that strengthen the claim
3. **Where to escalate** — per-code routing to the relevant authorities (regulators, agencies, vendor channels)
4. **Why these codes** — the disambiguation: why this code and not the adjacent ones (auto-filled from the GER's structured "distinct from" pairs, or override with your own justification)

The receipt is generated entirely by your browser. SVRNOS doesn't see your case description, your codes, or your evidence. The receipt is yours.

## How to use it

1. **Add the GER codes** that apply to your case. Put the structurally-primary code first; secondary and contributing codes after.
2. **Write a brief case description** (optional). This appears at the top of the receipt.
3. **Add a "why these codes" justification** (optional). If left blank, the receipt auto-fills from the GER's structured distinct-from pairs.
4. **Download as markdown** or **copy to clipboard**. The markdown renders in any text editor, GitHub issue, regulator portal, or attorney intake form.

## Where the codes come from

If you don't know which codes apply to your case, start with the [lookup tool](/ger/find). The tool narrows 71+ codes to a short list of candidates based on your symptoms, the event you observed, or the sector / harm-type filter. You read the candidates and pick the ones that fit.

## What this isn't

* **It is not a diagnostic LLM.** The receipt does not classify your case using AI. You select the codes; the receipt structures the output.
* **It is not legal advice.** The "where to escalate" section lists the most common routes; your specific case may need different counsel.
* **It does not submit anything.** The receipt is a document you generate; what you do with it is up to you.

## A note on tracking

If you intend to use a receipt in **regulatory filing, litigation, audit programs, or insurance claims**, please notify SVRNOS at [hello@svrnos.com](mailto:hello@svrnos.com). We track adoption visibly on the changelog as a public signal that the registry is being used in the field.

This is not a license condition. It's a request that helps the registry mature.
