@plebeiantech/lat.md 0.12.3-fork.9 → 0.13.4-fork.2

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 (340) hide show
  1. package/README.md +27 -3
  2. package/dist/src/cli/agent-invocation.d.ts +6 -0
  3. package/dist/src/cli/agent-invocation.js +23 -0
  4. package/dist/src/cli/checklist-menu.d.ts +2 -1
  5. package/dist/src/cli/checklist-menu.js +3 -2
  6. package/dist/src/cli/fork-instructions.d.ts +1 -0
  7. package/dist/src/cli/fork-instructions.js +8 -32
  8. package/dist/src/cli/fork-scaffold.js +2 -2
  9. package/dist/src/cli/graph.d.ts +1 -1
  10. package/dist/src/cli/hook.d.ts +26 -0
  11. package/dist/src/cli/hook.js +115 -64
  12. package/dist/src/cli/index.js +178 -70
  13. package/dist/src/cli/init-preferences.d.ts +4 -0
  14. package/dist/src/cli/init-preferences.js +36 -0
  15. package/dist/src/cli/init.d.ts +2 -1
  16. package/dist/src/cli/init.js +100 -60
  17. package/dist/src/cli/reindex.d.ts +1 -1
  18. package/dist/src/cli/reindex.js +7 -10
  19. package/dist/src/cli/search.d.ts +14 -4
  20. package/dist/src/cli/search.js +115 -101
  21. package/dist/src/cli/ui-build-server.d.ts +12 -0
  22. package/dist/src/cli/ui-build-server.js +26 -0
  23. package/dist/src/cli/ui-build.d.ts +1 -1
  24. package/dist/src/cli/ui-build.js +1 -1
  25. package/dist/src/cli/ui.d.ts +1 -1
  26. package/dist/src/cli/ui.js +1 -1
  27. package/dist/src/cli/wiki.d.ts +12 -0
  28. package/dist/src/cli/wiki.js +85 -0
  29. package/dist/src/fork/antigravity-hook.d.ts +47 -0
  30. package/dist/src/fork/antigravity-hook.js +424 -0
  31. package/dist/src/fork/antigravity-init.d.ts +17 -0
  32. package/dist/src/fork/antigravity-init.js +124 -0
  33. package/dist/src/fork/upstream-drift.js +1 -1
  34. package/dist/src/fork/upstream-guard.d.ts +1 -1
  35. package/dist/src/fork/upstream-guard.js +8 -7
  36. package/dist/src/graph-export.js +7 -7
  37. package/dist/src/knowledge/index.js +2 -2
  38. package/dist/src/mcp/server.js +34 -18
  39. package/dist/src/search/cache.d.ts +3 -0
  40. package/dist/src/search/cache.js +104 -0
  41. package/dist/src/search/chunks.d.ts +23 -0
  42. package/dist/src/search/chunks.js +200 -0
  43. package/dist/src/search/db.d.ts +28 -16
  44. package/dist/src/search/db.js +100 -40
  45. package/dist/src/search/embedder.d.ts +2 -1
  46. package/dist/src/search/embedder.js +7 -6
  47. package/dist/src/search/index.d.ts +6 -2
  48. package/dist/src/search/index.js +176 -70
  49. package/dist/src/search/lexical.d.ts +6 -0
  50. package/dist/src/search/lexical.js +36 -0
  51. package/dist/src/search/lock.d.ts +5 -0
  52. package/dist/src/search/lock.js +45 -0
  53. package/dist/src/search/query.d.ts +26 -0
  54. package/dist/src/search/query.js +103 -0
  55. package/dist/src/search/search.d.ts +16 -7
  56. package/dist/src/search/search.js +165 -21
  57. package/dist/src/search/types.d.ts +15 -0
  58. package/dist/src/view/client/assets/GraphView-D_xnk0bP.js +456 -0
  59. package/dist/src/view/client/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  60. package/dist/src/view/client/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  61. package/dist/src/view/client/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  62. package/dist/src/view/client/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  63. package/dist/src/view/client/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  64. package/dist/src/view/client/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  65. package/dist/src/view/client/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  66. package/dist/src/view/client/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  67. package/dist/src/view/client/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  68. package/dist/src/view/client/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  69. package/dist/src/view/client/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  70. package/dist/src/view/client/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  71. package/dist/src/view/client/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  72. package/dist/src/view/client/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  73. package/dist/src/view/client/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  74. package/dist/src/view/client/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  75. package/dist/src/view/client/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  76. package/dist/src/view/client/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  77. package/dist/src/view/client/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  78. package/dist/src/view/client/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  79. package/dist/src/view/client/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  80. package/dist/src/view/client/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  81. package/dist/src/view/client/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  82. package/dist/src/view/client/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  83. package/dist/src/view/client/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  84. package/dist/src/view/client/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  85. package/dist/src/view/client/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  86. package/dist/src/view/client/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  87. package/dist/src/view/client/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  88. package/dist/src/view/client/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  89. package/dist/src/view/client/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  90. package/dist/src/view/client/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  91. package/dist/src/view/client/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  92. package/dist/src/view/client/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  93. package/dist/src/view/client/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  94. package/dist/src/view/client/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  95. package/dist/src/view/client/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  96. package/dist/src/view/client/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  97. package/dist/src/view/client/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  98. package/dist/src/view/client/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  99. package/dist/src/view/client/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  100. package/dist/src/view/client/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  101. package/dist/src/view/client/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  102. package/dist/src/view/client/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  103. package/dist/src/view/client/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  104. package/dist/src/view/client/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  105. package/dist/src/view/client/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  106. package/dist/src/view/client/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  107. package/dist/src/view/client/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  108. package/dist/src/view/client/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  109. package/dist/src/view/client/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  110. package/dist/src/view/client/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  111. package/dist/src/view/client/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  112. package/dist/src/view/client/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  113. package/dist/src/view/client/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  114. package/dist/src/view/client/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  115. package/dist/src/view/client/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  116. package/dist/src/view/client/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  117. package/dist/src/view/client/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  118. package/dist/src/view/client/assets/MarkdownEditor-bjqt_FoF.js +28 -0
  119. package/dist/src/view/client/assets/OrbitControls-DwcpQNja.js +1 -0
  120. package/dist/src/view/client/assets/STLLoader-CLWTKt5i.js +1 -0
  121. package/dist/src/view/client/assets/_commonjsHelpers-CqkleIqs.js +1 -0
  122. package/dist/src/view/client/assets/abnfDiagram-VCTEODGH-kWGvtRnL.js +1 -0
  123. package/dist/src/view/client/assets/arc-BPAFd7cP.js +1 -0
  124. package/dist/src/view/client/assets/architectureDiagram-5GKGNRK7-CsY39oIR.js +36 -0
  125. package/dist/src/view/client/assets/blockDiagram-I7D4REHJ-DHGBG7BJ.js +129 -0
  126. package/dist/src/view/client/assets/c4Diagram-7LVT6UL2-vywK4eb7.js +38 -0
  127. package/dist/src/view/client/assets/channel-CX71L_qV.js +1 -0
  128. package/dist/src/view/client/assets/chunk-2Q5K7J3B-Do3Hz_ci.js +1 -0
  129. package/dist/src/view/client/assets/chunk-5VM5RSS4-B5R1lSeY.js +15 -0
  130. package/dist/src/view/client/assets/chunk-F27PBJKO-Dm55FM_W.js +1 -0
  131. package/dist/src/view/client/assets/chunk-IMKFNOWR-ChptrvvM.js +231 -0
  132. package/dist/src/view/client/assets/chunk-JWPE2WC7-BRQBjrKS.js +1 -0
  133. package/dist/src/view/client/assets/chunk-POPQ4Y6H-CainVZIL.js +1 -0
  134. package/dist/src/view/client/assets/chunk-SVP7TREG-DsKsNGmM.js +88 -0
  135. package/dist/src/view/client/assets/chunk-TICWLB2K-BctkMcJc.js +206 -0
  136. package/dist/src/view/client/assets/chunk-XXDRQBXY-BN7SgOUT.js +1 -0
  137. package/dist/src/view/client/assets/classDiagram-ZZMXUADV-B1VyU6zO.js +1 -0
  138. package/dist/src/view/client/assets/classDiagram-v2-VYDZK3BY-B1VyU6zO.js +1 -0
  139. package/dist/src/view/client/assets/cose-bilkent-JH36ORCC-BszzwrMe.js +1 -0
  140. package/dist/src/view/client/assets/cynefin-OW5HDTMX-CdRyAkPs.js +166 -0
  141. package/dist/src/view/client/assets/cynefinDiagram-5FMLGOSQ-BLvKPZ1u.js +62 -0
  142. package/dist/src/view/client/assets/cytoscape.esm-DzSz-X2X.js +321 -0
  143. package/dist/src/view/client/assets/dagre-GXQ25YYZ-V68w_l65.js +4 -0
  144. package/dist/src/view/client/assets/defaultLocale-DX6XiGOO.js +1 -0
  145. package/dist/src/view/client/assets/diagram-S7CK7UJ4-C2i4eEMg.js +30 -0
  146. package/dist/src/view/client/assets/diagram-UQ7AKVKN-BiwWh5jC.js +41 -0
  147. package/dist/src/view/client/assets/diagram-VSXAHHWV-hkKR_vyS.js +3 -0
  148. package/dist/src/view/client/assets/diagram-VX7I27RA-DzRCSMAc.js +24 -0
  149. package/dist/src/view/client/assets/diagram-Z3DM3KII-fhSFPxyK.js +24 -0
  150. package/dist/src/view/client/assets/ebnfDiagram-PWID7BFC-CCEUDKSA.js +1 -0
  151. package/dist/src/view/client/assets/erDiagram-RLTQ6QDP-FJ2IMyTi.js +99 -0
  152. package/dist/src/view/client/assets/flowDiagram-HODETNUW-BvasdLeK.js +168 -0
  153. package/dist/src/view/client/assets/ganttDiagram-EL5Y4UJY-CiwkBZvY.js +292 -0
  154. package/dist/src/view/client/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  155. package/dist/src/view/client/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  156. package/dist/src/view/client/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  157. package/dist/src/view/client/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  158. package/dist/src/view/client/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2 +0 -0
  159. package/dist/src/view/client/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2 +0 -0
  160. package/dist/src/view/client/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2 +0 -0
  161. package/dist/src/view/client/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
  162. package/dist/src/view/client/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2 +0 -0
  163. package/dist/src/view/client/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2 +0 -0
  164. package/dist/src/view/client/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  165. package/dist/src/view/client/assets/gitGraphDiagram-WWUBYQGX-DYlP2_js.js +106 -0
  166. package/dist/src/view/client/assets/index-BnENo9bV.js +1 -0
  167. package/dist/src/view/client/assets/index-CQ7EOox7.css +1 -0
  168. package/dist/src/view/client/assets/index-CynNDkxt.js +13 -0
  169. package/dist/src/view/client/assets/infoDiagram-27XIBGKW-DRPB2c48.js +2 -0
  170. package/dist/src/view/client/assets/init-Gi6I4Gst.js +1 -0
  171. package/dist/src/view/client/assets/ishikawaDiagram-5VMMS53U-8VV429Cv.js +70 -0
  172. package/dist/src/view/client/assets/journeyDiagram-3NMN7TZE-Dzmwnf83.js +139 -0
  173. package/dist/src/view/client/assets/kanban-definition-UXKFOSKX-pYyZZ1i-.js +89 -0
  174. package/dist/src/view/client/assets/katex-HP8lGamR.js +257 -0
  175. package/dist/src/view/client/assets/layout-GF9k6yGo.js +1 -0
  176. package/dist/src/view/client/assets/linear-Yt2sSOYV.js +1 -0
  177. package/dist/src/view/client/assets/logo-RR_KBOAT.svg +149 -0
  178. package/dist/src/view/client/assets/maplibre-gl-CDX6Zuow.js +800 -0
  179. package/dist/src/view/client/assets/mermaid.core-ChWYCHN0.js +310 -0
  180. package/dist/src/view/client/assets/mindmap-definition-YA3MSWOX-Cc4fQvf1.js +96 -0
  181. package/dist/src/view/client/assets/ordinal-Cboi1Yqb.js +1 -0
  182. package/dist/src/view/client/assets/pegDiagram-XKGWAZYB-C0SsB8bZ.js +1 -0
  183. package/dist/src/view/client/assets/pieDiagram-E7YTZNPT-DIJpqERZ.js +39 -0
  184. package/dist/src/view/client/assets/quadrantDiagram-AXDQQJYC--d-gl6j-.js +7 -0
  185. package/dist/src/view/client/assets/railroadDiagram-O6MQD6OU-BQxwTt7z.js +1 -0
  186. package/dist/src/view/client/assets/requirementDiagram-BXWQKSXE-B_oTeD2A.js +84 -0
  187. package/dist/src/view/client/assets/sankeyDiagram-P5KCCOFB-DLukmE8X.js +40 -0
  188. package/dist/src/view/client/assets/sequenceDiagram-WJ2MYXX4-BNjVB2sc.js +162 -0
  189. package/dist/src/view/client/assets/sizeCapture-INFHLROL-BZecQTOw.js +1 -0
  190. package/dist/src/view/client/assets/stateDiagram-D77RDMKH-Bu1urvXC.js +1 -0
  191. package/dist/src/view/client/assets/stateDiagram-v2-MP3YSRHH-5pc_697G.js +1 -0
  192. package/dist/src/view/client/assets/swimlanes-42K2YHIH-bLAlcepB.js +1 -0
  193. package/dist/src/view/client/assets/swimlanesDiagram-VR7AAH4N-BbOpZjpp.js +8 -0
  194. package/dist/src/view/client/assets/three.module-PDSP0dbZ.js +4108 -0
  195. package/dist/src/view/client/assets/timeline-definition-24CTP7MA-tbwCNvcA.js +120 -0
  196. package/dist/src/view/client/assets/vennDiagram-4TSXK5OY-D8U8Fk0N.js +34 -0
  197. package/dist/src/view/client/assets/wardleyDiagram-VM6X3IG4-LHBVIeNb.js +78 -0
  198. package/dist/src/view/client/assets/xychartDiagram-S5SC5T6Z-CN4tfaFV.js +7 -0
  199. package/dist/src/view/client/index.html +2 -2
  200. package/dist/src/view/client-shell.d.ts +2 -0
  201. package/dist/src/view/client-shell.js +5 -0
  202. package/dist/src/view/diagnostics.d.ts +3 -2
  203. package/dist/src/view/diagnostics.js +49 -58
  204. package/dist/src/view/document-edit.d.ts +8 -0
  205. package/dist/src/view/document-edit.js +25 -0
  206. package/dist/src/view/document-route.d.ts +14 -0
  207. package/dist/src/view/document-route.js +137 -0
  208. package/dist/src/view/document-tree.d.ts +18 -0
  209. package/dist/src/view/document-tree.js +139 -0
  210. package/dist/src/view/external-document-tree.d.ts +3 -0
  211. package/dist/src/view/external-document-tree.js +674 -0
  212. package/dist/src/view/git-diff.js +202 -2
  213. package/dist/src/view/git.js +1 -1
  214. package/dist/src/view/graph.d.ts +4 -3
  215. package/dist/src/view/graph.js +100 -9
  216. package/dist/src/view/highlight.d.ts +10 -2
  217. package/dist/src/view/highlight.js +50648 -3166
  218. package/dist/src/view/markdown.d.ts +3 -2
  219. package/dist/src/view/markdown.js +256 -54
  220. package/dist/src/view/preindexed-search.d.ts +15 -0
  221. package/dist/src/view/preindexed-search.js +25 -0
  222. package/dist/src/view/protocol.d.ts +53 -7
  223. package/dist/src/view/publication.d.ts +2 -0
  224. package/dist/src/view/publication.js +78 -0
  225. package/dist/src/view/references.d.ts +11 -26
  226. package/dist/src/view/references.js +121 -112
  227. package/dist/src/view/repository.d.ts +14 -4
  228. package/dist/src/view/repository.js +260 -19
  229. package/dist/src/view/request-security.d.ts +5 -0
  230. package/dist/src/view/request-security.js +46 -0
  231. package/dist/src/view/search-result.d.ts +4 -0
  232. package/dist/src/view/search-result.js +25 -0
  233. package/dist/src/view/search.d.ts +7 -2
  234. package/dist/src/view/search.js +23 -34
  235. package/dist/src/view/server-build.d.ts +21 -0
  236. package/dist/src/view/server-build.js +145 -0
  237. package/dist/src/view/server-deployment.d.ts +31 -0
  238. package/dist/src/view/server-deployment.js +123 -0
  239. package/dist/src/view/server-index-worker.d.ts +6 -0
  240. package/dist/src/view/server-index-worker.js +14 -0
  241. package/dist/src/view/server.d.ts +11 -2
  242. package/dist/src/view/server.js +245 -73
  243. package/dist/src/view/source-target.d.ts +2 -0
  244. package/dist/src/view/source-target.js +49 -8
  245. package/dist/src/view/static-build.d.ts +18 -2
  246. package/dist/src/view/static-build.js +449 -110
  247. package/dist/src/view/static-protocol.d.ts +26 -2
  248. package/dist/src/view/static-protocol.js +5 -0
  249. package/dist/src/view/store.d.ts +20 -3
  250. package/dist/src/view/store.js +304 -48
  251. package/dist/src/view/table-of-contents.d.ts +2 -2
  252. package/dist/src/view/table-of-contents.js +2 -22
  253. package/dist/src/view/vercel-build.d.ts +24 -0
  254. package/dist/src/view/vercel-build.js +152 -0
  255. package/dist/src/view/vercel-server-build.d.ts +10 -0
  256. package/dist/src/view/vercel-server-build.js +61 -0
  257. package/dist/src/wiki/catalog.d.ts +21 -0
  258. package/dist/src/wiki/catalog.js +256 -0
  259. package/dist/src/wiki/publish.d.ts +27 -0
  260. package/dist/src/wiki/publish.js +265 -0
  261. package/dist/src/wiki/render.d.ts +20 -0
  262. package/dist/src/wiki/render.js +163 -0
  263. package/dist/src/wiki/transform.d.ts +7 -0
  264. package/dist/src/wiki/transform.js +264 -0
  265. package/dist/vendor/lat.md-server/cli.d.ts +2 -0
  266. package/dist/vendor/lat.md-server/cli.js +12 -0
  267. package/dist/vendor/lat.md-server/index.d.ts +38 -0
  268. package/dist/vendor/lat.md-server/index.js +128 -0
  269. package/package.json +68 -22
  270. package/plugins/lat-md/README.md +61 -0
  271. package/plugins/lat-md/hooks.json +38 -0
  272. package/plugins/lat-md/plugin.json +9 -0
  273. package/plugins/lat-md/rules/AGENTS.md +344 -0
  274. package/plugins/lat-md/skills/lat-md/SKILL.md +210 -0
  275. package/plugins/lat-md/skills/lat-md-conventions/SKILL.md +226 -0
  276. package/templates/AGENTS.md +26 -7
  277. package/templates/cursor-rules.md +23 -7
  278. package/templates/fork/conventions.md +133 -11
  279. package/templates/opencode-plugin.ts +9 -9
  280. package/templates/pi-extension.ts +11 -11
  281. package/templates/skill/SKILL.md +35 -3
  282. package/dist/src/cli/check-coverage.d.ts +0 -2
  283. package/dist/src/cli/check-coverage.js +0 -71
  284. package/dist/src/cli/check-frontmatter.d.ts +0 -12
  285. package/dist/src/cli/check-frontmatter.js +0 -44
  286. package/dist/src/cli/check-mode.d.ts +0 -21
  287. package/dist/src/cli/check-mode.js +0 -364
  288. package/dist/src/cli/check-status.d.ts +0 -74
  289. package/dist/src/cli/check-status.js +0 -217
  290. package/dist/src/cli/check.d.ts +0 -45
  291. package/dist/src/cli/check.js +0 -781
  292. package/dist/src/cli/context.d.ts +0 -11
  293. package/dist/src/cli/context.js +0 -58
  294. package/dist/src/cli/expand.d.ts +0 -8
  295. package/dist/src/cli/expand.js +0 -94
  296. package/dist/src/cli/gen-index.d.ts +0 -45
  297. package/dist/src/cli/gen-index.js +0 -235
  298. package/dist/src/cli/link-scheme.d.ts +0 -54
  299. package/dist/src/cli/link-scheme.js +0 -101
  300. package/dist/src/cli/locate.d.ts +0 -2
  301. package/dist/src/cli/locate.js +0 -17
  302. package/dist/src/cli/refs.d.ts +0 -22
  303. package/dist/src/cli/refs.js +0 -229
  304. package/dist/src/cli/section.d.ts +0 -43
  305. package/dist/src/cli/section.js +0 -252
  306. package/dist/src/cli/select-menu.d.ts +0 -13
  307. package/dist/src/cli/select-menu.js +0 -100
  308. package/dist/src/code-refs.d.ts +0 -17
  309. package/dist/src/code-refs.js +0 -298
  310. package/dist/src/config.d.ts +0 -29
  311. package/dist/src/config.js +0 -83
  312. package/dist/src/context.d.ts +0 -23
  313. package/dist/src/context.js +0 -11
  314. package/dist/src/extensions/wiki-link/from-markdown.d.ts +0 -5
  315. package/dist/src/extensions/wiki-link/from-markdown.js +0 -34
  316. package/dist/src/extensions/wiki-link/index.d.ts +0 -4
  317. package/dist/src/extensions/wiki-link/index.js +0 -3
  318. package/dist/src/extensions/wiki-link/syntax.d.ts +0 -14
  319. package/dist/src/extensions/wiki-link/syntax.js +0 -121
  320. package/dist/src/extensions/wiki-link/to-markdown.d.ts +0 -5
  321. package/dist/src/extensions/wiki-link/to-markdown.js +0 -28
  322. package/dist/src/extensions/wiki-link/types.d.ts +0 -34
  323. package/dist/src/format.d.ts +0 -8
  324. package/dist/src/format.js +0 -43
  325. package/dist/src/init-version.d.ts +0 -10
  326. package/dist/src/init-version.js +0 -49
  327. package/dist/src/lattice.d.ts +0 -109
  328. package/dist/src/lattice.js +0 -817
  329. package/dist/src/parser.d.ts +0 -3
  330. package/dist/src/parser.js +0 -18
  331. package/dist/src/source-parser.d.ts +0 -27
  332. package/dist/src/source-parser.js +0 -916
  333. package/dist/src/untrusted.d.ts +0 -18
  334. package/dist/src/untrusted.js +0 -93
  335. package/dist/src/view/client/assets/index-C3iaZyYT.css +0 -1
  336. package/dist/src/view/client/assets/index-KWi67IMz.js +0 -334
  337. package/dist/src/view/client/assets/logo-CNF8zs47.svg +0 -182
  338. package/dist/src/walk.d.ts +0 -18
  339. package/dist/src/walk.js +0 -27
  340. /package/dist/src/{extensions/wiki-link → search}/types.js +0 -0
