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.
- package/bin/command-registration.test.js +1 -3
- package/bin/register-core-commands.js +10 -23
- package/bin/register-maintenance-commands.js +3 -20
- package/bin/register-query-commands.js +23 -0
- package/bin/register-task-commands.js +1 -18
- package/bin/register-task-commands.test.js +0 -16
- package/bin/register-vault-operations-commands.js +1 -29
- package/dist/{chunk-QVMXF7FY.js → chunk-3D6BCTP6.js} +39 -1
- package/dist/{chunk-R2MIW5G7.js → chunk-3DHXQHYG.js} +1 -1
- package/dist/{chunk-Q2J5YTUF.js → chunk-3NSBOUT3.js} +73 -36
- package/dist/chunk-3RG5ZIWI.js +10 -0
- package/dist/{chunk-AZYOKJYC.js → chunk-62YTUT6J.js} +2 -2
- package/dist/chunk-6U6MK36V.js +205 -0
- package/dist/{chunk-4QYGFWRM.js → chunk-7R7O6STJ.js} +4 -4
- package/dist/{chunk-VXEOHTSL.js → chunk-C7OK5WKP.js} +4 -4
- package/dist/chunk-CMB7UL7C.js +327 -0
- package/dist/chunk-DEFFDRVP.js +938 -0
- package/dist/{chunk-K3CDT7IH.js → chunk-E7MFQB6D.js} +61 -20
- package/dist/{chunk-ME37YNW3.js → chunk-F2JEUD4J.js} +6 -4
- package/dist/chunk-GAJV4IGR.js +82 -0
- package/dist/chunk-GQSLDZTS.js +560 -0
- package/dist/{chunk-4OXMU5S2.js → chunk-GUKMRGM7.js} +1 -1
- package/dist/{chunk-YOSEUUNB.js → chunk-H34S76MB.js} +6 -6
- package/dist/{chunk-4TE4JMLA.js → chunk-JY6FYXIT.js} +10 -5
- package/dist/chunk-K234IDRJ.js +1073 -0
- package/dist/{chunk-IEVLHNLU.js → chunk-LNJA2UGL.js} +86 -9
- package/dist/{chunk-MFAWT5O5.js → chunk-LYHGEHXG.js} +1 -0
- package/dist/chunk-MFM6K7PU.js +374 -0
- package/dist/{chunk-QWQ3TIKS.js → chunk-N2AXRYLC.js} +1 -1
- package/dist/chunk-PAH27GSN.js +108 -0
- package/dist/{chunk-OIWVQYQF.js → chunk-QBLMXKF2.js} +1 -1
- package/dist/{chunk-FHFUXL6G.js → chunk-QK3UCXWL.js} +2 -2
- package/dist/{chunk-2YDBJS7M.js → chunk-SJSFRIYS.js} +1 -1
- package/dist/{chunk-GSD4ALSI.js → chunk-U55BGUAU.js} +2 -2
- package/dist/{chunk-PBEE567J.js → chunk-VGLOTGAS.js} +1 -1
- package/dist/{chunk-F55HGNU4.js → chunk-WAZ3NLWL.js} +47 -0
- package/dist/{chunk-KL4NAOMO.js → chunk-WGRQ6HDV.js} +1 -1
- package/dist/{chunk-UEOUADMO.js → chunk-YKTA5JOJ.js} +13 -10
- package/dist/{chunk-XAVB4GB4.js → chunk-ZVVFWOLW.js} +4 -4
- package/dist/cli/index.cjs +10033 -0
- package/dist/cli/index.d.cts +5 -0
- package/dist/cli/index.js +20 -18
- package/dist/commands/archive.cjs +287 -0
- package/dist/commands/archive.d.cts +11 -0
- package/dist/commands/archive.js +1 -0
- package/dist/commands/backlog.cjs +721 -0
- package/dist/commands/backlog.d.cts +53 -0
- package/dist/commands/backlog.js +3 -2
- package/dist/commands/blocked.cjs +204 -0
- package/dist/commands/blocked.d.cts +26 -0
- package/dist/commands/blocked.js +3 -2
- package/dist/commands/checkpoint.cjs +244 -0
- package/dist/commands/checkpoint.d.cts +41 -0
- package/dist/commands/checkpoint.js +2 -1
- package/dist/commands/compat.cjs +369 -0
- package/dist/commands/compat.d.cts +28 -0
- package/dist/commands/compat.js +2 -1
- package/dist/commands/context.cjs +2989 -0
- package/dist/commands/context.d.cts +2 -0
- package/dist/commands/context.js +5 -4
- package/dist/commands/doctor.cjs +3062 -0
- package/dist/commands/doctor.d.cts +21 -0
- package/dist/commands/doctor.d.ts +6 -1
- package/dist/commands/doctor.js +13 -11
- package/dist/commands/embed.cjs +232 -0
- package/dist/commands/embed.d.cts +17 -0
- package/dist/commands/embed.js +5 -2
- package/dist/commands/entities.cjs +141 -0
- package/dist/commands/entities.d.cts +7 -0
- package/dist/commands/entities.js +1 -0
- package/dist/commands/graph.cjs +501 -0
- package/dist/commands/graph.d.cts +21 -0
- package/dist/commands/graph.js +1 -0
- package/dist/commands/inject.cjs +1636 -0
- package/dist/commands/inject.d.cts +2 -0
- package/dist/commands/inject.d.ts +1 -1
- package/dist/commands/inject.js +4 -2
- package/dist/commands/kanban.cjs +884 -0
- package/dist/commands/kanban.d.cts +63 -0
- package/dist/commands/kanban.js +4 -3
- package/dist/commands/link.cjs +965 -0
- package/dist/commands/link.d.cts +11 -0
- package/dist/commands/link.js +1 -0
- package/dist/commands/migrate-observations.cjs +362 -0
- package/dist/commands/migrate-observations.d.cts +19 -0
- package/dist/commands/migrate-observations.js +3 -2
- package/dist/commands/observe.cjs +4099 -0
- package/dist/commands/observe.d.cts +23 -0
- package/dist/commands/observe.d.ts +1 -0
- package/dist/commands/observe.js +11 -9
- package/dist/commands/project.cjs +1341 -0
- package/dist/commands/project.d.cts +85 -0
- package/dist/commands/project.js +5 -4
- package/dist/commands/rebuild.cjs +3136 -0
- package/dist/commands/rebuild.d.cts +11 -0
- package/dist/commands/rebuild.js +10 -8
- package/dist/commands/recover.cjs +361 -0
- package/dist/commands/recover.d.cts +38 -0
- package/dist/commands/recover.js +3 -2
- package/dist/commands/reflect.cjs +1008 -0
- package/dist/commands/reflect.d.cts +11 -0
- package/dist/commands/reflect.js +6 -4
- package/dist/commands/repair-session.cjs +457 -0
- package/dist/commands/repair-session.d.cts +38 -0
- package/dist/commands/repair-session.js +1 -0
- package/dist/commands/replay.cjs +4103 -0
- package/dist/commands/replay.d.cts +16 -0
- package/dist/commands/replay.js +12 -10
- package/dist/commands/session-recap.cjs +353 -0
- package/dist/commands/session-recap.d.cts +27 -0
- package/dist/commands/session-recap.js +1 -0
- package/dist/commands/setup.cjs +1345 -0
- package/dist/commands/setup.d.cts +100 -0
- package/dist/commands/setup.d.ts +90 -2
- package/dist/commands/setup.js +21 -2
- package/dist/commands/shell-init.cjs +75 -0
- package/dist/commands/shell-init.d.cts +7 -0
- package/dist/commands/shell-init.js +2 -0
- package/dist/commands/sleep.cjs +6028 -0
- package/dist/commands/sleep.d.cts +36 -0
- package/dist/commands/sleep.d.ts +1 -1
- package/dist/commands/sleep.js +17 -15
- package/dist/commands/status.cjs +2736 -0
- package/dist/commands/status.d.cts +52 -0
- package/dist/commands/status.js +12 -10
- package/dist/commands/tailscale.cjs +1532 -0
- package/dist/commands/tailscale.d.cts +52 -0
- package/dist/commands/tailscale.js +1 -0
- package/dist/commands/task.cjs +1236 -0
- package/dist/commands/task.d.cts +97 -0
- package/dist/commands/task.js +4 -3
- package/dist/commands/template.cjs +457 -0
- package/dist/commands/template.d.cts +36 -0
- package/dist/commands/template.js +2 -1
- package/dist/commands/wake.cjs +2626 -0
- package/dist/commands/wake.d.cts +22 -0
- package/dist/commands/wake.d.ts +1 -1
- package/dist/commands/wake.js +12 -11
- package/dist/context-BUGaWpyL.d.cts +46 -0
- package/dist/index.cjs +14526 -0
- package/dist/index.d.cts +858 -0
- package/dist/index.d.ts +192 -7
- package/dist/index.js +101 -75
- package/dist/{inject-x65KXWPk.d.ts → inject-Bzi5E-By.d.cts} +1 -1
- package/dist/inject-Bzi5E-By.d.ts +137 -0
- package/dist/lib/auto-linker.cjs +176 -0
- package/dist/lib/auto-linker.d.cts +26 -0
- package/dist/lib/auto-linker.js +1 -0
- package/dist/lib/canvas-layout.cjs +136 -0
- package/dist/lib/canvas-layout.d.cts +31 -0
- package/dist/lib/canvas-layout.d.ts +16 -100
- package/dist/lib/canvas-layout.js +78 -20
- package/dist/lib/config.cjs +78 -0
- package/dist/lib/config.d.cts +11 -0
- package/dist/lib/config.js +1 -0
- package/dist/lib/entity-index.cjs +84 -0
- package/dist/lib/entity-index.d.cts +26 -0
- package/dist/lib/entity-index.js +1 -0
- package/dist/lib/project-utils.cjs +864 -0
- package/dist/lib/project-utils.d.cts +97 -0
- package/dist/lib/project-utils.js +4 -3
- package/dist/lib/session-repair.cjs +239 -0
- package/dist/lib/session-repair.d.cts +110 -0
- package/dist/lib/session-repair.js +1 -0
- package/dist/lib/session-utils.cjs +209 -0
- package/dist/lib/session-utils.d.cts +63 -0
- package/dist/lib/session-utils.js +1 -0
- package/dist/lib/tailscale.cjs +1183 -0
- package/dist/lib/tailscale.d.cts +225 -0
- package/dist/lib/tailscale.js +1 -0
- package/dist/lib/task-utils.cjs +1137 -0
- package/dist/lib/task-utils.d.cts +208 -0
- package/dist/lib/task-utils.js +3 -2
- package/dist/lib/template-engine.cjs +47 -0
- package/dist/lib/template-engine.d.cts +11 -0
- package/dist/lib/template-engine.js +1 -0
- package/dist/lib/webdav.cjs +568 -0
- package/dist/lib/webdav.d.cts +109 -0
- package/dist/lib/webdav.js +1 -0
- package/dist/plugin/index.cjs +1907 -0
- package/dist/plugin/index.d.cts +36 -0
- package/dist/plugin/index.d.ts +36 -0
- package/dist/plugin/index.js +572 -0
- package/dist/plugin/inject.cjs +356 -0
- package/dist/plugin/inject.d.cts +54 -0
- package/dist/plugin/inject.d.ts +54 -0
- package/dist/plugin/inject.js +17 -0
- package/dist/plugin/observe.cjs +631 -0
- package/dist/plugin/observe.d.cts +39 -0
- package/dist/plugin/observe.d.ts +39 -0
- package/dist/plugin/observe.js +18 -0
- package/dist/plugin/templates.cjs +593 -0
- package/dist/plugin/templates.d.cts +52 -0
- package/dist/plugin/templates.d.ts +52 -0
- package/dist/plugin/templates.js +25 -0
- package/dist/plugin/types.cjs +18 -0
- package/dist/plugin/types.d.cts +209 -0
- package/dist/plugin/types.d.ts +209 -0
- package/dist/plugin/types.js +0 -0
- package/dist/plugin/vault.cjs +927 -0
- package/dist/plugin/vault.d.cts +68 -0
- package/dist/plugin/vault.d.ts +68 -0
- package/dist/plugin/vault.js +22 -0
- package/dist/{types-C74wgGL1.d.ts → types-Y2_Um2Ls.d.cts} +44 -1
- package/dist/types-Y2_Um2Ls.d.ts +205 -0
- package/hooks/clawvault/handler.js +70 -7
- package/hooks/clawvault/handler.test.js +91 -0
- package/openclaw.plugin.json +56 -0
- package/package.json +17 -7
- package/templates/memory-event.md +67 -0
- package/templates/party.md +63 -0
- package/templates/primitive-registry.yaml +551 -0
- package/templates/run.md +68 -0
- package/templates/trigger.md +68 -0
- package/templates/workspace.md +50 -0
- package/dashboard/lib/graph-diff.js +0 -104
- package/dashboard/lib/graph-diff.test.js +0 -75
- package/dashboard/lib/vault-parser.js +0 -556
- package/dashboard/lib/vault-parser.test.js +0 -254
- package/dashboard/public/app.js +0 -796
- package/dashboard/public/index.html +0 -52
- package/dashboard/public/styles.css +0 -221
- package/dashboard/server.js +0 -374
- package/dist/chunk-HA5M6KJB.js +0 -33
- package/dist/chunk-MAKNAHAW.js +0 -375
- package/dist/chunk-MDIH26GC.js +0 -183
- package/dist/chunk-MGDEINGP.js +0 -99
- package/dist/chunk-RVYA52PY.js +0 -363
- package/dist/commands/canvas.d.ts +0 -15
- package/dist/commands/canvas.js +0 -199
- package/dist/commands/sync-bd.d.ts +0 -10
- package/dist/commands/sync-bd.js +0 -9
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,858 @@
|
|
|
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, E as ExtractedDate, f as ExtractedPreference } from './types-Y2_Um2Ls.cjs';
|
|
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.cjs';
|
|
4
|
+
export { setupCommand } from './commands/setup.cjs';
|
|
5
|
+
export { CompatCheck, CompatCommandOptions, CompatReport, CompatStatus, checkOpenClawCompatibility, compatCommand, compatibilityExitCode } from './commands/compat.cjs';
|
|
6
|
+
export { GraphSummary, graphCommand, graphSummary } from './commands/graph.cjs';
|
|
7
|
+
export { KanbanGroupBy, KanbanImportChange, KanbanImportOptions, KanbanImportResult, KanbanLane, KanbanSyncOptions, KanbanSyncResult, ParsedKanbanBoard, ParsedKanbanLane, buildKanbanLanes, extractCardSlug, formatKanbanCard, generateKanbanMarkdown, importKanbanBoard, kanbanCommand, parseKanbanMarkdown, syncKanbanBoard } from './commands/kanban.cjs';
|
|
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.cjs';
|
|
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.cjs';
|
|
10
|
+
export { ObserveCommandOptions, observeCommand, registerObserveCommand } from './commands/observe.cjs';
|
|
11
|
+
export { ReflectCommandOptions, reflectCommand, registerReflectCommand } from './commands/reflect.cjs';
|
|
12
|
+
export { ArchiveCommandOptions, archiveCommand, registerArchiveCommand } from './commands/archive.cjs';
|
|
13
|
+
export { RebuildCommandOptions, rebuildCommand, registerRebuildCommand } from './commands/rebuild.cjs';
|
|
14
|
+
export { DoctorCheck, DoctorReport, DoctorStatus, doctor } from './commands/doctor.cjs';
|
|
15
|
+
export { EmbedCommandOptions, EmbedCommandResult, embedCommand, registerEmbedCommand } from './commands/embed.cjs';
|
|
16
|
+
export { ReplayCommandOptions, registerReplayCommand, replayCommand } from './commands/replay.cjs';
|
|
17
|
+
export { MigrateObservationsOptions, MigrateObservationsResult, migrateObservations, migrateObservationsCommand, registerMigrateObservationsCommand } from './commands/migrate-observations.cjs';
|
|
18
|
+
export { SessionRecapFormat, SessionRecapOptions, SessionRecapResult, SessionTurn, buildSessionRecap, formatSessionRecapMarkdown, sessionRecapCommand } from './commands/session-recap.cjs';
|
|
19
|
+
export { findNearestVaultPath, getVaultPath, resolveVaultPath } from './lib/config.cjs';
|
|
20
|
+
export { registerCliCommands } from './cli/index.cjs';
|
|
21
|
+
import { TaskStatus } from './lib/task-utils.cjs';
|
|
22
|
+
export { completeTask, listDependentTasks, listSubtasks, updateTask } from './lib/task-utils.cjs';
|
|
23
|
+
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.cjs';
|
|
24
|
+
export { TailscaleDiscoverCommandOptions, TailscaleServeCommandOptions, TailscaleStatusCommandOptions, TailscaleSyncCommandOptions, registerTailscaleCommands, registerTailscaleDiscoverCommand, registerTailscaleServeCommand, registerTailscaleStatusCommand, registerTailscaleSyncCommand, tailscaleDiscoverCommand, tailscaleServeCommand, tailscaleStatusCommand, tailscaleSyncCommand } from './commands/tailscale.cjs';
|
|
25
|
+
export { TemplateVariables, buildTemplateVariables, renderTemplate } from './lib/template-engine.cjs';
|
|
26
|
+
export { Project, ProjectFrontmatter, ProjectStatus, archiveProject, createProject, getProjectActivity, getProjectTasks, listProjects, readProject, updateProject } from './lib/project-utils.cjs';
|
|
27
|
+
import 'child_process';
|
|
28
|
+
import 'http';
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* ClawVault - The elephant's memory
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
declare class ClawVault {
|
|
35
|
+
private config;
|
|
36
|
+
private search;
|
|
37
|
+
private initialized;
|
|
38
|
+
constructor(vaultPath: string);
|
|
39
|
+
/**
|
|
40
|
+
* Initialize a new vault
|
|
41
|
+
*/
|
|
42
|
+
init(options?: Partial<VaultConfig>, initFlags?: {
|
|
43
|
+
skipBases?: boolean;
|
|
44
|
+
skipTasks?: boolean;
|
|
45
|
+
skipGraph?: boolean;
|
|
46
|
+
}): Promise<void>;
|
|
47
|
+
private createBasesFiles;
|
|
48
|
+
/**
|
|
49
|
+
* Load an existing vault
|
|
50
|
+
*/
|
|
51
|
+
load(): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Reindex all documents
|
|
54
|
+
*/
|
|
55
|
+
reindex(): Promise<number>;
|
|
56
|
+
/**
|
|
57
|
+
* Load a document from disk
|
|
58
|
+
*/
|
|
59
|
+
private loadDocument;
|
|
60
|
+
/**
|
|
61
|
+
* Store a new document
|
|
62
|
+
*/
|
|
63
|
+
store(options: StoreOptions): Promise<Document>;
|
|
64
|
+
/**
|
|
65
|
+
* Quick store to inbox
|
|
66
|
+
*/
|
|
67
|
+
capture(note: string, title?: string): Promise<Document>;
|
|
68
|
+
/**
|
|
69
|
+
* Search the vault (BM25 via qmd)
|
|
70
|
+
*/
|
|
71
|
+
find(query: string, options?: SearchOptions): Promise<SearchResult[]>;
|
|
72
|
+
/**
|
|
73
|
+
* Semantic/vector search (via qmd vsearch)
|
|
74
|
+
*/
|
|
75
|
+
vsearch(query: string, options?: SearchOptions): Promise<SearchResult[]>;
|
|
76
|
+
/**
|
|
77
|
+
* Combined search with query expansion (via qmd query)
|
|
78
|
+
*/
|
|
79
|
+
query(query: string, options?: SearchOptions): Promise<SearchResult[]>;
|
|
80
|
+
/**
|
|
81
|
+
* Get a document by ID or path
|
|
82
|
+
*/
|
|
83
|
+
get(idOrPath: string): Promise<Document | null>;
|
|
84
|
+
/**
|
|
85
|
+
* List documents in a category
|
|
86
|
+
*/
|
|
87
|
+
list(category?: string): Promise<Document[]>;
|
|
88
|
+
/**
|
|
89
|
+
* Sync vault to another location (for Obsidian on Windows, etc.)
|
|
90
|
+
*/
|
|
91
|
+
sync(options: SyncOptions): Promise<SyncResult>;
|
|
92
|
+
/**
|
|
93
|
+
* Get vault statistics
|
|
94
|
+
*/
|
|
95
|
+
stats(): Promise<{
|
|
96
|
+
documents: number;
|
|
97
|
+
categories: {
|
|
98
|
+
[key: string]: number;
|
|
99
|
+
};
|
|
100
|
+
links: number;
|
|
101
|
+
tags: string[];
|
|
102
|
+
}>;
|
|
103
|
+
/**
|
|
104
|
+
* Get all categories
|
|
105
|
+
*/
|
|
106
|
+
getCategories(): Category[];
|
|
107
|
+
/**
|
|
108
|
+
* Check if vault is initialized
|
|
109
|
+
*/
|
|
110
|
+
isInitialized(): boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Get vault path
|
|
113
|
+
*/
|
|
114
|
+
getPath(): string;
|
|
115
|
+
/**
|
|
116
|
+
* Get vault name
|
|
117
|
+
*/
|
|
118
|
+
getName(): string;
|
|
119
|
+
/**
|
|
120
|
+
* Get qmd collection name
|
|
121
|
+
*/
|
|
122
|
+
getQmdCollection(): string;
|
|
123
|
+
/**
|
|
124
|
+
* Get qmd collection root
|
|
125
|
+
*/
|
|
126
|
+
getQmdRoot(): string;
|
|
127
|
+
/**
|
|
128
|
+
* Store a memory with type classification
|
|
129
|
+
* Automatically routes to correct category based on type
|
|
130
|
+
*/
|
|
131
|
+
remember(type: MemoryType, title: string, content: string, frontmatter?: Record<string, unknown>): Promise<Document>;
|
|
132
|
+
/**
|
|
133
|
+
* Create a session handoff document
|
|
134
|
+
* Call this before context death or long pauses
|
|
135
|
+
*/
|
|
136
|
+
createHandoff(handoff: Omit<HandoffDocument, 'created'>): Promise<Document>;
|
|
137
|
+
/**
|
|
138
|
+
* Format handoff as readable markdown
|
|
139
|
+
*/
|
|
140
|
+
private formatHandoff;
|
|
141
|
+
/**
|
|
142
|
+
* Generate a session recap - who I was
|
|
143
|
+
* Call this on bootstrap to restore context
|
|
144
|
+
*/
|
|
145
|
+
generateRecap(options?: {
|
|
146
|
+
handoffLimit?: number;
|
|
147
|
+
brief?: boolean;
|
|
148
|
+
}): Promise<SessionRecap>;
|
|
149
|
+
/**
|
|
150
|
+
* Format recap as readable markdown for injection
|
|
151
|
+
*/
|
|
152
|
+
formatRecap(recap: SessionRecap, options?: {
|
|
153
|
+
brief?: boolean;
|
|
154
|
+
}): string;
|
|
155
|
+
/**
|
|
156
|
+
* Parse a handoff document back into structured form
|
|
157
|
+
*/
|
|
158
|
+
private parseHandoff;
|
|
159
|
+
private applyQmdConfig;
|
|
160
|
+
private slugify;
|
|
161
|
+
private saveIndex;
|
|
162
|
+
private createTemplates;
|
|
163
|
+
private createWelcomeNote;
|
|
164
|
+
private syncMemoryGraphIndex;
|
|
165
|
+
private generateReadme;
|
|
166
|
+
private getCategoryDescription;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Find and open the nearest vault (walks up directory tree)
|
|
170
|
+
*/
|
|
171
|
+
declare function findVault(startPath?: string): Promise<ClawVault | null>;
|
|
172
|
+
/**
|
|
173
|
+
* Create a new vault
|
|
174
|
+
*/
|
|
175
|
+
declare function createVault(vaultPath: string, options?: Partial<VaultConfig>, initFlags?: {
|
|
176
|
+
skipBases?: boolean;
|
|
177
|
+
skipTasks?: boolean;
|
|
178
|
+
skipGraph?: boolean;
|
|
179
|
+
}): Promise<ClawVault>;
|
|
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
|
+
|
|
297
|
+
/**
|
|
298
|
+
* ClawVault Search Engine - qmd Backend
|
|
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)
|
|
306
|
+
*/
|
|
307
|
+
|
|
308
|
+
declare const QMD_INSTALL_URL = "https://github.com/tobi/qmd";
|
|
309
|
+
declare const QMD_INSTALL_COMMAND = "bun install -g github:tobi/qmd";
|
|
310
|
+
declare class QmdUnavailableError extends Error {
|
|
311
|
+
constructor(message?: string);
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Check if qmd is available
|
|
315
|
+
*/
|
|
316
|
+
declare function hasQmd(): boolean;
|
|
317
|
+
/**
|
|
318
|
+
* Trigger qmd update (reindex)
|
|
319
|
+
*/
|
|
320
|
+
declare function qmdUpdate(collection?: string, indexName?: string): void;
|
|
321
|
+
/**
|
|
322
|
+
* Trigger qmd embed (create/update vector embeddings)
|
|
323
|
+
*/
|
|
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';
|
|
350
|
+
/**
|
|
351
|
+
* QMD Search Engine - wraps qmd CLI
|
|
352
|
+
*/
|
|
353
|
+
declare class SearchEngine {
|
|
354
|
+
private documents;
|
|
355
|
+
private collection;
|
|
356
|
+
private vaultPath;
|
|
357
|
+
private collectionRoot;
|
|
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;
|
|
365
|
+
/**
|
|
366
|
+
* Set the collection name (usually vault name)
|
|
367
|
+
*/
|
|
368
|
+
setCollection(name: string): void;
|
|
369
|
+
/**
|
|
370
|
+
* Set the vault path for file resolution
|
|
371
|
+
*/
|
|
372
|
+
setVaultPath(vaultPath: string): void;
|
|
373
|
+
/**
|
|
374
|
+
* Set the collection root for qmd:// URI resolution
|
|
375
|
+
*/
|
|
376
|
+
setCollectionRoot(root: string): void;
|
|
377
|
+
/**
|
|
378
|
+
* Set qmd index name (defaults to qmd global default when omitted)
|
|
379
|
+
*/
|
|
380
|
+
setIndexName(indexName?: string): void;
|
|
381
|
+
/**
|
|
382
|
+
* Add or update a document in the local cache.
|
|
383
|
+
* v2.7: also extracts dates, preferences, and chunks at ingest time.
|
|
384
|
+
* Note: qmd indexing happens via qmd update command
|
|
385
|
+
*/
|
|
386
|
+
addDocument(doc: Document): void;
|
|
387
|
+
/**
|
|
388
|
+
* Remove a document from the local cache
|
|
389
|
+
*/
|
|
390
|
+
removeDocument(id: string): void;
|
|
391
|
+
/**
|
|
392
|
+
* No-op for qmd - indexing is managed externally
|
|
393
|
+
*/
|
|
394
|
+
rebuildIDF(): void;
|
|
395
|
+
/**
|
|
396
|
+
* BM25 search via qmd
|
|
397
|
+
*/
|
|
398
|
+
search(query: string, options?: SearchOptions): SearchResult[];
|
|
399
|
+
/**
|
|
400
|
+
* Vector/semantic search via qmd vsearch
|
|
401
|
+
*/
|
|
402
|
+
vsearch(query: string, options?: SearchOptions): SearchResult[];
|
|
403
|
+
/**
|
|
404
|
+
* Combined search with query expansion (qmd query command)
|
|
405
|
+
*/
|
|
406
|
+
query(query: string, options?: SearchOptions): SearchResult[];
|
|
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[];
|
|
434
|
+
/**
|
|
435
|
+
* Convert qmd results to ClawVault SearchResult format
|
|
436
|
+
*/
|
|
437
|
+
private convertResults;
|
|
438
|
+
private resolveModifiedAt;
|
|
439
|
+
private getRecencyFactor;
|
|
440
|
+
/**
|
|
441
|
+
* Convert qmd:// URI to file path
|
|
442
|
+
*/
|
|
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;
|
|
449
|
+
/**
|
|
450
|
+
* Clean up qmd snippet format
|
|
451
|
+
*/
|
|
452
|
+
private cleanSnippet;
|
|
453
|
+
/**
|
|
454
|
+
* Get all cached documents
|
|
455
|
+
*/
|
|
456
|
+
getAllDocuments(): Document[];
|
|
457
|
+
/**
|
|
458
|
+
* Get document count
|
|
459
|
+
*/
|
|
460
|
+
get size(): number;
|
|
461
|
+
/**
|
|
462
|
+
* Clear the local document cache and all v2.7 indices
|
|
463
|
+
*/
|
|
464
|
+
clear(): void;
|
|
465
|
+
/**
|
|
466
|
+
* Export documents for persistence
|
|
467
|
+
*/
|
|
468
|
+
export(): {
|
|
469
|
+
documents: Document[];
|
|
470
|
+
};
|
|
471
|
+
/**
|
|
472
|
+
* Import from persisted data
|
|
473
|
+
*/
|
|
474
|
+
import(data: {
|
|
475
|
+
documents: Document[];
|
|
476
|
+
}): void;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Find wiki-links in content
|
|
480
|
+
*/
|
|
481
|
+
declare function extractWikiLinks(content: string): string[];
|
|
482
|
+
/**
|
|
483
|
+
* Find tags in content (#tag format)
|
|
484
|
+
*/
|
|
485
|
+
declare function extractTags(content: string): string[];
|
|
486
|
+
|
|
487
|
+
declare const OBSERVE_PROVIDERS: readonly ["anthropic", "openai", "gemini"];
|
|
488
|
+
declare const OBSERVER_COMPRESSION_PROVIDERS: readonly ["anthropic", "openai", "gemini", "openai-compatible", "ollama"];
|
|
489
|
+
declare const THEMES: readonly ["neural", "minimal", "none"];
|
|
490
|
+
declare const CONTEXT_PROFILES: readonly ["default", "planning", "incident", "handoff", "auto"];
|
|
491
|
+
type ObserveProvider = (typeof OBSERVE_PROVIDERS)[number];
|
|
492
|
+
type ObserverCompressionProvider = (typeof OBSERVER_COMPRESSION_PROVIDERS)[number];
|
|
493
|
+
type Theme = (typeof THEMES)[number];
|
|
494
|
+
type ContextProfile = (typeof CONTEXT_PROFILES)[number];
|
|
495
|
+
type ManagedConfigKey = 'name' | 'categories' | 'theme' | 'observe.model' | 'observe.provider' | 'observer.compression.provider' | 'observer.compression.model' | 'observer.compression.baseUrl' | 'observer.compression.apiKey' | 'context.maxResults' | 'context.defaultProfile' | 'graph.maxHops' | 'inject.maxResults' | 'inject.useLlm' | 'inject.scope';
|
|
496
|
+
interface RouteRule {
|
|
497
|
+
pattern: string;
|
|
498
|
+
target: string;
|
|
499
|
+
priority: number;
|
|
500
|
+
}
|
|
501
|
+
declare const SUPPORTED_CONFIG_KEYS: ManagedConfigKey[];
|
|
502
|
+
declare function listConfig(vaultPath: string): Record<string, unknown>;
|
|
503
|
+
declare function getConfig(vaultPath: string): Record<string, unknown>;
|
|
504
|
+
declare function getConfigValue(vaultPath: string, key: ManagedConfigKey): unknown;
|
|
505
|
+
declare function setConfigValue(vaultPath: string, key: ManagedConfigKey, value: unknown): {
|
|
506
|
+
value: unknown;
|
|
507
|
+
config: Record<string, unknown>;
|
|
508
|
+
};
|
|
509
|
+
declare function resetConfig(vaultPath: string): Record<string, unknown>;
|
|
510
|
+
declare function listRouteRules(vaultPath: string): RouteRule[];
|
|
511
|
+
declare function addRouteRule(vaultPath: string, pattern: string, target: string): RouteRule;
|
|
512
|
+
declare function removeRouteRule(vaultPath: string, pattern: string): boolean;
|
|
513
|
+
declare function matchRouteRule(text: string, routes: RouteRule[]): RouteRule | null;
|
|
514
|
+
declare function testRouteRule(vaultPath: string, text: string): RouteRule | null;
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* Transition Ledger for ClawVault
|
|
518
|
+
* Logs task status transitions to JSONL files and supports querying.
|
|
519
|
+
*/
|
|
520
|
+
|
|
521
|
+
interface TransitionEvent {
|
|
522
|
+
task_id: string;
|
|
523
|
+
agent_id: string;
|
|
524
|
+
from_status: TaskStatus;
|
|
525
|
+
to_status: TaskStatus;
|
|
526
|
+
timestamp: string;
|
|
527
|
+
confidence: number;
|
|
528
|
+
cost_tokens: number | null;
|
|
529
|
+
reason: string | null;
|
|
530
|
+
}
|
|
531
|
+
declare function isRegression(from: TaskStatus, to: TaskStatus): boolean;
|
|
532
|
+
/**
|
|
533
|
+
* Append a transition event to the ledger
|
|
534
|
+
*/
|
|
535
|
+
declare function appendTransition(vaultPath: string, event: TransitionEvent): void;
|
|
536
|
+
/**
|
|
537
|
+
* Build a transition event from context
|
|
538
|
+
*/
|
|
539
|
+
declare function buildTransitionEvent(taskId: string, fromStatus: TaskStatus, toStatus: TaskStatus, options?: {
|
|
540
|
+
confidence?: number;
|
|
541
|
+
reason?: string;
|
|
542
|
+
}): TransitionEvent;
|
|
543
|
+
/**
|
|
544
|
+
* Read all transition events from all ledger files
|
|
545
|
+
*/
|
|
546
|
+
declare function readAllTransitions(vaultPath: string): TransitionEvent[];
|
|
547
|
+
/**
|
|
548
|
+
* Query transitions with filters
|
|
549
|
+
*/
|
|
550
|
+
declare function queryTransitions(vaultPath: string, filters?: {
|
|
551
|
+
taskId?: string;
|
|
552
|
+
agent?: string;
|
|
553
|
+
failed?: boolean;
|
|
554
|
+
}): TransitionEvent[];
|
|
555
|
+
/**
|
|
556
|
+
* Count blocked transitions for a task
|
|
557
|
+
*/
|
|
558
|
+
declare function countBlockedTransitions(vaultPath: string, taskId: string): number;
|
|
559
|
+
/**
|
|
560
|
+
* Format transitions as a table string
|
|
561
|
+
*/
|
|
562
|
+
declare function formatTransitionsTable(events: TransitionEvent[]): string;
|
|
563
|
+
|
|
564
|
+
interface CompressorOptions {
|
|
565
|
+
provider?: CompressionProvider;
|
|
566
|
+
model?: string;
|
|
567
|
+
baseUrl?: string;
|
|
568
|
+
apiKey?: string;
|
|
569
|
+
now?: () => Date;
|
|
570
|
+
fetchImpl?: typeof fetch;
|
|
571
|
+
}
|
|
572
|
+
type CompressionProvider = 'anthropic' | 'openai' | 'gemini' | 'openai-compatible' | 'ollama';
|
|
573
|
+
declare class Compressor {
|
|
574
|
+
private readonly provider?;
|
|
575
|
+
private readonly model?;
|
|
576
|
+
private readonly baseUrl?;
|
|
577
|
+
private readonly apiKey?;
|
|
578
|
+
private readonly now;
|
|
579
|
+
private readonly fetchImpl;
|
|
580
|
+
constructor(options?: CompressorOptions);
|
|
581
|
+
compress(messages: string[], existingObservations: string): Promise<string>;
|
|
582
|
+
private resolveProvider;
|
|
583
|
+
private resolveConfiguredProvider;
|
|
584
|
+
private resolveProviderFromEnv;
|
|
585
|
+
private resolveModel;
|
|
586
|
+
private resolveApiKey;
|
|
587
|
+
private resolveBaseUrl;
|
|
588
|
+
private readEnvValue;
|
|
589
|
+
private buildPrompt;
|
|
590
|
+
private buildOpenAICompatibleUrl;
|
|
591
|
+
private buildOpenAICompatibleHeaders;
|
|
592
|
+
private extractOpenAIContent;
|
|
593
|
+
private callAnthropic;
|
|
594
|
+
private callOpenAI;
|
|
595
|
+
private callOpenAICompatible;
|
|
596
|
+
private callGemini;
|
|
597
|
+
private normalizeLlmOutput;
|
|
598
|
+
/**
|
|
599
|
+
* Fix wiki-link corruption from LLM compression.
|
|
600
|
+
* LLMs often fuse preceding word fragments into wiki-links during rewriting:
|
|
601
|
+
* "reque[[people/pedro]]" → "[[people/pedro]]"
|
|
602
|
+
* "Linke[[agents/zeca]]" → "[[agents/zeca]]"
|
|
603
|
+
* "taske[[people/pedro]]a" → "[[people/pedro]]"
|
|
604
|
+
* Also fixes trailing word fragments fused after closing brackets.
|
|
605
|
+
*/
|
|
606
|
+
private sanitizeWikiLinks;
|
|
607
|
+
private enforceImportanceRules;
|
|
608
|
+
private enforceImportanceForRecord;
|
|
609
|
+
private fallbackCompression;
|
|
610
|
+
private mergeObservations;
|
|
611
|
+
private mergeRecord;
|
|
612
|
+
private renderSections;
|
|
613
|
+
private inferImportance;
|
|
614
|
+
private inferConfidence;
|
|
615
|
+
private isCriticalContent;
|
|
616
|
+
private isNotableContent;
|
|
617
|
+
private inferTaskType;
|
|
618
|
+
private normalizeText;
|
|
619
|
+
private extractDate;
|
|
620
|
+
private extractTime;
|
|
621
|
+
private formatDate;
|
|
622
|
+
private formatTime;
|
|
623
|
+
private clamp01;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
interface ObserverCompressor {
|
|
627
|
+
compress(messages: string[], existingObservations: string): Promise<string>;
|
|
628
|
+
}
|
|
629
|
+
interface ObserverReflector {
|
|
630
|
+
reflect(observations: string): string;
|
|
631
|
+
}
|
|
632
|
+
interface ObserverOptions {
|
|
633
|
+
tokenThreshold?: number;
|
|
634
|
+
reflectThreshold?: number;
|
|
635
|
+
model?: string;
|
|
636
|
+
compressionProvider?: CompressionProvider;
|
|
637
|
+
compressionBaseUrl?: string;
|
|
638
|
+
compressionApiKey?: string;
|
|
639
|
+
compressor?: ObserverCompressor;
|
|
640
|
+
reflector?: ObserverReflector;
|
|
641
|
+
now?: () => Date;
|
|
642
|
+
rawCapture?: boolean;
|
|
643
|
+
extractTasks?: boolean;
|
|
644
|
+
}
|
|
645
|
+
interface ObserverProcessOptions {
|
|
646
|
+
source?: string;
|
|
647
|
+
sessionKey?: string;
|
|
648
|
+
transcriptId?: string;
|
|
649
|
+
timestamp?: Date;
|
|
650
|
+
}
|
|
651
|
+
declare class Observer {
|
|
652
|
+
private readonly vaultPath;
|
|
653
|
+
private readonly tokenThreshold;
|
|
654
|
+
private readonly reflectThreshold;
|
|
655
|
+
private readonly compressor;
|
|
656
|
+
private readonly reflector;
|
|
657
|
+
private readonly now;
|
|
658
|
+
private readonly rawCapture;
|
|
659
|
+
private readonly router;
|
|
660
|
+
private pendingMessages;
|
|
661
|
+
private pendingRouteContext;
|
|
662
|
+
private observationsCache;
|
|
663
|
+
private lastRoutingSummary;
|
|
664
|
+
constructor(vaultPath: string, options?: ObserverOptions);
|
|
665
|
+
processMessages(messages: string[], options?: ObserverProcessOptions): Promise<void>;
|
|
666
|
+
/**
|
|
667
|
+
* Force-flush pending messages regardless of threshold.
|
|
668
|
+
* Call this on session end to capture everything.
|
|
669
|
+
*/
|
|
670
|
+
flush(): Promise<{
|
|
671
|
+
observations: string;
|
|
672
|
+
routingSummary: string;
|
|
673
|
+
}>;
|
|
674
|
+
getObservations(): string;
|
|
675
|
+
private estimateTokens;
|
|
676
|
+
private readTodayObservations;
|
|
677
|
+
private readObservationForDate;
|
|
678
|
+
private readObservationFile;
|
|
679
|
+
private writeObservationFile;
|
|
680
|
+
private deduplicateObservationMarkdown;
|
|
681
|
+
private persistRawMessages;
|
|
682
|
+
private sanitizeSource;
|
|
683
|
+
private mergeRouteContext;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
interface ObserveCursorEntry {
|
|
687
|
+
lastObservedOffset: number;
|
|
688
|
+
lastObservedAt: string;
|
|
689
|
+
sessionKey: string;
|
|
690
|
+
lastFileSize: number;
|
|
691
|
+
}
|
|
692
|
+
type ObserveCursorStore = Record<string, ObserveCursorEntry>;
|
|
693
|
+
interface ActiveObserveOptions {
|
|
694
|
+
vaultPath: string;
|
|
695
|
+
agentId?: string;
|
|
696
|
+
minNewBytes?: number;
|
|
697
|
+
sessionsDir?: string;
|
|
698
|
+
dryRun?: boolean;
|
|
699
|
+
threshold?: number;
|
|
700
|
+
reflectThreshold?: number;
|
|
701
|
+
model?: string;
|
|
702
|
+
extractTasks?: boolean;
|
|
703
|
+
maxSessions?: number;
|
|
704
|
+
}
|
|
705
|
+
interface ActiveObservationCandidate {
|
|
706
|
+
sessionId: string;
|
|
707
|
+
sessionKey: string;
|
|
708
|
+
sourceLabel: string;
|
|
709
|
+
filePath: string;
|
|
710
|
+
fileSize: number;
|
|
711
|
+
startOffset: number;
|
|
712
|
+
newBytes: number;
|
|
713
|
+
thresholdBytes: number;
|
|
714
|
+
}
|
|
715
|
+
interface ActiveObservationFailure {
|
|
716
|
+
sessionId: string;
|
|
717
|
+
sessionKey: string;
|
|
718
|
+
sourceLabel: string;
|
|
719
|
+
error: string;
|
|
720
|
+
}
|
|
721
|
+
interface ActiveObserveResult {
|
|
722
|
+
agentId: string;
|
|
723
|
+
sessionsDir: string;
|
|
724
|
+
checkedSessions: number;
|
|
725
|
+
candidateSessions: number;
|
|
726
|
+
observedSessions: number;
|
|
727
|
+
cursorUpdates: number;
|
|
728
|
+
dryRun: boolean;
|
|
729
|
+
totalNewBytes: number;
|
|
730
|
+
observedNewBytes: number;
|
|
731
|
+
routedCounts: Record<string, number>;
|
|
732
|
+
failedSessionCount: number;
|
|
733
|
+
failedSessions: ActiveObservationFailure[];
|
|
734
|
+
candidates: ActiveObservationCandidate[];
|
|
735
|
+
}
|
|
736
|
+
interface ObserverStalenessResult {
|
|
737
|
+
staleCount: number;
|
|
738
|
+
oldestMs: number;
|
|
739
|
+
newestMs: number;
|
|
740
|
+
}
|
|
741
|
+
type MinimalObserver = Pick<Observer, 'processMessages' | 'flush'>;
|
|
742
|
+
type ObserverFactory = (vaultPath: string, options: ObserverOptions) => MinimalObserver;
|
|
743
|
+
interface ActiveObserveDependencies {
|
|
744
|
+
createObserver?: ObserverFactory;
|
|
745
|
+
now?: () => Date;
|
|
746
|
+
}
|
|
747
|
+
interface ObserverStalenessOptions {
|
|
748
|
+
sessionsDir?: string;
|
|
749
|
+
now?: () => Date;
|
|
750
|
+
}
|
|
751
|
+
declare function getScaledObservationThresholdBytes(fileSizeBytes: number): number;
|
|
752
|
+
declare function getObserverStaleness(vaultPath: string, options?: ObserverStalenessOptions): ObserverStalenessResult;
|
|
753
|
+
declare function parseSessionSourceLabel(sessionKey: string): string;
|
|
754
|
+
declare function observeActiveSessions(options: ActiveObserveOptions, dependencies?: ActiveObserveDependencies): Promise<ActiveObserveResult>;
|
|
755
|
+
|
|
756
|
+
interface ReflectorOptions {
|
|
757
|
+
now?: () => Date;
|
|
758
|
+
}
|
|
759
|
+
declare class Reflector {
|
|
760
|
+
private readonly now;
|
|
761
|
+
constructor(options?: ReflectorOptions);
|
|
762
|
+
reflect(observations: string): string;
|
|
763
|
+
private buildCutoffDate;
|
|
764
|
+
private parseDate;
|
|
765
|
+
private parseSections;
|
|
766
|
+
private renderSections;
|
|
767
|
+
private normalizeText;
|
|
768
|
+
private isSimilar;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
interface SessionWatcherOptions {
|
|
772
|
+
ignoreInitial?: boolean;
|
|
773
|
+
debounceMs?: number;
|
|
774
|
+
flushThresholdChars?: number;
|
|
775
|
+
}
|
|
776
|
+
declare class SessionWatcher {
|
|
777
|
+
private readonly watchPath;
|
|
778
|
+
private readonly observer;
|
|
779
|
+
private readonly ignoreInitial;
|
|
780
|
+
private readonly debounceMs;
|
|
781
|
+
private readonly flushThresholdChars;
|
|
782
|
+
private watcher;
|
|
783
|
+
private fileOffsets;
|
|
784
|
+
private pendingPaths;
|
|
785
|
+
private debounceTimer;
|
|
786
|
+
private processingQueue;
|
|
787
|
+
private bufferedChars;
|
|
788
|
+
constructor(watchPath: string, observer: Observer, options?: SessionWatcherOptions);
|
|
789
|
+
start(): Promise<void>;
|
|
790
|
+
stop(): Promise<void>;
|
|
791
|
+
private scheduleDrain;
|
|
792
|
+
private drainPendingPaths;
|
|
793
|
+
private consumeFile;
|
|
794
|
+
private primeInitialOffsets;
|
|
795
|
+
private collectFiles;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
declare function parseSessionFile(filePath: string): string[];
|
|
799
|
+
|
|
800
|
+
interface ArchiveObservationsOptions {
|
|
801
|
+
olderThanDays?: number;
|
|
802
|
+
dryRun?: boolean;
|
|
803
|
+
now?: () => Date;
|
|
804
|
+
}
|
|
805
|
+
interface ArchiveObservationsResult {
|
|
806
|
+
scanned: number;
|
|
807
|
+
archived: number;
|
|
808
|
+
skipped: number;
|
|
809
|
+
dryRun: boolean;
|
|
810
|
+
archivedDates: string[];
|
|
811
|
+
}
|
|
812
|
+
declare function archiveObservations(vaultPath: string, options?: ArchiveObservationsOptions): ArchiveObservationsResult;
|
|
813
|
+
|
|
814
|
+
interface ReflectOptions {
|
|
815
|
+
vaultPath: string;
|
|
816
|
+
days?: number;
|
|
817
|
+
dryRun?: boolean;
|
|
818
|
+
now?: () => Date;
|
|
819
|
+
}
|
|
820
|
+
interface ReflectResult {
|
|
821
|
+
processedWeeks: number;
|
|
822
|
+
writtenWeeks: number;
|
|
823
|
+
dryRun: boolean;
|
|
824
|
+
files: string[];
|
|
825
|
+
archive: ArchiveObservationsResult | null;
|
|
826
|
+
}
|
|
827
|
+
declare function runReflection(options: ReflectOptions): Promise<ReflectResult>;
|
|
828
|
+
|
|
829
|
+
/**
|
|
830
|
+
* ClawVault 🐘 — An Elephant Never Forgets
|
|
831
|
+
*
|
|
832
|
+
* Structured memory system for AI agents with Obsidian-compatible markdown
|
|
833
|
+
* and embedded semantic search.
|
|
834
|
+
*
|
|
835
|
+
* @example
|
|
836
|
+
* ```typescript
|
|
837
|
+
* import { ClawVault, createVault, findVault } from 'clawvault';
|
|
838
|
+
*
|
|
839
|
+
* // Create a new vault
|
|
840
|
+
* const vault = await createVault('./my-memory');
|
|
841
|
+
*
|
|
842
|
+
* // Store a memory
|
|
843
|
+
* await vault.store({
|
|
844
|
+
* category: 'decisions',
|
|
845
|
+
* title: 'Use ClawVault',
|
|
846
|
+
* content: 'Decided to use ClawVault for memory management.'
|
|
847
|
+
* });
|
|
848
|
+
*
|
|
849
|
+
* // Search memories
|
|
850
|
+
* const results = await vault.find('memory management');
|
|
851
|
+
* console.log(results);
|
|
852
|
+
* ```
|
|
853
|
+
*/
|
|
854
|
+
|
|
855
|
+
declare const VERSION: string;
|
|
856
|
+
declare function registerCommanderCommands(program: Command): Command;
|
|
857
|
+
|
|
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 };
|