@j0hanz/memdb 1.2.4 → 1.2.5

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.
@@ -1,74 +1,32 @@
1
1
  # memdb MCP Server — AI Usage Instructions
2
2
 
3
- Use this server to store and retrieve persistent memories (facts, decisions, lessons, plans) in a local SQLite database. Prefer using these tools over "remembering" state in chat.
3
+ Use this server to store and retrieve persistent memories (facts, decisions, lessons, plans) in a local SQLite database. Prefer these tools over "remembering" state in chat.
4
4
 
5
5
  ## Operating Rules
6
6
 
7
7
  - Use tools only when the operation changes or verifies memory state.
8
8
  - Prefer `search_memories` or `memory_stats` to establish state before updating/deleting.
9
9
  - Operate by stable identifiers (`hash`, 32-char hex MD5) rather than ambiguous user text.
10
- - Batch operations when available: use `store_memories` / `delete_memories` for multiple items.
11
- - Treat destructive tools (`delete_memory`, `delete_memories`, `delete_relationship`) as destructive: require explicit user confirmation unless the user clearly requested deletion.
12
- - Keep operations atomic; if a request is vague, ask a clarifying question before calling tools.
10
+ - Treat destructive tools (`delete_memory`, `delete_memories`, `delete_relationship`) as destructive: require explicit user confirmation unless clearly requested.
11
+ - Keep operations atomic; if a request is vague, ask a clarifying question.
12
+ - **Client UX:** Tool lists can be cached (reset via "MCP: Reset Cached Tools"). Only run MCP servers from trusted sources.
13
13
 
14
- ### Quick Decision Rules
14
+ ### Strategies
15
15
 
16
- - If unsure what exists → call `search_memories` or `memory_stats` before mutation.
17
- - If the user provides multiple items use `store_memories` (up to 50) or `delete_memories`.
18
- - If the user asks to delete without a specific target → list matches first and ask which hash.
19
- - Prefer `update_memory` over delete+recreate when correcting an existing memory.
16
+ - **Discovery:** Start with `search_memories` or `memory_stats` to discover what exists. Use `recall` (depth 1-2) when you need connected context.
17
+ - **Action:** Use `store_memories` for batch imports (up to 50). Prefer `update_memory` to fix content (preserves history/context better than delete+create). Always confirm explicit deletions with the user.
20
18
 
21
- ### Client UX Notes (VS Code)
19
+ ## Data Model
22
20
 
23
- - Non-read-only tools typically require user confirmation.
24
- - Tool lists can be cached; users can reset via **MCP: Reset Cached Tools**.
25
- - Only run MCP servers from trusted sources.
21
+ - **Memory:**
22
+ - `hash` (MD5 of content, primary key)
23
+ - `content` (1–100k chars)
24
+ - `tags` (1–100 items, no whitespace, `kebab-case`)
25
+ - `importance` (0–10, 10=critical)
26
+ - `memory_type` (`general`, `fact`, `plan`, `decision`, `reflection`, `lesson`, `error`, `gradient`)
27
+ - **Relationship:** Directed edge (`from_hash` → `to_hash`) with a typed label (`relation_type`).
26
28
 
27
- ## Data Model (What the Server Operates On)
28
-
29
- ### Memory
30
-
31
- | Field | Type | Description |
32
- | ------------- | ---------- | --------------------------------------------------------------------------- |
33
- | `id` | int | Auto-generated row ID |
34
- | `hash` | string | MD5 of content (32 hex chars); primary lookup key |
35
- | `content` | string | 1–100,000 chars; the stored text |
36
- | `tags` | string[] | 1–100 tags; no whitespace; max 50 chars each; use `kebab-case` |
37
- | `importance` | int (0–10) | Priority (0=low, 10=critical); higher surfaces first in search |
38
- | `memory_type` | enum | `general` `fact` `plan` `decision` `reflection` `lesson` `error` `gradient` |
39
- | `created_at` | ISO 8601 | Creation timestamp |
40
- | `accessed_at` | ISO 8601 | Last access timestamp |
41
-
42
- ### Relationship (Knowledge Graph Edge)
43
-
44
- | Field | Type | Description |
45
- | --------------- | ------ | ----------------------------------------------------------------- |
46
- | `from_hash` | string | Source memory hash |
47
- | `to_hash` | string | Target memory hash |
48
- | `relation_type` | string | No whitespace; e.g., `depends_on`, `causes`, `part_of`, `follows` |
49
-
50
- ### Constraints
51
-
52
- - Changing content changes the hash (content-addressed).
53
- - Tags and `relation_type` must not contain whitespace.
54
- - Search query: 1–1,000 chars, max 50 terms.
55
- - Batch limits: 50 items for `store_memories` and `delete_memories`.
56
-
57
- ## Response Shape
58
-
59
- All tools return JSON in `structuredContent`:
60
-
61
- ```json
62
- // Success
63
- { "ok": true, "result": { ... } }
64
-
65
- // Error
66
- { "ok": false, "error": { "code": "E_CODE", "message": "..." } }
67
- ```
68
-
69
- Error responses also set `isError: true` on the top-level tool result.
70
-
71
- ## Workflows (Recommended)
29
+ ## Workflows
72
30
 
