@s_s/mnemo 1.2.0 → 1.4.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/README.md +32 -6
- package/build/core/config.d.ts +12 -0
- package/build/core/config.js +24 -0
- package/build/core/config.js.map +1 -1
- package/build/core/embedding.d.ts +1 -0
- package/build/core/embedding.js +4 -0
- package/build/core/embedding.js.map +1 -1
- package/build/core/notes.d.ts +2 -2
- package/build/core/notes.js +13 -5
- package/build/core/notes.js.map +1 -1
- package/build/hooks/installer.d.ts +20 -0
- package/build/hooks/installer.js +124 -0
- package/build/hooks/installer.js.map +1 -0
- package/build/hooks/reminders.d.ts +47 -0
- package/build/hooks/reminders.js +191 -0
- package/build/hooks/reminders.js.map +1 -0
- package/build/index.js +0 -0
- package/build/prompts/templates.js +82 -12
- package/build/prompts/templates.js.map +1 -1
- package/build/tools/compress.js +5 -3
- package/build/tools/compress.js.map +1 -1
- package/build/tools/get.js +2 -0
- package/build/tools/get.js.map +1 -1
- package/build/tools/save.js +17 -6
- package/build/tools/save.js.map +1 -1
- package/build/tools/search.js +16 -4
- package/build/tools/search.js.map +1 -1
- package/build/tools/setup.js +70 -32
- package/build/tools/setup.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core reminder texts used across all agents.
|
|
3
|
+
* Keep each reminder minimal (~50 tokens) to avoid attention overhead.
|
|
4
|
+
*/
|
|
5
|
+
export const REMINDERS = {
|
|
6
|
+
/** Per-turn self-check reminder (UserPromptSubmit equivalent) */
|
|
7
|
+
perTurn: `<mnemo-reminder>
|
|
8
|
+
After this task, briefly self-check:
|
|
9
|
+
- Did a durable preference, decision, or rule emerge? → memory_save
|
|
10
|
+
- Is there an unresolved thread to resume later? → memory_save (continuity)
|
|
11
|
+
- Did context window reset? → memory_compress
|
|
12
|
+
If nothing qualifies, skip. Don't force saves.
|
|
13
|
+
</mnemo-reminder>`,
|
|
14
|
+
/** Session start reminder */
|
|
15
|
+
sessionStart: `<mnemo-session-start>
|
|
16
|
+
Search memory for relevant context before starting work.
|
|
17
|
+
Call memory_search with a query based on the user's message.
|
|
18
|
+
</mnemo-session-start>`,
|
|
19
|
+
/** Context compaction reminder */
|
|
20
|
+
compaction: `<mnemo-compaction>
|
|
21
|
+
Context is being compacted. Before losing context:
|
|
22
|
+
1. Save any important unresolved threads as continuity memories (memory_save)
|
|
23
|
+
2. Call memory_compress if many notes have accumulated
|
|
24
|
+
</mnemo-compaction>`,
|
|
25
|
+
/** Session end / idle self-check */
|
|
26
|
+
sessionEnd: `<mnemo-session-end>
|
|
27
|
+
Session ending. Quick self-check:
|
|
28
|
+
- Did a durable conclusion, preference, or decision emerge? → memory_save
|
|
29
|
+
- Was an important thread left unresolved? → memory_save (continuity)
|
|
30
|
+
- Did I learn something reusable that would be lost without saving? → memory_save (experience)
|
|
31
|
+
</mnemo-session-end>`,
|
|
32
|
+
};
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
// Claude Code / Codex — shell script template
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
/**
|
|
37
|
+
* Shell script for Claude Code / Codex UserPromptSubmit hook.
|
|
38
|
+
* Outputs the per-turn reminder to stdout so the agent sees it as context.
|
|
39
|
+
*/
|
|
40
|
+
export const ACTIVATOR_SCRIPT = `#!/bin/bash
|
|
41
|
+
# Mnemo Memory Activator Hook
|
|
42
|
+
# Triggers on UserPromptSubmit to remind the agent about memory management
|
|
43
|
+
# Keep output minimal (~50 tokens) to minimize overhead
|
|
44
|
+
|
|
45
|
+
set -e
|
|
46
|
+
|
|
47
|
+
cat << 'EOF'
|
|
48
|
+
${REMINDERS.perTurn}
|
|
49
|
+
EOF
|
|
50
|
+
`;
|
|
51
|
+
// ---------------------------------------------------------------------------
|
|
52
|
+
// OpenClaw — HOOK.md + handler.ts templates
|
|
53
|
+
// ---------------------------------------------------------------------------
|
|
54
|
+
/**
|
|
55
|
+
* OpenClaw HOOK.md manifest for the mnemo hook.
|
|
56
|
+
*/
|
|
57
|
+
export const OPENCLAW_HOOK_MD = `---
|
|
58
|
+
name: mnemo
|
|
59
|
+
description: "Injects memory management reminder during agent bootstrap"
|
|
60
|
+
metadata: {"openclaw":{"emoji":"\\ud83e\\udde0","events":["agent:bootstrap"]}}
|
|
61
|
+
---
|
|
62
|
+
`;
|
|
63
|
+
/**
|
|
64
|
+
* OpenClaw handler.ts for agent:bootstrap event.
|
|
65
|
+
* Injects a virtual MNEMO_REMINDER.md file into the bootstrap context.
|
|
66
|
+
*/
|
|
67
|
+
export const OPENCLAW_HANDLER_TS = `const REMINDER_CONTENT = \`
|
|
68
|
+
## Mnemo - Memory Management Reminder
|
|
69
|
+
|
|
70
|
+
${REMINDERS.sessionStart}
|
|
71
|
+
|
|
72
|
+
${REMINDERS.perTurn}
|
|
73
|
+
\`;
|
|
74
|
+
|
|
75
|
+
const handler = async (event) => {
|
|
76
|
+
// Only handle agent:bootstrap
|
|
77
|
+
if (event.type !== 'agent' || event.action !== 'bootstrap') {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Skip sub-agent sessions to avoid bootstrap issues
|
|
82
|
+
if (event.sessionKey && event.sessionKey.includes(':subagent:')) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Inject virtual file into bootstrap context
|
|
87
|
+
if (Array.isArray(event.context.bootstrapFiles)) {
|
|
88
|
+
event.context.bootstrapFiles.push({
|
|
89
|
+
path: 'MNEMO_REMINDER.md',
|
|
90
|
+
content: REMINDER_CONTENT,
|
|
91
|
+
virtual: true,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export default handler;
|
|
97
|
+
`;
|
|
98
|
+
// ---------------------------------------------------------------------------
|
|
99
|
+
// OpenCode — plugin template
|
|
100
|
+
// ---------------------------------------------------------------------------
|
|
101
|
+
/**
|
|
102
|
+
* OpenCode plugin for mnemo memory reminders.
|
|
103
|
+
* Subscribes to session lifecycle events.
|
|
104
|
+
*/
|
|
105
|
+
export const OPENCODE_PLUGIN_TS = `/**
|
|
106
|
+
* Mnemo Memory Reminder Plugin for OpenCode
|
|
107
|
+
* Injects memory management reminders at key session lifecycle points.
|
|
108
|
+
*/
|
|
109
|
+
|
|
110
|
+
const SESSION_START_REMINDER = \`${REMINDERS.sessionStart}\`;
|
|
111
|
+
|
|
112
|
+
const SESSION_END_REMINDER = \`${REMINDERS.sessionEnd}\`;
|
|
113
|
+
|
|
114
|
+
const COMPACTION_REMINDER = \`${REMINDERS.compaction}\`;
|
|
115
|
+
|
|
116
|
+
export const MnemoReminder = async ({ client }) => {
|
|
117
|
+
return {
|
|
118
|
+
event: async ({ event }) => {
|
|
119
|
+
if (event.type === "session.created") {
|
|
120
|
+
// Remind to search memory at session start
|
|
121
|
+
try {
|
|
122
|
+
const sessions = await client.session.list();
|
|
123
|
+
const current = sessions.data?.[0];
|
|
124
|
+
if (current?.id) {
|
|
125
|
+
await client.session.prompt({
|
|
126
|
+
path: { id: current.id },
|
|
127
|
+
body: {
|
|
128
|
+
noReply: true,
|
|
129
|
+
parts: [{ type: "text", text: SESSION_START_REMINDER }],
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
} catch {
|
|
134
|
+
// Best effort — don't break the session
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (event.type === "session.idle") {
|
|
138
|
+
// Remind to self-check at session end
|
|
139
|
+
try {
|
|
140
|
+
const sessions = await client.session.list();
|
|
141
|
+
const current = sessions.data?.[0];
|
|
142
|
+
if (current?.id) {
|
|
143
|
+
await client.session.prompt({
|
|
144
|
+
path: { id: current.id },
|
|
145
|
+
body: {
|
|
146
|
+
noReply: true,
|
|
147
|
+
parts: [{ type: "text", text: SESSION_END_REMINDER }],
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
} catch {
|
|
152
|
+
// Best effort
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
"experimental.session.compacting": async (input, output) => {
|
|
157
|
+
output.context.push(COMPACTION_REMINDER);
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
`;
|
|
162
|
+
export const HOOK_CONFIGS = {
|
|
163
|
+
'claude-code': {
|
|
164
|
+
getHookDir: (home) => `${home}/.claude/hooks/mnemo`,
|
|
165
|
+
files: {
|
|
166
|
+
'mnemo-activator.sh': ACTIVATOR_SCRIPT,
|
|
167
|
+
},
|
|
168
|
+
getSettingsPath: (home) => `${home}/.claude/settings.json`,
|
|
169
|
+
},
|
|
170
|
+
codex: {
|
|
171
|
+
getHookDir: (home) => `${home}/.codex/hooks/mnemo`,
|
|
172
|
+
files: {
|
|
173
|
+
'mnemo-activator.sh': ACTIVATOR_SCRIPT,
|
|
174
|
+
},
|
|
175
|
+
getSettingsPath: (home) => `${home}/.codex/settings.json`,
|
|
176
|
+
},
|
|
177
|
+
openclaw: {
|
|
178
|
+
getHookDir: (home) => `${home}/.openclaw/hooks/mnemo`,
|
|
179
|
+
files: {
|
|
180
|
+
'HOOK.md': OPENCLAW_HOOK_MD,
|
|
181
|
+
'handler.ts': OPENCLAW_HANDLER_TS,
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
opencode: {
|
|
185
|
+
getHookDir: (home) => `${home}/.config/opencode/plugins`,
|
|
186
|
+
files: {
|
|
187
|
+
'mnemo-reminder.ts': OPENCODE_PLUGIN_TS,
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
//# sourceMappingURL=reminders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reminders.js","sourceRoot":"","sources":["../../src/hooks/reminders.ts"],"names":[],"mappings":"AAEA;;;GAGG;AAEH,MAAM,CAAC,MAAM,SAAS,GAAG;IACrB,iEAAiE;IACjE,OAAO,E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C,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,uBAAuB;KAC5D;IACD,QAAQ,EAAE;QACN,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,wBAAwB;QACrD,KAAK,EAAE;YACH,SAAS,EAAE,gBAAgB;YAC3B,YAAY,EAAE,mBAAmB;SACpC;KACJ;IACD,QAAQ,EAAE;QACN,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,2BAA2B;QACxD,KAAK,EAAE;YACH,mBAAmB,EAAE,kBAAkB;SAC1C;KACJ;CACJ,CAAC"}
|
package/build/index.js
CHANGED
|
File without changes
|
|
@@ -6,11 +6,65 @@ const BASE_MEMORY_PROMPT = `
|
|
|
6
6
|
|
|
7
7
|
You have access to a persistent memory system (Mnemo). Use it to retain important information across conversations.
|
|
8
8
|
|
|
9
|
+
Mnemo is not a full transcript archive. It is a system for preserving high-value long-term context across conversations.
|
|
10
|
+
|
|
11
|
+
### Quick Reference
|
|
12
|
+
|
|
13
|
+
| Situation | Action | Type |
|
|
14
|
+
|-----------|--------|------|
|
|
15
|
+
| User states a stable preference or working style | memory_save | preference |
|
|
16
|
+
| A decision is made that will affect future work | memory_save | decision |
|
|
17
|
+
| A reusable rule or convention is established | memory_save | rule |
|
|
18
|
+
| A long-term goal or direction is clarified | memory_save | goal |
|
|
19
|
+
| An unresolved thread must be resumed later | memory_save | continuity |
|
|
20
|
+
| Stable background info about user/project/topic | memory_save | profile or fact |
|
|
21
|
+
| A validated, reusable experience proves its worth | memory_save | experience |
|
|
22
|
+
| New conversation begins | memory_search | — |
|
|
23
|
+
| User references past discussions or decisions | memory_search | — |
|
|
24
|
+
| Entering a long-running project or topic | memory_search | — |
|
|
25
|
+
| Many notes accumulated or context window reset | memory_compress | — |
|
|
26
|
+
| A continuity thread has been resolved | memory_compress or memory_save | evolve type |
|
|
27
|
+
|
|
28
|
+
### When to search memory (memory_search):
|
|
29
|
+
- **At the START of each conversation**, search for relevant context based on the user's first message. This is your highest-priority Mnemo action — do it before anything else.
|
|
30
|
+
- Search before doing major work on an ongoing topic, project, or long-running discussion
|
|
31
|
+
- When the user references past discussions or decisions — watch for phrases like:
|
|
32
|
+
- "do you remember...", "we discussed before...", "last time we..."
|
|
33
|
+
- "didn't we decide...", "what was the conclusion on..."
|
|
34
|
+
- "as we agreed...", "going back to..."
|
|
35
|
+
- When you need background context for a task
|
|
36
|
+
- memory_search returns **summaries** — use memory_get with the returned IDs to retrieve full content when needed
|
|
37
|
+
|
|
9
38
|
### When to save memory (memory_save):
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
39
|
+
- Save only high-value long-term context, not temporary details or full conversation logs
|
|
40
|
+
- Watch for these trigger patterns in conversation:
|
|
41
|
+
|
|
42
|
+
**Preferences** (→ type: preference):
|
|
43
|
+
- User says: "I prefer...", "always do it this way...", "don't ever...", "I like when..."
|
|
44
|
+
- User expresses a stable preference, working style, boundary, or requirement
|
|
45
|
+
|
|
46
|
+
**Decisions** (→ type: decision):
|
|
47
|
+
- User says: "let's go with...", "decided:", "the plan is...", "we'll use..."
|
|
48
|
+
- A question is resolved and the answer will affect future work
|
|
49
|
+
|
|
50
|
+
**Rules** (→ type: rule):
|
|
51
|
+
- User says: "from now on...", "going forward, always...", "the convention is..."
|
|
52
|
+
- A reusable workflow convention or agreement is established
|
|
53
|
+
|
|
54
|
+
**Goals** (→ type: goal):
|
|
55
|
+
- User says: "the long-term plan is...", "eventually we want...", "the vision is..."
|
|
56
|
+
- A long-term direction or objective is clarified
|
|
57
|
+
|
|
58
|
+
**Continuity** (→ type: continuity):
|
|
59
|
+
- A thread is left unresolved but will clearly be resumed
|
|
60
|
+
- User says: "we'll pick this up later...", "let's come back to this...", "not now, but..."
|
|
61
|
+
|
|
62
|
+
**Profile / Fact** (→ type: profile or fact):
|
|
63
|
+
- Stable background information about the user, project, or topic is surfaced
|
|
64
|
+
|
|
65
|
+
**Experience** (→ type: experience) — high bar:
|
|
66
|
+
- Only save when ALL three conditions are met: (1) the experience has been validated, (2) it is reusable across sessions, (3) it would meaningfully affect future work
|
|
67
|
+
- A single error, one-off debugging session, or unconfirmed workaround does NOT qualify
|
|
14
68
|
|
|
15
69
|
### When to initialize memory (memory_setup):
|
|
16
70
|
- When Mnemo has not been initialized yet and a memory tool reports that setup is required
|
|
@@ -18,13 +72,6 @@ You have access to a persistent memory system (Mnemo). Use it to retain importan
|
|
|
18
72
|
- Default to global scope for shared cross-project memory
|
|
19
73
|
- Use project scope only when the user explicitly wants isolated per-project memory
|
|
20
74
|
|
|
21
|
-
### When to search memory (memory_search):
|
|
22
|
-
- At the START of each conversation, search for relevant context based on the user's first message
|
|
23
|
-
- When the user references past discussions or decisions
|
|
24
|
-
- When you need background context for a task
|
|
25
|
-
- When the user asks "do you remember..." or similar
|
|
26
|
-
- memory_search returns **summaries** — use memory_get with the returned IDs to retrieve full content when needed
|
|
27
|
-
|
|
28
75
|
### When to get full memory content (memory_get):
|
|
29
76
|
- After memory_search, when you need the complete content of specific memories
|
|
30
77
|
- Pass one or more note IDs from memory_search results to retrieve full content
|
|
@@ -35,14 +82,37 @@ You have access to a persistent memory system (Mnemo). Use it to retain importan
|
|
|
35
82
|
- When explicitly asked to organize or clean up memories
|
|
36
83
|
- Periodically during long conversations
|
|
37
84
|
- After context compaction or context window reset — when resuming from a compacted context, check if memories need consolidation before continuing work
|
|
85
|
+
- When a continuity thread has turned into a clear decision, rule, or fact and older notes should be consolidated
|
|
38
86
|
- Workflow: call memory_compress to get all notes → distill them into fewer, concise notes → call memory_compress_apply with the distilled notes and old IDs to atomically save new + delete old
|
|
39
87
|
|
|
88
|
+
### Memory Lifecycle:
|
|
89
|
+
Memories are not static. They evolve as context matures:
|
|
90
|
+
- \`continuity\` → \`decision\` (when an open question is resolved)
|
|
91
|
+
- \`decision\` → \`rule\` (when a one-time choice becomes a standing convention)
|
|
92
|
+
- \`continuity\` → \`fact\` (when an open question is answered with stable info)
|
|
93
|
+
- \`experience\` → \`rule\` (when a validated experience becomes a default practice)
|
|
94
|
+
|
|
95
|
+
**Continuity closure**: When a \`continuity\` thread is resolved, do not leave it dangling — either transform it into the appropriate type (decision, fact, rule) or remove it if it no longer has long-term value. Stale continuity notes pollute the memory system.
|
|
96
|
+
|
|
97
|
+
**Dedup before adding**: When saving, always check if a similar memory already exists. Prefer updating or replacing existing memories over creating duplicates. Priority order: supplement existing → update existing → replace outdated → add new (last resort).
|
|
98
|
+
|
|
40
99
|
### Guidelines:
|
|
41
|
-
-
|
|
100
|
+
- Prefer this order: memory_search -> do the work -> memory_save -> memory_compress when needed
|
|
101
|
+
- Before saving, verify the information meets at least 2 of these 3 criteria: (1) useful across future sessions, (2) affects future work or decisions, (3) would require re-alignment if forgotten
|
|
102
|
+
- **Always specify a type when saving.** Determine the type first (preference, profile, goal, continuity, fact, decision, rule, or experience), then call memory_save with the type parameter. Saving without a type defeats the purpose of organized long-term memory.
|
|
103
|
+
- Save memories in concise, distilled form — capture the essence, not raw conversation
|
|
104
|
+
- Do not save routine task state, ordinary command output, or one-off debugging noise
|
|
42
105
|
- Use descriptive tags to categorize memories
|
|
43
106
|
- Always include relevant project/topic context in the memory content
|
|
44
107
|
- Do not save trivial or temporary information
|
|
45
108
|
- When searching, use semantic queries that describe the information you need
|
|
109
|
+
|
|
110
|
+
### Self-Check (after completing each task):
|
|
111
|
+
Ask yourself briefly:
|
|
112
|
+
- Did a durable conclusion, preference, or decision emerge from this conversation?
|
|
113
|
+
- Was an important thread left unresolved that I should save as continuity?
|
|
114
|
+
- Did I learn something reusable that would be lost without saving?
|
|
115
|
+
If the answer to any of these is yes and the save threshold is met, call memory_save before moving on.
|
|
46
116
|
`.trim();
|
|
47
117
|
/**
|
|
48
118
|
* Agent-specific memory prompt overrides.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/prompts/templates.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAA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AW,CAAC,GAAW;IAC5B,OAAO,GAAG,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AACtD,CAAC"}
|
package/build/tools/compress.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { readAllNotes, saveNote, deleteNotes, getNoteStats } from '../core/notes.js';
|
|
3
3
|
import { indexNote, removeMultipleFromIndex } from '../core/embedding.js';
|
|
4
|
+
import { MEMORY_TYPES } from '../core/config.js';
|
|
4
5
|
/**
|
|
5
6
|
* Register the memory_compress tool
|
|
6
7
|
*/
|
|
7
8
|
export function registerCompressTool(server) {
|
|
8
9
|
server.registerTool('memory_compress', {
|
|
9
10
|
title: 'Compress Memory',
|
|
10
|
-
description: 'Consolidate and compress existing
|
|
11
|
+
description: 'Consolidate and compress existing long-term memories. This tool reads current notes, asks you to distill them into fewer and clearer memories, and helps keep the knowledge base focused on durable high-value context instead of fragmented history.',
|
|
11
12
|
inputSchema: {
|
|
12
13
|
strategy: z
|
|
13
14
|
.enum(['review', 'auto_tag'])
|
|
@@ -75,7 +76,7 @@ export function registerCompressTool(server) {
|
|
|
75
76
|
}
|
|
76
77
|
// Strategy: review - return all notes for LLM to distill
|
|
77
78
|
const notesText = targetNotes
|
|
78
|
-
.map((n) => `[ID: ${n.meta.id}] [Tags: ${n.meta.tags.join(', ')}] [Created: ${n.meta.created}]\n${n.content}`)
|
|
79
|
+
.map((n) => `[ID: ${n.meta.id}]${n.meta.type ? ` [Type: ${n.meta.type}]` : ''} [Tags: ${n.meta.tags.join(', ')}] [Created: ${n.meta.created}]\n${n.content}`)
|
|
79
80
|
.join('\n\n---\n\n');
|
|
80
81
|
const noteIds = targetNotes.map((n) => n.meta.id);
|
|
81
82
|
return {
|
|
@@ -142,6 +143,7 @@ export function registerCompressTool(server) {
|
|
|
142
143
|
.array(z.object({
|
|
143
144
|
content: z.string().describe('The distilled note content'),
|
|
144
145
|
tags: z.array(z.string()).optional().describe('Tags for this note'),
|
|
146
|
+
type: z.enum(MEMORY_TYPES).optional().describe('Memory type classification for this note'),
|
|
145
147
|
}))
|
|
146
148
|
.describe('Array of distilled notes to save'),
|
|
147
149
|
old_ids: z
|
|
@@ -154,7 +156,7 @@ export function registerCompressTool(server) {
|
|
|
154
156
|
// Step 1: Save all new notes
|
|
155
157
|
const savedNotes = [];
|
|
156
158
|
for (const n of notes) {
|
|
157
|
-
const saved = await saveNote(n.content, n.tags || [], source || 'unknown');
|
|
159
|
+
const saved = await saveNote(n.content, n.tags || [], source || 'unknown', n.type);
|
|
158
160
|
savedNotes.push(saved);
|
|
159
161
|
}
|
|
160
162
|
// Step 2: Index new notes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compress.js","sourceRoot":"","sources":["../../src/tools/compress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"compress.js","sourceRoot":"","sources":["../../src/tools/compress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAiB;IAClD,MAAM,CAAC,YAAY,CACf,iBAAiB,EACjB;QACI,KAAK,EAAE,iBAAiB;QACxB,WAAW,EACP,uPAAuP;QAC3P,WAAW,EAAE;YACT,QAAQ,EA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D,IAAI,MAAM,GAAG,2DAA2D,UAAU,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,2BAA2B,YAAY,OAAO,OAAO,CAAC,MAAM,EAAE,CAAC;YAE9K,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC3B,MAAM,IAAI,kGAAkG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3I,CAAC;YAED,OAAO;gBACH,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;aACrD,CAAC;QACN,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO;gBACH,OAAO,EAAE;oBACL;wBACI,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,gCAAgC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;qBACjG;iBACJ;gBACD,OAAO,EAAE,IAAI;aAChB,CAAC;QACN,CAAC;IACL,CAAC,CACJ,CAAC;AACN,CAAC"}
|
package/build/tools/get.js
CHANGED
|
@@ -23,6 +23,7 @@ export function registerGetTool(server) {
|
|
|
23
23
|
tags: note.meta.tags,
|
|
24
24
|
source: note.meta.source,
|
|
25
25
|
created: note.meta.created,
|
|
26
|
+
type: note.meta.type,
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
29
|
else {
|
|
@@ -42,6 +43,7 @@ export function registerGetTool(server) {
|
|
|
42
43
|
const output = results
|
|
43
44
|
.map((r, i) => `### Memory ${i + 1}\n` +
|
|
44
45
|
`- **ID:** ${r.id}\n` +
|
|
46
|
+
(r.type ? `- **Type:** ${r.type}\n` : '') +
|
|
45
47
|
`- **Tags:** [${r.tags.join(', ')}]\n` +
|
|
46
48
|
`- **Source:** ${r.source}\n` +
|
|
47
49
|
`- **Created:** ${r.created}\n\n` +
|
package/build/tools/get.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../src/tools/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC7C,MAAM,CAAC,YAAY,CACf,YAAY,EACZ;QACI,KAAK,EAAE,YAAY;QACnB,WAAW,EACP,oJAAoJ;QACxJ,WAAW,EAAE;YACT,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,4DAA4D,CAAC;SACzG;KACJ,EACD,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;QACd,IAAI,CAAC;YACD,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../src/tools/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC7C,MAAM,CAAC,YAAY,CACf,YAAY,EACZ;QACI,KAAK,EAAE,YAAY;QACnB,WAAW,EACP,oJAAoJ;QACxJ,WAAW,EAAE;YACT,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,4DAA4D,CAAC;SACzG;KACJ,EACD,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;QACd,IAAI,CAAC;YACD,MAAM,OAAO,GAOR,EAAE,CAAC;YACR,MAAM,QAAQ,GAAa,EAAE,CAAC;YAE9B,KAAK,MAAM,E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CACrB;iBACA,IAAI,CAAC,aAAa,CAAC,CAAC;YAEzB,IAAI,IAAI,GAAG,MAAM,CAAC;YAClB,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACtB,IAAI,IAAI,uDAAuD,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;YAC1F,CAAC;YAED,OAAO;gBACH,OAAO,EAAE;oBACL;wBACI,IAAI,EAAE,MAAe;wBACrB,IAAI;qBACP;iBACJ;aACJ,CAAC;QACN,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO;gBACH,OAAO,EAAE;oBACL;wBACI,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,gCAAgC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;qBACjG;iBACJ;gBACD,OAAO,EAAE,IAAI;aAChB,CAAC;QACN,CAAC;IACL,CAAC,CACJ,CAAC;AACN,CAAC"}
|
package/build/tools/save.js
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { saveNote, getNoteStats } from '../core/notes.js';
|
|
3
3
|
import { indexNote } from '../core/embedding.js';
|
|
4
|
-
import { COMPRESS_THRESHOLDS } from '../core/config.js';
|
|
4
|
+
import { COMPRESS_THRESHOLDS, MEMORY_TYPES } from '../core/config.js';
|
|
5
5
|
/**
|
|
6
6
|
* Register the memory_save tool
|
|
7
7
|
*/
|
|
8
8
|
export function registerSaveTool(server) {
|
|
9
9
|
server.registerTool('memory_save', {
|
|
10
10
|
title: 'Save Memory',
|
|
11
|
-
description: 'Save a piece of
|
|
11
|
+
description: 'Save a piece of high-value long-term context as a persistent memory note. Use this for stable preferences, important decisions, long-term goals, reusable rules, or continuity that should matter across future conversations. Content should be distilled and concise, not raw conversation.',
|
|
12
12
|
inputSchema: {
|
|
13
13
|
content: z
|
|
14
14
|
.string()
|
|
15
|
-
.describe('The
|
|
15
|
+
.describe('The long-term context to save. It should capture the durable essence of what should still matter in future conversations.'),
|
|
16
|
+
type: z
|
|
17
|
+
.enum(MEMORY_TYPES)
|
|
18
|
+
.optional()
|
|
19
|
+
.describe('Memory type classification. Helps organize and retrieve memories. Options: preference (user preferences/habits), profile (stable background info), goal (long-term directions), continuity (unresolved threads to resume), fact (stable objective info), decision (confirmed choices), rule (reusable conventions), experience (validated reusable lessons).'),
|
|
16
20
|
tags: z
|
|
17
21
|
.array(z.string())
|
|
18
22
|
.optional()
|
|
@@ -22,10 +26,10 @@ export function registerSaveTool(server) {
|
|
|
22
26
|
.optional()
|
|
23
27
|
.describe("Source identifier, e.g., 'opencode', 'claude-code'. Defaults to 'unknown'."),
|
|
24
28
|
},
|
|
25
|
-
}, async ({ content, tags, source }) => {
|
|
29
|
+
}, async ({ content, type, tags, source }) => {
|
|
26
30
|
try {
|
|
27
31
|
// Save the note to disk first (fast, reliable)
|
|
28
|
-
const note = await saveNote(content, tags || [], source || 'unknown');
|
|
32
|
+
const note = await saveNote(content, tags || [], source || 'unknown', type);
|
|
29
33
|
// Try to index for semantic search (may be slow on first call)
|
|
30
34
|
let indexWarning = '';
|
|
31
35
|
try {
|
|
@@ -36,17 +40,24 @@ export function registerSaveTool(server) {
|
|
|
36
40
|
indexWarning = `\n\nWarning: Memory saved to disk but semantic indexing failed (${reason}). The note will be available via memory_search after the embedding model finishes loading.`;
|
|
37
41
|
console.error('Mnemo: indexing failed for note', note.meta.id, reason);
|
|
38
42
|
}
|
|
43
|
+
// Soft hint if type was not specified
|
|
44
|
+
let typeHint = '';
|
|
45
|
+
if (!type) {
|
|
46
|
+
typeHint =
|
|
47
|
+
'\n\nHint: Consider specifying a memory type (preference, profile, goal, continuity, fact, decision, rule, experience) for better organization and retrieval.';
|
|
48
|
+
}
|
|
39
49
|
// Check if compression might be needed (program-level guardrail)
|
|
40
50
|
const stats = await getNoteStats();
|
|
41
51
|
let compressHint = '';
|
|
42
52
|
if (stats.count > COMPRESS_THRESHOLDS.maxNotes || stats.totalSize > COMPRESS_THRESHOLDS.maxTotalSize) {
|
|
43
53
|
compressHint = `\n\nNote: Memory storage is growing large (${stats.count} notes, ${Math.round(stats.totalSize / 1000)}KB). Consider running memory_compress to consolidate and distill older memories.`;
|
|
44
54
|
}
|
|
55
|
+
const typeLine = note.meta.type ? `\nType: ${note.meta.type}` : '';
|
|
45
56
|
return {
|
|
46
57
|
content: [
|
|
47
58
|
{
|
|
48
59
|
type: 'text',
|
|
49
|
-
text: `Memory saved successfully.\n\nID: ${note.meta.id}\nTags: [${note.meta.tags.join(', ')}]${indexWarning}${compressHint}`,
|
|
60
|
+
text: `Memory saved successfully.\n\nID: ${note.meta.id}${typeLine}\nTags: [${note.meta.tags.join(', ')}]${indexWarning}${typeHint}${compressHint}`,
|
|
50
61
|
},
|
|
51
62
|
],
|
|
52
63
|
};
|
package/build/tools/save.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"save.js","sourceRoot":"","sources":["../../src/tools/save.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAoB,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"save.js","sourceRoot":"","sources":["../../src/tools/save.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAoB,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtE;;GAEG;AACH,MA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C"}
|
package/build/tools/search.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { searchNotes } from '../core/embedding.js';
|
|
3
|
+
import { MEMORY_TYPES } from '../core/config.js';
|
|
3
4
|
/**
|
|
4
5
|
* Extract a summary from note content: first line, or first ~200 chars.
|
|
5
6
|
*/
|
|
@@ -15,7 +16,7 @@ export function extractSummary(content, maxLen = 200) {
|
|
|
15
16
|
export function registerSearchTool(server) {
|
|
16
17
|
server.registerTool('memory_search', {
|
|
17
18
|
title: 'Search Memory',
|
|
18
|
-
description: 'Search through persistent
|
|
19
|
+
description: 'Search through persistent high-value long-term context using semantic similarity. Returns summaries of matching memories so you can recover relevant background before continuing work.',
|
|
19
20
|
inputSchema: {
|
|
20
21
|
query: z
|
|
21
22
|
.string()
|
|
@@ -36,11 +37,16 @@ export function registerSearchTool(server) {
|
|
|
36
37
|
.array(z.string())
|
|
37
38
|
.optional()
|
|
38
39
|
.describe('Filter results to only include notes that have ALL of the specified tags. E.g., ["architecture", "decision"]'),
|
|
40
|
+
type_filter: z
|
|
41
|
+
.enum(MEMORY_TYPES)
|
|
42
|
+
.optional()
|
|
43
|
+
.describe('Filter results to only include notes of a specific memory type. E.g., "decision", "rule", "continuity".'),
|
|
39
44
|
},
|
|
40
|
-
}, async ({ query, top_k, source_filter, tag_filter }) => {
|
|
45
|
+
}, async ({ query, top_k, source_filter, tag_filter, type_filter }) => {
|
|
41
46
|
try {
|
|
42
|
-
// When tag_filter is used, fetch more results to compensate for post-filtering
|
|
43
|
-
const
|
|
47
|
+
// When tag_filter or type_filter is used, fetch more results to compensate for post-filtering
|
|
48
|
+
const hasPostFilter = (tag_filter && tag_filter.length > 0) || type_filter;
|
|
49
|
+
const fetchK = hasPostFilter ? (top_k || 5) * 3 : top_k || 5;
|
|
44
50
|
let results = await searchNotes(query, fetchK, source_filter);
|
|
45
51
|
// Post-filter by tags if specified
|
|
46
52
|
if (tag_filter && tag_filter.length > 0) {
|
|
@@ -50,6 +56,11 @@ export function registerSearchTool(server) {
|
|
|
50
56
|
});
|
|
51
57
|
results = results.slice(0, top_k || 5);
|
|
52
58
|
}
|
|
59
|
+
// Post-filter by type if specified
|
|
60
|
+
if (type_filter) {
|
|
61
|
+
results = results.filter((r) => r.type === type_filter);
|
|
62
|
+
results = results.slice(0, top_k || 5);
|
|
63
|
+
}
|
|
53
64
|
if (results.length === 0) {
|
|
54
65
|
return {
|
|
55
66
|
content: [
|
|
@@ -64,6 +75,7 @@ export function registerSearchTool(server) {
|
|
|
64
75
|
const output = results
|
|
65
76
|
.map((r, i) => `### Memory ${i + 1} (relevance: ${(r.score * 100).toFixed(1)}%)\n` +
|
|
66
77
|
`- **ID:** ${r.id}\n` +
|
|
78
|
+
(r.type ? `- **Type:** ${r.type}\n` : '') +
|
|
67
79
|
`- **Tags:** [${r.tags}]\n` +
|
|
68
80
|
`- **Source:** ${r.source}\n` +
|
|
69
81
|
`- **Created:** ${r.created}\n` +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAoB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAoB,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe,EAAE,SAAiB,GAAG;IAChE,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAChD,IAAI,SAAS,CAAC,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