Nhánh B · Giai đoạn 2 · A.6 A.7 A.10Branch B · Phase 2 · A.6 A.7 A.10

Design doc, data sheet và đánh giá vendorDesign doc, data sheet and vendor assessment

Ba văn bản, mỗi văn bản 1–2 trang, viết trước khi code chạy thật: tính năng được làm gì, dữ liệu nào rời cửa hàng, và nhà cung cấp model giữ dữ liệu đó ra sao. Mỗi câu phải trỏ được tới một bằng chứng.Three documents, 1–2 pages each, written before the code runs for real: what the feature may do, which data leaves the shop, and how the model vendor keeps it. Every sentence must point to evidence.

M2 – DONE KHIM2 – DONE WHENDesign doc và data sheet được ít nhất 1 người review và duyệt.The design doc and data sheet are reviewed and approved by at least one person.
Customer data passes a masking step before reaching the model vendor; the three documents get an approval stamp. shop-api order · chat maskPII() [PHONE] [EMAIL] Anthropic API claude-sonnet-5-5 ≤ 30d · no training design.mdlimits · R1–R7 data-sheet.mdper field vendor.md8 criteria APPROVED
01

Ba văn bản, ba câu hỏi của auditorThree documents, three auditor questions

Câu hỏi về một tính năng AI luôn rơi vào ba nhóm. Mỗi nhóm có một văn bản trả lời, ứng với một nhóm control Annex A. Viết trước khi lên production; viết sau sự cố thì đó là biên bản sự cố.Questions about an AI feature always fall into three groups. Each has one document that answers it and maps to one group of Annex A controls. Write them before production; written after an incident, they are a post-mortem.

design.md

Design docDesign doc

Làm gì, cho ai, không được dùng vào việc gì, rủi ro đã biết.What it does, for whom, what it must not be used for, known risks.

A.6.2.2 · A.6.2.3
Bằng chứng: file trong repo + PR đã duyệtEvidence: file in the repo + approved PR
data-sheet.md

Data sheetData sheet

Từng trường: nguồn, quyền dùng, có PII không, gửi gì cho ai, ghi log thế nào.Every field: source, right to use, PII or not, what goes to whom, how it is logged.

A.7.2 · A.7.3 · A.7.5 · A.7.6
Bằng chứng: hàm maskPII() và test của nóEvidence: maskPII() and its tests
vendor-assessment.md

Đánh giá vendorVendor assessment

Vendor giữ dữ liệu bao lâu, ở đâu, có huấn luyện trên đó không, điều khoản gì.How long the vendor keeps data, where, whether it trains on it, which terms apply.

A.10.2 · A.10.3
Bằng chứng: link điều khoản + ngày kiểm traEvidence: links to terms + check date

Mỗi văn bản 1–2 trang. Dài hơn thì không ai review kỹ, mà M2 cần đúng bước review đó. Nên đọc trước: ai-pilot-audit-ready.1–2 pages each. Longer, and nobody reviews it properly — and M2 depends on exactly that review. Read first: ai-pilot-audit-ready.

02

Ví dụ xuyên bài: Trợ lý đơn hàngRunning example: the Order assistant

Cửa hàng online 5 dev ở các bài trước (shop-web Next.js, shop-api Node), bán đồ gia dụng ở Việt Nam, có vài khách nhận hàng ở EU. Pilot: khung chat trả lời trạng thái đơn, ngày giao, chính sách đổi trả và soạn yêu cầu hoàn tiền.The 5-dev online shop from earlier topics (shop-web Next.js, shop-api Node), selling household goods in Vietnam with a few EU customers. The pilot: a chat that answers order status, delivery dates and return policy, and drafts refund requests.

Khách ──► shop-web chat ──► shop-api ──► maskPII() ──► Anthropic API
                               │                        claude-sonnet-5-5
                               ├── get_order(order_id)        read
                               ├── get_policy(topic)          read
                               └── create_refund_request ──► CS approval queue
