Custom detectors
Custom detectors let you catch data that only your organization cares about: customer account numbers, internal project code names, part numbers, ticket IDs, unreleased product names. Define them in YAML, test them with the CLI, and refer to them in policies like built-in data classes.
Regex with a validator
Section titled “Regex with a validator”apiVersion: promptglass.ai/v1kind: Detectormetadata: name: acme-customer-accountspec: dataClass: acme.customer_account description: "Acme customer account numbers (AC-########-C)" pattern: '\bAC-\d{8}-[0-9X]\b' validator: type: mod11 # luhn | mod11 | mod97 | iban | custom-wasm context: words: [account, customer, acct, "client id"] window: 60 # characters on either side required: false # when true, a match without context is dropped boost: high # confidence when context is present allowlist: ["AC-00000000-0"]Dictionary
Section titled “Dictionary”kind: Detectormetadata: { name: project-codenames }spec: dataClass: acme.codename dictionary: caseSensitive: false wholeWord: true terms: [Bluefin, Kestrel, "Project Atlas", Nightjar] minCount: 1Dictionaries can hold hundreds of thousands of terms. They compile to an Aho-Corasick automaton, so lookup cost doesn’t grow with dictionary size.
Keyword proximity
Section titled “Keyword proximity”Finds documents that talk about a sensitive topic without fixed identifiers:
kind: Detectormetadata: { name: unreleased-earnings }spec: dataClass: business.financials.unreleased proximity: all: [[revenue, EBITDA, "gross margin", guidance], [Q1, Q2, Q3, Q4, FY2026, FY2027]] any: [draft, "not for distribution", preliminary] window: 200Custom ML classifier
Section titled “Custom ML classifier”Upload labeled examples (at least 50 positive and 50 negative) under Detection → Classifiers → New. PromptGlass fine-tunes a small text classifier inside your tenant. Your examples never leave your deployment, and they are never used to train anyone else’s models. Refer to the classifier as classifier: <name> in a detector.
Test and apply
Section titled “Test and apply”promptglass detector apply -f detectors/promptglass detector test acme-customer-account --file samples/ticket.txtpromptglass detector test --all --corpus ./regression-corpus/ # precision/recall reportKeep detector files in Git next to your policies. A CI job that runs promptglass detector test --corpus before apply catches regressions early.