@cleocode/cleo 2026.10.3 → 2026.10.5-rc.ci.672

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 (352) hide show
  1. package/README.md +7 -0
  2. package/bin/cleo.js +11 -1
  3. package/dist/cli/adapter-OUQRSFZL.js +159 -0
  4. package/dist/cli/add-4SRRJL4U.js +443 -0
  5. package/dist/cli/add-batch-TSWICA5J.js +164 -0
  6. package/dist/cli/admin-L3F6CDYH.js +1428 -0
  7. package/dist/cli/admin-YMU55YCU.js +341 -0
  8. package/dist/cli/adr-XESRMFMP.js +172 -0
  9. package/dist/cli/agent-TAFPIYUU.js +2404 -0
  10. package/dist/cli/agent-outputs-HVJJIPS4.js +84 -0
  11. package/dist/cli/analyze-YQ22QVGW.js +49 -0
  12. package/dist/cli/archive-W5XX6AH7.js +65 -0
  13. package/dist/cli/archive-stats-HP2KPAJU.js +101 -0
  14. package/dist/cli/attention-7JBDCRZX.js +124 -0
  15. package/dist/cli/attention-ZXZANHKC.js +168 -0
  16. package/dist/cli/audit-ICA2SEFN.js +122 -0
  17. package/dist/cli/auth-DXIG5OG7.js +491 -0
  18. package/dist/cli/backfill-LBSYBWLR.js +156 -0
  19. package/dist/cli/backup-NUGBZ7NA.js +588 -0
  20. package/dist/cli/backup-inspect-PDRXI45A.js +26 -0
  21. package/dist/cli/backup-recover-TVKAPERB.js +29 -0
  22. package/dist/cli/blockers-ZOPCGHDW.js +55 -0
  23. package/dist/cli/brain-EJOBKL4A.js +397 -0
  24. package/dist/cli/briefing-RDQJ6WHS.js +213 -0
  25. package/dist/cli/caamp-Z3XPKEHB.js +181 -0
  26. package/dist/cli/cancel-S7EHLCJN.js +85 -0
  27. package/dist/cli/canon-NPF5RODM.js +142 -0
  28. package/dist/cli/canon-docs-2GTOLF7Y.js +26 -0
  29. package/dist/cli/cant-CHNN6O57.js +239 -0
  30. package/dist/cli/changeset-RYPHPN2B.js +246 -0
  31. package/dist/cli/check-C67YAU7W.js +759 -0
  32. package/dist/cli/check-DHMURGHC.js +924 -0
  33. package/dist/cli/checkpoint-UWDFOGYQ.js +128 -0
  34. package/dist/cli/chunk-22YPFZYB.js +91 -0
  35. package/dist/cli/chunk-2MGFDMDF.js +272 -0
  36. package/dist/cli/chunk-47JYZAMS.js +30 -0
  37. package/dist/cli/chunk-4JYHPP4C.js +76 -0
  38. package/dist/cli/chunk-4PEODTHY.js +278 -0
  39. package/dist/cli/chunk-4RGSNUUP.js +950 -0
  40. package/dist/cli/chunk-4VASFLUW.js +35 -0
  41. package/dist/cli/chunk-5PNI276X.js +124 -0
  42. package/dist/cli/chunk-6JSJNYH2.js +114 -0
  43. package/dist/cli/chunk-6N6WGLXE.js +63 -0
  44. package/dist/cli/chunk-75UH3BLS.js +210 -0
  45. package/dist/cli/chunk-7ACK4EIN.js +92 -0
  46. package/dist/cli/chunk-7NMKLVMI.js +107 -0
  47. package/dist/cli/chunk-7SINJXB6.js +110 -0
  48. package/dist/cli/chunk-7UARFJYS.js +46 -0
  49. package/dist/cli/chunk-7ZYPQV4N.js +90 -0
  50. package/dist/cli/chunk-AQCYT3L4.js +72 -0
  51. package/dist/cli/chunk-BQK6XTOH.js +57 -0
  52. package/dist/cli/chunk-C3B7C43W.js +16 -0
  53. package/dist/cli/chunk-CAPAGD5E.js +98 -0
  54. package/dist/cli/chunk-CHGEDCKG.js +77 -0
  55. package/dist/cli/chunk-COXFJ3PT.js +74 -0
  56. package/dist/cli/chunk-D7BAQNV2.js +55 -0
  57. package/dist/cli/chunk-EIUXVHNF.js +258 -0
  58. package/dist/cli/chunk-EUGB6P5V.js +173 -0
  59. package/dist/cli/chunk-EW2CKNNZ.js +304 -0
  60. package/dist/cli/chunk-FSKN4DWC.js +108 -0
  61. package/dist/cli/chunk-FVKLULL7.js +48 -0
  62. package/dist/cli/chunk-GAGUBU4Z.js +280 -0
  63. package/dist/cli/chunk-GKRFH2YG.js +171 -0
  64. package/dist/cli/chunk-GRU74UE4.js +270 -0
  65. package/dist/cli/chunk-GZFVDR44.js +320 -0
  66. package/dist/cli/chunk-HFLLZE6A.js +83 -0
  67. package/dist/cli/chunk-HXRXT3XU.js +78 -0
  68. package/dist/cli/chunk-IIOGUY3B.js +258 -0
  69. package/dist/cli/chunk-ILWWL462.js +60 -0
  70. package/dist/cli/chunk-J5USPJKZ.js +48 -0
  71. package/dist/cli/chunk-KEQS36GD.js +88 -0
  72. package/dist/cli/chunk-L7ONYSV6.js +2497 -0
  73. package/dist/cli/chunk-LVGIFMCV.js +163 -0
  74. package/dist/cli/chunk-NEFMQYLE.js +656 -0
  75. package/dist/cli/chunk-NU6CQQVB.js +4501 -0
  76. package/dist/cli/chunk-OILHT47L.js +252 -0
  77. package/dist/cli/chunk-PKKZPOOP.js +352 -0
  78. package/dist/cli/chunk-PN4WW5VX.js +66 -0
  79. package/dist/cli/chunk-PSJ33WVO.js +56 -0
  80. package/dist/cli/chunk-QA6T2LQ5.js +71 -0
  81. package/dist/cli/chunk-QJJWWCIC.js +288 -0
  82. package/dist/cli/chunk-QKMBWYAS.js +93 -0
  83. package/dist/cli/chunk-QWNKLLLG.js +84 -0
  84. package/dist/cli/chunk-QWUFFDL3.js +85 -0
  85. package/dist/cli/chunk-QY76BRUZ.js +35 -0
  86. package/dist/cli/chunk-R45KVF5Y.js +117 -0
  87. package/dist/cli/chunk-RRKP7HLU.js +66 -0
  88. package/dist/cli/chunk-SXXOC6KZ.js +209 -0
  89. package/dist/cli/chunk-T6GZJYL3.js +108 -0
  90. package/dist/cli/chunk-TLQ37HRE.js +67 -0
  91. package/dist/cli/chunk-TPTNEJZJ.js +52 -0
  92. package/dist/cli/chunk-TYC7G5LF.js +100 -0
  93. package/dist/cli/chunk-UWCZY52R.js +766 -0
  94. package/dist/cli/chunk-VB3LDPL5.js +46 -0
  95. package/dist/cli/chunk-VLEYOOPH.js +31 -0
  96. package/dist/cli/chunk-W3JLYKKY.js +140 -0
  97. package/dist/cli/chunk-WWCYZYSN.js +56 -0
  98. package/dist/cli/chunk-XA5WISNV.js +52 -0
  99. package/dist/cli/chunk-XHRZ7OYZ.js +132 -0
  100. package/dist/cli/chunk-XLPMIGJJ.js +148 -0
  101. package/dist/cli/chunk-YY66LFZF.js +29 -0
  102. package/dist/cli/chunk-ZMGDZMSJ.js +210 -0
  103. package/dist/cli/claim-IGOG2QOC.js +97 -0
  104. package/dist/cli/classify-MG4N7GMQ.js +117 -0
  105. package/dist/cli/cli-A23Q335V.js +51 -0
  106. package/dist/cli/cloud-SILYJVKO.js +731 -0
  107. package/dist/cli/cockpit-RZKLGYPN.js +790 -0
  108. package/dist/cli/code-H2FQCVMW.js +178 -0
  109. package/dist/cli/complete-JLX7NBI4.js +35 -0
  110. package/dist/cli/complexity-OKV7PVZH.js +57 -0
  111. package/dist/cli/compliance-QMGZHJNQ.js +277 -0
  112. package/dist/cli/conduit-4H32UYEA.js +308 -0
  113. package/dist/cli/conduit-EY54WTZA.js +535 -0
  114. package/dist/cli/config-TDYOC7XO.js +519 -0
  115. package/dist/cli/consensus-4XCOFPPT.js +122 -0
  116. package/dist/cli/context-FN4YTGHD.js +142 -0
  117. package/dist/cli/contribution-7RWFBJLC.js +112 -0
  118. package/dist/cli/curator-HKZJCVRL.js +139 -0
  119. package/dist/cli/current-B2NU7V3G.js +43 -0
  120. package/dist/cli/daemon-GBD4TVCD.js +452 -0
  121. package/dist/cli/dash-IGDANIE5.js +71 -0
  122. package/dist/cli/decide-26SXC2V6.js +416 -0
  123. package/dist/cli/decompose-LQ76TEZG.js +78 -0
  124. package/dist/cli/decomposition-WFRWNUSJ.js +122 -0
  125. package/dist/cli/delete-T5DUQHOX.js +69 -0
  126. package/dist/cli/deps-UTPZJBXL.js +462 -0
  127. package/dist/cli/detect-FFZSMVDT.js +46 -0
  128. package/dist/cli/detect-drift-TVCJOFYJ.js +408 -0
  129. package/dist/cli/diagnostics-GN5CVD3N.js +93 -0
  130. package/dist/cli/diagnostics-ZNBKH6GX.js +133 -0
  131. package/dist/cli/docs-CLQKEEUK.js +1710 -0
  132. package/dist/cli/docs-DPPDFTWR.js +3098 -0
  133. package/dist/cli/doctor-GPENOP4N.js +1270 -0
  134. package/dist/cli/doctor-ac-bindings-S3IOEFP4.js +26 -0
  135. package/dist/cli/doctor-acceptance-drift-VNFKPBSQ.js +26 -0
  136. package/dist/cli/doctor-credentials-A5H4JMTF.js +26 -0
  137. package/dist/cli/doctor-db-substrate-FGCISE4Z.js +27 -0
  138. package/dist/cli/doctor-dep-cycles-BKKKHHYG.js +26 -0
  139. package/dist/cli/doctor-exodus-ND2DH2KP.js +26 -0
  140. package/dist/cli/doctor-exodus-residue-4EMRYMEQ.js +26 -0
  141. package/dist/cli/doctor-fk-check-VY3RIQV3.js +26 -0
  142. package/dist/cli/doctor-global-delivery-JN6IGHUL.js +26 -0
  143. package/dist/cli/doctor-heavy-command-hook-XSN44WXU.js +26 -0
  144. package/dist/cli/doctor-legacy-backups-QAG5NHYP.js +26 -0
  145. package/dist/cli/doctor-legacy-reaper-CIRGFE6R.js +26 -0
  146. package/dist/cli/doctor-malformed-ids-WL7HT4TB.js +26 -0
  147. package/dist/cli/doctor-manifest-rows-SMQCKJ2T.js +26 -0
  148. package/dist/cli/doctor-memory-guard-LJDOJG76.js +26 -0
  149. package/dist/cli/doctor-migrations-ETQPFNUP.js +26 -0
  150. package/dist/cli/doctor-nexus-residency-A4JMKBEJ.js +26 -0
  151. package/dist/cli/doctor-project-identity-FFQJ5LNX.js +26 -0
  152. package/dist/cli/doctor-projects-MFUTKRHP.js +30 -0
  153. package/dist/cli/doctor-projects-registry-76X6VTGM.js +26 -0
  154. package/dist/cli/doctor-release-readiness-QJCOPFTK.js +26 -0
  155. package/dist/cli/doctor-repair-AU76FIKY.js +26 -0
  156. package/dist/cli/doctor-row-identity-KW6JYZQE.js +26 -0
  157. package/dist/cli/doctor-skill-fixtures-G3T7JUHS.js +26 -0
  158. package/dist/cli/doctor-split-brain-FUW6L7FS.js +26 -0
  159. package/dist/cli/doctor-superseded-store-DUHGSBLC.js +26 -0
  160. package/dist/cli/doctor-sync-journal-SXMUIKF7.js +26 -0
  161. package/dist/cli/doctor-sync-triggers-6WNJZFRM.js +26 -0
  162. package/dist/cli/doctor-tool-locks-66LSLUBN.js +26 -0
  163. package/dist/cli/doctor-twin-collapse-AYBYBFC4.js +26 -0
  164. package/dist/cli/doctor-worktree-stores-C5XEH5OG.js +26 -0
  165. package/dist/cli/done-R64XRZ32.js +196 -0
  166. package/dist/cli/dynamic-RR4HB7BB.js +29 -0
  167. package/dist/cli/entities-3JIHDIOK.js +361 -0
  168. package/dist/cli/event-45KEWV5H.js +372 -0
  169. package/dist/cli/exists-BEDZS5RI.js +65 -0
  170. package/dist/cli/exodus-DUX62344.js +401 -0
  171. package/dist/cli/export-C5PQIQ5O.js +93 -0
  172. package/dist/cli/export-tasks-CUXDZPJB.js +97 -0
  173. package/dist/cli/federation-ESM35EGG.js +145 -0
  174. package/dist/cli/find-5EUZHHQJ.js +178 -0
  175. package/dist/cli/focus-6AH4KLRO.js +368 -0
  176. package/dist/cli/focus-ANKAIRO5.js +56 -0
  177. package/dist/cli/gateway-2GW2KTK3.js +77 -0
  178. package/dist/cli/gateway-auto-start-EDK7XI6E.js +36 -0
  179. package/dist/cli/gc-CTOQLUSA.js +291 -0
  180. package/dist/cli/go-YJPNHHYT.js +206 -0
  181. package/dist/cli/goal-4GW4G77D.js +213 -0
  182. package/dist/cli/grade-25WSZH4X.js +57 -0
  183. package/dist/cli/graph-JUO3TMF3.js +879 -0
  184. package/dist/cli/history-NACNUQTC.js +138 -0
  185. package/dist/cli/hook-UF7J7R6D.js +57 -0
  186. package/dist/cli/hook-entry.js +244 -19
  187. package/dist/cli/hygiene-3QZ2NI7P.js +55 -0
  188. package/dist/cli/import-7ESGL5SS.js +89 -0
  189. package/dist/cli/import-tasks-FLE2RPBR.js +109 -0
  190. package/dist/cli/index.js +601 -94637
  191. package/dist/cli/init-AN4DZ2XO.js +40 -0
  192. package/dist/cli/inject-HQWA5GWY.js +83 -0
  193. package/dist/cli/install-global-YQV4W5OG.js +95 -0
  194. package/dist/cli/intelligence-OFFNQGHE.js +238 -0
  195. package/dist/cli/intelligence-QIC4SN4X.js +182 -0
  196. package/dist/cli/issue-P5RNMRDG.js +159 -0
  197. package/dist/cli/janitor-ZNCFQ7E3.js +111 -0
  198. package/dist/cli/labels-ORBM3T57.js +88 -0
  199. package/dist/cli/lifecycle-MHR22TVI.js +273 -0
  200. package/dist/cli/list-LB6GCYYU.js +109 -0
  201. package/dist/cli/llm-H7LZWQKX.js +130 -0
  202. package/dist/cli/llm-OTJWPMGI.js +704 -0
  203. package/dist/cli/llm-cost-MLMXEAR4.js +25 -0
  204. package/dist/cli/llm-stream-AAEUNKRP.js +27 -0
  205. package/dist/cli/log-W2A5M2NA.js +76 -0
  206. package/dist/cli/login-SIXFFZSP.js +45 -0
  207. package/dist/cli/logout-G3KVLQQM.js +74 -0
  208. package/dist/cli/manifest-G4T6EBSI.js +354 -0
  209. package/dist/cli/map-VU5M72TK.js +53 -0
  210. package/dist/cli/memory-2E27G2G5.js +1952 -0
  211. package/dist/cli/memory-IAEYKXG6.js +1895 -0
  212. package/dist/cli/migrate-agents-v2-A52QIYNJ.js +33 -0
  213. package/dist/cli/migrate-claude-mem-TPDW3R4Z.js +206 -0
  214. package/dist/cli/next-SVH4LIDY.js +57 -0
  215. package/dist/cli/nexus-FPQV2EAF.js +1059 -0
  216. package/dist/cli/nexus-XSFXN5E6.js +2924 -0
  217. package/dist/cli/ops-K6LHY5J6.js +52 -0
  218. package/dist/cli/orchestrate-CZ2J6W3L.js +1650 -0
  219. package/dist/cli/orchestrate-HURUCQFT.js +950 -0
  220. package/dist/cli/otel-JCNPVJLZ.js +188 -0
  221. package/dist/cli/phase-VDFRASSO.js +221 -0
  222. package/dist/cli/pipeline-TCZPOEDR.js +697 -0
  223. package/dist/cli/pivot-V5MSQZ7L.js +88 -0
  224. package/dist/cli/plan-SQUGCKSM.js +49 -0
  225. package/dist/cli/playbook-L47GLDQD.js +230 -0
  226. package/dist/cli/playbook-NJVO4R6P.js +33 -0
  227. package/dist/cli/project-YZEC7GYF.js +331 -0
  228. package/dist/cli/promote-FINF4HVK.js +53 -0
  229. package/dist/cli/provenance-3TUWVBFR.js +141 -0
  230. package/dist/cli/provenance-YZG33JGM.js +129 -0
  231. package/dist/cli/provider-23JVLLG3.js +213 -0
  232. package/dist/cli/reason-FHN54O7O.js +138 -0
  233. package/dist/cli/reconcile-MOM5T4AX.js +128 -0
  234. package/dist/cli/refresh-memory-3OSTRAVK.js +45 -0
  235. package/dist/cli/relates-6FWUFUS2.js +260 -0
  236. package/dist/cli/release-G2DPSG5M.js +347 -0
  237. package/dist/cli/release-URX6JHZ2.js +525 -0
  238. package/dist/cli/remote-VIULU2T5.js +279 -0
  239. package/dist/cli/renderers-TGSW77J4.js +37 -0
  240. package/dist/cli/reorder-UIPN6TQY.js +87 -0
  241. package/dist/cli/reparent-ALOWWUIU.js +59 -0
  242. package/dist/cli/req-RH2Y3H7A.js +130 -0
  243. package/dist/cli/research-G2Y72HRC.js +366 -0
  244. package/dist/cli/restore-VBR5XNML.js +470 -0
  245. package/dist/cli/revert-32LDNSGP.js +240 -0
  246. package/dist/cli/roadmap-LFU3AG7D.js +62 -0
  247. package/dist/cli/run-HXRILSR7.js +245 -0
  248. package/dist/cli/safestop-Z5UC7NGQ.js +89 -0
  249. package/dist/cli/saga-Y6FZS6AM.js +286 -0
  250. package/dist/cli/schema-OOOKLWUE.js +195 -0
  251. package/dist/cli/self-update-26SOTJMH.js +504 -0
  252. package/dist/cli/selfimprove-4SMOCLUV.js +89 -0
  253. package/dist/cli/selfimprove-EB4RQLP4.js +139 -0
  254. package/dist/cli/sentient-QPETVE53.js +254 -0
  255. package/dist/cli/sentient-RGMWR4XJ.js +1088 -0
  256. package/dist/cli/sequence-H7DSAJPF.js +94 -0
  257. package/dist/cli/service-EK5MGB2D.js +156 -0
  258. package/dist/cli/service-GLOMZWPQ.js +437 -0
  259. package/dist/cli/session-HYUXAQGC.js +708 -0
  260. package/dist/cli/session-N5ISU56W.js +568 -0
  261. package/dist/cli/setup-L3YYV53D.js +323 -0
  262. package/dist/cli/show-364V3KY2.js +123 -0
  263. package/dist/cli/skill-F2KR6HW5.js +84 -0
  264. package/dist/cli/skills-FS3DCP6E.js +929 -0
  265. package/dist/cli/smoke-provider-SKUFMZXU.js +218 -0
  266. package/dist/cli/snapshot-EGXEQ5PR.js +120 -0
  267. package/dist/cli/src-LYLXHXHH.js +80 -0
  268. package/dist/cli/start-6DXOCCKL.js +68 -0
  269. package/dist/cli/stats-UVUQEGYC.js +96 -0
  270. package/dist/cli/status-XLKYLN42.js +157 -0
  271. package/dist/cli/sticky-VSTQ2I2O.js +264 -0
  272. package/dist/cli/sticky-XZXZDCFW.js +339 -0
  273. package/dist/cli/stop-VNOAFWNB.js +43 -0
  274. package/dist/cli/sync-YYPARW3A.js +155 -0
  275. package/dist/cli/tasks-C24KHTFF.js +1118 -0
  276. package/dist/cli/tasks-LBJC7CZV.js +175 -0
  277. package/dist/cli/telemetry-CU7W5WAY.js +120 -0
  278. package/dist/cli/templates-G42JBUY4.js +609 -0
  279. package/dist/cli/testing-HSRITHEY.js +147 -0
  280. package/dist/cli/token-J74E7TSU.js +221 -0
  281. package/dist/cli/tools-BI74W7VE.js +652 -0
  282. package/dist/cli/transcript-RGK7RSGQ.js +440 -0
  283. package/dist/cli/tui-BPUFHYKK.js +51 -0
  284. package/dist/cli/update-2KQWA27S.js +478 -0
  285. package/dist/cli/update-check-entry.js +124 -0
  286. package/dist/cli/update-notice-6SQ6WPQG.js +68 -0
  287. package/dist/cli/upgrade-E2MJAPC7.js +136 -0
  288. package/dist/cli/upgrade-XRSQ4RWH.js +243 -0
  289. package/dist/cli/verify-WASRGDBA.js +191 -0
  290. package/dist/cli/web-NJ3P67EU.js +275 -0
  291. package/dist/cli/workgraph-OHJ2VKJD.js +232 -0
  292. package/dist/cli/worktree-FVQLORFY.js +371 -0
  293. package/dist/cli/worktree-ZJ6JTQNG.js +287 -0
  294. package/package.json +13 -13
  295. package/studio-dist/client/_app/immutable/chunks/{DMj27Pxj.js → AH7dIemv.js} +1 -1
  296. package/studio-dist/client/_app/immutable/chunks/{Dc2owyvE.js → BDgH40i3.js} +1 -1
  297. package/studio-dist/client/_app/immutable/chunks/BXDCSJ7U.js +1 -0
  298. package/studio-dist/client/_app/immutable/chunks/{qq3pe1aT.js → Gg4iYl59.js} +1 -1
  299. package/studio-dist/client/_app/immutable/entry/{app.CHWXLeE9.js → app.DUDNK-37.js} +2 -2
  300. package/studio-dist/client/_app/immutable/entry/start.DNmZ0pA4.js +1 -0
  301. package/studio-dist/client/_app/immutable/nodes/{0.DmKQGvFh.js → 0.DWqP3ail.js} +1 -1
  302. package/studio-dist/client/_app/immutable/nodes/{1.DqJk_REO.js → 1.CZGVUP5B.js} +1 -1
  303. package/studio-dist/client/_app/immutable/nodes/{15.GUy6kdW1.js → 15.DGaflZRS.js} +1 -1
  304. package/studio-dist/client/_app/immutable/nodes/{16.CcnKZ8f9.js → 16.uYlarGXl.js} +1 -1
  305. package/studio-dist/client/_app/immutable/nodes/{17.DAlQF3lQ.js → 17.CZMR0E47.js} +1 -1
  306. package/studio-dist/client/_app/immutable/nodes/{18.vQFr-vFj.js → 18.CBC-AKH_.js} +1 -1
  307. package/studio-dist/client/_app/immutable/nodes/{20.GVOj5j_r.js → 20.BGi43MvQ.js} +1 -1
  308. package/studio-dist/client/_app/immutable/nodes/{24.2-wC6DOh.js → 24.Dv8ftCyR.js} +1 -1
  309. package/studio-dist/client/_app/immutable/nodes/25.DQPVlTDQ.js +39 -0
  310. package/studio-dist/client/_app/immutable/nodes/{26.C3rNqzZF.js → 26.Cl800304.js} +1 -1
  311. package/studio-dist/client/_app/immutable/nodes/{3.b-7pzc3M.js → 3.D_fQKj9f.js} +1 -1
  312. package/studio-dist/client/_app/version.json +1 -1
  313. package/studio-dist/server/chunks/{0-BaCce-O1.js → 0-BpOagOst.js} +3 -3
  314. package/studio-dist/server/chunks/1-D0oRGR-C.js +9 -0
  315. package/studio-dist/server/chunks/{15-DRMOSIC9.js → 15-BcjHz7Tv.js} +3 -3
  316. package/studio-dist/server/chunks/{16-BulXhoZZ.js → 16-CXm8TUk7.js} +3 -3
  317. package/studio-dist/server/chunks/{17-DUEOCM0H.js → 17-mSgUK-cp.js} +3 -3
  318. package/studio-dist/server/chunks/{18-DP7Q8zPs.js → 18-BtfnIw1d.js} +3 -3
  319. package/studio-dist/server/chunks/{20-9ta6MI7q.js → 20-By1e4QDS.js} +3 -3
  320. package/studio-dist/server/chunks/{24-DysdL1ab.js → 24-0i2YLVxG.js} +3 -3
  321. package/studio-dist/server/chunks/{dist-CdoCt9zT.js → 25-DPsrqbrh.js} +797 -10736
  322. package/studio-dist/server/chunks/{26-Df4YXgg0.js → 26-P0XkOibm.js} +3 -3
  323. package/studio-dist/server/chunks/{3-BEhOhYpL.js → 3-WudjUK7e.js} +3 -3
  324. package/studio-dist/server/chunks/{_layout.svelte-CnLcXYG-.js → _layout.svelte-D9m81Rle.js} +4 -4
  325. package/studio-dist/server/chunks/{_page.svelte-DGhXqeRc.js → _page.svelte-2PDLOF83.js} +3 -3
  326. package/studio-dist/server/chunks/{_page.svelte-Dv8tmDEC.js → _page.svelte-BjE3jm2K.js} +3 -3
  327. package/studio-dist/server/chunks/{_page.svelte-C0qgUvzA.js → _page.svelte-Clc0vmiZ.js} +4 -4
  328. package/studio-dist/server/chunks/{_page.svelte-ui7LnWkL.js → _page.svelte-DABdRT3h.js} +3 -3
  329. package/studio-dist/server/chunks/{_page.svelte-HUqTICJR.js → _page.svelte-DG3PjiHj.js} +3 -3
  330. package/studio-dist/server/chunks/{_page.svelte-DzcZljiy.js → _page.svelte-Edy9CaE8.js} +20 -7
  331. package/studio-dist/server/chunks/{_page.svelte-DOl0DGOO.js → _page.svelte-Hrf3-ZR8.js} +3 -3
  332. package/studio-dist/server/chunks/{_page.svelte-Da4q5l93.js → _page.svelte-VB4O4Nl5.js} +3 -3
  333. package/studio-dist/server/chunks/{_page.svelte-CbyEPj2j.js → _page.svelte-d3jEgjsI.js} +3 -3
  334. package/studio-dist/server/chunks/{_server.ts-P4wVVksg.js → _server.ts-BcRFsyo3.js} +4 -5
  335. package/studio-dist/server/chunks/{_server.ts-Cr57EKWf.js → _server.ts-CEWpIFrj.js} +6 -5
  336. package/studio-dist/server/chunks/{_server.ts-CnKVmf_s.js → _server.ts-CLVdVIF9.js} +2 -2
  337. package/studio-dist/server/chunks/{_server.ts-C0evMKCk.js → _server.ts-D_j7aSy5.js} +6 -5
  338. package/studio-dist/server/chunks/{_server.ts-2BazvYRP.js → _server.ts-QEZF8h2q.js} +4 -5
  339. package/studio-dist/server/chunks/{client-CPM4LrO2.js → client-Kp1dP1od.js} +2 -2
  340. package/studio-dist/server/chunks/{error.svelte-ShcZo43D.js → error.svelte-WOCioJVX.js} +3 -3
  341. package/studio-dist/server/chunks/{hooks.server-D2qbf3Zp.js → hooks.server-DH9zkIrJ.js} +3 -1
  342. package/studio-dist/server/chunks/{http-BiQjEmVU.js → http-DT5kxaWk.js} +5 -4
  343. package/studio-dist/server/chunks/{internal-Cgsrya1j.js → internal-z0vqd5_u.js} +3 -3
  344. package/studio-dist/server/chunks/operations-registry-DdzmYzqX.js +10584 -0
  345. package/studio-dist/server/chunks/{stores-BGrpEDMK.js → stores-s2kaL315.js} +2 -2
  346. package/studio-dist/server/index.js +1 -1
  347. package/studio-dist/server/manifest.js +17 -17
  348. package/studio-dist/client/_app/immutable/chunks/Bw6J8NDM.js +0 -1
  349. package/studio-dist/client/_app/immutable/entry/start.C9bwPpvc.js +0 -1
  350. package/studio-dist/client/_app/immutable/nodes/25.D1vYaH8g.js +0 -39
  351. package/studio-dist/server/chunks/1-CVo7Nk6d.js +0 -9
  352. package/studio-dist/server/chunks/25-CYsps38R.js +0 -366
