myagentmemory 0.4.4 → 0.4.6

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.
@@ -5,100 +5,149 @@ description: Persistent memory across coding sessions — long-term facts, daily
5
5
 
6
6
  # Agent Memory
7
7
 
8
- You have a persistent memory system. Use it to remember decisions, preferences, lessons learned, and context across sessions.
8
+ You have a persistent memory system. Use it **proactively** don't wait to be asked.
9
9
 
10
- ## Important: Load context at session start
10
+ 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
11
 
12
- At the beginning of each session, run this command to load your memory context:
12
+ ## On Session Start Load Context First
13
+
14
+ Run this at the beginning of every session to load your memory:
13
15
 
14
16
  ```bash
15
17
  agent-memory context --no-search 2>/dev/null
16
18
  ```
17
19
 
18
- ## Memory Commands
20
+ This prints your scratchpad, today's log, long-term memory, and yesterday's log. Review it — especially **open scratchpad items** — before starting work.
19
21
 
20
- All commands use the `agent-memory` CLI. Examples:
22
+ If the user's task relates to prior work, search for relevant memories:
23
+ ```bash
24
+ agent-memory search --query "<topic>" --mode keyword
25
+ ```
21
26
 
22
- ### Write to memory
27
+ ## On Session End (After Significant Work)
23
28
 
24
- ```bash
25
- # Save a long-term fact, decision, or preference
26
- agent-memory write --target long_term --content "User prefers TypeScript with strict mode"
29
+ 1. Log what was accomplished in the daily log
30
+ 2. Mark completed scratchpad items as done; add new follow-ups
31
+ 3. Only write to long-term memory if you discovered a **durable fact** that doesn't already exist there
27
32
 
28
- # Overwrite MEMORY.md entirely (use with care)
29
- agent-memory write --target long_term --content "..." --mode overwrite
33
+ ## Where to Write Decision Guide
34
+
35
+ **Default to daily. Long-term is rare.**
36
+
37
+ | What happened | Write to | Why |
38
+ |---|---|---|
39
+ | Made progress, fixed a bug, investigated something | `daily` | Session-specific — searchable later via qmd |
40
+ | User said "remember this" about a preference or decision | `long_term` | Durable fact, needs to be in every session's context |
41
+ | Discovered a recurring pattern (3rd time seeing it) | `long_term` | Graduated from daily observations to established fact |
42
+ | 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 |
44
+
45
+ **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.
30
46
 
31
- # Append to today's daily log
32
- agent-memory write --target daily --content "Fixed auth bug in login.ts — was missing token refresh"
47
+ ## Memory Commands
48
+
49
+ ### Write to daily log (default)
50
+
51
+ ```bash
52
+ # 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)"
33
55
  ```
34
56
 
35
- ### Read memory
57
+ ### Write to long-term memory (rare, curated)
36
58
 
37
59
  ```bash
38
- # Read long-term memory
39
- agent-memory read --target long_term
60
+ # Only for durable facts that belong in every session's context
61
+ agent-memory write --target long_term --content "Project uses Drizzle ORM with PostgreSQL. Migrations in db/migrations/. #architecture"
40
62
 
41
- # Read today's daily log
42
- agent-memory read --target daily
63
+ # Overwrite MEMORY.md entirely (for curation — rewrite, don't append)
64
+ agent-memory write --target long_term --content "..." --mode overwrite
65
+ ```
43
66
 
44
- # Read a specific day's log
45
- agent-memory read --target daily --date 2026-02-15
67
+ 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.
46
68
 
47
- # List all daily logs
48
- agent-memory read --target list
69
+ ### Read
49
70
 
50
- # Read scratchpad
51
- agent-memory read --target scratchpad
71
+ ```bash
72
+ agent-memory read --target daily # Today's log
73
+ agent-memory read --target daily --date 2026-02-15 # Specific day
74
+ agent-memory read --target list # All daily log files
75
+ agent-memory read --target long_term # MEMORY.md
76
+ agent-memory read --target scratchpad # Scratchpad checklist
52
77
  ```
53
78
 
54
- ### Manage scratchpad (checklist)
79
+ ### Scratchpad (cross-session TODOs)
55
80
 
56
81
  ```bash
57
- # Add an item
58
82
  agent-memory scratchpad add --text "Review PR #42"
59
-
60
- # List items
61
83
  agent-memory scratchpad list
