clawvault 2.6.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/bin/command-registration.test.js +1 -3
  2. package/bin/register-core-commands.js +10 -23
  3. package/bin/register-maintenance-commands.js +3 -20
  4. package/bin/register-query-commands.js +23 -0
  5. package/bin/register-task-commands.js +1 -18
  6. package/bin/register-task-commands.test.js +0 -16
  7. package/bin/register-vault-operations-commands.js +1 -29
  8. package/dist/{chunk-QVMXF7FY.js → chunk-3D6BCTP6.js} +39 -1
  9. package/dist/{chunk-R2MIW5G7.js → chunk-3DHXQHYG.js} +1 -1
  10. package/dist/{chunk-Q2J5YTUF.js → chunk-3NSBOUT3.js} +73 -36
  11. package/dist/chunk-3RG5ZIWI.js +10 -0
  12. package/dist/{chunk-AZYOKJYC.js → chunk-62YTUT6J.js} +2 -2
  13. package/dist/chunk-6U6MK36V.js +205 -0
  14. package/dist/{chunk-4QYGFWRM.js → chunk-7R7O6STJ.js} +4 -4
  15. package/dist/{chunk-VXEOHTSL.js → chunk-C7OK5WKP.js} +4 -4
  16. package/dist/chunk-CMB7UL7C.js +327 -0
  17. package/dist/chunk-DEFFDRVP.js +938 -0
  18. package/dist/{chunk-K3CDT7IH.js → chunk-E7MFQB6D.js} +61 -20
  19. package/dist/{chunk-ME37YNW3.js → chunk-F2JEUD4J.js} +6 -4
  20. package/dist/chunk-GAJV4IGR.js +82 -0
  21. package/dist/chunk-GQSLDZTS.js +560 -0
  22. package/dist/{chunk-4OXMU5S2.js → chunk-GUKMRGM7.js} +1 -1
  23. package/dist/{chunk-YOSEUUNB.js → chunk-H34S76MB.js} +6 -6
  24. package/dist/{chunk-4TE4JMLA.js → chunk-JY6FYXIT.js} +10 -5
  25. package/dist/chunk-K234IDRJ.js +1073 -0
  26. package/dist/{chunk-IEVLHNLU.js → chunk-LNJA2UGL.js} +86 -9
  27. package/dist/{chunk-MFAWT5O5.js → chunk-LYHGEHXG.js} +1 -0
  28. package/dist/chunk-MFM6K7PU.js +374 -0
  29. package/dist/{chunk-QWQ3TIKS.js → chunk-N2AXRYLC.js} +1 -1
  30. package/dist/chunk-PAH27GSN.js +108 -0
  31. package/dist/{chunk-OIWVQYQF.js → chunk-QBLMXKF2.js} +1 -1
  32. package/dist/{chunk-FHFUXL6G.js → chunk-QK3UCXWL.js} +2 -2
  33. package/dist/{chunk-2YDBJS7M.js → chunk-SJSFRIYS.js} +1 -1
  34. package/dist/{chunk-GSD4ALSI.js → chunk-U55BGUAU.js} +2 -2
  35. package/dist/{chunk-PBEE567J.js → chunk-VGLOTGAS.js} +1 -1
  36. package/dist/{chunk-F55HGNU4.js → chunk-WAZ3NLWL.js} +47 -0
  37. package/dist/{chunk-KL4NAOMO.js → chunk-WGRQ6HDV.js} +1 -1
  38. package/dist/{chunk-UEOUADMO.js → chunk-YKTA5JOJ.js} +13 -10
  39. package/dist/{chunk-XAVB4GB4.js → chunk-ZVVFWOLW.js} +4 -4
  40. package/dist/cli/index.cjs +10033 -0
  41. package/dist/cli/index.d.cts +5 -0
  42. package/dist/cli/index.js +20 -18
  43. package/dist/commands/archive.cjs +287 -0
  44. package/dist/commands/archive.d.cts +11 -0
  45. package/dist/commands/archive.js +1 -0
  46. package/dist/commands/backlog.cjs +721 -0
  47. package/dist/commands/backlog.d.cts +53 -0
  48. package/dist/commands/backlog.js +3 -2
  49. package/dist/commands/blocked.cjs +204 -0
  50. package/dist/commands/blocked.d.cts +26 -0
  51. package/dist/commands/blocked.js +3 -2
  52. package/dist/commands/checkpoint.cjs +244 -0
  53. package/dist/commands/checkpoint.d.cts +41 -0
  54. package/dist/commands/checkpoint.js +2 -1
  55. package/dist/commands/compat.cjs +369 -0
  56. package/dist/commands/compat.d.cts +28 -0
  57. package/dist/commands/compat.js +2 -1
  58. package/dist/commands/context.cjs +2989 -0
  59. package/dist/commands/context.d.cts +2 -0
  60. package/dist/commands/context.js +5 -4
  61. package/dist/commands/doctor.cjs +3062 -0
  62. package/dist/commands/doctor.d.cts +21 -0
  63. package/dist/commands/doctor.d.ts +6 -1
  64. package/dist/commands/doctor.js +13 -11
  65. package/dist/commands/embed.cjs +232 -0
  66. package/dist/commands/embed.d.cts +17 -0
  67. package/dist/commands/embed.js +5 -2
  68. package/dist/commands/entities.cjs +141 -0
  69. package/dist/commands/entities.d.cts +7 -0
  70. package/dist/commands/entities.js +1 -0
  71. package/dist/commands/graph.cjs +501 -0
  72. package/dist/commands/graph.d.cts +21 -0
  73. package/dist/commands/graph.js +1 -0
  74. package/dist/commands/inject.cjs +1636 -0
  75. package/dist/commands/inject.d.cts +2 -0
  76. package/dist/commands/inject.d.ts +1 -1
  77. package/dist/commands/inject.js +4 -2
  78. package/dist/commands/kanban.cjs +884 -0
  79. package/dist/commands/kanban.d.cts +63 -0
  80. package/dist/commands/kanban.js +4 -3
  81. package/dist/commands/link.cjs +965 -0
  82. package/dist/commands/link.d.cts +11 -0
  83. package/dist/commands/link.js +1 -0
  84. package/dist/commands/migrate-observations.cjs +362 -0
  85. package/dist/commands/migrate-observations.d.cts +19 -0
  86. package/dist/commands/migrate-observations.js +3 -2
  87. package/dist/commands/observe.cjs +4099 -0
  88. package/dist/commands/observe.d.cts +23 -0
  89. package/dist/commands/observe.d.ts +1 -0
  90. package/dist/commands/observe.js +11 -9
  91. package/dist/commands/project.cjs +1341 -0
  92. package/dist/commands/project.d.cts +85 -0
  93. package/dist/commands/project.js +5 -4
  94. package/dist/commands/rebuild.cjs +3136 -0
  95. package/dist/commands/rebuild.d.cts +11 -0
  96. package/dist/commands/rebuild.js +10 -8
  97. package/dist/commands/recover.cjs +361 -0
  98. package/dist/commands/recover.d.cts +38 -0
  99. package/dist/commands/recover.js +3 -2
  100. package/dist/commands/reflect.cjs +1008 -0
  101. package/dist/commands/reflect.d.cts +11 -0
  102. package/dist/commands/reflect.js +6 -4
  103. package/dist/commands/repair-session.cjs +457 -0
  104. package/dist/commands/repair-session.d.cts +38 -0
  105. package/dist/commands/repair-session.js +1 -0
  106. package/dist/commands/replay.cjs +4103 -0
  107. package/dist/commands/replay.d.cts +16 -0
  108. package/dist/commands/replay.js +12 -10
  109. package/dist/commands/session-recap.cjs +353 -0
  110. package/dist/commands/session-recap.d.cts +27 -0
  111. package/dist/commands/session-recap.js +1 -0
  112. package/dist/commands/setup.cjs +1345 -0
  113. package/dist/commands/setup.d.cts +100 -0
  114. package/dist/commands/setup.d.ts +90 -2
  115. package/dist/commands/setup.js +21 -2
  116. package/dist/commands/shell-init.cjs +75 -0
  117. package/dist/commands/shell-init.d.cts +7 -0
  118. package/dist/commands/shell-init.js +2 -0
  119. package/dist/commands/sleep.cjs +6028 -0
  120. package/dist/commands/sleep.d.cts +36 -0
  121. package/dist/commands/sleep.d.ts +1 -1
  122. package/dist/commands/sleep.js +17 -15
  123. package/dist/commands/status.cjs +2736 -0
  124. package/dist/commands/status.d.cts +52 -0
  125. package/dist/commands/status.js +12 -10
  126. package/dist/commands/tailscale.cjs +1532 -0
  127. package/dist/commands/tailscale.d.cts +52 -0
  128. package/dist/commands/tailscale.js +1 -0
  129. package/dist/commands/task.cjs +1236 -0
  130. package/dist/commands/task.d.cts +97 -0
  131. package/dist/commands/task.js +4 -3
  132. package/dist/commands/template.cjs +457 -0
  133. package/dist/commands/template.d.cts +36 -0
  134. package/dist/commands/template.js +2 -1
  135. package/dist/commands/wake.cjs +2626 -0
  136. package/dist/commands/wake.d.cts +22 -0
  137. package/dist/commands/wake.d.ts +1 -1
  138. package/dist/commands/wake.js +12 -11
  139. package/dist/context-BUGaWpyL.d.cts +46 -0
  140. package/dist/index.cjs +14526 -0
  141. package/dist/index.d.cts +858 -0
  142. package/dist/index.d.ts +192 -7
  143. package/dist/index.js +101 -75
  144. package/dist/{inject-x65KXWPk.d.ts → inject-Bzi5E-By.d.cts} +1 -1
  145. package/dist/inject-Bzi5E-By.d.ts +137 -0
  146. package/dist/lib/auto-linker.cjs +176 -0
  147. package/dist/lib/auto-linker.d.cts +26 -0
  148. package/dist/lib/auto-linker.js +1 -0
  149. package/dist/lib/canvas-layout.cjs +136 -0
  150. package/dist/lib/canvas-layout.d.cts +31 -0
  151. package/dist/lib/canvas-layout.d.ts +16 -100
  152. package/dist/lib/canvas-layout.js +78 -20
  153. package/dist/lib/config.cjs +78 -0
  154. package/dist/lib/config.d.cts +11 -0
  155. package/dist/lib/config.js +1 -0
  156. package/dist/lib/entity-index.cjs +84 -0
  157. package/dist/lib/entity-index.d.cts +26 -0
  158. package/dist/lib/entity-index.js +1 -0
  159. package/dist/lib/project-utils.cjs +864 -0
  160. package/dist/lib/project-utils.d.cts +97 -0
  161. package/dist/lib/project-utils.js +4 -3
  162. package/dist/lib/session-repair.cjs +239 -0
  163. package/dist/lib/session-repair.d.cts +110 -0
  164. package/dist/lib/session-repair.js +1 -0
  165. package/dist/lib/session-utils.cjs +209 -0
  166. package/dist/lib/session-utils.d.cts +63 -0
  167. package/dist/lib/session-utils.js +1 -0
  168. package/dist/lib/tailscale.cjs +1183 -0
  169. package/dist/lib/tailscale.d.cts +225 -0
  170. package/dist/lib/tailscale.js +1 -0
  171. package/dist/lib/task-utils.cjs +1137 -0
  172. package/dist/lib/task-utils.d.cts +208 -0
  173. package/dist/lib/task-utils.js +3 -2
  174. package/dist/lib/template-engine.cjs +47 -0
  175. package/dist/lib/template-engine.d.cts +11 -0
  176. package/dist/lib/template-engine.js +1 -0
  177. package/dist/lib/webdav.cjs +568 -0
  178. package/dist/lib/webdav.d.cts +109 -0
  179. package/dist/lib/webdav.js +1 -0
  180. package/dist/plugin/index.cjs +1907 -0
  181. package/dist/plugin/index.d.cts +36 -0
  182. package/dist/plugin/index.d.ts +36 -0
  183. package/dist/plugin/index.js +572 -0
  184. package/dist/plugin/inject.cjs +356 -0
  185. package/dist/plugin/inject.d.cts +54 -0
  186. package/dist/plugin/inject.d.ts +54 -0
  187. package/dist/plugin/inject.js +17 -0
  188. package/dist/plugin/observe.cjs +631 -0
  189. package/dist/plugin/observe.d.cts +39 -0
  190. package/dist/plugin/observe.d.ts +39 -0
  191. package/dist/plugin/observe.js +18 -0
  192. package/dist/plugin/templates.cjs +593 -0
  193. package/dist/plugin/templates.d.cts +52 -0
  194. package/dist/plugin/templates.d.ts +52 -0
  195. package/dist/plugin/templates.js +25 -0
  196. package/dist/plugin/types.cjs +18 -0
  197. package/dist/plugin/types.d.cts +209 -0
  198. package/dist/plugin/types.d.ts +209 -0
  199. package/dist/plugin/types.js +0 -0
  200. package/dist/plugin/vault.cjs +927 -0
  201. package/dist/plugin/vault.d.cts +68 -0
  202. package/dist/plugin/vault.d.ts +68 -0
  203. package/dist/plugin/vault.js +22 -0
  204. package/dist/{types-C74wgGL1.d.ts → types-Y2_Um2Ls.d.cts} +44 -1
  205. package/dist/types-Y2_Um2Ls.d.ts +205 -0
  206. package/hooks/clawvault/handler.js +70 -7
  207. package/hooks/clawvault/handler.test.js +91 -0
  208. package/openclaw.plugin.json +56 -0
  209. package/package.json +17 -7
  210. package/templates/memory-event.md +67 -0
  211. package/templates/party.md +63 -0
  212. package/templates/primitive-registry.yaml +551 -0
  213. package/templates/run.md +68 -0
  214. package/templates/trigger.md +68 -0
  215. package/templates/workspace.md +50 -0
  216. package/dashboard/lib/graph-diff.js +0 -104
  217. package/dashboard/lib/graph-diff.test.js +0 -75
  218. package/dashboard/lib/vault-parser.js +0 -556
  219. package/dashboard/lib/vault-parser.test.js +0 -254
  220. package/dashboard/public/app.js +0 -796
  221. package/dashboard/public/index.html +0 -52
  222. package/dashboard/public/styles.css +0 -221
  223. package/dashboard/server.js +0 -374
  224. package/dist/chunk-HA5M6KJB.js +0 -33
  225. package/dist/chunk-MAKNAHAW.js +0 -375
  226. package/dist/chunk-MDIH26GC.js +0 -183
  227. package/dist/chunk-MGDEINGP.js +0 -99
  228. package/dist/chunk-RVYA52PY.js +0 -363
  229. package/dist/commands/canvas.d.ts +0 -15
  230. package/dist/commands/canvas.js +0 -199
  231. package/dist/commands/sync-bd.d.ts +0 -10
  232. package/dist/commands/sync-bd.js +0 -9
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import { Command } from 'commander';
2
- import { V as VaultConfig, S as StoreOptions, D as Document, a as SearchOptions, b as SearchResult, c as SyncOptions, d as SyncResult, C as Category, M as MemoryType, H as HandoffDocument, e as SessionRecap } from './types-C74wgGL1.js';
3
- export { f as DEFAULT_CATEGORIES, g as DEFAULT_CONFIG, h as MEMORY_TYPES, T as TYPE_TO_CATEGORY, i as VaultMeta } from './types-C74wgGL1.js';
2
+ import { V as VaultConfig, S as StoreOptions, D as Document, a as SearchOptions, b as SearchResult, c as SyncOptions, d as SyncResult, C as Category, M as MemoryType, H as HandoffDocument, e as SessionRecap, E as ExtractedDate, f as ExtractedPreference } from './types-Y2_Um2Ls.js';
3
+ export { g as DEFAULT_CATEGORIES, h as DEFAULT_CONFIG, i as MEMORY_TYPES, T as TYPE_TO_CATEGORY, j as VaultMeta } from './types-Y2_Um2Ls.js';
4
4
  export { setupCommand } from './commands/setup.js';
