claude_memory 0.2.0 → 0.3.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 (104) hide show
  1. checksums.yaml +4 -4
  2. data/.claude/.mind.mv2.o2N83S +0 -0
  3. data/.claude/CLAUDE.md +1 -0
  4. data/.claude/rules/claude_memory.generated.md +28 -9
  5. data/.claude/settings.local.json +9 -1
  6. data/.claude/skills/check-memory/SKILL.md +77 -0
  7. data/.claude/skills/improve/SKILL.md +532 -0
  8. data/.claude/skills/improve/feature-patterns.md +1221 -0
  9. data/.claude/skills/quality-update/SKILL.md +229 -0
  10. data/.claude/skills/quality-update/implementation-guide.md +346 -0
  11. data/.claude/skills/review-commit/SKILL.md +199 -0
  12. data/.claude/skills/review-for-quality/SKILL.md +154 -0
  13. data/.claude/skills/review-for-quality/expert-checklists.md +79 -0
  14. data/.claude/skills/setup-memory/SKILL.md +168 -0
  15. data/.claude/skills/study-repo/SKILL.md +307 -0
  16. data/.claude/skills/study-repo/analysis-template.md +323 -0
  17. data/.claude/skills/study-repo/focus-examples.md +327 -0
  18. data/CHANGELOG.md +133 -0
  19. data/CLAUDE.md +130 -11
  20. data/README.md +117 -10
  21. data/db/migrations/001_create_initial_schema.rb +117 -0
  22. data/db/migrations/002_add_project_scoping.rb +33 -0
  23. data/db/migrations/003_add_session_metadata.rb +42 -0
  24. data/db/migrations/004_add_fact_embeddings.rb +20 -0
  25. data/db/migrations/005_add_incremental_sync.rb +21 -0
  26. data/db/migrations/006_add_operation_tracking.rb +40 -0
  27. data/db/migrations/007_add_ingestion_metrics.rb +26 -0
  28. data/docs/.claude/mind.mv2.lock +0 -0
  29. data/docs/GETTING_STARTED.md +587 -0
  30. data/docs/RELEASE_NOTES_v0.2.0.md +0 -1
  31. data/docs/RUBY_COMMUNITY_POST_v0.2.0.md +0 -2
  32. data/docs/architecture.md +9 -8
  33. data/docs/auto_init_design.md +230 -0
  34. data/docs/improvements.md +557 -731
  35. data/docs/influence/.gitkeep +13 -0
  36. data/docs/influence/grepai.md +933 -0
  37. data/docs/influence/qmd.md +2195 -0
  38. data/docs/plugin.md +257 -11
  39. data/docs/quality_review.md +472 -1273
  40. data/docs/remaining_improvements.md +330 -0
  41. data/lefthook.yml +13 -0
  42. data/lib/claude_memory/commands/checks/claude_md_check.rb +41 -0
  43. data/lib/claude_memory/commands/checks/database_check.rb +120 -0
  44. data/lib/claude_memory/commands/checks/hooks_check.rb +112 -0
  45. data/lib/claude_memory/commands/checks/reporter.rb +110 -0
  46. data/lib/claude_memory/commands/checks/snapshot_check.rb +30 -0
  47. data/lib/claude_memory/commands/doctor_command.rb +12 -129
  48. data/lib/claude_memory/commands/help_command.rb +1 -0
  49. data/lib/claude_memory/commands/hook_command.rb +9 -2
  50. data/lib/claude_memory/commands/index_command.rb +169 -0
  51. data/lib/claude_memory/commands/ingest_command.rb +1 -1
  52. data/lib/claude_memory/commands/init_command.rb +5 -197
  53. data/lib/claude_memory/commands/initializers/database_ensurer.rb +30 -0
  54. data/lib/claude_memory/commands/initializers/global_initializer.rb +85 -0
  55. data/lib/claude_memory/commands/initializers/hooks_configurator.rb +156 -0
  56. data/lib/claude_memory/commands/initializers/mcp_configurator.rb +56 -0
  57. data/lib/claude_memory/commands/initializers/memory_instructions_writer.rb +135 -0
  58. data/lib/claude_memory/commands/initializers/project_initializer.rb +111 -0
  59. data/lib/claude_memory/commands/recover_command.rb +75 -0
  60. data/lib/claude_memory/commands/registry.rb +5 -1
  61. data/lib/claude_memory/commands/stats_command.rb +239 -0
  62. data/lib/claude_memory/commands/uninstall_command.rb +226 -0
  63. data/lib/claude_memory/core/batch_loader.rb +32 -0
  64. data/lib/claude_memory/core/concept_ranker.rb +73 -0
  65. data/lib/claude_memory/core/embedding_candidate_builder.rb +37 -0
  66. data/lib/claude_memory/core/fact_collector.rb +51 -0
  67. data/lib/claude_memory/core/fact_query_builder.rb +154 -0
  68. data/lib/claude_memory/core/fact_ranker.rb +113 -0
  69. data/lib/claude_memory/core/result_builder.rb +54 -0
  70. data/lib/claude_memory/core/result_sorter.rb +25 -0
  71. data/lib/claude_memory/core/scope_filter.rb +61 -0
  72. data/lib/claude_memory/core/text_builder.rb +29 -0
  73. data/lib/claude_memory/embeddings/generator.rb +161 -0
  74. data/lib/claude_memory/embeddings/similarity.rb +69 -0
  75. data/lib/claude_memory/hook/handler.rb +4 -3
  76. data/lib/claude_memory/index/lexical_fts.rb +7 -2
  77. data/lib/claude_memory/infrastructure/operation_tracker.rb +158 -0
  78. data/lib/claude_memory/infrastructure/schema_validator.rb +206 -0
  79. data/lib/claude_memory/ingest/content_sanitizer.rb +6 -7
  80. data/lib/claude_memory/ingest/ingester.rb +99 -15
  81. data/lib/claude_memory/ingest/metadata_extractor.rb +57 -0
  82. data/lib/claude_memory/ingest/tool_extractor.rb +71 -0
  83. data/lib/claude_memory/mcp/response_formatter.rb +331 -0
  84. data/lib/claude_memory/mcp/server.rb +19 -0
  85. data/lib/claude_memory/mcp/setup_status_analyzer.rb +73 -0
  86. data/lib/claude_memory/mcp/tool_definitions.rb +279 -0
  87. data/lib/claude_memory/mcp/tool_helpers.rb +80 -0
  88. data/lib/claude_memory/mcp/tools.rb +330 -320
  89. data/lib/claude_memory/recall/dual_query_template.rb +63 -0
  90. data/lib/claude_memory/recall.rb +304 -237
  91. data/lib/claude_memory/resolve/resolver.rb +52 -49
  92. data/lib/claude_memory/store/sqlite_store.rb +210 -144
  93. data/lib/claude_memory/store/store_manager.rb +6 -6
  94. data/lib/claude_memory/sweep/sweeper.rb +6 -0
  95. data/lib/claude_memory/version.rb +1 -1
  96. data/lib/claude_memory.rb +35 -3
  97. metadata +71 -11
  98. data/.claude/.mind.mv2.aLCUZd +0 -0
  99. data/.claude/memory.sqlite3 +0 -0
  100. data/.mcp.json +0 -11
  101. /data/docs/{feature_adoption_plan.md → plans/feature_adoption_plan.md} +0 -0
  102. /data/docs/{feature_adoption_plan_revised.md → plans/feature_adoption_plan_revised.md} +0 -0
  103. /data/docs/{plan.md → plans/plan.md} +0 -0
  104. /data/docs/{updated_plan.md → plans/updated_plan.md} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cba9abfc06579e1d4e979fe20c81b6c751351b2001c9efc0f7144973454d9b2d