84
+ agent-memory scratchpad done --text "PR #42" # Matches by substring
85
+ agent-memory scratchpad undo --text "PR #42"
86
+ agent-memory scratchpad clear_done # Remove completed items
87
+ ```
62
88
 
63
- # Mark item as done (matches by substring)
64
- agent-memory scratchpad done --text "PR #42"
89
+ ### Search recall past work
65
90
 
66
- # Undo a done item
67
- agent-memory scratchpad undo --text "PR #42"
91
+ Search is how you find things written to daily logs. Use it before duplicating effort.
68
92
 
69
- # Remove all completed items
70
- agent-memory scratchpad clear_done
93
+ ```bash
94
+ agent-memory search --query "database choice" --mode keyword # Fast keyword
95
+ agent-memory search --query "how we handle auth" --mode semantic # Finds related concepts
96
+ agent-memory search --query "performance" --mode deep --limit 10 # Hybrid + reranking
71
97
  ```
72
98
 
73
- ### Search memory (requires qmd)
99
+ If qmd is not installed, fall back to reading files directly:
100
+ ```bash
101
+ agent-memory read --target long_term
102
+ agent-memory read --target daily
103
+ ```
104
+
105
+ ### Setup
74
106
 
75
107
  ```bash
76
- # Fast keyword search
77
- agent-memory search --query "database choice" --mode keyword
108
+ agent-memory init # Create dirs, detect qmd, setup collection
109
+ agent-memory sync # Re-index and embed all files (requires qmd)
110
+ agent-memory status # Show config, file counts, qmd status
111
+ ```
112
+
113
+ ## Writing Good Entries
78
114
 
79
- # Semantic search (finds related concepts)
80
- agent-memory search --query "how do we handle auth" --mode semantic
115
+ ### Daily log entries
116
+ Describe what you did and what you learned. Future-you will search for these.
81
117
 
82
- # Deep hybrid search with reranking
83
- agent-memory search --query "performance optimization" --mode deep --limit 10
118
+ ```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."
121
+
122
+ # Bad — too vague to be useful in search
123
+ agent-memory write --target daily --content "worked on auth stuff"
84
124
  ```
85
125
 
86
- ### Setup and status
126
+ ### Long-term entries
127
+ Only facts that should appear in **every** session's context. Use `#tags` and `[[links]]`.
87
128
 
88
129
  ```bash
89
- # Initialize memory directory and qmd collection
90
- agent-memory init
130
+ # Good this belongs in every session
131
+ agent-memory write --target long_term --content "Deploy: 'bun run deploy:prod', requires AWS_PROFILE=prod. #ops [[deploy]]"
91
132
 
92
- # Show configuration and status
93
- agent-memory status
133
+ # Bad this is a daily log entry, not a durable fact
134
+ agent-memory write --target long_term --content "Fixed the deploy script today"
94
135
  ```
95
136
 
137
+ ## Memory Hygiene
138
+
139
+ - **Daily is the default** — when in doubt, write to daily
140
+ - **MEMORY.md is a wiki** — curate it by reading + rewriting, not by appending endlessly
141
+ - **Keep MEMORY.md under ~50 lines** — it's injected into every session, so only high-signal facts belong there
142
+ - **Search before writing long-term** — the fact may already exist in a daily log, searchable via qmd
143
+ - **Promote deliberately** — if a pattern appears in daily logs 3+ times, that's when it earns a spot in MEMORY.md
144
+
96
145
  ## Guidelines
97
146
 
98
- - When someone says "remember this" or asks you to note something, write it immediately using `agent-memory write`
99
- - Use `--target long_term` for durable facts: decisions, preferences, architecture choices, lessons learned
100
- - Use `--target daily` for session notes: what you worked on, bugs found, progress updates
101
- - Use the scratchpad for TODOs, follow-ups, and things to keep in mind
102
- - Use `#tags` (e.g. `#decision`, `#preference`, `#lesson`) and `[[links]]` (e.g. `[[auth-strategy]]`) in content to improve future search recall
103
- - Before starting a task, check if relevant context exists via `agent-memory search`
104
- - At the end of a significant work session, summarize what was done in the daily log
147
+ - 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
149
+ - Use `--target long_term` sparingly: architecture, preferences, key commands, hard-won lessons
150
+ - Use the scratchpad for: TODOs, follow-ups, multi-session tracking
151
+ - Use `#tags` and `[[links]]` in content to improve search recall
152
+ - Use `agent-memory search` to recall past work before starting related tasks
153
+ - All `agent-memory` commands are safe they read/write only to the memory directory (`~/.agent-memory/` by default)
@@ -6,96 +6,143 @@ allowed-tools: Bash(agent-memory *)
6
6
 
