Responsible AI, Safety & Risk for Architects
This module answers: what stops the system from refusing a legitimate request, producing an unfair outcome, or taking an action no one approved? Safety is a layered system. Every layer has a blind spot the next layer must cover. The architect decides where each layer sits and how it behaves when it fails.
3.1 The alignment boundary D5
- Training-time alignment (Anthropic's job): Claude is trained against the published constitution (priority: broadly safe, ethical, policy-compliant, genuinely helpful — an overall balance). It lowers baseline risk for broadly harmful categories on every request, the same for every user.
- Inference-time control (your job): system instructions, runtime screening, tool authorization, human review. These enforce deployment-specific rules.
- Claude cannot enforce a rule it was never told. Your domain policy, data rules, and authorization model are not in the training.
| Layer | Covers | Misses | Owner |
|---|---|---|---|
| Trained behavior | Broadly harmful content | Domain policy, data rules, authorization | Anthropic |
| System-prompt instructions | Role, tone, stated limits | Anything a strange or adversarial input can talk it out of | Architect |
| Runtime screening | Disallowed content in input/output | Actions with side effects; novel attacks | Architect |
| Authorization | Can this caller do this now | Content quality and fairness | Architect |
Exam trap
"Claude refused every harmful test prompt, so it will also block cross-tenant access." Wrong. A normal-looking in-domain request that violates a policy exists in none of those layers. Broad harm → trained behavior. Tenant isolation, approved phrasing, refund sign-off, program eligibility → the application layer.
3.2 Risk categories and assessment D5
| Risk | What happens | Control sits at |
|---|---|---|
| Direct prompt injection | User input overrides instructions | Input screening; structure over instruction |
| Indirect prompt injection | Instructions hidden in retrieved documents or tool output treated as trusted content. The primary attack path for RAG and agents; invisible to user-input screening entirely | Screen retrieved content and tool output before adding it to context |
| Token-budget exhaustion | Padded input truncates work or spikes cost | Input limits, budgets |
| Tool and action abuse | Model is induced to call a side-effecting tool outside policy | Deterministic tool authorization; least privilege |
| Data exposure | Sensitive fields enter context or logs regardless of model behavior | Minimize and redact before the call |
Practice: a written risk assessment
Walk the request path and the data path together. At every entry point (user input, retrieved content, tool output, model output, logs), ask: what could an attacker do? which control stops it? A plausible attack with no matching control is a finding. Log per risk: category, affected component, likelihood and impact, mitigating control, owner, evidence. A security reviewer signs this document.
3.3 Placing guardrails on the request path D5 D3
Three decision points, each answering a different question. A control at one point does nothing for the others — an output filter at the end can't stop a refund tool that already fired.
| Control point | Question | Use a model when | Use a deterministic rule when |
|---|---|---|---|
| 1. Input screening | Should this request reach the model? | Ambiguous intent, jailbreak/injection patterns | Blocklist, regex, length, format |
| 2. Output screening | Can this output be returned safely? | Toxicity, policy compliance (judge) | Known strings, disallowed fields, schema violations |
| 3. Tool-call authorization | Can this caller do this action in this context? | Rarely | Almost always: allowlist + identity + scope, provable and replayable |
A classifier can be talked around; a rule is brittle. Chain them and write down what each one misses.
Fail closed everywhere a wrong pass-through causes harm. If you don't choose a direction, surrounding code usually lets traffic through — a guardrail that silently fails open is worse than none. Log every block or failure at a gate. This applies to components you build yourself; Anthropic's built-in safety controls can't be configured by the operator added.
Refusals verify docs: the API returns stop_reason: "refusal", possibly with a nullable details object. Handle it per category and reset or rewrite the refused turn; resending on the refused context keeps getting refused.
Reference path: request → input screening (fail closed) → model → output screening (fail closed) → deterministic authorization before any side effect → response, logged at every gate.
Skill supply-chain security
- A Skill is distributed code plus instructions; malicious logic in the package is invisible to conversation-level screening.
- Audit before trusting: network, shell, filesystem, credential reads, behavior beyond the stated purpose.
- Runtime isolation as a safety net: least privilege, sandboxing, limited file/network access, no standing credentials.
- Trusted-source policy: internal repos, verified publishers, signed releases. Don't assume the platform vets a Skill for you.
- Record every audit outcome: approved, rejected, or re-audited after remediation.
3.4 Fairness and transparency D5
Fairness is an architectural property with four injection points you control:
- Retrieval corpus: over- or under-representation, outdated or single-region guidance.
- Prompt framing: embedded assumptions ("flag suspicious applications" nudges toward denial).
- Few-shot examples: same skew risk as the corpus.
- Downstream routing: who gets human review, who gets auto-decided.
| Audience | Needs from the same decision record |
|---|---|
| Affected user | Why the decision happened, in actionable terms (a concrete denial reason) |
| Regulator | Consistent handling of comparable cases; ability to reconstruct any decision |
| Dev team | Full trace: prompt version, retrieved content, output, every routing step |
Decision logging: input, retrieved document IDs, prompt version, example set, output, routing path — indexed so a single decision can be replayed. Build it once; every audience draws from it.
Gaps to find: an unlogged routing step, retrieved content that was never captured, outputs stored with no inputs, overall accuracy with no sub-group breakdown. The decision log is itself sensitive data — minimize, limit retention, control access.
Exam trap
"The vendor ran a bias evaluation" or "the model was trained to be fair, so fairness is handled." Your corpus, framing, examples, and routing create skew the vendor never saw. Instrument and monitor it; don't assume it's a built-in model property.
3.5 Human-review routing by stakes D5
Treat reviewer attention as a fixed budget. Reversibility and error cost set the risk tier. Confidence estimates how likely an output is wrong; it sets volume, not risk — and it's only useful when calibrated.
Rule: low confidence and irreversible or high-cost → route to a human. When signals conflict, weight cost and reversibility more heavily. Route by risk, not by volume.
| Placement | Gives you | Costs | Fits |
|---|---|---|---|
| Pre-action approval | Nothing irreversible happens unreviewed | Latency; depends on reviewer availability; doesn't scale | High-risk, irreversible (a low-confidence denial) |
| Post-action audit | High throughput | The error already happened | Reversible, lower-cost |
| Sampled review | Monitors quality without slowing the flow | Individual bad cases can slip through | Monitoring the whole system |
The reviewer's interface determines whether review is real: show the input, the model output, and the specific reason it was flagged.
Two independent failures, either one disables review: too much volume (consent fatigue, review becomes rubber-stamping) and missing context. Anthropic's own agentic research leans toward fewer step-by-step approvals and review concentrated at higher-value checkpoints (plan review, exceptions) — which is why Claude Code has plan-level approval.
3.6 Compliance: from obligation to evidenced controls D5
The route is a prerequisite, not proof. Every obligation becomes three things: a specific technical control, a named owner, and continuously updated evidence (the most commonly missing piece).
| Obligation | Control | Evidence | Owner |
|---|---|---|---|
| HIPAA PHI | HIPAA-ready plan or a BAA'd API; HIPAA settings on; only in-scope features | Signed BAA, admin-console config screenshot, compliant-feature list | Security lead |
| FedRAMP impact level | An authorized route meeting or exceeding the required level | Authorization record; proof the workload only runs in that environment | Platform lead |
| Data residency | In-region processing and storage, logs/cache/monitoring included | Residency config + a data-flow record of every copy | Data owner |
| Decisions reconstructable | Retained, queryable decision log | A reconstructed example from live logs | Architect |
Not used for training ≠ not retained. Data can be excluded from training and still be retained for logging, abuse prevention, or legal reasons.
Reviewers accept signed agreements, config screenshots, authorization records, or a log query that returns a result. They don't accept a design doc that names a control with no owner and no evidence (same logic as FIAR KSDs and A-123 testing).
Configurations drift; revalidate the register periodically. "A prompt instruction to handle health data carefully" is not HIPAA evidence. A BAA plus an enabled configuration is.
3.7 Assembling the safety stack (order matters)
- Draw the boundary: domain rules in the application layer; explicit rules into a deterministic rules engine; Claude drafts the explanation.
- Place input, output, and authorization controls; pick a check type for each; fail closed.
- Instrument the four fairness injection points, serving all audiences from one decision log.
- Route review by risk; pre-action approval for low-confidence, hard-to-reverse harm.
- Build the control register: obligation → control → owner → evidence.
Steps 3 and 4 depend on logging; step 5 depends on evidence from steps 2–4.
Your logged weak spots — Module 3
- Implement guardrails and safety controls: a Skill or prompt can't enforce; a hook or authorization can. Scope comes from the server-side session, never from a model-supplied tool parameter. Watch your pull toward detective controls (trace IDs, logging) when a preventive option is available.
- Ensure compliance with regulations: filter by authorization first. For CUI/FedRAMP, Claude Enterprise is excluded regardless of license count. Reason from the exam's rule, not "DoD already uses Bedrock."
- Identify risks, limitations, failure modes: drill the four model properties until they're reflexive.
Module 3 self-test
- Which layer enforces "never show tenant A's data to tenant B"? Why can't trained behavior do it?
- A RAG agent executes instructions hidden in a retrieved page. What risk is this, and where does the control sit?
- Name the three components of deterministic tool authorization.
- Your screening service times out at peak load and requests pass through anyway. What's wrong?
- A decision is high-confidence but irreversible and high-cost — route to a human? What variables decide it?
- What three things does every obligation in the register need?
中文要点
安全是分层体系。训练对齐只覆盖广泛有害内容;领域规则、租户隔离、授权必须在应用层实现。
间接 prompt injection 来自检索内容和工具输出,是 RAG/agent 的主要威胁,要在加入上下文前筛查。
三个控制点:输入筛查、输出筛查、工具调用授权。授权必须确定性(allowlist + 身份 + 范围)。自建护栏要 fail closed。
公平的四个注入点:语料、prompt 措辞、示例、下游路由。一份决策日志服务用户、监管、开发三类受众。
人工审核按风险(可逆性 + 错误成本)路由,置信度只决定数量。每项合规义务要有控制、负责人、证据。