@remnic/core 9.3.623 → 9.3.625

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 (262) hide show
  1. package/dist/access-cli.js +18 -16
  2. package/dist/access-cli.js.map +1 -1
  3. package/dist/access-http.d.ts +12 -5
  4. package/dist/access-http.js +10 -9
  5. package/dist/access-mcp.d.ts +5 -5
  6. package/dist/access-mcp.js +8 -8
  7. package/dist/access-schema.d.ts +5 -5
  8. package/dist/{access-service-CBNEKjzN.d.ts → access-service-C_sfOHsX.d.ts} +26 -3
  9. package/dist/access-service.d.ts +5 -5
  10. package/dist/access-service.js +7 -7
  11. package/dist/action-confidence.d.ts +1 -1
  12. package/dist/active-memory-bridge.d.ts +1 -1
  13. package/dist/active-recall.d.ts +1 -1
  14. package/dist/active-recall.js +2 -1
  15. package/dist/active-recall.js.map +1 -1
  16. package/dist/behavior-learner.d.ts +1 -1
  17. package/dist/behavior-signals.d.ts +1 -1
  18. package/dist/bootstrap.d.ts +4 -4
  19. package/dist/briefing.d.ts +1 -1
  20. package/dist/briefing.js +3 -3
  21. package/dist/buffer-surprise-report.d.ts +1 -1
  22. package/dist/buffer.d.ts +1 -1
  23. package/dist/calibration.d.ts +1 -1
  24. package/dist/causal-behavior.d.ts +1 -1
  25. package/dist/causal-consolidation.d.ts +1 -1
  26. package/dist/causal-consolidation.js +4 -4
  27. package/dist/{chunk-C4PZTWTG.js → chunk-2RHI3FGV.js} +540 -17
  28. package/dist/chunk-2RHI3FGV.js.map +1 -0
  29. package/dist/{chunk-GYTVOLNX.js → chunk-3MNBW7R7.js} +2 -2
  30. package/dist/{chunk-QFQQFX2H.js → chunk-3R2UZV3U.js} +2 -2
  31. package/dist/{chunk-O4UNM6OR.js → chunk-532VCWYW.js} +2 -2
  32. package/dist/{chunk-2UFQYU5F.js → chunk-57QXN2CS.js} +2 -2
  33. package/dist/chunk-7WV3F5DQ.js +22 -0
  34. package/dist/chunk-7WV3F5DQ.js.map +1 -0
  35. package/dist/{chunk-RKW6QR7W.js → chunk-AZ4RI3QD.js} +1461 -78
  36. package/dist/chunk-AZ4RI3QD.js.map +1 -0
  37. package/dist/{chunk-KQFQ3IS5.js → chunk-F3FY3D3S.js} +43 -7
  38. package/dist/chunk-F3FY3D3S.js.map +1 -0
  39. package/dist/{chunk-4R4KTDIE.js → chunk-FPNQF475.js} +1 -1
  40. package/dist/chunk-FPNQF475.js.map +1 -0
  41. package/dist/{chunk-UGEBPVNI.js → chunk-GE7Q7KXP.js} +2 -2
  42. package/dist/{chunk-GLWW3EJQ.js → chunk-KB4MFBF5.js} +3 -3
  43. package/dist/{chunk-5GOMXHLC.js → chunk-KKTXCFD7.js} +255 -1
  44. package/dist/chunk-KKTXCFD7.js.map +1 -0
  45. package/dist/{chunk-FH3PPO42.js → chunk-KVFYTRMV.js} +2 -2
  46. package/dist/{chunk-BNW5NJJH.js → chunk-LQYTQCXM.js} +2 -2
  47. package/dist/{chunk-AYHXQR53.js → chunk-MVQN73GT.js} +2 -2
  48. package/dist/{chunk-ZZPIJPPD.js → chunk-N5RGXWLQ.js} +2 -2
  49. package/dist/chunk-NDAH7BJ5.js +213 -0
  50. package/dist/chunk-NDAH7BJ5.js.map +1 -0
  51. package/dist/{chunk-R3OQGYOU.js → chunk-P2D2MM47.js} +2 -2
  52. package/dist/{chunk-PSUB67YB.js → chunk-PW6GURU3.js} +2 -2
  53. package/dist/{chunk-W3BKVM64.js → chunk-QDV6VAD4.js} +2 -2
  54. package/dist/{chunk-3QSU4NFF.js → chunk-QHXW3LZV.js} +3 -3
  55. package/dist/{chunk-I6UCUHLK.js → chunk-SHV5Y2WU.js} +182 -3
  56. package/dist/chunk-SHV5Y2WU.js.map +1 -0
  57. package/dist/{chunk-OZXVGYGZ.js → chunk-STDAAGH7.js} +2 -2
  58. package/dist/{chunk-FMGWXIES.js → chunk-TZDSNIRO.js} +5 -5
  59. package/dist/{chunk-2L54V4ZO.js → chunk-UELS6WWF.js} +2 -2
  60. package/dist/{chunk-PJGB7XRR.js → chunk-UGHUNQ74.js} +502 -134
  61. package/dist/chunk-UGHUNQ74.js.map +1 -0
  62. package/dist/{chunk-ZJSZNTEI.js → chunk-Y3TMFC6I.js} +140 -10
  63. package/dist/chunk-Y3TMFC6I.js.map +1 -0
  64. package/dist/{chunk-BPSGLMQ4.js → chunk-YQNADJCT.js} +2 -2
  65. package/dist/{cli-Cw729yLf.d.ts → cli-EZv6YE6_.d.ts} +3 -3
  66. package/dist/cli.d.ts +6 -6
  67. package/dist/cli.js +23 -21
  68. package/dist/compounding/engine.d.ts +1 -1
  69. package/dist/compounding/engine.js +3 -3
  70. package/dist/compounding/preference-consolidator.d.ts +1 -1
  71. package/dist/compression-optimizer.d.ts +1 -1
  72. package/dist/config.d.ts +1 -1
  73. package/dist/config.js +2 -1
  74. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  75. package/dist/connectors/codex-materialize-runner.js +3 -3
  76. package/dist/connectors/codex-materialize.d.ts +1 -1
  77. package/dist/connectors/index.d.ts +1 -1
  78. package/dist/connectors/index.js +3 -3
  79. package/dist/consolidation-provenance-check.d.ts +1 -1
  80. package/dist/consolidation-undo.d.ts +1 -1
  81. package/dist/contradiction/index.d.ts +2 -2
  82. package/dist/conversation-index/backend.d.ts +1 -1
  83. package/dist/conversation-index/chunker.d.ts +1 -1
  84. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  85. package/dist/conversation-index/indexer.d.ts +1 -1
  86. package/dist/conversation-index/search.d.ts +1 -1
  87. package/dist/day-summary.d.ts +1 -1
  88. package/dist/delinearize.d.ts +1 -1
  89. package/dist/direct-answer-wiring.d.ts +1 -1
  90. package/dist/direct-answer.d.ts +1 -1
  91. package/dist/embedding-fallback.d.ts +1 -1
  92. package/dist/enrichment/index.d.ts +1 -1
  93. package/dist/entity-retrieval.d.ts +1 -1
  94. package/dist/entity-retrieval.js +3 -3
  95. package/dist/entity-schema.d.ts +1 -1
  96. package/dist/explicit-capture.d.ts +4 -4
  97. package/dist/extraction-judge-telemetry.d.ts +1 -1
  98. package/dist/extraction-judge-training.d.ts +1 -1
  99. package/dist/extraction-judge.d.ts +1 -1
  100. package/dist/extraction.d.ts +1 -1
  101. package/dist/fallback-llm.d.ts +1 -1
  102. package/dist/identity-continuity.d.ts +1 -1
  103. package/dist/importance.d.ts +1 -1
  104. package/dist/index.d.ts +307 -9
  105. package/dist/index.js +155 -29
  106. package/dist/index.js.map +1 -1
  107. package/dist/intent.d.ts +1 -1
  108. package/dist/lcm/engine.d.ts +1 -1
  109. package/dist/lcm/index.d.ts +1 -1
  110. package/dist/lcm/tools.d.ts +1 -1
  111. package/dist/lifecycle.d.ts +1 -1
  112. package/dist/live-connectors-runner.d.ts +1 -1
  113. package/dist/local-llm.d.ts +1 -1
  114. package/dist/maintenance/memory-governance.d.ts +1 -1
  115. package/dist/maintenance/memory-governance.js +3 -3
  116. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +3 -3
  117. package/dist/maintenance/rebuild-memory-projection.js +4 -4
  118. package/dist/mcp-memory-inspector-app.d.ts +5 -5
  119. package/dist/memory-action-policy.d.ts +1 -1
  120. package/dist/memory-cache.d.ts +1 -1
  121. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  122. package/dist/memory-projection-store.d.ts +1 -1
  123. package/dist/memory-provenance.d.ts +1 -1
  124. package/dist/memory-worth-outcomes.d.ts +1 -1
  125. package/dist/models-json.d.ts +1 -1
  126. package/dist/namespaces/migrate.d.ts +1 -1
  127. package/dist/namespaces/migrate.js +4 -4
  128. package/dist/namespaces/principal.d.ts +1 -1
  129. package/dist/namespaces/search.d.ts +1 -1
  130. package/dist/namespaces/storage.d.ts +1 -1
  131. package/dist/namespaces/storage.js +3 -3
  132. package/dist/native-knowledge.d.ts +1 -1
  133. package/dist/operator-toolkit.d.ts +1 -1
  134. package/dist/operator-toolkit.js +8 -7
  135. package/dist/{orchestrator-CqWOjfgl.d.ts → orchestrator-CEycaY3M.d.ts} +361 -4
  136. package/dist/orchestrator.d.ts +4 -4
  137. package/dist/orchestrator.js +13 -11
  138. package/dist/patterns-cli.d.ts +1 -1
  139. package/dist/policy-runtime.d.ts +1 -1
  140. package/dist/qmd-recall-cache.d.ts +1 -1
  141. package/dist/qmd.d.ts +1 -1
  142. package/dist/recall-disclosure-escalation.d.ts +1 -1
  143. package/dist/recall-explain-renderer.d.ts +1 -1
  144. package/dist/recall-explain-renderer.js +3 -3
  145. package/dist/recall-planner-llm.d.ts +1 -1
  146. package/dist/recall-state.d.ts +1 -1
  147. package/dist/recall-tag-filter.d.ts +1 -1
  148. package/dist/recall-xray-cli.d.ts +1 -1
  149. package/dist/recall-xray-cli.js +4 -4
  150. package/dist/recall-xray-renderer.d.ts +1 -1
  151. package/dist/recall-xray-renderer.js +3 -3
  152. package/dist/recall-xray.d.ts +1 -1
  153. package/dist/recall-xray.js +2 -2
  154. package/dist/resolve-auth-token.d.ts +1 -1
  155. package/dist/resume-bundles.js +3 -2
  156. package/dist/retrieval-agents.d.ts +1 -1
  157. package/dist/retrieval-tiers.d.ts +1 -1
  158. package/dist/routing/engine.d.ts +1 -1
  159. package/dist/routing/store.d.ts +1 -1
  160. package/dist/schemas.d.ts +32 -32
  161. package/dist/search/embed-helper.d.ts +1 -1
  162. package/dist/search/factory.d.ts +1 -1
  163. package/dist/search/index.d.ts +1 -1
  164. package/dist/search/lancedb-backend.d.ts +1 -1
  165. package/dist/search/meilisearch-backend.d.ts +1 -1
  166. package/dist/search/noop-backend.d.ts +1 -1
  167. package/dist/search/orama-backend.d.ts +1 -1
  168. package/dist/search/port.d.ts +1 -1
  169. package/dist/search/remote-backend.d.ts +1 -1
  170. package/dist/{semantic-SLAa_prH.d.ts → semantic-DJR8_DMQ.d.ts} +1 -1
  171. package/dist/{semantic-consolidation-4HkHWgeI.d.ts → semantic-consolidation-FbhPeJjB.d.ts} +1 -1
  172. package/dist/semantic-consolidation.d.ts +2 -2
  173. package/dist/semantic-consolidation.js +4 -4
  174. package/dist/semantic-rule-promotion.js +3 -3
  175. package/dist/semantic-rule-verifier.d.ts +1 -1
  176. package/dist/semantic-rule-verifier.js +3 -3
  177. package/dist/session-observer-bands.d.ts +1 -1
  178. package/dist/session-observer-state.d.ts +1 -1
  179. package/dist/shared-context/manager.d.ts +5 -5
  180. package/dist/signal.d.ts +1 -1
  181. package/dist/storage.d.ts +19 -1
  182. package/dist/storage.js +2 -2
  183. package/dist/summarizer.d.ts +1 -1
  184. package/dist/summary-snapshot.d.ts +1 -1
  185. package/dist/temporal-supersession.d.ts +1 -1
  186. package/dist/temporal-validity.d.ts +1 -1
  187. package/dist/threading.d.ts +1 -1
  188. package/dist/tier-migration.d.ts +1 -1
  189. package/dist/tier-routing.d.ts +1 -1
  190. package/dist/topics.d.ts +1 -1
  191. package/dist/transcript.d.ts +1 -1
  192. package/dist/transfer/types.d.ts +12 -12
  193. package/dist/types-D5VRAI04.d.ts +3134 -0
  194. package/dist/types.d.ts +3 -2862
  195. package/dist/types.js +1 -1
  196. package/dist/utility-runtime.d.ts +1 -1
  197. package/dist/verified-recall.js +3 -3
  198. package/package.json +1 -1
  199. package/src/access-http.ts +182 -8
  200. package/src/access-mcp.ts +198 -0
  201. package/src/access-service.ts +65 -0
  202. package/src/cli.ts +187 -0
  203. package/src/config.ts +7 -0
  204. package/src/index.ts +7 -0
  205. package/src/orchestrator.ts +42 -0
  206. package/src/storage.ts +106 -0
  207. package/src/types.ts +5 -0
  208. package/src/wearables/cleanup.test.ts +134 -0
  209. package/src/wearables/cleanup.ts +188 -0
  210. package/src/wearables/cli.test.ts +170 -0
  211. package/src/wearables/cli.ts +441 -0
  212. package/src/wearables/config.test.ts +143 -0
  213. package/src/wearables/config.ts +332 -0
  214. package/src/wearables/corrections.test.ts +118 -0
  215. package/src/wearables/corrections.ts +211 -0
  216. package/src/wearables/day-store.test.ts +143 -0
  217. package/src/wearables/day-store.ts +238 -0
  218. package/src/wearables/errors.test.ts +32 -0
  219. package/src/wearables/errors.ts +29 -0
  220. package/src/wearables/index.ts +114 -0
  221. package/src/wearables/memory-gen.test.ts +342 -0
  222. package/src/wearables/memory-gen.ts +413 -0
  223. package/src/wearables/pipeline.test.ts +608 -0
  224. package/src/wearables/pipeline.ts +519 -0
  225. package/src/wearables/redaction.test.ts +94 -0
  226. package/src/wearables/redaction.ts +156 -0
  227. package/src/wearables/registry.test.ts +62 -0
  228. package/src/wearables/registry.ts +133 -0
  229. package/src/wearables/service.test.ts +425 -0
  230. package/src/wearables/service.ts +691 -0
  231. package/src/wearables/speakers.test.ts +110 -0
  232. package/src/wearables/speakers.ts +174 -0
  233. package/src/wearables/storage-io.test.ts +105 -0
  234. package/src/wearables/sync-state.test.ts +134 -0
  235. package/src/wearables/sync-state.ts +186 -0
  236. package/src/wearables/types.ts +285 -0
  237. package/dist/chunk-4R4KTDIE.js.map +0 -1
  238. package/dist/chunk-5GOMXHLC.js.map +0 -1
  239. package/dist/chunk-C4PZTWTG.js.map +0 -1
  240. package/dist/chunk-I6UCUHLK.js.map +0 -1
  241. package/dist/chunk-KQFQ3IS5.js.map +0 -1
  242. package/dist/chunk-PJGB7XRR.js.map +0 -1
  243. package/dist/chunk-RKW6QR7W.js.map +0 -1
  244. package/dist/chunk-ZJSZNTEI.js.map +0 -1
  245. /package/dist/{chunk-GYTVOLNX.js.map → chunk-3MNBW7R7.js.map} +0 -0
  246. /package/dist/{chunk-QFQQFX2H.js.map → chunk-3R2UZV3U.js.map} +0 -0
  247. /package/dist/{chunk-O4UNM6OR.js.map → chunk-532VCWYW.js.map} +0 -0
  248. /package/dist/{chunk-2UFQYU5F.js.map → chunk-57QXN2CS.js.map} +0 -0
  249. /package/dist/{chunk-UGEBPVNI.js.map → chunk-GE7Q7KXP.js.map} +0 -0
  250. /package/dist/{chunk-GLWW3EJQ.js.map → chunk-KB4MFBF5.js.map} +0 -0
  251. /package/dist/{chunk-FH3PPO42.js.map → chunk-KVFYTRMV.js.map} +0 -0
  252. /package/dist/{chunk-BNW5NJJH.js.map → chunk-LQYTQCXM.js.map} +0 -0
  253. /package/dist/{chunk-AYHXQR53.js.map → chunk-MVQN73GT.js.map} +0 -0
  254. /package/dist/{chunk-ZZPIJPPD.js.map → chunk-N5RGXWLQ.js.map} +0 -0
  255. /package/dist/{chunk-R3OQGYOU.js.map → chunk-P2D2MM47.js.map} +0 -0
  256. /package/dist/{chunk-PSUB67YB.js.map → chunk-PW6GURU3.js.map} +0 -0
  257. /package/dist/{chunk-W3BKVM64.js.map → chunk-QDV6VAD4.js.map} +0 -0
  258. /package/dist/{chunk-3QSU4NFF.js.map → chunk-QHXW3LZV.js.map} +0 -0
  259. /package/dist/{chunk-OZXVGYGZ.js.map → chunk-STDAAGH7.js.map} +0 -0
  260. /package/dist/{chunk-FMGWXIES.js.map → chunk-TZDSNIRO.js.map} +0 -0
  261. /package/dist/{chunk-2L54V4ZO.js.map → chunk-UELS6WWF.js.map} +0 -0
  262. /package/dist/{chunk-BPSGLMQ4.js.map → chunk-YQNADJCT.js.map} +0 -0
