@crewx/memory 0.1.5 → 0.1.7
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/SKILL.md +325 -261
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +11 -8
- package/dist/cli.js.map +1 -1
- package/dist/src/engine.d.ts +5 -0
- package/dist/src/engine.d.ts.map +1 -1
- package/dist/src/engine.js +48 -4
- package/dist/src/engine.js.map +1 -1
- package/dist/src/types.d.ts +4 -0
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +12 -2
package/SKILL.md
CHANGED
|
@@ -1,37 +1,39 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: memory
|
|
3
|
-
description:
|
|
4
|
-
|
|
2
|
+
name: crewx/memory
|
|
3
|
+
description: Markdown + frontmatter-based long-term memory skill. Scalable memory management with drill-down structure.
|
|
4
|
+
metadata:
|
|
5
|
+
version: 0.10.0
|
|
6
|
+
built-in: true
|
|
5
7
|
---
|
|
6
8
|
|
|
7
9
|
# Memory V2 Skill
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
A long-term memory management skill based on markdown + frontmatter.
|
|
10
12
|
|
|
11
|
-
##
|
|
13
|
+
## Installation
|
|
12
14
|
|
|
13
|
-
`packages/built-in/memory
|
|
15
|
+
Included in `packages/built-in/memory`, used via the `npx memory` command.
|
|
14
16
|
|
|
15
|
-
##
|
|
17
|
+
## Features
|
|
16
18
|
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
- **Git
|
|
19
|
+
- **Frontmatter**: Separated metadata (date, category, tags, topic)
|
|
20
|
+
- **Drill-down**: index.md -> entries/ structure
|
|
21
|
+
- **Readability**: Human-readable and editable
|
|
22
|
+
- **Git-friendly**: Version control with individual files
|
|
21
23
|
|
|
22
|
-
##
|
|
24
|
+
## Command Aliases
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
Shorthand aliases for frequently used commands. They work identically to the original commands.
|
|
25
27
|
|
|
26
|
-
| Alias |
|
|
27
|
-
|
|
28
|
-
| `read` | `get` |
|
|
29
|
-
| `list` | `index` |
|
|
30
|
-
| `rm` | `delete` |
|
|
31
|
-
| `ls` | `recent` |
|
|
28
|
+
| Alias | Actual Command | Description |
|
|
29
|
+
|-------|---------------|-------------|
|
|
30
|
+
| `read` | `get` | View memory details |
|
|
31
|
+
| `list` | `index` | View full index |
|
|
32
|
+
| `rm` | `delete` | Delete memory |
|
|
33
|
+
| `ls` | `recent` | View recent memories |
|
|
32
34
|
|
|
33
35
|
```bash
|
|
34
|
-
#
|
|
36
|
+
# The following two commands are identical
|
|
35
37
|
npx memory get agent_id ABC123
|
|
36
38
|
npx memory read agent_id ABC123
|
|
37
39
|
|
|
@@ -39,215 +41,215 @@ npx memory index agent_id
|
|
|
39
41
|
npx memory list agent_id
|
|
40
42
|
```
|
|
41
43
|
|
|
42
|
-
##
|
|
44
|
+
## Directory Structure
|
|
43
45
|
|
|
44
46
|
```
|
|
45
47
|
memory/
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
+-- {agent_id}/
|
|
49
|
+
+-- summary.md # Overall summary (topic-based sections + entries/ links)
|
|
50
|
+
+-- graph.json # Graph data
|
|
51
|
+
+-- entries/ # Individual memories
|
|
52
|
+
+-- {id}.md # Filename = nanoid (e.g., QOSIOs.md)
|
|
51
53
|
```
|
|
52
54
|
|
|
53
|
-
>
|
|
55
|
+
> **Filename rule**: `{id}.md` (e.g., `QOSIOs.md`). Since metadata like date and title is in the frontmatter, it is not duplicated in the filename. This saves tokens and prevents filename collisions.
|
|
54
56
|
|
|
55
|
-
##
|
|
57
|
+
## Commands
|
|
56
58
|
|
|
57
|
-
###
|
|
59
|
+
### Save
|
|
58
60
|
|
|
59
61
|
```bash
|
|
60
|
-
npx memory save <agent_id> "<summary>" [category] [--topic=xxx] [--tags=a,b,c] [--body="
|
|
62
|
+
npx memory save <agent_id> "<summary>" [category] [--topic=xxx] [--tags=a,b,c] [--body="detailed content"]
|
|
61
63
|
```
|
|
62
64
|
|
|
63
|
-
|
|
64
|
-
|
|
|
65
|
-
|
|
66
|
-
| `category` |
|
|
67
|
-
| `--topic` |
|
|
68
|
-
| `--tags` |
|
|
69
|
-
| `--body` |
|
|
65
|
+
**Options:**
|
|
66
|
+
| Option | Description | Example |
|
|
67
|
+
|--------|-------------|---------|
|
|
68
|
+
| `category` | Memory classification | decision, task, project, schedule, context, preference, general |
|
|
69
|
+
| `--topic` | Topic group | `--topic=crewx-strategy` |
|
|
70
|
+
| `--tags` | Tags (comma-separated) | `--tags=gemini,pricing` |
|
|
71
|
+
| `--body` | **Detailed content (recommended!)** | `--body="background, rationale, decisions, etc."` |
|
|
70
72
|
|
|
71
|
-
|
|
72
|
-
- `--body
|
|
73
|
-
-
|
|
74
|
-
-
|
|
73
|
+
**WARNING: Important: Always use the `--body` option!**
|
|
74
|
+
- Without `--body`, only a placeholder is saved
|
|
75
|
+
- Makes it difficult to understand context later
|
|
76
|
+
- At least 1-2 sentences of detailed content is recommended
|
|
75
77
|
|
|
76
|
-
|
|
78
|
+
**Examples:**
|
|
77
79
|
```bash
|
|
78
|
-
#
|
|
79
|
-
npx memory save cto "Gemini 3.0 Flash
|
|
80
|
+
# [BAD] Bad example - no details
|
|
81
|
+
npx memory save cto "Gemini 3.0 Flash moment" decision --topic=crewx-strategy
|
|
80
82
|
|
|
81
|
-
#
|
|
82
|
-
npx memory save cto "Gemini 3.0 Flash
|
|
83
|
+
# [GOOD] Good example - details included
|
|
84
|
+
npx memory save cto "Gemini 3.0 Flash moment - strategic turning point" decision --topic=crewx-strategy --tags=gemini,pricing --body="SWE-bench 78% dominates Claude 3.5 Sonnet (49%). Price is 1/6. CrewX strategy validated -- orchestration is the key moat."
|
|
83
85
|
```
|
|
84
86
|
|
|
85
|
-
###
|
|
87
|
+
### Index Query
|
|
86
88
|
|
|
87
89
|
```bash
|
|
88
|
-
npx memory index <agent_id> #
|
|
89
|
-
npx memory index <agent_id> --recent #
|
|
90
|
-
npx memory index <agent_id> --full #
|
|
90
|
+
npx memory index <agent_id> # Medium-term memory (topic summaries only)
|
|
91
|
+
npx memory index <agent_id> --recent # Recent entry list
|
|
92
|
+
npx memory index <agent_id> --full # Full view
|
|
91
93
|
```
|
|
92
94
|
|
|
93
|
-
|
|
95
|
+
**Drill-down pattern:** `index` -> drill into needed topic with `topic` -> drill into needed entry with `get`
|
|
94
96
|
|
|
95
|
-
###
|
|
97
|
+
### Topic Drill-down
|
|
96
98
|
|
|
97
99
|
```bash
|
|
98
100
|
npx memory topic <agent_id> <topic_name>
|
|
99
101
|
```
|
|
100
102
|
|
|
101
|
-
###
|
|
103
|
+
### Recent Memories
|
|
102
104
|
|
|
103
105
|
```bash
|
|
104
106
|
npx memory recent <agent_id> [days=30]
|
|
105
107
|
```
|
|
106
108
|
|
|
107
|
-
###
|
|
109
|
+
### Keyword Search (Fast)
|
|
108
110
|
|
|
109
111
|
```bash
|
|
110
112
|
npx memory find <agent_id> "<keyword>"
|
|
111
113
|
```
|
|
112
114
|
|
|
113
|
-
|
|
115
|
+
Grep-based string matching. Fast and free.
|
|
114
116
|
|
|
115
|
-
###
|
|
117
|
+
### Semantic Search (AI)
|
|
116
118
|
|
|
117
119
|
```bash
|
|
118
|
-
npx memory search <agent_id> "
|
|
120
|
+
npx memory search <agent_id> "<query>"
|
|
119
121
|
```
|
|
120
122
|
|
|
121
|
-
**Gemini 2.0 Flash
|
|
123
|
+
Semantic search powered by **Gemini 2.0 Flash**. Understands synonyms and context.
|
|
122
124
|
|
|
123
|
-
-
|
|
124
|
-
-
|
|
125
|
+
- Uses internal `@memory_searcher` agent (crewx.yaml)
|
|
126
|
+
- Cost: ~$0.015/1M tokens (virtually free)
|
|
125
127
|
|
|
126
|
-
|
|
128
|
+
**Examples:**
|
|
127
129
|
```bash
|
|
128
|
-
#
|
|
129
|
-
npx memory find crewx_dev_lead "
|
|
130
|
+
# Keyword search (fast)
|
|
131
|
+
npx memory find crewx_dev_lead "agent"
|
|
130
132
|
|
|
131
|
-
#
|
|
132
|
-
npx memory search crewx_dev_lead "
|
|
133
|
+
# Semantic search (AI)
|
|
134
|
+
npx memory search crewx_dev_lead "things to watch out for when assigning tasks"
|
|
133
135
|
```
|
|
134
136
|
|
|
135
|
-
###
|
|
137
|
+
### Detail View (Drill-down)
|
|
136
138
|
|
|
137
139
|
```bash
|
|
138
140
|
npx memory get <agent_id> <memory_id>
|
|
139
141
|
```
|
|
140
142
|
|
|
141
|
-
###
|
|
143
|
+
### Update Memory
|
|
142
144
|
|
|
143
145
|
```bash
|
|
144
|
-
npx memory update <agent_id> <memory_id> [
|
|
146
|
+
npx memory update <agent_id> <memory_id> [options]
|
|
145
147
|
```
|
|
146
148
|
|
|
147
|
-
|
|
148
|
-
|
|
|
149
|
-
|
|
150
|
-
| `--summary` |
|
|
151
|
-
| `--body` |
|
|
152
|
-
| `--topic` |
|
|
153
|
-
| `--category` |
|
|
154
|
-
| `--tags` |
|
|
149
|
+
**Options:**
|
|
150
|
+
| Option | Description |
|
|
151
|
+
|--------|-------------|
|
|
152
|
+
| `--summary` | Update summary |
|
|
153
|
+
| `--body` | Update detailed content |
|
|
154
|
+
| `--topic` | Change topic |
|
|
155
|
+
| `--category` | Change category |
|
|
156
|
+
| `--tags` | Change tags (comma-separated) |
|
|
155
157
|
|
|
156
|
-
|
|
158
|
+
**Examples:**
|
|
157
159
|
```bash
|
|
158
|
-
#
|
|
159
|
-
npx memory update cto VkY9X6 --summary="
|
|
160
|
+
# Update summary and detailed content
|
|
161
|
+
npx memory update cto VkY9X6 --summary="Updated summary" --body="Updated detailed content"
|
|
160
162
|
|
|
161
|
-
#
|
|
163
|
+
# Change topic only
|
|
162
164
|
npx memory update cto VkY9X6 --topic=new-topic
|
|
163
165
|
```
|
|
164
166
|
|
|
165
|
-
###
|
|
167
|
+
### Delete Memory
|
|
166
168
|
|
|
167
169
|
```bash
|
|
168
170
|
npx memory delete <agent_id> <memory_id> [--force]
|
|
169
171
|
```
|
|
170
172
|
|
|
171
|
-
- `--force
|
|
172
|
-
- `--force
|
|
173
|
+
- Without `--force`, only a confirmation message is displayed
|
|
174
|
+
- With `--force`, actually deletes the memory
|
|
173
175
|
|
|
174
|
-
|
|
176
|
+
**Examples:**
|
|
175
177
|
```bash
|
|
176
|
-
#
|
|
178
|
+
# Deletion confirmation
|
|
177
179
|
npx memory delete cto VkY9X6
|
|
178
180
|
|
|
179
|
-
#
|
|
181
|
+
# Actual deletion
|
|
180
182
|
npx memory delete cto VkY9X6 --force
|
|
181
183
|
```
|
|
182
184
|
|
|
183
|
-
###
|
|
185
|
+
### Merge Memories
|
|
184
186
|
|
|
185
187
|
```bash
|
|
186
|
-
npx memory merge <agent_id> <memory_id1> <memory_id2> [--summary="
|
|
188
|
+
npx memory merge <agent_id> <memory_id1> <memory_id2> [--summary="merge summary"]
|
|
187
189
|
```
|
|
188
190
|
|
|
189
|
-
-
|
|
190
|
-
-
|
|
191
|
-
-
|
|
192
|
-
-
|
|
191
|
+
- Merges two memories into one
|
|
192
|
+
- Both original memories are deleted
|
|
193
|
+
- Tags are combined (duplicates removed)
|
|
194
|
+
- `merged_from` metadata is added to the merged file
|
|
193
195
|
|
|
194
|
-
|
|
196
|
+
**Examples:**
|
|
195
197
|
```bash
|
|
196
|
-
#
|
|
198
|
+
# Merge two memories
|
|
197
199
|
npx memory merge cto abc123 def456
|
|
198
200
|
|
|
199
|
-
#
|
|
200
|
-
npx memory merge cto abc123 def456 --summary="VLM
|
|
201
|
+
# Merge with custom summary
|
|
202
|
+
npx memory merge cto abc123 def456 --summary="VLM fine-tuning comprehensive summary"
|
|
201
203
|
```
|
|
202
204
|
|
|
203
|
-
###
|
|
205
|
+
### Generate Summary (summarize)
|
|
204
206
|
|
|
205
207
|
```bash
|
|
206
208
|
npx memory summarize <agent_id> [--force]
|
|
207
209
|
```
|
|
208
210
|
|
|
209
|
-
|
|
211
|
+
Memory summarization using the MemGAS incremental summarization approach.
|
|
210
212
|
|
|
211
|
-
|
|
212
|
-
- `summary.md`
|
|
213
|
-
- `save`/`delete`
|
|
214
|
-
- `summarize
|
|
213
|
+
**Structure:**
|
|
214
|
+
- A single `summary.md` containing topic-based summaries + relative path links to entries/
|
|
215
|
+
- Automatically updates summary.md on `save`/`delete` execution
|
|
216
|
+
- `summarize` is for manual triggering (when auto-update fails or with `--force` for full regeneration)
|
|
215
217
|
|
|
216
|
-
|
|
217
|
-
-
|
|
218
|
-
-
|
|
219
|
-
- `@memory_summarizer` (Haiku)
|
|
220
|
-
-
|
|
218
|
+
**Incremental tracking:**
|
|
219
|
+
- Stores `last_entry_id` in frontmatter
|
|
220
|
+
- On next run, extracts only entries after that ID and reflects them in the summary
|
|
221
|
+
- `@memory_summarizer` (Haiku) agent generates the summary
|
|
222
|
+
- Falls back to bullet-point format if AI call fails
|
|
221
223
|
|
|
222
|
-
|
|
223
|
-
|
|
|
224
|
-
|
|
225
|
-
| `--force` |
|
|
224
|
+
**Options:**
|
|
225
|
+
| Option | Description |
|
|
226
|
+
|--------|-------------|
|
|
227
|
+
| `--force` | Full regeneration (ignore incremental) |
|
|
226
228
|
|
|
227
|
-
|
|
229
|
+
**Examples:**
|
|
228
230
|
```bash
|
|
229
|
-
#
|
|
231
|
+
# Incremental summary (reflects new entries only)
|
|
230
232
|
npx memory summarize ui_devlead
|
|
231
233
|
|
|
232
|
-
#
|
|
234
|
+
# Force full regeneration
|
|
233
235
|
npx memory summarize ui_devlead --force
|
|
234
236
|
```
|
|
235
237
|
|
|
236
|
-
###
|
|
238
|
+
### Generate Summary (summarize-dirty)
|
|
237
239
|
|
|
238
|
-
`save`/`delete
|
|
239
|
-
|
|
240
|
+
`save`/`delete` creates only a **dirty flag** instead of synchronous summarize, and works with cron to asynchronously update summaries only for agents with dirty flags.
|
|
241
|
+
Cron checks and executes every 1 minute.
|
|
240
242
|
|
|
241
243
|
```bash
|
|
242
244
|
npx memory summarize-dirty
|
|
243
245
|
```
|
|
244
246
|
|
|
245
|
-
**
|
|
247
|
+
**Cron registration example:**
|
|
246
248
|
```bash
|
|
247
249
|
npx cron add "*/1 * * * *" "npx memory summarize-dirty" --mode command --name "memory-debounce"
|
|
248
250
|
```
|
|
249
251
|
|
|
250
|
-
**summary.md
|
|
252
|
+
**summary.md format:**
|
|
251
253
|
```markdown
|
|
252
254
|
---
|
|
253
255
|
last_entry_id: QOSIOs
|
|
@@ -256,300 +258,362 @@ entry_count: 48
|
|
|
256
258
|
summarizer: haiku
|
|
257
259
|
---
|
|
258
260
|
|
|
259
|
-
## mcp-http (4
|
|
260
|
-
MCP HTTP
|
|
261
|
-
|
|
262
|
-
|
|
261
|
+
## mcp-http (4 entries)
|
|
262
|
+
MCP HTTP endpoint implementation completed...
|
|
263
|
+
-> [entries/HYpwPP.md](entries/HYpwPP.md)
|
|
264
|
+
-> [entries/ImH-56.md](entries/ImH-56.md)
|
|
263
265
|
|
|
264
|
-
## cli-service (3
|
|
265
|
-
CLI
|
|
266
|
-
|
|
266
|
+
## cli-service (3 entries)
|
|
267
|
+
CLI shell environment detection performance improvement...
|
|
268
|
+
-> [entries/a3cOL8.md](entries/a3cOL8.md)
|
|
267
269
|
```
|
|
268
270
|
|
|
269
|
-
###
|
|
271
|
+
### Filename Migration (migrate)
|
|
270
272
|
|
|
271
273
|
```bash
|
|
272
274
|
npx memory migrate <agent_id>
|
|
273
275
|
```
|
|
274
276
|
|
|
275
|
-
|
|
277
|
+
Batch converts existing slug filenames (`2026-02-16-slug-name.md`) to ID-based filenames (`QOSIOs.md`).
|
|
276
278
|
|
|
277
|
-
-
|
|
278
|
-
-
|
|
279
|
-
-
|
|
279
|
+
- Reads `id` from each .md file's frontmatter -> renames to `{id}.md`
|
|
280
|
+
- Automatically regenerates summary.md + updates graph after completion
|
|
281
|
+
- Skips files that already have ID-based filenames
|
|
280
282
|
|
|
281
|
-
|
|
283
|
+
**Example:**
|
|
282
284
|
```bash
|
|
283
285
|
npx memory migrate ui_devlead
|
|
284
286
|
```
|
|
285
287
|
|
|
286
|
-
##
|
|
288
|
+
## Frontmatter Schema
|
|
287
289
|
|
|
288
290
|
```yaml
|
|
289
291
|
---
|
|
290
|
-
id: yLC8Iv # nanoid
|
|
292
|
+
id: yLC8Iv # 6-character nanoid
|
|
291
293
|
date: 2025-12-23
|
|
292
294
|
category: decision
|
|
293
295
|
tags: ["strategy", "gemini"]
|
|
294
296
|
topic: crewx-strategy
|
|
295
|
-
summary: "
|
|
297
|
+
summary: "One-line summary"
|
|
296
298
|
---
|
|
297
299
|
```
|
|
298
300
|
|
|
299
|
-
##
|
|
301
|
+
## Agent Prompt Guide
|
|
300
302
|
|
|
301
303
|
```markdown
|
|
302
304
|
<memory-v2-guide agent_id="{{agent_id}}">
|
|
303
|
-
# Memory V2
|
|
305
|
+
# Memory V2 Usage Guide
|
|
304
306
|
|
|
305
|
-
##
|
|
307
|
+
## At Conversation Start (Required!)
|
|
306
308
|
```bash
|
|
307
|
-
#
|
|
309
|
+
# Load medium-term memory (topic summaries + drill-down guide)
|
|
308
310
|
npx memory index {{agent_id}}
|
|
309
311
|
|
|
310
|
-
#
|
|
311
|
-
npx memory index {{agent_id}} --recent #
|
|
312
|
-
npx memory topic {{agent_id}} <topic> #
|
|
313
|
-
npx memory get {{agent_id}} <id> #
|
|
312
|
+
# Drill down as needed
|
|
313
|
+
npx memory index {{agent_id}} --recent # Recent list
|
|
314
|
+
npx memory topic {{agent_id}} <topic> # Topic details
|
|
315
|
+
npx memory get {{agent_id}} <id> # Individual memory
|
|
314
316
|
```
|
|
315
317
|
|
|
316
|
-
##
|
|
317
|
-
- "
|
|
318
|
-
-
|
|
319
|
-
-
|
|
318
|
+
## Memory Save Triggers
|
|
319
|
+
- When asked to "remember this", "save this", "note this"
|
|
320
|
+
- When important decisions are made
|
|
321
|
+
- When receiving executive directives
|
|
320
322
|
|
|
321
|
-
##
|
|
323
|
+
## Topic Selection Guide (Important)
|
|
322
324
|
|
|
323
|
-
|
|
325
|
+
**Always specify an appropriate topic when saving!**
|
|
324
326
|
|
|
325
|
-
1.
|
|
326
|
-
2.
|
|
327
|
-
3.
|
|
327
|
+
1. **Check existing topics**: Use `index` command to see existing topic list
|
|
328
|
+
2. **Select existing topic**: Use that topic if a related one exists
|
|
329
|
+
3. **Create new topic**: Create a new topic name if none exists (kebab-case, e.g., `new-feature`)
|
|
328
330
|
|
|
329
|
-
|
|
330
|
-
- kebab-case
|
|
331
|
-
-
|
|
332
|
-
-
|
|
331
|
+
**Topic naming rules:**
|
|
332
|
+
- Use kebab-case (e.g., `vlm-finetuning`, `crewx-strategy`)
|
|
333
|
+
- Group by project/feature/subject
|
|
334
|
+
- Don't over-segment (consider merging if fewer than 5 entries)
|
|
333
335
|
|
|
334
|
-
|
|
336
|
+
**Examples:**
|
|
335
337
|
```bash
|
|
336
|
-
#
|
|
337
|
-
npx memory save {{agent_id}} "VLM
|
|
338
|
+
# Add to existing topic
|
|
339
|
+
npx memory save {{agent_id}} "VLM learning rate adjustment" decision --topic=vlm-finetuning
|
|
338
340
|
|
|
339
|
-
#
|
|
340
|
-
npx memory save {{agent_id}} "
|
|
341
|
+
# Create new topic
|
|
342
|
+
npx memory save {{agent_id}} "New feature planning" decision --topic=new-feature-x
|
|
341
343
|
```
|
|
342
344
|
|
|
343
|
-
##
|
|
345
|
+
## Save Command (--body required!)
|
|
344
346
|
```bash
|
|
345
|
-
#
|
|
346
|
-
npx memory save {{agent_id}} "
|
|
347
|
+
# WARNING: Always save with --body included!
|
|
348
|
+
npx memory save {{agent_id}} "<summary>" <category> --topic=<topic> --body="<detailed content>"
|
|
347
349
|
```
|
|
348
350
|
|
|
349
|
-
**--body
|
|
350
|
-
-
|
|
351
|
-
-
|
|
352
|
-
-
|
|
353
|
-
-
|
|
351
|
+
**--body writing guide:**
|
|
352
|
+
- Why this decision was made (background/rationale)
|
|
353
|
+
- Key metrics or data
|
|
354
|
+
- Related file/document paths
|
|
355
|
+
- Include follow-up actions if any
|
|
354
356
|
|
|
355
|
-
##
|
|
356
|
-
- **decision**:
|
|
357
|
-
- **task**:
|
|
358
|
-
- **project**:
|
|
359
|
-
- **schedule**:
|
|
360
|
-
- **context**:
|
|
361
|
-
- **preference**:
|
|
362
|
-
- **general**:
|
|
357
|
+
## Category Selection
|
|
358
|
+
- **decision**: Decisions, executive directives
|
|
359
|
+
- **task**: To-dos, work plans
|
|
360
|
+
- **project**: Project information
|
|
361
|
+
- **schedule**: Schedules, meetings
|
|
362
|
+
- **context**: Background information, context
|
|
363
|
+
- **preference**: Preferences, rules
|
|
364
|
+
- **general**: Other
|
|
363
365
|
|
|
364
366
|
</memory-v2-guide>
|
|
365
367
|
```
|
|
366
368
|
|
|
367
|
-
##
|
|
369
|
+
## Differences from Legacy Memory Skill
|
|
368
370
|
|
|
369
|
-
|
|
|
371
|
+
| Item | memory (v1) | memory-v2 |
|
|
370
372
|
|------|-------------|-----------|
|
|
371
|
-
|
|
|
372
|
-
|
|
|
373
|
-
|
|
|
374
|
-
|
|
|
375
|
-
|
|
|
373
|
+
| Storage format | JSON array | Markdown files |
|
|
374
|
+
| Metadata | Mixed within content | Separated in frontmatter |
|
|
375
|
+
| Query | Full load | Index -> drill-down |
|
|
376
|
+
| Topic support | None | Supported |
|
|
377
|
+
| Readability | Low | High |
|
|
376
378
|
|
|
377
|
-
##
|
|
379
|
+
## Memory Connection Graph
|
|
378
380
|
|
|
379
|
-
|
|
381
|
+
Manages associations between memories as a graph.
|
|
380
382
|
|
|
381
|
-
###
|
|
383
|
+
### Build Graph
|
|
382
384
|
|
|
383
385
|
```bash
|
|
384
386
|
npx memory mindmap build <agent_id>
|
|
385
387
|
```
|
|
386
388
|
|
|
387
|
-
|
|
388
|
-
-
|
|
389
|
-
-
|
|
390
|
-
-
|
|
391
|
-
-
|
|
389
|
+
Rule-based connection generation:
|
|
390
|
+
- **Same topic**: weight 0.7 (WARNING: excludes `general`)
|
|
391
|
+
- **Shared tags**: weight 0.4~0.8 (1 tag=0.4, 2 tags=0.6, 3+ tags=0.8)
|
|
392
|
+
- **Same date**: weight 0.3 (default OFF)
|
|
393
|
+
- **Same category**: weight 0.2 (WARNING: excludes `general`)
|
|
392
394
|
|
|
393
|
-
> **edgeThreshold = 0.3**
|
|
395
|
+
> **edgeThreshold = 0.3** -> Total weight must be 0.3 or above to create a connection
|
|
394
396
|
|
|
395
|
-
###
|
|
397
|
+
### (Important) Tips for Increasing Connectivity
|
|
396
398
|
|
|
397
|
-
|
|
399
|
+
**Key: Avoid `general` and be specific!**
|
|
398
400
|
|
|
399
|
-
|
|
|
400
|
-
|
|
401
|
-
| topic
|
|
402
|
-
|
|
|
403
|
-
|
|
|
404
|
-
| category | +0.2 | decision/task
|
|
401
|
+
| Method | Weight | Effect |
|
|
402
|
+
|--------|--------|--------|
|
|
403
|
+
| Specify topic | +0.7 | Memories with same topic auto-connect |
|
|
404
|
+
| 2+ tags | +0.6 | Connect via tags even across different topics |
|
|
405
|
+
| 3+ tags | +0.8 | Maximum connection strength |
|
|
406
|
+
| category | +0.2 | Use specific ones like decision/task |
|
|
405
407
|
|
|
406
|
-
|
|
408
|
+
**[BAD] Bad example (no connections)**
|
|
407
409
|
```bash
|
|
408
|
-
# topic=general, category=general
|
|
409
|
-
npx memory save agent "Discord
|
|
410
|
+
# topic=general, category=general -> 0 connections
|
|
411
|
+
npx memory save agent "Discord settings removal" general
|
|
410
412
|
```
|
|
411
413
|
|
|
412
|
-
|
|
414
|
+
**[GOOD] Good example (strong connections)**
|
|
413
415
|
```bash
|
|
414
|
-
# topic + category + tags
|
|
415
|
-
npx memory save agent "Discord
|
|
416
|
+
# topic + category + tags -> maximum connections
|
|
417
|
+
npx memory save agent "Discord settings removal decision" decision \
|
|
416
418
|
--topic=discord \
|
|
417
419
|
--tags=settings,cpo-decision,oauth \
|
|
418
|
-
--body="CPO
|
|
420
|
+
--body="CPO meeting result..."
|
|
419
421
|
```
|
|
420
422
|
|
|
421
|
-
|
|
422
|
-
-
|
|
423
|
-
-
|
|
424
|
-
-
|
|
423
|
+
**Tag usage strategy:**
|
|
424
|
+
- Related feature/module names: `discord`, `oauth`, `settings`
|
|
425
|
+
- Meeting/decision-maker: `cpo-decision`, `dev-meeting`
|
|
426
|
+
- Status: `completed`, `blocked`, `wip`
|
|
425
427
|
|
|
426
|
-
###
|
|
428
|
+
### View Graph Summary
|
|
427
429
|
|
|
428
430
|
```bash
|
|
429
431
|
npx memory mindmap show <agent_id>
|
|
430
432
|
```
|
|
431
433
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
`--format=mermaid
|
|
434
|
+
Displays topic-based clusters, hub nodes (memories with many connections), etc.
|
|
435
|
+
Default output is in **Mermaid format**, which can be visualized as a graph in VS Code markdown preview.
|
|
436
|
+
`--format=mermaid` is the default, and `--format=text` is also available for text output.
|
|
435
437
|
|
|
436
|
-
|
|
438
|
+
**Period filter options:**
|
|
437
439
|
```bash
|
|
438
440
|
npx memory mindmap show <agent_id> --period=stm # 24h
|
|
439
441
|
npx memory mindmap show <agent_id> --period=mtm # 7d
|
|
440
442
|
npx memory mindmap show <agent_id> --period=ltm # 30d
|
|
441
443
|
```
|
|
442
444
|
|
|
443
|
-
### PNG
|
|
445
|
+
### Export as PNG Image
|
|
444
446
|
|
|
445
|
-
Mermaid
|
|
447
|
+
Convert Mermaid output to PNG images for visual inspection.
|
|
446
448
|
|
|
447
449
|
```bash
|
|
448
|
-
# 1. mermaid
|
|
450
|
+
# 1. Save mermaid code to file
|
|
449
451
|
npx memory mindmap show <agent_id> | sed 's/^```mermaid$//' | sed 's/^```$//' > /tmp/graph.mmd
|
|
450
452
|
|
|
451
|
-
# 2. PNG
|
|
453
|
+
# 2. Convert to PNG (runs without installation via npx)
|
|
452
454
|
npx @mermaid-js/mermaid-cli -i /tmp/graph.mmd -o graph.png -w 2400 -H 1600 -b white
|
|
453
455
|
|
|
454
|
-
#
|
|
456
|
+
# Period filter + PNG (e.g., last 24 hours only)
|
|
455
457
|
npx memory mindmap show <agent_id> --period=stm | sed 's/^```mermaid$//' | sed 's/^```$//' | grep -v '^(' > /tmp/graph-stm.mmd
|
|
456
458
|
npx @mermaid-js/mermaid-cli -i /tmp/graph-stm.mmd -o graph-stm.png -w 1600 -H 900 -b white
|
|
457
459
|
```
|
|
458
460
|
|
|
459
|
-
>
|
|
461
|
+
> **Tip**: Full graphs (58+ nodes) can be complex, so it's recommended to narrow the view using `--period=stm` (24h) or `--period=mtm` (7d).
|
|
460
462
|
|
|
461
|
-
###
|
|
463
|
+
### Query Related Memories
|
|
462
464
|
|
|
463
465
|
```bash
|
|
464
466
|
npx memory mindmap related <agent_id> <memory_id>
|
|
465
467
|
```
|
|
466
468
|
|
|
467
|
-
|
|
469
|
+
Displays memories connected to a specific memory, sorted by weight.
|
|
468
470
|
|
|
469
|
-
###
|
|
471
|
+
### Manual Connection Management
|
|
470
472
|
|
|
471
473
|
```bash
|
|
472
|
-
#
|
|
474
|
+
# Add connection
|
|
473
475
|
npx memory mindmap add <agent_id> <from_id> <to_id> [type]
|
|
474
476
|
|
|
475
|
-
#
|
|
477
|
+
# Remove connection
|
|
476
478
|
npx memory mindmap remove <agent_id> <from_id> <to_id>
|
|
477
479
|
```
|
|
478
480
|
|
|
479
|
-
###
|
|
481
|
+
### Visualization (HTML) - Shared Graph
|
|
480
482
|
|
|
481
483
|
```bash
|
|
482
484
|
npx memory mindmap html
|
|
483
485
|
```
|
|
484
486
|
|
|
485
|
-
|
|
487
|
+
Generates a **shared visualization combining connection graphs of all agents** in one place.
|
|
486
488
|
|
|
487
|
-
|
|
488
|
-
-
|
|
489
|
-
-
|
|
490
|
-
- D3.js force-directed
|
|
491
|
-
-
|
|
492
|
-
-
|
|
493
|
-
-
|
|
494
|
-
-
|
|
495
|
-
-
|
|
489
|
+
**Features:**
|
|
490
|
+
- Embeds graph.json data from all agents into a single HTML
|
|
491
|
+
- Dropdown to select agent -> real-time graph switching
|
|
492
|
+
- D3.js force-directed graph
|
|
493
|
+
- Color-coded by topic
|
|
494
|
+
- Zoom & drag support
|
|
495
|
+
- Tooltip with details on hover
|
|
496
|
+
- Node size = number of connections
|
|
497
|
+
- Can be opened directly via file:// protocol without a server
|
|
496
498
|
|
|
497
|
-
|
|
499
|
+
**Usage:**
|
|
498
500
|
```bash
|
|
499
|
-
# 1.
|
|
501
|
+
# 1. Generate shared HTML (no agent_id needed)
|
|
500
502
|
npx memory mindmap html
|
|
501
503
|
|
|
502
|
-
# 2.
|
|
504
|
+
# 2. Open in browser
|
|
503
505
|
npx memory mindmap open
|
|
504
506
|
```
|
|
505
507
|
|
|
506
|
-
|
|
508
|
+
**Example:**
|
|
507
509
|
```bash
|
|
508
|
-
#
|
|
510
|
+
# Generate integrated visualization of all agent graphs
|
|
509
511
|
npx memory mindmap html
|
|
510
512
|
```
|
|
511
513
|
|
|
512
|
-
###
|
|
514
|
+
### Open in Browser
|
|
513
515
|
|
|
514
516
|
```bash
|
|
515
517
|
npx memory mindmap open [agent_id]
|
|
516
518
|
```
|
|
517
519
|
|
|
518
|
-
|
|
520
|
+
Opens a specific agent's graph directly in the browser.
|
|
519
521
|
|
|
520
|
-
|
|
522
|
+
**Examples:**
|
|
521
523
|
```bash
|
|
522
|
-
# CTO
|
|
524
|
+
# Open CTO graph
|
|
523
525
|
npx memory mindmap open cto
|
|
524
526
|
|
|
525
|
-
#
|
|
527
|
+
# Open default (all agents)
|
|
526
528
|
npx memory mindmap open
|
|
527
529
|
```
|
|
528
530
|
|
|
529
|
-
###
|
|
531
|
+
### Storage Location
|
|
530
532
|
|
|
531
533
|
```
|
|
532
|
-
memory/{agent_id}/graph.json #
|
|
533
|
-
memory/mindmap.html #
|
|
534
|
+
memory/{agent_id}/graph.json # Graph data
|
|
535
|
+
memory/mindmap.html # Shared visualization HTML (generated by npx memory mindmap html)
|
|
534
536
|
```
|
|
535
537
|
|
|
536
538
|
---
|
|
537
539
|
|
|
538
|
-
##
|
|
540
|
+
## Memory Hierarchy Structure
|
|
539
541
|
|
|
540
|
-
`index`
|
|
542
|
+
The `index` command provides 3-tier output based on cognitive psychology (Ebbinghaus, Atkinson-Shiffrin) and AI agent memory research (MemoryOS, A-Mem).
|
|
541
543
|
|
|
542
|
-
|
|
|
543
|
-
|
|
544
|
-
|
|
|
545
|
-
|
|
|
546
|
-
|
|
|
544
|
+
| Tier | Timeframe | Output |
|
|
545
|
+
|------|-----------|--------|
|
|
546
|
+
| Short-term (STM) | 24h | `## ** Recent Work` |
|
|
547
|
+
| Medium-term (MTM) | 7 days | Topic summaries (summary.md) |
|
|
548
|
+
| Long-term (LTM) | 30 days | `--recent` or `--full` |
|
|
547
549
|
|
|
548
|
-
|
|
550
|
+
Design rationale details: [README.md](./README.md#design-rationale-hierarchical-memory-architecture)
|
|
549
551
|
|
|
550
552
|
---
|
|
551
553
|
|
|
552
|
-
##
|
|
554
|
+
## Configuration (crewx.yaml)
|
|
555
|
+
|
|
556
|
+
Memory engine settings can be customized via the `settings.memory` block in `crewx.yaml`. All fields are optional — defaults are used when not specified.
|
|
557
|
+
|
|
558
|
+
> **Settings are applied immediately** — no restart required. The config file is read on every command invocation.
|
|
559
|
+
|
|
560
|
+
### Fields
|
|
561
|
+
|
|
562
|
+
```yaml
|
|
563
|
+
settings:
|
|
564
|
+
memory:
|
|
565
|
+
summarizer_agent: "@memory_summarizer" # crewx.yaml에 정의된 에이전트 ID. summary.md 생성에 사용
|
|
566
|
+
searcher_agent: "@memory_searcher" # crewx.yaml에 정의된 에이전트 ID. semantic search에 사용
|
|
567
|
+
summarizer_timeout: 60000 # summarizer 에이전트 호출 타임아웃 (ms). 초과 시 bullet-point fallback
|
|
568
|
+
searcher_timeout: 300000 # searcher 에이전트 호출 타임아웃 (ms). 초과 시 에러 반환
|
|
569
|
+
summary_days: 7 # index 명령의 중기기억(MTM) 요약 범위 (일 단위)
|
|
570
|
+
recent_days: 30 # index --recent / recent 명령의 조회 범위 (일 단위)
|
|
571
|
+
short_term_hours: 24 # index 명령의 단기기억(STM, "🔥 Recent Work") 범위 (시간 단위)
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
### Resolve priority
|
|
575
|
+
|
|
576
|
+
| Field | Priority |
|
|
577
|
+
|-------|----------|
|
|
578
|
+
| `summary_days`, `recent_days` | `config parameter` > `crewx.yaml` > `environment variable` (`MEMORY_SUMMARY_DAYS`, `MEMORY_RECENT_DAYS`) > `built-in default` |
|
|
579
|
+
| `summarizer_agent`, `searcher_agent`, `summarizer_timeout`, `searcher_timeout`, `short_term_hours` | `config parameter` > `crewx.yaml` > `built-in default` |
|
|
580
|
+
|
|
581
|
+
> **Note:** Environment variables are only supported for `summary_days` (`MEMORY_SUMMARY_DAYS`) and `recent_days` (`MEMORY_RECENT_DAYS`). Other fields do not have corresponding env vars.
|
|
582
|
+
|
|
583
|
+
### Config file location
|
|
584
|
+
|
|
585
|
+
By default, `crewx.yaml` is read from the project root. To use a different path, set the `CREWX_CONFIG` environment variable:
|
|
586
|
+
|
|
587
|
+
```bash
|
|
588
|
+
CREWX_CONFIG=/path/to/custom-crewx.yaml npx memory index my_agent
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
### Error handling
|
|
592
|
+
|
|
593
|
+
- **YAML parse failure** (file missing, syntax error): All fields silently fall back to built-in defaults. No error is raised — check your YAML syntax if settings seem ignored.
|
|
594
|
+
- **Invalid numeric value** (e.g., `summary_days: "abc"`): 잘못된 숫자 값(예: "abc")은 NaN으로 설정되어 예기치 않은 동작을 유발할 수 있습니다. 숫자 필드에는 반드시 유효한 정수만 입력하세요.
|
|
595
|
+
|
|
596
|
+
### Customization example
|
|
597
|
+
|
|
598
|
+
Expand the summary window to 2 weeks and use a custom summarizer agent:
|
|
599
|
+
|
|
600
|
+
```yaml
|
|
601
|
+
settings:
|
|
602
|
+
memory:
|
|
603
|
+
summary_days: 14 # 기본 7일 → 2주로 확장
|
|
604
|
+
summarizer_agent: "@my_custom_summarizer" # 커스텀 요약 에이전트 (crewx.yaml agents 섹션에 정의 필요)
|
|
605
|
+
summarizer_timeout: 120000 # 커스텀 에이전트에 맞춰 타임아웃 2분으로 증가
|
|
606
|
+
```
|
|
607
|
+
|
|
608
|
+
Or override via environment variable (e.g., in CI/CD):
|
|
609
|
+
|
|
610
|
+
```bash
|
|
611
|
+
MEMORY_SUMMARY_DAYS=14 npx memory summarize my_agent
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
---
|
|
615
|
+
|
|
616
|
+
## v1 -> v2 Migration
|
|
553
617
|
|
|
554
618
|
```bash
|
|
555
619
|
npx memory migrate <agent_id>
|