@vpxa/kb 0.1.13 → 0.1.16

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 (490) hide show
  1. package/README.md +65 -12
  2. package/package.json +14 -7
  3. package/packages/analyzers/dist/blast-radius-analyzer.d.ts +17 -21
  4. package/packages/analyzers/dist/blast-radius-analyzer.js +5 -12
  5. package/packages/analyzers/dist/dependency-analyzer.d.ts +31 -28
  6. package/packages/analyzers/dist/dependency-analyzer.js +6 -9
  7. package/packages/analyzers/dist/diagram-generator.d.ts +12 -9
  8. package/packages/analyzers/dist/diagram-generator.js +2 -4
  9. package/packages/analyzers/dist/entry-point-analyzer.d.ts +39 -36
  10. package/packages/analyzers/dist/entry-point-analyzer.js +4 -6
  11. package/packages/analyzers/dist/index.d.ts +12 -14
  12. package/packages/analyzers/dist/index.js +1 -1
  13. package/packages/analyzers/dist/knowledge-producer.d.ts +34 -26
  14. package/packages/analyzers/dist/knowledge-producer.js +17 -15
  15. package/packages/analyzers/dist/pattern-analyzer.d.ts +14 -11
  16. package/packages/analyzers/dist/pattern-analyzer.js +2 -5
  17. package/packages/analyzers/dist/regex-call-graph.d.ts +6 -13
  18. package/packages/analyzers/dist/regex-call-graph.js +1 -1
  19. package/packages/analyzers/dist/structure-analyzer.d.ts +13 -10
  20. package/packages/analyzers/dist/structure-analyzer.js +2 -4
  21. package/packages/analyzers/dist/symbol-analyzer.d.ts +13 -9
  22. package/packages/analyzers/dist/symbol-analyzer.js +9 -13
  23. package/packages/analyzers/dist/ts-call-graph.d.ts +16 -14
  24. package/packages/analyzers/dist/ts-call-graph.js +1 -1
  25. package/packages/analyzers/dist/types.d.ts +82 -80
  26. package/packages/analyzers/dist/types.js +1 -0
  27. package/packages/chunker/dist/call-graph-extractor.d.ts +15 -12
  28. package/packages/chunker/dist/call-graph-extractor.js +1 -1
  29. package/packages/chunker/dist/chunker-factory.d.ts +16 -4
  30. package/packages/chunker/dist/chunker-factory.js +1 -1
  31. package/packages/chunker/dist/chunker.interface.d.ts +8 -5
  32. package/packages/chunker/dist/chunker.interface.js +1 -0
  33. package/packages/chunker/dist/code-chunker.d.ts +16 -13
  34. package/packages/chunker/dist/code-chunker.js +11 -14
  35. package/packages/chunker/dist/extractors/call-extractor.d.ts +24 -0
  36. package/packages/chunker/dist/extractors/call-extractor.js +1 -0
  37. package/packages/chunker/dist/extractors/entry-point-detector.d.ts +14 -0
  38. package/packages/chunker/dist/extractors/entry-point-detector.js +1 -0
  39. package/packages/chunker/dist/extractors/import-extractor.d.ts +14 -0
  40. package/packages/chunker/dist/extractors/import-extractor.js +1 -0
  41. package/packages/chunker/dist/extractors/pattern-detector.d.ts +14 -0
  42. package/packages/chunker/dist/extractors/pattern-detector.js +1 -0
  43. package/packages/chunker/dist/extractors/scope-resolver.d.ts +26 -0
  44. package/packages/chunker/dist/extractors/scope-resolver.js +1 -0
  45. package/packages/chunker/dist/extractors/symbol-extractor.d.ts +14 -0
  46. package/packages/chunker/dist/extractors/symbol-extractor.js +1 -0
  47. package/packages/chunker/dist/extractors/types.d.ts +36 -0
  48. package/packages/chunker/dist/extractors/types.js +1 -0
  49. package/packages/chunker/dist/generic-chunker.d.ts +14 -11
  50. package/packages/chunker/dist/generic-chunker.js +5 -5
  51. package/packages/chunker/dist/index.d.ts +19 -8
  52. package/packages/chunker/dist/index.js +1 -1
  53. package/packages/chunker/dist/markdown-chunker.d.ts +16 -13
  54. package/packages/chunker/dist/markdown-chunker.js +3 -10
  55. package/packages/chunker/dist/wasm/languages.d.ts +18 -0
  56. package/packages/chunker/dist/wasm/languages.js +1 -0
  57. package/packages/chunker/dist/wasm/query-executor.d.ts +70 -0
  58. package/packages/chunker/dist/wasm/query-executor.js +1 -0
  59. package/packages/chunker/dist/wasm/runtime.d.ts +44 -0
  60. package/packages/chunker/dist/wasm/runtime.js +1 -0
  61. package/packages/chunker/dist/wasm/types.d.ts +84 -0
  62. package/packages/chunker/dist/wasm/types.js +1 -0
  63. package/packages/chunker/dist/wasm-chunker.d.ts +23 -0
  64. package/packages/chunker/dist/wasm-chunker.js +6 -0
  65. package/packages/chunker/src/queries/go/calls.scm +11 -0
  66. package/packages/chunker/src/queries/go/entry-points.scm +20 -0
  67. package/packages/chunker/src/queries/go/imports.scm +6 -0
  68. package/packages/chunker/src/queries/go/patterns.scm +25 -0
  69. package/packages/chunker/src/queries/go/symbols.scm +26 -0
  70. package/packages/chunker/src/queries/java/calls.scm +10 -0
  71. package/packages/chunker/src/queries/java/entry-points.scm +27 -0
  72. package/packages/chunker/src/queries/java/imports.scm +11 -0
  73. package/packages/chunker/src/queries/java/patterns.scm +27 -0
  74. package/packages/chunker/src/queries/java/symbols.scm +28 -0
  75. package/packages/chunker/src/queries/javascript/calls.scm +21 -0
  76. package/packages/chunker/src/queries/javascript/entry-points.scm +31 -0
  77. package/packages/chunker/src/queries/javascript/imports.scm +32 -0
  78. package/packages/chunker/src/queries/javascript/patterns.scm +28 -0
  79. package/packages/chunker/src/queries/javascript/symbols.scm +52 -0
  80. package/packages/chunker/src/queries/python/calls.scm +11 -0
  81. package/packages/chunker/src/queries/python/entry-points.scm +21 -0
  82. package/packages/chunker/src/queries/python/imports.scm +14 -0
  83. package/packages/chunker/src/queries/python/patterns.scm +25 -0
  84. package/packages/chunker/src/queries/python/symbols.scm +17 -0
  85. package/packages/chunker/src/queries/rust/calls.scm +20 -0
  86. package/packages/chunker/src/queries/rust/entry-points.scm +7 -0
  87. package/packages/chunker/src/queries/rust/imports.scm +26 -0
  88. package/packages/chunker/src/queries/rust/patterns.scm +18 -0
  89. package/packages/chunker/src/queries/rust/symbols.scm +73 -0
  90. package/packages/chunker/src/queries/typescript/calls.scm +21 -0
  91. package/packages/chunker/src/queries/typescript/entry-points.scm +48 -0
  92. package/packages/chunker/src/queries/typescript/imports.scm +35 -0
  93. package/packages/chunker/src/queries/typescript/patterns.scm +47 -0
  94. package/packages/chunker/src/queries/typescript/symbols.scm +79 -0
  95. package/packages/chunker/wasm/tree-sitter-go.wasm +0 -0
  96. package/packages/chunker/wasm/tree-sitter-java.wasm +0 -0
  97. package/packages/chunker/wasm/tree-sitter-javascript.wasm +0 -0
  98. package/packages/chunker/wasm/tree-sitter-python.wasm +0 -0
  99. package/packages/chunker/wasm/tree-sitter-rust.wasm +0 -0
  100. package/packages/chunker/wasm/tree-sitter-typescript.wasm +0 -0
  101. package/packages/chunker/wasm/tree-sitter.wasm +0 -0
  102. package/packages/cli/dist/commands/analyze.d.ts +6 -3
  103. package/packages/cli/dist/commands/analyze.js +2 -3
  104. package/packages/cli/dist/commands/context-cmds.d.ts +6 -3
  105. package/packages/cli/dist/commands/context-cmds.js +1 -1
  106. package/packages/cli/dist/commands/environment.d.ts +6 -3
  107. package/packages/cli/dist/commands/environment.js +1 -2
  108. package/packages/cli/dist/commands/execution.d.ts +6 -3
  109. package/packages/cli/dist/commands/execution.js +1 -1
  110. package/packages/cli/dist/commands/graph.d.ts +6 -3
  111. package/packages/cli/dist/commands/graph.js +5 -6
  112. package/packages/cli/dist/commands/init/adapters.d.ts +28 -0
  113. package/packages/cli/dist/commands/init/adapters.js +1 -0
  114. package/packages/cli/dist/commands/init/config.d.ts +10 -0
  115. package/packages/cli/dist/commands/init/config.js +3 -0
  116. package/packages/cli/dist/commands/init/constants.d.ts +18 -0
  117. package/packages/cli/dist/commands/init/constants.js +1 -0
  118. package/packages/cli/dist/commands/init/curated.d.ts +7 -0
  119. package/packages/cli/dist/commands/init/curated.js +1 -0
  120. package/packages/cli/dist/commands/init/global.d.ts +34 -0
  121. package/packages/cli/dist/commands/init/global.js +5 -0
  122. package/packages/cli/dist/commands/init/index.d.ts +28 -0
  123. package/packages/cli/dist/commands/init/index.js +5 -0
  124. package/packages/cli/dist/commands/init/scaffold.d.ts +23 -0
  125. package/packages/cli/dist/commands/init/scaffold.js +1 -0
  126. package/packages/cli/dist/commands/init/templates.d.ts +9 -0
  127. package/packages/cli/dist/commands/init/templates.js +165 -0
  128. package/packages/cli/dist/commands/knowledge.d.ts +6 -3
  129. package/packages/cli/dist/commands/knowledge.js +1 -1
  130. package/packages/cli/dist/commands/search.d.ts +6 -3
  131. package/packages/cli/dist/commands/search.js +1 -8
  132. package/packages/cli/dist/commands/system.d.ts +6 -3
  133. package/packages/cli/dist/commands/system.js +4 -7
  134. package/packages/cli/dist/commands/workspace.d.ts +6 -3
  135. package/packages/cli/dist/commands/workspace.js +1 -2
  136. package/packages/cli/dist/context.d.ts +7 -5
  137. package/packages/cli/dist/context.js +1 -1
  138. package/packages/cli/dist/helpers.d.ts +51 -48
  139. package/packages/cli/dist/helpers.js +5 -5
  140. package/packages/cli/dist/index.d.ts +4 -2
  141. package/packages/cli/dist/index.js +2 -2
  142. package/packages/cli/dist/kb-init.d.ts +48 -51
  143. package/packages/cli/dist/kb-init.js +1 -1
  144. package/packages/cli/dist/types.d.ts +8 -6
  145. package/packages/cli/dist/types.js +1 -0
  146. package/packages/core/dist/constants.d.ts +58 -34
  147. package/packages/core/dist/constants.js +1 -1
  148. package/packages/core/dist/content-detector.d.ts +8 -8
  149. package/packages/core/dist/content-detector.js +1 -1
  150. package/packages/core/dist/errors.d.ts +15 -13
  151. package/packages/core/dist/errors.js +1 -1
  152. package/packages/core/dist/global-registry.d.ts +62 -0
  153. package/packages/core/dist/global-registry.js +1 -0
  154. package/packages/core/dist/index.d.ts +7 -6
  155. package/packages/core/dist/index.js +1 -1
  156. package/packages/core/dist/logger.d.ts +19 -8
  157. package/packages/core/dist/logger.js +1 -1
  158. package/packages/core/dist/types.d.ts +107 -92
  159. package/packages/core/dist/types.js +1 -0
  160. package/packages/embeddings/dist/embedder.interface.d.ts +22 -20
  161. package/packages/embeddings/dist/embedder.interface.js +1 -0
  162. package/packages/embeddings/dist/index.d.ts +3 -3
  163. package/packages/embeddings/dist/index.js +1 -1
  164. package/packages/embeddings/dist/onnx-embedder.d.ts +21 -23
  165. package/packages/embeddings/dist/onnx-embedder.js +1 -1
  166. package/packages/enterprise-bridge/dist/cache.d.ts +28 -0
  167. package/packages/enterprise-bridge/dist/cache.js +1 -0
  168. package/packages/enterprise-bridge/dist/er-client.d.ts +37 -0
  169. package/packages/enterprise-bridge/dist/er-client.js +1 -0
  170. package/packages/enterprise-bridge/dist/evolution-collector.d.ts +62 -0
  171. package/packages/enterprise-bridge/dist/evolution-collector.js +1 -0
  172. package/packages/enterprise-bridge/dist/index.d.ts +8 -0
  173. package/packages/enterprise-bridge/dist/index.js +1 -0
  174. package/packages/enterprise-bridge/dist/policy-store.d.ts +45 -0
  175. package/packages/enterprise-bridge/dist/policy-store.js +1 -0
  176. package/packages/enterprise-bridge/dist/push-adapter.d.ts +23 -0
  177. package/packages/enterprise-bridge/dist/push-adapter.js +1 -0
  178. package/packages/enterprise-bridge/dist/result-merger.d.ts +14 -0
  179. package/packages/enterprise-bridge/dist/result-merger.js +1 -0
  180. package/packages/enterprise-bridge/dist/types.d.ts +81 -0
  181. package/packages/enterprise-bridge/dist/types.js +1 -0
  182. package/packages/indexer/dist/file-hasher.d.ts +5 -3
  183. package/packages/indexer/dist/file-hasher.js +1 -1
  184. package/packages/indexer/dist/filesystem-crawler.d.ts +23 -21
  185. package/packages/indexer/dist/filesystem-crawler.js +1 -1
  186. package/packages/indexer/dist/graph-extractor.d.ts +9 -13
  187. package/packages/indexer/dist/graph-extractor.js +1 -1
  188. package/packages/indexer/dist/incremental-indexer.d.ts +49 -44
  189. package/packages/indexer/dist/incremental-indexer.js +1 -1
  190. package/packages/indexer/dist/index.d.ts +5 -5
  191. package/packages/indexer/dist/index.js +1 -1
  192. package/packages/server/dist/api.d.ts +3 -8
  193. package/packages/server/dist/api.js +1 -1
  194. package/packages/server/dist/config.d.ts +6 -3
  195. package/packages/server/dist/config.js +1 -1
  196. package/packages/server/dist/cross-workspace.d.ts +43 -0
  197. package/packages/server/dist/cross-workspace.js +1 -0
  198. package/packages/server/dist/curated-manager.d.ts +80 -78
  199. package/packages/server/dist/curated-manager.js +5 -10
  200. package/packages/server/dist/index.d.ts +1 -2
  201. package/packages/server/dist/index.js +1 -1
  202. package/packages/server/dist/replay-interceptor.d.ts +6 -7
  203. package/packages/server/dist/replay-interceptor.js +1 -1
  204. package/packages/server/dist/resources/resources.d.ts +7 -4
  205. package/packages/server/dist/resources/resources.js +2 -2
  206. package/packages/server/dist/server.d.ts +37 -25
  207. package/packages/server/dist/server.js +1 -1
  208. package/packages/server/dist/tools/analyze.tools.d.ts +14 -11
  209. package/packages/server/dist/tools/analyze.tools.js +1 -3
  210. package/packages/server/dist/tools/audit.tool.d.ts +8 -5
  211. package/packages/server/dist/tools/audit.tool.js +1 -4
  212. package/packages/server/dist/tools/bridge.tools.d.ts +34 -0
  213. package/packages/server/dist/tools/bridge.tools.js +15 -0
  214. package/packages/server/dist/tools/evolution.tools.d.ts +7 -0
  215. package/packages/server/dist/tools/evolution.tools.js +5 -0
  216. package/packages/server/dist/tools/forge.tools.d.ts +13 -12
  217. package/packages/server/dist/tools/forge.tools.js +10 -13
  218. package/packages/server/dist/tools/forget.tool.d.ts +7 -4
  219. package/packages/server/dist/tools/forget.tool.js +1 -7
  220. package/packages/server/dist/tools/graph.tool.d.ts +7 -4
  221. package/packages/server/dist/tools/graph.tool.js +4 -5
  222. package/packages/server/dist/tools/list.tool.d.ts +7 -4
  223. package/packages/server/dist/tools/list.tool.js +2 -8
  224. package/packages/server/dist/tools/lookup.tool.d.ts +7 -4
  225. package/packages/server/dist/tools/lookup.tool.js +2 -9
  226. package/packages/server/dist/tools/onboard.tool.d.ts +8 -5
  227. package/packages/server/dist/tools/onboard.tool.js +2 -2
  228. package/packages/server/dist/tools/policy.tools.d.ts +7 -0
  229. package/packages/server/dist/tools/policy.tools.js +2 -0
  230. package/packages/server/dist/tools/produce.tool.d.ts +6 -3
  231. package/packages/server/dist/tools/produce.tool.js +2 -2
  232. package/packages/server/dist/tools/read.tool.d.ts +7 -4
  233. package/packages/server/dist/tools/read.tool.js +2 -6
  234. package/packages/server/dist/tools/reindex.tool.d.ts +10 -7
  235. package/packages/server/dist/tools/reindex.tool.js +3 -2
  236. package/packages/server/dist/tools/remember.tool.d.ts +8 -4
  237. package/packages/server/dist/tools/remember.tool.js +3 -5
  238. package/packages/server/dist/tools/replay.tool.d.ts +6 -3
  239. package/packages/server/dist/tools/replay.tool.js +2 -6
  240. package/packages/server/dist/tools/search.tool.d.ts +10 -5
  241. package/packages/server/dist/tools/search.tool.js +6 -22
  242. package/packages/server/dist/tools/status.tool.d.ts +12 -4
  243. package/packages/server/dist/tools/status.tool.js +2 -3
  244. package/packages/server/dist/tools/toolkit.tools.d.ts +36 -35
  245. package/packages/server/dist/tools/toolkit.tools.js +20 -24
  246. package/packages/server/dist/tools/update.tool.d.ts +7 -4
  247. package/packages/server/dist/tools/update.tool.js +1 -6
  248. package/packages/server/dist/tools/utility.tools.d.ts +15 -15
  249. package/packages/server/dist/tools/utility.tools.js +10 -23
  250. package/packages/server/dist/version-check.d.ts +5 -2
  251. package/packages/server/dist/version-check.js +1 -1
  252. package/packages/store/dist/graph-store.interface.d.ts +89 -87
  253. package/packages/store/dist/graph-store.interface.js +1 -0
  254. package/packages/store/dist/index.d.ts +6 -6
  255. package/packages/store/dist/index.js +1 -1
  256. package/packages/store/dist/lance-store.d.ts +37 -31
  257. package/packages/store/dist/lance-store.js +1 -1
  258. package/packages/store/dist/sqlite-graph-store.d.ts +43 -47
  259. package/packages/store/dist/sqlite-graph-store.js +13 -13
  260. package/packages/store/dist/store-factory.d.ts +11 -8
  261. package/packages/store/dist/store-factory.js +1 -1
  262. package/packages/store/dist/store.interface.d.ts +47 -47
  263. package/packages/store/dist/store.interface.js +1 -0
  264. package/packages/tools/dist/audit.d.ts +61 -62
  265. package/packages/tools/dist/audit.js +4 -5
  266. package/packages/tools/dist/batch.d.ts +20 -18
  267. package/packages/tools/dist/batch.js +1 -1
  268. package/packages/tools/dist/changelog.d.ts +29 -27
  269. package/packages/tools/dist/changelog.js +2 -2
  270. package/packages/tools/dist/check.d.ts +42 -39
  271. package/packages/tools/dist/check.js +2 -2
  272. package/packages/tools/dist/checkpoint.d.ts +17 -15
  273. package/packages/tools/dist/checkpoint.js +1 -2
  274. package/packages/tools/dist/codemod.d.ts +35 -33
  275. package/packages/tools/dist/codemod.js +2 -2
  276. package/packages/tools/dist/compact.d.ts +34 -38
  277. package/packages/tools/dist/compact.js +2 -2
  278. package/packages/tools/dist/data-transform.d.ts +10 -8
  279. package/packages/tools/dist/data-transform.js +1 -1
  280. package/packages/tools/dist/dead-symbols.d.ts +29 -26
  281. package/packages/tools/dist/dead-symbols.js +2 -2
  282. package/packages/tools/dist/delegate.d.ts +26 -24
  283. package/packages/tools/dist/delegate.js +1 -5
  284. package/packages/tools/dist/diff-parse.d.ts +24 -22
  285. package/packages/tools/dist/diff-parse.js +3 -3
  286. package/packages/tools/dist/digest.d.ts +43 -46
  287. package/packages/tools/dist/digest.js +4 -5
  288. package/packages/tools/dist/dogfood-log.d.ts +49 -0
  289. package/packages/tools/dist/dogfood-log.js +2 -0
  290. package/packages/tools/dist/encode.d.ts +11 -9
  291. package/packages/tools/dist/encode.js +1 -1
  292. package/packages/tools/dist/env-info.d.ts +25 -23
  293. package/packages/tools/dist/env-info.js +1 -1
  294. package/packages/tools/dist/eval.d.ts +13 -11
  295. package/packages/tools/dist/eval.js +2 -3
  296. package/packages/tools/dist/evidence-map.d.ts +64 -62
  297. package/packages/tools/dist/evidence-map.js +2 -3
  298. package/packages/tools/dist/file-cache.d.ts +41 -0
  299. package/packages/tools/dist/file-cache.js +3 -0
  300. package/packages/tools/dist/file-summary.d.ts +50 -30
  301. package/packages/tools/dist/file-summary.js +2 -2
  302. package/packages/tools/dist/file-walk.d.ts +6 -4
  303. package/packages/tools/dist/file-walk.js +1 -1
  304. package/packages/tools/dist/find-examples.d.ts +26 -22
  305. package/packages/tools/dist/find-examples.js +3 -3
  306. package/packages/tools/dist/find.d.ts +39 -41
  307. package/packages/tools/dist/find.js +1 -1
  308. package/packages/tools/dist/forge-classify.d.ts +35 -39
  309. package/packages/tools/dist/forge-classify.js +2 -2
  310. package/packages/tools/dist/forge-ground.d.ts +58 -61
  311. package/packages/tools/dist/forge-ground.js +1 -1
  312. package/packages/tools/dist/git-context.d.ts +22 -20
  313. package/packages/tools/dist/git-context.js +3 -3
  314. package/packages/tools/dist/graph-query.d.ts +75 -79
  315. package/packages/tools/dist/graph-query.js +1 -1
  316. package/packages/tools/dist/guide.d.ts +14 -12
  317. package/packages/tools/dist/guide.js +1 -1
  318. package/packages/tools/dist/health.d.ts +13 -11
  319. package/packages/tools/dist/health.js +2 -2
  320. package/packages/tools/dist/http-request.d.ts +20 -18
  321. package/packages/tools/dist/http-request.js +1 -1
  322. package/packages/tools/dist/index.d.ts +55 -53
  323. package/packages/tools/dist/index.js +1 -1
  324. package/packages/tools/dist/lane.d.ts +28 -26
  325. package/packages/tools/dist/lane.js +6 -7
  326. package/packages/tools/dist/measure.d.ts +34 -30
  327. package/packages/tools/dist/measure.js +2 -2
  328. package/packages/tools/dist/onboard.d.ts +29 -27
  329. package/packages/tools/dist/onboard.js +17 -41
  330. package/packages/tools/dist/parse-output.d.ts +48 -46
  331. package/packages/tools/dist/parse-output.js +2 -2
  332. package/packages/tools/dist/path-resolver.d.ts +4 -2
  333. package/packages/tools/dist/path-resolver.js +1 -1
  334. package/packages/tools/dist/process-manager.d.ts +18 -16
  335. package/packages/tools/dist/process-manager.js +1 -1
  336. package/packages/tools/dist/queue.d.ts +28 -26
  337. package/packages/tools/dist/queue.js +1 -2
  338. package/packages/tools/dist/regex-test.d.ts +26 -24
  339. package/packages/tools/dist/regex-test.js +1 -1
  340. package/packages/tools/dist/rename.d.ts +28 -26
  341. package/packages/tools/dist/rename.js +2 -2
  342. package/packages/tools/dist/replay.d.ts +33 -31
  343. package/packages/tools/dist/replay.js +4 -6
  344. package/packages/tools/dist/response-envelope.d.ts +32 -30
  345. package/packages/tools/dist/response-envelope.js +1 -1
  346. package/packages/tools/dist/schema-validate.d.ts +15 -13
  347. package/packages/tools/dist/schema-validate.js +1 -1
  348. package/packages/tools/dist/scope-map.d.ts +45 -48
  349. package/packages/tools/dist/scope-map.js +1 -1
  350. package/packages/tools/dist/snippet.d.ts +26 -25
  351. package/packages/tools/dist/snippet.js +1 -1
  352. package/packages/tools/dist/stash.d.ts +13 -11
  353. package/packages/tools/dist/stash.js +1 -2
  354. package/packages/tools/dist/stratum-card.d.ts +27 -28
  355. package/packages/tools/dist/stratum-card.js +3 -5
  356. package/packages/tools/dist/symbol.d.ts +31 -26
  357. package/packages/tools/dist/symbol.js +3 -3
  358. package/packages/tools/dist/test-run.d.ts +19 -16
  359. package/packages/tools/dist/test-run.js +2 -2
  360. package/packages/tools/dist/text-utils.d.ts +6 -4
  361. package/packages/tools/dist/text-utils.js +2 -2
  362. package/packages/tools/dist/time-utils.d.ts +15 -13
  363. package/packages/tools/dist/time-utils.js +1 -1
  364. package/packages/tools/dist/trace.d.ts +26 -21
  365. package/packages/tools/dist/trace.js +2 -2
  366. package/packages/tools/dist/truncation.d.ts +6 -4
  367. package/packages/tools/dist/truncation.js +6 -13
  368. package/packages/tools/dist/watch.d.ts +28 -26
  369. package/packages/tools/dist/watch.js +1 -1
  370. package/packages/tools/dist/web-fetch.d.ts +35 -33
  371. package/packages/tools/dist/web-fetch.js +6 -12
  372. package/packages/tools/dist/web-search.d.ts +16 -14
  373. package/packages/tools/dist/web-search.js +1 -1
  374. package/packages/tools/dist/workset.d.ts +19 -17
  375. package/packages/tools/dist/workset.js +1 -2
  376. package/packages/tui/dist/App-CYLNJLr6.js +2 -0
  377. package/packages/tui/dist/App.d.ts +11 -6
  378. package/packages/tui/dist/App.js +1 -450
  379. package/packages/tui/dist/CuratedPanel-sYdZAICX.js +2 -0
  380. package/packages/tui/dist/LogPanel-DtMnoyXT.js +3 -0
  381. package/packages/tui/dist/SearchPanel-DREo6zgt.js +2 -0
  382. package/packages/tui/dist/StatusPanel-2ex8fLOO.js +2 -0
  383. package/packages/tui/dist/chunk-D6axbAb-.js +2 -0
  384. package/packages/tui/dist/devtools-DUyj952l.js +7 -0
  385. package/packages/tui/dist/embedder.interface-D4ew0HPW.d.ts +28 -0
  386. package/packages/tui/dist/index-B9VpfVPP.d.ts +13 -0
  387. package/packages/tui/dist/index.d.ts +3 -19
  388. package/packages/tui/dist/index.js +1 -476
  389. package/packages/tui/dist/jsx-runtime-Cof-kwFn.js +316 -0
  390. package/packages/tui/dist/panels/CuratedPanel.d.ts +11 -6
  391. package/packages/tui/dist/panels/CuratedPanel.js +1 -371
  392. package/packages/tui/dist/panels/LogPanel.d.ts +7 -3
  393. package/packages/tui/dist/panels/LogPanel.js +1 -449
  394. package/packages/tui/dist/panels/SearchPanel.d.ts +14 -8
  395. package/packages/tui/dist/panels/SearchPanel.js +1 -372
  396. package/packages/tui/dist/panels/StatusPanel.d.ts +11 -6
  397. package/packages/tui/dist/panels/StatusPanel.js +1 -371
  398. package/packages/tui/dist/store.interface-CnY6SPOH.d.ts +150 -0
  399. package/scaffold/adapters/claude-code.mjs +20 -0
  400. package/scaffold/adapters/copilot.mjs +320 -0
  401. package/scaffold/copilot/agents/Architect-Reviewer-Alpha.agent.md +21 -0
  402. package/scaffold/copilot/agents/Architect-Reviewer-Beta.agent.md +21 -0
  403. package/scaffold/copilot/agents/Documenter.agent.md +42 -0
  404. package/scaffold/copilot/agents/Orchestrator.agent.md +104 -0
  405. package/scaffold/copilot/agents/Planner.agent.md +54 -0
  406. package/scaffold/copilot/agents/Refactor.agent.md +36 -0
  407. package/scaffold/copilot/agents/Researcher-Alpha.agent.md +20 -0
  408. package/scaffold/copilot/agents/Researcher-Beta.agent.md +20 -0
  409. package/scaffold/copilot/agents/Researcher-Delta.agent.md +20 -0
  410. package/scaffold/copilot/agents/Researcher-Gamma.agent.md +20 -0
  411. package/scaffold/definitions/agents.mjs +165 -0
  412. package/scaffold/definitions/bodies.mjs +292 -0
  413. package/scaffold/definitions/hooks.mjs +43 -0
  414. package/scaffold/definitions/models.mjs +56 -0
  415. package/scaffold/definitions/plugins.mjs +24 -0
  416. package/scaffold/definitions/prompts.mjs +145 -0
  417. package/scaffold/definitions/protocols.mjs +322 -0
  418. package/scaffold/definitions/tools.mjs +176 -0
  419. package/scaffold/general/agents/Architect-Reviewer-Alpha.agent.md +21 -0
  420. package/scaffold/general/agents/Architect-Reviewer-Beta.agent.md +21 -0
  421. package/scaffold/general/agents/Code-Reviewer-Alpha.agent.md +12 -0
  422. package/scaffold/general/agents/Code-Reviewer-Beta.agent.md +12 -0
  423. package/scaffold/general/agents/Debugger.agent.md +31 -0
  424. package/scaffold/general/agents/Documenter.agent.md +42 -0
  425. package/scaffold/general/agents/Explorer.agent.md +50 -0
  426. package/scaffold/general/agents/Frontend.agent.md +29 -0
  427. package/scaffold/general/agents/Implementer.agent.md +31 -0
  428. package/scaffold/general/agents/Orchestrator.agent.md +104 -0
  429. package/scaffold/general/agents/Planner.agent.md +55 -0
  430. package/scaffold/general/agents/README.md +57 -0
  431. package/scaffold/general/agents/Refactor.agent.md +36 -0
  432. package/scaffold/general/agents/Researcher-Alpha.agent.md +20 -0
  433. package/scaffold/general/agents/Researcher-Beta.agent.md +20 -0
  434. package/scaffold/general/agents/Researcher-Delta.agent.md +20 -0
  435. package/scaffold/general/agents/Researcher-Gamma.agent.md +20 -0
  436. package/scaffold/general/agents/Security.agent.md +42 -0
  437. package/scaffold/general/agents/_shared/adr-protocol.md +91 -0
  438. package/scaffold/general/agents/_shared/architect-reviewer-base.md +50 -0
  439. package/scaffold/general/agents/_shared/code-agent-base.md +88 -0
  440. package/scaffold/general/agents/_shared/code-reviewer-base.md +54 -0
  441. package/scaffold/general/agents/_shared/decision-protocol.md +27 -0
  442. package/scaffold/general/agents/_shared/forge-protocol.md +46 -0
  443. package/scaffold/general/agents/_shared/researcher-base.md +61 -0
  444. package/scaffold/general/agents/templates/adr-template.md +27 -0
  445. package/scaffold/general/agents/templates/execution-state.md +25 -0
  446. package/scaffold/general/prompts/ask.prompt.md +20 -0
  447. package/scaffold/general/prompts/debug.prompt.md +25 -0
  448. package/scaffold/general/prompts/design.prompt.md +22 -0
  449. package/scaffold/general/prompts/implement.prompt.md +26 -0
  450. package/scaffold/general/prompts/plan.prompt.md +24 -0
  451. package/scaffold/general/prompts/review.prompt.md +31 -0
  452. package/scaffold/generate.mjs +74 -0
  453. package/skills/adr-skill/SKILL.md +329 -0
  454. package/skills/adr-skill/assets/templates/adr-madr.md +89 -0
  455. package/skills/adr-skill/assets/templates/adr-readme.md +20 -0
  456. package/skills/adr-skill/assets/templates/adr-simple.md +46 -0
  457. package/skills/adr-skill/references/adr-conventions.md +95 -0
  458. package/skills/adr-skill/references/examples.md +193 -0
  459. package/skills/adr-skill/references/review-checklist.md +77 -0
  460. package/skills/adr-skill/references/template-variants.md +52 -0
  461. package/skills/adr-skill/scripts/bootstrap_adr.js +259 -0
  462. package/skills/adr-skill/scripts/new_adr.js +391 -0
  463. package/skills/adr-skill/scripts/set_adr_status.js +169 -0
  464. package/skills/brainstorming/SKILL.md +259 -0
  465. package/skills/brainstorming/scripts/frame-template.html +365 -0
  466. package/skills/brainstorming/scripts/helper.js +216 -0
  467. package/skills/brainstorming/scripts/server.cjs +9 -0
  468. package/skills/brainstorming/scripts/server.src.cjs +249 -0
  469. package/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
  470. package/skills/brainstorming/visual-companion.md +430 -0
  471. package/skills/c4-architecture/SKILL.md +295 -0
  472. package/skills/c4-architecture/references/advanced-patterns.md +552 -0
  473. package/skills/c4-architecture/references/c4-syntax.md +492 -0
  474. package/skills/c4-architecture/references/common-mistakes.md +437 -0
  475. package/skills/knowledge-base/SKILL.md +100 -10
  476. package/skills/lesson-learned/SKILL.md +105 -0
  477. package/skills/lesson-learned/references/anti-patterns.md +55 -0
  478. package/skills/lesson-learned/references/se-principles.md +109 -0
  479. package/skills/requirements-clarity/SKILL.md +324 -0
  480. package/skills/session-handoff/SKILL.md +189 -0
  481. package/skills/session-handoff/references/handoff-template.md +139 -0
  482. package/skills/session-handoff/references/resume-checklist.md +80 -0
  483. package/skills/session-handoff/scripts/check_staleness.js +269 -0
  484. package/skills/session-handoff/scripts/create_handoff.js +299 -0
  485. package/skills/session-handoff/scripts/list_handoffs.js +113 -0
  486. package/skills/session-handoff/scripts/validate_handoff.js +241 -0
  487. package/packages/chunker/dist/treesitter-chunker.d.ts +0 -47
  488. package/packages/chunker/dist/treesitter-chunker.js +0 -8
  489. package/packages/cli/dist/commands/init.d.ts +0 -10
  490. package/packages/cli/dist/commands/init.js +0 -308