4
- data.tar.gz: 95e420c5c7e6705564332c68d3728ee9cf43984e89207bdce46121223dac1ddc
3
+ metadata.gz: 7835fd6219efb8e7b8942c0933abd529228b92fc003649abeb26415fae05881b
4
+ data.tar.gz: 8a466024f18ac23db38cc85cedc9e80512f9b8a7cf74cdbcd453626f12408afc
5
5
  SHA512:
6
- metadata.gz: c6b7ee6d2ff3ab5cea00e99995781d295527859cc328b1572220075cff829ff089090d871cb40d65a5d4e8d9b518a66637bc32d3c3d6ab98b14a8968338cce1a
7
- data.tar.gz: 17884491cf569f5627fa3f4b4328eb214625236d75585517bd4dd3a30b393c0e6f2b33198087207916e8a9c65c00bc6360db3b2f042f7aaff057b605dda50df8
6
+ metadata.gz: 664a3477dd134ad7857cc7e292fea52833260986cb8d85f80d5ab5faba5c3821bab72e754960d5dadd3c203e03443b393e3b7687fbd4915f70970b3d98c9e3ec
7
+ data.tar.gz: 9924044b6fbe3d4a39a722e754a4dc94d3f73af7b0cb9b5177353f9de7461afbd5688f411fbe8d2dcccdd52153318b2ed279ed70984fc7f8b6b45544ad2036e5
Binary file
data/.claude/CLAUDE.md CHANGED
@@ -1,3 +1,4 @@
1
+ <!-- ClaudeMemory v0.3.0 -->
1
2
  # Project Memory
