@shahmilsaari/memory-core 0.2.15 → 0.2.17
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 +133 -9
- package/dist/chunk-T4WJR6L6.js +1287 -0
- package/dist/{chunk-DUUQHRIB.js → chunk-WUL7HLAA.js} +26 -11
- package/dist/cli.js +388 -1447
- package/dist/dashboard/assets/index-BCu-gBna.js +2 -0
- package/dist/dashboard/assets/index-BxS_xPdw.css +1 -0
- package/dist/dashboard/index.html +13 -0
- package/dist/dashboard-server-EVN4FL4L.js +547 -0
- package/dist/{db-VLOR7L6Q.js → db-MF3VKVKH.js} +1 -1
- package/package.json +14 -4
- package/templates/AGENTS.md.hbs +1 -1
- package/templates/AI_RULES.md.hbs +1 -2
- package/templates/ARCHITECTURE.md.hbs +1 -1
- package/templates/CLAUDE.md.hbs +1 -1
- package/templates/DEVIN.md.hbs +1 -1
- package/templates/PROJECT_MEMORY.md.hbs +1 -4
- package/templates/amazonq-guidelines.md.hbs +1 -1
- package/templates/clinerules.hbs +1 -1
- package/templates/copilot-instructions.md.hbs +1 -1
- package/templates/cursor-rule.mdc.hbs +1 -1
- package/templates/cursorrules.hbs +1 -1
- package/templates/gemini-styleguide.md.hbs +1 -1
- package/templates/jetbrains-ai.md.hbs +1 -1
- package/templates/roo-rule.md.hbs +1 -1
- package/templates/windsurfrules.hbs +1 -1
|
@@ -28,6 +28,7 @@ async function runMigrations() {
|
|
|
28
28
|
await client.query("BEGIN");
|
|
29
29
|
await client.query(`ALTER TABLE memories ADD COLUMN IF NOT EXISTS reason TEXT`);
|
|
30
30
|
await client.query(`ALTER TABLE memories ADD COLUMN IF NOT EXISTS content_hash TEXT`);
|
|
31
|
+
await client.query(`ALTER TABLE memories ADD COLUMN IF NOT EXISTS context JSONB NOT NULL DEFAULT '{}'::jsonb`);
|
|
31
32
|
await client.query(
|
|
32
33
|
`UPDATE memories
|
|
33
34
|
SET content_hash = md5(trim(content))
|
|
@@ -45,12 +46,24 @@ async function runMigrations() {
|
|
|
45
46
|
}
|
|
46
47
|
async function saveMemory(memory) {
|
|
47
48
|
await runMigrations();
|
|
48
|
-
const { type, scope, architecture, projectName, title, content, reason, tags, embedding } = memory;
|
|
49
|
+
const { type, scope, architecture, projectName, title, content, reason, context, tags, embedding } = memory;
|
|
49
50
|
const contentHash = hashMemoryContent(content);
|
|
50
51
|
await getPool().query(
|
|
51
|
-
`INSERT INTO memories (type, scope, architecture, project_name, title, content, reason, tags, embedding, content_hash)
|
|
52
|
-
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)`,
|
|
53
|
-
[
|
|
52
|
+
`INSERT INTO memories (type, scope, architecture, project_name, title, content, reason, context, tags, embedding, content_hash)
|
|
53
|
+
VALUES ($1, $2, $3, $4, $5, $6, $7, $8::jsonb, $9, $10, $11)`,
|
|
54
|
+
[
|
|
55
|
+
type,
|
|
56
|
+
scope,
|
|
57
|
+
architecture ?? null,
|
|
58
|
+
projectName ?? null,
|
|
59
|
+
title ?? null,
|
|
60
|
+
content,
|
|
61
|
+
reason ?? null,
|
|
62
|
+
JSON.stringify(context ?? {}),
|
|
63
|
+
tags ?? [],
|
|
64
|
+
`[${embedding.join(",")}]`,
|
|
65
|
+
contentHash
|
|
66
|
+
]
|
|
54
67
|
);
|
|
55
68
|
}
|
|
56
69
|
async function upsertMemory(memory) {
|
|
@@ -101,7 +114,7 @@ async function listMemories(filters = {}) {
|
|
|
101
114
|
const limit = filters.limit ?? 200;
|
|
102
115
|
params.push(limit);
|
|
103
116
|
const result = await getPool().query(
|
|
104
|
-
`SELECT id, type, scope, architecture, project_name, title, content, reason, tags, content_hash
|
|
117
|
+
`SELECT id, type, scope, architecture, project_name, title, content, reason, context, tags, content_hash
|
|
105
118
|
FROM memories
|
|
106
119
|
${where.length ? `WHERE ${where.join(" AND ")}` : ""}
|
|
107
120
|
ORDER BY id ASC
|
|
@@ -113,7 +126,7 @@ async function listMemories(filters = {}) {
|
|
|
113
126
|
async function getMemory(id) {
|
|
114
127
|
await runMigrations();
|
|
115
128
|
const result = await getPool().query(
|
|
116
|
-
`SELECT id, type, scope, architecture, project_name, title, content, reason, tags, content_hash
|
|
129
|
+
`SELECT id, type, scope, architecture, project_name, title, content, reason, context, tags, content_hash
|
|
117
130
|
FROM memories
|
|
118
131
|
WHERE id = $1`,
|
|
119
132
|
[id]
|
|
@@ -173,11 +186,12 @@ async function updateMemory(id, patch) {
|
|
|
173
186
|
title = $4,
|
|
174
187
|
content = $5,
|
|
175
188
|
reason = $6,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
189
|
+
context = $7::jsonb,
|
|
190
|
+
tags = $8,
|
|
191
|
+
content_hash = $9,
|
|
192
|
+
embedding = COALESCE($10::vector, embedding)
|
|
179
193
|
WHERE id = $1
|
|
180
|
-
RETURNING id, type, scope, architecture, project_name, title, content, reason, tags, content_hash`,
|
|
194
|
+
RETURNING id, type, scope, architecture, project_name, title, content, reason, context, tags, content_hash`,
|
|
181
195
|
[
|
|
182
196
|
id,
|
|
183
197
|
patch.type ?? current.type,
|
|
@@ -185,6 +199,7 @@ async function updateMemory(id, patch) {
|
|
|
185
199
|
patch.title ?? current.title ?? null,
|
|
186
200
|
content,
|
|
187
201
|
patch.reason ?? current.reason ?? null,
|
|
202
|
+
JSON.stringify(patch.context ?? current.context ?? {}),
|
|
188
203
|
patch.tags ?? current.tags ?? [],
|
|
189
204
|
contentHash,
|
|
190
205
|
embedding
|
|
@@ -211,7 +226,7 @@ async function searchMemories(embedding, architectures, limit = 10) {
|
|
|
211
226
|
await client.query("BEGIN");
|
|
212
227
|
await client.query("SET LOCAL ivfflat.probes = 10");
|
|
213
228
|
const result = await client.query(
|
|
214
|
-
`SELECT id, type, scope, architecture, project_name, title, content, reason, tags,
|
|
229
|
+
`SELECT id, type, scope, architecture, project_name, title, content, reason, context, tags,
|
|
215
230
|
1 - (embedding <=> $1) AS similarity
|
|
216
231
|
FROM memories
|
|
217
232
|
${whereClause}
|