Notes
The idea
Start with the flow. A user types a message into your app. Your app wraps it in a system prompt, adds retrieved documents and tool results, maybe a file, and sends the lot to a model provider. All of that leaves your boundary. The user typed one sentence, but the prompt might hold their address and order history. Privacy work starts by knowing exactly what is in each prompt.
- the user's message
- system prompt and examples
- retrieved documents
- tool results (orders, CRM)
- uploaded files and images
- metadata: user id, IP
- every one may hold personal
- data you are responsible for
What they may keep
So what does the provider keep? Three questions. How long are inputs and outputs retained, and why? Often around thirty days for abuse monitoring. Are they used to train future models? Business API terms usually say no by default, while consumer chat apps often train unless you opt out. Is zero data retention available? Many providers offer it by agreement. And watch stored features like uploaded files or saved threads, which keep data until you delete them.
- retention: how long are inputs and outputs kept? why? (often ~30 days, abuse checks)
- training: used to train models? business APIs: usually no consumer apps: often opt-out zero retention: available by agreement for some endpoints
- stored features: files, threads, batch jobs keep data longer
Minimise, then mask
First, minimise. For every field, ask whether the model needs it. A ticket summariser needs the complaint, not the phone number. Then mask what is left. Here, three items are found: a name, an email and a phone number. Each becomes a placeholder, and the mapping stays in your app for this one call. The order number stays, because the model needs it. When the reply says name one, you swap the real name back in.
in: I am Priya Shah, priya@mail.com,
+91 98200 12345. Order 7781 lost.
out: I am [NAME_1], [EMAIL_1],
[PHONE_1]. Order 7781 lost.
map, kept in your app for this call:
NAME_1 → Priya Shah
EMAIL_1 → priya@mail.com
PHONE_1 → +91 98200 12345
reply: Sorry [NAME_1], ...
restore: Sorry Priya Shah, ... Secrets
Secrets are a separate problem. Never put an API key, a database password or an access token in a prompt. Anything in the context can be repeated back, logged by someone, or pulled out by a prompt injection. Instead, the model asks for a tool, and your tool code fetches the credential from a vault at run time. Scan logs for secret patterns, and if a key leaks, rotate it. Deleting the log line is not enough.
- no API keys, passwords or tokens in prompts: anything in context can be repeated
- tools fetch credentials from the vault at run time
- scan prompts, outputs and logs for secret patterns
- a leaked key gets rotated, not just deleted from logs
Logs and caches
Your own systems are often the bigger leak. One prompt gets copied into traces, error trackers, analytics, a response cache, and later into eval sets and fine tuning data. Each copy needs rules. Redact before writing, set an expiry measured in days, and limit who can read it. Watch semantic caches especially. If the cache key ignores the user, one customer can get an answer built from another customer's data.
- traces and debug logs
- error trackers and analytics
- response and semantic caches
- eval sets and fine-tune data
- rules for every copy:
- redact before writing
- expiry (days, not forever)
- access by role, not everyone
- cache keys include the user
Keep users apart
Retrieval is where data most often crosses between users. Tag every chunk with its tenant, owner and allowed groups. At query time, filter inside the vector search using the identity from the login session, never from the model. A prompt saying only use Alice's documents is not access control, because the model can be talked out of it. Memory works the same way: per user, viewable and deletable by them.
- tag every chunk: tenant_id, owner, allowed groups
- filter inside the search, from the session identity
- never "please only use Alice's docs" in a prompt
- big tenants: own namespace
- memory: per user, viewable, deletable by that user
Data residency
Some customers and laws require data to stay in a region. Ask four questions. Where does inference run? Where are logs and uploaded files stored? Where are backups? And who can access the data from abroad, including support staff and sub-processors? Many providers sell regional endpoints. But residency covers every copy, so your vector database, your traces and your caches must sit in the same region too.
- where does inference run?
- where are logs and files kept?
- where are backups?
- who can access from abroad (support, sub-processors)?
- many providers sell regional
- endpoints; check every store, your vector DB and logs too
Right to deletion
When a user asks to be deleted, the request must reach every copy. Here, user forty two has three documents, which became two hundred and twelve vector chunks, plus eighteen cache entries, nine memory facts, traces and two files at the provider. Embeddings count as personal data, because research shows the text can often be largely rebuilt from them. Data baked into a fine tuned model is very hard to remove, so avoid training on it.
source docs 3 deleted vector chunks 212 deleted semantic cache 18 entries chat memory 9 facts traces purged by user id provider files 2 deleted backups expire within 35 days eval / tune sets check, then drop embeddings ARE personal data: text can be largely rebuilt
Consent and notice
Be open with users. Tell them when they are talking to an AI. Explain in plain words what data is sent, to what kind of provider, and why. Ask before using their conversations to improve your models, and make that a real choice, not a pre-ticked box. Data collected for one purpose should not quietly be reused for another. Label AI generated content, and offer a way to reach a person.
- say they are talking to AI
- name what data is sent, to which kind of provider, why
- opt in before using their data to improve models
- one purpose per consent; no silent reuse later
- label AI-generated content
- offer a route to a human
Audit logs
An audit log answers a different question from a debug log: who accessed which data, when, and was it allowed? Each record holds the time, the actor, the action, the ids of the data touched, which model and region served it, and the policy decision. Store ids rather than raw prompt text, so the audit log is not itself a new privacy risk. Make it append only and tamper evident.
time 2026-03-04T10:22Z actor user 42 (support agent) action rag.search + summarise data ticket 9913, chunks 4 model frontier, eu region policy pii masked, allowed append-only, tamper-evident, ids not raw prompt text, kept as long as policy says
Data protection laws
You do not need to be a lawyer, but know the shape. GDPR style laws, in Europe, the United Kingdom and many other places, ask for a lawful basis, a clear purpose, minimal data, rights to access and erase, an impact assessment for risky processing, and contracts with every processor, including your model provider. India's Digital Personal Data Protection Act asks for clear notice and consent, correction and erasure, breach reporting, and lets the government restrict transfers to certain countries.
- GDPR-style laws (EU, UK, more) lawful basis, purpose limit, minimise, access + erasure, impact assessment if risky, contracts with processors
- India DPDP Act 2023 clear notice + consent, correction and erasure, breach reporting, transfers can be restricted by country
EU AI Act tiers
The European Union's AI Act regulates by risk. Unacceptable uses, like social scoring, are banned. High risk uses, such as screening job candidates, credit decisions or grading exams, carry strict duties: risk management, data quality, logging and human oversight. Limited risk systems, like chatbots, must tell people they are dealing with AI and label deepfakes. Minimal risk covers most other apps. Model providers have their own duties. The rules phase in over several years.
- unacceptable: banned e.g. social scoring
- high risk: strict duties hiring, credit, exams, health risk mgmt, logs, human review
- limited: transparency say it is AI, label deepfakes
- minimal: no extra duties most chat and search apps
- + duties for general-purpose model providers
Vendor review
Before real data flows to any AI vendor, run the same checklist. A signed data processing agreement. A written promise not to train on your data. The retention period and whether zero retention is available. Regions for both compute and storage. The list of sub-processors. Independent security certifications. How quickly they must tell you about a breach. How you delete data on request and when you leave. And encryption in transit and at rest.
- □ data processing agreement
- □ no training on our data
- □ retention period, zero- retention option
- □ regions for compute + storage
- □ sub-processor list
- □ security certifications
- □ breach notice time
- □ deletion on request + exit
- □ encryption in transit + rest
Numbers worth knowing
Some numbers to quote, knowing terms change. Provider retention for abuse checks is usually zero to about thirty days, and zero retention is by agreement. Under GDPR, a breach must reach the regulator within seventy two hours, and user requests get an answer within about a month. Maximum fines are four percent of global turnover under GDPR, seven percent under the AI Act, and two hundred and fifty crore rupees under India's law.
provider abuse retention ~0-30 days zero retention by agreement GDPR breach notice 72 hours GDPR reply to a request ~1 month GDPR max fine 4% turnover/€20M AI Act max fine 7% turnover/€35M DPDP max penalty ₹250 crore backup expiry ~30-90 days regex: strong on emails, cards names need NER, still misses some
Common mistakes
The common mistakes. Trusting regular expressions to find names. They catch emails and card numbers well, but names and addresses need an entity recogniser, which still misses some. Forgetting that a postcode, birth date and gender together identify most people. Logging full prompts forever. Sharing a cache across users. Putting access rules in the prompt. Deleting database rows but not their vectors. And staff pasting customer data into a consumer chat app.
- trusting regex to find names
- zip + birth date + gender: re-identifies most people
- full prompts logged forever
- cache shared across users
- access rules in the prompt
- deleting rows, not vectors
- prod data in eval sets without consent or masking
- consumer chat app for work
Engineering checklist
Here is the engineering checklist. Draw a data map of every field and every store it lands in. Minimise and mask before sending. Keep secrets in a vault and scan for leaks. Filter retrieval by the signed in user. Redact logs and give them an expiry. Key caches by user or tenant. Pin the region for every copy. Write one deletion job that reaches every store. Show notice and get consent. Keep an audit log, and review every vendor.
- □ data map: every field, store
- □ minimise + mask before send
- □ secrets in a vault, scanned
- □ retrieval filtered per user
- □ logs redacted, with expiry
- □ cache keyed by user/tenant
- □ region pinned for all copies
- □ one delete job, all stores
- □ notice, consent, AI label
- □ audit log + vendor review
Say it like this
How to say it. We mask names, emails and phone numbers before the prompt and restore them in the reply. The provider is under a zero retention agreement, in an EU region, with no training on our data. Retrieval filters by tenant using the session identity, not the model. Logs are redacted and expire in fourteen days. And one deletion job covers vectors, caches, traces and provider files. That shows you followed the data.
- "We mask names, emails and phones before the prompt and restore them after. The provider has zero retention, an EU region and no training. Retrieval filters by tenant from the session. Logs expire in 14 days, and one delete job covers vectors, caches, traces and provider files."