Create a Prompt-based File Classifier

Define a file classifier using natural language. No training required.

Getting Started

Nightfall provides 20+ pre-built file classifiers out of the box, covering common sensitive document types such as contracts, background checks, financial records, and HR documents.

In some cases, customers need to protect business-critical document types that don’t fit a standard document type—or require more precision than a general-purpose classifier provides.

A Prompt-Based File Classifier lets you define these custom document types using a natural language description of the document’s purpose, content, and context. Nightfall then classifies entire files based on intent, structure, and meaning.

Important Note: The detector supports scanning Files, Attachments, and Email Bodies only. We will be adding support for message and field scanning in 2026.

To create a prompt-based entity detector, navigate to Detection → Detectors, then click + Custom Detector in the upper-right corner and select File Classifier (Prompt-Based) from the menu.

This opens the Prompt-Based Entity Detector design tab, shown below.

How Nightfall Interprets File Classifier Prompts

Prompt-based file classifiers use an LLM to evaluate the entire document and determine whether it matches the document type you describe.

Accuracy improves when you clearly describe what the document is, what it typically contains, the context in which it’s used, and what should not be classified as a match.

Understanding Prompts, Keywords, and Sample Files

Prompt-based file classifiers use three primary inputs:

  • Prompt – describes the type of document to detect

  • Keywords – important terms commonly found in the document

  • Sample File – a sanitized, representative example of the document. A template or form is OK.

Together, these inputs help Nightfall reliably classify documents with high precision.

Prompt

The Prompt describes the document type you want to classify. It should focus on intent and structure, not individual sensitive entities.

A strong prompt typically includes:

  • Document type (what the file represents)

  • Purpose of the document

  • Key sections or information types

  • Typical use cases or workflows

  • What should not be considered this document type

Prompt example

Custom Mortgage Application

Detect a completed mortgage application form.

This document collects borrower personal information, employment details, income, assets and liabilities, property information, and loan request details.

It is used during the mortgage origination process and does not include finalized loan agreements or closing disclosures.

Keywords

Keywords help reinforce classification by highlighting terms commonly found in the document.

Keywords should:

  • Be comma-separated

  • Reflect section headers, labels, or repeated concepts

  • Be descriptive but not overly specific

Example keywords

Custom Mortgage Application

Sample File

The Sample File provides Nightfall with a concrete example of the document type you want to classify.

Best practices for sample files:

  • Use a realistic but sanitized document

  • Include representative sections and structure

  • Avoid production secrets or live customer data

  • Upload a single, complete document (PDF, XLSX, etc.)

The sample file is used only to guide classification and improve precision.

Test Prompt

Once you are satisfied with the classifier definition, click Test Prompt to run a prompt hygiene check.

During this check, Nightfall evaluates the Prompt, Keywords, and Sample File together to confirm that the classifier can accurately identify the document type and meet Nightfall’s detection quality standards.

If the prompt passes the hygiene check, the file classifier can be:

  • Added to your Custom Detectors list

  • Used in a Detection Rule

  • Included in a Policy for monitoring, alerting, or enforcement

If the prompt does not pass, Nightfall will guide you to improve it by:

  • Clarifying the document intent

  • Adjusting keywords

  • Providing a more representative sample file

This ensures that file classifiers are precise, reliable, and safe to deploy in production environments.

Sample Prompt and Files

Last updated

Was this helpful?