clawvault 2.1.1 → 2.2.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 (54) hide show
  1. package/bin/command-registration.test.js +6 -1
  2. package/bin/help-contract.test.js +2 -0
  3. package/bin/register-maintenance-commands.js +111 -0
  4. package/bin/register-query-commands.js +32 -1
  5. package/bin/register-session-lifecycle-commands.js +2 -0
  6. package/dist/{chunk-USAY3OIO.js → chunk-2HM7ZI4X.js} +273 -435
  7. package/dist/{chunk-TBVI4N53.js → chunk-6RIHODNR.js} +120 -95
  8. package/dist/chunk-73P7XCQM.js +104 -0
  9. package/dist/{chunk-MIIXBNO3.js → chunk-DHBDH4DN.js} +4 -0
  10. package/dist/chunk-GJEGPO7U.js +49 -0
  11. package/dist/chunk-GQVYQCY5.js +396 -0
  12. package/dist/{chunk-TXO34J3O.js → chunk-H7JW4L7H.js} +1 -1
  13. package/dist/{chunk-QFBKWDYR.js → chunk-IFGDPIFI.js} +3 -3
  14. package/dist/chunk-K6XHCUFL.js +123 -0
  15. package/dist/{chunk-PIJGYMQZ.js → chunk-KNDVXXKC.js} +1 -1
  16. package/dist/chunk-L6NB43WV.js +472 -0
  17. package/dist/{chunk-UPHUI5PD.js → chunk-LB6P4CD5.js} +20 -7
  18. package/dist/chunk-MGDEINGP.js +99 -0
  19. package/dist/chunk-MQUJNOHK.js +58 -0
  20. package/dist/chunk-P5EPF6MB.js +182 -0
  21. package/dist/chunk-VR5NE7PZ.js +45 -0
  22. package/dist/chunk-WZI3OAE5.js +111 -0
  23. package/dist/chunk-Z2XBWN7A.js +247 -0
  24. package/dist/{chunk-O5V7SD5C.js → chunk-ZZA73MFY.js} +1 -1
  25. package/dist/commands/archive.d.ts +11 -0
  26. package/dist/commands/archive.js +11 -0
  27. package/dist/commands/context.d.ts +1 -1
  28. package/dist/commands/context.js +6 -4
  29. package/dist/commands/doctor.js +6 -6
  30. package/dist/commands/graph.js +2 -2
  31. package/dist/commands/link.js +1 -1
  32. package/dist/commands/migrate-observations.d.ts +19 -0
  33. package/dist/commands/migrate-observations.js +13 -0
  34. package/dist/commands/observe.js +5 -2
  35. package/dist/commands/rebuild.d.ts +11 -0
  36. package/dist/commands/rebuild.js +12 -0
  37. package/dist/commands/reflect.d.ts +11 -0
  38. package/dist/commands/reflect.js +13 -0
  39. package/dist/commands/replay.d.ts +16 -0
  40. package/dist/commands/replay.js +14 -0
  41. package/dist/commands/setup.js +2 -2
  42. package/dist/commands/sleep.d.ts +1 -0
  43. package/dist/commands/sleep.js +29 -6
  44. package/dist/commands/status.js +6 -6
  45. package/dist/commands/sync-bd.d.ts +10 -0
  46. package/dist/commands/sync-bd.js +9 -0
  47. package/dist/commands/wake.js +53 -35
  48. package/dist/{context-COo8oq1k.d.ts → context-BUGaWpyL.d.ts} +1 -0
  49. package/dist/index.d.ts +55 -20
  50. package/dist/index.js +67 -16
  51. package/hooks/clawvault/HOOK.md +3 -2
  52. package/hooks/clawvault/handler.js +51 -0
  53. package/hooks/clawvault/handler.test.js +20 -0
  54. package/package.json +2 -2
