clawvault 3.3.0 → 3.4.1

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.
@@ -0,0 +1,223 @@
1
+ // src/recall/strategies.ts
2
+ var VERIFICATION_PATTERN = /\b(verify|verification|source|citation|cite|proof|prove|where did|evidence)\b/i;
3
+ var TEMPORAL_PATTERN = /\b(today|yesterday|last\s+(?:day|week|month|year)|this\s+(?:week|month|year)|recent|recently|timeline|when)\b/i;
4
+ var RELATIONSHIP_PATTERN = /\b(relationship|relates?|connected|between|depends on|works with|reports to|interacts? with)\b/i;
5
+ function parseTemporalWindowDays(query) {
6
+ if (/\byesterday\b/i.test(query)) return 2;
7
+ if (/\btoday\b/i.test(query)) return 1;
8
+ if (/\blast\s+day\b/i.test(query)) return 1;
9
+ if (/\blast\s+week\b/i.test(query)) return 7;
10
+ if (/\bthis\s+week\b/i.test(query)) return 7;
11
+ if (/\blast\s+month\b/i.test(query)) return 31;
12
+ if (/\bthis\s+month\b/i.test(query)) return 31;
13
+ if (/\blast\s+year\b/i.test(query) || /\bthis\s+year\b/i.test(query)) return 366;
14
+ return void 0;
15
+ }
16
+ function inferEntityName(query, knownEntityNames) {
17
+ const wikiLink = query.match(/\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/);
18
+ if (wikiLink?.[1]) {
19
+ return wikiLink[1].trim();
20
+ }
21
+ const normalizedQuery = query.toLowerCase();
22
+ for (const entity of knownEntityNames) {
23
+ if (!entity.trim()) continue;
24
+ if (normalizedQuery.includes(entity.toLowerCase())) {
25
+ return entity;
26
+ }
27
+ }
28
+ const capSequence = query.match(/\b([A-Z][a-z]+(?:\s+[A-Z][a-z]+){0,2})\b/);
29
+ if (capSequence?.[1]) {
30
+ return capSequence[1].trim();
31
+ }
32
+ return void 0;
33
+ }
34
+ function classifyRecallQuery(query, knownEntityNames = [], forcedStrategy) {
35
+ if (forcedStrategy) {
36
+ return {
37
+ strategy: forcedStrategy,
38
+ entityName: forcedStrategy === "entity" ? inferEntityName(query, knownEntityNames) : void 0,
39
+ temporalDays: forcedStrategy === "temporal" ? parseTemporalWindowDays(query) : void 0
40
+ };
41
+ }
42
+ const entityName = inferEntityName(query, knownEntityNames);
43
+ if (RELATIONSHIP_PATTERN.test(query)) {
44
+ return { strategy: "relationship", entityName };
45
+ }
46
+ if (VERIFICATION_PATTERN.test(query)) {
47
+ return { strategy: "verification", entityName };
48
+ }
49
+ if (TEMPORAL_PATTERN.test(query)) {
50
+ return {
51
+ strategy: "temporal",
52
+ entityName,
53
+ temporalDays: parseTemporalWindowDays(query)
54
+ };
55
+ }
56
+ if (entityName) {
57
+ return { strategy: "entity", entityName };
58
+ }
59
+ return { strategy: "quick" };
60
+ }
61
+
62
+ // src/recall/service.ts
63
+ import * as fs from "fs";
64
+ import * as path from "path";
65
+ import matter from "gray-matter";
66
+ var DEFAULT_LIMIT = 6;
67
+ var DEFAULT_MAX_SNIPPET = 220;
68
+ function compactSnippet(value, maxChars = DEFAULT_MAX_SNIPPET) {
69
+ const normalized = value.replace(/\s+/g, " ").trim();
70
+ if (!normalized) return "No snippet available.";
71
+ return normalized.slice(0, maxChars);
72
+ }
73
+ function toIso(value) {
74
+ return value.toISOString();
75
+ }
76
+ function parseFrontmatterDate(raw) {
77
+ if (typeof raw !== "string" && !(raw instanceof Date)) return null;
78
+ const date = raw instanceof Date ? raw : new Date(raw);
79
+ if (Number.isNaN(date.getTime())) return null;
80
+ return date;
81
+ }
82
+ function formatContextHeader(strategy, query) {
83
+ return [
84
+ "[ClawVault memory recall]",
85
+ `strategy: ${strategy}`,
86
+ `query: ${query}`
87
+ ].join(" | ");
88
+ }
89
+ function isRelationshipResult(result) {
90
+ const memoryType = typeof result.document.frontmatter.memoryType === "string" ? result.document.frontmatter.memoryType.toLowerCase() : "";
91
+ if (memoryType === "relationship") {
92
+ return true;
93
+ }
94
+ const content = `${result.document.title}
95
+ ${result.document.content}`;
96
+ return /\b(works with|reports to|related to|depends on|collaborates with|partnered with|between)\b/i.test(content) || (result.document.links?.length ?? 0) >= 2;
97
+ }
98
+ function filterTemporalResults(results, days) {
99
+ if (!days || !Number.isFinite(days) || days <= 0) {
100
+ return results;
101
+ }
102
+ const windowMs = days * 24 * 60 * 60 * 1e3;
103
+ const cutoff = Date.now() - windowMs;
104
+ return results.filter((result) => {
105
+ const fmDate = parseFrontmatterDate(result.document.frontmatter.date);
106
+ const reference = fmDate ?? result.document.modified;
107
+ return reference.getTime() >= cutoff;
108
+ });
109
+ }
110
+ function entityProfilePath(vaultPath, entityName) {
111
+ const slug = entityName.toLowerCase().replace(/[^\w\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-").trim();
112
+ return path.join(vaultPath, "entities", `${slug}.md`);
113
+ }
114
+ function readEntityBrief(vaultPath, entityName) {
115
+ const filePath = entityProfilePath(vaultPath, entityName);
116
+ if (!fs.existsSync(filePath)) {
117
+ return null;
118
+ }
119
+ const parsed = matter(fs.readFileSync(filePath, "utf-8"));
120
+ const kind = typeof parsed.data.kind === "string" ? parsed.data.kind : "unknown";
121
+ const summary = parsed.content.split(/\r?\n/).map((line) => line.trim()).find((line) => line && !line.startsWith("#") && !line.startsWith("-")) ?? "";
122
+ const relationships = Array.isArray(parsed.data.relationships) ? parsed.data.relationships.slice(0, 4).map((entry) => {
123
+ if (typeof entry === "string") return entry;
124
+ if (!entry || typeof entry !== "object") return "";
125
+ const record = entry;
126
+ return typeof record.target === "string" ? record.target : "";
127
+ }).filter(Boolean) : [];
128
+ const relationshipChunk = relationships.length > 0 ? ` Relationships: ${relationships.join(", ")}.` : "";
129
+ return `Entity brief: ${entityName} (${kind}). ${summary}${relationshipChunk}`.trim();
130
+ }
131
+ function toRecallSource(result) {
132
+ return {
133
+ title: result.document.title,
134
+ path: result.document.id,
135
+ category: result.document.category,
136
+ score: Number(result.score.toFixed(4)),
137
+ snippet: compactSnippet(result.snippet || result.document.content),
138
+ modified: toIso(result.document.modified)
139
+ };
140
+ }
141
+ function uniqueEntityNames(results) {
142
+ const names = /* @__PURE__ */ new Set();
143
+ for (const result of results) {
144
+ if (result.document.category === "people" || result.document.category === "projects" || result.document.category === "entities") {
145
+ names.add(result.document.title);
146
+ }
147
+ for (const link of result.document.links) {
148
+ if (link.trim()) names.add(link.trim());
149
+ }
150
+ }
151
+ return [...names];
152
+ }
153
+ function formatRecallContext(result, includeSources) {
154
+ const lines = [formatContextHeader(result.strategy, result.query), ""];
155
+ if (result.sources.length === 0) {
156
+ lines.push("No relevant memories found.");
157
+ return lines.join("\n");
158
+ }
159
+ if (result.strategy === "verification") {
160
+ lines.push("Verification-oriented evidence:");
161
+ } else if (result.strategy === "relationship") {
162
+ lines.push("Relationship-focused recall:");
163
+ } else if (result.strategy === "temporal") {
164
+ lines.push("Time-filtered recall:");
165
+ } else if (result.strategy === "entity" && result.entityName) {
166
+ lines.push(`Entity-focused recall for "${result.entityName}":`);
167
+ } else {
168
+ lines.push("Relevant recall:");
169
+ }
170
+ lines.push("");
171
+ for (const source of result.sources) {
172
+ const sourceTail = includeSources || result.strategy === "verification" ? ` [${source.path}]` : "";
173
+ lines.push(`- (${source.score.toFixed(2)}) ${source.title}${sourceTail}`);
174
+ lines.push(` ${source.snippet}`);
175
+ }
176
+ return lines.join("\n").trim();
177
+ }
178
+ async function buildRecallResult(vault, query, options = {}) {
179
+ const limit = options.limit ?? DEFAULT_LIMIT;
180
+ const broadLimit = Math.max(limit * 4, limit);
181
+ const seededResults = await vault.find(query, {
182
+ limit: broadLimit,
183
+ temporalBoost: true,
184
+ ...options.searchOptions ?? {}
185
+ });
186
+ const knownEntityNames = uniqueEntityNames(seededResults);
187
+ const classification = classifyRecallQuery(query, knownEntityNames, options.strategy);
188
+ let scopedResults = seededResults;
189
+ if (classification.strategy === "entity" && classification.entityName) {
190
+ scopedResults = await vault.find(`"${classification.entityName}" ${query}`, {
191
+ limit: broadLimit,
192
+ temporalBoost: true,
193
+ ...options.searchOptions ?? {}
194
+ });
195
+ } else if (classification.strategy === "temporal") {
196
+ scopedResults = filterTemporalResults(scopedResults, classification.temporalDays);
197
+ } else if (classification.strategy === "relationship") {
198
+ scopedResults = scopedResults.filter((result) => isRelationshipResult(result));
199
+ } else if (classification.strategy === "verification") {
200
+ scopedResults = [...scopedResults].sort((left, right) => right.score - left.score);
201
+ }
202
+ const selected = scopedResults.slice(0, limit);
203
+ const sources = selected.map(toRecallSource);
204
+ const entityBrief = classification.entityName ? readEntityBrief(vault.getPath(), classification.entityName) : null;
205
+ const provisionalResult = {
206
+ query,
207
+ strategy: classification.strategy,
208
+ entityName: classification.entityName,
209
+ context: "",
210
+ sources,
211
+ rawResults: selected
212
+ };
213
+ const baseContext = formatRecallContext(provisionalResult, options.includeSources ?? false);
214
+ provisionalResult.context = entityBrief ? `${baseContext}
215
+
216
+ ${entityBrief}` : baseContext;
217
+ return provisionalResult;
218
+ }
219
+
220
+ export {
221
+ classifyRecallQuery,
222
+ buildRecallResult
223
+ };
@@ -0,0 +1,37 @@
1
+ import {
2
+ buildRecallResult
3
+ } from "./chunk-RL2L6I6K.js";
4
+ import {
5
+ ClawVault
6
+ } from "./chunk-ECGJYWNA.js";
7
+ import {
8
+ resolveVaultPath
9
+ } from "./chunk-GJO3CFUN.js";
10
+
11
+ // src/commands/recall.ts
12
+ async function recallCommand(query, options) {
13
+ const vaultPath = resolveVaultPath({ explicitPath: options.vaultPath });
14
+ const vault = new ClawVault(vaultPath);
15
+ await vault.load();
16
+ const recallOptions = {
17
+ limit: options.limit,
18
+ strategy: options.strategy,
19
+ includeSources: options.includeSources
20
+ };
21
+ const result = await buildRecallResult(vault, query, recallOptions);
22
+ if (options.json) {
23
+ console.log(JSON.stringify({
24
+ strategy: result.strategy,
25
+ query: result.query,
26
+ sources: result.sources,
27
+ context: result.context
28
+ }, null, 2));
29
+ return result;
30
+ }
31
+ console.log(result.context);
32
+ return result;
33
+ }
34
+
35
+ export {
36
+ recallCommand
37
+ };
package/dist/cli/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  registerCliCommands
3
- } from "../chunk-YCUVAOFC.js";
3
+ } from "../chunk-DCF4KMFD.js";
4
4
  import "../chunk-KCYWJDDW.js";