03

Design doc: giới hạn sử dụng là mục quan trọng nhấtDesign doc: usage limits matter most

Bốn mục bắt buộc: mục đích, người dùng, giới hạn sử dụng, rủi ro đã biết. Model làm được rất nhiều việc, nên design doc phải nói rõ việc nào tính năng được phép làm, và chặn phần còn lại bằng cơ chế gì.Four required sections: purpose, users, usage limits, known risks. A model can do a great deal, so the design doc must say what the feature is allowed to do, and which mechanism blocks the rest.

Được dùng choIntended use
Không được dùng choOut of scope
Khi gặp thìWhen it happens
Trạng thái, ETA đơn của chính khách đang chatStatus, ETA of the chatting customer's own orders
Tra đơn của người khác, kể cả khi có mã đơnLooking up someone else's order, even with its number
Từ chối, yêu cầu đăng nhậpRefuse, ask to sign in
Giải thích chính sách đổi trả hiện hànhExplain the current return policy
Hứa ngoại lệ ngoài chính sáchPromise exceptions to the policy
Chuyển cho nhân viênHand off to staff
Soạn yêu cầu hoàn tiền để nhân viên duyệtDraft a refund request for staff to approve
Tự hoàn tiền, đổi số tiền đã duyệtRefund, change an approved amount
Không có tool — chặn bằng thiết kếNo tool exists — blocked by design
Trả lời bằng tiếng Việt hoặc tiếng AnhAnswer in Vietnamese or English
Tư vấn y tế, pháp lý, an toàn sản phẩmMedical, legal, product-safety advice
Chuyển ngay cho nhân viênHand off immediately
—
> 2.000.000đ, khách doạ kiện, rất bức xúc> 2,000,000 VND, legal threats, very angry customers
Chuyển nhân viên, gắn cờHand off, flag

Cột thứ ba quan trọng hơn cột thứ hai. Chỉ viết "không được" mà không có cơ chế chặn, thì đó là lời hứa, không phải thiết kế.The third column matters more than the second. "Must not" without a blocking mechanism is a promise, not a design.

Rủi ro đã biết R1–R7 — xương sống của cả nhánh BKnown risks R1–R7 — the backbone of Branch B

Các bài sau không thêm rủi ro mới; chúng lấp cột bằng chứng.Later topics add no new risks; they fill the evidence column.

04

Data sheet: từng trường, và hai lớp cheData sheet: every field, and two masking layers

Không viết "chúng tôi dùng dữ liệu đơn hàng". Liệt kê từng trường và trả lời bốn câu: nguồn, quyền dùng, có PII (thông tin định danh cá nhân) không, đi đâu. Quy tắc chọn: model có cần trường này để trả lời không? Model cần tỉnh để ước tính ngày giao, không cần số nhà.Never write "we use order data". List every field and answer four questions: source, right to use, PII or not, where it goes. The rule: does the model need this field to answer? It needs the province for delivery estimates, not the house number.

TrườngFieldNguồnSourcePII?Gửi cho vendorSent to vendorGhi logLogged
Tin nhắn của kháchCustomer messageKhung chatChat widgetCó thể cóPossiblyChe rồi gửiMasked, then sentCheMasked
Tên gọiFirst namecustomers.first_namePIIGửiSentCheMasked
Họ tên, SĐT, emailFull name, phone, emailcustomers.*PIIKhôngNoKhôngNo
Địa chỉ giao hàngShipping addressorders.shipping_addressPIIChỉ tỉnh/thànhProvince onlyKhôngNo
Mặt hàng, số lượng, giá, trạng thái, ETAItems, quantity, price, status, ETAorders, order_itemsKhôngNoGửiSentGửi nguyênAs-is
Thông tin thanh toánPayment detailsCổng thanh toánPayment gatewayPII tài chínhFinancial PIIKhông bao giờNeverKhôngNo