@@ -0,0 +1,19 @@
1
+ import { Command } from 'commander';
2
+
3
+ interface MigrateObservationsOptions {
4
+ vaultPath?: string;
5
+ dryRun?: boolean;
6
+ }
7
+ interface MigrateObservationsResult {
8
+ scanned: number;
9
+ migrated: number;
10
+ backups: number;
11
+ dryRun: boolean;
12
+ }
13
+ declare function migrateObservations(vaultPath: string, options?: {
14
+ dryRun?: boolean;
15
+ }): MigrateObservationsResult;
16
+ declare function migrateObservationsCommand(options: MigrateObservationsOptions): Promise<void>;
17
+ declare function registerMigrateObservationsCommand(program: Command): void;
18
+
19
+ export { type MigrateObservationsOptions, type MigrateObservationsResult, migrateObservations, migrateObservationsCommand, registerMigrateObservationsCommand };
@@ -0,0 +1,13 @@
1
+ import {
2
+ migrateObservations,
3
+ migrateObservationsCommand,
4
+ registerMigrateObservationsCommand
5
+ } from "../chunk-WZI3OAE5.js";
6
+ import "../chunk-K6XHCUFL.js";
7
+ import "../chunk-Z2XBWN7A.js";
8
+ import "../chunk-MXSSG3QU.js";
9
+ export {
10
+ migrateObservations,
11
+ migrateObservationsCommand,
12
+ registerMigrateObservationsCommand
13
+ };
@@ -1,9 +1,12 @@
1
1
  import {
2
2
  observeCommand,
3
3
  registerObserveCommand
4
- } from "../chunk-UPHUI5PD.js";
4
+ } from "../chunk-LB6P4CD5.js";
5
+ import "../chunk-P5EPF6MB.js";
5
6
  import "../chunk-HRLWZGMA.js";
6
- import "../chunk-USAY3OIO.js";
7
+ import "../chunk-2HM7ZI4X.js";
8
+ import "../chunk-K6XHCUFL.js";
9
+ import "../chunk-Z2XBWN7A.js";
7
10
  import "../chunk-MXSSG3QU.js";
8
11
  export {
9
12
  observeCommand,
@@ -0,0 +1,11 @@
1
+ import { Command } from 'commander';
2
+
3
+ interface RebuildCommandOptions {
4
+ vaultPath?: string;
5
+ from?: string;
6
+ to?: string;
7
+ }
8
+ declare function rebuildCommand(options: RebuildCommandOptions): Promise<void>;
9
+ declare function registerRebuildCommand(program: Command): void;
10
+
11
+ export { type RebuildCommandOptions, rebuildCommand, registerRebuildCommand };
@@ -0,0 +1,12 @@
1
+ import {
2
+ rebuildCommand,
3
+ registerRebuildCommand
4
+ } from "../chunk-73P7XCQM.js";
5
+ import "../chunk-2HM7ZI4X.js";
6
+ import "../chunk-K6XHCUFL.js";
7
+ import "../chunk-Z2XBWN7A.js";
8
+ import "../chunk-MXSSG3QU.js";
9
+ export {
10
+ rebuildCommand,
11
+ registerRebuildCommand
12
+ };
@@ -0,0 +1,11 @@
1
+ import { Command } from 'commander';
2
+
3
+ interface ReflectCommandOptions {
4
+ vaultPath?: string;
5
+ days?: number;
6
+ dryRun?: boolean;
7
+ }
8
+ declare function reflectCommand(options: ReflectCommandOptions): Promise<void>;
9
+ declare function registerReflectCommand(program: Command): void;
10
+
11
+ export { type ReflectCommandOptions, reflectCommand, registerReflectCommand };
@@ -0,0 +1,13 @@
1
+ import {
2
+ reflectCommand,
3
+ registerReflectCommand
4
+ } from "../chunk-GJEGPO7U.js";
5
+ import "../chunk-GQVYQCY5.js";
6
+ import "../chunk-MQUJNOHK.js";
7
+ import "../chunk-K6XHCUFL.js";
8
+ import "../chunk-Z2XBWN7A.js";
9
+ import "../chunk-MXSSG3QU.js";
10
+ export {
11
+ reflectCommand,
12
+ registerReflectCommand
13
+ };
@@ -0,0 +1,16 @@
1
+ import { Command } from 'commander';
2
+
3
+ type ReplaySource = 'chatgpt' | 'claude' | 'opencode' | 'openclaw';
4
+
5
+ interface ReplayCommandOptions {
6
+ source: ReplaySource;
7
+ inputPath: string;
8
+ from?: string;
9
+ to?: string;
10
+ dryRun?: boolean;
11
+ vaultPath?: string;
12
+ }
13
+ declare function replayCommand(options: ReplayCommandOptions): Promise<void>;
14
+ declare function registerReplayCommand(program: Command): void;
15
+
16
+ export { type ReplayCommandOptions, registerReplayCommand, replayCommand };
@@ -0,0 +1,14 @@
1
+ import {
2
+ registerReplayCommand,
3
+ replayCommand
4
+ } from "../chunk-L6NB43WV.js";
5
+ import "../chunk-2HM7ZI4X.js";
6
+ import "../chunk-GQVYQCY5.js";
7
+ import "../chunk-MQUJNOHK.js";
8
+ import "../chunk-K6XHCUFL.js";
9
+ import "../chunk-Z2XBWN7A.js";
10
+ import "../chunk-MXSSG3QU.js";
11
+ export {
12
+ registerReplayCommand,
13
+ replayCommand
14
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  setupCommand
3
- } from "../chunk-PIJGYMQZ.js";
4
- import "../chunk-MIIXBNO3.js";
3
+ } from "../chunk-KNDVXXKC.js";
4
+ import "../chunk-DHBDH4DN.js";
5
5
  export {
6
6
  setupCommand
7
7
  };