7
7
  # Agent Memory
8
8
 
9
- You have a persistent memory system. Use it to remember decisions, preferences, lessons learned, and context across sessions.
9
+ You have a persistent memory system. Use it **proactively** don't wait to be asked.
10
10
 
11
11
  ## Current Memory Context
12
12
 
13
13
  !`agent-memory context --no-search 2>/dev/null`
14
14
 
15
- ## Memory Commands
15
+ ## Session Lifecycle
16
16
 
17
- All commands use the `agent-memory` CLI. Examples:
17
+ ### On session start
18
+ 1. Review the memory context above — especially **open scratchpad items** (pick up where you left off)
19
+ 2. If the user's task relates to prior work, search for relevant memories:
20
+ ```bash
21
+ agent-memory search --query "<topic>" --mode keyword
22
+ ```
18
23
 
19
- ### Write to memory
24
+ ### On session end (after significant work)
25
+ 1. Log what was accomplished in the daily log
26
+ 2. Mark completed scratchpad items as done; add new follow-ups
27
+ 3. Only write to long-term memory if you discovered a **durable fact** that doesn't already exist there
20
28
 
21
- ```bash
22
- # Save a long-term fact, decision, or preference
23
- agent-memory write --target long_term --content "User prefers TypeScript with strict mode"
29
+ ## Where to Write — Decision Guide
24
30
 
25
- # Overwrite MEMORY.md entirely (use with care)
26
- agent-memory write --target long_term --content "..." --mode overwrite
31
+ **Default to daily. Long-term is rare.**
32
+
33
+ | What happened | Write to | Why |
34
+ |---|---|---|
35
+ | Made progress, fixed a bug, investigated something | `daily` | Session-specific — searchable later via qmd |
36
+ | User said "remember this" about a preference or decision | `long_term` | Durable fact, needs to be in every session's context |
37
+ | Discovered a recurring pattern (3rd time seeing it) | `long_term` | Graduated from daily observations to established fact |
38
+ | 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 |
40
+
41
+ **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
+
43
+ ## Memory Commands
44
+
45
+ ### Write to daily log (default)
27
46
 
28
- # Append to today's daily log
29
- agent-memory write --target daily --content "Fixed auth bug in login.ts — was missing token refresh"
47
+ ```bash
48
+ # 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)"
30
51
  ```
31
52
 
32
- ### Read memory
53
+ ### Write to long-term memory (rare, curated)
33
54
 
34
55
  ```bash
35
- # Read long-term memory
36
- agent-memory read --target long_term
56
+ # Only for durable facts that belong in every session's context
57
+ agent-memory write --target long_term --content "Project uses Drizzle ORM with PostgreSQL. Migrations in db/migrations/. #architecture"
37
58
 
38
- # Read today's daily log
39
- agent-memory read --target daily
59
+ # Overwrite MEMORY.md entirely (for curation — rewrite, don't append)
60
+ agent-memory write --target long_term --content "..." --mode overwrite
61
+ ```
40
62
 
41
- # Read a specific day's log
42
- agent-memory read --target daily --date 2026-02-15
63
+ 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.
43
64
 
44
- # List all daily logs
45
- agent-memory read --target list
65
+ ### Read
46
66
 
47
- # Read scratchpad
48
- agent-memory read --target scratchpad
67
+ ```bash
68
+ agent-memory read --target daily # Today's log
69
+ agent-memory read --target daily --date 2026-02-15 # Specific day
70
+ agent-memory read --target list # All daily log files
71
+ agent-memory read --target long_term # MEMORY.md
72
+ agent-memory read --target scratchpad # Scratchpad checklist
49
73
  ```
50
74
 
51
- ### Manage scratchpad (checklist)
75
+ ### Scratchpad (cross-session TODOs)
52
76
 
53
77
  ```bash
54
- # Add an item
55
78
  agent-memory scratchpad add --text "Review PR #42"
56
-
57
- # List items
58
79
  agent-memory scratchpad list
