@snoai/memory 0.0.0-stage → 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 (478) hide show
  1. package/LICENSE +176 -0
  2. package/README.md +7 -2
  3. package/config/b-profile-section-registry.json +118 -0
  4. package/config/llm/compiled/2026-05-19T230932Z/manifest.json +25 -0
  5. package/config/llm/compiled/2026-05-19T230932Z/registry-root.json +67 -0
  6. package/config/llm/compiled/2026-05-19T230932Z/resolved/mem_claw/openai_gpt_5_nano.json +5 -0
  7. package/config/llm/compiled/2026-05-19T230932Z/resolved/mem_claw/openrouter_auto.json +5 -0
  8. package/config/llm/compiled/2026-05-19T230932Z/resolved/mem_claw/sno_ai_extract.json +5 -0
  9. package/config/llm/compiled/2026-05-19T230932Z/source/mem_claw/openai_gpt_5_nano.mda +24 -0
  10. package/config/llm/compiled/2026-05-19T230932Z/source/mem_claw/openrouter_auto.mda +24 -0
  11. package/config/llm/compiled/2026-05-19T230932Z/source/mem_claw/sno_ai_extract.mda +24 -0
  12. package/config/llm/compiled/2026-07-21T001311Z/manifest.json +43 -0
  13. package/config/llm/compiled/2026-07-21T001311Z/registry-root.json +97 -0
  14. package/config/llm/compiled/2026-07-21T001311Z/resolved/mem_claw/openai_gpt_5_nano.json +5 -0
  15. package/config/llm/compiled/2026-07-21T001311Z/resolved/mem_claw/openrouter_auto.json +5 -0
  16. package/config/llm/compiled/2026-07-21T001311Z/resolved/mem_claw/sno_ai_extract.json +5 -0
  17. package/config/llm/compiled/2026-07-21T001311Z/resolved/mem_claw/sno_conflict_verdict.json +10 -0
  18. package/config/llm/compiled/2026-07-21T001311Z/resolved/mem_claw/sno_extract_chat.json +10 -0
  19. package/config/llm/compiled/2026-07-21T001311Z/resolved/mem_claw/sno_extract_profile.json +10 -0
  20. package/config/llm/compiled/2026-07-21T001311Z/source/mem_claw/openai_gpt_5_nano.mda +24 -0
  21. package/config/llm/compiled/2026-07-21T001311Z/source/mem_claw/openrouter_auto.mda +24 -0
  22. package/config/llm/compiled/2026-07-21T001311Z/source/mem_claw/sno_ai_extract.mda +24 -0
  23. package/config/llm/compiled/2026-07-21T001311Z/source/mem_claw/sno_conflict_verdict.mda +27 -0
  24. package/config/llm/compiled/2026-07-21T001311Z/source/mem_claw/sno_extract_chat.mda +27 -0
  25. package/config/llm/compiled/2026-07-21T001311Z/source/mem_claw/sno_extract_profile.mda +27 -0
  26. package/config/llm/compiled/2026-08-29T060335Z/manifest.json +43 -0
  27. package/config/llm/compiled/2026-08-29T060335Z/registry-root.json +97 -0
  28. package/config/llm/compiled/2026-08-29T060335Z/resolved/mem_claw/openai_gpt_5_nano.json +5 -0
  29. package/config/llm/compiled/2026-08-29T060335Z/resolved/mem_claw/openrouter_auto.json +5 -0
  30. package/config/llm/compiled/2026-08-29T060335Z/resolved/mem_claw/sno_ai_extract.json +5 -0
  31. package/config/llm/compiled/2026-08-29T060335Z/resolved/mem_claw/sno_conflict_verdict.json +10 -0
  32. package/config/llm/compiled/2026-08-29T060335Z/resolved/mem_claw/sno_extract_chat.json +10 -0
  33. package/config/llm/compiled/2026-08-29T060335Z/resolved/mem_claw/sno_extract_profile.json +10 -0
  34. package/config/llm/compiled/2026-08-29T060335Z/source/mem_claw/openai_gpt_5_nano.mda +24 -0
  35. package/config/llm/compiled/2026-08-29T060335Z/source/mem_claw/openrouter_auto.mda +24 -0
  36. package/config/llm/compiled/2026-08-29T060335Z/source/mem_claw/sno_ai_extract.mda +24 -0
  37. package/config/llm/compiled/2026-08-29T060335Z/source/mem_claw/sno_conflict_verdict.mda +27 -0
  38. package/config/llm/compiled/2026-08-29T060335Z/source/mem_claw/sno_extract_chat.mda +27 -0
  39. package/config/llm/compiled/2026-08-29T060335Z/source/mem_claw/sno_extract_profile.mda +27 -0
  40. package/config/llm/compiled/2026-09-04T004828Z/manifest.json +43 -0
  41. package/config/llm/compiled/2026-09-04T004828Z/registry-root.json +97 -0
  42. package/config/llm/compiled/2026-09-04T004828Z/resolved/mem_claw/openai_gpt_5_nano.json +5 -0
  43. package/config/llm/compiled/2026-09-04T004828Z/resolved/mem_claw/openrouter_auto.json +5 -0
  44. package/config/llm/compiled/2026-09-04T004828Z/resolved/mem_claw/sno_ai_extract.json +5 -0
  45. package/config/llm/compiled/2026-09-04T004828Z/resolved/mem_claw/sno_conflict_verdict.json +10 -0
  46. package/config/llm/compiled/2026-09-04T004828Z/resolved/mem_claw/sno_extract_chat.json +10 -0
  47. package/config/llm/compiled/2026-09-04T004828Z/resolved/mem_claw/sno_extract_profile.json +10 -0
  48. package/config/llm/compiled/2026-09-04T004828Z/source/mem_claw/openai_gpt_5_nano.mda +24 -0
  49. package/config/llm/compiled/2026-09-04T004828Z/source/mem_claw/openrouter_auto.mda +24 -0
  50. package/config/llm/compiled/2026-09-04T004828Z/source/mem_claw/sno_ai_extract.mda +24 -0
  51. package/config/llm/compiled/2026-09-04T004828Z/source/mem_claw/sno_conflict_verdict.mda +27 -0
  52. package/config/llm/compiled/2026-09-04T004828Z/source/mem_claw/sno_extract_chat.mda +27 -0
  53. package/config/llm/compiled/2026-09-04T004828Z/source/mem_claw/sno_extract_profile.mda +27 -0
  54. package/config/llm/current.json +4 -0
  55. package/config/llm/source/mem_claw/openai_gpt_5_nano.mda +24 -0
  56. package/config/llm/source/mem_claw/openrouter_auto.mda +24 -0
  57. package/config/llm/source/mem_claw/sno_ai_extract.mda +24 -0
  58. package/config/llm/source/mem_claw/sno_conflict_verdict.mda +27 -0
  59. package/config/llm/source/mem_claw/sno_extract_chat.mda +27 -0
  60. package/config/llm/source/mem_claw/sno_extract_profile.mda +27 -0
  61. package/config/llm.trust.json +37 -0
  62. package/dist/_types-CUKHSRkS.d.ts +103 -0
  63. package/dist/access-tracker-CSc21GtV.d.ts +110 -0
  64. package/dist/adapter-DMEmCTKo.d.ts +69 -0
  65. package/dist/adapter-XaRHZWZ2.js +333 -0
  66. package/dist/agent-llm-port-5oXgBpzJ.d.ts +53 -0
  67. package/dist/all-resources-BQK2ugjB.js +6379 -0
  68. package/dist/all-resources-Dij6l5h0.d.ts +18 -0
  69. package/dist/ambient-learning-text-normalizer-CxjATmMp.js +170 -0
  70. package/dist/ambient-learning-text-normalizer-_fH3LeuK.d.ts +10 -0
  71. package/dist/atomic-extraction-reply-BJ9XV_9s.js +863 -0
  72. package/dist/atomic-extraction-skill-CcXmuCqL.js +56 -0
  73. package/dist/atomic-memory-extraction-BpOUWPJM.d.ts +327 -0
  74. package/dist/atomic-memory-extraction-sdNf1-B1.js +3605 -0
  75. package/dist/b-profile-section-dictionary-provider-BHkoNqgk.js +1812 -0
  76. package/dist/b-profile-section-dictionary-provider-BxbksLj3.d.ts +62 -0
  77. package/dist/best-effort-BPZSzKk0.d.ts +9 -0
  78. package/dist/calendar-instruction-CzqZbAPG.js +194 -0
  79. package/dist/capture-policy-detector-CHz5GOPA.d.ts +53 -0
  80. package/dist/capture-policy-detector-DaMfy9CZ.js +357 -0
  81. package/dist/classifier-C96uH9OF.d.ts +272 -0
  82. package/dist/client.d.ts +34 -0
  83. package/dist/client.js +305 -0
  84. package/dist/coding-skin.d.ts +51 -0
  85. package/dist/coding-skin.js +55 -0
  86. package/dist/config-tSrvLXgV.js +2577 -0
  87. package/dist/connection-DAbzki8K.d.ts +391 -0
  88. package/dist/connection-DliCOBB2.js +297 -0
  89. package/dist/daily-log-generator-CH_KuWHs.js +469 -0
  90. package/dist/daily-log-generator-CsQPHl4A.d.ts +73 -0
  91. package/dist/daily-spend-estimator-DiwzBlo1.d.ts +8 -0
  92. package/dist/data-bootstrap-CYniFp8b.js +172 -0
  93. package/dist/data-bootstrap-CcJUwkqf.d.ts +30 -0
  94. package/dist/data-paths-C7sNdqvP.d.ts +22 -0
  95. package/dist/derived-suppression-cache-C7bGARc0.d.ts +36 -0
  96. package/dist/diagnostic-encoder.d.ts +6 -0
  97. package/dist/diagnostic-encoder.js +29 -0
  98. package/dist/embedding-provider-client-Q_hJonK9.js +294 -0
  99. package/dist/embedding-provider-client-vynZMuit.d.ts +94 -0
  100. package/dist/entry-metadata-parser-BIVSMCIk.js +20 -0
  101. package/dist/error-D-wb-rZw.js +23 -0
  102. package/dist/error-signals-D8_3vYu4.d.ts +28 -0
  103. package/dist/error-signals-lMH2uAdV.js +134 -0
  104. package/dist/errors-CeVRxf9V.d.ts +49 -0
  105. package/dist/extraction-text-sanitizer-B_AhIecT.d.ts +32 -0
  106. package/dist/i18n-text-DbD6Qify.d.ts +13 -0
  107. package/dist/index-BsMap4It.d.ts +650 -0
  108. package/dist/index-DL8AVj0Z.d.ts +571 -0
  109. package/dist/index-DQ7VL6d3.d.ts +350 -0
  110. package/dist/index.d.ts +65 -0
  111. package/dist/index.js +1201 -0
  112. package/dist/intent-analyzer-B5XVrWwe.d.ts +28 -0
  113. package/dist/internal/config/index.d.ts +2 -0
  114. package/dist/internal/config/index.js +581 -0
  115. package/dist/internal/config/plugin-config-schema.d.ts +2 -0
  116. package/dist/internal/config/plugin-config-schema.js +2 -0
  117. package/dist/internal/config/product-mode.d.ts +2 -0
  118. package/dist/internal/config/product-mode.js +36 -0
  119. package/dist/internal/config/settings.d.ts +2 -0
  120. package/dist/internal/config/settings.js +265 -0
  121. package/dist/internal/config/skill-categories.d.ts +4 -0
  122. package/dist/internal/config/skill-categories.js +68 -0
  123. package/dist/internal/config/skin-defaults.d.ts +6 -0
  124. package/dist/internal/config/skin-defaults.js +6 -0
  125. package/dist/internal/contract/discovery.d.ts +10 -0
  126. package/dist/internal/contract/discovery.js +53 -0
  127. package/dist/internal/contract/profile.d.ts +2 -0
  128. package/dist/internal/contract/profile.js +44 -0
  129. package/dist/internal/contract/routes.d.ts +2 -0
  130. package/dist/internal/contract/routes.js +61 -0
  131. package/dist/internal/engine/bindings/memory-cli-shared.d.ts +47 -0
  132. package/dist/internal/engine/bindings/memory-cli-shared.js +84 -0
  133. package/dist/internal/engine/bindings/memory-forget-tool.d.ts +5 -0
  134. package/dist/internal/engine/bindings/memory-forget-tool.js +66 -0
  135. package/dist/internal/engine/bindings/memory-list-tool.d.ts +5 -0
  136. package/dist/internal/engine/bindings/memory-list-tool.js +57 -0
  137. package/dist/internal/engine/bindings/memory-recall-tool.d.ts +10 -0
  138. package/dist/internal/engine/bindings/memory-recall-tool.js +283 -0
  139. package/dist/internal/engine/bindings/memory-reflection-resolve-tool.d.ts +5 -0
  140. package/dist/internal/engine/bindings/memory-reflection-resolve-tool.js +150 -0
  141. package/dist/internal/engine/bindings/memory-stats-tool.d.ts +5 -0
  142. package/dist/internal/engine/bindings/memory-stats-tool.js +43 -0
  143. package/dist/internal/engine/bindings/memory-store-tool.d.ts +5 -0
  144. package/dist/internal/engine/bindings/memory-store-tool.js +165 -0
  145. package/dist/internal/engine/bindings/memory-tool-access.d.ts +16 -0
  146. package/dist/internal/engine/bindings/memory-tool-access.js +46 -0
  147. package/dist/internal/engine/bindings/memory-tool-formatting.d.ts +62 -0
  148. package/dist/internal/engine/bindings/memory-tool-formatting.js +106 -0
  149. package/dist/internal/engine/bindings/memory-tool-results.d.ts +8 -0
  150. package/dist/internal/engine/bindings/memory-tool-results.js +41 -0
  151. package/dist/internal/engine/bindings/memory-tool-schemas.d.ts +109 -0
  152. package/dist/internal/engine/bindings/memory-tool-schemas.js +75 -0
  153. package/dist/internal/engine/bindings/memory-update-tool.d.ts +5 -0
  154. package/dist/internal/engine/bindings/memory-update-tool.js +127 -0
  155. package/dist/internal/engine/bindings/sno-station-mem-ambient-learning-hook.d.ts +14 -0
  156. package/dist/internal/engine/bindings/sno-station-mem-ambient-learning-hook.js +248 -0
  157. package/dist/internal/engine/bindings/sno-station-mem-auto-recall-hook.d.ts +12 -0
  158. package/dist/internal/engine/bindings/sno-station-mem-auto-recall-hook.js +324 -0
  159. package/dist/internal/engine/bindings/sno-station-mem-hook-types.d.ts +56 -0
  160. package/dist/internal/engine/bindings/sno-station-mem-hook-types.js +1 -0
  161. package/dist/internal/engine/bindings/sno-station-mem-insight-distill-factory.d.ts +14 -0
  162. package/dist/internal/engine/bindings/sno-station-mem-insight-distill-factory.js +119 -0
  163. package/dist/internal/engine/bindings/sno-station-mem-message-transcript.d.ts +52 -0
  164. package/dist/internal/engine/bindings/sno-station-mem-message-transcript.js +145 -0
  165. package/dist/internal/engine/bindings/sno-station-mem-reset-hook.d.ts +10 -0
  166. package/dist/internal/engine/bindings/sno-station-mem-reset-hook.js +9 -0
  167. package/dist/internal/engine/bindings/sno-station-mem-runtime-mode.d.ts +37 -0
  168. package/dist/internal/engine/bindings/sno-station-mem-runtime-mode.js +105 -0
  169. package/dist/internal/engine/bindings/sno-station-mem-session-state.d.ts +10 -0
  170. package/dist/internal/engine/bindings/sno-station-mem-session-state.js +27 -0
  171. package/dist/internal/engine/eval/trace.d.ts +2 -0
  172. package/dist/internal/engine/eval/trace.js +151 -0
  173. package/dist/internal/engine/extraction/ambient-learning-text-normalizer.d.ts +2 -0
  174. package/dist/internal/engine/extraction/ambient-learning-text-normalizer.js +2 -0
  175. package/dist/internal/engine/extraction/atomic-memory-extraction.d.ts +2 -0
  176. package/dist/internal/engine/extraction/atomic-memory-extraction.js +2 -0
  177. package/dist/internal/engine/extraction/b-profile-section-dictionary-provider.d.ts +2 -0
  178. package/dist/internal/engine/extraction/b-profile-section-dictionary-provider.js +2 -0
  179. package/dist/internal/engine/extraction/b-profile-section-rekey.d.ts +49 -0
  180. package/dist/internal/engine/extraction/b-profile-section-rekey.js +730 -0
  181. package/dist/internal/engine/extraction/capture-policy-detector.d.ts +2 -0
  182. package/dist/internal/engine/extraction/capture-policy-detector.js +2 -0
  183. package/dist/internal/engine/extraction/embedding-provider-client.d.ts +2 -0
  184. package/dist/internal/engine/extraction/embedding-provider-client.js +2 -0
  185. package/dist/internal/engine/extraction/extraction-text-sanitizer.d.ts +2 -0
  186. package/dist/internal/engine/extraction/extraction-text-sanitizer.js +114 -0
  187. package/dist/internal/engine/extraction/memory-metadata-codec.d.ts +3 -0
  188. package/dist/internal/engine/extraction/memory-metadata-codec.js +2 -0
  189. package/dist/internal/engine/extraction/memory-temporality-classifier.d.ts +2 -0
  190. package/dist/internal/engine/extraction/memory-temporality-classifier.js +2 -0
  191. package/dist/internal/engine/i18n/all-resources.d.ts +2 -0
  192. package/dist/internal/engine/i18n/all-resources.js +2 -0
  193. package/dist/internal/engine/i18n/locales.d.ts +2 -0
  194. package/dist/internal/engine/i18n/locales.js +19 -0
  195. package/dist/internal/engine/i18n/res/_types.d.ts +2 -0
  196. package/dist/internal/engine/i18n/res/_types.js +11 -0
  197. package/dist/internal/engine/observability/adapter.d.ts +2 -0
  198. package/dist/internal/engine/observability/adapter.js +2 -0
  199. package/dist/internal/engine/observability/best-effort.d.ts +2 -0
  200. package/dist/internal/engine/observability/best-effort.js +41 -0
  201. package/dist/internal/engine/observability/early-diagnostics.js +2 -0
  202. package/dist/internal/engine/observability/memory-snapshot.d.ts +2 -0
  203. package/dist/internal/engine/observability/memory-snapshot.js +44 -0
  204. package/dist/internal/engine/observability/observable-embedder.d.ts +2 -0
  205. package/dist/internal/engine/observability/observable-embedder.js +43 -0
  206. package/dist/internal/engine/observability/observable-llm-client.d.ts +2 -0
  207. package/dist/internal/engine/observability/observable-llm-client.js +98 -0
  208. package/dist/internal/engine/observability/observable-memory-store.d.ts +2 -0
  209. package/dist/internal/engine/observability/observable-memory-store.js +701 -0
  210. package/dist/internal/engine/observability/observable-retriever.d.ts +2 -0
  211. package/dist/internal/engine/observability/observable-retriever.js +95 -0
  212. package/dist/internal/engine/observability/runtime-diagnostics.d.ts +13 -0
  213. package/dist/internal/engine/observability/runtime-diagnostics.js +96 -0
  214. package/dist/internal/engine/observability/session-registry.d.ts +2 -0
  215. package/dist/internal/engine/observability/session-registry.js +58 -0
  216. package/dist/internal/engine/observability/version-metadata.d.ts +7 -0
  217. package/dist/internal/engine/observability/version-metadata.js +59 -0
  218. package/dist/internal/engine/operations/daily-spend-estimator.d.ts +2 -0
  219. package/dist/internal/engine/operations/daily-spend-estimator.js +97 -0
  220. package/dist/internal/engine/operations/learning-file-maintenance.d.ts +2 -0
  221. package/dist/internal/engine/operations/learning-file-maintenance.js +255 -0
  222. package/dist/internal/engine/operations/memory-tier-promoter.d.ts +2 -0
  223. package/dist/internal/engine/operations/memory-tier-promoter.js +95 -0
  224. package/dist/internal/engine/operations/runtime-audit-log.d.ts +3 -0
  225. package/dist/internal/engine/operations/runtime-audit-log.js +3 -0
  226. package/dist/internal/engine/provider/canonical-memory-corpus.d.ts +38 -0
  227. package/dist/internal/engine/provider/canonical-memory-corpus.js +253 -0
  228. package/dist/internal/engine/provider/provider-registration.d.ts +39 -0
  229. package/dist/internal/engine/provider/provider-registration.js +2 -0
  230. package/dist/internal/engine/provider/provider-row-renderer.d.ts +7 -0
  231. package/dist/internal/engine/provider/provider-row-renderer.js +53 -0
  232. package/dist/internal/engine/provider/provider-types.d.ts +2 -0
  233. package/dist/internal/engine/provider/provider-types.js +1 -0
  234. package/dist/internal/engine/reflection/daily-log-generator.d.ts +2 -0
  235. package/dist/internal/engine/reflection/daily-log-generator.js +2 -0
  236. package/dist/internal/engine/reflection/reflection-command-hooks.d.ts +2 -0
  237. package/dist/internal/engine/reflection/reflection-command-hooks.js +2 -0
  238. package/dist/internal/engine/reflection/reflection-deps.d.ts +2 -0
  239. package/dist/internal/engine/reflection/reflection-deps.js +1 -0
  240. package/dist/internal/engine/reflection/reflection-embedded-generator.d.ts +2 -0
  241. package/dist/internal/engine/reflection/reflection-embedded-generator.js +2 -0
  242. package/dist/internal/engine/reflection/reflection-injection-hooks.d.ts +2 -0
  243. package/dist/internal/engine/reflection/reflection-injection-hooks.js +219 -0
  244. package/dist/internal/engine/reflection/reflection-lifecycle-hooks.d.ts +2 -0
  245. package/dist/internal/engine/reflection/reflection-lifecycle-hooks.js +63 -0
  246. package/dist/internal/engine/reflection/strategy-hook-runner.d.ts +4 -0
  247. package/dist/internal/engine/reflection/strategy-hook-runner.js +3 -0
  248. package/dist/internal/engine/rem/classifier.d.ts +2 -0
  249. package/dist/internal/engine/rem/classifier.js +180 -0
  250. package/dist/internal/engine/rem/index.d.ts +4 -0
  251. package/dist/internal/engine/rem/index.js +2551 -0
  252. package/dist/internal/engine/rem/types.d.ts +2 -0
  253. package/dist/internal/engine/rem/types.js +40 -0
  254. package/dist/internal/engine/retrieval/access-tracker.d.ts +2 -0
  255. package/dist/internal/engine/retrieval/access-tracker.js +314 -0
  256. package/dist/internal/engine/retrieval/intent-analyzer.d.ts +2 -0
  257. package/dist/internal/engine/retrieval/intent-analyzer.js +27 -0
  258. package/dist/internal/engine/retrieval/retrieval-gate.d.ts +2 -0
  259. package/dist/internal/engine/retrieval/retrieval-gate.js +47 -0
  260. package/dist/internal/engine/retrieval/retriever.d.ts +2 -0
  261. package/dist/internal/engine/retrieval/retriever.js +2 -0
  262. package/dist/internal/engine/security/memory-scope-policy.d.ts +2 -0
  263. package/dist/internal/engine/security/memory-scope-policy.js +2 -0
  264. package/dist/internal/engine/security/redact.d.ts +2 -0
  265. package/dist/internal/engine/security/redact.js +34 -0
  266. package/dist/internal/engine/security/scopes.d.ts +3 -0
  267. package/dist/internal/engine/security/scopes.js +3 -0
  268. package/dist/internal/engine/shared/errors.d.ts +2 -0
  269. package/dist/internal/engine/shared/errors.js +66 -0
  270. package/dist/internal/engine/shared/i18n-text.d.ts +2 -0
  271. package/dist/internal/engine/shared/i18n-text.js +58 -0
  272. package/dist/internal/engine/shared/iso-date-time.d.ts +16 -0
  273. package/dist/internal/engine/shared/iso-date-time.js +40 -0
  274. package/dist/internal/engine/shared/lru.d.ts +2 -0
  275. package/dist/internal/engine/shared/lru.js +30 -0
  276. package/dist/internal/engine/shared/memory-kind-policy.d.ts +2 -0
  277. package/dist/internal/engine/shared/memory-kind-policy.js +64 -0
  278. package/dist/internal/engine/shared/paths.d.ts +3 -0
  279. package/dist/internal/engine/shared/paths.js +2 -0
  280. package/dist/internal/engine/shared/types.d.ts +3 -0
  281. package/dist/internal/engine/shared/types.js +25 -0
  282. package/dist/internal/engine/shared/utils.d.ts +2 -0
  283. package/dist/internal/engine/shared/utils.js +175 -0
  284. package/dist/internal/engine/telemetry/memory-telemetry-api.d.ts +134 -0
  285. package/dist/internal/engine/telemetry/memory-telemetry-api.js +730 -0
  286. package/dist/internal/engine/telemetry/memory-telemetry-observability.d.ts +24 -0
  287. package/dist/internal/engine/telemetry/memory-telemetry-observability.js +133 -0
  288. package/dist/internal/engine/telemetry/memory-telemetry-outbox.d.ts +2 -0
  289. package/dist/internal/engine/telemetry/memory-telemetry-outbox.js +443 -0
  290. package/dist/internal/engine/telemetry/memory-telemetry-types.d.ts +2 -0
  291. package/dist/internal/engine/telemetry/memory-telemetry-types.js +21 -0
  292. package/dist/internal/engine/telemetry/observe-ledger.d.ts +30 -0
  293. package/dist/internal/engine/telemetry/observe-ledger.js +111 -0
  294. package/dist/internal/model/agent-llm-port.d.ts +2 -0
  295. package/dist/internal/model/agent-llm-port.js +1 -0
  296. package/dist/internal/model/llm-client.d.ts +3 -0
  297. package/dist/internal/model/llm-client.js +3 -0
  298. package/dist/internal/model/llm-failure.d.ts +26 -0
  299. package/dist/internal/model/llm-failure.js +63 -0
  300. package/dist/internal/model/llm-mode-routing.d.ts +22 -0
  301. package/dist/internal/model/llm-mode-routing.js +37 -0
  302. package/dist/internal/store/atomic-memory-cutover-sql.d.ts +13 -0
  303. package/dist/internal/store/atomic-memory-cutover-sql.js +237 -0
  304. package/dist/internal/store/connection.d.ts +2 -0
  305. package/dist/internal/store/connection.js +2 -0
  306. package/dist/internal/store/data-bootstrap.d.ts +2 -0
  307. package/dist/internal/store/data-bootstrap.js +2 -0
  308. package/dist/internal/store/data-paths.d.ts +2 -0
  309. package/dist/internal/store/data-paths.js +65 -0
  310. package/dist/internal/store/maintenance.d.ts +75 -0
  311. package/dist/internal/store/maintenance.js +1401 -0
  312. package/dist/internal/store/memory-kinds-cutover-migrator.d.ts +28 -0
  313. package/dist/internal/store/memory-kinds-cutover-migrator.js +415 -0
  314. package/dist/internal/store/migrations.d.ts +27 -0
  315. package/dist/internal/store/migrations.js +201 -0
  316. package/dist/internal/store/sqlite-runtime.d.ts +2 -0
  317. package/dist/internal/store/sqlite-runtime.js +109 -0
  318. package/dist/internal/store/store.d.ts +3 -0
  319. package/dist/internal/store/store.js +2 -0
  320. package/dist/learning-file-maintenance-9b-Ut6Kv.d.ts +30 -0
  321. package/dist/llm-client-B7Xoxqou.js +1378 -0
  322. package/dist/llm-client-DOTSGzhe.d.ts +51 -0
  323. package/dist/locales-JxGmkG6t.d.ts +7 -0
  324. package/dist/log-site-catalog.generated-B9WYdnAM.js +2321 -0
  325. package/dist/log-site-catalog.json +1 -0
  326. package/dist/lru-DyoaTyIs.d.ts +14 -0
  327. package/dist/memdump.d.ts +52 -0
  328. package/dist/memdump.js +163 -0
  329. package/dist/memory-entry-projector-DHo8jH10.js +1015 -0
  330. package/dist/memory-kind-policy-LKt0u3gy.d.ts +23 -0
  331. package/dist/memory-metadata-codec-C3oQd47V.d.ts +68 -0
  332. package/dist/memory-metadata-codec-DL1sbJiN.js +577 -0
  333. package/dist/memory-runtime-BZtREuwW.js +19459 -0
  334. package/dist/memory-scope-policy-1gg5QlWZ.d.ts +67 -0
  335. package/dist/memory-scope-policy-DICSCURA.js +283 -0
  336. package/dist/memory-snapshot-3e44ND2i.d.ts +16 -0
  337. package/dist/memory-source-order-BtrIxaIt.js +134 -0
  338. package/dist/memory-store-base-XRA4S9Xl.d.ts +1095 -0
  339. package/dist/memory-store-shared-DeIDkhLj.js +158 -0
  340. package/dist/memory-store-write-validation-B_hDG2zf.js +243 -0
  341. package/dist/memory-telemetry-incidents-BWA9kcZx.js +8 -0
  342. package/dist/memory-telemetry-metadata-CA7W8tK6.js +77 -0
  343. package/dist/memory-telemetry-outbox-ddTdImt7.d.ts +74 -0
  344. package/dist/memory-telemetry-receipts-MAJecvXQ.d.ts +34 -0
  345. package/dist/memory-telemetry-receipts-YsxbwOAf.js +91 -0
  346. package/dist/memory-telemetry-types-CufVmrCs.d.ts +14 -0
  347. package/dist/memory-temporality-classifier-CEdRTN5J.d.ts +43 -0
  348. package/dist/memory-temporality-classifier-CKiTAHXe.js +184 -0
  349. package/dist/memory-tier-promoter-DbTpahkP.d.ts +43 -0
  350. package/dist/memory-tool-dependencies-CLODycUw.js +19 -0
  351. package/dist/memory-tool-dependencies-N69chrQc.d.ts +14 -0
  352. package/dist/model-call-table-CspopkBg.js +563 -0
  353. package/dist/model-reply-text-CKopStP2.js +334 -0
  354. package/dist/observable-embedder-DQnNgf9O.d.ts +17 -0
  355. package/dist/observable-llm-client-uwqPADpN.d.ts +21 -0
  356. package/dist/observable-memory-store-BaZKbhgq.d.ts +73 -0
  357. package/dist/observable-retriever-Dt_NUxAA.d.ts +23 -0
  358. package/dist/operation-cancellation-CTKWwNHk.js +81 -0
  359. package/dist/paths-qVF-5uBq.d.ts +1 -0
  360. package/dist/plugin-config-schema-C0UUbOmG.d.ts +413 -0
  361. package/dist/plugin-config-schema-YJLyIIcJ.js +361 -0
  362. package/dist/profile-TWPJ_myr.d.ts +13 -0
  363. package/dist/profile-section-writer-hIphqpUY.js +2149 -0
  364. package/dist/provider-registration-CF1tg8Xy.js +721 -0
  365. package/dist/provider-runtime-types-DFhtdA6d.d.ts +134 -0
  366. package/dist/provider-types-CZGm6v88.d.ts +23 -0
  367. package/dist/redact-BTIZcHQL.d.ts +5 -0
  368. package/dist/reflection-command-hooks-BeQiJI9-.js +644 -0
  369. package/dist/reflection-command-hooks-C1Vxgb-O.d.ts +32 -0
  370. package/dist/reflection-deps-RpLPFrSc.d.ts +19 -0
  371. package/dist/reflection-embedded-generator-CDUhgV96.js +130 -0
  372. package/dist/reflection-embedded-generator-CxOex5xK.d.ts +14 -0
  373. package/dist/reflection-injection-hooks-DfUgqu8f.d.ts +43 -0
  374. package/dist/reflection-lifecycle-hooks-Ct5HBdSG.d.ts +27 -0
  375. package/dist/relation-dictionary-Cev1kyLe.js +4248 -0
  376. package/dist/release-download.d.ts +8 -0
  377. package/dist/release-download.js +32 -0
  378. package/dist/relevant-memories-context-m8nuFZcM.js +23 -0
  379. package/dist/rem-batch-executor-Cbm5gfSe.js +31644 -0
  380. package/dist/rem-batch-executor-bc0IFlp2.js +2 -0
  381. package/dist/rem-consumer-retrieval-CRpvG8KS.js +246 -0
  382. package/dist/rem-trigger-BTxkcjgT.js +729 -0
  383. package/dist/resolver-Dy-hnjCR.js +103 -0
  384. package/dist/results-C3ZLroMb.js +140 -0
  385. package/dist/retrieval-gate-Bx2Zg7jD.d.ts +31 -0
  386. package/dist/retriever-CygHBazG.js +1757 -0
  387. package/dist/retriever-Ruk3zp7_.d.ts +469 -0
  388. package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
  389. package/dist/routes-Ce7SQKec.js +59 -0
  390. package/dist/runtime-audit-log-BCeujlEp.js +430 -0
  391. package/dist/runtime-audit-log-zpQiR9HT.d.ts +149 -0
  392. package/dist/scopes-CSOn6zdd.js +71 -0
  393. package/dist/scopes-CtrY-YQ3.d.ts +23 -0
  394. package/dist/server-BPAY4NTG.js +1410 -0
  395. package/dist/session-registry-DBoE7AvZ.d.ts +14 -0
  396. package/dist/sidecar/main.d.ts +1 -0
  397. package/dist/sidecar/main.js +56 -0
  398. package/dist/signed-registry-constants-Bv0fgZ8Q.d.ts +12 -0
  399. package/dist/signed-registry-constants-yq3DlG3B.js +82 -0
  400. package/dist/sno-station-mem-runtime-dependencies-Bu-MiqPX.d.ts +31 -0
  401. package/dist/sno-station-mem-runtime-dependencies-DjLOhB45.js +30 -0
  402. package/dist/sqlite-runtime-L_ywirTm.d.ts +58 -0
  403. package/dist/store-2pM0-dZg.d.ts +27 -0
  404. package/dist/store-DzpZBMEm.js +5830 -0
  405. package/dist/strategy-hook-runner-gBtU47tX.d.ts +16 -0
  406. package/dist/strategy-hook-runner-zmdIYOmQ.js +110 -0
  407. package/dist/token-counter-BD1f48Km.js +73 -0
  408. package/dist/trace-1t1n_wUm.d.ts +86 -0
  409. package/dist/types-DxKqU60b.d.ts +477 -0
  410. package/dist/types-pVomjzqR.d.ts +132 -0
  411. package/dist/unplaced-candidate-migration-CbQHzcEM.js +940 -0
  412. package/dist/utils-Ctb9aevJ.d.ts +34 -0
  413. package/drizzle/0000_initial.sql +10 -0
  414. package/drizzle/0001_virtual_tables.sql +34 -0
  415. package/drizzle/0002_add_indexes.sql +11 -0
  416. package/drizzle/0003_content_hash_lookup_index.sql +2 -0
  417. package/drizzle/0004_chunk_swap.sql +60 -0
  418. package/drizzle/0005_drop_legacy_vec_fts.sql +10 -0
  419. package/drizzle/0006_fts_simple.sql +45 -0
  420. package/drizzle/0007_restore_simple_fts.sql +40 -0
  421. package/drizzle/0008_widen_memory_hash_unique_index.sql +4 -0
  422. package/drizzle/0009_memory_telemetry.sql +109 -0
  423. package/drizzle/0010_provider_mappings.sql +27 -0
  424. package/drizzle/0011_db_optimization.sql +82 -0
  425. package/drizzle/0012_b_profile_lanes.sql +9 -0
  426. package/drizzle/0013_extraction_timestamps.sql +6 -0
  427. package/drizzle/0014_extraction_timestamp_source.sql +3 -0
  428. package/drizzle/0015_task_lifecycle_state.sql +101 -0
  429. package/drizzle/0016_task_lifecycle_legacy_migration.sql +144 -0
  430. package/drizzle/0017_unplaced_candidates.sql +15 -0
  431. package/drizzle/0018_rem_batch_chassis.sql +71 -0
  432. package/drizzle/0019_profile_recovery_entries.sql +17 -0
  433. package/drizzle/0020_rem_scan_retry_progress.down.sql +14 -0
  434. package/drizzle/0020_rem_scan_retry_progress.sql +24 -0
  435. package/drizzle/0021_rem_two_facet_storage.down.sql +14 -0
  436. package/drizzle/0021_rem_two_facet_storage.sql +42 -0
  437. package/drizzle/0022_rem_facet_chunk_versions.down.sql +4 -0
  438. package/drizzle/0022_rem_facet_chunk_versions.sql +4 -0
  439. package/drizzle/0023_rem_defect_ledger.sql +40 -0
  440. package/drizzle/0024_rem_unbuilt_foundations.down.sql +13 -0
  441. package/drizzle/0024_rem_unbuilt_foundations.sql +65 -0
  442. package/drizzle/0025_rem_journal_operation_constraint.sql +28 -0
  443. package/drizzle/0026_rem_journal_detail.sql +1 -0
  444. package/drizzle/0027_legacy_nodix_namespace.sql +3 -0
  445. package/drizzle/0028_memory_timezone.sql +23 -0
  446. package/drizzle/0029_rem_write_hash_symmetry.sql +17 -0
  447. package/drizzle/0030_atomic_memory_additive.sql +105 -0
  448. package/drizzle/0031_atomic_extraction_ledger.sql +23 -0
  449. package/drizzle/0032_atomic_memory_entities.sql +12 -0
  450. package/drizzle/0033_todo_own_store.sql +99 -0
  451. package/drizzle/meta/0000_snapshot.json +87 -0
  452. package/drizzle/meta/_journal.json +244 -0
  453. package/generated/rem-operations.json +1 -0
  454. package/package.json +126 -4
  455. package/scripts/download-simple-tokenizer.mjs +254 -0
  456. package/settings.default.json +243 -0
  457. package/skills/extract-atomic-memory/SKILL.md +298 -0
  458. package/skills/extract-atomic-memory/references/account-for-turns.md +9 -0
  459. package/skills/extract-atomic-memory/references/calendar-meaning.md +64 -0
  460. package/skills/extract-atomic-memory/references/capture.md +120 -0
  461. package/skills/extract-atomic-memory/references/enrichment.md +92 -0
  462. package/skills/extract-atomic-memory/references/missing-durable-half.md +6 -0
  463. package/skills/extract-atomic-memory/references/progress-classification.md +21 -0
  464. package/skills/extract-atomic-memory/references/resolve-subject.md +19 -0
  465. package/skills/extract-atomic-memory/references/surrounding-context.md +10 -0
  466. package/skills/extract-atomic-memory/references/user-subject-guard.md +29 -0
  467. package/skills/judge-group-closure/SKILL.md +25 -0
  468. package/skills/judge-rem-memory-updates/SKILL.md +56 -0
  469. package/skills/judge-rem-memory-updates/agents/openai.yaml +4 -0
  470. package/skills/judge-retired-position/SKILL.md +25 -0
  471. package/skills/judge-task-lifecycle/SKILL.md +45 -0
  472. package/skills/key-state-attribute/SKILL.md +16 -0
  473. package/skills/resolve-entity-identity/SKILL.md +24 -0
  474. package/skills/resolve-relative-time/SKILL.md +22 -0
  475. package/sqlite-extensions/LICENSE-simple-tokenizer +28 -0
  476. package/sqlite-extensions/LICENSE-sqlite-vec +21 -0
  477. package/sqlite-extensions/linux-arm64/vec0.so +0 -0
  478. package/sqlite-extensions/linux-x64/vec0.so +0 -0
