This prompt is designed for compliance officers and privacy engineers who must respond to a formal Data Subject Access Request (DSAR) by locating every instance of a specific individual's data within an AI system's production traces. The core job-to-be-done is not real-time redaction or data deletion, but forensic discovery: producing a comprehensive, auditable inventory of trace spans that contain the subject's information. The ideal user has access to a pre-extracted, structured dataset of trace spans—typically exported from an observability platform—and needs to map those spans to data categories, processing purposes, and retention statuses to demonstrate regulatory compliance.
Prompt
Data Subject Access Request Trace Audit Prompt

When to Use This Prompt
Defines the job-to-be-done, the ideal user, required context, and critical limitations for the DSAR trace audit prompt.
You should use this prompt when you have already isolated a set of candidate trace spans for a given data subject identifier (such as a user ID, email, or device fingerprint) and need to classify the data within them. The prompt assumes the input is a well-formed list of trace spans, each with a unique ID, timestamp, and raw content. It is not a search engine; do not use it to scan unstructured log files or to perform the initial identifier matching. The output is a structured inventory that can be directly attached to a DSAR response package or fed into a governance, risk, and compliance (GRC) tool. This workflow is high-stakes, so every output must be treated as a draft requiring human review before it is shared externally.
Do not use this prompt as a substitute for a proper data catalog, a real-time data redaction pipeline, or an automated deletion mechanism. It will not catch data that exists outside the provided trace spans, such as information in application databases, backup snapshots, or third-party sub-processor logs. If the trace data is incomplete or the subject identifier matching was flawed, the audit will be incomplete. Always pair this prompt with a rigorous upstream data extraction process and a downstream human-in-the-loop review step to verify findings, especially for data categories classified as 'sensitive' or 'restricted'.
Use Case Fit
Where the DSAR Trace Audit Prompt works and where it introduces operational risk. Use these cards to decide if this prompt fits your compliance workflow before wiring it into production.
Good Fit: Structured Trace Systems
Use when: your production traces include structured span attributes (user ID, email, device fingerprint) and are queryable by subject identifier. Guardrail: pre-filter traces to the subject's known identifiers before invoking the prompt to keep the context window focused and reduce hallucination risk.
Bad Fit: Unstructured Log Files
Avoid when: the only available data is raw, unstructured application logs without consistent subject identifiers. The prompt relies on trace-span structure for accurate matching. Guardrail: run a structured extraction prompt first to normalize logs into trace spans before attempting DSAR audit.
Required Inputs
What you need: a verified data subject identifier (email, user ID, or device fingerprint), access to production trace storage with retention covering the request window, and a data category taxonomy. Guardrail: validate the subject's identity through your standard DSAR verification process before feeding identifiers into the prompt.
Operational Risk: Incomplete Coverage
What to watch: the prompt only audits traces that exist. If certain processing systems don't emit traces, or traces were purged per retention policy, the inventory will be incomplete. Guardrail: append a coverage disclaimer to the output listing known trace gaps and retention windows so the compliance officer understands the audit's boundaries.
Operational Risk: Identifier Drift
What to watch: a subject may appear under multiple identifiers (old email, guest session, SSO change) that aren't linked in your identity graph. The prompt will miss these unless all aliases are provided. Guardrail: resolve all known subject aliases through your identity provider before trace search, and include an alias list in the prompt input.
Operational Risk: Over-Reporting
What to watch: fuzzy identifier matching can pull in traces from other subjects with similar IDs, inflating the DSAR response and potentially exposing third-party data. Guardrail: use exact-match filtering at the query layer before the prompt runs, and add a post-processing deduplication step keyed on trace ID.
Copy-Ready Prompt Template
A reusable prompt template with square-bracket placeholders for auditing production traces to locate all occurrences of a data subject's information.
This template is designed to be pasted directly into your orchestration layer. It instructs the model to act as a privacy compliance auditor, searching a provided set of production trace spans for any information related to a specific data subject. The prompt uses square-bracket placeholders for all dynamic inputs, such as the subject's identifiers, the trace data itself, and the required output format. This ensures the instruction logic remains stable while the data changes with each DSAR request.
textYou are a meticulous privacy compliance auditor. Your task is to search the provided production trace data for all occurrences of information related to a specific data subject, in response to a Data Subject Access Request (DSAR). You must identify the subject using the following identifiers: [SUBJECT_IDENTIFIERS] Analyze the trace spans provided below. For each span that contains a match, extract the required details and format your entire response as a single JSON object conforming to the specified schema. [TRACE_DATA] [OUTPUT_SCHEMA] Follow these constraints strictly: [CONSTRAINTS] Here are a few examples of correct input-output pairs: [EXAMPLES] Before producing the final output, use the following tools for validation: [TOOLS] This task is classified as [RISK_LEVEL] risk. Ensure your analysis is thorough and your output is strictly validated.
To adapt this template, replace each bracketed placeholder with concrete values for your system. [SUBJECT_IDENTIFIERS] should be a structured list of known IDs, emails, and device fingerprints. [TRACE_DATA] is the raw JSON or text of the trace spans to audit. [OUTPUT_SCHEMA] must be a strict JSON Schema defining the inventory fields (e.g., data category, processing purpose, retention status). [CONSTRAINTS] should include rules like 'do not include spans with no match' or 'redact PII in the output log'. [EXAMPLES] and [TOOLS] are optional but critical for improving accuracy. For high-risk DSARs, always set [RISK_LEVEL] to 'high' and ensure a human reviews the final inventory before it is sent to the data subject.
Prompt Variables
Inputs required by the Data Subject Access Request Trace Audit Prompt. Each placeholder must be resolved before the prompt is sent. Validation notes describe how to confirm the input is well-formed and safe.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[SUBJECT_IDENTIFIER] | The data subject's primary identifier to search for across all trace spans. | user_829104 or jane.doe@example.com | Must be non-empty. Validate format against known ID patterns (UUID, email regex, or tenant-prefixed ID). Reject wildcards unless explicitly approved. |
[IDENTIFIER_TYPE] | The category of the subject identifier to control matching logic. | email, user_id, device_fingerprint, account_number | Must match an allowed enum in the harness. Reject unknown types to prevent overly broad or incorrect matching. |
[TRACE_SOURCE] | The system or database containing the production traces to audit. | s3://traces-2025-03/ or datadog_logs_index:prod-llm | Must be a valid, accessible path or connection string. Harness should verify read permissions and that the source is within the retention window before execution. |
[TIME_RANGE_START] and [TIME_RANGE_END] | The inclusive UTC time window for the DSAR scope. | 2025-03-01T00:00:00Z and 2025-03-31T23:59:59Z | Must be ISO 8601. End must be after start. Range must not exceed the maximum query window defined in the harness config. Null start means 'beginning of retention'; null end means 'now'. |
[DATA_CATEGORIES] | The list of data categories the subject is requesting, used to filter relevant spans. | ["profile", "purchase_history", "support_tickets"] | Must be a valid JSON array of strings. Each string must match a category in the organization's data inventory. Reject empty arrays. |
[OUTPUT_SCHEMA] | The exact JSON schema each trace finding must conform to. | {"type": "object", "properties": {"span_id": {"type": "string"}, "data_category": {"type": "string"}, "processing_purpose": {"type": "string"}, "retention_status": {"type": "string"}}, "required": ["span_id", "data_category", "processing_purpose", "retention_status"]} | Must be a valid, parseable JSON Schema. Harness must validate the schema itself before using it to validate the model's output. Reject schemas that lack required fields for audit evidence. |
[RETENTION_POLICY_MAP] | A mapping from data categories to their declared retention periods for compliance checking. | {"profile": "7_years_active", "support_tickets": "3_years_then_archive"} | Must be a valid JSON object. Each key must match a value in [DATA_CATEGORIES]. Values must be non-empty strings. Used to flag spans where data exceeds its retention period. |
[APPROVAL_THRESHOLD] | The minimum confidence score for automated inclusion. Findings below this threshold are flagged for human review. | 0.85 | Must be a float between 0.0 and 1.0. Harness should default to 0.90 if not provided. A value of 1.0 forces all findings to human review. |
Implementation Harness Notes
How to wire the DSAR trace audit prompt into a production compliance workflow with validation, human review, and evidence packaging.
This prompt is not a standalone chat interaction. It is a batch processing step inside a larger Data Subject Access Request (DSAR) fulfillment pipeline. The harness must feed the prompt structured trace data, enforce output schema compliance, and package results for a human compliance officer who will make the final disclosure decision. Treat the model as an evidence collector and organizer, not as the final authority on what gets released to the data subject.
The implementation loop follows a clear pattern: fetch traces → assemble prompt → validate output → human review → package report. Start by querying your observability platform (LangSmith, Arize, Datadog LLM, or custom trace store) for all spans matching the subject identifier across user IDs, emails, and device fingerprints. De-duplicate and sort spans by timestamp before injecting them into the [TRACE_SPANS] placeholder. The prompt expects each span to include span_id, timestamp, operation, input_summary, output_summary, data_categories_observed, retrieval_sources, and tool_calls. If your trace schema differs, add a pre-processing step that normalizes fields before prompt assembly. Run the prompt with a low-temperature model (0.0–0.2) to maximize deterministic inventory behavior. After generation, validate the JSON output against the expected schema: every entry must have data_subject_identifier, span_id, data_categories, processing_purpose, retention_status, and disclosure_recommendation. Reject and retry any response that fails schema validation or contains unresolved placeholders. Log every run with the trace batch ID, model version, prompt version, and validation result for auditability.
Human review is mandatory before any data is disclosed to the data subject. Route validated outputs to a review queue where a compliance officer can inspect each trace-span entry, override the disclosure_recommendation field, and add notes. The review interface should highlight spans where data_categories includes sensitive or third-party-shared, and flag any span where retention_status is unknown or past-policy. Only after human sign-off should the inventory be assembled into the final DSAR response package. Never automate disclosure directly from model output. For high-volume DSAR operations, consider caching trace inventories per subject identifier with a TTL that matches your regulatory response window, and re-run the prompt only when new traces appear. Avoid running this prompt on raw, unsanitized trace data that includes full message bodies—pre-summarize inputs and outputs to minimize the risk of exposing one data subject's information to the model in the context of another subject's request.
Expected Output Contract
Defines the required fields, types, and validation rules for the DSAR trace audit output. Use this contract to parse, validate, and store the structured findings before presenting them to the compliance officer.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
subject_identifier | object | Must contain the queried [SUBJECT_ID] and the matched [IDENTIFIER_TYPE]. Validate that at least one match field (user_id, email, device_fingerprint) is populated. | |
trace_inventory | array of objects | Must not be empty if the subject is found. Each item must have a unique trace_span_id. Schema check: reject if any required sub-field is missing. | |
trace_inventory[].trace_span_id | string (UUID format) | Must match UUID v4 regex. Parse check: reject non-conforming strings. Must be unique within the inventory array. | |
trace_inventory[].timestamp | string (ISO 8601) | Must be a valid ISO 8601 date-time string. Parse check: reject unparseable dates. Must be in the past relative to the audit execution time. | |
trace_inventory[].data_category | string (enum) | Must be one of: 'PII', 'PHI', 'PCI', 'CREDENTIALS', 'BEHAVIORAL', 'COMMUNICATION', 'OTHER'. Schema check: reject unknown categories. | |
trace_inventory[].processing_purpose | string | Must not be null or empty. Must map to a declared purpose in the organization's data processing registry. Approval required if purpose is 'UNKNOWN'. | |
trace_inventory[].retention_status | string (enum) | Must be one of: 'ACTIVE', 'EXPIRED', 'DELETED', 'ANONYMIZED', 'UNKNOWN'. If 'UNKNOWN', the finding must be flagged for human review. | |
trace_inventory[].data_excerpt | string or null | If present, must be a snippet of the raw trace data containing the subject's information. Null allowed if the data is already redacted. If not null, a confidence threshold of >0.9 for PII match is required. |
Common Failure Modes
DSAR trace audits fail silently when subject matching is incomplete, data categories are misclassified, or retention status is assumed rather than verified. These are the most common production failure modes and how to prevent them.
Incomplete Subject Identity Resolution
What to watch: The prompt matches on a single identifier (e.g., email) but misses the same subject's traces under a different user ID, device fingerprint, or pseudonymized token. The resulting inventory is incomplete, creating compliance exposure. Guardrail: Require the prompt to expand the subject identifier set before searching. Input schema must accept multiple identifier types, and the harness should pre-resolve known aliases from an identity graph before trace scanning begins.
Data Category Misclassification
What to watch: The model labels a field as 'contact information' when it contains behavioral data, or classifies inferred attributes as directly provided data. This corrupts the processing purpose mapping and retention justification. Guardrail: Provide a closed taxonomy of data categories in the prompt with definitions and boundary examples. Add a post-processing validator that flags any category not in the allowed enum and routes ambiguous spans to human review.
Retention Status Assumed Instead of Queried
What to watch: The prompt infers retention status from data age or storage location rather than checking the actual retention policy attached to that data class. This produces a false 'eligible for deletion' or 'retained per policy' status. Guardrail: The prompt must output a retention status field with a required evidence source—either a policy reference, a system metadata flag, or an explicit 'unable to determine' value. Never permit the model to guess retention from timestamps alone.
Trace Span Scope Creep
What to watch: The audit pulls in spans that reference the subject indirectly—such as retrieved documents mentioning the person, or tool-call arguments containing their data in a batch—without distinguishing between the subject's own data and data about the subject held by others. Guardrail: Add a 'relationship to subject' field in the output schema with values like 'directly provided by subject', 'generated about subject', 'retrieved context mentioning subject', and 'unknown'. This forces the model to classify provenance, not just presence.
Silent Omission of Unstructured Trace Data
What to watch: The prompt scans structured fields and log messages but skips free-text generation outputs, error messages, or conversation turns where the subject's data appears in natural language. These are the most common sources of missed PII in DSAR responses. Guardrail: Explicitly instruct the prompt to scan all span attributes, not just typed fields. Include a checklist in the prompt: user input, model output, tool arguments, tool results, error messages, and intermediate reasoning if captured.
Processing Purpose Mapped to System Instead of Activity
What to watch: The prompt assigns the processing purpose based on which system stored the data (e.g., 'CRM system' → 'customer support') rather than the actual processing activity observed in the trace. This misaligns the DSAR response with the Article 30 record. Guardrail: Require the prompt to derive processing purpose from the trace context—what the model was doing with the data at that moment—not from the storage location. Include a 'purpose confidence' field, and route low-confidence classifications to a privacy officer for review.
Evaluation Rubric
Criteria for evaluating the quality of a DSAR trace audit output before releasing it to a compliance officer or data subject. Each row defines a pass standard, a failure signal, and a concrete test method.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Subject Identifier Recall | All trace spans containing the [SUBJECT_IDENTIFIER] in user IDs, emails, or device fingerprints are included in the inventory. | A known test trace with the subject's email is missing from the output inventory. | Inject a golden trace with the subject's email and verify the span ID appears in the output. |
Data Category Coverage | Every span in the inventory has a non-null [DATA_CATEGORY] field from the allowed taxonomy (e.g., PII, PHI, PCI, credentials). | A span is listed with a null, empty, or out-of-taxonomy [DATA_CATEGORY] value. | Parse the output JSON and assert all [DATA_CATEGORY] values are in the approved enum list. |
Processing Purpose Mapping | Each span's [PROCESSING_PURPOSE] maps to a declared purpose from the organization's ROPA or privacy notice. | A span has a purpose like 'unknown', 'misc', or a purpose not in the approved list. | Cross-reference output [PROCESSING_PURPOSE] values against a static allowed-purposes list. |
Retention Status Accuracy | Each span's [RETENTION_STATUS] reflects the current state: 'active', 'expired', 'deleted', or 'unknown' with a justification. | A span known to be in a deleted partition is marked 'active', or a live span is marked 'deleted'. | Use a trace with known TTL metadata and assert the output [RETENTION_STATUS] matches the expected state. |
Span Completeness | Every inventory entry includes [SPAN_ID], [TIMESTAMP], [DATA_CATEGORY], [PROCESSING_PURPOSE], and [RETENTION_STATUS]. | An entry is missing one or more required fields. | Validate the output against a JSON Schema that requires all five fields for each item in the inventory array. |
False Positive Rate | No spans are included that do not contain the [SUBJECT_IDENTIFIER] or a derivative of it. | A span for a different user with a similar name or ID is incorrectly attributed to the subject. | Run the prompt against a trace set with a known non-subject user and assert the output inventory is empty. |
Timeline Ordering | The inventory is sorted by [TIMESTAMP] in ascending order to support chronological review. | Entries are out of order, making it difficult to reconstruct the data processing timeline. | Extract all [TIMESTAMP] values from the output array and assert they are monotonically increasing. |
Uncertainty Flagging | Any span where data category or retention status is ambiguous includes an [UNCERTAINTY_FLAG] set to true with a [NOTES] field explaining the ambiguity. | An ambiguous span is presented with high confidence and no qualification, misleading the reviewer. | Include a trace with an obfuscated email hash and assert the output has [UNCERTAINTY_FLAG] = true and a non-empty [NOTES]. |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Use the base prompt with a single trace file and manual review. Replace [SUBJECT_IDENTIFIER] with a known test email or user ID. Skip retention status lookups and focus on trace-span inventory with data categories and processing purpose. Accept JSON output without strict schema enforcement.
Watch for
- False negatives on partial matches (e.g., email in a different case or with whitespace)
- Overly broad matches that flag system IDs as subject data
- Missing device fingerprint correlation when only email is provided

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us