Thử hàm che: gõ như một khách hàng thậtTry the masking function: type like a real customer

Lớp 1 che trước khi gửi vendor, lớp 2 che trước khi ghi log (cả đầu ra, phòng khi model lặp lại PII). Mã đơn được giữ — model cần nó.Layer 1 masks before the vendor call, layer 2 before logging (output too, in case the model repeats PII). The order number is kept — the model needs it.

Tin nhắn của kháchCustomer message

Bản gửi cho vendor / ghi logWhat the vendor and the log receive

Regex chỉ là lớp đầu: nó bắt SĐT, email, số thẻ, địa chỉ có số nhà, nhưng không bắt tên người hay địa chỉ viết tự do. Test của hàm che (dấu cách, +84, chữ hoa, gạch nối) chính là bằng chứng cho A.7.6.Regex is only the first layer: it catches phones, emails, card numbers and numbered addresses, but not names or free-form addresses. The masking tests (spaces, +84, upper case, dashes) are the evidence for A.7.6.

Quyền dùng: gửi ra nước ngoài là chuyển dữ liệu xuyên biên giớiRight to use: sending abroad is a cross-border transfer

Luật Bảo vệ dữ liệu cá nhân số 91/2025/QH15 (hiệu lực 1/1/2026) có điều riêng về chuyển dữ liệu cá nhân xuyên biên giới (Điều 20) kèm hồ sơ đánh giá tác động. Điều kiện chi tiết và nghị định hướng dẫn: chưa xác minh ở bài này, bài M4 sẽ đi sâu. Data sheet ghi ba điều: chính sách bảo mật đã nhắc tới vendor AI ở nước ngoài chưa; cơ sở dùng từng nhóm dữ liệu; ai ký quyết định gửi dữ liệu ra ngoài.Vietnam's Personal Data Protection Law No. 91/2025/QH15 (effective 1 Jan 2026) has a dedicated article on cross-border transfers (Article 20) with an impact-assessment dossier. Detailed conditions and implementing decrees: not verified here; the M4 topic goes deeper. The data sheet records three things: whether the privacy notice mentions an AI vendor abroad; the basis for each data group; who signed off sending data out.

05

Đánh giá vendor: tám tiêu chí, năm cổng chặnVendor assessment: eight criteria, five gates

Tiêu chí có viền cam là bắt buộc: trượt một cái thì điểm các tiêu chí khác cao cỡ nào cũng không dùng.Criteria with an orange edge are required: fail one and the vendor is out, however well it scores elsewhere.

1 · Huấn luyện1 · TrainingCó dùng prompt/đầu ra của bạn để huấn luyện không? Phải là không.Does it train on your prompts/outputs? Must be no.
2 · Thời gian lưu2 · RetentionMặc định bao lâu, ngoại lệ nào lâu hơn?Default period, which exceptions keep longer?
3 · ZDRZero data retention: điều kiện, áp cho model nào?Zero data retention: conditions, which models?
4 · Vùng4 · RegionInference ở đâu, lưu trữ ở đâu, chọn được không?Where inference runs and data is stored, can you choose?
5 · DPAPhụ lục xử lý dữ liệu: tự áp dụng hay phải ký?Data processing addendum: automatic or signed?
6 · Sub-processorDanh sách công khai, có báo khi đổi?Public list, change notices?
7 · Usage policy7 · Usage policyTrường hợp sử dụng của bạn có bị cấm không?Is your use case prohibited?
8 · Đổi model8 · Model changesGhim version được không, báo trước khi ngừng?Can you pin versions, notice before retirement?

So sánh ba vendor — đã kiểm tra 2026-11-01Three vendors compared — checked 2026-11-01

