@remnic/core 9.3.734 → 9.3.735

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 (258) hide show
  1. package/dist/access-boundary.d.ts +8 -6
  2. package/dist/access-boundary.js +9 -9
  3. package/dist/access-cli.js +24 -24
  4. package/dist/access-http.d.ts +8 -6
  5. package/dist/access-http.js +14 -14
  6. package/dist/access-mcp.d.ts +8 -6
  7. package/dist/access-mcp.js +13 -13
  8. package/dist/access-operations-batch.js +11 -11
  9. package/dist/access-operations.d.ts +8 -6
  10. package/dist/access-operations.js +12 -12
  11. package/dist/access-schema.d.ts +4 -4
  12. package/dist/{access-service-rjFfmfKB.d.ts → access-service-CVx7mmvK.d.ts} +3 -3
  13. package/dist/access-service.d.ts +8 -6
  14. package/dist/access-service.js +8 -8
  15. package/dist/access-surface-catalog.d.ts +8 -6
  16. package/dist/action-confidence.d.ts +1 -1
  17. package/dist/active-memory-bridge.d.ts +1 -1
  18. package/dist/active-memory-bridge.js +3 -3
  19. package/dist/active-recall.d.ts +1 -1
  20. package/dist/behavior-learner.d.ts +1 -1
  21. package/dist/behavior-signals.d.ts +1 -1
  22. package/dist/bootstrap.d.ts +7 -5
  23. package/dist/briefing.d.ts +1 -1
  24. package/dist/buffer-surprise-report.d.ts +1 -1
  25. package/dist/buffer.d.ts +1 -1
  26. package/dist/calibration.d.ts +1 -1
  27. package/dist/capabilities.d.ts +101 -2
  28. package/dist/capabilities.js +13 -3
  29. package/dist/{catalog-DHYXzM4-.d.ts → catalog-BVhDEUhT.d.ts} +1 -1
  30. package/dist/causal-behavior.d.ts +1 -1
  31. package/dist/causal-consolidation.d.ts +1 -1
  32. package/dist/causal-trajectory-graph.d.ts +1 -1
  33. package/dist/{chunk-IWMGBNXY.js → chunk-2T2N7ISV.js} +3 -3
  34. package/dist/{chunk-K7PAILHO.js → chunk-5BOQNB2K.js} +3 -3
  35. package/dist/{chunk-Q5LGXWNG.js → chunk-AAIHDIMD.js} +6 -6
  36. package/dist/{chunk-WHQ2JB35.js → chunk-AB2E5DCN.js} +2 -2
  37. package/dist/{chunk-FAGERSH2.js → chunk-AE7NTZ75.js} +3 -3
  38. package/dist/{chunk-V5OVSGB6.js → chunk-AESC5OQJ.js} +2 -2
  39. package/dist/{chunk-7FPJFCXL.js → chunk-BXPG5AVX.js} +4 -4
  40. package/dist/{chunk-UH3NYOHN.js → chunk-CHJIWG2H.js} +2 -2
  41. package/dist/{chunk-IDIXGGDN.js → chunk-E4LYJ7PY.js} +6 -6
  42. package/dist/{chunk-WTTVFSCO.js → chunk-FF36YNKY.js} +3 -3
  43. package/dist/{chunk-Z7J3OAPR.js → chunk-FLCYY5JX.js} +456 -398
  44. package/dist/chunk-FLCYY5JX.js.map +1 -0
  45. package/dist/{chunk-TJSQHO4Q.js → chunk-FLPKEMSO.js} +2 -2
  46. package/dist/{chunk-UF3N7IRP.js → chunk-G54IDCD3.js} +45 -41
  47. package/dist/chunk-G54IDCD3.js.map +1 -0
  48. package/dist/{chunk-UK6U5C3N.js → chunk-GB2FZOWB.js} +3 -3
  49. package/dist/{chunk-5OYHJIJN.js → chunk-GYICIICQ.js} +3 -3
  50. package/dist/{chunk-PEF2XOIV.js → chunk-HFXZIF3V.js} +3 -3
  51. package/dist/{chunk-PKO5NJ65.js → chunk-HLPYL6LC.js} +27 -24
  52. package/dist/chunk-HLPYL6LC.js.map +1 -0
  53. package/dist/{chunk-ET5HXSQL.js → chunk-IPI45Q4S.js} +2 -2
  54. package/dist/{chunk-2L5RTVMO.js → chunk-IX4L7E5G.js} +2 -2
  55. package/dist/{chunk-SYX73XD7.js → chunk-IXGXALRV.js} +10 -7
  56. package/dist/chunk-IXGXALRV.js.map +1 -0
  57. package/dist/{chunk-SHJGBAIW.js → chunk-JWDE7OVJ.js} +44 -2
  58. package/dist/{chunk-SHJGBAIW.js.map → chunk-JWDE7OVJ.js.map} +1 -1
  59. package/dist/{chunk-IZLTOS5L.js → chunk-K3Y2SJTN.js} +4 -4
  60. package/dist/{chunk-CILX2XW7.js → chunk-NDKW67ER.js} +2 -2
  61. package/dist/{chunk-54RCE5Z3.js → chunk-NNJKEAP2.js} +2 -2
  62. package/dist/{chunk-LV32K4OP.js → chunk-OYHYBHHI.js} +2 -2
  63. package/dist/{chunk-5DIKZKOD.js → chunk-P6VLG7KE.js} +2 -2
  64. package/dist/{chunk-T7CGPTFU.js → chunk-QNTLWH3T.js} +3 -3
  65. package/dist/{chunk-6U7TES2M.js → chunk-UO6MPN77.js} +13 -12
  66. package/dist/chunk-UO6MPN77.js.map +1 -0
  67. package/dist/{chunk-NDYQIN6C.js → chunk-VOEVVIP3.js} +3 -3
  68. package/dist/{chunk-3QETM5NG.js → chunk-ZBZ4XULO.js} +3 -3
  69. package/dist/{cli-XVpmSoQs.d.ts → cli-Cx5Mxwk7.d.ts} +3 -3
  70. package/dist/cli.d.ts +9 -7
  71. package/dist/cli.js +20 -20
  72. package/dist/compounding/engine.d.ts +1 -1
  73. package/dist/compounding/engine.js +2 -2
  74. package/dist/compounding/preference-consolidator.d.ts +1 -1
  75. package/dist/compression-optimizer.d.ts +1 -1
  76. package/dist/config.d.ts +1 -1
  77. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  78. package/dist/connectors/codex-materialize.d.ts +1 -1
  79. package/dist/connectors/index.d.ts +1 -1
  80. package/dist/consolidation-provenance-check.d.ts +1 -1
  81. package/dist/consolidation-undo.d.ts +1 -1
  82. package/dist/contradiction/index.d.ts +1 -1
  83. package/dist/contradiction/index.js +2 -2
  84. package/dist/{contradiction-scan-OUHMCUBT.js → contradiction-scan-2B4AE4TI.js} +3 -3
  85. package/dist/conversation-index/backend.d.ts +1 -1
  86. package/dist/conversation-index/chunker.d.ts +1 -1
  87. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  88. package/dist/conversation-index/indexer.d.ts +1 -1
  89. package/dist/conversation-index/search.d.ts +1 -1
  90. package/dist/day-summary.d.ts +1 -1
  91. package/dist/delinearize.d.ts +1 -1
  92. package/dist/direct-answer-wiring.d.ts +1 -1
  93. package/dist/direct-answer.d.ts +1 -1
  94. package/dist/embedding-fallback.d.ts +1 -1
  95. package/dist/embedding-fallback.js +2 -2
  96. package/dist/enrichment/index.d.ts +1 -1
  97. package/dist/entity-retrieval.d.ts +1 -1
  98. package/dist/entity-retrieval.js +2 -2
  99. package/dist/entity-schema.d.ts +1 -1
  100. package/dist/explicit-capture.d.ts +7 -5
  101. package/dist/explicit-capture.js +2 -2
  102. package/dist/extraction-faithfulness.d.ts +1 -1
  103. package/dist/extraction-judge-telemetry.d.ts +1 -1
  104. package/dist/extraction-judge-training.d.ts +1 -1
  105. package/dist/extraction-judge.d.ts +1 -1
  106. package/dist/extraction.d.ts +1 -1
  107. package/dist/extraction.js +3 -3
  108. package/dist/fallback-llm.d.ts +1 -1
  109. package/dist/{first-start-migration-W4U6XDKI.js → first-start-migration-2RQYDIZ7.js} +6 -5
  110. package/dist/first-start-migration-2RQYDIZ7.js.map +1 -0
  111. package/dist/graph-dashboard-diff.d.ts +1 -1
  112. package/dist/graph-dashboard-key.d.ts +1 -1
  113. package/dist/graph-dashboard-parser.d.ts +1 -1
  114. package/dist/graph-edge-reinforcement.d.ts +1 -1
  115. package/dist/graph-snapshot.d.ts +1 -1
  116. package/dist/graph.d.ts +1 -1
  117. package/dist/identity-continuity.d.ts +1 -1
  118. package/dist/importance.d.ts +1 -1
  119. package/dist/index.d.ts +9 -9
  120. package/dist/index.js +30 -30
  121. package/dist/intent.d.ts +1 -1
  122. package/dist/lcm/engine.d.ts +1 -1
  123. package/dist/lcm/index.d.ts +1 -1
  124. package/dist/lcm/tools.d.ts +1 -1
  125. package/dist/lifecycle.d.ts +1 -1
  126. package/dist/live-connectors-runner.d.ts +1 -1
  127. package/dist/local-llm.d.ts +1 -1
  128. package/dist/local-llm.js +2 -2
  129. package/dist/local-model-endpoint.d.ts +1 -1
  130. package/dist/maintenance/memory-governance.d.ts +1 -1
  131. package/dist/mcp-memory-inspector-app.d.ts +8 -6
  132. package/dist/memory-action-policy.d.ts +1 -1
  133. package/dist/memory-cache.d.ts +1 -1
  134. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  135. package/dist/memory-projection-store.d.ts +1 -1
  136. package/dist/memory-provenance.d.ts +1 -1
  137. package/dist/memory-worth-outcomes.d.ts +1 -1
  138. package/dist/models-json.d.ts +1 -1
  139. package/dist/namespaces/migrate.d.ts +2 -2
  140. package/dist/namespaces/migrate.js +6 -6
  141. package/dist/namespaces/principal.d.ts +1 -1
  142. package/dist/namespaces/principal.js +2 -2
  143. package/dist/namespaces/search.d.ts +1 -1
  144. package/dist/namespaces/search.js +4 -4
  145. package/dist/namespaces/storage.d.ts +2 -2
  146. package/dist/namespaces/storage.js +2 -2
  147. package/dist/native-knowledge.d.ts +1 -1
  148. package/dist/operator-toolkit.d.ts +1 -1
  149. package/dist/operator-toolkit.js +11 -11
  150. package/dist/orchestration/compression-guideline-coordinator.d.ts +1 -1
  151. package/dist/orchestration/compression-guideline-coordinator.js +2 -1
  152. package/dist/orchestration/maintenance.d.ts +2 -2
  153. package/dist/orchestration/maintenance.js +6 -6
  154. package/dist/{orchestrator-BXi-gadS.d.ts → orchestrator-oF0cceBX.d.ts} +80 -16
  155. package/dist/orchestrator.d.ts +7 -5
  156. package/dist/orchestrator.js +19 -19
  157. package/dist/patterns-cli.d.ts +1 -1
  158. package/dist/policy-runtime.d.ts +1 -1
  159. package/dist/provenance.d.ts +1 -1
  160. package/dist/qmd-recall-cache.d.ts +1 -1
  161. package/dist/qmd.d.ts +1 -1
  162. package/dist/recall-disclosure-escalation.d.ts +1 -1
  163. package/dist/recall-explain-renderer.d.ts +1 -1
  164. package/dist/recall-planner-llm.d.ts +1 -1
  165. package/dist/recall-state.d.ts +1 -1
  166. package/dist/recall-tag-filter.d.ts +1 -1
  167. package/dist/recall-xray-cli.d.ts +1 -1
  168. package/dist/recall-xray-renderer.d.ts +1 -1
  169. package/dist/recall-xray.d.ts +1 -1
  170. package/dist/resolve-auth-token.d.ts +1 -1
  171. package/dist/retrieval-agents.d.ts +1 -1
  172. package/dist/retrieval-tiers.d.ts +1 -1
  173. package/dist/routing/engine.d.ts +1 -1
  174. package/dist/routing/store.d.ts +1 -1
  175. package/dist/schemas.d.ts +24 -24
  176. package/dist/search/embed-helper.d.ts +1 -1
  177. package/dist/search/embed-helper.js +2 -2
  178. package/dist/search/factory.d.ts +1 -1
  179. package/dist/search/factory.js +3 -3
  180. package/dist/search/index.d.ts +1 -1
  181. package/dist/search/index.js +3 -3
  182. package/dist/search/lancedb-backend.d.ts +1 -1
  183. package/dist/search/meilisearch-backend.d.ts +1 -1
  184. package/dist/search/noop-backend.d.ts +1 -1
  185. package/dist/search/orama-backend.d.ts +1 -1
  186. package/dist/search/port.d.ts +1 -1
  187. package/dist/search/remote-backend.d.ts +1 -1
  188. package/dist/{semantic-consolidation-DeL5grLx.d.ts → semantic-consolidation-DKGbufYO.d.ts} +1 -1
  189. package/dist/semantic-consolidation.d.ts +2 -2
  190. package/dist/semantic-rule-verifier.d.ts +1 -1
  191. package/dist/session-observer-bands.d.ts +1 -1
  192. package/dist/session-observer-state.d.ts +1 -1
  193. package/dist/shared-context/manager.d.ts +3 -3
  194. package/dist/signal.d.ts +1 -1
  195. package/dist/storage.d.ts +1 -1
  196. package/dist/summarizer.d.ts +1 -1
  197. package/dist/summarizer.js +3 -3
  198. package/dist/summary-snapshot.d.ts +1 -1
  199. package/dist/temporal-supersession.d.ts +1 -1
  200. package/dist/temporal-validity.d.ts +1 -1
  201. package/dist/threading.d.ts +1 -1
  202. package/dist/tier-migration.d.ts +1 -1
  203. package/dist/tier-routing.d.ts +1 -1
  204. package/dist/{tier-stats-LSM35HZY.js → tier-stats-KPDIISG7.js} +6 -5
  205. package/dist/tier-stats-KPDIISG7.js.map +1 -0
  206. package/dist/topics.d.ts +1 -1
  207. package/dist/transcript.d.ts +1 -1
  208. package/dist/transfer/types.d.ts +42 -42
  209. package/dist/trust-score-stage.d.ts +1 -1
  210. package/dist/trust-score.d.ts +1 -1
  211. package/dist/{types-CpFz51Pv.d.ts → types-C7UCxpuO.d.ts} +1 -1
  212. package/dist/types.d.ts +1 -1
  213. package/dist/utility-runtime.d.ts +1 -1
  214. package/package.json +2 -2
  215. package/src/access-service.ts +20 -20
  216. package/src/capabilities.test.ts +197 -0
  217. package/src/capabilities.ts +206 -0
  218. package/src/cli/creation-ledger-commands.ts +2 -2
  219. package/src/cli/research-status-commands.ts +13 -13
  220. package/src/cli.ts +17 -17
  221. package/src/maintenance/first-start-migration.ts +3 -3
  222. package/src/maintenance/tier-stats.ts +3 -3
  223. package/src/operator-toolkit.ts +8 -8
  224. package/src/orchestration/compression-guideline-coordinator.ts +7 -6
  225. package/src/orchestration/lifecycle-policy-coordinator.ts +504 -0
  226. package/src/orchestrator.ts +28 -383
  227. package/dist/chunk-6U7TES2M.js.map +0 -1
  228. package/dist/chunk-PKO5NJ65.js.map +0 -1
  229. package/dist/chunk-SYX73XD7.js.map +0 -1
  230. package/dist/chunk-UF3N7IRP.js.map +0 -1
  231. package/dist/chunk-Z7J3OAPR.js.map +0 -1
  232. package/dist/first-start-migration-W4U6XDKI.js.map +0 -1
  233. package/dist/tier-stats-LSM35HZY.js.map +0 -1
  234. /package/dist/{chunk-IWMGBNXY.js.map → chunk-2T2N7ISV.js.map} +0 -0
  235. /package/dist/{chunk-K7PAILHO.js.map → chunk-5BOQNB2K.js.map} +0 -0
  236. /package/dist/{chunk-Q5LGXWNG.js.map → chunk-AAIHDIMD.js.map} +0 -0
  237. /package/dist/{chunk-WHQ2JB35.js.map → chunk-AB2E5DCN.js.map} +0 -0
  238. /package/dist/{chunk-FAGERSH2.js.map → chunk-AE7NTZ75.js.map} +0 -0
  239. /package/dist/{chunk-V5OVSGB6.js.map → chunk-AESC5OQJ.js.map} +0 -0
  240. /package/dist/{chunk-7FPJFCXL.js.map → chunk-BXPG5AVX.js.map} +0 -0
  241. /package/dist/{chunk-UH3NYOHN.js.map → chunk-CHJIWG2H.js.map} +0 -0
  242. /package/dist/{chunk-IDIXGGDN.js.map → chunk-E4LYJ7PY.js.map} +0 -0
  243. /package/dist/{chunk-WTTVFSCO.js.map → chunk-FF36YNKY.js.map} +0 -0
  244. /package/dist/{chunk-TJSQHO4Q.js.map → chunk-FLPKEMSO.js.map} +0 -0
  245. /package/dist/{chunk-UK6U5C3N.js.map → chunk-GB2FZOWB.js.map} +0 -0
  246. /package/dist/{chunk-5OYHJIJN.js.map → chunk-GYICIICQ.js.map} +0 -0
  247. /package/dist/{chunk-PEF2XOIV.js.map → chunk-HFXZIF3V.js.map} +0 -0
  248. /package/dist/{chunk-ET5HXSQL.js.map → chunk-IPI45Q4S.js.map} +0 -0
  249. /package/dist/{chunk-2L5RTVMO.js.map → chunk-IX4L7E5G.js.map} +0 -0
  250. /package/dist/{chunk-IZLTOS5L.js.map → chunk-K3Y2SJTN.js.map} +0 -0
  251. /package/dist/{chunk-CILX2XW7.js.map → chunk-NDKW67ER.js.map} +0 -0
  252. /package/dist/{chunk-54RCE5Z3.js.map → chunk-NNJKEAP2.js.map} +0 -0
  253. /package/dist/{chunk-LV32K4OP.js.map → chunk-OYHYBHHI.js.map} +0 -0
  254. /package/dist/{chunk-5DIKZKOD.js.map → chunk-P6VLG7KE.js.map} +0 -0
  255. /package/dist/{chunk-T7CGPTFU.js.map → chunk-QNTLWH3T.js.map} +0 -0
  256. /package/dist/{chunk-NDYQIN6C.js.map → chunk-VOEVVIP3.js.map} +0 -0
  257. /package/dist/{chunk-3QETM5NG.js.map → chunk-ZBZ4XULO.js.map} +0 -0
  258. /package/dist/{contradiction-scan-OUHMCUBT.js.map → contradiction-scan-2B4AE4TI.js.map} +0 -0