73
31
  ### 1) Capture a new memory
74
32
 
@@ -88,16 +46,15 @@ Error responses also set `isError: true` on the top-level tool result.
88
46
  2. Use `create_relationship` to link durable facts/decisions in the knowledge graph.
89
47
  3. Use `delete_memory` / `delete_memories` only with explicit user intent.
90
48
 
91
- ## Tools (What to Use, When)
49
+ ## Tools
92
50
 
93
51
  ### store_memory
94
52
 
95
53
  Store a single memory with tags.
96
54
 
97
55
  - **Use when:** You have one clear item to persist.
98
- - **Args:** `content` (req), `tags` (req, 1–100), `importance` (opt, 0–10), `memory_type` (opt).
56
+ - **Args:** `content` (req), `tags` (req), `importance` (opt), `memory_type` (opt).
99
57
  - **Returns:** `{ id, hash, isNew }`.
100
- - **Notes:** Idempotent (same content → same hash, `isNew: false`).
101
58
 
102
59
  ### store_memories
103
60
 
@@ -106,16 +63,15 @@ Batch store up to 50 memories.
106
63
  - **Use when:** Importing multiple items at once.
107
64
  - **Args:** `items[]` (each has `content`, `tags`, optional `importance`, `memory_type`).
108
65
  - **Returns:** `{ results, succeeded, failed }`.
109
- - **Notes:** Partial success supported.
110
66
 
111
67
  ### search_memories
112
68
 
113
69
  Full-text + tag search.
114
70
 
115
71
  - **Use when:** Discovering what exists; start here before mutating.
116
- - **Args:** `query` (1–1,000 chars, max 50 terms).
72
+ - **Args:** `query` (1–1,000 chars).
117
73
  - **Returns:** Array of `Memory` + `relevance`, up to 100 results.
118
- - **Notes:** Read-only. Content matches rank higher than tag matches.
74
+ - **Notes:** Content matches rank higher than tag matches.
119
75
 
120
76
  ### get_memory
121
77
 
@@ -123,17 +79,16 @@ Fetch a single memory by hash.
123
79
 
124
80
  - **Use when:** You need verbatim content after search identified a hash.
125
81
  - **Args:** `hash` (32 hex chars).
126
- - **Returns:** `Memory`.
127
- - **Notes:** Read-only. Returns `E_NOT_FOUND` if missing.
82
+ - **Returns:** `Memory` object.
128
83
 
129
84
  ### update_memory
130
85
 
131
86
  Update content (and optionally replace tags).
132
87
 
133
88
  - **Use when:** Correcting or refining an existing memory.
134
- - **Args:** `hash` (req), `content` (req), `tags` (opt, replaces all if provided).
89
+ - **Args:** `hash` (req), `content` (req), `tags` (opt, replaces all).
135
90
  - **Returns:** `{ updated: true, oldHash, newHash }`.
136
- - **Notes:** Hash changes because content changes. Idempotent.
91
+ - **Notes:** Hash changes because content changes (content-addressed).
137
92
 
138
93
  ### delete_memory
139
94
 
@@ -141,8 +96,7 @@ Delete a single memory by hash.
141
96
 
142
97
  - **Use when:** User explicitly wants removal.
143
98
  - **Args:** `hash`.
144
- - **Returns:** `{ deleted: true }` or `E_NOT_FOUND`.
145
- - **Notes:** Destructive. Confirm before calling.
99
+ - **Returns:** `{ deleted: true }` or error if not found.
146
100
 