5
5
  export { CompatCheck, CompatCommandOptions, CompatReport, CompatStatus, checkOpenClawCompatibility, compatCommand, compatibilityExitCode } from './commands/compat.js';
6
6
  export { GraphSummary, graphCommand, graphSummary } from './commands/graph.js';
7
7
  export { KanbanGroupBy, KanbanImportChange, KanbanImportOptions, KanbanImportResult, KanbanLane, KanbanSyncOptions, KanbanSyncResult, ParsedKanbanBoard, ParsedKanbanLane, buildKanbanLanes, extractCardSlug, formatKanbanCard, generateKanbanMarkdown, importKanbanBoard, kanbanCommand, parseKanbanMarkdown, syncKanbanBoard } from './commands/kanban.js';
8
8
  export { C as ContextEntry, a as ContextFormat, b as ContextOptions, c as ContextProfile, d as ContextProfileInput, e as ContextProfileOption, f as ContextResult, R as ResolvedContextProfile, g as buildContext, h as contextCommand, i as formatContextMarkdown, j as inferContextProfile, n as normalizeContextProfileInput, r as registerContextCommand, k as resolveContextProfile } from './context-BUGaWpyL.js';
9
- export { I as InjectCommandOptions, a as InjectFormat, b as InjectMatch, c as InjectMatchReason, d as InjectMatchSource, e as InjectResult, f as InjectRuntimeOptions, g as InjectSourceCategory, h as InjectableItem, L as LlmCompletionOptions, i as LlmProvider, M as MEMORY_GRAPH_SCHEMA_VERSION, j as MemoryGraph, k as MemoryGraphEdge, l as MemoryGraphEdgeType, m as MemoryGraphIndex, n as MemoryGraphNode, o as MemoryGraphNodeType, p as MemoryGraphStats, q as buildInjectionResult, r as buildOrUpdateMemoryGraphIndex, s as deterministicInjectMatches, t as getMemoryGraph, u as indexInjectableItems, v as injectCommand, w as loadMemoryGraphIndex, x as registerInjectCommand, y as requestLlmCompletion, z as resolveLlmProvider, A as runPromptInjection } from './inject-x65KXWPk.js';
9
+ export { I as InjectCommandOptions, a as InjectFormat, b as InjectMatch, c as InjectMatchReason, d as InjectMatchSource, e as InjectResult, f as InjectRuntimeOptions, g as InjectSourceCategory, h as InjectableItem, L as LlmCompletionOptions, i as LlmProvider, M as MEMORY_GRAPH_SCHEMA_VERSION, j as MemoryGraph, k as MemoryGraphEdge, l as MemoryGraphEdgeType, m as MemoryGraphIndex, n as MemoryGraphNode, o as MemoryGraphNodeType, p as MemoryGraphStats, q as buildInjectionResult, r as buildOrUpdateMemoryGraphIndex, s as deterministicInjectMatches, t as getMemoryGraph, u as indexInjectableItems, v as injectCommand, w as loadMemoryGraphIndex, x as registerInjectCommand, y as requestLlmCompletion, z as resolveLlmProvider, A as runPromptInjection } from './inject-Bzi5E-By.js';
10
10
  export { ObserveCommandOptions, observeCommand, registerObserveCommand } from './commands/observe.js';