@@ -13,6 +13,7 @@ interface SleepOptions {
13
13
  index?: boolean;
14
14
  git?: boolean;
15
15
  sessionTranscript?: string;
16
+ reflect?: boolean;
16
17
  prompt?: PromptFn;
17
18
  cwd?: string;
18
19
  }
@@ -1,17 +1,25 @@
1
1
  import {
2
- Observer,
3
2
  parseSessionFile
4
- } from "../chunk-USAY3OIO.js";
3
+ } from "../chunk-P5EPF6MB.js";
4
+ import {
5
+ Observer
6
+ } from "../chunk-2HM7ZI4X.js";
7
+ import {
8
+ runReflection
9
+ } from "../chunk-GQVYQCY5.js";
10
+ import "../chunk-MQUJNOHK.js";
5
11
  import {
6
12
  clearDirtyFlag
7
13
  } from "../chunk-MZZJLQNQ.js";
14
+ import "../chunk-K6XHCUFL.js";
15
+ import "../chunk-Z2XBWN7A.js";
8
16
  import {
9
17
  ClawVault
10
- } from "../chunk-QFBKWDYR.js";
18
+ } from "../chunk-IFGDPIFI.js";
11
19
  import {
12
20
  qmdUpdate
13
- } from "../chunk-MIIXBNO3.js";
14
- import "../chunk-O5V7SD5C.js";
21
+ } from "../chunk-DHBDH4DN.js";
22
+ import "../chunk-ZZA73MFY.js";
15
23
 
16
24
  // src/commands/sleep.ts
17
25
  import * as fs from "fs";
@@ -177,12 +185,27 @@ async function sleep(options) {
177
185
  if (transcriptPath) {
178
186
  const observer = new Observer(vault.getPath());
179
187
  const messages = parseSessionFile(transcriptPath);
180
- await observer.processMessages(messages);
188
+ const transcriptStat = fs.statSync(transcriptPath);
189
+ await observer.processMessages(messages, {
190
+ source: "openclaw",
191
+ transcriptId: path.basename(transcriptPath),
192
+ timestamp: transcriptStat.mtime
193
+ });
181
194
  const { routingSummary } = await observer.flush();
182
195
  observationRoutingSummary = routingSummary || void 0;
183
196
  }
184
197
  } catch {
185
198
  }
199
+ if (options.reflect) {
200
+ try {
201
+ await runReflection({
202
+ vaultPath: vault.getPath(),
203
+ days: 14,
204
+ dryRun: false
205
+ });
206
+ } catch {
207
+ }
208
+ }
186
209
  return { handoff, document, git, observationRoutingSummary };
