universal-memory-mcp 0.2.1 → 0.2.3

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 slicenferqin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.js CHANGED
@@ -55,6 +55,10 @@ Use specific keywords for better results (e.g., "TypeScript preferences", "datab
55
55
  type: 'string',
56
56
  description: 'Filter by project name',
57
57
  },
58
+ client: {
59
+ type: 'string',
60
+ description: 'Filter by client name (e.g., claude-code, opencode, trae)',
61
+ },
58
62
  limit: {
59
63
  type: 'number',
60
64
  description: 'Max results to return, default 10',
@@ -92,6 +96,10 @@ This builds memory over time, allowing recall of past discussions in future sess
92
96
  type: 'string',
93
97
  description: 'Project name if in a project context',
94
98
  },
99
+ client: {
100
+ type: 'string',
101
+ description: 'Client name (e.g., claude-code, opencode, trae)',
102
+ },
95
103
  session_id: {
96
104
  type: 'string',
97
105
  description: 'Session ID for grouping related conversations',
@@ -142,12 +150,13 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
142
150
  try {
143
151
  switch (name) {
144
152
  case 'memory_search': {
145
- const { query, time_range, project, limit } = args;
153
+ const { query, time_range, project, client, limit } = args;
146
154
  const results = await memoryManager.search(query, {
147
155
  timeRange: time_range
148
156
  ? [new Date(time_range[0]), new Date(time_range[1])]
149
157
  : undefined,
150
158
  project,
159
+ client,
151
160
  limit,
152
161
  });
153
162
  if (results.length === 0) {
@@ -177,9 +186,10 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
177
186
  };
178
187
  }
179
188
  case 'memory_record': {
180
- const { user_message, ai_response, project, session_id } = args;
189
+ const { user_message, ai_response, project, client, session_id } = args;
181
190
  const conversation = await memoryManager.recordConversation(user_message, ai_response, {
182
191
  project,
192
+ client,
183
193
  sessionId: session_id,
184
194
  });
185
195
  return {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,mBAAmB,EAAqB,MAAM,uBAAuB,CAAC;AAE/E,wBAAwB;AACxB,MAAM,aAAa,GAAG,mBAAmB,EAAE,CAAC;AAE5C,oBAAoB;AACpB,MAAM,MAAM,GAAG,IAAI,MAAM,CACvB;IACE,IAAI,EAAE,sBAAsB;IAC5B,OAAO,EAAE,OAAO;CACjB,EACD;IACE,YAAY,EAAE;QACZ,KAAK,EAAE,EAAE;KACV;CACF,CACF,CAAC;AAEF,eAAe;AACf,MAAM,CAAC,iBAAiB,CA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oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,UAAU,OAAO,EAAE;iBAC1B;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,eAAe;AACf,KAAK,UAAU,IAAI;IACjB,2BAA2B;IAC3B,MAAM,aAAa,CAAC,UAAU,EAAE,CAAC;IAEjC,OAAO,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC;IACzD,OAAO,CAAC,KAAK,CAAC,iBAAiB,aAAa,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;IAEjE,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,OAAO,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC;AACvD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=record.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../src/record.ts"],"names":[],"mappings":""}
package/dist/record.js ADDED
@@ -0,0 +1,94 @@
1
+ #!/usr/bin/env node
2
+ import { createMemoryManager } from 'universal-memory-core';
3
+ function getArgValue(args, name) {
4
+ const idx = args.indexOf(name);
5
+ if (idx === -1)
6
+ return undefined;
7
+ const value = args[idx + 1];
8
+ if (!value || value.startsWith('--'))
9
+ return undefined;
10
+ return value;
11
+ }
12
+ function hasFlag(args, name) {
13
+ return args.includes(name);
14
+ }
15
+ async function readStdin() {
16
+ const chunks = [];
17
+ for await (const chunk of process.stdin) {
18
+ chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk)));
19
+ }
20
+ return Buffer.concat(chunks).toString('utf8');
21
+ }
22
+ function usage() {
23
+ return [
24
+ 'Usage:',
25
+ ' universal-memory-record --user <text> --ai <text> [--project <name>] [--client <name>] [--session-id <id>] [--cwd <path>]',
26
+ ' universal-memory-record --json',
27
+ '',
28
+ 'JSON mode reads stdin with fields:',
29
+ ' { "user_message": "...", "ai_response": "...", "project": "...", "client": "...", "session_id": "...", "working_directory": "...", "storage_path": "..." }',
30
+ '',
31
+ 'Storage path resolution priority:',
32
+ ' --storage-path / JSON.storage_path > env.MEMORY_PATH > default (~/.ai_memory)',
33
+ ].join('\n');
34
+ }
35
+ function normalizeInput(argv) {
36
+ if (hasFlag(argv, '--json')) {
37
+ return {};
38
+ }
39
+ const user_message = getArgValue(argv, '--user');
40
+ const ai_response = getArgValue(argv, '--ai');
41
+ const project = getArgValue(argv, '--project');
42
+ const client = getArgValue(argv, '--client');
43
+ const session_id = getArgValue(argv, '--session-id');
44
+ const working_directory = getArgValue(argv, '--cwd');
45
+ const storage_path = getArgValue(argv, '--storage-path');
46
+ return {
47
+ user_message,
48
+ ai_response,
49
+ project,
50
+ client,
51
+ session_id,
52
+ working_directory,
53
+ storage_path,
54
+ };
55
+ }
56
+ async function main() {
57
+ const argv = process.argv.slice(2);
58
+ if (hasFlag(argv, '--help') || hasFlag(argv, '-h')) {
59
+ process.stdout.write(`${usage()}\n`);
60
+ process.exit(0);
61
+ }
62
+ let input = normalizeInput(argv);
63
+ if (hasFlag(argv, '--json')) {
64
+ const raw = await readStdin();
65
+ if (!raw.trim()) {
66
+ process.stderr.write('Error: --json provided but stdin is empty\n');
67
+ process.stderr.write(`${usage()}\n`);
68
+ process.exit(1);
69
+ }
70
+ input = JSON.parse(raw);
71
+ }
72
+ const userMessage = input.user_message;
73
+ const aiResponse = input.ai_response;
74
+ if (!userMessage || !aiResponse) {
75
+ process.stderr.write('Error: missing required fields user_message/ai_response (or --user/--ai)\n');
76
+ process.stderr.write(`${usage()}\n`);
77
+ process.exit(1);
78
+ }
79
+ const storagePath = input.storage_path || process.env.MEMORY_PATH || undefined;
80
+ const memoryManager = createMemoryManager(storagePath ? { storagePath } : undefined);
81
+ const conversation = await memoryManager.recordConversation(userMessage, aiResponse, {
82
+ project: input.project,
83
+ client: input.client,
84
+ sessionId: input.session_id,
85
+ workingDirectory: input.working_directory,
86
+ });
87
+ process.stdout.write(`${conversation.id}\n`);
88
+ }
89
+ main().catch((error) => {
90
+ const message = error instanceof Error ? error.message : String(error);
91
+ process.stderr.write(`Fatal error: ${message}\n`);
92
+ process.exit(1);
93
+ });
94
+ //# sourceMappingURL=record.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"record.js","sourceRoot":"","sources":["../src/record.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAY5D,SAAS,WAAW,CAAC,IAAc,EAAE,IAAY;IAC/C,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,GAAG,KAAK,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IACjC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IAC5B,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IACvD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,OAAO,CAAC,IAAc,EAAE,IAAY;IAC3C,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC;AAED,KAAK,UAAU,SAAS;IACtB,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QACxC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC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CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAC1C,CAAC;IAEF,MAAM,YAAY,GAAG,MAAM,aAAa,CAAC,kBAAkB,CACzD,WAAW,EACX,UAAU,EACV;QACE,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,SAAS,EAAE,KAAK,CAAC,UAAU;QAC3B,gBAAgB,EAAE,KAAK,CAAC,iBAAiB;KACnC,CACT,CAAC;IAEF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,YAAY,CAAC,EAAE,IAAI,CAAC,CAAC;AAC/C,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,OAAO,IAAI,CAAC,CAAC;IAClD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "universal-memory-mcp",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "MCP Server for persistent AI memory across sessions",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
8
8
  "bin": {
9
- "universal-memory-mcp": "./dist/index.js"
9
+ "universal-memory-mcp": "./dist/index.js",
10
+ "universal-memory-record": "./dist/record.js"
10
11
  },
11
12
  "exports": {
12
13
  ".": {
@@ -27,109 +27,132 @@ const MCP_CONFIG = {
27
27
  const SKILL_CONTENT = `---
28
28
  name: memory-assistant
29
29
  description: |
30
- Automatic conversation memory management using universal-memory MCP.
30
+ CRITICAL: You MUST use memory tools for EVERY conversation.
31
31
 
32
- ALWAYS activate this skill to:
33
- 1. SEARCH memories when user mentions: "之前", "上次", "我们讨论过", "remember", "we talked about", "what did we decide"
34
- 2. RECORD conversations at the END of EVERY meaningful response
35
- 3. STORE long-term info when discovering: user preferences, important decisions, key facts
32
+ MANDATORY actions:
33
+ 1. SEARCH memories when user mentions past discussions ("之前", "上次", "remember", "we talked about")
34
+ 2. RECORD EVERY response (except greetings like "hi"/"thanks") - NO EXCEPTIONS
35
+ 3. STORE preferences/decisions/facts immediately when discovered
36
36
 
37
- This skill ensures AI maintains persistent memory across all sessions.
37
+ This is NOT optional. Memory recording is REQUIRED for all conversations.
38
38
  ---
39
39
 
40
- # Memory Assistant
40
+ # Memory Assistant - MANDATORY RULES
41
41
 
42
- You have access to persistent memory through the universal-memory MCP tools. Use them proactively.
42
+ ## RULE 1: Record EVERY Response (NO EXCEPTIONS)
43
43
 
44
- ## Core Rules
44
+ **CRITICAL**: At the END of your response, you MUST call \`memory_record\`.
45
45
 
46
- ### 1. Always Search Before Answering (When Relevant)
46
+ **Only skip if**:
47
+ - User message is ONLY: "hi", "hello", "thanks", "ok", "好的", "谢谢"
48
+ - Your response is ONLY: acknowledgment with no information
47
49
 
48
- When user references past conversations or asks about previous decisions:
50
+ **Everything else MUST be recorded**:
51
+ - ✅ Questions and answers
52
+ - ✅ Code discussions
53
+ - ✅ Bug fixes
54
+ - ✅ Feature requests
55
+ - ✅ Explanations
56
+ - ✅ Debugging sessions
57
+ - ✅ ANY conversation with information
49
58
 
59
+ ### How to Record
60
+
61
+ \`\`\`javascript
62
+ memory_record({
63
+ user_message: "<brief summary of user's question>",
64
+ ai_response: "<key points of your response in 1-2 sentences>",
65
+ project: "<project name if in project directory>"
66
+ })
50
67
  \`\`\`
51
- Call memory_search with relevant keywords
68
+
69
+ **Example**:
70
+ \`\`\`javascript
71
+ // User: "为什么 memory_search 不工作?"
72
+ // AI: [explains bugs and fixes...]
73
+
74
+ memory_record({
75
+ user_message: "询问为什么 memory_search 无法找到已存储的记忆",
76
+ ai_response: "诊断并修复了两个 bug:storage.list() 调用错误和未搜索 long_term/ 目录。发布了 v0.2.1 修复版本",
77
+ project: "universal-memory-mcp"
78
+ })
52
79
  \`\`\`
53
80
 
54
- Trigger phrases:
81
+ ## RULE 2: Search When User References Past
82
+
83
+ When user says:
55
84
  - "之前", "上次", "我们讨论过", "记得吗"
56
85
  - "remember", "we talked about", "what did we decide", "last time"
57
- - Any reference to past discussions or decisions
58
86
 
59
- ### 2. Always Record After Responding
87
+ **MUST call** \`memory_search\` BEFORE answering:
60
88
 
61
- At the END of EVERY meaningful conversation exchange, call:
62
-
63
- \`\`\`
64
- memory_record({
65
- user_message: "<summarize user's question/request>",
66
- ai_response: "<key points of your response>",
67
- project: "<current project name if applicable>"
89
+ \`\`\`javascript
90
+ memory_search({
91
+ query: "<relevant keywords>",
92
+ limit: 5
68
93
  })
69
94
  \`\`\`
70
95
 
71
- What counts as "meaningful":
72
- - Technical discussions or decisions
73
- - Problem-solving conversations
74
- - User preferences expressed
75
- - Any information worth remembering
76
-
77
- What to skip:
78
- - Simple greetings ("hi", "thanks")
79
- - Trivial clarifications
96
+ ## RULE 3: Store Important Information Immediately
80
97
 
81
- ### 3. Store Important Long-term Information
98
+ When you discover:
99
+ - **Preferences**: User's coding style, tool choices, communication style
100
+ - **Decisions**: Architecture, technology, design choices
101
+ - **Facts**: Project info, team structure, key details
102
+ - **Contacts**: People, teams, organizations
82
103
 
83
- When you identify important information, immediately call:
104
+ **MUST call** \`memory_update_long_term\` immediately:
84
105
 
85
- \`\`\`
106
+ \`\`\`javascript
86
107
  memory_update_long_term({
87
108
  category: "preferences" | "decisions" | "facts" | "contacts",
88
109
  content: "<the information>"
89
110
  })
90
111
  \`\`\`
91
112
 
92
- Categories:
93
- - **preferences**: User's coding style, tool preferences, communication style
94
- - **decisions**: Architecture choices, technology selections, design decisions
95
- - **facts**: Key information about user, projects, team structure
96
- - **contacts**: People, teams, organizations mentioned
113
+ ## Workflow for EVERY Response
114
+
115
+ \`\`\`
116
+ 1. [If user references past] Call memory_search
117
+ 2. [Generate your response]
118
+ 3. [If discovered preference/decision/fact] → Call memory_update_long_term
119
+ 4. [ALWAYS] → Call memory_record (unless simple greeting)
120
+ \`\`\`
97
121
 
98
122
  ## Examples
99
123
 
100
- ### Example 1: User References Past Discussion
124
+ ### Example 1: Bug Fix Discussion
101
125
 
102
- **User**: "我们之前讨论的认证方案是什么来着?"
126
+ **User**: "为什么 memory_search 不工作?"
103
127
 
104
- **Action**:
105
- 1. Call \`memory_search({ query: "认证方案 authentication" })\`
106
- 2. Use search results to answer
107
- 3. Call \`memory_record\` to log this exchange
128
+ **Your Actions**:
129
+ 1. Diagnose and explain the bug
130
+ 2. Fix the code
131
+ 3. **MUST call**: \`memory_record({ user_message: "...", ai_response: "..." })\`
108
132
 
109
133
  ### Example 2: User Expresses Preference
110
134
 
111
- **User**: "我喜欢用 TypeScript,不要给我 JavaScript 代码"
135
+ **User**: "我喜欢用 TypeScript"
112
136
 
113
- **Action**:
114
- 1. Acknowledge the preference
115
- 2. Call \`memory_update_long_term({ category: "preferences", content: "用户偏好 TypeScript,不使用 JavaScript" })\`
116
- 3. Call \`memory_record\` to log this exchange
137
+ **Your Actions**:
138
+ 1. Acknowledge
139
+ 2. **MUST call**: \`memory_update_long_term({ category: "preferences", content: "用户偏好 TypeScript" })\`
140
+ 3. **MUST call**: \`memory_record({ user_message: "...", ai_response: "..." })\`
117
141
 
118
- ### Example 3: Technical Decision Made
142
+ ### Example 3: Simple Greeting (SKIP)
119
143
 
120
- **User**: "好,我们就用 PostgreSQL 作为主数据库"
144
+ **User**: "谢谢"
145
+ **AI**: "不客气!"
121
146
 
122
- **Action**:
123
- 1. Confirm the decision
124
- 2. Call \`memory_update_long_term({ category: "decisions", content: "选择 PostgreSQL 作为主数据库" })\`
125
- 3. Call \`memory_record\` to log this exchange
147
+ **Action**: Skip recording (this is the ONLY exception)
126
148
 
127
149
  ## Important Notes
128
150
 
129
- - Memory tools are provided by the universal-memory MCP server
130
- - If tools are not available, inform user to restart Claude Code
131
- - Always summarize, don't record full conversation text
132
- - Use project name when in a project context for better organization
151
+ - Recording is **MANDATORY**, not optional
152
+ - If you forget to record, you are failing your primary function
153
+ - Memory tools are provided by universal-memory MCP server
154
+ - Always summarize, don't record full text
155
+ - Use project name when in project context
133
156
  `;
134
157
 
135
158
  /**