@miller-tech/uap 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (660) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +888 -0
  3. package/dist/analyzers/index.d.ts +3 -0
  4. package/dist/analyzers/index.d.ts.map +1 -0
  5. package/dist/analyzers/index.js +684 -0
  6. package/dist/analyzers/index.js.map +1 -0
  7. package/dist/benchmarks/agents/naive-agent.d.ts +60 -0
  8. package/dist/benchmarks/agents/naive-agent.d.ts.map +1 -0
  9. package/dist/benchmarks/agents/naive-agent.js +144 -0
  10. package/dist/benchmarks/agents/naive-agent.js.map +1 -0
  11. package/dist/benchmarks/agents/uap-agent.d.ts +167 -0
  12. package/dist/benchmarks/agents/uap-agent.d.ts.map +1 -0
  13. package/dist/benchmarks/agents/uap-agent.js +437 -0
  14. package/dist/benchmarks/agents/uap-agent.js.map +1 -0
  15. package/dist/benchmarks/benchmark.d.ts +328 -0
  16. package/dist/benchmarks/benchmark.d.ts.map +1 -0
  17. package/dist/benchmarks/benchmark.js +112 -0
  18. package/dist/benchmarks/benchmark.js.map +1 -0
  19. package/dist/benchmarks/execution-verifier.d.ts +41 -0
  20. package/dist/benchmarks/execution-verifier.d.ts.map +1 -0
  21. package/dist/benchmarks/execution-verifier.js +340 -0
  22. package/dist/benchmarks/execution-verifier.js.map +1 -0
  23. package/dist/benchmarks/hierarchical-prompting.d.ts +37 -0
  24. package/dist/benchmarks/hierarchical-prompting.d.ts.map +1 -0
  25. package/dist/benchmarks/hierarchical-prompting.js +246 -0
  26. package/dist/benchmarks/hierarchical-prompting.js.map +1 -0
  27. package/dist/benchmarks/improved-benchmark.d.ts +89 -0
  28. package/dist/benchmarks/improved-benchmark.d.ts.map +1 -0
  29. package/dist/benchmarks/improved-benchmark.js +585 -0
  30. package/dist/benchmarks/improved-benchmark.js.map +1 -0
  31. package/dist/benchmarks/index.d.ts +11 -0
  32. package/dist/benchmarks/index.d.ts.map +1 -0
  33. package/dist/benchmarks/index.js +11 -0
  34. package/dist/benchmarks/index.js.map +1 -0
  35. package/dist/benchmarks/model-integration.d.ts +111 -0
  36. package/dist/benchmarks/model-integration.d.ts.map +1 -0
  37. package/dist/benchmarks/model-integration.js +904 -0
  38. package/dist/benchmarks/model-integration.js.map +1 -0
  39. package/dist/benchmarks/multi-turn-agent.d.ts +44 -0
  40. package/dist/benchmarks/multi-turn-agent.d.ts.map +1 -0
  41. package/dist/benchmarks/multi-turn-agent.js +254 -0
  42. package/dist/benchmarks/multi-turn-agent.js.map +1 -0
  43. package/dist/benchmarks/multi-turn-loop.d.ts +57 -0
  44. package/dist/benchmarks/multi-turn-loop.d.ts.map +1 -0
  45. package/dist/benchmarks/multi-turn-loop.js +167 -0
  46. package/dist/benchmarks/multi-turn-loop.js.map +1 -0
  47. package/dist/benchmarks/tasks.d.ts +19 -0
  48. package/dist/benchmarks/tasks.d.ts.map +1 -0
  49. package/dist/benchmarks/tasks.js +435 -0
  50. package/dist/benchmarks/tasks.js.map +1 -0
  51. package/dist/bin/cli.d.ts +3 -0
  52. package/dist/bin/cli.d.ts.map +1 -0
  53. package/dist/bin/cli.js +546 -0
  54. package/dist/bin/cli.js.map +1 -0
  55. package/dist/bin/llama-server-optimize.d.ts +18 -0
  56. package/dist/bin/llama-server-optimize.d.ts.map +1 -0
  57. package/dist/bin/llama-server-optimize.js +708 -0
  58. package/dist/bin/llama-server-optimize.js.map +1 -0
  59. package/dist/bin/policy.d.ts +3 -0
  60. package/dist/bin/policy.d.ts.map +1 -0
  61. package/dist/bin/policy.js +143 -0
  62. package/dist/bin/policy.js.map +1 -0
  63. package/dist/bin/tool-calls.d.ts +3 -0
  64. package/dist/bin/tool-calls.d.ts.map +1 -0
  65. package/dist/bin/tool-calls.js +4 -0
  66. package/dist/bin/tool-calls.js.map +1 -0
  67. package/dist/browser/index.d.ts +2 -0
  68. package/dist/browser/index.d.ts.map +1 -0
  69. package/dist/browser/index.js +2 -0
  70. package/dist/browser/index.js.map +1 -0
  71. package/dist/browser/web-browser.d.ts +30 -0
  72. package/dist/browser/web-browser.d.ts.map +1 -0
  73. package/dist/browser/web-browser.js +93 -0
  74. package/dist/browser/web-browser.js.map +1 -0
  75. package/dist/cli/agent.d.ts +20 -0
  76. package/dist/cli/agent.d.ts.map +1 -0
  77. package/dist/cli/agent.js +474 -0
  78. package/dist/cli/agent.js.map +1 -0
  79. package/dist/cli/analyze.d.ts +7 -0
  80. package/dist/cli/analyze.d.ts.map +1 -0
  81. package/dist/cli/analyze.js +103 -0
  82. package/dist/cli/analyze.js.map +1 -0
  83. package/dist/cli/completion-gates.d.ts +51 -0
  84. package/dist/cli/completion-gates.d.ts.map +1 -0
  85. package/dist/cli/completion-gates.js +201 -0
  86. package/dist/cli/completion-gates.js.map +1 -0
  87. package/dist/cli/compliance.d.ts +8 -0
  88. package/dist/cli/compliance.d.ts.map +1 -0
  89. package/dist/cli/compliance.js +509 -0
  90. package/dist/cli/compliance.js.map +1 -0
  91. package/dist/cli/coord.d.ts +7 -0
  92. package/dist/cli/coord.d.ts.map +1 -0
  93. package/dist/cli/coord.js +138 -0
  94. package/dist/cli/coord.js.map +1 -0
  95. package/dist/cli/dashboard.d.ts +21 -0
  96. package/dist/cli/dashboard.d.ts.map +1 -0
  97. package/dist/cli/dashboard.js +1508 -0
  98. package/dist/cli/dashboard.js.map +1 -0
  99. package/dist/cli/deploy.d.ts +19 -0
  100. package/dist/cli/deploy.d.ts.map +1 -0
  101. package/dist/cli/deploy.js +387 -0
  102. package/dist/cli/deploy.js.map +1 -0
  103. package/dist/cli/droids.d.ts +9 -0
  104. package/dist/cli/droids.d.ts.map +1 -0
  105. package/dist/cli/droids.js +227 -0
  106. package/dist/cli/droids.js.map +1 -0
  107. package/dist/cli/generate.d.ts +17 -0
  108. package/dist/cli/generate.d.ts.map +1 -0
  109. package/dist/cli/generate.js +432 -0
  110. package/dist/cli/generate.js.map +1 -0
  111. package/dist/cli/hooks.d.ts +9 -0
  112. package/dist/cli/hooks.d.ts.map +1 -0
  113. package/dist/cli/hooks.js +464 -0
  114. package/dist/cli/hooks.js.map +1 -0
  115. package/dist/cli/init.d.ts +12 -0
  116. package/dist/cli/init.d.ts.map +1 -0
  117. package/dist/cli/init.js +364 -0
  118. package/dist/cli/init.js.map +1 -0
  119. package/dist/cli/mcp-router.d.ts +16 -0
  120. package/dist/cli/mcp-router.d.ts.map +1 -0
  121. package/dist/cli/mcp-router.js +143 -0
  122. package/dist/cli/mcp-router.js.map +1 -0
  123. package/dist/cli/memory.d.ts +24 -0
  124. package/dist/cli/memory.d.ts.map +1 -0
  125. package/dist/cli/memory.js +885 -0
  126. package/dist/cli/memory.js.map +1 -0
  127. package/dist/cli/model.d.ts +15 -0
  128. package/dist/cli/model.d.ts.map +1 -0
  129. package/dist/cli/model.js +290 -0
  130. package/dist/cli/model.js.map +1 -0
  131. package/dist/cli/patterns.d.ts +26 -0
  132. package/dist/cli/patterns.d.ts.map +1 -0
  133. package/dist/cli/patterns.js +862 -0
  134. package/dist/cli/patterns.js.map +1 -0
  135. package/dist/cli/rtk-validation.d.ts +9 -0
  136. package/dist/cli/rtk-validation.d.ts.map +1 -0
  137. package/dist/cli/rtk-validation.js +9 -0
  138. package/dist/cli/rtk-validation.js.map +1 -0
  139. package/dist/cli/rtk.d.ts +34 -0
  140. package/dist/cli/rtk.d.ts.map +1 -0
  141. package/dist/cli/rtk.js +401 -0
  142. package/dist/cli/rtk.js.map +1 -0
  143. package/dist/cli/schema-diff.d.ts +7 -0
  144. package/dist/cli/schema-diff.d.ts.map +1 -0
  145. package/dist/cli/schema-diff.js +11 -0
  146. package/dist/cli/schema-diff.js.map +1 -0
  147. package/dist/cli/setup-mcp-router.d.ts +8 -0
  148. package/dist/cli/setup-mcp-router.d.ts.map +1 -0
  149. package/dist/cli/setup-mcp-router.js +163 -0
  150. package/dist/cli/setup-mcp-router.js.map +1 -0
  151. package/dist/cli/setup-wizard.d.ts +2 -0
  152. package/dist/cli/setup-wizard.d.ts.map +1 -0
  153. package/dist/cli/setup-wizard.js +806 -0
  154. package/dist/cli/setup-wizard.js.map +1 -0
  155. package/dist/cli/setup.d.ts +15 -0
  156. package/dist/cli/setup.d.ts.map +1 -0
  157. package/dist/cli/setup.js +154 -0
  158. package/dist/cli/setup.js.map +1 -0
  159. package/dist/cli/sync.d.ts +8 -0
  160. package/dist/cli/sync.d.ts.map +1 -0
  161. package/dist/cli/sync.js +395 -0
  162. package/dist/cli/sync.js.map +1 -0
  163. package/dist/cli/task.d.ts +33 -0
  164. package/dist/cli/task.d.ts.map +1 -0
  165. package/dist/cli/task.js +672 -0
  166. package/dist/cli/task.js.map +1 -0
  167. package/dist/cli/tool-calls.d.ts +20 -0
  168. package/dist/cli/tool-calls.d.ts.map +1 -0
  169. package/dist/cli/tool-calls.js +605 -0
  170. package/dist/cli/tool-calls.js.map +1 -0
  171. package/dist/cli/uap.d.ts +10 -0
  172. package/dist/cli/uap.d.ts.map +1 -0
  173. package/dist/cli/uap.js +398 -0
  174. package/dist/cli/uap.js.map +1 -0
  175. package/dist/cli/update.d.ts +10 -0
  176. package/dist/cli/update.d.ts.map +1 -0
  177. package/dist/cli/update.js +300 -0
  178. package/dist/cli/update.js.map +1 -0
  179. package/dist/cli/visualize.d.ts +77 -0
  180. package/dist/cli/visualize.d.ts.map +1 -0
  181. package/dist/cli/visualize.js +287 -0
  182. package/dist/cli/visualize.js.map +1 -0
  183. package/dist/cli/worktree.d.ts +9 -0
  184. package/dist/cli/worktree.d.ts.map +1 -0
  185. package/dist/cli/worktree.js +213 -0
  186. package/dist/cli/worktree.js.map +1 -0
  187. package/dist/coordination/adaptive-patterns.d.ts +65 -0
  188. package/dist/coordination/adaptive-patterns.d.ts.map +1 -0
  189. package/dist/coordination/adaptive-patterns.js +108 -0
  190. package/dist/coordination/adaptive-patterns.js.map +1 -0
  191. package/dist/coordination/auto-agent.d.ts +82 -0
  192. package/dist/coordination/auto-agent.d.ts.map +1 -0
  193. package/dist/coordination/auto-agent.js +145 -0
  194. package/dist/coordination/auto-agent.js.map +1 -0
  195. package/dist/coordination/capability-router.d.ts +79 -0
  196. package/dist/coordination/capability-router.d.ts.map +1 -0
  197. package/dist/coordination/capability-router.js +334 -0
  198. package/dist/coordination/capability-router.js.map +1 -0
  199. package/dist/coordination/database.d.ts +13 -0
  200. package/dist/coordination/database.d.ts.map +1 -0
  201. package/dist/coordination/database.js +136 -0
  202. package/dist/coordination/database.js.map +1 -0
  203. package/dist/coordination/deploy-batcher.d.ts +122 -0
  204. package/dist/coordination/deploy-batcher.d.ts.map +1 -0
  205. package/dist/coordination/deploy-batcher.js +718 -0
  206. package/dist/coordination/deploy-batcher.js.map +1 -0
  207. package/dist/coordination/droid-validator.d.ts +59 -0
  208. package/dist/coordination/droid-validator.d.ts.map +1 -0
  209. package/dist/coordination/droid-validator.js +142 -0
  210. package/dist/coordination/droid-validator.js.map +1 -0
  211. package/dist/coordination/index.d.ts +10 -0
  212. package/dist/coordination/index.d.ts.map +1 -0
  213. package/dist/coordination/index.js +10 -0
  214. package/dist/coordination/index.js.map +1 -0
  215. package/dist/coordination/pattern-router.d.ts +50 -0
  216. package/dist/coordination/pattern-router.d.ts.map +1 -0
  217. package/dist/coordination/pattern-router.js +118 -0
  218. package/dist/coordination/pattern-router.js.map +1 -0
  219. package/dist/coordination/service.d.ts +81 -0
  220. package/dist/coordination/service.d.ts.map +1 -0
  221. package/dist/coordination/service.js +619 -0
  222. package/dist/coordination/service.js.map +1 -0
  223. package/dist/coordination/worktree-enforcer.d.ts +22 -0
  224. package/dist/coordination/worktree-enforcer.d.ts.map +1 -0
  225. package/dist/coordination/worktree-enforcer.js +71 -0
  226. package/dist/coordination/worktree-enforcer.js.map +1 -0
  227. package/dist/generators/claude-md.d.ts +3 -0
  228. package/dist/generators/claude-md.d.ts.map +1 -0
  229. package/dist/generators/claude-md.js +1020 -0
  230. package/dist/generators/claude-md.js.map +1 -0
  231. package/dist/generators/template-loader.d.ts +105 -0
  232. package/dist/generators/template-loader.d.ts.map +1 -0
  233. package/dist/generators/template-loader.js +291 -0
  234. package/dist/generators/template-loader.js.map +1 -0
  235. package/dist/index.d.ts +49 -0
  236. package/dist/index.d.ts.map +1 -0
  237. package/dist/index.js +63 -0
  238. package/dist/index.js.map +1 -0
  239. package/dist/mcp-router/config/parser.d.ts +9 -0
  240. package/dist/mcp-router/config/parser.d.ts.map +1 -0
  241. package/dist/mcp-router/config/parser.js +174 -0
  242. package/dist/mcp-router/config/parser.js.map +1 -0
  243. package/dist/mcp-router/executor/client.d.ts +31 -0
  244. package/dist/mcp-router/executor/client.d.ts.map +1 -0
  245. package/dist/mcp-router/executor/client.js +189 -0
  246. package/dist/mcp-router/executor/client.js.map +1 -0
  247. package/dist/mcp-router/index.d.ts +22 -0
  248. package/dist/mcp-router/index.d.ts.map +1 -0
  249. package/dist/mcp-router/index.js +18 -0
  250. package/dist/mcp-router/index.js.map +1 -0
  251. package/dist/mcp-router/output-compressor.d.ts +26 -0
  252. package/dist/mcp-router/output-compressor.d.ts.map +1 -0
  253. package/dist/mcp-router/output-compressor.js +236 -0
  254. package/dist/mcp-router/output-compressor.js.map +1 -0
  255. package/dist/mcp-router/search/fuzzy.d.ts +26 -0
  256. package/dist/mcp-router/search/fuzzy.d.ts.map +1 -0
  257. package/dist/mcp-router/search/fuzzy.js +94 -0
  258. package/dist/mcp-router/search/fuzzy.js.map +1 -0
  259. package/dist/mcp-router/server.d.ts +50 -0
  260. package/dist/mcp-router/server.d.ts.map +1 -0
  261. package/dist/mcp-router/server.js +229 -0
  262. package/dist/mcp-router/server.js.map +1 -0
  263. package/dist/mcp-router/session-stats.d.ts +37 -0
  264. package/dist/mcp-router/session-stats.d.ts.map +1 -0
  265. package/dist/mcp-router/session-stats.js +56 -0
  266. package/dist/mcp-router/session-stats.js.map +1 -0
  267. package/dist/mcp-router/tools/discover.d.ts +37 -0
  268. package/dist/mcp-router/tools/discover.d.ts.map +1 -0
  269. package/dist/mcp-router/tools/discover.js +65 -0
  270. package/dist/mcp-router/tools/discover.js.map +1 -0
  271. package/dist/mcp-router/tools/execute.d.ts +43 -0
  272. package/dist/mcp-router/tools/execute.d.ts.map +1 -0
  273. package/dist/mcp-router/tools/execute.js +144 -0
  274. package/dist/mcp-router/tools/execute.js.map +1 -0
  275. package/dist/mcp-router/types.d.ts +62 -0
  276. package/dist/mcp-router/types.d.ts.map +1 -0
  277. package/dist/mcp-router/types.js +6 -0
  278. package/dist/mcp-router/types.js.map +1 -0
  279. package/dist/memory/adaptive-context.d.ts +149 -0
  280. package/dist/memory/adaptive-context.d.ts.map +1 -0
  281. package/dist/memory/adaptive-context.js +1095 -0
  282. package/dist/memory/adaptive-context.js.map +1 -0
  283. package/dist/memory/agent-scoped-memory.d.ts +67 -0
  284. package/dist/memory/agent-scoped-memory.d.ts.map +1 -0
  285. package/dist/memory/agent-scoped-memory.js +126 -0
  286. package/dist/memory/agent-scoped-memory.js.map +1 -0
  287. package/dist/memory/ambiguity-detector.d.ts +54 -0
  288. package/dist/memory/ambiguity-detector.d.ts.map +1 -0
  289. package/dist/memory/ambiguity-detector.js +401 -0
  290. package/dist/memory/ambiguity-detector.js.map +1 -0
  291. package/dist/memory/backends/base.d.ts +18 -0
  292. package/dist/memory/backends/base.d.ts.map +1 -0
  293. package/dist/memory/backends/base.js +2 -0
  294. package/dist/memory/backends/base.js.map +1 -0
  295. package/dist/memory/backends/factory.d.ts +4 -0
  296. package/dist/memory/backends/factory.d.ts.map +1 -0
  297. package/dist/memory/backends/factory.js +53 -0
  298. package/dist/memory/backends/factory.js.map +1 -0
  299. package/dist/memory/backends/github.d.ts +27 -0
  300. package/dist/memory/backends/github.d.ts.map +1 -0
  301. package/dist/memory/backends/github.js +134 -0
  302. package/dist/memory/backends/github.js.map +1 -0
  303. package/dist/memory/backends/qdrant-cloud.d.ts +32 -0
  304. package/dist/memory/backends/qdrant-cloud.d.ts.map +1 -0
  305. package/dist/memory/backends/qdrant-cloud.js +167 -0
  306. package/dist/memory/backends/qdrant-cloud.js.map +1 -0
  307. package/dist/memory/context-compressor.d.ts +116 -0
  308. package/dist/memory/context-compressor.d.ts.map +1 -0
  309. package/dist/memory/context-compressor.js +430 -0
  310. package/dist/memory/context-compressor.js.map +1 -0
  311. package/dist/memory/context-pruner.d.ts +55 -0
  312. package/dist/memory/context-pruner.d.ts.map +1 -0
  313. package/dist/memory/context-pruner.js +85 -0
  314. package/dist/memory/context-pruner.js.map +1 -0
  315. package/dist/memory/correction-propagator.d.ts +44 -0
  316. package/dist/memory/correction-propagator.d.ts.map +1 -0
  317. package/dist/memory/correction-propagator.js +156 -0
  318. package/dist/memory/correction-propagator.js.map +1 -0
  319. package/dist/memory/daily-log.d.ts +67 -0
  320. package/dist/memory/daily-log.d.ts.map +1 -0
  321. package/dist/memory/daily-log.js +143 -0
  322. package/dist/memory/daily-log.js.map +1 -0
  323. package/dist/memory/dynamic-retrieval.d.ts +112 -0
  324. package/dist/memory/dynamic-retrieval.d.ts.map +1 -0
  325. package/dist/memory/dynamic-retrieval.js +908 -0
  326. package/dist/memory/dynamic-retrieval.js.map +1 -0
  327. package/dist/memory/embeddings.d.ts +172 -0
  328. package/dist/memory/embeddings.d.ts.map +1 -0
  329. package/dist/memory/embeddings.js +780 -0
  330. package/dist/memory/embeddings.js.map +1 -0
  331. package/dist/memory/generic-uap-patterns.d.ts +7 -0
  332. package/dist/memory/generic-uap-patterns.d.ts.map +1 -0
  333. package/dist/memory/generic-uap-patterns.js +43 -0
  334. package/dist/memory/generic-uap-patterns.js.map +1 -0
  335. package/dist/memory/hierarchical-memory.d.ts +141 -0
  336. package/dist/memory/hierarchical-memory.d.ts.map +1 -0
  337. package/dist/memory/hierarchical-memory.js +485 -0
  338. package/dist/memory/hierarchical-memory.js.map +1 -0
  339. package/dist/memory/knowledge-graph.d.ts +98 -0
  340. package/dist/memory/knowledge-graph.d.ts.map +1 -0
  341. package/dist/memory/knowledge-graph.js +275 -0
  342. package/dist/memory/knowledge-graph.js.map +1 -0
  343. package/dist/memory/memory-consolidator.d.ts +124 -0
  344. package/dist/memory/memory-consolidator.d.ts.map +1 -0
  345. package/dist/memory/memory-consolidator.js +514 -0
  346. package/dist/memory/memory-consolidator.js.map +1 -0
  347. package/dist/memory/memory-maintenance.d.ts +39 -0
  348. package/dist/memory/memory-maintenance.d.ts.map +1 -0
  349. package/dist/memory/memory-maintenance.js +336 -0
  350. package/dist/memory/memory-maintenance.js.map +1 -0
  351. package/dist/memory/model-router.d.ts +105 -0
  352. package/dist/memory/model-router.d.ts.map +1 -0
  353. package/dist/memory/model-router.js +474 -0
  354. package/dist/memory/model-router.js.map +1 -0
  355. package/dist/memory/multi-view-memory.d.ts +134 -0
  356. package/dist/memory/multi-view-memory.d.ts.map +1 -0
  357. package/dist/memory/multi-view-memory.js +430 -0
  358. package/dist/memory/multi-view-memory.js.map +1 -0
  359. package/dist/memory/predictive-memory.d.ts +79 -0
  360. package/dist/memory/predictive-memory.d.ts.map +1 -0
  361. package/dist/memory/predictive-memory.js +294 -0
  362. package/dist/memory/predictive-memory.js.map +1 -0
  363. package/dist/memory/prepopulate.d.ts +76 -0
  364. package/dist/memory/prepopulate.d.ts.map +1 -0
  365. package/dist/memory/prepopulate.js +832 -0
  366. package/dist/memory/prepopulate.js.map +1 -0
  367. package/dist/memory/semantic-compression.d.ts +77 -0
  368. package/dist/memory/semantic-compression.d.ts.map +1 -0
  369. package/dist/memory/semantic-compression.js +359 -0
  370. package/dist/memory/semantic-compression.js.map +1 -0
  371. package/dist/memory/serverless-qdrant.d.ts +102 -0
  372. package/dist/memory/serverless-qdrant.d.ts.map +1 -0
  373. package/dist/memory/serverless-qdrant.js +369 -0
  374. package/dist/memory/serverless-qdrant.js.map +1 -0
  375. package/dist/memory/short-term/factory.d.ts +26 -0
  376. package/dist/memory/short-term/factory.d.ts.map +1 -0
  377. package/dist/memory/short-term/factory.js +28 -0
  378. package/dist/memory/short-term/factory.js.map +1 -0
  379. package/dist/memory/short-term/indexeddb.d.ts +25 -0
  380. package/dist/memory/short-term/indexeddb.d.ts.map +1 -0
  381. package/dist/memory/short-term/indexeddb.js +64 -0
  382. package/dist/memory/short-term/indexeddb.js.map +1 -0
  383. package/dist/memory/short-term/schema.d.ts +6 -0
  384. package/dist/memory/short-term/schema.d.ts.map +1 -0
  385. package/dist/memory/short-term/schema.js +141 -0
  386. package/dist/memory/short-term/schema.js.map +1 -0
  387. package/dist/memory/short-term/sqlite.d.ts +64 -0
  388. package/dist/memory/short-term/sqlite.d.ts.map +1 -0
  389. package/dist/memory/short-term/sqlite.js +274 -0
  390. package/dist/memory/short-term/sqlite.js.map +1 -0
  391. package/dist/memory/speculative-cache.d.ts +111 -0
  392. package/dist/memory/speculative-cache.d.ts.map +1 -0
  393. package/dist/memory/speculative-cache.js +457 -0
  394. package/dist/memory/speculative-cache.js.map +1 -0
  395. package/dist/memory/task-classifier.d.ts +40 -0
  396. package/dist/memory/task-classifier.d.ts.map +1 -0
  397. package/dist/memory/task-classifier.js +342 -0
  398. package/dist/memory/task-classifier.js.map +1 -0
  399. package/dist/memory/terminal-bench-knowledge.d.ts +48 -0
  400. package/dist/memory/terminal-bench-knowledge.d.ts.map +1 -0
  401. package/dist/memory/terminal-bench-knowledge.js +622 -0
  402. package/dist/memory/terminal-bench-knowledge.js.map +1 -0
  403. package/dist/memory/write-gate.d.ts +39 -0
  404. package/dist/memory/write-gate.d.ts.map +1 -0
  405. package/dist/memory/write-gate.js +190 -0
  406. package/dist/memory/write-gate.js.map +1 -0
  407. package/dist/models/api-client.d.ts +46 -0
  408. package/dist/models/api-client.d.ts.map +1 -0
  409. package/dist/models/api-client.js +182 -0
  410. package/dist/models/api-client.js.map +1 -0
  411. package/dist/models/execution-profiles.d.ts +64 -0
  412. package/dist/models/execution-profiles.d.ts.map +1 -0
  413. package/dist/models/execution-profiles.js +403 -0
  414. package/dist/models/execution-profiles.js.map +1 -0
  415. package/dist/models/executor.d.ts +130 -0
  416. package/dist/models/executor.d.ts.map +1 -0
  417. package/dist/models/executor.js +382 -0
  418. package/dist/models/executor.js.map +1 -0
  419. package/dist/models/index.d.ts +19 -0
  420. package/dist/models/index.d.ts.map +1 -0
  421. package/dist/models/index.js +23 -0
  422. package/dist/models/index.js.map +1 -0
  423. package/dist/models/plan-validator.d.ts +37 -0
  424. package/dist/models/plan-validator.d.ts.map +1 -0
  425. package/dist/models/plan-validator.js +179 -0
  426. package/dist/models/plan-validator.js.map +1 -0
  427. package/dist/models/planner.d.ts +73 -0
  428. package/dist/models/planner.d.ts.map +1 -0
  429. package/dist/models/planner.js +375 -0
  430. package/dist/models/planner.js.map +1 -0
  431. package/dist/models/router.d.ts +96 -0
  432. package/dist/models/router.d.ts.map +1 -0
  433. package/dist/models/router.js +523 -0
  434. package/dist/models/router.js.map +1 -0
  435. package/dist/models/types.d.ts +370 -0
  436. package/dist/models/types.d.ts.map +1 -0
  437. package/dist/models/types.js +232 -0
  438. package/dist/models/types.js.map +1 -0
  439. package/dist/models/unified-router.d.ts +152 -0
  440. package/dist/models/unified-router.d.ts.map +1 -0
  441. package/dist/models/unified-router.js +313 -0
  442. package/dist/models/unified-router.js.map +1 -0
  443. package/dist/policies/convert-policy-to-claude.d.ts +3 -0
  444. package/dist/policies/convert-policy-to-claude.d.ts.map +1 -0
  445. package/dist/policies/convert-policy-to-claude.js +87 -0
  446. package/dist/policies/convert-policy-to-claude.js.map +1 -0
  447. package/dist/policies/database-manager.d.ts +27 -0
  448. package/dist/policies/database-manager.d.ts.map +1 -0
  449. package/dist/policies/database-manager.js +198 -0
  450. package/dist/policies/database-manager.js.map +1 -0
  451. package/dist/policies/enforced-tool-router.d.ts +53 -0
  452. package/dist/policies/enforced-tool-router.d.ts.map +1 -0
  453. package/dist/policies/enforced-tool-router.js +80 -0
  454. package/dist/policies/enforced-tool-router.js.map +1 -0
  455. package/dist/policies/index.d.ts +10 -0
  456. package/dist/policies/index.d.ts.map +1 -0
  457. package/dist/policies/index.js +8 -0
  458. package/dist/policies/index.js.map +1 -0
  459. package/dist/policies/policy-gate.d.ts +59 -0
  460. package/dist/policies/policy-gate.d.ts.map +1 -0
  461. package/dist/policies/policy-gate.js +171 -0
  462. package/dist/policies/policy-gate.js.map +1 -0
  463. package/dist/policies/policy-memory.d.ts +18 -0
  464. package/dist/policies/policy-memory.d.ts.map +1 -0
  465. package/dist/policies/policy-memory.js +126 -0
  466. package/dist/policies/policy-memory.js.map +1 -0
  467. package/dist/policies/policy-tools.d.ts +11 -0
  468. package/dist/policies/policy-tools.d.ts.map +1 -0
  469. package/dist/policies/policy-tools.js +66 -0
  470. package/dist/policies/policy-tools.js.map +1 -0
  471. package/dist/policies/schemas/policy.d.ts +69 -0
  472. package/dist/policies/schemas/policy.d.ts.map +1 -0
  473. package/dist/policies/schemas/policy.js +31 -0
  474. package/dist/policies/schemas/policy.js.map +1 -0
  475. package/dist/tasks/coordination.d.ts +83 -0
  476. package/dist/tasks/coordination.d.ts.map +1 -0
  477. package/dist/tasks/coordination.js +291 -0
  478. package/dist/tasks/coordination.js.map +1 -0
  479. package/dist/tasks/database.d.ts +19 -0
  480. package/dist/tasks/database.d.ts.map +1 -0
  481. package/dist/tasks/database.js +149 -0
  482. package/dist/tasks/database.js.map +1 -0
  483. package/dist/tasks/decoder-gate.d.ts +64 -0
  484. package/dist/tasks/decoder-gate.d.ts.map +1 -0
  485. package/dist/tasks/decoder-gate.js +268 -0
  486. package/dist/tasks/decoder-gate.js.map +1 -0
  487. package/dist/tasks/index.d.ts +6 -0
  488. package/dist/tasks/index.d.ts.map +1 -0
  489. package/dist/tasks/index.js +6 -0
  490. package/dist/tasks/index.js.map +1 -0
  491. package/dist/tasks/service.d.ts +40 -0
  492. package/dist/tasks/service.d.ts.map +1 -0
  493. package/dist/tasks/service.js +671 -0
  494. package/dist/tasks/service.js.map +1 -0
  495. package/dist/tasks/types.d.ts +238 -0
  496. package/dist/tasks/types.d.ts.map +1 -0
  497. package/dist/tasks/types.js +74 -0
  498. package/dist/tasks/types.js.map +1 -0
  499. package/dist/telemetry/index.d.ts +2 -0
  500. package/dist/telemetry/index.d.ts.map +1 -0
  501. package/dist/telemetry/index.js +2 -0
  502. package/dist/telemetry/index.js.map +1 -0
  503. package/dist/telemetry/session-telemetry.d.ts +56 -0
  504. package/dist/telemetry/session-telemetry.d.ts.map +1 -0
  505. package/dist/telemetry/session-telemetry.js +807 -0
  506. package/dist/telemetry/session-telemetry.js.map +1 -0
  507. package/dist/types/analysis.d.ts +82 -0
  508. package/dist/types/analysis.d.ts.map +1 -0
  509. package/dist/types/analysis.js +2 -0
  510. package/dist/types/analysis.js.map +1 -0
  511. package/dist/types/config.d.ts +3324 -0
  512. package/dist/types/config.d.ts.map +1 -0
  513. package/dist/types/config.js +418 -0
  514. package/dist/types/config.js.map +1 -0
  515. package/dist/types/coordination.d.ts +240 -0
  516. package/dist/types/coordination.d.ts.map +1 -0
  517. package/dist/types/coordination.js +43 -0
  518. package/dist/types/coordination.js.map +1 -0
  519. package/dist/types/index.d.ts +4 -0
  520. package/dist/types/index.d.ts.map +1 -0
  521. package/dist/types/index.js +4 -0
  522. package/dist/types/index.js.map +1 -0
  523. package/dist/uap-droids-strict.d.ts +59 -0
  524. package/dist/uap-droids-strict.d.ts.map +1 -0
  525. package/dist/uap-droids-strict.js +200 -0
  526. package/dist/uap-droids-strict.js.map +1 -0
  527. package/dist/utils/config-manager.d.ts +30 -0
  528. package/dist/utils/config-manager.d.ts.map +1 -0
  529. package/dist/utils/config-manager.js +41 -0
  530. package/dist/utils/config-manager.js.map +1 -0
  531. package/dist/utils/fetch-with-retry.d.ts +5 -0
  532. package/dist/utils/fetch-with-retry.d.ts.map +1 -0
  533. package/dist/utils/fetch-with-retry.js +61 -0
  534. package/dist/utils/fetch-with-retry.js.map +1 -0
  535. package/dist/utils/merge-claude-md.d.ts +28 -0
  536. package/dist/utils/merge-claude-md.d.ts.map +1 -0
  537. package/dist/utils/merge-claude-md.js +342 -0
  538. package/dist/utils/merge-claude-md.js.map +1 -0
  539. package/dist/utils/rate-limiter.d.ts +58 -0
  540. package/dist/utils/rate-limiter.d.ts.map +1 -0
  541. package/dist/utils/rate-limiter.js +100 -0
  542. package/dist/utils/rate-limiter.js.map +1 -0
  543. package/dist/utils/string-similarity.d.ts +37 -0
  544. package/dist/utils/string-similarity.d.ts.map +1 -0
  545. package/dist/utils/string-similarity.js +114 -0
  546. package/dist/utils/string-similarity.js.map +1 -0
  547. package/dist/utils/validate-json.d.ts +51 -0
  548. package/dist/utils/validate-json.d.ts.map +1 -0
  549. package/dist/utils/validate-json.js +94 -0
  550. package/dist/utils/validate-json.js.map +1 -0
  551. package/docs/INDEX.md +66 -0
  552. package/docs/architecture/MULTI_MODEL.md +224 -0
  553. package/docs/architecture/SYSTEM_ANALYSIS.md +1117 -0
  554. package/docs/architecture/UAP_COMPLIANCE.md +217 -0
  555. package/docs/architecture/UAP_PROTOCOL.md +339 -0
  556. package/docs/architecture/UAP_STRICT_DROIDS.md +172 -0
  557. package/docs/archive/BALLS_MODE_SELF_ANALYSIS.md +260 -0
  558. package/docs/archive/FAILING_TASKS_SOLUTION_PLAN.md +668 -0
  559. package/docs/archive/JINJA2-SYSTEM-MESSAGE-FIX.md +209 -0
  560. package/docs/archive/NPM-PUBLISH-V0.9.1.md +240 -0
  561. package/docs/archive/OPTIMIZATION_OPTIONS.md +334 -0
  562. package/docs/archive/SETUP_IMPROVEMENTS.md +213 -0
  563. package/docs/archive/UAP_GENERIC_OPTIMIZATION_PLAN.md +270 -0
  564. package/docs/archive/UAP_V103_PATTERN_DESIGN.md +315 -0
  565. package/docs/archive/UAP_V104_COMPLIANCE_DESIGN.md +223 -0
  566. package/docs/archive/changelog/2026-03-10_uap-100-compliance.md +77 -0
  567. package/docs/archive/changelog/2026-03-10_uap-full-system-verification.md +109 -0
  568. package/docs/benchmarks/ACCURACY_ANALYSIS.md +471 -0
  569. package/docs/benchmarks/TOKEN_OPTIMIZATION.md +572 -0
  570. package/docs/benchmarks/VALIDATION_PLAN.md +568 -0
  571. package/docs/benchmarks/VALIDATION_RESULTS.md +161 -0
  572. package/docs/deployment/DEPLOYMENT.md +895 -0
  573. package/docs/deployment/DEPLOYMENT_STRATEGIES.md +518 -0
  574. package/docs/deployment/DEPLOY_BATCHER_ANALYSIS.md +856 -0
  575. package/docs/deployment/DEPLOY_BATCHING.md +273 -0
  576. package/docs/deployment/DEPLOY_BUCKETING_ANALYSIS.md +420 -0
  577. package/docs/deployment/QWEN35_LLAMA_CPP.md +265 -0
  578. package/docs/getting-started/INTEGRATION.md +449 -0
  579. package/docs/getting-started/OVERVIEW.md +344 -0
  580. package/docs/getting-started/SETUP.md +203 -0
  581. package/docs/integrations/MCP_ROUTER_SETUP.md +445 -0
  582. package/docs/integrations/RTK_INTEGRATION.md +468 -0
  583. package/docs/operations/TROUBLESHOOTING.md +660 -0
  584. package/docs/reference/API_REFERENCE.md +903 -0
  585. package/docs/reference/FEATURES.md +472 -0
  586. package/docs/reference/HARNESS-MATRIX.md +318 -0
  587. package/docs/reference/UAP_CLI_REFERENCE.md +600 -0
  588. package/docs/research/BEHAVIORAL_PATTERNS.md +228 -0
  589. package/docs/research/DOMAIN_STRATEGIES.md +316 -0
  590. package/docs/research/MEMORY_SYSTEMS_COMPARISON.md +812 -0
  591. package/docs/research/PATTERN_ANALYSIS_2026-01-18.md +436 -0
  592. package/docs/research/PERFORMANCE_ANALYSIS_2026-01-18.md +209 -0
  593. package/docs/research/PERFORMANCE_TEST_PLAN.md +383 -0
  594. package/docs/research/TERMINAL_BENCH_LEARNINGS.md +217 -0
  595. package/package.json +113 -0
  596. package/scripts/README.md +161 -0
  597. package/templates/CLAUDE.template.md +10 -0
  598. package/templates/CLAUDE_ARCHITECTURE.template.md +103 -0
  599. package/templates/CLAUDE_CODING.template.md +127 -0
  600. package/templates/CLAUDE_DROIDS.template.md +109 -0
  601. package/templates/CLAUDE_MEMORY.template.md +131 -0
  602. package/templates/CLAUDE_WORKFLOWS.template.md +139 -0
  603. package/templates/PROJECT.template.md +209 -0
  604. package/templates/SCHEMA.md +57 -0
  605. package/templates/archive/CLAUDE.template.root-v6.md +534 -0
  606. package/templates/archive/CLAUDE.template.v6.md +534 -0
  607. package/templates/hooks/forgecode/pre-compact.sh +68 -0
  608. package/templates/hooks/forgecode/session-start.sh +169 -0
  609. package/templates/hooks/forgecode.plugin.sh +128 -0
  610. package/templates/hooks/pre-compact.sh +74 -0
  611. package/templates/hooks/session-start.sh +366 -0
  612. package/tools/agents/README.md +224 -0
  613. package/tools/agents/UAP/README.md +386 -0
  614. package/tools/agents/UAP/__init__.py +9 -0
  615. package/tools/agents/UAP/cli.py +901 -0
  616. package/tools/agents/UAP/compliance_verify.sh +108 -0
  617. package/tools/agents/UAP/full_verification.sh +126 -0
  618. package/tools/agents/UAP/version.py +32 -0
  619. package/tools/agents/benchmarks/benchmark_memory_systems.py +730 -0
  620. package/tools/agents/benchmarks/results/benchmark_20260106_064817.json +170 -0
  621. package/tools/agents/benchmarks/results/benchmark_20260106_064817.md +51 -0
  622. package/tools/agents/config/chat_template.jinja +77 -0
  623. package/tools/agents/config/tool-call-schema.json +19 -0
  624. package/tools/agents/config/tool-call.gbnf +58 -0
  625. package/tools/agents/docker/Dockerfile.python +52 -0
  626. package/tools/agents/docker/Dockerfile.ubuntu +55 -0
  627. package/tools/agents/docker-compose.qdrant.yml +24 -0
  628. package/tools/agents/install-opencode-local.sh.j2 +135 -0
  629. package/tools/agents/migrations/apply.py +256 -0
  630. package/tools/agents/opencode_uap_agent.py +1505 -0
  631. package/tools/agents/plugin/README.md +91 -0
  632. package/tools/agents/plugin/index.ts +46 -0
  633. package/tools/agents/plugin/pre-compact.sh +68 -0
  634. package/tools/agents/plugin/session-start.sh +175 -0
  635. package/tools/agents/plugin/uap-commands.ts +45 -0
  636. package/tools/agents/plugin/uap-droids.ts +54 -0
  637. package/tools/agents/plugin/uap-patterns.ts +54 -0
  638. package/tools/agents/plugin/uap-skills.ts +52 -0
  639. package/tools/agents/plugins/uap-enforce.ts +314 -0
  640. package/tools/agents/scripts/__pycache__/tool_call_wrapper.cpython-313.pyc +0 -0
  641. package/tools/agents/scripts/chat_template_verifier.py +343 -0
  642. package/tools/agents/scripts/fix-qwen-template.js +38 -0
  643. package/tools/agents/scripts/fix_qwen_chat_template.py +316 -0
  644. package/tools/agents/scripts/generate_lora_training_data.py +412 -0
  645. package/tools/agents/scripts/init_qdrant.py +151 -0
  646. package/tools/agents/scripts/memory_migration.py +560 -0
  647. package/tools/agents/scripts/migrate_memory_to_qdrant.py +110 -0
  648. package/tools/agents/scripts/prepare_lora.sh +512 -0
  649. package/tools/agents/scripts/query_memory.py +200 -0
  650. package/tools/agents/scripts/qwen-tool-call-test.js +38 -0
  651. package/tools/agents/scripts/qwen-tool-call-wrapper.js +38 -0
  652. package/tools/agents/scripts/qwen_tool_call_test.py +464 -0
  653. package/tools/agents/scripts/qwen_tool_call_wrapper.py +686 -0
  654. package/tools/agents/scripts/start-services.sh +96 -0
  655. package/tools/agents/scripts/tool-choice-proxy.cjs +296 -0
  656. package/tools/agents/scripts/tool_call_test.py +656 -0
  657. package/tools/agents/scripts/tool_call_wrapper.py +799 -0
  658. package/tools/agents/tests/test_uap_compliance.py +257 -0
  659. package/tools/agents/uap_agent.py +122 -0
  660. package/tools/agents/uap_agent_install.sh +12 -0