5
5
  import "../chunk-TIGW564L.js";
6
6
  import "../chunk-IVRIKYFE.js";
7
7
  import "../chunk-DOIUYIXV.js";
8
8
  import "../chunk-TWMI3SNN.js";
9
9
  import "../chunk-OFOCU2V4.js";
10
- import "../chunk-TDWFBDAQ.js";
10
+ import "../chunk-D5U3Q4N5.js";
11
11
  import "../chunk-BLQXXX7Q.js";
12
12
  import "../chunk-VXAGOLDP.js";
13
13
  import "../chunk-7SWP5FKU.js";
@@ -16,15 +16,16 @@ import "../chunk-DVOUSOR3.js";
16
16
  import "../chunk-4PY655YM.js";
17
17
  import "../chunk-AXSJIFOJ.js";
18
18
  import "../chunk-GFCHWMGD.js";
19
+ import "../chunk-T7E764W3.js";
20
+ import "../chunk-HEHO7SMV.js";
21
+ import "../chunk-2PKBIKDH.js";
22
+ import "../chunk-35JCYSRR.js";
19
23
  import "../chunk-BSJ6RIT7.js";
20
24
  import "../chunk-ECGJYWNA.js";
21
25
  import "../chunk-2CDEETQN.js";
22
- import "../chunk-T7E764W3.js";
23
26
  import "../chunk-FZ5I2NF7.js";
