@complior/engine 0.9.0

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.
Files changed (594) hide show
  1. package/.well-known/ai-compliance.json +16 -0
  2. package/COMPLIANCE.md +64 -0
  3. package/data/data-integrity.test.ts +75 -0
  4. package/data/eval/eval-mappings.json +33 -0
  5. package/data/llm/model-pricing.json +15 -0
  6. package/data/llm/model-routing.json +36 -0
  7. package/data/onboarding/risk-profile.json +17 -0
  8. package/data/regulations/eu-ai-act/README.md +245 -0
  9. package/data/regulations/eu-ai-act/applicability-tree.json +160 -0
  10. package/data/regulations/eu-ai-act/cross-mapping.json +175 -0
  11. package/data/regulations/eu-ai-act/localization.json +186 -0
  12. package/data/regulations/eu-ai-act/obligations.json +3981 -0
  13. package/data/regulations/eu-ai-act/regulation-meta.json +482 -0
  14. package/data/regulations/eu-ai-act/scoring.json +342 -0
  15. package/data/regulations/eu-ai-act/technical-requirements.json +2590 -0
  16. package/data/regulations/eu-ai-act/timeline.json +160 -0
  17. package/data/regulations/jurisdictions/at.json +15 -0
  18. package/data/regulations/jurisdictions/be.json +15 -0
  19. package/data/regulations/jurisdictions/bg.json +15 -0
  20. package/data/regulations/jurisdictions/cy.json +15 -0
  21. package/data/regulations/jurisdictions/cz.json +15 -0
  22. package/data/regulations/jurisdictions/de.json +15 -0
  23. package/data/regulations/jurisdictions/dk.json +15 -0
  24. package/data/regulations/jurisdictions/ee.json +15 -0
  25. package/data/regulations/jurisdictions/es.json +15 -0
  26. package/data/regulations/jurisdictions/fi.json +15 -0
  27. package/data/regulations/jurisdictions/fr.json +15 -0
  28. package/data/regulations/jurisdictions/gr.json +15 -0
  29. package/data/regulations/jurisdictions/hr.json +15 -0
  30. package/data/regulations/jurisdictions/hu.json +15 -0
  31. package/data/regulations/jurisdictions/ie.json +15 -0
  32. package/data/regulations/jurisdictions/is.json +15 -0
  33. package/data/regulations/jurisdictions/it.json +15 -0
  34. package/data/regulations/jurisdictions/li.json +15 -0
  35. package/data/regulations/jurisdictions/lt.json +15 -0
  36. package/data/regulations/jurisdictions/lu.json +15 -0
  37. package/data/regulations/jurisdictions/lv.json +15 -0
  38. package/data/regulations/jurisdictions/mt.json +15 -0
  39. package/data/regulations/jurisdictions/nl.json +15 -0
  40. package/data/regulations/jurisdictions/no.json +15 -0
  41. package/data/regulations/jurisdictions/pl.json +15 -0
  42. package/data/regulations/jurisdictions/pt.json +15 -0
  43. package/data/regulations/jurisdictions/ro.json +15 -0
  44. package/data/regulations/jurisdictions/se.json +15 -0
  45. package/data/regulations/jurisdictions/si.json +15 -0
  46. package/data/regulations/jurisdictions/sk.json +15 -0
  47. package/data/scanner/check-id-categories.json +81 -0
  48. package/data/scanner/confidence-params.json +16 -0
  49. package/data/scanner/limits.json +4 -0
  50. package/data/schemas/http-contract-sample.json +79 -0
  51. package/data/schemas/http-contract.json +144 -0
  52. package/data/semgrep-rules/bare-call.yaml +37 -0
  53. package/data/semgrep-rules/injection.yaml +73 -0
  54. package/data/semgrep-rules/missing-error-handling.yaml +58 -0
  55. package/data/semgrep-rules/unsafe-deser.yaml +65 -0
  56. package/data/templates/eu-ai-act/ai-literacy.md +184 -0
  57. package/data/templates/eu-ai-act/art5-screening.md +131 -0
  58. package/data/templates/eu-ai-act/data-governance.md +145 -0
  59. package/data/templates/eu-ai-act/declaration-of-conformity.md +161 -0
  60. package/data/templates/eu-ai-act/fria.md +127 -0
  61. package/data/templates/eu-ai-act/gpai-systemic-risk.md +150 -0
  62. package/data/templates/eu-ai-act/gpai-transparency.md +166 -0
  63. package/data/templates/eu-ai-act/incident-report.md +188 -0
  64. package/data/templates/eu-ai-act/instructions-for-use.md +202 -0
  65. package/data/templates/eu-ai-act/monitoring-policy.md +110 -0
  66. package/data/templates/eu-ai-act/qms.md +180 -0
  67. package/data/templates/eu-ai-act/risk-management-system.md +123 -0
  68. package/data/templates/eu-ai-act/technical-documentation.md +287 -0
  69. package/data/templates/eu-ai-act/worker-notification.md +143 -0
  70. package/data/templates/policies/biometrics-ai-policy.md +214 -0
  71. package/data/templates/policies/critical-infra-ai-policy.md +228 -0
  72. package/data/templates/policies/education-ai-policy.md +184 -0
  73. package/data/templates/policies/finance-ai-policy.md +191 -0
  74. package/data/templates/policies/healthcare-ai-policy.md +197 -0
  75. package/data/templates/policies/hr-ai-policy.md +178 -0
  76. package/data/templates/policies/legal-ai-policy.md +189 -0
  77. package/data/templates/policies/migration-ai-policy.md +239 -0
  78. package/engine.log +7 -0
  79. package/package.json +74 -0
  80. package/src/composition-root.ts +791 -0
  81. package/src/data/eval/conformity-tests.test.ts +122 -0
  82. package/src/data/eval/ct-1-transparency.ts +106 -0
  83. package/src/data/eval/ct-10-gpai.ts +25 -0
  84. package/src/data/eval/ct-11-industry.ts +42 -0
  85. package/src/data/eval/ct-2-oversight.ts +41 -0
  86. package/src/data/eval/ct-3-explanation.ts +14 -0
  87. package/src/data/eval/ct-4-bias.ts +83 -0
  88. package/src/data/eval/ct-5-accuracy.ts +41 -0
  89. package/src/data/eval/ct-6-robustness.ts +81 -0
  90. package/src/data/eval/ct-7-prohibited.ts +52 -0
  91. package/src/data/eval/ct-8-logging.ts +68 -0
  92. package/src/data/eval/ct-9-risk-awareness.ts +33 -0
  93. package/src/data/eval/deterministic-evaluator.ts +120 -0
  94. package/src/data/eval/index.ts +55 -0
  95. package/src/data/eval/judge-prompts.ts +146 -0
  96. package/src/data/eval/llm-judged-tests.ts +279 -0
  97. package/src/data/eval/llm-tests.test.ts +83 -0
  98. package/src/data/eval/remediation/ct-1-transparency.ts +91 -0
  99. package/src/data/eval/remediation/ct-10-gpai.ts +94 -0
  100. package/src/data/eval/remediation/ct-11-industry.ts +94 -0
  101. package/src/data/eval/remediation/ct-2-oversight.ts +71 -0
  102. package/src/data/eval/remediation/ct-3-explanation.ts +70 -0
  103. package/src/data/eval/remediation/ct-4-bias.ts +70 -0
  104. package/src/data/eval/remediation/ct-5-accuracy.ts +70 -0
  105. package/src/data/eval/remediation/ct-6-robustness.ts +70 -0
  106. package/src/data/eval/remediation/ct-7-prohibited.ts +94 -0
  107. package/src/data/eval/remediation/ct-8-logging.ts +94 -0
  108. package/src/data/eval/remediation/ct-9-risk-awareness.ts +94 -0
  109. package/src/data/eval/remediation/index.ts +89 -0
  110. package/src/data/eval/remediation/owasp-art5.ts +15 -0
  111. package/src/data/eval/remediation/owasp-llm01.ts +72 -0
  112. package/src/data/eval/remediation/owasp-llm02.ts +72 -0
  113. package/src/data/eval/remediation/owasp-llm03.ts +15 -0
  114. package/src/data/eval/remediation/owasp-llm04.ts +15 -0
  115. package/src/data/eval/remediation/owasp-llm05.ts +15 -0
  116. package/src/data/eval/remediation/owasp-llm06.ts +15 -0
  117. package/src/data/eval/remediation/owasp-llm07.ts +15 -0
  118. package/src/data/eval/remediation/owasp-llm08.ts +15 -0
  119. package/src/data/eval/remediation/owasp-llm09.ts +15 -0
  120. package/src/data/eval/remediation/owasp-llm10.ts +15 -0
  121. package/src/data/eval/remediation/remediation.test.ts +229 -0
  122. package/src/data/eval/remediation/test-mapping.ts +290 -0
  123. package/src/data/eval/security-rubrics.ts +381 -0
  124. package/src/data/finding-explanations.json +453 -0
  125. package/src/data/industry-patterns.ts +161 -0
  126. package/src/data/registry-cards.ts +368 -0
  127. package/src/data/regulation/index.ts +5 -0
  128. package/src/data/regulation/jurisdiction-data.test.ts +73 -0
  129. package/src/data/regulation/jurisdiction-data.ts +65 -0
  130. package/src/data/regulation/regulation-data.ts +19 -0
  131. package/src/data/regulation/regulation-loader.test.ts +107 -0
  132. package/src/data/regulation/regulation-loader.ts +56 -0
  133. package/src/data/scanner-constants.ts +46 -0
  134. package/src/data/schemas/schemas-core.ts +140 -0
  135. package/src/data/schemas/schemas-supplementary.ts +211 -0
  136. package/src/data/schemas/schemas.ts +28 -0
  137. package/src/data/security/attack-probes.test.ts +62 -0
  138. package/src/data/security/attack-probes.ts +496 -0
  139. package/src/data/security/eu-ai-act-security.ts +40 -0
  140. package/src/data/security/index.ts +19 -0
  141. package/src/data/security/mitre-atlas.test.ts +43 -0
  142. package/src/data/security/mitre-atlas.ts +93 -0
  143. package/src/data/security/nist-ai-rmf.ts +43 -0
  144. package/src/data/security/owasp-llm-top10.test.ts +60 -0
  145. package/src/data/security/owasp-llm-top10.ts +138 -0
  146. package/src/data/template-registry.ts +53 -0
  147. package/src/data/tool-versions.json +22 -0
  148. package/src/domain/audit/audit-package.test.ts +152 -0
  149. package/src/domain/audit/audit-package.ts +166 -0
  150. package/src/domain/audit/audit-trail.test.ts +121 -0
  151. package/src/domain/audit/audit-trail.ts +174 -0
  152. package/src/domain/audit/index.ts +8 -0
  153. package/src/domain/audit/permissions-matrix.test.ts +136 -0
  154. package/src/domain/audit/permissions-matrix.ts +121 -0
  155. package/src/domain/certification/adversarial/bias-tests.ts +95 -0
  156. package/src/domain/certification/adversarial/evaluators.ts +304 -0
  157. package/src/domain/certification/adversarial/index.ts +11 -0
  158. package/src/domain/certification/adversarial/prompt-injection.ts +103 -0
  159. package/src/domain/certification/adversarial/safety-boundary.ts +132 -0
  160. package/src/domain/certification/aiuc1-readiness.test.ts +236 -0
  161. package/src/domain/certification/aiuc1-readiness.ts +298 -0
  162. package/src/domain/certification/aiuc1-requirements.ts +235 -0
  163. package/src/domain/certification/index.ts +10 -0
  164. package/src/domain/certification/redteam-runner.test.ts +97 -0
  165. package/src/domain/certification/redteam-runner.ts +205 -0
  166. package/src/domain/certification/test-runner.test.ts +232 -0
  167. package/src/domain/certification/test-runner.ts +289 -0
  168. package/src/domain/cost/cost-estimator.test.ts +187 -0
  169. package/src/domain/cost/cost-estimator.ts +133 -0
  170. package/src/domain/disclaimer.test.ts +52 -0
  171. package/src/domain/disclaimer.ts +39 -0
  172. package/src/domain/documents/ai-enricher.test.ts +120 -0
  173. package/src/domain/documents/ai-enricher.ts +159 -0
  174. package/src/domain/documents/document-generator.test.ts +318 -0
  175. package/src/domain/documents/document-generator.ts +239 -0
  176. package/src/domain/documents/index.ts +9 -0
  177. package/src/domain/documents/passport-helpers.ts +25 -0
  178. package/src/domain/documents/policy-generator.test.ts +252 -0
  179. package/src/domain/documents/policy-generator.ts +94 -0
  180. package/src/domain/documents/worker-notification-generator.test.ts +162 -0
  181. package/src/domain/documents/worker-notification-generator.ts +141 -0
  182. package/src/domain/eval/adapters/adapter-port.ts +94 -0
  183. package/src/domain/eval/adapters/adapters.test.ts +303 -0
  184. package/src/domain/eval/adapters/anthropic-adapter.ts +57 -0
  185. package/src/domain/eval/adapters/auto-detect.ts +104 -0
  186. package/src/domain/eval/adapters/create-chat-adapter.ts +106 -0
  187. package/src/domain/eval/adapters/custom-adapter.ts +74 -0
  188. package/src/domain/eval/adapters/http-adapter.ts +66 -0
  189. package/src/domain/eval/adapters/index.ts +7 -0
  190. package/src/domain/eval/adapters/ollama-adapter.ts +48 -0
  191. package/src/domain/eval/adapters/openai-adapter.ts +58 -0
  192. package/src/domain/eval/adapters/with-timeout.ts +25 -0
  193. package/src/domain/eval/conformity-score.test.ts +161 -0
  194. package/src/domain/eval/conformity-score.ts +135 -0
  195. package/src/domain/eval/eval-constants.ts +55 -0
  196. package/src/domain/eval/eval-evidence.test.ts +85 -0
  197. package/src/domain/eval/eval-evidence.ts +103 -0
  198. package/src/domain/eval/eval-fix-generator.test.ts +421 -0
  199. package/src/domain/eval/eval-fix-generator.ts +205 -0
  200. package/src/domain/eval/eval-passport.test.ts +82 -0
  201. package/src/domain/eval/eval-passport.ts +89 -0
  202. package/src/domain/eval/eval-remediation-report.test.ts +682 -0
  203. package/src/domain/eval/eval-remediation-report.ts +170 -0
  204. package/src/domain/eval/eval-report.ts +108 -0
  205. package/src/domain/eval/eval-runner.test.ts +609 -0
  206. package/src/domain/eval/eval-runner.ts +593 -0
  207. package/src/domain/eval/eval-to-findings.test.ts +293 -0
  208. package/src/domain/eval/eval-to-findings.ts +83 -0
  209. package/src/domain/eval/index.ts +31 -0
  210. package/src/domain/eval/llm-judge.test.ts +139 -0
  211. package/src/domain/eval/llm-judge.ts +168 -0
  212. package/src/domain/eval/remediation-types.ts +90 -0
  213. package/src/domain/eval/security-integration.test.ts +196 -0
  214. package/src/domain/eval/security-integration.ts +136 -0
  215. package/src/domain/eval/types.test.ts +173 -0
  216. package/src/domain/eval/types.ts +244 -0
  217. package/src/domain/eval/verdict-utils.ts +45 -0
  218. package/src/domain/fixer/create-fixer.ts +101 -0
  219. package/src/domain/fixer/diff.ts +70 -0
  220. package/src/domain/fixer/fix-history.ts +23 -0
  221. package/src/domain/fixer/fixer.test.ts +306 -0
  222. package/src/domain/fixer/index.ts +9 -0
  223. package/src/domain/fixer/strategies/bandit-fix.ts +61 -0
  224. package/src/domain/fixer/strategies/bias-testing.ts +49 -0
  225. package/src/domain/fixer/strategies/ci-compliance.ts +57 -0
  226. package/src/domain/fixer/strategies/content-marking.ts +45 -0
  227. package/src/domain/fixer/strategies/cve-upgrade.ts +66 -0
  228. package/src/domain/fixer/strategies/data-governance.ts +65 -0
  229. package/src/domain/fixer/strategies/disclosure.ts +69 -0
  230. package/src/domain/fixer/strategies/doc-code-sync.ts +53 -0
  231. package/src/domain/fixer/strategies/documentation.ts +59 -0
  232. package/src/domain/fixer/strategies/error-handler.ts +63 -0
  233. package/src/domain/fixer/strategies/hitl-gate.ts +67 -0
  234. package/src/domain/fixer/strategies/index.ts +61 -0
  235. package/src/domain/fixer/strategies/kill-switch-test.ts +85 -0
  236. package/src/domain/fixer/strategies/kill-switch.ts +53 -0
  237. package/src/domain/fixer/strategies/license-fix.ts +57 -0
  238. package/src/domain/fixer/strategies/log-retention.ts +40 -0
  239. package/src/domain/fixer/strategies/logging.ts +59 -0
  240. package/src/domain/fixer/strategies/metadata.ts +45 -0
  241. package/src/domain/fixer/strategies/permission-guard.ts +84 -0
  242. package/src/domain/fixer/strategies/record-keeping.ts +69 -0
  243. package/src/domain/fixer/strategies/secret-rotation.ts +52 -0
  244. package/src/domain/fixer/strategies.test.ts +341 -0
  245. package/src/domain/fixer/template-engine.test.ts +64 -0
  246. package/src/domain/fixer/template-engine.ts +38 -0
  247. package/src/domain/fixer/types.ts +88 -0
  248. package/src/domain/frameworks/aiuc1-framework.test.ts +159 -0
  249. package/src/domain/frameworks/aiuc1-framework.ts +126 -0
  250. package/src/domain/frameworks/collect-foundation-metrics.test.ts +96 -0
  251. package/src/domain/frameworks/collect-foundation-metrics.ts +34 -0
  252. package/src/domain/frameworks/eu-ai-act-framework.test.ts +117 -0
  253. package/src/domain/frameworks/eu-ai-act-framework.ts +100 -0
  254. package/src/domain/frameworks/framework-registry.test.ts +91 -0
  255. package/src/domain/frameworks/framework-registry.ts +38 -0
  256. package/src/domain/frameworks/index.ts +8 -0
  257. package/src/domain/frameworks/mitre-atlas-framework.test.ts +53 -0
  258. package/src/domain/frameworks/mitre-atlas-framework.ts +53 -0
  259. package/src/domain/frameworks/owasp-llm-framework.test.ts +77 -0
  260. package/src/domain/frameworks/owasp-llm-framework.ts +54 -0
  261. package/src/domain/frameworks/score-plugin-framework.ts +117 -0
  262. package/src/domain/fria/fria-generator.test.ts +273 -0
  263. package/src/domain/fria/fria-generator.ts +366 -0
  264. package/src/domain/import/promptfoo-importer.test.ts +103 -0
  265. package/src/domain/import/promptfoo-importer.ts +151 -0
  266. package/src/domain/onboarding/guided-onboarding.test.ts +144 -0
  267. package/src/domain/onboarding/guided-onboarding.ts +135 -0
  268. package/src/domain/passport/builder/domain-mapper.ts +9 -0
  269. package/src/domain/passport/builder/manifest-builder.test.ts +546 -0
  270. package/src/domain/passport/builder/manifest-builder.ts +535 -0
  271. package/src/domain/passport/builder/manifest-diff.test.ts +105 -0
  272. package/src/domain/passport/builder/manifest-diff.ts +89 -0
  273. package/src/domain/passport/builder/manifest-files.ts +17 -0
  274. package/src/domain/passport/crypto-signer.test.ts +93 -0
  275. package/src/domain/passport/crypto-signer.ts +157 -0
  276. package/src/domain/passport/discovery/agent-discovery.test.ts +296 -0
  277. package/src/domain/passport/discovery/agent-discovery.ts +325 -0
  278. package/src/domain/passport/discovery/autonomy-analyzer.test.ts +141 -0
  279. package/src/domain/passport/discovery/autonomy-analyzer.ts +113 -0
  280. package/src/domain/passport/discovery/permission-scanner.test.ts +191 -0
  281. package/src/domain/passport/discovery/permission-scanner.ts +414 -0
  282. package/src/domain/passport/export/a2a-mapper.ts +75 -0
  283. package/src/domain/passport/export/aiuc1-mapper.ts +126 -0
  284. package/src/domain/passport/export/export.test.ts +207 -0
  285. package/src/domain/passport/export/index.ts +41 -0
  286. package/src/domain/passport/export/nist-mapper.ts +227 -0
  287. package/src/domain/passport/import/a2a-importer.test.ts +133 -0
  288. package/src/domain/passport/import/a2a-importer.ts +156 -0
  289. package/src/domain/passport/import/index.ts +2 -0
  290. package/src/domain/passport/index.ts +32 -0
  291. package/src/domain/passport/obligation-field-map.test.ts +113 -0
  292. package/src/domain/passport/obligation-field-map.ts +117 -0
  293. package/src/domain/passport/passport-validator.test.ts +156 -0
  294. package/src/domain/passport/passport-validator.ts +126 -0
  295. package/src/domain/passport/scan-to-compliance.test.ts +336 -0
  296. package/src/domain/passport/scan-to-compliance.ts +166 -0
  297. package/src/domain/passport/test-generator.test.ts +93 -0
  298. package/src/domain/passport/test-generator.ts +136 -0
  299. package/src/domain/proxy/index.ts +11 -0
  300. package/src/domain/proxy/json-rpc.test.ts +72 -0
  301. package/src/domain/proxy/json-rpc.ts +53 -0
  302. package/src/domain/proxy/policy-engine.test.ts +259 -0
  303. package/src/domain/proxy/policy-engine.ts +137 -0
  304. package/src/domain/proxy/proxy-bridge.ts +125 -0
  305. package/src/domain/proxy/proxy-interceptor.test.ts +184 -0
  306. package/src/domain/proxy/proxy-interceptor.ts +120 -0
  307. package/src/domain/proxy/proxy-types.ts +35 -0
  308. package/src/domain/registry/compute-agent-score.test.ts +279 -0
  309. package/src/domain/registry/compute-agent-score.ts +162 -0
  310. package/src/domain/reporter/audit-report.test.ts +87 -0
  311. package/src/domain/reporter/audit-report.ts +116 -0
  312. package/src/domain/reporter/badge-generator.test.ts +54 -0
  313. package/src/domain/reporter/badge-generator.ts +40 -0
  314. package/src/domain/reporter/compliance-md.ts +45 -0
  315. package/src/domain/reporter/index.ts +7 -0
  316. package/src/domain/reporter/pdf-renderer.ts +282 -0
  317. package/src/domain/reporter/share.test.ts +92 -0
  318. package/src/domain/reporter/share.ts +80 -0
  319. package/src/domain/scanner/ast/swc-analyzer.test.ts +49 -0
  320. package/src/domain/scanner/ast/swc-analyzer.ts +124 -0
  321. package/src/domain/scanner/attestations.ts +97 -0
  322. package/src/domain/scanner/checks/ai-disclosure.test.ts +90 -0
  323. package/src/domain/scanner/checks/ai-disclosure.ts +54 -0
  324. package/src/domain/scanner/checks/ai-literacy.ts +163 -0
  325. package/src/domain/scanner/checks/behavioral-constraints.test.ts +167 -0
  326. package/src/domain/scanner/checks/behavioral-constraints.ts +86 -0
  327. package/src/domain/scanner/checks/compliance-metadata.ts +63 -0
  328. package/src/domain/scanner/checks/content-marking.ts +74 -0
  329. package/src/domain/scanner/checks/dep-deep-scan.test.ts +318 -0
  330. package/src/domain/scanner/checks/dep-deep-scan.ts +137 -0
  331. package/src/domain/scanner/checks/documentation.test.ts +88 -0
  332. package/src/domain/scanner/checks/documentation.ts +79 -0
  333. package/src/domain/scanner/checks/git-history.test.ts +120 -0
  334. package/src/domain/scanner/checks/git-history.ts +163 -0
  335. package/src/domain/scanner/checks/gpai-systemic-risk.test.ts +84 -0
  336. package/src/domain/scanner/checks/gpai-systemic-risk.ts +98 -0
  337. package/src/domain/scanner/checks/gpai-transparency.ts +94 -0
  338. package/src/domain/scanner/checks/index.ts +28 -0
  339. package/src/domain/scanner/checks/industry/index.ts +40 -0
  340. package/src/domain/scanner/checks/industry/industry.test.ts +287 -0
  341. package/src/domain/scanner/checks/interaction-logging.test.ts +113 -0
  342. package/src/domain/scanner/checks/interaction-logging.ts +142 -0
  343. package/src/domain/scanner/checks/nhi-scanner.test.ts +158 -0
  344. package/src/domain/scanner/checks/nhi-scanner.ts +78 -0
  345. package/src/domain/scanner/checks/passport-completeness.test.ts +127 -0
  346. package/src/domain/scanner/checks/passport-completeness.ts +82 -0
  347. package/src/domain/scanner/checks/passport-presence.test.ts +56 -0
  348. package/src/domain/scanner/checks/passport-presence.ts +78 -0
  349. package/src/domain/scanner/checks/pattern-check-factory.ts +70 -0
  350. package/src/domain/scanner/checks/permission-scanner.test.ts +279 -0
  351. package/src/domain/scanner/checks/permission-scanner.ts +90 -0
  352. package/src/domain/scanner/checks/presence-check-factory.test.ts +124 -0
  353. package/src/domain/scanner/checks/presence-check-factory.ts +275 -0
  354. package/src/domain/scanner/compliance-diff.test.ts +165 -0
  355. package/src/domain/scanner/compliance-diff.ts +138 -0
  356. package/src/domain/scanner/confidence.test.ts +235 -0
  357. package/src/domain/scanner/confidence.ts +156 -0
  358. package/src/domain/scanner/constants.ts +13 -0
  359. package/src/domain/scanner/create-scanner.ts +573 -0
  360. package/src/domain/scanner/cross-layer.test.ts +372 -0
  361. package/src/domain/scanner/cross-layer.ts +232 -0
  362. package/src/domain/scanner/data/ai-packages.ts +82 -0
  363. package/src/domain/scanner/debt-calculator.test.ts +89 -0
  364. package/src/domain/scanner/debt-calculator.ts +111 -0
  365. package/src/domain/scanner/drift.test.ts +191 -0
  366. package/src/domain/scanner/drift.ts +73 -0
  367. package/src/domain/scanner/evidence-store.test.ts +207 -0
  368. package/src/domain/scanner/evidence-store.ts +195 -0
  369. package/src/domain/scanner/evidence.test.ts +104 -0
  370. package/src/domain/scanner/evidence.ts +71 -0
  371. package/src/domain/scanner/external/bandit-runner.test.ts +45 -0
  372. package/src/domain/scanner/external/bandit-runner.ts +90 -0
  373. package/src/domain/scanner/external/checks.ts +321 -0
  374. package/src/domain/scanner/external/dedup.test.ts +79 -0
  375. package/src/domain/scanner/external/dedup.ts +94 -0
  376. package/src/domain/scanner/external/detect-secrets-runner.test.ts +58 -0
  377. package/src/domain/scanner/external/detect-secrets-runner.ts +81 -0
  378. package/src/domain/scanner/external/external-scanner.test.ts +221 -0
  379. package/src/domain/scanner/external/external-scanner.ts +36 -0
  380. package/src/domain/scanner/external/finding-mapper.test.ts +95 -0
  381. package/src/domain/scanner/external/finding-mapper.ts +138 -0
  382. package/src/domain/scanner/external/index.ts +15 -0
  383. package/src/domain/scanner/external/mappings.ts +93 -0
  384. package/src/domain/scanner/external/modelscan-runner.test.ts +35 -0
  385. package/src/domain/scanner/external/modelscan-runner.ts +101 -0
  386. package/src/domain/scanner/external/path-utils.ts +8 -0
  387. package/src/domain/scanner/external/runner-port.ts +45 -0
  388. package/src/domain/scanner/external/semgrep-runner.test.ts +52 -0
  389. package/src/domain/scanner/external/semgrep-runner.ts +94 -0
  390. package/src/domain/scanner/external/types.ts +32 -0
  391. package/src/domain/scanner/finding-attribution.test.ts +444 -0
  392. package/src/domain/scanner/finding-attribution.ts +195 -0
  393. package/src/domain/scanner/finding-explainer.test.ts +157 -0
  394. package/src/domain/scanner/finding-explainer.ts +73 -0
  395. package/src/domain/scanner/fix-diff-builder.test.ts +272 -0
  396. package/src/domain/scanner/fix-diff-builder.ts +477 -0
  397. package/src/domain/scanner/import-graph.test.ts +162 -0
  398. package/src/domain/scanner/import-graph.ts +198 -0
  399. package/src/domain/scanner/languages/adapter.test.ts +105 -0
  400. package/src/domain/scanner/languages/adapter.ts +239 -0
  401. package/src/domain/scanner/layers/index.ts +24 -0
  402. package/src/domain/scanner/layers/layer1-files.ts +54 -0
  403. package/src/domain/scanner/layers/layer2-docs.test.ts +1207 -0
  404. package/src/domain/scanner/layers/layer2-docs.ts +297 -0
  405. package/src/domain/scanner/layers/layer2-parsing.ts +217 -0
  406. package/src/domain/scanner/layers/layer3-config.test.ts +187 -0
  407. package/src/domain/scanner/layers/layer3-config.ts +279 -0
  408. package/src/domain/scanner/layers/layer3-parsers.ts +73 -0
  409. package/src/domain/scanner/layers/layer4-patterns.test.ts +397 -0
  410. package/src/domain/scanner/layers/layer4-patterns.ts +216 -0
  411. package/src/domain/scanner/layers/layer5-docs.test.ts +99 -0
  412. package/src/domain/scanner/layers/layer5-docs.ts +250 -0
  413. package/src/domain/scanner/layers/layer5-llm.test.ts +146 -0
  414. package/src/domain/scanner/layers/layer5-llm.ts +262 -0
  415. package/src/domain/scanner/layers/layer5-targeted.test.ts +93 -0
  416. package/src/domain/scanner/layers/layer5-targeted.ts +233 -0
  417. package/src/domain/scanner/layers/lockfile-parsers.test.ts +320 -0
  418. package/src/domain/scanner/layers/lockfile-parsers.ts +184 -0
  419. package/src/domain/scanner/regulation-version.test.ts +54 -0
  420. package/src/domain/scanner/regulation-version.ts +23 -0
  421. package/src/domain/scanner/role-filter.test.ts +116 -0
  422. package/src/domain/scanner/role-filter.ts +51 -0
  423. package/src/domain/scanner/rules/banned-packages-data.ts +553 -0
  424. package/src/domain/scanner/rules/banned-packages-sdk.ts +65 -0
  425. package/src/domain/scanner/rules/banned-packages.test.ts +249 -0
  426. package/src/domain/scanner/rules/banned-packages.ts +55 -0
  427. package/src/domain/scanner/rules/comment-filter.test.ts +115 -0
  428. package/src/domain/scanner/rules/comment-filter.ts +297 -0
  429. package/src/domain/scanner/rules/index.ts +9 -0
  430. package/src/domain/scanner/rules/nhi-patterns.test.ts +128 -0
  431. package/src/domain/scanner/rules/nhi-patterns.ts +60 -0
  432. package/src/domain/scanner/rules/pattern-rules.ts +1152 -0
  433. package/src/domain/scanner/sbom.test.ts +136 -0
  434. package/src/domain/scanner/sbom.ts +103 -0
  435. package/src/domain/scanner/scan-cache.test.ts +136 -0
  436. package/src/domain/scanner/scan-cache.ts +115 -0
  437. package/src/domain/scanner/scanner.test.ts +125 -0
  438. package/src/domain/scanner/score-calculator.test.ts +363 -0
  439. package/src/domain/scanner/score-calculator.ts +189 -0
  440. package/src/domain/scanner/security-score.test.ts +107 -0
  441. package/src/domain/scanner/security-score.ts +116 -0
  442. package/src/domain/scanner/source-filter.ts +24 -0
  443. package/src/domain/scanner/validators.ts +223 -0
  444. package/src/domain/shared/compliance-constants.ts +48 -0
  445. package/src/domain/shared/disclosure-patterns.ts +16 -0
  446. package/src/domain/shared/index.ts +6 -0
  447. package/src/domain/shared/parse-dependencies.ts +21 -0
  448. package/src/domain/supply-chain/dependency-analyzer.ts +138 -0
  449. package/src/domain/supply-chain/index.ts +3 -0
  450. package/src/domain/supply-chain/supply-chain.test.ts +211 -0
  451. package/src/domain/supply-chain/types.ts +32 -0
  452. package/src/domain/whatif/config-fixer.ts +187 -0
  453. package/src/domain/whatif/index.ts +6 -0
  454. package/src/domain/whatif/scenario-engine.ts +121 -0
  455. package/src/domain/whatif/simulate-actions.test.ts +161 -0
  456. package/src/domain/whatif/simulate-actions.ts +114 -0
  457. package/src/domain/whatif/whatif.test.ts +135 -0
  458. package/src/e2e/gaps-e2e.test.ts +259 -0
  459. package/src/e2e/smoke.test.ts +101 -0
  460. package/src/hooks/hooks-export.test.ts +81 -0
  461. package/src/hooks/installer.ts +113 -0
  462. package/src/http/cors.test.ts +38 -0
  463. package/src/http/create-router.ts +259 -0
  464. package/src/http/routes/agent.route.ts +380 -0
  465. package/src/http/routes/audit.route.ts +66 -0
  466. package/src/http/routes/badge.route.ts +23 -0
  467. package/src/http/routes/cert.route.ts +66 -0
  468. package/src/http/routes/chat.route.ts +228 -0
  469. package/src/http/routes/cost.route.ts +33 -0
  470. package/src/http/routes/debt.route.ts +29 -0
  471. package/src/http/routes/disclaimer.route.ts +64 -0
  472. package/src/http/routes/eval.route.ts +161 -0
  473. package/src/http/routes/events.route.test.ts +108 -0
  474. package/src/http/routes/events.route.ts +71 -0
  475. package/src/http/routes/external-scan.route.ts +24 -0
  476. package/src/http/routes/file.route.ts +54 -0
  477. package/src/http/routes/fix.route.ts +219 -0
  478. package/src/http/routes/frameworks.route.test.ts +66 -0
  479. package/src/http/routes/frameworks.route.ts +36 -0
  480. package/src/http/routes/git.route.ts +27 -0
  481. package/src/http/routes/guided-onboarding.route.ts +65 -0
  482. package/src/http/routes/import.route.ts +64 -0
  483. package/src/http/routes/jurisdiction.route.ts +22 -0
  484. package/src/http/routes/obligations.route.test.ts +122 -0
  485. package/src/http/routes/obligations.route.ts +110 -0
  486. package/src/http/routes/onboarding.route.ts +53 -0
  487. package/src/http/routes/provider.route.ts +42 -0
  488. package/src/http/routes/proxy.route.ts +40 -0
  489. package/src/http/routes/redteam.route.ts +84 -0
  490. package/src/http/routes/report.route.ts +29 -0
  491. package/src/http/routes/scan.route.ts +104 -0
  492. package/src/http/routes/share.route.ts +44 -0
  493. package/src/http/routes/shell.route.ts +27 -0
  494. package/src/http/routes/status.route.ts +66 -0
  495. package/src/http/routes/supply-chain.route.ts +121 -0
  496. package/src/http/routes/sync.route.ts +328 -0
  497. package/src/http/routes/tools.route.ts +29 -0
  498. package/src/http/routes/whatif.route.ts +96 -0
  499. package/src/http/utils/validation.ts +31 -0
  500. package/src/index.ts +1 -0
  501. package/src/infra/bundle-fetcher.ts +77 -0
  502. package/src/infra/cache-storage.ts +34 -0
  503. package/src/infra/event-bus.ts +31 -0
  504. package/src/infra/file-collector.ts +61 -0
  505. package/src/infra/file-ops-adapter.ts +95 -0
  506. package/src/infra/file-watcher.test.ts +90 -0
  507. package/src/infra/file-watcher.ts +106 -0
  508. package/src/infra/git-adapter.ts +93 -0
  509. package/src/infra/git-history-adapter.ts +41 -0
  510. package/src/infra/headless-browser.ts +178 -0
  511. package/src/infra/llm-adapter.test.ts +83 -0
  512. package/src/infra/llm-adapter.ts +86 -0
  513. package/src/infra/logger.ts +27 -0
  514. package/src/infra/project-config.test.ts +74 -0
  515. package/src/infra/project-config.ts +35 -0
  516. package/src/infra/rate-limiter.test.ts +36 -0
  517. package/src/infra/rate-limiter.ts +34 -0
  518. package/src/infra/retry.ts +46 -0
  519. package/src/infra/saas-client.ts +123 -0
  520. package/src/infra/search-adapter.ts +113 -0
  521. package/src/infra/shell-adapter.ts +68 -0
  522. package/src/infra/tool-manager.test.ts +99 -0
  523. package/src/infra/tool-manager.ts +197 -0
  524. package/src/llm/agents/agent-modes.test.ts +44 -0
  525. package/src/llm/agents/modes.ts +68 -0
  526. package/src/llm/routing/cost-routing.test.ts +37 -0
  527. package/src/llm/routing/cost-tracker.ts +74 -0
  528. package/src/llm/routing/model-routing.test.ts +79 -0
  529. package/src/llm/routing/model-routing.ts +38 -0
  530. package/src/llm/routing/pricing.ts +19 -0
  531. package/src/llm/sse-protocol.ts +77 -0
  532. package/src/llm/tool-definitions.ts +83 -0
  533. package/src/llm/tool-executors.ts +80 -0
  534. package/src/llm/tools/types.ts +13 -0
  535. package/src/mcp/create-mcp-stack.ts +82 -0
  536. package/src/mcp/handlers.ts +245 -0
  537. package/src/mcp/index.ts +28 -0
  538. package/src/mcp/mcp-server.test.ts +80 -0
  539. package/src/mcp/server.ts +79 -0
  540. package/src/mcp/tools.ts +48 -0
  541. package/src/onboarding/auto-detect.ts +164 -0
  542. package/src/onboarding/onboarding.test.ts +89 -0
  543. package/src/onboarding/profile.ts +169 -0
  544. package/src/onboarding/questions.ts +112 -0
  545. package/src/onboarding/wizard.ts +66 -0
  546. package/src/output/github-issue.ts +32 -0
  547. package/src/output/json-output.ts +67 -0
  548. package/src/ports/browser.port.ts +23 -0
  549. package/src/ports/events.port.ts +28 -0
  550. package/src/ports/llm.port.ts +23 -0
  551. package/src/ports/logger.port.ts +6 -0
  552. package/src/ports/process.port.ts +6 -0
  553. package/src/ports/scanner.port.ts +15 -0
  554. package/src/server.ts +134 -0
  555. package/src/services/badge-service.ts +67 -0
  556. package/src/services/chat-service.test.ts +162 -0
  557. package/src/services/chat-service.ts +152 -0
  558. package/src/services/cost-service.ts +52 -0
  559. package/src/services/debt-service.ts +65 -0
  560. package/src/services/eval-integration.test.ts +132 -0
  561. package/src/services/eval-service.test.ts +373 -0
  562. package/src/services/eval-service.ts +463 -0
  563. package/src/services/external-scan-service.ts +60 -0
  564. package/src/services/file-service.ts +37 -0
  565. package/src/services/fix-service.test.ts +470 -0
  566. package/src/services/fix-service.ts +648 -0
  567. package/src/services/framework-service.test.ts +159 -0
  568. package/src/services/framework-service.ts +67 -0
  569. package/src/services/onboarding-service.ts +165 -0
  570. package/src/services/passport-audit.ts +244 -0
  571. package/src/services/passport-documents.ts +258 -0
  572. package/src/services/passport-service-utils.ts +72 -0
  573. package/src/services/passport-service.test.ts +251 -0
  574. package/src/services/passport-service.ts +339 -0
  575. package/src/services/proxy-service.ts +81 -0
  576. package/src/services/report-service.ts +72 -0
  577. package/src/services/scan-service.test.ts +470 -0
  578. package/src/services/scan-service.ts +335 -0
  579. package/src/services/share-service.ts +108 -0
  580. package/src/services/shared/backup.ts +23 -0
  581. package/src/services/status-service.ts +38 -0
  582. package/src/services/undo-service.test.ts +190 -0
  583. package/src/services/undo-service.ts +144 -0
  584. package/src/test-helpers/factories.ts +116 -0
  585. package/src/types/common.schemas.ts +147 -0
  586. package/src/types/common.types.ts +292 -0
  587. package/src/types/contract.test.ts +217 -0
  588. package/src/types/errors.ts +52 -0
  589. package/src/types/framework.types.ts +87 -0
  590. package/src/types/passport-schemas.ts +241 -0
  591. package/src/types/passport.types.ts +296 -0
  592. package/src/version.ts +1 -0
  593. package/tsconfig.json +20 -0
  594. package/vitest.config.ts +9 -0