@@ -0,0 +1,38 @@
1
+ {
2
+ "lat-md": {
3
+ "PreInvocation": [
4
+ {
5
+ "type": "command",
6
+ "command": "lat hook antigravity PreInvocation"
7
+ }
8
+ ],
9
+ "PreToolUse": [
10
+ {
11
+ "matcher": "replace_file_content|write_to_file",
12
+ "hooks": [
13
+ {
14
+ "type": "command",
15
+ "command": "lat hook antigravity PreToolUse"
16
+ }
17
+ ]
18
+ }
19
+ ],
20
+ "PostToolUse": [
21
+ {
22
+ "matcher": "replace_file_content|write_to_file",
23
+ "hooks": [
24
+ {
25
+ "type": "command",
26
+ "command": "lat hook antigravity PostToolUse"
27
+ }
28
+ ]
29
+ }
30
+ ],
31
+ "Stop": [
32
+ {
33
+ "type": "command",
34
+ "command": "lat hook antigravity Stop"
35
+ }
36
+ ]
37
+ }
38
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "lat-md",
3
+ "version": "0.12.3",
4
+ "description": "Grounds an agent in a project's lat.md/ knowledge graph deterministically: resolves [[refs]] and federates knowledge into prompts, blocks multi-line rationale comments before they reach source, regenerates directory indexes after edits, and blocks Stop on a failing lat check — including Diataxis mode validation.",
5
+ "author": {
6
+ "name": "PlebeianTech"
7
+ },
8
+ "keywords": ["documentation", "diataxis", "lat.md", "knowledge-graph"]
9
+ }
@@ -0,0 +1,344 @@
1
+ # Before starting work
2
+
3
+ Use Lat's knowledge graph to ground each task before changing code.
4
+
5
+ - Run `lat search` to find sections relevant to your task. Read them to understand the design intent before writing code.
6
+
7
+ # Post-task checklist (REQUIRED — do not skip)
8
+
9
+ After EVERY task, before responding to the user:
10
+
11
+ - [ ] Update `lat.md/` if you added or changed meaningful implemented functionality, architecture, tests, or behavior. Keep it a focused snapshot of the current implemented state, not a journal/changelog. Plans may be drafted in `lat.md/` alongside implementation, with the intent that by commit time they describe what was implemented. Otherwise, keep proposals, hypothetical designs, and future work outside `lat.md/` unless the user explicitly requests them there.
12
+ - [ ] Run `lat check` — all validations must pass
13
+ - [ ] Do not skip these steps. Do not consider your task done until both are complete.
14
+
15
+ ---
16
+
17
+ # What is lat.md?
18
+
19
+ Lat.md is the project's structured knowledge graph for architecture, design decisions, behavior, and tests.
20
+
21
+ The graph lives in `lat.md/` as cross-linked Markdown describing **what** the project does and **why**. Use it to ground work in actual architecture, and keep it a focused snapshot of the current implemented state rather than a journal or changelog.
22
+
23
+ Project-specific lat documentation belongs in `lat.md/`. Do not modify this generated instruction file or a generated `lat-md` `SKILL.md` to record project guidance: both are owned by lat tooling and may be replaced by a later `lat init`.
24
+
25
+ # Commands
26
+
27
+ Use these commands to navigate and validate the project knowledge graph.
28
+
29
+ ```bash
30
+ lat locate "Section Name" # find a section by name (exact, fuzzy)
31
+ lat refs "file#Section" # find what references a section
32
+ lat search "natural language" # semantic search across all sections
33
+ lat external show <handle> # inspect a pinned external source before cloning it
34
+ lat check # run full graph and documentation validation
35
+ ```
36
+
37
+ Run `lat --help` when in doubt about available commands or options.
38
+
39
+ If `lat search` fails because no API key is configured, explain to the user that semantic search requires a key provided via `LAT_LLM_KEY` (direct value), `LAT_LLM_KEY_FILE` (path to key file), or `LAT_LLM_KEY_HELPER` (command that prints the key). Supported key prefixes: `sk-...` (OpenAI) or `vck_...` (Vercel). If the user doesn't want to set it up, use `lat locate` for direct lookups instead.
40
+
41
+ # Syntax primer
42
+
43
+ Lat uses stable section ids, wiki links, source links, and code references to connect documentation with implementation.
44
+
45
+ - **Section ids**: `lat.md/path/to/file#Heading#SubHeading` — full form uses project-root-relative path (e.g. `lat.md/tests/search#RAG Replay Tests`). Short form uses bare file name when unique (e.g. `search#RAG Replay Tests`, `cli#search#Indexing`).
46
+ - **Wiki links**: `[[target]]` or `[[target|alias]]` — cross-references between sections. Can also reference repository paths or source code: `[[schema.sql]]`, `[[src/components]]`, `[[src/foo.ts#myFunction]]`.
47
+ - **Link specificity**: When documenting implemented behavior, prefer the narrowest relevant source-symbol link over a whole-file link. Use whole-file or directory links when discussing the module or resource as a whole, or when no supported symbol represents the target. If prose names a symbol, link that symbol directly.
48
+ - **Repository path links**: Wiki links without a `#` fragment may target any existing file or directory inside the project. Unsupported formats validate but cannot be opened by Lat; fragments require a `lat.md/` section or supported source file.
49
+ - **Source code links**: Wiki links in `lat.md/` files can reference functions, classes, constants, and methods in supported source files. Use the full path: `[[src/config.ts#getConfigDir]]`, `[[src/server.ts#App#listen]]` (class method), `[[lib/utils.py#parse_args]]`, `[[src/lib.rs#Greeter#greet]]` (Rust impl method), `[[src/app.go#Greeter#Greet]]` (Go method), `[[src/app.h#Greeter]]` (C struct). When prose names an implementation symbol or a behavior governed by one, link the symbol instead of using a bare code span or copying its literal value. Prefer `[[src/config.ts#DEFAULT_TIMEOUT]]` (or an aliased form) over a bare identifier or copied value. `lat check` validates these exist.
50
+ - **Code refs**: `// @lat: [[section-id]]` (JS/TS/Rust/Go/C/PHP) or `# @lat: [[section-id]]` (Python/PHP) — ties source code to concepts
51
+
52
+ # Diagrams
53
+
54
+ Default to prose. Reserve Mermaid diagrams for concepts involving more than seven interacting subjects (such as components, states, or stages) with complex sequencing, branching, or dependencies that prose alone makes hard to follow.
55
+
56
+ The subject count alone does not justify a diagram; omit diagrams for simple sequences or relationships that a short paragraph or list explains clearly. A diagram should give users and later agents an overview of the interactions.
57
+
58
+ Keep each diagram focused on one process, use readable labels, and explain the important decisions in surrounding prose with precise source-symbol links. Prefer a small overview or several focused diagrams over one dense diagram. Use fenced `mermaid` blocks and run `lat check` to validate syntax and readability.
59
+
60
+ # Test specs
61
+
62
+ Key tests can be described as sections in `lat.md/` files (e.g. `tests.md`). Add frontmatter to require that every leaf section is referenced by a `// @lat:` or `# @lat:` comment in test code:
63
+
64
+ ```markdown
65
+ ---
66
+ lat:
67
+ require-code-mention: true
68
+ ---
69
+ # Tests
70
+
71
+ Authentication and authorization test specifications.
72
+
73
+ ## User login
74
+
75
+ Verify credential validation and error handling for the login endpoint.
76
+
77
+ ### Rejects expired tokens
78
+ Tokens past their expiry timestamp are rejected with 401, even if otherwise valid.
79
+
80
+ ### Handles missing password
81
+ Login request without a password field returns 400 with a descriptive error.
82
+ ```
83
+
84
+ Every section MUST have a description — at least one sentence explaining what the test verifies and why. Empty sections with just a heading are not acceptable. (This is a specific case of the general leading paragraph rule below.)
85
+
86
+ Each test in code should reference its spec with exactly one comment placed next to the relevant test — not at the top of the file:
87
+
88
+ ```python
89
+ # @lat: [[tests#User login#Rejects expired tokens]]
90
+ def test_rejects_expired_tokens():
91
+ ...
92
+
93
+ # @lat: [[tests#User login#Handles missing password]]
94
+ def test_handles_missing_password():
95
+ ...
96
+ ```
97
+
98
+ Do not duplicate refs. One `@lat:` comment per spec section, placed at the test that covers it. `lat check` will flag any spec section not covered by a code reference, and any code reference pointing to a nonexistent section.
99
+
100
+ # Section structure
101
+
102
+ Concise opening paragraphs give every section a stable overview for validation and discovery.
103
+
104
+ Every section in `lat.md/` **must** have a leading paragraph — at least one sentence immediately after the heading, before any child headings or other block content. The first paragraph must be ≤250 characters (excluding `[[wiki link]]` content). This paragraph serves as the section's overview and is used in search results, command output, and RAG context — keeping it concise guarantees the section's essence is always captured.
105
+
106
+ ```markdown
107
+ # Good Section
108
+
109
+ Brief overview of what this section documents and why it matters.
110
+
111
+ More detail can go in subsequent paragraphs, code blocks, or lists.
112
+
113
+ ## Child heading
114
+
115
+ Details about this child topic.
116
+ ```
117
+
118
+ ```markdown
119
+ # Bad Section
120
+
121
+ ## Child heading
122
+
123
+ Details about this child topic.
124
+ ```
125
+
126
+ The second example is invalid because `Bad Section` has no leading paragraph. `lat check` validates this rule and reports errors for missing or overly long leading paragraphs.
127
+
128
+ # lat.md conventions this project enforces
129
+
130
+ `lat check` fails on the first three rules below. The last three it cannot see,
131
+ and they matter as much. None of the six are optional. This block is generated
132
+ and a later `lat init` replaces it: record project guidance in `lat.md/`, never
133
+ here.
134
+
135
+ ## Every document goes in a Diátaxis mode directory
136
+
137
+ A document belongs in exactly one of four subdirectories, and `lat check mode`
138
+ enforces one shape rule for each:
139
+
140
+ | Directory | Holds | Shape rule |
141
+ | --- | --- | --- |
142
+ | `lat.md/tutorials/` | a guided first pass for someone new | an ordered list of steps, and a stated outcome |
143
+ | `lat.md/how-to/` | a recipe for a task that recurs | an ordered list of steps |
144
+ | `lat.md/reference/` | lookup facts: fields, states, limits, names | no narrative prose (no second paragraph under a heading) |
145
+ | `lat.md/explanation/` | why the design is what it is | no imperative commands |
146
+
147
+ A document is classified either by the directory it sits in, or by declaring
148
+ the mode in its own frontmatter:
149
+
150
+ ```markdown
151
+ ---
152
+ lat:
153
+ mode: explanation
154
+ ---
155
+ ```
156
+
157
+ Both are enforced identically: `lat check mode` applies the shape rule to any
158
+ document that declares a mode, whether or not the root index carries
159
+ `require-mode: true`. That flag adds a separate rule: a document declaring *no*
160
+ mode, in no mode directory, becomes an error too.
161
+
162
+ Prefer the directory in a tree you own outright. Prefer the declaration when
163
+ the file cannot move, such as a document another project maintains or a tree
164
+ other agents are writing to while you work. Moving costs every reference to the
165
+ file; declaring costs nothing at read time, because frontmatter sits above the
166
+ first heading and outside every section.
167
+
168
+ **A document that fails its mode is usually two documents.** A file that lists
169
+ the states *and* argues for the design is mixed: the lookup half goes in
170
+ `reference/`, the reasoning half in `explanation/`, and each links the other.
171
+ Filing it under one mode and softening the prose until the check passes is the
172
+ wrong repair.
173
+
174
+ Classifying a mixed document does not make it pass. Narrative prose put under
175
+ `reference/` fails on contact, because a reference may not carry a second
176
+ paragraph under a heading, so a move is not a way to adopt the rule cheaply.
177
+ Split first, then place. And `explanation` is not the safe default: it bans
178
+ only imperative commands, so nearly any prose passes it. Declaring it is a
179
+ claim about the document, not somewhere to put whatever is left over. A
180
+ document you cannot honestly classify is better left undeclared than
181
+ mislabelled.
182
+
183
+ Classify before writing, not after. If a `diataxis` skill is available, use it.
184
+
185
+ ## Every project has at least one `@lat:` code ref
186
+
187
+ `lat check` fails a tree that has documents and no `@lat:` ref anywhere in the
188
+ codebase. A graph nothing points at cannot be reached from the code, which is
189
+ the only reason it exists.
190
+
191
+ Start at the application entrypoint (`config/application.rb`, `src/index.ts`,
192
+ `main.go`, `manage.py`, whatever a new reader opens first) and point it at the
193
+ root index:
194
+
195
+ ```ruby
196
+ # @lat: [[lat#Acme]]
197
+ module Acme
198
+ ```
199
+
200
+ Then one ref per section that source code actually implements, placed at that
201
+ code. Never in a block at the top of a file.
202
+
203
+ ### An `@lat:` pointer is exempt from this project's comment conventions
204
+
205
+ A repository that minimises, budgets, or forbids comments is right about prose
206
+ comments and does not reach this one. An `@lat:` line is a machine directive,
207
+ in the same class as `# frozen_string_literal:` or `// eslint-disable`. It
208
+ carries no rationale, asserts nothing a reader could dispute, and cannot rot
209
+ quietly: `lat check` fails the moment its target moves or disappears.
210
+
211
+ Add the ref. Then, if the reasoning that would have been a comment is worth
212
+ keeping, put it in a `lat.md/explanation/` section and let the pointer reach it.
213
+
214
+ ### The marker is a comment syntax, not a language allowlist
215
+
216
+ `//` for C-family languages; `#` for Ruby, Python, shell, Elixir, YAML, Make,
217
+ and everything else that comments with `#`. The scan is textual and walks every
218
+ non-markdown file in the project, so every language works.
219
+
220
+ Any list of example languages you find is a list of examples. Never conclude a
221
+ language is unsupported because it is absent from one. `lat check` prints what
222
+ it scanned:
223
+
224
+ ```
225
+ Scanned 41 .md, 622 .rb, 118 .tsx in 1.2s
226
+ ```
227
+
228
+ Read that line rather than guessing, and if you are still unsure, add one ref
229
+ and run the check. It costs one command.
230
+
231
+ (The tree-sitter grammars limit only `[[src/file.ts#symbol]]` wiki links, which
232
+ resolve a symbol inside source. `@lat:` refs point the other way and have no
233
+ such limit.)
234
+
235
+ ## Test specs are wired to their tests
236
+
237
+ A document describing tests declares it in frontmatter:
238
+
239
+ ```markdown
240
+ ---
241
+ lat:
242
+ require-code-mention: true
243
+ ---
244
+ ```
245
+
246
+ Every leaf section then needs exactly one `@lat:` comment at the test that
247
+ covers it, and every section needs at least one sentence saying what it
248
+ verifies and why. `lat check` reports any spec section no test claims, and any
249
+ ref pointing at no section.
250
+
251
+ ## One specialty per document
252
+
253
+ A document is **small**, **discrete**, and does **not conflict** with any
254
+ other. Those are three demands on the same thing: a reader must be able to
255
+ find the one place a fact is written down, and trust it.
256
+
257
+ **Small: a document covers one specialty.** Not one topic area; one
258
+ specialty. When a document covers two, it is two documents. Past roughly forty
259
+ sections it has almost certainly become several, and an agent then loads all of
260
+ it to reach one part.
261
+
262
+ **Discrete: each document covers its own specialty.** Before writing a new
263
+ document, search for the specialty first:
264
+
265
+ ```
266
+ lat search "the thing you are about to document"
267
+ ```
268
+
269
+ An overlap has two honest repairs, and picking neither is what produces the
270
+ third copy. Either the two are one document and belong merged, or the part they
271
+ share is its own document that both link. Deciding they are "mostly different"
272
+ and writing anyway is how the set rots.
273
+
274
+ **Does not conflict: two documents never say different things about the same
275
+ specialty.** Never restate a fact another document owns. Link to it with
276
+ `[[section]]`. A restatement is a second copy, a second copy drifts, and drift
277
+ is how document B ends up contradicting document A while both look maintained.
278
+
279
+ The mode rule above is the sharpest available test of "one specialty": a
280
+ document that fails its mode is usually two documents. Split it. Do not soften
281
+ the prose until the check passes.
282
+
283
+ ## Write in a tight Strunk & White voice
284
+
285
+ Diátaxis governs what a document is and where it sits. *The Elements of Style*
286
+ governs every sentence inside it. Preserve every fact and design constraint, and
287
+ make it land harder in fewer words. When in doubt, ask whether Strunk & White
288
+ would red-pen the line.
289
+
290
+ 1. **Omit needless words.** Every word must earn its place. Cut throat-clearing
291
+ ("What this module does is straightforward"). If it is straightforward, the
292
+ prose will show it.
293
+ 2. **Prefer the active voice.** Passive voice hides the actor and saps energy.
294
+ Name the module, function, or caller that acts ("`scanCodeRefs` walks every
295
+ source file", not "source files are walked").
296
+ 3. **Put statements in positive form.** Say what something is, not what it is
297
+ not ("The cache stores parsed ASTs in memory", not "The cache does not
298
+ persist across runs").
299
+ 4. **Be concrete, not corporate.** Replace abstractions with specifics. Name the
300
+ file, symbol, flag, or state instead of gesturing at "workflows",
301
+ "capabilities", or "alignment".
302
+ 5. **Brevity is courtesy.** Respect the reader's time and context window. A
303
+ tight sentence carries more weight than a padded paragraph.
304
+ 6. **Let confidence speak quietly.** Do not hedge or oversell. State what the
305
+ code does and what the design trades off. Cut qualifiers ("very",
306
+ "extremely") and exclamation marks.
307
+ 7. **One thought per sentence.** When a sentence tries to do two things, split
308
+ it so each thought lands.
309
+ 8. **Reason first, conclusion second.** When a sentence contains both a reason
310
+ and a claim, lead with the reason so the reader follows the logic instead of
311
+ being told the answer and then backfilled ("Most queries touch one section,
312
+ so `lat section` loads only that range" rather than "`lat section` loads only
313
+ that range as most queries touch one section").
314
+ 9. **Jargon is fine; obscurity is not.** Technical terms are precise when the
315
+ reader knows them. When introducing a project-specific term, define it in
316
+ plain words on first use.
317
+ 10. **Vary sentence rhythm.** Uniform sentence length sounds robotic. Mix short
318
+ sentences with longer ones that build through a clause or two. A short
319
+ sentence after two longer ones creates emphasis.
320
+ 11. **No em dashes and no horizontal rules.** Never use em dashes in prose;
321
+ they are an AI tell. Use a colon to introduce a list or elaboration, commas
322
+ or parentheses for an aside, and a period or semicolon between independent
323
+ thoughts. Never use horizontal rules (`---`, `***`, `___`) to separate
324
+ sections; use a blank line or a heading instead. (YAML frontmatter
325
+ delimiters remain `---`.)
326
+
327
+ ## Read sections, not files
328
+
329
+ `lat search` prints a section id and the exact lines that section occupies.
330
+ Resolve it with `lat section`, or read only that line range. Opening the whole
331
+ file is the reflex to break, and it is the expensive one:
332
+
333
+ ```
334
+ lat search "how does backend selection work"
335
+ lat section "cli#CLI#search#Backend selection"
336
+ ```
337
+
338
+ not a `read` of `lat.md/cli.md`. Measured on lat.md's own graph, the section
339
+ costs 4 KB against the file's 44 KB, eleven times the context for the same
340
+ answer, and the answer arrives buried in forty-one sections that were not
341
+ asked about.
342
+
343
+ Use `lat expand` on a prompt carrying `[[refs]]` for the same reason: it
344
+ resolves each ref to a location and a preview rather than to a file.
@@ -0,0 +1,210 @@
1
+ ---
2
+ name: lat-md
3
+ description: >-
4
+ Writing and maintaining lat.md documentation files — structured markdown that
5
+ describes a project's architecture, design decisions, and test specs. Use when
6
+ creating, editing, or reviewing files in the lat.md/ directory.
7
+ ---
8
+
9
+ # lat.md Authoring Guide
10
+
11
+ This skill covers the syntax, structure rules, and conventions for writing `lat.md/` files. Load it whenever you need to create or edit sections in the `lat.md/` directory.
12
+
13
+ Project-specific lat documentation belongs in `lat.md/`. Do not modify this generated skill or a generated `AGENTS.md` to record project guidance: both are owned by lat tooling and may be replaced by a later `lat init`.
14
+
15
+ ## What belongs in lat.md
16
+
17
+ `lat.md/` files describe **what** the project does and **why** — domain concepts, key design decisions, business logic, and test specifications. They do NOT duplicate source code. Think of each section as an anchor that source code references back to.
18
+
19
+ Treat `lat.md/` as a focused snapshot of the current implemented state. Plans may be drafted in `lat.md/` alongside implementation, with the intent that by commit time they describe what was implemented. Otherwise, keep proposals, hypothetical designs, and future work outside `lat.md/` unless the user explicitly requests them there. A planning-only task does not require a knowledge-graph update. Do not use it as a journal or changelog, and do not grow it just to record insignificant implementation details.
20
+
21
+ Good candidates for sections:
22
+ - Architecture decisions and their rationale
23
+ - Domain concepts and business rules
24
+ - API contracts and protocols
25
+ - Test specifications (what is tested and why)
26
+ - Non-obvious constraints or invariants
27
+
28
+ Bad candidates:
29
+ - Step-by-step code walkthroughs (the code itself is the walkthrough)
30
+ - Auto-generated API docs (use tools for that)
31
+ - Journal/changelog entries for each change
32
+ - Proposals, planned features, hypothetical designs, or promises of future behavior, unless explicitly requested by the user or drafted alongside implementation to describe implemented behavior by commit time
33
+ - Temporary notes or TODOs
34
+ - Insignificant implementation details that do not change the current-state model
35
+
36
+ ## Section structure
37
+
38
+ Every section **must** have a leading paragraph — at least one sentence immediately after the heading, before any child headings or other block content.
39
+
40
+ The first paragraph must be ≤250 characters (excluding `[[wiki link]]` content). This paragraph is the section's identity — it appears in search results, command output, and RAG context.
41
+
42
+ ```markdown
43
+ # Good Section
44
+
45
+ Brief overview of what this section documents and why it matters.
46
+
47
+ More detail can go in subsequent paragraphs, code blocks, or lists.
48
+
49
+ ## Child heading
50
+
51
+ Details about this child topic.
52
+ ```
53
+
54
+ ```markdown
55
+ # Bad Section
56
+
57
+ ## Child heading
58
+
59
+ This is invalid — "Bad Section" has no leading paragraph.
60
+ ```
61
+
62
+ `lat check` enforces this rule.
63
+
64
+ ## Diagrams
65
+
66
+ Default to prose. Reserve Mermaid diagrams for concepts involving more than seven interacting subjects (such as components, states, or stages) with complex sequencing, branching, or dependencies that prose alone makes hard to follow.
67
+
68
+ The subject count alone does not justify a diagram; omit diagrams for simple sequences or relationships that a short paragraph or list explains clearly. A diagram should give users and later agents an overview of the interactions.
69
+
70
+ Keep each diagram focused on one process, use readable labels, and explain the important decisions in surrounding prose with precise source-symbol links. Prefer a small overview or several focused diagrams over one dense diagram. Use fenced `mermaid` blocks and run `lat check` to validate syntax and readability.
71
+
72
+ ## Section IDs
73
+
74
+ Sections are addressed by file path and heading chain:
75
+
76
+ - **Full form**: `lat.md/path/to/file#Heading#SubHeading`
77
+ - **Short form**: `file#Heading#SubHeading` (when the file stem is unique)
78
+
79
+ Examples: `lat.md/tests/search#RAG Replay Tests`, `cli#init`, `parser#Wiki Links`.
80
+
81
+ Configured external sources use `[[handle:path/to/file.md#Heading]]` for
82
+ Markdown headings and `[[handle:path/to/file.ts#symbol]]` for supported code
83
+ symbols. Run `lat external show <handle>` before cloning an external source;
84
+ its output includes the pinned commit and safe checkout suggestions.
85
+
86
+ ## Wiki links
87
+
88
+ Cross-reference other sections or source code with `[[target]]` or `[[target|alias]]`.
89
+
90
+ When documenting implemented behavior, prefer the narrowest relevant source-symbol link over a whole-file link. Use whole-file or directory links when discussing the module or resource as a whole, or when no supported symbol represents the target. If prose names a symbol, link that symbol directly.
91
+
92
+ ### Section links
93
+
94
+ Section links connect related concepts while keeping their stable graph identities explicit.
95
+
96
+ ```markdown
97
+ See [[cli#init]] for setup details.
98
+ The parser validates [[parser#Wiki Links|wiki link syntax]].
99
+ ```
100
+
101
+ ### Repository path links
102
+
103
+ Reference any existing file or directory beneath the project root without a fragment:
104
+
105
+ ```markdown
106
+ [[schema.sql]]
107
+ [[CHANGELOG]]
108
+ [[src/components]]
109
+ ```
110
+
111
+ Unsupported formats validate as references but cannot be opened by Lat. A `#fragment` requires a `lat.md/` section or a supported source file.
112
+
113
+ ### Source code links
114
+
115
+ Reference functions, classes, constants, and methods in source files:
116
+
117
+ ```markdown
118
+ [[src/config.ts#getConfigDir]] — function
119
+ [[src/server.ts#App#listen]] — class method
120
+ [[lib/utils.py#parse_args]] — Python function
121
+ [[src/lib.rs#Greeter#greet]] — Rust impl method
122
+ [[src/app.go#Greeter#Greet]] — Go method
123
+ [[src/app.h#Greeter]] — C struct
124
+ ```
125
+
126
+ When prose names an implementation symbol or a behavior governed by one, link the symbol instead of using a bare code span or copying its literal value. Prefer `[[src/config.ts#DEFAULT_TIMEOUT]]` (or `[[src/config.ts#DEFAULT_TIMEOUT|the default timeout]]`) over a bare identifier or copied value. Keep the behavioral explanation in prose; the link makes its implementation binding navigable and validated.
127
+
128
+ `lat check` validates that all targets exist.
129
+
130
+ ## Code refs
131
+
132
+ Tie source code back to `lat.md/` sections with `@lat:` comments:
133
+
134
+ ```typescript
135
+ // @lat: [[cli#init]]
136
+ export function init() { ... }
137
+ ```
138
+
139
+ ```python
140
+ # @lat: [[cli#init]]
141
+ def init():
142
+ ...
143
+ ```
144
+
145
+ Supported comment styles: `//` (JS/TS/Rust/Go/C/PHP) and `#` (Python/PHP).
146
+
147
+ Place one `@lat:` comment per section, at the relevant code — not at the top of the file.
148
+
149
+ ## Test specs
150
+
151
+ Describe tests as sections in `lat.md/` files. Add frontmatter to require that every leaf section has a matching `@lat:` comment in test code:
152
+
153
+ ```markdown
154
+ ---
155
+ lat:
156
+ require-code-mention: true
157
+ ---
158
+ # Tests
159
+
160
+ Authentication test specifications.
161
+
162
+ ## User login
163
+
164
+ Verify credential validation and error handling.
165
+
166
+ ### Rejects expired tokens
167
+
168
+ Tokens past their expiry timestamp are rejected with 401, even if otherwise valid.
169
+
170
+ ### Handles missing password
171
+
172
+ Login request without a password field returns 400 with a descriptive error.
173
+ ```
174
+
175
+ Each test references its spec:
176
+
177
+ ```python
178
+ # @lat: [[tests#User login#Rejects expired tokens]]
179
+ def test_rejects_expired_tokens():
180
+ ...
181
+ ```
182
+
183
+ Rules:
184
+ - Every leaf section under `require-code-mention: true` must be referenced by exactly one `@lat:` comment
185
+ - Every section MUST have a description — at least one sentence explaining what the test verifies and why
186
+ - `lat check` flags unreferenced specs and dangling code refs
187
+
188
+ ## Frontmatter
189
+
190
+ Optional YAML frontmatter at the top of `lat.md/` files:
191
+
192
+ ```yaml
193
+ ---
194
+ lat:
195
+ require-code-mention: true
196
+ ---
197
+ ```
198
+
199
+ Currently the only supported field is `require-code-mention` for test spec enforcement.
200
+
201
+ ## Validation
202
+
203
+ Always run `lat check` after editing `lat.md/` files. It validates:
204
+ - All wiki links point to existing sections, repository paths, or source code symbols
205
+ - All relative markdown links point to existing files
206
+ - Full and collapsed reference-style links have definitions
207
+ - All `@lat:` code refs point to existing sections
208
+ - Every section has a leading paragraph (≤250 chars)
209
+ - All `require-code-mention` leaf sections are referenced in code
210
+ - Every `lat.md/` directory has an accurate index