24
27
  import "../chunk-PTWPPVC7.js";
25
28
  import "../chunk-H3JZIB5O.js";
26
- import "../chunk-HEHO7SMV.js";
27
- import "../chunk-2PKBIKDH.js";
28
29
  import "../chunk-MQUJNOHK.js";
29
30
  import "../chunk-GJO3CFUN.js";
30
31
  import "../chunk-ZKWPCBYT.js";
@@ -1,7 +1,14 @@
1
1
  interface EntitiesOptions {
2
2
  json?: boolean;
3
3
  vaultPath?: string;
4
+ refresh?: boolean;
5
+ }
6
+ interface EntityOptions {
7
+ json?: boolean;
8
+ vaultPath?: string;
9
+ refresh?: boolean;
4
10
  }
5
11
  declare function entitiesCommand(options: EntitiesOptions): Promise<void>;
12
+ declare function entityCommand(name: string, options: EntityOptions): Promise<void>;
6
13
 
7
- export { entitiesCommand };
14
+ export { entitiesCommand, entityCommand };
@@ -1,14 +1,27 @@
1
1
  import {
2
2
  buildEntityIndex
3
3
  } from "../chunk-J7ZWCI2C.js";
4
+ import {
5
+ readEntityProfile,
6
+ synthesizeEntityProfiles
7
+ } from "../chunk-NSXYM6EZ.js";
8
+ import "../chunk-ECGJYWNA.js";
9
+ import "../chunk-2CDEETQN.js";
10
+ import "../chunk-FZ5I2NF7.js";
11
+ import "../chunk-PTWPPVC7.js";
12
+ import "../chunk-H3JZIB5O.js";
4
13
  import {
5
14
  resolveVaultPath
6
15
  } from "../chunk-GJO3CFUN.js";