80
+ agent-memory scratchpad done --text "PR #42" # Matches by substring
81
+ agent-memory scratchpad undo --text "PR #42"
82
+ agent-memory scratchpad clear_done # Remove completed items
83
+ ```
59
84
 
60
- # Mark item as done (matches by substring)
61
- agent-memory scratchpad done --text "PR #42"
85
+ ### Search recall past work
62
86
 
63
- # Undo a done item
64
- agent-memory scratchpad undo --text "PR #42"
87
+ Search is how you find things written to daily logs. Use it before duplicating effort.
65
88
 
66
- # Remove all completed items
67
- agent-memory scratchpad clear_done
89
+ ```bash
90
+ agent-memory search --query "database choice" --mode keyword # Fast keyword
91
+ agent-memory search --query "how we handle auth" --mode semantic # Finds related concepts
92
+ agent-memory search --query "performance" --mode deep --limit 10 # Hybrid + reranking
68
93
  ```
69
94
 
70
- ### Search memory (requires qmd)
95
+ If qmd is not installed, fall back to reading files directly:
96
+ ```bash
97
+ agent-memory read --target long_term
98
+ agent-memory read --target daily
99
+ ```
100
+
101
+ ### Setup
71
102
 
72
103
  ```bash
73
- # Fast keyword search
74
- agent-memory search --query "database choice" --mode keyword
104
+ agent-memory init # Create dirs, detect qmd, setup collection
105
+ agent-memory sync # Re-index and embed all files (requires qmd)
106
+ agent-memory status # Show config, file counts, qmd status
107
+ ```
75
108
 
76
- # Semantic search (finds related concepts)
77
- agent-memory search --query "how do we handle auth" --mode semantic
109
+ ## Writing Good Entries
78
110
 
79
- # Deep hybrid search with reranking
80
- agent-memory search --query "performance optimization" --mode deep --limit 10
111
+ ### Daily log entries
112
+ Describe what you did and what you learned. Future-you will search for these.
113
+
114
+ ```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."
117
+
118
+ # Bad — too vague to be useful in search
119
+ agent-memory write --target daily --content "worked on auth stuff"
81
120
  ```
82
121
 
83
- ### Setup and status
122
+ ### Long-term entries
123
+ Only facts that should appear in **every** session's context. Use `#tags` and `[[links]]`.
84
124
 
85
125
  ```bash
86
- # Initialize memory directory and qmd collection
87
- agent-memory init
126
+ # Good this belongs in every session
127
+ agent-memory write --target long_term --content "Deploy: 'bun run deploy:prod', requires AWS_PROFILE=prod. #ops [[deploy]]"
88
128
 
89
- # Show configuration and status
90
- agent-memory status
129
+ # Bad this is a daily log entry, not a durable fact
130
+ agent-memory write --target long_term --content "Fixed the deploy script today"
91
131
  ```
92
132
 
133
+ ## Memory Hygiene
134
+
135
+ - **Daily is the default** — when in doubt, write to daily
136
+ - **MEMORY.md is a wiki** — curate it by reading + rewriting, not by appending endlessly
137
+ - **Keep MEMORY.md under ~50 lines** — it's injected into every session, so only high-signal facts belong there
138
+ - **Search before writing long-term** — the fact may already exist in a daily log, searchable via qmd
139
+ - **Promote deliberately** — if a pattern appears in daily logs 3+ times, that's when it earns a spot in MEMORY.md
140
+
93
141
  ## Guidelines
94
142
 
95
- - When someone says "remember this" or asks you to note something, write it immediately using `agent-memory write`
96
- - Use `--target long_term` for durable facts: decisions, preferences, architecture choices, lessons learned
97
- - Use `--target daily` for session notes: what you worked on, bugs found, progress updates
98
- - Use the scratchpad for TODOs, follow-ups, and things to keep in mind
99
- - Use `#tags` (e.g. `#decision`, `#preference`, `#lesson`) and `[[links]]` (e.g. `[[auth-strategy]]`) in content to improve future search recall
100
- - Before starting a task, check if relevant context exists via `agent-memory search`
101
- - At the end of a significant work session, summarize what was done in the daily log
143
+ - 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
145
+ - Use `--target long_term` sparingly: architecture, preferences, key commands, hard-won lessons
146
+ - Use the scratchpad for: TODOs, follow-ups, multi-session tracking
147
+ - Use `#tags` and `[[links]]` in content to improve search recall
148
+ - Use `agent-memory search` to recall past work before starting related tasks
@@ -5,100 +5,147 @@ description: Persistent memory across coding sessions — long-term facts, daily
5
5
 