11
11
  export { ReflectCommandOptions, reflectCommand, registerReflectCommand } from './commands/reflect.js';
12
12
  export { ArchiveCommandOptions, archiveCommand, registerArchiveCommand } from './commands/archive.js';
@@ -15,7 +15,6 @@ export { DoctorCheck, DoctorReport, DoctorStatus, doctor } from './commands/doct
15
15
  export { EmbedCommandOptions, EmbedCommandResult, embedCommand, registerEmbedCommand } from './commands/embed.js';
16
16
  export { ReplayCommandOptions, registerReplayCommand, replayCommand } from './commands/replay.js';
17
17
  export { MigrateObservationsOptions, MigrateObservationsResult, migrateObservations, migrateObservationsCommand, registerMigrateObservationsCommand } from './commands/migrate-observations.js';
18
- export { SyncBdCommandOptions, registerSyncBdCommand, syncBdCommand } from './commands/sync-bd.js';
19
18
  export { SessionRecapFormat, SessionRecapOptions, SessionRecapResult, SessionTurn, buildSessionRecap, formatSessionRecapMarkdown, sessionRecapCommand } from './commands/session-recap.js';
20
19
  export { findNearestVaultPath, getVaultPath, resolveVaultPath } from './lib/config.js';
21
20
  export { registerCliCommands } from './cli/index.js';