@@ -0,0 +1,1952 @@
1
+ (() => {
2
+ const _installed = Symbol.for('cleocode.cli.sqliteWarningFilter');
3
+ if (globalThis[_installed]) return;
4
+ globalThis[_installed] = true;
5
+ const _origEmitWarning = process.emitWarning;
6
+ process.emitWarning = function(warning, type, code, ctor) {
7
+ if (typeof warning === 'object' && warning.name === 'ExperimentalWarning' && typeof warning.message === 'string' && /SQLite is an experimental feature/i.test(warning.message)) {
8
+ return;
9
+ }
10
+ if (typeof warning === 'string' && /SQLite is an experimental feature/i.test(warning)) {
11
+ return;
12
+ }
13
+ return _origEmitWarning.call(process, warning, type, code, ctor);
14
+ };
15
+ })();
16
+ import {
17
+ dispatchFromCli,
18
+ dispatchRaw,
19
+ handleRawError
20
+ } from "./chunk-L7ONYSV6.js";
21
+ import {
22
+ CLEO_DIR_NAME,
23
+ MIGRATE_MEMORY_HASHES_JSON
24
+ } from "./chunk-6N6WGLXE.js";
25
+ import "./chunk-4VASFLUW.js";
26
+ import {
27
+ defineCommand,
28
+ showUsage
29
+ } from "./chunk-PKKZPOOP.js";
30
+ import "./chunk-QKMBWYAS.js";
31
+ import {
32
+ cliError,
33
+ cliOutput
34
+ } from "./chunk-4RGSNUUP.js";
35
+ import "./chunk-6JSJNYH2.js";
36
+ import "./chunk-D7BAQNV2.js";
37
+ import "./chunk-TYC7G5LF.js";
38
+
39
+ // packages/cleo/src/cli/commands/memory.ts
40
+ import { runConsolidation } from "@cleocode/core/memory/brain-lifecycle";
41
+ import { getDreamStatus, triggerManualDream } from "@cleocode/core/memory/dream-cycle";
42
+ import { importMemoryFiles } from "@cleocode/core/memory/import-from-provider.js";
43
+ import { getTierStats, scanDuplicateEntries, setEntryTier } from "@cleocode/core/memory/public-api";
44
+ import { streamMemoryWatchEvents } from "@cleocode/core/memory/watch-stream.js";
45
+ import { getProjectRoot } from "@cleocode/core/project-scope";
46
+ import { getBrainDb } from "@cleocode/core/store/memory-sqlite";
47
+ var storeCommand = defineCommand({
48
+ meta: { name: "store", description: "Store a pattern or learning to BRAIN memory" },
49
+ args: {
50
+ type: {
51
+ type: "string",
52
+ description: "Memory type: pattern or learning",
53
+ required: true
54
+ },
55
+ content: {
56
+ type: "string",
57
+ description: "Content of the memory entry",
58
+ required: true
59
+ },
60
+ context: {
61
+ type: "string",
62
+ description: "Context in which the pattern/learning was observed"
63
+ },
64
+ source: {
65
+ type: "string",
66
+ description: "Source of the learning"
67
+ },
68
+ "pattern-type": {
69
+ type: "string",
70
+ description: "Pattern type: workflow, blocker, success, failure, optimization"
71
+ },
72
+ impact: {
73
+ type: "string",
74
+ description: "Impact level: low, medium, high"
75
+ },
76
+ confidence: {
77
+ type: "string",
78
+ description: "Confidence score 0.0-1.0 (for learnings)"
79
+ },
80
+ actionable: {
81
+ type: "boolean",
82
+ description: "Mark learning as actionable"
83
+ },
84
+ "linked-task": {
85
+ type: "string",
86
+ description: "Task ID to link this memory to"
87
+ },
88
+ json: {
89
+ type: "boolean",
90
+ description: "Output as JSON"
91
+ }
92
+ },
93
+ async run({ args }) {
94
+ const memType = args.type;
95
+ if (memType === "pattern") {
96
+ await dispatchFromCli(
97
+ "mutate",
98
+ "memory",
99
+ "pattern.store",
100
+ {
101
+ type: args["pattern-type"] || "workflow",
102
+ pattern: args.content,
103
+ context: args.context || "Unspecified context",
104
+ impact: args.impact,
105
+ examples: args["linked-task"] ? [args["linked-task"]] : []
106
+ },
107
+ { command: "memory", operation: "memory.pattern.store" }
108
+ );
109
+ } else if (memType === "learning") {
110
+ await dispatchFromCli(
111
+ "mutate",
112
+ "memory",
113
+ "learning.store",
114
+ {
115
+ insight: args.content,
116
+ source: args.source || "manual",
117
+ confidence: args.confidence !== void 0 ? parseFloat(args.confidence) : 0.5,
118
+ actionable: !!args.actionable,
119
+ applicableTypes: args["linked-task"] ? [args["linked-task"]] : []
120
+ },
121
+ { command: "memory", operation: "memory.learning.store" }
122
+ );
123
+ } else {
124
+ cliError(`Unknown memory type: ${memType}. Use 'pattern' or 'learning'.`, "E_VALIDATION", {
125
+ name: "E_VALIDATION"
126
+ });
127
+ process.exit(1);
128
+ }
129
+ }
130
+ });
131
+ var findCommand = defineCommand({
132
+ meta: {
133
+ name: "find",
134
+ description: "Search BRAIN memory (all tables, or filter by --type decision|pattern|learning|observation)"
135
+ },
136
+ args: {
137
+ query: {
138
+ type: "positional",
139
+ description: "Search query",
140
+ required: true
141
+ },
142
+ type: {
143
+ type: "string",
144
+ description: "Filter by memory type: decision, pattern, learning, or observation (default: all)"
145
+ },
146
+ history: {
147
+ type: "boolean",
148
+ description: "Include superseded and invalidated memory as historical evidence"
149
+ },
150
+ "pattern-type": {
151
+ type: "string",
152
+ description: "Filter patterns by type: workflow, blocker, success, failure, optimization"
153
+ },
154
+ "min-confidence": {
155
+ type: "string",
156
+ description: "Minimum confidence for learnings"
157
+ },
158
+ actionable: {
159
+ type: "boolean",
160
+ description: "Only show actionable learnings"
161
+ },
162
+ limit: {
163
+ type: "string",
164
+ description: "Maximum results"
165
+ },
166
+ // T418: agent filter for per-agent mental model retrieval
167
+ agent: {
168
+ type: "string",
169
+ description: "Filter observations by agent provenance name (Wave 8 mental models)"
170
+ },
171
+ json: {
172
+ type: "boolean",
173
+ description: "Output as JSON"
174
+ }
175
+ },
176
+ async run({ args }) {
177
+ const query = args.query;
178
+ const memType = args.type;
179
+ if (memType !== void 0 && !["decision", "pattern", "learning", "observation"].includes(memType)) {
180
+ cliError(
181
+ `Unknown memory type: ${memType}. Use decision, pattern, learning, or observation.`,
182
+ "E_VALIDATION",
183
+ { name: "E_VALIDATION" }
184
+ );
185
+ process.exitCode = 1;
186
+ return;
187
+ }
188
+ if (args.agent !== void 0 && memType !== void 0 && memType !== "observation") {
189
+ cliError("--agent can only be combined with --type observation.", "E_VALIDATION", {
190
+ name: "E_VALIDATION"
191
+ });
192
+ process.exitCode = 1;
193
+ return;
194
+ }
195
+ if (memType === "pattern" && !args.history) {
196
+ await dispatchFromCli(
197
+ "query",
198
+ "memory",
199
+ "pattern.find",
200
+ {
201
+ query,
202
+ type: args["pattern-type"],
203
+ limit: args.limit !== void 0 ? parseInt(args.limit, 10) : void 0
204
+ },
205
+ { command: "memory", operation: "memory.find" }
206
+ );
207
+ } else if (memType === "learning" && !args.history) {
208
+ await dispatchFromCli(
209
+ "query",
210
+ "memory",
211
+ "learning.find",
212
+ {
213
+ query,
214
+ minConfidence: args["min-confidence"] !== void 0 ? parseFloat(args["min-confidence"]) : void 0,
215
+ actionableOnly: !!args.actionable,
216
+ limit: args.limit !== void 0 ? parseInt(args.limit, 10) : void 0
217
+ },
218
+ { command: "memory", operation: "memory.find" }
219
+ );
220
+ } else {
221
+ await dispatchFromCli(
222
+ "query",
223
+ "memory",
224
+ "find",
225
+ {
226
+ query,
227
+ limit: args.limit !== void 0 ? parseInt(args.limit, 10) : void 0,
228
+ includeHistory: args.history,
229
+ ...memType === "pattern" && { tables: ["patterns"] },
230
+ ...memType === "learning" && { tables: ["learnings"] },
231
+ ...memType === "decision" && { tables: ["decisions"] },
232
+ ...memType === "observation" && { tables: ["observations"] },
233
+ // T418: forward agent filter when provided
234
+ ...args.agent !== void 0 && { agent: args.agent }
235
+ },
236
+ { command: "memory", operation: "memory.find" }
237
+ );
238
+ }
239
+ }
240
+ });
241
+ var statsCommand = defineCommand({
242
+ meta: { name: "stats", description: "Show BRAIN memory statistics" },
243
+ async run() {
244
+ const pResponse = await dispatchRaw("query", "memory", "pattern.find", {
245
+ query: "",
246
+ limit: 0
247
+ });
248
+ const lResponse = await dispatchRaw("query", "memory", "learning.find", {
249
+ query: "",
250
+ limit: 0
251
+ });
252
+ const result = {};
253
+ if (pResponse.success) result["patterns"] = pResponse.data;
254
+ if (lResponse.success) result["learnings"] = lResponse.data;
255
+ if (!pResponse.success && !lResponse.success) {
256
+ handleRawError(pResponse, { command: "memory-stats", operation: "memory.stats" });
257
+ return;
258
+ }
259
+ cliOutput(result, { command: "memory-stats", operation: "memory.stats" });
260
+ }
261
+ });
262
+ var observeCommand = defineCommand({
263
+ meta: {
264
+ name: "observe",
265
+ description: "Save an observation to brain.db \u2014 captures facts, decisions, and discoveries for cross-session memory"
266
+ },
267
+ args: {
268
+ text: {
269
+ type: "positional",
270
+ description: "Observation text",
271
+ required: true
272
+ },
273
+ title: {
274
+ type: "string",
275
+ description: "Short title for the observation (defaults to first 120 chars of text)"
276
+ },
277
+ type: {
278
+ type: "string",
279
+ description: "Category: discovery (found something new), decision (choice made), bugfix (bug found/fixed), refactor (code restructured), feature (feature added), change (general change), diary (journal entry), session-summary (end-of-session recap auto-created by cleo session end)"
280
+ },
281
+ agent: {
282
+ type: "string",
283
+ description: "Name of the agent producing this observation (enables per-agent memory retrieval)"
284
+ },
285
+ "source-type": {
286
+ type: "string",
287
+ description: "How this observation was captured: manual (typed by human/agent), auto (lifecycle hook), transcript (extracted from session)"
288
+ },
289
+ attach: {
290
+ type: "string",
291
+ description: "SHA-256 of an attachment to link to this observation (comma-separated for multiple)"
292
+ }
293
+ },
294
+ async run({ args }) {
295
+ await dispatchFromCli(
296
+ "mutate",
297
+ "memory",
298
+ "observe",
299
+ {
300
+ text: args.text,
301
+ title: args.title,
302
+ ...args.agent !== void 0 && { agent: args.agent },
303
+ ...args.type !== void 0 && { type: args.type },
304
+ sourceType: args["source-type"] ?? "manual",
305
+ // T799: pass attachment refs
306
+ ...args.attach !== void 0 && { attach: args.attach }
307
+ },
308
+ { command: "memory", operation: "memory.observe" }
309
+ );
310
+ }
311
+ });
312
+ var timelineCommand = defineCommand({
313
+ meta: {
314
+ name: "timeline",
315
+ description: "Show chronological context around an anchor observation ID"
316
+ },
317
+ args: {
318
+ // Output format is controlled by the global --json/--human flags (format-context).
319
+ anchor: {
320
+ type: "positional",
321
+ description: "Anchor observation ID",
322
+ required: true
323
+ },
324
+ before: {
325
+ type: "string",
326
+ description: "Number of entries before anchor"
327
+ },
328
+ after: {
329
+ type: "string",
330
+ description: "Number of entries after anchor"
331
+ }
332
+ },
333
+ async run({ args }) {
334
+ await dispatchFromCli(
335
+ "query",
336
+ "memory",
337
+ "timeline",
338
+ {
339
+ anchor: args.anchor,
340
+ depthBefore: args.before !== void 0 ? parseInt(args.before, 10) : void 0,
341
+ depthAfter: args.after !== void 0 ? parseInt(args.after, 10) : void 0
342
+ },
343
+ { command: "memory-timeline", operation: "memory.timeline" }
344
+ );
345
+ }
346
+ });
347
+ var fetchCommand = defineCommand({
348
+ meta: { name: "fetch", description: "Fetch full details for specific observation IDs" },
349
+ args: {
350
+ // Note: citty doesn't support variadic positional args, so we accept a single
351
+ // positional and split on commas/spaces to support: `cleo memory fetch ID1,ID2`
352
+ // Output format is controlled by the global --json/--human flags (format-context).
353
+ ids: {
354
+ type: "positional",
355
+ description: "Comma- or space-separated observation IDs",
356
+ required: true
357
+ }
358
+ },
359
+ async run({ args }) {
360
+ const ids = args.ids.split(/[,\s]+/).map((s) => s.trim()).filter(Boolean);
361
+ await dispatchFromCli(
362
+ "query",
363
+ "memory",
364
+ "fetch",
365
+ { ids },
366
+ { command: "memory-fetch", operation: "memory.fetch" }
367
+ );
368
+ }
369
+ });
370
+ var decisionFindCommand = defineCommand({
371
+ meta: {
372
+ name: "decision-find",
373
+ description: "Search architectural decisions (use BEFORE grep or ledger files)"
374
+ },
375
+ args: {
376
+ query: {
377
+ type: "positional",
378
+ description: "Search query",
379
+ required: false
380
+ },
381
+ limit: {
382
+ type: "string",
383
+ description: "Maximum results"
384
+ },
385
+ "include-agent-dispatch": {
386
+ type: "boolean",
387
+ description: "Include AGT-* agent dispatch rows (excluded by default \u2014 use to surface execution history)"
388
+ },
389
+ json: {
390
+ type: "boolean",
391
+ description: "Output as JSON"
392
+ }
393
+ },
394
+ async run({ args }) {
395
+ await dispatchFromCli(
396
+ "query",
397
+ "memory",
398
+ "decision.find",
399
+ {
400
+ query: args.query ?? "",
401
+ limit: args.limit !== void 0 ? parseInt(args.limit, 10) : void 0,
402
+ // T1830: pass flag so the engine can filter by decision_category
403
+ includeAgentDispatch: args["include-agent-dispatch"] === true
404
+ },
405
+ { command: "memory", operation: "memory.decision.find" }
406
+ );
407
+ }
408
+ });
409
+ var decisionStoreCommand = defineCommand({
410
+ meta: {
411
+ name: "decision-store",
412
+ description: "Store an architectural decision \u2014 supports --linked-task, --confirmation-state, --supersedes, --superseded-by, --decided-by"
413
+ },
414
+ args: {
415
+ decision: {
416
+ type: "string",
417
+ description: "The decision that was made",
418
+ required: true
419
+ },
420
+ rationale: {
421
+ type: "string",
422
+ description: "Rationale behind the decision",
423
+ required: true
424
+ },
425
+ alternatives: {
426
+ type: "string",
427
+ description: "Alternatives that were considered"
428
+ },
429
+ "linked-task": {
430
+ type: "string",
431
+ description: "Task ID to associate with this decision"
432
+ },
433
+ "adr-path": {
434
+ type: "string",
435
+ description: "Path to the ADR document on disk (e.g. docs/adr/ADR-027.md)"
436
+ },
437
+ supersedes: {
438
+ type: "string",
439
+ description: "Decision ID that this decision supersedes (e.g. D001)"
440
+ },
441
+ "superseded-by": {
442
+ type: "string",
443
+ description: "Decision ID that has superseded this decision (e.g. D002)"
444
+ },
445
+ "confirmation-state": {
446
+ type: "string",
447
+ description: "Lifecycle state: proposed | accepted | superseded (default: proposed)"
448
+ },
449
+ "decided-by": {
450
+ type: "string",
451
+ description: "Who originated this decision: owner | council | agent (default: agent)"
452
+ },
453
+ json: {
454
+ type: "boolean",
455
+ description: "Output as JSON"
456
+ }
457
+ },
458
+ async run({ args }) {
459
+ await dispatchFromCli(
460
+ "mutate",
461
+ "memory",
462
+ "decision.store",
463
+ {
464
+ decision: args.decision,
465
+ rationale: args.rationale,
466
+ ...args.alternatives !== void 0 && { alternatives: args.alternatives },
467
+ ...args["linked-task"] !== void 0 && { taskId: args["linked-task"] },
468
+ ...args["adr-path"] !== void 0 && { adrPath: args["adr-path"] },
469
+ ...args.supersedes !== void 0 && { supersedes: args.supersedes },
470
+ ...args["superseded-by"] !== void 0 && { supersededBy: args["superseded-by"] },
471
+ ...args["confirmation-state"] !== void 0 && {
472
+ confirmationState: args["confirmation-state"]
473
+ },
474
+ ...args["decided-by"] !== void 0 && { decidedBy: args["decided-by"] }
475
+ },
476
+ { command: "memory", operation: "memory.decision.store" }
477
+ );
478
+ }
479
+ });
480
+ var linkCommand = defineCommand({
481
+ meta: {
482
+ name: "link",
483
+ description: "Connect a BRAIN decision/observation to a task (example: cleo memory link T10520 D012)"
484
+ },
485
+ args: {
486
+ taskId: {
487
+ type: "positional",
488
+ description: "Task ID",
489
+ required: true
490
+ },
491
+ entryId: {
492
+ type: "positional",
493
+ description: "Brain entry ID",
494
+ required: true
495
+ },
496
+ json: {
497
+ type: "boolean",
498
+ description: "Output as JSON"
499
+ }
500
+ },
501
+ async run({ args }) {
502
+ await dispatchFromCli(
503
+ "mutate",
504
+ "memory",
505
+ "link",
506
+ { taskId: args.taskId, entryId: args.entryId },
507
+ { command: "memory", operation: "memory.link" }
508
+ );
509
+ }
510
+ });
511
+ var traceCommand = defineCommand({
512
+ meta: {
513
+ name: "trace",
514
+ description: "BFS traversal of the brain knowledge graph from a seed node"
515
+ },
516
+ args: {
517
+ nodeId: {
518
+ type: "positional",
519
+ description: "Seed node ID",
520
+ required: true
521
+ },
522
+ depth: {
523
+ type: "string",
524
+ description: "Maximum traversal depth (default: 3)"
525
+ },
526
+ json: {
527
+ type: "boolean",
528
+ description: "Output as JSON"
529
+ }
530
+ },
531
+ async run({ args }) {
532
+ await dispatchFromCli(
533
+ "query",
534
+ "memory",
535
+ "graph.trace",
536
+ {
537
+ nodeId: args.nodeId,
538
+ ...args.depth !== void 0 && { maxDepth: parseInt(args.depth, 10) }
539
+ },
540
+ { command: "memory-trace", operation: "memory.graph.trace" }
541
+ );
542
+ }
543
+ });
544
+ var relatedCommand = defineCommand({
545
+ meta: {
546
+ name: "related",
547
+ description: "Return immediate (1-hop) neighbours of a brain graph node"
548
+ },
549
+ args: {
550
+ nodeId: {
551
+ type: "positional",
552
+ description: "Node ID",
553
+ required: true
554
+ },
555
+ type: {
556
+ type: "string",
557
+ description: "Filter by edge type (e.g. applies_to, supports, derived_from)"
558
+ },
559
+ json: {
560
+ type: "boolean",
561
+ description: "Output as JSON"
562
+ }
563
+ },
564
+ async run({ args }) {
565
+ await dispatchFromCli(
566
+ "query",
567
+ "memory",
568
+ "graph.related",
569
+ {
570
+ nodeId: args.nodeId,
571
+ ...args.type !== void 0 && { edgeType: args.type }
572
+ },
573
+ { command: "memory-related", operation: "memory.graph.related" }
574
+ );
575
+ }
576
+ });
577
+ var contextCommand = defineCommand({
578
+ meta: {
579
+ name: "context",
580
+ description: "360-degree context view of a brain graph node: node + all edges + neighbours"
581
+ },
582
+ args: {
583
+ nodeId: {
584
+ type: "positional",
585
+ description: "Node ID",
586
+ required: true
587
+ },
588
+ json: {
589
+ type: "boolean",
590
+ description: "Output as JSON"
591
+ }
592
+ },
593
+ async run({ args }) {
594
+ await dispatchFromCli(
595
+ "query",
596
+ "memory",
597
+ "graph.context",
598
+ { nodeId: args.nodeId },
599
+ { command: "memory-context", operation: "memory.graph.context" }
600
+ );
601
+ }
602
+ });
603
+ var graphStatsCommand = defineCommand({
604
+ meta: {
605
+ name: "graph-stats",
606
+ description: "Show brain knowledge graph statistics: node and edge counts by type"
607
+ },
608
+ args: {
609
+ json: {
610
+ type: "boolean",
611
+ description: "Output as JSON"
612
+ }
613
+ },
614
+ async run() {
615
+ await dispatchFromCli(
616
+ "query",
617
+ "memory",
618
+ "graph.stats",
619
+ {},
620
+ { command: "memory-graph-stats", operation: "memory.graph.stats" }
621
+ );
622
+ }
623
+ });
624
+ var graphShowCommand = defineCommand({
625
+ meta: { name: "graph-show", description: "Get a PageIndex graph node and its edges" },
626
+ args: {
627
+ nodeId: {
628
+ type: "positional",
629
+ description: "Node ID",
630
+ required: true
631
+ },
632
+ json: {
633
+ type: "boolean",
634
+ description: "Output as JSON"
635
+ }
636
+ },
637
+ async run({ args }) {
638
+ await dispatchFromCli(
639
+ "query",
640
+ "memory",
641
+ "graph.show",
642
+ { nodeId: args.nodeId },
643
+ { command: "memory", operation: "memory.graph.show" }
644
+ );
645
+ }
646
+ });
647
+ var graphNeighborsCommand = defineCommand({
648
+ meta: {
649
+ name: "graph-neighbors",
650
+ description: "Get neighbor nodes from the PageIndex graph"
651
+ },
652
+ args: {
653
+ nodeId: {
654
+ type: "positional",
655
+ description: "Node ID",
656
+ required: true
657
+ },
658
+ depth: {
659
+ type: "string",
660
+ description: "Traversal depth"
661
+ },
662
+ limit: {
663
+ type: "string",
664
+ description: "Maximum neighbors"
665
+ },
666
+ json: {
667
+ type: "boolean",
668
+ description: "Output as JSON"
669
+ }
670
+ },
671
+ async run({ args }) {
672
+ await dispatchFromCli(
673
+ "query",
674
+ "memory",
675
+ "graph.neighbors",
676
+ {
677
+ nodeId: args.nodeId,
678
+ ...args.depth !== void 0 && { depth: parseInt(args.depth, 10) },
679
+ ...args.limit !== void 0 && { limit: parseInt(args.limit, 10) }
680
+ },
681
+ { command: "memory", operation: "memory.graph.neighbors" }
682
+ );
683
+ }
684
+ });
685
+ var graphAddCommand = defineCommand({
686
+ meta: { name: "graph-add", description: "Add a node or edge to the PageIndex graph" },
687
+ args: {
688
+ "node-id": {
689
+ type: "string",
690
+ description: "Node ID to add"
691
+ },
692
+ "node-type": {
693
+ type: "string",
694
+ description: "Node type (e.g. concept, task, file)"
695
+ },
696
+ label: {
697
+ type: "string",
698
+ description: "Label for the node"
699
+ },
700
+ from: {
701
+ type: "string",
702
+ description: "Source node ID for an edge"
703
+ },
704
+ to: {
705
+ type: "string",
706
+ description: "Target node ID for an edge"
707
+ },
708
+ "edge-type": {
709
+ type: "string",
710
+ description: "Edge relationship type"
711
+ },
712
+ json: {
713
+ type: "boolean",
714
+ description: "Output as JSON"
715
+ }
716
+ },
717
+ async run({ args }) {
718
+ await dispatchFromCli(
719
+ "mutate",
720
+ "memory",
721
+ "graph.add",
722
+ {
723
+ ...args["node-id"] !== void 0 && { nodeId: args["node-id"] },
724
+ ...args["node-type"] !== void 0 && { nodeType: args["node-type"] },
725
+ ...args.label !== void 0 && { label: args.label },
726
+ ...args.from !== void 0 && { fromId: args.from },
727
+ ...args.to !== void 0 && { toId: args.to },
728
+ ...args["edge-type"] !== void 0 && { edgeType: args["edge-type"] }
729
+ },
730
+ { command: "memory", operation: "memory.graph.add" }
731
+ );
732
+ }
733
+ });
734
+ var graphRemoveCommand = defineCommand({
735
+ meta: { name: "graph-remove", description: "Remove a node or edge from the PageIndex graph" },
736
+ args: {
737
+ "node-id": {
738
+ type: "string",
739
+ description: "Node ID to remove"
740
+ },
741
+ from: {
742
+ type: "string",
743
+ description: "Source node ID of the edge to remove"
744
+ },
745
+ to: {
746
+ type: "string",
747
+ description: "Target node ID of the edge to remove"
748
+ },
749
+ json: {
750
+ type: "boolean",
751
+ description: "Output as JSON"
752
+ }
753
+ },
754
+ async run({ args }) {
755
+ await dispatchFromCli(
756
+ "mutate",
757
+ "memory",
758
+ "graph.remove",
759
+ {
760
+ ...args["node-id"] !== void 0 && { nodeId: args["node-id"] },
761
+ ...args.from !== void 0 && { fromId: args.from },
762
+ ...args.to !== void 0 && { toId: args.to }
763
+ },
764
+ { command: "memory", operation: "memory.graph.remove" }
765
+ );
766
+ }
767
+ });
768
+ var reasonWhyCommand = defineCommand({
769
+ meta: { name: "reason-why", description: "Causal trace through task dependency chains" },
770
+ args: {
771
+ taskId: {
772
+ type: "positional",
773
+ description: "Task ID",
774
+ required: true
775
+ },
776
+ depth: {
777
+ type: "string",
778
+ description: "Maximum trace depth"
779
+ },
780
+ json: {
781
+ type: "boolean",
782
+ description: "Output as JSON"
783
+ }
784
+ },
785
+ async run({ args }) {
786
+ await dispatchFromCli(
787
+ "query",
788
+ "memory",
789
+ "reason.why",
790
+ {
791
+ taskId: args.taskId,
792
+ ...args.depth !== void 0 && { depth: parseInt(args.depth, 10) }
793
+ },
794
+ { command: "memory", operation: "memory.reason.why" }
795
+ );
796
+ }
797
+ });
798
+ var reasonSimilarCommand = defineCommand({
799
+ meta: { name: "reason-similar", description: "Find semantically similar brain entries" },
800
+ args: {
801
+ entryId: {
802
+ type: "positional",
803
+ description: "Entry ID",
804
+ required: true
805
+ },
806
+ limit: {
807
+ type: "string",
808
+ description: "Maximum results"
809
+ },
810
+ json: {
811
+ type: "boolean",
812
+ description: "Output as JSON"
813
+ }
814
+ },
815
+ async run({ args }) {
816
+ await dispatchFromCli(
817
+ "query",
818
+ "memory",
819
+ "reason.similar",
820
+ {
821
+ entryId: args.entryId,
822
+ ...args.limit !== void 0 && { limit: parseInt(args.limit, 10) }
823
+ },
824
+ { command: "memory", operation: "memory.reason.similar" }
825
+ );
826
+ }
827
+ });
828
+ var searchHybridCommand = defineCommand({
829
+ meta: {
830
+ name: "search-hybrid",
831
+ description: "Hybrid search across FTS5, vector, and graph indexes"
832
+ },
833
+ args: {
834
+ query: {
835
+ type: "positional",
836
+ description: "Search query",
837
+ required: true
838
+ },
839
+ limit: {
840
+ type: "string",
841
+ description: "Maximum results"
842
+ },
843
+ json: {
844
+ type: "boolean",
845
+ description: "Output as JSON"
846
+ }
847
+ },
848
+ async run({ args }) {
849
+ await dispatchFromCli(
850
+ "query",
851
+ "memory",
852
+ "search.hybrid",
853
+ {
854
+ query: args.query,
855
+ ...args.limit !== void 0 && { limit: parseInt(args.limit, 10) }
856
+ },
857
+ { command: "memory", operation: "memory.search.hybrid" }
858
+ );
859
+ }
860
+ });
861
+ var codeLinksCommand = defineCommand({
862
+ meta: {
863
+ name: "code-links",
864
+ description: "Show code \u2194 memory connections (code_reference edges between brain and nexus)"
865
+ },
866
+ args: {
867
+ limit: {
868
+ type: "string",
869
+ description: "Maximum entries to return (default 100)"
870
+ },
871
+ json: {
872
+ type: "boolean",
873
+ description: "Output as JSON"
874
+ }
875
+ },
876
+ async run({ args }) {
877
+ await dispatchFromCli(
878
+ "query",
879
+ "memory",
880
+ "code.links",
881
+ {
882
+ ...args.limit !== void 0 && { limit: parseInt(args.limit, 10) }
883
+ },
884
+ { command: "memory", operation: "memory.code.links" }
885
+ );
886
+ }
887
+ });
888
+ var codeAutoLinkCommand = defineCommand({
889
+ meta: {
890
+ name: "code-auto-link",
891
+ description: "Scan brain memory nodes for entity references and auto-link to nexus code nodes"
892
+ },
893
+ args: {
894
+ json: {
895
+ type: "boolean",
896
+ description: "Output as JSON"
897
+ }
898
+ },
899
+ async run() {
900
+ await dispatchFromCli(
901
+ "mutate",
902
+ "memory",
903
+ "code.auto-link",
904
+ {},
905
+ { command: "memory", operation: "memory.code.auto-link" }
906
+ );
907
+ }
908
+ });
909
+ var codeMemoriesForCodeCommand = defineCommand({
910
+ meta: {
911
+ name: "code-memories-for-code",
912
+ description: "Find brain memory nodes that reference a given nexus code symbol"
913
+ },
914
+ args: {
915
+ symbol: {
916
+ type: "positional",
917
+ description: "Code symbol name",
918
+ required: true
919
+ },
920
+ json: {
921
+ type: "boolean",
922
+ description: "Output as JSON"
923
+ }
924
+ },
925
+ async run({ args }) {
926
+ await dispatchFromCli(
927
+ "query",
928
+ "memory",
929
+ "code.memories-for-code",
930
+ { symbol: args.symbol },
931
+ { command: "memory", operation: "memory.code.memories-for-code" }
932
+ );
933
+ }
934
+ });
935
+ var codeForMemoryCommand = defineCommand({
936
+ meta: {
937
+ name: "code-for-memory",
938
+ description: "Find nexus code nodes referenced by a given brain memory entry"
939
+ },
940
+ args: {
941
+ memoryId: {
942
+ type: "positional",
943
+ description: "Memory entry ID",
944
+ required: true
945
+ },
946
+ json: {
947
+ type: "boolean",
948
+ description: "Output as JSON"
949
+ }
950
+ },
951
+ async run({ args }) {
952
+ await dispatchFromCli(
953
+ "query",
954
+ "memory",
955
+ "code.for-memory",
956
+ { memoryId: args.memoryId },
957
+ { command: "memory", operation: "memory.code.for-memory" }
958
+ );
959
+ }
960
+ });
961
+ var consolidateCommand = defineCommand({
962
+ meta: {
963
+ name: "consolidate",
964
+ description: "Run the full brain consolidation pipeline: dedup, quality recompute, tier promotion, contradiction detection, soft eviction, graph strengthening, summary generation. Equivalent to the session-end sleep-time consolidation but triggered on demand."
965
+ },
966
+ args: {},
967
+ async run() {
968
+ const root = getProjectRoot();
969
+ try {
970
+ const result = await runConsolidation(root);
971
+ cliOutput(result, { command: "memory-consolidate", operation: "memory.consolidate" });
972
+ } catch (err) {
973
+ const message = err instanceof Error ? err.message : String(err);
974
+ cliError(`Memory consolidation failed: ${message}`, "E_INTERNAL", { name: "E_INTERNAL" });
975
+ process.exit(1);
976
+ }
977
+ }
978
+ });
979
+ var dreamCommand = defineCommand({
980
+ meta: {
981
+ name: "dream",
982
+ description: "Manually trigger the full auto-dream cycle: consolidation pipeline including R-STDP reward backfill (Step 9a), STDP plasticity (Step 9b), and homeostatic decay (Step 9c). Equivalent to autonomous nightly consolidation but triggered on demand. Idempotent \u2014 safe to run multiple times. Use --status to check engine liveness without triggering consolidation."
983
+ },
984
+ args: {
985
+ status: {
986
+ type: "boolean",
987
+ description: "Return engine liveness status as JSON instead of triggering a dream cycle. Fields: lastConsolidatedAt, observationsSinceLastConsolidation, idleMinutesSinceLastRetrieval, tickLoopAlive, lastTickAt, dreamInFlight, lastError, isOverdue. Exits with code 1 when isOverdue=true.",
988
+ default: false
989
+ }
990
+ },
991
+ async run({ args }) {
992
+ const root = getProjectRoot();
993
+ if (args.status) {
994
+ try {
995
+ const status = await getDreamStatus(root);
996
+ cliOutput(status, { command: "memory-dream-status", operation: "memory.dream.status" });
997
+ if (status.isOverdue) {
998
+ process.exit(1);
999
+ }
1000
+ } catch (err) {
1001
+ const message = err instanceof Error ? err.message : String(err);
1002
+ cliError(`Dream status check failed: ${message}`, "E_INTERNAL", { name: "E_INTERNAL" });
1003
+ process.exit(1);
1004
+ }
1005
+ return;
1006
+ }
1007
+ try {
1008
+ const result = await triggerManualDream(root);
1009
+ cliOutput(result, { command: "memory-dream", operation: "memory.dream" });
1010
+ } catch (err) {
1011
+ const message = err instanceof Error ? err.message : String(err);
1012
+ cliError(`Dream cycle failed: ${message}`, "E_INTERNAL", { name: "E_INTERNAL" });
1013
+ process.exit(1);
1014
+ }
1015
+ }
1016
+ });
1017
+ var reflectCommand = defineCommand({
1018
+ meta: {
1019
+ name: "reflect",
1020
+ description: "Manually trigger the LLM Observer + Reflector pipeline for the most recent session. Observer compresses session observations; Reflector synthesizes patterns and learnings. Requires ANTHROPIC_API_KEY to be set."
1021
+ },
1022
+ args: {
1023
+ session: {
1024
+ type: "string",
1025
+ description: "Run against a specific session ID (default: most recent session)"
1026
+ }
1027
+ },
1028
+ async run({ args }) {
1029
+ const root = getProjectRoot();
1030
+ try {
1031
+ const { runObserver, runReflector } = await import("@cleocode/core/memory");
1032
+ const observerResult = await runObserver(root, args.session, {
1033
+ thresholdOverride: 1
1034
+ });
1035
+ const reflectorResult = await runReflector(root, args.session);
1036
+ const data = {
1037
+ observer: {
1038
+ ran: observerResult.ran,
1039
+ stored: observerResult.stored,
1040
+ compressedIds: observerResult.compressedIds
1041
+ },
1042
+ reflector: {
1043
+ ran: reflectorResult.ran,
1044
+ patternsStored: reflectorResult.patternsStored,
1045
+ learningsStored: reflectorResult.learningsStored,
1046
+ supersededIds: reflectorResult.supersededIds
1047
+ }
1048
+ };
1049
+ cliOutput(data, { command: "memory-reflect", operation: "memory.reflect" });
1050
+ } catch (err) {
1051
+ const message = err instanceof Error ? err.message : String(err);
1052
+ cliError(`Reflect failed: ${message}`, "E_INTERNAL", { name: "E_INTERNAL" });
1053
+ process.exit(1);
1054
+ }
1055
+ }
1056
+ });
1057
+ var pruneStubsCommand = defineCommand({
1058
+ meta: {
1059
+ name: "prune-stubs",
1060
+ description: 'Report (and with --apply, quarantine) content-free BRAIN observation stubs \u2014 auto-hook task-start/complete records and the "status: undefined" artefact of T12071. These are short enough that BM25 length-normalisation ranks them ABOVE substantive memories, so they actively degrade recall. Dry-run by default.'
1061
+ },
1062
+ args: {
1063
+ apply: {
1064
+ type: "boolean",
1065
+ description: "Quarantine matched rows and return a recovery receipt (default: report only)"
1066
+ }
1067
+ },
1068
+ async run({ args }) {
1069
+ const root = getProjectRoot();
1070
+ await getBrainDb(root);
1071
+ const { getBrainNativeDb } = await import("@cleocode/core/internal");
1072
+ const nativeDb = getBrainNativeDb();
1073
+ if (!nativeDb) {
1074
+ cliError("BRAIN database is not open");
1075
+ return;
1076
+ }
1077
+ const { pruneObservationStubs } = await import("@cleocode/core/internal");
1078
+ const result = pruneObservationStubs(nativeDb, Boolean(args.apply));
1079
+ cliOutput(result, { command: "memory prune-stubs", operation: "memory.prune-stubs" });
1080
+ }
1081
+ });
1082
+ var pruneTraitsCommand = defineCommand({
1083
+ meta: {
1084
+ name: "prune-traits",
1085
+ description: `Report (and with --apply, remove) user-profile traits that are operation receipts or status lines ("Operation succeeded in domain 'check'", "gate set to true for T123"). --envelope-derived also matches every legacy dialectic trait with no project stamp: those were minted from operation envelopes. Apply backs rows up first; --restore <backup> reverses it. Dry-run by default.`
1086
+ },
1087
+ args: {
1088
+ apply: {
1089
+ type: "boolean",
1090
+ description: "Back up, then delete matched rows and return a receipt (default: report only)"
1091
+ },
1092
+ "envelope-derived": {
1093
+ type: "boolean",
1094
+ description: "Also match legacy dialectic:* traits with no project stamp"
1095
+ },
1096
+ restore: {
1097
+ type: "string",
1098
+ description: "Re-insert the rows from a prune-traits backup file (never overwrites)"
1099
+ },
1100
+ sha256: {
1101
+ type: "string",
1102
+ description: "With --restore: the receipt backupSha256; a mismatching backup is refused"
1103
+ }
1104
+ },
1105
+ async run({ args }) {
1106
+ const core = await import("@cleocode/core/internal");
1107
+ const nexusDb = await core.getNexusDb(getProjectRoot());
1108
+ const result = args.restore ? await core.restorePrunedTraits(
1109
+ nexusDb,
1110
+ String(args.restore),
1111
+ args.sha256 ? String(args.sha256) : void 0
1112
+ ) : await core.pruneReceiptTraits(nexusDb, {
1113
+ apply: Boolean(args.apply),
1114
+ includeEnvelopeDerived: Boolean(args["envelope-derived"])
1115
+ });
1116
+ cliOutput(result, { command: "memory prune-traits", operation: "memory.prune-traits" });
1117
+ }
1118
+ });
1119
+ var setTraitScopeCommand = defineCommand({
1120
+ meta: {
1121
+ name: "set-trait-scope",
1122
+ description: `Set a user-profile trait scope: "user" = user-global, injected into every project's agent prompts; "project" = only the project it was derived in.`
1123
+ },
1124
+ args: {
1125
+ key: { type: "positional", description: "Trait key", required: true },
1126
+ scope: { type: "positional", description: "project | user", required: true }
1127
+ },
1128
+ async run({ args }) {
1129
+ const scope = String(args.scope);
1130
+ if (scope !== "project" && scope !== "user") {
1131
+ cliError(`scope must be "project" or "user", got "${scope}"`, "E_VALIDATION", {
1132
+ name: "E_VALIDATION"
1133
+ });
1134
+ return;
1135
+ }
1136
+ const core = await import("@cleocode/core/internal");
1137
+ const nexusDb = await core.getNexusDb(getProjectRoot());
1138
+ const previous = await core.setUserProfileTraitScope(nexusDb, String(args.key), scope);
1139
+ if (previous === null) {
1140
+ cliError(`No user-profile trait "${args.key}"`, "E_NOT_FOUND", { name: "E_NOT_FOUND" });
1141
+ return;
1142
+ }
1143
+ cliOutput(
1144
+ { traitKey: args.key, previousScope: previous, scope },
1145
+ { command: "memory set-trait-scope", operation: "memory.set-trait-scope" }
1146
+ );
1147
+ }
1148
+ });
1149
+ var dedupScanCommand = defineCommand({
1150
+ meta: {
1151
+ name: "dedup-scan",
1152
+ description: "Scan brain.db for potential duplicate entries by content-hash and keyword similarity. Reports duplicates per table without modifying any data. Use --apply to merge confirmed duplicates via the consolidation pipeline."
1153
+ },
1154
+ args: {
1155
+ apply: {
1156
+ type: "boolean",
1157
+ description: "Run full consolidation to merge duplicates (calls cleo memory consolidate internally)"
1158
+ }
1159
+ },
1160
+ async run({ args }) {
1161
+ const root = getProjectRoot();
1162
+ try {
1163
+ await getBrainDb(root);
1164
+ const { totalDuplicateRows, groups } = await scanDuplicateEntries();
1165
+ if (args.apply) {
1166
+ const result = await runConsolidation(root);
1167
+ cliOutput(
1168
+ {
1169
+ totalDuplicateRows,
1170
+ groups,
1171
+ applied: true,
1172
+ consolidation: { deduplicated: result.deduplicated }
1173
+ },
1174
+ { command: "memory-dedup-scan", operation: "memory.dedup-scan" }
1175
+ );
1176
+ } else {
1177
+ cliOutput(
1178
+ { totalDuplicateRows, groups, applied: false },
1179
+ { command: "memory-dedup-scan", operation: "memory.dedup-scan" }
1180
+ );
1181
+ }
1182
+ } catch (err) {
1183
+ const message = err instanceof Error ? err.message : String(err);
1184
+ cliError(`Dedup scan failed: ${message}`, "E_INTERNAL", { name: "E_INTERNAL" });
1185
+ process.exit(1);
1186
+ }
1187
+ }
1188
+ });
1189
+ var importCommand = defineCommand({
1190
+ meta: {
1191
+ name: "import",
1192
+ description: "Import memory files from a provider-specific directory (e.g. ~/.claude/projects/*/memory/) into brain.db. Enables provider-agnostic memory via CLEO CLI instead of Claude Code MEMORY.md."
1193
+ },
1194
+ args: {
1195
+ from: {
1196
+ type: "string",
1197
+ description: "Source directory containing *.md memory files (default: ~/.claude/projects/-mnt-projects-cleocode/memory)"
1198
+ },
1199
+ "dry-run": {
1200
+ type: "boolean",
1201
+ description: "Print what would be imported without writing to brain.db"
1202
+ }
1203
+ },
1204
+ async run({ args }) {
1205
+ const sourceDir = args.from;
1206
+ const isDryRun = !!args["dry-run"];
1207
+ const projectRoot = getProjectRoot();
1208
+ try {
1209
+ const result = await importMemoryFiles({
1210
+ sourceDir,
1211
+ dryRun: isDryRun,
1212
+ projectRoot,
1213
+ cleoDirName: CLEO_DIR_NAME,
1214
+ hasheFileName: MIGRATE_MEMORY_HASHES_JSON,
1215
+ dispatch: dispatchFromCli
1216
+ });
1217
+ cliOutput(
1218
+ {
1219
+ total: result.total,
1220
+ imported: result.imported,
1221
+ skipped: result.skipped,
1222
+ errors: result.errors,
1223
+ dryRun: isDryRun,
1224
+ importedEntries: result.importedEntries,
1225
+ skippedEntries: result.skippedEntries,
1226
+ errorEntries: result.errorEntries
1227
+ },
1228
+ { command: "memory-import", operation: "memory.import" }
1229
+ );
1230
+ if (result.errors > 0) process.exit(1);
1231
+ } catch (err) {
1232
+ const message = err instanceof Error ? err.message : String(err);
1233
+ cliError(message, "E_NOT_FOUND", { name: "E_NOT_FOUND" });
1234
+ process.exit(1);
1235
+ }
1236
+ }
1237
+ });
1238
+ var doctorCommand = defineCommand({
1239
+ meta: {
1240
+ name: "doctor",
1241
+ description: "Read-only brain noise scan: detects duplicate-content, missing-type, missing-provenance, orphan-edge, low-confidence, and stale-unverified patterns. Use --assert-clean as the M7 entry gate before enabling Sentient v1 (`cleo sentient propose enable`)."
1242
+ },
1243
+ args: {
1244
+ "assert-clean": {
1245
+ type: "boolean",
1246
+ description: "Exit non-zero when any noise patterns are detected (M7 gate for Sentient v1)"
1247
+ },
1248
+ json: {
1249
+ type: "boolean",
1250
+ description: "Output as JSON"
1251
+ }
1252
+ },
1253
+ async run({ args }) {
1254
+ await dispatchFromCli(
1255
+ "query",
1256
+ "memory",
1257
+ "doctor",
1258
+ { "assert-clean": args["assert-clean"] },
1259
+ { command: "memory-doctor", operation: "memory.doctor" }
1260
+ );
1261
+ }
1262
+ });
1263
+ var llmStatusCommand = defineCommand({
1264
+ meta: {
1265
+ name: "llm-status",
1266
+ description: "Report LLM backend resolution status and extraction readiness. Shows which source resolved the Anthropic API key (env/config/oauth/none), whether LLM extraction is enabled, and when extraction last ran."
1267
+ },
1268
+ args: {
1269
+ json: {
1270
+ type: "boolean",
1271
+ description: "Output as JSON"
1272
+ }
1273
+ },
1274
+ async run() {
1275
+ await dispatchFromCli(
1276
+ "query",
1277
+ "memory",
1278
+ "llm-status",
1279
+ {},
1280
+ { command: "memory-llm-status", operation: "memory.llm-status" }
1281
+ );
1282
+ }
1283
+ });
1284
+ var verifyCommand = defineCommand({
1285
+ meta: {
1286
+ name: "verify",
1287
+ description: "Promote a brain memory entry to verified=true. Requires caller identity of cleo-prime or owner. Flips the verified flag in brain_observations (or typed table), enabling long-tier promotion and ground-truth retrieval weighting."
1288
+ },
1289
+ args: {
1290
+ id: {
1291
+ type: "positional",
1292
+ description: "Brain entry ID to verify",
1293
+ required: true
1294
+ },
1295
+ agent: {
1296
+ type: "string",
1297
+ description: "Caller identity ('cleo-prime' or 'owner'). Omit when calling from the owner terminal (no identity required)."
1298
+ },
1299
+ json: {
1300
+ type: "boolean",
1301
+ description: "Output as JSON"
1302
+ }
1303
+ },
1304
+ async run({ args }) {
1305
+ await dispatchFromCli(
1306
+ "mutate",
1307
+ "memory",
1308
+ "verify",
1309
+ {
1310
+ id: args.id,
1311
+ ...args.agent !== void 0 && { agent: args.agent }
1312
+ },
1313
+ { command: "memory-verify", operation: "memory.verify" }
1314
+ );
1315
+ }
1316
+ });
1317
+ var pendingVerifyCommand = defineCommand({
1318
+ meta: {
1319
+ name: "pending-verify",
1320
+ description: "List brain memory entries that are unverified (verified=false) but highly cited (citation_count >= threshold). These are strong candidates for manual verification via 'cleo memory verify <id>'."
1321
+ },
1322
+ args: {
1323
+ "min-citations": {
1324
+ type: "string",
1325
+ description: "Minimum citation count threshold (default: 5)"
1326
+ },
1327
+ limit: {
1328
+ type: "string",
1329
+ description: "Maximum entries to return (default: 50)"
1330
+ },
1331
+ json: {
1332
+ type: "boolean",
1333
+ description: "Output as JSON"
1334
+ }
1335
+ },
1336
+ async run({ args }) {
1337
+ await dispatchFromCli(
1338
+ "query",
1339
+ "memory",
1340
+ "pending-verify",
1341
+ {
1342
+ ...args["min-citations"] !== void 0 && {
1343
+ minCitations: parseInt(args["min-citations"], 10)
1344
+ },
1345
+ ...args.limit !== void 0 && { limit: parseInt(args.limit, 10) }
1346
+ },
1347
+ { command: "memory-pending-verify", operation: "memory.pending-verify" }
1348
+ );
1349
+ }
1350
+ });
1351
+ var tierStatsCommand = defineCommand({
1352
+ meta: {
1353
+ name: "stats",
1354
+ description: "Show tier distribution across all brain tables + countdown to next long-tier promotions (top-10)"
1355
+ },
1356
+ args: {},
1357
+ async run() {
1358
+ const root = getProjectRoot();
1359
+ try {
1360
+ await getBrainDb(root);
1361
+ const result = await getTierStats(root);
1362
+ const distribution = {};
1363
+ for (const t of result.tables) {
1364
+ distribution[t.table] = { short: t.short, medium: t.medium, long: t.long };
1365
+ }
1366
+ const top10 = result.upcomingLongPromotions.slice(0, 10);
1367
+ cliOutput(
1368
+ { distribution, upcomingLongPromotions: top10 },
1369
+ { command: "memory-tier-stats", operation: "memory.tier.stats" }
1370
+ );
1371
+ } catch (err) {
1372
+ const message = err instanceof Error ? err.message : String(err);
1373
+ cliError(`Tier stats failed: ${message}`, "E_INTERNAL", { name: "E_INTERNAL" });
1374
+ process.exit(1);
1375
+ }
1376
+ }
1377
+ });
1378
+ var tierPromoteCommand = defineCommand({
1379
+ meta: {
1380
+ name: "promote",
1381
+ description: "Manually promote a memory entry to a higher tier (bypasses age gate)"
1382
+ },
1383
+ args: {
1384
+ id: {
1385
+ type: "positional",
1386
+ description: "Brain entry ID",
1387
+ required: true
1388
+ },
1389
+ to: {
1390
+ type: "string",
1391
+ description: "Target tier: medium or long",
1392
+ required: true
1393
+ },
1394
+ reason: {
1395
+ type: "string",
1396
+ description: "Reason for manual promotion (required)",
1397
+ required: true
1398
+ }
1399
+ },
1400
+ async run({ args }) {
1401
+ const root = getProjectRoot();
1402
+ const targetTier = args.to;
1403
+ const reason = args.reason;
1404
+ const validTiers = ["medium", "long"];
1405
+ if (!validTiers.includes(targetTier)) {
1406
+ cliError(
1407
+ `Invalid target tier: ${targetTier}. Must be one of: ${validTiers.join(", ")}`,
1408
+ "E_VALIDATION",
1409
+ { name: "E_VALIDATION" }
1410
+ );
1411
+ process.exit(1);
1412
+ return;
1413
+ }
1414
+ try {
1415
+ await getBrainDb(root);
1416
+ const result = await setEntryTier(args.id, targetTier, "promote");
1417
+ cliOutput(
1418
+ {
1419
+ id: result.id,
1420
+ table: result.table,
1421
+ fromTier: result.fromTier,
1422
+ toTier: result.toTier,
1423
+ reason,
1424
+ promotedAt: result.updatedAt
1425
+ },
1426
+ { command: "memory-tier-promote", operation: "memory.tier.promote" }
1427
+ );
1428
+ } catch (err) {
1429
+ const message = err instanceof Error ? err.message : String(err);
1430
+ const isValidation = message.includes("already at tier") || message.includes("Cannot promote") || message.includes("not found");
1431
+ if (isValidation) {
1432
+ cliError(message, "E_VALIDATION", { name: "E_VALIDATION" });
1433
+ } else {
1434
+ cliError(`Tier promote failed: ${message}`, "E_INTERNAL", { name: "E_INTERNAL" });
1435
+ }
1436
+ process.exit(1);
1437
+ }
1438
+ }
1439
+ });
1440
+ var tierDemoteCommand = defineCommand({
1441
+ meta: {
1442
+ name: "demote",
1443
+ description: "Manually demote a memory entry to a lower tier"
1444
+ },
1445
+ args: {
1446
+ id: {
1447
+ type: "positional",
1448
+ description: "Brain entry ID",
1449
+ required: true
1450
+ },
1451
+ to: {
1452
+ type: "string",
1453
+ description: "Target tier: short or medium",
1454
+ required: true
1455
+ },
1456
+ reason: {
1457
+ type: "string",
1458
+ description: "Reason for manual demotion (required)",
1459
+ required: true
1460
+ },
1461
+ force: {
1462
+ type: "boolean",
1463
+ description: "Required when demoting from long tier"
1464
+ }
1465
+ },
1466
+ async run({ args }) {
1467
+ const root = getProjectRoot();
1468
+ const targetTier = args.to;
1469
+ const reason = args.reason;
1470
+ const validTiers = ["short", "medium"];
1471
+ if (!validTiers.includes(targetTier)) {
1472
+ cliError(
1473
+ `Invalid target tier for demotion: ${targetTier}. Must be one of: ${validTiers.join(", ")}`,
1474
+ "E_VALIDATION",
1475
+ { name: "E_VALIDATION" }
1476
+ );
1477
+ process.exit(1);
1478
+ return;
1479
+ }
1480
+ try {
1481
+ await getBrainDb(root);
1482
+ const result = await setEntryTier(args.id, targetTier, "demote", { force: !!args.force });
1483
+ cliOutput(
1484
+ {
1485
+ id: result.id,
1486
+ table: result.table,
1487
+ fromTier: result.fromTier,
1488
+ toTier: result.toTier,
1489
+ reason,
1490
+ demotedAt: result.updatedAt
1491
+ },
1492
+ { command: "memory-tier-demote", operation: "memory.tier.demote" }
1493
+ );
1494
+ } catch (err) {
1495
+ const message = err instanceof Error ? err.message : String(err);
1496
+ const isValidation = message.includes("already at tier") || message.includes("Cannot demote") || message.includes("not found") || message.includes("long tier") || message.includes("Long-tier");
1497
+ if (isValidation) {
1498
+ cliError(message, "E_VALIDATION", { name: "E_VALIDATION" });
1499
+ } else {
1500
+ cliError(`Tier demote failed: ${message}`, "E_INTERNAL", { name: "E_INTERNAL" });
1501
+ }
1502
+ process.exit(1);
1503
+ }
1504
+ }
1505
+ });
1506
+ function makeMemorySubcommand(opts) {
1507
+ const mergedArgs = {
1508
+ ...opts.args,
1509
+ json: {
1510
+ type: "boolean",
1511
+ description: "Output as JSON"
1512
+ }
1513
+ };
1514
+ return defineCommand({
1515
+ meta: { name: opts.name, description: opts.description },
1516
+ args: mergedArgs,
1517
+ async run({ args }) {
1518
+ const params = opts.paramBuilder(args);
1519
+ await dispatchFromCli(opts.gateway, "memory", opts.operation, params, opts.output);
1520
+ }
1521
+ });
1522
+ }
1523
+ var precompactFlushCommand = makeMemorySubcommand({
1524
+ name: "precompact-flush",
1525
+ description: "Flush in-flight observations to brain.db and checkpoint the SQLite WAL before context compaction (T1004).",
1526
+ args: {},
1527
+ gateway: "mutate",
1528
+ operation: "precompact-flush",
1529
+ output: { command: "memory-precompact-flush", operation: "memory.precompact-flush" },
1530
+ paramBuilder: () => ({})
1531
+ });
1532
+ var backfillRunCommand = makeMemorySubcommand({
1533
+ name: "run",
1534
+ description: "Stage a brain-graph backfill run (pending approval). Pass --source to tag the run with a human-readable descriptor.",
1535
+ args: {
1536
+ source: {
1537
+ type: "string",
1538
+ description: "Human-readable descriptor for the backfill source (file path, session ID, etc)."
1539
+ },
1540
+ kind: {
1541
+ type: "string",
1542
+ description: "Backfill kind (default: 'graph-backfill')."
1543
+ },
1544
+ "node-ids": {
1545
+ type: "string",
1546
+ description: "Comma-separated exact qualified graph node IDs to stage; every ID must be eligible and missing."
1547
+ },
1548
+ "target-table": {
1549
+ type: "string",
1550
+ description: "Target table (default: 'brain_page_nodes')."
1551
+ }
1552
+ },
1553
+ gateway: "mutate",
1554
+ operation: "backfill.run",
1555
+ output: { command: "memory-backfill-run", operation: "memory.backfill.run" },
1556
+ paramBuilder: (args) => ({
1557
+ ...args["node-ids"] !== void 0 && {
1558
+ nodeIds: String(args["node-ids"]).split(",").map((id) => id.trim())
1559
+ },
1560
+ ...args["source"] !== void 0 && { source: args["source"] },
1561
+ ...args["kind"] !== void 0 && { kind: args["kind"] },
1562
+ ...args["target-table"] !== void 0 && { targetTable: args["target-table"] }
1563
+ })
1564
+ });
1565
+ var backfillApproveCommand = makeMemorySubcommand({
1566
+ name: "approve",
1567
+ description: "Approve a staged backfill run (commits rows to brain_page_nodes). Idempotent \u2014 re-approval returns alreadySettled=true.",
1568
+ args: {
1569
+ runId: {
1570
+ type: "positional",
1571
+ description: "Backfill run ID to approve",
1572
+ required: true
1573
+ },
1574
+ "approved-by": {
1575
+ type: "string",
1576
+ description: "Identity of the approver (default: 'cli')."
1577
+ }
1578
+ },
1579
+ gateway: "mutate",
1580
+ operation: "backfill.approve",
1581
+ output: { command: "memory-backfill-approve", operation: "memory.backfill.approve" },
1582
+ paramBuilder: (args) => ({
1583
+ runId: args["runId"],
1584
+ ...args["approved-by"] !== void 0 && { approvedBy: args["approved-by"] }
1585
+ })
1586
+ });
1587
+ var backfillRollbackCommand = makeMemorySubcommand({
1588
+ name: "rollback",
1589
+ description: "Rollback a staged or committed backfill run. Removes any rows written to brain_page_nodes.",
1590
+ args: {
1591
+ runId: {
1592
+ type: "positional",
1593
+ description: "Backfill run ID to rollback",
1594
+ required: true
1595
+ }
1596
+ },
1597
+ gateway: "mutate",
1598
+ operation: "backfill.rollback",
1599
+ output: { command: "memory-backfill-rollback", operation: "memory.backfill.rollback" },
1600
+ paramBuilder: (args) => ({
1601
+ runId: args["runId"]
1602
+ })
1603
+ });
1604
+ var backfillCommand = defineCommand({
1605
+ meta: {
1606
+ name: "backfill",
1607
+ description: "Staged brain-graph backfill operations: run, approve, rollback (T1003)."
1608
+ },
1609
+ subCommands: {
1610
+ run: backfillRunCommand,
1611
+ approve: backfillApproveCommand,
1612
+ rollback: backfillRollbackCommand
1613
+ },
1614
+ async run({ cmd, rawArgs }) {
1615
+ const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
1616
+ if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
1617
+ await showUsage(cmd);
1618
+ }
1619
+ });
1620
+ var digestCommand = defineCommand({
1621
+ meta: {
1622
+ name: "digest",
1623
+ description: "Summarized top-N brain observations for session briefing (T1006). Pass --hygiene to show latest hygiene scan results from the sentient background loop (T1636)."
1624
+ },
1625
+ args: {
1626
+ limit: {
1627
+ type: "string",
1628
+ description: "Maximum number of observations to include (default: 10)."
1629
+ },
1630
+ hygiene: {
1631
+ type: "boolean",
1632
+ description: "Show only hygiene observations (hygiene:orphan, hygiene:top-level-orphan, hygiene:content-defect, hygiene:premature-close-leak) from the sentient background loop (T1636)."
1633
+ },
1634
+ json: {
1635
+ type: "boolean",
1636
+ description: "Output as JSON"
1637
+ }
1638
+ },
1639
+ async run({ args }) {
1640
+ if (args.hygiene) {
1641
+ await dispatchFromCli(
1642
+ "query",
1643
+ "memory",
1644
+ "find",
1645
+ {
1646
+ query: "hygiene:",
1647
+ limit: args.limit !== void 0 ? parseInt(args.limit, 10) : 20
1648
+ },
1649
+ { command: "memory-hygiene-digest", operation: "memory.find" }
1650
+ );
1651
+ } else {
1652
+ await dispatchFromCli(
1653
+ "query",
1654
+ "memory",
1655
+ "digest",
1656
+ {
1657
+ ...args["limit"] !== void 0 && { limit: parseInt(args["limit"], 10) }
1658
+ },
1659
+ { command: "memory-digest", operation: "memory.digest" }
1660
+ );
1661
+ }
1662
+ }
1663
+ });
1664
+ var recentCommand = makeMemorySubcommand({
1665
+ name: "recent",
1666
+ description: "Tail recent brain observations with optional filters (T1006). --since accepts 30m / 24h / 7d or an ISO timestamp.",
1667
+ args: {
1668
+ limit: {
1669
+ type: "string",
1670
+ description: "Maximum number of observations to return (default: 20)."
1671
+ },
1672
+ type: {
1673
+ type: "string",
1674
+ description: "Filter by observation type (discovery, decision, bugfix, refactor, feature, change, diary, session-summary)."
1675
+ },
1676
+ since: {
1677
+ type: "string",
1678
+ description: "Duration (e.g. 24h, 7d, 30m) or ISO timestamp lower bound."
1679
+ },
1680
+ session: {
1681
+ type: "string",
1682
+ description: "Filter by source session ID."
1683
+ },
1684
+ tier: {
1685
+ type: "string",
1686
+ description: "Filter by memory tier ('short', 'medium', 'long')."
1687
+ }
1688
+ },
1689
+ gateway: "query",
1690
+ operation: "recent",
1691
+ output: { command: "memory-recent", operation: "memory.recent" },
1692
+ paramBuilder: (args) => ({
1693
+ ...args["limit"] !== void 0 && { limit: parseInt(args["limit"], 10) },
1694
+ ...args["type"] !== void 0 && { type: args["type"] },
1695
+ ...args["since"] !== void 0 && { since: args["since"] },
1696
+ ...args["session"] !== void 0 && { session: args["session"] },
1697
+ ...args["tier"] !== void 0 && { tier: args["tier"] }
1698
+ })
1699
+ });
1700
+ var diaryReadCommand = makeMemorySubcommand({
1701
+ name: "read",
1702
+ description: "Read recent diary-typed observations (T1006).",
1703
+ args: {
1704
+ limit: {
1705
+ type: "string",
1706
+ description: "Maximum number of diary entries to return (default: 20)."
1707
+ }
1708
+ },
1709
+ gateway: "query",
1710
+ operation: "diary",
1711
+ output: { command: "memory-diary-read", operation: "memory.diary" },
1712
+ paramBuilder: (args) => ({
1713
+ ...args["limit"] !== void 0 && { limit: parseInt(args["limit"], 10) }
1714
+ })
1715
+ });
1716
+ var diaryWriteCommand = makeMemorySubcommand({
1717
+ name: "write",
1718
+ description: "Write a diary-typed observation to brain.db (T1006).",
1719
+ args: {
1720
+ text: {
1721
+ type: "positional",
1722
+ description: "Diary entry text",
1723
+ required: true
1724
+ },
1725
+ title: {
1726
+ type: "string",
1727
+ description: "Optional diary entry title (defaults to first 120 chars of text)."
1728
+ },
1729
+ agent: {
1730
+ type: "string",
1731
+ description: "Optional agent provenance (e.g. cleo-prime, historian)."
1732
+ }
1733
+ },
1734
+ gateway: "mutate",
1735
+ operation: "diary.write",
1736
+ output: { command: "memory-diary-write", operation: "memory.diary.write" },
1737
+ paramBuilder: (args) => ({
1738
+ text: args["text"],
1739
+ ...args["title"] !== void 0 && { title: args["title"] },
1740
+ ...args["agent"] !== void 0 && { agent: args["agent"] }
1741
+ })
1742
+ });
1743
+ var diaryCommand = defineCommand({
1744
+ meta: {
1745
+ name: "diary",
1746
+ description: "Read or write diary-typed brain observations (T1006)."
1747
+ },
1748
+ subCommands: {
1749
+ read: diaryReadCommand,
1750
+ write: diaryWriteCommand
1751
+ },
1752
+ async run({ cmd, rawArgs }) {
1753
+ const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
1754
+ if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
1755
+ await showUsage(cmd);
1756
+ }
1757
+ });
1758
+ var watchCommand = defineCommand({
1759
+ meta: {
1760
+ name: "watch",
1761
+ description: "Long-poll stream of recent brain writes. Use --follow to stream continuously as SSE-style events."
1762
+ },
1763
+ args: {
1764
+ cursor: {
1765
+ type: "string",
1766
+ description: "Resume cursor (created_at lower bound) from a previous watch call."
1767
+ },
1768
+ limit: {
1769
+ type: "string",
1770
+ description: "Maximum events per poll (default: 10)."
1771
+ },
1772
+ follow: {
1773
+ type: "boolean",
1774
+ description: "Stream continuously; polls every --interval ms until interrupted."
1775
+ },
1776
+ interval: {
1777
+ type: "string",
1778
+ description: "Poll interval in milliseconds when --follow is set (default: 1000)."
1779
+ },
1780
+ json: {
1781
+ type: "boolean",
1782
+ description: "Output as JSON (non-follow mode only)."
1783
+ }
1784
+ },
1785
+ async run({ args }) {
1786
+ const buildParams = (cursor) => ({
1787
+ ...cursor !== void 0 && { cursor },
1788
+ ...args.limit !== void 0 && { limit: parseInt(args.limit, 10) }
1789
+ });
1790
+ if (!args.follow) {
1791
+ await dispatchFromCli(
1792
+ "query",
1793
+ "memory",
1794
+ "watch",
1795
+ buildParams(args.cursor),
1796
+ { command: "memory-watch", operation: "memory.watch" }
1797
+ );
1798
+ return;
1799
+ }
1800
+ const abortController = new AbortController();
1801
+ const onSignal = () => abortController.abort();
1802
+ process.once("SIGINT", onSignal);
1803
+ process.once("SIGTERM", onSignal);
1804
+ const stream = streamMemoryWatchEvents({
1805
+ cursor: args.cursor,
1806
+ limit: args.limit !== void 0 ? parseInt(args.limit, 10) : void 0,
1807
+ intervalMs: args.interval !== void 0 ? parseInt(args.interval, 10) : 1e3,
1808
+ dispatchRaw,
1809
+ signal: abortController.signal
1810
+ });
1811
+ for await (const item of stream) {
1812
+ if (item.kind === "ping") {
1813
+ process.stdout.write(`event: ping
1814
+ data: ${JSON.stringify({ ts: item.ts })}
1815
+
1816
+ `);
1817
+ } else if (item.kind === "events") {
1818
+ for (const event of item.events) {
1819
+ process.stdout.write(`event: observation
1820
+ data: ${JSON.stringify(event)}
1821
+
1822
+ `);
1823
+ }
1824
+ } else if (item.kind === "error") {
1825
+ cliError(item.message, 1, { name: item.code }, { operation: "memory.watch" });
1826
+ process.exit(1);
1827
+ return;
1828
+ } else if (item.kind === "close") {
1829
+ process.stdout.write(`event: close
1830
+ data: ${JSON.stringify({ ts: item.ts })}
1831
+
1832
+ `);
1833
+ }
1834
+ }
1835
+ }
1836
+ });
1837
+ var tierCommand = defineCommand({
1838
+ meta: { name: "tier", description: "Memory tier management: stats, promote, demote" },
1839
+ subCommands: {
1840
+ stats: tierStatsCommand,
1841
+ promote: tierPromoteCommand,
1842
+ demote: tierDemoteCommand
1843
+ }
1844
+ });
1845
+ var sweepCommand = defineCommand({
1846
+ meta: {
1847
+ name: "sweep",
1848
+ description: "T1147 W7 BRAIN noise sweep. --dry-run: detect noise candidates. --approve <runId>: apply to live tables. --status: list runs. --rollback <runId>: discard staged run."
1849
+ },
1850
+ args: {
1851
+ "dry-run": {
1852
+ type: "boolean",
1853
+ description: "Detect noise candidates without staging DB writes."
1854
+ },
1855
+ approve: {
1856
+ type: "string",
1857
+ description: "Run ID to approve and apply to live tables."
1858
+ },
1859
+ status: {
1860
+ type: "boolean",
1861
+ description: "List recent noise-sweep-2440 runs."
1862
+ },
1863
+ rollback: {
1864
+ type: "string",
1865
+ description: "Run ID to roll back without applying changes."
1866
+ },
1867
+ json: {
1868
+ type: "boolean",
1869
+ description: "Output as JSON"
1870
+ }
1871
+ },
1872
+ async run({
1873
+ args
1874
+ }) {
1875
+ const gateway = args.approve || args.rollback ? "mutate" : "query";
1876
+ await dispatchFromCli(
1877
+ gateway,
1878
+ "memory",
1879
+ "sweep",
1880
+ {
1881
+ "dry-run": args["dry-run"],
1882
+ approve: args.approve,
1883
+ status: args.status,
1884
+ rollback: args.rollback
1885
+ },
1886
+ { command: "memory-sweep", operation: "memory.sweep" }
1887
+ );
1888
+ }
1889
+ });
1890
+ var memoryCommand = defineCommand({
1891
+ meta: {
1892
+ name: "memory",
1893
+ description: "BRAIN memory operations (patterns, learnings, decisions \u2014 use decision-store/-find for architectural decisions)"
1894
+ },
1895
+ subCommands: {
1896
+ store: storeCommand,
1897
+ find: findCommand,
1898
+ stats: statsCommand,
1899
+ observe: observeCommand,
1900
+ timeline: timelineCommand,
1901
+ fetch: fetchCommand,
1902
+ "decision-find": decisionFindCommand,
1903
+ "decision-store": decisionStoreCommand,
1904
+ link: linkCommand,
1905
+ trace: traceCommand,
1906
+ related: relatedCommand,
1907
+ context: contextCommand,
1908
+ "graph-stats": graphStatsCommand,
1909
+ "graph-show": graphShowCommand,
1910
+ "graph-neighbors": graphNeighborsCommand,
1911
+ "graph-add": graphAddCommand,
1912
+ "graph-remove": graphRemoveCommand,
1913
+ "reason-why": reasonWhyCommand,
1914
+ "reason-similar": reasonSimilarCommand,
1915
+ "search-hybrid": searchHybridCommand,
1916
+ "code-links": codeLinksCommand,
1917
+ "code-auto-link": codeAutoLinkCommand,
1918
+ "code-memories-for-code": codeMemoriesForCodeCommand,
1919
+ "code-for-memory": codeForMemoryCommand,
1920
+ consolidate: consolidateCommand,
1921
+ dream: dreamCommand,
1922
+ reflect: reflectCommand,
1923
+ "dedup-scan": dedupScanCommand,
1924
+ "prune-stubs": pruneStubsCommand,
1925
+ "prune-traits": pruneTraitsCommand,
1926
+ "set-trait-scope": setTraitScopeCommand,
1927
+ import: importCommand,
1928
+ doctor: doctorCommand,
1929
+ "llm-status": llmStatusCommand,
1930
+ verify: verifyCommand,
1931
+ "pending-verify": pendingVerifyCommand,
1932
+ tier: tierCommand,
1933
+ // T1013 — new memory subcommands
1934
+ "precompact-flush": precompactFlushCommand,
1935
+ backfill: backfillCommand,
1936
+ digest: digestCommand,
1937
+ recent: recentCommand,
1938
+ diary: diaryCommand,
1939
+ watch: watchCommand,
1940
+ // T1147 W7 — BRAIN noise sweep
1941
+ sweep: sweepCommand
1942
+ },
1943
+ async run({ cmd, rawArgs }) {
1944
+ const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
1945
+ if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
1946
+ await showUsage(cmd);
1947
+ }
1948
+ });
1949
+ export {
1950
+ memoryCommand
1951
+ };
1952
+ //# sourceMappingURL=memory-2E27G2G5.js.map