@hir4ta/mneme 0.17.0

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.
Files changed (43) hide show
  1. package/.claude-plugin/plugin.json +29 -0
  2. package/.mcp.json +18 -0
  3. package/README.ja.md +400 -0
  4. package/README.md +410 -0
  5. package/bin/mneme.js +203 -0
  6. package/dist/lib/db.js +340 -0
  7. package/dist/lib/fuzzy-search.js +214 -0
  8. package/dist/lib/github.js +121 -0
  9. package/dist/lib/similarity.js +193 -0
  10. package/dist/lib/utils.js +62 -0
  11. package/dist/public/apple-touch-icon.png +0 -0
  12. package/dist/public/assets/index-BgqCALAg.css +1 -0
  13. package/dist/public/assets/index-EMvn4VEa.js +330 -0
  14. package/dist/public/assets/react-force-graph-2d-DWoBaKmT.js +46 -0
  15. package/dist/public/favicon-128-max.png +0 -0
  16. package/dist/public/favicon-256-max.png +0 -0
  17. package/dist/public/favicon-32-max.png +0 -0
  18. package/dist/public/favicon-512-max.png +0 -0
  19. package/dist/public/favicon-64-max.png +0 -0
  20. package/dist/public/index.html +15 -0
  21. package/dist/server.js +4791 -0
  22. package/dist/servers/db-server.js +30558 -0
  23. package/dist/servers/search-server.js +30366 -0
  24. package/hooks/default-tags.json +1055 -0
  25. package/hooks/hooks.json +61 -0
  26. package/hooks/post-tool-use.sh +96 -0
  27. package/hooks/pre-compact.sh +187 -0
  28. package/hooks/session-end.sh +567 -0
  29. package/hooks/session-start.sh +380 -0
  30. package/hooks/user-prompt-submit.sh +253 -0
  31. package/package.json +77 -0
  32. package/servers/db-server.ts +993 -0
  33. package/servers/search-server.ts +675 -0
  34. package/skills/AGENTS.override.md +5 -0
  35. package/skills/harvest/skill.md +295 -0
  36. package/skills/init-mneme/skill.md +101 -0
  37. package/skills/plan/skill.md +422 -0
  38. package/skills/report/skill.md +74 -0
  39. package/skills/resume/skill.md +278 -0
  40. package/skills/review/skill.md +419 -0
  41. package/skills/save/skill.md +482 -0
  42. package/skills/search/skill.md +175 -0
  43. package/skills/using-mneme/skill.md +185 -0
