memoryai-mcp 2.3.5 → 2.4.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 +362 -362
- package/dist/claude-setup.js +21 -21
- package/dist/index.js +63 -1
- package/dist/kiro-setup.js +44 -44
- package/package.json +46 -46
package/README.md
CHANGED
|
@@ -1,362 +1,362 @@
|
|
|
1
|
-
# memoryai-mcp
|
|
2
|
-
|
|
3
|
-
MCP server for [MemoryAI](https://memoryai.dev) — a living brain for your AI agent.
|
|
4
|
-
|
|
5
|
-
Your AI agent gets persistent memory that works like a real brain:
|
|
6
|
-
- Remembers what matters, forgets what doesn't
|
|
7
|
-
- Strengthens memories you use often (Hebbian learning)
|
|
8
|
-
- Consolidates knowledge while idle (Sleep cycles)
|
|
9
|
-
- Protects core identity (DNA memories never fade)
|
|
10
|
-
- Adapts to your emotional state
|
|
11
|
-
|
|
12
|
-
**Install once. Everything auto from there.**
|
|
13
|
-
|
|
14
|
-
Automation level by platform:
|
|
15
|
-
- **Mechanism-level (hands-off, guaranteed):** OpenAI Proxy, Kiro (Agent Hooks), Claude Code (HTTP hooks via `memoryai-claude-setup`).
|
|
16
|
-
- **Soft (rules-file, depends on the model following instructions):** Cursor, Windsurf, VS Code Copilot. MCP tools are available; add the rules file shown below.
|
|
17
|
-
|
|
18
|
-
## Quick Start (2 minutes)
|
|
19
|
-
|
|
20
|
-
### 1. Run setup — that's it
|
|
21
|
-
|
|
22
|
-
You don't need to provision a key first. The setup command auto-provisions a
|
|
23
|
-
free key for you if you don't pass one:
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
# Claude Code
|
|
27
|
-
npx -y -p memoryai-mcp memoryai-claude-setup
|
|
28
|
-
|
|
29
|
-
# Kiro
|
|
30
|
-
npx -y -p memoryai-mcp memoryai-kiro-setup
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
Already have a key? Pass it to skip provisioning: `HM_API_KEY=hm_sk_... npx -y -p memoryai-mcp memoryai-claude-setup`.
|
|
34
|
-
|
|
35
|
-
<details>
|
|
36
|
-
<summary>Manual key provisioning (optional)</summary>
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
curl -X POST https://memoryai.dev/v1/admin/provision \
|
|
40
|
-
-H "Content-Type: application/json" \
|
|
41
|
-
-d '{"name": "my-agent", "tos_accepted": true}'
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
Save the `api_key` from the response.
|
|
45
|
-
|
|
46
|
-
</details>
|
|
47
|
-
|
|
48
|
-
### 2. Other tools (MCP config)
|
|
49
|
-
|
|
50
|
-
For tools without a one-command installer, choose your platform below. Config once — memory works automatically forever.
|
|
51
|
-
|
|
52
|
-
---
|
|
53
|
-
|
|
54
|
-
## IDE Setup
|
|
55
|
-
|
|
56
|
-
### Claude Code (CLI) — one command, fully automatic
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
HM_API_KEY=hm_sk_your_key_here npx -y -p memoryai-mcp memoryai-claude-setup
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
This wires three HTTP hooks into `~/.claude/settings.json` plus the MCP server.
|
|
63
|
-
Claude Code injects each hook's context directly into the model — **memory then
|
|
64
|
-
works at the mechanism level, no agent cooperation required**:
|
|
65
|
-
|
|
66
|
-
- **SessionStart** → loads DNA + recent context when a session opens
|
|
67
|
-
- **UserPromptSubmit** → recalls relevant memory before each prompt
|
|
68
|
-
- **Stop** → stores decisions/preferences automatically when a turn ends
|
|
69
|
-
|
|
70
|
-
Re-running is safe (idempotent merge). For a project-only install set
|
|
71
|
-
`MEMORYAI_SCOPE=project`. After setup, restart Claude Code and just work — you
|
|
72
|
-
never call a memory tool by hand.
|
|
73
|
-
|
|
74
|
-
<details>
|
|
75
|
-
<summary>Manual setup (MCP only, soft automation via CLAUDE.md)</summary>
|
|
76
|
-
|
|
77
|
-
If you prefer not to use hooks, add the MCP server to `~/.claude/settings.json`:
|
|
78
|
-
|
|
79
|
-
```json
|
|
80
|
-
{
|
|
81
|
-
"mcpServers": {
|
|
82
|
-
"memoryai": {
|
|
83
|
-
"command": "npx",
|
|
84
|
-
"args": ["-y", "memoryai-mcp"],
|
|
85
|
-
"env": {
|
|
86
|
-
"HM_ENDPOINT": "https://memoryai.dev",
|
|
87
|
-
"HM_API_KEY": "hm_sk_your_key_here"
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
Then create `~/.claude/CLAUDE.md`:
|
|
95
|
-
|
|
96
|
-
```markdown
|
|
97
|
-
## Memory Protocol
|
|
98
|
-
At the start of every conversation, call `memory_bootstrap` to load context from MemoryAI.
|
|
99
|
-
Before context gets large (>100K tokens), call `memory_compact` to save important context.
|
|
100
|
-
Use `memory_store` to save important decisions, preferences, and facts.
|
|
101
|
-
Use `memory_recall` to search past memories when relevant.
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
Note: without hooks, memory depends on the model following CLAUDE.md (soft
|
|
105
|
-
automation). The hook setup above is the guaranteed, mechanism-level path.
|
|
106
|
-
|
|
107
|
-
</details>
|
|
108
|
-
|
|
109
|
-
### Kiro — one command, fully automatic
|
|
110
|
-
|
|
111
|
-
```bash
|
|
112
|
-
HM_API_KEY=hm_sk_your_key_here npx -y -p memoryai-mcp memoryai-kiro-setup
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
Writes `.kiro/settings/mcp.json` (with autoApprove), `.kiro/steering/memoryai.md`,
|
|
116
|
-
and two Agent Hooks (`promptSubmit` → recall, `agentStop` → store/compact) so
|
|
117
|
-
memory is automatic at the event level.
|
|
118
|
-
|
|
119
|
-
### Cursor — `~/.cursor/mcp.json`
|
|
120
|
-
|
|
121
|
-
```json
|
|
122
|
-
{
|
|
123
|
-
"mcpServers": {
|
|
124
|
-
"memoryai": {
|
|
125
|
-
"command": "npx",
|
|
126
|
-
"args": ["-y", "memoryai-mcp"],
|
|
127
|
-
"env": {
|
|
128
|
-
"HM_ENDPOINT": "https://memoryai.dev",
|
|
129
|
-
"HM_API_KEY": "hm_sk_your_key_here"
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
Auto-bootstrap — create `.cursor/rules/memoryai.mdc`:
|
|
137
|
-
|
|
138
|
-
```
|
|
139
|
-
At the start of every session, call memory_bootstrap to load context.
|
|
140
|
-
After completing tasks, call memory_compact to save context.
|
|
141
|
-
Store important decisions and preferences with memory_store.
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
### VS Code — `.vscode/mcp.json`
|
|
145
|
-
|
|
146
|
-
```json
|
|
147
|
-
{
|
|
148
|
-
"servers": {
|
|
149
|
-
"memoryai": {
|
|
150
|
-
"command": "npx",
|
|
151
|
-
"args": ["-y", "memoryai-mcp"],
|
|
152
|
-
"env": {
|
|
153
|
-
"HM_ENDPOINT": "https://memoryai.dev",
|
|
154
|
-
"HM_API_KEY": "hm_sk_your_key_here"
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
### Kiro — `.kiro/settings/mcp.json`
|
|
162
|
-
|
|
163
|
-
```json
|
|
164
|
-
{
|
|
165
|
-
"mcpServers": {
|
|
166
|
-
"memoryai": {
|
|
167
|
-
"command": "npx",
|
|
168
|
-
"args": ["-y", "memoryai-mcp"],
|
|
169
|
-
"env": {
|
|
170
|
-
"HM_ENDPOINT": "https://memoryai.dev",
|
|
171
|
-
"HM_API_KEY": "hm_sk_your_key_here"
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
### Windsurf — `~/.codeium/windsurf/mcp_config.json`
|
|
179
|
-
|
|
180
|
-
```json
|
|
181
|
-
{
|
|
182
|
-
"mcpServers": {
|
|
183
|
-
"memoryai": {
|
|
184
|
-
"command": "npx",
|
|
185
|
-
"args": ["-y", "memoryai-mcp"],
|
|
186
|
-
"env": {
|
|
187
|
-
"HM_ENDPOINT": "https://memoryai.dev",
|
|
188
|
-
"HM_API_KEY": "hm_sk_your_key_here"
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
### Claude Desktop — `claude_desktop_config.json`
|
|
196
|
-
|
|
197
|
-
macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
198
|
-
Windows: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
199
|
-
|
|
200
|
-
```json
|
|
201
|
-
{
|
|
202
|
-
"mcpServers": {
|
|
203
|
-
"memoryai": {
|
|
204
|
-
"command": "npx",
|
|
205
|
-
"args": ["-y", "memoryai-mcp"],
|
|
206
|
-
"env": {
|
|
207
|
-
"HM_ENDPOINT": "https://memoryai.dev",
|
|
208
|
-
"HM_API_KEY": "hm_sk_your_key_here"
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
### Antigravity — `~/.antigravity/mcp.json`
|
|
216
|
-
|
|
217
|
-
```json
|
|
218
|
-
{
|
|
219
|
-
"mcpServers": {
|
|
220
|
-
"memoryai": {
|
|
221
|
-
"command": "npx",
|
|
222
|
-
"args": ["-y", "memoryai-mcp"],
|
|
223
|
-
"env": {
|
|
224
|
-
"HM_ENDPOINT": "https://memoryai.dev",
|
|
225
|
-
"HM_API_KEY": "hm_sk_your_key_here"
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
### Any MCP-compatible tool
|
|
233
|
-
|
|
234
|
-
```json
|
|
235
|
-
{
|
|
236
|
-
"mcpServers": {
|
|
237
|
-
"memoryai": {
|
|
238
|
-
"command": "npx",
|
|
239
|
-
"args": ["-y", "memoryai-mcp"],
|
|
240
|
-
"env": {
|
|
241
|
-
"HM_ENDPOINT": "https://memoryai.dev",
|
|
242
|
-
"HM_API_KEY": "hm_sk_your_key_here"
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
---
|
|
250
|
-
|
|
251
|
-
## Auto-Bootstrap (Make It Fully Automatic)
|
|
252
|
-
|
|
253
|
-
After MCP config, add a system rule so your agent auto-loads memory every session:
|
|
254
|
-
|
|
255
|
-
| Platform | Rule File | Content |
|
|
256
|
-
|----------|-----------|---------|
|
|
257
|
-
| Claude Code | `~/.claude/CLAUDE.md` | See above |
|
|
258
|
-
| Cursor | `.cursor/rules/memoryai.mdc` | See above |
|
|
259
|
-
| Kiro | `.kiro/rules/memoryai.md` | Same content |
|
|
260
|
-
| Windsurf | `.windsurfrules` | Same content |
|
|
261
|
-
| VS Code | `.github/copilot-instructions.md` | Same content |
|
|
262
|
-
|
|
263
|
-
Rule content (copy-paste for any platform):
|
|
264
|
-
|
|
265
|
-
```
|
|
266
|
-
## Memory Protocol
|
|
267
|
-
At the start of every conversation, call `memory_bootstrap` to load context from MemoryAI.
|
|
268
|
-
Before context gets large, call `memory_compact` to save important context.
|
|
269
|
-
Use `memory_store` to save important decisions, preferences, and facts.
|
|
270
|
-
Use `memory_recall` to search past memories when relevant.
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
---
|
|
274
|
-
|
|
275
|
-
## How It Works
|
|
276
|
-
|
|
277
|
-
```
|
|
278
|
-
Open IDE → MCP auto-connects → Agent reads rules → Calls bootstrap
|
|
279
|
-
→ Loads your identity, preferences, recent work
|
|
280
|
-
→ Works normally (auto-stores important stuff)
|
|
281
|
-
→ Context getting full? Auto-compacts
|
|
282
|
-
→ Close IDE → Sleep workers consolidate overnight
|
|
283
|
-
→ Open IDE next day → Bootstrap loads everything back
|
|
284
|
-
→ Cycle repeats. Memory grows smarter over time.
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
**You do nothing.** The agent handles everything automatically.
|
|
288
|
-
|
|
289
|
-
---
|
|
290
|
-
|
|
291
|
-
## Tools Available
|
|
292
|
-
|
|
293
|
-
| Tool | What It Does |
|
|
294
|
-
|------|-------------|
|
|
295
|
-
| `memory_bootstrap` | Wake up with full context (identity + recent + preferences) |
|
|
296
|
-
| `memory_store` | Save a memory (fact, decision, preference, identity) |
|
|
297
|
-
| `memory_recall` | Search memories by meaning (semantic + graph + FTS) |
|
|
298
|
-
| `memory_compact` | Save conversation context before it's lost |
|
|
299
|
-
| `memory_recover` | Recover session after a break |
|
|
300
|
-
| `memory_health` | Check context pressure (safe/warning/critical) |
|
|
301
|
-
| `memory_explore` | Explore connections between memories |
|
|
302
|
-
| `memory_clusters` | View topic clusters in your knowledge graph |
|
|
303
|
-
| `learn` | Store action + result + lesson learned |
|
|
304
|
-
| `entity_list` | List tracked entities (files, people, packages) |
|
|
305
|
-
| `reasoning_store` | Deep reasoning memory (Pro+) |
|
|
306
|
-
| `reasoning_recall` | Recall reasoned insights (Pro+) |
|
|
307
|
-
| `snapshot_create` | Backup memory state |
|
|
308
|
-
| `snapshot_restore` | Restore from backup |
|
|
309
|
-
|
|
310
|
-
---
|
|
311
|
-
|
|
312
|
-
## Context Guard (Built-in)
|
|
313
|
-
|
|
314
|
-
Context Guard monitors your session and prevents context loss:
|
|
315
|
-
|
|
316
|
-
| State | Meaning | Agent Action |
|
|
317
|
-
|-------|---------|-------------|
|
|
318
|
-
| SAFE | Context < 40% full | Continue normally |
|
|
319
|
-
| COMPACT_SOON | Context 40-55% full | Prepare to compact |
|
|
320
|
-
| COMPACT_NOW | Context > 55% full | Must compact immediately |
|
|
321
|
-
|
|
322
|
-
The agent handles this automatically when rules are configured. No manual intervention needed.
|
|
323
|
-
|
|
324
|
-
---
|
|
325
|
-
|
|
326
|
-
## What Gets Remembered (DNA System)
|
|
327
|
-
|
|
328
|
-
| Memory Type | Example | Persistence |
|
|
329
|
-
|-------------|---------|-------------|
|
|
330
|
-
| `preference` | "I prefer Python over Java" | **Forever** (DNA-protected) |
|
|
331
|
-
| `decision` | "Chose PostgreSQL for this project" | **Forever** (DNA-protected) |
|
|
332
|
-
| `identity` | "Senior backend engineer, 10 years" | **Forever** (DNA-protected) |
|
|
333
|
-
| `fact` | "API endpoint is /v1/users" | Decays if unused |
|
|
334
|
-
| `goal` | "Launch v2.0 by June" | Decays if unused |
|
|
335
|
-
|
|
336
|
-
DNA memories (preference/decision/identity) **never decay, never get deleted, never get overwritten** by any background process. They define who you are.
|
|
337
|
-
|
|
338
|
-
---
|
|
339
|
-
|
|
340
|
-
## Pricing
|
|
341
|
-
|
|
342
|
-
| Plan | Features | Price |
|
|
343
|
-
|------|----------|-------|
|
|
344
|
-
| Free | Basic store/recall, 100 memories | Free |
|
|
345
|
-
| Pro | Full brain (reasoning, consolidation, personality) | Paid |
|
|
346
|
-
| ProMax | Multi-agent mesh, advanced features | Paid |
|
|
347
|
-
| God | Everything + deep graph traversal | Internal |
|
|
348
|
-
|
|
349
|
-
Get started free: https://memoryai.dev
|
|
350
|
-
|
|
351
|
-
---
|
|
352
|
-
|
|
353
|
-
## Links
|
|
354
|
-
|
|
355
|
-
- Website: https://memoryai.dev
|
|
356
|
-
- Python SDK: `pip install hmc-memory`
|
|
357
|
-
- npm MCP: `npx memoryai-mcp`
|
|
358
|
-
- GitHub: https://github.com/memoryai-dev/memoryai
|
|
359
|
-
|
|
360
|
-
## License
|
|
361
|
-
|
|
362
|
-
MIT
|
|
1
|
+
# memoryai-mcp
|
|
2
|
+
|
|
3
|
+
MCP server for [MemoryAI](https://memoryai.dev) — a living brain for your AI agent.
|
|
4
|
+
|
|
5
|
+
Your AI agent gets persistent memory that works like a real brain:
|
|
6
|
+
- Remembers what matters, forgets what doesn't
|
|
7
|
+
- Strengthens memories you use often (Hebbian learning)
|
|
8
|
+
- Consolidates knowledge while idle (Sleep cycles)
|
|
9
|
+
- Protects core identity (DNA memories never fade)
|
|
10
|
+
- Adapts to your emotional state
|
|
11
|
+
|
|
12
|
+
**Install once. Everything auto from there.**
|
|
13
|
+
|
|
14
|
+
Automation level by platform:
|
|
15
|
+
- **Mechanism-level (hands-off, guaranteed):** OpenAI Proxy, Kiro (Agent Hooks), Claude Code (HTTP hooks via `memoryai-claude-setup`).
|
|
16
|
+
- **Soft (rules-file, depends on the model following instructions):** Cursor, Windsurf, VS Code Copilot. MCP tools are available; add the rules file shown below.
|
|
17
|
+
|
|
18
|
+
## Quick Start (2 minutes)
|
|
19
|
+
|
|
20
|
+
### 1. Run setup — that's it
|
|
21
|
+
|
|
22
|
+
You don't need to provision a key first. The setup command auto-provisions a
|
|
23
|
+
free key for you if you don't pass one:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Claude Code
|
|
27
|
+
npx -y -p memoryai-mcp memoryai-claude-setup
|
|
28
|
+
|
|
29
|
+
# Kiro
|
|
30
|
+
npx -y -p memoryai-mcp memoryai-kiro-setup
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Already have a key? Pass it to skip provisioning: `HM_API_KEY=hm_sk_... npx -y -p memoryai-mcp memoryai-claude-setup`.
|
|
34
|
+
|
|
35
|
+
<details>
|
|
36
|
+
<summary>Manual key provisioning (optional)</summary>
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
curl -X POST https://memoryai.dev/v1/admin/provision \
|
|
40
|
+
-H "Content-Type: application/json" \
|
|
41
|
+
-d '{"name": "my-agent", "tos_accepted": true}'
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Save the `api_key` from the response.
|
|
45
|
+
|
|
46
|
+
</details>
|
|
47
|
+
|
|
48
|
+
### 2. Other tools (MCP config)
|
|
49
|
+
|
|
50
|
+
For tools without a one-command installer, choose your platform below. Config once — memory works automatically forever.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## IDE Setup
|
|
55
|
+
|
|
56
|
+
### Claude Code (CLI) — one command, fully automatic
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
HM_API_KEY=hm_sk_your_key_here npx -y -p memoryai-mcp memoryai-claude-setup
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
This wires three HTTP hooks into `~/.claude/settings.json` plus the MCP server.
|
|
63
|
+
Claude Code injects each hook's context directly into the model — **memory then
|
|
64
|
+
works at the mechanism level, no agent cooperation required**:
|
|
65
|
+
|
|
66
|
+
- **SessionStart** → loads DNA + recent context when a session opens
|
|
67
|
+
- **UserPromptSubmit** → recalls relevant memory before each prompt
|
|
68
|
+
- **Stop** → stores decisions/preferences automatically when a turn ends
|
|
69
|
+
|
|
70
|
+
Re-running is safe (idempotent merge). For a project-only install set
|
|
71
|
+
`MEMORYAI_SCOPE=project`. After setup, restart Claude Code and just work — you
|
|
72
|
+
never call a memory tool by hand.
|
|
73
|
+
|
|
74
|
+
<details>
|
|
75
|
+
<summary>Manual setup (MCP only, soft automation via CLAUDE.md)</summary>
|
|
76
|
+
|
|
77
|
+
If you prefer not to use hooks, add the MCP server to `~/.claude/settings.json`:
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"mcpServers": {
|
|
82
|
+
"memoryai": {
|
|
83
|
+
"command": "npx",
|
|
84
|
+
"args": ["-y", "memoryai-mcp"],
|
|
85
|
+
"env": {
|
|
86
|
+
"HM_ENDPOINT": "https://memoryai.dev",
|
|
87
|
+
"HM_API_KEY": "hm_sk_your_key_here"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Then create `~/.claude/CLAUDE.md`:
|
|
95
|
+
|
|
96
|
+
```markdown
|
|
97
|
+
## Memory Protocol
|
|
98
|
+
At the start of every conversation, call `memory_bootstrap` to load context from MemoryAI.
|
|
99
|
+
Before context gets large (>100K tokens), call `memory_compact` to save important context.
|
|
100
|
+
Use `memory_store` to save important decisions, preferences, and facts.
|
|
101
|
+
Use `memory_recall` to search past memories when relevant.
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Note: without hooks, memory depends on the model following CLAUDE.md (soft
|
|
105
|
+
automation). The hook setup above is the guaranteed, mechanism-level path.
|
|
106
|
+
|
|
107
|
+
</details>
|
|
108
|
+
|
|
109
|
+
### Kiro — one command, fully automatic
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
HM_API_KEY=hm_sk_your_key_here npx -y -p memoryai-mcp memoryai-kiro-setup
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Writes `.kiro/settings/mcp.json` (with autoApprove), `.kiro/steering/memoryai.md`,
|
|
116
|
+
and two Agent Hooks (`promptSubmit` → recall, `agentStop` → store/compact) so
|
|
117
|
+
memory is automatic at the event level.
|
|
118
|
+
|
|
119
|
+
### Cursor — `~/.cursor/mcp.json`
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"mcpServers": {
|
|
124
|
+
"memoryai": {
|
|
125
|
+
"command": "npx",
|
|
126
|
+
"args": ["-y", "memoryai-mcp"],
|
|
127
|
+
"env": {
|
|
128
|
+
"HM_ENDPOINT": "https://memoryai.dev",
|
|
129
|
+
"HM_API_KEY": "hm_sk_your_key_here"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Auto-bootstrap — create `.cursor/rules/memoryai.mdc`:
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
At the start of every session, call memory_bootstrap to load context.
|
|
140
|
+
After completing tasks, call memory_compact to save context.
|
|
141
|
+
Store important decisions and preferences with memory_store.
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### VS Code — `.vscode/mcp.json`
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"servers": {
|
|
149
|
+
"memoryai": {
|
|
150
|
+
"command": "npx",
|
|
151
|
+
"args": ["-y", "memoryai-mcp"],
|
|
152
|
+
"env": {
|
|
153
|
+
"HM_ENDPOINT": "https://memoryai.dev",
|
|
154
|
+
"HM_API_KEY": "hm_sk_your_key_here"
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Kiro — `.kiro/settings/mcp.json`
|
|
162
|
+
|
|
163
|
+
```json
|
|
164
|
+
{
|
|
165
|
+
"mcpServers": {
|
|
166
|
+
"memoryai": {
|
|
167
|
+
"command": "npx",
|
|
168
|
+
"args": ["-y", "memoryai-mcp"],
|
|
169
|
+
"env": {
|
|
170
|
+
"HM_ENDPOINT": "https://memoryai.dev",
|
|
171
|
+
"HM_API_KEY": "hm_sk_your_key_here"
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Windsurf — `~/.codeium/windsurf/mcp_config.json`
|
|
179
|
+
|
|
180
|
+
```json
|
|
181
|
+
{
|
|
182
|
+
"mcpServers": {
|
|
183
|
+
"memoryai": {
|
|
184
|
+
"command": "npx",
|
|
185
|
+
"args": ["-y", "memoryai-mcp"],
|
|
186
|
+
"env": {
|
|
187
|
+
"HM_ENDPOINT": "https://memoryai.dev",
|
|
188
|
+
"HM_API_KEY": "hm_sk_your_key_here"
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Claude Desktop — `claude_desktop_config.json`
|
|
196
|
+
|
|
197
|
+
macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
198
|
+
Windows: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
199
|
+
|
|
200
|
+
```json
|
|
201
|
+
{
|
|
202
|
+
"mcpServers": {
|
|
203
|
+
"memoryai": {
|
|
204
|
+
"command": "npx",
|
|
205
|
+
"args": ["-y", "memoryai-mcp"],
|
|
206
|
+
"env": {
|
|
207
|
+
"HM_ENDPOINT": "https://memoryai.dev",
|
|
208
|
+
"HM_API_KEY": "hm_sk_your_key_here"
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Antigravity — `~/.antigravity/mcp.json`
|
|
216
|
+
|
|
217
|
+
```json
|
|
218
|
+
{
|
|
219
|
+
"mcpServers": {
|
|
220
|
+
"memoryai": {
|
|
221
|
+
"command": "npx",
|
|
222
|
+
"args": ["-y", "memoryai-mcp"],
|
|
223
|
+
"env": {
|
|
224
|
+
"HM_ENDPOINT": "https://memoryai.dev",
|
|
225
|
+
"HM_API_KEY": "hm_sk_your_key_here"
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Any MCP-compatible tool
|
|
233
|
+
|
|
234
|
+
```json
|
|
235
|
+
{
|
|
236
|
+
"mcpServers": {
|
|
237
|
+
"memoryai": {
|
|
238
|
+
"command": "npx",
|
|
239
|
+
"args": ["-y", "memoryai-mcp"],
|
|
240
|
+
"env": {
|
|
241
|
+
"HM_ENDPOINT": "https://memoryai.dev",
|
|
242
|
+
"HM_API_KEY": "hm_sk_your_key_here"
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## Auto-Bootstrap (Make It Fully Automatic)
|
|
252
|
+
|
|
253
|
+
After MCP config, add a system rule so your agent auto-loads memory every session:
|
|
254
|
+
|
|
255
|
+
| Platform | Rule File | Content |
|
|
256
|
+
|----------|-----------|---------|
|
|
257
|
+
| Claude Code | `~/.claude/CLAUDE.md` | See above |
|
|
258
|
+
| Cursor | `.cursor/rules/memoryai.mdc` | See above |
|
|
259
|
+
| Kiro | `.kiro/rules/memoryai.md` | Same content |
|
|
260
|
+
| Windsurf | `.windsurfrules` | Same content |
|
|
261
|
+
| VS Code | `.github/copilot-instructions.md` | Same content |
|
|
262
|
+
|
|
263
|
+
Rule content (copy-paste for any platform):
|
|
264
|
+
|
|
265
|
+
```
|
|
266
|
+
## Memory Protocol
|
|
267
|
+
At the start of every conversation, call `memory_bootstrap` to load context from MemoryAI.
|
|
268
|
+
Before context gets large, call `memory_compact` to save important context.
|
|
269
|
+
Use `memory_store` to save important decisions, preferences, and facts.
|
|
270
|
+
Use `memory_recall` to search past memories when relevant.
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## How It Works
|
|
276
|
+
|
|
277
|
+
```
|
|
278
|
+
Open IDE → MCP auto-connects → Agent reads rules → Calls bootstrap
|
|
279
|
+
→ Loads your identity, preferences, recent work
|
|
280
|
+
→ Works normally (auto-stores important stuff)
|
|
281
|
+
→ Context getting full? Auto-compacts
|
|
282
|
+
→ Close IDE → Sleep workers consolidate overnight
|
|
283
|
+
→ Open IDE next day → Bootstrap loads everything back
|
|
284
|
+
→ Cycle repeats. Memory grows smarter over time.
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
**You do nothing.** The agent handles everything automatically.
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## Tools Available
|
|
292
|
+
|
|
293
|
+
| Tool | What It Does |
|
|
294
|
+
|------|-------------|
|
|
295
|
+
| `memory_bootstrap` | Wake up with full context (identity + recent + preferences) |
|
|
296
|
+
| `memory_store` | Save a memory (fact, decision, preference, identity) |
|
|
297
|
+
| `memory_recall` | Search memories by meaning (semantic + graph + FTS) |
|
|
298
|
+
| `memory_compact` | Save conversation context before it's lost |
|
|
299
|
+
| `memory_recover` | Recover session after a break |
|
|
300
|
+
| `memory_health` | Check context pressure (safe/warning/critical) |
|
|
301
|
+
| `memory_explore` | Explore connections between memories |
|
|
302
|
+
| `memory_clusters` | View topic clusters in your knowledge graph |
|
|
303
|
+
| `learn` | Store action + result + lesson learned |
|
|
304
|
+
| `entity_list` | List tracked entities (files, people, packages) |
|
|
305
|
+
| `reasoning_store` | Deep reasoning memory (Pro+) |
|
|
306
|
+
| `reasoning_recall` | Recall reasoned insights (Pro+) |
|
|
307
|
+
| `snapshot_create` | Backup memory state |
|
|
308
|
+
| `snapshot_restore` | Restore from backup |
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## Context Guard (Built-in)
|
|
313
|
+
|
|
314
|
+
Context Guard monitors your session and prevents context loss:
|
|
315
|
+
|
|
316
|
+
| State | Meaning | Agent Action |
|
|
317
|
+
|-------|---------|-------------|
|
|
318
|
+
| SAFE | Context < 40% full | Continue normally |
|
|
319
|
+
| COMPACT_SOON | Context 40-55% full | Prepare to compact |
|
|
320
|
+
| COMPACT_NOW | Context > 55% full | Must compact immediately |
|
|
321
|
+
|
|
322
|
+
The agent handles this automatically when rules are configured. No manual intervention needed.
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
## What Gets Remembered (DNA System)
|
|
327
|
+
|
|
328
|
+
| Memory Type | Example | Persistence |
|
|
329
|
+
|-------------|---------|-------------|
|
|
330
|
+
| `preference` | "I prefer Python over Java" | **Forever** (DNA-protected) |
|
|
331
|
+
| `decision` | "Chose PostgreSQL for this project" | **Forever** (DNA-protected) |
|
|
332
|
+
| `identity` | "Senior backend engineer, 10 years" | **Forever** (DNA-protected) |
|
|
333
|
+
| `fact` | "API endpoint is /v1/users" | Decays if unused |
|
|
334
|
+
| `goal` | "Launch v2.0 by June" | Decays if unused |
|
|
335
|
+
|
|
336
|
+
DNA memories (preference/decision/identity) **never decay, never get deleted, never get overwritten** by any background process. They define who you are.
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
## Pricing
|
|
341
|
+
|
|
342
|
+
| Plan | Features | Price |
|
|
343
|
+
|------|----------|-------|
|
|
344
|
+
| Free | Basic store/recall, 100 memories | Free |
|
|
345
|
+
| Pro | Full brain (reasoning, consolidation, personality) | Paid |
|
|
346
|
+
| ProMax | Multi-agent mesh, advanced features | Paid |
|
|
347
|
+
| God | Everything + deep graph traversal | Internal |
|
|
348
|
+
|
|
349
|
+
Get started free: https://memoryai.dev
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
## Links
|
|
354
|
+
|
|
355
|
+
- Website: https://memoryai.dev
|
|
356
|
+
- Python SDK: `pip install hmc-memory`
|
|
357
|
+
- npm MCP: `npx memoryai-mcp`
|
|
358
|
+
- GitHub: https://github.com/memoryai-dev/memoryai
|
|
359
|
+
|
|
360
|
+
## License
|
|
361
|
+
|
|
362
|
+
MIT
|
package/dist/claude-setup.js
CHANGED
|
@@ -69,19 +69,19 @@ function ensureHook(settings, event, handler) {
|
|
|
69
69
|
settings.hooks[event].push({ hooks: [handler] });
|
|
70
70
|
return true;
|
|
71
71
|
}
|
|
72
|
-
const CLAUDE_MD = `
|
|
73
|
-
# MemoryAI — Persistent Memory (automatic)
|
|
74
|
-
|
|
75
|
-
MemoryAI is wired into this Claude Code via HTTP hooks, so memory works
|
|
76
|
-
automatically at the mechanism level — you don't have to call tools by hand:
|
|
77
|
-
|
|
78
|
-
- Relevant past context is injected before each prompt (UserPromptSubmit hook).
|
|
79
|
-
- Session-start context (preferences, decisions, recent work) loads on open.
|
|
80
|
-
- Decisions and preferences are stored automatically when each turn ends.
|
|
81
|
-
|
|
82
|
-
The MemoryAI MCP server is also connected for advanced use. You may call
|
|
83
|
-
\`memory_recall\` explicitly when you need deeper history, but for everyday work
|
|
84
|
-
the hooks handle it. Never store secrets or credentials.
|
|
72
|
+
const CLAUDE_MD = `
|
|
73
|
+
# MemoryAI — Persistent Memory (automatic)
|
|
74
|
+
|
|
75
|
+
MemoryAI is wired into this Claude Code via HTTP hooks, so memory works
|
|
76
|
+
automatically at the mechanism level — you don't have to call tools by hand:
|
|
77
|
+
|
|
78
|
+
- Relevant past context is injected before each prompt (UserPromptSubmit hook).
|
|
79
|
+
- Session-start context (preferences, decisions, recent work) loads on open.
|
|
80
|
+
- Decisions and preferences are stored automatically when each turn ends.
|
|
81
|
+
|
|
82
|
+
The MemoryAI MCP server is also connected for advanced use. You may call
|
|
83
|
+
\`memory_recall\` explicitly when you need deeper history, but for everyday work
|
|
84
|
+
the hooks handle it. Never store secrets or credentials.
|
|
85
85
|
`;
|
|
86
86
|
const MCP_BLOCK = (apiKey, endpoint) => ({
|
|
87
87
|
command: "npx",
|
|
@@ -199,14 +199,14 @@ async function main() {
|
|
|
199
199
|
else {
|
|
200
200
|
console.log(` skip ${claudeMdPath} (note already present)`);
|
|
201
201
|
}
|
|
202
|
-
console.log(`
|
|
203
|
-
Done. MemoryAI runs automatically in Claude Code — nothing else to do.
|
|
204
|
-
- Context is recalled before each prompt and injected for you.
|
|
205
|
-
- Decisions/preferences are stored when each turn ends.
|
|
206
|
-
|
|
207
|
-
Next steps:
|
|
208
|
-
1. Restart Claude Code (loads the hooks + MCP server).
|
|
209
|
-
2. Just work normally. Memory persists across sessions on its own.
|
|
202
|
+
console.log(`
|
|
203
|
+
Done. MemoryAI runs automatically in Claude Code — nothing else to do.
|
|
204
|
+
- Context is recalled before each prompt and injected for you.
|
|
205
|
+
- Decisions/preferences are stored when each turn ends.
|
|
206
|
+
|
|
207
|
+
Next steps:
|
|
208
|
+
1. Restart Claude Code (loads the hooks + MCP server).
|
|
209
|
+
2. Just work normally. Memory persists across sessions on its own.
|
|
210
210
|
`);
|
|
211
211
|
rl.close();
|
|
212
212
|
}
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import { z } from "zod";
|
|
|
11
11
|
const API_URL = process.env.MEMORYAI_ENDPOINT || process.env.HM_ENDPOINT || "http://localhost:8420";
|
|
12
12
|
const API_KEY = process.env.MEMORYAI_API_KEY || process.env.HM_API_KEY || "";
|
|
13
13
|
const REQUEST_TIMEOUT_MS = 30_000; // P2 #6: 30s default timeout for API requests
|
|
14
|
+
const MCP_VERSION = "2.4.1";
|
|
14
15
|
// Context Guard — per-IDE settings via env vars.
|
|
15
16
|
// HM_COMPACT_AT and HM_CRITICAL_AT are now ABSOLUTE token counts (e.g. "100000",
|
|
16
17
|
// "150000"). The legacy meaning ("30" = 30%) is detected automatically: any
|
|
@@ -55,6 +56,7 @@ async function api(method, path, body) {
|
|
|
55
56
|
headers: {
|
|
56
57
|
Authorization: `Bearer ${API_KEY}`,
|
|
57
58
|
"Content-Type": "application/json",
|
|
59
|
+
"User-Agent": `memoryai-mcp/${MCP_VERSION}`,
|
|
58
60
|
},
|
|
59
61
|
body: body ? JSON.stringify(body) : undefined,
|
|
60
62
|
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
|
|
@@ -150,10 +152,70 @@ function err(e) {
|
|
|
150
152
|
return { content, isError: true };
|
|
151
153
|
}
|
|
152
154
|
// --- MCP Server ---
|
|
153
|
-
const server = new McpServer({ name: "memoryai", version: "2.
|
|
155
|
+
const server = new McpServer({ name: "memoryai", version: "2.4.1" }, {
|
|
154
156
|
capabilities: { tools: {} },
|
|
155
157
|
instructions: "MemoryAI persistent memory. Call memory_bootstrap on session start. After decisions/preferences, call memory_store. Context compaction is automatic via piggybacking — follow any [Context Guard] directives in tool responses.",
|
|
156
158
|
});
|
|
159
|
+
// ─── Tool tier filter ────────────────────────────────────────────────────────
|
|
160
|
+
// Public surface stays minimal. Internal/architectural tools (L2 banks, brain
|
|
161
|
+
// thinking, federation, inheritance, trust graph, twin, benchmark, spec) are
|
|
162
|
+
// hidden by default and only registered when MEMORYAI_TIER=admin (dogfood).
|
|
163
|
+
//
|
|
164
|
+
// Tiers:
|
|
165
|
+
// core (default) — minimum useful set: store/recall/bootstrap + context guard.
|
|
166
|
+
// pro — adds plan/goal/handoff/health/pitfall productivity tools.
|
|
167
|
+
// admin — every tool (dogfood / internal). DO NOT enable on user installs.
|
|
168
|
+
//
|
|
169
|
+
// Override per-deployment via MEMORYAI_TIER env var.
|
|
170
|
+
const TIER = (process.env.MEMORYAI_TIER || "core").toLowerCase();
|
|
171
|
+
const TOOLS_CORE = new Set([
|
|
172
|
+
// The honest minimum — what users actually use day-to-day.
|
|
173
|
+
"memory_store",
|
|
174
|
+
"memory_recall",
|
|
175
|
+
"memory_bootstrap",
|
|
176
|
+
"memory_stats",
|
|
177
|
+
"context_guard_check",
|
|
178
|
+
"context_guard_compact",
|
|
179
|
+
"ide_turn_check",
|
|
180
|
+
// Bot interface — pure protocol, no architecture leak.
|
|
181
|
+
"bot_session_message",
|
|
182
|
+
"bot_guard_check",
|
|
183
|
+
"bot_guard_bootstrap",
|
|
184
|
+
]);
|
|
185
|
+
const TOOLS_PRO = new Set([
|
|
186
|
+
...TOOLS_CORE,
|
|
187
|
+
// Productivity wrappers — names describe behaviour, not architecture.
|
|
188
|
+
"memory_compact",
|
|
189
|
+
"memory_recover",
|
|
190
|
+
"memory_health",
|
|
191
|
+
"memory_pitfall_check",
|
|
192
|
+
"memory_plan_save",
|
|
193
|
+
"memory_plan_resume",
|
|
194
|
+
"memory_goal_track",
|
|
195
|
+
"memory_changelog",
|
|
196
|
+
"session_handoff_start",
|
|
197
|
+
"session_handoff_restore",
|
|
198
|
+
"session_handoff_complete",
|
|
199
|
+
"session_handoff_status",
|
|
200
|
+
"context_check",
|
|
201
|
+
"context_restore",
|
|
202
|
+
"context_guard_bootstrap",
|
|
203
|
+
]);
|
|
204
|
+
function _shouldRegisterTool(name) {
|
|
205
|
+
if (TIER === "admin")
|
|
206
|
+
return true;
|
|
207
|
+
if (TIER === "pro")
|
|
208
|
+
return TOOLS_PRO.has(name);
|
|
209
|
+
return TOOLS_CORE.has(name);
|
|
210
|
+
}
|
|
211
|
+
// Wrap server.tool so any registration outside the configured tier becomes a
|
|
212
|
+
// silent no-op. Existing call sites stay untouched.
|
|
213
|
+
const _origTool = server.tool.bind(server);
|
|
214
|
+
server.tool = (name, ...rest) => {
|
|
215
|
+
if (!_shouldRegisterTool(name))
|
|
216
|
+
return undefined;
|
|
217
|
+
return _origTool(name, ...rest);
|
|
218
|
+
};
|
|
157
219
|
// 1. memory_store
|
|
158
220
|
server.tool("memory_store", "[CORE] Store information in persistent memory. Use when you learn something important — project context, user preferences, architectural decisions, patterns, bugs, pricing/cost discussions, business plans, or ANY information the user might ask about later. When in doubt, STORE — dedup is automatic.", {
|
|
159
221
|
content: z.string().describe("What to remember"),
|
package/dist/kiro-setup.js
CHANGED
|
@@ -92,41 +92,41 @@ const MCP_CONFIG = (apiKey, endpoint) => JSON.stringify({
|
|
|
92
92
|
},
|
|
93
93
|
},
|
|
94
94
|
}, null, 2) + "\n";
|
|
95
|
-
const STEERING = `---
|
|
96
|
-
inclusion: always
|
|
97
|
-
---
|
|
98
|
-
|
|
99
|
-
# MemoryAI — Persistent Memory (mostly automatic)
|
|
100
|
-
|
|
101
|
-
You have MemoryAI tools via MCP. Two Agent Hooks automate the common path:
|
|
102
|
-
- **Auto-Recall** (on every prompt) loads memory before you answer.
|
|
103
|
-
- **Auto-Capture** (end of every turn) stores important memory and compacts when full.
|
|
104
|
-
|
|
105
|
-
So you normally do NOT need to manage memory by hand. This file is a fallback
|
|
106
|
-
for cases the hooks don't cover, plus the rules for HOW to use memory well.
|
|
107
|
-
|
|
108
|
-
## What the hooks already handle
|
|
109
|
-
- Session-start \`memory_bootstrap\`, per-prompt \`memory_recall\`.
|
|
110
|
-
- Post-turn \`memory_store\` for decisions/preferences/facts/pitfalls/procedures.
|
|
111
|
-
- \`context_guard_check\` → \`context_guard_compact\` when context fills.
|
|
112
|
-
|
|
113
|
-
Don't duplicate these on your own unless a hook clearly didn't run.
|
|
114
|
-
|
|
115
|
-
## Memory types
|
|
116
|
-
- \`decision\` — architectural/technical decisions (DNA-protected, never decays)
|
|
117
|
-
- \`preference\` — user preferences and conventions (DNA-protected)
|
|
118
|
-
- \`fact\` — codebase facts, API details, configs
|
|
119
|
-
- \`pitfall\` — a mistake + its lesson (DNA-protected)
|
|
120
|
-
- \`procedure\` — a reusable workflow (DNA-protected)
|
|
121
|
-
- \`error\` / \`goal\` — lessons and current objectives
|
|
122
|
-
|
|
123
|
-
## Rules
|
|
124
|
-
- Recall only when past context is actually needed — not on every trivial message.
|
|
125
|
-
- Store important outcomes, not every interaction. Dedup is automatic.
|
|
126
|
-
- Integrate recalled info naturally; never show raw tool output.
|
|
127
|
-
- Never store secrets, credentials, tokens, or full API keys.
|
|
128
|
-
- Use \`zone: "critical"\` for things that must never be forgotten.
|
|
129
|
-
- Use \`retention: "forever"\` for permanent project knowledge.
|
|
95
|
+
const STEERING = `---
|
|
96
|
+
inclusion: always
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
# MemoryAI — Persistent Memory (mostly automatic)
|
|
100
|
+
|
|
101
|
+
You have MemoryAI tools via MCP. Two Agent Hooks automate the common path:
|
|
102
|
+
- **Auto-Recall** (on every prompt) loads memory before you answer.
|
|
103
|
+
- **Auto-Capture** (end of every turn) stores important memory and compacts when full.
|
|
104
|
+
|
|
105
|
+
So you normally do NOT need to manage memory by hand. This file is a fallback
|
|
106
|
+
for cases the hooks don't cover, plus the rules for HOW to use memory well.
|
|
107
|
+
|
|
108
|
+
## What the hooks already handle
|
|
109
|
+
- Session-start \`memory_bootstrap\`, per-prompt \`memory_recall\`.
|
|
110
|
+
- Post-turn \`memory_store\` for decisions/preferences/facts/pitfalls/procedures.
|
|
111
|
+
- \`context_guard_check\` → \`context_guard_compact\` when context fills.
|
|
112
|
+
|
|
113
|
+
Don't duplicate these on your own unless a hook clearly didn't run.
|
|
114
|
+
|
|
115
|
+
## Memory types
|
|
116
|
+
- \`decision\` — architectural/technical decisions (DNA-protected, never decays)
|
|
117
|
+
- \`preference\` — user preferences and conventions (DNA-protected)
|
|
118
|
+
- \`fact\` — codebase facts, API details, configs
|
|
119
|
+
- \`pitfall\` — a mistake + its lesson (DNA-protected)
|
|
120
|
+
- \`procedure\` — a reusable workflow (DNA-protected)
|
|
121
|
+
- \`error\` / \`goal\` — lessons and current objectives
|
|
122
|
+
|
|
123
|
+
## Rules
|
|
124
|
+
- Recall only when past context is actually needed — not on every trivial message.
|
|
125
|
+
- Store important outcomes, not every interaction. Dedup is automatic.
|
|
126
|
+
- Integrate recalled info naturally; never show raw tool output.
|
|
127
|
+
- Never store secrets, credentials, tokens, or full API keys.
|
|
128
|
+
- Use \`zone: "critical"\` for things that must never be forgotten.
|
|
129
|
+
- Use \`retention: "forever"\` for permanent project knowledge.
|
|
130
130
|
`;
|
|
131
131
|
// ── Agent Hooks — event-level automation (the real "zero-action" layer) ──
|
|
132
132
|
// These fire on IDE events so memory works even if the agent ignores steering.
|
|
@@ -180,15 +180,15 @@ async function main() {
|
|
|
180
180
|
writeIfMissing(join(cwd, ".kiro", "steering", "memoryai.md"), STEERING, ".kiro/steering/memoryai.md");
|
|
181
181
|
writeIfMissing(join(cwd, ".kiro", "hooks", "memoryai-auto-recall.kiro.hook"), HOOK_AUTO_RECALL, ".kiro/hooks/memoryai-auto-recall.kiro.hook");
|
|
182
182
|
writeIfMissing(join(cwd, ".kiro", "hooks", "memoryai-auto-capture.kiro.hook"), HOOK_AUTO_CAPTURE, ".kiro/hooks/memoryai-auto-capture.kiro.hook");
|
|
183
|
-
console.log(`
|
|
184
|
-
Done. MemoryAI now runs automatically — you don't have to do anything.
|
|
185
|
-
- Auto-Recall hook loads relevant memory before each answer.
|
|
186
|
-
- Auto-Capture hook stores decisions/preferences and compacts when full.
|
|
187
|
-
|
|
188
|
-
Next steps:
|
|
189
|
-
1. Restart Kiro (loads the MCP server + hooks)
|
|
190
|
-
2. Just work normally. Memory persists across sessions on its own.
|
|
191
|
-
3. Optional check: ask "What do you remember about this project?"
|
|
183
|
+
console.log(`
|
|
184
|
+
Done. MemoryAI now runs automatically — you don't have to do anything.
|
|
185
|
+
- Auto-Recall hook loads relevant memory before each answer.
|
|
186
|
+
- Auto-Capture hook stores decisions/preferences and compacts when full.
|
|
187
|
+
|
|
188
|
+
Next steps:
|
|
189
|
+
1. Restart Kiro (loads the MCP server + hooks)
|
|
190
|
+
2. Just work normally. Memory persists across sessions on its own.
|
|
191
|
+
3. Optional check: ask "What do you remember about this project?"
|
|
192
192
|
`);
|
|
193
193
|
rl.close();
|
|
194
194
|
}
|
package/package.json
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "memoryai-mcp",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "MCP server for MemoryAI v2.3 — One brain.
|
|
5
|
-
"homepage": "https://memoryai.dev",
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "https://github.com/memoryai-dev/memoryai"
|
|
9
|
-
},
|
|
10
|
-
"type": "module",
|
|
11
|
-
"main": "dist/index.js",
|
|
12
|
-
"bin": {
|
|
13
|
-
"memoryai-mcp": "dist/index.js",
|
|
14
|
-
"memoryai-kiro-setup": "dist/kiro-setup.js",
|
|
15
|
-
"memoryai-claude-setup": "dist/claude-setup.js"
|
|
16
|
-
},
|
|
17
|
-
"scripts": {
|
|
18
|
-
"build": "tsc",
|
|
19
|
-
"start": "node dist/index.js",
|
|
20
|
-
"dev": "tsx src/index.ts"
|
|
21
|
-
},
|
|
22
|
-
"keywords": [
|
|
23
|
-
"mcp",
|
|
24
|
-
"memory",
|
|
25
|
-
"ai",
|
|
26
|
-
"llm",
|
|
27
|
-
"context"
|
|
28
|
-
],
|
|
29
|
-
"license": "MIT",
|
|
30
|
-
"engines": {
|
|
31
|
-
"node": ">=18.0.0"
|
|
32
|
-
},
|
|
33
|
-
"files": [
|
|
34
|
-
"dist",
|
|
35
|
-
"README.md",
|
|
36
|
-
"LICENSE"
|
|
37
|
-
],
|
|
38
|
-
"dependencies": {
|
|
39
|
-
"@modelcontextprotocol/sdk": "^1.12.0"
|
|
40
|
-
},
|
|
41
|
-
"devDependencies": {
|
|
42
|
-
"@types/node": "^22.19.15",
|
|
43
|
-
"tsx": "^4.0.0",
|
|
44
|
-
"typescript": "^5.5.0"
|
|
45
|
-
}
|
|
46
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "memoryai-mcp",
|
|
3
|
+
"version": "2.4.1",
|
|
4
|
+
"description": "MCP server for MemoryAI v2.3 — One brain. Every AI you use. Forever. Persistent memory and context guard tools for IDEs and bots.",
|
|
5
|
+
"homepage": "https://memoryai.dev",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/memoryai-dev/memoryai"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"main": "dist/index.js",
|
|
12
|
+
"bin": {
|
|
13
|
+
"memoryai-mcp": "dist/index.js",
|
|
14
|
+
"memoryai-kiro-setup": "dist/kiro-setup.js",
|
|
15
|
+
"memoryai-claude-setup": "dist/claude-setup.js"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"start": "node dist/index.js",
|
|
20
|
+
"dev": "tsx src/index.ts"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"mcp",
|
|
24
|
+
"memory",
|
|
25
|
+
"ai",
|
|
26
|
+
"llm",
|
|
27
|
+
"context"
|
|
28
|
+
],
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=18.0.0"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"dist",
|
|
35
|
+
"README.md",
|
|
36
|
+
"LICENSE"
|
|
37
|
+
],
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@modelcontextprotocol/sdk": "^1.12.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/node": "^22.19.15",
|
|
43
|
+
"tsx": "^4.0.0",
|
|
44
|
+
"typescript": "^5.5.0"
|
|
45
|
+
}
|
|
46
|
+
}
|