@aeriondyseti/vector-memory-mcp 1.1.0-dev.3 → 1.1.0-dev.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -11
- package/dist/package.json +1 -2
- package/dist/src/db/conversation.repository.d.ts.map +1 -1
- package/dist/src/db/conversation.repository.js +2 -1
- package/dist/src/db/conversation.repository.js.map +1 -1
- package/dist/src/db/conversation.schema.js +1 -1
- package/dist/src/db/conversation.schema.js.map +1 -1
- package/dist/src/db/lancedb-utils.d.ts +12 -0
- package/dist/src/db/lancedb-utils.d.ts.map +1 -1
- package/dist/src/db/lancedb-utils.js +18 -0
- package/dist/src/db/lancedb-utils.js.map +1 -1
- package/dist/src/db/memory.repository.d.ts +1 -0
- package/dist/src/db/memory.repository.d.ts.map +1 -1
- package/dist/src/db/memory.repository.js +15 -4
- package/dist/src/db/memory.repository.js.map +1 -1
- package/dist/src/db/schema.d.ts.map +1 -1
- package/dist/src/db/schema.js +1 -1
- package/dist/src/db/schema.js.map +1 -1
- package/dist/src/http/server.d.ts.map +1 -1
- package/dist/src/http/server.js +12 -17
- package/dist/src/http/server.js.map +1 -1
- package/dist/src/mcp/handlers.d.ts +2 -2
- package/dist/src/mcp/handlers.d.ts.map +1 -1
- package/dist/src/mcp/handlers.js +22 -28
- package/dist/src/mcp/handlers.js.map +1 -1
- package/dist/src/mcp/tools.d.ts +2 -2
- package/dist/src/mcp/tools.d.ts.map +1 -1
- package/dist/src/mcp/tools.js +10 -10
- package/dist/src/mcp/tools.js.map +1 -1
- package/dist/src/services/memory.service.d.ts +3 -2
- package/dist/src/services/memory.service.d.ts.map +1 -1
- package/dist/src/services/memory.service.js +28 -14
- package/dist/src/services/memory.service.js.map +1 -1
- package/package.json +1 -2
- package/src/db/conversation.repository.ts +2 -1
- package/src/db/conversation.schema.ts +1 -1
- package/src/db/lancedb-utils.ts +17 -0
- package/src/db/memory.repository.ts +15 -4
- package/src/db/schema.ts +1 -1
- package/src/http/server.ts +12 -18
- package/src/mcp/handlers.ts +23 -28
- package/src/mcp/tools.ts +10 -10
- package/src/services/memory.service.ts +35 -14
- package/hooks/session-start.ts +0 -118
|
@@ -76,6 +76,24 @@ export class MemoryService {
|
|
|
76
76
|
return updatedMemory;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
async getMultiple(ids: string[]): Promise<Memory[]> {
|
|
80
|
+
if (ids.length === 0) return [];
|
|
81
|
+
const memories = await this.repository.findByIds(ids);
|
|
82
|
+
// Track access in bulk
|
|
83
|
+
const now = new Date();
|
|
84
|
+
const live = memories.filter((m) => !isDeleted(m));
|
|
85
|
+
await Promise.all(
|
|
86
|
+
live.map((m) =>
|
|
87
|
+
this.repository.upsert({
|
|
88
|
+
...m,
|
|
89
|
+
accessCount: m.accessCount + 1,
|
|
90
|
+
lastAccessed: now,
|
|
91
|
+
})
|
|
92
|
+
)
|
|
93
|
+
);
|
|
94
|
+
return live;
|
|
95
|
+
}
|
|
96
|
+
|
|
79
97
|
async delete(id: string): Promise<boolean> {
|
|
80
98
|
return await this.repository.markDeleted(id);
|
|
81
99
|
}
|
|
@@ -240,23 +258,26 @@ export class MemoryService {
|
|
|
240
258
|
}
|
|
241
259
|
|
|
242
260
|
async trackAccess(ids: string[]): Promise<void> {
|
|
261
|
+
if (ids.length === 0) return;
|
|
262
|
+
const memories = await this.repository.findByIds(ids);
|
|
243
263
|
const now = new Date();
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
264
|
+
await Promise.all(
|
|
265
|
+
memories
|
|
266
|
+
.filter((m) => !isDeleted(m))
|
|
267
|
+
.map((m) =>
|
|
268
|
+
this.repository.upsert({
|
|
269
|
+
...m,
|
|
270
|
+
accessCount: m.accessCount + 1,
|
|
271
|
+
lastAccessed: now,
|
|
272
|
+
})
|
|
273
|
+
)
|
|
274
|
+
);
|
|
254
275
|
}
|
|
255
276
|
|
|
256
277
|
private static readonly UUID_ZERO =
|
|
257
278
|
"00000000-0000-0000-0000-000000000000";
|
|
258
279
|
|
|
259
|
-
async
|
|
280
|
+
async setWaypoint(args: {
|
|
260
281
|
project: string;
|
|
261
282
|
branch?: string;
|
|
262
283
|
summary: string;
|
|
@@ -283,7 +304,7 @@ export class MemoryService {
|
|
|
283
304
|
return items.map((i) => `- ${i}`).join("\n");
|
|
284
305
|
};
|
|
285
306
|
|
|
286
|
-
const content = `#
|
|
307
|
+
const content = `# Waypoint - ${args.project}
|
|
287
308
|
**Date:** ${date} ${time} | **Branch:** ${args.branch ?? "unknown"}
|
|
288
309
|
|
|
289
310
|
## Summary
|
|
@@ -306,7 +327,7 @@ ${list(args.memory_ids)}`;
|
|
|
306
327
|
|
|
307
328
|
const metadata: Record<string, unknown> = {
|
|
308
329
|
...(args.metadata ?? {}),
|
|
309
|
-
type: "
|
|
330
|
+
type: "waypoint",
|
|
310
331
|
project: args.project,
|
|
311
332
|
date,
|
|
312
333
|
branch: args.branch ?? "unknown",
|
|
@@ -330,7 +351,7 @@ ${list(args.memory_ids)}`;
|
|
|
330
351
|
return memory;
|
|
331
352
|
}
|
|
332
353
|
|
|
333
|
-
async
|
|
354
|
+
async getLatestWaypoint(): Promise<Memory | null> {
|
|
334
355
|
return await this.get(MemoryService.UUID_ZERO);
|
|
335
356
|
}
|
|
336
357
|
}
|
package/hooks/session-start.ts
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
/**
|
|
3
|
-
* SessionStart hook for Claude Code
|
|
4
|
-
*
|
|
5
|
-
* 1. Triggers incremental conversation history indexing (if enabled)
|
|
6
|
-
* 2. Loads and outputs the latest checkpoint with referenced memories
|
|
7
|
-
*
|
|
8
|
-
* Requires the vector-memory-mcp server to be running with HTTP enabled.
|
|
9
|
-
*
|
|
10
|
-
* Usage in ~/.claude/settings.json:
|
|
11
|
-
* {
|
|
12
|
-
* "hooks": {
|
|
13
|
-
* "SessionStart": [{
|
|
14
|
-
* "hooks": [{
|
|
15
|
-
* "type": "command",
|
|
16
|
-
* "command": "bun /path/to/vector-memory-mcp/hooks/session-start.ts"
|
|
17
|
-
* }]
|
|
18
|
-
* }]
|
|
19
|
-
* }
|
|
20
|
-
* }
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
const VECTOR_MEMORY_URL =
|
|
24
|
-
process.env.VECTOR_MEMORY_URL ?? "http://127.0.0.1:3271";
|
|
25
|
-
|
|
26
|
-
interface HealthResponse {
|
|
27
|
-
status: string;
|
|
28
|
-
config: {
|
|
29
|
-
dbPath: string;
|
|
30
|
-
embeddingModel: string;
|
|
31
|
-
embeddingDimension: number;
|
|
32
|
-
historyEnabled: boolean;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
interface CheckpointResponse {
|
|
37
|
-
content: string;
|
|
38
|
-
metadata: Record<string, unknown>;
|
|
39
|
-
referencedMemories: Array<{ id: string; content: string }>;
|
|
40
|
-
updatedAt: string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
async function main() {
|
|
44
|
-
// Step 1: Check server is running and get config
|
|
45
|
-
let health: HealthResponse;
|
|
46
|
-
try {
|
|
47
|
-
const response = await fetch(`${VECTOR_MEMORY_URL}/health`);
|
|
48
|
-
if (!response.ok) {
|
|
49
|
-
throw new Error(`Server returned ${response.status}`);
|
|
50
|
-
}
|
|
51
|
-
health = await response.json();
|
|
52
|
-
} catch (error) {
|
|
53
|
-
if (error instanceof Error && error.message.includes("ECONNREFUSED")) {
|
|
54
|
-
console.log("Vector memory server not running. Starting fresh session.");
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
throw error;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Step 2: Trigger conversation history indexing (if enabled)
|
|
61
|
-
if (health.config.historyEnabled) {
|
|
62
|
-
try {
|
|
63
|
-
const indexResponse = await fetch(
|
|
64
|
-
`${VECTOR_MEMORY_URL}/index-conversations`,
|
|
65
|
-
{ method: "POST", headers: { "Content-Type": "application/json" }, body: "{}" }
|
|
66
|
-
);
|
|
67
|
-
if (indexResponse.ok) {
|
|
68
|
-
const result = await indexResponse.json();
|
|
69
|
-
if (result.indexed > 0 || result.errors?.length > 0) {
|
|
70
|
-
console.error(
|
|
71
|
-
`[vector-memory] Indexed ${result.indexed} sessions, skipped ${result.skipped}` +
|
|
72
|
-
(result.errors?.length > 0
|
|
73
|
-
? `, ${result.errors.length} errors`
|
|
74
|
-
: "")
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
} catch {
|
|
79
|
-
// Non-fatal — indexing failure shouldn't block session start
|
|
80
|
-
console.error("[vector-memory] Conversation indexing failed, continuing.");
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Step 3: Load and output checkpoint
|
|
85
|
-
let checkpoint: CheckpointResponse;
|
|
86
|
-
try {
|
|
87
|
-
const response = await fetch(`${VECTOR_MEMORY_URL}/checkpoint`);
|
|
88
|
-
if (response.status === 404) {
|
|
89
|
-
console.log("No checkpoint found. Starting fresh session.");
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
if (!response.ok) {
|
|
93
|
-
throw new Error(`Checkpoint endpoint returned ${response.status}`);
|
|
94
|
-
}
|
|
95
|
-
checkpoint = await response.json();
|
|
96
|
-
} catch (error) {
|
|
97
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
98
|
-
console.error(`[vector-memory] Failed to load checkpoint: ${msg}`);
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// Format output: checkpoint content + referenced memories
|
|
103
|
-
let output = checkpoint.content;
|
|
104
|
-
|
|
105
|
-
if (checkpoint.referencedMemories.length > 0) {
|
|
106
|
-
const memoriesSection = checkpoint.referencedMemories
|
|
107
|
-
.map((m) => `### Memory: ${m.id}\n${m.content}`)
|
|
108
|
-
.join("\n\n");
|
|
109
|
-
output += `\n\n## Referenced Memories\n\n${memoriesSection}`;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
console.log(output);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
main().catch((err) => {
|
|
116
|
-
console.error("Error in session-start hook:", err.message);
|
|
117
|
-
process.exit(1);
|
|
118
|
-
});
|