187
210
  }
188
211
  export {
@@ -1,20 +1,20 @@
1
+ import {
2
+ scanVaultLinks
3
+ } from "../chunk-4VQTUVH7.js";
1
4
  import {
2
5
  formatAge
3
6
  } from "../chunk-7ZRP733D.js";
4
7
  import {
5
8
  ClawVault
6
- } from "../chunk-QFBKWDYR.js";
9
+ } from "../chunk-IFGDPIFI.js";
7
10
  import {
8
11
  QmdUnavailableError,
9
12
  hasQmd
10
- } from "../chunk-MIIXBNO3.js";
11
- import {
12
- scanVaultLinks
13
- } from "../chunk-4VQTUVH7.js";
13
+ } from "../chunk-DHBDH4DN.js";
14
14
  import "../chunk-J7ZWCI2C.js";
15
15
  import {
16
16
  loadMemoryGraphIndex
17
- } from "../chunk-O5V7SD5C.js";
17
+ } from "../chunk-ZZA73MFY.js";
18
18
 
19
19
  // src/commands/status.ts
20
20
  import * as fs from "fs";
@@ -0,0 +1,10 @@
1
+ import { Command } from 'commander';
2
+
3
+ interface SyncBdCommandOptions {
4
+ vaultPath?: string;
5
+ dryRun?: boolean;
6
+ }
7
+ declare function syncBdCommand(options: SyncBdCommandOptions): Promise<void>;
8
+ declare function registerSyncBdCommand(program: Command): void;
9
+
10
+ export { type SyncBdCommandOptions, registerSyncBdCommand, syncBdCommand };
@@ -0,0 +1,9 @@
1
+ import {
2
+ registerSyncBdCommand,
3
+ syncBdCommand
4
+ } from "../chunk-MGDEINGP.js";
5
+ import "../chunk-MXSSG3QU.js";
6
+ export {
7
+ registerSyncBdCommand,
8
+ syncBdCommand
9
+ };
@@ -4,18 +4,23 @@ import {
4
4
  import {
5
5
  clearDirtyFlag
6
6
  } from "../chunk-MZZJLQNQ.js";
7
+ import {
8
+ parseObservationMarkdown
9
+ } from "../chunk-K6XHCUFL.js";
10
+ import {
11
+ listObservationFiles
12
+ } from "../chunk-Z2XBWN7A.js";
7
13
  import "../chunk-7ZRP733D.js";
8
14
  import {
9
15
  ClawVault
10
- } from "../chunk-QFBKWDYR.js";
11
- import "../chunk-MIIXBNO3.js";
12
- import "../chunk-O5V7SD5C.js";
16
+ } from "../chunk-IFGDPIFI.js";
17
+ import "../chunk-DHBDH4DN.js";
18
+ import "../chunk-ZZA73MFY.js";
13
19
 
14
20
  // src/commands/wake.ts
15
21
  import * as fs from "fs";
16
22
  import * as path from "path";
17
23
  var DEFAULT_HANDOFF_LIMIT = 3;
18
- var OBSERVATION_HIGHLIGHT_RE = /^(🔴|🟡)\s+(.+)$/u;
19
24
  var MAX_WAKE_RED_OBSERVATIONS = 20;
20
25
  var MAX_WAKE_YELLOW_OBSERVATIONS = 10;
21
26
  var MAX_WAKE_OUTPUT_LINES = 100;
@@ -39,40 +44,48 @@ function buildWakeSummary(recovery, recap) {
39
44
  }
40
45
  return workSummary || "No recent work summary found.";
41
46
  }
42
- function formatDateKey(date) {
43
- return date.toISOString().split("T")[0];
44
- }
45
47
  function readRecentObservationHighlights(vaultPath) {
46
48
  const now = /* @__PURE__ */ new Date();
49
+ const today = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate()));
50
+ const fileByDate = new Map(
51
+ listObservationFiles(vaultPath, {
52
+ includeLegacy: true,
53
+ includeArchive: false,
54
+ dedupeByDate: true
55
+ }).map((entry) => [entry.date, entry.path])
56
+ );
47
57
  const highlights = [];