Tiêu chíCriterionAnthropic APIOpenAI APIGemini Developer API (trả phí)Gemini Developer API (paid)
Huấn luyệnTrainingKhông (Commercial Terms)No (Commercial Terms)Không, trừ khi bạn đồng ý (opt in)No, unless you opt inKhông, với Paid ServicesNo, on Paid Services
Lưu mặc địnhDefault retentionXoá trong 30 ngày; ngoại lệ: Files API, vi phạm usage policy, pháp luậtDeleted within 30 days; exceptions: Files API, policy enforcement, lawTối đa 30 ngày (giám sát lạm dụng); Responses API store ≥ 30 ngàyUp to 30 days (abuse monitoring); Responses API store ≥ 30 days"Thời gian giới hạn" để phát hiện vi phạm; 55 ngày (thông báo 11/2024) "A limited period" for abuse detection; 55 days (Nov 2024 notice) chưa xác minhnot verified
ZDRCó, qua sales; không cho Covered Models (Fable 5.1, Mythos 5.1, Fable 5, Mythos 5)Yes, via sales; not for Covered Models (Fable 5.1, Mythos 5.1, Fable 5, Mythos 5)Có, cần OpenAI duyệt trướcYes, with OpenAI's prior approvalKhông đảm bảo trên Developer API; dùng Vertex AINot guaranteed on the Developer API; use Vertex AI
Khi bị gắn cờWhen flaggedCó thể tới 2 năm, kể cả có ZDRUp to 2 years, even under ZDRLâu hơn khi luật yêu cầuLonger when the law requiresChưa xác minhNot verified
VùngRegioninference_geo: global / us (×1,1); lưu trữ chỉ USstorage US onlyUS, EU, UAE (xử lý + lưu); vài nước khác chỉ lưu trữ, không xử lýUS, EU, UAE (processing + storage); some countries storage onlyChưa xác minhNot verified; Vertex AI có chọn vùngVertex AI offers regions
DPAKèm Commercial TermsPart of Commercial TermsCông khai, bản hiệu lực 1/1/2026Public, effective 1 Jan 2026Chưa xác minh chi tiếtDetails not verified
Sub-processorDanh sách công khaiPublic listCông khai, có đăng ký thông báoPublic, with notificationsChưa xác minhNot verified

Chính sách vendor đổi thường xuyên. Bảng ghi lại trang chính thức ngày 2026-11-01 — kiểm tra lại trước khi quyết định thật, và lưu link + ngày kiểm tra vào bản đánh giá.Vendor policies change often. The table records the official pages on 2026-11-01 — re-check before a real decision, and keep links + check date in your assessment.

Ba cái bẫyThree traps

ZDR không áp cho mọi modelZDR does not cover every modelCovered Models bắt buộc lưu 30 ngày. Đổi sang Fable mà không đọc lại đánh giá thì giả định "ZDR" sai ngay. Ghi model cụ thể, không chỉ tên vendor.Covered Models require 30-day retention. Switch to Fable without re-reading, and the "ZDR" assumption is wrong. Name the specific model, not just the vendor.
Tính năng phụ lưu riêngSide features keep their own dataFiles API, code execution, store của Responses API, grounding Google Search (30 ngày, không tắt được). Bật tính năng mới = đánh giá lại.Files API, code execution, Responses API store, Google Search grounding (30 days, no opt-out). New feature = re-assess.
"Inference ở US" ≠ dữ liệu ở lại Việt Nam"Inference in the US" ≠ data stays in VietnamVới cả ba vendor, dữ liệu đều rời Việt Nam. Câu hỏi đúng là "đã che đủ chưa, có cơ sở pháp lý chưa". Vì vậy cửa hàng giữ global: us tốn thêm 10% mà không giải quyết gì.With all three vendors, the data leaves Vietnam. The right question is "masked enough, legal basis in place?". So the shop keeps global: us costs 10% more and solves nothing.
06

Soạn ba văn bản cho pilot của bạnDraft the three documents for your pilot