16
+ import "../chunk-33DOSHTA.js";
7
17
  import "../chunk-2ZDO52B4.js";
8
18
 
9
19
  // src/commands/entities.ts
10
20
  async function entitiesCommand(options) {
11
21
  const vaultPath = resolveVaultPath({ explicitPath: options.vaultPath });
22
+ if (options.refresh) {
23
+ await synthesizeEntityProfiles(vaultPath, { writeFiles: true });
24
+ }
12
25
  const index = buildEntityIndex(vaultPath);
13
26
  if (options.json) {
14
27
  const output = {};
@@ -40,6 +53,36 @@ async function entitiesCommand(options) {
40
53
  }
41
54
  console.log(`Total: ${index.byPath.size} entities, ${index.entries.size} linkable aliases`);
42
55
  }
56
+ async function entityCommand(name, options) {
57
+ const vaultPath = resolveVaultPath({ explicitPath: options.vaultPath });
58
+ if (options.refresh) {
59
+ await synthesizeEntityProfiles(vaultPath, { writeFiles: true });
60
+ }
61
+ const profile = await readEntityProfile(vaultPath, name);
62
+ if (!profile) {
63
+ throw new Error(`Entity not found: ${name}`);
64
+ }
65
+ if (options.json) {
66
+ console.log(JSON.stringify(profile, null, 2));
67
+ return;
68
+ }
69
+ console.log(`\u{1F4CC} ${profile.name}`);
70
+ console.log(`Kind: ${profile.kind}`);
71
+ console.log(`Aliases: ${profile.aliases.join(", ")}`);
72
+ console.log(`Last mentioned: ${profile.lastMentioned}`);
73
+ console.log("");
74
+ console.log(profile.summary);
75
+ console.log("");
76
+ console.log("Relationships:");
77
+ if (profile.relationships.length === 0) {
78
+ console.log("- none");
79
+ } else {
80
+ for (const relationship of profile.relationships) {
81
+ console.log(`- ${relationship.target} (strength: ${relationship.strength})`);
82
+ }
83
+ }
84
+ }
43
85
  export {
44
- entitiesCommand
86
+ entitiesCommand,
87
+ entityCommand
45
88
  };
@@ -1,13 +1,13 @@
1
- import {
2
- readBacklinksIndex,
3
- rebuildBacklinksIndex,
4
- scanVaultLinks
5
- } from "../chunk-7YZWHM36.js";
6
1
  import {
7
2
  autoLink,
8
3
  dryRunLink,
9
4
  findUnlinkedMentions
10
5
  } from "../chunk-P62WHA27.js";
6
+ import {
7
+ readBacklinksIndex,
8
+ rebuildBacklinksIndex,
9
+ scanVaultLinks
10
+ } from "../chunk-7YZWHM36.js";
11
11
  import {
12
12
  buildEntityIndex
13
13
  } from "../chunk-J7ZWCI2C.js";
@@ -1,9 +1,10 @@
1
1
  import {
2
2
  maintainCommand,
3
3
  registerMaintainCommand
4
- } from "../chunk-TDWFBDAQ.js";
4
+ } from "../chunk-D5U3Q4N5.js";
5
5
  import "../chunk-DVOUSOR3.js";