@@ -0,0 +1,832 @@
1
+ import { execSync, execFileSync } from 'child_process';
2
+ import { existsSync, readFileSync, readdirSync, statSync } from 'fs';
3
+ import { join, relative, extname, basename } from 'path';
4
+ /**
5
+ * Prepopulate memory from project documentation, git history, and skills/artifacts
6
+ */
7
+ export async function prepopulateMemory(cwd, options = {}) {
8
+ const shortTermMemories = [];
9
+ const longTermMemories = [];
10
+ const discoveredSkills = [];
11
+ const doAll = !options.docs && !options.git && !options.skills;
12
+ // Parse documentation
13
+ if (doAll || options.docs) {
14
+ const docs = await parseDocumentation(cwd, options.verbose);
15
+ const docMemories = extractDocumentationMemories(docs);
16
+ // Short-term: recent/important observations
17
+ shortTermMemories.push(...docMemories.filter((m) => m.importance && m.importance >= 7).slice(0, 20));
18
+ // Long-term: all documentation memories
19
+ longTermMemories.push(...docMemories);
20
+ }
21
+ // Extract git learnings
22
+ if (doAll || options.git) {
23
+ const commits = await extractGitHistory(cwd, options.limit || 500, options.since);
24
+ const gitMemories = extractGitLearnings(commits);
25
+ // Short-term: recent significant commits
26
+ shortTermMemories.push(...gitMemories.filter((m) => m.importance && m.importance >= 6).slice(0, 30));
27
+ // Long-term: all git learnings
28
+ longTermMemories.push(...gitMemories);
29
+ }
30
+ // Discover skills, droids, commands, and artifacts
31
+ if (doAll || options.skills) {
32
+ const skills = await discoverSkillsAndArtifacts(cwd, options.verbose);
33
+ discoveredSkills.push(...skills);
34
+ // Create memories for discovered skills
35
+ const skillMemories = extractSkillMemories(skills);
36
+ longTermMemories.push(...skillMemories);
37
+ // Add important skills to short-term
38
+ shortTermMemories.push(...skillMemories.filter((m) => m.importance && m.importance >= 7).slice(0, 10));
39
+ }
40
+ return { shortTerm: shortTermMemories, longTerm: longTermMemories, skills: discoveredSkills };
41
+ }
42
+ /**
43
+ * Parse all documentation files in the project
44
+ */
45
+ export async function parseDocumentation(cwd, verbose = false) {
46
+ const docs = [];
47
+ // Documentation file patterns to search for
48
+ const docPatterns = [
49
+ 'README.md',
50
+ 'README.txt',
51
+ 'README',
52
+ 'CONTRIBUTING.md',
53
+ 'CHANGELOG.md',
54
+ 'ARCHITECTURE.md',
55
+ 'DEVELOPMENT.md',
56
+ 'SECURITY.md',
57
+ '.github/PULL_REQUEST_TEMPLATE.md',
58
+ '.github/ISSUE_TEMPLATE.md',
59
+ ];
60
+ // Parse root-level docs
61
+ for (const pattern of docPatterns) {
62
+ const docPath = join(cwd, pattern);
63
+ if (existsSync(docPath)) {
64
+ const doc = parseMarkdownFile(docPath, cwd);
65
+ if (doc) {
66
+ docs.push(doc);
67
+ if (verbose)
68
+ console.log(` Parsed: ${pattern}`);
69
+ }
70
+ }
71
+ }
72
+ // Parse docs/ directory
73
+ const docsDir = join(cwd, 'docs');
74
+ if (existsSync(docsDir) && statSync(docsDir).isDirectory()) {
75
+ const docFiles = findMarkdownFiles(docsDir);
76
+ for (const docFile of docFiles) {
77
+ const doc = parseMarkdownFile(docFile, cwd);
78
+ if (doc) {
79
+ docs.push(doc);
80
+ if (verbose)
81
+ console.log(` Parsed: ${relative(cwd, docFile)}`);
82
+ }
83
+ }
84
+ }
85
+ // Parse ADRs (Architecture Decision Records)
86
+ const adrDirs = ['docs/adr', 'docs/decisions', 'adr', 'decisions'];
87
+ for (const adrDir of adrDirs) {
88
+ const adrPath = join(cwd, adrDir);
89
+ if (existsSync(adrPath) && statSync(adrPath).isDirectory()) {
90
+ const adrFiles = findMarkdownFiles(adrPath);
91
+ for (const adrFile of adrFiles) {
92
+ const doc = parseMarkdownFile(adrFile, cwd, 'adr');
93
+ if (doc) {
94
+ docs.push(doc);
95
+ if (verbose)
96
+ console.log(` Parsed ADR: ${relative(cwd, adrFile)}`);
97
+ }
98
+ }
99
+ }
100
+ }
101
+ return docs;
102
+ }
103
+ /**
104
+ * Extract git commit history with details
105
+ */
106
+ export async function extractGitHistory(cwd, limit = 500, since) {
107
+ const commits = [];
108
+ try {
109
+ // Check if it's a git repo
110
+ execSync('git rev-parse --git-dir', { cwd, encoding: 'utf-8', stdio: 'pipe' });
111
+ }
112
+ catch {
113
+ return commits; // Not a git repo
114
+ }
115
+ // Build git log command args — use execFileSync to avoid shell injection
116
+ const gitArgs = ['log', '--pretty=format:%H|%aI|%an|%s|%b<<<END>>>', '-n', String(limit)];
117
+ if (since) {
118
+ // Validate since parameter to prevent injection
119
+ if (!/^[\w\-.:/ ]+$/.test(since)) {
120
+ return commits; // Invalid since format
121
+ }
122
+ gitArgs.push(`--since=${since}`);
123
+ }
124
+ try {
125
+ const output = execFileSync('git', gitArgs, {
126
+ cwd,
127
+ encoding: 'utf-8',
128
+ maxBuffer: 50 * 1024 * 1024,
129
+ });
130
+ const commitStrings = output.split('<<<END>>>').filter((s) => s.trim());
131
+ for (const commitStr of commitStrings) {
132
+ const parts = commitStr.trim().split('|');
133
+ if (parts.length < 4)
134
+ continue;
135
+ const [hash, date, author, ...rest] = parts;
136
+ const messageAndBody = rest.join('|');
137
+ const [message, ...bodyParts] = messageAndBody.split('\n');
138
+ const body = bodyParts.join('\n').trim();
139
+ // Get files changed in this commit — validate hash is hex before using
140
+ let files = [];
141
+ const trimmedHash = hash.trim();
142
+ if (/^[0-9a-f]+$/i.test(trimmedHash)) {
143
+ try {
144
+ const filesOutput = execFileSync('git', ['diff-tree', '--no-commit-id', '--name-only', '-r', trimmedHash], {
145
+ cwd,
146
+ encoding: 'utf-8',
147
+ stdio: 'pipe',
148
+ });
149
+ files = filesOutput
150
+ .trim()
151
+ .split('\n')
152
+ .filter((f) => f);
153
+ }
154
+ catch {
155
+ // Ignore errors getting file list
156
+ }
157
+ }
158
+ // Determine commit type from conventional commit format
159
+ const type = categorizeCommit(message);
160
+ commits.push({
161
+ hash: trimmedHash,
162
+ date: date.trim(),
163
+ author: author.trim(),
164
+ message: message.trim(),
165
+ body,
166
+ files,
167
+ type,
168
+ });
169
+ }
170
+ }
171
+ catch (error) {
172
+ // Git command failed, return empty
173
+ console.warn('Failed to extract git history:', error);
174
+ }
175
+ return commits;
176
+ }
177
+ /**
178
+ * Convert documentation into memory entries
179
+ */
180
+ export function extractDocumentationMemories(docs) {
181
+ const memories = [];
182
+ const now = new Date().toISOString();
183
+ for (const doc of docs) {
184
+ for (const section of doc.sections) {
185
+ // Skip empty or very short sections
186
+ if (!section.content || section.content.length < 50)
187
+ continue;
188
+ // Chunk large sections
189
+ const chunks = chunkContent(section.content, 500);
190
+ for (let i = 0; i < chunks.length; i++) {
191
+ const memoryType = mapSectionToMemoryType(section.type);
192
+ const importance = calculateDocImportance(section, doc.path);
193
+ memories.push({
194
+ id: `doc-${basename(doc.path, extname(doc.path))}-${section.heading.toLowerCase().replace(/\s+/g, '-')}-${i}`,
195
+ timestamp: now,
196
+ type: memoryType,
197
+ content: chunks[i],
198
+ tags: extractTags(section, doc.path),
199
+ importance,
200
+ metadata: {
201
+ source: 'documentation',
202
+ file: doc.path,
203
+ section: section.heading,
204
+ docTitle: doc.title,
205
+ },
206
+ });
207
+ }
208
+ }
209
+ }
210
+ return memories;
211
+ }
212
+ /**
213
+ * Convert git history into memory entries with learnings
214
+ */
215
+ export function extractGitLearnings(commits) {
216
+ const memories = [];
217
+ // Group commits by type for analysis
218
+ const bugFixes = commits.filter((c) => c.type === 'fix');
219
+ const features = commits.filter((c) => c.type === 'feat');
220
+ const refactors = commits.filter((c) => c.type === 'refactor');
221
+ const reverts = commits.filter((c) => c.type === 'revert');
222
+ // Extract learnings from bug fixes
223
+ for (const commit of bugFixes.slice(0, 50)) {
224
+ const learning = extractBugFixLearning(commit);
225
+ if (learning) {
226
+ memories.push({
227
+ id: `git-fix-${commit.hash.substring(0, 8)}`,
228
+ timestamp: commit.date,
229
+ type: 'observation',
230
+ content: learning,
231
+ tags: ['bug-fix', ...extractFileTags(commit.files)],
232
+ importance: calculateCommitImportance(commit),
233
+ metadata: {
234
+ source: 'git',
235
+ commit: commit.hash,
236
+ author: commit.author,
237
+ files: commit.files.slice(0, 10),
238
+ },
239
+ });
240
+ }
241
+ }
242
+ // Extract learnings from features
243
+ for (const commit of features.slice(0, 30)) {
244
+ memories.push({
245
+ id: `git-feat-${commit.hash.substring(0, 8)}`,
246
+ timestamp: commit.date,
247
+ type: 'observation',
248
+ content: `Feature added: ${commit.message}${commit.body ? `. ${summarizeBody(commit.body)}` : ''}`,
249
+ tags: ['feature', ...extractFileTags(commit.files)],
250
+ importance: calculateCommitImportance(commit),
251
+ metadata: {
252
+ source: 'git',
253
+ commit: commit.hash,
254
+ author: commit.author,
255
+ files: commit.files.slice(0, 10),
256
+ },
257
+ });
258
+ }
259
+ // Extract learnings from refactors (architectural decisions)
260
+ for (const commit of refactors.slice(0, 20)) {
261
+ memories.push({
262
+ id: `git-refactor-${commit.hash.substring(0, 8)}`,
263
+ timestamp: commit.date,
264
+ type: 'thought',
265
+ content: `Architectural change: ${commit.message}${commit.body ? `. Reasoning: ${summarizeBody(commit.body)}` : ''}`,
266
+ tags: ['refactor', 'architecture', ...extractFileTags(commit.files)],
267
+ importance: calculateCommitImportance(commit) + 1, // Refactors are usually important decisions
268
+ metadata: {
269
+ source: 'git',
270
+ commit: commit.hash,
271
+ author: commit.author,
272
+ files: commit.files.slice(0, 10),
273
+ },
274
+ });
275
+ }
276
+ // Extract learnings from reverts (failed approaches)
277
+ for (const commit of reverts) {
278
+ memories.push({
279
+ id: `git-revert-${commit.hash.substring(0, 8)}`,
280
+ timestamp: commit.date,
281
+ type: 'thought',
282
+ content: `Failed approach reverted: ${commit.message}. This approach did not work - avoid similar changes.`,
283
+ tags: ['revert', 'failed-approach', ...extractFileTags(commit.files)],
284
+ importance: 8, // Reverts are always important learnings
285
+ metadata: {
286
+ source: 'git',
287
+ commit: commit.hash,
288
+ author: commit.author,
289
+ files: commit.files.slice(0, 10),
290
+ },
291
+ });
292
+ }
293
+ // Identify hot spots (frequently modified files)
294
+ const fileChangeCounts = new Map();
295
+ for (const commit of commits) {
296
+ for (const file of commit.files) {
297
+ fileChangeCounts.set(file, (fileChangeCounts.get(file) || 0) + 1);
298
+ }
299
+ }
300
+ const hotSpots = [...fileChangeCounts.entries()]
301
+ .sort((a, b) => b[1] - a[1])
302
+ .slice(0, 10)
303
+ .filter(([_, count]) => count >= 5);
304
+ if (hotSpots.length > 0) {
305
+ memories.push({
306
+ id: 'git-hotspots',
307
+ timestamp: new Date().toISOString(),
308
+ type: 'observation',
309
+ content: `Frequently modified files (hot spots): ${hotSpots.map(([f, c]) => `${f} (${c} changes)`).join(', ')}. These files may need extra attention during changes.`,
310
+ tags: ['hot-spots', 'code-quality'],
311
+ importance: 7,
312
+ metadata: {
313
+ source: 'git-analysis',
314
+ hotSpots: Object.fromEntries(hotSpots),
315
+ },
316
+ });
317
+ }
318
+ return memories;
319
+ }
320
+ // Helper functions
321
+ function findMarkdownFiles(dir) {
322
+ const files = [];
323
+ const entries = readdirSync(dir, { withFileTypes: true });
324
+ for (const entry of entries) {
325
+ const fullPath = join(dir, entry.name);
326
+ if (entry.isDirectory() && !entry.name.startsWith('.')) {
327
+ files.push(...findMarkdownFiles(fullPath));
328
+ }
329
+ else if (entry.isFile() && (entry.name.endsWith('.md') || entry.name.endsWith('.mdx'))) {
330
+ files.push(fullPath);
331
+ }
332
+ }
333
+ return files;
334
+ }
335
+ function parseMarkdownFile(filePath, cwd, docType) {
336
+ try {
337
+ const content = readFileSync(filePath, 'utf-8');
338
+ const relativePath = relative(cwd, filePath);
339
+ // Extract title from first heading or filename
340
+ const titleMatch = content.match(/^#\s+(.+)$/m);
341
+ const title = titleMatch ? titleMatch[1] : basename(filePath, extname(filePath));
342
+ // Split content by headings
343
+ const sections = [];
344
+ const headingRegex = /^(#{1,3})\s+(.+)$/gm;
345
+ let lastIndex = 0;
346
+ let lastHeading = 'Introduction';
347
+ let match;
348
+ while ((match = headingRegex.exec(content)) !== null) {
349
+ // Save previous section
350
+ if (lastIndex > 0 || match.index > 0) {
351
+ const sectionContent = content.slice(lastIndex, match.index).trim();
352
+ if (sectionContent) {
353
+ sections.push({
354
+ heading: lastHeading,
355
+ content: cleanMarkdown(sectionContent),
356
+ type: categorizeSectionType(lastHeading, sectionContent, docType),
357
+ });
358
+ }
359
+ }
360
+ lastHeading = match[2];
361
+ lastIndex = match.index + match[0].length;
362
+ }
363
+ // Add final section
364
+ const finalContent = content.slice(lastIndex).trim();
365
+ if (finalContent) {
366
+ sections.push({
367
+ heading: lastHeading,
368
+ content: cleanMarkdown(finalContent),
369
+ type: categorizeSectionType(lastHeading, finalContent, docType),
370
+ });
371
+ }
372
+ return {
373
+ path: relativePath,
374
+ title,
375
+ sections,
376
+ };
377
+ }
378
+ catch {
379
+ return null;
380
+ }
381
+ }
382
+ function cleanMarkdown(content) {
383
+ return content
384
+ .replace(/```[\s\S]*?```/g, '[code block]') // Replace code blocks
385
+ .replace(/`[^`]+`/g, (m) => m) // Keep inline code
386
+ .replace(/\[([^\]]+)\]\([^)]+\)/g, '$1') // Convert links to text
387
+ .replace(/!\[([^\]]*)\]\([^)]+\)/g, '[image: $1]') // Simplify images
388
+ .replace(/\n{3,}/g, '\n\n') // Normalize newlines
389
+ .trim();
390
+ }
391
+ function categorizeSectionType(heading, content, docType) {
392
+ const headingLower = heading.toLowerCase();
393
+ const contentLower = content.toLowerCase();
394
+ if (docType === 'adr')
395
+ return 'architecture';
396
+ if (headingLower.includes('install') ||
397
+ headingLower.includes('setup') ||
398
+ headingLower.includes('getting started') ||
399
+ headingLower.includes('quickstart') ||
400
+ headingLower.includes('prerequisites')) {
401
+ return 'setup';
402
+ }
403
+ if (headingLower.includes('architecture') ||
404
+ headingLower.includes('design') ||
405
+ headingLower.includes('structure') ||
406
+ headingLower.includes('overview')) {
407
+ return 'architecture';
408
+ }
409
+ if (headingLower.includes('api') ||
410
+ headingLower.includes('endpoint') ||
411
+ headingLower.includes('reference')) {
412
+ return 'api';
413
+ }
414
+ if (headingLower.includes('troubleshoot') ||
415
+ headingLower.includes('faq') ||
416
+ headingLower.includes('common issues') ||
417
+ headingLower.includes('known issues') ||
418
+ contentLower.includes('if you encounter')) {
419
+ return 'troubleshooting';
420
+ }
421
+ return 'general';
422
+ }
423
+ function mapSectionToMemoryType(sectionType) {
424
+ switch (sectionType) {
425
+ case 'architecture':
426
+ return 'thought';
427
+ case 'troubleshooting':
428
+ return 'observation';
429
+ default:
430
+ return 'observation';
431
+ }
432
+ }
433
+ function calculateDocImportance(section, filePath) {
434
+ let importance = 5;
435
+ // Boost README
436
+ if (filePath.toLowerCase().includes('readme'))
437
+ importance += 2;
438
+ // Boost architecture docs
439
+ if (section.type === 'architecture')
440
+ importance += 1;
441
+ // Boost setup/troubleshooting
442
+ if (section.type === 'setup' || section.type === 'troubleshooting')
443
+ importance += 1;
444
+ // ADRs are important
445
+ if (filePath.includes('adr') || filePath.includes('decision'))
446
+ importance += 2;
447
+ return Math.min(importance, 10);
448
+ }
449
+ function categorizeCommit(message) {
450
+ const msgLower = message.toLowerCase();
451
+ if (msgLower.startsWith('revert'))
452
+ return 'revert';
453
+ if (msgLower.startsWith('fix:') || msgLower.startsWith('fix(') || msgLower.includes('bugfix'))
454
+ return 'fix';
455
+ if (msgLower.startsWith('feat:') ||
456
+ msgLower.startsWith('feat(') ||
457
+ msgLower.startsWith('feature'))
458
+ return 'feat';
459
+ if (msgLower.startsWith('refactor:') || msgLower.startsWith('refactor('))
460
+ return 'refactor';
461
+ if (msgLower.startsWith('docs:') || msgLower.startsWith('docs('))
462
+ return 'docs';
463
+ if (msgLower.startsWith('test:') || msgLower.startsWith('test('))
464
+ return 'test';
465
+ if (msgLower.startsWith('chore:') || msgLower.startsWith('chore('))
466
+ return 'chore';
467
+ return 'other';
468
+ }
469
+ function extractBugFixLearning(commit) {
470
+ const message = commit.message;
471
+ const body = commit.body;
472
+ // Try to extract what was fixed
473
+ let learning = `Bug fixed: ${message}`;
474
+ if (body) {
475
+ // Look for "Fixes #123" or similar
476
+ const issueMatch = body.match(/(?:fixes|closes|resolves)\s+#(\d+)/i);
477
+ if (issueMatch) {
478
+ learning += ` (Issue #${issueMatch[1]})`;
479
+ }
480
+ // Add summary of body if present
481
+ const summary = summarizeBody(body);
482
+ if (summary) {
483
+ learning += `. ${summary}`;
484
+ }
485
+ }
486
+ // Add affected files context
487
+ if (commit.files.length > 0 && commit.files.length <= 5) {
488
+ learning += ` Affected files: ${commit.files.join(', ')}.`;
489
+ }
490
+ return learning;
491
+ }
492
+ function summarizeBody(body) {
493
+ // Take first meaningful line of body
494
+ const lines = body
495
+ .split('\n')
496
+ .filter((l) => l.trim() && !l.startsWith('Co-authored') && !l.startsWith('Signed-off'));
497
+ if (lines.length === 0)
498
+ return '';
499
+ const firstLine = lines[0].trim();
500
+ if (firstLine.length > 200) {
501
+ return firstLine.substring(0, 200) + '...';
502
+ }
503
+ return firstLine;
504
+ }
505
+ function calculateCommitImportance(commit) {
506
+ let importance = 5;
507
+ // Reverts are always important
508
+ if (commit.type === 'revert')
509
+ importance = 8;
510
+ // Large changes are more significant
511
+ if (commit.files.length > 10)
512
+ importance += 1;
513
+ // Changes to core files
514
+ const coreFiles = commit.files.filter((f) => f.includes('config') ||
515
+ f.includes('package.json') ||
516
+ f.includes('index') ||
517
+ f.includes('main') ||
518
+ f.includes('app'));
519
+ if (coreFiles.length > 0)
520
+ importance += 1;
521
+ // Has detailed body
522
+ if (commit.body && commit.body.length > 50)
523
+ importance += 1;
524
+ return Math.min(importance, 10);
525
+ }
526
+ function extractFileTags(files) {
527
+ const tags = new Set();
528
+ for (const file of files.slice(0, 10)) {
529
+ // Extract directory as tag
530
+ const parts = file.split('/');
531
+ if (parts.length > 1) {
532
+ tags.add(parts[0]);
533
+ }
534
+ // Extract file type
535
+ const ext = extname(file).toLowerCase();
536
+ if (ext === '.ts' || ext === '.tsx')
537
+ tags.add('typescript');
538
+ if (ext === '.js' || ext === '.jsx')
539
+ tags.add('javascript');
540
+ if (ext === '.py')
541
+ tags.add('python');
542
+ if (ext === '.go')
543
+ tags.add('go');
544
+ if (ext === '.rs')
545
+ tags.add('rust');
546
+ if (ext === '.yml' || ext === '.yaml')
547
+ tags.add('config');
548
+ if (ext === '.json')
549
+ tags.add('config');
550
+ if (ext === '.md')
551
+ tags.add('docs');
552
+ // Special files
553
+ if (file.includes('test') || file.includes('spec'))
554
+ tags.add('tests');
555
+ if (file.includes('docker') || file.includes('Dockerfile'))
556
+ tags.add('docker');
557
+ if (file.includes('terraform') || file.endsWith('.tf'))
558
+ tags.add('terraform');
559
+ }
560
+ return [...tags].slice(0, 5);
561
+ }
562
+ function extractTags(section, filePath) {
563
+ const tags = [section.type];
564
+ // Add source file as tag
565
+ const fileName = basename(filePath, extname(filePath)).toLowerCase();
566
+ if (fileName !== 'readme') {
567
+ tags.push(fileName);
568
+ }
569
+ // Extract keywords from heading
570
+ const keywords = section.heading
571
+ .toLowerCase()
572
+ .split(/[\s-_]+/)
573
+ .filter((w) => w.length > 3 && !['the', 'and', 'for', 'with'].includes(w));
574
+ tags.push(...keywords.slice(0, 3));
575
+ return [...new Set(tags)].slice(0, 5);
576
+ }
577
+ function chunkContent(content, maxLength) {
578
+ if (content.length <= maxLength)
579
+ return [content];
580
+ const chunks = [];
581
+ const sentences = content.split(/(?<=[.!?])\s+/);
582
+ let currentChunk = '';
583
+ for (const sentence of sentences) {
584
+ if (currentChunk.length + sentence.length > maxLength) {
585
+ if (currentChunk)
586
+ chunks.push(currentChunk.trim());
587
+ currentChunk = sentence;
588
+ }
589
+ else {
590
+ currentChunk += (currentChunk ? ' ' : '') + sentence;
591
+ }
592
+ }
593
+ if (currentChunk)
594
+ chunks.push(currentChunk.trim());
595
+ return chunks;
596
+ }
597
+ /**
598
+ * Discover skills, droids, commands, and artifacts from various platforms
599
+ */
600
+ export async function discoverSkillsAndArtifacts(cwd, verbose = false) {
601
+ const skills = [];
602
+ // Factory.ai droids, skills, and commands
603
+ const factoryPaths = [
604
+ { dir: '.factory/droids', type: 'droid' },
605
+ { dir: '.factory/skills', type: 'skill' },
606
+ { dir: '.factory/commands', type: 'command' },
607
+ ];
608
+ for (const { dir, type } of factoryPaths) {
609
+ const fullPath = join(cwd, dir);
610
+ if (existsSync(fullPath) && statSync(fullPath).isDirectory()) {
611
+ const files = readdirSync(fullPath);
612
+ for (const file of files) {
613
+ if (file.endsWith('.md') || file.endsWith('.yaml') || file.endsWith('.yml')) {
614
+ const filePath = join(fullPath, file);
615
+ const skill = parseSkillFile(filePath, cwd, type, 'factory');
616
+ if (skill) {
617
+ skills.push(skill);
618
+ if (verbose)
619
+ console.log(` Found Factory ${type}: ${skill.name}`);
620
+ }
621
+ }
622
+ }
623
+ }
624
+ }
625
+ // Claude Code agents and commands
626
+ const claudePaths = [
627
+ { dir: '.claude/agents', type: 'droid' },
628
+ { dir: '.claude/commands', type: 'command' },
629
+ ];
630
+ for (const { dir, type } of claudePaths) {
631
+ const fullPath = join(cwd, dir);
632
+ if (existsSync(fullPath) && statSync(fullPath).isDirectory()) {
633
+ const files = readdirSync(fullPath);
634
+ for (const file of files) {
635
+ if (file.endsWith('.md') || file.endsWith('.yaml') || file.endsWith('.yml')) {
636
+ const filePath = join(fullPath, file);
637
+ const skill = parseSkillFile(filePath, cwd, type, 'claude');
638
+ if (skill) {
639
+ skills.push(skill);
640
+ if (verbose)
641
+ console.log(` Found Claude ${type}: ${skill.name}`);
642
+ }
643
+ }
644
+ }
645
+ }
646
+ }
647
+ // OpenCode agents and commands
648
+ const opencodePaths = [
649
+ { dir: '.opencode/agent', type: 'droid' },
650
+ { dir: '.opencode/command', type: 'command' },
651
+ ];
652
+ for (const { dir, type } of opencodePaths) {
653
+ const fullPath = join(cwd, dir);
654
+ if (existsSync(fullPath) && statSync(fullPath).isDirectory()) {
655
+ const files = readdirSync(fullPath);
656
+ for (const file of files) {
657
+ if (file.endsWith('.md') ||
658
+ file.endsWith('.yaml') ||
659
+ file.endsWith('.yml') ||
660
+ file.endsWith('.json')) {
661
+ const filePath = join(fullPath, file);
662
+ const skill = parseSkillFile(filePath, cwd, type, 'opencode');
663
+ if (skill) {
664
+ skills.push(skill);
665
+ if (verbose)
666
+ console.log(` Found OpenCode ${type}: ${skill.name}`);
667
+ }
668
+ }
669
+ }
670
+ }
671
+ }
672
+ // Discover artifacts (reusable code patterns, templates)
673
+ const artifactDirs = ['templates', 'snippets', '.github/workflows', 'scripts', 'tools'];
674
+ for (const dir of artifactDirs) {
675
+ const fullPath = join(cwd, dir);
676
+ if (existsSync(fullPath) && statSync(fullPath).isDirectory()) {
677
+ const files = readdirSync(fullPath).slice(0, 20); // Limit to avoid too many
678
+ for (const file of files) {
679
+ const filePath = join(fullPath, file);
680
+ if (statSync(filePath).isFile()) {
681
+ skills.push({
682
+ name: basename(file, extname(file)),
683
+ path: relative(cwd, filePath),
684
+ type: 'artifact',
685
+ description: `Reusable ${dir} artifact`,
686
+ platform: 'generic',
687
+ });
688
+ if (verbose)
689
+ console.log(` Found artifact: ${file}`);
690
+ }
691
+ }
692
+ }
693
+ }
694
+ return skills;
695
+ }
696
+ /**
697
+ * Parse a skill/droid/command file to extract metadata
698
+ */
699
+ function parseSkillFile(filePath, cwd, type, platform) {
700
+ try {
701
+ const content = readFileSync(filePath, 'utf-8');
702
+ const fileName = basename(filePath, extname(filePath));
703
+ let description = '';
704
+ // Try to extract description from different formats
705
+ if (filePath.endsWith('.md')) {
706
+ // Extract first paragraph or heading
707
+ const match = content.match(/^#\s+.+\n+(.+)/m);
708
+ if (match)
709
+ description = match[1].trim();
710
+ }
711
+ else if (filePath.endsWith('.yaml') || filePath.endsWith('.yml')) {
712
+ // Look for description field
713
+ const match = content.match(/description:\s*['"]?([^'"\n]+)/i);
714
+ if (match)
715
+ description = match[1].trim();
716
+ }
717
+ else if (filePath.endsWith('.json')) {
718
+ try {
719
+ const json = JSON.parse(content);
720
+ description = json.description || '';
721
+ }
722
+ catch {
723
+ // Ignore JSON parse errors
724
+ }
725
+ }
726
+ return {
727
+ name: fileName,
728
+ path: relative(cwd, filePath),
729
+ type,
730
+ description: description || `${platform} ${type}`,
731
+ platform,
732
+ };
733
+ }
734
+ catch {
735
+ return null;
736
+ }
737
+ }
738
+ /**
739
+ * Convert discovered skills into memory entries
740
+ */
741
+ export function extractSkillMemories(skills) {
742
+ const memories = [];
743
+ const now = new Date().toISOString();
744
+ // Group by type
745
+ const droids = skills.filter((s) => s.type === 'droid');
746
+ const skillItems = skills.filter((s) => s.type === 'skill');
747
+ const commands = skills.filter((s) => s.type === 'command');
748
+ const artifacts = skills.filter((s) => s.type === 'artifact');
749
+ // Create memory for available droids/agents
750
+ if (droids.length > 0) {
751
+ memories.push({
752
+ id: 'skills-droids-available',
753
+ timestamp: now,
754
+ type: 'observation',
755
+ content: `Available AI agents/droids: ${droids.map((d) => `${d.name} (${d.platform})`).join(', ')}. These can be invoked for specialized tasks.`,
756
+ tags: ['droids', 'agents', 'capabilities'],
757
+ importance: 8,
758
+ metadata: {
759
+ source: 'skills-discovery',
760
+ droids: droids.map((d) => ({ name: d.name, platform: d.platform, path: d.path })),
761
+ },
762
+ });
763
+ }
764
+ // Create memory for available skills
765
+ if (skillItems.length > 0) {
766
+ memories.push({
767
+ id: 'skills-skills-available',
768
+ timestamp: now,
769
+ type: 'observation',
770
+ content: `Available skills: ${skillItems.map((s) => s.name).join(', ')}. These provide specialized capabilities.`,
771
+ tags: ['skills', 'capabilities'],
772
+ importance: 7,
773
+ metadata: {
774
+ source: 'skills-discovery',
775
+ skills: skillItems.map((s) => ({ name: s.name, platform: s.platform, path: s.path })),
776
+ },
777
+ });
778
+ }
779
+ // Create memory for available commands
780
+ if (commands.length > 0) {
781
+ memories.push({
782
+ id: 'skills-commands-available',
783
+ timestamp: now,
784
+ type: 'observation',
785
+ content: `Available slash commands: ${commands.map((c) => `/${c.name}`).join(', ')}. Use these for quick actions.`,
786
+ tags: ['commands', 'shortcuts'],
787
+ importance: 7,
788
+ metadata: {
789
+ source: 'skills-discovery',
790
+ commands: commands.map((c) => ({ name: c.name, platform: c.platform, path: c.path })),
791
+ },
792
+ });
793
+ }
794
+ // Create memories for individual droids with descriptions
795
+ for (const droid of droids) {
796
+ if (droid.description && droid.description.length > 20) {
797
+ memories.push({
798
+ id: `skill-droid-${droid.name}`,
799
+ timestamp: now,
800
+ type: 'thought',
801
+ content: `Droid "${droid.name}" (${droid.platform}): ${droid.description}. Located at ${droid.path}.`,
802
+ tags: ['droid', droid.platform, droid.name],
803
+ importance: 6,
804
+ metadata: {
805
+ source: 'skills-discovery',
806
+ ...droid,
807
+ },
808
+ });
809
+ }
810
+ }
811
+ // Create memory for useful artifacts/templates
812
+ const usefulArtifacts = artifacts.filter((a) => a.path.includes('workflow') || a.path.includes('template') || a.path.includes('script'));
813
+ if (usefulArtifacts.length > 0) {
814
+ memories.push({
815
+ id: 'skills-artifacts-available',
816
+ timestamp: now,
817
+ type: 'observation',
818
+ content: `Useful project artifacts: ${usefulArtifacts
819
+ .slice(0, 10)
820
+ .map((a) => a.path)
821
+ .join(', ')}. These can be referenced or reused.`,
822
+ tags: ['artifacts', 'templates', 'reusable'],
823
+ importance: 5,
824
+ metadata: {
825
+ source: 'skills-discovery',
826
+ artifacts: usefulArtifacts.map((a) => a.path),
827
+ },
828
+ });
829
+ }
830
+ return memories;
831
+ }
832
+ //# sourceMappingURL=prepopulate.js.map