Design the data-flow architecture for an India-scoped HR-docs copilot where prompts, embeddings, outputs, and traces are all treated as personal-data surfaces. The hard question you must answer in writing: when an employee withdraws consent, what exactly happens to the vectors derived from their records — and can you prove it happened?
Vikram's ARB has a new standing question. The BFSI firm's HR function wants a copilot over employee handbooks, HR policies, and — this is where the review gets serious — individual employee records: leave histories, grievance files, performance notes. The Digital Personal Data Protection regime makes this a design problem, not a legal afterthought: the DPDP Rules were notified in November 2025 with phased compliance deadlines, penalties scale to ₹250 crore from May 2027, and the lawful-basis menu is consent-centric — consent plus a narrow legitimate-use category, far narrower than GDPR's six bases. A RAG system multiplies personal-data copies into places most architectures forget: chunks, embeddings, caches, model outputs, and observability traces. This lab makes you find every copy, draw it, and design its deletion path — before an auditor asks.
~90 minutes hands-on · Advanced tier (maps to module M8). Runs at ~₹0 — this is a design-artifact lab; you need only a chat assistant and a Mermaid renderer (any free online editor or your IDE preview).
Create lab-14/ with four empty files: surfaces.md, dfd.md, compliance-design.md, adr-residency.md.
The engagement brief (all details synthetic):
SYSTEM: "Saarthi" - internal HR copilot for a BFSI firm, ~18,000 employees,
all data principals located in India.
CORPUS: (a) HR policy handbook (no personal data), (b) per-employee records:
leave history, grievance tickets, appraisal summaries. Employees consented to
HR processing at onboarding; the copilot is a NEW purpose.
USERS: HR ops team (full corpus) and employees (self-service: policies + own
records only).
STACK (proposed by the vendor): managed embedding model + LLM endpoint,
vector store, app tier, LLM-observability tracing "for quality improvement",
nightly ingestion from the HRMS.
OPEN QUESTIONS FROM THE ARB: residency, consent lineage, deletion,
redaction placement, and whether tracing is even lawful as proposed.
You also received an AI-drafted "compliance summary" from the vendor's presales engineer. It is part of your input — and it contains seeded errors you must catch in Step 2:
VENDOR AI COMPLIANCE SUMMARY (as received):
1. DPDP requires all personal data of Indian citizens to be stored only on
servers physically located in India, so the vector store must be in-country.
2. Embeddings are anonymized mathematical representations, not personal data,
so consent and deletion obligations do not apply to the vector store.
3. Penalties under the DPDP regime reach Rs 500 crore per incident from
May 2027, so we recommend our premium compliance tier.
4. Because employees consented to HR processing at onboarding, no further
consent action is needed for the copilot.
Treat every AI or vendor compliance claim the way this track treats service limits: as unverified text until checked against the primary source — here, the DPDP Act and Rules themselves and your counsel's reading of them.
In surfaces.md, list every place personal data exists in the proposed system — at rest and in motion. Work through the request path (employee question → retrieval → prompt assembly → model → answer → trace) and the ingestion path (HRMS → chunker → embedder → vector store). Your list must include at minimum: source records, chunks, embeddings, assembled prompts, model outputs, application logs, observability traces, semantic/response caches if any, and eval samples if answer quality is being reviewed. For each surface: what personal data reaches it, where it physically lives, and its retention today (usually: "indefinite, by accident").
✅ Checkpoint: surfaces.md lists at least eight surfaces; embeddings, traces, and caches all appear with a stated retention answer (even if that answer is "undefined — flagged").
Before designing anything, audit the four vendor claims against what you know from the module and the primary texts. Mark each claim correct, wrong, or dangerously oversimplified, with one line of reasoning. Do this yourself first; then ask your assistant to critique your audit — and verify anything it adds before accepting it, because correcting one AI with another AI unverified is compounding the failure mode, not fixing it. Record the audit at the top of compliance-design.md.
✅ Checkpoint: all four claims dispositioned in writing; at least three marked wrong or oversimplified (see answer key after finishing).
In dfd.md, produce the Mermaid DFD. Every personal-data surface from Step 1 must appear as a node; annotate edges with what crosses them. Skeleton to extend:
flowchart LR
subgraph IN["India region - pinned deployment"]
U[Employee / HR user] --> RG[Redaction gateway]
RG --> APP[Copilot app tier]
APP --> VDB[(Vector store: chunks + embeddings + doc/principal metadata)]
APP --> LLM[LLM endpoint - private connectivity]
APP --> TR[(Trace store - sampled, redacted, TTL)]
HRMS[HRMS source] --> ING[Ingestion + chunker + embedder]
ING --> VDB
ING --> CR[(Consent register)]
CR -. lineage check .-> ING
CR -. deletion trigger .-> VDB
end
Design decisions the diagram must make visible: where the redaction gateway sits (before the model and before the trace store — outbound prompts and stored traces are separate exposures), the consent register as a first-class component wired to both ingestion (no consent, no ingest) and deletion (withdrawal triggers purge), and access-path separation for the two user classes (HR ops vs employee self-service — retrieval must enforce the requester's entitlement via metadata filters, not the prompt).
✅ Checkpoint: rendered diagram shows all Step-1 surfaces, the consent register with both its edges, and the redaction gateway covering both the model path and the trace path.
This is the section auditors will read first. In compliance-design.md, design two mechanisms:
principal_id, source_doc_id, purpose_tag, consent_ref, ingested_at. Ingestion checks the consent register per principal per purpose before embedding — and because the copilot is a new purpose beyond onboarding-era HR processing, the design must include a fresh consent capture for it. Lineage means you can answer, for any single vector, "whose data, from which document, under which consent, for which purpose."principal_id = P (this is why the metadata schema exists — deletion by similarity search is not deletion); purge of chunk store and any caches holding P's content; trace-store handling (redacted-at-write plus TTL makes this tractable — raw traces make it a crisis); eval samples scrubbed; and downstream copies (backups) covered by a documented backup-expiry window. Close with the two structural commitments that keep deletion possible: no fine-tuning on employee personal data (a model weight has no delete API), and no unredacted personal data in any store without TTL. Add a verification step: a periodic job re-queries all stores for principal_id = P and files the empty result as evidence.✅ Checkpoint: the deletion-path table covers every surface from Step 1 with mechanism + owner + deadline, and states the no-fine-tuning commitment explicitly.
Write adr-residency.md in standard ADR form (context, options, decision, consequences). The honest legal posture per the module: the DPDP regime today does not impose blanket localization, but the government may restrict transfers to specified destinations — so the architecture question is not "must everything be in India?" but "how expensive is it to comply the day a restriction lands?" Options to weigh: (A) India-pinned everything (model endpoint, vector store, traces); (B) India-pinned data stores with cross-border model inference; (C) unpinned managed defaults. Decide for this BFSI context (sectoral conservatism is a legitimate input — mark any RBI-adjacent expectation as "verify with compliance before relying on it"), and record the architect-for-restrictability consequences: region-pinned deployment, a portable vector store (export path tested, no proprietary-only index format), and provider terms verified in writing for no-training-on-inputs.
✅ Checkpoint: ADR names its decision, and the consequences section includes portability and the no-training contractual verification as first-class items.
Paste your DFD and compliance design into your assistant with: "You are a DPDP auditor. Find data flows where personal data escapes the controls described." Typical genuine catches: personal data in error logs (a stack trace containing the assembled prompt), the embedding model provider retaining inputs, cached answers served across entitlement boundaries, and deletion not covering the consent register's own records. Accept or rebut each finding in the margin — and verify any legal claim the assistant makes before adopting it.
✅ Checkpoint: at least two red-team findings accepted into the design, each with its mitigation added to the DFD or the deletion table.
In a RAG system the personal data is not "in the database" — it is in every derived copy: chunks, vectors, prompts, outputs, traces, caches. Design the metadata that makes each copy findable, and deletion becomes a query; skip it, and deletion becomes a rebuild.
The lab-14/ design package: surfaces.md, dfd.md (rendered), compliance-design.md (vendor audit + consent lineage + deletion paths), adr-residency.md, with red-team findings incorporated. Self-grading rubric (pass = 8/10):
This lab is already synthetic, but its real-world twin is maximally sensitive: an actual client's HR data flows are themselves confidential. Run the design work inside the client's approved tenancy or a local model; never paste a real client's system inventory, employee-data descriptions, or MSA excerpts into public AI tools. The deliverable formats — surface inventory, DFD, deletion table, residency ADR — contain structure rather than data and are safe to reuse across engagements; the populated contents are the client's. And every legal interpretation in the package ships to the client marked "architecture input — confirm with counsel," because the architect owns the data flows, not the legal opinion.
principal_id/role in the query), not two parallel systems.The four vendor claims, dispositioned:
purpose_tag and why ingestion gates on it. "We already have consent" without a purpose match is the compliance equivalent of reusing credentials across systems.The structural answer to the lab's hard question, compressed: consent withdrawal becomes tractable exactly when every derived copy carries principal_id metadata and no copy lives in a store without either a delete-by-filter API or a TTL — and it becomes intractable the moment personal data enters model weights, which is why "no fine-tuning on employee personal data" is an architecture commitment, not a policy preference.