@@ -179,9 +178,131 @@ declare function createVault(vaultPath: string, options?: Partial<VaultConfig>,
179
178
  skipGraph?: boolean;
180
179
  }): Promise<ClawVault>;
181
180
 
181
+ interface ReweaveCommandOptions {
182
+ vaultPath?: string;
183
+ since?: string;
184
+ dryRun?: boolean;
185
+ threshold?: number;
186
+ }
187
+ declare function reweaveCommand(options: ReweaveCommandOptions): Promise<void>;
188
+ declare function registerReweaveCommand(program: Command): void;
189
+
190
+ declare const OBSERVATION_TYPES: readonly ["decision", "preference", "fact", "commitment", "task", "todo", "commitment-unresolved", "milestone", "lesson", "relationship", "project"];
191
+ type ObservationType = typeof OBSERVATION_TYPES[number];
192
+ type LegacyObservationPriority = '🔴' | '🟡' | '🟢';
193
+ type ObservationLineKind = 'scored' | 'emoji';
194
+ interface ParsedObservationRecord {
195
+ date: string;
196
+ type: ObservationType;
197
+ confidence: number;
198
+ importance: number;
199
+ content: string;
200
+ format: ObservationLineKind;
201
+ priority?: LegacyObservationPriority;
202
+ time?: string;
203
+ rawLine: string;
204
+ }
205
+
206
+ /**
207
+ * Reweave — Backward memory consolidation for ClawVault
208
+ *
209
+ * When new observations are written, reweave performs a backward pass over
210
+ * existing observations to detect knowledge updates (same entity, new value).
211
+ * Older observations are marked as superseded so search always returns the
212
+ * latest version of a fact.
213
+ *
214
+ * Design inspired by Ars Contexta's "notes are hypotheses" philosophy —
215
+ * every observation is a claim that can be superseded by newer evidence.
216
+ */
217
+
218
+ interface SupersessionRecord {
219
+ /** The older observation that was superseded */
220
+ oldObservation: ParsedObservationRecord;
221
+ /** The newer observation that supersedes it */
222
+ newObservation: ParsedObservationRecord;
223
+ /** File path of the older observation */
224
+ oldFile: string;
225
+ /** File path of the newer observation */
226
+ newFile: string;
227
+ /** Reason for supersession */
228
+ reason: string;
229
+ /** Timestamp of detection */
230
+ detectedAt: string;
231
+ }
232
+ interface ReweaveResult {
233
+ /** Number of observation files scanned */
234
+ filesScanned: number;
235
+ /** Number of individual observations checked */
236
+ observationsChecked: number;
237
+ /** Supersession records found/applied */
238
+ supersessions: SupersessionRecord[];
239
+ /** Whether this was a dry run */
240
+ dryRun: boolean;
241
+ }
242
+ interface ReweaveOptions {
243
+ vaultPath: string;
244
+ /** Only process observations since this date (YYYY-MM-DD) */
245
+ since?: string;
246
+ /** Dry run — report but don't write */
247
+ dryRun?: boolean;
248
+ /** Similarity threshold for entity matching (0-1). Default 0.6 */
249
+ similarityThreshold?: number;
250
+ }
251
+ declare function isSuperseded(line: string): boolean;
252
+ declare function getSupersessionInfo(line: string): {
253
+ supersededBy: string;
254
+ detectedAt: string;
255
+ } | null;
256
+ /**
257
+ * Extract key entities/subjects from an observation for matching.
258
+ * Returns normalized tokens that represent the "what" of the observation.
259
+ */
260
+ declare function extractEntities(content: string): string[];
261
+ /**
262
+ * Compute similarity between two observations based on entity overlap.
263
+ * Returns 0-1 where 1 = identical entities.
264
+ */
265
+ declare function entitySimilarity(a: string[], b: string[]): number;
266
+ /**
267
+ * Check if two observations represent a knowledge update.
268
+ * Both must be about the same entity/subject but with different values.
269
+ *
270
+ * Heuristic: high entity overlap + different observation content = update.
271
+ * Same content = duplicate, not update.
272
+ */
273
+ declare function isKnowledgeUpdate(older: ParsedObservationRecord, newer: ParsedObservationRecord, threshold?: number): {
274
+ isUpdate: boolean;
275
+ reason: string;
276
+ };
277
+ /**
278
+ * Run backward consolidation across observations.
279
+ *
280
+ * For each newer observation, check all older observations for knowledge updates.
281
+ * When found, mark the older one as superseded.
282
+ */
283
+ declare function reweave(options: ReweaveOptions): ReweaveResult;
284
+ /**
285
+ * Filter search results to prefer latest versions of superseded observations.
286
+ * When multiple observations cover the same entity, only keep the newest.
287
+ *
288
+ * This is called from the search pipeline to boost knowledge update accuracy.
289
+ */
290
+ declare function filterSuperseded(lines: string[]): string[];
291
+ /**
292
+ * Given observation markdown content, return only non-superseded lines.
293
+ * Preserves date headings and structure.
294
+ */
295
+ declare function stripSupersededObservations(markdown: string): string;
296
+
182
297
  /**
183
298
  * ClawVault Search Engine - qmd Backend
184
299
  * Uses qmd CLI for BM25 and vector search
300
+ *
301
+ * v2.7.0 enhancements:
302
+ * 1. Chunk-level BM25 pre-filtering (from eval v4 adapter)
303
+ * 2. Exhaustive threshold-based retrieval (from eval v6 adapter)
304
+ * 3. Preference extraction pipeline (from eval v3 adapter)
305
+ * 4. Temporal date indexing at ingest time (from eval v8 design)
185
306
  */
