Policy reference
This page documents every key in a PromptGlass Policy resource. Policies are applied with promptglass policy apply -f <file> or edited in the console. Unknown keys are rejected at apply time.
Top level
Section titled “Top level”apiVersion: promptglass.ai/v1kind: Policymetadata: name: string # unique, kebab-case description: string labels: { key: value }spec: priority: 100 # lower runs first when several policies apply to a user appliesTo: # optional; default = everyone groups: [string] # IdP group names or IDs departments: [string] excludeGroups: [string] defaults: storage: full | redacted | metadata-only | hashed on_error: fail_open | fail_closed retention: 90d rules: [Rule] exceptions: [Exception]- name: string # required, unique within the policy mode: enforce | shadow # default enforce match: Match # omitted = match everything action: allow | log | coach | redact | block | route | alert message: string # shown for coach/block; supports {{app}}, {{data_classes}}, {{approved_app}} offer: { app: string, url: string } # suggested alternative (coach/block) allowOverride: true # coach only: user may continue with a reason redact: style: token | mask | remove # [PERSON_1] | ****** | (deleted) restoreInResponse: true route: target: string # gateway target name keepModelFamily: true alert: channels: [siem, slack:#ai-risk, teams:AI Governance, servicenow, webhook:name] severity: low | medium | high | critical throttle: 1h # per user+rule storage: full | redacted | metadata-only | hashed # overrides defaults retention: 30d on_error: fail_open | fail_closedAll conditions in a match must be true (AND). List values inside a condition are OR’d. Wildcards (*) are supported in names.
match: sensor: [gateway, extension, agent, connector] app: [chatgpt-personal, claude-*, "category:ai-coding"] appRisk: { min: high } # from the AI app catalog sanctioned: false # app not on your approved list model: [gpt-4o, "claude-*"] direction: prompt | response | upload | paste data_class: [pii.*, phi.*] min_confidence: low | medium | high min_count: 1 topic: [legal-contract-review, hr-performance] file: types: [xlsx, csv, pdf] min_size: 1MB label: [Confidential, "Highly Confidential"] users: [alice@example.com] groups: [Finance] departments: [Legal] devices: { managed: false } network: { cidrs: [10.0.0.0/8], outside: false } time: { days: [Mon-Fri], hours: "08:00-18:00", tz: "America/Toronto" } budget: { scope: team, exceeded: true } tokens: { min: 50000 } # very large promptsException
Section titled “Exception”Exceptions are time-boxed waivers. They require an approver and are audited.
exceptions: - rule: block-source-code-public-ai groups: [OSS-Maintainers] reason: "Upstream open-source contributions" approvedBy: ciso@example.com expires: 2027-03-31Storage modes
Section titled “Storage modes”| Mode | Prompt/response stored | Detections stored | Searchable |
|---|---|---|---|
full |
Yes, encrypted | Yes | Full text, permissioned |
redacted |
Yes, with sensitive spans replaced | Yes | Redacted text |
metadata-only |
No | Yes (class, counts) | Metadata only |
hashed |
SHA-256 of normalized text only | Yes | Duplicate detection only |
Validation
Section titled “Validation”promptglass policy lint -f policies/ # schema + unreachable-rule warningspromptglass policy test -f policies/ --text "…" --user bob@example.com --app chatgpt-personalpromptglass policy simulate -f policies/ --since 14d --report out.htmllint warns about rules that can never match because an earlier terminal rule always wins, and about route targets that don’t exist.