2
3
 
3
4
  @.claude/rules/claude_memory.generated.md
@@ -1,27 +1,46 @@
1
1
  <!--
2
2
  This file is auto-generated by claude-memory.
3
3
  Do not edit manually - changes will be overwritten.
4
- Generated: 2026-01-22T18:04:05Z
4
+ Generated: 2026-01-29T18:59:01Z
5
5
  -->
6
6
 
7
7
  # Project Memory
8
8
 
9
+ ## Current Decisions
10
+
11
+ - Extralite chosen to fix database lock contention between MCP server and hooks
12
+
9
13
  ## Conventions
10
14
 
11
15
  - frozen_string_literal: true in all Ruby files
12
- - RSpec format documentation
16
+ - RSpec uses documentation format
17
+ - Default Rake task runs tests and linter
18
+ - frozen_string_literal: true in all Ruby files
13
19
  - Default Rake task runs spec and standard
20
+ - Standard Ruby linter configured for Ruby 3.2
14
21
  - Pre-commit hook runs standard:fix and stages changes
15
22
  - Pre-commit hook runs tests
16
- - Ruby version 3.2 minimum
17
- - run linting with 'bundle exec rake standard'
18
- - Ruby 3.2+ required
23
+ - Pre-commit hook runs quality review on Ruby files
24
+ - Pre-commit hook runs standard:fix and stages changes
25
+ - Pre-commit hook runs tests
26
+ - Pre-commit hook runs quality review on Ruby files
27
+ - frozen_string_literal: true
28
+ - RSpec documentation format
29
+ - Default Rake task runs tests and linter
19
30
  - frozen_string_literal: true in all Ruby files
20
- - Uses Standard Ruby for linting
21
- - Default task runs tests and linter
22
31
  - RSpec uses documentation format
32
+ - Default Rake task runs tests and linter
33
+ - Pre-commit hook runs standard:fix and stages changes
34
+ - Pre-commit hook runs tests
35
+ - Pre-commit hook runs quality review on Ruby files
36
+ - Pre-commit hook runs standard:fix and stages changes
37
+ - Pre-commit hook runs tests
38
+ - Pre-commit hook runs quality review on Ruby files
39
+ - frozen_string_literal: true in all Ruby files
40
+ - RSpec format documentation mode
41
+ - Default Rake task runs spec and standard
42
+ - frozen_string_literal: true in all Ruby files
23
43
 
24
44
  ## Technical Constraints
25
45
 
26
- - **Uses framework**: Sequel
27
- - **Uses database**: SQLite3
46
+ - **Uses database**: SQLite with Extralite adapter
@@ -17,7 +17,15 @@
17
17
  "mcp__memory__memory_explain",
18
18
  "Bash(bundle exec rspec:*)",
19
19
  "Bash(bundle exec rake:*)",
20
- "mcp__plugin_claude-memory_memory__memory_store_extraction"
20
+ "mcp__plugin_claude-memory_memory__memory_store_extraction",
21
+ "WebFetch(domain:raw.githubusercontent.com)",
22
+ "Bash(grep:*)",
23
+ "Bash(gem list:*)",
24
+ "Bash(ag:*)",
25
+ "Bash(git log:*)",
26
+ "Bash(find:*)",
27
+ "Bash(wc:*)",
28
+ "mcp__plugin_claude-memory_memory__memory_architecture"
21
29
  ]
22
30
  },
23
31
  "enableAllProjectMcpServers": true
