@remnic/core 1.1.4 → 1.1.6

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