@webex/plugin-meetings 3.12.0-next.15 → 3.12.0-next.150

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 (296) hide show
  1. package/.sdd/manifest.json +1312 -0
  2. package/.sdd/templates/.source.json +30 -0
  3. package/.sdd/templates/component-repo/module-docs/module-spec-quality.md +111 -0
  4. package/.sdd/templates/component-repo/module-docs/module-spec.template.md +321 -0
  5. package/.sdd/templates/component-repo/reference-docs/adr/_adr-example.md +59 -0
  6. package/.sdd/templates/component-repo/reference-docs/patterns/_pattern-example.md +49 -0
  7. package/.sdd/templates/component-repo/reference-docs/rules/_rule-example.md +42 -0
  8. package/.sdd/templates/component-repo/standing-docs/AGENTS.template.md +120 -0
  9. package/.sdd/templates/component-repo/standing-docs/ARCHITECTURE.template.md +206 -0
  10. package/.sdd/templates/component-repo/standing-docs/CONTRACTS.template.md +90 -0
  11. package/.sdd/templates/component-repo/standing-docs/DATA_MODEL.template.md +68 -0
  12. package/.sdd/templates/component-repo/standing-docs/GETTING_STARTED.template.md +111 -0
  13. package/.sdd/templates/component-repo/standing-docs/GLOSSARY.template.md +57 -0
  14. package/.sdd/templates/component-repo/standing-docs/REVIEW_CHECKLIST.template.md +69 -0
  15. package/.sdd/templates/component-repo/standing-docs/RULES.template.md +96 -0
  16. package/.sdd/templates/component-repo/standing-docs/SECURITY.template.md +84 -0
  17. package/.sdd/templates/component-repo/standing-docs/SERVICE_STATE.template.md +82 -0
  18. package/.sdd/templates/component-repo/standing-docs/SPEC_INDEX.template.md +94 -0
  19. package/.sdd/templates/component-repo/standing-docs/TEST_INDEX.template.md +64 -0
  20. package/.sdd/templates/component-repo/template-map.json +112 -0
  21. package/AGENTS.md +135 -0
  22. package/ai-docs/ARCHITECTURE.md +207 -0
  23. package/ai-docs/CONTRACTS.md +267 -0
  24. package/ai-docs/DATA_MODEL.md +64 -0
  25. package/ai-docs/GETTING_STARTED.md +73 -0
  26. package/ai-docs/GLOSSARY.md +56 -0
  27. package/ai-docs/REVIEW_CHECKLIST.md +45 -0
  28. package/ai-docs/RULES.md +79 -0
  29. package/ai-docs/SECURITY.md +74 -0
  30. package/ai-docs/SERVICE_STATE.md +59 -0
  31. package/ai-docs/SPEC_INDEX.md +85 -0
  32. package/ai-docs/TEST_INDEX.md +45 -0
  33. package/ai-docs/adr/0001-migrate-existing-docs-into-sdd.md +61 -0
  34. package/ai-docs/patterns/defensive-error-propagation.md +55 -0
  35. package/ai-docs/patterns/event-scope-emission.md +46 -0
  36. package/ai-docs/patterns/source-to-test-path-mirroring.md +45 -0
  37. package/ai-docs/patterns/stateless-plugin-request-classes.md +53 -0
  38. package/ai-docs/patterns/typed-constants-and-enum-values.md +47 -0
  39. package/dist/aiEnableRequest/index.js +15 -2
  40. package/dist/aiEnableRequest/index.js.map +1 -1
  41. package/dist/annotation/index.js +2 -2
  42. package/dist/annotation/index.js.map +1 -1
  43. package/dist/breakouts/breakout.js +8 -3
  44. package/dist/breakouts/breakout.js.map +1 -1
  45. package/dist/breakouts/events.js +29 -14
  46. package/dist/breakouts/events.js.map +1 -1
  47. package/dist/breakouts/index.js +99 -4
  48. package/dist/breakouts/index.js.map +1 -1
  49. package/dist/common/errors/webex-errors.js +49 -5
  50. package/dist/common/errors/webex-errors.js.map +1 -1
  51. package/dist/config.js +2 -2
  52. package/dist/config.js.map +1 -1
  53. package/dist/constants.js +37 -10
  54. package/dist/constants.js.map +1 -1
  55. package/dist/controls-options-manager/index.js +46 -10
  56. package/dist/controls-options-manager/index.js.map +1 -1
  57. package/dist/hashTree/constants.js +4 -1
  58. package/dist/hashTree/constants.js.map +1 -1
  59. package/dist/hashTree/hashTreeParser.js +1096 -391
  60. package/dist/hashTree/hashTreeParser.js.map +1 -1
  61. package/dist/hashTree/utils.js +20 -0
  62. package/dist/hashTree/utils.js.map +1 -1
  63. package/dist/index.js +7 -0
  64. package/dist/index.js.map +1 -1
  65. package/dist/interceptors/dataChannelAuthToken.js +75 -15
  66. package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
  67. package/dist/interceptors/locusRetry.js +23 -8
  68. package/dist/interceptors/locusRetry.js.map +1 -1
  69. package/dist/interpretation/index.js +55 -12
  70. package/dist/interpretation/index.js.map +1 -1
  71. package/dist/interpretation/interpretation.types.js +7 -0
  72. package/dist/interpretation/interpretation.types.js.map +1 -0
  73. package/dist/interpretation/siLanguage.js +1 -1
  74. package/dist/locus-info/controlsUtils.js +4 -1
  75. package/dist/locus-info/controlsUtils.js.map +1 -1
  76. package/dist/locus-info/index.js +615 -176
  77. package/dist/locus-info/index.js.map +1 -1
  78. package/dist/locus-info/infoUtils.js +36 -5
  79. package/dist/locus-info/infoUtils.js.map +1 -1
  80. package/dist/locus-info/types.js +20 -0
  81. package/dist/locus-info/types.js.map +1 -1
  82. package/dist/media/MediaConnectionAwaiter.js +15 -2
  83. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  84. package/dist/media/index.js +8 -2
  85. package/dist/media/index.js.map +1 -1
  86. package/dist/media/properties.js +4 -5
  87. package/dist/media/properties.js.map +1 -1
  88. package/dist/meeting/in-meeting-actions.js +7 -1
  89. package/dist/meeting/in-meeting-actions.js.map +1 -1
  90. package/dist/meeting/index.js +1684 -835
  91. package/dist/meeting/index.js.map +1 -1
  92. package/dist/meeting/locusMediaRequest.js +229 -82
  93. package/dist/meeting/locusMediaRequest.js.map +1 -1
  94. package/dist/meeting/muteState.js +10 -1
  95. package/dist/meeting/muteState.js.map +1 -1
  96. package/dist/meeting/request.js +5 -2
  97. package/dist/meeting/request.js.map +1 -1
  98. package/dist/meeting/util.js +37 -3
  99. package/dist/meeting/util.js.map +1 -1
  100. package/dist/meeting/voicea-meeting.js +2 -1
  101. package/dist/meeting/voicea-meeting.js.map +1 -1
  102. package/dist/meeting-info/meeting-info-v2.js +9 -3
  103. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  104. package/dist/meetings/index.js +300 -128
  105. package/dist/meetings/index.js.map +1 -1
  106. package/dist/meetings/meetings.types.js +6 -1
  107. package/dist/meetings/meetings.types.js.map +1 -1
  108. package/dist/meetings/request.js +39 -0
  109. package/dist/meetings/request.js.map +1 -1
  110. package/dist/meetings/util.js +116 -18
  111. package/dist/meetings/util.js.map +1 -1
  112. package/dist/member/index.js +10 -0
  113. package/dist/member/index.js.map +1 -1
  114. package/dist/member/types.js.map +1 -1
  115. package/dist/member/util.js +30 -0
  116. package/dist/member/util.js.map +1 -1
  117. package/dist/members/index.js +101 -43
  118. package/dist/members/index.js.map +1 -1
  119. package/dist/members/util.js +8 -1
  120. package/dist/members/util.js.map +1 -1
  121. package/dist/metrics/constants.js +7 -1
  122. package/dist/metrics/constants.js.map +1 -1
  123. package/dist/multistream/codec/constants.js +63 -0
  124. package/dist/multistream/codec/constants.js.map +1 -0
  125. package/dist/multistream/mediaRequestManager.js +62 -15
  126. package/dist/multistream/mediaRequestManager.js.map +1 -1
  127. package/dist/multistream/receiveSlot.js +9 -0
  128. package/dist/multistream/receiveSlot.js.map +1 -1
  129. package/dist/reachability/clusterReachability.js.map +1 -1
  130. package/dist/reachability/index.js +121 -83
  131. package/dist/reachability/index.js.map +1 -1
  132. package/dist/reachability/reachability.types.js +2 -0
  133. package/dist/reachability/reachability.types.js.map +1 -1
  134. package/dist/reachability/util.js +45 -0
  135. package/dist/reachability/util.js.map +1 -1
  136. package/dist/reactions/reactions.type.js.map +1 -1
  137. package/dist/recording-controller/index.js +1 -3
  138. package/dist/recording-controller/index.js.map +1 -1
  139. package/dist/roap/turnDiscovery.js +8 -1
  140. package/dist/roap/turnDiscovery.js.map +1 -1
  141. package/dist/types/common/errors/webex-errors.d.ts +32 -2
  142. package/dist/types/config.d.ts +2 -2
  143. package/dist/types/constants.d.ts +13 -1
  144. package/dist/types/controls-options-manager/index.d.ts +16 -0
  145. package/dist/types/hashTree/constants.d.ts +1 -0
  146. package/dist/types/hashTree/hashTreeParser.d.ts +201 -22
  147. package/dist/types/hashTree/utils.d.ts +7 -0
  148. package/dist/types/index.d.ts +3 -0
  149. package/dist/types/interceptors/locusRetry.d.ts +4 -4
  150. package/dist/types/interpretation/interpretation.types.d.ts +10 -0
  151. package/dist/types/locus-info/index.d.ts +106 -8
  152. package/dist/types/locus-info/infoUtils.d.ts +8 -0
  153. package/dist/types/locus-info/types.d.ts +22 -1
  154. package/dist/types/media/MediaConnectionAwaiter.d.ts +10 -1
  155. package/dist/types/media/properties.d.ts +6 -2
  156. package/dist/types/meeting/in-meeting-actions.d.ts +6 -0
  157. package/dist/types/meeting/index.d.ts +176 -11
  158. package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
  159. package/dist/types/meeting/request.d.ts +1 -0
  160. package/dist/types/meeting/util.d.ts +9 -0
  161. package/dist/types/meeting-info/meeting-info-v2.d.ts +1 -0
  162. package/dist/types/meetings/index.d.ts +40 -19
  163. package/dist/types/meetings/meetings.types.d.ts +15 -0
  164. package/dist/types/meetings/request.d.ts +14 -0
  165. package/dist/types/member/index.d.ts +1 -0
  166. package/dist/types/member/types.d.ts +1 -0
  167. package/dist/types/member/util.d.ts +9 -0
  168. package/dist/types/members/index.d.ts +15 -2
  169. package/dist/types/members/util.d.ts +1 -5
  170. package/dist/types/metrics/constants.d.ts +6 -0
  171. package/dist/types/multistream/codec/constants.d.ts +7 -0
  172. package/dist/types/multistream/mediaRequestManager.d.ts +22 -5
  173. package/dist/types/reachability/clusterReachability.d.ts +3 -3
  174. package/dist/types/reachability/index.d.ts +10 -3
  175. package/dist/types/reachability/reachability.types.d.ts +7 -0
  176. package/dist/types/reachability/util.d.ts +17 -0
  177. package/dist/types/reactions/reactions.type.d.ts +3 -0
  178. package/dist/webinar/index.js +307 -161
  179. package/dist/webinar/index.js.map +1 -1
  180. package/package.json +23 -23
  181. package/src/aiEnableRequest/ai-docs/ai-enable-request-spec.md +223 -0
  182. package/src/aiEnableRequest/index.ts +16 -0
  183. package/src/annotation/ai-docs/annotation-spec.md +236 -0
  184. package/src/annotation/index.ts +6 -4
  185. package/src/breakouts/ai-docs/breakouts-spec.md +324 -0
  186. package/src/breakouts/breakout.ts +3 -1
  187. package/src/breakouts/events.ts +33 -11
  188. package/src/breakouts/index.ts +122 -2
  189. package/src/common/errors/webex-errors.ts +50 -3
  190. package/src/config.ts +2 -2
  191. package/src/constants.ts +21 -3
  192. package/src/controls-options-manager/ai-docs/controls-options-manager-spec.md +243 -0
  193. package/src/controls-options-manager/index.ts +62 -10
  194. package/src/hashTree/ai-docs/hash-tree-spec.md +267 -0
  195. package/src/hashTree/constants.ts +7 -0
  196. package/src/hashTree/hashTreeParser.ts +861 -193
  197. package/src/hashTree/utils.ts +19 -0
  198. package/src/index.ts +6 -0
  199. package/src/interceptors/ai-docs/interceptors-spec.md +247 -0
  200. package/src/interceptors/dataChannelAuthToken.ts +88 -12
  201. package/src/interceptors/locusRetry.ts +25 -4
  202. package/src/interpretation/ai-docs/interpretation-spec.md +256 -0
  203. package/src/interpretation/index.ts +65 -10
  204. package/src/interpretation/interpretation.types.ts +11 -0
  205. package/src/locus-info/ai-docs/locus-info-spec.md +293 -0
  206. package/src/locus-info/controlsUtils.ts +3 -1
  207. package/src/locus-info/index.ts +566 -164
  208. package/src/locus-info/infoUtils.ts +41 -6
  209. package/src/locus-info/types.ts +26 -1
  210. package/src/media/MediaConnectionAwaiter.ts +21 -4
  211. package/src/media/ai-docs/media-spec.md +267 -0
  212. package/src/media/index.ts +10 -1
  213. package/src/media/properties.ts +8 -3
  214. package/src/meeting/ai-docs/meeting-spec.md +401 -0
  215. package/src/meeting/in-meeting-actions.ts +12 -0
  216. package/src/meeting/index.ts +937 -119
  217. package/src/meeting/locusMediaRequest.ts +106 -6
  218. package/src/meeting/muteState.ts +10 -1
  219. package/src/meeting/request.ts +11 -0
  220. package/src/meeting/util.ts +51 -7
  221. package/src/meeting/voicea-meeting.ts +1 -1
  222. package/src/meeting-info/ai-docs/meeting-info-spec.md +261 -0
  223. package/src/meeting-info/meeting-info-v2.ts +10 -4
  224. package/src/meetings/ai-docs/meetings-spec.md +296 -0
  225. package/src/meetings/index.ts +200 -80
  226. package/src/meetings/meetings.types.ts +19 -0
  227. package/src/meetings/request.ts +43 -0
  228. package/src/meetings/util.ts +117 -4
  229. package/src/member/ai-docs/member-spec.md +196 -0
  230. package/src/member/index.ts +10 -0
  231. package/src/member/types.ts +1 -0
  232. package/src/member/util.ts +29 -0
  233. package/src/members/ai-docs/members-spec.md +256 -0
  234. package/src/members/index.ts +70 -7
  235. package/src/members/util.ts +12 -4
  236. package/src/metrics/ai-docs/metrics-spec.md +185 -0
  237. package/src/metrics/constants.ts +6 -0
  238. package/src/multistream/ai-docs/multistream-spec.md +292 -0
  239. package/src/multistream/codec/constants.ts +58 -0
  240. package/src/multistream/mediaRequestManager.ts +119 -28
  241. package/src/multistream/receiveSlot.ts +18 -0
  242. package/src/personal-meeting-room/ai-docs/personal-meeting-room-spec.md +234 -0
  243. package/src/reachability/ai-docs/reachability-spec.md +261 -0
  244. package/src/reachability/clusterReachability.ts +3 -2
  245. package/src/reachability/index.ts +47 -16
  246. package/src/reachability/reachability.types.ts +11 -0
  247. package/src/reachability/util.ts +36 -0
  248. package/src/reactions/ai-docs/reactions-spec.md +198 -0
  249. package/src/reactions/reactions.type.ts +3 -0
  250. package/src/reconnection-manager/ai-docs/reconnection-manager-spec.md +272 -0
  251. package/src/recording-controller/ai-docs/recording-controller-spec.md +223 -0
  252. package/src/recording-controller/index.ts +1 -2
  253. package/src/roap/ai-docs/roap-spec.md +241 -0
  254. package/src/roap/turnDiscovery.ts +9 -1
  255. package/src/webinar/ai-docs/webinar-spec.md +243 -0
  256. package/src/webinar/index.ts +216 -38
  257. package/test/unit/spec/aiEnableRequest/index.ts +86 -0
  258. package/test/unit/spec/annotation/index.ts +3 -3
  259. package/test/unit/spec/breakouts/breakout.ts +9 -3
  260. package/test/unit/spec/breakouts/events.ts +120 -2
  261. package/test/unit/spec/breakouts/index.ts +223 -3
  262. package/test/unit/spec/common/errors/webex-errors.ts +78 -0
  263. package/test/unit/spec/controls-options-manager/index.js +139 -32
  264. package/test/unit/spec/hashTree/hashTreeParser.ts +2451 -184
  265. package/test/unit/spec/hashTree/utils.ts +37 -0
  266. package/test/unit/spec/interceptors/dataChannelAuthToken.ts +196 -0
  267. package/test/unit/spec/interceptors/locusRetry.ts +205 -4
  268. package/test/unit/spec/interpretation/index.ts +119 -4
  269. package/test/unit/spec/locus-info/controlsUtils.js +172 -57
  270. package/test/unit/spec/locus-info/index.js +1014 -58
  271. package/test/unit/spec/locus-info/infoUtils.js +184 -1
  272. package/test/unit/spec/media/MediaConnectionAwaiter.ts +55 -0
  273. package/test/unit/spec/media/index.ts +92 -0
  274. package/test/unit/spec/media/properties.ts +23 -23
  275. package/test/unit/spec/meeting/in-meeting-actions.ts +6 -0
  276. package/test/unit/spec/meeting/index.js +2811 -117
  277. package/test/unit/spec/meeting/locusMediaRequest.ts +406 -4
  278. package/test/unit/spec/meeting/muteState.js +81 -0
  279. package/test/unit/spec/meeting/request.js +12 -0
  280. package/test/unit/spec/meeting/utils.js +179 -16
  281. package/test/unit/spec/meeting/voicea-meeting.ts +85 -1
  282. package/test/unit/spec/meeting-info/meetinginfov2.js +76 -10
  283. package/test/unit/spec/meetings/index.js +544 -49
  284. package/test/unit/spec/meetings/request.js +141 -0
  285. package/test/unit/spec/meetings/utils.js +402 -51
  286. package/test/unit/spec/member/index.js +7 -0
  287. package/test/unit/spec/member/util.js +89 -0
  288. package/test/unit/spec/members/index.js +216 -0
  289. package/test/unit/spec/members/request.js +37 -1
  290. package/test/unit/spec/members/utils.js +63 -0
  291. package/test/unit/spec/multistream/mediaRequestManager.ts +501 -37
  292. package/test/unit/spec/reachability/index.ts +128 -46
  293. package/test/unit/spec/reachability/util.ts +31 -0
  294. package/test/unit/spec/recording-controller/index.js +9 -8
  295. package/test/unit/spec/roap/turnDiscovery.ts +20 -0
  296. package/test/unit/spec/webinar/index.ts +332 -31
