@aman_asmuei/amem 0.5.1 → 0.7.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.
- package/README.md +49 -7
- package/dist/cli.js +7 -7
- package/dist/cli.js.map +1 -1
- package/dist/database.d.ts +15 -0
- package/dist/database.js +129 -19
- package/dist/database.js.map +1 -1
- package/dist/database.test.d.ts +1 -0
- package/dist/database.test.js +275 -0
- package/dist/database.test.js.map +1 -0
- package/dist/embeddings.js +30 -2
- package/dist/embeddings.js.map +1 -1
- package/dist/embeddings.test.d.ts +1 -0
- package/dist/embeddings.test.js +106 -0
- package/dist/embeddings.test.js.map +1 -0
- package/dist/index.js +158 -80
- package/dist/index.js.map +1 -1
- package/dist/memory.d.ts +19 -2
- package/dist/memory.js +108 -35
- package/dist/memory.js.map +1 -1
- package/dist/memory.test.d.ts +1 -0
- package/dist/memory.test.js +171 -0
- package/dist/memory.test.js.map +1 -0
- package/dist/schemas.d.ts +209 -31
- package/dist/schemas.js +54 -1
- package/dist/schemas.js.map +1 -1
- package/dist/tools/graph.d.ts +3 -0
- package/dist/tools/graph.js +344 -0
- package/dist/tools/graph.js.map +1 -0
- package/dist/tools/helpers.d.ts +7 -0
- package/dist/tools/helpers.js +23 -0
- package/dist/tools/helpers.js.map +1 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.js +19 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/log.d.ts +3 -0
- package/dist/tools/log.js +244 -0
- package/dist/tools/log.js.map +1 -0
- package/dist/tools/memory.d.ts +4 -0
- package/dist/tools/memory.js +1245 -0
- package/dist/tools/memory.js.map +1 -0
- package/dist/tools/reminders.d.ts +3 -0
- package/dist/tools/reminders.js +228 -0
- package/dist/tools/reminders.js.map +1 -0
- package/dist/tools/versions.d.ts +3 -0
- package/dist/tools/versions.js +118 -0
- package/dist/tools/versions.js.map +1 -0
- package/dist/tools.test.d.ts +1 -0
- package/dist/tools.test.js +217 -0
- package/dist/tools.test.js.map +1 -0
- package/package.json +4 -3
- package/dist/tools.d.ts +0 -6
- package/dist/tools.js +0 -1885
- package/dist/tools.js.map +0 -1
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { LogAppendResultSchema, LogRecallResultSchema, LogCleanupResultSchema } from "../schemas.js";
|
|
3
|
+
import { shortId, formatAge } from "./helpers.js";
|
|
4
|
+
export function registerLogTools(server, db, project) {
|
|
5
|
+
// ── memory_log ────────────────────────────────────────────
|
|
6
|
+
server.registerTool("memory_log", {
|
|
7
|
+
title: "Append to Conversation Log",
|
|
8
|
+
description: `Append a raw conversation turn to the lossless, append-only conversation log. Unlike memory_store (which distills memories), memory_log preserves the exact, unmodified content of every exchange — nothing is summarized or discarded.
|
|
9
|
+
|
|
10
|
+
The log is your permanent audit trail:
|
|
11
|
+
- Every user message, assistant response, or system note
|
|
12
|
+
- Fully searchable via memory_log_recall
|
|
13
|
+
- Organized by session ID for replaying conversations
|
|
14
|
+
- Scoped per project — never mixes contexts
|
|
15
|
+
|
|
16
|
+
Use this to preserve conversation turns that may be important later but aren't yet ready to be distilled into memories. You can later search the log and promote specific entries into proper memories.
|
|
17
|
+
|
|
18
|
+
Args:
|
|
19
|
+
- session_id (string): Conversation session identifier — use a consistent ID per conversation
|
|
20
|
+
- role (enum): Who said it — user | assistant | system
|
|
21
|
+
- content (string): The exact text to preserve — no summarization
|
|
22
|
+
- metadata (object, optional): Extra context — e.g., { tool: "vscode", file: "auth.ts" }`,
|
|
23
|
+
inputSchema: z.object({
|
|
24
|
+
session_id: z.string().min(1).describe("Session identifier — keep consistent across a conversation"),
|
|
25
|
+
role: z.enum(["user", "assistant", "system"]).describe("Who said this"),
|
|
26
|
+
content: z.string().min(1).max(50000, "Log content too long — max 50,000 characters").describe("Exact content to preserve — not summarized"),
|
|
27
|
+
metadata: z.record(z.unknown()).optional().describe("Optional extra context"),
|
|
28
|
+
}).strict(),
|
|
29
|
+
outputSchema: LogAppendResultSchema,
|
|
30
|
+
annotations: {
|
|
31
|
+
readOnlyHint: false,
|
|
32
|
+
destructiveHint: false,
|
|
33
|
+
idempotentHint: false,
|
|
34
|
+
openWorldHint: false,
|
|
35
|
+
},
|
|
36
|
+
}, async ({ session_id, role, content, metadata }) => {
|
|
37
|
+
try {
|
|
38
|
+
const id = db.appendLog({
|
|
39
|
+
sessionId: session_id,
|
|
40
|
+
role,
|
|
41
|
+
content,
|
|
42
|
+
project,
|
|
43
|
+
metadata: metadata ?? {},
|
|
44
|
+
});
|
|
45
|
+
return {
|
|
46
|
+
content: [{
|
|
47
|
+
type: "text",
|
|
48
|
+
text: `Logged ${role} turn (${shortId(id)}) to session "${session_id}". Content length: ${content.length} chars.`,
|
|
49
|
+
}],
|
|
50
|
+
structuredContent: {
|
|
51
|
+
id,
|
|
52
|
+
sessionId: session_id,
|
|
53
|
+
role,
|
|
54
|
+
appended: true,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
return {
|
|
60
|
+
isError: true,
|
|
61
|
+
content: [{
|
|
62
|
+
type: "text",
|
|
63
|
+
text: `Error appending to log: ${error instanceof Error ? error.message : String(error)}`,
|
|
64
|
+
}],
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
// ── memory_log_recall ─────────────────────────────────────
|
|
69
|
+
server.registerTool("memory_log_recall", {
|
|
70
|
+
title: "Search Conversation Log",
|
|
71
|
+
description: `Search or replay the lossless conversation log. Returns raw, unmodified conversation turns — nothing has been summarized or lost.
|
|
72
|
+
|
|
73
|
+
Use this when:
|
|
74
|
+
- You need to find exactly what was said in a past conversation
|
|
75
|
+
- Replaying a session to reconstruct context
|
|
76
|
+
- Searching for a specific phrase, decision, or exchange that may not have been extracted into a memory
|
|
77
|
+
- Auditing what happened in a past session
|
|
78
|
+
|
|
79
|
+
Search modes:
|
|
80
|
+
- By session_id: replays a specific conversation in order
|
|
81
|
+
- By query: full-text search across all logged content
|
|
82
|
+
- Recent: retrieve the N most recent log entries for this project
|
|
83
|
+
|
|
84
|
+
Args:
|
|
85
|
+
- session_id (string, optional): Replay a specific session in chronological order
|
|
86
|
+
- query (string, optional): Full-text search across all logged content
|
|
87
|
+
- limit (number): Max entries to return (default: 20)`,
|
|
88
|
+
inputSchema: z.object({
|
|
89
|
+
session_id: z.string().optional().describe("Replay a specific session — returns turns in order"),
|
|
90
|
+
query: z.string().optional().describe("Full-text search across all logged content"),
|
|
91
|
+
limit: z.number().int().min(1).max(200).default(20).describe("Max entries to return"),
|
|
92
|
+
}).strict().refine(d => d.session_id || d.query || true, "Provide session_id or query, or omit both for recent entries"),
|
|
93
|
+
outputSchema: LogRecallResultSchema,
|
|
94
|
+
annotations: {
|
|
95
|
+
readOnlyHint: true,
|
|
96
|
+
destructiveHint: false,
|
|
97
|
+
idempotentHint: true,
|
|
98
|
+
openWorldHint: false,
|
|
99
|
+
},
|
|
100
|
+
}, async ({ session_id, query, limit }) => {
|
|
101
|
+
try {
|
|
102
|
+
let entries;
|
|
103
|
+
if (session_id) {
|
|
104
|
+
entries = db.getLogBySession(session_id);
|
|
105
|
+
}
|
|
106
|
+
else if (query) {
|
|
107
|
+
entries = db.searchLog(query, limit);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
entries = db.getRecentLog(limit, project);
|
|
111
|
+
}
|
|
112
|
+
if (entries.length === 0) {
|
|
113
|
+
const hint = session_id
|
|
114
|
+
? `No log entries found for session "${session_id}". Log turns using memory_log first.`
|
|
115
|
+
: query
|
|
116
|
+
? `No log entries match "${query}".`
|
|
117
|
+
: `No log entries yet for this project. Use memory_log to preserve conversation turns.`;
|
|
118
|
+
return {
|
|
119
|
+
content: [{ type: "text", text: hint }],
|
|
120
|
+
structuredContent: {
|
|
121
|
+
query,
|
|
122
|
+
sessionId: session_id,
|
|
123
|
+
total: 0,
|
|
124
|
+
entries: [],
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
const lines = [];
|
|
129
|
+
if (session_id) {
|
|
130
|
+
lines.push(`Session "${session_id}" — ${entries.length} turn${entries.length === 1 ? "" : "s"}`);
|
|
131
|
+
lines.push("");
|
|
132
|
+
for (const e of entries) {
|
|
133
|
+
const roleLabel = e.role === "user" ? "▶ User" : e.role === "assistant" ? "◀ Assistant" : "⚙ System";
|
|
134
|
+
lines.push(`[${formatAge(e.timestamp)}] ${roleLabel}`);
|
|
135
|
+
lines.push(e.content.length > 300 ? e.content.slice(0, 300) + "…" : e.content);
|
|
136
|
+
lines.push("");
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
const header = query ? `Log search: "${query}" — ${entries.length} result${entries.length === 1 ? "" : "s"}` : `Recent log — ${entries.length} entries`;
|
|
141
|
+
lines.push(header);
|
|
142
|
+
lines.push("");
|
|
143
|
+
for (const e of entries) {
|
|
144
|
+
lines.push(`[${shortId(e.id)}] ${formatAge(e.timestamp)} | ${e.role} | session:${shortId(e.sessionId)}`);
|
|
145
|
+
lines.push(e.content.length > 200 ? e.content.slice(0, 200) + "…" : e.content);
|
|
146
|
+
lines.push("");
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return {
|
|
150
|
+
content: [{ type: "text", text: lines.join("\n").trim() }],
|
|
151
|
+
structuredContent: {
|
|
152
|
+
query,
|
|
153
|
+
sessionId: session_id,
|
|
154
|
+
total: entries.length,
|
|
155
|
+
entries: entries.slice(0, limit).map(e => ({
|
|
156
|
+
id: e.id,
|
|
157
|
+
role: e.role,
|
|
158
|
+
content: e.content,
|
|
159
|
+
timestamp: e.timestamp,
|
|
160
|
+
age: formatAge(e.timestamp),
|
|
161
|
+
project: e.project,
|
|
162
|
+
})),
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
return {
|
|
168
|
+
isError: true,
|
|
169
|
+
content: [{
|
|
170
|
+
type: "text",
|
|
171
|
+
text: `Error searching log: ${error instanceof Error ? error.message : String(error)}`,
|
|
172
|
+
}],
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
// ── memory_log_cleanup ───────────────────────────────────
|
|
177
|
+
server.registerTool("memory_log_cleanup", {
|
|
178
|
+
title: "Clean Up Conversation Log",
|
|
179
|
+
description: `Delete old conversation log entries to keep the database lean. The conversation log is append-only and grows without bound — use this periodically to prune entries older than a given retention period.
|
|
180
|
+
|
|
181
|
+
Args:
|
|
182
|
+
- older_than_days (number): Delete log entries older than this many days (default: 90)
|
|
183
|
+
- confirm (boolean): Must be true to actually delete (default: false — preview only)
|
|
184
|
+
|
|
185
|
+
Returns:
|
|
186
|
+
Number of entries deleted and remaining.`,
|
|
187
|
+
inputSchema: z.object({
|
|
188
|
+
older_than_days: z.number().int().min(1).default(90).describe("Delete entries older than this many days"),
|
|
189
|
+
confirm: z.boolean().default(false).describe("false = preview (safe), true = execute deletion"),
|
|
190
|
+
}).strict(),
|
|
191
|
+
outputSchema: LogCleanupResultSchema,
|
|
192
|
+
annotations: {
|
|
193
|
+
readOnlyHint: false,
|
|
194
|
+
destructiveHint: true,
|
|
195
|
+
idempotentHint: true,
|
|
196
|
+
openWorldHint: false,
|
|
197
|
+
},
|
|
198
|
+
}, async ({ older_than_days, confirm }) => {
|
|
199
|
+
try {
|
|
200
|
+
const cutoff = Date.now() - older_than_days * 24 * 60 * 60 * 1000;
|
|
201
|
+
const cutoffDate = new Date(cutoff).toISOString().slice(0, 10);
|
|
202
|
+
const totalBefore = db.getLogCount();
|
|
203
|
+
if (!confirm) {
|
|
204
|
+
// Preview: count how many would be deleted
|
|
205
|
+
const recent = db.getRecentLog(totalBefore);
|
|
206
|
+
const wouldDelete = recent.filter(e => e.timestamp < cutoff).length;
|
|
207
|
+
return {
|
|
208
|
+
content: [{
|
|
209
|
+
type: "text",
|
|
210
|
+
text: `Preview: ${wouldDelete} log entries older than ${older_than_days} days (before ${cutoffDate}) would be deleted.\n${totalBefore - wouldDelete} entries would remain.\n\nCall again with confirm=true to execute.`,
|
|
211
|
+
}],
|
|
212
|
+
structuredContent: {
|
|
213
|
+
deleted: wouldDelete,
|
|
214
|
+
remaining: totalBefore - wouldDelete,
|
|
215
|
+
cutoffDate,
|
|
216
|
+
},
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
const deleted = db.deleteLogBefore(cutoff);
|
|
220
|
+
const remaining = db.getLogCount();
|
|
221
|
+
return {
|
|
222
|
+
content: [{
|
|
223
|
+
type: "text",
|
|
224
|
+
text: `Deleted ${deleted} log entries older than ${older_than_days} days (before ${cutoffDate}). ${remaining} entries remaining.`,
|
|
225
|
+
}],
|
|
226
|
+
structuredContent: {
|
|
227
|
+
deleted,
|
|
228
|
+
remaining,
|
|
229
|
+
cutoffDate,
|
|
230
|
+
},
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
catch (error) {
|
|
234
|
+
return {
|
|
235
|
+
isError: true,
|
|
236
|
+
content: [{
|
|
237
|
+
type: "text",
|
|
238
|
+
text: `Error cleaning up log: ${error instanceof Error ? error.message : String(error)}`,
|
|
239
|
+
}],
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
//# sourceMappingURL=log.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/tools/log.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACrG,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,UAAU,gBAAgB,CAAC,MAAiB,EAAE,EAAgB,EAAE,OAAe;IAEnF,6DAA6D;IAC7D,MAAM,CAAC,YAAY,CACjB,YAAY,EACZ;QACE,KAAK,EAAE,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I,EAAE,MAAe;4BACrB,IAAI,EAAE,YAAY,WAAW,2BAA2B,eAAe,iBAAiB,UAAU,wBAAwB,WAAW,GAAG,WAAW,oEAAoE;yBACxN,CAAC;oBACF,iBAAiB,EAAE;wBACjB,OAAO,EAAE,WAAW;wBACpB,SAAS,EAAE,WAAW,GAAG,WAAW;wBACpC,UAAU;qBACX;iBACF,CAAC;YACJ,CAAC;YAED,MAAM,OAAO,GAAG,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YAC3C,MAAM,SAAS,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC;YAEnC,OAAO;gBACL,OAAO,EAAE,CAAC;wBACR,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,WAAW,OAAO,2BAA2B,eAAe,iBAAiB,UAAU,MAAM,SAAS,qBAAqB;qBAClI,CAAC;gBACF,iBAAiB,EAAE;oBACjB,OAAO;oBACP,SAAS;oBACT,UAAU;iBACX;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE,CAAC;wBACR,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,0BAA0B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;qBACzF,CAAC;aACH,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import type { AmemDatabase } from "../database.js";
|
|
3
|
+
import { type MemoryTypeValue } from "../memory.js";
|
|
4
|
+
export declare function registerMemoryTools(server: McpServer, db: AmemDatabase, project: string, autoScope: (type: MemoryTypeValue) => string): void;
|