claude-mem 3.3.7 → 3.3.9

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 (96) hide show
  1. package/README.md +183 -46
  2. package/dist/bin/cli.d.ts +2 -0
  3. package/dist/bin/cli.js +179 -0
  4. package/dist/commands/compress.d.ts +2 -0
  5. package/dist/commands/compress.js +27 -0
  6. package/dist/commands/hooks.d.ts +19 -0
  7. package/dist/commands/hooks.js +131 -0
  8. package/dist/commands/install.d.ts +2 -0
  9. package/dist/commands/install.js +836 -0
  10. package/dist/commands/load-context.d.ts +2 -0
  11. package/dist/commands/load-context.js +151 -0
  12. package/dist/commands/logs.d.ts +2 -0
  13. package/dist/commands/logs.js +76 -0
  14. package/dist/commands/migrate-to-jsonl.d.ts +5 -0
  15. package/dist/commands/migrate-to-jsonl.js +99 -0
  16. package/dist/commands/restore.d.ts +1 -0
  17. package/dist/commands/restore.js +20 -0
  18. package/dist/commands/status.d.ts +1 -0
  19. package/dist/commands/status.js +136 -0
  20. package/dist/commands/trash-empty.d.ts +3 -0
  21. package/dist/commands/trash-empty.js +56 -0
  22. package/dist/commands/trash-view.d.ts +1 -0
  23. package/dist/commands/trash-view.js +101 -0
  24. package/dist/commands/trash.d.ts +6 -0
  25. package/dist/commands/trash.js +49 -0
  26. package/dist/commands/uninstall.d.ts +2 -0
  27. package/dist/commands/uninstall.js +107 -0
  28. package/dist/constants.d.ts +271 -0
  29. package/dist/constants.js +199 -0
  30. package/dist/core/compression/TranscriptCompressor.d.ts +79 -0
  31. package/dist/core/compression/TranscriptCompressor.js +585 -0
  32. package/dist/core/orchestration/PromptOrchestrator.d.ts +165 -0
  33. package/dist/core/orchestration/PromptOrchestrator.js +182 -0
  34. package/dist/lib/time-utils.d.ts +5 -0
  35. package/dist/lib/time-utils.js +70 -0
  36. package/dist/prompts/constants.d.ts +126 -0
  37. package/dist/prompts/constants.js +161 -0
  38. package/dist/prompts/index.d.ts +10 -0
  39. package/dist/prompts/index.js +11 -0
  40. package/dist/prompts/templates/analysis/AnalysisTemplates.d.ts +13 -0
  41. package/dist/prompts/templates/analysis/AnalysisTemplates.js +94 -0
  42. package/dist/prompts/templates/context/ContextTemplates.d.ts +119 -0
  43. package/dist/prompts/templates/context/ContextTemplates.js +399 -0
  44. package/dist/prompts/templates/hooks/HookTemplates.d.ts +175 -0
  45. package/dist/prompts/templates/hooks/HookTemplates.js +394 -0
  46. package/dist/prompts/templates/hooks/HookTemplates.test.d.ts +7 -0
  47. package/dist/prompts/templates/hooks/HookTemplates.test.js +127 -0
  48. package/dist/shared/config.d.ts +4 -0
  49. package/dist/shared/config.js +41 -0
  50. package/dist/shared/error-handler.d.ts +22 -0
  51. package/dist/shared/error-handler.js +142 -0
  52. package/dist/shared/logger.d.ts +19 -0
  53. package/dist/shared/logger.js +51 -0
  54. package/dist/shared/paths.d.ts +28 -0
  55. package/dist/shared/paths.js +100 -0
  56. package/dist/shared/settings.d.ts +41 -0
  57. package/dist/shared/settings.js +81 -0
  58. package/dist/shared/types.d.ts +145 -0
  59. package/dist/shared/types.js +78 -0
  60. package/docs/STATUS.md +155 -0
  61. package/docs/chroma-backend-migration.md +161 -0
  62. package/docs/landing-page-outline.md +287 -0
  63. package/docs/multi-platform-builds.md +96 -0
  64. package/docs/plans/cloud-service-plan.md +274 -0
  65. package/docs/plans/fix-response-format-issue.md +61 -0
  66. package/docs/plans/restructure-session-hook-output.md +102 -0
  67. package/docs/plans/session-start-hook-investigation.md +45 -0
  68. package/docs/plans/src-reorganization-plan.md +181 -0
  69. package/docs/plans/terminal-effects-decision.md +22 -0
  70. package/docs/plans/terminal-effects-integration.md +82 -0
  71. package/docs/plans/trash-bin-feature-plan.md +240 -0
  72. package/docs/plans/trash-bin-minimal-plan.md +102 -0
  73. package/docs/reference/bun-single-executable.md +584 -0
  74. package/docs/reference/cc-output-styles.md +99 -0
  75. package/docs/reference/chroma-mcp-project-memory-example.md +80 -0
  76. package/docs/reference/chroma-mcp-team-example.md +92 -0
  77. package/docs/reference/claude-code/cc-hooks.md +787 -0
  78. package/docs/reference/claude-code/cc-status-line.md +202 -0
  79. package/docs/reference/claude-code/hook-configuration.md +173 -0
  80. package/docs/reference/claude-code/hook-responses.md +127 -0
  81. package/docs/reference/claude-code/hooks.md +175 -0
  82. package/docs/reference/claude-code/mcp-configuration.md +133 -0
  83. package/docs/reference/claude-code/session-start-hook.md +82 -0
  84. package/docs/reference/load-context-format-example.md +33 -0
  85. package/docs/reference/mcp-sdk/mcp-typescript-sdk-readme.md +1323 -0
  86. package/docs/reference/mcp-sdk/server-implementation.md +286 -0
  87. package/docs/reference/mcp-sdk/stdio-transport.md +345 -0
  88. package/docs/todos/fix-response-format-tasks.md +43 -0
  89. package/docs/todos/implementation-todos.md +280 -0
  90. package/docs/todos/restructure-hook-output-tasks.md +103 -0
  91. package/docs/todos/session-start-hook-fix.md +26 -0
  92. package/docs/todos/terminal-effects-tasks.md +42 -0
  93. package/docs/todos/trash-bin-implementation-todos.md +348 -0
  94. package/docs/todos/trash-bin-minimal-todos.md +27 -0
  95. package/package.json +56 -6
  96. package/claude-mem +0 -0
