myagentmemory 0.4.8 → 0.4.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,14 @@
1
1
  ---
2
2
  name: agent-memory
3
- description: Persistent memory across coding sessions — long-term facts, daily logs, scratchpad checklist, and semantic search.
3
+ description: Persistent memory across coding sessions — long-term facts, daily logs, topic notes, scratchpad checklist, and semantic search.
4
4
  ---
5
5
 
6
6
  # Agent Memory
7
7
 
8
8
  You have a persistent memory system. Use it **proactively** — don't wait to be asked.
9
9
 
10
+ Pi users can choose the native extension (`pi-memory`: https://github.com/jayzeng/pi-memory) or use this CLI + skill workflow as the cross-platform alternative.
11
+
10
12
  This skill works with any CLI-based coding agent that can execute shell commands. All state is stored as plain markdown files in `~/.agent-memory/` (configurable via `AGENT_MEMORY_DIR` env var or `--dir` flag).
11
13
 
12
14
  ## On Session Start — Load Context First
@@ -37,21 +39,22 @@ agent-memory search --query "<topic>" --mode keyword
37
39
  | What happened | Write to | Why |
38
40
  |---|---|---|
39
41
  | Made progress, fixed a bug, investigated something | `daily` | Session-specific — searchable later via qmd |
42
+ | Tracking a topic or event across days | `topic` | Builds a per-topic file with backlinks to daily logs |
40
43
  | User said "remember this" about a preference or decision | `long_term` | Durable fact, needs to be in every session's context |
41
44
  | Discovered a recurring pattern (3rd time seeing it) | `long_term` | Graduated from daily observations to established fact |
42
45
  | Found a gotcha, workaround, or non-obvious behavior | `daily` first | If it keeps coming up, *then* promote to long-term |
43
- | TODO or follow-up for next session | `scratchpad` | Active task tracking |
46
+ | TODO or follow-up for any task (persistent todo) | `scratchpad` | Persistent, cross-session task tracking |
44
47
 
45
48
  **MEMORY.md is a curated wiki, not a log.** It should stay under ~50 lines of high-signal content. If you're appending to it frequently, you're probably writing to the wrong target.
46
49
 
47
50
  ## Memory Commands
48
51
 
49
- ### Write to daily log (default)
52
+ ### Write to daily log (default — no --target needed)
50
53
 
51
54
  ```bash
52
55
  # Session notes, progress, bugs found, decisions made
53
- agent-memory write --target daily --content "Fixed auth bug in login.ts — token refresh was missing"
54
- agent-memory write --target daily --content "Investigated slow queries — N+1 in getUserOrders, added .include(:orders)"
56
+ agent-memory write --content "Fixed auth bug in login.ts — token refresh was missing"
57
+ agent-memory write --content "Investigated slow queries — N+1 in getUserOrders, added .include(:orders)"
55
58
  ```
56
59
 
57
60
  ### Write to long-term memory (rare, curated)
@@ -66,17 +69,26 @@ agent-memory write --target long_term --content "..." --mode overwrite
66
69
 
67
70
  When writing to long-term, prefer **overwrite mode** to curate the whole file rather than blindly appending. Read it first, then rewrite with the new fact incorporated.
68
71
 
72
+ ### Write to a topic/event file
73
+
74
+ ```bash
75
+ # Event- or theme-based log with backlinks to the daily entry
76
+ agent-memory write --target topic --topic "auth" --content "JWT refresh rolled out to edge #auth"
77
+ ```
78
+
69
79
  ### Read
70
80
 
71
81
  ```bash
72
82
  agent-memory read --target daily # Today's log
73
83
  agent-memory read --target daily --date 2026-02-15 # Specific day
74
84
  agent-memory read --target list # All daily log files
85
+ agent-memory read --target topic --topic "auth"
86
+ agent-memory read --target topics # All topic files
75
87
  agent-memory read --target long_term # MEMORY.md
76
88
  agent-memory read --target scratchpad # Scratchpad checklist
77
89
  ```
78
90
 
79
- ### Scratchpad (cross-session TODOs)
91
+ ### Scratchpad (persistent TODOs)
80
92
 
81
93
  ```bash
82
94
  agent-memory scratchpad add --text "Review PR #42"
@@ -113,14 +125,17 @@ agent-memory status # Show config, file counts, qmd status
113
125
  ## Writing Good Entries
114
126
 
115
127
  ### Daily log entries
116
- Describe what you did and what you learned. Future-you will search for these.
128
+ Describe what you did and what you learned. Include `#tags` distil uses them to organize MEMORY.md.
129
+
130
+ **Recommended tags** (use what fits, invent your own as needed):
131
+ `#architecture` `#auth` `#bugfix` `#database` `#deploy` `#docs` `#ops` `#perf` `#refactor` `#security` `#testing` `#ui`
117
132
 
118
133
  ```bash
119
- # Good — specific, searchable
120
- agent-memory write --target daily --content "Refactored auth middleware to use jose instead of jsonwebtoken. Reduced bundle by 40KB. Token validation now in middleware/auth.ts."
134
+ # Good — specific, searchable, tagged
135
+ agent-memory write --content "Refactored auth middleware to use jose instead of jsonwebtoken. Reduced bundle by 40KB. #refactor #auth"
121
136
 
122
- # Bad — too vague to be useful in search
123
- agent-memory write --target daily --content "worked on auth stuff"
137
+ # Bad — too vague, no tags
138
+ agent-memory write --content "worked on auth stuff"
124
139
  ```
125
140
 
126
141
  ### Long-term entries
@@ -136,18 +151,28 @@ agent-memory write --target long_term --content "Fixed the deploy script today"
136
151
 
137
152
  ## Memory Hygiene
138
153
 
139
- - **Daily is the default** — when in doubt, write to daily
154
+ - **Daily is the default** — when in doubt, write to daily (no `--target` needed)
140
155
  - **MEMORY.md is a wiki** — curate it by reading + rewriting, not by appending endlessly
141
156
  - **Keep MEMORY.md under ~50 lines** — it's injected into every session, so only high-signal facts belong there
142
157
  - **Search before writing long-term** — the fact may already exist in a daily log, searchable via qmd
143
158
  - **Promote deliberately** — if a pattern appears in daily logs 3+ times, that's when it earns a spot in MEMORY.md
159
+ - **Distil periodically** — run `agent-memory distil` to auto-generate a compact tagged index in MEMORY.md from daily logs and topics
160
+
161
+ ### Distil — auto-curate MEMORY.md
162
+
163
+ ```bash
164
+ agent-memory distil --dry-run # Preview without writing
165
+ agent-memory distil # Overwrite MEMORY.md with distilled index
166
+ ```
167
+
168
+ Distil scans daily logs and topic notes, groups entries by their `#tags`, and generates a compact MEMORY.md with tag-based sections, a topic index, and a tag index. Any `## Pinned` section in the existing MEMORY.md is preserved. The more consistently you tag entries, the better the distilled output.
144
169
 
145
170
  ## Guidelines
146
171
 
147
172
  - When someone says "remember this", decide: is it a durable fact (long-term) or a session note (daily)?
148
- - Default to `--target daily` for almost everything
173
+ - Default to daily for almost everything (just `--content "..."` — no `--target` needed)
149
174
  - Use `--target long_term` sparingly: architecture, preferences, key commands, hard-won lessons
150
- - Use the scratchpad for: TODOs, follow-ups, multi-session tracking
175
+ - Prefer the scratchpad for any TODOs or follow-ups (persistent, cross-session tracking)
151
176
  - Use `#tags` and `[[links]]` in content to improve search recall
152
177
  - Use `agent-memory search` to recall past work before starting related tasks
153
178
  - All `agent-memory` commands are safe — they read/write only to the memory directory (`~/.agent-memory/` by default)
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: agent-memory
3
- description: Persistent memory across coding sessions — long-term facts, daily logs, scratchpad checklist, and semantic search.
3
+ description: Persistent memory across coding sessions — long-term facts, daily logs, topic notes, scratchpad checklist, and semantic search.
4
4
  allowed-tools: Bash(agent-memory *)
5
5
  ---
6
6
 
@@ -8,6 +8,8 @@ allowed-tools: Bash(agent-memory *)
8
8
 
9
9
  You have a persistent memory system. Use it **proactively** — don't wait to be asked.
10
10
 
11
+ Pi users can choose the native extension (`pi-memory`: https://github.com/jayzeng/pi-memory) or use this CLI + skill workflow as the cross-platform alternative.
12
+
11
13
  ## Current Memory Context
12
14
 
13
15
  !`agent-memory context --no-search 2>/dev/null`
@@ -33,21 +35,22 @@ You have a persistent memory system. Use it **proactively** — don't wait to be
33
35
  | What happened | Write to | Why |
34
36
  |---|---|---|
35
37
  | Made progress, fixed a bug, investigated something | `daily` | Session-specific — searchable later via qmd |
38
+ | Tracking a topic or event across days | `topic` | Builds a per-topic file with backlinks to daily logs |
36
39
  | User said "remember this" about a preference or decision | `long_term` | Durable fact, needs to be in every session's context |
37
40
  | Discovered a recurring pattern (3rd time seeing it) | `long_term` | Graduated from daily observations to established fact |
38
41
  | Found a gotcha, workaround, or non-obvious behavior | `daily` first | If it keeps coming up, *then* promote to long-term |
39
- | TODO or follow-up for next session | `scratchpad` | Active task tracking |
42
+ | TODO or follow-up for any task (persistent todo) | `scratchpad` | Persistent, cross-session task tracking |
40
43
 
41
44
  **MEMORY.md is a curated wiki, not a log.** It should stay under ~50 lines of high-signal content. If you're appending to it frequently, you're probably writing to the wrong target.
42
45
 
43
46
  ## Memory Commands
44
47
 
45
- ### Write to daily log (default)
48
+ ### Write to daily log (default — no --target needed)
46
49
 
47
50
  ```bash
48
51
  # Session notes, progress, bugs found, decisions made
49
- agent-memory write --target daily --content "Fixed auth bug in login.ts — token refresh was missing"
50
- agent-memory write --target daily --content "Investigated slow queries — N+1 in getUserOrders, added .include(:orders)"
52
+ agent-memory write --content "Fixed auth bug in login.ts — token refresh was missing"
53
+ agent-memory write --content "Investigated slow queries — N+1 in getUserOrders, added .include(:orders)"
51
54
  ```
52
55
 
53
56
  ### Write to long-term memory (rare, curated)
@@ -62,17 +65,26 @@ agent-memory write --target long_term --content "..." --mode overwrite
62
65
 
63
66
  When writing to long-term, prefer **overwrite mode** to curate the whole file rather than blindly appending. Read it first, then rewrite with the new fact incorporated.
64
67
 
68
+ ### Write to a topic/event file
69
+
70
+ ```bash
71
+ # Event- or theme-based log with backlinks to the daily entry
72
+ agent-memory write --target topic --topic "auth" --content "JWT refresh rolled out to edge #auth"
73
+ ```
74
+
65
75
  ### Read
66
76
 
67
77
  ```bash
68
78
  agent-memory read --target daily # Today's log
69
79
  agent-memory read --target daily --date 2026-02-15 # Specific day
70
80
  agent-memory read --target list # All daily log files
81
+ agent-memory read --target topic --topic "auth"
82
+ agent-memory read --target topics # All topic files
71
83
  agent-memory read --target long_term # MEMORY.md
72
84
  agent-memory read --target scratchpad # Scratchpad checklist
73
85
  ```
74
86
 
75
- ### Scratchpad (cross-session TODOs)
87
+ ### Scratchpad (persistent TODOs)
76
88
 
77
89
  ```bash
78
90
  agent-memory scratchpad add --text "Review PR #42"
@@ -109,14 +121,17 @@ agent-memory status # Show config, file counts, qmd status
109
121
  ## Writing Good Entries
110
122
 
111
123
  ### Daily log entries
112
- Describe what you did and what you learned. Future-you will search for these.
124
+ Describe what you did and what you learned. Include `#tags` distil uses them to organize MEMORY.md.
125
+
126
+ **Recommended tags** (use what fits, invent your own as needed):
127
+ `#architecture` `#auth` `#bugfix` `#database` `#deploy` `#docs` `#ops` `#perf` `#refactor` `#security` `#testing` `#ui`
113
128
 
114
129
  ```bash
115
- # Good — specific, searchable
116
- agent-memory write --target daily --content "Refactored auth middleware to use jose instead of jsonwebtoken. Reduced bundle by 40KB. Token validation now in middleware/auth.ts."
130
+ # Good — specific, searchable, tagged
131
+ agent-memory write --content "Refactored auth middleware to use jose instead of jsonwebtoken. Reduced bundle by 40KB. #refactor #auth"
117
132
 
118
- # Bad — too vague to be useful in search
119
- agent-memory write --target daily --content "worked on auth stuff"
133
+ # Bad — too vague, no tags
134
+ agent-memory write --content "worked on auth stuff"
120
135
  ```
121
136
 
122
137
  ### Long-term entries
@@ -132,17 +147,27 @@ agent-memory write --target long_term --content "Fixed the deploy script today"
132
147
 
133
148
  ## Memory Hygiene
134
149
 
135
- - **Daily is the default** — when in doubt, write to daily
150
+ - **Daily is the default** — when in doubt, write to daily (no `--target` needed)
136
151
  - **MEMORY.md is a wiki** — curate it by reading + rewriting, not by appending endlessly
137
152
  - **Keep MEMORY.md under ~50 lines** — it's injected into every session, so only high-signal facts belong there
138
153
  - **Search before writing long-term** — the fact may already exist in a daily log, searchable via qmd
139
154
  - **Promote deliberately** — if a pattern appears in daily logs 3+ times, that's when it earns a spot in MEMORY.md
155
+ - **Distil periodically** — run `agent-memory distil` to auto-generate a compact tagged index in MEMORY.md from daily logs and topics
156
+
157
+ ### Distil — auto-curate MEMORY.md
158
+
159
+ ```bash
160
+ agent-memory distil --dry-run # Preview without writing
161
+ agent-memory distil # Overwrite MEMORY.md with distilled index
162
+ ```
163
+
164
+ Distil scans daily logs and topic notes, groups entries by their `#tags`, and generates a compact MEMORY.md with tag-based sections, a topic index, and a tag index. Any `## Pinned` section in the existing MEMORY.md is preserved. The more consistently you tag entries, the better the distilled output.
140
165
 
141
166
  ## Guidelines
142
167
 
143
168
  - When someone says "remember this", decide: is it a durable fact (long-term) or a session note (daily)?
144
- - Default to `--target daily` for almost everything
169
+ - Default to daily for almost everything (just `--content "..."` — no `--target` needed)
145
170
  - Use `--target long_term` sparingly: architecture, preferences, key commands, hard-won lessons
146
- - Use the scratchpad for: TODOs, follow-ups, multi-session tracking
171
+ - Prefer the scratchpad for any TODOs or follow-ups (persistent, cross-session tracking)
147
172
  - Use `#tags` and `[[links]]` in content to improve search recall
148
173
  - Use `agent-memory search` to recall past work before starting related tasks
@@ -1,12 +1,14 @@
1
1
  ---
2
2
  name: agent-memory
3
- description: Persistent memory across coding sessions — long-term facts, daily logs, scratchpad checklist, and semantic search.
3
+ description: Persistent memory across coding sessions — long-term facts, daily logs, topic notes, scratchpad checklist, and semantic search.
4
4
  ---
5
5
 
6
6
  # Agent Memory
7
7
 
8
8
  You have a persistent memory system. Use it **proactively** — don't wait to be asked.
9
9
 
10
+ Pi users can choose the native extension (`pi-memory`: https://github.com/jayzeng/pi-memory) or use this CLI + skill workflow as the cross-platform alternative.
11
+
10
12
  ## On Session Start — Load Context First
11
13
 
12
14
  Run this immediately at the beginning of every session:
@@ -35,21 +37,22 @@ agent-memory search --query "<topic>" --mode keyword
35
37
  | What happened | Write to | Why |
36
38
  |---|---|---|
37
39
  | Made progress, fixed a bug, investigated something | `daily` | Session-specific — searchable later via qmd |
40
+ | Tracking a topic or event across days | `topic` | Builds a per-topic file with backlinks to daily logs |
38
41
  | User said "remember this" about a preference or decision | `long_term` | Durable fact, needs to be in every session's context |
39
42
  | Discovered a recurring pattern (3rd time seeing it) | `long_term` | Graduated from daily observations to established fact |
40
43
  | Found a gotcha, workaround, or non-obvious behavior | `daily` first | If it keeps coming up, *then* promote to long-term |
41
- | TODO or follow-up for next session | `scratchpad` | Active task tracking |
44
+ | TODO or follow-up for any task (persistent todo) | `scratchpad` | Persistent, cross-session task tracking |
42
45
 
43
46
  **MEMORY.md is a curated wiki, not a log.** It should stay under ~50 lines of high-signal content. If you're appending to it frequently, you're probably writing to the wrong target.
44
47
 
45
48
  ## Memory Commands
46
49
 
47
- ### Write to daily log (default)
50
+ ### Write to daily log (default — no --target needed)
48
51
 
49
52
  ```bash
50
53
  # Session notes, progress, bugs found, decisions made
51
- agent-memory write --target daily --content "Fixed auth bug in login.ts — token refresh was missing"
52
- agent-memory write --target daily --content "Investigated slow queries — N+1 in getUserOrders, added .include(:orders)"
54
+ agent-memory write --content "Fixed auth bug in login.ts — token refresh was missing"
55
+ agent-memory write --content "Investigated slow queries — N+1 in getUserOrders, added .include(:orders)"
53
56
  ```
54
57
 
55
58
  ### Write to long-term memory (rare, curated)
@@ -64,17 +67,26 @@ agent-memory write --target long_term --content "..." --mode overwrite
64
67
 
65
68
  When writing to long-term, prefer **overwrite mode** to curate the whole file rather than blindly appending. Read it first, then rewrite with the new fact incorporated.
66
69
 
70
+ ### Write to a topic/event file
71
+
72
+ ```bash
73
+ # Event- or theme-based log with backlinks to the daily entry
74
+ agent-memory write --target topic --topic "auth" --content "JWT refresh rolled out to edge #auth"
75
+ ```
76
+
67
77
  ### Read
68
78
 
69
79
  ```bash
70
80
  agent-memory read --target daily # Today's log
71
81
  agent-memory read --target daily --date 2026-02-15 # Specific day
72
82
  agent-memory read --target list # All daily log files
83
+ agent-memory read --target topic --topic "auth"
84
+ agent-memory read --target topics # All topic files
73
85
  agent-memory read --target long_term # MEMORY.md
74
86
  agent-memory read --target scratchpad # Scratchpad checklist
75
87
  ```
76
88
 
77
- ### Scratchpad (cross-session TODOs)
89
+ ### Scratchpad (persistent TODOs)
78
90
 
79
91
  ```bash
80
92
  agent-memory scratchpad add --text "Review PR #42"
@@ -111,14 +123,17 @@ agent-memory status # Show config, file counts, qmd status
111
123
  ## Writing Good Entries
112
124
 
113
125
  ### Daily log entries
114
- Describe what you did and what you learned. Future-you will search for these.
126
+ Describe what you did and what you learned. Include `#tags` distil uses them to organize MEMORY.md.
127
+
128
+ **Recommended tags** (use what fits, invent your own as needed):
129
+ `#architecture` `#auth` `#bugfix` `#database` `#deploy` `#docs` `#ops` `#perf` `#refactor` `#security` `#testing` `#ui`
115
130
 
116
131
  ```bash
117
- # Good — specific, searchable
118
- agent-memory write --target daily --content "Refactored auth middleware to use jose instead of jsonwebtoken. Reduced bundle by 40KB. Token validation now in middleware/auth.ts."
132
+ # Good — specific, searchable, tagged
133
+ agent-memory write --content "Refactored auth middleware to use jose instead of jsonwebtoken. Reduced bundle by 40KB. #refactor #auth"
119
134
 
120
- # Bad — too vague to be useful in search
121
- agent-memory write --target daily --content "worked on auth stuff"
135
+ # Bad — too vague, no tags
136
+ agent-memory write --content "worked on auth stuff"
122
137
  ```
123
138
 
124
139
  ### Long-term entries
@@ -134,18 +149,28 @@ agent-memory write --target long_term --content "Fixed the deploy script today"
134
149
 
135
150
  ## Memory Hygiene
136
151
 
137
- - **Daily is the default** — when in doubt, write to daily
152
+ - **Daily is the default** — when in doubt, write to daily (no `--target` needed)
138
153
  - **MEMORY.md is a wiki** — curate it by reading + rewriting, not by appending endlessly
139
154
  - **Keep MEMORY.md under ~50 lines** — it's injected into every session, so only high-signal facts belong there
140
155
  - **Search before writing long-term** — the fact may already exist in a daily log, searchable via qmd
141
156
  - **Promote deliberately** — if a pattern appears in daily logs 3+ times, that's when it earns a spot in MEMORY.md
157
+ - **Distil periodically** — run `agent-memory distil` to auto-generate a compact tagged index in MEMORY.md from daily logs and topics
158
+
159
+ ### Distil — auto-curate MEMORY.md
160
+
161
+ ```bash
162
+ agent-memory distil --dry-run # Preview without writing
163
+ agent-memory distil # Overwrite MEMORY.md with distilled index
164
+ ```
165
+
166
+ Distil scans daily logs and topic notes, groups entries by their `#tags`, and generates a compact MEMORY.md with tag-based sections, a topic index, and a tag index. Any `## Pinned` section in the existing MEMORY.md is preserved. The more consistently you tag entries, the better the distilled output.
142
167
 
143
168
  ## Guidelines
144
169
 
145
170
  - When someone says "remember this", decide: is it a durable fact (long-term) or a session note (daily)?
146
- - Default to `--target daily` for almost everything
171
+ - Default to daily for almost everything (just `--content "..."` — no `--target` needed)
147
172
  - Use `--target long_term` sparingly: architecture, preferences, key commands, hard-won lessons
148
- - Use the scratchpad for: TODOs, follow-ups, multi-session tracking
173
+ - Prefer the scratchpad for any TODOs or follow-ups (persistent, cross-session tracking)
149
174
  - Use `#tags` and `[[links]]` in content to improve search recall
150
175
  - Use `agent-memory search` to recall past work before starting related tasks
151
176
  - All `agent-memory` commands are safe — they read/write only to the memory directory (`~/.agent-memory/` by default)
@@ -1,12 +1,14 @@
1
1
  ---
2
2
  name: agent-memory
3
- description: Persistent memory across coding sessions — long-term facts, daily logs, scratchpad checklist, and semantic search.
3
+ description: Persistent memory across coding sessions — long-term facts, daily logs, topic notes, scratchpad checklist, and semantic search.
4
4
  ---
5
5
 
6
6
  # Agent Memory
7
7
 
8
8
  You have a persistent memory system. Use it **proactively** — don't wait to be asked.
9
9
 
10
+ Pi users can choose the native extension (`pi-memory`: https://github.com/jayzeng/pi-memory) or use this CLI + skill workflow as the cross-platform alternative.
11
+
10
12
  ## On Session Start — Load Context First
11
13
 
12
14
  Run this at the beginning of every session to load your memory:
@@ -37,21 +39,22 @@ agent-memory search --query "<topic>" --mode keyword
37
39
  | What happened | Write to | Why |
38
40
  |---|---|---|
39
41
  | Made progress, fixed a bug, investigated something | `daily` | Session-specific — searchable later via qmd |
42
+ | Tracking a topic or event across days | `topic` | Builds a per-topic file with backlinks to daily logs |
40
43
  | User said "remember this" about a preference or decision | `long_term` | Durable fact, needs to be in every session's context |
41
44
  | Discovered a recurring pattern (3rd time seeing it) | `long_term` | Graduated from daily observations to established fact |
42
45
  | Found a gotcha, workaround, or non-obvious behavior | `daily` first | If it keeps coming up, *then* promote to long-term |
43
- | TODO or follow-up for next session | `scratchpad` | Active task tracking |
46
+ | TODO or follow-up for any task (persistent todo) | `scratchpad` | Persistent, cross-session task tracking |
44
47
 
45
48
  **MEMORY.md is a curated wiki, not a log.** It should stay under ~50 lines of high-signal content. If you're appending to it frequently, you're probably writing to the wrong target.
46
49
 
47
50
  ## Memory Commands
48
51
 
49
- ### Write to daily log (default)
52
+ ### Write to daily log (default — no --target needed)
50
53
 
51
54
  ```bash
52
55
  # Session notes, progress, bugs found, decisions made
53
- agent-memory write --target daily --content "Fixed auth bug in login.ts — token refresh was missing"
54
- agent-memory write --target daily --content "Investigated slow queries — N+1 in getUserOrders, added .include(:orders)"
56
+ agent-memory write --content "Fixed auth bug in login.ts — token refresh was missing"
57
+ agent-memory write --content "Investigated slow queries — N+1 in getUserOrders, added .include(:orders)"
55
58
  ```
56
59
 
57
60
  ### Write to long-term memory (rare, curated)
@@ -66,17 +69,26 @@ agent-memory write --target long_term --content "..." --mode overwrite
66
69
 
67
70
  When writing to long-term, prefer **overwrite mode** to curate the whole file rather than blindly appending. Read it first, then rewrite with the new fact incorporated.
68
71
 
72
+ ### Write to a topic/event file
73
+
74
+ ```bash
75
+ # Event- or theme-based log with backlinks to the daily entry
76
+ agent-memory write --target topic --topic "auth" --content "JWT refresh rolled out to edge #auth"
77
+ ```
78
+
69
79
  ### Read
70
80
 
71
81
  ```bash
72
82
  agent-memory read --target daily # Today's log
73
83
  agent-memory read --target daily --date 2026-02-15 # Specific day
74
84
  agent-memory read --target list # All daily log files
85
+ agent-memory read --target topic --topic "auth"
86
+ agent-memory read --target topics # All topic files
75
87
  agent-memory read --target long_term # MEMORY.md
76
88
  agent-memory read --target scratchpad # Scratchpad checklist
77
89
  ```
78
90
 
79
- ### Scratchpad (cross-session TODOs)
91
+ ### Scratchpad (persistent TODOs)
80
92
 
81
93
  ```bash
82
94
  agent-memory scratchpad add --text "Review PR #42"
@@ -113,14 +125,17 @@ agent-memory status # Show config, file counts, qmd status
113
125
  ## Writing Good Entries
114
126
 
115
127
  ### Daily log entries
116
- Describe what you did and what you learned. Future-you will search for these.
128
+ Describe what you did and what you learned. Include `#tags` distil uses them to organize MEMORY.md.
129
+
130
+ **Recommended tags** (use what fits, invent your own as needed):
131
+ `#architecture` `#auth` `#bugfix` `#database` `#deploy` `#docs` `#ops` `#perf` `#refactor` `#security` `#testing` `#ui`
117
132
 
118
133
  ```bash
119
- # Good — specific, searchable
120
- agent-memory write --target daily --content "Refactored auth middleware to use jose instead of jsonwebtoken. Reduced bundle by 40KB. Token validation now in middleware/auth.ts."
134
+ # Good — specific, searchable, tagged
135
+ agent-memory write --content "Refactored auth middleware to use jose instead of jsonwebtoken. Reduced bundle by 40KB. #refactor #auth"
121
136
 
122
- # Bad — too vague to be useful in search
123
- agent-memory write --target daily --content "worked on auth stuff"
137
+ # Bad — too vague, no tags
138
+ agent-memory write --content "worked on auth stuff"
124
139
  ```
125
140
 
126
141
  ### Long-term entries
@@ -136,18 +151,28 @@ agent-memory write --target long_term --content "Fixed the deploy script today"
136
151
 
137
152
  ## Memory Hygiene
138
153
 
139
- - **Daily is the default** — when in doubt, write to daily
154
+ - **Daily is the default** — when in doubt, write to daily (no `--target` needed)
140
155
  - **MEMORY.md is a wiki** — curate it by reading + rewriting, not by appending endlessly
141
156
  - **Keep MEMORY.md under ~50 lines** — it's injected into every session, so only high-signal facts belong there
142
157
  - **Search before writing long-term** — the fact may already exist in a daily log, searchable via qmd
143
158
  - **Promote deliberately** — if a pattern appears in daily logs 3+ times, that's when it earns a spot in MEMORY.md
159
+ - **Distil periodically** — run `agent-memory distil` to auto-generate a compact tagged index in MEMORY.md from daily logs and topics
160
+
161
+ ### Distil — auto-curate MEMORY.md
162
+
163
+ ```bash
164
+ agent-memory distil --dry-run # Preview without writing
165
+ agent-memory distil # Overwrite MEMORY.md with distilled index
166
+ ```
167
+
168
+ Distil scans daily logs and topic notes, groups entries by their `#tags`, and generates a compact MEMORY.md with tag-based sections, a topic index, and a tag index. Any `## Pinned` section in the existing MEMORY.md is preserved. The more consistently you tag entries, the better the distilled output.
144
169
 
145
170
  ## Guidelines
146
171
 
147
172
  - When someone says "remember this", decide: is it a durable fact (long-term) or a session note (daily)?
148
- - Default to `--target daily` for almost everything
173
+ - Default to daily for almost everything (just `--content "..."` — no `--target` needed)
149
174
  - Use `--target long_term` sparingly: architecture, preferences, key commands, hard-won lessons
150
- - Use the scratchpad for: TODOs, follow-ups, multi-session tracking
175
+ - Prefer the scratchpad for any TODOs or follow-ups (persistent, cross-session tracking)
151
176
  - Use `#tags` and `[[links]]` in content to improve search recall
152
177
  - Use `agent-memory search` to recall past work before starting related tasks
153
178
  - All `agent-memory` commands are safe — they read/write only to the memory directory (`~/.agent-memory/` by default)