{
  "_note": "Audit simulator rules. Evaluated top to bottom; the first rule whose `when` matches wins. Fields: action (export | voice | model-switch | kb-query | persona-update | other), secondTenant, confidentWrong, bypass, uiOnlyGuardrail, humanApproved. `consequential` is derived from the list below.",
  "consequential": ["export", "persona-update", "kb-query"],
  "actions": [
    { "id": "export", "label": "export", "detail": "signed pdf" },
    { "id": "voice", "label": "voice session", "detail": "realtime" },
    { "id": "model-switch", "label": "model switch", "detail": "gpt → claude" },
    { "id": "kb-query", "label": "knowledge base query", "detail": "12 docs" },
    { "id": "persona-update", "label": "persona update", "detail": "legal-review" },
    { "id": "other", "label": "action", "detail": "" }
  ],
  "toggles": [
    { "id": "secondTenant", "label": "second tenant present", "hint": "a document from tenant b shows up in the result set" },
    { "id": "confidentWrong", "label": "model confident and wrong", "hint": "high certainty, bad answer" },
    { "id": "bypass", "label": "integration bypasses the UI", "hint": "direct API call" },
    { "id": "uiOnlyGuardrail", "label": "guardrail lives in the UI only", "hint": "the pre-fix architecture" },
    { "id": "humanApproved", "label": "human approval granted", "hint": "a reviewer signed off" }
  ],
  "rules": [
    { "id": "tenant-leak", "when": { "action": "kb-query", "secondTenant": true }, "state": "reject", "label": "reject · isolate", "tone": "bad", "note": "A result crossed a tenant boundary. The query is rejected and the tenant is isolated until a human clears it." },
    { "id": "tenant-leak-any", "when": { "secondTenant": true, "consequential": true }, "state": "reject", "label": "reject · isolate", "tone": "bad", "note": "Tenant checks run on every data path, not only queries." },
    { "id": "ui-bypass", "when": { "consequential": true, "uiOnlyGuardrail": true, "bypass": true }, "state": "warn", "label": "unguarded · fix", "tone": "warn", "note": "The integration skipped the UI, so a UI-only guardrail never ran. This is the failure that moved the checks into the API layer." },
    { "id": "api-guarded", "when": { "consequential": true, "bypass": true }, "state": "approved", "label": "checked at api", "tone": "ok", "note": "The UI was bypassed. The guardrail sits in the API layer next to the tenant check, so it ran anyway." },
    { "id": "confident-wrong", "when": { "confidentWrong": true, "humanApproved": false }, "state": "needs_review", "label": "needs review", "tone": "wait", "note": "A confident model is not a trusted one. Output waits for a human gate." },
    { "id": "export-no-human", "when": { "action": "export", "humanApproved": false }, "state": "awaiting_human", "label": "awaiting human", "tone": "wait", "note": "Exports are consequential. Nothing leaves the workspace without a person approving it." },
    { "id": "export-approved", "when": { "action": "export", "humanApproved": true }, "state": "approved", "label": "approved · signed", "tone": "ok", "note": "Approved by a human, signed, and written to the trail." },
    { "id": "model-switch", "when": { "action": "model-switch" }, "state": "approved", "label": "approved · logged", "tone": "ok", "note": "Switching models is allowed and always logged." },
    { "id": "kb-scope-ok", "when": { "action": "kb-query" }, "state": "scope_ok", "label": "scope ok", "tone": "ok", "note": "Every returned document belongs to this tenant." },
    { "id": "voice", "when": { "action": "voice" }, "state": "isolated", "label": "isolated", "tone": "ok", "note": "Realtime sessions run inside the same guardrails as text." },
    { "id": "persona", "when": { "action": "persona-update" }, "state": "logged", "label": "logged", "tone": "ok", "note": "Persona changes are recorded with who, when, and what." },
    { "id": "default", "when": {}, "state": "logged", "label": "logged", "tone": "ok", "note": "Recorded." }
  ],
  "presets": [
    { "label": "export without approval", "action": "export", "set": {} },
    { "label": "export, approved", "action": "export", "set": { "humanApproved": true } },
    { "label": "kb query with a tenant leak", "action": "kb-query", "set": { "secondTenant": true } },
    { "label": "integration bypasses the UI (pre-fix)", "action": "export", "set": { "bypass": true, "uiOnlyGuardrail": true, "humanApproved": true } },
    { "label": "integration bypasses the UI (now)", "action": "export", "set": { "bypass": true, "humanApproved": true } },
    { "label": "confident and wrong", "action": "kb-query", "set": { "confidentWrong": true } }
  ]
}