Điền form bên trái; sơ đồ luồng dữ liệu và ba file Markdown cập nhật ngay. Bấm "Nạp ví dụ cửa hàng" để xem bản đầy đủ. Dữ liệu chỉ lưu trong trình duyệt của bạn.Fill in the form; the data-flow diagram and the three Markdown files update live. Press "Load shop example" to see a complete version. Data stays in your browser.

design.mdDesign docDesign doc
Không được dùng choOut of scopeKhi gặp thìWhen it happens
Rủi ro đã biếtKnown riskNgười chịu trách nhiệmAccountable
data-sheet.mdData sheetData sheet
TrườngFieldNguồnSourcePIIVendorLog
vendor.mdĐánh giá vendorVendor assessment
Tiêu chíCriterionKết quả (kèm nguồn)Result (with source)Đánh giáStatus

Đổi vendor sẽ nạp lại kết quả đã kiểm tra ngày 2026-11-01.Changing the vendor reloads the results checked on 2026-11-01.

DuyệtApprovalReview và phê duyệtReview and approval


    
07

Review và duyệt bằng PRReview and approve by PR

M2 chỉ xong khi người khác đọc và ký. Người viết tự duyệt thì không tính. Cửa hàng 5 người thì một người review nhiều văn bản cũng được, miễn không phải người viết.M2 is done only when someone else reads and signs. Self-approval does not count. In a 5-person shop one person may review several documents, as long as they did not write them.

designCS lead review — người chịu hậu quả khi trợ lý trả lời sai.CS lead reviews — the one who pays when the assistant is wrong.
dataQuản lý vận hành review — chịu trách nhiệm pháp lý về dữ liệu khách.Operations manager reviews — legally accountable for customer data.
vendorQuản lý vận hành review — ký hợp đồng và trả tiền.Operations manager reviews — signs the contract and pays.
✓Reviewer kiểm tra: mỗi giới hạn có cơ chế chặn; R1–R7 có người chịu trách nhiệm; mỗi trường có giá trị gửi/che/không; có link hàm che và test; đánh giá vendor có model, nguồn, ngày; không tiêu chí bắt buộc nào trượt.Reviewer checks: every limit has a blocking mechanism; R1–R7 have owners; every field is sent/masked/no; masking code and tests are linked; the vendor assessment names model, sources, date; no required criterion fails.
# shop-api/.github/CODEOWNERS
/docs/ai/  @shop/ops-manager @shop/cs-lead

# shop-api/docs/ai/order-assistant/
design.md
data-sheet.md
vendor-assessment.md
risk-register.md

Mỗi lần sửa là một PR, cần người trong CODEOWNERS duyệt. Khi auditor hỏi "ai duyệt, khi nào", bạn gửi link PR. Lịch sử git là bằng chứng có dấu thời gian, không cần thêm công cụ.Every change is a PR that needs a CODEOWNERS approval. When an auditor asks "who approved, when", send the PR link. Git history is timestamped evidence, with no extra tooling.

08

Trước và sau M2Before and after M2

Câu hỏiQuestionTrướcBeforeSauAfter
Trợ lý được làm gì?What may the assistant do?"Thì trả lời khách thôi""Answer customers, I guess"Bảng giới hạn, có cơ chế chặnA limits table with blocking mechanisms
Gửi gì cho Anthropic?What do we send to Anthropic?"Chắc là tin nhắn""Probably the messages"Từng trường, hàm che + testPer field, masking + tests
Họ giữ bao lâu?How long do they keep it?"Họ nói không train mà""They said no training"≤ 30 ngày, 2 năm nếu bị gắn cờ, link + ngày≤ 30 days, 2 years if flagged, link + date
Ai duyệt?Who approved?Không aiNobodyPR được CS lead, quản lý vận hành duyệtPR approved by CS lead, operations manager
Đổi model được không?Can we switch models?Đổi luônJust switchĐánh giá lại vendor + chạy eval (M3)Re-assess vendor + run evals (M3)
09