147
101
  ### delete_memories
148
102
 
@@ -151,7 +105,6 @@ Batch delete up to 50 hashes.
151
105
  - **Use when:** Bulk cleanup with explicit user intent.
152
106
  - **Args:** `hashes[]`.
153
107
  - **Returns:** `{ results, succeeded, failed }`.
154
- - **Notes:** Destructive. Partial success supported.
155
108
 
156
109
  ### create_relationship
157
110
 
@@ -160,7 +113,6 @@ Link two memories with a typed edge.
160
113
  - **Use when:** Building a knowledge graph (e.g., `depends_on`, `causes`, `part_of`).
161
114
  - **Args:** `from_hash`, `to_hash`, `relation_type`.
162
115
  - **Returns:** `{ id, isNew }`.
163
- - **Notes:** Idempotent.
164
116
 
165
117
  ### get_relationships
166
118
 
@@ -168,8 +120,7 @@ List relationships for a memory.
168
120
 
169
121
  - **Use when:** Inspecting local graph around one memory.
170
122
  - **Args:** `hash`, `direction` (opt: `outgoing`, `incoming`, `both`; default `both`).
171
- - **Returns:** Array of `Relationship`.
172
- - **Notes:** Read-only.
123
+ - **Returns:** Array of `Relationship` objects.
173
124
 
174
125
  ### delete_relationship
175
126
 
@@ -177,8 +128,7 @@ Remove a relationship edge.
177
128
 
178
129
  - **Use when:** An edge is wrong or outdated.
179
130
  - **Args:** `from_hash`, `to_hash`, `relation_type`.
180
- - **Returns:** `{ deleted: true }` or `E_NOT_FOUND`.
181
- - **Notes:** Destructive. Confirm before calling.
131
+ - **Returns:** `{ deleted: true }`.
182
132
 
183
133
  ### recall
184
134
 
@@ -187,7 +137,6 @@ Search + traverse relationships to return a connected cluster.
187
137
  - **Use when:** You need broader context beyond keyword matches.
188
138
  - **Args:** `query`, `depth` (opt, 0–3; default 1).
189
139
  - **Returns:** `{ memories, relationships, depth }`.
190
- - **Notes:** Read-only. Use `depth: 1–2` by default.
191
140
 
192
141
  ### memory_stats
193
142
 
@@ -196,9 +145,29 @@ Database statistics and health.
196
145
  - **Use when:** Sanity-checking the DB or reporting status.
197
146
  - **Args:** (none).
198
147
  - **Returns:** `{ memoryCount, tagCount, oldestMemory, newestMemory }`.
199
- - **Notes:** Read-only.
200
148
 
201
- ## Safety
149
+ ## Response Shape
150
+
151
+ Success: `{ "ok": true, "result": { ... } }`
152
+ Error: `{ "ok": false, "error": { "code": "E_...", "message": "..." } }`
153
+
154
+ ### Common Errors
155
+
156
+ | Code | Meaning | Resolution |
157
+ | --------------- | ----------------------------- | ----------------------------------- |
158
+ | `E_NOT_FOUND` | Memory/Relationship not found | Check hash or create new |
159
+ | `E_INVALID_ARG` | Validation failed (zod) | Check limits, types, and formatting |
160
+ | `E_TOOL_ERROR` | Internal/Db error | Check server logs or stats |
161
+
162
+ ## Limits
163
+
164
+ - **Content Size:** 100,000 chars per memory
165
+ - **Tag Count:** 100 per memory
166
+ - **Tag Length:** 50 chars (no whitespace)
167
+ - **Batch Size:** 50 items (store/delete)
168
+ - **Query Length:** 1,000 chars
169
+
170
+ ## Security
202
171
 
203
- - **Do not store secrets** (API keys, passwords, tokens, private keys) in memory content.
204
- - **Confirm destructive operations** (`delete_memory`, `delete_memories`, `delete_relationship`) before calling.
172
+ - **No Secrets:** Do not store API keys, passwords, or PII in memory content.
173
+ - **Confirmation:** Always ask before using `delete_*` tools unless the user explicitly requested it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@j0hanz/memdb",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "mcpName": "io.github.j0hanz/memdb",
5
5
  "description": "A SQLite-backed MCP memory server with local workspace storage.",
6
6
  "type": "module",