# SCRIMED Manual AAL2 QA Run Control Brief

Status: manual-aal2-qa-run-control-ready
Execution decision: operator-control-ready-human-aal2-required
Buyer claim status: operator-brief-ready-not-retained-authenticated-proof

## Boundary
SCRIMED Manual AAL2 QA Run Control creates a no-secret operator mission-control layer for human-run synthetic QA. It does not execute AAL2 ceremonies, mint tokens, store credentials, run unattended authenticated CI, process PHI, authorize clinical care, certify security or compliance, guarantee reimbursement, approve production connectors, or claim retained authenticated proof before protected no-secret evidence is persisted.

## Claim Rules
- Allowed now: SCRIMED has operator-ready AAL2 QA run-control briefs and workflow-specific safe evidence templates.
- Allowed now: SCRIMED can tell an operator exactly what to run, what to copy, what to reject, and when buyer proof can be promoted.
- Not allowed yet: SCRIMED has retained authenticated AAL2 QA proof for these workflows.
- Not allowed yet: SCRIMED is authorized for live clinical care, PHI processing, payer submission, production connectors, security certification, reimbursement certainty, or regional clinical deployment.

## Gates
- Fresh human AAL2 session (required-before-run): pass when Operator confirms AAL2 session and scoped role in the protected workspace. Fail when No AAL2 session, stale session, ambiguous role, or shared account. Boundary: AAL2 confirms operator context only; it is not clinical, legal, security, or reimbursement authority.
- Synthetic target selected (required-before-run): pass when Exactly one synthetic intake ID or workspace slug is selected before dispatch. Fail when Target is missing, broad, production-linked, or contains regulated data. Boundary: Targets must remain synthetic business workflow metadata.
- Short-lived token preflight (required-before-run): pass when Preflight passes with AAL2, session_id, expiry, and minimum remaining lifetime checks. Fail when Weak token shape, missing AAL2, missing session, expired token, or excessive lifetime. Boundary: Preflight is not signature verification; protected APIs remain the authority.
- Manual workflow dispatch (required-during-run): pass when Manual GitHub workflow passes against the explicit synthetic target. Fail when Workflow is scheduled, target is implicit, or authenticated path is optional. Boundary: Passing smoke proves only the synthetic protected route under review-gated conditions.
- Secret disposal (required-after-run): pass when Temporary masked secret is deleted or rotated immediately after completion. Fail when Token remains in GitHub, Vercel, source, docs, logs, packets, screenshots, or chat. Boundary: The token is never evidence and must not be retained.
- No-secret packet persistence (required-after-run): pass when Only safe metadata is persisted through the protected Manual QA Evidence route. Fail when Packet contains secrets, PHI, approvals, reports, clinical records, or unsupported identifiers. Boundary: Retained proof is limited to synthetic workflow metadata and packet hash.
- Buyer proof promotion (hard-stop): pass when Buyer Diligence is exported after packet hash and audit event are visible. Fail when Buyer material claims authenticated proof before no-secret metadata is persisted. Boundary: Buyer proof can reference retained QA evidence only after protected persistence.

## Sales Demo Session QA activation
- Workflow kind: sales-demo-session-qa
- State: ready-for-operator-control-human-aal2-required
- Dispatch path: .github/workflows/sales-demo-session-qa-smoke.yml
- Temporary secret: SCRIMED_SALES_QA_BEARER_TOKEN
- Evidence packet route: /api/qa-evidence/manual-run-packet
- Protected persistence route: /api/pilot-workspaces/{workspaceSlug}/qa-evidence/manual-run-packets
- Buyer proof rule: Do not promote this workflow into Buyer Diligence until the protected workspace shows a retained packet SHA-256 and append-only audit event.

Dispatch inputs:
```json
{
  "base_url": "https://app.scrimedsolutions.com",
  "intake_id": "<synthetic-sales-opportunity-intake-id>",
  "require_authenticated_path": true
}
```

Preflight command template:
```bash
SCRIMED_REQUIRE_SALES_QA=1 SCRIMED_SALES_QA_INTAKE_ID=<synthetic-intake-id> SCRIMED_SALES_QA_BEARER_TOKEN=<short-lived-aal2-token> node scripts/sales-demo-session-qa-token-preflight.mjs
```

Smoke command template:
```bash
SCRIMED_REQUIRE_SALES_QA=1 SCRIMED_BASE_URL=https://app.scrimedsolutions.com SCRIMED_SALES_QA_INTAKE_ID=<synthetic-intake-id> SCRIMED_SALES_QA_BEARER_TOKEN=<short-lived-aal2-token> node scripts/sales-demo-session-qa-smoke.mjs
```

Safe evidence template:
```json
{
  "workflowKind": "sales-demo-session-qa",
  "workflowRunId": "<numeric-scrimed-manual-run-id>",
  "workflowRunUrl": "https://app.scrimedsolutions.com/qa-run-control?runId=<numeric-scrimed-manual-run-id>",
  "executedAt": "<iso-8601-run-timestamp>",
  "baseUrl": "https://app.scrimedsolutions.com",
  "intakeId": "<synthetic-sales-opportunity-intake-id>",
  "createdSessionId": "<created-demo-session-uuid>",
  "packetAuditEventId": "<demo-session-packet-audit-event-uuid>",
  "qaOutcome": "pass",
  "operatorAttestation": "no-secrets-no-phi-aal2-human-run",
  "tokenDisposalAttestation": "temporary-token-deleted-or-rotated",
  "dataBoundary": "synthetic-business-workflow-only"
}
```