@@ -0,0 +1,3134 @@
1
+ import { c as ImportTurnProvenance } from './types-BliCnURB.js';
2
+ import { L as LcmMessagePartInput, M as MessagePartSourceFormat } from './index-DJ9QWMw-.js';
3
+
4
+ /**
5
+ * Wearable transcript subsystem — shared types (issue: wearable connectors).
6
+ *
7
+ * A "wearable source" is an always-on recording device with a cloud or
8
+ * local API that exposes diarized conversation transcripts (Limitless
9
+ * Pendant, Bee, Omi, ...). Connectors for concrete providers live in
10
+ * optional à-la-carte packages (`@remnic/connector-limitless`,
11
+ * `@remnic/connector-bee`, `@remnic/connector-omi`) and implement
12
+ * `WearableSourceConnector`; everything provider-agnostic — cleanup,
13
+ * speaker labeling, user corrections, day-transcript storage, and
14
+ * trust-gated memory creation — lives in this core subsystem.
15
+ */
16
+
17
+ /** One diarized utterance from a wearable transcript. */
18
+ interface WearableTranscriptSegment {
19
+ /** Utterance text as supplied by the provider (pre-cleanup). */
20
+ text: string;
21
+ /**
22
+ * Stable per-source speaker key. Connectors derive this from whatever
23
+ * the provider exposes (a name, a diarization label like "SPEAKER_00"
24
+ * or "0", or a person id). Used to look up overrides in the speaker
25
+ * registry as `<sourceId>:<speakerKey>`.
26
+ */
27
+ speakerKey: string;
28
+ /** Provider-supplied display name, when available. */
29
+ speakerName?: string;
30
+ /** True when the provider identified this utterance as the wearer. */
31
+ isWearer?: boolean;
32
+ /** ISO 8601 start of the utterance, when the provider supplies one. */
33
+ startIso?: string;
34
+ /** ISO 8601 end of the utterance, when the provider supplies one. */
35
+ endIso?: string;
36
+ }
37
+ /** One conversation (recording session) from a wearable source. */
38
+ interface WearableConversation {
39
+ /** Provider-stable conversation id (string form). */
40
+ id: string;
41
+ /** Connector id this conversation came from (e.g. "limitless"). */
42
+ source: string;
43
+ /** Provider title / one-line summary, when available. */
44
+ title?: string;
45
+ /** Provider-generated long summary, when available. */
46
+ summary?: string;
47
+ /** ISO 8601 conversation start. */
48
+ startIso: string;
49
+ /** ISO 8601 conversation end, when known. */
50
+ endIso?: string;
51
+ /** Human-readable location, when the provider supplies one. */
52
+ location?: string;
53
+ /** Ordered diarized segments. */
54
+ segments: WearableTranscriptSegment[];
55
+ }
56
+ /** Options for a single conversations fetch (one day window). */
57
+ interface WearableFetchOptions {
58
+ /** Day to fetch, formatted YYYY-MM-DD in `timezone`. */
59
+ date: string;
60
+ /** IANA timezone the date is interpreted in. */
61
+ timezone: string;
62
+ /** Opaque pagination cursor from a previous page, when paging. */
63
+ cursor?: string | null;
64
+ /** Abort signal for the underlying HTTP requests. */
65
+ signal?: AbortSignal;
66
+ }
67
+ /** One page of conversations from a connector. */
68
+ interface WearableFetchPage {
69
+ conversations: WearableConversation[];
70
+ /** Cursor for the next page, or null when exhausted. */
71
+ nextCursor: string | null;
72
+ }
73
+ /**
74
+ * A "native memory" is a fact the provider's own pipeline extracted
75
+ * (Bee facts, Omi memories). Importing these is optional and always
76
+ * lands them in the review queue — provider extraction quality is
77
+ * outside Remnic's control.
78
+ */
79
+ interface WearableNativeMemory {
80
+ id: string;
81
+ content: string;
82
+ createdIso?: string;
83
+ tags?: string[];
84
+ }
85
+ interface WearableNativeMemoryPage {
86
+ memories: WearableNativeMemory[];
87
+ nextCursor: string | null;
88
+ }
89
+ /** Result of a connector auth probe. */
90
+ interface WearableAuthCheck {
91
+ ok: boolean;
92
+ /** Short human-readable detail (never includes credentials). */
93
+ detail?: string;
94
+ }
95
+ /**
96
+ * Contract implemented by provider connector packages.
97
+ *
98
+ * Connectors are pure API clients + normalizers: no file IO, no memory
99
+ * writes, no config parsing beyond their own settings object. All
100
+ * pipeline behavior stays in core so every source benefits from the
101
+ * same cleanup, corrections, and trust gating.
102
+ */
103
+ interface WearableSourceConnector {
104
+ /** Stable connector id ("limitless" | "bee" | "omi" | custom). */
105
+ id: string;
106
+ /** Human-readable provider name for status output. */
107
+ displayName: string;
108
+ /** Probe credentials/connectivity without mutating anything. */
109
+ verifyAuth(signal?: AbortSignal): Promise<WearableAuthCheck>;
110
+ /** Fetch one page of conversations for a single day window. */
111
+ fetchConversations(opts: WearableFetchOptions): Promise<WearableFetchPage>;
112
+ /**
113
+ * Fetch one page of provider-extracted memories. Optional — only
114
+ * connectors whose provider exposes such a surface implement it.
115
+ */
116
+ fetchNativeMemories?(opts: {
117
+ cursor?: string | null;
118
+ signal?: AbortSignal;
119
+ }): Promise<WearableNativeMemoryPage>;
120
+ }
121
+ /** Per-source settings handed to a connector factory (parsed config). */
122
+ interface WearableSourceSettings {
123
+ /** Master gate for this source. */
124
+ enabled: boolean;
125
+ /**
126
+ * Credential for the provider API. Prefer the per-connector
127
+ * environment variable (see each connector's README); the config
128
+ * value takes precedence when both are set.
129
+ */
130
+ apiKey?: string;
131
+ /** Override the provider base URL (self-hosted / proxy setups). */
132
+ baseUrl?: string;
133
+ /** Omi: integration app id (the `{app_id}` path component). */
134
+ appId?: string;
135
+ /** Omi: target user id (`uid` query parameter). */
136
+ userId?: string;
137
+ /**
138
+ * Memory creation mode (trust gate):
139
+ * - "off": transcripts only; never create memories.
140
+ * - "review": extract candidate memories but write every one with
141
+ * status "pending_review" so nothing enters active
142
+ * recall without operator approval. Default.
143
+ * - "auto": extracted memories that pass the quality gates are
144
+ * written active, like live-conversation extraction.
145
+ */
146
+ memoryMode: WearableMemoryMode;
147
+ /** Drop extracted facts below this confidence (0–1). */
148
+ minConfidence: number;
149
+ /** Drop extracted facts scored below this importance level. */
150
+ minImportance: ImportanceLevel;
151
+ /**
152
+ * Cap on memories created per source per day. 0 disables the cap.
153
+ */
154
+ maxMemoriesPerDay: number;
155
+ /**
156
+ * Import provider-extracted memories (Bee facts / Omi memories).
157
+ * "review" lands them in the review queue; "off" (default) skips.
158
+ */
159
+ importNativeMemories: "off" | "review";
160
+ /** Transcript cleanup toggles. */
161
+ cleanup: WearableCleanupSettings;
162
+ }
163
+ type WearableMemoryMode = "off" | "review" | "auto";
164
+ interface WearableCleanupSettings {
165
+ /** Merge consecutive segments from the same speaker. */
166
+ mergeSameSpeaker: boolean;
167
+ /** Strip standalone filler tokens (um, uh, ...). */
168
+ stripFillers: boolean;
169
+ /** Collapse immediately repeated phrases (ASR stutter). */
170
+ collapseRepeats: boolean;
171
+ /**
172
+ * Drop segments that look like ASR garbage (very low word ratio,
173
+ * long single-character runs). Dropped segments are counted in the
174
+ * sync summary and excluded from memory extraction.
175
+ */
176
+ dropLowQuality: boolean;
177
+ }
178
+ /** A single user-specific transcript correction rule. */
179
+ interface WearableCorrectionRule {
180
+ /** Text (or regex when `regex` is true) to match. */
181
+ match: string;
182
+ /** Replacement text. */
183
+ replace: string;
184
+ /** Treat `match` as a regular expression. Default false (literal). */
185
+ regex?: boolean;
186
+ /** Case-insensitive matching. Default true. */
187
+ caseInsensitive?: boolean;
188
+ /**
189
+ * Restrict the rule to specific source ids. Omit to apply to all
190
+ * sources.
191
+ */
192
+ sources?: string[];
193
+ }
194
+ /** Top-level wearables configuration (parsed). */
195
+ interface WearablesConfig {
196
+ /** Master gate for the whole subsystem. Default false. */
197
+ enabled: boolean;
198
+ /**
199
+ * IANA timezone used to bucket transcripts into days. Defaults to
200
+ * the host timezone at runtime when unset.
201
+ */
202
+ timezone?: string;
203
+ /** Built-in PII redaction (SSN / payment-card patterns). Default true. */
204
+ redactionEnabled: boolean;
205
+ /** Additional user-supplied redaction regexes (validated at parse). */
206
+ redactionPatterns: string[];
207
+ /**
208
+ * Honor a spoken "off the record" marker by dropping segments until
209
+ * "back on the record" (or conversation end). Default false.
210
+ */
211
+ offTheRecordEnabled: boolean;
212
+ /**
213
+ * Write one compact daily-digest memory per synced source/day.
214
+ * Default false.
215
+ */
216
+ digestEnabled: boolean;
217
+ /** Correction rules from config (merged with CLI-managed rules). */
218
+ corrections: WearableCorrectionRule[];
219
+ /** Per-source settings, keyed by connector id. */
220
+ sources: Record<string, WearableSourceSettings>;
221
+ }
222
+ /** Summary returned by a sync run (one source). */
223
+ interface WearableSyncSummary {
224
+ source: string;
225
+ /** Days that were synced (YYYY-MM-DD). */
226
+ days: string[];
227
+ conversations: number;
228
+ segmentsKept: number;
229
+ segmentsDropped: number;
230
+ redactions: number;
231
+ correctionsApplied: number;
232
+ /** Day files written (skipped-unchanged days are not listed). */
233
+ transcriptsWritten: string[];
234
+ memoriesCreated: number;
235
+ memoriesSkipped: number;
236
+ nativeMemoriesImported: number;
237
+ /** Non-fatal warnings surfaced to the operator. */
238
+ warnings: string[];
239
+ }
240
+ /** Frontmatter persisted on a day-transcript file. */
241
+ interface WearableDayTranscriptMeta {
242
+ kind: "wearable-transcript";
243
+ source: string;
244
+ date: string;
245
+ timezone: string;
246
+ conversationCount: number;
247
+ segmentCount: number;
248
+ speakers: string[];
249
+ durationMinutes: number;
250
+ /** SHA-256 of the body — used to skip unchanged rewrites. */
251
+ contentHash: string;
252
+ syncedAt: string;
253
+ }
254
+ /** A parsed day-transcript file. */
255
+ interface WearableDayTranscript {
256
+ meta: WearableDayTranscriptMeta;
257
+ body: string;
258
+ }
259
+ /** Status snapshot for one configured source. */
260
+ interface WearableSourceStatus {
261
+ source: string;
262
+ displayName: string;
263
+ enabled: boolean;
264
+ connectorInstalled: boolean;
265
+ memoryMode: WearableMemoryMode;
266
+ lastSyncAt: string | null;
267
+ lastDateSynced: string | null;
268
+ transcriptDays: number;
269
+ }
270
+
271
+ /**
272
+ * dreams-ledger.ts — per-phase telemetry for the Dreams consolidation pipeline.
273
+ *
274
+ * Every scheduled or manual phase run appends one JSONL entry to
275
+ * <memoryDir>/state/dreams-ledger.jsonl
276
+ *
277
+ * The entry records which phase ran, how long it took, and a small
278
+ * itemsProcessed counter so `remnic dreams status` can aggregate the last
279
+ * 24-hour window without scanning the full memory corpus.
280
+ *
281
+ * This module is intentionally side-effect-free on import (no fs calls at
282
+ * module load time) so tests can import it without touching the filesystem.
283
+ */
284
+ /** The three named phases of the Dreams consolidation pipeline. */
285
+ type DreamsPhase = "lightSleep" | "rem" | "deepSleep";
286
+ /** Aggregated stats for a single phase over a time window. */
287
+ interface DreamsPhaseStatus {
288
+ phase: DreamsPhase;
289
+ /** Number of phase runs in the window. */
290
+ runCount: number;
291
+ /** Total wall-clock milliseconds across all runs in the window. */
292
+ totalDurationMs: number;
293
+ /** Total items processed across all runs in the window. */
294
+ totalItemsProcessed: number;
295
+ /** ISO-8601 timestamp of the most recent completed run, or null if none. */
296
+ lastRunAt: string | null;
297
+ /** Duration of the most recent run in ms, or null if none. */
298
+ lastDurationMs: number | null;
299
+ }
300
+ /** Shape returned by `getDreamsStatus` — the canonical telemetry response. */
301
+ interface DreamsStatusResult {
302
+ /** ISO-8601 start of the query window (inclusive). */
303
+ windowStart: string;
304
+ /** ISO-8601 end of the query window (exclusive). */
305
+ windowEnd: string;
306
+ /** Per-phase summaries, always present for all three phases. */
307
+ phases: {
308
+ lightSleep: DreamsPhaseStatus;
309
+ rem: DreamsPhaseStatus;
310
+ deepSleep: DreamsPhaseStatus;
311
+ };
312
+ }
313
+ /** Public result shape — identical to what HTTP, MCP, and CLI surfaces expose. */
314
+ interface DreamsRunResult {
315
+ phase: DreamsPhase;
316
+ dryRun: boolean;
317
+ durationMs: number;
318
+ itemsProcessed: number;
319
+ notes?: string;
320
+ }
321
+
322
+ type ReasoningEffort = "none" | "low" | "medium" | "high";
323
+ type TriggerMode = "smart" | "every_n" | "time_based";
324
+ type SignalLevel = "none" | "low" | "medium" | "high";
325
+ type MemoryCategory = "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule" | "procedure" | "reasoning_trace";
326
+ type ConsolidationAction = "ADD" | "MERGE" | "UPDATE" | "INVALIDATE" | "SKIP";
327
+ type ConfidenceTier = "explicit" | "implied" | "inferred" | "speculative";
328
+ type PrincipalFromSessionKeyMode = "map" | "prefix" | "regex";
329
+ type RecallPlanMode = "no_recall" | "minimal" | "full" | "graph_mode";
330
+ type CronRecallMode = "all" | "none" | "allowlist";
331
+ type CronConversationRecallMode = "auto" | "always" | "never";
332
+ type IdentityInjectionMode = "recovery_only" | "minimal" | "full";
333
+ type CaptureMode = "implicit" | "explicit" | "hybrid";
334
+ type MemoryOsPresetName = "conservative" | "balanced" | "research-max" | "local-llm-heavy";
335
+ type ExtractionPassSource = "base" | "proactive";
336
+ /**
337
+ * Scope classification for extracted facts (issue #XXX).
338
+ *
339
+ * - `"project"` — knowledge specific to one codebase: file paths, environment
340
+ * configs, deployment details, project-specific workarounds, team/stakeholder
341
+ * info tied to one project.
342
+ * - `"global"` — knowledge that applies across projects: core framework bugs,
343
+ * library behavior, API patterns, user preferences, tool configurations,
344
+ * general coding patterns, infrastructure knowledge.
345
+ *
346
+ * Default is `"project"` when a coding context is active, `"global"` when no
347
+ * coding context is present.
348
+ */
349
+ type MemoryScope = "project" | "global";
350
+ type SlotMismatchMode = "error" | "warn" | "silent";
351
+ type CodexCompactionFlushMode = "signal" | "heuristic" | "auto";
352
+ type DreamingNarrativePromptStyle = "reflective" | "diary" | "analytical";
353
+ type HeartbeatDetectionMode = "runtime-signal" | "heuristic" | "auto";
354
+ type ActiveRecallQueryMode = "message" | "recent" | "full";
355
+ type ActiveRecallPromptStyle = "balanced" | "strict" | "contextual" | "recall-heavy" | "precision-heavy" | "preference-only";
356
+ type ActiveRecallThinking = "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "adaptive";
357
+ type ActiveRecallChatType = "direct" | "group" | "channel";
358
+ type ActiveRecallModelFallbackPolicy = "default-remote" | "resolved-only";
359
+ /**
360
+ * Retrieval tier ladder (issue #518). Identifies which tier served a recall
361
+ * result. Ordered top-to-bottom by cost, but routing is not strictly
362
+ * sequential — callers may jump straight to a lower tier when eligibility
363
+ * does not hold.
364
+ */
365
+ type RetrievalTier = "exact-cache" | "fuzzy-cache" | "direct-answer" | "hybrid" | "rerank-graph" | "agentic";
366
+ /**
367
+ * Per-recall annotation describing which retrieval tier served a result,
368
+ * why that tier was chosen, and what was filtered along the way. Added as
369
+ * part of issue #518 (direct-answer tier + `query --explain`).
370
+ *
371
+ * Not to be confused with the existing `recallExplain` operation
372
+ * (graph-path explanation) — that is a user-invoked RPC; this is a
373
+ * per-result annotation that can be attached to any recall response.
374
+ */
375
+ interface RecallTierExplain {
376
+ tier: RetrievalTier;
377
+ tierReason: string;
378
+ filteredBy: string[];
379
+ candidatesConsidered: number;
380
+ latencyMs: number;
381
+ sourceAnchors?: Array<{
382
+ path: string;
383
+ lineRange?: [number, number];
384
+ }>;
385
+ }
386
+ /**
387
+ * Recall disclosure depth (issue #677). Selects how much content each
388
+ * recall result returns:
389
+ *
390
+ * - `"chunk"` — semantic chunk excerpt (cheapest; default).
391
+ * - `"section"` — full markdown section / memory body (current pre-#677 behavior).
392
+ * - `"raw"` — raw transcript / archive excerpts from `lcm/` when present.
393
+ *
394
+ * Disclosure is **orthogonal** to the retrieval-tier ladder
395
+ * (`RetrievalTier` / `RETRIEVAL_TIERS`). The tier ladder controls *which
396
+ * pipeline stage served a result*; disclosure controls *how deep into the
397
+ * underlying memory the result reaches*. A request can mix any retrieval
398
+ * tier with any disclosure depth.
399
+ *
400
+ * Default is `"chunk"` when the caller omits the field; this preserves the
401
+ * existing recall behavior because callers that did not request a disclosure
402
+ * level continue to receive the same chunk-shaped previews they always had.
403
+ * Surfaces (CLI / HTTP / MCP) and downstream telemetry are wired in later
404
+ * PRs of #677.
405
+ */
406
+ type RecallDisclosure = "chunk" | "section" | "raw";
407
+ /**
408
+ * Ordered list of disclosure levels, cheapest to most expensive. Used for
409
+ * validation, escalation policy comparisons, and future telemetry rollups.
410
+ * Treat this as the single source of truth — do not hard-code disclosure
411
+ * strings elsewhere.
412
+ */
413
+ declare const RECALL_DISCLOSURE_LEVELS: readonly RecallDisclosure[];
414
+ /**
415
+ * Default disclosure level when a caller omits `disclosure`. Set to `chunk`
416
+ * so callers that did not opt in to deeper disclosure see the same
417
+ * preview-shaped behavior as before #677.
418
+ */
419
+ declare const DEFAULT_RECALL_DISCLOSURE: RecallDisclosure;
420
+ declare function isRecallDisclosure(value: unknown): value is RecallDisclosure;
421
+ interface RecallSectionConfig {
422
+ id: string;
423
+ enabled?: boolean;
424
+ maxChars?: number | null;
425
+ maxHints?: number;
426
+ maxSupportingFacts?: number;
427
+ maxRelatedEntities?: number;
428
+ consolidateTriggerLines?: number;
429
+ consolidateTargetLines?: number;
430
+ maxEntities?: number;
431
+ maxResults?: number;
432
+ recentTurns?: number;
433
+ maxTurns?: number;
434
+ maxTokens?: number;
435
+ lookbackHours?: number;
436
+ maxCount?: number;
437
+ topK?: number;
438
+ timeoutMs?: number;
439
+ maxPatterns?: number;
440
+ maxRubrics?: number;
441
+ forceGeneric?: boolean;
442
+ }
443
+ interface RecallPipelineConfig {
444
+ recallBudgetChars: number;
445
+ pipeline: RecallSectionConfig[];
446
+ }
447
+ interface SessionObserverBandConfig {
448
+ maxBytes: number;
449
+ triggerDeltaBytes: number;
450
+ triggerDeltaTokens: number;
451
+ }
452
+ interface FileHygieneConfig {
453
+ enabled: boolean;
454
+ lintEnabled: boolean;
455
+ lintBudgetBytes: number;
456
+ lintWarnRatio: number;
457
+ lintPaths: string[];
458
+ rotateEnabled: boolean;
459
+ rotateMaxBytes: number;
460
+ rotateKeepTailChars: number;
461
+ rotatePaths: string[];
462
+ archiveDir: string;
463
+ runMinIntervalMs: number;
464
+ warningsLogEnabled: boolean;
465
+ warningsLogPath: string;
466
+ indexEnabled: boolean;
467
+ indexPath: string;
468
+ }
469
+ interface NativeKnowledgeConfig {
470
+ enabled: boolean;
471
+ includeFiles: string[];
472
+ maxChunkChars: number;
473
+ maxResults: number;
474
+ maxChars: number;
475
+ stateDir: string;
476
+ obsidianVaults: NativeKnowledgeObsidianVaultConfig[];
477
+ openclawWorkspace?: NativeKnowledgeOpenClawWorkspaceConfig;
478
+ }
479
+ interface NativeKnowledgeFolderRuleConfig {
480
+ pathPrefix: string;
481
+ namespace?: string;
482
+ privacyClass?: string;
483
+ }
484
+ interface NativeKnowledgeObsidianVaultConfig {
485
+ id: string;
486
+ rootDir: string;
487
+ includeGlobs: string[];
488
+ excludeGlobs: string[];
489
+ namespace?: string;
490
+ privacyClass?: string;
491
+ folderRules: NativeKnowledgeFolderRuleConfig[];
492
+ dailyNotePatterns: string[];
493
+ materializeBacklinks: boolean;
494
+ }
495
+ interface NativeKnowledgeOpenClawWorkspaceConfig {
496
+ enabled: boolean;
497
+ bootstrapFiles: string[];
498
+ handoffGlobs: string[];
499
+ dailySummaryGlobs: string[];
500
+ automationNoteGlobs: string[];
501
+ workspaceDocGlobs: string[];
502
+ excludeGlobs: string[];
503
+ sharedSafeGlobs: string[];
504
+ }
505
+ /**
506
+ * OpenClaw SecretRef shape (issue #757).
507
+ *
508
+ * OpenClaw resolves these at runtime via its built-in secret resolver
509
+ * (e.g. exec providers like `kc_*` for macOS Keychain). Plugins receive
510
+ * the raw object in `pluginConfig` and must call the gateway's resolver
511
+ * before using the value. Standalone Remnic does NOT resolve SecretRefs;
512
+ * operators must use plain strings or `${ENV_VAR}` expansion instead.
513
+ */
514
+ interface SecretRef {
515
+ source: string;
516
+ provider?: string;
517
+ id?: string;
518
+ command?: unknown;
519
+ [key: string]: unknown;
520
+ }
521
+ type AgentAccessAuthToken = string | SecretRef;
522
+ interface AgentAccessHttpConfig {
523
+ enabled: boolean;
524
+ host: string;
525
+ port: number;
526
+ /**
527
+ * Bearer token. Either a literal string (env-expanded) or an unresolved
528
+ * SecretRef object preserved verbatim from openclaw.json — resolved at
529
+ * service-start time via {@link resolveAgentAccessAuthToken}.
530
+ */
531
+ authToken?: AgentAccessAuthToken;
532
+ principal?: string;
533
+ maxBodyBytes: number;
534
+ }
535
+ interface DreamingConfig {
536
+ enabled: boolean;
537
+ journalPath: string;
538
+ maxEntries: number;
539
+ injectRecentCount: number;
540
+ minIntervalMinutes: number;
541
+ narrativeModel: string | null;
542
+ narrativePromptStyle: DreamingNarrativePromptStyle;
543
+ watchFile: boolean;
544
+ }
545
+ /**
546
+ * Light-sleep phase config (issue #678 PR 2/4).
547
+ *
548
+ * Groups existing top-level lifecycle-policy gates under a unified namespace.
549
+ * When `dreams.phases.lightSleep.*` keys are set they WIN over the legacy
550
+ * top-level keys; the legacy keys remain readable for backward compatibility.
551
+ *
552
+ * Light sleep: recent activity scoring + clustering (tier-routing value score,
553
+ * observation ledger, buffer state — `runLifecyclePolicyPass` in orchestrator).
554
+ */
555
+ interface DreamsLightSleepConfig {
556
+ /** Phase master switch. Mirrors `lifecyclePolicyEnabled` when not set explicitly. */
557
+ enabled: boolean;
558
+ /** Minimum interval between light-sleep passes in milliseconds. */
559
+ cadenceMs: number;
560
+ /** Value score above which a memory is treated as hot. Mirrors `lifecyclePromoteHeatThreshold`. */
561
+ promoteHeatThreshold: number;
562
+ /** Value score below which a memory starts to decay. Mirrors `lifecycleStaleDecayThreshold`. */
563
+ staleDecayThreshold: number;
564
+ /** Value score below which a memory is eligible for archive. Mirrors `lifecycleArchiveDecayThreshold`. */
565
+ archiveDecayThreshold: number;
566
+ /** Whether stale memories are filtered from recall. Mirrors `lifecycleFilterStaleEnabled`. */
567
+ filterStaleEnabled: boolean;
568
+ }
569
+ /**
570
+ * REM phase config (issue #678 PR 2/4).
571
+ *
572
+ * Groups existing top-level semantic-consolidation and supersession gates.
573
+ * When `dreams.phases.rem.*` keys are set they WIN over the legacy top-level
574
+ * keys.
575
+ *
576
+ * REM: cross-session synthesis, supersession resolution, semantic consolidation
577
+ * (`runSemanticConsolidation` in orchestrator).
578
+ */
579
+ interface DreamsRemConfig {
580
+ /** Phase master switch. Mirrors `semanticConsolidationEnabled` when not set explicitly. */
581
+ enabled: boolean;
582
+ /**
583
+ * How often the REM pass runs, in milliseconds.
584
+ * Derived from `semanticConsolidationIntervalHours` (×3 600 000) when not set explicitly.
585
+ */
586
+ cadenceMs: number;
587
+ /** Cosine-similarity threshold for cluster membership. Mirrors `semanticConsolidationThreshold`. */
588
+ similarityThreshold: number;
589
+ /** Minimum cluster size before consolidation runs. Mirrors `semanticConsolidationMinClusterSize`. */
590
+ minClusterSize: number;
591
+ /** Max cluster operations per run. Mirrors `semanticConsolidationMaxPerRun`. */
592
+ maxPerRun: number;
593
+ /** Minimum gap between consolidation passes (ms). Mirrors `consolidationMinIntervalMs`. */
594
+ minIntervalMs: number;
595
+ }
596
+ /**
597
+ * Deep-sleep phase config (issue #678 PR 2/4).
598
+ *
599
+ * Groups existing versioning and tier-migration gates.
600
+ * When `dreams.phases.deepSleep.*` keys are set they WIN over the legacy
601
+ * top-level keys.
602
+ *
603
+ * Deep sleep: promotion to durable memory, hot→cold tier migration,
604
+ * page-version snapshots, archive (`engram-nightly-governance` cron,
605
+ * `tier-migration.ts`, `page-versioning.ts`, `hygiene.ts`).
606
+ */
607
+ interface DreamsDeepSleepConfig {
608
+ /**
609
+ * Phase master switch. No single direct legacy mirror; defaults false unless
610
+ * an existing deep-sleep surface such as nightly governance auto-registration,
611
+ * tier migration, or page versioning is explicitly enabled. Set to `false`
612
+ * to disable those surfaces without removing legacy config keys.
613
+ */
614
+ enabled: boolean;
615
+ /** True only when dreams.phases.deepSleep.enabled was explicitly configured. */
616
+ enabledExplicitlySet?: boolean;
617
+ /**
618
+ * Minimum interval between deep-sleep passes in milliseconds.
619
+ * Informational only in PR 2; PR 4 will wire this into the cron scheduler.
620
+ */
621
+ cadenceMs: number;
622
+ /** Enable page-version snapshots on every overwrite. Mirrors `versioningEnabled`. */
623
+ versioningEnabled: boolean;
624
+ /** Max snapshots per page. Mirrors `versioningMaxPerPage`. */
625
+ versioningMaxPerPage: number;
626
+ }
627
+ /**
628
+ * Unified dreams phases config block (issue #678 PR 2/4).
629
+ *
630
+ * Operators set `dreams.phases.{lightSleep,rem,deepSleep}.*` in their plugin
631
+ * config. Values under this block WIN over the equivalent legacy top-level keys
632
+ * when both are set. Legacy keys continue to be parsed so existing configs do
633
+ * not need to change.
634
+ *
635
+ * This block is intentionally separate from `DreamingConfig` which controls the
636
+ * diary surface (`surfaces/dreams.ts`) — a different feature. See docs/dreams.md.
637
+ */
638
+ interface DreamsPhasesConfig {
639
+ lightSleep: DreamsLightSleepConfig;
640
+ rem: DreamsRemConfig;
641
+ deepSleep: DreamsDeepSleepConfig;
642
+ }
643
+ /** Procedural memory (issue #519): mining + recall gates. All sub-features default off. */
644
+ interface ProceduralConfig {
645
+ enabled: boolean;
646
+ /** Minimum cluster size before emitting a candidate; `0` disables mining (`minOccurrences_zero`). */
647
+ minOccurrences: number;
648
+ /** Minimum success rate from trajectory outcomes in [0, 1]. */
649
+ successFloor: number;
650
+ /** When auto-promotion is enabled, promote pending_review → active after this many occurrences. */
651
+ autoPromoteOccurrences: number;
652
+ autoPromoteEnabled: boolean;
653
+ lookbackDays: number;
654
+ /** When true, installer may register the nightly procedural mining cron (default off). */
655
+ proceduralMiningCronAutoRegister: boolean;
656
+ /** Max procedure memories to inject on task-initiation recall (1–10). */
657
+ recallMaxProcedures: number;
658
+ }
659
+ /**
660
+ * Coding-agent mode config (issue #569).
661
+ *
662
+ * When the connector provides a `CodingContext` (see below), Remnic overlays
663
+ * a project- and/or branch-scoped namespace on top of the principal's default
664
+ * namespace so that memories written while working on project A do not surface
665
+ * while working on project B.
666
+ *
667
+ * Both flags default off-for-branch / on-for-project. Per CLAUDE.md #30 every
668
+ * filter or transform needs an escape hatch: set `projectScope: false` to
669
+ * exactly restore pre-#569 behaviour.
670
+ */
671
+ interface CodingModeConfig {
672
+ /**
673
+ * When true (default), a session with a resolved `CodingContext` uses a
674
+ * project-scoped namespace. When false, the principal's default namespace
675
+ * is used unchanged (pre-#569 behaviour).
676
+ */
677
+ projectScope: boolean;
678
+ /**
679
+ * When true, recall/write also overlay the current branch on top of the
680
+ * project namespace. Default false — branch-scope is opt-in because active
681
+ * development typically wants recall across branches. (Wired by PR 3 of
682
+ * issue #569; declared here so the schema ships in one slice.)
683
+ */
684
+ branchScope: boolean;
685
+ /**
686
+ * When true (default), project-scoped and branch-scoped sessions include
687
+ * the root/default namespace in their read fallbacks so globally useful
688
+ * memories remain visible from any project. When false, project-scoped
689
+ * sessions only see their own namespace (strict isolation).
690
+ *
691
+ * CLAUDE.md #30: configuration gate for the recall fan-out to the root
692
+ * namespace. Does not affect writes — those always go to the project
693
+ * namespace only.
694
+ */
695
+ globalFallback: boolean;
696
+ }
697
+ /**
698
+ * Session-scoped coding context. Produced by `resolveGitContext()` in the
699
+ * connector layer and attached to a session so that recall + write paths can
700
+ * compute an overlay namespace.
701
+ *
702
+ * All fields mirror `GitContext` from `./coding/git-context.ts`; kept as a
703
+ * separate interface because `types.ts` must stay dependency-free (it is
704
+ * imported by every other module).
705
+ */
706
+ interface CodingContext {
707
+ projectId: string;
708
+ branch: string | null;
709
+ rootPath: string;
710
+ defaultBranch: string | null;
711
+ }
712
+ /** Configuration for the nightly contradiction-scan cron (issue #520). */
713
+ interface ContradictionScanConfig {
714
+ /** Master switch for the contradiction scan cron. Default true. */
715
+ enabled: boolean;
716
+ /** Embedding cosine similarity floor for candidate pair generation. Default 0.82. */
717
+ similarityFloor: number;
718
+ /** Minimum topic-token Jaccard overlap for unstructured pairs. Default 0.4. */
719
+ topicOverlapFloor: number;
720
+ /** Cap on candidate pairs evaluated per cron run. Default 500. */
721
+ maxPairsPerRun: number;
722
+ /** Cooldown in days before re-evaluating a pair judged independent/both-valid. Default 14. */
723
+ cooldownDays: number;
724
+ /** When true, pairs judged "duplicates" are auto-flagged for dedup (still need user approval). Default false. */
725
+ autoMergeDuplicates: boolean;
726
+ }
727
+ interface HeartbeatConfig {
728
+ enabled: boolean;
729
+ journalPath: string;
730
+ maxPreviousRuns: number;
731
+ watchFile: boolean;
732
+ detectionMode: HeartbeatDetectionMode;
733
+ gateExtractionDuringHeartbeat: boolean;
734
+ }
735
+ interface SlotBehaviorConfig {
736
+ requireExclusiveMemorySlot: boolean;
737
+ onSlotMismatch: SlotMismatchMode;
738
+ }
739
+ interface CodexCompatConfig {
740
+ enabled: boolean;
741
+ threadIdBufferKeying: boolean;
742
+ compactionFlushMode: CodexCompactionFlushMode;
743
+ fingerprintDedup: boolean;
744
+ }
745
+ declare function confidenceTier(score: number): ConfidenceTier;
746
+ /** Default TTL in days for speculative memories (auto-expire if unconfirmed) */
747
+ declare const SPECULATIVE_TTL_DAYS = 30;
748
+ /**
749
+ * Shape for semantic chunking config overrides stored in PluginConfig.
750
+ * Mirrors SemanticChunkingConfig from semantic-chunking.ts without creating
751
+ * a circular import (types.ts is imported by everything).
752
+ */
753
+ interface SemanticChunkingConfigShape {
754
+ targetTokens: number;
755
+ minTokens: number;
756
+ maxTokens: number;
757
+ smoothingWindowSize: number;
758
+ boundaryThresholdStdDevs: number;
759
+ embeddingBatchSize: number;
760
+ fallbackToRecursive: boolean;
761
+ }
762
+ interface PluginConfig {
763
+ openaiApiKey: string | undefined;
764
+ openaiBaseUrl: string | undefined;
765
+ model: string;
766
+ reasoningEffort: ReasoningEffort;
767
+ triggerMode: TriggerMode;
768
+ bufferMaxTurns: number;
769
+ bufferMaxMinutes: number;
770
+ /**
771
+ * Surprise-gated buffer flush (issue #563, D-MEM).
772
+ *
773
+ * When enabled, every turn added to the smart buffer is scored against a
774
+ * configurable window of recent memories using an embedding-distance proxy
775
+ * for novelty (see `buffer-surprise.ts`). A turn whose surprise score
776
+ * exceeds `bufferSurpriseThreshold` triggers an immediate extract flush,
777
+ * even if the existing signal/turn-count/time triggers would otherwise keep
778
+ * buffering. Disabled by default — when `false`, buffer behavior is
779
+ * identical to pre-#563 code. Additive only: existing triggers are never
780
+ * suppressed by this flag.
781
+ */
782
+ bufferSurpriseTriggerEnabled: boolean;
783
+ /**
784
+ * Threshold in `[0, 1]` above which a surprise score causes an immediate
785
+ * flush. `0.35` is a conservative default chosen to favor precision over
786
+ * recall during the opt-in phase. Ignored unless
787
+ * `bufferSurpriseTriggerEnabled` is `true`.
788
+ */
789
+ bufferSurpriseThreshold: number;
790
+ /**
791
+ * Number of nearest neighbors to average over when computing the surprise
792
+ * score (see `computeSurprise`). Default `5`. Clamped to the recent-memory
793
+ * window size at call time.
794
+ */
795
+ bufferSurpriseK: number;
796
+ /**
797
+ * Maximum number of recent memories to sample when computing the surprise
798
+ * score. Bounds embedding cost per turn. Default `20`. Set to `0` to
799
+ * disable the trigger even when the flag is on (no memories to compare
800
+ * against → treat as not-applicable rather than maximally surprising).
801
+ */
802
+ bufferSurpriseRecentMemoryCount: number;
803
+ /**
804
+ * Hard timeout (ms) for the surprise probe. If the probe does not
805
+ * resolve within this window, the buffer treats the probe as failed,
806
+ * logs at debug, and falls through to the existing triggers. Ensures
807
+ * a slow or hung embedder cannot stall the turn-append path. Default
808
+ * `2000` (2s).
809
+ */
810
+ bufferSurpriseProbeTimeoutMs: number;
811
+ consolidateEveryN: number;
812
+ highSignalPatterns: string[];
813
+ maxMemoryTokens: number;
814
+ memoryOsPreset?: MemoryOsPresetName;
815
+ qmdEnabled: boolean;
816
+ qmdCollection: string;
817
+ qmdMaxResults: number;
818
+ qmdColdTierEnabled?: boolean;
819
+ qmdColdCollection?: string;
820
+ qmdColdMaxResults?: number;
821
+ qmdTierMigrationEnabled: boolean;
822
+ qmdTierDemotionMinAgeDays: number;
823
+ qmdTierDemotionValueThreshold: number;
824
+ qmdTierPromotionValueThreshold: number;
825
+ qmdTierParityGraphEnabled: boolean;
826
+ qmdTierParityHiMemEnabled: boolean;
827
+ qmdTierAutoBackfillEnabled: boolean;
828
+ qmdSupportedVersion: string;
829
+ qmdAutoUpgradeEnabled: boolean;
830
+ qmdAutoUpgradeCheckIntervalMs: number;
831
+ qmdChunkStrategy: "auto" | "regex";
832
+ qmdCandidateLimit?: number;
833
+ qmdQueryRerankEnabled: boolean;
834
+ qmdSearchStrategy: "hybrid" | "lex-vec" | "lex";
835
+ qmdSubprocessStrategy: "query" | "search";
836
+ qmdDaemonTimeoutMs: number;
837
+ qmdIndexName?: string;
838
+ qmdForceCpu: boolean;
839
+ qmdGpuBackend?: "auto" | "metal" | "cuda" | "vulkan" | "false";
840
+ qmdEmbedParallelism?: number;
841
+ qmdEmbedModel?: string;
842
+ qmdRerankModel?: string;
843
+ qmdGenerateModel?: string;
844
+ embeddingFallbackEnabled: boolean;
845
+ embeddingFallbackProvider: "auto" | "openai" | "local";
846
+ /**
847
+ * Host adapters may register an embedding provider scoped to this memoryDir.
848
+ * Core remains host-agnostic: when no provider is registered, the existing
849
+ * OpenAI/local fallback path is used.
850
+ */
851
+ hostEmbeddingProviderEnabled: boolean;
852
+ hostEmbeddingProviderId?: string;
853
+ hostEmbeddingProviderModel?: string;
854
+ /**
855
+ * Optional model identifier for local embedding fallback requests.
856
+ *
857
+ * Local chat/completion models and local embedding models are often
858
+ * different LM Studio/Ollama model IDs. When unset, Remnic preserves the
859
+ * legacy behavior and falls back to `localLlmModel`.
860
+ */
861
+ embeddingFallbackModel: string;
862
+ /** Optional absolute path to qmd binary. If unset, PATH/fallback discovery is used. */
863
+ qmdPath?: string;
864
+ memoryDir: string;
865
+ debug: boolean;
866
+ identityEnabled: boolean;
867
+ identityContinuityEnabled: boolean;
868
+ identityInjectionMode: IdentityInjectionMode;
869
+ identityMaxInjectChars: number;
870
+ continuityIncidentLoggingEnabled: boolean;
871
+ continuityAuditEnabled: boolean;
872
+ sessionObserverEnabled?: boolean;
873
+ sessionObserverDebounceMs?: number;
874
+ sessionObserverBands?: SessionObserverBandConfig[];
875
+ injectQuestions: boolean;
876
+ commitmentDecayDays: number;
877
+ workspaceDir: string;
878
+ captureMode: CaptureMode;
879
+ fileHygiene?: FileHygieneConfig;
880
+ nativeKnowledge?: NativeKnowledgeConfig;
881
+ agentAccessHttp: AgentAccessHttpConfig;
882
+ accessTrackingEnabled: boolean;
883
+ accessTrackingBufferMaxSize: number;
884
+ recencyWeight: number;
885
+ boostAccessCount: boolean;
886
+ /** Record empty recall impressions (memoryIds: []) when no memories are injected. Disabled by default. */
887
+ recordEmptyRecallImpressions: boolean;
888
+ queryExpansionEnabled: boolean;
889
+ queryExpansionMaxQueries: number;
890
+ /** Minimum token length to consider for query expansion. */
891
+ queryExpansionMinTokenLen: number;
892
+ rerankEnabled: boolean;
893
+ /** Rerank provider. "local" uses Local LLM only; "cloud" uses gateway fallback chain. */
894
+ rerankProvider: "local" | "cloud";
895
+ rerankMaxCandidates: number;
896
+ rerankTimeoutMs: number;
897
+ rerankCacheEnabled: boolean;
898
+ rerankCacheTtlMs: number;
899
+ feedbackEnabled: boolean;
900
+ /** If true, allow recording negative examples and apply a soft penalty during ranking. */
901
+ negativeExamplesEnabled: boolean;
902
+ /** Score penalty per "not useful" hit (typical QMD scores ~0-1). Keep small. */
903
+ negativeExamplesPenaltyPerHit: number;
904
+ /** Maximum penalty applied from negative examples. */
905
+ negativeExamplesPenaltyCap: number;
906
+ chunkingEnabled: boolean;
907
+ chunkingTargetTokens: number;
908
+ chunkingMinTokens: number;
909
+ chunkingOverlapSentences: number;
910
+ /** Enable semantic chunking with embedding-based topic boundary detection. Default: false. */
911
+ semanticChunkingEnabled: boolean;
912
+ /** Optional overrides for the semantic chunking algorithm. */
913
+ semanticChunkingConfig: Partial<SemanticChunkingConfigShape>;
914
+ contradictionDetectionEnabled: boolean;
915
+ contradictionSimilarityThreshold: number;
916
+ contradictionMinConfidence: number;
917
+ contradictionAutoResolve: boolean;
918
+ /** Nightly contradiction-scan cron config (issue #520). */
919
+ contradictionScan: ContradictionScanConfig;
920
+ /**
921
+ * When enabled, writes that carry `structuredAttributes` mark any older
922
+ * fact with the same `entityRef + attribute_name` supersession key and a
923
+ * conflicting value as `status: "superseded"`.
924
+ */
925
+ temporalSupersessionEnabled: boolean;
926
+ /**
927
+ * When enabled, superseded memories are still returned by recall (useful
928
+ * for audit/history queries). Default: false — superseded memories are
929
+ * filtered out.
930
+ */
931
+ temporalSupersessionIncludeInRecall: boolean;
932
+ /**
933
+ * When true, recall checks whether a single validated memory in a
934
+ * high-trust taxonomy bucket can answer the query before invoking QMD.
935
+ * Default false — enable explicitly after bench validation.
936
+ */
937
+ recallDirectAnswerEnabled: boolean;
938
+ /**
939
+ * Disclosure auto-escalation policy (issue #677 PR 4/4). When set to
940
+ * `"auto"`, recalls without an explicit caller-supplied disclosure
941
+ * escalate from `chunk` to `section` if the top-K confidence falls
942
+ * below {@link recallDisclosureEscalationThreshold}. `raw` is never
943
+ * auto-selected — it requires an explicit caller request. Default
944
+ * `"manual"` preserves pre-#677 behavior.
945
+ */
946
+ recallDisclosureEscalation: "manual" | "auto";
947
+ /**
948
+ * Top-K confidence threshold (in `[0, 1]`) below which auto-escalation
949
+ * promotes `chunk` → `section`. Only consulted when
950
+ * {@link recallDisclosureEscalation} is `"auto"`. Default `0.5`.
951
+ */
952
+ recallDisclosureEscalationThreshold: number;
953
+ /**
954
+ * Graph-based retrieval tier via Personalized PageRank (issue #559 PR 4).
955
+ * When true, recall builds a retrieval graph from memory frontmatter
956
+ * and runs PPR, merging the result with QMD via MMR. Default false —
957
+ * ships off pending the retrieval-graph bench in PR 5.
958
+ */
959
+ recallGraphEnabled: boolean;
960
+ /** PPR damping factor used when `recallGraphEnabled` is true. */
961
+ recallGraphDamping: number;
962
+ /** PPR power-iteration cap used when `recallGraphEnabled` is true. */
963
+ recallGraphIterations: number;
964
+ /**
965
+ * Max memories returned by the graph tier before MMR. Set to 0 to
966
+ * disable the graph tier's contribution without flipping the flag.
967
+ */
968
+ recallGraphTopK: number;
969
+ /**
970
+ * Minimum token-overlap ratio (query tokens ∩ memory tokens / query tokens)
971
+ * required for direct-answer eligibility. Set to 0 to disable the gate.
972
+ */
973
+ recallDirectAnswerTokenOverlapFloor: number;
974
+ /**
975
+ * Minimum calibrated importance score required for direct-answer
976
+ * eligibility. Set to 0 to disable the gate.
977
+ */
978
+ recallDirectAnswerImportanceFloor: number;
979
+ /**
980
+ * Ambiguity margin: if the second-best candidate scores within this
981
+ * ratio of the top candidate, direct-answer defers to the hybrid tier.
982
+ */
983
+ recallDirectAnswerAmbiguityMargin: number;
984
+ /**
985
+ * Taxonomy category IDs eligible for direct-answer routing. Memories
986
+ * whose resolved taxonomy category is not in this list never qualify.
987
+ */
988
+ recallDirectAnswerEligibleTaxonomyBuckets: string[];
989
+ /**
990
+ * Cross-namespace query-budget limiter (issue #565 PR 4/5). When true,
991
+ * a principal that issues a burst of recalls against namespaces other
992
+ * than their own is throttled once its per-window count crosses
993
+ * `recallCrossNamespaceBudgetHardLimit`. Default false — ships disabled.
994
+ */
995
+ recallCrossNamespaceBudgetEnabled: boolean;
996
+ /** Rolling window in milliseconds over which cross-namespace reads are counted. */
997
+ recallCrossNamespaceBudgetWindowMs: number;
998
+ /**
999
+ * Soft threshold — the first point at which the limiter flags a burst.
1000
+ * Calls are still allowed; anomaly detection (issue #565 PR 5) will
1001
+ * surface the warning.
1002
+ */
1003
+ recallCrossNamespaceBudgetSoftLimit: number;
1004
+ /** Hard threshold — calls past this count are denied in the window. */
1005
+ recallCrossNamespaceBudgetHardLimit: number;
1006
+ /**
1007
+ * When true, recall multiplies candidate scores by the Memory Worth
1008
+ * factor computed from `mw_success` / `mw_fail` counters on each
1009
+ * memory's frontmatter (see `computeMemoryWorth`). Memories with a
1010
+ * history of failed sessions sink; neutral / uninstrumented memories
1011
+ * are untouched (multiplier 1.0). Default false — flip to true in PR 5
1012
+ * once the benchmark shows precision tie-or-win.
1013
+ */
1014
+ recallMemoryWorthFilterEnabled: boolean;
1015
+ /**
1016
+ * Recall-audit anomaly detector (issue #565 PR 5/5). When true,
1017
+ * access surfaces run the anomaly detector over a tail of the audit
1018
+ * trail after each recall and surface any flags via logs / metrics.
1019
+ * Ships disabled.
1020
+ */
1021
+ recallAuditAnomalyDetectionEnabled: boolean;
1022
+ /** Rolling window over which audit entries are analyzed. */
1023
+ recallAuditAnomalyWindowMs: number;
1024
+ /** Threshold for the `repeat-query` flag. */
1025
+ recallAuditAnomalyRepeatQueryLimit: number;
1026
+ /** Threshold for the `namespace-walk` flag (distinct namespaces). */
1027
+ recallAuditAnomalyNamespaceWalkLimit: number;
1028
+ /** Threshold for the `high-cardinality-return` flag. */
1029
+ recallAuditAnomalyHighCardinalityLimit: number;
1030
+ /** Threshold for the `rapid-fire` flag. */
1031
+ recallAuditAnomalyRapidFireLimit: number;
1032
+ /**
1033
+ * Optional half-life for Memory Worth decay, in milliseconds. When
1034
+ * positive, older outcome observations are exponentially decayed toward
1035
+ * the uniform prior. Set to 0 (default) to disable decay and use raw
1036
+ * counter values.
1037
+ */
1038
+ recallMemoryWorthHalfLifeMs: number;
1039
+ memoryLinkingEnabled: boolean;
1040
+ threadingEnabled: boolean;
1041
+ threadingGapMinutes: number;
1042
+ summarizationEnabled: boolean;
1043
+ summarizationTriggerCount: number;
1044
+ summarizationRecentToKeep: number;
1045
+ summarizationImportanceThreshold: number;
1046
+ summarizationProtectedTags: string[];
1047
+ topicExtractionEnabled: boolean;
1048
+ topicExtractionTopN: number;
1049
+ transcriptEnabled: boolean;
1050
+ transcriptRetentionDays: number;
1051
+ /** Channel types to skip from transcript logging (e.g., ["cron"]) */
1052
+ transcriptSkipChannelTypes: string[];
1053
+ transcriptRecallHours: number;
1054
+ maxTranscriptTurns: number;
1055
+ maxTranscriptTokens: number;
1056
+ checkpointEnabled: boolean;
1057
+ checkpointTurns: number;
1058
+ compactionResetEnabled: boolean;
1059
+ beforeResetTimeoutMs: number;
1060
+ initGateTimeoutMs: number;
1061
+ flushOnResetEnabled: boolean;
1062
+ commandsListEnabled: boolean;
1063
+ openclawToolsEnabled: boolean;
1064
+ openclawToolSnippetMaxChars: number;
1065
+ openclawMessageReceivedCaptureEnabled: boolean;
1066
+ openclawReplyMetadataCaptureEnabled: boolean;
1067
+ openclawReplyMetadataExtractionHintsEnabled: boolean;
1068
+ openclawChannelEnvelopeCleaningEnabled: boolean;
1069
+ sessionTogglesEnabled: boolean;
1070
+ verboseRecallVisibility: boolean;
1071
+ recallTranscriptsEnabled: boolean;
1072
+ recallTranscriptRetentionDays: number;
1073
+ respectBundledActiveMemoryToggle: boolean;
1074
+ activeRecallEnabled: boolean;
1075
+ activeRecallAgents: string[] | null;
1076
+ activeRecallAllowedChatTypes: ActiveRecallChatType[];
1077
+ activeRecallQueryMode: ActiveRecallQueryMode;
1078
+ activeRecallPromptStyle: ActiveRecallPromptStyle;
1079
+ activeRecallCustomInstruction: string | null;
1080
+ activeRecallPromptAppend: string | null;
1081
+ activeRecallMaxSummaryChars: number;
1082
+ activeRecallRecentUserTurns: number;
1083
+ activeRecallRecentAssistantTurns: number;
1084
+ activeRecallRecentUserChars: number;
1085
+ activeRecallRecentAssistantChars: number;
1086
+ activeRecallThinking: ActiveRecallThinking;
1087
+ activeRecallTimeoutMs: number;
1088
+ activeRecallCacheTtlMs: number;
1089
+ activeRecallModel: string | null;
1090
+ activeRecallModelFallbackPolicy: ActiveRecallModelFallbackPolicy;
1091
+ activeRecallPersistTranscripts: boolean;
1092
+ activeRecallTranscriptDir: string;
1093
+ activeRecallEntityGraphDepth: number;
1094
+ activeRecallIncludeCausalTrajectories: boolean;
1095
+ activeRecallIncludeDaySummary: boolean;
1096
+ activeRecallAttachRecallExplain: boolean;
1097
+ activeRecallAllowChainedActiveMemory: boolean;
1098
+ dreaming: DreamingConfig;
1099
+ /**
1100
+ * Unified dreams-phases config block (issue #678 PR 2/4).
1101
+ * Groups existing lifecycle, REM, and deep-sleep gates under one namespace.
1102
+ * Values here WIN over equivalent legacy top-level keys when set. See docs/dreams.md.
1103
+ */
1104
+ dreamsPhases: DreamsPhasesConfig;
1105
+ procedural: ProceduralConfig;
1106
+ /**
1107
+ * Wearable transcript ingestion (Limitless / Bee / Omi connectors).
1108
+ * Disabled by default; see docs/wearables.md.
1109
+ */
1110
+ wearables: WearablesConfig;
1111
+ /**
1112
+ * At-rest encryption configuration (issue #690 PR 3/4).
1113
+ *
1114
+ * When `secureStoreEnabled` is true, `StorageManager` reads and
1115
+ * writes memory files through the `secure-fs` encryption layer.
1116
+ * The store must be unlocked via `remnic secure-store unlock` before
1117
+ * any recall or store operations will succeed.
1118
+ *
1119
+ * When `secureStoreEncryptOnWrite` is true (the default when enabled),
1120
+ * every new memory write is encrypted. Set to false to pause new
1121
+ * encryptions while still being able to decrypt existing files.
1122
+ */
1123
+ secureStoreEnabled: boolean;
1124
+ /** Encrypt new writes when the secure-store is unlocked. Default true. */
1125
+ secureStoreEncryptOnWrite: boolean;
1126
+ codingMode: CodingModeConfig;
1127
+ heartbeat: HeartbeatConfig;
1128
+ slotBehavior: SlotBehaviorConfig;
1129
+ codexCompat: CodexCompatConfig;
1130
+ /**
1131
+ * When true (default), the extraction prompt instructs the LLM to classify
1132
+ * each fact as `"project"` or `"global"` scope. Global-scoped facts are
1133
+ * promoted to the shared namespace so they are visible across all projects.
1134
+ * When false, all facts go to whatever namespace the session is in (pre-
1135
+ * scope-classification behavior). Rule 30: configuration gate.
1136
+ */
1137
+ extractionScopeClassificationEnabled: boolean;
1138
+ /** Enable the LLM-as-judge fact-worthiness gate on extracted facts. Default false (opt-in). */
1139
+ extractionJudgeEnabled: boolean;
1140
+ /** Model override for the judge LLM. Empty string means use the local model. */
1141
+ extractionJudgeModel: string;
1142
+ /** Maximum number of candidate facts per judge LLM batch call. */
1143
+ extractionJudgeBatchSize: number;
1144
+ /** Shadow mode: log judge verdicts but do not filter facts. Default false. */
1145
+ extractionJudgeShadow: boolean;
1146
+ /**
1147
+ * Maximum number of times the same candidate text may be deferred before
1148
+ * the judge forcibly converts the verdict to `"reject"`. Prevents
1149
+ * pathological LLM responses from looping forever on ambiguous facts.
1150
+ * Defaults to 2 (issue #562, PR 2).
1151
+ */
1152
+ extractionJudgeMaxDeferrals: number;
1153
+ /**
1154
+ * Emit structured telemetry rows to
1155
+ * `state/observation-ledger/extraction-judge-verdicts.jsonl` on every
1156
+ * judge verdict. Off by default; enable to collect defer-rate / latency
1157
+ * metrics for operator dashboards (issue #562, PR 3).
1158
+ */
1159
+ extractionJudgeTelemetryEnabled: boolean;
1160
+ /**
1161
+ * Collect `(candidate_text, verdict_kind, reason)` tuples into
1162
+ * `~/.remnic/judge-training/<date>.jsonl` for use by a future GRPO
1163
+ * training pipeline (issue #562, PR 4). Off by default. Rows live in
1164
+ * the user's home directory rather than the shared memory directory so
1165
+ * they are not committed, sync'd, or bundled into memory exports.
1166
+ */
1167
+ collectJudgeTrainingPairs: boolean;
1168
+ /**
1169
+ * Override directory for judge training-pair collection. Empty string
1170
+ * means use the default (`~/.remnic/judge-training`). Primarily for
1171
+ * tests and for operators who want the output to land in a specific
1172
+ * location.
1173
+ */
1174
+ judgeTrainingDir: string;
1175
+ hourlySummariesEnabled: boolean;
1176
+ daySummaryEnabled: boolean;
1177
+ /** If true, Engram may attempt to auto-register an hourly summary cron job (default off). */
1178
+ hourlySummaryCronAutoRegister: boolean;
1179
+ /** If true, Engram may attempt to auto-register the nightly governance cron job (default off). */
1180
+ nightlyGovernanceCronAutoRegister: boolean;
1181
+ summaryRecallHours: number;
1182
+ maxSummaryCount: number;
1183
+ summaryModel: string;
1184
+ hourlySummariesExtendedEnabled: boolean;
1185
+ hourlySummariesIncludeToolStats: boolean;
1186
+ hourlySummariesIncludeSystemMessages: boolean;
1187
+ hourlySummariesMaxTurnsPerRun: number;
1188
+ conversationIndexEnabled: boolean;
1189
+ conversationIndexBackend: "qmd" | "faiss";
1190
+ conversationIndexQmdCollection: string;
1191
+ conversationIndexRetentionDays: number;
1192
+ conversationIndexMinUpdateIntervalMs: number;
1193
+ conversationIndexEmbedOnUpdate: boolean;
1194
+ conversationIndexFaissScriptPath?: string;
1195
+ conversationIndexFaissPythonBin?: string;
1196
+ conversationIndexFaissModelId: string;
1197
+ conversationIndexFaissIndexDir: string;
1198
+ conversationIndexFaissUpsertTimeoutMs: number;
1199
+ conversationIndexFaissSearchTimeoutMs: number;
1200
+ conversationIndexFaissHealthTimeoutMs: number;
1201
+ conversationIndexFaissMaxBatchSize: number;
1202
+ conversationIndexFaissMaxSearchK: number;
1203
+ conversationRecallTopK: number;
1204
+ conversationRecallMaxChars: number;
1205
+ conversationRecallTimeoutMs: number;
1206
+ evalHarnessEnabled: boolean;
1207
+ evalShadowModeEnabled: boolean;
1208
+ benchmarkBaselineSnapshotsEnabled: boolean;
1209
+ benchmarkDeltaReporterEnabled: boolean;
1210
+ benchmarkStoredBaselineEnabled: boolean;
1211
+ evalStoreDir: string;
1212
+ objectiveStateMemoryEnabled: boolean;
1213
+ objectiveStateSnapshotWritesEnabled: boolean;
1214
+ objectiveStateRecallEnabled: boolean;
1215
+ objectiveStateStoreDir: string;
1216
+ causalTrajectoryMemoryEnabled: boolean;
1217
+ causalTrajectoryStoreDir: string;
1218
+ causalTrajectoryRecallEnabled: boolean;
1219
+ actionGraphRecallEnabled: boolean;
1220
+ trustZonesEnabled: boolean;
1221
+ quarantinePromotionEnabled: boolean;
1222
+ trustZoneStoreDir: string;
1223
+ trustZoneRecallEnabled: boolean;
1224
+ memoryPoisoningDefenseEnabled: boolean;
1225
+ memoryRedTeamBenchEnabled: boolean;
1226
+ harmonicRetrievalEnabled: boolean;
1227
+ abstractionAnchorsEnabled: boolean;
1228
+ abstractionNodeStoreDir: string;
1229
+ verifiedRecallEnabled: boolean;
1230
+ semanticRulePromotionEnabled: boolean;
1231
+ semanticRuleVerificationEnabled: boolean;
1232
+ semanticConsolidationEnabled: boolean;
1233
+ semanticConsolidationModel: string;
1234
+ semanticConsolidationThreshold: number;
1235
+ semanticConsolidationMinClusterSize: number;
1236
+ semanticConsolidationExcludeCategories: string[];
1237
+ semanticConsolidationIntervalHours: number;
1238
+ semanticConsolidationMaxPerRun: number;
1239
+ /**
1240
+ * When true (default), semantic-consolidation prompts the LLM with an
1241
+ * operator-aware format asking for JSON `{operator, output}` and records
1242
+ * the resulting SPLIT/MERGE/UPDATE operator on `derived_via`. When
1243
+ * false, falls back to the legacy plain-text prompt — `derived_via` is
1244
+ * still populated via the cluster-shape heuristic in
1245
+ * `chooseConsolidationOperator`. Issue #561 PR 3.
1246
+ */
1247
+ operatorAwareConsolidationEnabled: boolean;
1248
+ /**
1249
+ * When true, the pattern-reinforcement maintenance job runs on its
1250
+ * configured cadence and clusters duplicate non-procedural memories
1251
+ * by normalized content. Clusters with `>= patternReinforcementMinCount`
1252
+ * members produce a canonical (most-recent) memory tagged with
1253
+ * `reinforcement_count` + `last_reinforced_at`; the older duplicates
1254
+ * are marked `superseded` and pointed at the canonical. Default
1255
+ * `false` — opt-in until bench validation lands.
1256
+ */
1257
+ patternReinforcementEnabled: boolean;
1258
+ /**
1259
+ * Minimum interval (ms) between pattern-reinforcement runs. Default
1260
+ * `7 * 24 * 60 * 60 * 1000` (7 days). Set to `0` to disable cadence
1261
+ * gating (useful for tests / manual invocation).
1262
+ */
1263
+ patternReinforcementCadenceMs: number;
1264
+ /**
1265
+ * Minimum cluster size before pattern reinforcement promotes a
1266
+ * canonical and supersedes duplicates. Default `3`. Clamped to
1267
+ * `>= 2` at config-parse time — a "cluster of 1" is just a single
1268
+ * memory and a "cluster of 0" is meaningless.
1269
+ */
1270
+ patternReinforcementMinCount: number;
1271
+ /**
1272
+ * Memory categories the pattern-reinforcement job considers.
1273
+ * Default `["preference", "fact", "decision"]`. The job
1274
+ * intentionally skips procedural memories so it stays disjoint from
1275
+ * the procedural mining pipeline.
1276
+ */
1277
+ patternReinforcementCategories: string[];
1278
+ /** issue #687 PR 3/4: opt-in recall score boost for reinforced memories. Default false. */
1279
+ reinforcementRecallBoostEnabled: boolean;
1280
+ /** Score bonus per unit of reinforcement_count. Range [0, 1]. Default 0.05. */
1281
+ reinforcementRecallBoostWeight: number;
1282
+ /** Maximum additive reinforcement boost per result. Range [0, 1]. Default 0.3. */
1283
+ reinforcementRecallBoostMax: number;
1284
+ /**
1285
+ * Async peer profile reasoner — issue #679 PR 2/5.
1286
+ *
1287
+ * Default `false` (opt-in). When enabled, the reasoner runs after
1288
+ * `runSemanticConsolidation` (the REM phase of the dreams pipeline)
1289
+ * and updates per-peer profile.md files with provenance-tagged
1290
+ * field updates derived from the peer's interaction log.
1291
+ */
1292
+ peerProfileReasonerEnabled: boolean;
1293
+ /**
1294
+ * Model identifier used by the peer profile reasoner. Logged for
1295
+ * telemetry only — actual dispatch is via the same FallbackLlmClient
1296
+ * the orchestrator uses for semantic consolidation. Default `gpt-5.5`.
1297
+ */
1298
+ peerProfileReasonerModel: string;
1299
+ /**
1300
+ * Minimum new interaction-log entries a peer must accumulate since
1301
+ * the previous reasoner run before being processed again. Default 5.
1302
+ * Setting to 0 forces every run to consider every peer.
1303
+ */
1304
+ peerProfileReasonerMinInteractions: number;
1305
+ /**
1306
+ * Hard cap on the total number of profile fields the reasoner will
1307
+ * apply across all peers in a single run. Default 8.
1308
+ */
1309
+ peerProfileReasonerMaxFieldsPerRun: number;
1310
+ /**
1311
+ * When true, inject the active peer's profile fields into the recall
1312
+ * context as a "## Peer Profile" section. Default false (opt-in,
1313
+ * Gotcha #30/#48 — least-privileged default). Requires the session's
1314
+ * peer ID to be registered via `setPeerIdForSession` before recall.
1315
+ */
1316
+ peerProfileRecallEnabled: boolean;
1317
+ /**
1318
+ * Maximum number of peer profile fields to inject per recall. Only
1319
+ * the most-recently-updated N fields are included to keep the context
1320
+ * budget predictable. Default 5. Setting to 0 disables field
1321
+ * injection even when `peerProfileRecallEnabled` is true.
1322
+ */
1323
+ peerProfileRecallMaxFields: number;
1324
+ creationMemoryEnabled: boolean;
1325
+ memoryUtilityLearningEnabled: boolean;
1326
+ promotionByOutcomeEnabled: boolean;
1327
+ commitmentLedgerEnabled: boolean;
1328
+ commitmentLifecycleEnabled: boolean;
1329
+ commitmentStaleDays: number;
1330
+ commitmentLedgerDir: string;
1331
+ resumeBundlesEnabled: boolean;
1332
+ resumeBundleDir: string;
1333
+ workProductRecallEnabled: boolean;
1334
+ workProductLedgerDir: string;
1335
+ workTasksEnabled: boolean;
1336
+ workProjectsEnabled: boolean;
1337
+ workTasksDir: string;
1338
+ workProjectsDir: string;
1339
+ workIndexEnabled: boolean;
1340
+ workIndexDir: string;
1341
+ workTaskIndexEnabled: boolean;
1342
+ workProjectIndexEnabled: boolean;
1343
+ workIndexAutoRebuildEnabled: boolean;
1344
+ workIndexAutoRebuildDebounceMs: number;
1345
+ localLlmEnabled: boolean;
1346
+ localLlmUrl: string;
1347
+ localLlmModel: string;
1348
+ /** Optional API key for authenticated OpenAI-compatible endpoints. */
1349
+ localLlmApiKey?: string;
1350
+ /** Additional headers for local/compatible endpoint requests. */
1351
+ localLlmHeaders?: Record<string, string>;
1352
+ /** If false, do not send Authorization header even when localLlmApiKey is set. */
1353
+ localLlmAuthHeader: boolean;
1354
+ localLlmFallback: boolean;
1355
+ /** Optional home directory override for local LLM helpers (LM Studio settings, CLI PATH). */
1356
+ localLlmHomeDir?: string;
1357
+ /** Optional absolute path to LMS CLI binary (preferred over auto-detection). */
1358
+ localLmsCliPath?: string;
1359
+ /** Optional bin directory prepended to PATH for LMS CLI execution. */
1360
+ localLmsBinDir?: string;
1361
+ /** Hard timeout for local LLM and gateway fallback requests (ms). */
1362
+ localLlmTimeoutMs: number;
1363
+ /** Max context window for local LLM (override auto-detection). Set lower if your LLM server defaults to smaller contexts. */
1364
+ localLlmMaxContext?: number;
1365
+ /** If true, log slow operations (local LLM + related I/O) with durations and metadata (no content). */
1366
+ slowLogEnabled: boolean;
1367
+ /**
1368
+ * If true, include the full recalled memory text in `RecallTraceEvent.recalledContent`.
1369
+ * Disabled by default — enable only when you want external trace subscribers (e.g. Langfuse)
1370
+ * to see the exact memory context injected into each conversation turn.
1371
+ * This adds payload to trace events but does not log to files or the gateway log.
1372
+ */
1373
+ traceRecallContent: boolean;
1374
+ /** Threshold for slow operation logging (ms). */
1375
+ slowLogThresholdMs: number;
1376
+ /** If true, collect and persist timing traces for recall and extraction pipelines. */
1377
+ profilingEnabled: boolean;
1378
+ /** Directory for profiling trace JSONL files. Defaults to <memoryDir>/profiling. */
1379
+ profilingStorageDir: string;
1380
+ /** Maximum number of trace files to keep (rolling window). */
1381
+ profilingMaxTraces: number;
1382
+ extractionDedupeEnabled: boolean;
1383
+ extractionDedupeWindowMs: number;
1384
+ extractionMinChars: number;
1385
+ extractionMinUserTurns: number;
1386
+ /**
1387
+ * When true, skip semantic memory extraction for mechanical action/state
1388
+ * telemetry transcripts that have no durable-memory cue. Raw transcript
1389
+ * storage/recall still runs; this only prevents expensive low-value fact
1390
+ * extraction over state logs. Default true.
1391
+ */
1392
+ extractionTelemetryPrefilterEnabled: boolean;
1393
+ /**
1394
+ * When true, LCM uses deterministic compression instead of semantic LLM
1395
+ * summarization for mechanical action/state telemetry transcripts with no
1396
+ * durable-memory cue. Raw transcript storage/recall still runs. Default true.
1397
+ */
1398
+ lcmTelemetryPrefilterEnabled: boolean;
1399
+ extractionMaxTurnChars: number;
1400
+ extractionMaxFactsPerRun: number;
1401
+ extractionMaxEntitiesPerRun: number;
1402
+ extractionMaxQuestionsPerRun: number;
1403
+ extractionMaxProfileUpdatesPerRun: number;
1404
+ /**
1405
+ * Minimum importance level required to persist an extracted fact. Facts
1406
+ * whose locally-scored level falls below this threshold are dropped before
1407
+ * write and counted toward the `importance_gated` metric. Defaults to
1408
+ * "low" so trivial content (greetings, single-word replies, filler) is
1409
+ * silently dropped while everything else still passes.
1410
+ */
1411
+ extractionMinImportanceLevel: ImportanceLevel;
1412
+ /**
1413
+ * Inline source attribution (issue #369).
1414
+ * When enabled, extracted facts carry a compact provenance tag (agent,
1415
+ * session, timestamp) inlined into the fact text — not just in YAML
1416
+ * frontmatter — so the citation survives hostile memory text, copy/paste,
1417
+ * and LLM quoting. Off by default to preserve backwards compatibility
1418
+ * with existing downstream consumers that expect raw fact text.
1419
+ */
1420
+ inlineSourceAttributionEnabled: boolean;
1421
+ /**
1422
+ * Template used when injecting inline citations. Supported placeholders:
1423
+ * `{agent}`, `{session}`, `{sessionId}`, `{ts}`, `{date}`. Defaults to
1424
+ * `[Source: agent={agent}, session={sessionId}, ts={ts}]`.
1425
+ */
1426
+ inlineSourceAttributionFormat: string;
1427
+ consolidationRequireNonZeroExtraction: boolean;
1428
+ consolidationMinIntervalMs: number;
1429
+ qmdMaintenanceEnabled: boolean;
1430
+ qmdMaintenanceDebounceMs: number;
1431
+ qmdAutoEmbedEnabled: boolean;
1432
+ qmdEmbedMinIntervalMs: number;
1433
+ qmdUpdateTimeoutMs: number;
1434
+ qmdUpdateMinIntervalMs: number;
1435
+ localLlmRetry5xxCount: number;
1436
+ localLlmRetryBackoffMs: number;
1437
+ localLlm400TripThreshold: number;
1438
+ localLlm400CooldownMs: number;
1439
+ localLlmFastEnabled: boolean;
1440
+ localLlmFastModel: string;
1441
+ localLlmFastUrl: string;
1442
+ localLlmFastTimeoutMs: number;
1443
+ /**
1444
+ * Suppress chain-of-thought / thinking mode on the main local LLM
1445
+ * (issue #548). When true, Remnic injects
1446
+ * `chat_template_kwargs: { enable_thinking: false }` on every
1447
+ * request so thinking-capable models (Qwen 3.5, Gemma 4, DeepSeek,
1448
+ * etc.) skip reasoning tokens that structured-output tasks like
1449
+ * extraction and consolidation cannot benefit from. Default: true
1450
+ * — the dominant localLlm use case is JSON-shaped extraction where
1451
+ * thinking is pure latency tax and a common cause of 60s timeouts.
1452
+ * Set to false to restore thinking for narrative tasks.
1453
+ *
1454
+ * The fast-tier client (`fastLlm`) always disables thinking; that
1455
+ * contract is baked into "fast tier" and is unaffected by this flag.
1456
+ */
1457
+ localLlmDisableThinking: boolean;
1458
+ gatewayConfig?: GatewayConfig;
1459
+ /**
1460
+ * Optional host-supplied resolver for provider API keys. Core never discovers
1461
+ * host runtimes directly; adapters inject their native secret resolver here.
1462
+ */
1463
+ providerApiKeyResolver?: (params: {
1464
+ provider: string;
1465
+ cfg?: unknown;
1466
+ agentDir?: string;
1467
+ }) => Promise<{
1468
+ apiKey?: string;
1469
+ source?: string;
1470
+ mode?: string;
1471
+ } | null>;
1472
+ /**
1473
+ * Optional host-supplied resolver for request-ready model auth, including
1474
+ * provider transforms such as OAuth token exchange or base URL overrides.
1475
+ */
1476
+ runtimeAuthForModelResolver?: (params: {
1477
+ model: {
1478
+ provider: string;
1479
+ id: string;
1480
+ api?: string;
1481
+ baseUrl?: string;
1482
+ };
1483
+ cfg?: unknown;
1484
+ workspaceDir?: string;
1485
+ }) => Promise<{
1486
+ apiKey?: string;
1487
+ baseUrl?: string;
1488
+ source?: string;
1489
+ mode?: string;
1490
+ profileId?: string;
1491
+ } | null>;
1492
+ modelSource: "plugin" | "gateway";
1493
+ gatewayAgentId: string;
1494
+ fastGatewayAgentId: string;
1495
+ /**
1496
+ * Optional task-specific model chain for Remnic's background LLM work —
1497
+ * extraction, the extraction judge, fact/profile/identity consolidation,
1498
+ * summarization, semantic consolidation, calibration, and causal
1499
+ * consolidation. When set, this chain is resolved through gateway providers
1500
+ * instead of using gatewayAgentId or agents.defaults.model. All task paths
1501
+ * route through the shared `gatewayTaskChainOptions` helper.
1502
+ *
1503
+ * Only takes effect when `modelSource: "gateway"`; ignored (with a startup
1504
+ * warning) under `modelSource: "plugin"`. See issue #1365 / PR #1370.
1505
+ */
1506
+ taskModelChain?: AgentPersonaModelConfig;
1507
+ namespacesEnabled: boolean;
1508
+ defaultNamespace: string;
1509
+ sharedNamespace: string;
1510
+ principalFromSessionKeyMode: PrincipalFromSessionKeyMode;
1511
+ principalFromSessionKeyRules: PrincipalRule[];
1512
+ namespacePolicies: NamespacePolicy[];
1513
+ defaultRecallNamespaces: Array<"self" | "shared">;
1514
+ cronRecallMode: CronRecallMode;
1515
+ cronRecallAllowlist: string[];
1516
+ cronRecallPolicyEnabled: boolean;
1517
+ cronRecallNormalizedQueryMaxChars: number;
1518
+ cronRecallInstructionHeavyTokenCap: number;
1519
+ cronConversationRecallMode: CronConversationRecallMode;
1520
+ autoPromoteToSharedEnabled: boolean;
1521
+ autoPromoteToSharedCategories: Array<"fact" | "correction" | "decision" | "preference">;
1522
+ autoPromoteMinConfidenceTier: ConfidenceTier;
1523
+ routingRulesEnabled: boolean;
1524
+ routingRulesStateFile: string;
1525
+ sharedContextEnabled: boolean;
1526
+ sharedContextDir?: string;
1527
+ sharedContextMaxInjectChars: number;
1528
+ crossSignalsSemanticEnabled: boolean;
1529
+ crossSignalsSemanticTimeoutMs: number;
1530
+ sharedCrossSignalSemanticEnabled?: boolean;
1531
+ sharedCrossSignalSemanticTimeoutMs?: number;
1532
+ sharedCrossSignalSemanticMaxCandidates?: number;
1533
+ compoundingEnabled: boolean;
1534
+ compoundingWeeklyCronEnabled: boolean;
1535
+ compoundingSemanticEnabled: boolean;
1536
+ compoundingSynthesisTimeoutMs: number;
1537
+ compoundingInjectEnabled: boolean;
1538
+ ircEnabled: boolean;
1539
+ ircMaxPreferences: number;
1540
+ ircIncludeCorrections: boolean;
1541
+ ircMinConfidence: number;
1542
+ cmcEnabled: boolean;
1543
+ cmcStitchLookbackDays: number;
1544
+ cmcStitchMinScore: number;
1545
+ cmcStitchMaxEdgesPerTrajectory: number;
1546
+ cmcConsolidationEnabled: boolean;
1547
+ cmcConsolidationMinRecurrence: number;
1548
+ cmcConsolidationMinSessions: number;
1549
+ cmcConsolidationSuccessThreshold: number;
1550
+ cmcRetrievalEnabled: boolean;
1551
+ cmcRetrievalMaxDepth: number;
1552
+ cmcRetrievalMaxChars: number;
1553
+ cmcRetrievalCounterfactualBoost: number;
1554
+ cmcBehaviorLearningEnabled: boolean;
1555
+ cmcBehaviorMinFrequency: number;
1556
+ cmcBehaviorMinSessions: number;
1557
+ cmcBehaviorConfidenceThreshold: number;
1558
+ cmcLifecycleCausalImpactWeight: number;
1559
+ calibrationEnabled: boolean;
1560
+ calibrationMaxRulesPerRecall: number;
1561
+ calibrationMaxChars: number;
1562
+ searchBackend?: "qmd" | "remote" | "noop" | "lancedb" | "meilisearch" | "orama";
1563
+ remoteSearchBaseUrl?: string;
1564
+ remoteSearchApiKey?: string;
1565
+ remoteSearchTimeoutMs?: number;
1566
+ lancedbEnabled: boolean;
1567
+ lanceDbPath?: string;
1568
+ lanceEmbeddingDimension?: number;
1569
+ meilisearchEnabled: boolean;
1570
+ meilisearchHost?: string;
1571
+ meilisearchApiKey?: string;
1572
+ meilisearchTimeoutMs?: number;
1573
+ meilisearchAutoIndex?: boolean;
1574
+ oramaEnabled: boolean;
1575
+ oramaDbPath?: string;
1576
+ oramaEmbeddingDimension?: number;
1577
+ qmdDaemonEnabled: boolean;
1578
+ qmdDaemonUrl: string;
1579
+ qmdDaemonRecheckIntervalMs: number;
1580
+ qmdIntentHintsEnabled: boolean;
1581
+ qmdExplainEnabled: boolean;
1582
+ knowledgeIndexEnabled: boolean;
1583
+ knowledgeIndexMaxEntities: number;
1584
+ knowledgeIndexMaxChars: number;
1585
+ entityRetrievalEnabled: boolean;
1586
+ entityRetrievalMaxChars: number;
1587
+ entityRetrievalMaxHints: number;
1588
+ entityRetrievalMaxSupportingFacts: number;
1589
+ entityRetrievalMaxRelatedEntities: number;
1590
+ entityRetrievalRecentTurns: number;
1591
+ entitySchemas?: Record<string, EntitySchemaDefinition>;
1592
+ recallBudgetChars: number;
1593
+ recallOuterTimeoutMs: number;
1594
+ recallCoreDeadlineMs: number;
1595
+ recallEnrichmentDeadlineMs: number;
1596
+ recallPipeline: RecallSectionConfig[];
1597
+ /** Apply Maximal Marginal Relevance to the final recall selection per-section. */
1598
+ recallMmrEnabled: boolean;
1599
+ /** MMR λ parameter. 1.0 = pure relevance, 0.0 = pure diversity. Default 0.7. */
1600
+ recallMmrLambda: number;
1601
+ /** MMR is applied over the top N candidates per section. Default 40. */
1602
+ recallMmrTopN: number;
1603
+ /**
1604
+ * Boost stored `reasoning_trace` memories in recall results when the
1605
+ * incoming query reads like a problem-solving ask (e.g. "how do I…",
1606
+ * "step by step", "walk me through…"). Default false — opt in after
1607
+ * benchmarking (issue #564 PR 3).
1608
+ */
1609
+ recallReasoningTraceBoostEnabled: boolean;
1610
+ qmdRecallCacheTtlMs: number;
1611
+ qmdRecallCacheStaleTtlMs: number;
1612
+ qmdRecallCacheMaxEntries: number;
1613
+ entityRelationshipsEnabled: boolean;
1614
+ entityActivityLogEnabled: boolean;
1615
+ entityActivityLogMaxEntries: number;
1616
+ entityAliasesEnabled: boolean;
1617
+ entitySummaryEnabled: boolean;
1618
+ entitySynthesisMaxTokens: number;
1619
+ /** Enable content-hash deduplication to prevent storing semantically identical facts. */
1620
+ factDeduplicationEnabled: boolean;
1621
+ /**
1622
+ * Issue #373 — Write-time semantic similarity guard. When enabled (default),
1623
+ * the orchestrator embeds each candidate fact and queries the existing
1624
+ * embedding index for its top-K nearest neighbors. If the best cosine
1625
+ * similarity is at or above `semanticDedupThreshold`, the fact is dropped
1626
+ * as a near-duplicate. Fails open (keeps the fact) if the embedding backend
1627
+ * is unavailable.
1628
+ */
1629
+ semanticDedupEnabled: boolean;
1630
+ /** Cosine similarity threshold in [0, 1] above which a candidate fact is skipped. */
1631
+ semanticDedupThreshold: number;
1632
+ /** Number of nearest-neighbor candidates to consider during semantic dedup. */
1633
+ semanticDedupCandidates: number;
1634
+ /** Enable automatic archival of old, low-importance, rarely-accessed facts. */
1635
+ factArchivalEnabled: boolean;
1636
+ /** Minimum age in days before a fact is eligible for archival. */
1637
+ factArchivalAgeDays: number;
1638
+ /** Maximum importance score for archival eligibility (0-1). Only facts below this are archived. */
1639
+ factArchivalMaxImportance: number;
1640
+ /** Maximum access count for archival eligibility. Only rarely-accessed facts are archived. */
1641
+ factArchivalMaxAccessCount: number;
1642
+ /** Tags that protect a fact from archival regardless of other criteria. */
1643
+ factArchivalProtectedCategories: string[];
1644
+ lifecyclePolicyEnabled: boolean;
1645
+ lifecycleFilterStaleEnabled: boolean;
1646
+ lifecyclePromoteHeatThreshold: number;
1647
+ lifecycleStaleDecayThreshold: number;
1648
+ lifecycleArchiveDecayThreshold: number;
1649
+ lifecycleProtectedCategories: MemoryCategory[];
1650
+ lifecycleMetricsEnabled: boolean;
1651
+ proactiveExtractionEnabled: boolean;
1652
+ contextCompressionActionsEnabled: boolean;
1653
+ compressionGuidelineLearningEnabled: boolean;
1654
+ compressionGuidelineSemanticRefinementEnabled: boolean;
1655
+ compressionGuidelineSemanticTimeoutMs: number;
1656
+ maxProactiveQuestionsPerExtraction: number;
1657
+ proactiveExtractionTimeoutMs: number;
1658
+ proactiveExtractionMaxTokens: number;
1659
+ extractionMaxOutputTokens: number;
1660
+ proactiveExtractionCategoryAllowlist?: MemoryCategory[];
1661
+ maxCompressionTokensPerHour: number;
1662
+ behaviorLoopAutoTuneEnabled: boolean;
1663
+ behaviorLoopLearningWindowDays: number;
1664
+ behaviorLoopMinSignalCount: number;
1665
+ behaviorLoopMaxDeltaPerCycle: number;
1666
+ behaviorLoopProtectedParams: string[];
1667
+ recallPlannerEnabled: boolean;
1668
+ /**
1669
+ * Opt-in gate for LLM-based recall planning (issue #1367 / Option C). When
1670
+ * false (the default) recall mode is decided by the regex heuristic
1671
+ * `planRecallMode()`. When true, the planner consults an LLM (routed through
1672
+ * the gateway/fallback chain — provider-agnostic) and falls back to the
1673
+ * heuristic on timeout/error/unavailable. `recallPlannerShadowMode` runs the
1674
+ * LLM for telemetry only without changing the effective mode.
1675
+ */
1676
+ recallPlannerLlmEnabled: boolean;
1677
+ recallPlannerModel: string;
1678
+ recallPlannerTimeoutMs: number;
1679
+ recallPlannerUseResponsesApi: boolean;
1680
+ recallPlannerMaxPromptChars: number;
1681
+ recallPlannerMaxMemoryHints: number;
1682
+ recallPlannerShadowMode: boolean;
1683
+ recallPlannerTelemetryEnabled: boolean;
1684
+ recallPlannerMaxQmdResultsMinimal: number;
1685
+ recallPlannerMaxQmdResultsFull: number;
1686
+ intentRoutingEnabled: boolean;
1687
+ intentRoutingBoost: number;
1688
+ verbatimArtifactsEnabled: boolean;
1689
+ verbatimArtifactsMinConfidence: number;
1690
+ verbatimArtifactsMaxRecall: number;
1691
+ verbatimArtifactCategories: MemoryCategory[];
1692
+ memoryBoxesEnabled: boolean;
1693
+ /** Jaccard overlap threshold below which a topic shift triggers box sealing (0-1, default 0.35) */
1694
+ boxTopicShiftThreshold: number;
1695
+ /** Time gap in ms before an open box is sealed (default 30 min) */
1696
+ boxTimeGapMs: number;
1697
+ /** Max memories per box before forced seal */
1698
+ boxMaxMemories: number;
1699
+ traceWeaverEnabled: boolean;
1700
+ /** Days back to search for trace links */
1701
+ traceWeaverLookbackDays: number;
1702
+ /** Minimum Jaccard overlap to assign the same traceId (0-1, default 0.4) */
1703
+ traceWeaverOverlapThreshold: number;
1704
+ /** Number of recent days of boxes to inject during recall */
1705
+ boxRecallDays: number;
1706
+ /** Classify extracted memories as episode or note and tag with memoryKind */
1707
+ episodeNoteModeEnabled: boolean;
1708
+ /** Build and maintain temporal (state/index_time.json) and tag (state/index_tags.json) indexes */
1709
+ queryAwareIndexingEnabled: boolean;
1710
+ /** Max candidate paths returned from index prefilter (0 = no cap) */
1711
+ queryAwareIndexingMaxCandidates: number;
1712
+ temporalIndexWindowDays: number;
1713
+ temporalIndexMaxEntries: number;
1714
+ temporalBoostRecentDays: number;
1715
+ temporalBoostScore: number;
1716
+ temporalDecayEnabled: boolean;
1717
+ tagMemoryEnabled: boolean;
1718
+ tagMaxPerMemory: number;
1719
+ tagIndexMaxEntries: number;
1720
+ tagRecallBoost: number;
1721
+ tagRecallMaxMatches: number;
1722
+ multiGraphMemoryEnabled: boolean;
1723
+ graphRecallEnabled: boolean;
1724
+ graphRecallMaxExpansions: number;
1725
+ graphRecallMaxPerSeed: number;
1726
+ graphRecallMinEdgeWeight: number;
1727
+ graphRecallShadowEnabled: boolean;
1728
+ graphRecallSnapshotEnabled: boolean;
1729
+ graphRecallShadowSampleRate: number;
1730
+ graphRecallExplainToolEnabled: boolean;
1731
+ graphRecallStoreColdMirror: boolean;
1732
+ graphRecallColdMirrorCollection?: string;
1733
+ graphRecallColdMirrorMinAgeDays: number;
1734
+ graphRecallUseEntityPriors: boolean;
1735
+ graphRecallEntityPriorBoost: number;
1736
+ graphRecallPreferHubSeeds: boolean;
1737
+ graphRecallHubBias: number;
1738
+ graphRecallRecencyHalfLifeDays: number;
1739
+ graphRecallDampingFactor: number;
1740
+ graphRecallMaxSeedNodes: number;
1741
+ graphRecallMaxExpandedNodes: number;
1742
+ graphRecallMaxTrailPerNode: number;
1743
+ graphRecallMinSeedScore: number;
1744
+ graphRecallExpansionScoreThreshold: number;
1745
+ graphRecallExplainMaxPaths: number;
1746
+ graphRecallExplainMaxChars: number;
1747
+ graphRecallExplainEdgeLimit: number;
1748
+ graphRecallExplainEnabled: boolean;
1749
+ graphRecallEntityHintsEnabled: boolean;
1750
+ graphRecallEntityHintMax: number;
1751
+ graphRecallEntityHintMaxChars: number;
1752
+ graphRecallSnapshotDir: string;
1753
+ graphRecallEnableTrace: boolean;
1754
+ graphRecallEnableDebug: boolean;
1755
+ /** Allow graph_mode escalation for broader causal/timeline phrasing beyond strict keywords. */
1756
+ graphExpandedIntentEnabled?: boolean;
1757
+ /** Run bounded graph expansion in full mode when enough recall seeds exist. */
1758
+ graphAssistInFullModeEnabled?: boolean;
1759
+ /** In full mode, compute graph assist for telemetry/snapshotting but do not inject merged results. */
1760
+ graphAssistShadowEvalEnabled?: boolean;
1761
+ /** Minimum seed results required before full-mode graph assist runs. */
1762
+ graphAssistMinSeedResults?: number;
1763
+ entityGraphEnabled: boolean;
1764
+ timeGraphEnabled: boolean;
1765
+ /** When true, write fallback temporal adjacency edges for consecutive extracted memories. */
1766
+ graphWriteSessionAdjacencyEnabled?: boolean;
1767
+ causalGraphEnabled: boolean;
1768
+ maxGraphTraversalSteps: number;
1769
+ graphActivationDecay: number;
1770
+ /** Weight of graph activation score when blending with seed QMD score (0-1). */
1771
+ graphExpansionActivationWeight: number;
1772
+ /** Lower bound for blended graph-expanded recall scores (0-1). */
1773
+ graphExpansionBlendMin: number;
1774
+ /** Upper bound for blended graph-expanded recall scores (0-1). */
1775
+ graphExpansionBlendMax: number;
1776
+ maxEntityGraphEdgesPerMemory: number;
1777
+ /** SimpleMem-inspired de-linearization: resolve pronouns and anchor relative dates after extraction. */
1778
+ delinearizeEnabled: boolean;
1779
+ /** Synapse-inspired confidence gate — skip memory injection when top score is below threshold. */
1780
+ recallConfidenceGateEnabled: boolean;
1781
+ recallConfidenceGateThreshold: number;
1782
+ /** PlugMem-inspired causal rule extraction: mine IF→THEN rules during consolidation. */
1783
+ causalRuleExtractionEnabled: boolean;
1784
+ /** E-Mem-inspired memory reconstruction: targeted retrieval for missing entity context. */
1785
+ memoryReconstructionEnabled: boolean;
1786
+ /** Maximum number of entity expansions per recall. */
1787
+ memoryReconstructionMaxExpansions: number;
1788
+ /** Synapse-inspired lateral inhibition to suppress hub-node dominance. */
1789
+ graphLateralInhibitionEnabled: boolean;
1790
+ /** Inhibition strength (default 0.15). Higher = more suppression. */
1791
+ graphLateralInhibitionBeta: number;
1792
+ /** Number of top competing nodes considered for inhibition (default 7). */
1793
+ graphLateralInhibitionTopM: number;
1794
+ /** Enable the periodic graph-edge confidence decay job. Default false (opt-in). */
1795
+ graphEdgeDecayEnabled: boolean;
1796
+ /** Cadence in milliseconds at which the cron triggers the decay job. Default 7d. */
1797
+ graphEdgeDecayCadenceMs: number;
1798
+ /** Decay window passed through to `decayEdgeConfidence`. Default 90 days. */
1799
+ graphEdgeDecayWindowMs: number;
1800
+ /** Per-window confidence drop. Default 0.1. */
1801
+ graphEdgeDecayPerWindow: number;
1802
+ /** Floor confidence will not decay below. Default 0.1. */
1803
+ graphEdgeDecayFloor: number;
1804
+ /** Confidence threshold for the "below visibility" telemetry counter. Default 0.2. */
1805
+ graphEdgeDecayVisibilityThreshold: number;
1806
+ /**
1807
+ * Issue #681 PR 3/3 — minimum edge confidence required for an edge to be
1808
+ * traversed during spreading activation. Edges with `confidence` below this
1809
+ * floor are pruned and contribute neither activation nor downstream
1810
+ * neighbors. Legacy edges without `confidence` are treated as 1.0 so they
1811
+ * always pass the floor. Range `[0, 1]`; default `0.2`.
1812
+ */
1813
+ graphTraversalConfidenceFloor: number;
1814
+ /**
1815
+ * Issue #681 PR 3/3 — number of PageRank-style refinement iterations applied
1816
+ * on top of the BFS spreading-activation scores. Each iteration redistributes
1817
+ * a node's confidence-weighted activation along its outgoing edges. Set to 0
1818
+ * to disable refinement and use raw BFS scores. Default `8`.
1819
+ */
1820
+ graphTraversalPageRankIterations: number;
1821
+ temporalMemoryTreeEnabled: boolean;
1822
+ tmtHourlyMinMemories: number;
1823
+ tmtSummaryMaxTokens: number;
1824
+ /** Front-load exact stored evidence for query-visible cues like turns, dates, ids, files, and tools. */
1825
+ explicitCueRecallEnabled: boolean;
1826
+ /** Character budget for the explicit cue evidence section. */
1827
+ explicitCueRecallMaxChars: number;
1828
+ /** Maximum query-visible cues expanded per recall. */
1829
+ explicitCueRecallMaxReferences: number;
1830
+ /** Enable targeted fact evidence recall for direct answer questions. */
1831
+ targetedFactRecallEnabled: boolean;
1832
+ /** Character budget for the targeted fact evidence section. */
1833
+ targetedFactRecallMaxChars: number;
1834
+ /** Maximum recalled items for targeted fact evidence. */
1835
+ targetedFactRecallMaxResults: number;
1836
+ /** Recent-turn scan window for targeted fact evidence. */
1837
+ targetedFactRecallScanWindowTurns: number;
1838
+ /** Recent-token scan window for targeted fact evidence. */
1839
+ targetedFactRecallScanWindowTokens: number;
1840
+ /** Enable focused list evidence recall for count, relation, and recommendation questions. */
1841
+ focusedListRecallEnabled: boolean;
1842
+ /** Character budget for the focused list evidence section. */
1843
+ focusedListRecallMaxChars: number;
1844
+ /** Maximum recalled items for focused list evidence. */
1845
+ focusedListRecallMaxResults: number;
1846
+ /** Recent-turn scan window for focused list evidence. */
1847
+ focusedListRecallScanWindowTurns: number;
1848
+ /** Recent-token scan window for focused list evidence. */
1849
+ focusedListRecallScanWindowTokens: number;
1850
+ /** Enable response guidance recall for user answer-shape preferences. */
1851
+ responseGuidanceRecallEnabled: boolean;
1852
+ /** Character budget for the response guidance recall section. */
1853
+ responseGuidanceRecallMaxChars: number;
1854
+ /** Maximum recalled items for response guidance. */
1855
+ responseGuidanceRecallMaxResults: number;
1856
+ /** Recent-turn scan window for response guidance. */
1857
+ responseGuidanceRecallScanWindowTurns: number;
1858
+ /** Recent-token scan window for response guidance. */
1859
+ responseGuidanceRecallScanWindowTokens: number;
1860
+ /** Enable event-order evidence recall for chronology questions. */
1861
+ eventOrderRecallEnabled: boolean;
1862
+ /** Character budget for the event-order evidence section. */
1863
+ eventOrderRecallMaxChars: number;
1864
+ /** Maximum recalled items for event-order evidence. */
1865
+ eventOrderRecallMaxResults: number;
1866
+ /** Recent-turn scan window for event-order evidence. */
1867
+ eventOrderRecallScanWindowTurns: number;
1868
+ /** Recent-token scan window for event-order evidence. */
1869
+ eventOrderRecallScanWindowTokens: number;
1870
+ lcmEnabled: boolean;
1871
+ lcmLeafBatchSize: number;
1872
+ lcmRollupFanIn: number;
1873
+ lcmFreshTailTurns: number;
1874
+ lcmMaxDepth: number;
1875
+ lcmRecallBudgetShare: number;
1876
+ lcmDeterministicMaxTokens: number;
1877
+ lcmArchiveRetentionDays: number;
1878
+ /** Max independent LCM observe jobs to process concurrently. Default 1. */
1879
+ lcmObserveConcurrency: number;
1880
+ /** Opt-in structured message-part capture/recall sidecar for LCM. Default false. */
1881
+ messagePartsEnabled: boolean;
1882
+ /** Max structured file/tool matches injected into recall. */
1883
+ messagePartsRecallMaxResults: number;
1884
+ /** Enable three-agent parallel retrieval (DirectFact + Contextual + Temporal). Default false. */
1885
+ parallelRetrievalEnabled: boolean;
1886
+ /** Per-agent source weights for score blending during merge. */
1887
+ parallelAgentWeights: {
1888
+ direct: number;
1889
+ contextual: number;
1890
+ temporal: number;
1891
+ };
1892
+ /** Max results fetched per agent before merge. */
1893
+ parallelMaxResultsPerAgent: number;
1894
+ /** Briefing configuration knobs — see BriefingConfig for field docs. */
1895
+ briefing: BriefingConfig;
1896
+ codex: CodexConnectorConfig;
1897
+ connectors: LiveConnectorsConfig;
1898
+ /** Enable the MECE taxonomy knowledge directory. Default false. */
1899
+ taxonomyEnabled: boolean;
1900
+ /** Auto-regenerate RESOLVER.md when taxonomy changes. Default true. */
1901
+ taxonomyAutoGenResolver: boolean;
1902
+ /** Materialize Remnic memories into Codex's expected ~/.codex/memories/ layout. Default true. */
1903
+ codexMaterializeMemories: boolean;
1904
+ /** Namespace to materialize; "auto" derives from the connector context. Default "auto". */
1905
+ codexMaterializeNamespace: string;
1906
+ /** Max whitespace-tokenized size of memory_summary.md. Default 4500. */
1907
+ codexMaterializeMaxSummaryTokens: number;
1908
+ /** Max age in days for rollout_summaries/*.md before pruning. Default 30. */
1909
+ codexMaterializeRolloutRetentionDays: number;
1910
+ /** Run materialization after semantic/causal consolidation completes. Default true. */
1911
+ codexMaterializeOnConsolidation: boolean;
1912
+ /** Run materialization at Codex session-end hook. Default true. */
1913
+ codexMaterializeOnSessionEnd: boolean;
1914
+ /** Enable Codex marketplace integration. Default true. */
1915
+ codexMarketplaceEnabled: boolean;
1916
+ /** Enable page-level versioning with sidecar snapshots. Default false. */
1917
+ versioningEnabled: boolean;
1918
+ /** Maximum number of version snapshots to keep per page. Default 50. Set to 0 to disable pruning. */
1919
+ versioningMaxPerPage: number;
1920
+ /** Name of the sidecar directory inside memoryDir. Default ".versions". */
1921
+ versioningSidecarDir: string;
1922
+ /** Enable binary file lifecycle management (mirror, redirect, clean). Default: false. */
1923
+ binaryLifecycleEnabled: boolean;
1924
+ /** Grace period in days before a mirrored binary is eligible for local cleanup. Default: 7. */
1925
+ binaryLifecycleGracePeriodDays: number;
1926
+ /** Storage backend type: "filesystem" copies to a local dir, "none" is no-op. Default: "none". */
1927
+ binaryLifecycleBackendType: "filesystem" | "s3" | "none";
1928
+ /** Base path for the filesystem backend. Required when backendType is "filesystem". */
1929
+ binaryLifecycleBackendPath: string;
1930
+ /**
1931
+ * Advertise legacy `engram_*` / `engram.*` MCP tool aliases alongside the
1932
+ * canonical `remnic_*` names (issue #1427). Default true for backward
1933
+ * compatibility. Set false to halve the advertised MCP `tools/list` surface;
1934
+ * tools stay callable under both names regardless. Also settable via
1935
+ * `REMNIC_EMIT_LEGACY_TOOLS` (falls back to `ENGRAM_EMIT_LEGACY_TOOLS`).
1936
+ */
1937
+ emitLegacyTools: boolean;
1938
+ /** Enable oai-mem-citation blocks in recall responses. Default false. */
1939
+ citationsEnabled: boolean;
1940
+ /** Auto-enable citations when the Codex adapter is detected. Default true. */
1941
+ citationsAutoDetect: boolean;
1942
+ /** Enable the external enrichment pipeline. Default false. */
1943
+ enrichmentEnabled: boolean;
1944
+ /** Automatically enrich new entities on creation. Default false. */
1945
+ enrichmentAutoOnCreate: boolean;
1946
+ /** Max candidates accepted per entity per enrichment run. Default 20. */
1947
+ enrichmentMaxCandidatesPerEntity: number;
1948
+ /** Whether third-party memory extensions are discovered and injected into consolidation. Default true. */
1949
+ memoryExtensionsEnabled: boolean;
1950
+ /**
1951
+ * Root directory for memory extensions. Empty string means derive from
1952
+ * memoryDir: go up to the Remnic home dir and append memory_extensions.
1953
+ */
1954
+ memoryExtensionsRoot: string;
1955
+ }
1956
+ /** Runtime configuration for the daily context briefing feature. */
1957
+ interface BriefingConfig {
1958
+ /** Whether `remnic briefing` CLI and MCP tool are enabled. */
1959
+ enabled: boolean;
1960
+ /** Default lookback window token (e.g. "yesterday", "3d", "1w", "24h"). */
1961
+ defaultWindow: string;
1962
+ /** Default output format for the CLI. */
1963
+ defaultFormat: "markdown" | "json";
1964
+ /** Maximum number of LLM-generated suggested follow-ups. */
1965
+ maxFollowups: number;
1966
+ /** Optional path to an ICS or JSON calendar file. null disables the section. */
1967
+ calendarSource: string | null;
1968
+ /** If true, CLI writes a dated briefing file by default. */
1969
+ saveByDefault: boolean;
1970
+ /** Override directory for saved briefings. null → $REMNIC_HOME/briefings/. */
1971
+ saveDir: string | null;
1972
+ /** Whether to call the Responses API for follow-up suggestions. */
1973
+ llmFollowups: boolean;
1974
+ }
1975
+ /** Parsed representation of a briefing lookback window. */
1976
+ type BriefingWindow = "yesterday" | "today" | string;
1977
+ /** Filter the briefing to a single entity / project / topic. */
1978
+ interface BriefingFocus {
1979
+ type: "person" | "project" | "topic";
1980
+ value: string;
1981
+ }
1982
+ /** Calendar event surfaced by a CalendarSource implementation. */
1983
+ interface CalendarEvent {
1984
+ /** Stable identifier for dedupe / linking. */
1985
+ id: string;
1986
+ /** Event title (short). */
1987
+ title: string;
1988
+ /** ISO 8601 start timestamp. */
1989
+ start: string;
1990
+ /** Optional ISO 8601 end timestamp. */
1991
+ end?: string;
1992
+ /** Optional freeform location. */
1993
+ location?: string;
1994
+ /** Optional short notes. */
1995
+ notes?: string;
1996
+ }
1997
+ /** Abstraction over any calendar backend. Concrete implementations: `FileCalendarSource`. */
1998
+ interface CalendarSource {
1999
+ /** Return events that fall on the given UTC date (YYYY-MM-DD). */
2000
+ eventsForDate(dateIso: string): Promise<CalendarEvent[]>;
2001
+ }
2002
+ /** A single "active thread" surfaced in a briefing. */
2003
+ interface BriefingActiveThread {
2004
+ id: string;
2005
+ title: string;
2006
+ updatedAt: string;
2007
+ reason: string;
2008
+ }
2009
+ /** A single "recent entity" entry. */
2010
+ interface BriefingRecentEntity {
2011
+ name: string;
2012
+ type: string;
2013
+ updatedAt: string;
2014
+ score: number;
2015
+ summary?: string;
2016
+ }
2017
+ /** A single unresolved commitment or open question. */
2018
+ interface BriefingOpenCommitment {
2019
+ id: string;
2020
+ kind: "question" | "commitment" | "pending_memory";
2021
+ text: string;
2022
+ source?: string;
2023
+ createdAt?: string;
2024
+ }
2025
+ /** An LLM-generated short follow-up suggestion. */
2026
+ interface BriefingFollowup {
2027
+ text: string;
2028
+ rationale?: string;
2029
+ }
2030
+ /** Structured sections of a briefing result. */
2031
+ interface BriefingSections {
2032
+ activeThreads: BriefingActiveThread[];
2033
+ recentEntities: BriefingRecentEntity[];
2034
+ openCommitments: BriefingOpenCommitment[];
2035
+ suggestedFollowups: BriefingFollowup[];
2036
+ /** Only populated when a calendar source is configured and returns events. */
2037
+ todayCalendar?: CalendarEvent[];
2038
+ }
2039
+ /** A calendar source failure recorded when a CalendarSource throws during briefing generation. */
2040
+ interface BriefingCalendarSourceError {
2041
+ /** Human-readable description of the source (e.g. file path or source name). */
2042
+ source: string;
2043
+ /** Stringified error message from the failed source. */
2044
+ error: string;
2045
+ }
2046
+ /** Result returned by `buildBriefing`. */
2047
+ interface BriefingResult {
2048
+ markdown: string;
2049
+ json: Record<string, unknown>;
2050
+ sections: BriefingSections;
2051
+ /** Reason why suggested follow-ups were omitted (e.g. missing API key, LLM error). */
2052
+ followupsUnavailableReason?: string;
2053
+ /** Effective lookback window (ISO date range) used for this briefing. */
2054
+ window: {
2055
+ from: string;
2056
+ to: string;
2057
+ };
2058
+ /**
2059
+ * Calendar sources that failed during this briefing run.
2060
+ * Only present (non-empty) when at least one source threw.
2061
+ * Allows callers to distinguish "no events today" from "source unavailable".
2062
+ */
2063
+ calendarSourceErrors?: BriefingCalendarSourceError[];
2064
+ }
2065
+ /**
2066
+ * Settings for the Codex CLI connector. These are consumed by
2067
+ * `remnic connectors install codex-cli` to decide where the phase-2 memory
2068
+ * extension is dropped and whether to install it at all.
2069
+ */
2070
+ interface CodexConnectorConfig {
2071
+ /**
2072
+ * Whether to install the Remnic memory extension into
2073
+ * `<codex_home>/memories_extensions/remnic/` when the `codex-cli`
2074
+ * connector is installed. Default `true`. Set to `false` for users who
2075
+ * self-manage the Codex memory extensions folder.
2076
+ */
2077
+ installExtension: boolean;
2078
+ /**
2079
+ * Optional override for the Codex home directory. When `null`, the
2080
+ * connector reads `$CODEX_HOME` and falls back to `~/.codex`. Setting
2081
+ * this is useful for integration tests and non-default installs.
2082
+ */
2083
+ codexHome: string | null;
2084
+ }
2085
+ /**
2086
+ * Container for live-connector config blocks (issue #683 PR 2/N).
2087
+ *
2088
+ * Lives at `connectors.*` rather than the top level so future connectors
2089
+ * (Notion, Gmail, GitHub) can slot in without bloating `PluginConfig`.
2090
+ *
2091
+ * Every child block must default to `enabled: false` per CLAUDE.md gotcha
2092
+ * #30 (escape hatch by default) and gotcha #48 (least-privileged enum
2093
+ * defaults). Concrete connectors are also expected to short-circuit at
2094
+ * registration time when their credentials are not populated.
2095
+ */
2096
+ interface LiveConnectorsConfig {
2097
+ /** Google Drive live connector (issue #683 PR 2/N). */
2098
+ googleDrive: GoogleDriveLiveConnectorConfig;
2099
+ /** Notion live connector (issue #683 PR 3/N). */
2100
+ notion: NotionLiveConnectorConfig;
2101
+ /** Gmail live connector (issue #683 PR 4/6). */
2102
+ gmail: GmailLiveConnectorConfig;
2103
+ /** GitHub live connector (issue #683 PR 5/6). */
2104
+ github: GitHubLiveConnectorConfig;
2105
+ }
2106
+ /**
2107
+ * Operator-facing config for the Google Drive live connector. The connector
2108
+ * module itself defines a separate, *validated* `GoogleDriveConnectorConfig`
2109
+ * shape (frozen, post-validation). This interface is the pre-validation
2110
+ * shape that `parseConfig` round-trips through.
2111
+ *
2112
+ * `clientId` / `clientSecret` / `refreshToken` are stored as strings here so
2113
+ * the schema can ship in `openclaw.plugin.json` and operators can populate
2114
+ * them from a secret store (e.g. an env-substituted plist or systemd
2115
+ * EnvironmentFile). They MUST NEVER be committed to source. The repo-wide
2116
+ * privacy policy in CLAUDE.md applies.
2117
+ */
2118
+ interface GoogleDriveLiveConnectorConfig {
2119
+ /** Master gate. Default false — operators must opt in explicitly. */
2120
+ enabled: boolean;
2121
+ /** OAuth2 client id. Populate from a secret store; never commit. */
2122
+ clientId: string;
2123
+ /** OAuth2 client secret. Populate from a secret store; never commit. */
2124
+ clientSecret: string;
2125
+ /** OAuth2 refresh token. Populate from a secret store; never commit. */
2126
+ refreshToken: string;
2127
+ /** Poll interval in ms. Default 300000 (5 min); min 1000; max 86400000 (24h). */
2128
+ pollIntervalMs: number;
2129
+ /** Optional folder-id scope. Empty array = all accessible files. */
2130
+ folderIds: string[];
2131
+ }
2132
+ /**
2133
+ * Operator-facing config for the Notion live connector (issue #683 PR 3/N).
2134
+ * The connector module defines a separate validated `NotionConnectorConfig`
2135
+ * shape (frozen, post-validation). This interface is the pre-validation shape
2136
+ * that `parseConfig` round-trips through.
2137
+ *
2138
+ * `token` is stored as a string here so operators can populate it from a
2139
+ * secret store (e.g. an env-substituted plist or systemd EnvironmentFile).
2140
+ * It MUST NEVER be committed to source. The repo-wide privacy policy in
2141
+ * CLAUDE.md applies.
2142
+ */
2143
+ interface NotionLiveConnectorConfig {
2144
+ /** Master gate. Default false — operators must opt in explicitly. */
2145
+ enabled: boolean;
2146
+ /** Notion integration token. Starts with `secret_`. Populate from a secret store; never commit. */
2147
+ token: string;
2148
+ /** Array of Notion database ids to import pages from. Empty = connector is a no-op. */
2149
+ databaseIds: string[];
2150
+ /** Poll interval in ms. Default 300000 (5 min); min 1000; max 86400000 (24h). */
2151
+ pollIntervalMs: number;
2152
+ }
2153
+ /**
2154
+ * Operator-facing config for the Gmail live connector (issue #683 PR 4/6).
2155
+ * The connector module defines a separate validated `GmailConnectorConfig`
2156
+ * shape (frozen, post-validation). This interface is the pre-validation shape
2157
+ * that `parseConfig` round-trips through.
2158
+ *
2159
+ * OAuth2 credentials are stored as strings here so operators can populate
2160
+ * them from a secret store (e.g. env-substituted plist or systemd
2161
+ * EnvironmentFile). They MUST NEVER be committed to source. The repo-wide
2162
+ * privacy policy in CLAUDE.md applies.
2163
+ */
2164
+ interface GmailLiveConnectorConfig {
2165
+ /** Master gate. Default false — operators must opt in explicitly. */
2166
+ enabled: boolean;
2167
+ /** OAuth2 client id. Populate from a secret store; never commit. */
2168
+ clientId: string;
2169
+ /** OAuth2 client secret. Populate from a secret store; never commit. */
2170
+ clientSecret: string;
2171
+ /** OAuth2 refresh token issued for the Gmail scope. Populate from a secret store; never commit. */
2172
+ refreshToken: string;
2173
+ /** Gmail userId. Defaults to "me" (the authenticated user). */
2174
+ userId: string;
2175
+ /** Gmail search query applied in addition to the watermark filter. Default "in:inbox". */
2176
+ query: string;
2177
+ /** Poll interval in ms. Default 300000 (5 min); min 1000; max 86400000 (24h). */
2178
+ pollIntervalMs: number;
2179
+ }
2180
+ /**
2181
+ * Operator-facing config for the GitHub live connector (issue #683 PR 5/6).
2182
+ * The connector module defines a separate validated `GitHubConnectorConfig`
2183
+ * shape (frozen, post-validation). This interface is the pre-validation shape
2184
+ * that `parseConfig` round-trips through.
2185
+ *
2186
+ * `token` is stored as a string here so operators can populate it from a
2187
+ * secret store (e.g. an env-substituted plist or systemd EnvironmentFile).
2188
+ * It MUST NEVER be committed to source. The repo-wide privacy policy in
2189
+ * CLAUDE.md applies.
2190
+ */
2191
+ interface GitHubLiveConnectorConfig {
2192
+ /** Master gate. Default false — operators must opt in explicitly. */
2193
+ enabled: boolean;
2194
+ /** GitHub personal access token. Populate from a secret store; never commit. */
2195
+ token: string;
2196
+ /** GitHub login of the user whose comments will be imported. Required. */
2197
+ userLogin: string;
2198
+ /** Repos to poll in "owner/repo" format. Empty = connector is a no-op. */
2199
+ repos: string[];
2200
+ /** Poll interval in ms. Default 300000 (5 min); min 1000; max 86400000 (24h). */
2201
+ pollIntervalMs: number;
2202
+ /** Whether to fetch Discussion comments in addition to issue/PR comments. Default false. */
2203
+ includeDiscussions: boolean;
2204
+ }
2205
+ interface BootstrapOptions {
2206
+ dryRun?: boolean;
2207
+ sessionsDir?: string;
2208
+ limit?: number;
2209
+ since?: Date;
2210
+ }
2211
+ interface BootstrapResult {
2212
+ sessionsScanned: number;
2213
+ turnsProcessed: number;
2214
+ highSignalTurns: number;
2215
+ memoriesCreated: number;
2216
+ skipped: number;
2217
+ }
2218
+ interface PrincipalRule {
2219
+ match: string;
2220
+ principal: string;
2221
+ }
2222
+ interface NamespacePolicy {
2223
+ name: string;
2224
+ readPrincipals: string[];
2225
+ writePrincipals: string[];
2226
+ includeInRecallByDefault?: boolean;
2227
+ }
2228
+ interface RelevanceFeedback {
2229
+ up: number;
2230
+ down: number;
2231
+ lastUpdatedAt: string;
2232
+ notes?: string[];
2233
+ }
2234
+ interface BufferTurn {
2235
+ role: "user" | "assistant";
2236
+ content: string;
2237
+ timestamp: string;
2238
+ sourceValidAt?: string;
2239
+ sessionKey?: string;
2240
+ logicalSessionKey?: string;
2241
+ providerThreadId?: string | null;
2242
+ turnFingerprint?: string;
2243
+ persistProcessedFingerprint?: boolean;
2244
+ extractionContextOnly?: boolean;
2245
+ parts?: LcmMessagePartInput[];
2246
+ rawContent?: unknown;
2247
+ sourceFormat?: MessagePartSourceFormat;
2248
+ importProvenance?: ImportTurnProvenance;
2249
+ }
2250
+ interface BufferEntryState {
2251
+ turns: BufferTurn[];
2252
+ lastExtractionAt: string | null;
2253
+ extractionCount: number;
2254
+ /**
2255
+ * Turns retained across `clearAfterExtraction` so a later extraction pass
2256
+ * sees the context that caused a defer verdict (issue #562, PR 2). Bounded
2257
+ * to the configured retention cap by `retainDeferredTurns`. Empty / absent
2258
+ * means no retention in effect.
2259
+ */
2260
+ retainedTurns?: BufferTurn[];
2261
+ }
2262
+ interface BufferState {
2263
+ turns: BufferTurn[];
2264
+ lastExtractionAt: string | null;
2265
+ extractionCount: number;
2266
+ entries?: Record<string, BufferEntryState>;
2267
+ }
2268
+ interface BehaviorLoopAdjustment {
2269
+ parameter: string;
2270
+ previousValue: number;
2271
+ nextValue: number;
2272
+ delta: number;
2273
+ evidenceCount: number;
2274
+ confidence: number;
2275
+ reason: string;
2276
+ appliedAt: string;
2277
+ }
2278
+ interface BehaviorLoopPolicyState {
2279
+ version: number;
2280
+ windowDays: number;
2281
+ minSignalCount: number;
2282
+ maxDeltaPerCycle: number;
2283
+ protectedParams: string[];
2284
+ adjustments: BehaviorLoopAdjustment[];
2285
+ updatedAt: string;
2286
+ }
2287
+ type BehaviorSignalType = "correction_override" | "preference_affinity" | "topic_revisitation" | "action_pattern" | "outcome_preference" | "phrasing_style";
2288
+ type BehaviorSignalDirection = "positive" | "negative";
2289
+ interface BehaviorSignalEvent {
2290
+ timestamp: string;
2291
+ namespace: string;
2292
+ memoryId: string;
2293
+ category: Extract<MemoryCategory, "correction" | "preference">;
2294
+ signalType: BehaviorSignalType;
2295
+ direction: BehaviorSignalDirection;
2296
+ confidence: number;
2297
+ signalHash: string;
2298
+ source: "extraction" | "correction";
2299
+ }
2300
+ /**
2301
+ * One row of the buffer-surprise telemetry ledger (issue #563 PR 3).
2302
+ *
2303
+ * Emitted by `SmartBuffer` each time the surprise probe produces a score
2304
+ * for an incoming turn (i.e. the feature flag is on and the existing
2305
+ * trigger-logic path called through to the probe). Not written when the
2306
+ * probe is skipped — the absence of a row is meaningful and matches the
2307
+ * "probe was not consulted" state.
2308
+ *
2309
+ * The ledger is intentionally lean: we record the score, the threshold in
2310
+ * force, whether the turn caused a flush, and the turn count so operators
2311
+ * can re-derive precision/recall without replaying traffic. Turn content
2312
+ * is never persisted — this ledger is safe to commit to shared storage.
2313
+ */
2314
+ interface BufferSurpriseEvent {
2315
+ /** Literal tag to simplify multiplexed log consumers. */
2316
+ event: "BUFFER_SURPRISE";
2317
+ /** ISO timestamp when the decision was made. Server-side, not turn ts. */
2318
+ timestamp: string;
2319
+ /** Buffer identifier (session / thread). Opaque string. */
2320
+ bufferKey: string;
2321
+ /** Session key if available; null when the turn has no session binding. */
2322
+ sessionKey: string | null;
2323
+ /** Role of the scored turn. */
2324
+ turnRole: "user" | "assistant";
2325
+ /** Surprise score in `[0, 1]`, already clamped. */
2326
+ surpriseScore: number;
2327
+ /** Threshold in force when the decision was made. */
2328
+ threshold: number;
2329
+ /** Whether this turn upgraded `keep_buffering` → `extract_now`. */
2330
+ triggeredFlush: boolean;
2331
+ /** Number of turns in the buffer (including the current turn). */
2332
+ turnCountInWindow: number;
2333
+ }
2334
+ /** Memory status for lifecycle management */
2335
+ type MemoryStatus = "active" | "pending_review" | "rejected" | "quarantined" | "superseded" | "archived"
2336
+ /**
2337
+ * Operator explicitly forgot the memory (issue #686 PR 4/6). Soft
2338
+ * delete: the file stays on disk and a page-version snapshot is kept
2339
+ * so the act is reversible during a configurable retention window
2340
+ * (default 90 days), but the memory is excluded from recall, browse,
2341
+ * and entity attribution. After the retention window passes, a
2342
+ * future maintenance cron will hard-delete forgotten memories.
2343
+ */
2344
+ | "forgotten";
2345
+ type LifecycleState = "candidate" | "validated" | "active" | "stale" | "archived";
2346
+ type VerificationState = "unverified" | "user_confirmed" | "system_inferred" | "disputed";
2347
+ type PolicyClass = "ephemeral" | "durable" | "protected";
2348
+ /** Importance level tiers */
2349
+ type ImportanceLevel = "critical" | "high" | "normal" | "low" | "trivial";
2350
+ /** Importance scoring result */
2351
+ interface ImportanceScore {
2352
+ /** Numeric score 0-1 */
2353
+ score: number;
2354
+ /** Tier level */
2355
+ level: ImportanceLevel;
2356
+ /** Reasons for this score */
2357
+ reasons: string[];
2358
+ /** Salient keywords extracted */
2359
+ keywords: string[];
2360
+ }
2361
+ interface MemoryFrontmatter {
2362
+ id: string;
2363
+ category: MemoryCategory;
2364
+ created: string;
2365
+ updated: string;
2366
+ source: string;
2367
+ confidence: number;
2368
+ confidenceTier: ConfidenceTier;
2369
+ tags: string[];
2370
+ entityRef?: string;
2371
+ supersedes?: string;
2372
+ /** ISO 8601 date — memory expires and gets cleaned up after this date */
2373
+ expiresAt?: string;
2374
+ /** IDs of parent memories this was derived from (lineage tracking) */
2375
+ lineage?: string[];
2376
+ /** Memory status: active (default), pending_review, rejected, quarantined, superseded, archived, or forgotten */
2377
+ status?: MemoryStatus;
2378
+ /** ID of memory that superseded this one */
2379
+ supersededBy?: string;
2380
+ /** Timestamp when superseded */
2381
+ supersededAt?: string;
2382
+ /** Timestamp when archived */
2383
+ archivedAt?: string;
2384
+ /**
2385
+ * Explicit fact validity start (issue #680). ISO 8601 timestamp.
2386
+ *
2387
+ * When present, marks the moment at which the fact begins being
2388
+ * "true" / authoritative. When absent at read time, callers fall
2389
+ * back to `created` so legacy memories written before #680 still
2390
+ * participate in `as_of` recall filtering without a migration.
2391
+ */
2392
+ valid_at?: string;
2393
+ /**
2394
+ * Explicit fact validity end (issue #680). ISO 8601 timestamp.
2395
+ *
2396
+ * Set automatically by the temporal-supersession pipeline when a
2397
+ * newer fact supersedes this one — the value is the superseder's
2398
+ * `valid_at` (or `created` if no `valid_at` was set). May also be
2399
+ * set manually for facts that are known to expire at a specific
2400
+ * point in time.
2401
+ */
2402
+ invalid_at?: string;
2403
+ /**
2404
+ * Timestamp when the operator explicitly forgot this memory
2405
+ * (issue #686 PR 4/6). Set by `remnic forget <id>`. Memories with
2406
+ * `status === "forgotten"` are excluded from recall, browse, and
2407
+ * entity attribution; the file remains on disk until the retention
2408
+ * window passes.
2409
+ */
2410
+ forgottenAt?: string;
2411
+ /** Optional human-readable reason captured by `remnic forget --reason`. */
2412
+ forgottenReason?: string;
2413
+ /** Policy-driven lifecycle state used for retrieval eligibility/ranking. */
2414
+ lifecycleState?: LifecycleState;
2415
+ /** Verification provenance used by lifecycle policy. */
2416
+ verificationState?: VerificationState;
2417
+ /** Policy class used by lifecycle guardrails. */
2418
+ policyClass?: PolicyClass;
2419
+ /** Last lifecycle validation timestamp (ISO 8601). */
2420
+ lastValidatedAt?: string;
2421
+ /** Lifecycle decay score in [0,1]. */
2422
+ decayScore?: number;
2423
+ /** Lifecycle heat score in [0,1]. */
2424
+ heatScore?: number;
2425
+ /** Number of times this memory has been retrieved */
2426
+ accessCount?: number;
2427
+ /** Last time this memory was accessed (ISO 8601) */
2428
+ lastAccessed?: string;
2429
+ /** Number of sessions where this memory was retrieved and the outcome was judged a success. */
2430
+ mw_success?: number;
2431
+ /** Number of sessions where this memory was retrieved and the outcome was judged a failure. */
2432
+ mw_fail?: number;
2433
+ /** Importance score with level, reasons, and keywords */
2434
+ importance?: ImportanceScore;
2435
+ /** Parent memory ID if this is a chunk */
2436
+ parentId?: string;
2437
+ /** Chunk index within parent (0-based) */
2438
+ chunkIndex?: number;
2439
+ /** Total number of chunks for this parent */
2440
+ chunkTotal?: number;
2441
+ /** Links to other memories */
2442
+ links?: MemoryLink[];
2443
+ intentGoal?: string;
2444
+ intentActionType?: string;
2445
+ intentEntityTypes?: string[];
2446
+ artifactType?: "decision" | "constraint" | "todo" | "definition" | "commitment" | "correction" | "fact";
2447
+ sourceMemoryId?: string;
2448
+ sourceTurnId?: string;
2449
+ /** episode = time-specific event; note = stable belief/preference/decision */
2450
+ memoryKind?: "episode" | "note" | "box" | "dream" | "procedural";
2451
+ /** Structured key-value attributes extracted from the content (e.g., product attributes, dates, quantities). */
2452
+ structuredAttributes?: Record<string, string>;
2453
+ /**
2454
+ * SHA-256 (via ContentHashIndex.computeHash) of the raw content that was
2455
+ * used as the dedup key at write time. Persists through archive and
2456
+ * consolidation so the hash can be removed from the index even if the stored
2457
+ * content has been transformed (e.g. an inline citation was appended).
2458
+ *
2459
+ * When present, archive/consolidation paths use this directly instead of
2460
+ * calling stripCitation(memory.content), which only handles the default
2461
+ * [Source: ...] format and silently fails for custom citation templates.
2462
+ */
2463
+ contentHash?: string;
2464
+ /**
2465
+ * Consolidation provenance — pointers to the page-versioning snapshots
2466
+ * that this memory was derived from (issue #561). Each entry is a
2467
+ * `"<memory-path>:<version-number>"` string (e.g.
2468
+ * `"facts/preferences.md:3"`) referencing a snapshot recorded by
2469
+ * `page-versioning.ts`.
2470
+ *
2471
+ * PR 1 introduces this field as read-through only — storage preserves
2472
+ * it verbatim but no code produces it yet. PR 2 populates it on
2473
+ * consolidation writes; PR 4 adds a `remnic doctor` integrity check
2474
+ * that validates each referent actually exists.
2475
+ */
2476
+ derived_from?: string[];
2477
+ /**
2478
+ * Which consolidation operator produced this memory (issue #561,
2479
+ * extended in #687). See `ConsolidationOperator` in
2480
+ * `semantic-consolidation.ts` for the operator algebra. Absent on
2481
+ * memories that were not produced by a consolidation pass.
2482
+ *
2483
+ * `"pattern-reinforcement"` (issue #687 PR 2/4) tags memories that
2484
+ * were promoted to canonical by the pattern-reinforcement
2485
+ * maintenance job after observing the same content across
2486
+ * multiple sessions.
2487
+ */
2488
+ derived_via?: "split" | "merge" | "update" | "pattern-reinforcement";
2489
+ /**
2490
+ * Number of source memories that reinforced this canonical memory
2491
+ * (issue #687 PR 2/4). Set by the pattern-reinforcement
2492
+ * maintenance job when it clusters duplicate memories and promotes
2493
+ * the most recent member to canonical. Counts the cluster size at
2494
+ * the time of the run; subsequent runs update this monotonically.
2495
+ *
2496
+ * Always a positive integer when present. Absent on memories that
2497
+ * have not been touched by pattern reinforcement.
2498
+ */
2499
+ reinforcement_count?: number;
2500
+ /**
2501
+ * ISO 8601 timestamp recording the most recent pattern-reinforcement
2502
+ * run that touched this memory (issue #687 PR 2/4). Updated each
2503
+ * time the cluster size grows. Absent when `reinforcement_count`
2504
+ * is absent.
2505
+ */
2506
+ last_reinforced_at?: string;
2507
+ }
2508
+ /** Memory link relationship types */
2509
+ type MemoryLinkType = "follows" | "references" | "contradicts" | "supports" | "related";
2510
+ /** A link between memories */
2511
+ interface MemoryLink {
2512
+ targetId: string;
2513
+ linkType: MemoryLinkType;
2514
+ strength: number;
2515
+ reason?: string;
2516
+ }
2517
+ interface ConversationThread {
2518
+ id: string;
2519
+ title: string;
2520
+ createdAt: string;
2521
+ updatedAt: string;
2522
+ sessionKey?: string;
2523
+ episodeIds: string[];
2524
+ linkedThreadIds: string[];
2525
+ }
2526
+ interface MemorySummary {
2527
+ id: string;
2528
+ createdAt: string;
2529
+ timeRangeStart: string;
2530
+ timeRangeEnd: string;
2531
+ summaryText: string;
2532
+ keyFacts: string[];
2533
+ keyEntities: string[];
2534
+ sourceEpisodeIds: string[];
2535
+ }
2536
+ interface DaySummaryResult {
2537
+ summary: string;
2538
+ bullets: string[];
2539
+ next_actions: string[];
2540
+ risks_or_open_loops: string[];
2541
+ }
2542
+ interface TopicScore {
2543
+ term: string;
2544
+ score: number;
2545
+ count: number;
2546
+ }
2547
+ interface MemoryFile {
2548
+ path: string;
2549
+ frontmatter: MemoryFrontmatter;
2550
+ content: string;
2551
+ }
2552
+ /**
2553
+ * Public type representing the **Observation** stage in the
2554
+ * Trace → Observation → Primitive pipeline (issue #685).
2555
+ *
2556
+ * - **Trace**: raw conversation turns captured in `buffer.ts`. Noisy,
2557
+ * verbose, ephemeral.
2558
+ * - **Observation** (this type): post-extraction, importance-scored
2559
+ * fact candidate emitted by `extraction.ts` / `extraction-judge.ts`.
2560
+ * Already distilled — but not yet consolidated against the corpus.
2561
+ * - **Primitive**: the durable `MemoryFile` written by `storage.ts`,
2562
+ * reinforced over time by `compounding/engine.ts`.
2563
+ *
2564
+ * `MemoryObservation` is the named handle on the intermediate stage
2565
+ * the codebase has always produced but never publicly typed. It lets
2566
+ * callers (telemetry, doctor surfaces, tests, downstream tooling)
2567
+ * inspect the post-extraction shape without reaching into extraction
2568
+ * internals.
2569
+ *
2570
+ * Naming note: this is intentionally NOT the same as the existing
2571
+ * `state/observation-ledger/` directory, which is telemetry storage
2572
+ * for the extraction pipeline (turn-count aggregates rebuilt by
2573
+ * `maintenance/rebuild-observations.ts` and judge verdict events
2574
+ * appended by `extraction-judge-telemetry.ts`). Lifecycle events on
2575
+ * primitives — status flips, supersessions, archival, forget — live
2576
+ * in `state/memory-lifecycle-ledger.jsonl`, written by
2577
+ * `StorageManager`. A `MemoryObservation` describes the in-flight
2578
+ * candidate that became (or didn't become) a primitive; the ledger
2579
+ * directory is how the pipeline reports on itself. See
2580
+ * `docs/trace-to-primitive.md` for the full pipeline walkthrough.
2581
+ */
2582
+ interface MemoryObservation {
2583
+ /** Stable id for this observation, distinct from any primitive id. */
2584
+ id: string;
2585
+ /** Source session id the trace came from. */
2586
+ sessionId?: string;
2587
+ /** ISO timestamp the observation was emitted. */
2588
+ observedAt: string;
2589
+ /** The extracted fact candidate (category, content, confidence, tags, etc.). */
2590
+ fact: ExtractedFact;
2591
+ /** Importance score in [0,1], from `importance.ts`. */
2592
+ importance?: number;
2593
+ /**
2594
+ * Whether the observation passed the extraction judge
2595
+ * (`extraction-judge.ts`). When `false`, the observation was
2596
+ * captured for telemetry but not persisted as a primitive.
2597
+ */
2598
+ judgeAccepted?: boolean;
2599
+ /** Optional reason the judge gave when rejecting. */
2600
+ judgeRejectionReason?: string;
2601
+ /**
2602
+ * Id of the resulting `MemoryFile` primitive once consolidation runs.
2603
+ * Absent until consolidation decides to ADD/MERGE/UPDATE the
2604
+ * observation into the corpus.
2605
+ */
2606
+ resultingPrimitiveId?: string;
2607
+ }
2608
+ /** Ordered step for extracted procedure memories (issue #519). */
2609
+ interface ExtractedProcedureStep {
2610
+ order: number;
2611
+ intent: string;
2612
+ toolCall?: {
2613
+ kind: string;
2614
+ signature: string;
2615
+ };
2616
+ expectedOutcome?: string;
2617
+ optional?: boolean;
2618
+ }
2619
+ interface ExtractedFact {
2620
+ category: MemoryCategory;
2621
+ content: string;
2622
+ confidence: number;
2623
+ tags: string[];
2624
+ entityRef?: string;
2625
+ source?: ExtractionPassSource;
2626
+ promptedByQuestion?: string;
2627
+ /**
2628
+ * Whether this fact is project-scoped or globally applicable.
2629
+ * When `extractionScopeClassificationEnabled` is true, the extraction LLM
2630
+ * classifies each fact. Default is `"project"` when a coding context is
2631
+ * active, `"global"` when no coding context is present.
2632
+ */
2633
+ scope?: MemoryScope;
2634
+ /** Structured key-value attributes extracted from the content (e.g., product attributes, dates, quantities). */
2635
+ structuredAttributes?: Record<string, string>;
2636
+ /** When category is `procedure`, ordered steps with intents (persisted under procedures/). */
2637
+ procedureSteps?: ExtractedProcedureStep[];
2638
+ /**
2639
+ * When category is `reasoning_trace`, the stored solution chain the user
2640
+ * walked through. Persisted under reasoning-traces/.
2641
+ */
2642
+ reasoningTrace?: ExtractedReasoningTrace;
2643
+ }
2644
+ interface ExtractedReasoningTraceStep {
2645
+ order: number;
2646
+ description: string;
2647
+ }
2648
+ interface ExtractedReasoningTrace {
2649
+ steps: ExtractedReasoningTraceStep[];
2650
+ finalAnswer: string;
2651
+ observedOutcome?: string;
2652
+ }
2653
+ interface MemoryIntent {
2654
+ goal: string;
2655
+ actionType: string;
2656
+ entityTypes: string[];
2657
+ /** True when the prompt reads like starting a concrete task (ship/deploy/tests/PR, etc.). */
2658
+ taskInitiation?: boolean;
2659
+ }
2660
+ interface ExtractedQuestion {
2661
+ question: string;
2662
+ context: string;
2663
+ priority: number;
2664
+ }
2665
+ interface QuestionEntry {
2666
+ id: string;
2667
+ question: string;
2668
+ context: string;
2669
+ priority: number;
2670
+ created: string;
2671
+ resolved: boolean;
2672
+ resolvedAt?: string;
2673
+ }
2674
+ interface ExtractionResult {
2675
+ facts: ExtractedFact[];
2676
+ profileUpdates: string[];
2677
+ entities: EntityMention[];
2678
+ questions: ExtractedQuestion[];
2679
+ identityReflection?: string;
2680
+ relationships?: ExtractedRelationship[];
2681
+ }
2682
+ interface EntityMention {
2683
+ name: string;
2684
+ type: "person" | "project" | "tool" | "company" | "place" | "other";
2685
+ facts: string[];
2686
+ structuredSections?: EntityStructuredSection[];
2687
+ source?: ExtractionPassSource;
2688
+ promptedByQuestion?: string;
2689
+ }
2690
+ interface EntityRelationship {
2691
+ target: string;
2692
+ label: string;
2693
+ }
2694
+ interface EntityActivityEntry {
2695
+ date: string;
2696
+ note: string;
2697
+ }
2698
+ interface EntityTimelineEntry {
2699
+ timestamp: string;
2700
+ text: string;
2701
+ source?: string;
2702
+ sessionKey?: string;
2703
+ principal?: string;
2704
+ }
2705
+ interface EntityStructuredSection {
2706
+ key: string;
2707
+ title: string;
2708
+ facts: string[];
2709
+ }
2710
+ interface EntitySchemaSectionDefinition {
2711
+ key: string;
2712
+ title: string;
2713
+ description: string;
2714
+ aliases?: string[];
2715
+ }
2716
+ interface EntitySchemaDefinition {
2717
+ sections: EntitySchemaSectionDefinition[];
2718
+ }
2719
+ interface EntityFile {
2720
+ name: string;
2721
+ type: string;
2722
+ created?: string;
2723
+ updated: string;
2724
+ extraFrontmatterLines?: string[];
2725
+ preSectionLines?: string[];
2726
+ facts: string[];
2727
+ summary?: string;
2728
+ synthesis?: string;
2729
+ synthesisUpdatedAt?: string;
2730
+ synthesisTimelineCount?: number;
2731
+ synthesisStructuredFactCount?: number;
2732
+ synthesisStructuredFactDigest?: string;
2733
+ synthesisVersion?: number;
2734
+ timeline: EntityTimelineEntry[];
2735
+ structuredSections?: EntityStructuredSection[];
2736
+ relationships: EntityRelationship[];
2737
+ activity: EntityActivityEntry[];
2738
+ aliases: string[];
2739
+ extraSections?: Array<{
2740
+ title: string;
2741
+ lines: string[];
2742
+ }>;
2743
+ }
2744
+ interface ScoredEntity {
2745
+ name: string;
2746
+ type: string;
2747
+ score: number;
2748
+ factCount: number;
2749
+ summary?: string;
2750
+ topRelationships: string[];
2751
+ }
2752
+ interface ExtractedRelationship {
2753
+ source: string;
2754
+ target: string;
2755
+ label: string;
2756
+ extractionSource?: ExtractionPassSource;
2757
+ promptedByQuestion?: string;
2758
+ }
2759
+ interface ConsolidationItem {
2760
+ existingId: string;
2761
+ action: ConsolidationAction;
2762
+ mergeWith?: string;
2763
+ updatedContent?: string;
2764
+ reason: string;
2765
+ }
2766
+ interface ConsolidationResult {
2767
+ items: ConsolidationItem[];
2768
+ profileUpdates: string[];
2769
+ entityUpdates: EntityMention[];
2770
+ }
2771
+ interface ConsolidationObservation {
2772
+ runAt: string;
2773
+ recentMemories: MemoryFile[];
2774
+ existingMemories: MemoryFile[];
2775
+ profile: string;
2776
+ result: ConsolidationResult;
2777
+ merged: number;
2778
+ invalidated: number;
2779
+ }
2780
+ interface QmdSearchResult {
2781
+ docid: string;
2782
+ path: string;
2783
+ snippet: string;
2784
+ score: number;
2785
+ line?: number;
2786
+ explain?: QmdSearchExplain;
2787
+ transport?: "daemon" | "subprocess" | "hybrid" | "scoped_prefilter";
2788
+ }
2789
+ interface QmdSearchExplain {
2790
+ ftsScores?: number[];
2791
+ vectorScores?: number[];
2792
+ /** QMD 2.5 nested RRF `totalScore`, or legacy numeric RRF score. */
2793
+ rrf?: number;
2794
+ rrfRank?: number;
2795
+ rrfPositionScore?: number;
2796
+ rrfBaseScore?: number;
2797
+ rrfTopRankBonus?: number;
2798
+ rerankScore?: number;
2799
+ blendedScore?: number;
2800
+ /** Additive boost applied from `reinforcement_count` frontmatter (issue #687 PR 3/4). */
2801
+ reinforcementBoost?: number;
2802
+ }
2803
+ interface MetaState {
2804
+ extractionCount: number;
2805
+ lastExtractionAt: string | null;
2806
+ lastConsolidationAt: string | null;
2807
+ totalMemories: number;
2808
+ totalEntities: number;
2809
+ processedExtractionFingerprints?: Array<{
2810
+ fingerprint: string;
2811
+ observedAt: string;
2812
+ }>;
2813
+ }
2814
+ type MemoryActionType = "store_episode" | "store_note" | "update_note" | "create_artifact" | "summarize_node" | "discard" | "link_graph";
2815
+ type MemoryActionOutcome = "applied" | "skipped" | "failed";
2816
+ type MemoryActionPolicyDecision = "allow" | "defer" | "deny";
2817
+ type MemoryActionStatus = "validated" | "applied" | "rejected";
2818
+ type MemoryActionEligibilitySource = "extraction" | "consolidation" | "replay" | "manual" | "unknown";
2819
+ interface MemoryActionEligibilityContext {
2820
+ confidence: number;
2821
+ lifecycleState: LifecycleState;
2822
+ importance: number;
2823
+ source: MemoryActionEligibilitySource;
2824
+ }
2825
+ interface MemoryActionPolicyResult {
2826
+ action: MemoryActionType;
2827
+ decision: MemoryActionPolicyDecision;
2828
+ rationale: string;
2829
+ eligibility: MemoryActionEligibilityContext;
2830
+ }
2831
+ interface MemoryActionEvent {
2832
+ schemaVersion?: number;
2833
+ actionId?: string;
2834
+ timestamp: string;
2835
+ action: MemoryActionType;
2836
+ outcome: MemoryActionOutcome;
2837
+ status?: MemoryActionStatus;
2838
+ actor?: string;
2839
+ subsystem?: string;
2840
+ reason?: string;
2841
+ memoryId?: string;
2842
+ namespace?: string;
2843
+ sessionKey?: string;
2844
+ sourceSessionKey?: string;
2845
+ checkpointCapturedAt?: string;
2846
+ checkpointTtl?: string;
2847
+ checkpointTurnCount?: number;
2848
+ inputSummary?: string;
2849
+ outputMemoryIds?: string[];
2850
+ dryRun?: boolean;
2851
+ policyVersion?: string;
2852
+ promptHash?: string;
2853
+ policyDecision?: MemoryActionPolicyDecision;
2854
+ policyRationale?: string;
2855
+ policyEligibility?: MemoryActionEligibilityContext;
2856
+ }
2857
+ type MemoryLifecycleEventType = "created" | "updated" | "superseded" | "archived" | "rejected" | "restored" | "merged" | "imported" | "promoted" | "explicit_capture_accepted" | "explicit_capture_queued";
2858
+ interface MemoryLifecycleStateSummary {
2859
+ category?: MemoryCategory;
2860
+ path?: string;
2861
+ status?: MemoryStatus;
2862
+ lifecycleState?: LifecycleState;
2863
+ }
2864
+ interface MemoryLifecycleEvent {
2865
+ eventId: string;
2866
+ memoryId: string;
2867
+ eventType: MemoryLifecycleEventType;
2868
+ timestamp: string;
2869
+ actor: string;
2870
+ reasonCode?: string;
2871
+ ruleVersion: string;
2872
+ relatedMemoryIds?: string[];
2873
+ before?: MemoryLifecycleStateSummary;
2874
+ after?: MemoryLifecycleStateSummary;
2875
+ correlationId?: string;
2876
+ }
2877
+ interface MemoryProjectionCurrentState {
2878
+ memoryId: string;
2879
+ category: MemoryCategory;
2880
+ status: MemoryStatus;
2881
+ lifecycleState?: LifecycleState;
2882
+ path: string;
2883
+ pathRel: string;
2884
+ created: string;
2885
+ updated: string;
2886
+ archivedAt?: string;
2887
+ supersededAt?: string;
2888
+ entityRef?: string;
2889
+ source: string;
2890
+ confidence: number;
2891
+ confidenceTier: ConfidenceTier;
2892
+ memoryKind?: MemoryFrontmatter["memoryKind"];
2893
+ accessCount?: number;
2894
+ lastAccessed?: string;
2895
+ tags?: string[];
2896
+ preview?: string;
2897
+ }
2898
+ interface CompressionGuidelineOptimizerSourceWindow {
2899
+ from: string;
2900
+ to: string;
2901
+ }
2902
+ interface CompressionGuidelineOptimizerEventCounts {
2903
+ total: number;
2904
+ applied: number;
2905
+ skipped: number;
2906
+ failed: number;
2907
+ }
2908
+ type CompressionGuidelineActivationState = "draft" | "active";
2909
+ interface CompressionGuidelineOptimizerActionSummary {
2910
+ action: MemoryActionType;
2911
+ total: number;
2912
+ outcomes: Record<MemoryActionOutcome, number>;
2913
+ quality: {
2914
+ good: number;
2915
+ poor: number;
2916
+ unknown: number;
2917
+ };
2918
+ }
2919
+ interface CompressionGuidelineOptimizerRuleUpdate {
2920
+ action: MemoryActionType;
2921
+ delta: number;
2922
+ direction: "increase" | "decrease" | "hold";
2923
+ confidence: "low" | "medium" | "high";
2924
+ notes: string[];
2925
+ }
2926
+ interface CompressionGuidelineOptimizerState {
2927
+ version: number;
2928
+ updatedAt: string;
2929
+ sourceWindow: CompressionGuidelineOptimizerSourceWindow;
2930
+ eventCounts: CompressionGuidelineOptimizerEventCounts;
2931
+ guidelineVersion: number;
2932
+ contentHash?: string;
2933
+ activationState?: CompressionGuidelineActivationState;
2934
+ actionSummaries?: CompressionGuidelineOptimizerActionSummary[];
2935
+ ruleUpdates?: CompressionGuidelineOptimizerRuleUpdate[];
2936
+ }
2937
+ type ContinuityIncidentState = "open" | "closed";
2938
+ interface ContinuityIncidentRecord {
2939
+ id: string;
2940
+ state: ContinuityIncidentState;
2941
+ openedAt: string;
2942
+ updatedAt: string;
2943
+ triggerWindow?: string;
2944
+ symptom: string;
2945
+ suspectedCause?: string;
2946
+ fixApplied?: string;
2947
+ verificationResult?: string;
2948
+ preventiveRule?: string;
2949
+ closedAt?: string;
2950
+ filePath?: string;
2951
+ }
2952
+ interface ContinuityIncidentOpenInput {
2953
+ triggerWindow?: string;
2954
+ symptom: string;
2955
+ suspectedCause?: string;
2956
+ }
2957
+ interface ContinuityIncidentCloseInput {
2958
+ fixApplied: string;
2959
+ verificationResult: string;
2960
+ preventiveRule?: string;
2961
+ }
2962
+ type ContinuityLoopCadence = "daily" | "weekly" | "monthly" | "quarterly";
2963
+ type ContinuityLoopStatus = "active" | "paused" | "retired";
2964
+ interface ContinuityImprovementLoop {
2965
+ id: string;
2966
+ cadence: ContinuityLoopCadence;
2967
+ purpose: string;
2968
+ status: ContinuityLoopStatus;
2969
+ killCondition: string;
2970
+ lastReviewed: string;
2971
+ notes?: string;
2972
+ }
2973
+ interface ContinuityLoopUpsertInput {
2974
+ id: string;
2975
+ cadence: ContinuityLoopCadence;
2976
+ purpose: string;
2977
+ status: ContinuityLoopStatus;
2978
+ killCondition: string;
2979
+ lastReviewed?: string;
2980
+ notes?: string;
2981
+ }
2982
+ interface ContinuityLoopReviewInput {
2983
+ status?: ContinuityLoopStatus;
2984
+ notes?: string;
2985
+ reviewedAt?: string;
2986
+ }
2987
+ /** Entry in the access tracking buffer (batched updates) */
2988
+ interface AccessTrackingEntry {
2989
+ memoryId: string;
2990
+ newCount: number;
2991
+ lastAccessed: string;
2992
+ }
2993
+ interface SignalScanResult {
2994
+ level: SignalLevel;
2995
+ patterns: string[];
2996
+ }
2997
+ interface LlmTraceEvent {
2998
+ kind: "llm_start" | "llm_end" | "llm_error";
2999
+ traceId: string;
3000
+ model: string;
3001
+ operation: "extraction" | "consolidation" | "profile_consolidation" | "identity_consolidation" | "day_summary";
3002
+ input?: string;
3003
+ output?: string;
3004
+ durationMs?: number;
3005
+ error?: string;
3006
+ tokenUsage?: {
3007
+ input?: number;
3008
+ output?: number;
3009
+ total?: number;
3010
+ };
3011
+ }
3012
+ interface RecallTraceEvent {
3013
+ kind: "recall_summary";
3014
+ traceId: string;
3015
+ operation: "recall";
3016
+ sessionKey?: string;
3017
+ promptHash: string;
3018
+ promptLength: number;
3019
+ retrievalQueryHash: string;
3020
+ retrievalQueryLength: number;
3021
+ recallMode: RecallPlanMode;
3022
+ recallResultLimit: number;
3023
+ qmdEnabled: boolean;
3024
+ qmdAvailable: boolean;
3025
+ recallNamespaces: string[];
3026
+ source: "none" | "hot_qmd" | "hot_embedding" | "cold_fallback" | "recent_scan";
3027
+ recalledMemoryCount: number;
3028
+ injected: boolean;
3029
+ contextChars: number;
3030
+ policyVersion?: string;
3031
+ identityInjectionMode?: IdentityInjectionMode | "none";
3032
+ identityInjectedChars?: number;
3033
+ identityInjectionTruncated?: boolean;
3034
+ durationMs: number;
3035
+ timings?: Record<string, string>;
3036
+ /**
3037
+ * The full recalled memory context added to the runtime context.
3038
+ * Only populated when `traceRecallContent` config option is `true`.
3039
+ * Omitted by default to avoid sending potentially sensitive memory content
3040
+ * to external trace collectors unless explicitly opted in.
3041
+ */
3042
+ recalledContent?: string;
3043
+ }
3044
+ type EngramTraceEvent = LlmTraceEvent | RecallTraceEvent;
3045
+ type LlmTraceCallback = (event: EngramTraceEvent) => void;
3046
+ type ModelApi = "openai-completions" | "anthropic-messages" | "google-generative" | "codex-cli" | string;
3047
+ type CodexCliReasoningEffort = "low" | "medium" | "high" | "xhigh";
3048
+ type ModelProviderAuthMode = "bearer" | "header" | "query";
3049
+ interface ModelDefinitionConfig {
3050
+ id: string;
3051
+ name?: string;
3052
+ contextWindow?: number;
3053
+ maxOutputTokens?: number;
3054
+ costPer1MInput?: number;
3055
+ costPer1MOutput?: number;
3056
+ aliases?: string[];
3057
+ }
3058
+ interface ModelProviderConfig {
3059
+ baseUrl: string;
3060
+ apiKey?: string | Record<string, unknown>;
3061
+ auth?: ModelProviderAuthMode;
3062
+ api?: ModelApi;
3063
+ headers?: Record<string, string>;
3064
+ authHeader?: boolean;
3065
+ disableThinking?: boolean;
3066
+ executable?: string;
3067
+ reasoningEffort?: CodexCliReasoningEffort;
3068
+ codexCliExecutable?: string;
3069
+ codexCliReasoningEffort?: CodexCliReasoningEffort;
3070
+ retryOptions?: {
3071
+ timeoutMs?: number;
3072
+ };
3073
+ models: ModelDefinitionConfig[];
3074
+ }
3075
+ interface AgentDefaultsConfig {
3076
+ model?: {
3077
+ primary?: string;
3078
+ backup?: string;
3079
+ fallbacks?: string[];
3080
+ };
3081
+ thinking?: {
3082
+ mode?: "off" | "on" | "adaptive";
3083
+ budget?: number;
3084
+ };
3085
+ }
3086
+ interface AgentPersonaModelConfig {
3087
+ primary?: string;
3088
+ fallbacks?: string[];
3089
+ }
3090
+ interface AgentPersona {
3091
+ id: string;
3092
+ name?: string;
3093
+ model?: AgentPersonaModelConfig;
3094
+ }
3095
+ interface GatewayConfig {
3096
+ agents?: {
3097
+ defaults?: AgentDefaultsConfig;
3098
+ list?: AgentPersona[];
3099
+ };
3100
+ models?: {
3101
+ providers?: Record<string, ModelProviderConfig>;
3102
+ };
3103
+ }
3104
+ interface TranscriptEntry {
3105
+ timestamp: string;
3106
+ role: "user" | "assistant";
3107
+ content: string;
3108
+ sessionKey: string;
3109
+ turnId: string;
3110
+ metadata?: {
3111
+ compactAfter?: boolean;
3112
+ compactionId?: string | null;
3113
+ messageId?: string;
3114
+ threadId?: string;
3115
+ replyToId?: string;
3116
+ replyToBody?: string;
3117
+ replyToSender?: string;
3118
+ };
3119
+ }
3120
+ interface Checkpoint {
3121
+ sessionKey: string;
3122
+ capturedAt: string;
3123
+ turns: TranscriptEntry[];
3124
+ ttl: string;
3125
+ }
3126
+ interface HourlySummary {
3127
+ hour: string;
3128
+ sessionKey: string;
3129
+ bullets: string[];
3130
+ turnCount: number;
3131
+ generatedAt: string;
3132
+ }
3133
+
3134
+ export { type BriefingFocus as $, type ActiveRecallChatType as A, type BehaviorSignalEvent as B, type CompressionGuidelineOptimizerState as C, type MemorySummary as D, type EntityStructuredSection as E, type FileHygieneConfig as F, type GatewayConfig as G, type RecallPlanMode as H, type ImportanceScore as I, type IdentityInjectionMode as J, type RecallDisclosure as K, type LiveConnectorsConfig as L, type MemoryCategory as M, type BufferTurn as N, type TranscriptEntry as O, type PluginConfig as P, type QmdSearchResult as Q, type RecallTierExplain as R, type Checkpoint as S, type TopicScore as T, type HourlySummary as U, type SessionObserverBandConfig as V, type LifecycleState as W, type VerificationState as X, type PolicyClass as Y, type BriefingSections as Z, type BriefingFollowup as _, type ActiveRecallQueryMode as a, type WearableNativeMemoryPage as a$, type CalendarSource as a0, type CalendarEvent as a1, type BriefingActiveThread as a2, type BriefingResult as a3, type BriefingRecentEntity as a4, type SecretRef as a5, type AgentAccessAuthToken as a6, type CompressionGuidelineOptimizerEventCounts as a7, type CompressionGuidelineOptimizerActionSummary as a8, type CompressionGuidelineOptimizerRuleUpdate as a9, type WearableSourceConnector as aA, type WearablesConfig as aB, type WearableSyncSummary as aC, type WearableSourceStatus as aD, type WearableDayTranscript as aE, type WearableCorrectionRule as aF, type CodingContext as aG, type BootstrapOptions as aH, type BootstrapResult as aI, type ConsolidationObservation as aJ, type EntityTimelineEntry as aK, type CodingModeConfig as aL, type WearableCleanupSettings as aM, type WearableDayTranscriptMeta as aN, type BriefingConfig as aO, type BriefingOpenCommitment as aP, type BriefingWindow as aQ, type CodexCompatConfig as aR, DEFAULT_RECALL_DISCLOSURE as aS, type ExtractedFact as aT, type MemoryActionEligibilitySource as aU, type MemoryObservation as aV, type MemoryScope as aW, RECALL_DISCLOSURE_LEVELS as aX, type WearableAuthCheck as aY, type WearableFetchOptions as aZ, type WearableFetchPage as a_, type MemoryActionType as aa, type EntityMention as ab, type EntitySchemaDefinition as ac, type EntitySchemaSectionDefinition as ad, type ImportanceLevel as ae, type ExtractionResult as af, type ConsolidationResult as ag, type DaySummaryResult as ah, type MemoryIntent as ai, type QmdSearchExplain as aj, type MemoryActionEligibilityContext as ak, type MemoryActionPolicyResult as al, type MemoryLifecycleEventType as am, type MemoryLifecycleStateSummary as an, type ModelProviderConfig as ao, type NativeKnowledgeConfig as ap, type RetrievalTier as aq, type SignalScanResult as ar, type ConversationThread as as, type DreamsStatusResult as at, type DreamsPhase as au, type DreamsRunResult as av, type WearableConversation as aw, type WearableSourceSettings as ax, type WearableNativeMemory as ay, type WearableMemoryMode as az, type ActiveRecallPromptStyle as b, type ReasoningEffort as b$, type WearableTranscriptSegment as b0, isRecallDisclosure as b1, type AgentAccessHttpConfig as b2, type AgentDefaultsConfig as b3, type AgentPersona as b4, type BehaviorLoopAdjustment as b5, type BehaviorSignalDirection as b6, type BehaviorSignalType as b7, type BriefingCalendarSourceError as b8, type BufferEntryState as b9, type ExtractedReasoningTraceStep as bA, type ExtractedRelationship as bB, type ExtractionPassSource as bC, type GitHubLiveConnectorConfig as bD, type GmailLiveConnectorConfig as bE, type GoogleDriveLiveConnectorConfig as bF, type HeartbeatConfig as bG, type HeartbeatDetectionMode as bH, type LlmTraceCallback as bI, type LlmTraceEvent as bJ, type MemoryActionOutcome as bK, type MemoryActionPolicyDecision as bL, type MemoryActionStatus as bM, type MemoryLinkType as bN, type MemoryOsPresetName as bO, type ModelApi as bP, type ModelDefinitionConfig as bQ, type ModelProviderAuthMode as bR, type NamespacePolicy as bS, type NativeKnowledgeFolderRuleConfig as bT, type NativeKnowledgeObsidianVaultConfig as bU, type NativeKnowledgeOpenClawWorkspaceConfig as bV, type NotionLiveConnectorConfig as bW, type PrincipalFromSessionKeyMode as bX, type PrincipalRule as bY, type ProceduralConfig as bZ, type QuestionEntry as b_, type CaptureMode as ba, type CodexCliReasoningEffort as bb, type CodexCompactionFlushMode as bc, type CodexConnectorConfig as bd, type CompressionGuidelineActivationState as be, type CompressionGuidelineOptimizerSourceWindow as bf, type ConfidenceTier as bg, type ConsolidationAction as bh, type ConsolidationItem as bi, type ContinuityIncidentState as bj, type ContinuityLoopCadence as bk, type ContinuityLoopStatus as bl, type ContradictionScanConfig as bm, type CronConversationRecallMode as bn, type CronRecallMode as bo, type DreamingConfig as bp, type DreamingNarrativePromptStyle as bq, type DreamsDeepSleepConfig as br, type DreamsLightSleepConfig as bs, type DreamsPhaseStatus as bt, type DreamsPhasesConfig as bu, type DreamsRemConfig as bv, type EngramTraceEvent as bw, type ExtractedProcedureStep as bx, type ExtractedQuestion as by, type ExtractedReasoningTrace as bz, type ActiveRecallThinking as c, type RecallPipelineConfig as c0, type RecallSectionConfig as c1, type RecallTraceEvent as c2, type RelevanceFeedback as c3, SPECULATIVE_TTL_DAYS as c4, type ScoredEntity as c5, type SemanticChunkingConfigShape as c6, type SignalLevel as c7, type SlotBehaviorConfig as c8, type SlotMismatchMode as c9, type TriggerMode as ca, confidenceTier as cb, type ActiveRecallModelFallbackPolicy as d, type BehaviorLoopPolicyState as e, type AgentPersonaModelConfig as f, type MemoryFile as g, type MemoryLink as h, type MemoryFrontmatter as i, type MemoryStatus as j, type BufferState as k, type MetaState as l, type MemoryActionEvent as m, type MemoryLifecycleEvent as n, type BufferSurpriseEvent as o, type ContinuityIncidentOpenInput as p, type ContinuityIncidentRecord as q, type ContinuityIncidentCloseInput as r, type ContinuityImprovementLoop as s, type ContinuityLoopUpsertInput as t, type ContinuityLoopReviewInput as u, type EntityRelationship as v, type EntityActivityEntry as w, type EntityFile as x, type AccessTrackingEntry as y, type MemoryProjectionCurrentState as z };