@@ -0,0 +1,77 @@
1
+ ---
2
+ name: check-memory
3
+ description: Explicitly check memory system before answering or exploring
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Check Memory First
8
+
9
+ When invoked with `/check-memory <topic>`, this skill forces a memory-first workflow.
10
+
11
+ ## Task
12
+
13
+ **IMPORTANT: You MUST check memory BEFORE reading any files or running any code searches.**
14
+
15
+ The user is asking about: $ARGUMENTS
16
+
17
+ ## Step-by-Step Workflow
18
+
19
+ ### 1. Query Memory (REQUIRED FIRST STEP)
20
+
21
+ Run multiple memory queries to find existing knowledge:
22
+
23
+ ```
24
+ memory.recall "$ARGUMENTS"
25
+ ```
26
+
27
+ Also try specialized shortcuts:
28
+ - `memory.decisions` (if implementing a feature)
29
+ - `memory.architecture` (if working with frameworks)
30
+ - `memory.conventions` (if writing code)
31
+ - `memory.conflicts` (if encountering contradictions)
32
+
33
+ ### 2. Analyze Results
34
+
35
+ Review what memory returns:
36
+ - **If sufficient**: Answer using recalled facts with citations
37
+ - **If partial**: Note what's known and what needs investigation
38
+ - **If empty**: Memory has no knowledge on this topic yet
39
+
40
+ ### 3. Explore Code (ONLY IF NEEDED)
41
+
42
+ If memory doesn't have enough information:
43
+ - Use Read/Grep/Glob to explore the codebase
44
+ - Clearly distinguish between:
45
+ - **Recalled knowledge** (from memory)
46
+ - **Discovered information** (from code exploration)
47
+
48
+ ### 4. Provide Complete Answer
49
+
50
+ Combine:
51
+ - Facts from memory (with fact IDs if relevant)
52
+ - New information from code exploration (if any)
53
+ - Clear indication of sources
54
+
55
+ ## Example Response Format
56
+
57
+ ```
58
+ Based on memory:
59
+ - [Fact from memory with context]
60
+
61
+ From code exploration:
62
+ - [New findings from reading files]
63
+
64
+ Answer: [Complete response combining both sources]
65
+ ```
66
+
67
+ ## Why This Matters
68
+
69
+ Memory contains distilled knowledge from previous sessions. Checking it first:
70
+ - Saves time (no need to re-explore known areas)
71
+ - Provides context (decisions, patterns, conventions)
72
+ - Avoids mistakes (previous lessons learned)
73
+ - Reduces token usage (recalled facts are concise)
74
+
75
+ ## Remember
76
+
77
+ **ALWAYS start with memory queries. NEVER skip this step.**
@@ -0,0 +1,532 @@
1
+ ---
2
+ name: improve
3
+ description: Incrementally implement feature improvements from docs/improvements.md with tests and atomic commits. Focuses on new functionality rather than refactoring.
4
+ agent: general-purpose
5
+ allowed-tools: Read, Grep, Edit, Write, Bash
6
+ ---
7
+
8
+ # Feature Improvements - Incremental Implementation
9
+
10
+ Systematically implement feature improvements from `docs/improvements.md`, making tested, atomic commits for each feature addition.
11
+
12
+ ## Process Overview
13
+
14
+ 1. **Read the improvements document** from `docs/improvements.md`
15
+ 2. **Identify unimplemented features** from "Remaining Tasks" section
16
+ 3. **Prioritize by stated priority** (Medium → Low)
17
+ 4. **Assess feasibility** (skip if too complex or requires external services)
18
+ 5. **Implement features incrementally** (one logical feature at a time)
19
+ 6. **Run tests after each change** to ensure nothing breaks
20
+ 7. **Make atomic commits** that capture the feature and its purpose
21
+ 8. **Update improvements.md** to mark features as implemented
22
+
23
+ ## Detailed Steps
24
+
25
+ ### Step 1: Read and Parse Improvements Document
26
+
27
+ ```bash
28
+ # Read the improvements document
29
+ Read docs/improvements.md
30
+ ```
31
+
32
+ Focus on these sections:
33
+ 1. **Remaining Tasks** - Unimplemented features
34
+ 2. **Medium Priority** - Higher value features
35
+ 3. **Low Priority** - Nice-to-have features
36
+ 4. **Features to Avoid** - Do NOT implement these
37
+
38
+ ### Step 2: Prioritize Features
39
+
40
+ **Priority Order:**
41
+ 1. Medium Priority items first
42
+ 2. Low Priority items second
43
+ 3. Skip items marked "If Requested" or "Features to Avoid"
44
+
45
+ **Feasibility Assessment:**
46
+ - ✅ **Can implement**: Pure Ruby, no external services, clear scope
47
+ - ⚠️ **Consider carefully**: Requires API integration, new dependencies
48
+ - ❌ **Skip**: Requires external services, architectural changes, unclear requirements
49
+
50
+ ### Step 3: Assess Each Feature
51
+
52
+ Before implementing, check:
53
+
54
+ **✅ Safe to implement automatically:**
55
+ - Small database schema additions (new columns, tables)
56
+ - New CLI commands with clear behavior
57
+ - Utility methods and helpers
58
+ - Enhanced output formatting
59
+ - Statistics and reporting features
60
+
61
+ **⚠️ Implement with caution:**
62
+ - Features requiring API calls (Claude API, external services)
63
+ - New gem dependencies (check compatibility first)
64
+ - Background processing (daemon/fork complexity)
65
+ - Features touching critical paths
66
+
67
+ **❌ Skip and report:**
68
+ - Web UI features (React, Sinatra, complex frontend)
69
+ - Worker service/daemon management
70
+ - Features requiring Python/Node.js
71
+ - Vector database integration (ChromaDB, external services)
72
+ - Health monitoring (unless simple)
73
+
74
+ ### Step 4: Implement the Feature
75
+
76
+ For each feature:
77
+
78
+ 1. **Read relevant code** to understand where feature fits
79
+ 2. **Plan the implementation**:
80
+ - Which files need changes?
81
+ - What tests are needed?
82
+ - Are there dependencies?
83
+ 3. **Implement incrementally**:
84
+ - Schema changes first (if needed)
85
+ - Core functionality
86
+ - CLI command (if applicable)
87
+ - Tests
88
+ 4. **Run linter**:
89
+ ```bash
90
+ bundle exec rake standard:fix
91
+ ```
92
+ 5. **Run tests**:
93
+ ```bash
94
+ bundle exec rspec
95
+ ```
96
+ 6. **Fix any test failures** before proceeding
97
+
98
+ ### Step 5: Make Atomic Commit
99
+
100
+ **Commit Message Format:**
101
+ ```
102
+ [Feature] Brief description of what was added
103
+
104
+ - Specific implementation details
105
+ - Why this improves the system
106
+ - Reference to docs/improvements.md section
107
+
108
+ Implements: docs/improvements.md (Section: <name>)
109
+ ```
110
+
111
+ **Example Commit:**
112
+ ```bash
113
+ git add -A
114
+ git commit -m "[Feature] Add ROI metrics tracking for distillation
115
+
116
+ - Add ingestion_metrics table with token counts
117
+ - Track input_tokens, output_tokens, facts_extracted
118
+ - Add metrics display to stats command
119
+ - Show efficiency (facts per 1k tokens)
120
+
121
+ Implements: docs/improvements.md (Section: ROI Metrics and Token Economics)
122
+ "
123
+ ```
124
+
125
+ ### Step 6: Update improvements.md
126
+
127
+ After successful implementation:
128
+
129
+ 1. **Move item to "Implemented Improvements"** section
130
+ 2. **Add date and brief description**
131
+ 3. **Update "Remaining Tasks"** to remove completed item
132
+ 4. **Commit the documentation update**:
133
+ ```bash
134
+ git add docs/improvements.md
135
+ git commit -m "[Docs] Mark <feature> as implemented"
136
+ ```
137
+
138
+ ### Step 7: Continue or Report
139
+
140
+ **Continue** to next feature if:
141
+ - Tests pass ✅
142
+ - Commit successful ✅
143
+ - Feature works as expected ✅
144
+ - No blockers encountered ✅
145
+
146
+ **Stop and report** if:
147
+ - Tests fail after multiple fix attempts ❌
148
+ - Feature requires external services ❌
149
+ - Complexity exceeds estimate ❌
150
+ - Unclear requirements ❌
151
+ - Time budget exceeded ❌
152
+
153
+ ## Feature Categories & Approach
154
+
155
+ ### Category A: Schema Additions (Low Risk)
156
+ **Examples:**
157
+ - Add metrics table
158
+ - Add columns for metadata
159
+ - Add indexes
160
+
161
+ **Approach:**
162
+ - Schema version bump
163
+ - Migration method
164
+ - Tests for new schema
165
+ - Single commit
166
+
167
+ ### Category B: Statistics & Reporting (Low Risk)
168
+ **Examples:**
169
+ - Enhanced stats command
170
+ - ROI metrics display
171
+ - Better formatting
172
+
173
+ **Approach:**
174
+ - Query implementation
175
+ - Output formatting
176
+ - Tests for accuracy
177
+ - Single commit
178
+
179
+ ### Category C: CLI Commands (Low-Medium Risk)
180
+ **Examples:**
181
+ - New commands (embed, stats enhancements)
182
+ - Command options
183
+
184
+ **Approach:**
185
+ - Command class
186
+ - Registry update
187
+ - Tests for command
188
+ - Help documentation
189
+ - Single commit
190
+
191
+ ### Category D: Background Processing (Medium Risk)
192
+ **Examples:**
193
+ - Async hook execution
194
+ - Fork/daemon processes
195
+
196
+ **Approach:**
197
+ - **ASSESS CAREFULLY** - fork/daemon in Ruby is tricky
198
+ - Consider simple async approach first
199
+ - Test on multiple platforms
200
+ - May need multiple commits
201
+ - May skip if too complex
202
+
203
+ ### Category E: External Integration (Medium-High Risk)
204
+ **Examples:**
205
+ - API calls (Claude, external services)
206
+ - New gem dependencies
207
+ - External tool integration
208
+
209
+ **Approach:**
210
+ - **ASSESS CAREFULLY** - adds dependencies
211
+ - Check gem compatibility
212
+ - Error handling critical
213
+ - May need API keys
214
+ - Consider skipping if complex
215
+
216
+ ### Category F: Architectural Changes (High Risk)
217
+ **Examples:**
218
+ - Worker services
219
+ - Web UI
220
+ - New database systems
221
+
222
+ **Approach:**
223
+ - **SKIP** - too complex for automated implementation
224
+ - Report as "needs planning"
225
+ - These require design sessions
226
+
227
+ ## Implementation Examples
228
+
229
+ ### Example 1: ROI Metrics (Medium Priority)
230
+
231
+ **Assessment**: Category A + B (Schema + Reporting) - Safe to implement
232
+
233
+ **Steps:**
234
+ 1. Add migration for ingestion_metrics table
235
+ 2. Add tracking in distiller (if implemented) or stub for future
236
+ 3. Add aggregation query methods
237
+ 4. Enhance stats command to display metrics
238
+ 5. Add tests
239
+ 6. Commit
240
+ 7. Update improvements.md
241
+
242
+ **Time Estimate**: 30-45 minutes
243
+
244
+ ### Example 2: Background Processing (Medium Priority)
245
+
246
+ **Assessment**: Category D (Background) - Medium risk
247
+
248
+ **Steps:**
249
+ 1. Research Ruby async options (Process.fork vs Thread)
250
+ 2. Add --async flag to hook commands
251
+ 3. Simple fork approach (not full daemon)
252
+ 4. Output logging
253
+ 5. Tests on Unix systems (may skip Windows)
254
+ 6. Commit
255
+ 7. Update improvements.md
256
+
257
+ **Time Estimate**: 45-60 minutes
258
+ **Risk**: May skip if too complex
259
+
260
+ ### Example 3: Web UI (Low Priority, "If Requested")
261
+
262
+ **Assessment**: Category F (Architectural) - High risk
263
+
264
+ **Action**: **SKIP** - Too complex, marked "if requested"
265
+ **Report**: "Web UI requires design session, skipped per priority guidance"
266
+
267
+ ## Decision Tree
268
+
269
+ ```
270
+ Read next feature from improvements.md
271
+
272
+ Is it marked "Features to Avoid"?
273
+ ├─ YES → SKIP completely
274
+ └─ NO → Continue
275
+
276
+ Is it marked "If Requested"?
277
+ ├─ YES → SKIP, note as "needs user request"
278
+ └─ NO → Continue
279
+
280
+ Assess category (A-F)
281
+
282
+ Category F (Architectural)?
283
+ ├─ YES → SKIP, report as "needs planning"
284
+ └─ NO → Continue
285
+
286
+ Category E (External)?
287
+ ├─ YES → Assess carefully, may skip
288
+ └─ NO → Continue
289
+
290
+ Category D (Background)?
291
+ ├─ YES → Assess carefully, may skip
292
+ └─ NO → Implement (Categories A-C safe)
293
+
294
+ Implement the feature
295
+
296
+ Run tests
297
+
298
+ Tests pass?
299
+ ├─ NO → Can fix in < 20 min?
300
+ │ ├─ YES → Fix and retry
301
+ │ └─ NO → SKIP, report as "complex"
302
+ └─ YES → Continue
303
+
304
+ Commit with [Feature] message
305
+
306
+ Update improvements.md
307
+
308
+ Commit documentation update
309
+
310
+ Next feature
311
+ ```
312
+
313
+ ## Time Budgets
314
+
315
+ **Per Feature:**
316
+ - Category A (Schema): Max 20 minutes
317
+ - Category B (Reporting): Max 30 minutes
318
+ - Category C (CLI): Max 30 minutes
319
+ - Category D (Background): Max 60 minutes (or skip)
320
+ - Category E (External): Max 45 minutes (or skip)
321
+
322
+ **Session Total:** Max 2 hours
323
+
324
+ If time budget exceeded: SKIP remaining features and report.
325
+
326
+ ## Testing Strategy
327
+
328
+ ### Test Frequency
329
+ - After schema changes: Run all specs
330
+ - After new command: Run command specs + integration
331
+ - After reporting changes: Run relevant specs
332
+ - Before commit: Full test suite
333
+
334
+ ### Test Commands
335
+ ```bash
336
+ # Specific command tests
337
+ bundle exec rspec spec/claude_memory/commands/
338
+
339
+ # Schema tests
340
+ bundle exec rspec spec/claude_memory/store/
341
+
342
+ # Full suite
343
+ bundle exec rspec
344
+
345
+ # With linting
346
+ bundle exec rake
347
+ ```
348
+
349
+ ### New Feature Tests
350
+
351
+ Always add tests for new features:
352
+ ```ruby
353
+ # spec/claude_memory/commands/new_feature_spec.rb
354
+ RSpec.describe ClaudeMemory::Commands::NewFeature do
355
+ it "implements the feature correctly" do
356
+ # Test implementation
357
+ end
358
+
359
+ it "handles errors gracefully" do
360
+ # Test error cases
361
+ end
362
+ end
363
+ ```
364
+
365
+ ## Documentation Updates
366
+
367
+ ### After Each Implementation
368
+
369
+ Update `docs/improvements.md`:
370
+
371
+ 1. **Move to Implemented section**:
372
+ ```markdown
373
+ ## Implemented Improvements ✓
374
+
375
+ 14. **ROI Metrics Tracking** - ingestion_metrics table, stats display
376
+ ```
377
+
378
+ 2. **Remove from Remaining Tasks**:
379
+ ```markdown
380
+ ### Remaining Tasks
381
+
382
+ - [x] ROI metrics table for token tracking during distillation
383
+ - [ ] Background processing (--async flag for hooks)
384
+ ```
385
+
386
+ 3. **Update last modified date**:
387
+ ```markdown
388
+ *Last updated: 2026-01-26 - Added ROI metrics tracking*
389
+ ```
390
+
391
+ ## Progress Tracking
392
+
393
+ Keep running count:
394
+ - ✅ Medium Priority completed: X/Y
395
+ - ✅ Low Priority completed: X/Y
396
+ - ⏳ Currently working on: [feature name]
397
+ - ⚠️ Skipped (complex): [list]
398
+ - ❌ Blocked: [list with reasons]
399
+
400
+ ## Success Criteria
401
+
402
+ Session completes successfully when:
403
+ - At least 2-3 Medium Priority features implemented ✅
404
+ - All tests pass ✅
405
+ - All commits follow [Feature] format ✅
406
+ - docs/improvements.md updated ✅
407
+ - Progress report provided ✅
408
+
409
+ ## Important Notes
410
+
411
+ - **Never skip tests** - each feature must pass tests before committing
412
+ - **Stay conservative** - skip complex features, report them
413
+ - **One feature at a time** - don't combine unrelated features
414
+ - **Update documentation** - mark features as implemented
415
+ - **Read before coding** - understand existing code first
416
+ - **Check dependencies** - verify gems are compatible
417
+ - **Test incrementally** - after each logical step
418
+
419
+ ## Red Flags - When to Skip
420
+
421
+ Skip feature and report if you encounter:
422
+ - 🚩 Requires external services (ChromaDB, web servers, etc.)
423
+ - 🚩 Needs background daemon/worker
424
+ - 🚩 Requires new major dependencies
425
+ - 🚩 Touches security-critical code
426
+ - 🚩 Unclear requirements or scope
427
+ - 🚩 Time budget exceeded
428
+ - 🚩 Marked "Features to Avoid"
429
+ - 🚩 Marked "If Requested" or "Only if users request"
430
+ - 🚩 Tests fail after 2 fix attempts
431
+
432
+ ## Example Session
433
+
434
+ ```
435
+ Session Start: 2026-01-26 14:00
436
+
437
+ 1. Read docs/improvements.md
438
+ - Found 4 Remaining Tasks
439
+ - 2 Medium Priority, 2 Low Priority
440
+ - Plan: Start with Medium Priority
441
+
442
+ 2. Medium Priority #1: Background Processing (--async flag)
443
+ - Category: D (Background)
444
+ - Assessment: Medium risk, daemon complexity
445
+ - TIME ESTIMATE: 60 minutes
446
+ - DECISION: SKIP - Too complex, needs design
447
+ - Reason: Ruby daemon management is tricky, fork approach needs careful testing
448
+
449
+ 3. Medium Priority #2: ROI Metrics Tracking
450
+ - Category: A + B (Schema + Reporting)
451
+ - Assessment: Low risk
452
+ - Implement:
453
+ a. Add schema migration v7
454
+ b. Add ingestion_metrics table
455
+ c. Add aggregate_metrics method to store
456
+ d. Enhance stats command
457
+ e. Add tests
458
+ - Run: bundle exec rspec ✅
459
+ - Commit: [Feature] Add ROI metrics tracking... ✅
460
+ - Update: docs/improvements.md ✅
461
+ - Commit: [Docs] Mark ROI metrics as implemented ✅
462
+
463
+ 4. Low Priority #1: Structured Logging
464
+ - Category: C (CLI)
465
+ - Assessment: Low risk
466
+ - Implement:
467
+ a. Add Logger configuration
468
+ b. Add JSON formatter
469
+ c. Add log output to commands
470
+ d. Add --log-level flag
471
+ e. Add tests
472
+ - Run: bundle exec rspec ✅
473
+ - Commit: [Feature] Add structured logging... ✅
474
+ - Update: docs/improvements.md ✅
475
+ - Commit: [Docs] Mark structured logging as implemented ✅
476
+
477
+ 5. Low Priority #2: Embed Command
478
+ - Category: C (CLI)
479
+ - Started implementation...
480
+ - TIME LIMIT EXCEEDED (45 minutes)
481
+ - SKIP - More complex than expected
482
+
483
+ Session End: 2026-01-26 15:30
484
+ Duration: 1.5 hours
485
+
486
+ Results:
487
+ - Medium Priority: 1/2 completed (1 skipped - too complex)
488
+ - Low Priority: 1/2 completed (1 time exceeded)
489
+ - Commits: 4 (2 feature, 2 docs)
490
+ - Tests: All passing ✅
491
+ - Features added: ROI metrics, Structured logging
492
+ ```
493
+
494
+ ## Final Report Format
495
+
496
+ ```
497
+ ## Feature Implementation Session Report
498
+
499
+ ### Completed ✅
500
+ 1. [Medium] ROI Metrics Tracking (commit: abc123)
501
+ - Added ingestion_metrics table
502
+ - Enhanced stats command
503
+ - Shows token efficiency metrics
504
+
505
+ 2. [Low] Structured Logging (commit: def456)
506
+ - JSON log formatter
507
+ - --log-level flag for commands
508
+ - Better debugging visibility
509
+
510
+ ### Skipped ⚠️
511
+ - [Medium] Background Processing (--async flag)
512
+ - Reason: Ruby daemon complexity, needs design session
513
+ - Recommendation: Plan this separately with forking strategy
514
+
515
+ - [Low] Embed Command
516
+ - Reason: Time budget exceeded (45 min)
517
+ - Progress: 60% complete, needs embedding generation logic
518
+ - Recommendation: Complete in focused session
519
+
520
+ ### Summary
521
+ - Medium Priority: 1/2 completed (50%)
522
+ - Low Priority: 1/2 completed (50%)
523
+ - Tests: All passing ✅
524
+ - Commits: 4 total (2 features + 2 docs)
525
+ - Time: 1.5 hours
526
+
527
+ ### Next Steps
528
+ 1. Design session for background processing
529
+ 2. Complete embed command implementation
530
+ 3. Consider remaining Low Priority items
531
+ 4. Run /review-for-quality to assess any code quality issues from new features
532
+ ```