@@ -0,0 +1,571 @@
1
+ import { z } from "zod";
2
+ import { CHUNKING_VERSION, DEFAULT_AGGREGATION_CONFIG, DEFAULT_CHUNK_CONFIG, HEAD_EXTRACT_MIN_CONTENT_TOKENS, HEAD_EXTRACT_OVERLAP_DROP_RATIO, HEAD_EXTRACT_TOKEN_BUDGET } from "@snoai/chunking";
3
+ import { LOCAL_EMBEDDING_MODEL } from "@snoai/embedder";
4
+ //#region config/index.d.ts
5
+ /** Maximum wait for sidecar requests and resource cleanup during shutdown. */
6
+ declare const MEMORY_SHUTDOWN_TIMEOUT_MS: number;
7
+ /**
8
+ * Final result floor, applied to the POST-scoring-pipeline score (after the
9
+ * multiplicative shrinker chain: importance, length-norm, time-decay,
10
+ * retention). That chain routinely compresses a genuinely relevant match to
11
+ * 0.03-0.06 once a memory ages past its decay half-life — a real, expected
12
+ * production scenario, not an edge case. The old value (0.37) was calibrated
13
+ * against the PRE-shrinker fused score scale and silently rejected almost
14
+ * all real recall once shrinkers applied (confirmed 2026-07-05 scoring-
15
+ * pipeline audit). 0 matches the only value ever proven end-to-end
16
+ * (LoCoMo stratified-100, 86%, `evals/locomo/outputs/stratified-100-20260705-002827`);
17
+ * shipped and tested must be the same config. Re-introducing a nonzero floor
18
+ * needs fresh measured data post the A2/A3 fixes below, not a guess.
19
+ */
20
+ declare const DEFAULT_MIN_SCORE = 0;
21
+ /** Hard floor applied before any score amplification in the pipeline. See
22
+ * `DEFAULT_MIN_SCORE` — same reasoning, same fix. */
23
+ declare const DEFAULT_HARD_MIN_SCORE = 0;
24
+ /** Default importance score for new memories (0.0–1.0) */
25
+ declare const DEFAULT_IMPORTANCE = .7;
26
+ /** Default scope for memories without explicit scope */
27
+ declare const DEFAULT_SCOPE = "global";
28
+ /** Default embedding vector dimension (Voyage AI 1024-d) */
29
+ declare const VECTOR_DIMENSION_DEFAULT = 1024;
30
+ /** Plugin version identifier */
31
+ declare const PLUGIN_VERSION = "0.9.74";
32
+ /** Production sno.ai host origin used by @snoai/observability. */
33
+ declare const SNO_OBSERVE_DEFAULT_BASE_URL = "https://www.sno.ai";
34
+ /** Default observability agent id for OpenClaw plugin emits. */
35
+ declare const SNO_OBSERVE_DEFAULT_AGENT_ID = "openclaw";
36
+ /** Bounded lifecycle observe flush — enough headroom for the SDK to complete one HTTP POST batch. */
37
+ declare const SNO_OBSERVE_FLUSH_TIMEOUT_MS = 8e3;
38
+ /** Default top-K results returned from search */
39
+ declare const DEFAULT_TOP_K = 10;
40
+ /** Default and minimum character-estimated token budgets for one recall result. */
41
+ declare const DEFAULT_RECALL_TOKEN_BUDGET = 7e3;
42
+ declare const MIN_RECALL_TOKEN_BUDGET = 5e3;
43
+ /** Weight for vector (semantic) branch in hybrid score fusion */
44
+ declare const DEFAULT_VECTOR_WEIGHT = .7;
45
+ /** Weight for BM25 (keyword) branch in hybrid score fusion */
46
+ declare const DEFAULT_BM25_WEIGHT = .3;
47
+ /** Initial candidate pool size for precision recall search */
48
+ declare const CANDIDATE_POOL_SIZE = 64;
49
+ /**
50
+ * Hard ceiling for candidate pool expansion. Also the retrieval limit `memory_recall` asks for,
51
+ * so it bounds how much of a live store one answer can see. Raised 100 → 512 on 2026-09-06 (owner
52
+ * order): atomic rows are small and many, and at 100 a 159-row live store served 76 rows per
53
+ * question, cutting live to-dos the question asked for; at 512 the whole store came back for
54
+ * 3,476 tokens, half the recall token budget. Raised again 512 -> 2048 on 2026-09-15: the pool is
55
+ * `max(candidatePoolSize, limit * 2)` clamped here, so at 512 a caller asking for more than 256
56
+ * memories silently got fewer, and the ceiling — not the ranking — decided what the model saw.
57
+ */
58
+ declare const MAX_CANDIDATE_POOL_SIZE = 2048;
59
+ /**
60
+ * How many candidates one `memory_recall` call retrieves and ranks.
61
+ *
62
+ * Split from `MAX_CANDIDATE_POOL_SIZE` on 2026-09-15. The tool used to ask for that ceiling
63
+ * directly, so raising the ceiling to let auto-recall inject more memories would also have made
64
+ * every tool call fuse and rerank four times as many rows for a result the token packer bounds
65
+ * at `DEFAULT_RECALL_TOKEN_BUDGET` anyway. This keeps the tool's cost where it was measured.
66
+ */
67
+ declare const MAX_RECALL_TOOL_CANDIDATES = 512;
68
+ /**
69
+ * How many of a subject's live profile and state rows, most similar first, the REM replace wave
70
+ * pairs each such row with (PRD 140 REQ-8). A persona's live profile holds 72–107 rows (measured
71
+ * 2026-09-07), so 128 reaches every row of one subject; it catches what the write-time cap below
72
+ * leaves out.
73
+ */
74
+ declare const ARRIVAL_RETIREMENT_CANDIDATE_CAP = 128;
75
+ /**
76
+ * How many older live profile and state rows of the project, most similar first, a newly
77
+ * written row is judged against at write time, one conflict-adjudication call per pair (PRD 140
78
+ * REQ-2). A measured correction pair was its subject's most similar pair (0.688 against 0.495–0.618
79
+ * for the others, 2026-09-23); a target outside this cap is left to the REM replace wave.
80
+ */
81
+ declare const ARRIVAL_RETIREMENT_JUDGED_CANDIDATE_CAP = 10;
82
+ /**
83
+ * Measurement-only overrides for the block 210 retrieval-breadth experiment.
84
+ *
85
+ * Both are OFF unless the named environment variable is set, and neither is
86
+ * reachable from the plugin configuration schema, so a deployed plugin cannot
87
+ * turn them on: the experiment harness sets them on the process it starts and
88
+ * nothing else does. They exist because the runtime and the schema both stop
89
+ * the candidate pool at `MAX_CANDIDATE_POOL_SIZE`, which makes the pool-200
90
+ * cell impossible to run at all without one enabling edit (PRD 210 DEC-1).
91
+ *
92
+ * Read at call time, not at import time, so a harness that sets the variable
93
+ * after this module loads still gets the value it asked for.
94
+ */
95
+ declare function experimentCandidatePoolOverride(): number | undefined;
96
+ /** True only while the block 210 experiment harness has asked for MMR off. */
97
+ declare function experimentMmrDisabled(): boolean;
98
+ /**
99
+ * Maximum aggregation evidence rows materialized into one recall result.
100
+ * Derived from the largest measured population (290) plus ~10% headroom, then raised with the
101
+ * candidate pool ceiling on 2026-09-06 so a whole-population read can serve past that ceiling.
102
+ * This bounds the synchronous storage read; a separate token budget bounds
103
+ * the serialized tool result.
104
+ */
105
+ declare const MAX_AGGREGATION_ROWS = 640;
106
+ /**
107
+ * Token budget for the aggregation payload ONE consumer receives.
108
+ *
109
+ * Derived, and every number is a measurement. The answering engine's context is 64K tokens (owner,
110
+ * 2026-08-14, raised from 32K with the Qwen 3.8 rollout); half is reserved for the question, the
111
+ * surrounding prompt and the answer, leaving 32K for recalled evidence. Measured with
112
+ * `dev-scripts/census-aggregation-payload.mts` against the largest real store
113
+ * (`academic_researcher_weekly`, 138 active profile/episodic rows): the ENTIRE population renders in
114
+ * 43,699 characters ~= 10,925 tokens, a sixth of the context. A complete aggregation is therefore
115
+ * the ordinary case on real data, not an aspiration.
116
+ *
117
+ * The HALF is the load-bearing part, not the literal number. When the context moved to 64K this
118
+ * constant did not move with it for one commit, and a budget that stays put while its derivation
119
+ * doubles silently becomes a quarter of the context — a tightening nobody decided and nobody would
120
+ * find. That is the same shape as defect 2 below. If the context changes again, this changes.
121
+ *
122
+ * Known trade, stated rather than discovered later: widening this window is what raised aggregation
123
+ * from 0.045 to 0.744 on 2026-08-13, and it is also what dropped FAA 0.647 -> 0.600 in the same
124
+ * run, because retired rows the old ceiling had hidden came back into view. The answer to that is
125
+ * REM removing them (PRD 30/40), never a smaller recall window — shrinking this to protect FAA
126
+ * re-severs the counting path, which is the defect this constant exists to record.
127
+ *
128
+ * This replaces three ceilings that stacked on one path and severed it. Measured on the full
129
+ * benchmark run of 2026-08-13: 30 counting questions scored 0.045 mean with 28 of them exactly
130
+ * 0.000, while the same personas' other 60 questions scored 0.748. The model was not wrong — asked
131
+ * for a week of steps it answered "14,392 steps (recorded on June 7). No other step data is logged
132
+ * for the rest of the week", because 8 rows of 138 reached it. A model cannot total rows it was
133
+ * never shown. The three were:
134
+ *
135
+ * 1. `MAX_AGGREGATION_OUTPUT_ROWS = 8` — no derivation anywhere; 5.8% of a population handed to a
136
+ * question whose entire job is to total that population.
137
+ * 2. `MAX_AGGREGATION_TOOL_RESULT_CHARS = 16_384` — a unit error. 16,384 was the OLD 16K context
138
+ * in TOKENS, applied as a CHARACTER count, binding 3-4x tighter than it read.
139
+ * 3. Charging each consumer for the other's copy: the budget measured `JSON.stringify(result)`,
140
+ * which carries every row twice — once rendered, once in `memories` — while the OpenClaw host
141
+ * reads only the rendered text and the eval reads only `memories`.
142
+ *
143
+ * So this budget is counted in tokens, against the larger of the two consumer views, never a sum.
144
+ */
145
+ declare const MAX_AGGREGATION_RESULT_TOKENS = 32768;
146
+ /** Pool size = max(candidatePoolSize, limit * PRECISION_RECALL_POOL_SIZE_FACTOR) */
147
+ declare const PRECISION_RECALL_POOL_SIZE_FACTOR = 2;
148
+ /** Enable age-based retrieval scoring only when explicitly requested. */
149
+ declare const TEMPORAL_WEIGHTING_DEFAULT: boolean;
150
+ /** Recency boost half-life in days (entries this old get 50% boost) */
151
+ declare const RECENCY_HALF_LIFE_DAYS = 14;
152
+ /** Additive recency boost magnitude */
153
+ declare const RECENCY_WEIGHT = .1;
154
+ /** Maximum allowed recency weight */
155
+ declare const RECENCY_WEIGHT_MAX = .5;
156
+ /** Base multiplier for importance weighting (score * (base + importance * base)) */
157
+ declare const IMPORTANCE_WEIGHT_BASE = .7;
158
+ /**
159
+ * Reference text length for log normalization (longer texts penalized).
160
+ * 0 disables the stage (see `applyLengthNormalization`'s early-return).
161
+ * Disabled 2026-07-05: confirmed actively harmful, not just miscalibrated —
162
+ * it demotes memories by parent-document verbosity, not by how much of the
163
+ * matched chunk is relevant, and was the dominant compressor feeding the
164
+ * MMR scale-mismatch bug (see MMR_LAMBDA below). Anchor value 500 (chars)
165
+ * also never matched the chunk geometry (256-448 tokens) it was scoring.
166
+ */
167
+ declare const LENGTH_NORM_ANCHOR = 0;
168
+ /** Time decay half-life in days */
169
+ declare const TIME_DECAY_HALF_LIFE_DAYS = 60;
170
+ /** Minimum time decay multiplier (floor for very old entries) */
171
+ declare const TIME_DECAY_FLOOR = .6;
172
+ /** Dynamic memories use a shorter half-life when temporal decay is enabled */
173
+ declare const TEMPORAL_DYNAMIC_HALF_LIFE_DIVISOR = 3;
174
+ /**
175
+ * Relevance vs diversity tradeoff for MMR (0.7 = 70% relevance, 30% diversity).
176
+ * `applyMmrDiversity` normalizes the relevance term to [0,1] (batch-max) before
177
+ * applying this weight — without that normalization, the shrinker chain above
178
+ * compresses relevance so far below the [0,1] cosine-similarity diversity term
179
+ * that this ratio was moot (diversity always won). Fixed 2026-07-05.
180
+ */
181
+ declare const MMR_LAMBDA = .7;
182
+ /** Weight for fusion score in rerank blend */
183
+ declare const RERANK_BLEND_VECTOR = .3;
184
+ /** Weight for cross-encoder score in rerank blend */
185
+ declare const RERANK_BLEND_CROSS = .7;
186
+ /** Fusion-score weight in local cosine-blend rerank */
187
+ declare const LIGHTWEIGHT_FUSION_WEIGHT = .7;
188
+ /** Cosine-similarity weight in local cosine-blend rerank */
189
+ declare const LIGHTWEIGHT_COSINE_WEIGHT = .3;
190
+ /** Default rerank model identifier */
191
+ declare const DEFAULT_RERANK_MODEL = "rerank-2";
192
+ /** Default timeout for rerank API calls in milliseconds */
193
+ declare const DEFAULT_RERANK_TIMEOUT_MS = 15e3;
194
+ /**
195
+ * How many rerank batches may be in flight at once. A candidate pool of
196
+ * `MAX_CANDIDATE_POOL_SIZE` divided by a provider's per-request batch limit is 11 requests for
197
+ * TEI, and sending them one after another put `DEFAULT_RERANK_TIMEOUT_MS` on the clock 11 times
198
+ * over. Four is what the Sno GPU serves concurrently at near-linear 4x (owner-measured
199
+ * 2026-08-17); the first failing wave still ends the whole rerank, so a wedged reranker costs one
200
+ * timeout rather than one per batch.
201
+ */
202
+ declare const DEFAULT_RERANK_BATCH_CONCURRENCY = 4;
203
+ /**
204
+ * Texts per HTTP request, applied whatever `rerankMaxCandidates` allows out in total: that one
205
+ * is the operator's budget, this one is the transport's own per-request limit.
206
+ *
207
+ * Confirmed 2026-09-14 against the deployed self-hosted ranker, which answers a 51-text request
208
+ * with `{"error":"too many texts: max 50, got 51"}`. Such a deployment rejects an over-limit
209
+ * batch outright rather than truncating it, and the retriever files that HTTP 400 as "reranker
210
+ * unavailable" — so getting this wrong degrades every call to raw fusion order with no visible
211
+ * error.
212
+ *
213
+ * It binds every provider, not only the self-hosted one it was measured against. Making it
214
+ * conditional on the configured provider name put the guarantee in a deploy script instead of
215
+ * in the code. Hosted providers (voyage, jina, pinecone, dashscope) document much higher
216
+ * limits, so holding them to this one only sends more, smaller requests, which the rerank waves
217
+ * already run four at a time.
218
+ */
219
+ declare const DEFAULT_TEI_RERANK_MAX_CANDIDATES = 50;
220
+ /**
221
+ * THE per-record token ceiling, and the only number of its kind in this repository (owner
222
+ * ruling 2026-09-14). One stored memory record, one embedder input, one rerank candidate,
223
+ * one row rendered into an aggregation answer: each is at most this many tokens, counted by
224
+ * the embedder's own tokenizer (`Embedder.countTokens`), never estimated from characters.
225
+ * Why one number: the local ONNX embedder silently truncates past its context window, the
226
+ * Sno reranker silently truncates past its own, and a record longer than either scores on
227
+ * its first half only — measured 2026-09-14, a claim placed past the cut ranked 0.0001.
228
+ * The reranker's window is shared with the query and a fixed instruction, so this ceiling
229
+ * must leave that room. It does NOT leave it by itself: a record at this ceiling plus any
230
+ * query at all is already past the reranker's window, which is why the rerank path cuts the
231
+ * request copy of a candidate down to what the query leaves, inside this same number.
232
+ * The two tokenizers are no longer one vocabulary either — the deployed ranking model is not
233
+ * the embedder's model (measured 2026-09-14), so a count taken here is an estimate of the
234
+ * ranker's count, and the ranker's own refusal is the only exact measure.
235
+ * Extraction is told to split anything longer (skill `extract-atomic-memory`); the store
236
+ * refuses a longer record outright. Every other size in this file that describes a piece
237
+ * of a record derives from this constant — do not write its value, or a fraction of it, as
238
+ * a literal anywhere else.
239
+ */
240
+ declare const DEFAULT_MAX_CONTEXT_TOKENS = 512;
241
+ /**
242
+ * Tokens the ranking model's own prompt template adds to a pair, on top of the query and the
243
+ * document. Measured against the deployed endpoint 2026-09-14: a 509-token pair is accepted
244
+ * and reported back as 512 input tokens, and a 510-token pair is refused as 513.
245
+ */
246
+ declare const RERANK_PROMPT_TEMPLATE_TOKENS = 3;
247
+ /** Maximum lines per chunk before forcing an earlier split at a line boundary */
248
+ declare const DEFAULT_MAX_LINES_PER_CHUNK = 50;
249
+ /** Default list query page size */
250
+ declare const DEFAULT_LIST_LIMIT = 50;
251
+ /**
252
+ * Maximum allowed list query page size; also caps each search branch
253
+ * (`memory-store-search-api.ts` clamps both the semantic and the keyword branch to it), so it
254
+ * stays >= the pool ceiling. Derived, not written: left at a literal 512 when the pool ceiling
255
+ * went 512 -> 2048 on 2026-09-15, every branch silently returned at most 512 candidates while
256
+ * retrieval asked for up to 2048, and the ceiling decided what ranking never saw.
257
+ */
258
+ declare const MAX_LIST_LIMIT: typeof MAX_CANDIDATE_POOL_SIZE;
259
+ /** Maximum number of to-dos prepended to one recall result */
260
+ declare const MAX_RECALLED_TODOS = 50;
261
+ declare const MAX_RECALLED_TODO_TOKENS = 1e3;
262
+ /**
263
+ * Ceiling for chunk-level fetch budgets (semantic/keyword chunk search).
264
+ * Deliberately independent of MAX_LIST_LIMIT: memory-level wrappers overfetch
265
+ * chunks (limit * 8) so one high-recall parent cannot collapse parent diversity.
266
+ */
267
+ declare const MAX_CHUNK_FETCH_LIMIT = 4096;
268
+ /** Batch size for bulk delete operations (respects SQLite ~32k bind-param limit) */
269
+ declare const DELETE_BATCH_SIZE = 500;
270
+ /** Default limit for forget-query similarity search */
271
+ declare const FORGET_QUERY_DEFAULT_LIMIT = 10;
272
+ /** Minimum score threshold for forget-query matches */
273
+ declare const FORGET_QUERY_MIN_SCORE = .8;
274
+ /**
275
+ * Minimum age of the newest backup before another is taken (1 day). A backup is a full copy of
276
+ * the store, so an hourly cadence cost a 1.7 GB store 40 GB of disk a day.
277
+ */
278
+ declare const BACKUP_INTERVAL_MS = 864e5;
279
+ /** Number of backup files to retain before rotation */
280
+ declare const BACKUP_RETENTION_COUNT = 6;
281
+ /**
282
+ * Share of the backup volume that must stay free. Before a backup is written the oldest backups are
283
+ * deleted until the copy fits above this floor, and again afterwards if the volume is still under
284
+ * it; the newest backup is always kept, and when even that is not enough the backup is skipped.
285
+ */
286
+ declare const BACKUP_MIN_FREE_DISK_RATIO = .1;
287
+ /** How often the maintenance timer wakes to see which jobs are due (1 hour). */
288
+ declare const MAINTENANCE_TICK_MS = 36e5;
289
+ /** Full-page integrity sweep (1 hour). */
290
+ declare const INTEGRITY_CHECK_INTERVAL_MS = 36e5;
291
+ /** Usage-telemetry outbox drain and quarantine cleanup (1 hour). */
292
+ declare const USAGE_OUTBOX_INTERVAL_MS = 36e5;
293
+ /** Pruning of expired recall/inject usage events (1 hour). */
294
+ declare const USAGE_EVENT_RETENTION_INTERVAL_MS = 36e5;
295
+ /** Full-text index segment merge (1 hour). */
296
+ declare const FTS_MERGE_INTERVAL_MS = 36e5;
297
+ /** Query-planner statistics refresh (1 hour). */
298
+ declare const PLANNER_STATISTICS_INTERVAL_MS = 36e5;
299
+ /**
300
+ * How often the automatic REM trigger is evaluated (1 hour). Evaluating is only a check: REM
301
+ * itself runs on its own daily schedule and volume rule in src/sidecar/rem-trigger.ts.
302
+ */
303
+ declare const REM_TRIGGER_CHECK_INTERVAL_MS = 36e5;
304
+ /** Embedder LRU cache max entries */
305
+ declare const CACHE_SIZE = 256;
306
+ /** Embedder LRU cache TTL in milliseconds (30 minutes) */
307
+ declare const CACHE_TTL_MS = 18e5;
308
+ /** Kill switch file check interval in milliseconds */
309
+ declare const KILL_SWITCH_CACHE_TTL_MS = 100;
310
+ /** Cost estimate cache TTL in milliseconds */
311
+ declare const COST_ESTIMATE_CACHE_TTL_MS = 5e3;
312
+ /** Max sessions tracked in LRU map */
313
+ declare const MAX_TRACKED_SESSIONS = 100;
314
+ /** Max recall history entries per session */
315
+ declare const MAX_SESSION_RECALL_ENTRIES = 200;
316
+ /** Default number of recent messages to read from a session file */
317
+ declare const DEFAULT_SESSION_MESSAGE_COUNT = 15;
318
+ /** Chunk size for reading last JSON line from session files */
319
+ declare const LAST_JSON_LINE_CHUNK_BYTES = 4096;
320
+ /** Token budget per session-summary chunk sent to the model */
321
+ declare const SESSION_SUMMARY_CHUNK_TOKENS = 4096;
322
+ /**
323
+ * Total token budget for a session-summary transcript before chunking. Message count is bounded
324
+ * upstream but per-message text is not, so a handful of very large messages can otherwise produce
325
+ * an effectively unlimited number of chunks. The most-recent portion is kept (drop-oldest).
326
+ */
327
+ declare const SESSION_SUMMARY_MAX_INPUT_TOKENS = 32768;
328
+ /**
329
+ * Hard cap on sequential model calls in one reset-time session-summary capture. Backstops the input
330
+ * budget so a single capture can never run indefinitely even if the pre-chunk budget has a gap. At
331
+ * the default 30s per-chunk timeout this bounds a capture to roughly SESSION_SUMMARY_MAX_CHUNKS × 30s.
332
+ */
333
+ declare const SESSION_SUMMARY_MAX_CHUNKS = 8;
334
+ /** Transcript budget shared by an atomic window and its preceding context. */
335
+ declare const ATOMIC_EXTRACTION_MAX_INPUT_TOKENS = 4096;
336
+ declare const ATOMIC_ENRICHMENT_OUTPUT_TOKEN_BUDGET = 1400;
337
+ /**
338
+ * Output cap of one capture call. The capture reply lists every claim and then every fact with
339
+ * its quote, roughly 70 tokens per fact; at 4,096 a 35-turn session replayed as one turn hit the
340
+ * cap and lost the whole window (43 of 272 LoCoMo sessions, measured 2026-09-13). A window is
341
+ * split by turns when a reply truncates, so a single long turn (a pasted document, a replayed
342
+ * session) has only this cap between it and total loss. Sized from the budget, not the failure:
343
+ * the prompt (skill, calendar reference, response schema, dictionaries) is about 10K tokens, the
344
+ * transcript at most ATOMIC_EXTRACTION_MAX_INPUT_TOKENS, and the model serves a 64K context, so
345
+ * 16,384 keeps the whole call near 30K; the longest LoCoMo session (40 messages, ~100 facts)
346
+ * needs about 10K, which 8,192 only just covered.
347
+ */
348
+ declare const ATOMIC_CAPTURE_OUTPUT_TOKEN_BUDGET = 16384;
349
+ /**
350
+ * Wall time one capture call is given. The generic client timeout is what an installation sets
351
+ * for short judgments (30s by default, 60s on the LoCoMo VM) and does not know this call's output
352
+ * budget, so raising the budget silently made the call unfinishable: measured 2026-09-20, four
353
+ * sessions produced `LlmClientTerminalError category=timeout` at 60s after 105-130s of work and
354
+ * stored nothing. Sized from the budget at the extraction model's measured ~60 output tokens per
355
+ * second, with the same headroom the budget carries.
356
+ */
357
+ declare const ATOMIC_CAPTURE_TIMEOUT_MS = 3e5;
358
+ /** Minimum text length for CJK content to be captured */
359
+ declare const CAPTURE_MIN_LENGTH_CJK = 4;
360
+ /** Minimum text length for non-CJK content to be captured */
361
+ declare const CAPTURE_MIN_LENGTH_STANDARD = 10;
362
+ /** Maximum character length of auto-recall query before truncation */
363
+ declare const DEFAULT_AUTO_RECALL_MAX_QUERY_LENGTH = 2e3;
364
+ /** Maximum emoji count before content is rejected as noise */
365
+ declare const CAPTURE_MAX_EMOJI_COUNT = 3;
366
+ /** Minimum trimmed text length before content is classified as noise */
367
+ declare const NOISE_MIN_TEXT_LENGTH = 5;
368
+ /**
369
+ * Whether ambient-learning requires a text to match the `MEMORY_TRIGGERS` regex
370
+ * whitelist (e.g. `i prefer`, `my X is Y`, `we decided`, `remember`, ...).
371
+ *
372
+ * When `true`, texts lacking any trigger keyword are dropped — high precision,
373
+ * low recall. The bench corpus exposes the cost: teach turns like
374
+ * "My team lead at Anthropic is Maya Patel" (fails `my\s+\w+\s+is` — 4 words)
375
+ * "My go-to coffee is an oat milk latte" (fails — "go-to" has hyphen)
376
+ * "My teammates on Glacier are Jin ..." (fails — "are" not "is")
377
+ * were silently dropped, contributing 5 of 7 missing probes at 53%.
378
+ *
379
+ * When `false`, only length / noise / prompt-injection filters apply.
380
+ * Content-hash dedup in the store keeps volume bounded.
381
+ *
382
+ * Bench history:
383
+ * - true → 53% (post-runtime-fix baseline).
384
+ * - false → TBD (under evaluation 2026-04-17).
385
+ */
386
+ declare const AMBIENT_LEARNING_REQUIRE_TRIGGER_MATCH: boolean;
387
+ /**
388
+ * Top-K memories injected into the agent's prepend context at
389
+ * `before_agent_start`. Higher values expose more facts but increase
390
+ * prompt size + reranker workload.
391
+ *
392
+ * Bench history (LoCoMo mid, 50 rows, isolated sessions, 2026-04-22):
393
+ * - 5 → 52% (original default) — too many R3 refusals on specific-date/object
394
+ * queries because the answer memory wasn't ranked in the top 5.
395
+ * - 15 → 66% (+14pp) — opens the budget for list/count/temporal queries.
396
+ * Peak score; the remaining failures are memories ranked beyond 15 or
397
+ * wrong-content retrievals (architectural, not budget).
398
+ * - 25 → 64% (−2pp vs 15) — wider top-k dilutes with noise; agent surfaces
399
+ * adjacent-but-wrong memories.
400
+ *
401
+ * 2026-04-27 (commit 6a3ab60): raised to 20 — the Round-B chunked retrieval
402
+ * pipeline tightened candidate quality enough that the K=15→20 dilution risk
403
+ * noted above no longer dominated, and the wider budget caught list/count/
404
+ * temporal queries whose answer ranked 16-20 on conv0.
405
+ *
406
+ * 2026-07-02: re-tightened to 10 after the RETRIEVAL_CHUNK_PROFILE migration
407
+ * (target 384→512, max 448→1536) ballooned per-question prompts to ~123k
408
+ * chars and the score fell to 58%. That large-chunk profile was itself
409
+ * reverted the next day (`RETRIEVAL_STORAGE_CHUNK_PROFILE` back to
410
+ * 256/384/448/32, validated 86% on 2026-07-03) — but this constant was never
411
+ * reverted alongside it, leaving it stuck compensating for a regression that
412
+ * no longer exists.
413
+ *
414
+ * 2026-07-05: reverted to 20 to match. The shipped default must equal what
415
+ * the eval harness actually validates (`run-eval.sh` pins `recallTopK: 20`;
416
+ * the 86% run above used it) — production and eval must not diverge.
417
+ */
418
+ declare const AUTO_RECALL_INJECTION_TOP_K = 20;
419
+ /**
420
+ * Lean recall top-K — the lower-cost alternative surfaced in onboarding copy.
421
+ * Pre-512-geometry history (K=15 lean vs K=20 default, LoCoMo conv0 74-fact
422
+ * corpus, 4-run avg ±0.88pp): 86.25% correctness, ~9.3M prompt tokens /
423
+ * 400 QAs, ~25% cheaper than the then-default K=20.
424
+ *
425
+ * 2026-07-02: rescaled 15 → 8 alongside the default's 20 → 10 for a
426
+ * large-chunk profile that was itself reverted the next day. 2026-07-05:
427
+ * reverted to 15 alongside AUTO_RECALL_INJECTION_TOP_K's 10 → 20 revert,
428
+ * restoring the original ~0.75 lean:default ratio.
429
+ *
430
+ * This constant is the source of truth for the "Lean N" token in
431
+ * `openclaw.plugin.json` uiHints and the Path A install nudge.
432
+ * The plugin configuration test
433
+ * pins all four surfaces to this constant.
434
+ */
435
+ declare const AUTO_RECALL_LEAN_TOP_K = 15;
436
+ /** Default number of recent messages used for reflection input */
437
+ declare const DEFAULT_REFLECTION_MESSAGE_COUNT = 120;
438
+ /** Maximum input characters for reflection prompt */
439
+ declare const DEFAULT_REFLECTION_MAX_INPUT_CHARS = 24e3;
440
+ /** Timeout for individual reflection LLM calls in milliseconds */
441
+ declare const DEFAULT_REFLECTION_TIMEOUT_MS = 2e4;
442
+ /** Maximum error reminder entries included in reflection prompt */
443
+ declare const DEFAULT_REFLECTION_ERROR_REMINDER_MAX_ENTRIES = 3;
444
+ /** Session TTL in reflection tracking map (30 minutes) */
445
+ declare const DEFAULT_REFLECTION_SESSION_TTL_MS: number;
446
+ /** Maximum sessions tracked in reflection state */
447
+ declare const DEFAULT_REFLECTION_MAX_TRACKED_SESSIONS = 200;
448
+ /** Maximum chars scanned for error signals in conversation */
449
+ declare const DEFAULT_REFLECTION_ERROR_SCAN_MAX_CHARS = 8e3;
450
+ /** Maximum invariant entries extracted from a single reflection */
451
+ declare const REFLECTION_MAX_INVARIANTS = 8;
452
+ /** Maximum derived delta entries extracted from a single reflection */
453
+ declare const REFLECTION_MAX_DERIVED = 10;
454
+ /** Cosine similarity threshold above which a reflection is considered duplicate */
455
+ declare const REFLECTION_DEDUP_THRESHOLD = .97;
456
+ /** Minimum score for dedup similarity search (low to catch near-dupes) */
457
+ declare const REFLECTION_DEDUP_MIN_SCORE = .1;
458
+ /** Importance score assigned to stored reflection entries */
459
+ declare const REFLECTION_IMPORTANCE = .75;
460
+ /** Maximum filename collision retries for reflection FS output */
461
+ declare const REFLECTION_MAX_FILENAME_ATTEMPTS = 10;
462
+ /** Cache TTL for loaded reflection slices in milliseconds */
463
+ declare const REFLECTION_SLICE_CACHE_TTL_MS = 15e3;
464
+ /** Maximum age for derived deltas to be included in context (2 hours) */
465
+ declare const REFLECTION_DERIVED_MAX_AGE_MS = 72e5;
466
+ /**
467
+ * Minimum cosine score for `handleProfileMerge` to fire an unconditional merge
468
+ * on an identity row. NO dedup LLM gate runs after this — the threshold is
469
+ * the only filter — so it must be tight enough that "plausibly related"
470
+ * identity facts do not get merged together. Matched to the compaction
471
+ * clustering bar.
472
+ */
473
+ declare const PROFILE_MERGE_THRESHOLD = .88;
474
+ declare const RETRIEVAL_STORAGE_CHUNK_PROFILE: {
475
+ readonly minTokens: number;
476
+ readonly targetTokens: number;
477
+ readonly maxTokens: number;
478
+ readonly overlapTokens: number;
479
+ };
480
+ /** Minimum tokens per chunk before merge (mirrors RETRIEVAL_STORAGE_CHUNK_PROFILE). */
481
+ declare const CHUNK_MIN_TOKENS: typeof RETRIEVAL_STORAGE_CHUNK_PROFILE.minTokens;
482
+ /** Target tokens per chunk (mirrors RETRIEVAL_STORAGE_CHUNK_PROFILE). */
483
+ declare const CHUNK_TARGET_TOKENS: typeof RETRIEVAL_STORAGE_CHUNK_PROFILE.targetTokens;
484
+ /** Max tokens per chunk before split (mirrors RETRIEVAL_STORAGE_CHUNK_PROFILE). */
485
+ declare const CHUNK_MAX_TOKENS: typeof RETRIEVAL_STORAGE_CHUNK_PROFILE.maxTokens;
486
+ /** Overlap tokens between adjacent chunks (mirrors RETRIEVAL_STORAGE_CHUNK_PROFILE). */
487
+ declare const CHUNK_OVERLAP_TOKENS: typeof RETRIEVAL_STORAGE_CHUNK_PROFILE.overlapTokens;
488
+ /** Tokenizer mode used by the chunker (mirrors DEFAULT_CHUNK_CONFIG.tokenizerMode). */
489
+ declare const CHUNK_TOKENIZER_MODE: typeof DEFAULT_CHUNK_CONFIG.tokenizerMode;
490
+ /**
491
+ * Diagnostic threshold for intra-memory chunk cosine similarity (PRD §8.1).
492
+ * Pairs above this score are flagged as redundant during eval / introspection.
493
+ */
494
+ declare const INTRA_MEMORY_COSINE_THRESHOLD = .92;
495
+ /** Alias for VECTOR_DIMENSION_DEFAULT — the embedder output dimension. */
496
+ declare const EMBEDDER_DIM: typeof VECTOR_DIMENSION_DEFAULT;
497
+ /** Default embedder provider id stamped into chunk provenance. */
498
+ declare const EMBEDDER_PROVIDER_DEFAULT: "local-onnx";
499
+ /**
500
+ * Default embedder model id stamped into chunk provenance.
501
+ *
502
+ * Codex 2026-04-30 (batch-C C1): the previous hard-coded
503
+ * `qwen3-embedding-4b@1024` did not match the actual local default
504
+ * (`LOCAL_EMBEDDING_MODEL`, the bundled local embedding model), which would
505
+ * mislabel every default-provider chunk in eval traces. Tracking the
506
+ * embedder package's constant keeps provenance honest by construction.
507
+ */
508
+ declare const EMBEDDER_MODEL_DEFAULT: typeof LOCAL_EMBEDDING_MODEL;
509
+ /** SQL window cap on chunks per parent memory (prevents parent flooding). */
510
+ declare const MAX_CHUNKS_PER_PARENT = 16;
511
+ /** Per-hit bonus for repeated chunk hits inside one parent. */
512
+ declare const MULTI_HIT_BONUS_PER_HIT: typeof DEFAULT_AGGREGATION_CONFIG.multiHitBonusPerHit;
513
+ /** Cap on the cumulative multi-hit bonus per parent. */
514
+ declare const MULTI_HIT_BONUS_CAP: typeof DEFAULT_AGGREGATION_CONFIG.multiHitBonusCap;
515
+ /** Per-pair bonus for adjacent chunk hits within one parent. */
516
+ declare const ADJACENCY_BONUS_PER_PAIR: typeof DEFAULT_AGGREGATION_CONFIG.adjacencyBonusPerPair;
517
+ /** Cap on the cumulative adjacency bonus per parent. */
518
+ declare const ADJACENCY_BONUS_CAP: typeof DEFAULT_AGGREGATION_CONFIG.adjacencyBonusCap;
519
+ /** Invariant: bonusTotalInvariant >= MULTI_HIT_BONUS_CAP + ADJACENCY_BONUS_CAP. */
520
+ declare const BONUS_TOTAL_INVARIANT: typeof DEFAULT_AGGREGATION_CONFIG.bonusTotalInvariant;
521
+ /**
522
+ * Number of preceding chunks pulled into a snippet window.
523
+ *
524
+ * Override (not the package default) — LoCoMo eval showed multi-fact
525
+ * questions that span 4+ messages were partially answered when the window
526
+ * was 1 (e.g. "what events has Caroline done to help children" landed on
527
+ * mentorship but missed the school-speech chunk two messages away). Bumped
528
+ * to 2 paired with the head-extract metadata-preserve fix (2026-05-01).
529
+ * A later LoCoMo `3/3` trial improved mid-50 but regressed full conv0 by
530
+ * adding nearby distractors, so the stable default remains `2/2`.
531
+ */
532
+ declare const SNIPPET_NEIGHBOR_BEFORE = 2;
533
+ /** Number of following chunks pulled into a snippet window. See above. */
534
+ declare const SNIPPET_NEIGHBOR_AFTER = 2;
535
+ /** When false, retrieval traces are not written. Eval harness flips this on. */
536
+ declare const EVAL_TRACE_ENABLED: boolean;
537
+ /** Filename for the per-eval-run config snapshot. */
538
+ declare const EVAL_CONFIG_SNAPSHOT_FILENAME: "config-snapshot.json";
539
+ /** Filename for per-QA retrieval traces emitted during eval runs. */
540
+ declare const EVAL_QA_TRACES_FILENAME: "qa_traces.jsonl";
541
+ /** Multiplicative penalty applied to unreturned candidates after rerank. */
542
+ declare const LIGHTWEIGHT_RERANK_PENALTY = .8;
543
+ /** Maximum tokens kept in a sanitized FTS5 MATCH expression. */
544
+ declare const FTS_QUERY_TOKEN_CAP = 50;
545
+ type RecallLifecycleConfigShape = {
546
+ retentionScorer: boolean;
547
+ tierPromoter: boolean;
548
+ autoRecallAccessTracking: boolean;
549
+ traceEnabled: boolean;
550
+ tierFloorMode: "bare" | "withFloor";
551
+ tierPromotionTopK: number;
552
+ accessRateLimitMs: number;
553
+ accessCountCeiling: number;
554
+ };
555
+ /**
556
+ * Zod schema for the `recallLifecycle` config block. The whole block defaults
557
+ * to `{}` so existing configs without it continue to parse and behave
558
+ * bit-for-bit identically to the pre-Phase-0 baseline.
559
+ *
560
+ * Spec: openspec/changes/mem-lifecycle/specs/config/spec.md.
561
+ */
562
+ declare const recallLifecycleSchema: z.ZodType<RecallLifecycleConfigShape, unknown>;
563
+ /** Inferred config shape for the `recallLifecycle` block. */
564
+ type RecallLifecycleConfig = z.infer<typeof recallLifecycleSchema>;
565
+ /**
566
+ * Resolved default `recallLifecycle` config. Use in code paths that need a
567
+ * literal default object instead of re-parsing the schema each time.
568
+ */
569
+ declare const DEFAULT_RECALL_LIFECYCLE: RecallLifecycleConfig;
570
+ //#endregion
571
+ export { DEFAULT_VECTOR_WEIGHT as $, REFLECTION_MAX_FILENAME_ATTEMPTS as $t, DEFAULT_BM25_WEIGHT as A, MAX_RECALLED_TODOS as At, DEFAULT_REFLECTION_ERROR_SCAN_MAX_CHARS as B, NOISE_MIN_TEXT_LENGTH as Bt, CHUNK_MAX_TOKENS as C, experimentCandidatePoolOverride as Cn, MAINTENANCE_TICK_MS as Ct, CHUNK_TOKENIZER_MODE as D, MAX_CHUNKS_PER_PARENT as Dt, CHUNK_TARGET_TOKENS as E, MAX_CANDIDATE_POOL_SIZE as Et, DEFAULT_MAX_LINES_PER_CHUNK as F, MEMORY_SHUTDOWN_TIMEOUT_MS as Ft, DEFAULT_REFLECTION_TIMEOUT_MS as G, RECENCY_HALF_LIFE_DAYS as Gt, DEFAULT_REFLECTION_MAX_TRACKED_SESSIONS as H, PLUGIN_VERSION as Ht, DEFAULT_MIN_SCORE as I, MIN_RECALL_TOKEN_BUDGET as It, DEFAULT_RERANK_TIMEOUT_MS as J, REFLECTION_DEDUP_MIN_SCORE as Jt, DEFAULT_RERANK_BATCH_CONCURRENCY as K, RECENCY_WEIGHT as Kt, DEFAULT_RECALL_LIFECYCLE as L, MMR_LAMBDA as Lt, DEFAULT_IMPORTANCE as M, MAX_RECALL_TOOL_CANDIDATES as Mt, DEFAULT_LIST_LIMIT as N, MAX_SESSION_RECALL_ENTRIES as Nt, COST_ESTIMATE_CACHE_TTL_MS as O, MAX_CHUNK_FETCH_LIMIT as Ot, DEFAULT_MAX_CONTEXT_TOKENS as P, MAX_TRACKED_SESSIONS as Pt, DEFAULT_TOP_K as Q, REFLECTION_MAX_DERIVED as Qt, DEFAULT_RECALL_TOKEN_BUDGET as R, MULTI_HIT_BONUS_CAP as Rt, CHUNKING_VERSION as S, VECTOR_DIMENSION_DEFAULT as Sn, LIGHTWEIGHT_RERANK_PENALTY as St, CHUNK_OVERLAP_TOKENS as T, recallLifecycleSchema as Tn, MAX_AGGREGATION_ROWS as Tt, DEFAULT_REFLECTION_MESSAGE_COUNT as U, PRECISION_RECALL_POOL_SIZE_FACTOR as Ut, DEFAULT_REFLECTION_MAX_INPUT_CHARS as V, PLANNER_STATISTICS_INTERVAL_MS as Vt, DEFAULT_REFLECTION_SESSION_TTL_MS as W, PROFILE_MERGE_THRESHOLD as Wt, DEFAULT_SESSION_MESSAGE_COUNT as X, REFLECTION_DERIVED_MAX_AGE_MS as Xt, DEFAULT_SCOPE as Y, REFLECTION_DEDUP_THRESHOLD as Yt, DEFAULT_TEI_RERANK_MAX_CANDIDATES as Z, REFLECTION_IMPORTANCE as Zt, CACHE_TTL_MS as _, TEMPORAL_WEIGHTING_DEFAULT as _n, KILL_SWITCH_CACHE_TTL_MS as _t, ARRIVAL_RETIREMENT_JUDGED_CANDIDATE_CAP as a, RERANK_PROMPT_TEMPLATE_TOKENS as an, EVAL_QA_TRACES_FILENAME as at, CAPTURE_MIN_LENGTH_CJK as b, USAGE_EVENT_RETENTION_INTERVAL_MS as bn, LIGHTWEIGHT_COSINE_WEIGHT as bt, ATOMIC_ENRICHMENT_OUTPUT_TOKEN_BUDGET as c, SESSION_SUMMARY_CHUNK_TOKENS as cn, FORGET_QUERY_MIN_SCORE as ct, AUTO_RECALL_LEAN_TOP_K as d, SNIPPET_NEIGHBOR_AFTER as dn, HEAD_EXTRACT_MIN_CONTENT_TOKENS as dt, REFLECTION_MAX_INVARIANTS as en, DELETE_BATCH_SIZE as et, BACKUP_INTERVAL_MS as f, SNIPPET_NEIGHBOR_BEFORE as fn, HEAD_EXTRACT_OVERLAP_DROP_RATIO as ft, CACHE_SIZE as g, TEMPORAL_DYNAMIC_HALF_LIFE_DIVISOR as gn, INTRA_MEMORY_COSINE_THRESHOLD as gt, BONUS_TOTAL_INVARIANT as h, SNO_OBSERVE_FLUSH_TIMEOUT_MS as hn, INTEGRITY_CHECK_INTERVAL_MS as ht, ARRIVAL_RETIREMENT_CANDIDATE_CAP as i, RERANK_BLEND_VECTOR as in, EVAL_CONFIG_SNAPSHOT_FILENAME as it, DEFAULT_HARD_MIN_SCORE as j, MAX_RECALLED_TODO_TOKENS as jt, DEFAULT_AUTO_RECALL_MAX_QUERY_LENGTH as k, MAX_LIST_LIMIT as kt, ATOMIC_EXTRACTION_MAX_INPUT_TOKENS as l, SESSION_SUMMARY_MAX_CHUNKS as ln, FTS_MERGE_INTERVAL_MS as lt, BACKUP_RETENTION_COUNT as m, SNO_OBSERVE_DEFAULT_BASE_URL as mn, IMPORTANCE_WEIGHT_BASE as mt, ADJACENCY_BONUS_PER_PAIR as n, REM_TRIGGER_CHECK_INTERVAL_MS as nn, EMBEDDER_MODEL_DEFAULT as nt, ATOMIC_CAPTURE_OUTPUT_TOKEN_BUDGET as o, RETRIEVAL_STORAGE_CHUNK_PROFILE as on, EVAL_TRACE_ENABLED as ot, BACKUP_MIN_FREE_DISK_RATIO as p, SNO_OBSERVE_DEFAULT_AGENT_ID as pn, HEAD_EXTRACT_TOKEN_BUDGET as pt, DEFAULT_RERANK_MODEL as q, RECENCY_WEIGHT_MAX as qt, AMBIENT_LEARNING_REQUIRE_TRIGGER_MATCH as r, RERANK_BLEND_CROSS as rn, EMBEDDER_PROVIDER_DEFAULT as rt, ATOMIC_CAPTURE_TIMEOUT_MS as s, RecallLifecycleConfig as sn, FORGET_QUERY_DEFAULT_LIMIT as st, ADJACENCY_BONUS_CAP as t, REFLECTION_SLICE_CACHE_TTL_MS as tn, EMBEDDER_DIM as tt, AUTO_RECALL_INJECTION_TOP_K as u, SESSION_SUMMARY_MAX_INPUT_TOKENS as un, FTS_QUERY_TOKEN_CAP as ut, CANDIDATE_POOL_SIZE as v, TIME_DECAY_FLOOR as vn, LAST_JSON_LINE_CHUNK_BYTES as vt, CHUNK_MIN_TOKENS as w, experimentMmrDisabled as wn, MAX_AGGREGATION_RESULT_TOKENS as wt, CAPTURE_MIN_LENGTH_STANDARD as x, USAGE_OUTBOX_INTERVAL_MS as xn, LIGHTWEIGHT_FUSION_WEIGHT as xt, CAPTURE_MAX_EMOJI_COUNT as y, TIME_DECAY_HALF_LIFE_DAYS as yn, LENGTH_NORM_ANCHOR as yt, DEFAULT_REFLECTION_ERROR_REMINDER_MAX_ENTRIES as z, MULTI_HIT_BONUS_PER_HIT as zt };