@@ -1,8 +0,0 @@
1
- import{extname as m}from"node:path";import{CHUNK_SIZES as k}from"../../core/dist/index.js";import{CodeChunker as y}from"./code-chunker.js";const f={".ts":{package:"tree-sitter-typescript",subLanguage:"typescript"},".tsx":{package:"tree-sitter-typescript",subLanguage:"tsx"},".mts":{package:"tree-sitter-typescript",subLanguage:"typescript"},".cts":{package:"tree-sitter-typescript",subLanguage:"typescript"},".js":{package:"tree-sitter-javascript"},".jsx":{package:"tree-sitter-javascript"},".mjs":{package:"tree-sitter-javascript"},".cjs":{package:"tree-sitter-javascript"},".py":{package:"tree-sitter-python"},".go":{package:"tree-sitter-go"},".rs":{package:"tree-sitter-rust"},".java":{package:"tree-sitter-java"}},x=new Set(["function_declaration","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","lexical_declaration","export_statement","variable_declaration","abstract_class_declaration","function_definition","class_definition","decorated_definition","function_declaration","method_declaration","type_declaration","function_item","impl_item","struct_item","enum_item","trait_item","mod_item","type_item","class_declaration","interface_declaration","method_declaration","enum_declaration"]);class u{static instance=null;parser=null;languages=new Map;static async initialize(){if(u.instance)return u.instance;const t=new u;return await t.init()?(u.instance=t,t):null}static get(){return u.instance}async init(){try{const t=await import("tree-sitter"),r=t.default??t;this.parser=new r;for(const[c,s]of Object.entries(f))try{const o=await import(s.package),e=o.default??o,n=s.subLanguage?e[s.subLanguage]:e;n&&this.languages.set(c,n)}catch{}const i=this.languages.size>0;return i&&console.error(`[KB] Tree-sitter initialized with ${this.languages.size} languages: ${[...this.languages.keys()].join(", ")}`),i}catch{return!1}}parse(t,r){const i=this.languages.get(r);return i?(this.parser.setLanguage(i),this.parser.parse(t)):null}hasLanguage(t){return this.languages.has(t)}}async function w(){return await u.initialize()!==null}class L{maxChunkSize;runtime;regexFallback;constructor(t,r){this.runtime=t,this.maxChunkSize=r?.maxChunkSize??k.code.max,this.regexFallback=new y(r)}chunk(t,r){const i=m(r.sourcePath).toLowerCase(),c=this.runtime.parse(t,i);if(!c)return this.regexFallback.chunk(t,r);try{return this.chunkFromAst(c,t,r)}catch{return this.regexFallback.chunk(t,r)}}chunkFromAst(t,r,i){const c=t.rootNode,s=[],o=[];for(let e=0;e<c.childCount;e++){const n=c.child(e);if(n&&x.has(n.type)){let h=n.startPosition?n.startIndex:n.startByte??0,l=n.startPosition?.row??0,a=n.previousSibling;for(;a&&(a.type==="comment"||a.type==="line_comment"||a.type==="block_comment"||a.type==="decorator");)h=a.startIndex??a.startByte??h,l=a.startPosition?.row??l,a=a.previousSibling;o.push({startByte:h,endByte:n.endIndex??n.endByte??r.length,startRow:l,endRow:n.endPosition?.row??r.split(`
2
- `).length-1})}}if(o.length===0)return this.regexFallback.chunk(r,i);if(o[0].startByte>0){const e=r.slice(0,o[0].startByte).trim();e.length>0&&s.push({text:`// File: ${i.sourcePath}
3
- ${e}`,sourcePath:i.sourcePath,contentType:i.contentType,chunkIndex:0,totalChunks:0,startLine:1,endLine:o[0].startRow+1})}for(const e of o){let n=r.slice(e.startByte,e.endByte).trim();if(n=`// File: ${i.sourcePath}
4
- `+n,n.length>this.maxChunkSize){const l=this.splitByLines(n,this.maxChunkSize);let a=e.startRow+1;for(const p of l){const g=p.split(`
5
- `).length;s.push({text:p,sourcePath:i.sourcePath,contentType:i.contentType,chunkIndex:s.length,totalChunks:0,startLine:a,endLine:a+g-1}),a+=g}}else s.push({text:n,sourcePath:i.sourcePath,contentType:i.contentType,chunkIndex:s.length,totalChunks:0,startLine:e.startRow+1,endLine:e.endRow+1})}return s.map((e,n)=>({...e,chunkIndex:n,totalChunks:s.length}))}splitByLines(t,r){const i=t.split(`
6
- `),c=[];let s=[],o=0;for(const e of i)o+e.length+1>r&&s.length>0?(c.push(s.join(`
7
- `)),s=[e],o=e.length):(s.push(e),o+=e.length+1);return s.length>0&&c.push(s.join(`
8
- `)),c}}export{L as TreeSitterChunker,u as TreeSitterRuntime,w as initializeTreeSitter};
@@ -1,10 +0,0 @@
1
- /**
2
- * `kb init` — scaffold a knowledge base in the current directory.
3
- * Creates kb.config.json, .gitignore entry, optional IDE config,
4
- * agent instruction files (.github/copilot-instructions.md, AGENTS.md),
5
- * and skills/knowledge-base/SKILL.md.
6
- */
7
- export declare function initProject(options: {
8
- force: boolean;
9
- }): Promise<void>;
10
- //# sourceMappingURL=init.d.ts.map
@@ -1,308 +0,0 @@
1
- import{appendFileSync as h,copyFileSync as y,existsSync as t,mkdirSync as n,readFileSync as v,writeFileSync as r}from"node:fs";import{basename as w,dirname as S,resolve as e}from"node:path";import{fileURLToPath as x}from"node:url";const C={sources:[{path:".",excludePatterns:["**/node_modules/**","**/dist/**","**/build/**","**/.git/**","**/.kb-data/**","**/coverage/**","**/*.min.js","**/package-lock.json","**/pnpm-lock.yaml"]}],indexing:{chunkSize:1500,chunkOverlap:200,minChunkSize:100},embedding:{model:"mixedbread-ai/mxbai-embed-large-v1",dimensions:1024},store:{backend:"lancedb",path:".kb-data/lance"},curated:{path:"curated"}};function A(o){return{servers:{[`${o}-kb`]:{type:"stdio",command:"npx",args:["@vpxa/kb","serve"]}}}}function T(o){return`# ${o} \u2014 Copilot Instructions
2
-
3
- This project uses **@vpxa/kb** as an MCP knowledge base server. The KB provides search, context compression, persistent memory, and validation tools that **MUST** be used to maintain quality and performance.
4
-
5
- ## Mandatory Rules
6
-
7
- ### 1. ALWAYS search before acting
8
- Before writing or modifying code, you MUST recall prior decisions and understand the affected area:
9
- \`\`\`
10
- kb_search({ query: "<task keywords>" })
11
- kb_scope_map({ task: "<what you are doing>" })
12
- \`\`\`
13
-
14
- ### 2. ALWAYS compress context before reading large files
15
- Do NOT read entire files into context. Use these tools to reduce tokens and focus on what matters:
16
-
17
- | Situation | Tool | Why |
18
- |-----------|------|-----|
19
- | Need relevant sections of a large file | \`kb_compact\` | Extracts only semantically relevant chunks \u2014 5-20x reduction |
20
- | Need to summarize multiple sources | \`kb_digest\` | Compresses multiple text blocks into a token-budgeted summary |
21
- | Need a quick structural overview of a file | \`kb_file_summary\` | Returns exports, imports, functions without reading the full file |
22
- | Need a reusable context card | \`kb_stratum_card\` | Generates T1/T2 cards \u2014 10-100x token reduction |
23
-
24
- **Example \u2014 reading a 400-line file:**
25
- \`\`\`
26
- # BAD: read_file entire file (wastes ~3000 tokens)
27
- # GOOD: get structure first, then compact only what you need
28
- kb_file_summary({ path: "src/http-client.ts" })
29
- kb_compact({ path: "src/http-client.ts", query: "retry logic" })
30
- \`\`\`
31
-
32
- ### 3. ALWAYS use persistent memory
33
- - **Start of session**: Read prior knowledge with \`kb_list()\` and \`kb_search({ query: "SESSION CHECKPOINT", origin: "curated" })\`
34
- - **During session**: Use \`kb_stash\` for temporary working data, \`kb_checkpoint\` to save progress
35
- - **End of session**: MUST call \`kb_remember\` to persist decisions, patterns, and lessons learned
36
- - **Before proposing a new approach**: MUST \`kb_search\` to check if a decision already exists
37
-
38
- | Tool | When | Persistence |
39
- |------|------|-------------|
40
- | \`kb_stash\` | Temporary data within a session (intermediate results, scratch notes) | Session only |
41
- | \`kb_checkpoint\` | Save/restore session progress (resumable work) | Session only |
42
- | \`kb_remember\` | Architecture decisions, conventions, patterns, troubleshooting | Permanent (survives reindex) |
43
-
44
- ### 4. ALWAYS validate before committing
45
- \`\`\`
46
- kb_check({}) # Typecheck + lint (returns summary by default)
47
- kb_test_run({}) # Run tests
48
- kb_blast_radius({ changed_files: ["..."] }) # Impact analysis
49
- kb_audit({}) # Unified project audit with score and recommendations
50
- \`\`\`
51
-
52
- ### 5. Use FORGE for complex tasks
53
- For tasks involving multiple files or architectural decisions:
54
- \`\`\`
55
- kb_forge_classify({ task: "<description>" }) # Classify complexity tier
56
- kb_forge_ground({ task: "<description>" }) # Full analysis: scope + constraints + evidence
57
- kb_evidence_map({ claims: [...] }) # Track verified vs assumed claims
58
- \`\`\`
59
-
60
- ## Quick Workflow
61
-
62
- \`\`\`
63
- # 1. Orient
64
- kb_search({ query: "task keywords" })
65
- kb_scope_map({ task: "what you are doing" })
66
-
67
- # 2. Read efficiently (NEVER raw-read large files)
68
- kb_file_summary({ path: "relevant-file.ts" })
69
- kb_compact({ path: "relevant-file.ts", query: "specific concern" })
70
-
71
- # 3. Do the work
72
-
73
- # 4. Validate
74
- kb_check({})
75
- kb_test_run({})
76
-
77
- # 5. Persist
78
- kb_remember({ title: "What I learned", content: "...", category: "decisions" })
79
- \`\`\`
80
-
81
- ## Context Budget Rules
82
-
83
- - **Prefer \`kb_file_summary\` over \`read_file\`** for understanding file structure
84
- - **Prefer \`kb_compact\` over full file reads** when you need specific sections (use \`path\` param to avoid read_file round-trip)
85
- - **Prefer \`kb_search\` over \`grep_search\`** for semantic/conceptual queries
86
- - **Prefer \`kb_symbol\` over manual grep** for finding definitions and references
87
- - **Use \`kb_digest\`** when combining information from 3+ sources
88
- - **Use \`kb_stratum_card\`** to create reusable compressed context for repeated reference
89
- `}function P(o){return`# ${o} \u2014 Agent Instructions
90
-
91
- ## KB Knowledge Base
92
-
93
- This project has a **@vpxa/kb** MCP server providing search, analysis, memory, and developer tools.
94
-
95
- ### Skills Reference
96
-
97
- | Context | Skill | Details |
98
- |---------|-------|---------|
99
- | KB search, analysis, memory | \`kb\` | See [skills/knowledge-base/SKILL.md](skills/knowledge-base/SKILL.md) or run \`kb_status({})\` |
100
-
101
- ### Available Tool Categories
102
-
103
- | Category | Tools | Purpose |
104
- |----------|-------|---------|
105
- | Search & Discovery | \`kb_search\`, \`kb_find\`, \`kb_symbol\`, \`kb_trace\`, \`kb_scope_map\`, \`kb_lookup\`, \`kb_dead_symbols\`, \`kb_file_summary\` | Find code, symbols, data flow, reading plans |
106
- | Code Analysis | \`kb_analyze_structure\`, \`kb_analyze_dependencies\`, \`kb_analyze_symbols\`, \`kb_analyze_patterns\`, \`kb_analyze_entry_points\`, \`kb_analyze_diagram\`, \`kb_blast_radius\` | Structure, deps, patterns, impact, diagrams |
107
- | Knowledge | \`kb_remember\`, \`kb_read\`, \`kb_update\`, \`kb_forget\`, \`kb_list\`, \`kb_produce_knowledge\` | Persistent cross-session memory |
108
- | Execution | \`kb_check\`, \`kb_test_run\`, \`kb_eval\`, \`kb_batch\`, \`kb_audit\` | Typecheck, lint, test, run code, unified audit. \`check\` defaults to summary output (~300 tokens) |
109
- | Code Manipulation | \`kb_rename\`, \`kb_codemod\`, \`kb_diff_parse\`, \`kb_data_transform\` | Safe renames, transforms, diff parsing |
110
- | Context | \`kb_compact\`, \`kb_workset\`, \`kb_stash\`, \`kb_checkpoint\`, \`kb_parse_output\` | Manage working sets, save progress. \`compact\` accepts \`path\` for server-side file read |
111
- | FORGE | \`kb_forge_ground\`, \`kb_forge_classify\`, \`kb_evidence_map\`, \`kb_digest\`, \`kb_stratum_card\` | Quality gates, context compression |
112
- | Web & API | \`kb_web_fetch\`, \`kb_web_search\`, \`kb_http\` | Fetch pages, search web, test APIs |
113
- | Lanes | \`kb_lane\` | Isolated file copies for parallel exploration (create/list/status/diff/merge/discard) |
114
- | Git & Environment | \`kb_git_context\`, \`kb_process\`, \`kb_watch\`, \`kb_delegate\` | Git info, process management |
115
- | Utilities | \`kb_regex_test\`, \`kb_encode\`, \`kb_measure\`, \`kb_changelog\`, \`kb_schema_validate\`, \`kb_snippet\`, \`kb_env\`, \`kb_time\` | Regex, encoding, metrics, validation |
116
- | System | \`kb_status\`, \`kb_reindex\`, \`kb_health\`, \`kb_guide\`, \`kb_onboard\`, \`kb_graph\`, \`kb_queue\`, \`kb_replay\` | Index management, health checks, tool discovery, knowledge graph |
117
-
118
- ---
119
-
120
- ## MANDATORY: Context Reduction Protocol
121
-
122
- **Every agent interaction MUST minimize context window usage.** Raw file reads waste tokens and degrade LLM output quality. Use these tools instead:
123
-
124
- ### Decision Tree \u2014 How to Read Code
125
-
126
- \`\`\`
127
- Need to understand a file?
128
- \u251C\u2500 Just structure? \u2192 kb_file_summary (exports, imports, functions \u2014 ~50 tokens)
129
- \u251C\u2500 Specific section? \u2192 kb_compact({ path: "file.ts", query: "topic" }) \u2014 5-20x reduction
130
- \u251C\u2500 Multiple files? \u2192 kb_digest (multi-source compression \u2014 token-budgeted)
131
- \u251C\u2500 Repeated reference? \u2192 kb_stratum_card (T1/T2 card \u2014 10-100x reduction)
132
- \u2514\u2500 Full file needed? \u2192 ONLY as last resort, and compact it after reading
133
- \`\`\`
134
-
135
- ### Rules
136
- 1. **NEVER read a file >100 lines without compressing it first**
137
- 2. **ALWAYS use \`kb_file_summary\` before \`read_file\`** \u2014 often the summary is sufficient
138
- 3. **ALWAYS use \`kb_compact\` when you only need specific sections** of a file (use \`path\` param to read server-side)
139
- 4. **Use \`kb_digest\` when synthesizing from 3+ sources** \u2014 don't accumulate raw text
140
- 5. **Use \`kb_stratum_card\` for files you'll reference repeatedly** in a session
141
-
142
- ---
143
-
144
- ## MANDATORY: Memory Protocol
145
-
146
- **Every session MUST read and write persistent memory.** Without this, every conversation starts from zero.
147
-
148
- ### Session Start (MUST do ALL of these)
149
- \`\`\`
150
- kb_status({}) # Verify KB is ready
151
- kb_list() # See what knowledge exists
152
- kb_search({ query: "SESSION CHECKPOINT", origin: "curated" }) # Resume prior work
153
- \`\`\`
154
-
155
- ### During Session
156
- | Situation | Action |
157
- |-----------|--------|
158
- | Found a useful intermediate result | \`kb_stash({ key: "name", value: "data" })\` |
159
- | Completed a milestone | \`kb_checkpoint({ action: "save", name: "milestone" })\` |
160
- | Made an architecture decision | \`kb_remember({ title: "...", category: "decisions" })\` |
161
- | Discovered a pattern or convention | \`kb_remember({ title: "...", category: "patterns" })\` |
162
- | Found a non-obvious solution | \`kb_remember({ title: "...", category: "troubleshooting" })\` |
163
- | About to propose a new approach | \`kb_search({ query: "..." })\` \u2014 check if decided before |
164
-
165
- ### Session End (MUST do this)
166
- \`\`\`
167
- kb_remember({
168
- title: "Session checkpoint: <topic>",
169
- content: "<what was done, decisions made, blockers, next steps>",
170
- category: "conventions"
171
- })
172
- \`\`\`
173
-
174
- ### Memory Decision Tree
175
- \`\`\`
176
- Is this data temporary (scratch, intermediate)?
177
- \u251C\u2500 Yes \u2192 kb_stash (session-scoped key-value)
178
- \u2514\u2500 No \u2192 Is it resumable progress?
179
- \u251C\u2500 Yes \u2192 kb_checkpoint (session-scoped snapshot)
180
- \u2514\u2500 No \u2192 kb_remember (permanent, survives reindex)
181
- Categories: decisions | patterns | conventions | troubleshooting
182
- \`\`\`
183
-
184
- ---
185
-
186
- ## MANDATORY: Search-Before-Act Protocol
187
-
188
- **NEVER write or modify code without first searching for context.**
189
-
190
- \`\`\`
191
- # Before ANY code change:
192
- kb_search({ query: "<what you're about to change>" }) # Prior decisions?
193
- kb_scope_map({ task: "<description>" }) # What files to read?
194
- kb_symbol({ name: "<key symbol>" }) # Where is it defined/used?
195
- \`\`\`
196
-
197
- If \`kb_search\` returns a prior decision about the topic, you MUST follow it or explicitly explain why you're deviating.
198
-
199
- ---
200
-
201
- ## MANDATORY: Validation Protocol
202
-
203
- **NEVER commit or present code without validation.**
204
-
205
- \`\`\`
206
- kb_check({}) # Typecheck + lint (tsc + biome)
207
- kb_test_run({}) # Run tests
208
- kb_blast_radius({ changed_files: ["..."] }) # Impact analysis
209
- kb_audit({}) # Unified project audit (structure, deps, patterns, health, dead symbols, entry points)
210
- \`\`\`
211
-
212
- ---
213
-
214
- ## FORGE Protocol (for complex tasks)
215
-
216
- For tasks touching 3+ files or involving architectural decisions:
217
-
218
- \`\`\`
219
- kb_forge_classify({ task: "<description>" }) # Quick: Floor/Standard/Critical tier
220
- kb_forge_ground({ task: "<description>" }) # Full: scope + constraints + evidence
221
- kb_evidence_map({ claims: ["claim1", "claim2"] }) # Track verified vs assumed
222
- \`\`\`
223
-
224
- ---
225
-
226
- ## Search Modes
227
-
228
- | Mode | When | Example |
229
- |------|------|---------|
230
- | \`hybrid\` (default) | General queries | \`kb_search({ query: "error handling" })\` |
231
- | \`semantic\` | Conceptual/meaning-based | \`kb_search({ query: "retry with backoff", search_mode: "semantic" })\` |
232
- | \`keyword\` | Exact identifiers | \`kb_search({ query: "CircuitBreaker", search_mode: "keyword" })\` |
233
-
234
- Filters: \`origin\` (\`indexed\`/\`curated\`/\`produced\`), \`category\`, \`content_type\`, \`tags\`, \`min_score\`.
235
-
236
- ---
237
-
238
- ## Workflow Chains
239
-
240
- **Codebase onboarding:**
241
- \`\`\`
242
- kb_onboard({ path: "." }) \u2192 kb_produce_knowledge({ path: "src/" }) \u2192 kb_remember(...)
243
- \`\`\`
244
-
245
- **Planning a task:**
246
- \`\`\`
247
- kb_search({ query: "task keywords" })
248
- \u2192 kb_scope_map({ task: "description" })
249
- \u2192 kb_file_summary for each file in scope
250
- \u2192 kb_compact({ path: "relevant-file.ts", query: "detail needed" }) for files needing detail
251
- \u2192 kb_workset({ action: "save", name: "task", files: [...] })
252
- \`\`\`
253
-
254
- **Bug investigation:**
255
- \`\`\`
256
- kb_parse_output({ output: "<error>" })
257
- \u2192 kb_symbol({ name: "failingFn" })
258
- \u2192 kb_trace({ symbol: "failingFn", direction: "backward" })
259
- \u2192 kb_blast_radius({ changed_files: ["suspect.ts"] })
260
- \`\`\`
261
-
262
- **Safe refactor with lanes:**
263
- \`\`\`
264
- kb_lane({ action: "create", name: "refactor", files: [...] })
265
- \u2192 [make changes]
266
- \u2192 kb_lane({ action: "diff", name: "refactor" })
267
- \u2192 kb_check({}) \u2192 kb_test_run({})
268
- \u2192 kb_lane({ action: "merge", name: "refactor" })
269
- \`\`\`
270
-
271
- **After making changes:**
272
- \`\`\`
273
- kb_blast_radius({ changed_files: ["src/file.ts"] })
274
- \u2192 kb_check({}) \u2192 kb_test_run({})
275
- \u2192 kb_reindex({})
276
- \u2192 kb_remember(...)
277
- \`\`\`
278
-
279
- ---
280
-
281
- ## Knowledge Categories
282
-
283
- | Category | What to store |
284
- |----------|---------------|
285
- | \`decisions\` | Architecture choices, trade-offs, rejected alternatives |
286
- | \`patterns\` | Code patterns, naming conventions, structural patterns |
287
- | \`conventions\` | Session checkpoints, workflow conventions, team agreements |
288
- | \`troubleshooting\` | Non-obvious fixes, debugging strategies, workarounds |
289
-
290
- ---
291
-
292
- ## Core Rules Summary
293
-
294
- 1. **Search KB before proposing anything new** \u2014 prior decisions exist
295
- 2. **Compress context aggressively** \u2014 \`file_summary\` \u2192 \`compact\` \u2192 \`digest\`
296
- 3. **Use persistent memory** \u2014 \`remember\` decisions, \`stash\` temporary data
297
- 4. **Validate before committing** \u2014 \`check\` + \`test_run\` + \`blast_radius\`
298
- 5. **Follow \`_Next:\` hints** in tool responses for guided workflow
299
- 6. **Use FORGE for complex tasks** \u2014 \`forge_classify\` \u2192 \`forge_ground\` \u2192 \`evidence_map\`
300
- `}async function R(o){const s=process.cwd(),c=e(s,"kb.config.json");if(t(c)&&!o.force){console.log("kb.config.json already exists. Use --force to overwrite.");return}r(c,`${JSON.stringify(C,null,2)}
301
- `,"utf-8"),console.log(" Created kb.config.json");const d=e(s,"curated");t(d)||(n(d,{recursive:!0}),console.log(" Created curated/"));const a=e(s,".gitignore");t(a)?v(a,"utf-8").includes(".kb-data")||(h(a,`
302
- # Knowledge base vector store
303
- .kb-data/
304
- `,"utf-8"),console.log(" Added .kb-data/ to .gitignore")):(r(a,`# Knowledge base vector store
305
- .kb-data/
306
- `,"utf-8"),console.log(" Created .gitignore with .kb-data/"));const i=w(s),l=e(s,".vscode"),k=e(l,"mcp.json");t(l)&&!t(k)&&(r(k,`${JSON.stringify(A(i),null,2)}
307
- `,"utf-8"),console.log(" Created .vscode/mcp.json"));const u=e(s,".github"),b=e(u,"copilot-instructions.md");t(b)||(n(u,{recursive:!0}),r(b,T(i),"utf-8"),console.log(" Created .github/copilot-instructions.md"));const m=e(s,"AGENTS.md");t(m)||(r(m,P(i),"utf-8"),console.log(" Created AGENTS.md"));const _=e(s,"skills","knowledge-base"),p=e(_,"SKILL.md");if(!t(p)){const f=S(x(import.meta.url)),g=e(f,"..","..","..","skills","knowledge-base","SKILL.md");t(g)&&(n(_,{recursive:!0}),y(g,p),console.log(" Created skills/knowledge-base/SKILL.md"))}console.log(`
308
- Knowledge base initialized! Next steps:`),console.log(" kb reindex Index your codebase"),console.log(" kb search Search indexed content"),console.log(" kb serve Start MCP server for IDE integration")}export{R as initProject};