@@ -102,6 +102,7 @@ import { TierMigrationCoordinator } from "./orchestration/tier-migration-coordin
102
102
  import { ExtractionQueueCoordinator } from "./orchestration/extraction-queue-coordinator.js";
103
103
  import { CompressionGuidelineCoordinator } from "./orchestration/compression-guideline-coordinator.js";
104
104
  import { SemanticConsolidationCoordinator } from "./orchestration/semantic-consolidation-coordinator.js";
105
+ import { LifecyclePolicyCoordinator } from "./orchestration/lifecycle-policy-coordinator.js";
105
106
  import {
106
107
  runLiveConnectorsOnce,
107
108
  type LiveConnectorsRunSummary,
@@ -281,7 +282,7 @@ import {
281
282
  resolveQmdCapabilities,
282
283
  resolveIdentityContinuityCapabilities,
283
284
  resolveLocalLlmCapabilities,
284
- } from "./capabilities.js";
285
+ resolveSecurityCapabilities, resolveEvalCapabilities, resolveUtilityLearningCapabilities, resolveObjectiveStateCapabilities, resolveCompressionCapabilities} from "./capabilities.js";
285
286
  import { DEFAULT_TAXONOMY } from "./taxonomy/index.js";
286
287
  import {
287
288
  searchHarmonicRetrieval,
@@ -1902,6 +1903,7 @@ export class Orchestrator {
1902
1903
  readonly tierMigrationCoordinator: TierMigrationCoordinator;
1903
1904
  readonly compressionGuidelineCoordinator: CompressionGuidelineCoordinator;
1904
1905
  readonly semanticConsolidationCoordinator: SemanticConsolidationCoordinator;
1906
+ readonly lifecyclePolicyCoordinator: LifecyclePolicyCoordinator;
1905
1907
  /**
1906
1908
  * In-memory X-ray snapshot from the most recent `recall()` call that
1907
1909
  * was invoked with `xrayCapture: true` (issue #570 PR 1). Scope is
@@ -3098,6 +3100,16 @@ export class Orchestrator {
3098
3100
  config.gatewayConfig,
3099
3101
  this.modelRegistry,
3100
3102
  );
3103
+ this.lifecyclePolicyCoordinator = new LifecyclePolicyCoordinator({
3104
+ config,
3105
+ getStorage: () => this.storage,
3106
+ extraction: this.extraction,
3107
+ embeddingFallback: this.embeddingFallback,
3108
+ getEffectiveLifecycleThresholds: () => this.effectiveLifecycleThresholds(),
3109
+ removeContentHashForMemory: (targetStorage, memory, context) =>
3110
+ this.removeContentHashForMemory(targetStorage, memory, context),
3111
+ saveContentHashIndexes: () => this.saveContentHashIndexes(),
3112
+ });
3101
3113
  this.threading = new ThreadingManager(
3102
3114
  path.join(config.memoryDir, "threads"),
3103
3115
  config.threadingGapMinutes,
@@ -3510,8 +3522,8 @@ export class Orchestrator {
3510
3522
  this.runtimePolicyValues = await this.policyRuntime.loadRuntimeValues();
3511
3523
  this.utilityRuntimeValues = await loadUtilityRuntimeValues({
3512
3524
  memoryDir: this.config.memoryDir,
3513
- memoryUtilityLearningEnabled: this.config.memoryUtilityLearningEnabled,
3514
- promotionByOutcomeEnabled: this.config.promotionByOutcomeEnabled,
3525
+ memoryUtilityLearningEnabled: resolveUtilityLearningCapabilities(this.config).memoryUtilityLearning,
3526
+ promotionByOutcomeEnabled: resolveUtilityLearningCapabilities(this.config).promotionByOutcome,
3515
3527
  });
3516
3528
 
3517
3529
  // Initialize content-hash dedup index
@@ -4805,7 +4817,7 @@ export class Orchestrator {
4805
4817
  action: event.action,
4806
4818
  eligibility,
4807
4819
  options: {
4808
- actionsEnabled: this.config.contextCompressionActionsEnabled,
4820
+ actionsEnabled: resolveCompressionCapabilities(this.config).contextCompressionActions,
4809
4821
  maxCompressionTokensPerHour: this.config.maxCompressionTokensPerHour,
4810
4822
  },
4811
4823
  });
@@ -8305,11 +8317,11 @@ export class Orchestrator {
8305
8317
  const objectiveStatePromise = (async (): Promise<string | null> => {
8306
8318
  const t0 = Date.now();
8307
8319
  if (
8308
- !this.config.objectiveStateMemoryEnabled ||
8309
- !this.config.objectiveStateRecallEnabled ||
8320
+ !resolveObjectiveStateCapabilities(this.config).objectiveStateMemory ||
8321
+ !resolveObjectiveStateCapabilities(this.config).objectiveStateRecall ||
8310
8322
  !this.isRecallSectionEnabled(
8311
8323
  "objective-state",
8312
- this.config.objectiveStateRecallEnabled === true,
8324
+ resolveObjectiveStateCapabilities(this.config).objectiveStateRecall === true,
8313
8325
  )
8314
8326
  ) {
8315
8327
  recordRecallSectionMetric({
@@ -8562,11 +8574,11 @@ export class Orchestrator {
8562
8574
  const trustZonePromise = (async (): Promise<string | null> => {
8563
8575
  const t0 = Date.now();
8564
8576
  if (
8565
- !this.config.trustZonesEnabled ||
8566
- !this.config.trustZoneRecallEnabled ||
8577
+ !resolveSecurityCapabilities(this.config).trustZones ||
8578
+ !resolveSecurityCapabilities(this.config).trustZoneRecall ||
8567
8579
  !this.isRecallSectionEnabled(
8568
8580
  "trust-zones",
8569
- this.config.trustZoneRecallEnabled === true,
8581
+ resolveSecurityCapabilities(this.config).trustZoneRecall === true,
8570
8582
  )
8571
8583
  ) {
8572
8584
  recordRecallSectionMetric({
@@ -11735,7 +11747,7 @@ export class Orchestrator {
11735
11747
  if (
11736
11748
  this.isRecallSectionEnabled(
11737
11749
  "compression-guidelines",
11738
- this.config.compressionGuidelineLearningEnabled === true,
11750
+ resolveCompressionCapabilities(this.config).compressionGuidelineLearning === true,
11739
11751
  )
11740
11752
  ) {
11741
11753
  const compressionGuidelineSection =
@@ -17017,81 +17029,6 @@ export class Orchestrator {
17017
17029
  return this.compressionGuidelineCoordinator.buildCompressionGuidelineRecallSection();
17018
17030
  }
17019
17031
 
17020
- private actionOutcomePriorDelta(event: MemoryActionEvent): number {
17021
- if (event.outcome === "failed") return -0.3;
17022
- if (event.policyDecision === "deny") return -0.22;
17023
- if (event.policyDecision === "defer") return -0.14;
17024
- if (event.outcome === "skipped") return -0.1;
17025
-
17026
- if (event.outcome !== "applied") return 0;
17027
- switch (event.action) {
17028
- case "store_episode":
17029
- case "store_note":
17030
- case "update_note":
17031
- return 0.08;
17032
- case "create_artifact":
17033
- case "summarize_node":
17034
- case "link_graph":
17035
- return 0.04;
17036
- case "discard":
17037
- return -0.03;
17038
- default:
17039
- return 0;
17040
- }
17041
- }
17042
-
17043
- private async buildLifecycleActionPriors(
17044
- storage: StorageManager = this.storage,
17045
- ): Promise<Map<string, number>> {
17046
- const events = await storage.readMemoryActionEvents(1200);
17047
- if (events.length === 0) return new Map<string, number>();
17048
-
17049
- const nowMs = Date.now();
17050
- const windowMs = 14 * 24 * 60 * 60 * 1000;
17051
- const byMemory = new Map<
17052
- string,
17053
- Array<{ weightedDelta: number; weight: number }>
17054
- >();
17055
-
17056
- for (const event of events) {
17057
- if (
17058
- typeof event.memoryId !== "string" ||
17059
- event.memoryId.trim().length === 0
17060
- )
17061
- continue;
17062
- const ts = Date.parse(event.timestamp);
17063
- if (!Number.isFinite(ts)) continue;
17064
- const ageMs = nowMs - ts;
17065
- if (ageMs < 0 || ageMs > windowMs) continue;
17066
-
17067
- const delta = this.actionOutcomePriorDelta(event);
17068
- if (delta === 0) continue;
17069
-
17070
- const recencyWeight = Math.max(0.2, 1 - ageMs / windowMs);
17071
- const list = byMemory.get(event.memoryId) ?? [];
17072
- if (list.length >= 8) list.shift();
17073
- list.push({
17074
- weightedDelta: delta * recencyWeight,
17075
- weight: recencyWeight,
17076
- });
17077
- byMemory.set(event.memoryId, list);
17078
- }
17079
-
17080
- const out = new Map<string, number>();
17081
- for (const [memoryId, deltas] of byMemory.entries()) {
17082
- if (deltas.length === 0) continue;
17083
- const weightedSum = deltas.reduce(
17084
- (sum, item) => sum + item.weightedDelta,
17085
- 0,
17086
- );
17087
- const weightTotal = deltas.reduce((sum, item) => sum + item.weight, 0);
17088
- if (weightTotal <= 0) continue;
17089
- const score = weightedSum / weightTotal;
17090
- out.set(memoryId, Math.max(-0.25, Math.min(0.15, score)));
17091
- }
17092
- return out;
17093
- }
17094
-
17095
17032
  private async recordScheduledDreamsPhaseRun(
17096
17033
  phase: "lightSleep" | "rem" | "deepSleep",
17097
17034
  itemsProcessed: number,
@@ -17126,315 +17063,23 @@ export class Orchestrator {
17126
17063
  allMemories: MemoryFile[],
17127
17064
  storage: StorageManager = this.storage,
17128
17065
  ): Promise<number> {
17129
- const now = new Date();
17130
- const nowIso = now.toISOString();
17131
- const countsByState: Record<LifecycleState, number> = {
17132
- candidate: 0,
17133
- validated: 0,
17134
- active: 0,
17135
- stale: 0,
17136
- archived: 0,
17137
- };
17138
- const transitionCounts: Record<string, number> = {};
17139
- let updatedCount = 0;
17140
- let disputedCount = 0;
17141
- let evaluatedCount = 0;
17142
- const lifecycleCaps = resolveMemoryLifecycleCapabilities(this.config);
17143
-
17144
- const thresholds = this.effectiveLifecycleThresholds();
17145
- const policy = {
17146
- promoteHeatThreshold: thresholds.promoteHeatThreshold,
17147
- staleDecayThreshold: thresholds.staleDecayThreshold,
17148
- archiveDecayThreshold: thresholds.archiveDecayThreshold,
17149
- protectedCategories: this.config.lifecycleProtectedCategories,
17150
- };
17151
- const actionPriors = await this.buildLifecycleActionPriors(storage);
17152
-
17153
- for (const memory of allMemories) {
17154
- if (
17155
- memory.frontmatter.status === "superseded" ||
17156
- memory.frontmatter.status === "forgotten"
17157
- ) {
17158
- continue;
17159
- }
17160
- evaluatedCount += 1;
17161
- const currentState = resolveLifecycleState(memory.frontmatter);
17162
- const actionPriorScore = actionPriors.get(memory.frontmatter.id);
17163
- const signals: LifecycleSignals | undefined =
17164
- typeof actionPriorScore === "number" &&
17165
- Number.isFinite(actionPriorScore)
17166
- ? { actionPriorScore }
17167
- : undefined;
17168
- const decision = decideLifecycleTransition(memory, policy, now, signals);
17169
- const nextState: LifecycleState =
17170
- memory.frontmatter.status === "archived"
17171
- ? "archived"
17172
- : decision.nextState;
17173
-
17174
- countsByState[nextState] += 1;
17175
- if (memory.frontmatter.verificationState === "disputed") {
17176
- disputedCount += 1;
17177
- }
17178
- if (nextState !== currentState) {
17179
- const key = `${currentState}->${nextState}`;
17180
- transitionCounts[key] = (transitionCounts[key] ?? 0) + 1;
17181
- }
17182
-
17183
- const prevHeat = memory.frontmatter.heatScore;
17184
- const prevDecay = memory.frontmatter.decayScore;
17185
- const scoreDelta =
17186
- Math.abs((prevHeat ?? -1) - decision.heatScore) +
17187
- Math.abs((prevDecay ?? -1) - decision.decayScore);
17188
- const shouldPersist =
17189
- memory.frontmatter.lifecycleState !== nextState ||
17190
- memory.frontmatter.heatScore === undefined ||
17191
- memory.frontmatter.decayScore === undefined ||
17192
- memory.frontmatter.lastValidatedAt === undefined ||
17193
- scoreDelta >= 0.01;
17194
-
17195
- if (!shouldPersist) continue;
17196
-
17197
- const wrote = await storage.writeMemoryFrontmatter(memory, {
17198
- lifecycleState: nextState,
17199
- heatScore: decision.heatScore,
17200
- decayScore: decision.decayScore,
17201
- lastValidatedAt: nowIso,
17202
- });
17203
- if (wrote) updatedCount += 1;
17204
- }
17205
-
17206
- // Report how many memories had frontmatter rewritten so callers can record a
17207
- // catalog write touch for lifecycle-only passes (codex NR-tS).
17208
- if (!lifecycleCaps.lifecycleMetrics) return updatedCount;
17209
-
17210
- const total = evaluatedCount;
17211
- const metrics = {
17212
- generatedAt: nowIso,
17213
- memoriesEvaluated: total,
17214
- memoriesUpdated: updatedCount,
17215
- countsByLifecycleState: countsByState,
17216
- transitionCounts,
17217
- staleRatio: total > 0 ? countsByState.stale / total : 0,
17218
- disputedRatio: total > 0 ? disputedCount / total : 0,
17219
- policy: {
17220
- promoteHeatThreshold: thresholds.promoteHeatThreshold,
17221
- staleDecayThreshold: thresholds.staleDecayThreshold,
17222
- archiveDecayThreshold: thresholds.archiveDecayThreshold,
17223
- protectedCategories: this.config.lifecycleProtectedCategories,
17224
- },
17225
- };
17226
- const metricsPath = path.join(
17227
- storage.dir,
17228
- "state",
17229
- "lifecycle-metrics.json",
17230
- );
17231
- await mkdir(path.dirname(metricsPath), { recursive: true });
17232
- await writeFile(metricsPath, JSON.stringify(metrics, null, 2), "utf-8");
17233
- return updatedCount;
17066
+ return this.lifecyclePolicyCoordinator.runLifecyclePolicyPass(allMemories, storage);
17234
17067
  }
17235
-
17236
- /**
17237
- * Archive old, low-importance, rarely-accessed facts (v6.0).
17238
- * Moves eligible facts from facts/ to archive/YYYY-MM-DD/.
17239
- * Returns the number of archived facts.
17240
- */
17241
17068
  private async runFactArchival(
17242
17069
  allMemories: import("./types.js").MemoryFile[],
17243
17070
  ): Promise<number> {
17244
- const now = Date.now();
17245
- const ageCutoffMs = this.config.factArchivalAgeDays * 24 * 60 * 60 * 1000;
17246
- const protectedCategories = new Set(
17247
- this.config.factArchivalProtectedCategories,
17248
- );
17249
- let archivedCount = 0;
17250
-
17251
- for (const memory of allMemories) {
17252
- const fm = memory.frontmatter;
17253
-
17254
- // Skip already-archived or superseded
17255
- if (fm.status && fm.status !== "active") continue;
17256
-
17257
- // Skip protected categories
17258
- if (protectedCategories.has(fm.category)) continue;
17259
-
17260
- // Skip corrections (always keep)
17261
- if (fm.category === "correction") continue;
17262
-
17263
- // Check age requirement
17264
- const createdMs = new Date(fm.created).getTime();
17265
- if (now - createdMs < ageCutoffMs) continue;
17266
-
17267
- // Check importance (only archive low-importance facts)
17268
- const importanceScore = fm.importance?.score ?? 0.5;
17269
- if (importanceScore >= this.config.factArchivalMaxImportance) continue;
17270
-
17271
- // Check access count
17272
- const accessCount = fm.accessCount ?? 0;
17273
- if (accessCount > this.config.factArchivalMaxAccessCount) continue;
17274
-
17275
- // All criteria met — archive
17276
- const result = await this.storage.archiveMemory(memory);
17277
- if (result) {
17278
- // Remove from the same storage-scoped content-hash index since it is
17279
- // no longer in hot search.
17280
- await this.removeContentHashForMemory(
17281
- this.storage,
17282
- memory,
17283
- "fact-archival",
17284
- );
17285
- await this.embeddingFallback.removeFromIndex(memory.frontmatter.id);
17286
- if (
17287
- resolveIndexingCapabilities(this.config).queryAwareIndexing &&
17288
- memory.path &&
17289
- memory.frontmatter?.created
17290
- ) {
17291
- deindexMemory(
17292
- this.config.memoryDir,
17293
- memory.path,
17294
- memory.frontmatter.created,
17295
- memory.frontmatter.tags ?? [],
17296
- );
17297
- }
17298
- archivedCount++;
17299
- }
17300
- }
17301
-
17302
- // Save hash indexes if we removed any entries.
17303
- if (archivedCount > 0) {
17304
- await this.saveContentHashIndexes().catch((err) =>
17305
- log.warn(`content-hash index save failed during archival: ${err}`),
17306
- );
17307
- }
17308
-
17309
- return archivedCount;
17071
+ return this.lifecyclePolicyCoordinator.runFactArchival(allMemories);
17310
17072
  }
17311
-
17312
- /**
17313
- * Run memory summarization if memory count exceeds threshold (Phase 4A).
17314
- */
17315
17073
  private async runSummarization(
17316
17074
  allMemories: import("./types.js").MemoryFile[],
17317
17075
  ): Promise<void> {
17318
- // Only active memories count toward the threshold
17319
- const activeMemories = allMemories.filter(
17320
- (m) => isActiveMemoryStatus(m.frontmatter.status),
17321
- );
17322
-
17323
- if (activeMemories.length < this.config.summarizationTriggerCount) {
17324
- return;
17325
- }
17326
-
17327
- log.info(
17328
- `memory count (${activeMemories.length}) exceeds threshold (${this.config.summarizationTriggerCount}) — running summarization`,
17329
- );
17330
-
17331
- // Sort by creation date, oldest first
17332
- const sorted = activeMemories.sort(
17333
- (a, b) =>
17334
- new Date(a.frontmatter.created).getTime() -
17335
- new Date(b.frontmatter.created).getTime(),
17336
- );
17337
-
17338
- // Keep recent memories, with explicit zero handling so `slice(-0)` does not
17339
- // accidentally keep every memory out of the summarization candidate set.
17340
- const recentToKeep = Math.max(0, this.config.summarizationRecentToKeep);
17341
- const toSummarize = recentToKeep > 0 ? sorted.slice(0, -recentToKeep) : sorted;
17342
-
17343
- // Filter candidates for summarization
17344
- const candidates = toSummarize.filter((m) => {
17345
- // Skip if protected by entity reference
17346
- if (m.frontmatter.entityRef) return false;
17347
-
17348
- // Skip if protected by tag
17349
- const protectedTags = this.config.summarizationProtectedTags;
17350
- if (m.frontmatter.tags.some((t) => protectedTags.includes(t)))
17351
- return false;
17352
-
17353
- // Skip if importance is above threshold
17354
- const importance = m.frontmatter.importance?.score ?? 0.5;
17355
- if (importance >= this.config.summarizationImportanceThreshold)
17356
- return false;
17357
-
17358
- return true;
17359
- });
17360
-
17361
- if (candidates.length < 50) {
17362
- log.debug(
17363
- `only ${candidates.length} candidates for summarization — skipping`,
17364
- );
17365
- return;
17366
- }
17367
-
17368
- // Summarize in batches of 50
17369
- const batchSize = 50;
17370
- for (let i = 0; i < candidates.length; i += batchSize) {
17371
- const batch = candidates.slice(i, i + batchSize);
17372
- const batchData = batch.map((m) => ({
17373
- id: m.frontmatter.id,
17374
- content: m.content,
17375
- category: m.frontmatter.category,
17376
- created: m.frontmatter.created,
17377
- }));
17378
-
17379
- const result = await this.extraction.summarizeMemories(batchData);
17380
- if (!result) continue;
17381
-
17382
- // Create summary
17383
- const summary: MemorySummary = {
17384
- id: `summary-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
17385
- createdAt: new Date().toISOString(),
17386
- timeRangeStart: batch[0].frontmatter.created,
17387
- timeRangeEnd: batch[batch.length - 1].frontmatter.created,
17388
- summaryText: result.summaryText,
17389
- keyFacts: result.keyFacts,
17390
- keyEntities: result.keyEntities,
17391
- sourceEpisodeIds: batch.map((m) => m.frontmatter.id),
17392
- };
17393
-
17394
- await this.storage.writeSummary(summary);
17395
-
17396
- // Archive source memories
17397
- const archived = await this.storage.archiveMemories(
17398
- batch.map((m) => m.frontmatter.id),
17399
- summary.id,
17400
- );
17401
-
17402
- // Catalog write touch (issue #1499 sweep): summarization writes a durable
17403
- // summary and then rewrites source-memory archive status, bypassing the
17404
- // extraction write path. Record the touch after both mutations complete so
17405
- // `lastWriteAt` covers the final archived-state write.
17406
- // #1522: catalog touch handled at the storage chokepoint.
17407
-
17408
- log.info(
17409
- `created summary ${summary.id} from ${batch.length} memories, archived ${archived}`,
17410
- );
17411
- }
17076
+ return this.lifecyclePolicyCoordinator.runSummarization(allMemories);
17412
17077
  }
17413
-
17414
- /**
17415
- * Run topic extraction on all memories (Phase 4B).
17416
- */
17417
17078
  private async runTopicExtraction(
17418
17079
  allMemories: import("./types.js").MemoryFile[],
17419
17080
  ): Promise<void> {
17420
- // Only extract from active memories
17421
- const activeMemories = allMemories.filter(
17422
- (m) => isActiveMemoryStatus(m.frontmatter.status),
17423
- );
17424
-
17425
- if (activeMemories.length === 0) return;
17426
-
17427
- const topics = extractTopics(
17428
- activeMemories,
17429
- this.config.topicExtractionTopN,
17430
- );
17431
- await this.storage.saveTopics(topics);
17432
-
17433
- log.debug(
17434
- `extracted ${topics.length} topics from ${activeMemories.length} memories`,
17435
- );
17081
+ return this.lifecyclePolicyCoordinator.runTopicExtraction(allMemories);
17436
17082
  }
17437
-
17438
17083
  /** Threshold (bytes) at which IDENTITY.md reflections get auto-consolidated */
17439
17084
  private static readonly IDENTITY_CONSOLIDATE_THRESHOLD = 8_000;
17440
17085
 
@@ -17888,7 +17533,7 @@ export class Orchestrator {
17888
17533
  private queueEvalShadowRecall(
17889
17534
  record: Omit<EvalShadowRecallRecord, "schemaVersion">,
17890
17535
  ): void {
17891
- if (!this.config.evalHarnessEnabled || !this.config.evalShadowModeEnabled)
17536
+ if (!resolveEvalCapabilities(this.config).evalHarness || !resolveEvalCapabilities(this.config).evalShadowMode)
17892
17537
  return;
17893
17538
  this.evalShadowWriteChain = this.evalShadowWriteChain
17894
17539
  .catch(() => undefined)