Anti-patternAnti-patterns

Anti-patternVì sao hỏngWhy it failsThay bằngInstead
Design doc 15 trangA 15-page design docKhông ai review hết, duyệt thành hình thứcNobody reviews it all; approval becomes a formality1–2 trang, chi tiết để ở link1–2 pages, details behind links
"Dữ liệu: dữ liệu đơn hàng""Data: order data"Không trả lời được "gửi trường nào"Cannot answer "which fields are sent"Bảng từng trườngA per-field table
Chỉ che trước khi gửi vendorMasking only before the vendor callLog nội bộ vẫn chứa SĐT, địa chỉInternal logs still hold phones, addressesChe cả hai lớpMask at both layers
Đánh giá vendor không ghi ngày, modelVendor assessment without date or modelChính sách đổi, văn bản vẫn ghi "đạt"Policies change, the document still says "pass"Model id, link, ngày kiểm tra, ngày đánh giá lạiModel id, links, check date, re-assessment date
Tin bài blog tổng hợpTrusting aggregator blogsThường lỗi thời hoặc saiOften outdated or wrongChỉ trích trang chính thứcCite official pages only
Người viết tự duyệtAuthors approving their own docsKhông có góc nhìn thứ haiNo second pair of eyesReviewer khác người viết, duyệt qua PRA different reviewer, via PR
10

Checklist M2M2 checklist

0/8
11

Tự kiểm traSelf-check

Vì sao mục "không được dùng cho" cần cột "khi gặp thì làm gì"?Why does "not allowed" need a "when it happens" column?

"Không được" mà không có cơ chế chặn chỉ là lời hứa. Cột hành động cho dev biết phải code gì (từ chối, chuyển nhân viên, không cấp tool), cho reviewer biết phải kiểm tra gì."Not allowed" without a mechanism is a promise. The action column tells devs what to build (refuse, hand off, withhold the tool) and reviewers what to check.

Model cần tỉnh nhưng không cần số nhà. Nguyên tắc nào?The model needs the province, not the house number. Which principle?

Tối thiểu hoá dữ liệu: chỉ gửi trường model thật sự cần. Trường không gửi thì không thể lộ ở phía vendor.Data minimisation: send only what the model needs. A field never sent cannot leak on the vendor side.

Vì sao phải che cả trước khi ghi log, khi log nằm trên server của bạn?Why mask before logging, when logs sit on your own servers?

Log giữ lâu hơn, nhiều người đọc hơn và hay bị copy sang dashboard, ticket. Lộ từ log cũng là lộ.Logs live longer, have more readers and get copied into dashboards and tickets. A leak from logs is still a leak.

Đánh giá ghi "Anthropic: có ZDR". Thiếu gì?An assessment says "Anthropic: has ZDR". What is missing?

Model cụ thể và ngày kiểm tra. ZDR phải xin, không tự có, và không áp cho Covered Models. Ghi "đã xin hay chưa, cho model nào".The specific model and the check date. ZDR must be requested and excludes Covered Models. Record "requested or not, for which model".

Team bật Files API để khách gửi ảnh hàng lỗi. Văn bản nào phải sửa?The team enables the Files API for photos of damaged goods. Which documents change?

Cả ba: data sheet (trường mới, ảnh có thể chứa PII), đánh giá vendor (Files API lưu tới khi bạn xoá), design doc (mục đích và giới hạn mới).All three: data sheet (new field, photos may hold PII), vendor assessment (Files API keeps files until you delete them), design doc (new purpose and limits).

Vì sao duyệt qua PR tốt hơn qua email?Why approve by PR rather than email?

PR có người duyệt, dấu thời gian, diff và lịch sử; CODEOWNERS bắt đúng người duyệt. Email không truy lại được và không gắn với version văn bản.A PR has an approver, timestamp, diff and history; CODEOWNERS enforces the right reviewer. Email is untraceable and not tied to a document version.