@@ -0,0 +1,482 @@
1
+ ---
2
+ name: save
3
+ description: |
4
+ Extract and persist session knowledge including summary, decisions, patterns, and rules.
5
+ Use when: (1) completing a significant work session, (2) making important technical decisions,
6
+ (3) solving complex errors worth documenting, (4) before ending a long session.
7
+ ---
8
+
9
+ # /mneme:save
10
+
11
+ Extract and save all meaningful data from the current session.
12
+
13
+ ## When to Use
14
+
15
+ **Run at the end of meaningful sessions** to extract:
16
+
17
+ - Summary (title, goal, outcome)
18
+ - Technical decisions → `.mneme/decisions/`
19
+ - Error patterns → `.mneme/patterns/`
20
+ - Development rules → `.mneme/rules/`
21
+
22
+ ## Usage
23
+
24
+ ```
25
+ /mneme:save
26
+ ```
27
+
28
+ ## What Gets Saved
29
+
30
+ | Data | Source | Destination |
31
+ |------|--------|-------------|
32
+ | Summary | Conversation | sessions/{id}.json |
33
+ | Discussions | Conversation | sessions/{id}.json + **decisions/{id}.json** |
34
+ | Errors | Conversation | sessions/{id}.json + **patterns/{user}.json** |
35
+ | Dev rules | User instructions | rules/dev-rules.json |
36
+ | Review guidelines | User instructions | rules/review-guidelines.json |
37
+
38
+ ## Execution Steps
39
+
40
+ <phases>
41
+ Execute all phases in order. Each phase builds on the previous.
42
+
43
+ - Phase 0: Master Session - Identify master and merge child sessions
44
+ - Phase 1: Interactions - Merge preCompactBackups with current conversation
45
+ - Phase 2: Summary - Extract session metadata (considering ALL interactions)
46
+ - Phase 3: Decisions - Save to decisions/
47
+ - Phase 4: Patterns - Save to patterns/
48
+ - Phase 5: Rules - Extract development standards
49
+ </phases>
50
+
51
+ ### Phase 0: Identify Master Session and Merge Children
52
+
53
+ **Purpose:** Support multiple Claude sessions contributing to one logical mneme session.
54
+
55
+ 1. Get current session path from additionalContext (e.g., `.mneme/sessions/2026/01/xyz78901.json`)
56
+ 2. Get session ID from the path (e.g., `xyz78901`)
57
+
58
+ 3. **Check for session-link file:**
59
+ ```bash
60
+ Read: .mneme/session-links/xyz78901.json
61
+ ```
62
+ If exists, extract `masterSessionId`. If not, current session IS the master.
63
+
64
+ 4. **Find master session file:**
65
+ ```bash
66
+ Glob: .mneme/sessions/**/{masterSessionId}.json
67
+ ```
68
+
69
+ 5. **Find all child sessions linked to this master:**
70
+ ```bash
71
+ # Read all session-link files
72
+ Glob: .mneme/session-links/*.json
73
+
74
+ # Filter by masterSessionId
75
+ for each link:
76
+ if link.masterSessionId == masterSessionId:
77
+ childSessionIds.push(link file's session ID)
78
+ ```
79
+
80
+ 6. **Also check legacy `resumedFrom` chains:**
81
+ ```bash
82
+ # Find sessions where resumedFrom points to master or any child
83
+ Glob: .mneme/sessions/**/*.json
84
+ for each session:
85
+ if session.resumedFrom == masterSessionId or session.resumedFrom in childSessionIds:
86
+ childSessionIds.push(session.id)
87
+ ```
88
+
89
+ 7. **Merge child session data into master:**
90
+ For each child session JSON:
91
+ - Merge `workPeriods` (add any missing entries)
92
+ - Merge `files` (union, deduplicate by path)
93
+ - Merge `discussions` (append unique items)
94
+ - Merge `errors` (append unique items)
95
+ - Merge `metrics.toolUsage` (combine counts)
96
+ - Update `metrics.userMessages` (will be recalculated from SQLite)
97
+
98
+ 8. **Mark child sessions as merged:**
99
+ ```bash
100
+ Edit: .mneme/sessions/{year}/{month}/{childId}.json
101
+ ```
102
+ ```json
103
+ {
104
+ "status": "merged",
105
+ "mergedAt": "2026-01-27T12:00:00Z",
106
+ "masterSessionId": "abc12345"
107
+ }
108
+ ```
109
+
110
+ **Important:** After this phase, all subsequent operations work on the MASTER session.
111
+
112
+ ### Phase 1: Save Interactions to SQLite
113
+
114
+ **REQUIRED:** You MUST save interactions to `.mneme/local.db` in this phase.
115
+ Do NOT skip this step or delegate to SessionEnd hook.
116
+
117
+ 1. Use master session ID from Phase 0 (e.g., `abc12345`)
118
+ 2. Get Claude Code session ID from the system (check session context for the full UUID)
119
+
120
+ 3. **Create session-link file** (for SessionEnd hook to find the correct mneme session):
121
+ ```bash
122
+ mkdir -p .mneme/session-links
123
+ ```
124
+ Write to `.mneme/session-links/{claude-session-short-id}.json`:
125
+ ```json
126
+ {
127
+ "masterSessionId": "abc12345",
128
+ "claudeSessionId": "<full-claude-session-id>",
129
+ "createdAt": "<current ISO timestamp>"
130
+ }
131
+ ```
132
+ The claude-session-short-id is the first 8 characters of the Claude Code session ID.
133
+
134
+ 4. **Save interactions using MCP tool:**
135
+
136
+ Call the `mneme_save_interactions` MCP tool with:
137
+ - `claudeSessionId`: The full Claude Code session UUID (36 chars)
138
+ - `mnemeSessionId`: The master session ID from Phase 0 (8 chars)
139
+
140
+ Example:
141
+ ```
142
+ mcp__mneme-db__mneme_save_interactions({
143
+ claudeSessionId: "86ea2268-ae4d-4f5c-bb38-424d3716061f",
144
+ mnemeSessionId: "abc12345"
145
+ })
146
+ ```
147
+
148
+ The tool will:
149
+ - Read the transcript file directly from `~/.claude/projects/`
150
+ - Extract all user/assistant messages with thinking blocks
151
+ - Merge with any pre_compact_backups
152
+ - Save to `.mneme/local.db`
153
+
154
+ 5. **Verify the result:**
155
+ Check the tool response for:
156
+ - `success`: Should be `true`
157
+ - `savedCount`: Number of interactions saved
158
+ - `mergedFromBackup`: Count from pre-compact backup
159
+
160
+ If `success` is `false`, check the `message` for error details.
161
+
162
+ 6. **Update session JSON** with files and metrics
163
+ 7. Set `updatedAt` to current timestamp
164
+
165
+ **Verification:** Report the savedCount from the MCP tool response to the user.
166
+
167
+ ### Phase 2: Extract Session Data
168
+
169
+ **Language Detection (IMPORTANT):**
170
+ - Detect the language used in the conversation with the user
171
+ - ALL generated content (title, summary, decisions, patterns, rules) MUST be in the same language as the user's messages
172
+ - If the user writes in Japanese → generate Japanese content
173
+ - If the user writes in English → generate English content
174
+ - Do NOT default to English; match the user's language
175
+
176
+ 1. Use master session from Phase 0
177
+ 2. Read master session file (already updated with merged data from Phase 0-1)
178
+ 3. **Scan entire conversation** (including long sessions) to extract:
179
+
180
+ #### Summary
181
+ ```json
182
+ {
183
+ "title": "Brief descriptive title",
184
+ "goal": "What was trying to be achieved",
185
+ "outcome": "success | partial | failed | ongoing",
186
+ "description": "What was accomplished",
187
+ "sessionType": "decision | implementation | research | exploration | discussion | debug | review"
188
+ }
189
+ ```
190
+
191
+ **sessionType selection criteria:**
192
+ | Type | When to use |
193
+ |------|-------------|
194
+ | `decision` | Made design choices or technology selections |
195
+ | `implementation` | Made code changes |
196
+ | `research` | Researched, learned, or investigated topics |
197
+ | `exploration` | Explored and understood the codebase |
198
+ | `discussion` | Discussion only (no code changes) |
199
+ | `debug` | Debugged or investigated bugs |
200
+ | `review` | Performed code review |
201
+
202
+ #### Discussions (→ also saved to decisions/)
203
+ ```json
204
+ {
205
+ "topic": "What was discussed",
206
+ "decision": "What was decided",
207
+ "reasoning": "Why this decision",
208
+ "alternatives": ["Other options considered"]
209
+ }
210
+ ```
211
+
212
+ #### Errors (→ also saved to patterns/)
213
+ ```json
214
+ {
215
+ "error": "Error message (first line)",
216
+ "context": "What was being done",
217
+ "cause": "Root cause identified",
218
+ "solution": "How it was fixed",
219
+ "files": ["Related files"]
220
+ }
221
+ ```
222
+
223
+ #### Other Fields
224
+ - **plan**: tasks[], remaining[]
225
+ - **handoff**: stoppedReason, notes, nextSteps
226
+ - **references**: URLs and files referenced
227
+
228
+ ### Phase 3: Save to decisions/
229
+
230
+ **For each discussion with a clear decision:**
231
+
232
+ 1. Generate ID from topic: `slugify(topic)-001`
233
+ 2. Check for duplicates in `.mneme/decisions/`
234
+ 3. Save to `.mneme/decisions/YYYY/MM/{id}.json`:
235
+
236
+ ```json
237
+ {
238
+ "id": "jwt-auth-001",
239
+ "title": "Authentication method selection",
240
+ "decision": "Use JWT with RS256",
241
+ "reasoning": "Stateless, scalable, secure for microservices",
242
+ "alternatives": [
243
+ {"name": "Session Cookie", "reason": "Requires server-side state"}
244
+ ],
245
+ "tags": ["auth", "architecture"],
246
+ "createdAt": "2026-01-27T10:00:00Z",
247
+ "user": {"name": "git user.name"},
248
+ "context": {
249
+ "branch": "feature/auth",
250
+ "projectDir": "/path/to/project"
251
+ },
252
+ "relatedSessions": ["abc12345"],
253
+ "source": "save",
254
+ "status": "active"
255
+ }
256
+ ```
257
+
258
+ **Skip saving if:**
259
+ - No clear decision was made (just discussion)
260
+ - Similar decision already exists (check by title/topic)
261
+
262
+ ### Phase 4: Save to patterns/
263
+
264
+ **For each error that was solved:**
265
+
266
+ 1. Read or create `.mneme/patterns/{git-user-name}.json`
267
+ 2. Check if similar pattern exists (by errorPattern)
268
+ 3. Add or update pattern:
269
+
270
+ ```json
271
+ {
272
+ "id": "pattern-user-001",
273
+ "user": {"name": "git user.name"},
274
+ "patterns": [
275
+ {
276
+ "type": "error-solution",
277
+ "title": "JWT RS256 requires asymmetric key",
278
+ "description": "secretOrPrivateKey must be an asymmetric key when using RS256",
279
+ "errorPattern": "secretOrPrivateKey must be asymmetric",
280
+ "errorRegex": "secretOrPrivateKey.*asymmetric",
281
+ "solution": "Generate RS256 key pair instead of using symmetric secret",
282
+ "reasoning": "RS256 requires asymmetric keys",
283
+ "relatedFiles": ["src/auth/jwt.ts"],
284
+ "tags": ["jwt", "auth"],
285
+ "detectedAt": "2026-01-27T10:00:00Z",
286
+ "source": "save",
287
+ "sourceId": "abc12345",
288
+ "occurrences": 1,
289
+ "lastSeenAt": "2026-01-27T10:00:00Z"
290
+ }
291
+ ],
292
+ "updatedAt": "2026-01-27T10:00:00Z"
293
+ }
294
+ ```
295
+
296
+ **Required fields:** `type`, `title`, `errorPattern` (for error-solution), `solution`
297
+ **Optional fields:** `description`, `errorRegex`, `reasoning`, `relatedFiles`, `tags`, etc.
298
+
299
+ **If pattern already exists:**
300
+ - Increment `occurrences`
301
+ - Update `lastSeenAt`
302
+ - Optionally improve `solution` if better
303
+
304
+ **Skip saving if:**
305
+ - Error was trivial (typo, syntax error)
306
+ - No root cause was identified
307
+ - Error was environment-specific
308
+
309
+ ### Phase 5: Extract Rules
310
+
311
+ Scan conversation for development standards. These include both explicit user
312
+ instructions and implicit standards from technical discussions.
313
+
314
+ **Example extraction:**
315
+ ```
316
+ Conversation: "Codex pointed out that all pgvector queries need tenantId for security"
317
+
318
+ Extracted rule:
319
+ {
320
+ "category": "security",
321
+ "rule": "All pgvector queries must include tenantId condition",
322
+ "reasoning": "Multi-tenant data isolation",
323
+ "source": "session:abc12345"
324
+ }
325
+ ```
326
+
327
+ Scan for user instructions AND technical standards:
328
+
329
+ #### Dev Rules
330
+
331
+ <rule-sources>
332
+ 1. Explicit user instructions: "Use X", "Don't use X", "Always do X", "Never do X"
333
+ 2. Technical discussions: Security requirements, architectural decisions, best practices from code review
334
+ </rule-sources>
335
+
336
+ **Example - Explicit instruction:**
337
+ ```
338
+ User: "Always validate embedding dimensions before saving"
339
+
340
+ Rule: {
341
+ "id": "rule-001",
342
+ "key": "validate-embedding-dimensions",
343
+ "text": "Validate embedding dimensions (3072) before saving",
344
+ "category": "architecture",
345
+ "status": "active",
346
+ "createdAt": "2026-01-30T12:00:00Z",
347
+ "updatedAt": "2026-01-30T12:00:00Z"
348
+ }
349
+ ```
350
+
351
+ **Example - Implicit from discussion:**
352
+ ```
353
+ Codex review: "This query lacks tenantId - multi-tenant security risk"
354
+ Discussion concluded: Add tenantId to all pgvector queries
355
+
356
+ Rule: {
357
+ "id": "rule-002",
358
+ "key": "pgvector-tenantid-required",
359
+ "text": "All pgvector queries must include tenantId condition",
360
+ "category": "security",
361
+ "rationale": "Multi-tenant data isolation",
362
+ "status": "active",
363
+ "createdAt": "2026-01-30T12:00:00Z",
364
+ "updatedAt": "2026-01-30T12:00:00Z"
365
+ }
366
+ ```
367
+
368
+ **Required fields:** `id`, `key`, `text`, `category`, `status`, `createdAt`, `updatedAt`
369
+ **Optional fields:** `rationale`, `priority`
370
+
371
+ Categories: `code-style`, `architecture`, `error-handling`, `performance`, `security`, `testing`, `other`
372
+
373
+ #### Review Guidelines
374
+ Look for:
375
+ - "Check X in reviews"
376
+ - "Point out X"
377
+
378
+ Categories: `must-check`, `warning`, `suggestion`, `other`
379
+
380
+ #### Duplicate Check
381
+ Before adding:
382
+ 1. Read existing items
383
+ 2. Compare semantically
384
+ 3. Skip if similar exists
385
+
386
+ ### File Operations
387
+
388
+ ```bash
389
+ # Local SQLite (interactions - project-local)
390
+ # Location: .mneme/local.db
391
+ Read + Write: .mneme/local.db
392
+ - interactions table
393
+ - pre_compact_backups table
394
+
395
+ # Session JSON (metadata - shared)
396
+ Read + Edit: .mneme/sessions/YYYY/MM/{id}.json
397
+
398
+ # Decisions (create if new)
399
+ Read: .mneme/decisions/YYYY/MM/*.json (for duplicate check)
400
+ Write: .mneme/decisions/YYYY/MM/{decision-id}.json
401
+
402
+ # Patterns (merge into user file)
403
+ Read + Edit: .mneme/patterns/{git-user-name}.json
404
+
405
+ # Rules (append)
406
+ Read + Edit: .mneme/rules/dev-rules.json
407
+ Read + Edit: .mneme/rules/review-guidelines.json
408
+ ```
409
+
410
+ ## Handling Long Sessions
411
+
412
+ **For sessions with many interactions:**
413
+
414
+ 1. **Scan chronologically** - Process from start to end
415
+ 2. **Group related items** - Combine related discussions/errors
416
+ 3. **Prioritize significant items**:
417
+ - Decisions that changed direction
418
+ - Errors that took time to solve
419
+ - Rules explicitly stated by user
420
+ 4. **Don't truncate** - Extract all meaningful data
421
+
422
+ ## Output Format
423
+
424
+ Report each phase result:
425
+
426
+ ```
427
+ ---
428
+ **Session saved.**
429
+
430
+ **Master Session ID:** abc12345
431
+ **Path:** .mneme/sessions/2026/01/abc12345.json
432
+
433
+ **Phase 0 - Master Session:**
434
+ Master: abc12345
435
+ Children merged: xyz78901, def45678
436
+ Work periods: 3
437
+
438
+ **Phase 1 - Interactions:** Saved to local.db
439
+ - Link: .mneme/session-links/{claude-session-id}.json
440
+ - Interactions saved: 15 (user: 8, assistant: 7)
441
+
442
+ **Phase 2 - Summary:**
443
+ | Field | Value |
444
+ |-------|-------|
445
+ | Title | JWT authentication implementation |
446
+ | Goal | Implement JWT-based auth |
447
+ | Outcome | success |
448
+ | Type | implementation |
449
+
450
+ **Phase 3 - Decisions (2):**
451
+ - `[jwt-auth-001]` Authentication method selection → decisions/2026/01/
452
+ - `[token-expiry-001]` Token expiry strategy → decisions/2026/01/
453
+
454
+ **Phase 4 - Patterns (1):**
455
+ - `[error-solution]` secretOrPrivateKey must be asymmetric → patterns/user.json
456
+
457
+ **Phase 5 - Rules:**
458
+ dev-rules.json:
459
+ + [code-style] Use early return pattern
460
+ ~ [architecture] Avoid circular dependencies (skipped: similar exists)
461
+
462
+ review-guidelines.json:
463
+ (no changes)
464
+ ```
465
+
466
+ If no rules are found, report what was scanned:
467
+ ```
468
+ **Phase 5 - Rules:**
469
+ Scanned for: user instructions, technical standards from Codex review, security requirements
470
+ Result: No new rules identified
471
+ ```
472
+
473
+ ## Notes
474
+
475
+ - Session path is shown in additionalContext at session start
476
+ - **Phase 1 MUST save interactions** to `.mneme/local.db` immediately - do NOT skip or defer
477
+ - SessionEnd hook is only a backup; `/mneme:save` is the primary way to persist interactions
478
+ - **Privacy**: Interactions in SQLite are local (`.mneme/local.db` should be gitignored)
479
+ - **Project-local storage**: Each project has its own `.mneme/local.db`
480
+ - **JSON lightness**: Session JSON contains only metadata (no interactions)
481
+ - Decisions and patterns are also kept in session JSON for context
482
+ - Duplicate checking prevents bloat in decisions/ and patterns/
@@ -0,0 +1,175 @@
1
+ ---
2
+ name: search
3
+ description: |
4
+ Search saved sessions, decisions, and patterns in mneme's knowledge base.
5
+ Use when: (1) looking for past solutions to similar problems, (2) finding previous decisions,
6
+ (3) recalling how something was implemented before.
7
+ argument-hint: "<query>"
8
+ ---
9
+
10
+ # /mneme:search
11
+
12
+ Search saved sessions, decisions, and patterns.
13
+
14
+ ## Usage
15
+
16
+ ```
17
+ /mneme:search <query>
18
+ ```
19
+
20
+ ### Filter by Type
21
+
22
+ ```
23
+ /mneme:search <query> --type session
24
+ /mneme:search <query> --type decision
25
+ /mneme:search <query> --type pattern
26
+ ```
27
+
28
+ ## Execution Steps
29
+
30
+ **Use the `mneme_search` MCP tool for fast, unified search:**
31
+
32
+ 1. Call `mneme_search` with the query
33
+ 2. Display scored results
34
+ 3. If user wants details, use `mneme_get_session` or `mneme_get_decision`
35
+
36
+ ### MCP Tools
37
+
38
+ ```typescript
39
+ // Search all types
40
+ mneme_search({ query: "JWT auth", limit: 10 })
41
+
42
+ // Filter by type
43
+ mneme_search({ query: "JWT auth", types: ["decision", "session"] })
44
+
45
+ // Get full session details
46
+ mneme_get_session({ sessionId: "abc123" })
47
+
48
+ // Get full decision details
49
+ mneme_get_decision({ decisionId: "jwt-auth-001" })
50
+ ```
51
+
52
+ **Fallback (if MCP unavailable):** Read JSON files directly using Glob + Read tools.
53
+
54
+ ## Search Algorithm
55
+
56
+ Text matching on each file's content:
57
+
58
+ - Title/topic match: +3 points
59
+ - thinking/reasoning match: +2 points
60
+ - Tag match: +1 point
61
+ - Tag alias match: +1 point
62
+ - Exact match: 2x score
63
+
64
+ ### Tag Alias Search
65
+
66
+ If query matches an alias in tags.json, search using the corresponding id:
67
+ - Example: "front" → search for "frontend" tag
68
+
69
+ ## Search Target Fields
70
+
71
+ ### Sessions (.mneme/sessions/**/*.json)
72
+
73
+ **Search index fields:**
74
+ - `title` - Session title
75
+ - `tags` - Tags
76
+
77
+ **Auto-saved interaction fields:**
78
+ - `interactions[].user` - User's request
79
+ - `interactions[].thinking` - Thought process
80
+ - `interactions[].assistant` - Assistant response
81
+
82
+ **Structured data (set by /mneme:save):**
83
+ - `summary.title` - Session title
84
+ - `summary.goal` - Session goal
85
+ - `summary.description` - What was accomplished
86
+ - `plan.goals[]` - Planned goals
87
+ - `plan.tasks[]` - Task list
88
+ - `discussions[].topic` - Discussion topic
89
+ - `discussions[].decision` - What was decided
90
+ - `discussions[].reasoning` - Why this decision
91
+ - `errors[].error` - Error encountered
92
+ - `errors[].cause` - Root cause
93
+ - `errors[].solution` - How it was resolved
94
+ - `handoff.stoppedReason` - Why session ended
95
+ - `handoff.nextSteps[]` - Next steps
96
+
97
+ ### Decisions (.mneme/decisions/**/*.json)
98
+ - `title` - Title
99
+ - `decision` - What was decided
100
+ - `reasoning` - Why
101
+ - `tags` - Tags
102
+
103
+ ### Patterns (.mneme/patterns/*.json)
104
+ - `title` - Title
105
+ - `description` - Description
106
+ - `example` - Example
107
+ - `tags` - Tags
108
+
109
+ ## Output Format
110
+
111
+ ```
112
+ Search results for "JWT": 5 items
113
+
114
+ [decision] jwt-auth-001 (score: 8)
115
+ Adopt JWT for authentication
116
+ Match: title, reasoning
117
+
118
+ [session] 2026-01-24_abc123 (score: 6)
119
+ JWT authentication implementation
120
+ Match: title, interactions[0].topic
121
+
122
+ [pattern] pattern-tanaka-001 (score: 3)
123
+ Set short JWT token expiry
124
+ Match: description
125
+
126
+ Enter number for details (quit: q):
127
+ ```
128
+
129
+ ## Detail View
130
+
131
+ ### Session Detail
132
+
133
+ ```
134
+ [session] 2026-01-24_abc123
135
+
136
+ Title: JWT authentication implementation
137
+ Tags: [auth] [jwt] [backend]
138
+
139
+ Summary:
140
+ Goal: Implement JWT-based auth
141
+ Outcome: success
142
+ Type: implementation
143
+
144
+ Discussions:
145
+ - Auth method selection
146
+ Decision: JWT (easy auth sharing between microservices)
147
+ - Refresh token expiry
148
+ Decision: 7 days (balance between security and UX)
149
+
150
+ Errors resolved:
151
+ - Token validation failed → Fixed by using correct public key
152
+
153
+ Handoff:
154
+ Next steps:
155
+ - Add refresh token rotation
156
+ - Implement logout endpoint
157
+
158
+ Created: 2026-01-24
159
+ ```
160
+
161
+ ### Decision Detail
162
+
163
+ ```
164
+ [decision] jwt-auth-001
165
+
166
+ Title: Auth method selection
167
+ Decision: Adopt JWT for session management
168
+ Reasoning: Easy auth sharing between microservices. Stateless and scalable.
169
+
170
+ Alternatives:
171
+ - Session Cookie: Requires server-side state, doesn't scale well
172
+
173
+ Tags: [auth] [architecture] [jwt]
174
+ Created: 2026-01-24
175
+ ```