@@ -0,0 +1,280 @@
1
+ # Claude-Mem Cloud Service Implementation TODOs
2
+
3
+ ## Phase 1: Infrastructure Setup (Week 1-2)
4
+
5
+ ### Database Setup
6
+ - [ ] Create PostgreSQL instance on Coolify
7
+ - [ ] Run database migration scripts
8
+ - [ ] Create organizations table
9
+ - [ ] Create subscriptions table
10
+ - [ ] Create users table
11
+ - [ ] Create api_keys table
12
+ - [ ] Create api_usage table
13
+ - [ ] Create api_usage_daily table
14
+ - [ ] Create audit_logs table
15
+ - [ ] Set up database backups to S3
16
+
17
+ ### ChromaDB Deployment
18
+ - [ ] Create docker-compose.yml for ChromaDB
19
+ - [ ] Configure persistent volume storage
20
+ - [ ] Set up ChromaDB authentication
21
+ - [ ] Test collection creation/deletion
22
+ - [ ] Configure backup strategy
23
+ - [ ] Set up monitoring endpoints
24
+
25
+ ### Redis Setup
26
+ - [ ] Deploy Redis container on Coolify
27
+ - [ ] Configure Redis persistence
28
+ - [ ] Set up Redis password
29
+ - [ ] Test connection from Node.js
30
+ - [ ] Configure key expiration policies
31
+
32
+ ### Core API Server
33
+ - [ ] Initialize Node.js/TypeScript project
34
+ - [ ] Set up Express.js framework
35
+ - [ ] Configure environment variables
36
+ - [ ] Set up logging with Winston
37
+ - [ ] Create health check endpoints
38
+ - [ ] Configure CORS settings
39
+ - [ ] Set up error handling middleware
40
+
41
+ ## Phase 2: Authentication System (Week 3)
42
+
43
+ ### API Key Service
44
+ - [ ] Implement ApiKeyService class
45
+ - [ ] Create key generation function (sk_live_ prefix)
46
+ - [ ] Implement bcrypt hashing for keys
47
+ - [ ] Create key validation method
48
+ - [ ] Add key rotation functionality
49
+
50
+ ### Database Operations
51
+ - [ ] Create ApiKeyRepository class
52
+ - [ ] Implement createApiKey method
53
+ - [ ] Implement validateAndGetContext method
54
+ - [ ] Implement revokeApiKey method
55
+ - [ ] Add getKeysByOrganization method
56
+ - [ ] Create usage tracking queries
57
+
58
+ ### Authentication Middleware
59
+ - [ ] Create AuthMiddleware class
60
+ - [ ] Implement Bearer token extraction
61
+ - [ ] Add Redis caching layer (5min TTL)
62
+ - [ ] Implement rate limiting checks
63
+ - [ ] Add request context injection
64
+ - [ ] Create auth error responses
65
+
66
+ ### Usage Tracking
67
+ - [ ] Create UsageTracker class
68
+ - [ ] Implement async request logging
69
+ - [ ] Add Redis counter updates
70
+ - [ ] Create daily aggregation job
71
+ - [ ] Implement getUsageStats method
72
+ - [ ] Build usage analytics queries
73
+
74
+ ## Phase 3: Billing Integration (Week 4)
75
+
76
+ ### Stripe Setup
77
+ - [ ] Create Stripe account
78
+ - [ ] Get API keys (test & live)
79
+ - [ ] Create subscription products ($9.95)
80
+ - [ ] Set up webhook endpoint
81
+ - [ ] Configure customer portal
82
+
83
+ ### Subscription Management
84
+ - [ ] Create SubscriptionService class
85
+ - [ ] Implement createSubscription method
86
+ - [ ] Add updateSubscription method
87
+ - [ ] Create cancelSubscription method
88
+ - [ ] Implement reactivation flow
89
+ - [ ] Add proration calculations
90
+
91
+ ### Webhook Handlers
92
+ - [ ] Set up webhook verification
93
+ - [ ] Handle customer.subscription.created
94
+ - [ ] Handle customer.subscription.updated
95
+ - [ ] Handle customer.subscription.deleted
96
+ - [ ] Handle invoice.payment_succeeded
97
+ - [ ] Handle invoice.payment_failed
98
+ - [ ] Implement idempotency checks
99
+ - [ ] Add webhook event logging
100
+
101
+ ### Payment Recovery
102
+ - [ ] Configure smart retry rules
103
+ - [ ] Set up dunning emails
104
+ - [ ] Create grace period logic
105
+ - [ ] Implement reactivation flow
106
+ - [ ] Add payment method update flow
107
+
108
+ ## Phase 4: Synchronization Engine (Week 5-6)
109
+
110
+ ### WebSocket Server
111
+ - [ ] Set up Socket.IO server
112
+ - [ ] Implement connection authentication
113
+ - [ ] Create room management (by org)
114
+ - [ ] Add connection pooling
115
+ - [ ] Implement heartbeat/reconnection
116
+ - [ ] Add connection analytics
117
+
118
+ ### Sync Protocol
119
+ - [ ] Define message types
120
+ - [ ] Implement vector clock logic
121
+ - [ ] Create document change events
122
+ - [ ] Add batch sync operations
123
+ - [ ] Implement incremental sync
124
+ - [ ] Create sync status tracking
125
+
126
+ ### Conflict Resolution
127
+ - [ ] Implement vector clock comparison
128
+ - [ ] Add semantic similarity calculation
129
+ - [ ] Create auto-merge logic (>90%)
130
+ - [ ] Build manual resolution queue
131
+ - [ ] Implement CRDT for metadata
132
+ - [ ] Add conflict notification system
133
+
134
+ ### Offline Support
135
+ - [ ] Create Write-Ahead Log schema
136
+ - [ ] Implement WAL operations
137
+ - [ ] Add offline detection
138
+ - [ ] Create replay mechanism
139
+ - [ ] Implement sync queue
140
+ - [ ] Add retry with backoff
141
+
142
+ ### ChromaDB Integration
143
+ - [ ] Create IsolatedChromaClient class
144
+ - [ ] Implement collection prefixing
145
+ - [ ] Add query methods
146
+ - [ ] Create upsert operations
147
+ - [ ] Implement delete operations
148
+ - [ ] Add collection management
149
+
150
+ ## Phase 5: Web Dashboard (Week 7)
151
+
152
+ ### Frontend Setup
153
+ - [ ] Create Next.js application
154
+ - [ ] Set up Tailwind CSS
155
+ - [ ] Configure authentication
156
+ - [ ] Create routing structure
157
+ - [ ] Add state management (Zustand)
158
+
159
+ ### Authentication Pages
160
+ - [ ] Create signup page
161
+ - [ ] Build login page
162
+ - [ ] Add password reset flow
163
+ - [ ] Implement email verification
164
+ - [ ] Create OAuth integration (GitHub)
165
+
166
+ ### Dashboard Pages
167
+ - [ ] Build main dashboard
168
+ - [ ] Create API keys page
169
+ - [ ] Add usage analytics view
170
+ - [ ] Build billing management
171
+ - [ ] Create team management (future)
172
+ - [ ] Add documentation section
173
+
174
+ ### API Key Management
175
+ - [ ] Display active keys (masked)
176
+ - [ ] Add key creation modal
177
+ - [ ] Implement key revocation
178
+ - [ ] Show key usage stats
179
+ - [ ] Add key naming/description
180
+ - [ ] Create copy-to-clipboard
181
+
182
+ ### Billing Interface
183
+ - [ ] Show current plan
184
+ - [ ] Display usage metrics
185
+ - [ ] Add upgrade/downgrade flow
186
+ - [ ] Create payment method update
187
+ - [ ] Show invoice history
188
+ - [ ] Add download receipts
189
+
190
+ ## Phase 6: Testing & Launch (Week 8)
191
+
192
+ ### Testing Infrastructure
193
+ - [ ] Set up Jest for unit tests
194
+ - [ ] Configure integration tests
195
+ - [ ] Create E2E test suite
196
+ - [ ] Add load testing (K6)
197
+ - [ ] Set up CI/CD pipeline
198
+
199
+ ### Security Audit
200
+ - [ ] Review authentication flow
201
+ - [ ] Audit API permissions
202
+ - [ ] Check SQL injection prevention
203
+ - [ ] Verify XSS protection
204
+ - [ ] Test rate limiting
205
+ - [ ] Review encryption implementation
206
+
207
+ ### Documentation
208
+ - [ ] Write API documentation
209
+ - [ ] Create integration guide
210
+ - [ ] Build troubleshooting guide
211
+ - [ ] Add code examples
212
+ - [ ] Create video tutorials
213
+ - [ ] Write migration guide
214
+
215
+ ### Monitoring Setup
216
+ - [ ] Deploy Prometheus
217
+ - [ ] Configure Grafana dashboards
218
+ - [ ] Set up alerting rules
219
+ - [ ] Create PagerDuty integration
220
+ - [ ] Add application metrics
221
+ - [ ] Configure log aggregation
222
+
223
+ ### Beta Launch
224
+ - [ ] Create landing page
225
+ - [ ] Set up waitlist system
226
+ - [ ] Prepare onboarding emails
227
+ - [ ] Create feedback collection
228
+ - [ ] Launch to 50 beta users
229
+ - [ ] Monitor system stability
230
+
231
+ ### Production Launch
232
+ - [ ] Finalize pricing page
233
+ - [ ] Complete legal documents
234
+ - [ ] Set up customer support
235
+ - [ ] Prepare launch announcement
236
+ - [ ] Create Product Hunt submission
237
+ - [ ] Launch marketing campaign
238
+
239
+ ## Ongoing Operations
240
+
241
+ ### Daily Tasks
242
+ - [ ] Monitor system health
243
+ - [ ] Review error logs
244
+ - [ ] Check payment failures
245
+ - [ ] Respond to support tickets
246
+
247
+ ### Weekly Tasks
248
+ - [ ] Review usage analytics
249
+ - [ ] Analyze churn metrics
250
+ - [ ] Update documentation
251
+ - [ ] Deploy bug fixes
252
+
253
+ ### Monthly Tasks
254
+ - [ ] Review infrastructure costs
255
+ - [ ] Analyze customer feedback
256
+ - [ ] Plan feature updates
257
+ - [ ] Update security patches
258
+
259
+ ## Future Enhancements
260
+
261
+ ### Team Plan Features
262
+ - [ ] Multi-user management
263
+ - [ ] Role-based access control
264
+ - [ ] Shared collections
265
+ - [ ] Team usage analytics
266
+ - [ ] Centralized billing
267
+
268
+ ### Advanced Features
269
+ - [ ] Custom embeddings
270
+ - [ ] Data export API
271
+ - [ ] Webhook integrations
272
+ - [ ] Advanced analytics
273
+ - [ ] White-label options
274
+
275
+ ### Scale Optimizations
276
+ - [ ] Implement sharding
277
+ - [ ] Add read replicas
278
+ - [ ] Create CDN integration
279
+ - [ ] Optimize vector search
280
+ - [ ] Add caching layers
@@ -0,0 +1,103 @@
1
+ # Todo: Restructure Session Hook Output Implementation
2
+
3
+ ## Priority 1: Core Data Loading
4
+
5
+ - [ ] Update `loadContext()` in `/src/commands/load-context.ts`
6
+ - Increase default count to fetch more entries
7
+ - Separate overview extraction from memory extraction
8
+ - Return structured object with both overviews and memories
9
+
10
+ - [ ] Modify `extractOverview()` to `extractOverviews()`
11
+ - Accept count parameter (default 3)
12
+ - Return array of overview objects with timestamps
13
+ - Preserve content and metadata fields
14
+
15
+ ## Priority 2: Time Utilities
16
+
17
+ - [ ] Create `/src/lib/time-utils.ts`
18
+ - Implement `formatRelativeTime(timestamp: string): string`
19
+ - Handle various time ranges (minutes, hours, days, weeks)
20
+ - Return human-readable strings ("2 hours ago", "Yesterday", etc.)
21
+
22
+ - [ ] Add timestamp parsing to overview objects
23
+ - Extract timestamp from JSONL entry
24
+ - Convert to Date object for calculations
25
+ - Handle missing/invalid timestamps gracefully
26
+
27
+ ## Priority 3: Template Updates
28
+
29
+ - [ ] Create new Handlebars template `SESSION_START_LAYERED_TEMPLATE`
30
+ - User-visible section with 3 overviews and time-ago
31
+ - Clean formatting without granular details
32
+ - Professional header and separators
33
+
34
+ - [ ] Add HTML comment wrapper template
35
+ - Wrap granular memories in `<!-- CONTEXT-DATA ... -->`
36
+ - Preserve all memory details and keywords
37
+ - Ensure proper escaping of content
38
+
39
+ ## Priority 4: Rendering Logic
40
+
41
+ - [ ] Update `renderSessionStartTemplate()` function
42
+ - Process overviews array with time formatting
43
+ - Generate HTML comment block for memories
44
+ - Combine both layers into single output
45
+
46
+ - [ ] Test output formatting
47
+ - Verify HTML comments are properly hidden
48
+ - Confirm Claude can access both layers
49
+ - Check time-ago displays correctly
50
+
51
+ ## Priority 5: Integration & Testing
52
+
53
+ - [ ] Update `sessionStartHook()` orchestration
54
+ - Pass new parameters to loadContext
55
+ - Handle dual-layer output properly
56
+ - Maintain error handling
57
+
58
+ - [ ] Test with various scenarios
59
+ - Fresh project (no memories)
60
+ - Project with 1-2 overviews only
61
+ - Project with 3+ overviews
62
+ - Mixed timestamps (recent and old)
63
+
64
+ ## Priority 6: Edge Cases
65
+
66
+ - [ ] Handle missing timestamps
67
+ - Default to "Recent" or similar label
68
+ - Don't break on invalid dates
69
+ - Log warnings for debugging
70
+
71
+ - [ ] Handle special characters in content
72
+ - Escape HTML comment delimiters
73
+ - Prevent comment injection
74
+ - Preserve original formatting
75
+
76
+ ## Priority 7: Documentation
77
+
78
+ - [ ] Update code comments
79
+ - Document dual-layer approach
80
+ - Explain HTML comment purpose
81
+ - Add examples of output format
82
+
83
+ - [ ] Update README if needed
84
+ - Note new output format
85
+ - Explain visibility layers
86
+ - Add configuration options if any
87
+
88
+ ## Implementation Order
89
+ 1. Start with time-utils.ts creation
90
+ 2. Modify data extraction functions
91
+ 3. Update templates
92
+ 4. Integrate rendering logic
93
+ 5. Test end-to-end
94
+ 6. Handle edge cases
95
+ 7. Document changes
96
+
97
+ ## Testing Checklist
98
+ - [ ] User sees only 3 overviews
99
+ - [ ] Time-ago formatting works correctly
100
+ - [ ] Granular memories in HTML comments
101
+ - [ ] Claude can access full context
102
+ - [ ] No console errors or warnings
103
+ - [ ] Backward compatibility maintained
@@ -0,0 +1,26 @@
1
+ # Session Start Hook Fix - Todo List
2
+
3
+ ## Investigation Phase
4
+
5
+ - [ ] Examine session-start.js implementation
6
+ - [ ] Check Weaviate entity naming patterns
7
+ - [ ] Verify compression process project name extraction
8
+ - [ ] Query Weaviate for claude-mem-source entities
9
+
10
+ ## Diagnosis Phase
11
+
12
+ - [ ] Identify why entities aren't being retrieved
13
+ - [ ] Confirm correct project name usage
14
+ - [ ] Validate search query construction
15
+
16
+ ## Implementation Phase
17
+
18
+ - [ ] Fix entity naming or search logic as needed
19
+ - [ ] Update session-start hook if required
20
+ - [ ] Test context retrieval with new session
21
+
22
+ ## Validation Phase
23
+
24
+ - [ ] Verify latest updates appear in session context
25
+ - [ ] Confirm consistent behavior across restarts
26
+ - [ ] Document any changes to entity naming convention
@@ -0,0 +1,42 @@
1
+ # Terminal Effects Implementation Tasks
2
+
3
+ ## Prerequisites Enhancement
4
+ - [ ] Enhance `validatePrerequisites()` spinner messages with specific checks being performed
5
+ - [ ] Add visual separators between prerequisite check results
6
+ - [ ] Improve error message formatting for failed prerequisites
7
+
8
+ ## Installation Flow Progress
9
+ - [ ] Add step indicators to the main `p.group()` operation (Step 1/6, Step 2/6, etc.)
10
+ - [ ] Enhance individual spinner messages with more context:
11
+ - [ ] "Creating directory structure" → "Creating ~/.claude-mem directories..."
12
+ - [ ] "Installing Chroma MCP server" → "Setting up persistent memory backend..."
13
+ - [ ] "Installing hooks" → "Configuring Claude Code integration..."
14
+ - [ ] "Configuring settings" → "Updating Claude configuration..."
15
+
16
+ ## Error Display Improvements
17
+ - [ ] Create consistent error message formatting throughout
18
+ - [ ] Add visual hierarchy for error vs warning vs info messages
19
+ - [ ] Improve error context in `installChromaMcp()` function
20
+ - [ ] Enhance cancellation messages with better formatting
21
+
22
+ ## Verification & Results
23
+ - [ ] Improve `verifyInstallation()` feedback with detailed results list
24
+ - [ ] Add visual checkmarks/indicators for successful installation steps
25
+ - [ ] Format final success message with better visual hierarchy
26
+ - [ ] Enhance backup notification messages
27
+
28
+ ## Status Message Polish
29
+ - [ ] Review all spinner messages for consistency and clarity
30
+ - [ ] Add contextual information to longer-running operations
31
+ - [ ] Improve Claude path detection feedback messages
32
+ - [ ] Polish Smart Trash and save-on-clear configuration messages
33
+
34
+ ## Code Quality
35
+ - [ ] Ensure consistent use of @clack/prompts patterns throughout
36
+ - [ ] Verify all existing functionality remains unchanged
37
+ - [ ] Test installation flow with enhanced messages
38
+ - [ ] Document any new message patterns for consistency
39
+
40
+ ---
41
+
42
+ *Target: Enhanced visual feedback without functional changes*