6
6
  import "../chunk-2PKBIKDH.js";
7
+ import "../chunk-35JCYSRR.js";
7
8
  import "../chunk-GJO3CFUN.js";
8
9
  import "../chunk-2ZDO52B4.js";
9
10
  export {
@@ -0,0 +1,14 @@
1
+ import { R as RecallStrategy, c as RecallResult } from '../types-CbL-wIKi.js';
2
+ import '../types-DslKvCaj.js';
3
+ import '../lib/config.js';
4
+
5
+ interface RecallCommandOptions {
6
+ vaultPath?: string;
7
+ limit?: number;
8
+ strategy?: RecallStrategy;
9
+ json?: boolean;
10
+ includeSources?: boolean;
11
+ }
12
+ declare function recallCommand(query: string, options: RecallCommandOptions): Promise<RecallResult>;
13
+
14
+ export { type RecallCommandOptions, recallCommand };
@@ -0,0 +1,15 @@
1
+ import {
2
+ recallCommand
3
+ } from "../chunk-YTRZNA64.js";
4
+ import "../chunk-RL2L6I6K.js";
5
+ import "../chunk-ECGJYWNA.js";
6
+ import "../chunk-2CDEETQN.js";
7
+ import "../chunk-FZ5I2NF7.js";
8
+ import "../chunk-PTWPPVC7.js";
9
+ import "../chunk-H3JZIB5O.js";
10
+ import "../chunk-GJO3CFUN.js";
11
+ import "../chunk-33DOSHTA.js";
12
+ import "../chunk-2ZDO52B4.js";
13
+ export {
14
+ recallCommand
15
+ };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { Command } from 'commander';
2
2
  import { V as VaultConfig, S as StoreOptions, D as Document, P as PatchOptions, a as SearchOptions, b as SearchResult, c as SyncOptions, d as SyncResult, C as Category, M as MemoryType, H as HandoffDocument, e as SessionRecap, f as VaultSearchConfig } from './types-DslKvCaj.js';
3
3
  export { g as DEFAULT_CATEGORIES, h as DEFAULT_CONFIG, E as EmbeddingProvider, i as MEMORY_TYPES, j as PatchMode, R as RerankProvider, k as SearchBackend, T as TYPE_TO_CATEGORY, l as VaultMeta } from './types-DslKvCaj.js';
4
+ import { C as CaptureOptions, a as CaptureStoreResult, b as CaptureCandidate } from './openclaw-plugin--gqA2BZw.js';
5
+ export { c as CaptureMessage, d as CaptureRejection, e as CapturedMemoryType, M as MemorySlot, f as MemorySlotInitOptions, g as MemorySlotRecallOptions, h as MemorySlotSearchOptions, i as MemorySlotStoreOptions, j as MemoryStoreMetadata, k as createMemorySlot, l as createMemorySlotPlugin, m as openclawHookPlugin, r as registerMemorySlot } from './openclaw-plugin--gqA2BZw.js';
4
6
  export { setupCommand } from './commands/setup.js';
5
7
  export { CompatCheck, CompatCommandOptions, CompatReport, CompatStatus, checkOpenClawCompatibility, compatCommand, compatibilityExitCode } from './commands/compat.js';
6
8
  export { GraphSummary, graphCommand, graphSummary } from './commands/graph.js';
@@ -20,12 +22,15 @@ export { InboxAddCommandOptions, inboxAddCommand, registerInboxCommand } from '.
20
22
  export { MaintainCommandOptions, maintainCommand, registerMaintainCommand } from './commands/maintain.js';
21
23
  export { ReplayCommandOptions, registerReplayCommand, replayCommand } from './commands/replay.js';
22
24
  export { MigrateObservationsOptions, MigrateObservationsResult, migrateObservations, migrateObservationsCommand, registerMigrateObservationsCommand } from './commands/migrate-observations.js';
25
+ export { RecallCommandOptions, recallCommand } from './commands/recall.js';
23
26
  export { SyncBdCommandOptions, registerSyncBdCommand, syncBdCommand } from './commands/sync-bd.js';
24
27
  export { SessionRecapFormat, SessionRecapOptions, SessionRecapResult, SessionTurn, buildSessionRecap, formatSessionRecapMarkdown, sessionRecapCommand } from './commands/session-recap.js';
25
28
  export { findNearestVaultPath, getVaultPath, resolveVaultPath } from './lib/config.js';
26
29
  export { registerCliCommands } from './cli/index.js';
27
30
  import { TaskStatus } from './lib/task-utils.js';
28
31
  export { completeTask, listDependentTasks, listSubtasks, updateTask } from './lib/task-utils.js';
32
+ import { R as RecallStrategy, a as RecallQueryClassification, b as RecallOptions, c as RecallResult } from './types-CbL-wIKi.js';
33
+ export { d as RecallSource } from './types-CbL-wIKi.js';
29
34
  export { CLAWVAULT_SERVE_PATH, DEFAULT_SERVE_PORT, ServeInstance, TailscalePeer, TailscaleServeConfig, TailscaleStatus, TailscaleSyncOptions, TailscaleSyncResult, VaultFileEntry, VaultManifest, checkPeerClawVault, compareManifests, configureTailscaleServe, discoverClawVaultPeers, fetchRemoteFile, fetchRemoteManifest, findPeer, generateVaultManifest, getOnlinePeers, getTailscaleStatus, getTailscaleVersion, hasTailscale, pushFileToRemote, resolvePeerIP, serveVault, stopTailscaleServe, syncWithPeer } from './lib/tailscale.js';
30
35
  export { TailscaleDiscoverCommandOptions, TailscaleServeCommandOptions, TailscaleStatusCommandOptions, TailscaleSyncCommandOptions, registerTailscaleCommands, registerTailscaleDiscoverCommand, registerTailscaleServeCommand, registerTailscaleStatusCommand, registerTailscaleSyncCommand, tailscaleDiscoverCommand, tailscaleServeCommand, tailscaleStatusCommand, tailscaleSyncCommand } from './commands/tailscale.js';
31
36
  export { TemplateVariables, buildTemplateVariables, renderTemplate } from './lib/template-engine.js';
@@ -1124,6 +1129,59 @@ interface ReflectResult {
1124
1129
  }
1125
1130
  declare function runReflection(options: ReflectOptions): Promise<ReflectResult>;
1126
1131
 
1132
+ declare class LiveCaptureService {
1133
+ captureTurn(messages: unknown[], options?: CaptureOptions): Promise<CaptureStoreResult>;
1134
+ private persistCandidate;
1135
+ }
1136
+
1137
+ declare function extractTaggedMemoryNotes(text: string): CaptureCandidate[];
1138
+ declare function extractHeuristicMemories(text: string): CaptureCandidate[];
1139
+ declare function extractMemoriesFromAssistantResponse(text: string): CaptureCandidate[];
1140
+
1141
+ interface QualityGateOptions {
1142
+ minConfidence?: number;
1143
+ minQualityScore?: number;
1144
+ dedupThreshold?: number;
1145
+ }
1146
+ interface QualityGateResult {
1147
+ accepted: boolean;
1148
+ reason?: string;
1149
+ qualityScore: number;
1150
+ plausibilityScore: number;
1151
+ confidenceScore: number;
1152
+ maxSimilarity: number;
1153
+ }
1154
+ declare function isLikelyJunkMemory(content: string): boolean;
1155
+ declare function plausibilityScore(content: string): number;
1156
+ declare function evaluateCandidateQuality(candidate: CaptureCandidate, existingContents: string[], stagedContents?: string[], options?: QualityGateOptions): QualityGateResult;
1157
+
1158
+ declare function classifyRecallQuery(query: string, knownEntityNames?: string[], forcedStrategy?: RecallStrategy): RecallQueryClassification;
1159
+
1160
+ declare function buildRecallResult(vault: ClawVault, query: string, options?: RecallOptions): Promise<RecallResult>;
1161
+
1162
+ type EntityKind = 'person' | 'project' | 'org' | 'place' | 'unknown';
1163
+ interface EntityRelationship {
1164
+ target: string;
1165
+ strength: number;
1166
+ evidence: string[];
1167
+ }
1168
+ interface EntityProfile {
1169
+ name: string;
1170
+ aliases: string[];
1171
+ kind: EntityKind;
1172
+ summary: string;
1173
+ relationships: EntityRelationship[];
1174
+ lastMentioned: string;
1175
+ }
1176
+
1177
+ interface SynthesizeEntityProfilesOptions {
1178
+ writeFiles?: boolean;
1179
+ }
1180
+ declare function synthesizeEntityProfiles(vaultPath: string, options?: SynthesizeEntityProfilesOptions): Promise<EntityProfile[]>;
1181
+ declare function readEntityProfiles(vaultPath: string): EntityProfile[];
1182
+ declare function ensureEntityProfiles(vaultPath: string): Promise<EntityProfile[]>;
1183
+ declare function readEntityProfile(vaultPath: string, name: string): Promise<EntityProfile | null>;
1184
+
1127
1185
  /**
1128
1186
  * ClawVault 🐘 — An Elephant Never Forgets
1129
1187
  *
@@ -1153,4 +1211,4 @@ declare function runReflection(options: ReflectOptions): Promise<ReflectResult>;
1153
1211
  declare const VERSION: string;
1154
1212
  declare function registerCommanderCommands(program: Command): Command;
1155
1213
 
1156
- export { type ActiveObservationCandidate, type ActiveObservationFailure, type ActiveObserveOptions, type ActiveObserveResult, type ArchiveObservationsOptions, type ArchiveObservationsResult, type BenchmarkFixtureResult, Category, ClawVault, type CompressionProvider, Compressor, type CompressorOptions, type ContextProfile as ConfigDefaultProfile, type SearchBackend as ConfigSearchBackend, type SearchEmbeddingProvider as ConfigSearchEmbeddingProvider, type SearchRerankProvider as ConfigSearchRerankProvider, Document, EmbeddingCache, type ExtractedFact, type ExtractionResult, type FactExtractionMode$1 as FactExtractionMode, FactStore, type FactStoreStats, type FixtureScoringMetrics, type FixtureScoringResult, HandoffDocument, type KeywordRewriteFlag, type LlmAdapter, type LlmAdapterOptions, LlmProvider, type ManagedConfigKey, MemoryType, type MigrateCommandOptions, type MigrateResult, type MigrationAction, MigrationIssueType, type ObservationMatch, type ObserveCursorEntry, type ObserveCursorStore, type ObserveProvider, Observer, type ObserverBenchmarkFixture, type ObserverBenchmarkFixtureConfig, type ObserverBenchmarkProvider, type ObserverBenchmarkReport, type ObserverBenchmarkReportFormat, type ObserverBenchmarkRunOptions, type ObserverCompressionProvider, type ObserverCompressor, type ObserverOptions, type ObserverReflector, type ObserverStalenessResult, PatchOptions, QMD_INSTALL_COMMAND, QMD_INSTALL_URL, QmdConfigurationError, type QmdErrorCode, type QmdErrorDetails, QmdUnavailableError, type ReflectOptions, type ReflectResult, Reflector, type ReflectorOptions, type RouteRule, SUPPORTED_CONFIG_KEYS, type ScoreFixtureOptions, SearchEngine, SearchOptions, SearchResult, SessionRecap, SessionWatcher, type SessionWatcherOptions, StoreOptions, SyncOptions, SyncResult, type Theme, type TransitionEvent, VERSION, VaultConfig, VaultSearchConfig, addRouteRule, appendTransition, archiveObservations, buildTransitionEvent, compareObservationText, cosineSimilarity, countBlockedTransitions, createDefaultAdapter, createFactExtractionAdapter, createGeminiFlashAdapter, createLlmFunction, createVault, embed, embedBatch, extractFactsLlm, extractFactsRuleBased, extractKeywordSetFromTranscript, extractTags, extractWikiLinks, factId, findVault, formatObserverBenchmarkSummary, formatTransitionsTable, getConfig, getConfigValue, getObserverStaleness, getQmdErrorDetails, getScaledObservationThresholdBytes, hasQmd, hybridSearch, isRegression, listConfig, listRouteRules, loadObserverBenchmarkFixtures, matchObservationRecords, matchRouteRule, migrate, migrateCommand, normalizeEntity, observeActiveSessions, parseSessionFile, parseSessionSourceLabel, qmdEmbed, qmdUpdate, queryTransitions, readAllTransitions, reciprocalRankFusion, registerCommanderCommands, registerMigrateCommand, removeRouteRule, resetConfig, resolveFactExtractionMode, runObserverBenchmark, runReflection, scoreFixtureObservations, semanticSearch, setConfigValue, testRouteRule };
1214
+ export { type ActiveObservationCandidate, type ActiveObservationFailure, type ActiveObserveOptions, type ActiveObserveResult, type ArchiveObservationsOptions, type ArchiveObservationsResult, type BenchmarkFixtureResult, CaptureCandidate, CaptureOptions, CaptureStoreResult, Category, ClawVault, type CompressionProvider, Compressor, type CompressorOptions, type ContextProfile as ConfigDefaultProfile, type SearchBackend as ConfigSearchBackend, type SearchEmbeddingProvider as ConfigSearchEmbeddingProvider, type SearchRerankProvider as ConfigSearchRerankProvider, Document, EmbeddingCache, type EntityKind, type EntityProfile, type EntityRelationship, type ExtractedFact, type ExtractionResult, type FactExtractionMode$1 as FactExtractionMode, FactStore, type FactStoreStats, type FixtureScoringMetrics, type FixtureScoringResult, HandoffDocument, type KeywordRewriteFlag, LiveCaptureService, type LlmAdapter, type LlmAdapterOptions, LlmProvider, type ManagedConfigKey, MemoryType, type MigrateCommandOptions, type MigrateResult, type MigrationAction, MigrationIssueType, type ObservationMatch, type ObserveCursorEntry, type ObserveCursorStore, type ObserveProvider, Observer, type ObserverBenchmarkFixture, type ObserverBenchmarkFixtureConfig, type ObserverBenchmarkProvider, type ObserverBenchmarkReport, type ObserverBenchmarkReportFormat, type ObserverBenchmarkRunOptions, type ObserverCompressionProvider, type ObserverCompressor, type ObserverOptions, type ObserverReflector, type ObserverStalenessResult, PatchOptions, QMD_INSTALL_COMMAND, QMD_INSTALL_URL, QmdConfigurationError, type QmdErrorCode, type QmdErrorDetails, QmdUnavailableError, RecallOptions, RecallQueryClassification, RecallResult, RecallStrategy, type ReflectOptions, type ReflectResult, Reflector, type ReflectorOptions, type RouteRule, SUPPORTED_CONFIG_KEYS, type ScoreFixtureOptions, SearchEngine, SearchOptions, SearchResult, SessionRecap, SessionWatcher, type SessionWatcherOptions, StoreOptions, SyncOptions, SyncResult, type Theme, type TransitionEvent, VERSION, VaultConfig, VaultSearchConfig, addRouteRule, appendTransition, archiveObservations, buildRecallResult, buildTransitionEvent, classifyRecallQuery, compareObservationText, cosineSimilarity, countBlockedTransitions, createDefaultAdapter, createFactExtractionAdapter, createGeminiFlashAdapter, createLlmFunction, createVault, embed, embedBatch, ensureEntityProfiles, evaluateCandidateQuality, extractFactsLlm, extractFactsRuleBased, extractHeuristicMemories, extractKeywordSetFromTranscript, extractMemoriesFromAssistantResponse, extractTaggedMemoryNotes, extractTags, extractWikiLinks, factId, findVault, formatObserverBenchmarkSummary, formatTransitionsTable, getConfig, getConfigValue, getObserverStaleness, getQmdErrorDetails, getScaledObservationThresholdBytes, hasQmd, hybridSearch, isLikelyJunkMemory, isRegression, listConfig, listRouteRules, loadObserverBenchmarkFixtures, matchObservationRecords, matchRouteRule, migrate, migrateCommand, normalizeEntity, observeActiveSessions, parseSessionFile, parseSessionSourceLabel, plausibilityScore, qmdEmbed, qmdUpdate, queryTransitions, readAllTransitions, readEntityProfile, readEntityProfiles, reciprocalRankFusion, registerCommanderCommands, registerMigrateCommand, removeRouteRule, resetConfig, resolveFactExtractionMode, runObserverBenchmark, runReflection, scoreFixtureObservations, semanticSearch, setConfigValue, synthesizeEntityProfiles, testRouteRule };