@@ -0,0 +1,30 @@
1
+ {
2
+ "schema_version": 2,
3
+ "note": "Provenance for the template content this bundle carries. The sdd-legacy profile is frozen in templates/component-repo. As a temporary promotion safeguard, repo-standards bundles only the 17 upstream files its resolver consumes under templates/repo-standards-upstream; config/template-normalization.json remains authoritative for that profile's pin and the snapshot's own .source.json records its checksums. The top-level source_repo/source_branch/source_commit/library_version keys are the sdd-legacy pin and stay the single place it is recorded.",
4
+ "source_repo": "WebexDevPlatform/RepoAnnotation-Templates",
5
+ "source_branch": "main",
6
+ "source_commit": "0aa65d93f019e5313ec2ddfac9b0c7352a2882cc",
7
+ "library_version": "0.2.2",
8
+ "synced_at": "2026-07-31",
9
+ "profiles": {
10
+ "sdd-legacy": {
11
+ "kind": "vendored",
12
+ "root": "templates/component-repo",
13
+ "source_host": "sqbu-github.cisco.com",
14
+ "pin_recorded_in": "this file's top-level source_repo/source_branch/source_commit keys",
15
+ "frozen": true,
16
+ "frozen_reason": "RepoAnnotation-Templates moved to WebexTools/repo-standards, where the same document model was normalized. This profile stays pinned to the last reviewed commit of the old home so repositories already generated against it keep validating unchanged. The vendored tree is byte-identical to the commit the top-level keys name; nothing generated is written into it. New pins land on the repo-standards profile."
17
+ },
18
+ "repo-standards": {
19
+ "kind": "bundled-upstream",
20
+ "root": "templates/repo-standards-upstream",
21
+ "source_repo": "WebexTools/repo-standards",
22
+ "source_host": "github.com",
23
+ "pin_recorded_in": "config/template-normalization.json",
24
+ "snapshot_provenance": "templates/repo-standards-upstream/.source.json",
25
+ "resolved_by": "scripts/resolve_templates.py",
26
+ "stored_content": "17 resolver-required upstream files",
27
+ "stored_content_reason": "Temporary packaging and promotion safeguard: setup must work without network or private-repository credentials. The resolver rejects missing, extra, or checksum-mismatched files. This is not a copy of the complete repo-standards templates tree."
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,111 @@
1
+ # Detailed Module Spec Standard
2
+
3
+ Use this standard with `module-spec.template.md` when generating or manually writing
4
+ `<module-path>/ai-docs/<module-name>-spec.md`. It applies whether a team uses an automated generator
5
+ or its own manual process.
6
+
7
+ ## Required Shape
8
+
9
+ A module spec is the canonical module document. It combines orientation, requirements, design,
10
+ behavior flows, contracts, edge cases, and module tests in one source-local file.
11
+
12
+ Every generated module spec keeps these universal sections:
13
+
14
+ - `Metadata`
15
+ - `Evidence Rules`
16
+ - `Source Material Register`
17
+ - `Overview`
18
+ - `Purpose / Responsibility`
19
+ - `Stack`
20
+ - `Folder / Package Structure`
21
+ - `Key Files (source of truth)`
22
+ - `Public Surface`
23
+ - `Requires (dependencies)`
24
+ - `Requirements`
25
+ - `Design Overview`
26
+ - `Data Flow`
27
+ - `Sequence Diagram(s)`
28
+ - `Class / Component Relationships`
29
+ - `Use Cases`
30
+ - `Pitfalls`
31
+ - `Test-Case Strategy (module)`
32
+ - `Traceability`
33
+
34
+ Conditional sections are kept only when they apply to the module. When kept, they are filled with the
35
+ same level of evidence as the universal sections.
36
+
37
+ Rendered sections follow the template order: identity/provenance, orientation, public boundary,
38
+ requirements, implementation design and flows, applicable state/data/protocol details, maintenance
39
+ edges, tests, and traceability. Reordering generated sections makes the spec harder to scan and should
40
+ be corrected before validation.
41
+
42
+ The rendered `Metadata` table includes: `Module id`, `Source path(s)`, `Doc kind`,
43
+ `Coverage score`, `Generated from`, `generated_by / approved_by / updated_at`, and
44
+ `Validation status`.
45
+
46
+ `Coverage score` is always present. Before measurement it is `Pending coverage assessment`; after
47
+ measurement it is the numeric percentage plus assessment date and short evidence summary. `Coverage
48
+ score` and `Validation status` must not cite `.generated/` run-record paths or other local generated
49
+ report paths.
50
+
51
+ ## Detail Expectations
52
+
53
+ The spec should be context-efficient and complete. A future agent should be able to read the module
54
+ spec and understand the module enough to make a safe change without rediscovering the core behavior
55
+ from scratch.
56
+
57
+ - `Overview` and `Design Overview` explain ownership, internal structure, and rationale.
58
+ - `Requirements` capture observable behavior and compatibility promises with WHAT, WHY, evidence,
59
+ tests/examples, gaps, and confidence.
60
+ - `Data Flow` names the exact transport or call style and includes a Mermaid diagram for non-trivial
61
+ modules.
62
+ - `Sequence Diagram(s)` start with a sequence inventory or coverage note. The number of diagrams is
63
+ based on major operation groups from public surfaces, use cases, events, commands, state transitions,
64
+ and async jobs. One diagram can cover multiple operations only when actors, ordering, transport,
65
+ state transition, and failure behavior are the same. A single diagram is acceptable only for a
66
+ one-operation or trivial pass-through/composition module. Include relevant error, timeout, retry,
67
+ rollback, rejected, and recovery paths.
68
+ - `Class / Component Relationships` show main objects/components and how they relate; a file list is
69
+ not enough.
70
+ - `Use Cases` are concrete actor -> steps -> outcome flows with evidence.
71
+ - `Pitfalls` capture module-specific failure modes, sharp edges, and must-not-break behavior.
72
+ - `Test-Case Strategy (module)` maps behaviors/requirements to existing tests and gaps.
73
+ - Native contract sources such as OpenAPI, AsyncAPI, proto, GraphQL, JSON Schema, SDK API reports,
74
+ typedoc, or package entry points are linked as exact detail sources. The module spec summarizes and
75
+ routes to them instead of pasting full schemas.
76
+
77
+ Use `N/A` only when the code proves the concern cannot apply, and include the evidence path or reason.
78
+
79
+ ## Existing Docs
80
+
81
+ When a repo already has module overview, architecture, HLD, LLD, API, or test notes, use them as
82
+ source material instead of discarding their detail. Record exact prior doc paths in
83
+ `.sdd/manifest.json` and local source-fidelity run records; the committed module spec's
84
+ `Source Material Register` summarizes source basis by category and disposition, not by old
85
+ non-canonical file names:
86
+
87
+ - orientation content maps to `Overview`, `Purpose / Responsibility`, `Stack`,
88
+ `Folder / Package Structure`, and `Key Files`;
89
+ - architecture content maps to `Design Overview`, `Data Flow`, `Sequence Diagram(s)`,
90
+ `Class / Component Relationships`, conditional design sections, and `Pitfalls`;
91
+ - API/contract content maps to `Public Surface`, the root contract index, and linked schema/API
92
+ sources;
93
+ - behavior and test content maps to `Requirements`, `Use Cases`, and `Test-Case Strategy (module)`.
94
+
95
+ If code evidence disproves older content, mark the conflict and do not present the old statement as
96
+ current behavior.
97
+
98
+ ## Completion Check
99
+
100
+ Before treating a module spec as ready, check:
101
+
102
+ - all universal sections exist;
103
+ - sections are in the source-template order;
104
+ - the rendered metadata table includes all required rows;
105
+ - retained conditional sections are present and filled;
106
+ - sequence inventory, diagrams, and failure/error/recovery paths exist for non-trivial modules;
107
+ - every requirement has WHAT, WHY, source evidence, test/example evidence or a gap, and confidence;
108
+ - public surfaces link to the root contract index and exact schema/API detail source when one exists;
109
+ - no template placeholders, generic fill text, or vague evidence anchors remain.
110
+ - migrated specs do not name old non-canonical source files as headings, appendices, or Source
111
+ Material Register rows; exact source routing remains in the manifest/local source-fidelity records.
@@ -0,0 +1,321 @@
1
+ <!-- ───────────────────────────────
2
+ Template: Module Spec
3
+ Template-ID: module-spec
4
+ Generates: <module-path>/ai-docs/<module-name>-spec.md by default, or the manifest's module docs path
5
+ Description: Per-module canonical spec — orientation plus requirements, design, invariants, flows, pitfalls, and tests.
6
+ Library ver: 0.2.2
7
+ Last updated: 2026-07-30
8
+ ─────────────────────────────── -->
9
+
10
+ # <MODULE> — SPEC
11
+
12
+ > Start here → root [`AGENTS.md`](<relative-path-to-root-AGENTS.md>) (agent entry) · router [`SPEC_INDEX.md`](<relative-path-to-root-ai-docs/SPEC_INDEX.md>) · system [`ARCHITECTURE.md`](<relative-path-to-root-ai-docs/ARCHITECTURE.md>). This is the module's canonical spec: orientation, requirements, design, flows, state, protocol, UI, data, and tests. (Multi-repo: the root `AGENTS.md` may be the workspace-level one.)
13
+ > Context-efficiency: link to canonical docs — don't duplicate them. Load specs on demand per `SPEC_INDEX.md`.
14
+
15
+ <!--
16
+ CANONICAL MODULE SPEC. This file is the module documentation surface for orientation, requirements,
17
+ design, flows, state, protocol, UI, data, and tests. Save source-local as
18
+ <module-path>/ai-docs/<module-name>-spec.md by default.
19
+ Diagrams from real code;
20
+ prefer Mermaid unless the repository already standardizes on another diagram format.
21
+ This source-local file holds the module's orientation, design sections, diagrams, flows,
22
+ relationships, use cases, state/concurrency/error/protocol detail where applicable, and module test
23
+ strategy.
24
+ Headings are flat and concrete; sections preceded by `<!-- Include if: ... -->` are kept only when
25
+ the condition holds. Each section's comment gives Capture (what to write) / Avoid (the common mistake)
26
+ / Example (a generic illustration).
27
+ -->
28
+
29
+ ## Metadata
30
+ <!-- Capture: machine-readable doc identity, provenance, and validation state. Avoid: hiding these only in
31
+ template comments or run records. Example: Module id `<module-id>`, Source `<module-path>/`, Coverage score `Pending coverage assessment`. -->
32
+ | Field | Value |
33
+ |---|---|
34
+ | Module id | `<module-id>` |
35
+ | Source path(s) | `<module source path(s)>` |
36
+ | Parent spec | the parent module's canonical spec at the manifest's module docs path, e.g. `<parent-module-path>/ai-docs/<parent-name>-spec.md` — or `—` when this module has no parent module |
37
+ | Doc kind | Module spec |
38
+ | Coverage score | Pending coverage assessment / `<percent>%` assessed `<YYYY-MM-DD>` |
39
+ | Generated from | `module-spec` @ SDLC template library `0.2.2` |
40
+ | generated_by / approved_by / updated_at | <provenance> |
41
+ | Validation status | not-run / pass / pass-with-warnings / blocked, validator `<runtime>`, assessed `<YYYY-MM-DD>` |
42
+
43
+ Coverage score: `Pending coverage assessment` before the first report; after assessment, replace with
44
+ `<0-100%>` plus the assessment date and short evidence summary. Do not link or cite local generated
45
+ coverage or validation report paths from this committed metadata. Keep manifest coverage state outside
46
+ the rendered module doc metadata.
47
+
48
+ ## Evidence Rules
49
+ Every generated requirement below must cite concrete source evidence using `file path`. Separate source
50
+ evidence, test evidence, examples, assumptions, and gaps so validators and future agents can distinguish
51
+ truth from context. Test evidence is preferred for WHY. Commit evidence is allowed only when the
52
+ repository policy says history is reliable, and must include the commit hash. If evidence is missing or
53
+ conflicting, ask a focused discovery question before finalizing the requirement; record unresolved answers
54
+ as approved unknowns only when the human explicitly defers or does not know.
55
+
56
+ ## Source Material Register
57
+ <!-- Capture: source basis categories and disposition for this canonical spec. Avoid: listing old
58
+ non-canonical file paths such as prior AGENTS/ARCHITECTURE/spec snapshots, copying an entire
59
+ source file, or adding a large quoted block. Exact old source paths belong in .sdd/manifest.json
60
+ and local .generated source-fidelity reports. Preserve validated tables, diagrams, flows, and
61
+ requirements in the matching sections by meaning; record stale/conflicting/unverifiable units in
62
+ the run report. Example: "Reviewed prior module architecture docs | architecture | verified |
63
+ station-login sequence moved to Sequence Diagram(s); stale cache note recorded in source-fidelity
64
+ report." -->
65
+ | Source material | Scope | Decision | Detail location or disposition |
66
+ |---|---|---|---|
67
+ | `<source-basis-or-N/A>` | overview / architecture / API / tests / none | used / verified / reference-only / stale / conflicting / none | <where the detail landed, or why it is unsupported/conflicting/not applicable> |
68
+
69
+ ## Overview
70
+ <!-- Capture: the module's high-level orientation in 2-4 paragraphs: what it owns, how it is structured,
71
+ and where a maintainer should start. Avoid: duplicating every requirement or listing files with no
72
+ "why". Example: "`<module>` owns `<resource>` lifecycle; callers enter through `<public-api>`, which
73
+ delegates to `<internal-unit>` so validation and persistence stay separate." -->
74
+ <module orientation>
75
+
76
+ ## Purpose / Responsibility
77
+ <!-- Capture: in 1-2 sentences, the single thing this module owns. Avoid: a vague catch-all ("handles
78
+ stuff") or listing everything it touches. Example: "Owns `<resource>` lifecycle: create, validate, and
79
+ transition `<resource>`; does NOT own `<external capability>`." -->
80
+ <purpose>
81
+
82
+ <!-- Include if: the repo tiers its modules (e.g. Tier-1/Tier-2) [condition-id: module.has_tiers] -->
83
+ ## Tier
84
+ <!-- Capture: this module's tier and what the tier implies (SLO, review bar). Avoid: inventing a tier the
85
+ repo doesn't use. Example: "Tier-1 — customer-facing; changes need 2 reviewers + on-call sign-off." -->
86
+ **Tier:** <Tier-1 / Tier-2 / ...>
87
+
88
+ ## Stack
89
+ <!-- Capture: language+version, framework, test stack, build wiring (datastore/messaging only if it has them).
90
+ Avoid: copying the repo-wide stack when this module differs (polyglot). Example: "<language> <version>,
91
+ <framework>, <test framework>; build target <module-target>." -->
92
+ <stack>
93
+
94
+ ## Folder / Package Structure
95
+ <!-- Capture: the REAL tree globbed from disk, one-line role per dir. Avoid: an idealized/aspirational tree.
96
+ Example: <module>/src/{api,domain,repo}/ with a one-line role each. -->
97
+ ```
98
+ <module>/src/.../
99
+ ├── <dir>/ # <one-line role>
100
+ ```
101
+
102
+ <!-- Include if: this module contains child modules that own their own specs [condition-id: module.has_submodules] -->
103
+ ## Sub-modules
104
+ <!-- Capture: one row per DIRECT child module that owns its own spec — the routed registry an agent follows
105
+ to descend one level. Spec paths follow the manifest's module docs path, shown below with the default.
106
+ Avoid: listing directories that have no spec of their own (those stay in Folder / Package Structure),
107
+ listing indirect grandchildren, or restating a child's contents here. Example:
108
+ "`<module>/src/<child>/` | <what the child owns> | Partial | `<module>/src/<child>/ai-docs/<child>-spec.md`". -->
109
+ | Sub-module | Responsibility | Manifest coverage state | Spec |
110
+ |---|---|---|---|
111
+ | `<child-module-path>/` | <one line> | <from `.sdd/manifest.json`> | `<child-module-path>/ai-docs/<child-name>-spec.md` |
112
+
113
+ Scope rule: every section below describes THIS module only. Behavior owned by a sub-module is recorded in
114
+ that sub-module's spec and referenced here by contract id — never duplicated, so a requirement is counted
115
+ once and at one level.
116
+
117
+ ## Key Files (source of truth)
118
+ <!-- Capture: the files an agent must read and NOT infer values from (constants/config/schema, the export
119
+ barrel, typed props). Avoid: listing every file — only the authoritative ones. Example: "config/
120
+ limits.ts holds the rate caps; never hardcode them elsewhere." -->
121
+ | File | Holds |
122
+ |---|---|
123
+ | `<the real source-of-truth file(s)>` | <what it holds> |
124
+
125
+ ## Public Surface
126
+ <!--
127
+ Capture: how THIS module is consumed. Keep this compact: one row per public endpoint/export/event/command,
128
+ plus short compatibility or deprecation notes. Link exact schemas/details instead of pasting them here:
129
+ network API → OpenAPI `.yaml` link when available;
130
+ events/messages → AsyncAPI `.yaml`, JSON Schema, or event source link;
131
+ gRPC → `.proto`; GraphQL → `.graphql`;
132
+ imported SDK/code API → exported declarations, API report, or package entry point.
133
+ Avoid: a vague "API" heading, documenting internal helpers as public, or turning this spec into a full
134
+ schema dump. If there is no external contract, write "Internal Surface — internal use only" and list the
135
+ entry points other modules call.
136
+ Example: "billing.invoice.get | HTTP | GET /invoices/{id} | fetch invoice | stable; additive response fields only | openapi.yaml#/paths/... | ai-docs/CONTRACTS.md#api-endpoints".
137
+ -->
138
+ | Contract ID | Type | Surface | Purpose | Compatibility / deprecation | Schema / detail link | Root index |
139
+ |---|---|---|---|---|---|---|
140
+ | `<module>.<surface>` | HTTP / SDK / event / CLI / RPC | <method+path, symbol, event, command> | <why callers use it> | <stability and deprecation note> | `<schema-or-api-detail>` | `<relative-path-to-root-ai-docs/CONTRACTS.md>` |
141
+
142
+ Compatibility notes:
143
+ - <additive/change/removal rule; consumer transition or deprecation window if applicable>
144
+
145
+ ## Requires (dependencies)
146
+ <!-- Capture: what the module needs IN — internal modules, external services (+fallback), datastore/infra,
147
+ peer libs (+version floor). Avoid: omitting fallbacks/version floors. Example: "<cache/store> (temporary verifier store, bounded
148
+ TTL, fail-closed); <shared-lib> ^2.3." -->
149
+ <requires>
150
+
151
+ ## Requirements
152
+ <!-- Capture: observable behavior, public contracts, invariants, and compatibility promises that must be
153
+ preserved. Avoid: turning data inventory into requirements. Tables, fields, entities, migrations, and
154
+ cache keys belong in Data / Schema, Schema / Migration Discipline, or Data Model sections below. -->
155
+ | ID | WHAT | WHY | Source Evidence | Test / Example Evidence | Assumptions / Gaps | Confidence |
156
+ |---|---|---|---|---|---|---|
157
+ | `<MODULE>-R-001` | <observable behavior or contract the module must preserve> | <rationale from tests/usage/history, or approved unknown> | `<source-file>` | `<test-file>` / `<example-file>` / none found | <assumption, gap, or none> | PRESENT / WEAK / APPROVED_UNKNOWN |
158
+
159
+ Do not merge multiple unrelated behaviors into one requirement. Do not use broad evidence such as
160
+ "see source tree" or only an intake/questionnaire record; cite the implementation/test files that support
161
+ the claim. Do not record raw data/schema inventory as requirements.
162
+
163
+ ## Design Overview
164
+ <!-- Capture: how the module works internally and why it's structured this way (2-4 paragraphs).
165
+ Avoid: restating the overview or listing files with no "why". Example: "Splits intake validation from
166
+ processing rules so retries never re-validate; processor is pure + unit-testable." -->
167
+ <design overview>
168
+
169
+ ## Data Flow
170
+ <!-- Capture: how data moves through the module (inputs → transforms → outputs), naming the EXACT transport
171
+ (HTTP / WebSocket / gRPC / queue / in-process). Avoid: leaving transport vague — a frequent doc error.
172
+ Example: "Request → validator → domain service → repository (<store>); events emitted to the bus." -->
173
+ ```mermaid
174
+ <data-flow diagram>
175
+ ```
176
+
177
+ ## Sequence Diagram(s)
178
+ <!-- Capture: the sequence inventory first, then one sequence per major operation group. Count operation
179
+ groups from public surfaces, use cases, events, commands, state transitions, and async jobs. Merge
180
+ operations into one diagram only when they share the same actors, ordering, transport, state transition,
181
+ and failure behavior. Include error/timeout/retry/rejected/rollback/recovery paths. Avoid: one generic
182
+ happy-path diagram for a module with multiple behaviors. Example: a mermaid sequenceDiagram showing
183
+ client → service → store, plus the timeout → retry branch. -->
184
+ Sequence coverage:
185
+
186
+ | Operation group | Diagram | Failure / recovery coverage |
187
+ |---|---|---|
188
+ | `<operation group>` | `<diagram title>` | <alt/opt branch or separate diagram covering error/timeout/retry/rejected/rollback/recovery> |
189
+
190
+ ```mermaid
191
+ <sequence diagram for each major operation — prefer mermaid sequenceDiagram; include error/timeout paths>
192
+ ```
193
+
194
+ ## Class / Component Relationships
195
+ <!-- Capture: the key types and how they relate (inheritance, composition, DI). Avoid: an exhaustive dump of
196
+ every class. Example: a class diagram of Service → Repository interface ← two implementations. -->
197
+ ```mermaid
198
+ <class or component diagram>
199
+ ```
200
+ <Narrative of the key types and how they relate.>
201
+
202
+ ## Use Cases
203
+ <!-- Capture: the concrete flows the module supports (actor → steps → outcome). Avoid: vague capability names
204
+ with no steps. Example: "UC-1 Process item: caller submits → validate → persist → emit ItemProcessed." -->
205
+ - **UC-1 <name>:** <actor → steps → outcome>. Evidence: `<source-file>`, `<test-file>`.
206
+ <!-- Include if: this module has a UI — add the UI flow (screens, states, user actions) per use case [condition-id: module.has_ui] -->
207
+ <!-- Include if: this module crosses service boundaries (network API or events) — add the cross-service flow per use case [condition-id: module.crosses_service_boundaries] -->
208
+
209
+ <!-- Include if: this module holds client-side state [condition-id: module.holds_client_state] -->
210
+ ## State Model
211
+ <!-- Capture: the state shape (store/slices) and what triggers transitions. Avoid: documenting server data
212
+ here. Example: "<state-slice> {items, total}; ADD_ITEM/REMOVE_ITEM recompute total." -->
213
+ <state model>
214
+
215
+ <!-- Include if: the module enforces domain rules or entity invariants [condition-id: module.enforces_domain_rules] -->
216
+ ## Business Rules & Invariants
217
+ <!-- Capture: the rules that must ALWAYS hold (lifecycles, validation, state constraints) + where enforced
218
+ (file path). Avoid: mixing these with pitfalls. Example: "An order can't leave DRAFT without ≥1 line
219
+ item — enforced in <OwnerService>.submit (<owner-service>.ts)." -->
220
+ - <invariant — and where it is enforced>
221
+
222
+ <!-- Include if: the module is concurrent / async / reactive / event-driven [condition-id: module.is_concurrent_async] -->
223
+ ## Concurrency & Reactive Flow
224
+ <!-- Capture: the async/threading model — what runs concurrently, ordering guarantees, what must be
225
+ non-blocking, idempotency/retry, shared-state protection. Avoid: assuming single-threaded when it isn't.
226
+ Example: "Handlers are stateless; the same event may arrive twice — upsert keyed by event id." -->
227
+ - <concurrency model; ordering/idempotency guarantees; what NOT to block>
228
+
229
+ <!-- Include if: the module owns persistence (its own tables/store) [condition-id: module.owns_persistence] -->
230
+ ## Data / Schema
231
+ <!-- Capture: the tables/collections this module owns, key fields, and the migration rule. Avoid: documenting
232
+ data another module owns. Example: "Owns `<items>` (id, state, updated_at); migrations in db/migrations/,
233
+ expand→migrate→contract." Keep this as descriptive data inventory, not requirement rows. -->
234
+ - <owned stores + key schema + migration discipline>
235
+
236
+ <!-- Include if: this module owns persistence (a datastore + migrations) [condition-id: module.owns_persistence] -->
237
+ ## Schema / Migration Discipline
238
+ <!-- Capture: where migrations live, numbering/ordering, the migration-is-source-of-truth rule. Avoid:
239
+ hand-editing shipped migrations. Example: "db/migrations/NNNN_*.sql, monotonic; never edit a shipped one." -->
240
+ <migration discipline>
241
+
242
+ <!-- Include if: the module is stateful with non-trivial transitions [condition-id: module.stateful_transitions] -->
243
+ ## State Machine
244
+ <!-- Capture: states, transitions, guards, terminal states, and invalid transitions. Avoid: mixing state
245
+ transitions into generic requirements. -->
246
+ ```mermaid
247
+ <state diagram>
248
+ ```
249
+
250
+ <!-- Include if: the module exposes a wire protocol/format [condition-id: module.exposes_wire_protocol] -->
251
+ ## Protocol / Wire Format
252
+ <!-- Capture: message/frame shape, versioning, compatibility rules, and parser/serializer ownership. Avoid:
253
+ leaving parser/serializer ownership implicit. -->
254
+ - <protocol or wire-format details>
255
+
256
+ <!-- Include if: the module is UI with a multi-screen flow [condition-id: module.ui_multi_screen] -->
257
+ ## UI Flow
258
+ <!-- Capture: screens, states, user actions, empty/loading/error states, and accessibility constraints. Avoid:
259
+ omitting non-happy-path UI states. -->
260
+ - <UI flow details>
261
+
262
+ <!-- Include if: the module owns a large/complex data model [condition-id: module.large_data_model] -->
263
+ ## Data Model
264
+ <!-- Capture: entities, relationships, ownership, lifecycle, retention, and migration notes. Avoid:
265
+ recording table/field inventory as requirements. -->
266
+ - <data model details>
267
+
268
+ <!-- Include if: the module returns/raises errors a caller must handle [condition-id: module.returns_caller_errors] -->
269
+ ## Error Handling & Failure Modes
270
+ <!-- Capture: the errors/result types the module produces, when each fires, and how a caller recovers. Avoid:
271
+ swallowing errors or returning a bare null. Example: "Returns NotFound (unknown id) and Conflict
272
+ (stale version); callers retry Conflict once after re-reading." -->
273
+ | Condition | Signal (error/code/result) | Caller recovery |
274
+ |---|---|---|
275
+
276
+ ## Pitfalls
277
+ <!-- Capture: the latent-bug edges mined from incidents/tribal knowledge, and how to avoid each. Avoid: generic
278
+ advice ("handle errors"). Example: "Timestamps are stored UTC but the legacy column is local — convert
279
+ on read or reports drift by the offset." -->
280
+ - <non-obvious behavior / failure mode that has bitten or could bite; how to avoid it>
281
+
282
+ <!-- Include if: this module has specific conventions beyond the repo-wide rules [condition-id: module.module_specific_conventions] -->
283
+ ## Module Do's / Don'ts
284
+ <!-- Capture: conventions extracted from real code unique to this module. Avoid: repeating repo-wide rules.
285
+ Example: "DO emit <ResourceChanged> after every state write; DON'T mutate `<resource>` outside `<OwnerService>`." -->
286
+ - DO: <module-specific convention>
287
+ - DON'T: <module-specific pitfall>
288
+
289
+ <!-- Include if: this module is published/consumed as a package [condition-id: module.published_package] -->
290
+ ## Export Stability
291
+ <!-- Capture: semver sensitivity of exports, the type-declaration surface, sample usage. Avoid: a breaking
292
+ export change without a major bump. Example: "Adding an optional field = minor; removing one = major." -->
293
+ <export stability>
294
+
295
+ <!-- Include if: this module is embedded into a host application [condition-id: module.embedded_in_host] -->
296
+ ## Host Integration & Theming
297
+ <!-- Capture: theming/provider needs, custom-element/tag names, the host-mount contract. Avoid: assuming the
298
+ host's framework version. Example: "Mounts as <order-widget>; requires ThemeProvider; peer react ^18." -->
299
+ <host integration>
300
+
301
+ <!-- Include if: the module has a non-obvious design trade-off a consumer must know [condition-id: module.has_design_tradeoff] -->
302
+ ## Key Design Trade-off
303
+ <!-- Capture: the deliberate trade-off and the invariant it preserves. Avoid: presenting it as a limitation
304
+ with no rationale. Example: "Stable item identity is favored over pagination simplicity — cursors encode
305
+ identity, not offset, so inserts don't shift pages." -->
306
+ - <trade-off chosen, what it preserves, what it costs>
307
+
308
+ ## Test-Case Strategy (module)
309
+ <!-- Capture: unit boundaries, what each test asserts (a positive AND a negative case), key edge cases,
310
+ eventual-consistency handling. Avoid: only-happy-path tests, or restating a change-level test plan.
311
+ Example: "submit() — asserts persisted+event emitted (positive) AND rejects empty order (negative)." -->
312
+ <module test approach>
313
+
314
+ | Behavior / Requirement | Existing test evidence | Gap |
315
+ |---|---|---|
316
+ | `<MODULE>-R-001` | `<test-file>` or `None found` | <missing negative case / missing edge case / none> |
317
+
318
+ ## Traceability
319
+ <!-- Capture: the links up/out so a reader can navigate. Avoid: dead links or omitting the manifest. -->
320
+ - Repo architecture: `<relative-path-to-root-ai-docs/ARCHITECTURE.md>` · Registry: `<relative-path-to-root-ai-docs/SPEC_INDEX.md>`
321
+ - Coverage state & contracts baseline: `.sdd/manifest.json`
@@ -0,0 +1,59 @@
1
+ <!-- ───────────────────────────────
2
+ Template: ADR (example)
3
+ Template-ID: adr
4
+ Generates: ai-docs/adr/NNNN-<kebab-title>.md
5
+ Description: Standing architecture decision record — context, decision, alternatives rejected, consequences.
6
+ Library ver: 0.2.2
7
+ Last updated: 2026-06-30
8
+ ─────────────────────────────── -->
9
+
10
+ # ADR-NNNN — <short decision title>
11
+
12
+ > Start here → repo root [`AGENTS.md`](../../AGENTS.md) (agent entry) · router [`SPEC_INDEX.md`](../SPEC_INDEX.md) · system [`ARCHITECTURE.md`](../ARCHITECTURE.md). This is a standing `ai-docs/adr/` decision record; the folder README explains numbering/supersession.
13
+ > Context-efficiency: link to canonical docs — don't duplicate them; one decision per file.
14
+
15
+ <!--
16
+ STANDING decision record. One decision per file; immutable once Accepted. Capture the WHY and the rejected
17
+ options so the reasoning survives. Headings are flat; sections preceded by `<!-- Include if: ... -->` are
18
+ kept only when relevant. Each section comment gives Capture / Avoid / Example.
19
+ -->
20
+
21
+ <!-- Capture: status + date + deciders (roles) + supersession link. Avoid: editing an Accepted ADR in place —
22
+ supersede it with a new one. Example: "Status: Accepted; Deciders: architect + users TL." -->
23
+ | Field | Value |
24
+ |---|---|
25
+ | Status | Proposed / Accepted / Superseded by ADR-NNNN / Deprecated |
26
+ | Date | <YYYY-MM-DD> |
27
+ | Deciders | <roles, not just names> |
28
+ | Supersedes / Superseded by | <ADR-NNNN, or none> |
29
+ | Generated from | `adr` @ SDLC template library `0.2.2` |
30
+
31
+ ## Context
32
+ <!-- Capture: the forces — problem, constraints, what made the decision necessary, grounded in facts (file path/
33
+ incident/requirement). Avoid: opinion with no evidence. Example: "Two services wrote `<entity>`, causing
34
+ race-condition double-posts (INC-220)." -->
35
+ <context>
36
+
37
+ ## Decision
38
+ <!-- Capture: what was decided, as a clear directive. Avoid: a vague preference. Example: "`<owner service>` is
39
+ the sole writer of `<entity>`; others call its API." -->
40
+ <decision>
41
+
42
+ ## Alternatives Considered
43
+ <!-- Capture: the rejected options + WHY (the most valuable part — stops relitigation/accidental reversal).
44
+ Avoid: listing only the chosen option. Example: "Distributed lock — adds latency + a failure mode — rejected." -->
45
+ | Alternative | Pros | Cons | Why rejected |
46
+ |---|---|---|---|
47
+
48
+ ## Consequences
49
+ <!-- Capture: what gets easier/harder, follow-on obligations, the constraint agents must now respect. Avoid:
50
+ only the upside. Example: "Agents must: never write `<entity>` rows outside `<owner service>`." -->
51
+ - **Positive:** <…>
52
+ - **Negative / cost:** <…>
53
+ - **Agents must:** <the constraint this imposes on future changes>
54
+
55
+ <!-- Include if: the decision has a defined re-evaluation trigger -->
56
+ ## Revisit When
57
+ <!-- Capture: the condition under which to reconsider. Avoid: "never". Example: "if write throughput exceeds
58
+ what a single writer can sustain." -->
59
+ - <condition under which this should be reconsidered>
@@ -0,0 +1,49 @@
1
+ <!-- ───────────────────────────────
2
+ Template: Pattern (example)
3
+ Template-ID: pattern
4
+ Generates: ai-docs/patterns/<name>.md
5
+ Description: A repo convention from real code — correct vs incorrect form, with where it appears.
6
+ Library ver: 0.2.2
7
+ Last updated: 2026-06-30
8
+ ─────────────────────────────── -->
9
+
10
+ # Pattern: <name>
11
+
12
+ > Start here → repo root [`AGENTS.md`](../../AGENTS.md) (agent entry) · router [`SPEC_INDEX.md`](../SPEC_INDEX.md). This is an `ai-docs/patterns/` fill-in; the folder README explains generic-vs-per-language routing.
13
+ > Context-efficiency: link to canonical docs — don't duplicate them; one small, code-grounded pattern per file.
14
+
15
+ <!-- Example pattern file shape. Fill these from REAL code (3+ occurrences for a promoted pattern;
16
+ fewer occurrences can be a candidate note, not an enforceable pattern). Delete this example in a
17
+ real repo. Generic patterns sit here; language-specific ones go in a subfolder.
18
+ Each section comment gives Capture / Avoid / Example. -->
19
+
20
+ ## When to use
21
+ <!-- Capture: the concrete situation this pattern applies to. Avoid: "always" — give the trigger. Example:
22
+ "When emitting a domain event after a state change." -->
23
+ **When to use:** <the situation this pattern applies to>
24
+
25
+ ## Correct
26
+ <!-- Capture: the correct form copied from REAL source with a file path anchor. Avoid: an invented snippet.
27
+ Example: "// from events/emit.ts — emit(ev) wraps in the outbox." -->
28
+ ```<lang>
29
+ // from <real/file/path.ext>
30
+ <correct example drawn from actual source>
31
+ ```
32
+
33
+ ## Incorrect
34
+ <!-- Capture: the common mistake + the failure it causes. Avoid: a strawman nobody writes. Example: "direct
35
+ bus.publish() — bypasses the outbox, so the event is lost if the tx rolls back." -->
36
+ ```<lang>
37
+ <the common mistake>
38
+ ```
39
+ **Why wrong:** <the failure it causes>
40
+
41
+ ## Where it appears
42
+ <!-- Capture: 3+ real file:path occurrences (proves it's a real convention, not invented). Avoid: listing it
43
+ if it appears < 3 times. Example: "<module-a>/emit.ts, <module-b>/emit.ts, <module-c>/emit.ts." -->
44
+ - `<file:path>` , `<file:path>` , `<file:path>` (3+ real occurrences)
45
+
46
+ ## Edge cases / exceptions
47
+ <!-- Capture: where the pattern legitimately doesn't apply. Avoid: pretending there are none. Example: "Not for
48
+ fire-and-forget telemetry events, which skip the outbox by design." -->
49
+ - <when the pattern legitimately doesn't apply>
@@ -0,0 +1,42 @@
1
+ <!-- ───────────────────────────────
2
+ Template: Rule (example)
3
+ Template-ID: rule
4
+ Generates: ai-docs/rules/<name>.md
5
+ Description: One enforceable repo rule — the rule, its rationale, how to follow it, and how it's enforced.
6
+ Library ver: 0.2.2
7
+ Last updated: 2026-06-30
8
+ ─────────────────────────────── -->
9
+
10
+ # Rule: <short imperative name>
11
+
12
+ > Start here → repo root [`AGENTS.md`](../../AGENTS.md) (agent entry, carries the critical rules) · router [`SPEC_INDEX.md`](../SPEC_INDEX.md). This is an `ai-docs/rules/` fill-in; the folder README explains generic-vs-per-language routing; the repo-wide rules digest is `RULES.md`.
13
+ > Context-efficiency: link to canonical docs — don't duplicate them; one rule per file; defer to the linter where it enforces.
14
+
15
+ <!--
16
+ A single fill-in rule file (symmetric with patterns/_pattern-example.md). Generic rules live in
17
+ ai-docs/rules/; language-specific rules in ai-docs/rules/<language>/. One rule per file. Defer to tooling:
18
+ if a linter/CI already enforces it, point to that instead of restating it.
19
+ -->
20
+
21
+ ## Rule
22
+ <!-- Capture: the rule as one imperative sentence the agent can obey. Avoid: vague aspirations
23
+ ("write clean code") or generic best practice not specific to this repo. Example: "Wrap every
24
+ outbound network call in the shared retry helper; never call the HTTP client directly." -->
25
+ <the rule>
26
+
27
+ ## Why
28
+ <!-- Capture: the concrete reason — the incident, bug class, or convention it prevents. Avoid: "it's
29
+ best practice" with no consequence. Example: "Direct client calls bypass timeout + circuit-breaker
30
+ config and caused a cascading outage (INC-1234)." -->
31
+ <rationale>
32
+
33
+ ## How to follow
34
+ <!-- Capture: the correct way, with a real code reference (file path) or a short snippet. Avoid: an
35
+ abstract description with no example to copy. Example: "Use retryingClient.call(req) — see
36
+ src/net/retrying-client.ts." -->
37
+ <how + example reference>
38
+
39
+ ## Enforced by
40
+ <!-- Capture: the exact gate that catches a violation. Avoid: claiming enforcement that doesn't exist.
41
+ Example: "lint rule no-direct-http (errors in CI)" or "review only — no automated check yet." -->
42
+ <linter rule / CI gate / review check / "review only">