@enki-dev-expert/global-engineering-standards 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +303 -0
- package/CHANGELOG.md +28 -0
- package/CITATION.cff +21 -0
- package/CODE_OF_CONDUCT.md +13 -0
- package/CONTRIBUTING.md +27 -0
- package/LICENSE +21 -0
- package/README.md +159 -2
- package/SECURITY.md +25 -0
- package/dist/cli.js +40 -0
- package/dist/content.js +71 -0
- package/dist/filesystem.js +83 -0
- package/dist/installer.js +243 -0
- package/dist/layout.js +42 -0
- package/dist/transaction.js +143 -0
- package/docs/ai-and-llm.md +1312 -0
- package/docs/architecture.md +1007 -0
- package/docs/cost-engineering.md +1322 -0
- package/docs/data.md +993 -0
- package/docs/governance.md +1744 -0
- package/docs/mobile-and-web.md +1362 -0
- package/docs/observability.md +1345 -0
- package/docs/platforms-and-applications.md +1581 -0
- package/docs/privacy.md +566 -0
- package/docs/quality-and-testing.md +1278 -0
- package/docs/scalability.md +1012 -0
- package/docs/security.md +373 -0
- package/handbook/claude-plugin.md +31 -0
- package/handbook/compatibility.md +27 -0
- package/handbook/recovery.md +29 -0
- package/handbook/releasing.md +50 -0
- package/handbook/security-review.md +41 -0
- package/handbook/signing.md +18 -0
- package/handbook/validation.md +50 -0
- package/package.json +65 -4
- package/scripts/content-baseline.json +25 -0
- package/skills/engineering-architecture-review/SKILL.md +1531 -0
- package/skills/engineering-cost-estimate/SKILL.md +1599 -0
- package/skills/engineering-database-review/SKILL.md +1364 -0
- package/skills/engineering-privacy-check/SKILL.md +1295 -0
- package/skills/engineering-safe-implementation/SKILL.md +1502 -0
- package/skills/engineering-security-standards-check/SKILL.md +1112 -0
- package/src/cli.ts +45 -0
- package/src/content.ts +82 -0
- package/src/filesystem.ts +94 -0
- package/src/installer.ts +280 -0
- package/src/layout.ts +70 -0
- package/src/transaction.ts +167 -0
- package/templates/ADR.md +1302 -0
- package/templates/AUDIT_REPORT.md +1693 -0
- package/templates/EXCEPTIONS.md +647 -0
- package/templates/PROJECT_AGENTS.md +868 -0
|
@@ -0,0 +1,1312 @@
|
|
|
1
|
+
|
|
2
|
+
# Global AI, LLM and Agentic Systems Engineering Standards
|
|
3
|
+
|
|
4
|
+
## 1. Mission
|
|
5
|
+
|
|
6
|
+
Design, develop, evaluate, deploy and maintain secure, reliable, privacy-preserving, cost-efficient and scalable artificial intelligence systems.
|
|
7
|
+
|
|
8
|
+
These standards apply to all AI-assisted engineering workflows and AI-powered application features.
|
|
9
|
+
|
|
10
|
+
Supported technologies and applications include:
|
|
11
|
+
|
|
12
|
+
- Large Language Models (LLMs).
|
|
13
|
+
- Generative AI.
|
|
14
|
+
- Retrieval-Augmented Generation (RAG).
|
|
15
|
+
- AI agents.
|
|
16
|
+
- Multi-agent systems.
|
|
17
|
+
- Tool calling and function calling.
|
|
18
|
+
- Model Context Protocol (MCP).
|
|
19
|
+
- Document intelligence.
|
|
20
|
+
- Computer vision.
|
|
21
|
+
- Speech recognition.
|
|
22
|
+
- Speech synthesis.
|
|
23
|
+
- Multimodal AI.
|
|
24
|
+
- Embedding systems.
|
|
25
|
+
- Vector search.
|
|
26
|
+
- Machine learning pipelines.
|
|
27
|
+
- Self-hosted models.
|
|
28
|
+
- Managed AI services.
|
|
29
|
+
|
|
30
|
+
AI functionality must provide measurable business or user value.
|
|
31
|
+
|
|
32
|
+
Never introduce AI where deterministic software can solve the requirement more reliably, safely and economically.
|
|
33
|
+
|
|
34
|
+
## 2. Fundamental Principles
|
|
35
|
+
|
|
36
|
+
Apply:
|
|
37
|
+
|
|
38
|
+
1. Security by Design.
|
|
39
|
+
2. Privacy by Design.
|
|
40
|
+
3. Human Oversight.
|
|
41
|
+
4. Least Privilege.
|
|
42
|
+
5. Evidence-Based Evaluation.
|
|
43
|
+
6. Provider Neutrality.
|
|
44
|
+
7. Cost Awareness.
|
|
45
|
+
8. Observability.
|
|
46
|
+
9. Failure Containment.
|
|
47
|
+
10. Explainability appropriate to risk.
|
|
48
|
+
11. Data Minimization.
|
|
49
|
+
12. Controlled Autonomy.
|
|
50
|
+
13. Continuous Improvement.
|
|
51
|
+
14. Production Compatibility.
|
|
52
|
+
|
|
53
|
+
Never assume an AI model is correct merely because its response is fluent or plausible.
|
|
54
|
+
|
|
55
|
+
Never treat generated content as inherently trustworthy.
|
|
56
|
+
|
|
57
|
+
## 3. Provider and Model Independence
|
|
58
|
+
|
|
59
|
+
These standards are AI-provider-neutral and model-agnostic.
|
|
60
|
+
|
|
61
|
+
No model, model family or API provider is mandatory by default.
|
|
62
|
+
|
|
63
|
+
Support architectures using:
|
|
64
|
+
|
|
65
|
+
### OpenAI
|
|
66
|
+
|
|
67
|
+
Relevant technologies may include:
|
|
68
|
+
|
|
69
|
+
- Language models.
|
|
70
|
+
- Reasoning models.
|
|
71
|
+
- Multimodal models.
|
|
72
|
+
- Embeddings.
|
|
73
|
+
- Speech and audio models.
|
|
74
|
+
- Tool calling.
|
|
75
|
+
- Structured outputs.
|
|
76
|
+
- Managed inference services.
|
|
77
|
+
|
|
78
|
+
### Anthropic
|
|
79
|
+
|
|
80
|
+
Relevant technologies may include:
|
|
81
|
+
|
|
82
|
+
- Claude models.
|
|
83
|
+
- Tool use.
|
|
84
|
+
- Structured responses.
|
|
85
|
+
- Agentic workflows.
|
|
86
|
+
- Multimodal capabilities.
|
|
87
|
+
- Managed inference services.
|
|
88
|
+
|
|
89
|
+
### Google
|
|
90
|
+
|
|
91
|
+
Relevant technologies may include:
|
|
92
|
+
|
|
93
|
+
- Gemini models.
|
|
94
|
+
- Vertex AI.
|
|
95
|
+
- Multimodal processing.
|
|
96
|
+
- Embeddings.
|
|
97
|
+
- Tool integrations.
|
|
98
|
+
- Managed inference services.
|
|
99
|
+
|
|
100
|
+
### Amazon Web Services
|
|
101
|
+
|
|
102
|
+
Relevant technologies may include:
|
|
103
|
+
|
|
104
|
+
- Amazon Bedrock.
|
|
105
|
+
- Managed foundation models.
|
|
106
|
+
- AWS AI services.
|
|
107
|
+
- Model hosting.
|
|
108
|
+
- Agent orchestration.
|
|
109
|
+
- Enterprise integrations.
|
|
110
|
+
|
|
111
|
+
### Microsoft Azure
|
|
112
|
+
|
|
113
|
+
Relevant technologies may include:
|
|
114
|
+
|
|
115
|
+
- Azure-hosted AI models.
|
|
116
|
+
- Azure AI services.
|
|
117
|
+
- Azure AI Foundry or its current equivalent.
|
|
118
|
+
- Managed inference.
|
|
119
|
+
- Enterprise identity integration.
|
|
120
|
+
- AI monitoring.
|
|
121
|
+
|
|
122
|
+
### Other Providers and Models
|
|
123
|
+
|
|
124
|
+
Support appropriate technologies including:
|
|
125
|
+
|
|
126
|
+
- Mistral AI.
|
|
127
|
+
- Meta Llama models.
|
|
128
|
+
- Hugging Face.
|
|
129
|
+
- Cohere.
|
|
130
|
+
- DeepSeek.
|
|
131
|
+
- Ollama.
|
|
132
|
+
- vLLM.
|
|
133
|
+
- Local inference engines.
|
|
134
|
+
- Open-weight models.
|
|
135
|
+
- Self-hosted models.
|
|
136
|
+
- Specialized domain models.
|
|
137
|
+
- Future model providers.
|
|
138
|
+
|
|
139
|
+
Provider examples are not mandatory choices.
|
|
140
|
+
|
|
141
|
+
Verify current documentation, model availability, capabilities, limits, licensing and pricing before making recommendations.
|
|
142
|
+
|
|
143
|
+
Never migrate an existing AI system merely because another model is newer or more popular.
|
|
144
|
+
|
|
145
|
+
## 4. AI Architecture First
|
|
146
|
+
|
|
147
|
+
Before implementing significant AI functionality:
|
|
148
|
+
|
|
149
|
+
1. Identify the business problem.
|
|
150
|
+
2. Determine whether AI is necessary.
|
|
151
|
+
3. Define expected inputs.
|
|
152
|
+
4. Define expected outputs.
|
|
153
|
+
5. Identify affected users.
|
|
154
|
+
6. Identify relevant data.
|
|
155
|
+
7. Classify sensitivity.
|
|
156
|
+
8. Define security boundaries.
|
|
157
|
+
9. Define accuracy requirements.
|
|
158
|
+
10. Define acceptable failure behavior.
|
|
159
|
+
11. Estimate inference and operational costs.
|
|
160
|
+
12. Evaluate latency requirements.
|
|
161
|
+
13. Identify human approval requirements.
|
|
162
|
+
14. Establish evaluation criteria.
|
|
163
|
+
15. Present the proposed architecture.
|
|
164
|
+
16. Obtain approval before significant implementation.
|
|
165
|
+
|
|
166
|
+
Distinguish confirmed requirements from assumptions.
|
|
167
|
+
|
|
168
|
+
## 5. Deterministic Software Before AI
|
|
169
|
+
|
|
170
|
+
Prefer conventional software for tasks requiring exact and predictable outcomes.
|
|
171
|
+
|
|
172
|
+
Examples include:
|
|
173
|
+
|
|
174
|
+
- Arithmetic and financial calculations.
|
|
175
|
+
- Authorization decisions.
|
|
176
|
+
- Access control.
|
|
177
|
+
- Database constraints.
|
|
178
|
+
- Payment execution.
|
|
179
|
+
- Regulatory rule enforcement.
|
|
180
|
+
- Input validation.
|
|
181
|
+
- Cryptographic operations.
|
|
182
|
+
- Critical workflow invariants.
|
|
183
|
+
|
|
184
|
+
AI may assist with interpretation, classification or recommendations.
|
|
185
|
+
|
|
186
|
+
Deterministic and authorized systems must enforce final constraints.
|
|
187
|
+
|
|
188
|
+
Never use an LLM as the sole security boundary.
|
|
189
|
+
|
|
190
|
+
## 6. AI Risk Classification
|
|
191
|
+
|
|
192
|
+
Classify AI functionality according to potential impact.
|
|
193
|
+
|
|
194
|
+
Consider:
|
|
195
|
+
|
|
196
|
+
- Incorrect information.
|
|
197
|
+
- Financial loss.
|
|
198
|
+
- Privacy violations.
|
|
199
|
+
- Security compromise.
|
|
200
|
+
- Discrimination.
|
|
201
|
+
- Physical harm.
|
|
202
|
+
- Legal consequences.
|
|
203
|
+
- Business disruption.
|
|
204
|
+
- Loss of user trust.
|
|
205
|
+
|
|
206
|
+
Higher-risk functionality requires stronger testing, traceability, controls and human oversight.
|
|
207
|
+
|
|
208
|
+
Evaluate applicable sector-specific and jurisdiction-specific legal requirements.
|
|
209
|
+
|
|
210
|
+
Do not assume all AI applications have identical compliance obligations.
|
|
211
|
+
|
|
212
|
+
## 7. Model Selection
|
|
213
|
+
|
|
214
|
+
Select models according to:
|
|
215
|
+
|
|
216
|
+
- Task accuracy.
|
|
217
|
+
- Reliability.
|
|
218
|
+
- Latency.
|
|
219
|
+
- Context requirements.
|
|
220
|
+
- Structured output capabilities.
|
|
221
|
+
- Multimodal requirements.
|
|
222
|
+
- Security.
|
|
223
|
+
- Privacy.
|
|
224
|
+
- Data residency.
|
|
225
|
+
- Availability.
|
|
226
|
+
- Integration complexity.
|
|
227
|
+
- Licensing.
|
|
228
|
+
- Total cost.
|
|
229
|
+
|
|
230
|
+
Use task-specific evaluation results.
|
|
231
|
+
|
|
232
|
+
Do not automatically select the largest or most expensive model.
|
|
233
|
+
|
|
234
|
+
Do not select a cheaper model without verifying acceptable performance.
|
|
235
|
+
|
|
236
|
+
## 8. Prompt Engineering
|
|
237
|
+
|
|
238
|
+
Design prompts with clear:
|
|
239
|
+
|
|
240
|
+
- Task objectives.
|
|
241
|
+
- Context.
|
|
242
|
+
- Role boundaries.
|
|
243
|
+
- Input expectations.
|
|
244
|
+
- Output formats.
|
|
245
|
+
- Constraints.
|
|
246
|
+
- Error behavior.
|
|
247
|
+
- Tool-use permissions.
|
|
248
|
+
|
|
249
|
+
Prefer explicit and testable instructions.
|
|
250
|
+
|
|
251
|
+
Avoid unnecessarily long prompts.
|
|
252
|
+
|
|
253
|
+
Version important prompts.
|
|
254
|
+
|
|
255
|
+
Test prompts against representative and adversarial inputs.
|
|
256
|
+
|
|
257
|
+
Do not rely on prompt wording alone for security enforcement.
|
|
258
|
+
|
|
259
|
+
## 9. Prompt Injection Defense
|
|
260
|
+
|
|
261
|
+
Treat all external and user-controlled content as untrusted.
|
|
262
|
+
|
|
263
|
+
Potential injection sources include:
|
|
264
|
+
|
|
265
|
+
- User messages.
|
|
266
|
+
- Retrieved documents.
|
|
267
|
+
- Websites.
|
|
268
|
+
- Emails.
|
|
269
|
+
- Repository files.
|
|
270
|
+
- Search results.
|
|
271
|
+
- Images containing text.
|
|
272
|
+
- Tool responses.
|
|
273
|
+
- Database records.
|
|
274
|
+
- Logs.
|
|
275
|
+
- Third-party API output.
|
|
276
|
+
|
|
277
|
+
Never allow lower-trust content to override higher-priority system instructions or application policies.
|
|
278
|
+
|
|
279
|
+
Enforce permissions through trusted application code.
|
|
280
|
+
|
|
281
|
+
Limit tool capabilities and sensitive data exposure.
|
|
282
|
+
|
|
283
|
+
Use structured handling and validation where appropriate.
|
|
284
|
+
|
|
285
|
+
Test direct and indirect prompt injection attacks.
|
|
286
|
+
|
|
287
|
+
Do not assume filtering suspicious phrases is sufficient protection.
|
|
288
|
+
|
|
289
|
+
## 10. Trusted and Untrusted Boundaries
|
|
290
|
+
|
|
291
|
+
Separate:
|
|
292
|
+
|
|
293
|
+
- System instructions.
|
|
294
|
+
- Developer instructions.
|
|
295
|
+
- Authorized user requests.
|
|
296
|
+
- Retrieved evidence.
|
|
297
|
+
- Tool responses.
|
|
298
|
+
- Generated content.
|
|
299
|
+
|
|
300
|
+
Maintain clear trust boundaries.
|
|
301
|
+
|
|
302
|
+
Do not promote document content into privileged instructions.
|
|
303
|
+
|
|
304
|
+
Never execute commands supplied by retrieved content without explicit trusted authorization.
|
|
305
|
+
|
|
306
|
+
Do not treat model-generated instructions as authoritative operational policy.
|
|
307
|
+
|
|
308
|
+
## 11. Sensitive Information Protection
|
|
309
|
+
|
|
310
|
+
Identify sensitive information before sending data to AI providers.
|
|
311
|
+
|
|
312
|
+
Apply:
|
|
313
|
+
|
|
314
|
+
- Data minimization.
|
|
315
|
+
- Redaction where appropriate.
|
|
316
|
+
- Pseudonymization where appropriate.
|
|
317
|
+
- Secure transmission.
|
|
318
|
+
- Access controls.
|
|
319
|
+
- Retention controls.
|
|
320
|
+
- Logging restrictions.
|
|
321
|
+
- Contractual and privacy review.
|
|
322
|
+
|
|
323
|
+
Never place secrets or privileged credentials in prompts.
|
|
324
|
+
|
|
325
|
+
Never assume system prompts are secret.
|
|
326
|
+
|
|
327
|
+
Review provider data processing, retention and model-training terms.
|
|
328
|
+
|
|
329
|
+
Consult docs/privacy.md.
|
|
330
|
+
|
|
331
|
+
## 12. GDPR and AI Data Processing
|
|
332
|
+
|
|
333
|
+
For personal data processing, evaluate:
|
|
334
|
+
|
|
335
|
+
- Lawful basis.
|
|
336
|
+
- Purpose limitation.
|
|
337
|
+
- Data minimization.
|
|
338
|
+
- Transparency.
|
|
339
|
+
- Retention.
|
|
340
|
+
- Data subject rights.
|
|
341
|
+
- International transfers.
|
|
342
|
+
- Processor relationships.
|
|
343
|
+
- Automated decision-making restrictions.
|
|
344
|
+
- Applicable DPIA requirements.
|
|
345
|
+
|
|
346
|
+
Assess applicable AI-specific laws separately.
|
|
347
|
+
|
|
348
|
+
Apply heightened review to sensitive personal data and high-impact decisions.
|
|
349
|
+
|
|
350
|
+
Do not assume user consent is always the correct or required legal basis.
|
|
351
|
+
|
|
352
|
+
Never assume an AI provider's advertised compliance removes the application's own responsibilities.
|
|
353
|
+
|
|
354
|
+
## 13. AI Authorization
|
|
355
|
+
|
|
356
|
+
AI agents must operate within the permissions of the relevant user or service identity.
|
|
357
|
+
|
|
358
|
+
Enforce authorization before retrieving information or executing actions.
|
|
359
|
+
|
|
360
|
+
Never allow models to select or override their own permissions.
|
|
361
|
+
|
|
362
|
+
Validate:
|
|
363
|
+
|
|
364
|
+
- User identity.
|
|
365
|
+
- Tenant membership.
|
|
366
|
+
- Resource ownership.
|
|
367
|
+
- Operation scope.
|
|
368
|
+
- Tool permissions.
|
|
369
|
+
- Data visibility.
|
|
370
|
+
|
|
371
|
+
Authorization must be enforced by trusted systems.
|
|
372
|
+
|
|
373
|
+
## 14. Human Oversight
|
|
374
|
+
|
|
375
|
+
Define human oversight according to action risk.
|
|
376
|
+
|
|
377
|
+
Require explicit approval for high-impact operations, including:
|
|
378
|
+
|
|
379
|
+
- Financial transactions.
|
|
380
|
+
- Destructive data modifications.
|
|
381
|
+
- Production deployments.
|
|
382
|
+
- Security policy changes.
|
|
383
|
+
- Privileged access changes.
|
|
384
|
+
- Legal or regulatory submissions.
|
|
385
|
+
- Sensitive external communications.
|
|
386
|
+
- Critical business decisions.
|
|
387
|
+
- Significant infrastructure expenses.
|
|
388
|
+
|
|
389
|
+
Do not treat a model recommendation as human authorization.
|
|
390
|
+
|
|
391
|
+
Record meaningful approvals where appropriate.
|
|
392
|
+
|
|
393
|
+
## 15. Agentic Architecture
|
|
394
|
+
|
|
395
|
+
Prefer the simplest agent architecture that satisfies the requirements.
|
|
396
|
+
|
|
397
|
+
Possible approaches include:
|
|
398
|
+
|
|
399
|
+
- Single-model workflows.
|
|
400
|
+
- Single agents.
|
|
401
|
+
- Tool-using agents.
|
|
402
|
+
- Deterministic orchestration.
|
|
403
|
+
- Multi-agent coordination.
|
|
404
|
+
- Human-in-the-loop workflows.
|
|
405
|
+
|
|
406
|
+
Do not introduce multi-agent systems without a clear benefit.
|
|
407
|
+
|
|
408
|
+
Define each agent's:
|
|
409
|
+
|
|
410
|
+
- Responsibilities.
|
|
411
|
+
- Allowed tools.
|
|
412
|
+
- Permissions.
|
|
413
|
+
- Input contracts.
|
|
414
|
+
- Output contracts.
|
|
415
|
+
- State boundaries.
|
|
416
|
+
- Resource budgets.
|
|
417
|
+
- Failure behavior.
|
|
418
|
+
|
|
419
|
+
Avoid overlapping responsibilities and uncontrolled delegation.
|
|
420
|
+
|
|
421
|
+
## 16. Controlled Agent Autonomy
|
|
422
|
+
|
|
423
|
+
Bound autonomous execution.
|
|
424
|
+
|
|
425
|
+
Define appropriate limits for:
|
|
426
|
+
|
|
427
|
+
- Execution steps.
|
|
428
|
+
- Tool calls.
|
|
429
|
+
- Runtime.
|
|
430
|
+
- Token usage.
|
|
431
|
+
- Retries.
|
|
432
|
+
- Concurrency.
|
|
433
|
+
- Financial spending.
|
|
434
|
+
- Recursive delegation.
|
|
435
|
+
|
|
436
|
+
Detect repeated failures and loops.
|
|
437
|
+
|
|
438
|
+
Require authorization before irreversible or high-risk actions.
|
|
439
|
+
|
|
440
|
+
Never assume agent autonomy is inherently safe.
|
|
441
|
+
|
|
442
|
+
## 17. Tool Calling and Function Calling
|
|
443
|
+
|
|
444
|
+
Expose only necessary tools.
|
|
445
|
+
|
|
446
|
+
Use typed input schemas and validated parameters.
|
|
447
|
+
|
|
448
|
+
Enforce server-side authorization.
|
|
449
|
+
|
|
450
|
+
Validate tool results before downstream use.
|
|
451
|
+
|
|
452
|
+
Use appropriate:
|
|
453
|
+
|
|
454
|
+
- Timeouts.
|
|
455
|
+
- Retries.
|
|
456
|
+
- Idempotency.
|
|
457
|
+
- Rate limits.
|
|
458
|
+
- Error handling.
|
|
459
|
+
- Audit trails.
|
|
460
|
+
|
|
461
|
+
Do not expose unrestricted shell, filesystem, database or infrastructure access to production agents.
|
|
462
|
+
|
|
463
|
+
Never rely solely on model reasoning to determine whether a tool call is permitted.
|
|
464
|
+
|
|
465
|
+
## 18. Model Context Protocol (MCP)
|
|
466
|
+
|
|
467
|
+
MCP integrations must follow the applicable current protocol specification and security requirements.
|
|
468
|
+
|
|
469
|
+
Evaluate:
|
|
470
|
+
|
|
471
|
+
- Server trust.
|
|
472
|
+
- Tool descriptions.
|
|
473
|
+
- Authentication.
|
|
474
|
+
- Authorization.
|
|
475
|
+
- Token audience validation.
|
|
476
|
+
- Credential storage.
|
|
477
|
+
- Tool permissions.
|
|
478
|
+
- Resource access.
|
|
479
|
+
- Prompt injection exposure.
|
|
480
|
+
- Network boundaries.
|
|
481
|
+
- Logging.
|
|
482
|
+
- Data disclosure.
|
|
483
|
+
- Tool provenance.
|
|
484
|
+
|
|
485
|
+
Treat MCP servers as external dependencies with explicit trust boundaries.
|
|
486
|
+
|
|
487
|
+
Do not assume an MCP server is safe because it follows the protocol.
|
|
488
|
+
|
|
489
|
+
Never pass authentication tokens through to unintended services.
|
|
490
|
+
|
|
491
|
+
Validate access at each resource boundary.
|
|
492
|
+
|
|
493
|
+
Restrict production-changing MCP tools.
|
|
494
|
+
|
|
495
|
+
Require approval before installing new privileged MCP integrations.
|
|
496
|
+
|
|
497
|
+
## 19. Multi-Agent Systems
|
|
498
|
+
|
|
499
|
+
For multi-agent systems:
|
|
500
|
+
|
|
501
|
+
- Define explicit responsibilities.
|
|
502
|
+
- Limit delegation.
|
|
503
|
+
- Validate inter-agent messages.
|
|
504
|
+
- Preserve authorization boundaries.
|
|
505
|
+
- Restrict shared memory.
|
|
506
|
+
- Control tool access.
|
|
507
|
+
- Define failure escalation.
|
|
508
|
+
- Track workflow state.
|
|
509
|
+
- Limit inference costs.
|
|
510
|
+
- Prevent recursive agent loops.
|
|
511
|
+
|
|
512
|
+
Do not assume agents agree on facts or share correct context.
|
|
513
|
+
|
|
514
|
+
Use deterministic validation at critical boundaries.
|
|
515
|
+
|
|
516
|
+
## 20. RAG Architecture
|
|
517
|
+
|
|
518
|
+
Before implementing Retrieval-Augmented Generation:
|
|
519
|
+
|
|
520
|
+
1. Identify knowledge sources.
|
|
521
|
+
2. Define document ownership.
|
|
522
|
+
3. Classify data sensitivity.
|
|
523
|
+
4. Define ingestion workflows.
|
|
524
|
+
5. Select extraction methods.
|
|
525
|
+
6. Evaluate chunking.
|
|
526
|
+
7. Select embedding strategies.
|
|
527
|
+
8. Define indexing.
|
|
528
|
+
9. Define retrieval.
|
|
529
|
+
10. Define authorization.
|
|
530
|
+
11. Define evaluation metrics.
|
|
531
|
+
12. Define document update behavior.
|
|
532
|
+
13. Define deletion behavior.
|
|
533
|
+
14. Estimate operational costs.
|
|
534
|
+
15. Define monitoring.
|
|
535
|
+
|
|
536
|
+
Do not use RAG merely because an LLM application exists.
|
|
537
|
+
|
|
538
|
+
## 21. Secure RAG Retrieval
|
|
539
|
+
|
|
540
|
+
Enforce access control before unauthorized content can reach the model.
|
|
541
|
+
|
|
542
|
+
Validate:
|
|
543
|
+
|
|
544
|
+
- User permissions.
|
|
545
|
+
- Tenant isolation.
|
|
546
|
+
- Document ownership.
|
|
547
|
+
- Classification restrictions.
|
|
548
|
+
- Applicable sharing policies.
|
|
549
|
+
|
|
550
|
+
Never rely on the LLM to ignore documents it should not have received.
|
|
551
|
+
|
|
552
|
+
Apply authorization to vector search, keyword search, hybrid search and document fetching.
|
|
553
|
+
|
|
554
|
+
Test cross-tenant retrieval attempts.
|
|
555
|
+
|
|
556
|
+
## 22. Document Ingestion
|
|
557
|
+
|
|
558
|
+
For document-based AI systems:
|
|
559
|
+
|
|
560
|
+
- Validate file types.
|
|
561
|
+
- Validate file sizes.
|
|
562
|
+
- Scan untrusted uploads where justified.
|
|
563
|
+
- Isolate parsing workloads.
|
|
564
|
+
- Protect against malicious document content.
|
|
565
|
+
- Track ingestion status.
|
|
566
|
+
- Record source metadata.
|
|
567
|
+
- Handle extraction failures.
|
|
568
|
+
- Preserve required document provenance.
|
|
569
|
+
- Apply retention and deletion policies.
|
|
570
|
+
|
|
571
|
+
Treat extracted text as untrusted content.
|
|
572
|
+
|
|
573
|
+
Do not execute code or instructions embedded in documents.
|
|
574
|
+
|
|
575
|
+
## 23. Chunking and Embeddings
|
|
576
|
+
|
|
577
|
+
Select chunking strategies according to document characteristics.
|
|
578
|
+
|
|
579
|
+
Evaluate:
|
|
580
|
+
|
|
581
|
+
- Semantic coherence.
|
|
582
|
+
- Chunk size.
|
|
583
|
+
- Overlap.
|
|
584
|
+
- Metadata preservation.
|
|
585
|
+
- Retrieval precision.
|
|
586
|
+
- Retrieval recall.
|
|
587
|
+
- Embedding dimensionality.
|
|
588
|
+
- Storage cost.
|
|
589
|
+
- Update cost.
|
|
590
|
+
|
|
591
|
+
Avoid embedding unchanged content repeatedly.
|
|
592
|
+
|
|
593
|
+
Track source and embedding versions.
|
|
594
|
+
|
|
595
|
+
Reevaluate chunking based on measured retrieval quality.
|
|
596
|
+
|
|
597
|
+
## 24. Vector Database Independence
|
|
598
|
+
|
|
599
|
+
Support relevant technologies including:
|
|
600
|
+
|
|
601
|
+
- PostgreSQL with pgvector.
|
|
602
|
+
- Managed vector databases.
|
|
603
|
+
- Open-source vector engines.
|
|
604
|
+
- Search engines with vector capabilities.
|
|
605
|
+
- Cloud-native vector search.
|
|
606
|
+
- Hybrid retrieval platforms.
|
|
607
|
+
|
|
608
|
+
Do not mandate a vector database provider.
|
|
609
|
+
|
|
610
|
+
Choose according to:
|
|
611
|
+
|
|
612
|
+
- Retrieval quality.
|
|
613
|
+
- Access control.
|
|
614
|
+
- Workload size.
|
|
615
|
+
- Latency.
|
|
616
|
+
- Availability.
|
|
617
|
+
- Operations.
|
|
618
|
+
- Cost.
|
|
619
|
+
- Portability.
|
|
620
|
+
|
|
621
|
+
Consult docs/data.md.
|
|
622
|
+
|
|
623
|
+
## 25. Retrieval Quality
|
|
624
|
+
|
|
625
|
+
Evaluate retrieval using representative datasets.
|
|
626
|
+
|
|
627
|
+
Consider:
|
|
628
|
+
|
|
629
|
+
- Recall.
|
|
630
|
+
- Precision.
|
|
631
|
+
- Relevance.
|
|
632
|
+
- Ranking quality.
|
|
633
|
+
- Coverage.
|
|
634
|
+
- Freshness.
|
|
635
|
+
- Authorization correctness.
|
|
636
|
+
- Query latency.
|
|
637
|
+
|
|
638
|
+
Use hybrid search or reranking when evaluations justify them.
|
|
639
|
+
|
|
640
|
+
Do not assume vector similarity guarantees factual relevance.
|
|
641
|
+
|
|
642
|
+
## 26. Grounding and Citations
|
|
643
|
+
|
|
644
|
+
For evidence-based systems:
|
|
645
|
+
|
|
646
|
+
- Preserve source references.
|
|
647
|
+
- Separate evidence from generated interpretation.
|
|
648
|
+
- Identify missing evidence.
|
|
649
|
+
- Avoid invented citations.
|
|
650
|
+
- Expose uncertainty where relevant.
|
|
651
|
+
- Validate critical factual claims.
|
|
652
|
+
|
|
653
|
+
The model must not invent sources or imply verification that did not occur.
|
|
654
|
+
|
|
655
|
+
Citations should point to accessible and authorized evidence when feasible.
|
|
656
|
+
|
|
657
|
+
## 27. Hallucination Management
|
|
658
|
+
|
|
659
|
+
Treat unsupported model outputs as a reliability risk.
|
|
660
|
+
|
|
661
|
+
Possible mitigations include:
|
|
662
|
+
|
|
663
|
+
- Retrieval grounding.
|
|
664
|
+
- Structured outputs.
|
|
665
|
+
- Deterministic validation.
|
|
666
|
+
- Source verification.
|
|
667
|
+
- Confidence-aware escalation.
|
|
668
|
+
- Human review.
|
|
669
|
+
- Refusal to fabricate unavailable information.
|
|
670
|
+
|
|
671
|
+
Do not assume an LLM's self-reported confidence is calibrated.
|
|
672
|
+
|
|
673
|
+
Evaluate factual correctness against independent references.
|
|
674
|
+
|
|
675
|
+
## 28. Structured Outputs
|
|
676
|
+
|
|
677
|
+
Use schema-constrained outputs where supported and appropriate.
|
|
678
|
+
|
|
679
|
+
Validate outputs in trusted application code.
|
|
680
|
+
|
|
681
|
+
Consider:
|
|
682
|
+
|
|
683
|
+
- Type correctness.
|
|
684
|
+
- Required fields.
|
|
685
|
+
- Allowed values.
|
|
686
|
+
- Maximum lengths.
|
|
687
|
+
- Cross-field constraints.
|
|
688
|
+
- Domain invariants.
|
|
689
|
+
|
|
690
|
+
Do not assume syntactically valid JSON is semantically correct.
|
|
691
|
+
|
|
692
|
+
Never pass unvalidated model output directly into privileged operations.
|
|
693
|
+
|
|
694
|
+
## 29. AI Decision Support
|
|
695
|
+
|
|
696
|
+
For systems that recommend important decisions:
|
|
697
|
+
|
|
698
|
+
- Distinguish recommendations from final decisions.
|
|
699
|
+
- Present relevant evidence.
|
|
700
|
+
- Explain material assumptions.
|
|
701
|
+
- Record appropriate audit information.
|
|
702
|
+
- Surface uncertainty.
|
|
703
|
+
- Provide human review and override when required.
|
|
704
|
+
- Enforce deterministic business constraints.
|
|
705
|
+
|
|
706
|
+
Do not automatically execute consequential decisions unless authorized and legally appropriate.
|
|
707
|
+
|
|
708
|
+
## 30. High-Impact Domains
|
|
709
|
+
|
|
710
|
+
Apply additional safeguards to:
|
|
711
|
+
|
|
712
|
+
- Healthcare.
|
|
713
|
+
- Insurance.
|
|
714
|
+
- Financial services.
|
|
715
|
+
- Employment.
|
|
716
|
+
- Education.
|
|
717
|
+
- Public services.
|
|
718
|
+
- Identity verification.
|
|
719
|
+
- Safety-critical operations.
|
|
720
|
+
|
|
721
|
+
Evaluate sector-specific regulations, accuracy requirements, discrimination risks, professional oversight and operational consequences.
|
|
722
|
+
|
|
723
|
+
Do not assume one compliance design applies to every country or market.
|
|
724
|
+
|
|
725
|
+
## 31. Bias and Fairness Evaluation
|
|
726
|
+
|
|
727
|
+
Where relevant, evaluate:
|
|
728
|
+
|
|
729
|
+
- Unequal error rates.
|
|
730
|
+
- Dataset representativeness.
|
|
731
|
+
- Potential proxy variables.
|
|
732
|
+
- Differential performance.
|
|
733
|
+
- Accessibility.
|
|
734
|
+
- Language coverage.
|
|
735
|
+
- Harmful decision patterns.
|
|
736
|
+
|
|
737
|
+
Use appropriate lawful evaluation methods.
|
|
738
|
+
|
|
739
|
+
Do not infer fairness solely from overall accuracy.
|
|
740
|
+
|
|
741
|
+
Document known limitations.
|
|
742
|
+
|
|
743
|
+
## 32. Multimodal AI
|
|
744
|
+
|
|
745
|
+
For images, audio, video and other modalities:
|
|
746
|
+
|
|
747
|
+
- Define accepted inputs.
|
|
748
|
+
- Validate media.
|
|
749
|
+
- Limit file size and duration.
|
|
750
|
+
- Protect sensitive content.
|
|
751
|
+
- Evaluate extraction accuracy.
|
|
752
|
+
- Handle unsupported formats.
|
|
753
|
+
- Manage processing costs.
|
|
754
|
+
- Apply retention rules.
|
|
755
|
+
- Control external data sharing.
|
|
756
|
+
|
|
757
|
+
Never assume multimodal outputs are reliable without task-specific evaluation.
|
|
758
|
+
|
|
759
|
+
## 33. Speech and Audio AI
|
|
760
|
+
|
|
761
|
+
Evaluate:
|
|
762
|
+
|
|
763
|
+
- Transcription accuracy.
|
|
764
|
+
- Language coverage.
|
|
765
|
+
- Speaker handling.
|
|
766
|
+
- Background noise.
|
|
767
|
+
- Latency.
|
|
768
|
+
- Recording permissions.
|
|
769
|
+
- Privacy.
|
|
770
|
+
- Retention.
|
|
771
|
+
- Processing costs.
|
|
772
|
+
|
|
773
|
+
Apply appropriate consent and notification requirements where legally necessary.
|
|
774
|
+
|
|
775
|
+
Do not retain audio indefinitely without justification.
|
|
776
|
+
|
|
777
|
+
## 34. Computer Vision
|
|
778
|
+
|
|
779
|
+
For computer vision features:
|
|
780
|
+
|
|
781
|
+
- Define supported visual tasks.
|
|
782
|
+
- Evaluate relevant error modes.
|
|
783
|
+
- Test diverse real-world conditions.
|
|
784
|
+
- Assess privacy and biometric implications.
|
|
785
|
+
- Validate model outputs before important actions.
|
|
786
|
+
|
|
787
|
+
Never assume object recognition, OCR or image interpretation is perfectly accurate.
|
|
788
|
+
|
|
789
|
+
## 35. Model Fine-Tuning
|
|
790
|
+
|
|
791
|
+
Use fine-tuning only when justified by evaluation.
|
|
792
|
+
|
|
793
|
+
Consider:
|
|
794
|
+
|
|
795
|
+
- Training data quality.
|
|
796
|
+
- Licensing.
|
|
797
|
+
- Privacy.
|
|
798
|
+
- Data rights.
|
|
799
|
+
- Poisoning risks.
|
|
800
|
+
- Evaluation datasets.
|
|
801
|
+
- Overfitting.
|
|
802
|
+
- Deployment complexity.
|
|
803
|
+
- Model versioning.
|
|
804
|
+
- Training and hosting costs.
|
|
805
|
+
|
|
806
|
+
Do not fine-tune models on private user data without an appropriate legal and authorized basis.
|
|
807
|
+
|
|
808
|
+
## 36. Self-Hosted AI Models
|
|
809
|
+
|
|
810
|
+
Evaluate:
|
|
811
|
+
|
|
812
|
+
- Compute and accelerator requirements.
|
|
813
|
+
- GPU memory.
|
|
814
|
+
- Throughput.
|
|
815
|
+
- Latency.
|
|
816
|
+
- Model licensing.
|
|
817
|
+
- Infrastructure security.
|
|
818
|
+
- Model updates.
|
|
819
|
+
- Availability.
|
|
820
|
+
- Monitoring.
|
|
821
|
+
- Operational maintenance.
|
|
822
|
+
- Total cost.
|
|
823
|
+
|
|
824
|
+
Do not assume self-hosting is always cheaper or more private.
|
|
825
|
+
|
|
826
|
+
Compare managed and self-hosted alternatives using actual requirements.
|
|
827
|
+
|
|
828
|
+
## 37. AI Evaluation Strategy
|
|
829
|
+
|
|
830
|
+
Define measurable evaluation criteria before significant deployment.
|
|
831
|
+
|
|
832
|
+
Evaluate:
|
|
833
|
+
|
|
834
|
+
- Task correctness.
|
|
835
|
+
- Factuality.
|
|
836
|
+
- Retrieval quality.
|
|
837
|
+
- Tool-use accuracy.
|
|
838
|
+
- Authorization.
|
|
839
|
+
- Robustness.
|
|
840
|
+
- Latency.
|
|
841
|
+
- Cost.
|
|
842
|
+
- Failure handling.
|
|
843
|
+
- Safety.
|
|
844
|
+
|
|
845
|
+
Use representative datasets.
|
|
846
|
+
|
|
847
|
+
Distinguish automated scores from human assessments.
|
|
848
|
+
|
|
849
|
+
Avoid relying exclusively on model-based judging.
|
|
850
|
+
|
|
851
|
+
## 38. Regression Testing
|
|
852
|
+
|
|
853
|
+
Maintain evaluation datasets for important workflows.
|
|
854
|
+
|
|
855
|
+
Test changes to:
|
|
856
|
+
|
|
857
|
+
- Model versions.
|
|
858
|
+
- Prompts.
|
|
859
|
+
- Retrieval pipelines.
|
|
860
|
+
- Tools.
|
|
861
|
+
- Schemas.
|
|
862
|
+
- Orchestration.
|
|
863
|
+
- Embeddings.
|
|
864
|
+
- Ranking.
|
|
865
|
+
- Context management.
|
|
866
|
+
|
|
867
|
+
Compare results against established baselines.
|
|
868
|
+
|
|
869
|
+
Do not deploy meaningful AI behavior changes without appropriate regression evaluation.
|
|
870
|
+
|
|
871
|
+
## 39. Adversarial Testing
|
|
872
|
+
|
|
873
|
+
Test relevant adversarial scenarios, including:
|
|
874
|
+
|
|
875
|
+
- Prompt injection.
|
|
876
|
+
- Unauthorized tool execution.
|
|
877
|
+
- Sensitive information disclosure.
|
|
878
|
+
- Cross-tenant retrieval.
|
|
879
|
+
- Malicious documents.
|
|
880
|
+
- Tool output manipulation.
|
|
881
|
+
- Excessive agent actions.
|
|
882
|
+
- Model output abuse.
|
|
883
|
+
- Resource exhaustion.
|
|
884
|
+
- Dependency compromise.
|
|
885
|
+
|
|
886
|
+
Prioritize tests according to threat models and application risk.
|
|
887
|
+
|
|
888
|
+
Do not claim an AI system is immune to prompt injection.
|
|
889
|
+
|
|
890
|
+
## 40. AI Supply Chain Security
|
|
891
|
+
|
|
892
|
+
Evaluate:
|
|
893
|
+
|
|
894
|
+
- Model provenance.
|
|
895
|
+
- Model licenses.
|
|
896
|
+
- Training data claims where relevant.
|
|
897
|
+
- External model repositories.
|
|
898
|
+
- Model file integrity.
|
|
899
|
+
- SDK dependencies.
|
|
900
|
+
- Agent frameworks.
|
|
901
|
+
- MCP servers.
|
|
902
|
+
- Tools and plugins.
|
|
903
|
+
- Embedding packages.
|
|
904
|
+
- Container images.
|
|
905
|
+
|
|
906
|
+
Prefer trusted sources.
|
|
907
|
+
|
|
908
|
+
Verify artifacts when appropriate.
|
|
909
|
+
|
|
910
|
+
Do not execute untrusted model repository code without isolation and review.
|
|
911
|
+
|
|
912
|
+
## 41. AI Secrets Management
|
|
913
|
+
|
|
914
|
+
Protect:
|
|
915
|
+
|
|
916
|
+
- Provider API keys.
|
|
917
|
+
- Service credentials.
|
|
918
|
+
- Database secrets.
|
|
919
|
+
- OAuth tokens.
|
|
920
|
+
- Infrastructure credentials.
|
|
921
|
+
- Signing keys.
|
|
922
|
+
- Webhook secrets.
|
|
923
|
+
|
|
924
|
+
Never place production secrets in prompts, source code, logs or client applications.
|
|
925
|
+
|
|
926
|
+
Use approved secret management mechanisms.
|
|
927
|
+
|
|
928
|
+
Apply least privilege and rotation procedures.
|
|
929
|
+
|
|
930
|
+
## 42. AI Cost Engineering
|
|
931
|
+
|
|
932
|
+
Evaluate complete AI workflow costs.
|
|
933
|
+
|
|
934
|
+
Include:
|
|
935
|
+
|
|
936
|
+
- Input tokens.
|
|
937
|
+
- Output tokens.
|
|
938
|
+
- Cached tokens where applicable.
|
|
939
|
+
- Tool calls.
|
|
940
|
+
- Embeddings.
|
|
941
|
+
- Retrieval.
|
|
942
|
+
- Reranking.
|
|
943
|
+
- Model hosting.
|
|
944
|
+
- File processing.
|
|
945
|
+
- Audio and video processing.
|
|
946
|
+
- Retries.
|
|
947
|
+
- Background execution.
|
|
948
|
+
- Monitoring.
|
|
949
|
+
|
|
950
|
+
Define appropriate budgets.
|
|
951
|
+
|
|
952
|
+
Consult docs/cost-engineering.md.
|
|
953
|
+
|
|
954
|
+
## 43. Unbounded Consumption Prevention
|
|
955
|
+
|
|
956
|
+
Protect against uncontrolled cost and resource usage.
|
|
957
|
+
|
|
958
|
+
Implement appropriate:
|
|
959
|
+
|
|
960
|
+
- Token limits.
|
|
961
|
+
- Execution limits.
|
|
962
|
+
- Request quotas.
|
|
963
|
+
- Concurrency limits.
|
|
964
|
+
- Timeouts.
|
|
965
|
+
- Bounded retries.
|
|
966
|
+
- Agent step limits.
|
|
967
|
+
- File size limits.
|
|
968
|
+
- Tool invocation limits.
|
|
969
|
+
- Spending controls.
|
|
970
|
+
|
|
971
|
+
Detect abnormal usage.
|
|
972
|
+
|
|
973
|
+
Prevent attackers from triggering unlimited paid inference.
|
|
974
|
+
|
|
975
|
+
## 44. AI Performance and Scalability
|
|
976
|
+
|
|
977
|
+
Evaluate:
|
|
978
|
+
|
|
979
|
+
- Peak AI concurrency.
|
|
980
|
+
- Model throughput.
|
|
981
|
+
- Provider quotas.
|
|
982
|
+
- Queueing delays.
|
|
983
|
+
- End-to-end latency.
|
|
984
|
+
- Retrieval bottlenecks.
|
|
985
|
+
- Worker capacity.
|
|
986
|
+
- Rate limits.
|
|
987
|
+
- GPU capacity where relevant.
|
|
988
|
+
- Geographic latency.
|
|
989
|
+
- Fallback behavior.
|
|
990
|
+
|
|
991
|
+
Scale infrastructure according to measured requirements.
|
|
992
|
+
|
|
993
|
+
Do not assume model APIs or self-hosted inference have unlimited capacity.
|
|
994
|
+
|
|
995
|
+
Consult docs/scalability.md.
|
|
996
|
+
|
|
997
|
+
## 45. Model Routing and Fallback
|
|
998
|
+
|
|
999
|
+
Use model routing only when justified.
|
|
1000
|
+
|
|
1001
|
+
Define:
|
|
1002
|
+
|
|
1003
|
+
- Task requirements.
|
|
1004
|
+
- Primary model.
|
|
1005
|
+
- Alternative models.
|
|
1006
|
+
- Quality thresholds.
|
|
1007
|
+
- Failure triggers.
|
|
1008
|
+
- Latency objectives.
|
|
1009
|
+
- Privacy restrictions.
|
|
1010
|
+
- Cost implications.
|
|
1011
|
+
|
|
1012
|
+
Test fallback quality and data handling.
|
|
1013
|
+
|
|
1014
|
+
Do not route sensitive data to a new provider without appropriate authorization and privacy review.
|
|
1015
|
+
|
|
1016
|
+
## 46. Reliability and Failure Handling
|
|
1017
|
+
|
|
1018
|
+
Handle:
|
|
1019
|
+
|
|
1020
|
+
- Model timeouts.
|
|
1021
|
+
- Provider outages.
|
|
1022
|
+
- Rate limits.
|
|
1023
|
+
- Malformed responses.
|
|
1024
|
+
- Invalid tool parameters.
|
|
1025
|
+
- Tool failures.
|
|
1026
|
+
- Partial workflows.
|
|
1027
|
+
- Retrieval failures.
|
|
1028
|
+
- Duplicate execution.
|
|
1029
|
+
|
|
1030
|
+
Use bounded retries and graceful degradation.
|
|
1031
|
+
|
|
1032
|
+
Define escalation paths for unresolved failures.
|
|
1033
|
+
|
|
1034
|
+
Do not hide consequential errors behind fabricated successful responses.
|
|
1035
|
+
|
|
1036
|
+
## 47. AI Observability
|
|
1037
|
+
|
|
1038
|
+
Monitor appropriate:
|
|
1039
|
+
|
|
1040
|
+
- Request volumes.
|
|
1041
|
+
- Model identifiers and versions.
|
|
1042
|
+
- Latency.
|
|
1043
|
+
- Token consumption.
|
|
1044
|
+
- Tool calls.
|
|
1045
|
+
- Failure rates.
|
|
1046
|
+
- Retrieval quality.
|
|
1047
|
+
- Cost.
|
|
1048
|
+
- Human escalation rates.
|
|
1049
|
+
- Safety-relevant events.
|
|
1050
|
+
|
|
1051
|
+
Use privacy-preserving telemetry.
|
|
1052
|
+
|
|
1053
|
+
Avoid recording full prompts and responses by default when they may contain sensitive data.
|
|
1054
|
+
|
|
1055
|
+
Consult docs/observability.md.
|
|
1056
|
+
|
|
1057
|
+
## 48. AI Auditability
|
|
1058
|
+
|
|
1059
|
+
For important workflows, record sufficient information to support investigation.
|
|
1060
|
+
|
|
1061
|
+
Consider:
|
|
1062
|
+
|
|
1063
|
+
- Workflow identity.
|
|
1064
|
+
- Model and prompt version.
|
|
1065
|
+
- Relevant policy version.
|
|
1066
|
+
- Tool actions.
|
|
1067
|
+
- Authorization outcomes.
|
|
1068
|
+
- Human approvals.
|
|
1069
|
+
- Relevant evidence references.
|
|
1070
|
+
- Errors.
|
|
1071
|
+
- Final action status.
|
|
1072
|
+
|
|
1073
|
+
Avoid excessive sensitive data retention.
|
|
1074
|
+
|
|
1075
|
+
Auditability does not require storing every private conversation indefinitely.
|
|
1076
|
+
|
|
1077
|
+
## 49. AI Data Retention and Deletion
|
|
1078
|
+
|
|
1079
|
+
Define retention for:
|
|
1080
|
+
|
|
1081
|
+
- Prompts.
|
|
1082
|
+
- Responses.
|
|
1083
|
+
- Uploaded documents.
|
|
1084
|
+
- Embeddings.
|
|
1085
|
+
- Agent state.
|
|
1086
|
+
- Conversation memory.
|
|
1087
|
+
- Logs.
|
|
1088
|
+
- Evaluation datasets.
|
|
1089
|
+
- Provider-side processing records.
|
|
1090
|
+
|
|
1091
|
+
Implement deletion and retention according to applicable requirements.
|
|
1092
|
+
|
|
1093
|
+
Consider backup lifecycle and third-party processors.
|
|
1094
|
+
|
|
1095
|
+
Never assume deleting a primary database record automatically deletes all derived AI data.
|
|
1096
|
+
|
|
1097
|
+
## 50. AI Memory and Persistent State
|
|
1098
|
+
|
|
1099
|
+
For AI agents with memory:
|
|
1100
|
+
|
|
1101
|
+
- Define memory purpose.
|
|
1102
|
+
- Limit stored information.
|
|
1103
|
+
- Apply authorization.
|
|
1104
|
+
- Isolate tenants.
|
|
1105
|
+
- Validate memory updates.
|
|
1106
|
+
- Define retention.
|
|
1107
|
+
- Support correction and deletion.
|
|
1108
|
+
- Prevent sensitive information leakage.
|
|
1109
|
+
|
|
1110
|
+
Treat remembered content as data, not privileged instructions.
|
|
1111
|
+
|
|
1112
|
+
Do not allow stored memory to override application security policies.
|
|
1113
|
+
|
|
1114
|
+
## 51. AI Framework Independence
|
|
1115
|
+
|
|
1116
|
+
Support relevant agent and LLM frameworks, including:
|
|
1117
|
+
|
|
1118
|
+
- LangChain.
|
|
1119
|
+
- LangGraph.
|
|
1120
|
+
- LlamaIndex.
|
|
1121
|
+
- Semantic Kernel.
|
|
1122
|
+
- AutoGen.
|
|
1123
|
+
- CrewAI.
|
|
1124
|
+
- Provider-native SDKs.
|
|
1125
|
+
- Custom orchestration.
|
|
1126
|
+
|
|
1127
|
+
No framework is mandatory by default.
|
|
1128
|
+
|
|
1129
|
+
Choose according to actual requirements, maintenance status, security, complexity and cost.
|
|
1130
|
+
|
|
1131
|
+
Avoid adding orchestration libraries when straightforward application code is sufficient.
|
|
1132
|
+
|
|
1133
|
+
## 52. AI and Database Integration
|
|
1134
|
+
|
|
1135
|
+
AI functionality must respect database security and integrity.
|
|
1136
|
+
|
|
1137
|
+
Enforce:
|
|
1138
|
+
|
|
1139
|
+
- Tenant isolation.
|
|
1140
|
+
- Authorization.
|
|
1141
|
+
- Transaction boundaries.
|
|
1142
|
+
- Data minimization.
|
|
1143
|
+
- Query safety.
|
|
1144
|
+
- Approved access patterns.
|
|
1145
|
+
- Migration controls.
|
|
1146
|
+
|
|
1147
|
+
Never give an LLM unrestricted production database permissions.
|
|
1148
|
+
|
|
1149
|
+
Never execute generated SQL against production without appropriate validation and authorization.
|
|
1150
|
+
|
|
1151
|
+
Consult docs/data.md.
|
|
1152
|
+
|
|
1153
|
+
## 53. AI in Web and Mobile Applications
|
|
1154
|
+
|
|
1155
|
+
For web, iOS and Android applications:
|
|
1156
|
+
|
|
1157
|
+
- Protect provider credentials.
|
|
1158
|
+
- Avoid exposing privileged tools.
|
|
1159
|
+
- Handle intermittent connectivity.
|
|
1160
|
+
- Apply server-side authorization.
|
|
1161
|
+
- Manage streaming responses safely.
|
|
1162
|
+
- Consider battery and network usage.
|
|
1163
|
+
- Protect user privacy.
|
|
1164
|
+
- Handle retries and cancellations.
|
|
1165
|
+
- Display meaningful errors.
|
|
1166
|
+
- Respect accessibility.
|
|
1167
|
+
|
|
1168
|
+
Do not embed unrestricted paid AI credentials in distributed client applications.
|
|
1169
|
+
|
|
1170
|
+
## 54. Existing Production AI Audits
|
|
1171
|
+
|
|
1172
|
+
When auditing an existing production system:
|
|
1173
|
+
|
|
1174
|
+
1. Inspect the actual architecture.
|
|
1175
|
+
2. Identify models and providers.
|
|
1176
|
+
3. Map AI data flows.
|
|
1177
|
+
4. Identify sensitive information.
|
|
1178
|
+
5. Review authorization boundaries.
|
|
1179
|
+
6. Inspect tools and agent permissions.
|
|
1180
|
+
7. Evaluate prompt injection risks.
|
|
1181
|
+
8. Review RAG access control.
|
|
1182
|
+
9. Evaluate existing test evidence.
|
|
1183
|
+
10. Assess latency and costs.
|
|
1184
|
+
11. Identify reliability risks.
|
|
1185
|
+
12. Review human oversight.
|
|
1186
|
+
13. Present prioritized findings.
|
|
1187
|
+
14. Recommend minimal safe improvements.
|
|
1188
|
+
15. Wait for explicit approval.
|
|
1189
|
+
|
|
1190
|
+
The initial audit must be read-only.
|
|
1191
|
+
|
|
1192
|
+
Do not modify prompts, models, tools, permissions, production data or infrastructure during the assessment.
|
|
1193
|
+
|
|
1194
|
+
Do not claim live evaluation results unless the relevant tests were actually executed.
|
|
1195
|
+
|
|
1196
|
+
## 55. AI Change Management
|
|
1197
|
+
|
|
1198
|
+
Before significant AI changes:
|
|
1199
|
+
|
|
1200
|
+
- Document current behavior.
|
|
1201
|
+
- Define the proposed change.
|
|
1202
|
+
- Identify affected users.
|
|
1203
|
+
- Assess security.
|
|
1204
|
+
- Assess privacy.
|
|
1205
|
+
- Evaluate compliance.
|
|
1206
|
+
- Estimate costs.
|
|
1207
|
+
- Define evaluation datasets.
|
|
1208
|
+
- Measure regression risks.
|
|
1209
|
+
- Define rollout strategy.
|
|
1210
|
+
- Define rollback strategy.
|
|
1211
|
+
- Obtain explicit human approval.
|
|
1212
|
+
|
|
1213
|
+
Never silently replace a production model when its behavior may affect critical workflows.
|
|
1214
|
+
|
|
1215
|
+
## 56. AI Deployment Requirements
|
|
1216
|
+
|
|
1217
|
+
Before production deployment:
|
|
1218
|
+
|
|
1219
|
+
1. Verify model and provider configuration.
|
|
1220
|
+
2. Confirm authorization controls.
|
|
1221
|
+
3. Validate secret handling.
|
|
1222
|
+
4. Evaluate relevant security threats.
|
|
1223
|
+
5. Run appropriate evaluations.
|
|
1224
|
+
6. Check cost limits.
|
|
1225
|
+
7. Check rate limits.
|
|
1226
|
+
8. Validate error handling.
|
|
1227
|
+
9. Confirm monitoring.
|
|
1228
|
+
10. Confirm rollback procedures.
|
|
1229
|
+
11. Record known limitations.
|
|
1230
|
+
12. Obtain required approval.
|
|
1231
|
+
|
|
1232
|
+
Do not confuse successful API responses with correct AI behavior.
|
|
1233
|
+
|
|
1234
|
+
## 57. AI Incident Response
|
|
1235
|
+
|
|
1236
|
+
Prepare appropriate procedures for:
|
|
1237
|
+
|
|
1238
|
+
- Sensitive data leakage.
|
|
1239
|
+
- Unauthorized agent actions.
|
|
1240
|
+
- Prompt injection exploitation.
|
|
1241
|
+
- Model misuse.
|
|
1242
|
+
- Unexpected financial consumption.
|
|
1243
|
+
- Incorrect high-impact decisions.
|
|
1244
|
+
- Provider outages.
|
|
1245
|
+
- Compromised tools or MCP servers.
|
|
1246
|
+
|
|
1247
|
+
Define escalation, containment, investigation, recovery and communication responsibilities.
|
|
1248
|
+
|
|
1249
|
+
Preserve necessary evidence in a privacy-conscious manner.
|
|
1250
|
+
|
|
1251
|
+
Require human authorization for significant production containment actions, except narrowly predefined emergency controls explicitly approved in advance.
|
|
1252
|
+
|
|
1253
|
+
## 58. AI Definition of Done
|
|
1254
|
+
|
|
1255
|
+
For significant AI functionality:
|
|
1256
|
+
|
|
1257
|
+
- Business purpose documented.
|
|
1258
|
+
- AI necessity justified.
|
|
1259
|
+
- Model selection evaluated.
|
|
1260
|
+
- Security boundaries defined.
|
|
1261
|
+
- Privacy reviewed.
|
|
1262
|
+
- Authorization verified.
|
|
1263
|
+
- Evaluation criteria established.
|
|
1264
|
+
- Representative tests executed.
|
|
1265
|
+
- Prompt injection risks considered.
|
|
1266
|
+
- Tool permissions restricted.
|
|
1267
|
+
- Human oversight defined.
|
|
1268
|
+
- Failure behavior tested.
|
|
1269
|
+
- Costs estimated.
|
|
1270
|
+
- Resource limits established.
|
|
1271
|
+
- Observability prepared.
|
|
1272
|
+
- Known limitations documented.
|
|
1273
|
+
- Rollback strategy defined.
|
|
1274
|
+
- Human approval obtained where required.
|
|
1275
|
+
|
|
1276
|
+
Never consider an AI feature production-ready solely because a demonstration works.
|
|
1277
|
+
|
|
1278
|
+
## 59. Reference Standards and Guidance
|
|
1279
|
+
|
|
1280
|
+
Use applicable current guidance, including:
|
|
1281
|
+
|
|
1282
|
+
- NIST AI Risk Management Framework.
|
|
1283
|
+
- NIST AI RMF Generative AI Profile.
|
|
1284
|
+
- OWASP Top 10 for LLM and Generative AI Applications.
|
|
1285
|
+
- OWASP guidance for agentic AI security.
|
|
1286
|
+
- Model Context Protocol security and authorization specifications.
|
|
1287
|
+
- Applicable privacy legislation.
|
|
1288
|
+
- Applicable AI-specific regulations.
|
|
1289
|
+
- Relevant sector-specific standards.
|
|
1290
|
+
|
|
1291
|
+
Verify the current official version before making compliance claims.
|
|
1292
|
+
|
|
1293
|
+
These references inform engineering practices; following this document alone does not establish formal legal or regulatory compliance.
|
|
1294
|
+
|
|
1295
|
+
## 60. Final AI Engineering Principles
|
|
1296
|
+
|
|
1297
|
+
Use AI only when justified.
|
|
1298
|
+
Prefer deterministic systems for exact decisions.
|
|
1299
|
+
Treat model outputs as untrusted.
|
|
1300
|
+
Enforce authorization outside the model.
|
|
1301
|
+
Protect sensitive data.
|
|
1302
|
+
Defend against prompt injection.
|
|
1303
|
+
Restrict agent permissions.
|
|
1304
|
+
Limit autonomous execution.
|
|
1305
|
+
Secure tool and MCP integrations.
|
|
1306
|
+
Protect RAG retrieval boundaries.
|
|
1307
|
+
Evaluate models using evidence.
|
|
1308
|
+
Maintain human oversight.
|
|
1309
|
+
Prevent unbounded AI costs.
|
|
1310
|
+
Measure reliability and performance.
|
|
1311
|
+
Preserve existing production systems.
|
|
1312
|
+
Require approval for significant changes.
|