186
307
 
187
308
  declare const QMD_INSTALL_URL = "https://github.com/tobi/qmd";
@@ -201,6 +322,31 @@ declare function qmdUpdate(collection?: string, indexName?: string): void;
201
322
  * Trigger qmd embed (create/update vector embeddings)
202
323
  */
203
324
  declare function qmdEmbed(collection?: string, indexName?: string): void;
325
+ /**
326
+ * Split text into ~maxChars sentence-aligned chunks with overlap.
327
+ */
328
+ declare function sentenceChunk(text: string, maxChars?: number, overlapSentences?: number): string[];
329
+ /**
330
+ * BM25-rank chunks within a document by keyword overlap.
331
+ * Returns the top `max` chunks sorted by relevance, always including the
332
+ * first chunk (session context) when available.
333
+ */
334
+ declare function bm25RankChunks(chunks: string[], terms: string[], max?: number): {
335
+ text: string;
336
+ score: number;
337
+ }[];
338
+ /**
339
+ * Extract all date references from text content. Designed to run at ingest
340
+ * time so temporal queries can use structured dates + JS arithmetic instead
341
+ * of relying on LLM date math at query time.
342
+ */
343
+ declare function extractDates(text: string, sessionDateStr?: string): ExtractedDate[];
344
+ /**
345
+ * Extract user preferences from conversation text. Runs at ingest time to
346
+ * build a structured preference index for personalised recommendations.
347
+ */
348
+ declare function extractPreferences(text: string, documentId?: string): ExtractedPreference[];
349
+ declare function classifyQuestion(q: string): 'preference' | 'temporal' | 'aggregation' | 'default';
204
350
  /**
205
351
  * QMD Search Engine - wraps qmd CLI
206
352
  */