48
58
  for (let daysAgo = 0; daysAgo < 7; daysAgo++) {
49
- const date = new Date(now);
50
- date.setDate(now.getDate() - daysAgo);
51
- const dateKey = formatDateKey(date);
52
- const filePath = path.join(vaultPath, "observations", `${dateKey}.md`);
53
- if (!fs.existsSync(filePath)) continue;
59
+ const date = new Date(today);
60
+ date.setUTCDate(today.getUTCDate() - daysAgo);
61
+ const dateKey = date.toISOString().slice(0, 10);
62
+ const filePath = fileByDate.get(dateKey);
63
+ if (!filePath || !fs.existsSync(filePath)) continue;
54
64
  const content = fs.readFileSync(filePath, "utf-8");
55
- const dayRed = [];
56
- const dayYellow = [];
57
- for (const line of content.split(/\r?\n/)) {
58
- const match = line.trim().match(OBSERVATION_HIGHLIGHT_RE);
59
- if (!match?.[2]) continue;
65
+ const parsed = parseObservationMarkdown(content).filter((record) => record.importance >= 0.4);
66
+ const dayStructural = [];
67
+ const dayPotential = [];
68
+ for (const record of parsed) {
60
69
  const item = {
61
70
  date: dateKey,
62
- priority: match[1],
63
- text: match[2].trim()
71
+ type: record.type,
72
+ importance: record.importance,
73
+ text: record.content.trim()
64
74
  };
65
- if (item.priority === "\u{1F534}") dayRed.push(item);
66
- else dayYellow.push(item);
75
+ if (record.importance >= 0.8) {
76
+ dayStructural.push(item);
77
+ } else {
78
+ dayPotential.push(item);
79
+ }
67
80
  }
68
81
  if (daysAgo === 0) {
69
- highlights.push(...dayRed, ...dayYellow);
82
+ highlights.push(...dayStructural, ...dayPotential);
70
83
  } else if (daysAgo === 1) {
71
- highlights.push(...dayRed, ...dayYellow.slice(0, 5));
84
+ highlights.push(...dayStructural, ...dayPotential.slice(0, 5));
72
85
  } else if (daysAgo <= 3) {
73
- highlights.push(...dayRed);
86
+ highlights.push(...dayStructural);
74
87
  } else {
75
- highlights.push(...dayRed.slice(0, 3));
88
+ highlights.push(...dayStructural.slice(0, 3));
76
89
  }
77
90
  }
78
91
  return highlights;
@@ -88,16 +101,19 @@ function compareByRecency(left, right) {
88
101
  if (left.date !== right.date) {
89
102
  return right.date.localeCompare(left.date);
90
103
  }
104
+ if (left.importance !== right.importance) {
105
+ return right.importance - left.importance;
106
+ }
91
107
  return timeFromObservationText(right.text) - timeFromObservationText(left.text);
92
108
  }
93
109
  function formatRecentObservations(highlights) {
94
110
  if (highlights.length === 0) {
95
- return "_No critical or notable observations from today or yesterday._";
111
+ return "_No structural or potentially important observations from the recent window._";
96
112
  }
97
113
  const sorted = [...highlights].sort(compareByRecency);
98
- const red = sorted.filter((item) => item.priority === "\u{1F534}").slice(0, MAX_WAKE_RED_OBSERVATIONS);
99
- const yellow = sorted.filter((item) => item.priority === "\u{1F7E1}").slice(0, MAX_WAKE_YELLOW_OBSERVATIONS);
100
- const visible = [...red, ...yellow].sort(compareByRecency);
114
+ const structural = sorted.filter((item) => item.importance >= 0.8).slice(0, MAX_WAKE_RED_OBSERVATIONS);
115
+ const potential = sorted.filter((item) => item.importance >= 0.4 && item.importance < 0.8).slice(0, MAX_WAKE_YELLOW_OBSERVATIONS);
116
+ const visible = [...structural, ...potential].sort(compareByRecency);
101
117
  const omittedCount = Math.max(0, highlights.length - visible.length);
102
118
  const byDate = /* @__PURE__ */ new Map();
103
119
  for (const item of visible) {
@@ -116,7 +132,7 @@ function formatRecentObservations(highlights) {
116
132
  if (lines.length >= bodyLineBudget) {
117
133
  break;
118
134
  }
119
- lines.push(`- ${item.priority} ${item.text}`);
135
+ lines.push(`- [${item.type}|i=${item.importance.toFixed(2)}] ${item.text}`);
120
136
  }
121
137
  if (lines.length < bodyLineBudget) {
122
138
  lines.push("");
@@ -131,8 +147,8 @@ async function generateExecutiveSummary(recovery, recap, highlights) {
131
147
  if (process.env.CLAWVAULT_NO_LLM || process.env.VITEST) return null;
132
148
  const apiKey = process.env.GEMINI_API_KEY || process.env.ANTHROPIC_API_KEY || process.env.OPENAI_API_KEY;
133
149
  if (!apiKey) return null;
134
- const redItems = highlights.filter((h) => h.priority === "\u{1F534}").map((h) => h.text).slice(0, 10);
135
- const yellowItems = highlights.filter((h) => h.priority === "\u{1F7E1}").map((h) => h.text).slice(0, 5);
150
+ const structuralItems = highlights.filter((h) => h.importance >= 0.8).map((h) => h.text).slice(0, 10);
151
+ const potentialItems = highlights.filter((h) => h.importance >= 0.4 && h.importance < 0.8).map((h) => h.text).slice(0, 5);
136
152
  const projects = recap.activeProjects.slice(0, 8);
137
153
  const commitments = recap.pendingCommitments.slice(0, 5);
138
154
  const lastWork = recovery.checkpoint?.workingOn || recap.recentHandoffs[0]?.workingOn?.join(", ") || "";
@@ -149,8 +165,8 @@ async function generateExecutiveSummary(recovery, recap, highlights) {
149
165
  `Next steps: ${nextSteps || "(none)"}`,
150
166
  `Active projects (${projects.length}): ${projects.join(", ") || "(none)"}`,
151
167
  `Pending commitments: ${commitments.join(", ") || "(none)"}`,
152
- `Critical observations: ${redItems.join(" | ") || "(none)"}`,
153
- `Notable observations: ${yellowItems.join(" | ") || "(none)"}`,
168
+ `Structural observations: ${structuralItems.join(" | ") || "(none)"}`,
169
+ `Potential observations: ${potentialItems.join(" | ") || "(none)"}`,
154
170
  "",
155
171
  "Write the briefing now. Be concise."
156
172
  ].join("\n");
@@ -190,7 +206,9 @@ async function wake(options) {
190
206
  const highlights = readRecentObservationHighlights(vaultPath);
191
207
  const observations = formatRecentObservations(highlights);
192
208
  const execSummary = options.noSummary ? null : await generateExecutiveSummary(recovery, recap, highlights);
193
- const highlightSummaryItems = highlights.map((item) => `${item.priority} ${item.text}`);
209
+ const highlightSummaryItems = highlights.map(
210
+ (item) => `[${item.type}|i=${item.importance.toFixed(2)}] ${item.text}`
211
+ );
194
212
  const wakeSummary = formatSummaryItems(highlightSummaryItems);
195
213
  const baseSummary = buildWakeSummary(recovery, recap);
196
214
  const fullBaseSummary = wakeSummary ? `${baseSummary} | ${wakeSummary}` : baseSummary;
@@ -17,6 +17,7 @@ interface ContextOptions {
17
17
  includeObservations?: boolean;
18
18
  budget?: number;
19
19
  profile?: ContextProfileOption;
20
+ maxHops?: number;
20
21
  }
21
22
  interface ContextEntry {
22
23
  title: string;
package/dist/index.d.ts CHANGED
@@ -4,8 +4,14 @@ export { f as DEFAULT_CATEGORIES, g as DEFAULT_CONFIG, h as MEMORY_TYPES, T as T
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
- 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-COo8oq1k.js';
7
+ 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';
8
8
  export { ObserveCommandOptions, observeCommand, registerObserveCommand } from './commands/observe.js';
9
+ export { ReflectCommandOptions, reflectCommand, registerReflectCommand } from './commands/reflect.js';
10
+ export { ArchiveCommandOptions, archiveCommand, registerArchiveCommand } from './commands/archive.js';
11
+ export { RebuildCommandOptions, rebuildCommand, registerRebuildCommand } from './commands/rebuild.js';
12
+ export { ReplayCommandOptions, registerReplayCommand, replayCommand } from './commands/replay.js';
13
+ export { MigrateObservationsOptions, MigrateObservationsResult, migrateObservations, migrateObservationsCommand, registerMigrateObservationsCommand } from './commands/migrate-observations.js';
14
+ export { SyncBdCommandOptions, registerSyncBdCommand, syncBdCommand } from './commands/sync-bd.js';
9
15
  export { SessionRecapFormat, SessionRecapOptions, SessionRecapResult, SessionTurn, buildSessionRecap, formatSessionRecapMarkdown, sessionRecapCommand } from './commands/session-recap.js';
10
16
  export { findNearestVaultPath, getVaultPath, resolveVaultPath } from './lib/config.js';
11
17
  export { TemplateVariables, buildTemplateVariables, renderTemplate } from './lib/template-engine.js';
@@ -337,21 +343,28 @@ interface ObserverOptions {
337
343
  compressor?: ObserverCompressor;
338
344
  reflector?: ObserverReflector;
339
345
  now?: () => Date;
346
+ rawCapture?: boolean;
347
+ }
348
+ interface ObserverProcessOptions {
349
+ source?: string;
350
+ sessionKey?: string;
351
+ transcriptId?: string;
352
+ timestamp?: Date;
340
353
  }
341
354
  declare class Observer {
342
355
  private readonly vaultPath;
343
- private readonly observationsDir;
344
356
  private readonly tokenThreshold;
345
357
  private readonly reflectThreshold;
346
358
  private readonly compressor;
347
359
  private readonly reflector;
348
360
  private readonly now;
361
+ private readonly rawCapture;
349
362
  private readonly router;
350
363
  private pendingMessages;
351
364
  private observationsCache;
352
365
  private lastRoutingSummary;
353
366
  constructor(vaultPath: string, options?: ObserverOptions);
354
- processMessages(messages: string[]): Promise<void>;
367
+ processMessages(messages: string[], options?: ObserverProcessOptions): Promise<void>;
355
368
  /**
356
369
  * Force-flush pending messages regardless of threshold.
357
370
  * Call this on session end to capture everything.
@@ -362,17 +375,13 @@ declare class Observer {
362
375
  }>;
363
376
  getObservations(): string;
364
377
  private estimateTokens;
365
- private getObservationPath;
366
378
  private readTodayObservations;
379
+ private readObservationForDate;
367
380
  private readObservationFile;
368
381
  private writeObservationFile;
369
- private getObservationFiles;
370
- private readObservationCorpus;
371
382
  private deduplicateObservationMarkdown;
372
- private parseSections;
373
- private renderSections;
374
- private normalizeObservationContent;
375
- private reflectIfNeeded;
383
+ private persistRawMessages;
384
+ private sanitizeSource;
376
385
  }
377
386
 
378
387
  interface CompressorOptions {
@@ -401,18 +410,14 @@ declare class Compressor {
401
410
  * Also fixes trailing word fragments fused after closing brackets.
402
411
  */
403
412
  private sanitizeWikiLinks;
404
- /**
405
- * Post-process LLM output to enforce priority rules.
406
- * Lines matching critical rules get upgraded to 🔴, notable rules to 🟡.
407
- */
408
- private enforcePriorityRules;
413
+ private enforceImportanceRules;
414
+ private enforceImportanceForRecord;
409
415
  private fallbackCompression;
410
416
  private mergeObservations;
411
- private deduplicateObservationLines;
412
- private normalizeObservationContent;
413
- private parseSections;
417
+ private mergeRecord;
414
418
  private renderSections;
415
- private inferPriority;
419
+ private inferImportance;
420
+ private inferConfidence;
416
421
  private isCriticalContent;
417
422
  private isNotableContent;
418
423
  private normalizeText;
@@ -420,6 +425,7 @@ declare class Compressor {
420
425
  private extractTime;
421
426
  private formatDate;
422
427
  private formatTime;
428
+ private clamp01;
423
429
  }
424
430
 
425
431
  interface ReflectorOptions {
@@ -466,6 +472,35 @@ declare class SessionWatcher {
466
472
 
467
473
  declare function parseSessionFile(filePath: string): string[];
468
474
 
475
+ interface ArchiveObservationsOptions {
476
+ olderThanDays?: number;
477
+ dryRun?: boolean;
478
+ now?: () => Date;
479
+ }
480
+ interface ArchiveObservationsResult {
481
+ scanned: number;
482
+ archived: number;
483
+ skipped: number;
484
+ dryRun: boolean;
485
+ archivedDates: string[];
486
+ }
487
+ declare function archiveObservations(vaultPath: string, options?: ArchiveObservationsOptions): ArchiveObservationsResult;
488
+
489
+ interface ReflectOptions {
490
+ vaultPath: string;
491
+ days?: number;
492
+ dryRun?: boolean;
493
+ now?: () => Date;
494
+ }
495
+ interface ReflectResult {
496
+ processedWeeks: number;
497
+ writtenWeeks: number;
498
+ dryRun: boolean;
499
+ files: string[];
500
+ archive: ArchiveObservationsResult | null;
501
+ }
502
+ declare function runReflection(options: ReflectOptions): Promise<ReflectResult>;
503
+
469
504
  /**
470
505
  * ClawVault 🐘 — An Elephant Never Forgets
471
506
  *
@@ -495,4 +530,4 @@ declare function parseSessionFile(filePath: string): string[];
495
530
  declare const VERSION: string;
496
531
  declare function registerCommanderCommands(program: Command): Command;
497
532
 
498
- export { Category, ClawVault, Compressor, type CompressorOptions, Document, HandoffDocument, MEMORY_GRAPH_SCHEMA_VERSION, type MemoryGraph, type MemoryGraphEdge, type MemoryGraphEdgeType, type MemoryGraphIndex, type MemoryGraphNode, type MemoryGraphNodeType, type MemoryGraphStats, MemoryType, Observer, type ObserverCompressor, type ObserverOptions, type ObserverReflector, QMD_INSTALL_COMMAND, QMD_INSTALL_URL, QmdUnavailableError, Reflector, type ReflectorOptions, SearchEngine, SearchOptions, SearchResult, SessionRecap, SessionWatcher, type SessionWatcherOptions, StoreOptions, SyncOptions, SyncResult, VERSION, VaultConfig, buildOrUpdateMemoryGraphIndex, createVault, extractTags, extractWikiLinks, findVault, getMemoryGraph, hasQmd, loadMemoryGraphIndex, parseSessionFile, qmdEmbed, qmdUpdate, registerCommanderCommands };
533
+ export { type ArchiveObservationsOptions, type ArchiveObservationsResult, Category, ClawVault, Compressor, type CompressorOptions, Document, HandoffDocument, MEMORY_GRAPH_SCHEMA_VERSION, type MemoryGraph, type MemoryGraphEdge, type MemoryGraphEdgeType, type MemoryGraphIndex, type MemoryGraphNode, type MemoryGraphNodeType, type MemoryGraphStats, MemoryType, Observer, type ObserverCompressor, type ObserverOptions, type ObserverReflector, QMD_INSTALL_COMMAND, QMD_INSTALL_URL, QmdUnavailableError, type ReflectOptions, type ReflectResult, Reflector, type ReflectorOptions, SearchEngine, SearchOptions, SearchResult, SessionRecap, SessionWatcher, type SessionWatcherOptions, StoreOptions, SyncOptions, SyncResult, VERSION, VaultConfig, archiveObservations, buildOrUpdateMemoryGraphIndex, createVault, extractTags, extractWikiLinks, findVault, getMemoryGraph, hasQmd, loadMemoryGraphIndex, parseSessionFile, qmdEmbed, qmdUpdate, registerCommanderCommands, runReflection };