@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,422 @@
1
+ ---
2
+ name: plan
3
+ description: |
4
+ Memory-informed design and implementation planning with past knowledge lookup.
5
+ Use when: (1) starting a new feature or task, (2) designing architecture,
6
+ (3) needing to consider past decisions before implementing.
7
+ argument-hint: "[topic]"
8
+ ---
9
+
10
+ # /mneme:plan
11
+
12
+ Memory-informed design and implementation planning that combines Claude Code's native plan mode UI, Socratic questioning, and mneme's knowledge base.
13
+
14
+ ## Invocation
15
+
16
+ ```
17
+ /mneme:plan # Plan for current task
18
+ /mneme:plan "feature" # Plan for specific feature
19
+ ```
20
+
21
+ ## Workflow Overview
22
+
23
+ ```
24
+ Phase 0: Enter Plan Mode → Activate Claude Code native UI
25
+ Phase 1: Memory Search → Find relevant past knowledge
26
+ Phase 2: Explore Codebase → Read-only investigation
27
+ Phase 3: Clarify → Socratic questions (1 at a time)
28
+ Phase 4: Design → Present in sections, validate each
29
+ Phase 5: Exit Plan Mode → Approve and prepare execution
30
+ ```
31
+
32
+ ---
33
+
34
+ ## Phase 0: Enter Plan Mode
35
+
36
+ **Use Claude Code's native plan mode for proper UI integration.**
37
+
38
+ ```
39
+ Action: Call EnterPlanMode tool
40
+ Result: Terminal shows "⏸ plan mode on" indicator
41
+ ```
42
+
43
+ This enables:
44
+ - Read-only exploration (no accidental changes)
45
+ - Clear visual indication of planning state
46
+ - Native approval workflow via ExitPlanMode
47
+
48
+ **Skip this phase if already in plan mode.**
49
+
50
+ ---
51
+
52
+ ## Phase 1: Memory Search
53
+
54
+ Search mneme for relevant context before design work. This surfaces past decisions
55
+ and patterns that inform the current task.
56
+
57
+ **Why this matters:**
58
+ ```
59
+ Found: Previous JWT implementation used RS256
60
+ → Saves time by not re-discussing algorithm choice
61
+ ```
62
+
63
+ ### Search Procedure
64
+
65
+ Use MCP tools or file search:
66
+
67
+ 1. **Search sessions** for similar implementations:
68
+ ```
69
+ Tool: mcp__mneme-search__mneme_search
70
+ Query: keywords from user request
71
+ Types: ["session", "decision", "pattern"]
72
+ ```
73
+
74
+ 2. **Check rules** for constraints:
75
+ ```
76
+ Read: .mneme/rules/dev-rules.json
77
+ Read: .mneme/rules/review-guidelines.json
78
+ Look for: rules that apply to this feature
79
+ ```
80
+
81
+ ### Presentation Format
82
+
83
+ **Always present findings before asking questions:**
84
+
85
+ ```markdown
86
+ ## 📚 Past Context Found
87
+
88
+ **Similar implementation (2026-01-15):**
89
+ > Previously implemented [feature X] using [approach Y].
90
+ > Key decision: [decision made]
91
+ > Outcome: [what happened]
92
+
93
+ **Related decisions:**
94
+ - `dec-abc123` [title]: [summary] (status: active)
95
+
96
+ **Relevant patterns:**
97
+ - ✅ Good: [pattern description]
98
+ - ⚠️ Error-solution: [error] → [solution]
99
+
100
+ **Applicable rules:**
101
+ - [rule content]
102
+ ```
103
+
104
+ **If no relevant memories found:**
105
+ ```
106
+ No directly relevant past sessions found. Starting fresh design.
107
+ ```
108
+
109
+ ---
110
+
111
+ ## Phase 2: Explore Codebase
112
+
113
+ **Investigate the current state before asking questions.**
114
+
115
+ In plan mode, use read-only tools:
116
+ - `Read` - View file contents
117
+ - `Glob` - Find files by pattern
118
+ - `Grep` - Search code content
119
+ - `Task` with `subagent_type: Explore` - Deep exploration
120
+
121
+ ### What to Explore
122
+
123
+ 1. **Existing implementation** - Related code that already exists
124
+ 2. **Patterns in use** - How similar features are built
125
+ 3. **Dependencies** - What libraries/modules are available
126
+ 4. **Tests** - How similar features are tested
127
+
128
+ ### Present Findings
129
+
130
+ ```markdown
131
+ ## 🔍 Codebase Context
132
+
133
+ **Related files:**
134
+ - `src/components/Auth.tsx` - Current auth UI
135
+ - `src/lib/api.ts` - API client
136
+
137
+ **Patterns observed:**
138
+ - React Query for data fetching
139
+ - Zod for validation
140
+
141
+ **Available utilities:**
142
+ - `useAuth` hook exists
143
+ - `api.post()` method available
144
+ ```
145
+
146
+ ---
147
+
148
+ ## Phase 3: Clarify (Socratic Questions)
149
+
150
+ **Ask one question per message. Wait for response before next question.**
151
+
152
+ ### Question Rules
153
+
154
+ - **ONE question per message** - Never ask multiple questions
155
+ - **Multiple choice preferred** - Easier to answer
156
+ - **Reference past decisions** - "Based on the previous JWT decision..."
157
+ - **Skip obvious questions** - Don't ask what's already clear
158
+ - **3-5 questions max** - Don't over-question
159
+ - **YAGNI ruthlessly** - Remove unnecessary features from consideration
160
+
161
+ ### Question Format
162
+
163
+ Use the `AskUserQuestion` tool for structured questions:
164
+
165
+ ```typescript
166
+ AskUserQuestion({
167
+ questions: [{
168
+ question: "How should authentication be handled?",
169
+ header: "Auth method",
170
+ options: [
171
+ { label: "JWT tokens (Recommended)", description: "Consistent with existing API" },
172
+ { label: "Session cookies", description: "Simpler but requires server state" },
173
+ { label: "OAuth only", description: "Delegate to third party" }
174
+ ],
175
+ multiSelect: false
176
+ }]
177
+ })
178
+ ```
179
+
180
+ ### Core Questions (adapt as needed)
181
+
182
+ 1. **Use case clarification**
183
+ - What specific scenario should this feature support?
184
+ - Options based on memory search results
185
+
186
+ 2. **Success criteria**
187
+ - How will we know this is successful?
188
+ - Functional vs quality requirements
189
+
190
+ 3. **Constraints**
191
+ - Technology constraints from past decisions
192
+ - Compatibility requirements
193
+
194
+ 4. **Scope boundaries**
195
+ - What's explicitly OUT of scope?
196
+ - YAGNI: What features can we defer?
197
+
198
+ ---
199
+
200
+ ## Phase 4: Design
201
+
202
+ **Present the design in sections of 200-300 words. Validate each section before continuing.**
203
+
204
+ ### Section Order
205
+
206
+ 1. **Overview** - What we're building (1-2 sentences)
207
+ 2. **Architecture** - How components fit together
208
+ 3. **Data flow** - How data moves through the system
209
+ 4. **API/Interface** - Public contract
210
+ 5. **Error handling** - Edge cases and failures
211
+ 6. **Testing strategy** - How to verify it works
212
+
213
+ ### Present Each Section
214
+
215
+ ```markdown
216
+ ## 📐 Design: [Feature Name]
217
+
218
+ ### Overview
219
+
220
+ [200-300 words describing this section]
221
+
222
+ ---
223
+
224
+ Does this section look right? Any adjustments needed?
225
+ ```
226
+
227
+ **Wait for confirmation before presenting the next section.**
228
+
229
+ ### After All Sections Approved
230
+
231
+ Write the complete design to file:
232
+
233
+ ```markdown
234
+ ## Design Document
235
+
236
+ Saved to: `docs/plans/YYYY-MM-DD-[topic]-design.md`
237
+
238
+ The document includes:
239
+ - Overview and goals
240
+ - Architecture decisions
241
+ - Implementation approach
242
+ - Testing strategy
243
+ ```
244
+
245
+ ### Document Format
246
+
247
+ ```markdown
248
+ # [Feature] Design
249
+
250
+ **Date**: YYYY-MM-DD
251
+ **Status**: Approved
252
+
253
+ ## Overview
254
+
255
+ [What we're building and why]
256
+
257
+ ## Architecture
258
+
259
+ [How it fits together]
260
+
261
+ ## Key Decisions
262
+
263
+ | Decision | Choice | Reasoning |
264
+ |----------|--------|-----------|
265
+ | [Topic] | [Choice] | [Why] |
266
+
267
+ ## Implementation Tasks
268
+
269
+ ### Task 1: [Title]
270
+ - **Files**: `path/to/file.ts`
271
+ - **Steps**: [What to do]
272
+ - **Verification**: [How to test]
273
+
274
+ ### Task 2: [Title]
275
+ - **Depends on**: Task 1
276
+ - [...]
277
+
278
+ ## Testing Strategy
279
+
280
+ [How to verify the implementation]
281
+
282
+ ## Out of Scope
283
+
284
+ [What we're explicitly NOT doing (YAGNI)]
285
+ ```
286
+
287
+ ---
288
+
289
+ ## Phase 5: Exit Plan Mode
290
+
291
+ **Use ExitPlanMode to request user approval and prepare for execution.**
292
+
293
+ ```
294
+ Action: Call ExitPlanMode tool
295
+ Result: User reviews plan and approves/rejects
296
+ ```
297
+
298
+ ### Before Exiting
299
+
300
+ Ensure the plan document:
301
+ 1. Is saved to `docs/plans/`
302
+ 2. Contains all approved design sections
303
+ 3. Has clear implementation tasks
304
+ 4. Includes verification steps
305
+
306
+ ### Exit Message
307
+
308
+ ```markdown
309
+ ## 📋 Plan Ready for Approval
310
+
311
+ **Document**: `docs/plans/2026-02-01-feature-design.md`
312
+ **Tasks**: 5 implementation steps
313
+ **Key decisions**: [summary]
314
+
315
+ The plan is ready for your review. You can:
316
+ - Press `Ctrl+G` to open in your editor
317
+ - Approve to begin implementation
318
+ - Request changes
319
+
320
+ After implementation, run `/mneme:save` to capture decisions and patterns.
321
+ ```
322
+
323
+ ---
324
+
325
+ ## Quick Reference
326
+
327
+ ### Tools Used
328
+
329
+ | Phase | Tools |
330
+ |-------|-------|
331
+ | 0 | `EnterPlanMode` |
332
+ | 1 | `mcp__mneme-search__mneme_search`, `Read` |
333
+ | 2 | `Read`, `Glob`, `Grep`, `Task` (Explore) |
334
+ | 3 | `AskUserQuestion` |
335
+ | 4 | `Write` (design doc) |
336
+ | 5 | `ExitPlanMode` |
337
+
338
+ ### Key Principles
339
+
340
+ - **Memory first** - Always check past knowledge before designing
341
+ - **One question at a time** - Never overwhelm with multiple questions
342
+ - **Incremental validation** - Present design in sections, validate each
343
+ - **YAGNI ruthlessly** - Remove unnecessary features from all designs
344
+ - **Native UI** - Use Claude Code's plan mode for proper integration
345
+
346
+ ### Output Location
347
+
348
+ | Output | Location |
349
+ |--------|----------|
350
+ | Design document | `docs/plans/YYYY-MM-DD-[topic]-design.md` |
351
+
352
+ ---
353
+
354
+ ## Example Session
355
+
356
+ ```
357
+ User: /mneme:plan "add user preferences"
358
+
359
+ Claude: [Enters plan mode]
360
+
361
+ ## 📚 Past Context Found
362
+
363
+ **Related decision (2026-01-20):**
364
+ > User data stored in PostgreSQL with Prisma ORM.
365
+ > Key decision: All user-related data in `users` table with JSONB for flexible fields.
366
+
367
+ **Applicable rules:**
368
+ - [data-privacy] User preferences must be exportable
369
+
370
+ ---
371
+
372
+ Let me explore the codebase first...
373
+
374
+ ## 🔍 Codebase Context
375
+
376
+ **Related files:**
377
+ - `src/lib/prisma.ts` - Database client
378
+ - `src/types/user.ts` - User type definitions
379
+ - `prisma/schema.prisma` - Database schema
380
+
381
+ **Pattern observed:**
382
+ - JSONB field `metadata` already exists on User model
383
+
384
+ ---
385
+
386
+ Claude: [Uses AskUserQuestion]
387
+
388
+ Question: What preferences should users be able to set?
389
+
390
+ a) Theme only (dark/light)
391
+ b) Theme + language
392
+ c) Theme + language + notifications (Recommended)
393
+ d) Other
394
+
395
+ User: c
396
+
397
+ Claude: [Presents design section by section, validates each]
398
+
399
+ ## 📐 Design: User Preferences
400
+
401
+ ### Overview
402
+
403
+ Add a preferences system allowing users to customize theme, language,
404
+ and notification settings. Preferences stored in existing JSONB `metadata`
405
+ field for flexibility...
406
+
407
+ Does this section look right?
408
+
409
+ User: Yes
410
+
411
+ [Continues with Architecture, Data flow, etc.]
412
+
413
+ Claude: [Writes design document, calls ExitPlanMode]
414
+
415
+ ## 📋 Plan Ready for Approval
416
+
417
+ **Document**: `docs/plans/2026-02-01-user-preferences-design.md`
418
+ **Tasks**: 4 implementation steps
419
+ **Key decisions**: Use existing JSONB field, add type-safe accessor
420
+
421
+ Ready to begin implementation?
422
+ ```
@@ -0,0 +1,74 @@
1
+ ---
2
+ name: report
3
+ description: |
4
+ Generate weekly report aggregating review results from .mneme/reviews/.
5
+ Use when: (1) preparing weekly status updates, (2) summarizing team review activity,
6
+ (3) tracking code quality trends over time.
7
+ argument-hint: "[--from YYYY-MM-DD] [--to YYYY-MM-DD]"
8
+ ---
9
+
10
+ # /mneme:report
11
+
12
+ Generate weekly report from review results (`.mneme/reviews/`).
13
+
14
+ ## Usage
15
+
16
+ ```
17
+ /mneme:report
18
+ /mneme:report --from 2026-01-01 --to 2026-01-07
19
+ ```
20
+
21
+ ### Default
22
+
23
+ - If `--from/--to` not specified: **last 7 days**
24
+ - Save location: `.mneme/reports/YYYY-MM/weekly-YYYY-MM-DD.md` (based on `--to` date)
25
+
26
+ ## Execution Steps
27
+
28
+ 1. **Determine target period**
29
+ 2. **Read `.mneme/reviews/YYYY/MM/*.json`**
30
+ 3. Aggregate reviews in period:
31
+ - Blocker / Warning / Suggestion counts
32
+ - Top matched rules
33
+ - New rule proposals list
34
+ - Stale rules list
35
+ 4. **Generate Markdown report**
36
+ 5. Save to `.mneme/reports/YYYY-MM/weekly-YYYY-MM-DD.md`
37
+
38
+ ## Output Format (Markdown)
39
+
40
+ ```
41
+ # Weekly Review Report (2026-01-01 - 2026-01-07)
42
+
43
+ ## Summary
44
+ - Reviews: 5
45
+ - Blocker: 2
46
+ - Warning: 6
47
+ - Suggestion: 11
48
+
49
+ ## Highlights
50
+ - Most frequent rules: review-... (3), dev-... (2)
51
+ - Top affected areas: dashboard, server
52
+
53
+ ## Findings Digest
54
+ ### Blocker
55
+ 1. {title} (rule: {rule.id})
56
+ 2. ...
57
+
58
+ ### Warning
59
+ ...
60
+
61
+ ### Suggestion
62
+ ...
63
+
64
+ ## Rule Proposals
65
+ - {proposal text}
66
+
67
+ ## Stale Rules
68
+ - {rule.id} (lastSeenAt: YYYY-MM-DD)
69
+ ```
70
+
71
+ ## Notes
72
+
73
+ - Create `.mneme/reports/YYYY-MM/` if it doesn't exist
74
+ - If multiple reports on same day, append sequence number