6
6
  # Agent Memory
7
7
 
8
- You have a persistent memory system. Use it to remember decisions, preferences, lessons learned, and context across sessions.
8
+ You have a persistent memory system. Use it **proactively** don't wait to be asked.
9
9
 
10
- ## Important: Load context at session start
10
+ ## On Session Start Load Context First
11
11
 
12
- At the beginning of each session, run this command to load your memory context:
12
+ Run this immediately at the beginning of every session:
13
13
 
14
14
  ```bash
15
15
  agent-memory context --no-search 2>/dev/null
16
16
  ```
17
17
 
18
- ## Memory Commands
18
+ This prints your scratchpad, today's log, long-term memory, and yesterday's log. Review it — especially **open scratchpad items** — before starting work.
19
19
 
20
- All commands use the `agent-memory` CLI. Examples:
20
+ If the user's task relates to prior work, search for relevant memories:
21
+ ```bash
22
+ agent-memory search --query "<topic>" --mode keyword
23
+ ```
21
24
 
22
- ### Write to memory
25
+ ## On Session End (After Significant Work)
23
26
 
24
- ```bash
25
- # Save a long-term fact, decision, or preference
26
- agent-memory write --target long_term --content "User prefers TypeScript with strict mode"
27
+ 1. Log what was accomplished in the daily log
28
+ 2. Mark completed scratchpad items as done; add new follow-ups
29
+ 3. Only write to long-term memory if you discovered a **durable fact** that doesn't already exist there
27
30
 
28
- # Overwrite MEMORY.md entirely (use with care)
29
- agent-memory write --target long_term --content "..." --mode overwrite
31
+ ## Where to Write Decision Guide
30
32
 
31
- # Append to today's daily log
32
- agent-memory write --target daily --content "Fixed auth bug in login.ts — was missing token refresh"
33
+ **Default to daily. Long-term is rare.**
34
+
35
+ | What happened | Write to | Why |
36
+ |---|---|---|
37
+ | Made progress, fixed a bug, investigated something | `daily` | Session-specific — searchable later via qmd |
38
+ | User said "remember this" about a preference or decision | `long_term` | Durable fact, needs to be in every session's context |
39
+ | Discovered a recurring pattern (3rd time seeing it) | `long_term` | Graduated from daily observations to established fact |
40
+ | 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 |
42
+
43
+ **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
+
45
+ ## Memory Commands
46
+
47
+ ### Write to daily log (default)
48
+
49
+ ```bash
50
+ # 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)"
33
53
  ```
34
54
 
35
- ### Read memory
55
+ ### Write to long-term memory (rare, curated)
36
56
 
37
57
  ```bash
38
- # Read long-term memory
39
- agent-memory read --target long_term
58
+ # Only for durable facts that belong in every session's context
59
+ agent-memory write --target long_term --content "Project uses Drizzle ORM with PostgreSQL. Migrations in db/migrations/. #architecture"
40
60
 
41
- # Read today's daily log
42
- agent-memory read --target daily
61
+ # Overwrite MEMORY.md entirely (for curation — rewrite, don't append)
62
+ agent-memory write --target long_term --content "..." --mode overwrite
63
+ ```
43
64
 
44
- # Read a specific day's log
45
- agent-memory read --target daily --date 2026-02-15
65
+ 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.
46
66
 
47
- # List all daily logs
48
- agent-memory read --target list
67
+ ### Read
49
68
 
50
- # Read scratchpad
51
- agent-memory read --target scratchpad
69
+ ```bash
70
+ agent-memory read --target daily # Today's log
71
+ agent-memory read --target daily --date 2026-02-15 # Specific day
72
+ agent-memory read --target list # All daily log files
73
+ agent-memory read --target long_term # MEMORY.md
74
+ agent-memory read --target scratchpad # Scratchpad checklist
52
75
  ```
53
76
 
54
- ### Manage scratchpad (checklist)
77
+ ### Scratchpad (cross-session TODOs)
55
78
 
56
79
  ```bash
57
- # Add an item
58
80
  agent-memory scratchpad add --text "Review PR #42"
59
-
60
- # List items
61
81
  agent-memory scratchpad list
