@crewx/memory 0.1.6 → 0.1.8
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 +321 -259
- package/dist/cli.js +2 -1
- 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 +4 -1
package/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: crewx/memory
|
|
3
|
-
description:
|
|
3
|
+
description: Markdown + frontmatter-based long-term memory skill. Scalable memory management with drill-down structure.
|
|
4
4
|
metadata:
|
|
5
5
|
version: 0.10.0
|
|
6
6
|
built-in: true
|
|
@@ -8,32 +8,32 @@ metadata:
|
|
|
8
8
|
|
|
9
9
|
# Memory V2 Skill
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
A long-term memory management skill based on markdown + frontmatter.
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Installation
|
|
14
14
|
|
|
15
|
-
`packages/built-in/memory
|
|
15
|
+
Included in `packages/built-in/memory`, used via the `npx memory` command.
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## Features
|
|
18
18
|
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
- **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
|
|
23
23
|
|
|
24
|
-
##
|
|
24
|
+
## Command Aliases
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
Shorthand aliases for frequently used commands. They work identically to the original commands.
|
|
27
27
|
|
|
28
|
-
| Alias |
|
|
29
|
-
|
|
30
|
-
| `read` | `get` |
|
|
31
|
-
| `list` | `index` |
|
|
32
|
-
| `rm` | `delete` |
|
|
33
|
-
| `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 |
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
|
-
#
|
|
36
|
+
# The following two commands are identical
|
|
37
37
|
npx memory get agent_id ABC123
|
|
38
38
|
npx memory read agent_id ABC123
|
|
39
39
|
|
|
@@ -41,215 +41,215 @@ npx memory index agent_id
|
|
|
41
41
|
npx memory list agent_id
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
##
|
|
44
|
+
## Directory Structure
|
|
45
45
|
|
|
46
46
|
```
|
|
47
47
|
memory/
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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)
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
>
|
|
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.
|
|
56
56
|
|
|
57
|
-
##
|
|
57
|
+
## Commands
|
|
58
58
|
|
|
59
|
-
###
|
|
59
|
+
### Save
|
|
60
60
|
|
|
61
61
|
```bash
|
|
62
|
-
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"]
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
|
67
|
-
|
|
68
|
-
| `category` |
|
|
69
|
-
| `--topic` |
|
|
70
|
-
| `--tags` |
|
|
71
|
-
| `--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."` |
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
- `--body
|
|
75
|
-
-
|
|
76
|
-
-
|
|
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
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
**Examples:**
|
|
79
79
|
```bash
|
|
80
|
-
#
|
|
81
|
-
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
|
|
82
82
|
|
|
83
|
-
#
|
|
84
|
-
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."
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
-
###
|
|
87
|
+
### Index Query
|
|
88
88
|
|
|
89
89
|
```bash
|
|
90
|
-
npx memory index <agent_id> #
|
|
91
|
-
npx memory index <agent_id> --recent #
|
|
92
|
-
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
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
**Drill-down pattern:** `index` -> drill into needed topic with `topic` -> drill into needed entry with `get`
|
|
96
96
|
|
|
97
|
-
###
|
|
97
|
+
### Topic Drill-down
|
|
98
98
|
|
|
99
99
|
```bash
|
|
100
100
|
npx memory topic <agent_id> <topic_name>
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
-
###
|
|
103
|
+
### Recent Memories
|
|
104
104
|
|
|
105
105
|
```bash
|
|
106
106
|
npx memory recent <agent_id> [days=30]
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
-
###
|
|
109
|
+
### Keyword Search (Fast)
|
|
110
110
|
|
|
111
111
|
```bash
|
|
112
112
|
npx memory find <agent_id> "<keyword>"
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
Grep-based string matching. Fast and free.
|
|
116
116
|
|
|
117
|
-
###
|
|
117
|
+
### Semantic Search (AI)
|
|
118
118
|
|
|
119
119
|
```bash
|
|
120
|
-
npx memory search <agent_id> "
|
|
120
|
+
npx memory search <agent_id> "<query>"
|
|
121
121
|
```
|
|
122
122
|
|
|
123
|
-
**Gemini 2.0 Flash
|
|
123
|
+
Semantic search powered by **Gemini 2.0 Flash**. Understands synonyms and context.
|
|
124
124
|
|
|
125
|
-
-
|
|
126
|
-
-
|
|
125
|
+
- Uses internal `@memory_searcher` agent (crewx.yaml)
|
|
126
|
+
- Cost: ~$0.015/1M tokens (virtually free)
|
|
127
127
|
|
|
128
|
-
|
|
128
|
+
**Examples:**
|
|
129
129
|
```bash
|
|
130
|
-
#
|
|
131
|
-
npx memory find crewx_dev_lead "
|
|
130
|
+
# Keyword search (fast)
|
|
131
|
+
npx memory find crewx_dev_lead "agent"
|
|
132
132
|
|
|
133
|
-
#
|
|
134
|
-
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"
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
-
###
|
|
137
|
+
### Detail View (Drill-down)
|
|
138
138
|
|
|
139
139
|
```bash
|
|
140
140
|
npx memory get <agent_id> <memory_id>
|
|
141
141
|
```
|
|
142
142
|
|
|
143
|
-
###
|
|
143
|
+
### Update Memory
|
|
144
144
|
|
|
145
145
|
```bash
|
|
146
|
-
npx memory update <agent_id> <memory_id> [
|
|
146
|
+
npx memory update <agent_id> <memory_id> [options]
|
|
147
147
|
```
|
|
148
148
|
|
|
149
|
-
|
|
150
|
-
|
|
|
151
|
-
|
|
152
|
-
| `--summary` |
|
|
153
|
-
| `--body` |
|
|
154
|
-
| `--topic` |
|
|
155
|
-
| `--category` |
|
|
156
|
-
| `--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) |
|
|
157
157
|
|
|
158
|
-
|
|
158
|
+
**Examples:**
|
|
159
159
|
```bash
|
|
160
|
-
#
|
|
161
|
-
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"
|
|
162
162
|
|
|
163
|
-
#
|
|
163
|
+
# Change topic only
|
|
164
164
|
npx memory update cto VkY9X6 --topic=new-topic
|
|
165
165
|
```
|
|
166
166
|
|
|
167
|
-
###
|
|
167
|
+
### Delete Memory
|
|
168
168
|
|
|
169
169
|
```bash
|
|
170
170
|
npx memory delete <agent_id> <memory_id> [--force]
|
|
171
171
|
```
|
|
172
172
|
|
|
173
|
-
- `--force
|
|
174
|
-
- `--force
|
|
173
|
+
- Without `--force`, only a confirmation message is displayed
|
|
174
|
+
- With `--force`, actually deletes the memory
|
|
175
175
|
|
|
176
|
-
|
|
176
|
+
**Examples:**
|
|
177
177
|
```bash
|
|
178
|
-
#
|
|
178
|
+
# Deletion confirmation
|
|
179
179
|
npx memory delete cto VkY9X6
|
|
180
180
|
|
|
181
|
-
#
|
|
181
|
+
# Actual deletion
|
|
182
182
|
npx memory delete cto VkY9X6 --force
|
|
183
183
|
```
|
|
184
184
|
|
|
185
|
-
###
|
|
185
|
+
### Merge Memories
|
|
186
186
|
|
|
187
187
|
```bash
|
|
188
|
-
npx memory merge <agent_id> <memory_id1> <memory_id2> [--summary="
|
|
188
|
+
npx memory merge <agent_id> <memory_id1> <memory_id2> [--summary="merge summary"]
|
|
189
189
|
```
|
|
190
190
|
|
|
191
|
-
-
|
|
192
|
-
-
|
|
193
|
-
-
|
|
194
|
-
-
|
|
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
|
|
195
195
|
|
|
196
|
-
|
|
196
|
+
**Examples:**
|
|
197
197
|
```bash
|
|
198
|
-
#
|
|
198
|
+
# Merge two memories
|
|
199
199
|
npx memory merge cto abc123 def456
|
|
200
200
|
|
|
201
|
-
#
|
|
202
|
-
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"
|
|
203
203
|
```
|
|
204
204
|
|
|
205
|
-
###
|
|
205
|
+
### Generate Summary (summarize)
|
|
206
206
|
|
|
207
207
|
```bash
|
|
208
208
|
npx memory summarize <agent_id> [--force]
|
|
209
209
|
```
|
|
210
210
|
|
|
211
|
-
|
|
211
|
+
Memory summarization using the MemGAS incremental summarization approach.
|
|
212
212
|
|
|
213
|
-
|
|
214
|
-
- `summary.md`
|
|
215
|
-
- `save`/`delete`
|
|
216
|
-
- `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)
|
|
217
217
|
|
|
218
|
-
|
|
219
|
-
-
|
|
220
|
-
-
|
|
221
|
-
- `@memory_summarizer` (Haiku)
|
|
222
|
-
-
|
|
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
|
|
223
223
|
|
|
224
|
-
|
|
225
|
-
|
|
|
226
|
-
|
|
227
|
-
| `--force` |
|
|
224
|
+
**Options:**
|
|
225
|
+
| Option | Description |
|
|
226
|
+
|--------|-------------|
|
|
227
|
+
| `--force` | Full regeneration (ignore incremental) |
|
|
228
228
|
|
|
229
|
-
|
|
229
|
+
**Examples:**
|
|
230
230
|
```bash
|
|
231
|
-
#
|
|
231
|
+
# Incremental summary (reflects new entries only)
|
|
232
232
|
npx memory summarize ui_devlead
|
|
233
233
|
|
|
234
|
-
#
|
|
234
|
+
# Force full regeneration
|
|
235
235
|
npx memory summarize ui_devlead --force
|
|
236
236
|
```
|
|
237
237
|
|
|
238
|
-
###
|
|
238
|
+
### Generate Summary (summarize-dirty)
|
|
239
239
|
|
|
240
|
-
`save`/`delete
|
|
241
|
-
|
|
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.
|
|
242
242
|
|
|
243
243
|
```bash
|
|
244
244
|
npx memory summarize-dirty
|
|
245
245
|
```
|
|
246
246
|
|
|
247
|
-
**
|
|
247
|
+
**Cron registration example:**
|
|
248
248
|
```bash
|
|
249
249
|
npx cron add "*/1 * * * *" "npx memory summarize-dirty" --mode command --name "memory-debounce"
|
|
250
250
|
```
|
|
251
251
|
|
|
252
|
-
**summary.md
|
|
252
|
+
**summary.md format:**
|
|
253
253
|
```markdown
|
|
254
254
|
---
|
|
255
255
|
last_entry_id: QOSIOs
|
|
@@ -258,300 +258,362 @@ entry_count: 48
|
|
|
258
258
|
summarizer: haiku
|
|
259
259
|
---
|
|
260
260
|
|
|
261
|
-
## mcp-http (4
|
|
262
|
-
MCP HTTP
|
|
263
|
-
|
|
264
|
-
|
|
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)
|
|
265
265
|
|
|
266
|
-
## cli-service (3
|
|
267
|
-
CLI
|
|
268
|
-
|
|
266
|
+
## cli-service (3 entries)
|
|
267
|
+
CLI shell environment detection performance improvement...
|
|
268
|
+
-> [entries/a3cOL8.md](entries/a3cOL8.md)
|
|
269
269
|
```
|
|
270
270
|
|
|
271
|
-
###
|
|
271
|
+
### Filename Migration (migrate)
|
|
272
272
|
|
|
273
273
|
```bash
|
|
274
274
|
npx memory migrate <agent_id>
|
|
275
275
|
```
|
|
276
276
|
|
|
277
|
-
|
|
277
|
+
Batch converts existing slug filenames (`2026-02-16-slug-name.md`) to ID-based filenames (`QOSIOs.md`).
|
|
278
278
|
|
|
279
|
-
-
|
|
280
|
-
-
|
|
281
|
-
-
|
|
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
|
|
282
282
|
|
|
283
|
-
|
|
283
|
+
**Example:**
|
|
284
284
|
```bash
|
|
285
285
|
npx memory migrate ui_devlead
|
|
286
286
|
```
|
|
287
287
|
|
|
288
|
-
##
|
|
288
|
+
## Frontmatter Schema
|
|
289
289
|
|
|
290
290
|
```yaml
|
|
291
291
|
---
|
|
292
|
-
id: yLC8Iv # nanoid
|
|
292
|
+
id: yLC8Iv # 6-character nanoid
|
|
293
293
|
date: 2025-12-23
|
|
294
294
|
category: decision
|
|
295
295
|
tags: ["strategy", "gemini"]
|
|
296
296
|
topic: crewx-strategy
|
|
297
|
-
summary: "
|
|
297
|
+
summary: "One-line summary"
|
|
298
298
|
---
|
|
299
299
|
```
|
|
300
300
|
|
|
301
|
-
##
|
|
301
|
+
## Agent Prompt Guide
|
|
302
302
|
|
|
303
303
|
```markdown
|
|
304
304
|
<memory-v2-guide agent_id="{{agent_id}}">
|
|
305
|
-
# Memory V2
|
|
305
|
+
# Memory V2 Usage Guide
|
|
306
306
|
|
|
307
|
-
##
|
|
307
|
+
## At Conversation Start (Required!)
|
|
308
308
|
```bash
|
|
309
|
-
#
|
|
309
|
+
# Load medium-term memory (topic summaries + drill-down guide)
|
|
310
310
|
npx memory index {{agent_id}}
|
|
311
311
|
|
|
312
|
-
#
|
|
313
|
-
npx memory index {{agent_id}} --recent #
|
|
314
|
-
npx memory topic {{agent_id}} <topic> #
|
|
315
|
-
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
|
|
316
316
|
```
|
|
317
317
|
|
|
318
|
-
##
|
|
319
|
-
- "
|
|
320
|
-
-
|
|
321
|
-
-
|
|
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
|
|
322
322
|
|
|
323
|
-
##
|
|
323
|
+
## Topic Selection Guide (Important)
|
|
324
324
|
|
|
325
|
-
|
|
325
|
+
**Always specify an appropriate topic when saving!**
|
|
326
326
|
|
|
327
|
-
1.
|
|
328
|
-
2.
|
|
329
|
-
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`)
|
|
330
330
|
|
|
331
|
-
|
|
332
|
-
- kebab-case
|
|
333
|
-
-
|
|
334
|
-
-
|
|
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)
|
|
335
335
|
|
|
336
|
-
|
|
336
|
+
**Examples:**
|
|
337
337
|
```bash
|
|
338
|
-
#
|
|
339
|
-
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
|
|
340
340
|
|
|
341
|
-
#
|
|
342
|
-
npx memory save {{agent_id}} "
|
|
341
|
+
# Create new topic
|
|
342
|
+
npx memory save {{agent_id}} "New feature planning" decision --topic=new-feature-x
|
|
343
343
|
```
|
|
344
344
|
|
|
345
|
-
##
|
|
345
|
+
## Save Command (--body required!)
|
|
346
346
|
```bash
|
|
347
|
-
#
|
|
348
|
-
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>"
|
|
349
349
|
```
|
|
350
350
|
|
|
351
|
-
**--body
|
|
352
|
-
-
|
|
353
|
-
-
|
|
354
|
-
-
|
|
355
|
-
-
|
|
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
|
|
356
356
|
|
|
357
|
-
##
|
|
358
|
-
- **decision**:
|
|
359
|
-
- **task**:
|
|
360
|
-
- **project**:
|
|
361
|
-
- **schedule**:
|
|
362
|
-
- **context**:
|
|
363
|
-
- **preference**:
|
|
364
|
-
- **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
|
|
365
365
|
|
|
366
366
|
</memory-v2-guide>
|
|
367
367
|
```
|
|
368
368
|
|
|
369
|
-
##
|
|
369
|
+
## Differences from Legacy Memory Skill
|
|
370
370
|
|
|
371
|
-
|
|
|
371
|
+
| Item | memory (v1) | memory-v2 |
|
|
372
372
|
|------|-------------|-----------|
|
|
373
|
-
|
|
|
374
|
-
|
|
|
375
|
-
|
|
|
376
|
-
|
|
|
377
|
-
|
|
|
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 |
|
|
378
378
|
|
|
379
|
-
##
|
|
379
|
+
## Memory Connection Graph
|
|
380
380
|
|
|
381
|
-
|
|
381
|
+
Manages associations between memories as a graph.
|
|
382
382
|
|
|
383
|
-
###
|
|
383
|
+
### Build Graph
|
|
384
384
|
|
|
385
385
|
```bash
|
|
386
386
|
npx memory mindmap build <agent_id>
|
|
387
387
|
```
|
|
388
388
|
|
|
389
|
-
|
|
390
|
-
-
|
|
391
|
-
-
|
|
392
|
-
-
|
|
393
|
-
-
|
|
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`)
|
|
394
394
|
|
|
395
|
-
> **edgeThreshold = 0.3**
|
|
395
|
+
> **edgeThreshold = 0.3** -> Total weight must be 0.3 or above to create a connection
|
|
396
396
|
|
|
397
|
-
###
|
|
397
|
+
### (Important) Tips for Increasing Connectivity
|
|
398
398
|
|
|
399
|
-
|
|
399
|
+
**Key: Avoid `general` and be specific!**
|
|
400
400
|
|
|
401
|
-
|
|
|
402
|
-
|
|
403
|
-
| topic
|
|
404
|
-
|
|
|
405
|
-
|
|
|
406
|
-
| 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 |
|
|
407
407
|
|
|
408
|
-
|
|
408
|
+
**[BAD] Bad example (no connections)**
|
|
409
409
|
```bash
|
|
410
|
-
# topic=general, category=general
|
|
411
|
-
npx memory save agent "Discord
|
|
410
|
+
# topic=general, category=general -> 0 connections
|
|
411
|
+
npx memory save agent "Discord settings removal" general
|
|
412
412
|
```
|
|
413
413
|
|
|
414
|
-
|
|
414
|
+
**[GOOD] Good example (strong connections)**
|
|
415
415
|
```bash
|
|
416
|
-
# topic + category + tags
|
|
417
|
-
npx memory save agent "Discord
|
|
416
|
+
# topic + category + tags -> maximum connections
|
|
417
|
+
npx memory save agent "Discord settings removal decision" decision \
|
|
418
418
|
--topic=discord \
|
|
419
419
|
--tags=settings,cpo-decision,oauth \
|
|
420
|
-
--body="CPO
|
|
420
|
+
--body="CPO meeting result..."
|
|
421
421
|
```
|
|
422
422
|
|
|
423
|
-
|
|
424
|
-
-
|
|
425
|
-
-
|
|
426
|
-
-
|
|
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`
|
|
427
427
|
|
|
428
|
-
###
|
|
428
|
+
### View Graph Summary
|
|
429
429
|
|
|
430
430
|
```bash
|
|
431
431
|
npx memory mindmap show <agent_id>
|
|
432
432
|
```
|
|
433
433
|
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
`--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.
|
|
437
437
|
|
|
438
|
-
|
|
438
|
+
**Period filter options:**
|
|
439
439
|
```bash
|
|
440
440
|
npx memory mindmap show <agent_id> --period=stm # 24h
|
|
441
441
|
npx memory mindmap show <agent_id> --period=mtm # 7d
|
|
442
442
|
npx memory mindmap show <agent_id> --period=ltm # 30d
|
|
443
443
|
```
|
|
444
444
|
|
|
445
|
-
### PNG
|
|
445
|
+
### Export as PNG Image
|
|
446
446
|
|
|
447
|
-
Mermaid
|
|
447
|
+
Convert Mermaid output to PNG images for visual inspection.
|
|
448
448
|
|
|
449
449
|
```bash
|
|
450
|
-
# 1. mermaid
|
|
450
|
+
# 1. Save mermaid code to file
|
|
451
451
|
npx memory mindmap show <agent_id> | sed 's/^```mermaid$//' | sed 's/^```$//' > /tmp/graph.mmd
|
|
452
452
|
|
|
453
|
-
# 2. PNG
|
|
453
|
+
# 2. Convert to PNG (runs without installation via npx)
|
|
454
454
|
npx @mermaid-js/mermaid-cli -i /tmp/graph.mmd -o graph.png -w 2400 -H 1600 -b white
|
|
455
455
|
|
|
456
|
-
#
|
|
456
|
+
# Period filter + PNG (e.g., last 24 hours only)
|
|
457
457
|
npx memory mindmap show <agent_id> --period=stm | sed 's/^```mermaid$//' | sed 's/^```$//' | grep -v '^(' > /tmp/graph-stm.mmd
|
|
458
458
|
npx @mermaid-js/mermaid-cli -i /tmp/graph-stm.mmd -o graph-stm.png -w 1600 -H 900 -b white
|
|
459
459
|
```
|
|
460
460
|
|
|
461
|
-
>
|
|
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).
|
|
462
462
|
|
|
463
|
-
###
|
|
463
|
+
### Query Related Memories
|
|
464
464
|
|
|
465
465
|
```bash
|
|
466
466
|
npx memory mindmap related <agent_id> <memory_id>
|
|
467
467
|
```
|
|
468
468
|
|
|
469
|
-
|
|
469
|
+
Displays memories connected to a specific memory, sorted by weight.
|
|
470
470
|
|
|
471
|
-
###
|
|
471
|
+
### Manual Connection Management
|
|
472
472
|
|
|
473
473
|
```bash
|
|
474
|
-
#
|
|
474
|
+
# Add connection
|
|
475
475
|
npx memory mindmap add <agent_id> <from_id> <to_id> [type]
|
|
476
476
|
|
|
477
|
-
#
|
|
477
|
+
# Remove connection
|
|
478
478
|
npx memory mindmap remove <agent_id> <from_id> <to_id>
|
|
479
479
|
```
|
|
480
480
|
|
|
481
|
-
###
|
|
481
|
+
### Visualization (HTML) - Shared Graph
|
|
482
482
|
|
|
483
483
|
```bash
|
|
484
484
|
npx memory mindmap html
|
|
485
485
|
```
|
|
486
486
|
|
|
487
|
-
|
|
487
|
+
Generates a **shared visualization combining connection graphs of all agents** in one place.
|
|
488
488
|
|
|
489
|
-
|
|
490
|
-
-
|
|
491
|
-
-
|
|
492
|
-
- D3.js force-directed
|
|
493
|
-
-
|
|
494
|
-
-
|
|
495
|
-
-
|
|
496
|
-
-
|
|
497
|
-
-
|
|
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
|
|
498
498
|
|
|
499
|
-
|
|
499
|
+
**Usage:**
|
|
500
500
|
```bash
|
|
501
|
-
# 1.
|
|
501
|
+
# 1. Generate shared HTML (no agent_id needed)
|
|
502
502
|
npx memory mindmap html
|
|
503
503
|
|
|
504
|
-
# 2.
|
|
504
|
+
# 2. Open in browser
|
|
505
505
|
npx memory mindmap open
|
|
506
506
|
```
|
|
507
507
|
|
|
508
|
-
|
|
508
|
+
**Example:**
|
|
509
509
|
```bash
|
|
510
|
-
#
|
|
510
|
+
# Generate integrated visualization of all agent graphs
|
|
511
511
|
npx memory mindmap html
|
|
512
512
|
```
|
|
513
513
|
|
|
514
|
-
###
|
|
514
|
+
### Open in Browser
|
|
515
515
|
|
|
516
516
|
```bash
|
|
517
517
|
npx memory mindmap open [agent_id]
|
|
518
518
|
```
|
|
519
519
|
|
|
520
|
-
|
|
520
|
+
Opens a specific agent's graph directly in the browser.
|
|
521
521
|
|
|
522
|
-
|
|
522
|
+
**Examples:**
|
|
523
523
|
```bash
|
|
524
|
-
# CTO
|
|
524
|
+
# Open CTO graph
|
|
525
525
|
npx memory mindmap open cto
|
|
526
526
|
|
|
527
|
-
#
|
|
527
|
+
# Open default (all agents)
|
|
528
528
|
npx memory mindmap open
|
|
529
529
|
```
|
|
530
530
|
|
|
531
|
-
###
|
|
531
|
+
### Storage Location
|
|
532
532
|
|
|
533
533
|
```
|
|
534
|
-
memory/{agent_id}/graph.json #
|
|
535
|
-
memory/mindmap.html #
|
|
534
|
+
memory/{agent_id}/graph.json # Graph data
|
|
535
|
+
memory/mindmap.html # Shared visualization HTML (generated by npx memory mindmap html)
|
|
536
536
|
```
|
|
537
537
|
|
|
538
538
|
---
|
|
539
539
|
|
|
540
|
-
##
|
|
540
|
+
## Memory Hierarchy Structure
|
|
541
541
|
|
|
542
|
-
`index`
|
|
542
|
+
The `index` command provides 3-tier output based on cognitive psychology (Ebbinghaus, Atkinson-Shiffrin) and AI agent memory research (MemoryOS, A-Mem).
|
|
543
543
|
|
|
544
|
-
|
|
|
545
|
-
|
|
546
|
-
|
|
|
547
|
-
|
|
|
548
|
-
|
|
|
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` |
|
|
549
549
|
|
|
550
|
-
|
|
550
|
+
Design rationale details: [README.md](./README.md#design-rationale-hierarchical-memory-architecture)
|
|
551
551
|
|
|
552
552
|
---
|
|
553
553
|
|
|
554
|
-
##
|
|
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
|
|
555
617
|
|
|
556
618
|
```bash
|
|
557
619
|
npx memory migrate <agent_id>
|