@@ -210,6 +356,12 @@ declare class SearchEngine {
210
356
  private vaultPath;
211
357
  private collectionRoot;
212
358
  private qmdIndexName?;
359
+ /** v2.7 — Per-document date index built at ingest time */
360
+ private dateIndex;
361
+ /** v2.7 — Per-document preference index built at ingest time */
362
+ private preferenceIndex;
363
+ /** v2.7 — Per-document chunk cache for BM25 pre-filtering */
364
+ private chunkCache;
213
365
  /**
214
366
  * Set the collection name (usually vault name)
215
367
  */
@@ -227,7 +379,8 @@ declare class SearchEngine {
227
379
  */
228
380
  setIndexName(indexName?: string): void;
229
381
  /**
230
- * Add or update a document in the local cache
382
+ * Add or update a document in the local cache.
383
+ * v2.7: also extracts dates, preferences, and chunks at ingest time.
231
384
  * Note: qmd indexing happens via qmd update command
232
385
  */
233
386
  addDocument(doc: Document): void;
@@ -252,6 +405,32 @@ declare class SearchEngine {
252
405
  */
253
406
  query(query: string, options?: SearchOptions): SearchResult[];
254
407
  private runQmdQuery;
408
+ /**
409
+ * v2.7 — Chunk-level BM25 pre-filtered search. Ranks chunks within each
410
+ * document by keyword relevance before semantic ranking, so relevant
411
+ * content deep in long documents isn't missed.
412
+ *
413
+ * Returns results with snippets from the best-matching chunks.
414
+ */
415
+ chunkPrefilterSearch(query: string, options?: SearchOptions): SearchResult[];
416
+ /**
417
+ * v2.7 — Exhaustive threshold-based search for aggregation queries.
418
+ * Keeps pulling results until relevance drops below threshold.
419
+ */
420
+ exhaustiveSearch(query: string, threshold?: number, maxResults?: number): SearchResult[];
421
+ /**
422
+ * v2.7 — Get all extracted dates, optionally filtered by document ids.
423
+ */
424
+ getDates(documentIds?: string[]): ExtractedDate[];
425
+ /**
426
+ * v2.7 — Get all extracted preferences, optionally filtered by document ids.
427
+ */
428
+ getPreferences(documentIds?: string[]): ExtractedPreference[];
429
+ /**
430
+ * v2.7 — Search with automatic strategy selection based on question type.
431
+ * Classifies the query and routes to the appropriate pipeline.
432
+ */
433
+ smartQuery(query: string, options?: SearchOptions): SearchResult[];
255
434
  /**
256
435
  * Convert qmd results to ClawVault SearchResult format
257
436
  */
@@ -262,6 +441,11 @@ declare class SearchEngine {
262
441
  * Convert qmd:// URI to file path
263
442
  */
264
443
  private qmdUriToPath;
444
+ /**
445
+ * v2.8 — Filter superseded observation lines from snippet text.
446
+ * Ensures search results prefer the latest version of knowledge.
447
+ */
448
+ private stripSupersededFromSnippet;
265
449
  /**
266
450
  * Clean up qmd snippet format
267
451
  */
@@ -275,7 +459,7 @@ declare class SearchEngine {
275
459
  */
276
460
  get size(): number;
277
461
  /**
278
- * Clear the local document cache
462
+ * Clear the local document cache and all v2.7 indices
279
463
  */
280
464
  clear(): void;
281
465
  /**
@@ -516,6 +700,7 @@ interface ActiveObserveOptions {
516
700
  reflectThreshold?: number;
517
701
  model?: string;
518
702
  extractTasks?: boolean;
703
+ maxSessions?: number;
519
704
  }
520
705
  interface ActiveObservationCandidate {
521
706
  sessionId: string;
@@ -670,4 +855,4 @@ declare function runReflection(options: ReflectOptions): Promise<ReflectResult>;
670
855
  declare const VERSION: string;
671
856
  declare function registerCommanderCommands(program: Command): Command;
672
857
 
673
- export { type ActiveObservationCandidate, type ActiveObservationFailure, type ActiveObserveOptions, type ActiveObserveResult, type ArchiveObservationsOptions, type ArchiveObservationsResult, Category, ClawVault, type CompressionProvider, Compressor, type CompressorOptions, type ContextProfile as ConfigDefaultProfile, Document, HandoffDocument, type ManagedConfigKey, MemoryType, type ObserveCursorEntry, type ObserveCursorStore, type ObserveProvider, Observer, type ObserverCompressionProvider, type ObserverCompressor, type ObserverOptions, type ObserverReflector, type ObserverStalenessResult, QMD_INSTALL_COMMAND, QMD_INSTALL_URL, QmdUnavailableError, type ReflectOptions, type ReflectResult, Reflector, type ReflectorOptions, type RouteRule, SUPPORTED_CONFIG_KEYS, SearchEngine, SearchOptions, SearchResult, SessionRecap, SessionWatcher, type SessionWatcherOptions, StoreOptions, SyncOptions, SyncResult, type Theme, type TransitionEvent, VERSION, VaultConfig, addRouteRule, appendTransition, archiveObservations, buildTransitionEvent, countBlockedTransitions, createVault, extractTags, extractWikiLinks, findVault, formatTransitionsTable, getConfig, getConfigValue, getObserverStaleness, getScaledObservationThresholdBytes, hasQmd, isRegression, listConfig, listRouteRules, matchRouteRule, observeActiveSessions, parseSessionFile, parseSessionSourceLabel, qmdEmbed, qmdUpdate, queryTransitions, readAllTransitions, registerCommanderCommands, removeRouteRule, resetConfig, runReflection, setConfigValue, testRouteRule };
858
+ export { type ActiveObservationCandidate, type ActiveObservationFailure, type ActiveObserveOptions, type ActiveObserveResult, type ArchiveObservationsOptions, type ArchiveObservationsResult, Category, ClawVault, type CompressionProvider, Compressor, type CompressorOptions, type ContextProfile as ConfigDefaultProfile, Document, ExtractedDate, ExtractedPreference, HandoffDocument, type ManagedConfigKey, MemoryType, type ObserveCursorEntry, type ObserveCursorStore, type ObserveProvider, Observer, type ObserverCompressionProvider, type ObserverCompressor, type ObserverOptions, type ObserverReflector, type ObserverStalenessResult, QMD_INSTALL_COMMAND, QMD_INSTALL_URL, QmdUnavailableError, type ReflectOptions, type ReflectResult, Reflector, type ReflectorOptions, type ReweaveOptions, type ReweaveResult, type RouteRule, SUPPORTED_CONFIG_KEYS, SearchEngine, SearchOptions, SearchResult, SessionRecap, SessionWatcher, type SessionWatcherOptions, StoreOptions, type SupersessionRecord, SyncOptions, SyncResult, type Theme, type TransitionEvent, VERSION, VaultConfig, addRouteRule, appendTransition, archiveObservations, bm25RankChunks, buildTransitionEvent, classifyQuestion, countBlockedTransitions, createVault, entitySimilarity, extractDates, extractEntities, extractPreferences, extractTags, extractWikiLinks, filterSuperseded, findVault, formatTransitionsTable, getConfig, getConfigValue, getObserverStaleness, getScaledObservationThresholdBytes, getSupersessionInfo, hasQmd, isKnowledgeUpdate, isRegression, isSuperseded, listConfig, listRouteRules, matchRouteRule, observeActiveSessions, parseSessionFile, parseSessionSourceLabel, qmdEmbed, qmdUpdate, queryTransitions, readAllTransitions, registerCommanderCommands, registerReweaveCommand, removeRouteRule, resetConfig, reweave, reweaveCommand, runReflection, sentenceChunk, setConfigValue, stripSupersededObservations, testRouteRule };
package/dist/index.js CHANGED
@@ -1,31 +1,22 @@
1
- import {
2
- buildSessionRecap,
3
- formatSessionRecapMarkdown,
4
- sessionRecapCommand
5
- } from "./chunk-ZKGY7WTT.js";
6
1
  import {
7
2
  setupCommand
8
- } from "./chunk-RVYA52PY.js";
9
- import {
10
- registerSyncBdCommand,
11
- syncBdCommand
12
- } from "./chunk-MGDEINGP.js";
13
- import {
14
- migrateObservations,
15
- migrateObservationsCommand,
16
- registerMigrateObservationsCommand
17
- } from "./chunk-VXEOHTSL.js";
3
+ } from "./chunk-DEFFDRVP.js";
18
4
  import {
19
5
  rebuildCommand,
20
6
  registerRebuildCommand
21
- } from "./chunk-PBEE567J.js";
7
+ } from "./chunk-VGLOTGAS.js";
22
8
  import {
23
9
  registerReplayCommand,
24
10
  replayCommand
25
- } from "./chunk-4TE4JMLA.js";
11
+ } from "./chunk-JY6FYXIT.js";
12
+ import {
13
+ buildSessionRecap,
14
+ formatSessionRecapMarkdown,
15
+ sessionRecapCommand
16
+ } from "./chunk-ZKGY7WTT.js";
26
17
  import {
27
18
  doctor
28
- } from "./chunk-UEOUADMO.js";
19
+ } from "./chunk-YKTA5JOJ.js";
29
20
  import "./chunk-7ZRP733D.js";
30
21
  import {
31
22
  graphCommand,
@@ -40,12 +31,19 @@ import {
40
31
  kanbanCommand,
41
32
  parseKanbanMarkdown,
42
33
  syncKanbanBoard
43
- } from "./chunk-4OXMU5S2.js";
34
+ } from "./chunk-GUKMRGM7.js";
44
35
  import "./chunk-4VQTUVH7.js";
45
36
  import "./chunk-J7ZWCI2C.js";
46
37
  import {
47
- registerCliCommands
48
- } from "./chunk-HA5M6KJB.js";
38
+ migrateObservations,
39
+ migrateObservationsCommand,
40
+ registerMigrateObservationsCommand
41
+ } from "./chunk-C7OK5WKP.js";
42
+ import {
43
+ registerCliCommands,
44
+ registerReweaveCommand,
45
+ reweaveCommand
46
+ } from "./chunk-GAJV4IGR.js";
49
47
  import {
50
48
  registerTailscaleCommands,
51
49
  registerTailscaleDiscoverCommand,
@@ -83,38 +81,28 @@ import {
83
81
  SessionWatcher,
84
82
  observeCommand,
85
83
  registerObserveCommand
86
- } from "./chunk-ME37YNW3.js";
84
+ } from "./chunk-F2JEUD4J.js";
87
85
  import {
88
86
  parseSessionFile
89
87
  } from "./chunk-P5EPF6MB.js";
90
88
  import {
91
89
  reflectCommand,
92
90
  registerReflectCommand
93
- } from "./chunk-2YDBJS7M.js";
91
+ } from "./chunk-SJSFRIYS.js";
94
92
  import {
95
93
  runReflection
96
- } from "./chunk-YOSEUUNB.js";
97
- import {
98
- buildContext,
99
- contextCommand,
100
- formatContextMarkdown,
101
- inferContextProfile,
102
- normalizeContextProfileInput,
103
- registerContextCommand,
104
- resolveContextProfile
105
- } from "./chunk-XAVB4GB4.js";
94
+ } from "./chunk-H34S76MB.js";
106
95
  import {
107
96
  getObserverStaleness,
108
97
  getScaledObservationThresholdBytes,
109
98
  observeActiveSessions,
110
99
  parseSessionSourceLabel
111
- } from "./chunk-IEVLHNLU.js";
112
- import "./chunk-HRLWZGMA.js";
100
+ } from "./chunk-LNJA2UGL.js";
113
101
  import {
114
102
  Compressor,
115
103
  Observer,
116
104
  Reflector
117
- } from "./chunk-Q2J5YTUF.js";
105
+ } from "./chunk-3NSBOUT3.js";
118
106
  import {
119
107
  archiveProject,
120
108
  createProject,
@@ -123,28 +111,12 @@ import {
123
111
  listProjects,
124
112
  readProject,
125
113
  updateProject
126
- } from "./chunk-AZYOKJYC.js";
127
- import {
128
- ClawVault,
129
- createVault,
130
- findVault
131
- } from "./chunk-KL4NAOMO.js";
132
- import "./chunk-FHFUXL6G.js";
114
+ } from "./chunk-62YTUT6J.js";
115
+ import "./chunk-HRLWZGMA.js";
133
116
  import {
134
117
  embedCommand,
135
118
  registerEmbedCommand
136
- } from "./chunk-4QYGFWRM.js";
137
- import {
138
- QMD_INSTALL_COMMAND,
139
- QMD_INSTALL_URL,
140
- QmdUnavailableError,
141
- SearchEngine,
142
- extractTags,
143
- extractWikiLinks,
144
- hasQmd,
145
- qmdEmbed,
146
- qmdUpdate
147
- } from "./chunk-MAKNAHAW.js";
119
+ } from "./chunk-7R7O6STJ.js";
148
120
  import {
149
121
  buildInjectionResult,
150
122
  deterministicInjectMatches,
@@ -152,11 +124,11 @@ import {
152
124
  injectCommand,
153
125
  registerInjectCommand,
154
126
  runPromptInjection
155
- } from "./chunk-GSD4ALSI.js";
127
+ } from "./chunk-U55BGUAU.js";
156
128
  import {
157
129
  requestLlmCompletion,
158
130
  resolveLlmProvider
159
- } from "./chunk-K3CDT7IH.js";
131
+ } from "./chunk-E7MFQB6D.js";
160
132
  import {
161
133
  SUPPORTED_CONFIG_KEYS,
162
134
  addRouteRule,
@@ -170,12 +142,7 @@ import {
170
142
  setConfigValue,
171
143
  testRouteRule
172
144
  } from "./chunk-ITPEXLHA.js";
173
- import {
174
- DEFAULT_CATEGORIES,
175
- DEFAULT_CONFIG,
176
- MEMORY_TYPES,
177
- TYPE_TO_CATEGORY
178
- } from "./chunk-2CDEETQN.js";
145
+ import "./chunk-PAH27GSN.js";
179
146
  import {
180
147
  archiveCommand,
181
148
  registerArchiveCommand
@@ -188,13 +155,6 @@ import {
188
155
  getVaultPath,
189
156
  resolveVaultPath
190
157
  } from "./chunk-MXSSG3QU.js";
191
- import {
192
- MEMORY_GRAPH_SCHEMA_VERSION,
193
- buildOrUpdateMemoryGraphIndex,
194
- getMemoryGraph,
195
- loadMemoryGraphIndex
196
- } from "./chunk-ZZA73MFY.js";
197
- import "./chunk-Z2XBWN7A.js";
198
158
  import {
199
159
  appendTransition,
200
160
  buildTransitionEvent,
@@ -207,8 +167,8 @@ import {
207
167
  queryTransitions,
208
168
  readAllTransitions,
209
169
  updateTask
210
- } from "./chunk-QWQ3TIKS.js";
211
- import "./chunk-MFAWT5O5.js";
170
+ } from "./chunk-N2AXRYLC.js";
171
+ import "./chunk-LYHGEHXG.js";
212
172
  import {
213
173
  buildTemplateVariables,
214
174
  renderTemplate
@@ -217,7 +177,60 @@ import {
217
177
  checkOpenClawCompatibility,
218
178
  compatCommand,
219
179
  compatibilityExitCode
220
- } from "./chunk-QVMXF7FY.js";
180
+ } from "./chunk-3D6BCTP6.js";
181
+ import {
182
+ buildContext,
183
+ contextCommand,
184
+ formatContextMarkdown,
185
+ inferContextProfile,
186
+ normalizeContextProfileInput,
187
+ registerContextCommand,
188
+ resolveContextProfile
189
+ } from "./chunk-ZVVFWOLW.js";
190
+ import {
191
+ ClawVault,
192
+ createVault,
193
+ findVault
194
+ } from "./chunk-WGRQ6HDV.js";
195
+ import {
196
+ QMD_INSTALL_COMMAND,
197
+ QMD_INSTALL_URL,
198
+ QmdUnavailableError,
199
+ SearchEngine,
200
+ bm25RankChunks,
201
+ classifyQuestion,
202
+ entitySimilarity,
203
+ extractDates,
204
+ extractEntities,
205
+ extractPreferences,
206
+ extractTags,
207
+ extractWikiLinks,
208
+ filterSuperseded,
209
+ getSupersessionInfo,
210
+ hasQmd,
211
+ isKnowledgeUpdate,
212
+ isSuperseded,
213
+ qmdEmbed,
214
+ qmdUpdate,
215
+ reweave,
216
+ sentenceChunk,
217
+ stripSupersededObservations
218
+ } from "./chunk-K234IDRJ.js";
219
+ import {
220
+ DEFAULT_CATEGORIES,
221
+ DEFAULT_CONFIG,
222
+ MEMORY_TYPES,
223
+ TYPE_TO_CATEGORY
224
+ } from "./chunk-2CDEETQN.js";
225
+ import {
226
+ MEMORY_GRAPH_SCHEMA_VERSION,
227
+ buildOrUpdateMemoryGraphIndex,
228
+ getMemoryGraph,
229
+ loadMemoryGraphIndex
230
+ } from "./chunk-ZZA73MFY.js";
231
+ import "./chunk-QK3UCXWL.js";
232
+ import "./chunk-Z2XBWN7A.js";
233
+ import "./chunk-3RG5ZIWI.js";
221
234
 
222
235
  // src/index.ts
223
236
  import * as fs from "fs";
@@ -258,6 +271,7 @@ export {
258
271
  archiveCommand,
259
272
  archiveObservations,
260
273
  archiveProject,
274
+ bm25RankChunks,
261
275
  buildContext,
262
276
  buildInjectionResult,
263
277
  buildKanbanLanes,
@@ -267,6 +281,7 @@ export {
267
281
  buildTransitionEvent,
268
282
  checkOpenClawCompatibility,
269
283
  checkPeerClawVault,
284
+ classifyQuestion,
270
285
  compareManifests,
271
286
  compatCommand,
272
287
  compatibilityExitCode,
@@ -280,11 +295,16 @@ export {
280
295
  discoverClawVaultPeers,
281
296
  doctor,
282
297
  embedCommand,
298
+ entitySimilarity,
283
299
  extractCardSlug,
300
+ extractDates,
301
+ extractEntities,
302
+ extractPreferences,
284
303
  extractTags,
285
304
  extractWikiLinks,
286
305
  fetchRemoteFile,
287
306
  fetchRemoteManifest,
307
+ filterSuperseded,
288
308
  findNearestVaultPath,
289
309
  findPeer,
290
310
  findVault,
@@ -302,6 +322,7 @@ export {
302
322
  getProjectActivity,
303
323
  getProjectTasks,
304
324
  getScaledObservationThresholdBytes,
325
+ getSupersessionInfo,
305
326
  getTailscaleStatus,
306
327
  getTailscaleVersion,
307
328
  getVaultPath,
@@ -313,7 +334,9 @@ export {
313
334
  indexInjectableItems,
314
335
  inferContextProfile,
315
336
  injectCommand,
337
+ isKnowledgeUpdate,
316
338
  isRegression,
339
+ isSuperseded,
317
340
  kanbanCommand,
318
341
  listConfig,
319
342
  listDependentTasks,
@@ -349,7 +372,7 @@ export {
349
372
  registerRebuildCommand,
350
373
  registerReflectCommand,
351
374
  registerReplayCommand,
352
- registerSyncBdCommand,
375
+ registerReweaveCommand,
353
376
  registerTailscaleCommands,
354
377
  registerTailscaleDiscoverCommand,
355
378
  registerTailscaleServeCommand,
@@ -364,14 +387,17 @@ export {
364
387
  resolveLlmProvider,
365
388
  resolvePeerIP,
366
389
  resolveVaultPath,
390
+ reweave,
391
+ reweaveCommand,
367
392
  runPromptInjection,
368
393
  runReflection,
394
+ sentenceChunk,
369
395
  serveVault,
370
396
  sessionRecapCommand,
371
397
  setConfigValue,
372
398
  setupCommand,
373
399
  stopTailscaleServe,
374
- syncBdCommand,
400
+ stripSupersededObservations,
375
401
  syncKanbanBoard,
376
402
  syncWithPeer,
377
403
  tailscaleDiscoverCommand,
@@ -67,7 +67,7 @@ interface LlmCompletionOptions {
67
67
  maxTokens?: number;
68
68
  fetchImpl?: typeof fetch;
69
69
  }
70
- declare function resolveLlmProvider(): LlmProvider | null;
70
+ declare function resolveLlmProvider(fetchImpl?: typeof fetch): Promise<LlmProvider | null>;
71
71
  declare function requestLlmCompletion(options: LlmCompletionOptions): Promise<string>;
72
72
 
73
73
  declare const INJECTABLE_CATEGORIES: readonly ["rules", "decisions", "preferences"];