Sub topic 15
Audit trail and feedback data
What this chapter covers
This chapter assumes you know the Trust Layer pipeline from the earlier chapters. That covers grounding, masking, the LLM gateway, toxicity detection, and demasking. It also assumes you can read Salesforce objects and permission sets. Here we look at the last recorded step: what the Trust Layer logs about each interaction, what feedback data users and admins can add, and what you can and cannot learn from those records.
In the pipeline from the spine, the audit trail comes after demasking and before the response is shown to the user. Its job is to leave evidence. If someone asks "what did the agent send to the model, and what came back?", the audit trail is where you look.
Why an audit trail matters
Zero data retention means the model provider does not keep your prompts or responses. That protects your data at the provider. It also means the provider cannot help you reconstruct what happened. Salesforce has to keep that record on your side of the boundary.
An audit trail supports four common needs:
- Investigation. A user reports a wrong or odd answer. You need the prompt and the response.
- Compliance review. An auditor asks how customer data was used with generative AI.
- Tuning. You want to know whether masking, toxicity scoring, or grounding behaved as designed.
- Quality improvement. You want to see which responses users accepted and which they rejected.
What gets recorded
The audit trail stores data about each generative AI interaction. The exact fields depend on the feature and the release, so check the current Salesforce documentation for your org. In general, the record covers these items.
| Item | What it tells you |
|---|---|
| Original prompt | The grounded prompt before masking, with real CRM values |
| Masked prompt | What was actually sent to the model, with placeholders |
| Raw response | What the model returned, before demasking |
| Demasked response | What the user saw |
| Toxicity scores | The category scores for the response |
| Feature and model details | Which feature produced the prompt and which model handled it |
| Timestamps and user | When the request ran and who ran it |
Comparing the original prompt and the masked prompt is the quickest way to check masking. If an email address appears in the masked prompt, masking did not catch it. That points to a configuration gap or to a value the detector does not recognize.
Where the data is stored
Audit and feedback data is stored in Data 360 (formerly Data Cloud), not in ordinary custom objects. This has practical effects:
- Data 360 must be set up in the org before the audit trail can collect data.
- The records are held as Data 360 objects, so you query them with Data 360 tools, such as reports, dashboards, and queries over data model objects. You do not query them with a standard SOQL report on a custom object.
- Access is controlled by Data 360 permissions. Not every admin or user can see the prompts, and they should not be able to. Prompts can contain the very CRM data you worked to protect.
Retention
The audit data follows a retention period. Salesforce documents a default retention period for audit and feedback data, and the period can differ by edition and release. Treat retention as a question to verify, not an assumption. If your compliance rules require records for a set number of years, confirm whether the default meets them. If it does not, plan to export the data on a schedule.
Feedback data
Feedback data is what people say about a response. It comes in two forms.
- Explicit feedback. A user clicks a thumbs-up or thumbs-down on a response, and sometimes adds a comment. Admins can enable feedback collection for prompt templates and some features.
- Implicit signals. The system records whether the user accepted, edited, or discarded the generated text, where the feature supports it.
Feedback is stored alongside the audit record. That link is the useful part. A thumbs-down alone says little. A thumbs-down joined to the exact prompt, the masked version, the toxicity scores, and the model used lets you find the cause.
Feedback is a privacy surface too
A free-text comment can contain personal data, because users type whatever they like. Do not assume feedback is safe to share widely. Apply the same access controls you use for prompts.
Using the data as an admin
A practical review routine looks like this:
- Pick a time window and a feature, for example the case summary prompt over the last two weeks.
- Filter for thumbs-down responses and for responses with elevated toxicity scores.
- For each item, compare the original prompt, the masked prompt, and the response.
- Decide what failed: the grounding data was wrong, masking missed a value, the prompt template was vague, or the model answered poorly.
- Fix the cause, then recheck the same feature after a week.
The next-to-last step matters most. The audit trail points at the failing stage, but the fix often sits outside the Trust Layer. A bad summary caused by a case with empty fields is a data quality problem. Changing toxicity settings will not help.
A sample analysis query
The exact object and field names depend on your Data 360 setup, so the names below are placeholders. The shape of the query is what matters: join feedback to the generation record, then filter.
SELECT
g.GenerationId__c,
g.FeatureName__c,
g.MaskedPrompt__c,
f.Feedback__c,
f.FeedbackDetail__c
FROM GenAIGeneration__dlm AS g
JOIN GenAIFeedback__dlm AS f
ON f.GenerationId__c = g.GenerationId__c
WHERE f.Feedback__c = 'BAD'
AND g.FeatureName__c = 'CaseSummary'
ORDER BY g.GenerationId__cGotchas and limits
- The audit trail records. It does not block. It cannot stop a bad response. Blocking, if any, happens earlier in the pipeline.
- A missing record is a signal. If an interaction you expected has no entry, check whether the feature is covered by the audit trail and whether it is enabled. Coverage can vary by feature and release.
- Masked is not the same as removed. The masked prompt still holds the non-sensitive context. It is safe to send to a model, but you should still treat it as business data.
- Logging adds a second copy of sensitive data. The original prompt is stored on the Salesforce side. This is intended, but it means the audit store is now something you must protect, retain, and delete under your own policies.
- Deletion requests. If a customer asks for their data to be erased, check whether prompts that mention them live in the audit store. Your privacy process should cover it.
- Sampling the data is not enough. Reading five examples shows what went wrong once. Count across the window to see whether it is a pattern.
Shared responsibility
Salesforce provides the recording mechanism. You decide who reads the records, how long you keep them, and what you do with the findings. An audit trail nobody reviews offers no protection. A reviewed one turns the Trust Layer from a black box into something you can check.
Exercise
A user gives a thumbs-down to a case summary that included the wrong customer name. In the audit trail, the original prompt contains the correct name, and the masked prompt contains PERSON0 in its place. The raw response also contains PERSON0. Where did the problem most likely arise, and why?
Show answer
Probably not in masking or in the model. The original prompt had the correct name and masking replaced it consistently, and the raw response used the same placeholder. If the error appeared only in the text shown to the user, look at demasking, because the placeholder-to-value mapping is the step that turns PERSON_0 back into a name. Also check whether the grounded prompt held several names, such as an account contact and a case contact, and whether the placeholders were mapped to the right one. Comparing the demasked response with the original prompt is the next check.
Exercise
Your compliance team asks whether the model provider can show what prompts your org sent last month. What should you tell them, and where would you look instead?
Show answer
With zero data retention the provider does not keep prompts or responses, so it cannot supply them. The record is kept on the Salesforce side in the audit trail, stored in Data 360. Confirm that the audit trail is enabled for the features in question, that the retention period covers last month, and that the person running the query has Data 360 access to the audit data.