oh-my-agent-commandcode 0.0.0-stage → 20.38.4

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 (334) hide show
  1. package/README.md +35 -2
  2. package/filter-test-output.sh +52 -0
  3. package/mods/oma.ts +347 -0
  4. package/package.json +30 -4
  5. package/skills/_shared/conditional/experiment-ledger.md +28 -0
  6. package/skills/_shared/conditional/exploration-loop.md +22 -0
  7. package/skills/_shared/conditional/quality-score.md +33 -0
  8. package/skills/_shared/core/anti-ai-prose.md +191 -0
  9. package/skills/_shared/core/api-contracts/README.md +28 -0
  10. package/skills/_shared/core/api-contracts/template.md +90 -0
  11. package/skills/_shared/core/clarification-protocol.md +23 -0
  12. package/skills/_shared/core/code-intelligence.md +46 -0
  13. package/skills/_shared/core/collaboration-policy.md +28 -0
  14. package/skills/_shared/core/common-checklist.md +28 -0
  15. package/skills/_shared/core/context-budget.md +22 -0
  16. package/skills/_shared/core/context-loading.md +34 -0
  17. package/skills/_shared/core/difficulty-guide.md +26 -0
  18. package/skills/_shared/core/execution-policy.md +31 -0
  19. package/skills/_shared/core/lessons-learned.md +33 -0
  20. package/skills/_shared/core/prompt-structure.md +18 -0
  21. package/skills/_shared/core/quality-principles.md +11 -0
  22. package/skills/_shared/core/session-metrics.md +35 -0
  23. package/skills/_shared/core/skill-routing.md +39 -0
  24. package/skills/_shared/core/test-approach.md +54 -0
  25. package/skills/_shared/core/vendor-detection.md +52 -0
  26. package/skills/_shared/runtime/memory-protocol.md +118 -0
  27. package/skills/_shared/runtime/result-contract.md +64 -0
  28. package/skills/_shared/ui-interaction-quality.md +133 -0
  29. package/skills/oma-academic-writing/SKILL.md +181 -0
  30. package/skills/oma-academic-writing/resources/abstract-guide.md +51 -0
  31. package/skills/oma-academic-writing/resources/academic-verb-tiers.md +42 -0
  32. package/skills/oma-academic-writing/resources/anti-ai-checklist.md +52 -0
  33. package/skills/oma-academic-writing/resources/hedging-guide.md +132 -0
  34. package/skills/oma-academic-writing/resources/sentence-structure-reference.md +151 -0
  35. package/skills/oma-architecture/SKILL.md +203 -0
  36. package/skills/oma-architecture/resources/api-evolution.md +41 -0
  37. package/skills/oma-architecture/resources/checklist.md +42 -0
  38. package/skills/oma-architecture/resources/execution-protocol.md +115 -0
  39. package/skills/oma-architecture/resources/methodology-selection.md +92 -0
  40. package/skills/oma-architecture/resources/migration-patterns.md +28 -0
  41. package/skills/oma-architecture/resources/output-templates.md +111 -0
  42. package/skills/oma-architecture/resources/stakeholder-synthesis.md +80 -0
  43. package/skills/oma-backend/SKILL.md +202 -0
  44. package/skills/oma-backend/resources/checklist.md +45 -0
  45. package/skills/oma-backend/resources/error-playbook.md +97 -0
  46. package/skills/oma-backend/resources/execution-protocol.md +39 -0
  47. package/skills/oma-backend/resources/orm-reference.md +61 -0
  48. package/skills/oma-backend/variants/node/api-template.ts +315 -0
  49. package/skills/oma-backend/variants/node/snippets.md +475 -0
  50. package/skills/oma-backend/variants/node/stack.yaml +21 -0
  51. package/skills/oma-backend/variants/node/tech-stack.md +33 -0
  52. package/skills/oma-backend/variants/python/api-template.py +378 -0
  53. package/skills/oma-backend/variants/python/snippets.md +199 -0
  54. package/skills/oma-backend/variants/python/stack.yaml +18 -0
  55. package/skills/oma-backend/variants/python/tech-stack.md +45 -0
  56. package/skills/oma-backend/variants/rust/api-template.rs +635 -0
  57. package/skills/oma-backend/variants/rust/snippets.md +471 -0
  58. package/skills/oma-backend/variants/rust/stack.yaml +20 -0
  59. package/skills/oma-backend/variants/rust/tech-stack.md +36 -0
  60. package/skills/oma-backend/variants/stack.schema.json +73 -0
  61. package/skills/oma-brainstorm/SKILL.md +166 -0
  62. package/skills/oma-brainstorm/resources/triz-lite.md +117 -0
  63. package/skills/oma-coordination/SKILL.md +171 -0
  64. package/skills/oma-db/SKILL.md +201 -0
  65. package/skills/oma-db/resources/anti-patterns.md +177 -0
  66. package/skills/oma-db/resources/checklist.md +67 -0
  67. package/skills/oma-db/resources/document-templates.md +107 -0
  68. package/skills/oma-db/resources/error-playbook.md +50 -0
  69. package/skills/oma-db/resources/examples.md +170 -0
  70. package/skills/oma-db/resources/execution-protocol.md +127 -0
  71. package/skills/oma-db/resources/iso-controls.md +98 -0
  72. package/skills/oma-db/resources/migration-playbook.md +93 -0
  73. package/skills/oma-db/resources/query-tuning.md +57 -0
  74. package/skills/oma-db/resources/vector-db.md +159 -0
  75. package/skills/oma-debug/SKILL.md +146 -0
  76. package/skills/oma-debug/resources/bug-report-template.md +327 -0
  77. package/skills/oma-debug/resources/checklist.md +31 -0
  78. package/skills/oma-debug/resources/common-patterns.md +734 -0
  79. package/skills/oma-debug/resources/debugging-checklist.md +364 -0
  80. package/skills/oma-debug/resources/error-playbook.md +94 -0
  81. package/skills/oma-debug/resources/execution-protocol.md +40 -0
  82. package/skills/oma-design/SKILL.md +135 -0
  83. package/skills/oma-design/resources/asset-strategy.md +34 -0
  84. package/skills/oma-design/resources/checklist.md +63 -0
  85. package/skills/oma-design/resources/data-grid.md +48 -0
  86. package/skills/oma-design/resources/design-md-spec.md +107 -0
  87. package/skills/oma-design/resources/design-tokens.md +53 -0
  88. package/skills/oma-design/resources/error-playbook.md +18 -0
  89. package/skills/oma-design/resources/execution-protocol.md +95 -0
  90. package/skills/oma-design/resources/external-design-skills.md +130 -0
  91. package/skills/oma-design/resources/getdesign-fetcher.md +104 -0
  92. package/skills/oma-design/resources/product-interface-review.md +59 -0
  93. package/skills/oma-design/resources/redesign-protocol.md +52 -0
  94. package/skills/oma-design/resources/stitch-integration.md +244 -0
  95. package/skills/oma-dev-workflow/SKILL.md +375 -0
  96. package/skills/oma-dev-workflow/resources/affected-checks.py +58 -0
  97. package/skills/oma-dev-workflow/resources/api-workflows.md +58 -0
  98. package/skills/oma-dev-workflow/resources/database-patterns.md +107 -0
  99. package/skills/oma-dev-workflow/resources/i18n-patterns.md +63 -0
  100. package/skills/oma-dev-workflow/resources/release-coordination.md +240 -0
  101. package/skills/oma-dev-workflow/resources/tooling-profiles.md +217 -0
  102. package/skills/oma-dev-workflow/resources/troubleshooting.md +78 -0
  103. package/skills/oma-dev-workflow/resources/validation-pipeline.md +246 -0
  104. package/skills/oma-docs/SKILL.md +77 -0
  105. package/skills/oma-docs/resources/commands.md +76 -0
  106. package/skills/oma-explanation/SKILL.md +212 -0
  107. package/skills/oma-explanation/resources/document-structure.md +115 -0
  108. package/skills/oma-explanation/resources/draft-format.md +199 -0
  109. package/skills/oma-explanation/resources/html-contract.md +102 -0
  110. package/skills/oma-frontend/SKILL.md +227 -0
  111. package/skills/oma-frontend/resources/angular-rules.md +110 -0
  112. package/skills/oma-frontend/resources/checklist.md +76 -0
  113. package/skills/oma-frontend/resources/error-playbook.md +125 -0
  114. package/skills/oma-frontend/resources/execution-protocol.md +46 -0
  115. package/skills/oma-frontend/resources/snippets.md +354 -0
  116. package/skills/oma-frontend/resources/specialized-visual-implementation.md +193 -0
  117. package/skills/oma-frontend/resources/tailwind-rules.md +83 -0
  118. package/skills/oma-frontend/resources/tech-stack.md +156 -0
  119. package/skills/oma-hwp/SKILL.md +166 -0
  120. package/skills/oma-hwp/config/hwp-config.yaml +35 -0
  121. package/skills/oma-hwp/resources/balanced-tables.ts +39 -0
  122. package/skills/oma-hwp/resources/execution-protocol.md +145 -0
  123. package/skills/oma-hwp/resources/flatten-tables.ts +101 -0
  124. package/skills/oma-hwp/resources/package.json +13 -0
  125. package/skills/oma-hwp/resources/troubleshooting.md +70 -0
  126. package/skills/oma-hwp/resources/tsconfig.json +10 -0
  127. package/skills/oma-hwp/resources/turndown-plugin-gfm.d.ts +9 -0
  128. package/skills/oma-image/SKILL.md +142 -0
  129. package/skills/oma-image/config/image-config.yaml +70 -0
  130. package/skills/oma-image/resources/checklist.md +18 -0
  131. package/skills/oma-image/resources/execution-protocol.md +117 -0
  132. package/skills/oma-image/resources/invocation.md +105 -0
  133. package/skills/oma-image/resources/prompt-tips.md +71 -0
  134. package/skills/oma-image/resources/vendor-matrix.md +90 -0
  135. package/skills/oma-market/SKILL.md +142 -0
  136. package/skills/oma-market/resources/checklist.md +12 -0
  137. package/skills/oma-market/resources/error-playbook.md +12 -0
  138. package/skills/oma-market/resources/execution-protocol.md +60 -0
  139. package/skills/oma-market/resources/frameworks/pestel.md +101 -0
  140. package/skills/oma-market/resources/frameworks/porters-5f.md +90 -0
  141. package/skills/oma-market/resources/frameworks/swot.md +61 -0
  142. package/skills/oma-market/resources/intent-rules.md +35 -0
  143. package/skills/oma-market/resources/output-laws.md +53 -0
  144. package/skills/oma-mobile/SKILL.md +168 -0
  145. package/skills/oma-mobile/resources/checklist.md +77 -0
  146. package/skills/oma-mobile/resources/error-playbook.md +198 -0
  147. package/skills/oma-mobile/resources/execution-protocol.md +47 -0
  148. package/skills/oma-mobile/resources/screen-template.dart +331 -0
  149. package/skills/oma-mobile/resources/screen-template.swift +239 -0
  150. package/skills/oma-mobile/resources/screen-template.tsx +179 -0
  151. package/skills/oma-mobile/resources/tech-stack.md +69 -0
  152. package/skills/oma-mobile/variants/README.md +45 -0
  153. package/skills/oma-mobile/variants/flutter/api-template.dart +461 -0
  154. package/skills/oma-mobile/variants/flutter/snippets.md +1353 -0
  155. package/skills/oma-mobile/variants/flutter/stack.yaml +21 -0
  156. package/skills/oma-mobile/variants/flutter/tech-stack.md +201 -0
  157. package/skills/oma-mobile/variants/kotlin-android/api-template.kt +182 -0
  158. package/skills/oma-mobile/variants/kotlin-android/snippets.md +871 -0
  159. package/skills/oma-mobile/variants/kotlin-android/stack.yaml +32 -0
  160. package/skills/oma-mobile/variants/kotlin-android/tech-stack.md +159 -0
  161. package/skills/oma-mobile/variants/react-native/api-template.ts +531 -0
  162. package/skills/oma-mobile/variants/react-native/snippets.md +1014 -0
  163. package/skills/oma-mobile/variants/react-native/stack.yaml +22 -0
  164. package/skills/oma-mobile/variants/react-native/tech-stack.md +192 -0
  165. package/skills/oma-mobile/variants/stack.schema.json +68 -0
  166. package/skills/oma-mobile/variants/swift-ios/api-template.swift +165 -0
  167. package/skills/oma-mobile/variants/swift-ios/snippets.md +1028 -0
  168. package/skills/oma-mobile/variants/swift-ios/stack.yaml +25 -0
  169. package/skills/oma-mobile/variants/swift-ios/tech-stack.md +174 -0
  170. package/skills/oma-observability/SKILL.md +225 -0
  171. package/skills/oma-observability/resources/anti-patterns.md +555 -0
  172. package/skills/oma-observability/resources/boundaries/cross-application.md +348 -0
  173. package/skills/oma-observability/resources/boundaries/multi-tenant.md +290 -0
  174. package/skills/oma-observability/resources/boundaries/release.md +372 -0
  175. package/skills/oma-observability/resources/boundaries/slo.md +225 -0
  176. package/skills/oma-observability/resources/checklist.md +123 -0
  177. package/skills/oma-observability/resources/examples.md +448 -0
  178. package/skills/oma-observability/resources/execution-protocol.md +166 -0
  179. package/skills/oma-observability/resources/incident-forensics.md +348 -0
  180. package/skills/oma-observability/resources/intent-rules.md +307 -0
  181. package/skills/oma-observability/resources/layers/L3-network.md +281 -0
  182. package/skills/oma-observability/resources/layers/L4-transport.md +299 -0
  183. package/skills/oma-observability/resources/layers/L7-application/crash-analytics.md +359 -0
  184. package/skills/oma-observability/resources/layers/L7-application/mobile-rum.md +278 -0
  185. package/skills/oma-observability/resources/layers/L7-application/waf.md +246 -0
  186. package/skills/oma-observability/resources/layers/L7-application/web-rum.md +350 -0
  187. package/skills/oma-observability/resources/layers/mesh.md +368 -0
  188. package/skills/oma-observability/resources/matrix.md +177 -0
  189. package/skills/oma-observability/resources/meta-observability.md +605 -0
  190. package/skills/oma-observability/resources/observability-as-code.md +666 -0
  191. package/skills/oma-observability/resources/signals/audit.md +310 -0
  192. package/skills/oma-observability/resources/signals/cost.md +303 -0
  193. package/skills/oma-observability/resources/signals/logs.md +263 -0
  194. package/skills/oma-observability/resources/signals/metrics.md +478 -0
  195. package/skills/oma-observability/resources/signals/privacy.md +351 -0
  196. package/skills/oma-observability/resources/signals/profiles.md +245 -0
  197. package/skills/oma-observability/resources/signals/traces.md +360 -0
  198. package/skills/oma-observability/resources/standards.md +214 -0
  199. package/skills/oma-observability/resources/transport/collector-topology.md +308 -0
  200. package/skills/oma-observability/resources/transport/otlp-grpc-vs-http.md +256 -0
  201. package/skills/oma-observability/resources/transport/sampling-recipes.md +297 -0
  202. package/skills/oma-observability/resources/transport/udp-statsd-mtu.md +167 -0
  203. package/skills/oma-observability/resources/vendor-categories.md +352 -0
  204. package/skills/oma-orchestration/SKILL.md +302 -0
  205. package/skills/oma-orchestration/config/cli-config.yaml +92 -0
  206. package/skills/oma-orchestration/resources/memory-schema.md +232 -0
  207. package/skills/oma-orchestration/resources/subagent-prompt-template.md +30 -0
  208. package/skills/oma-orchestration/scripts/parallel-run.sh +6 -0
  209. package/skills/oma-orchestration/scripts/spawn-agent.sh +5 -0
  210. package/skills/oma-orchestration/scripts/verify.sh +20 -0
  211. package/skills/oma-orchestration/templates/backend-task.md +19 -0
  212. package/skills/oma-orchestration/templates/debug-task.md +16 -0
  213. package/skills/oma-orchestration/templates/frontend-task.md +18 -0
  214. package/skills/oma-orchestration/templates/mobile-task.md +18 -0
  215. package/skills/oma-orchestration/templates/qa-task.md +16 -0
  216. package/skills/oma-orchestration/templates/tasks-example.yaml +15 -0
  217. package/skills/oma-pdf/SKILL.md +162 -0
  218. package/skills/oma-pdf/config/pdf-config.yaml +27 -0
  219. package/skills/oma-pdf/resources/execution-protocol.md +127 -0
  220. package/skills/oma-pm/SKILL.md +157 -0
  221. package/skills/oma-pm/resources/error-playbook.md +75 -0
  222. package/skills/oma-pm/resources/examples.md +439 -0
  223. package/skills/oma-pm/resources/execution-protocol.md +62 -0
  224. package/skills/oma-pm/resources/iso-planning.md +110 -0
  225. package/skills/oma-pm/resources/plan-phase-protocol.md +66 -0
  226. package/skills/oma-pm/resources/task-template.json +86 -0
  227. package/skills/oma-qa/SKILL.md +141 -0
  228. package/skills/oma-qa/resources/checklist.md +339 -0
  229. package/skills/oma-qa/resources/error-playbook.md +98 -0
  230. package/skills/oma-qa/resources/execution-protocol.md +169 -0
  231. package/skills/oma-qa/resources/iso-quality.md +82 -0
  232. package/skills/oma-qa/resources/verify-ship-protocol.md +116 -0
  233. package/skills/oma-recap/SKILL.md +245 -0
  234. package/skills/oma-recap/resources/output-formats.md +83 -0
  235. package/skills/oma-refactor/SKILL.md +184 -0
  236. package/skills/oma-refactor/resources/definition.md +108 -0
  237. package/skills/oma-refactor/resources/governance.md +33 -0
  238. package/skills/oma-refactor/resources/hotspots.py +44 -0
  239. package/skills/oma-refactor/resources/measurement.md +93 -0
  240. package/skills/oma-scholar/SKILL.md +276 -0
  241. package/skills/oma-scholar/config/scholar-config.yaml +79 -0
  242. package/skills/oma-scholar/resources/api-endpoints.md +174 -0
  243. package/skills/oma-scholar/resources/checklist.md +92 -0
  244. package/skills/oma-scholar/resources/execution-protocol.md +224 -0
  245. package/skills/oma-scholar/resources/fallback-providers.md +143 -0
  246. package/skills/oma-scholar/resources/setup-openalex.md +85 -0
  247. package/skills/oma-scholar/resources/sidecar-spec.md +341 -0
  248. package/skills/oma-scholar/resources/upstream-spec-cache.md +972 -0
  249. package/skills/oma-scm/SKILL.md +103 -0
  250. package/skills/oma-scm/resources/cm-operations.md +56 -0
  251. package/skills/oma-scm/resources/codeowners-playbook.md +45 -0
  252. package/skills/oma-scm/resources/conventional-commits.md +108 -0
  253. package/skills/oma-scm/resources/merge-risk.md +76 -0
  254. package/skills/oma-scm/resources/onboarding-risk-signals.md +71 -0
  255. package/skills/oma-search/SKILL.md +125 -0
  256. package/skills/oma-search/resources/checklist.md +36 -0
  257. package/skills/oma-search/resources/error-playbook.md +66 -0
  258. package/skills/oma-search/resources/examples.md +80 -0
  259. package/skills/oma-search/resources/execution-protocol.md +86 -0
  260. package/skills/oma-search/resources/intent-rules.md +47 -0
  261. package/skills/oma-search/resources/trust-registry.md +53 -0
  262. package/skills/oma-security/SKILL.md +172 -0
  263. package/skills/oma-security/resources/artex.md +108 -0
  264. package/skills/oma-security/resources/ci.md +134 -0
  265. package/skills/oma-security/resources/cisco-source.md +108 -0
  266. package/skills/oma-security/resources/deepsec-config.md +45 -0
  267. package/skills/oma-security/resources/deepsec-matchers.md +35 -0
  268. package/skills/oma-security/resources/deepsec-scanning.md +45 -0
  269. package/skills/oma-security/resources/deepsec-setup.md +41 -0
  270. package/skills/oma-security/resources/findings-contract.md +408 -0
  271. package/skills/oma-security/resources/mcp-scanning.md +122 -0
  272. package/skills/oma-security/resources/skill-scanning.md +106 -0
  273. package/skills/oma-security/resources/validation.md +71 -0
  274. package/skills/oma-skill-creation/SKILL.md +84 -0
  275. package/skills/oma-skill-creation/resources/prompt-evaluation.md +36 -0
  276. package/skills/oma-skill-creation/resources/ssl-lite-template.md +108 -0
  277. package/skills/oma-skill-creation/resources/validation-checklist.md +101 -0
  278. package/skills/oma-slide/SKILL.md +277 -0
  279. package/skills/oma-slide/resources/animation-patterns.md +245 -0
  280. package/skills/oma-slide/resources/assets/deck-stage.js +514 -0
  281. package/skills/oma-slide/resources/assets/viewport-base.css +257 -0
  282. package/skills/oma-slide/resources/canva-integration.md +203 -0
  283. package/skills/oma-slide/resources/checklist.md +46 -0
  284. package/skills/oma-slide/resources/design-doctrine.md +260 -0
  285. package/skills/oma-slide/resources/fixed-stage.md +232 -0
  286. package/skills/oma-slide/resources/generation-protocol.md +393 -0
  287. package/skills/oma-slide/resources/native-pptx.md +84 -0
  288. package/skills/oma-slide/resources/selection-index.json +461 -0
  289. package/skills/oma-slide/resources/style-presets.LICENSE +10 -0
  290. package/skills/oma-slide/resources/style-presets.md +520 -0
  291. package/skills/oma-tf-infra/SKILL.md +201 -0
  292. package/skills/oma-tf-infra/resources/checklist.md +53 -0
  293. package/skills/oma-tf-infra/resources/cost-optimization.md +574 -0
  294. package/skills/oma-tf-infra/resources/error-playbook.md +68 -0
  295. package/skills/oma-tf-infra/resources/examples.md +38 -0
  296. package/skills/oma-tf-infra/resources/execution-protocol.md +129 -0
  297. package/skills/oma-tf-infra/resources/iso-42001-infra.md +229 -0
  298. package/skills/oma-tf-infra/resources/multi-cloud-examples.md +241 -0
  299. package/skills/oma-tf-infra/resources/policy-testing-examples.md +332 -0
  300. package/skills/oma-translation/SKILL.md +229 -0
  301. package/skills/oma-translation/resources/anti-ai-patterns.md +104 -0
  302. package/skills/oma-translation/resources/lang/_template.md +73 -0
  303. package/skills/oma-translation/resources/lang/en.md +123 -0
  304. package/skills/oma-translation/resources/lang/ja.md +274 -0
  305. package/skills/oma-translation/resources/lang/ko.md +228 -0
  306. package/skills/oma-translation/resources/lang/zh.md +285 -0
  307. package/skills/oma-translation/resources/style-skills.md +104 -0
  308. package/skills/oma-translation/resources/translation-rubric.md +126 -0
  309. package/skills/oma-video/SKILL.md +229 -0
  310. package/skills/oma-video/config/video-config.yaml +60 -0
  311. package/skills/oma-video/resources/checklist.md +26 -0
  312. package/skills/oma-video/resources/execution-protocol.md +122 -0
  313. package/skills/oma-video/resources/existing-media.md +185 -0
  314. package/skills/oma-video/resources/hyperframes-authoring/README.md +44 -0
  315. package/skills/oma-video/resources/hyperframes-authoring/demo.md +31 -0
  316. package/skills/oma-video/resources/hyperframes-authoring/explainer.md +10 -0
  317. package/skills/oma-video/resources/hyperframes-authoring/shorts.md +10 -0
  318. package/skills/oma-video/resources/motion-principles.md +81 -0
  319. package/skills/oma-video/resources/mpt/driver.py +301 -0
  320. package/skills/oma-video/resources/prompt-tips.md +75 -0
  321. package/skills/oma-video/resources/script-schema.md +81 -0
  322. package/skills/oma-video/resources/sound-design.md +127 -0
  323. package/skills/oma-video/resources/strudel/package.json +11 -0
  324. package/skills/oma-video/resources/strudel/page.html +87 -0
  325. package/skills/oma-video/resources/strudel/render.mjs +295 -0
  326. package/skills/oma-video/resources/vendor-matrix.md +124 -0
  327. package/skills/oma-voice/SKILL.md +249 -0
  328. package/skills/oma-voice/config/voice-config.yaml +30 -0
  329. package/skills/oma-voice/resources/audio-processing.md +119 -0
  330. package/skills/oma-voice/resources/checklist.md +47 -0
  331. package/skills/oma-voice/resources/execution-protocol.md +215 -0
  332. package/skills/oma-voice/resources/prompt-tips.md +43 -0
  333. package/skills/oma-voice/resources/voice-matrix.md +51 -0
  334. package/skills/oma-voice/resources/voicestudio.md +87 -0