82
+ agent-memory scratchpad done --text "PR #42" # Matches by substring
83
+ agent-memory scratchpad undo --text "PR #42"
84
+ agent-memory scratchpad clear_done # Remove completed items
85
+ ```
62
86
 
63
- # Mark item as done (matches by substring)
64
- agent-memory scratchpad done --text "PR #42"
87
+ ### Search recall past work
65
88
 
66
- # Undo a done item
67
- agent-memory scratchpad undo --text "PR #42"
89
+ Search is how you find things written to daily logs. Use it before duplicating effort.
68
90
 
69
- # Remove all completed items
70
- agent-memory scratchpad clear_done
91
+ ```bash
92
+ agent-memory search --query "database choice" --mode keyword # Fast keyword
93
+ agent-memory search --query "how we handle auth" --mode semantic # Finds related concepts
94
+ agent-memory search --query "performance" --mode deep --limit 10 # Hybrid + reranking
95
+ ```
96
+
97
+ If qmd is not installed, fall back to reading files directly:
98
+ ```bash
99
+ agent-memory read --target long_term
100
+ agent-memory read --target daily
71
101
  ```
72
102
 
73
- ### Search memory (requires qmd)
103
+ ### Setup
74
104
 
75
105
  ```bash
76
- # Fast keyword search
77
- agent-memory search --query "database choice" --mode keyword
106
+ agent-memory init # Create dirs, detect qmd, setup collection
107
+ agent-memory sync # Re-index and embed all files (requires qmd)
108
+ agent-memory status # Show config, file counts, qmd status
109
+ ```
110
+
111
+ ## Writing Good Entries
78
112
 
79
- # Semantic search (finds related concepts)
80
- agent-memory search --query "how do we handle auth" --mode semantic
113
+ ### Daily log entries
114
+ Describe what you did and what you learned. Future-you will search for these.
81
115
 
82
- # Deep hybrid search with reranking
83
- agent-memory search --query "performance optimization" --mode deep --limit 10
116
+ ```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."
119
+
120
+ # Bad — too vague to be useful in search
121
+ agent-memory write --target daily --content "worked on auth stuff"
84
122
  ```
85
123
 
86
- ### Setup and status
124
+ ### Long-term entries
125
+ Only facts that should appear in **every** session's context. Use `#tags` and `[[links]]`.
87
126
 
88
127
  ```bash
89
- # Initialize memory directory and qmd collection
90
- agent-memory init
128
+ # Good this belongs in every session
129
+ agent-memory write --target long_term --content "Deploy: 'bun run deploy:prod', requires AWS_PROFILE=prod. #ops [[deploy]]"
91
130
 
92
- # Show configuration and status
93
- agent-memory status
131
+ # Bad this is a daily log entry, not a durable fact
132
+ agent-memory write --target long_term --content "Fixed the deploy script today"
94
133
  ```
95
134
 
135
+ ## Memory Hygiene
136
+
137
+ - **Daily is the default** — when in doubt, write to daily
138
+ - **MEMORY.md is a wiki** — curate it by reading + rewriting, not by appending endlessly
139
+ - **Keep MEMORY.md under ~50 lines** — it's injected into every session, so only high-signal facts belong there
140
+ - **Search before writing long-term** — the fact may already exist in a daily log, searchable via qmd
141
+ - **Promote deliberately** — if a pattern appears in daily logs 3+ times, that's when it earns a spot in MEMORY.md
142
+
96
143
  ## Guidelines
97
144
 
98
- - When someone says "remember this" or asks you to note something, write it immediately using `agent-memory write`
99
- - Use `--target long_term` for durable facts: decisions, preferences, architecture choices, lessons learned
100
- - Use `--target daily` for session notes: what you worked on, bugs found, progress updates
101
- - Use the scratchpad for TODOs, follow-ups, and things to keep in mind
102
- - Use `#tags` (e.g. `#decision`, `#preference`, `#lesson`) and `[[links]]` (e.g. `[[auth-strategy]]`) in content to improve future search recall
103
- - Before starting a task, check if relevant context exists via `agent-memory search`
104
- - At the end of a significant work session, summarize what was done in the daily log
145
+ - 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
147
+ - Use `--target long_term` sparingly: architecture, preferences, key commands, hard-won lessons
148
+ - Use the scratchpad for: TODOs, follow-ups, multi-session tracking
149
+ - Use `#tags` and `[[links]]` in content to improve search recall
150
+ - Use `agent-memory search` to recall past work before starting related tasks
151
+ - All `agent-memory` commands are safe they read/write only to the memory directory (`~/.agent-memory/` by default)