---
title: AI Governance
summary: Input screening, privacy middleware, policy enforcement, and tool boundaries for BookWorm's AI workflows.
owners:
  - ai-capabilities-team
badges:
  - content: Cross-cutting Concept
    backgroundColor: purple
    textColor: purple
---

## Purpose and Scope

AI governance constrains prompts, models, agents, tool calls, and generated results across conversational discovery, review intelligence, and tool catalog capabilities. It applies wherever user text or external content crosses a model boundary or can trigger a state-changing action.

## Visual Reference

**AI Governance Guardrails**

<MermaidFileLoader file="mermaids/005-ai-governance-diagram-1.mmd" />

## Core Rules and Standards

1. **Screen before routing.** Validate prompt shape, length, language, domain scope, and known injection patterns before invoking a specialist agent or tool.
2. **Protect PII at model boundaries.** Anonymize sensitive data before external model calls and remove or redact sensitive content in returned results.
3. **Isolate untrusted content.** Treat prompts, retrieved passages, tool output, and external documents as untrusted data rather than instructions.
4. **Apply deny-by-default policies.** Every agent and tool must declare an allow rule; mutations and destructive operations require a specific policy grant.
5. **Bind actions to identity.** Session state and tool authorization must remain tied to authenticated caller claims and approved workload identity.
6. **Require human review for ambiguity.** Low-confidence or out-of-domain requests pause for clarification instead of guessing or escalating privilege.
7. **Record consequential decisions.** Preserve policy outcome, model and tool identifiers, correlation, redaction status, and human disposition for auditable events.

<Admonition type="warning">
	Prompt screening and PII detection reduce risk but do not guarantee safety. Novel prompt attacks,
	detector bypasses, or policy gaps require a human review and rapid rollback mechanism.
</Admonition>

## Mechanism / How It Works

| Governance Stage  | Required Behavior                                                                     |
| :---------------- | :------------------------------------------------------------------------------------ |
| Input admission   | Reject malformed, oversized, unsafe, or out-of-scope requests                         |
| Context isolation | Mark external text and tool output as data, never instructions                        |
| Privacy           | Anonymize PII and minimize retained conversation and prompt content                   |
| Routing           | Classify purpose and domain before selecting an agent or model                        |
| Policy            | Evaluate tool and operation permissions with deny-overrides semantics                 |
| Execution         | Use least-privilege tools, bounded retries, and session isolation                     |
| Review            | Escalate ambiguity, policy conflicts, or consequential actions to a responsible human |

## Evaluation and Fallback

- Evaluate prompt safety, domain classification, PII detection, tool authorization, output quality, and refusal behavior.
- Use deterministic tests for policy allow/deny decisions and adversarial tests for prompt and tool poisoning patterns.
- Fall back to a safe clarification or human handoff when routing confidence is low or policy state is uncertain.
- Disallow silent retries that change policy scope or expand tool permissions.
- Maintain an approved model, prompt, policy, and tool baseline for every release.

## Verification and Governance

- Test allow, deny, rate-limit, prompt-injection, PII, circuit-breaker, and human-handoff cases for every agent or tool change.
- Review policy coverage when a model or integration gains new data or mutation access.
- Verify that policy files and identity bindings load at runtime, not only during development.
- Define rollback criteria for quality regressions, privacy incidents, elevated false refusal rates, or unexpected tool use.

## Related Documentation

- [[doc|arc42/08-crosscutting-concepts/001-security-and-privacy]] — Identity and PII boundaries.
- [[doc|arc42/06-runtime-view/004-conversational-book-discovery]] — Conversational decision and tool flow.
- [[doc|misc/001-ms-decisions-model-use-case-and-lessons-learned]] — Model-routing rationale.