Operator sequence:
1. Open the protected workspace in a fresh browser session and confirm AAL2 posture.
2. Use one explicit synthetic Sales Operations intake ID as the target.
3. Create a temporary masked GitHub Actions secret for the short-lived AAL2 token.
4. Dispatch the manual workflow with require_authenticated_path=true.
5. Verify preflight passed before the authenticated smoke runs.
6. Copy only the workflow run ID, run URL, created safe object ID, packet audit event ID, and timestamp.
7. Delete or rotate the temporary secret immediately after the workflow completes.
8. Persist the safe metadata through /pilot-workspace/access -> Manual QA Evidence.
9. Export Buyer Diligence only after the packet hash and audit event are visible.

Abort conditions:
- No fresh human AAL2 session is available.
- The target is not synthetic or metadata-only.
- The token preflight fails or the token lifetime is too long.
- The workflow requires a long-lived or committed credential.
- Any evidence field contains a token, credential, PHI, patient identifier, payer member identifier, artifact URL, legal approval, security report, reimbursement determination, or production clinical record.
- The operator cannot delete or rotate the temporary secret after the run.
- Buyer Diligence is requested before no-secret evidence metadata is retained.

## Authority Reference QA activation
- Workflow kind: authority-reference-qa
- State: ready-for-operator-control-human-aal2-required
- Dispatch path: .github/workflows/authority-reference-qa-smoke.yml
- Temporary secret: SCRIMED_BEARER_TOKEN
- Evidence packet route: /api/qa-evidence/manual-run-packet
- Protected persistence route: /api/pilot-workspaces/{workspaceSlug}/qa-evidence/manual-run-packets
- Buyer proof rule: Do not promote this workflow into Buyer Diligence until the protected workspace shows a retained packet SHA-256 and append-only audit event.

Dispatch inputs:
```json
{
  "base_url": "https://app.scrimedsolutions.com",
  "workspace_slug": "atlas-synthetic-evaluation",
  "require_authenticated_path": true
}
```

Preflight command template:
```bash
SCRIMED_REQUIRE_AUTHORITY_REFERENCE_QA=1 SCRIMED_WORKSPACE_SLUG=<synthetic-workspace-slug> SCRIMED_BEARER_TOKEN=<short-lived-aal2-token> node scripts/authority-artifact-reference-qa-token-preflight.mjs
```

Smoke command template:
```bash
SCRIMED_REQUIRE_AUTHORITY_REFERENCE_QA=1 SCRIMED_BASE_URL=https://app.scrimedsolutions.com SCRIMED_WORKSPACE_SLUG=<synthetic-workspace-slug> SCRIMED_BEARER_TOKEN=<short-lived-aal2-token> node scripts/authority-artifact-reference-qa-smoke.mjs
```

Safe evidence template:
```json
{
  "workflowKind": "authority-reference-qa",
  "workflowRunId": "<numeric-scrimed-manual-run-id>",
  "workflowRunUrl": "https://app.scrimedsolutions.com/qa-run-control?runId=<numeric-scrimed-manual-run-id>",
  "executedAt": "<iso-8601-run-timestamp>",
  "baseUrl": "https://app.scrimedsolutions.com",
  "intakeId": "atlas-synthetic-evaluation",
  "createdSessionId": "<created-authority-reference-uuid>",
  "packetAuditEventId": "<authority-reference-packet-audit-event-uuid>",
  "qaOutcome": "pass",
  "operatorAttestation": "no-secrets-no-phi-aal2-human-run",
  "tokenDisposalAttestation": "temporary-token-deleted-or-rotated",
  "dataBoundary": "synthetic-business-workflow-only"
}
```

Operator sequence:
1. Open the protected workspace in a fresh browser session and confirm AAL2 posture.
2. Use the protected synthetic workspace slug as the explicit target.
3. Create a temporary masked GitHub Actions secret for the short-lived AAL2 token.
4. Dispatch the manual workflow with require_authenticated_path=true.
5. Verify preflight passed before the authenticated smoke runs.
6. Copy only the workflow run ID, run URL, created safe object ID, packet audit event ID, and timestamp.
7. Delete or rotate the temporary secret immediately after the workflow completes.
8. Persist the safe metadata through /pilot-workspace/access -> Manual QA Evidence.
9. Export Buyer Diligence only after the packet hash and audit event are visible.

Abort conditions:
- No fresh human AAL2 session is available.
- The target is not synthetic or metadata-only.
- The token preflight fails or the token lifetime is too long.
- The workflow requires a long-lived or committed credential.
- Any evidence field contains a token, credential, PHI, patient identifier, payer member identifier, artifact URL, legal approval, security report, reimbursement determination, or production clinical record.
- The operator cannot delete or rotate the temporary secret after the run.
- Buyer Diligence is requested before no-secret evidence metadata is retained.

## Next Recommended Build Step
Use this run-control layer, then /qa-human-run-packet, during the first human AAL2 run; persist the no-secret evidence packet through the protected workspace, then update Buyer Diligence only after packet hash visibility is verified.