@@ -0,0 +1,197 @@
1
+ # AI Usage Policy — Healthcare / Medical
2
+
3
+ | Field | Value |
4
+ |-------|-------|
5
+ | Policy Title | AI Usage Policy — Healthcare / Medical |
6
+ | Organization | [Organization] |
7
+ | Date | [Date] |
8
+ | Version | [Version] |
9
+ | AI System Name | [AI System Name] |
10
+ | Risk Class | [Risk Class] |
11
+
12
+ ## 1. Purpose and Scope
13
+ <!-- GUIDANCE: Healthcare AI may be regulated as both a high-risk AI system AND
14
+ a medical device (MDR). Scope must clearly state which regulatory framework(s)
15
+ apply. Include ALL clinical and administrative AI systems.
16
+ Example: "Covers: diagnostic imaging AI (MDR Class IIa + AI Act high-risk),
17
+ patient scheduling AI (AI Act limited-risk), clinical NLP (AI Act high-risk)." -->
18
+
19
+ This policy governs the use of [AI System Name] within [Organization]'s healthcare operations. It establishes requirements for safe, effective and transparent use of AI in clinical decision support, diagnostic assistance, patient monitoring, and medical data processing, in accordance with the EU AI Act (Regulation 2024/1689).
20
+
21
+ This policy applies to all healthcare professionals, technical staff, and administrative personnel involved in operating, supervising, or being affected by AI-assisted medical decisions.
22
+
23
+ ## 2. Applicable Legislation
24
+ <!-- GUIDANCE: Healthcare AI sits at the intersection of AI Act, MDR/IVDR, and
25
+ GDPR Art. 9 (health data). If the AI qualifies as a medical device, MDR takes
26
+ precedence for safety — AI Act adds transparency and monitoring requirements.
27
+ Example: "Primary: MDR (EU 2017/745) for device classification; supplementary:
28
+ AI Act Art. 6(1) high-risk obligations; GDPR Art. 9(2)(h) for health data." -->
29
+
30
+ - **EU AI Act** — Annex III §5(a): AI systems intended to be used as safety components in the management and operation of critical digital infrastructure, road traffic, or in the supply of water, gas, heating or electricity
31
+ - **Art. 6(2)** — High-risk AI system classification
32
+ - **Art. 9** — Risk management system requirements
33
+ - **Art. 10** — Data governance and management practices
34
+ - **Art. 14** — Human oversight measures
35
+ - **Art. 26** — Obligations of deployers of high-risk AI systems
36
+ - **Medical Devices Regulation** (EU 2017/745, MDR) — where AI qualifies as a medical device
37
+ - **In Vitro Diagnostic Regulation** (EU 2017/746, IVDR) — where applicable
38
+ - **GDPR** — Art. 9 (special categories of personal data), Art. 22, Art. 35
39
+ - **EU Charter of Fundamental Rights** — Art. 3 (right to integrity), Art. 35 (health care)
40
+
41
+ ## 3. AI System Description
42
+ <!-- GUIDANCE: For clinical AI, describe the intended clinical pathway and where
43
+ the AI output fits in the decision process. Specify whether it's screening,
44
+ diagnostic, prognostic, or therapeutic. Example: "Chest X-ray AI (screening):
45
+ flags potential pneumothorax on emergency department X-rays, output: binary
46
+ flag + confidence score, radiologist reviews all flagged cases within 30 minutes." -->
47
+
48
+ - System name: [AI System Name]
49
+ - Description: [Description]
50
+ - Provider: [Provider]
51
+ - Model ID: [Model ID]
52
+ - Autonomy level: [Autonomy Level]
53
+
54
+ ## 4. Risk Classification
55
+ <!-- GUIDANCE: Healthcare AI is typically high-risk under AI Act. If it also
56
+ qualifies as a medical device, it has DUAL classification (MDR + AI Act).
57
+ Document both classifications. Example: "AI Act: high-risk (medical device AI);
58
+ MDR: Class IIa (decision support software, Rule 11); IVDR: not applicable." -->
59
+
60
+ This AI system is classified as **[Risk Class]** under the EU AI Act. Healthcare AI systems that qualify as medical devices or are used in clinical decision-making are typically classified as high-risk.
61
+
62
+ ## 5. Data Governance
63
+ <!-- GUIDANCE: Health data is GDPR Art. 9 special category requiring explicit
64
+ legal basis (typically Art. 9(2)(h) — healthcare provision). Training data must
65
+ represent the target patient population to avoid clinical bias. Example: "Legal
66
+ basis: Art. 9(2)(h); training data: 100K chest X-rays from 12 EU hospitals,
67
+ validated for demographic representation (age, sex, ethnicity distribution
68
+ matching EU population ±5%)." -->
69
+
70
+ - All patient data must be processed in compliance with GDPR Art. 9 (special categories)
71
+ - Data minimisation: only clinically necessary data shall be provided to the AI system
72
+ - Training data must be representative of the target patient population
73
+ - Data quality controls must ensure accuracy and completeness of clinical inputs
74
+ - De-identification or pseudonymisation must be applied where full identification is not clinically required
75
+ - Data provenance and lineage must be documented for all datasets used
76
+
77
+ ## 6. Human Oversight
78
+ <!-- GUIDANCE: Clinical AI MUST be decision support only — never autonomous
79
+ clinical decisions. The clinician must have access to the underlying data,
80
+ not just the AI recommendation. Display confidence levels to support clinical
81
+ judgment. Example: "AI output displayed alongside original imaging; clinician
82
+ sees confidence score, similar historical cases, and known limitations for
83
+ the patient's demographics." -->
84
+
85
+ - Autonomy level: [Autonomy Level]
86
+ - [Human Oversight Description]
87
+ - The AI system must be used as a decision support tool only; final clinical decisions rest with qualified healthcare professionals
88
+ - Clinicians must have the ability to override, modify, or disregard any AI-generated recommendation
89
+ - AI outputs must be presented alongside confidence levels and relevant limitations
90
+
91
+ ## 7. Transparency and Disclosure
92
+ <!-- GUIDANCE: Patient information must be appropriate to comprehension level
93
+ and clinical context. In emergency settings, disclosure may be post-hoc.
94
+ Clinical records must clearly distinguish AI-generated from clinician-generated
95
+ content. Example: "Pre-admission: patient informed via consent form; emergency:
96
+ post-hoc disclosure within 24 hours; clinical notes: AI outputs prefixed
97
+ with '[AI-ASSIST]' in EHR." -->
98
+
99
+ - Patients must be informed when AI is used in their care pathway
100
+ - Information provided must be clear, accessible and appropriate to the patient's comprehension level
101
+ - Healthcare professionals must have access to information about the AI system's intended use, limitations and performance characteristics
102
+ - AI-generated outputs in clinical records must be clearly identified as AI-assisted
103
+
104
+ ## 8. Patient Safety and Clinical Validation
105
+ <!-- GUIDANCE: Clinical validation must follow established methodologies
106
+ (prospective studies, comparison with standard of care). Report adverse events
107
+ through pharmacovigilance systems. Define fail-safe mechanisms for system outage.
108
+ Example: "Validated in prospective study (n=5,000), sensitivity 94%, specificity
109
+ 89% vs. standard of care (radiologist): sensitivity 92%, specificity 91%.
110
+ Fail-safe: automatic fallback to manual queue if system unavailable >5 min." -->
111
+
112
+ - The AI system must have undergone clinical validation appropriate to its intended use
113
+ - Clinical evidence must demonstrate safety and performance in the target patient population
114
+ - Adverse events potentially related to AI system outputs must be reported through pharmacovigilance/medical device vigilance systems
115
+ - Regular clinical performance reviews must assess diagnostic accuracy, sensitivity, specificity, and clinical outcome impact
116
+ - Fail-safe mechanisms must ensure patient care is not compromised if the AI system becomes unavailable
117
+
118
+ ## 9. Medical Device Classification
119
+ <!-- GUIDANCE: Use MDR classification rules (esp. Rule 11 for software) to
120
+ determine device class. Software intended to provide diagnostic/prognostic
121
+ information is typically Class IIa or higher. CE marking is mandatory before
122
+ clinical use. Example: "Classified Class IIa per MDR Rule 11 (software providing
123
+ information used to make clinical decisions). CE marked, Notified Body: BSI
124
+ (NB 0086), Certificate: CE-2025-AI-0042." -->
125
+
126
+ - If the AI system qualifies as a medical device under MDR (EU 2017/745), it must bear a valid CE marking
127
+ - The system's risk class under MDR (Class I, IIa, IIb, or III) must be documented
128
+ - Post-market surveillance requirements under MDR must be followed
129
+ - Any software updates that affect the intended purpose must undergo conformity reassessment
130
+ - Current classification: [To be determined by qualified regulatory affairs personnel]
131
+
132
+ ## 10. Monitoring and Logging
133
+ <!-- GUIDANCE: Clinical AI monitoring must track both technical metrics AND
134
+ clinical outcomes. Correlate AI recommendations with actual patient outcomes
135
+ over time. Medical record retention typically 10+ years.
136
+ Example: "Track: AI sensitivity/specificity monthly, patient outcomes at 30/90/365
137
+ days, false negative rate with clinical impact. Logs retained 15 years per
138
+ national medical records legislation." -->
139
+
140
+ - All AI-assisted clinical recommendations must be logged with timestamps, inputs, and outputs
141
+ - System performance must be monitored for clinical accuracy and safety signals
142
+ - Key metrics: diagnostic accuracy, sensitivity, specificity, positive/negative predictive values
143
+ - Monitoring frequency: [continuous/weekly/monthly] with clinical review committee oversight
144
+ - Logs must be retained in compliance with medical record retention requirements
145
+
146
+ ## 11. Incident Response
147
+ <!-- GUIDANCE: Clinical AI incidents may be medical device vigilance events
148
+ requiring reporting to competent authority (e.g., under MDR Art. 87). 24-hour
149
+ reporting for death/serious health deterioration. Define clear suspension criteria.
150
+ Example: "Immediate suspension if: false negative leads to missed critical
151
+ diagnosis, or >3 clinician overrides in 24 hours for same error type.
152
+ MDR vigilance report within 24 hours for serious incidents." -->
153
+
154
+ - Any adverse event potentially related to AI system outputs must be reported within 24 hours
155
+ - The AI system must be immediately suspended if a patient safety concern is identified
156
+ - Affected patients must be identified, assessed, and managed according to clinical protocols
157
+ - Serious incidents must be reported to the competent authority for medical devices and market surveillance
158
+ - Root cause analysis must be conducted for all AI-related clinical incidents
159
+
160
+ ## 12. Training and Awareness
161
+ <!-- GUIDANCE: Healthcare professionals need clinical application training,
162
+ not just generic AI training. Include when to trust vs. question AI output,
163
+ and how to document AI-assisted decisions in clinical records.
164
+ Example: "4-hour clinical training: AI output interpretation, override
165
+ procedure, adverse event reporting, EHR documentation standards.
166
+ Competency test required before independent use." -->
167
+
168
+ - All healthcare professionals using the AI system must receive clinical application training
169
+ - Training must cover: intended use, limitations, override procedures, adverse event reporting, and data protection
170
+ - Competency assessment must be completed before independent use of the system
171
+ - Refresher training must be provided at least annually and upon significant system updates
172
+
173
+ ## 13. Review Schedule
174
+ <!-- GUIDANCE: Align with clinical governance review cycles. Consider patient
175
+ outcome data availability (30/90/365 day endpoints). Update when clinical
176
+ guidelines change or new evidence emerges. Example: "Quarterly Clinical
177
+ Governance Committee review; annual full re-validation with updated patient
178
+ outcome data; immediate review if clinical guidelines change." -->
179
+
180
+ - This policy shall be reviewed at least annually and upon any significant change to the AI system
181
+ - Review must incorporate clinical performance data, incident reports, and regulatory updates
182
+ - Updates must be approved by the Clinical Governance Committee
183
+
184
+ ## 14. Approval and Sign-off
185
+ <!-- GUIDANCE: Clinical AI policy requires sign-off from clinical leadership.
186
+ CMO or equivalent takes clinical responsibility. Clinical Governance Lead
187
+ confirms alignment with clinical governance framework.
188
+ Example: "CMO sign-off confirms clinical safety; DPO confirms GDPR Art. 9
189
+ compliance; Clinical Governance Lead confirms alignment with Trust clinical
190
+ governance framework." -->
191
+
192
+ | Role | Name | Date |
193
+ |------|------|------|
194
+ | Policy Owner | [Approver Name] | [Date] |
195
+ | Chief Medical Officer | _________________ | _________ |
196
+ | DPO | _________________ | _________ |
197
+ | Clinical Governance Lead | _________________ | _________ |
@@ -0,0 +1,178 @@
1
+ # AI Usage Policy — HR / Employment
2
+
3
+ | Field | Value |
4
+ |-------|-------|
5
+ | Policy Title | AI Usage Policy — HR / Employment |
6
+ | Organization | [Organization] |
7
+ | Date | [Date] |
8
+ | Version | [Version] |
9
+ | AI System Name | [AI System Name] |
10
+ | Risk Class | [Risk Class] |
11
+
12
+ ## 1. Purpose and Scope
13
+ <!-- GUIDANCE: Define the exact AI systems covered and their HR use cases.
14
+ Art. 26(1) requires deployers to use systems per provider instructions.
15
+ Scope must include ALL personnel affected — operators, subjects of decisions,
16
+ and supervisors. Example: "HireVue video interviews (recruitment), Workday
17
+ Peakon (engagement surveys), internal ML pipeline (attrition prediction)." -->
18
+
19
+ This policy governs the use of [AI System Name] within [Organization]'s human resources and employment processes. It establishes requirements for lawful, transparent and non-discriminatory use of AI in recruitment, performance evaluation, and workforce management, in accordance with the EU AI Act (Regulation 2024/1689).
20
+
21
+ This policy applies to all personnel involved in operating, supervising, or being affected by AI-assisted HR decisions.
22
+
23
+ ## 2. Applicable Legislation
24
+ <!-- GUIDANCE: Annex III §6(a) makes HR AI high-risk. Cross-reference GDPR Art. 22
25
+ (automated decisions) and national employment law. Identify which national
26
+ transposition laws apply to your jurisdiction. Example: In Germany, also reference
27
+ §26 BDSG (employee data processing) and BetrVG §87(1)(6) (works council rights). -->
28
+
29
+ - **EU AI Act** — Annex III §6(a): AI systems intended to be used for recruitment or selection of natural persons, for making decisions affecting terms of work-related relationships
30
+ - **Art. 6(2)** — High-risk AI system classification
31
+ - **Art. 9** — Risk management system requirements
32
+ - **Art. 10** — Data governance and management practices
33
+ - **Art. 13** — Transparency and provision of information to deployers
34
+ - **Art. 14** — Human oversight measures
35
+ - **Art. 26** — Obligations of deployers of high-risk AI systems
36
+ - **Art. 27** — Fundamental rights impact assessment for high-risk AI
37
+ - **GDPR** — Art. 22 (automated individual decision-making), Art. 35 (DPIA)
38
+ - **EU Charter of Fundamental Rights** — Art. 21 (non-discrimination), Art. 31 (fair working conditions)
39
+
40
+ ## 3. AI System Description
41
+ <!-- GUIDANCE: Be specific about what the AI system does — "assists with hiring"
42
+ is too vague. Describe the exact decision points where AI is involved and what
43
+ data it processes. Example: "Scores CVs on 12 criteria, generates shortlist of
44
+ top 20% candidates, provides interview question suggestions based on role profile." -->
45
+
46
+ - System name: [AI System Name]
47
+ - Description: [Description]
48
+ - Provider: [Provider]
49
+ - Model ID: [Model ID]
50
+ - Autonomy level: [Autonomy Level]
51
+
52
+ ## 4. Risk Classification
53
+ <!-- GUIDANCE: All HR AI for recruitment/selection is high-risk under Annex III §6(a).
54
+ If your system falls outside §6(a), document the exact reasoning. Consider whether
55
+ the system could be used for purposes that would make it high-risk even if the
56
+ primary use is not. Example: "High-risk per Annex III §6(a) — used for candidate
57
+ screening affecting access to employment." -->
58
+
59
+ This AI system is classified as **[Risk Class]** under the EU AI Act. HR/employment AI systems used for recruitment, selection, or decisions affecting terms of work-related relationships are classified as high-risk under Annex III §6(a).
60
+
61
+ ## 5. Data Governance
62
+ <!-- GUIDANCE: Art. 10 requires data governance for high-risk AI. Identify bias
63
+ risks in training data — historical hiring data often encodes past discrimination.
64
+ Prohibit use of protected characteristics as inputs, including proxy variables
65
+ (e.g., postcode correlating with ethnicity). Example: "Training data audited for
66
+ gender balance — 48% female representation vs. 52% in applicant pool." -->
67
+
68
+ - All training and input data must be assessed for bias and representativeness before use
69
+ - Personal data processing must comply with GDPR, with a lawful basis identified for each processing activity
70
+ - Data used for candidate screening or employee evaluation must be relevant, adequate, and not excessive
71
+ - Special category data (Art. 9 GDPR) must not be processed unless a specific exemption applies
72
+ - Data retention periods must be defined and enforced for all AI-processed HR data
73
+
74
+ ## 6. Human Oversight
75
+ <!-- GUIDANCE: Art. 14 requires meaningful human oversight, not rubber-stamping.
76
+ The reviewer must have authority AND competence to override AI outputs. GDPR Art. 22
77
+ prohibits fully automated decisions with legal effects without safeguards.
78
+ Example: "HR manager reviews all AI-generated shortlists before candidate contact;
79
+ minimum 15-minute review per shortlist, documented in ATS." -->
80
+
81
+ - Autonomy level: [Autonomy Level]
82
+ - [Human Oversight Description]
83
+ - No fully automated decisions shall be made that produce legal effects or similarly significantly affect natural persons without meaningful human review
84
+ - All AI-generated shortlists, scores, or recommendations must be reviewed by qualified HR personnel before action
85
+ - Human reviewers must have the authority and ability to override or disregard AI outputs
86
+
87
+ ## 7. Transparency and Disclosure
88
+ <!-- GUIDANCE: Art. 26(7) requires informing workers. GDPR Art. 13-14 requires
89
+ informing candidates about automated processing. Provide disclosure BEFORE the
90
+ AI-assisted process begins, not after. Example: "Candidate portal displays AI
91
+ disclosure at application start: 'Your application will be screened using AI.
92
+ You may request human-only review.'" -->
93
+
94
+ - Candidates and employees must be informed before any AI-assisted decision-making process begins
95
+ - Information provided must include: the fact that AI is used, its purpose, the logic involved, and potential consequences
96
+ - Worker representatives and works councils must be consulted where required by national law
97
+ - All AI-generated assessments must be clearly marked as AI-assisted
98
+
99
+ ## 8. Anti-Discrimination and Worker Rights
100
+ <!-- GUIDANCE: Charter Art. 21 (non-discrimination) is paramount. Conduct bias
101
+ audits disaggregated by gender, ethnicity, age, and disability. Set quantitative
102
+ thresholds for acceptable differential impact. Example: "Quarterly bias audit:
103
+ selection rate ratio between demographic groups must exceed 0.8 (four-fifths rule).
104
+ If below, system suspended pending investigation." -->
105
+
106
+ - Regular bias audits must be conducted on AI system outputs, disaggregated by protected characteristics
107
+ - The system must not use proxy variables that correlate with protected characteristics (gender, ethnicity, age, disability)
108
+ - Impact assessments must evaluate differential treatment across demographic groups
109
+ - Remediation procedures must be in place for identified discriminatory outcomes
110
+ - Workers retain the right to contest AI-assisted decisions through established grievance procedures
111
+
112
+ ## 9. Works Council and Employee Representation
113
+ <!-- GUIDANCE: Check national transposition of European Works Council Directive.
114
+ In many EU member states, AI deployment requires formal consultation or co-determination
115
+ with employee representatives. Document consultation process and outcomes.
116
+ Example: In France, CSE consultation required under Art. L2312-38 Code du travail. -->
117
+
118
+ - Works councils or employee representatives must be informed and consulted before AI system deployment, as required by national transposition of the European Works Council Directive
119
+ - Employee representatives must have access to relevant system documentation and audit results
120
+ - Consultation processes must be documented and their outcomes incorporated into deployment decisions
121
+
122
+ ## 10. Monitoring and Logging
123
+ <!-- GUIDANCE: Art. 26(6) requires log retention for at least 6 months. HR-specific
124
+ retention should align with employment law (often 3+ years for discrimination claims).
125
+ Track both system metrics (accuracy, speed) and fairness metrics (demographic parity).
126
+ Example: "Logs retained 5 years per employment tribunal limitation period." -->
127
+
128
+ - All AI-assisted decisions must be logged with sufficient detail for auditability
129
+ - System performance must be monitored for accuracy, fairness, and bias on a [quarterly/monthly] basis
130
+ - Key performance indicators must include: accuracy, false positive/negative rates, demographic parity metrics
131
+ - Logs must be retained for the period required by applicable employment law (minimum 3 years)
132
+
133
+ ## 11. Incident Response
134
+ <!-- GUIDANCE: Define what constitutes an "incident" in HR context: pattern of
135
+ discriminatory outcomes, candidate complaint of unfair treatment, system making
136
+ decisions outside its intended scope. Suspension criteria must be specific.
137
+ Example: "System suspended if: (a) bias audit fails four-fifths rule, (b) >3
138
+ candidate complaints in 30 days, (c) system scores >100 candidates without
139
+ human review." -->
140
+
141
+ - Any suspected discriminatory outcome or system malfunction must be reported immediately
142
+ - The AI system must be suspended if a pattern of discriminatory outcomes is detected
143
+ - Affected candidates or employees must be notified and offered alternative assessment
144
+ - Incidents must be reported to the relevant market surveillance authority where required
145
+
146
+ ## 12. Training and Awareness
147
+ <!-- GUIDANCE: Art. 4 requires AI literacy. HR staff using AI need Level 2 training
148
+ (operator level) covering bias recognition and override procedures. Training must
149
+ be role-specific, not generic AI awareness. Example: "Recruiters complete 4-hour
150
+ Level 2 training including: interpreting AI scores, override procedure, bias
151
+ indicators, complaint handling. Annual refresh required." -->
152
+
153
+ - All HR personnel using the AI system must receive training on its operation, limitations, and oversight responsibilities
154
+ - Training must cover: bias recognition, override procedures, data protection obligations, and complaint handling
155
+ - Refresher training must be provided at least annually and when significant system updates occur
156
+
157
+ ## 13. Review Schedule
158
+ <!-- GUIDANCE: Annual minimum review, but trigger-based review is equally important.
159
+ Triggers include: new AI system adoption, bias audit findings, regulatory updates,
160
+ significant system updates from provider. Example: "Annual review in Q1; ad-hoc
161
+ review triggered by provider updates, bias audit alerts, or >2 incidents." -->
162
+
163
+ - This policy shall be reviewed at least annually and upon any significant change to the AI system
164
+ - Review must include analysis of monitoring data, incident reports, and bias audit results
165
+ - Updates must be communicated to all affected personnel and worker representatives
166
+
167
+ ## 14. Approval and Sign-off
168
+ <!-- GUIDANCE: Minimum sign-offs: Policy Owner, HR Director, DPO, and Works Council
169
+ Representative (where applicable). In jurisdictions with co-determination rights,
170
+ Works Council sign-off may be legally required. Example: "Works Council representative
171
+ signs to confirm Art. L2312-38 consultation was completed and outcomes incorporated." -->
172
+
173
+ | Role | Name | Date |
174
+ |------|------|------|
175
+ | Policy Owner | [Approver Name] | [Date] |
176
+ | HR Director | _________________ | _________ |
177
+ | DPO | _________________ | _________ |
178
+ | Works Council Representative | _________________ | _________ |
@@ -0,0 +1,189 @@
1
+ # AI Usage Policy — Legal / Justice
2
+
3
+ | Field | Value |
4
+ |-------|-------|
5
+ | Policy Title | AI Usage Policy — Legal / Justice |
6
+ | Organization | [Organization] |
7
+ | Date | [Date] |
8
+ | Version | [Version] |
9
+ | AI System Name | [AI System Name] |
10
+ | Risk Class | [Risk Class] |
11
+
12
+ ## 1. Purpose and Scope
13
+ <!-- GUIDANCE: Annex III §8(a) makes judicial/legal AI high-risk. Scope must
14
+ address professional privilege implications — use of AI in legal work creates
15
+ novel confidentiality risks. Include ALL AI tools used by legal staff.
16
+ Example: "Covers: Harvey (contract review), Lexis+ AI (legal research),
17
+ in-house NLP (case analysis), Copilot (general drafting)." -->
18
+
19
+ This policy governs the use of [AI System Name] within [Organization]'s legal operations. It establishes requirements for ethical, confidential and accountable use of AI in legal research, case analysis, contract review, and legal decision support, in accordance with the EU AI Act (Regulation 2024/1689).
20
+
21
+ This policy applies to all legal professionals, support staff, and personnel involved in operating, supervising, or relying on AI-assisted legal analysis and decisions.
22
+
23
+ ## 2. Applicable Legislation
24
+ <!-- GUIDANCE: Legal AI intersects EU AI Act with professional conduct rules
25
+ (bar association regulations, solicitor regulation). ECHR Art. 6 (fair trial)
26
+ is relevant when AI assists judicial decisions. Check national bar rules on
27
+ AI use. Example: In Germany, reference BRAO §43a (duty of care) and BDSG
28
+ §22 (processing of special categories). -->
29
+
30
+ - **EU AI Act** — Annex III §8(a): AI systems intended to be used by a judicial authority or on their behalf to assist in researching and interpreting facts and the law and in applying the law to a concrete set of facts
31
+ - **Art. 6(2)** — High-risk AI system classification
32
+ - **Art. 9** — Risk management system requirements
33
+ - **Art. 10** — Data governance and management practices
34
+ - **Art. 14** — Human oversight measures
35
+ - **Art. 26** — Obligations of deployers of high-risk AI systems
36
+ - **GDPR** — Art. 22 (automated individual decision-making), Art. 35 (DPIA)
37
+ - **EU Charter of Fundamental Rights** — Art. 47 (right to effective remedy and fair trial), Art. 48 (presumption of innocence)
38
+ - **European Convention on Human Rights** — Art. 6 (right to a fair trial)
39
+ - **Professional conduct rules** — applicable bar association and law society regulations
40
+
41
+ ## 3. AI System Description
42
+ <!-- GUIDANCE: Describe the specific legal tasks the AI performs. Distinguish
43
+ between research assistance (finding cases) and analytical assistance (predicting
44
+ outcomes, drafting arguments). Example: "AI legal research: searches case law
45
+ database, returns relevant cases with relevance scores. Does NOT provide legal
46
+ analysis or outcome prediction. All results verified by qualified lawyer." -->
47
+
48
+ - System name: [AI System Name]
49
+ - Description: [Description]
50
+ - Provider: [Provider]
51
+ - Model ID: [Model ID]
52
+ - Autonomy level: [Autonomy Level]
53
+
54
+ ## 4. Risk Classification
55
+ <!-- GUIDANCE: AI assisting judicial authorities is high-risk per Annex III §8(a).
56
+ AI used for internal law firm operations (billing, scheduling) may be lower risk.
57
+ Document classification per system. Example: "Case analysis AI: high-risk
58
+ (Annex III §8(a)); time recording AI: minimal risk (administrative)." -->
59
+
60
+ This AI system is classified as **[Risk Class]** under the EU AI Act. AI systems intended for use by judicial authorities or in legal proceedings are classified as high-risk under Annex III §8(a).
61
+
62
+ ## 5. Data Governance
63
+ <!-- GUIDANCE: Legal privilege creates unique data governance challenges. Client
64
+ data must NEVER be used for AI model training or shared with providers. Verify
65
+ provider's data handling (does the model learn from inputs?). Example: "Provider
66
+ contractual guarantee: zero data retention, no model training on inputs.
67
+ Client matters segregated by matter ID. No cross-matter data leakage possible." -->
68
+
69
+ - Client data must be processed in compliance with professional privilege and confidentiality obligations
70
+ - Data minimisation: only legally relevant information shall be provided to the AI system
71
+ - Case data must be segregated to prevent cross-contamination between client matters
72
+ - Third-party AI providers must not retain or use client data for training or other purposes
73
+ - Data residency requirements must comply with applicable legal professional regulations
74
+ - Document retention and destruction policies must account for AI-processed materials
75
+
76
+ ## 6. Human Oversight
77
+ <!-- GUIDANCE: Professional duty of competence requires lawyers to understand
78
+ AI limitations. AI outputs are tools, not substitutes for professional judgment.
79
+ Every AI-generated citation must be independently verified — LLMs hallucinate
80
+ legal citations. Example: "Mandatory verification checklist before any
81
+ AI-assisted document is filed: (1) all citations verified in primary source,
82
+ (2) all statutory references current, (3) jurisdictional applicability confirmed." -->
83
+
84
+ - Autonomy level: [Autonomy Level]
85
+ - [Human Oversight Description]
86
+ - The AI system must be used as a research and analysis tool only; legal judgments and advice must be provided by qualified legal professionals
87
+ - Legal professionals must independently verify all AI-generated legal citations, case references, and statutory interpretations
88
+ - AI outputs must not be presented to clients or courts without professional review and validation
89
+
90
+ ## 7. Transparency and Disclosure
91
+ <!-- GUIDANCE: Professional conduct rules may require disclosure of AI use to
92
+ clients and courts. Check applicable bar rules. Some jurisdictions require
93
+ informing opposing counsel. Example: "Client engagement letter updated to
94
+ include: 'We may use AI tools to assist with legal research and document
95
+ review. All AI-assisted work is reviewed by qualified lawyers.'" -->
96
+
97
+ - Clients must be informed when AI tools are used in the handling of their matter
98
+ - The extent and nature of AI involvement must be disclosed as required by professional conduct rules
99
+ - Courts and tribunals must be informed of AI assistance where required by procedural rules
100
+ - AI-assisted legal documents must be reviewed and adopted as the professional's own work product
101
+
102
+ ## 8. Professional Confidentiality and Ethics
103
+ <!-- GUIDANCE: Attorney-client privilege may be waived if confidential data is
104
+ shared with third-party AI providers without adequate safeguards. Conduct privilege
105
+ impact assessment for each AI tool. Example: "Privilege risk assessment: Harvey
106
+ (API deployment, no data retention — LOW risk); ChatGPT (shared model —
107
+ HIGH risk, restricted to non-privileged research only)." -->
108
+
109
+ - Attorney-client privilege and legal professional privilege must be maintained when using AI systems
110
+ - Data processed by the AI system must not be accessible to third parties, including the AI provider, in a manner that could waive privilege
111
+ - Conflict of interest checks must account for information processed by the AI system
112
+ - AI use must comply with the professional duty of competence — lawyers must understand the AI tool's capabilities and limitations
113
+ - The duty of independent professional judgment must not be delegated to AI systems
114
+
115
+ ## 9. Unauthorized Practice Prevention
116
+ <!-- GUIDANCE: AI outputs that reach clients without lawyer review may constitute
117
+ unauthorized practice of law. Implement technical controls (access restrictions)
118
+ and procedural controls (review requirements). Example: "AI legal research tool
119
+ restricted to lawyer login only. Output watermarked: 'AI-generated — requires
120
+ lawyer review. Not legal advice.' Client portal has no AI-direct access." -->
121
+
122
+ - AI system outputs must not constitute legal advice to the public without professional intermediation
123
+ - Access controls must ensure that only qualified legal professionals can generate and interpret AI legal analysis
124
+ - AI-generated legal documents must not be filed or distributed without professional review and approval
125
+ - The system must include appropriate disclaimers indicating that AI outputs do not constitute legal advice
126
+ - Procedures must be in place to prevent clients or unqualified staff from directly relying on raw AI outputs
127
+
128
+ ## 10. Monitoring and Logging
129
+ <!-- GUIDANCE: Track hallucination rate (fabricated citations) as a critical KPI.
130
+ Legal AI accuracy has direct professional liability implications. Jurisdictional
131
+ correctness is essential for multi-jurisdiction practices. Example: "Monthly
132
+ audit: 50 random AI citations verified. Current hallucination rate: 2.3%
133
+ (target <1%). Jurisdictional accuracy: 97.5% (target >99%)." -->
134
+
135
+ - All AI-assisted legal analyses must be logged with sufficient detail for professional accountability
136
+ - System performance must be monitored for accuracy of legal citations, case law currency, and analytical reliability
137
+ - Key metrics: citation accuracy, hallucination rate, jurisdictional correctness, analytical consistency
138
+ - Monitoring frequency: [monthly/quarterly] with professional oversight committee review
139
+ - Logs must be retained in compliance with legal record-keeping and professional indemnity requirements
140
+
141
+ ## 11. Incident Response
142
+ <!-- GUIDANCE: Legal AI incidents may trigger professional indemnity insurance
143
+ notification, regulatory reporting, and duties to the court. If inaccurate
144
+ AI analysis was relied upon in filed documents, the duty of candor may require
145
+ correction. Example: "If AI-hallucinated citation is discovered after filing:
146
+ (1) correct with court immediately, (2) notify client, (3) notify PI insurer
147
+ within policy terms (typically 48 hours)." -->
148
+
149
+ - Any discovered inaccuracy in AI-generated legal analysis that was relied upon must be reported immediately
150
+ - If inaccurate AI analysis was submitted to a court or relied upon in advice, corrective action must be taken promptly
151
+ - Professional indemnity insurers must be notified as required by policy terms
152
+ - Affected clients must be informed if AI-related errors materially affect their matter
153
+ - Root cause analysis must be conducted and remediation measures implemented
154
+
155
+ ## 12. Training and Awareness
156
+ <!-- GUIDANCE: Legal professionals need training specific to AI verification —
157
+ LLM-generated legal text can be highly convincing but factually wrong. Include
158
+ practical exercises with known AI errors. Example: "Training exercise: review
159
+ AI-generated memo containing 3 deliberate errors (hallucinated case, wrong
160
+ jurisdiction, outdated statute). Trainees must identify all 3 to pass." -->
161
+
162
+ - All legal professionals using the AI system must receive training on its operation, limitations, and ethical obligations
163
+ - Training must cover: verification procedures, confidentiality safeguards, professional responsibility, and error reporting
164
+ - Competency assessment must be completed before independent use for client matters
165
+ - Refresher training must be provided at least annually and upon significant system updates
166
+
167
+ ## 13. Review Schedule
168
+ <!-- GUIDANCE: Legal AI policy must be updated when professional conduct rules
169
+ change. Bar associations are actively developing AI guidance — monitor updates.
170
+ Example: "Review triggers: new SRA/BSB guidance on AI, bar association updates,
171
+ new AI tool adoption, incident requiring corrective action." -->
172
+
173
+ - This policy shall be reviewed at least annually and upon relevant changes to professional conduct rules or legislation
174
+ - Review must incorporate accuracy monitoring data, incident reports, and regulatory guidance updates
175
+ - Updates must be approved by the firm's Managing Partner / General Counsel and Ethics Committee
176
+
177
+ ## 14. Approval and Sign-off
178
+ <!-- GUIDANCE: Managing Partner/General Counsel sign-off represents the firm's
179
+ commitment to responsible AI use. Ethics Committee ensures professional conduct
180
+ compliance. Consider external review by professional indemnity insurer.
181
+ Example: "Ethics Committee confirms compliance with SRA Principles (UK) /
182
+ CCBE guidance. PI insurer notified of AI tool adoption." -->
183
+
184
+ | Role | Name | Date |
185
+ |------|------|------|
186
+ | Policy Owner | [Approver Name] | [Date] |
187
+ | Managing Partner / General Counsel | _________________ | _________ |
188
+ | DPO | _________________ | _________ |
189
+ | Ethics Committee Chair | _________________ | _________ |