@@ -0,0 +1,127 @@
1
+ # DB Agent - Execution Protocol
2
+
3
+ ## Preparation
4
+ Use the task's scope, existing project conventions, and acceptance criteria. Follow `../../_shared/core/execution-policy.md` when it has not already been supplied. Read only references needed by the selected operation; consult lessons or recovery guides for an observed issue. Expand planning depth only when the change requires it.
5
+
6
+ ## Step 1: Explore
7
+ - Identify actors and external views that need data
8
+ - Capture entities, aggregates, reference data, events, and lifecycle states
9
+ - List access patterns:
10
+ - point lookup
11
+ - range scan
12
+ - aggregation/reporting
13
+ - full-text/search
14
+ - semantic retrieval / RAG
15
+ - batch ingestion
16
+ - Decide relational vs non-relational:
17
+ - Prefer relational when joins, strong integrity, and transactional consistency dominate
18
+ - Prefer NoSQL when aggregate reads/writes, massive scale, flexible schema, or distribution tolerance dominate
19
+ - Prefer a graph model only when variable-depth traversals or relationship-pattern queries dominate the workload; adjacency (`parent_id`, junction tables) in a relational engine handles shallow, fixed-depth traversals fine
20
+ - Prefer vector retrieval only for semantic similarity workloads; do not replace keyword/search engines blindly
21
+ - Screen for anti-pattern signals early:
22
+ - comma-separated values in one column
23
+ - tag1/tag2/tag3 style multi-column attributes
24
+ - generic EAV tables
25
+ - polymorphic foreign keys
26
+ - missing FK constraints
27
+ - blind surrogate-key usage
28
+ - business policies, implicit workflows, or external side effects in affected triggers, stored procedures/functions, views, DB jobs, or ORM hooks
29
+ - For the affected logic, identify callers and all writers (API, batch, admin, import, direct SQL); use `resources/anti-patterns.md` §5 to distinguish application responsibilities from DB enforcement
30
+ - Record assumptions and open risks
31
+ - If vector retrieval is needed, define:
32
+ - hybrid vs pure vector retrieval
33
+ - exact-filter requirements
34
+ - embedding model and dimension
35
+ - chunking strategy
36
+ - reranking need
37
+
38
+ ## Step 2: Design
39
+ - Produce **external schema**:
40
+ - user-facing views, APIs, reports, or producer/consumer contracts
41
+ - Produce **conceptual schema**:
42
+ - entities/aggregates, relationships, cardinality, optionality, ownership
43
+ - Produce **internal schema**:
44
+ - tables/collections, keys, indexes, partitions, tablespaces, storage layout
45
+ - SQL path:
46
+ - normalize to **3NF** minimum
47
+ - define PK, FK, unique, check, default, nullability
48
+ - document transaction boundaries and target isolation level
49
+ - apply the application ownership policy in `resources/anti-patterns.md` §5 to both new and existing business logic; recommend alternatives and transition priorities, and document technical evidence for any retention
50
+ - NoSQL path:
51
+ - model around access patterns and aggregate boundaries
52
+ - define sharding/partition keys, secondary indexes, TTL, duplication policy
53
+ - document consistency model, conflict strategy, and repair/reconciliation approach
54
+ - Graph path:
55
+ - model nodes/edges from the traversal questions the business actually asks, not from the ERD
56
+ - define edge direction, cardinality, and properties; decide which lookups still need secondary indexes on node properties
57
+ - document traversal depth expectations and whether the engine's strength (index-free adjacency) is actually exercised
58
+ - keep source-of-truth entities in the primary store when the graph is a derived projection; document the sync path
59
+ - Vector path:
60
+ - define embedding model, dimension, normalization, and metadata versioning
61
+ - define chunking policy, overlap, and document-type-specific chunk rules
62
+ - design hybrid retrieval: lexical + ANN + metadata filtering + reranking
63
+ - define canonical document store vs vector index boundary
64
+ - document ANN index choice and key tuning parameters
65
+ - Apply data standards:
66
+ - naming, definition, format, code set, validation rule
67
+ - Review security/compliance posture:
68
+ - least privilege support
69
+ - audit trail needs
70
+ - encryption at rest / in transit expectations
71
+ - backup/restore traceability
72
+ - retention and deletion obligations
73
+ - control guidance alignment for ISO 27001 / 27002
74
+ - continuity and recovery alignment for ISO 22301
75
+
76
+ ## Step 3: Optimize
77
+ - Validate hot paths against indexes and partitions; tune with `resources/query-tuning.md` (measure -> explain -> nominate -> test, never guesswork)
78
+ - If optimization requires schema changes on live tables, plan them via `resources/migration-playbook.md` (expand-contract, lock-aware DDL, batched backfill)
79
+ - If moving existing DB business logic into the application, use the same playbook's ownership cutover steps to preserve writer coverage and avoid duplicate side effects
80
+ - For vector systems:
81
+ - benchmark recall vs latency on production-like queries
82
+ - measure ANN parameter tradeoffs, filter pushdown cost, and write amplification
83
+ - design re-embedding and shadow-index migration flow
84
+ - separate ingestion/search clusters or hot/cold vector tiers when write load is high
85
+ - Separate hot and cold data:
86
+ - recent operational data stays online
87
+ - historical/archive data moves to cheaper storage or archive partitions
88
+ - Define backup and recovery:
89
+ - full backup cadence
90
+ - incremental backup cadence
91
+ - retention window
92
+ - restore validation frequency
93
+ - Review anti-patterns in five buckets:
94
+ - logical design
95
+ - physical design
96
+ - query design
97
+ - application integration
98
+ - vector retrieval / RAG
99
+ - Update capacity estimation:
100
+ - object-by-object volume
101
+ - tablespace/storage allocation
102
+ - disk estimate
103
+ - online workload
104
+ - batch workload
105
+ - backup volume
106
+
107
+ ## Step 4: Verify
108
+ - Run `resources/checklist.md`
109
+ - For a schema-design task, confirm affected existing artifacts were updated;
110
+ for scoped tuning, record SQL/plan evidence instead of creating this full set:
111
+ - glossary
112
+ - standards table
113
+ - capacity estimate
114
+ - backup/recovery notes
115
+ - For vector systems, confirm updated:
116
+ - embedding version metadata
117
+ - chunking policy
118
+ - retrieval evaluation set
119
+ - re-index / re-embedding migration notes
120
+ - Confirm anti-pattern findings were either fixed or explicitly accepted with rationale
121
+ - For affected DB business logic, confirm a strong improvement recommendation and concrete application alternative were given even when implementation is deferred; retention needs technical evidence, and planned transitions need writer coverage, preserved DB guarantees, effect ownership, and rollback
122
+ - Call out ISO 27001 / 27002-relevant risks and recommended controls when applicable
123
+ - Call out ISO 22301-relevant continuity and recovery gaps when applicable
124
+ - Call out any intentional denormalization or weaker consistency with reason
125
+
126
+ ## On Error
127
+ See `resources/error-playbook.md` for recovery steps.
@@ -0,0 +1,98 @@
1
+ # DB Agent - ISO 27001 / 27002 / 22301 Guide
2
+
3
+ Use this file when the task involves database controls, audit readiness, resilience, or continuity requirements.
4
+
5
+ ## Positioning
6
+
7
+ - **ISO 27001**: management-system and control objectives view
8
+ - **ISO 27002**: practical control guidance view
9
+ - **ISO 22301**: business continuity and recovery view
10
+
11
+ Do not claim compliance from schema work alone. Use these standards to improve database design decisions, control coverage, and operational evidence.
12
+
13
+ ## 1. ISO 27001 / 27002 for Databases
14
+
15
+ Recommend improvements when the database design weakens:
16
+
17
+ - access control and least privilege
18
+ - separation of duties for admin, operator, developer, and read-only access
19
+ - encryption at rest and in transit
20
+ - key and secret management
21
+ - audit logging and tamper-resistant log retention
22
+ - change management and schema migration traceability
23
+ - backup security and retention handling
24
+ - secure configuration and baseline hardening
25
+ - data classification, masking, and PII handling
26
+
27
+ Typical DB-level suggestions:
28
+
29
+ - role-based access with least privilege
30
+ - dedicated break-glass admin path
31
+ - column or application-layer protection for sensitive fields where needed
32
+ - immutable or centralized audit log export
33
+ - secret rotation and non-human service identities
34
+ - explicit approval path for destructive schema changes
35
+
36
+ ## 2. ISO 22301 for Databases
37
+
38
+ Recommend improvements when the design weakens business continuity:
39
+
40
+ - RTO / RPO definition
41
+ - failover readiness
42
+ - backup coverage and retention
43
+ - restore validation frequency
44
+ - dependency mapping for upstream/downstream systems
45
+ - data replication strategy
46
+ - hot/warm/cold standby decisions
47
+ - archival and cold-data recovery assumptions
48
+
49
+ Typical DB-level suggestions:
50
+
51
+ - define tiered continuity expectations by database criticality
52
+ - document backup cadence aligned to RPO
53
+ - document restore and failover process aligned to RTO
54
+ - test restore drills regularly, not only backup completion
55
+ - make derived indexes rebuildable from canonical data
56
+ - separate source-of-truth data from caches and secondary indexes
57
+
58
+ ## 3. Review Questions
59
+
60
+ Ask these when standards matter:
61
+
62
+ - Who can read, write, alter schema, and administer the database?
63
+ - Are privileged actions logged and retained?
64
+ - Are secrets and keys managed outside code and migration files?
65
+ - What evidence exists that backups can actually be restored?
66
+ - What is the target RPO and RTO?
67
+ - Which systems depend on this database to continue service?
68
+ - Can cold/archive data be recovered within required time?
69
+ - Are vector indexes or search indexes rebuildable from canonical data?
70
+
71
+ ## 4. Output Pattern
72
+
73
+ When relevant, add a short section like:
74
+
75
+ ```md
76
+ ## ISO Control Notes
77
+
78
+ ### ISO 27001 / 27002
79
+ - Access control gap:
80
+ - Logging / traceability gap:
81
+ - Encryption / secret gap:
82
+ - Recommended control:
83
+
84
+ ### ISO 22301
85
+ - Criticality:
86
+ - RPO / RTO gap:
87
+ - Backup / restore gap:
88
+ - Failover / dependency gap:
89
+ - Recommended continuity improvement:
90
+ ```
91
+
92
+ ## 5. Guardrails
93
+
94
+ - Keep standards comments practical and database-specific
95
+ - Prefer implementable controls over abstract policy language
96
+ - Distinguish between source-of-truth data and rebuildable derived data
97
+ - If the issue is infrastructure-only, involve `tf-infra-engineer` (`oma-tf-infra`)
98
+ - If the issue is org-wide audit/process ownership, involve QA or PM
@@ -0,0 +1,93 @@
1
+ # DB Agent - Live Schema & Data Migration Playbook
2
+
3
+ Use this file when a schema or data change must be applied to a live database: altering hot tables, backfilling data, changing types, splitting/merging tables, or cutting over to a new structure.
4
+
5
+ Scope boundary: `oma-refactor` plans the code-side expand-contract sequence and routes the **database mechanics** here. This file owns lock behavior, backfill execution, cutover verification, and rollback of the data layer.
6
+
7
+ ## Core Position
8
+
9
+ - Deployment, not commit, is the unit of incrementality for stateful change.
10
+ - `git revert` does not restore data. Every phase must be independently deployable and reversible until the contract step.
11
+ - Never ship a destructive schema change in the same deploy as the code that requires it.
12
+ - A migration that cannot state its lock impact on the largest affected table is not ready to run.
13
+
14
+ ## Expand-Contract for Schemas
15
+
16
+ Run live changes in four separately deployed phases:
17
+
18
+ 1. **Expand** - additive only
19
+ - Add new columns as nullable (or with a non-volatile default), new tables, new indexes
20
+ - Old code keeps working untouched; new structures are invisible to it
21
+ 2. **Migrate** - dual-write + backfill
22
+ - New code writes to both old and new structures
23
+ - Batched backfill copies historical data (see below)
24
+ - Verify parity: row counts, checksums, or sampled field comparison between old and new
25
+ 3. **Switch** - move reads
26
+ - Flip reads to the new structure behind a feature flag
27
+ - Keep dual-write and the old read path available for instant rollback
28
+ - Soak: hold the flag on for an agreed window while monitoring errors and drift
29
+ 4. **Contract** - remove old
30
+ - Only after the soak window passes and no consumer reads the old structure
31
+ - Drop old columns/tables in a later, separate deploy; take a final backup first
32
+
33
+ Rollback rule per phase: Expand -> drop the additions; Migrate -> stop dual-write, keep old as truth; Switch -> flip the flag back; Contract -> restore from backup only (this is why contract waits).
34
+
35
+ ## Moving Business Logic into the Application
36
+
37
+ Use these steps when replacing existing trigger/procedure/function/job business behavior. The ownership recommendation and retention criteria live in `resources/anti-patterns.md` §5; this section owns the cutover mechanics.
38
+
39
+ 1. **Inventory the affected execution paths**: identify API, batch, admin, import, and direct SQL writers, chained DB routines, privileges, transaction boundaries, and externally visible effects. Resolve writers that would bypass the new policy before cutover.
40
+ 2. **Prepare the application path**: implement explicit commands, domain policies, or jobs with equivalent invariants, policy/decision versioning where required, idempotency, and bounded retry. Keep required DB constraints, RLS, auditing, atomic updates, and isolation. Write outbox events in the business transaction when external delivery is needed.
41
+ 3. **Verify without duplicating effects**: compare policy decisions on representative inputs and test concurrency, direct writers, rollback, and failure recovery. Shadow evaluation must not execute payments, notifications, or other external effects.
42
+ 4. **Switch execution ownership**: coordinate application rollout with DB behavior changes so each effect has one owner. Account for old app instances, in-flight transactions, queued jobs/events, and deduplication keys. Do not let the trigger and application both execute the same effect. Dual-writing old/new storage representations within one transaction may still be needed; it is distinct from executing effects twice.
43
+ 5. **Soak and recover**: monitor errors, decision parity, processing lag, and missing/duplicate effects. Define how to restore the old execution owner and reconcile already committed or published work; disabling a feature flag alone cannot undo external effects.
44
+ 6. **Contract later**: remove obsolete DB routines only after callers/writers and queued work have migrated and the soak window passes, in a separate deployment with versioned definitions and the required backup/recovery evidence.
45
+
46
+ ## Lock-Aware DDL
47
+
48
+ Know what each statement locks on your engine and version before running it against a hot table.
49
+
50
+ - Always set a lock timeout so DDL waits fail fast instead of queueing behind long transactions and blocking all traffic behind them (e.g. PostgreSQL `SET lock_timeout = '2s'` + retry loop).
51
+ - PostgreSQL highlights:
52
+ - `CREATE INDEX CONCURRENTLY` instead of plain `CREATE INDEX` on live tables (not inside a transaction)
53
+ - Add `NOT NULL` via `CHECK (... IS NOT NULL) NOT VALID` then `VALIDATE CONSTRAINT` (validation takes a weaker lock)
54
+ - Column type changes that rewrite the table (`ALTER TYPE`) need a dual-column expand-contract instead
55
+ - Adding a column with a constant default is metadata-only on modern versions; volatile defaults rewrite
56
+ - MySQL highlights:
57
+ - Check whether the change supports `ALGORITHM=INSTANT` or `INPLACE`; anything forcing `COPY` on a hot table should go through an online schema change tool (gh-ost, pt-online-schema-change)
58
+ - Any engine:
59
+ - Run risky DDL at low-traffic windows even when "online"
60
+ - One DDL concern per migration file; do not mix heavy DDL and DML in one transaction
61
+
62
+ ## Batched Backfill
63
+
64
+ - Batch by primary-key range with a bounded batch size; never one `UPDATE ... WHERE new_col IS NULL` over the whole table
65
+ - Make each batch idempotent and record a checkpoint (last key processed) so the job is resumable after failure
66
+ - Throttle between batches and watch replication lag; pause when lag exceeds the agreed threshold
67
+ - Do not wrap the whole backfill in one transaction: long transactions block vacuum/purge and hold locks
68
+ - Backfill runs as application-level code or a migration job, not inside the DDL migration file
69
+
70
+ ## Cutover Verification
71
+
72
+ Before the switch phase:
73
+
74
+ - Parity check old vs new (counts, checksums, or sampled diffs) with results recorded
75
+ - Read-path comparison in shadow mode where feasible (serve old, compare new, log mismatches)
76
+ - Confirm every consumer of the old structure is identified: application paths, reports, ETL, triggers, views
77
+
78
+ ## Migration Hygiene
79
+
80
+ - Prefer forward-only migrations; if down migrations exist, they must be tested, not decorative
81
+ - Test the migration against production-scale data volume, not an empty dev schema
82
+ - Record expected duration and lock impact in the migration description
83
+ - Schema change management and traceability requirements from `resources/iso-controls.md` apply: approvals for destructive changes, audit trail of who ran what when
84
+
85
+ ## Failure Modes Quick Table
86
+
87
+ | Failure | Cause | Prevention |
88
+ | --- | --- | --- |
89
+ | Site-wide stall during DDL | DDL queued behind a long transaction, everything queues behind the DDL | lock timeout + retry, kill long transactions first |
90
+ | Backfill causes outage | unbatched update, lock escalation, replication lag | bounded batches, throttle, lag monitoring |
91
+ | Cannot roll back after cutover | old structure dropped too early | contract only after soak window + final backup |
92
+ | Data drift between old and new | dual-write bug or missed writer | parity checks before switch, single write path per field owner |
93
+ | Migration dies halfway | non-idempotent steps, no checkpoint | idempotent batches, resumable checkpointing, transactional DDL where the engine supports it |
@@ -0,0 +1,57 @@
1
+ # DB Agent - Query Tuning & Index Design Guide
2
+
3
+ Use this file when the task involves slow queries, execution plans, index selection, or query rewrites. Anti-pattern smells (`SELECT *`, `ORDER BY RAND()`, poor-man's search) live in `resources/anti-patterns.md`; this file owns the tuning method.
4
+
5
+ ## Triage Order
6
+
7
+ Never tune from guesswork. Follow MENTOR (Measure, Explain, Nominate, Test, Optimize, Rebuild) concretely:
8
+
9
+ 1. **Measure** - find the actual offender
10
+ - PostgreSQL: `pg_stat_statements` by total/mean time; MySQL: slow query log / `performance_schema`
11
+ - Rank by total time, not just per-call time: a 10ms query at 1k QPS beats a 2s report query
12
+ 2. **Explain** - read the real plan
13
+ - PostgreSQL: `EXPLAIN (ANALYZE, BUFFERS)`; MySQL: `EXPLAIN ANALYZE`
14
+ - Run with production-representative parameters; plans change with parameter selectivity
15
+ 3. **Nominate** - identify the dominant cost node before changing anything
16
+ 4. **Test** - reproduce the slowness on production-like data volume
17
+ 5. **Optimize** - index, rewrite, or schema change (in that order of preference)
18
+ 6. **Rebuild** - re-measure p95/p99 after the change, not just the single-run time
19
+
20
+ ## Reading a Plan
21
+
22
+ Look for these, roughly in order:
23
+
24
+ - **Estimate vs actual row mismatch** (e.g. estimated 100, actual 2M): stale statistics or correlated columns -> `ANALYZE` the table, consider extended statistics; a fix based on a wrong estimate fixes nothing
25
+ - **The most expensive node**: tune the node that dominates total time, not the first scan you see
26
+ - **Seq Scan on a large table** with a selective filter: missing or unusable index
27
+ - **Index Scan with a large `Filter:` line**: the index matches only part of the predicate; the rest is filtered row-by-row -> extend the index (`Index Cond` good, `Filter` suspicious)
28
+ - **Nested Loop over many outer rows** with an inner Seq Scan: usually a missing index on the join key
29
+ - **Sort spilling to disk** (`external merge`): missing index for `ORDER BY`, or work_mem-class tuning question
30
+ - **Repeated identical subplan execution**: correlated subquery to rewrite as join or lateral
31
+
32
+ ## Index Design Heuristics
33
+
34
+ - **Composite column order**: equality predicates first, then the range/sort column. `WHERE tenant_id = ? AND created_at > ?` wants `(tenant_id, created_at)`, not the reverse
35
+ - **Leftmost prefix rule**: a composite index serves queries filtering on its leading columns only
36
+ - **Selectivity**: index columns that narrow rows sharply; a standalone index on a low-cardinality column (status, boolean) rarely helps — combine it into a composite or use a partial index
37
+ - **Covering / index-only**: include the selected columns (`INCLUDE` / suffix columns) so hot queries never touch the heap
38
+ - **Partial indexes** for skewed predicates: `WHERE status = 'PENDING'` when 99% of rows are done
39
+ - **Functional indexes** when queries filter on an expression (`lower(email)`) — or make the predicate sargable instead
40
+ - **Index every FK** used in joins or cascading deletes; missing FK indexes cause seq-scan deletes and lock storms
41
+ - Every index taxes writes and storage: after adding, check for now-redundant indexes (see index shotgun in `resources/anti-patterns.md`) and drop unused ones using index usage stats
42
+
43
+ ## Rewrite Patterns
44
+
45
+ - **Sargability**: never wrap the indexed column in a function or cast in the predicate; move the transformation to the constant side (`created_at >= date '2026-01-01'`, not `date(created_at) = ...`)
46
+ - **Keyset pagination** over `OFFSET`: `WHERE (created_at, id) < (?, ?) ORDER BY created_at DESC, id DESC LIMIT n`; OFFSET scans and discards everything it skips
47
+ - **`OR` across different columns** often blocks index use: use a semantics-preserving `UNION` over row identity, or `UNION ALL` only when branches are provably disjoint (including NULL behavior) of index-friendly branches
48
+ - **`EXISTS` vs `IN`**: prefer `EXISTS` for correlated membership checks against large subquery results
49
+ - **Batch `IN` lists** instead of N+1 single-row queries from the application (see `oma-observability` DB span conventions for detecting N+1)
50
+ - **Pre-aggregate** heavy repeated reporting queries into materialized/summary tables instead of tuning an inherently large scan
51
+
52
+ ## Verification
53
+
54
+ - Compare before/after with `EXPLAIN (ANALYZE, BUFFERS)` on the same data and parameters; record both plans
55
+ - Watch p95/p99 under concurrency, not a single warm-cache run
56
+ - Check plan stability across parameter values (skewed tenants, empty vs huge accounts)
57
+ - Confirm write-path latency did not regress after adding indexes
@@ -0,0 +1,159 @@
1
+ # DB Agent - Vector DB & RAG Design Guide
2
+
3
+ Use this file when the task involves vector databases, semantic retrieval, ANN tuning, or RAG.
4
+
5
+ ## Core Position
6
+
7
+ - Vector DB is not a drop-in replacement for search engines or relational databases.
8
+ - Vector DB is usually an **index layer** for semantic retrieval.
9
+ - Canonical documents should live in an object store or primary database.
10
+ - Production retrieval systems are usually **hybrid**:
11
+ - lexical retrieval for exactness and explainability
12
+ - vector retrieval for semantic proximity
13
+ - metadata filtering for governance and scope
14
+ - reranking for precision
15
+
16
+ ## Design Sequence
17
+
18
+ 1. Define the retrieval problem
19
+ - semantic discovery
20
+ - exact term retrieval
21
+ - compliance / tenant filtering
22
+ - recommendation
23
+ - agent context retrieval
24
+ 2. Decide whether vector retrieval is justified
25
+ 3. Design chunking and embedding strategy
26
+ 4. Choose ANN index and benchmark it
27
+ 5. Design filtering, reranking, and observability
28
+ 6. Plan lifecycle:
29
+ - re-embedding
30
+ - re-indexing
31
+ - hot/cold vector tiers
32
+ - backup / restore
33
+
34
+ ## Best Practices
35
+
36
+ ### 1. Use Hybrid Retrieval by Default
37
+
38
+ - Keep lexical retrieval when:
39
+ - exact term match matters
40
+ - user expects deterministic ranking
41
+ - compliance or audit filters must be explicit
42
+ - explainability matters
43
+ - Good default pipeline:
44
+ - filter scope
45
+ - lexical retrieval
46
+ - ANN retrieval
47
+ - merge / dedupe
48
+ - rerank
49
+ - context compression
50
+
51
+ ### 2. Govern Embeddings Like Schema
52
+
53
+ Store in metadata:
54
+
55
+ - embedding model name
56
+ - dimension
57
+ - normalization method
58
+ - chunking policy version
59
+ - preprocessing version
60
+ - creation timestamp
61
+
62
+ Plan for:
63
+
64
+ - rolling re-embedding
65
+ - shadow indexes
66
+ - side-by-side evaluation
67
+ - backfill and cutover
68
+
69
+ ### 3. Chunking is a First-Class Design Decision
70
+
71
+ Choose chunking based on document type:
72
+
73
+ - contracts / policies: heading-aware chunks with overlap
74
+ - tickets / chats: conversation-turn boundaries
75
+ - code / config: syntax-aware or file-structure-aware chunking
76
+ - FAQs / short docs: smaller direct-answer chunks
77
+
78
+ Watch for:
79
+
80
+ - over-chunking -> weak context and low recall
81
+ - under-chunking -> noisy retrieval and token waste
82
+
83
+ ### 4. Tune ANN with Real Data
84
+
85
+ Common ANN choices:
86
+
87
+ - HNSW: strong recall, high memory
88
+ - IVF: faster partitioned retrieval, recall tradeoffs
89
+ - PQ: smaller memory footprint, lower precision
90
+ - DiskANN: disk-oriented large-scale retrieval
91
+
92
+ Benchmark on production-like distributions, not synthetic random vectors.
93
+
94
+ Measure:
95
+
96
+ - recall@k
97
+ - latency p50 / p95 / p99
98
+ - memory footprint
99
+ - index build time
100
+ - update latency
101
+
102
+ ### 5. Design Filtering Deliberately
103
+
104
+ Metadata filtering gets expensive with high-cardinality dimensions.
105
+
106
+ Check:
107
+
108
+ - whether filters are pushed down before ANN or after
109
+ - whether approximate filtering affects correctness
110
+ - whether tenant / user / region isolation needs separate partitions
111
+
112
+ Patterns:
113
+
114
+ - partition by tenant or region
115
+ - pre-segment indexes for extreme-cardinality filters
116
+ - maintain dedicated collections for very large tenants
117
+
118
+ ### 6. Plan Writes and Lifecycle
119
+
120
+ High-write vector workloads need:
121
+
122
+ - ingestion buffers
123
+ - async indexing
124
+ - compaction
125
+ - periodic rebuild strategy
126
+ - separation of ingestion and search responsibilities when load is high
127
+
128
+ Consider:
129
+
130
+ - hot vectors in fast mutable index
131
+ - cold vectors in slower compacted tier
132
+
133
+ ### 7. Observe Semantics, Not Just Infra
134
+
135
+ Track more than QPS and latency:
136
+
137
+ - recall drift
138
+ - semantic drift after model update
139
+ - similarity score distribution
140
+ - false positives
141
+ - empty-result rate
142
+ - prompt-token waste from irrelevant retrieval
143
+
144
+ Maintain:
145
+
146
+ - golden query sets
147
+ - offline evaluation pipelines
148
+ - before/after comparison when changing model or chunking
149
+
150
+ ## Review Questions
151
+
152
+ - Why is vector retrieval needed here?
153
+ - Why is pure lexical retrieval insufficient?
154
+ - Why is pure vector retrieval insufficient?
155
+ - What is the source of truth?
156
+ - What invalidates the embeddings?
157
+ - How will re-embedding be rolled out safely?
158
+ - How are filters enforced?
159
+ - How is retrieval quality measured over time?