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,274 @@
1
+ # Claude-Mem Cloud Service Plan
2
+
3
+ ## Executive Summary
4
+
5
+ Transform claude-mem into a cloud-hosted SaaS offering at $9.95/month for individual users, with a future team plan at $29.95/month (3-seat minimum). Users will connect multiple Claude Code instances to share a single "brain" (ChromaDB collection) across devices using API keys.
6
+
7
+ ## Service Architecture
8
+
9
+ ### Core Components
10
+ 1. **Cloud ChromaDB Cluster** - Dockerized ChromaDB on your Coolify server
11
+ 2. **API Gateway** - Node.js/TypeScript authentication & routing service
12
+ 3. **Sync Server** - WebSocket-based real-time synchronization
13
+ 4. **Billing System** - Stripe integration for subscription management
14
+ 5. **Web Dashboard** - Customer portal for key management & usage
15
+
16
+ ## Pricing Structure
17
+
18
+ ### Individual Plan ($9.95/month)
19
+ - 1 API key
20
+ - 100,000 vectors stored
21
+ - 10,000 API requests/month
22
+ - 60 requests/minute rate limit
23
+ - Multi-device sync
24
+ - 30-day data retention
25
+
26
+ ### Team Plan ($29.95/month) - Future
27
+ - 3+ API keys (seats)
28
+ - 500,000 vectors per seat
29
+ - 50,000 API requests/month per seat
30
+ - 120 requests/minute rate limit
31
+ - Admin dashboard
32
+ - 90-day data retention
33
+ - Priority support
34
+
35
+ ## Technical Stack
36
+
37
+ ### Backend Services
38
+ - **Runtime**: Node.js + TypeScript
39
+ - **Framework**: Express.js
40
+ - **Database**: PostgreSQL (users, subscriptions, usage)
41
+ - **Vector DB**: ChromaDB (memory storage)
42
+ - **Cache**: Redis (auth caching, rate limiting)
43
+ - **Queue**: Bull (background jobs)
44
+ - **WebSockets**: Socket.IO (real-time sync)
45
+
46
+ ### Infrastructure (on Coolify)
47
+ - **Deployment**: Docker Compose
48
+ - **SSL**: Traefik (auto Let's Encrypt)
49
+ - **Monitoring**: Prometheus + Grafana
50
+ - **Logging**: Loki + Promtail
51
+ - **Backups**: Automated S3 backups
52
+
53
+ ## API Authentication System
54
+
55
+ ### API Key Structure
56
+ ```
57
+ sk_live_[32-byte-random-base64url]
58
+ sk_test_[32-byte-random-base64url]
59
+ ```
60
+
61
+ ### Security Features
62
+ - Bcrypt hashed storage
63
+ - Redis-cached validation (5min TTL)
64
+ - Rate limiting per key
65
+ - Automatic revocation on subscription end
66
+ - Audit logging
67
+
68
+ ### Database Schema
69
+ - organizations (subscription entities)
70
+ - subscriptions (billing info)
71
+ - users (team members)
72
+ - api_keys (authentication)
73
+ - api_usage (tracking)
74
+ - api_usage_daily (aggregated metrics)
75
+
76
+ ## Multi-Device Synchronization
77
+
78
+ ### Sync Protocol
79
+ - **Primary**: WebSocket connections
80
+ - **Fallback**: Server-Sent Events
81
+ - **Last Resort**: HTTP polling
82
+
83
+ ### Conflict Resolution
84
+ 1. Vector clock tracking for causal ordering
85
+ 2. Semantic similarity for auto-merge (>90% similarity)
86
+ 3. CRDT for metadata (keywords, tags)
87
+ 4. Manual resolution queue for complex conflicts
88
+
89
+ ### Offline Support
90
+ - Local SQLite Write-Ahead Log (WAL)
91
+ - Automatic replay on reconnection
92
+ - Incremental sync from last known state
93
+
94
+ ## Subscription & Billing
95
+
96
+ ### Payment Provider: Stripe
97
+ - 2.9% + $0.30 per transaction
98
+ - Built-in subscription management
99
+ - Smart retry for failed payments
100
+ - Customer portal for self-service
101
+ - Comprehensive webhooks
102
+
103
+ ### Billing Events
104
+ - subscription.created → Provision API key & ChromaDB collection
105
+ - subscription.updated → Adjust limits/seats
106
+ - invoice.payment_failed → Send warning, grace period
107
+ - subscription.deleted → Revoke keys, archive data
108
+
109
+ ### Database Operations
110
+ ```sql
111
+ -- Core subscription tracking
112
+ subscriptions (
113
+ id, organization_id, plan_type, status,
114
+ seats, api_requests_limit, rate_limit,
115
+ started_at, ends_at
116
+ )
117
+ ```
118
+
119
+ ## Data Isolation & Security
120
+
121
+ ### Collection Naming
122
+ ```
123
+ org_${organizationId}_memories
124
+ ```
125
+
126
+ ### Access Control
127
+ - API key validates organization ownership
128
+ - Collections prefixed with org ID
129
+ - Row-level security in PostgreSQL
130
+ - Network isolation between tenants
131
+
132
+ ### Compliance
133
+ - GDPR data export/deletion
134
+ - SOC 2 Type I preparation
135
+ - Regular security audits
136
+ - Encrypted data at rest
137
+
138
+ ## Implementation Phases
139
+
140
+ ### Phase 1: Core Infrastructure (Week 1-2)
141
+ - PostgreSQL database setup
142
+ - ChromaDB cluster deployment
143
+ - Redis configuration
144
+ - Basic API server
145
+
146
+ ### Phase 2: Authentication (Week 3)
147
+ - API key generation service
148
+ - Authentication middleware
149
+ - Rate limiting
150
+ - Usage tracking
151
+
152
+ ### Phase 3: Billing Integration (Week 4)
153
+ - Stripe account setup
154
+ - Subscription endpoints
155
+ - Webhook handlers
156
+ - Customer portal
157
+
158
+ ### Phase 4: Synchronization (Week 5-6)
159
+ - WebSocket server
160
+ - Conflict resolution
161
+ - Offline support
162
+ - Device management
163
+
164
+ ### Phase 5: Dashboard (Week 7)
165
+ - Web interface
166
+ - Key management UI
167
+ - Usage analytics
168
+ - Billing management
169
+
170
+ ### Phase 6: Testing & Launch (Week 8)
171
+ - Load testing
172
+ - Security audit
173
+ - Documentation
174
+ - Beta launch
175
+
176
+ ## Monitoring & Operations
177
+
178
+ ### Key Metrics
179
+ - API response time (<100ms p95)
180
+ - Sync latency (<200ms)
181
+ - Uptime (99.9% target)
182
+ - Failed payment rate (<2%)
183
+ - Churn rate (<5% monthly)
184
+
185
+ ### Alerting
186
+ - API errors > 1% (PagerDuty)
187
+ - ChromaDB unreachable (immediate)
188
+ - Payment failures spike (email)
189
+ - Rate limit violations (dashboard)
190
+
191
+ ## Cost Structure
192
+
193
+ ### Infrastructure (Monthly)
194
+ - **Coolify Server**: $0 (existing)
195
+ - **Additional Storage**: ~$20 (100GB)
196
+ - **Bandwidth**: ~$10 (50GB)
197
+ - **Backups (S3)**: ~$5
198
+ - **Monitoring**: ~$0 (self-hosted)
199
+ - **Total**: ~$35/month
200
+
201
+ ### Per Customer Costs
202
+ - **Stripe Fees**: ~$0.59 per customer
203
+ - **Storage**: ~$0.10 per customer
204
+ - **Compute**: ~$0.05 per customer
205
+ - **Total**: ~$0.74 per customer
206
+
207
+ ### Margin Analysis
208
+ - Revenue per customer: $9.95
209
+ - Cost per customer: ~$0.74
210
+ - Gross margin: ~92.5%
211
+ - Break-even: ~4 customers
212
+
213
+ ## Marketing & Growth
214
+
215
+ ### Initial Launch Strategy
216
+ 1. Beta with existing claude-mem users
217
+ 2. Product Hunt launch
218
+ 3. Dev.to/Medium technical articles
219
+ 4. Twitter/X developer community
220
+ 5. GitHub sponsorship tier
221
+
222
+ ### Pricing Psychology
223
+ - $9.95 under $10 threshold
224
+ - Annual discount (2 months free)
225
+ - Free tier limitations drive upgrades
226
+ - Team pricing encourages expansion
227
+
228
+ ## Risk Mitigation
229
+
230
+ ### Technical Risks
231
+ - **ChromaDB scaling**: Plan sharding strategy
232
+ - **Sync conflicts**: Comprehensive testing
233
+ - **Data loss**: Automated backups, replication
234
+ - **Security breach**: Regular audits, encryption
235
+
236
+ ### Business Risks
237
+ - **Churn**: Focus on activation & retention
238
+ - **Competition**: Unique multi-device sync
239
+ - **Compliance**: Start GDPR/SOC 2 early
240
+ - **Support burden**: Self-service documentation
241
+
242
+ ## Success Metrics
243
+
244
+ ### Month 1 Goals
245
+ - 50 beta users
246
+ - <1% error rate
247
+ - 99% uptime
248
+ - NPS > 50
249
+
250
+ ### Month 6 Goals
251
+ - 500 paying customers
252
+ - $4,975 MRR
253
+ - <5% monthly churn
254
+ - Team plan launch
255
+
256
+ ### Year 1 Goals
257
+ - 2,000 customers
258
+ - $30,000 MRR
259
+ - 20% on team plans
260
+ - Break-even achieved
261
+
262
+ ## Next Steps
263
+
264
+ 1. Deploy ChromaDB cluster on Coolify
265
+ 2. Set up PostgreSQL database
266
+ 3. Create Stripe account & products
267
+ 4. Build authentication service
268
+ 5. Implement basic API endpoints
269
+ 6. Create landing page
270
+ 7. Begin beta testing
271
+
272
+ ## Conclusion
273
+
274
+ This plan provides a clear path to transform claude-mem into a sustainable SaaS business. The $9.95 price point is accessible while maintaining excellent margins. Multi-device sync provides unique value. Coolify infrastructure keeps costs minimal. Stripe handles complex billing scenarios. The phased approach reduces risk while enabling rapid iteration based on user feedback.
@@ -0,0 +1,61 @@
1
+ # Plan: Fix Claude Response Format Issue
2
+
3
+ ## Problem Summary
4
+ The claude-mem system is failing to extract summaries from Claude's responses because:
5
+ - **Expected**: Pipe-separated format with 5 parts: `summary | session_id | keywords | timestamp | archive`
6
+ - **Actual**: Claude returns structured markdown analysis or brief acknowledgments
7
+ - **Result**: 0 summaries extracted, sessions marked as "NO SUMMARIES EXTRACTED"
8
+
9
+ ## Root Cause Analysis
10
+
11
+ ### 1. Prompt Complexity
12
+ The current prompt in `AnalysisTemplates.ts` asks Claude to:
13
+ - Extract entities and create MCP tool calls
14
+ - Create relationships between entities
15
+ - Return pipe-separated summaries
16
+
17
+ This multi-step process is causing Claude to focus on the analysis portion and not produce the required output format.
18
+
19
+ ### 2. Format Mismatch
20
+ - **Prompt specifies**: 5-part pipe-separated format
21
+ - **Parser checks for**: 3+ parts (mismatch in validation)
22
+ - **Claude returns**: Markdown headers and structured text
23
+
24
+ ### 3. Recent Changes
25
+ A commit on 2025-09-03 updated the output format specification, but the parser wasn't synchronized with the new requirements.
26
+
27
+ ## Solution Approach
28
+
29
+ ### Primary Fix: Simplify the Prompt
30
+ Remove the MCP tool integration from the compression prompt and focus solely on generating pipe-separated summaries. The MCP tools can be called separately if needed.
31
+
32
+ ### Secondary Fix: Align Parser with Format
33
+ Update the parser to validate exactly 5 pipe-separated parts instead of 3+.
34
+
35
+ ## Implementation Steps
36
+
37
+ 1. **Modify `AnalysisTemplates.ts`**
38
+ - Remove MCP tool instructions from the prompt
39
+ - Clarify that ONLY pipe-separated lines should be returned
40
+ - Simplify the prompt to focus on summary generation
41
+
42
+ 2. **Update `TranscriptCompressor.ts`**
43
+ - Fix parser to validate exactly 5 parts
44
+ - Add better error logging for format mismatches
45
+ - Consider fallback parsing for partial matches
46
+
47
+ 3. **Test the Changes**
48
+ - Run compression on test transcripts
49
+ - Verify pipe-separated output is generated
50
+ - Ensure summaries are properly extracted and indexed
51
+
52
+ ## Risk Assessment
53
+ - **Low Risk**: Changes are isolated to prompt and parser
54
+ - **Impact**: Will fix summary extraction for all future sessions
55
+ - **Rollback**: Easy to revert if issues arise
56
+
57
+ ## Success Criteria
58
+ - Claude returns pipe-separated format consistently
59
+ - Parser extracts 3-10 summaries per session
60
+ - No more "NO SUMMARIES EXTRACTED" errors
61
+ - Archive files contain meaningful summaries
@@ -0,0 +1,102 @@
1
+ # Plan: Restructure Session Start Hook Output
2
+
3
+ ## Overview
4
+ Restructure the session start hook to display a cleaner user-facing view with last 3 overviews and time-ago data, while preserving all granular memories in the transcript-level context.
5
+
6
+ ## Requirements
7
+ 1. Keep granular memories in transcript level output (hidden from user but still in context)
8
+ 2. Show only the last 3 overviews with "time ago" data to user
9
+ 3. Preserve all context for Claude while presenting cleaner interface to user
10
+
11
+ ## Current State Analysis
12
+ - Session hook shows both overviews and detailed memory entries
13
+ - All output is visible to user via console.log
14
+ - Memories grouped by session with detailed keywords
15
+ - Single overview shown at top when available
16
+
17
+ ## Target Architecture
18
+
19
+ ### Output Layers
20
+ 1. **User-Visible Layer**: Clean display with last 3 overviews + time-ago
21
+ 2. **Transcript Layer**: Hidden HTML comments containing granular memories
22
+ 3. **Context Preservation**: Both layers remain in Claude's context
23
+
24
+ ### Data Structure
25
+ ```
26
+ [User Visible]
27
+ 🧠 Recent Context: [Current DateTime]
28
+ ====================================================================
29
+ 📅 2 hours ago:
30
+ [Overview content from session 1]
31
+
32
+ 📅 5 hours ago:
33
+ [Overview content from session 2]
34
+
35
+ 📅 Yesterday:
36
+ [Overview content from session 3]
37
+ ====================================================================
38
+
39
+ [Hidden in HTML Comments - Transcript Level]
40
+ <!-- CONTEXT-DATA
41
+ Granular memories for session analysis:
42
+ - Memory 1: [details] (keywords)
43
+ - Memory 2: [details] (keywords)
44
+ ...
45
+ END-CONTEXT-DATA -->
46
+ ```
47
+
48
+ ## Implementation Steps
49
+
50
+ ### Phase 1: Data Structure Enhancement
51
+ 1. Modify `loadContext()` to fetch more overview entries
52
+ 2. Create separate data paths for overviews vs memories
53
+ 3. Add timestamp metadata to overview objects
54
+
55
+ ### Phase 2: Time-Ago Calculation
56
+ 1. Implement relative time formatter utility
57
+ 2. Parse overview timestamps
58
+ 3. Calculate time differences from current time
59
+
60
+ ### Phase 3: Template Restructuring
61
+ 1. Create new template for user-visible overviews
62
+ 2. Add HTML comment wrapper for granular memories
63
+ 3. Split rendering logic for dual-layer output
64
+
65
+ ### Phase 4: Output Formatting
66
+ 1. Modify `renderSessionStartTemplate()` to handle dual outputs
67
+ 2. Implement HTML comment injection for transcript data
68
+ 3. Ensure proper escaping and formatting
69
+
70
+ ## Technical Details
71
+
72
+ ### Files to Modify
73
+ 1. `/src/commands/load-context.ts` - Data loading logic
74
+ 2. `/src/prompts/templates/context/ContextTemplates.ts` - Template definitions
75
+ 3. `/src/commands/hooks.ts` - Hook orchestration
76
+ 4. `/src/lib/time-utils.ts` - New file for time calculations
77
+
78
+ ### Key Functions to Update
79
+ - `extractOverview()` → `extractOverviews()` (plural, fetch 3)
80
+ - `processMemoryEntries()` - Keep as-is for transcript data
81
+ - `renderSessionStartTemplate()` - Add dual-layer rendering
82
+ - New: `formatRelativeTime()` - Time-ago formatting
83
+
84
+ ### Data Flow Changes
85
+ ```
86
+ JSONL → Parse →
87
+ ├── Extract 3 Overviews → Add timestamps → Format time-ago → User display
88
+ └── Extract Memories → Group by session → Wrap in comments → Transcript level
89
+ ```
90
+
91
+ ## Risk Mitigation
92
+ - Test HTML comment escaping to prevent injection
93
+ - Ensure backward compatibility with existing memory format
94
+ - Handle missing timestamps gracefully
95
+ - Preserve existing error handling
96
+
97
+ ## Success Criteria
98
+ 1. User sees clean display with only 3 recent overviews
99
+ 2. Each overview shows relative time (e.g., "2 hours ago")
100
+ 3. Granular memories preserved in HTML comments
101
+ 4. Claude maintains full context from both layers
102
+ 5. No regression in existing functionality
@@ -0,0 +1,45 @@
1
+ # Session Start Hook Investigation Plan
2
+
3
+ ## Problem Statement
4
+ After running `/compact` to compress the latest conversation into Weaviate, the session start hook is not loading the latest updates from the claude-mem-source project. The compaction appears successful but the context retrieval is not working as expected.
5
+
6
+ ## Investigation Areas
7
+
8
+ ### 1. Session Start Hook Implementation
9
+ - Examine `/Users/alexnewman/.claude-mem/hooks/session-start.js`
10
+ - Understand how it queries Weaviate for relevant context
11
+ - Check what search terms it uses to find relevant entities
12
+
13
+ ### 2. Entity Naming Convention
14
+ - Verify entities are being stored with correct naming pattern: `[project]_[entityType]_[entityName]`
15
+ - Check if project name is correctly identified as "claude-mem-source" vs "claude-mem"
16
+ - Validate entity names in Weaviate match expected format
17
+
18
+ ### 3. Compression Process
19
+ - Review how TranscriptCompressor extracts project name from conversation
20
+ - Verify entities are being created with proper project prefix
21
+ - Check if pre-compact hook is correctly processing the transcript
22
+
23
+ ### 4. Weaviate Data Verification
24
+ - Query Weaviate directly to see what entities exist
25
+ - Check for entities with "claude-mem-source" prefix
26
+ - Verify entities from recent improvements are stored
27
+
28
+ ## Success Criteria
29
+ - Session start hook retrieves context about recent code improvements
30
+ - Entities are correctly prefixed with "claude-mem-source"
31
+ - Context loading works consistently across session restarts
32
+
33
+ ## Parallel Agent Tasks
34
+
35
+ ### Agent 1: Hook Implementation Analysis
36
+ Investigate session-start.js to understand retrieval logic
37
+
38
+ ### Agent 2: Weaviate Data Inspection
39
+ Check what entities exist in Weaviate and their naming patterns
40
+
41
+ ### Agent 3: Compression Process Verification
42
+ Trace how project names are extracted and used in entity creation
43
+
44
+ ## Expected Outcome
45
+ Identify root cause and implement fix to ensure session start hook properly loads context from the claude-mem-source project.
@@ -0,0 +1,181 @@
1
+ # Source Folder Reorganization Plan
2
+
3
+ ## Overview
4
+
5
+ This plan reorganizes the `src/` folder to improve separation of concerns, eliminate misleading folder names, and create a cleaner, more maintainable architecture.
6
+
7
+ ## Current Issues
8
+
9
+ 1. **Mixed concerns at root level**: Entry points (`cli.ts`, `mcp-server*.ts`) mixed with shared modules
10
+ 2. **Misleading "utils" folder**: Contains core business logic instead of utilities
11
+ 3. **Large constants.ts file**: 455 lines mixing different concerns
12
+ 4. **Unclear prompts organization**: Example files mixed with templates and core logic
13
+ 5. **No clear infrastructure/domain separation**
14
+
15
+ ## Target Structure
16
+
17
+ ```
18
+ src/
19
+ ├── bin/ # Entry points only
20
+ │ ├── cli.ts
21
+ │ ├── mcp-server.ts
22
+ │ └── mcp-server-cli.ts
23
+ ├── commands/ # CLI commands (unchanged)
24
+ │ ├── compress.ts
25
+ │ ├── install.ts
26
+ │ ├── load-context.ts
27
+ │ ├── logs.ts
28
+ │ ├── status.ts
29
+ │ └── uninstall.ts
30
+ ├── core/ # Core business logic
31
+ │ ├── compression/
32
+ │ │ └── TranscriptCompressor.ts
33
+ │ └── orchestration/
34
+ │ └── PromptOrchestrator.ts
35
+ ├── storage/ # Data persistence layer
36
+ │ ├── adapters/
37
+ │ │ └── weaviate-mcp-adapter.ts
38
+ │ └── clients/
39
+ │ └── mcp-client.ts
40
+ ├── prompts/ # Template system
41
+ │ ├── templates/
42
+ │ │ ├── analysis/
43
+ │ │ │ └── AnalysisTemplates.ts
44
+ │ │ ├── context/
45
+ │ │ │ └── ContextTemplates.ts
46
+ │ │ └── hooks/
47
+ │ │ ├── HookTemplates.ts
48
+ │ │ └── HookTemplates.test.ts
49
+ │ ├── constants.ts # Prompt-specific constants (split from main)
50
+ │ └── index.ts # Main exports
51
+ ├── shared/ # Shared infrastructure
52
+ │ ├── config.ts
53
+ │ ├── types.ts
54
+ │ ├── paths.ts # Renamed from PathResolver
55
+ │ ├── logger.ts
56
+ │ └── error-handler.ts
57
+ └── constants.ts # Core app constants only
58
+ ```
59
+
60
+ ## Migration Steps
61
+
62
+ ### Phase 1: Create Directory Structure
63
+
64
+ ```bash
65
+ mkdir -p src/bin
66
+ mkdir -p src/core/compression
67
+ mkdir -p src/core/orchestration
68
+ mkdir -p src/storage/adapters
69
+ mkdir -p src/storage/clients
70
+ mkdir -p src/shared
71
+ mkdir -p src/prompts/templates/analysis
72
+ mkdir -p src/prompts/templates/context
73
+ mkdir -p src/prompts/templates/hooks
74
+ ```
75
+
76
+ ### Phase 2: Move Files
77
+
78
+ | From | To | Reason |
79
+ |------|-----|---------|
80
+ | `src/cli.ts` | `src/bin/cli.ts` | Separate entry points |
81
+ | `src/mcp-server.ts` | `src/bin/mcp-server.ts` | Separate entry points |
82
+ | `src/mcp-server-cli.ts` | `src/bin/mcp-server-cli.ts` | Separate entry points |
83
+ | `src/utils/TranscriptCompressor.ts` | `src/core/compression/TranscriptCompressor.ts` | Core business logic |
84
+ | `src/prompts/PromptOrchestrator.ts` | `src/core/orchestration/PromptOrchestrator.ts` | Core business logic |
85
+ | `src/utils/weaviate-mcp-adapter.ts` | `src/storage/adapters/weaviate-mcp-adapter.ts` | Storage layer |
86
+ | `src/utils/mcp-client.ts` | `src/storage/clients/mcp-client.ts` | Storage layer |
87
+ | `src/utils/PathResolver.ts` | `src/shared/paths.ts` | Shared utility, clearer name |
88
+ | `src/utils/logger.ts` | `src/shared/logger.ts` | Shared infrastructure |
89
+ | `src/config.ts` | `src/shared/config.ts` | Shared configuration |
90
+ | `src/types.ts` | `src/shared/types.ts` | Shared types |
91
+ | `src/error-handler.ts` | `src/shared/error-handler.ts` | Shared error handling |
92
+ | `src/prompts/templates/AnalysisTemplates.ts` | `src/prompts/templates/analysis/AnalysisTemplates.ts` | Template organization |
93
+ | `src/prompts/templates/ContextTemplates.ts` | `src/prompts/templates/context/ContextTemplates.ts` | Template organization |
94
+ | `src/prompts/templates/HookTemplates.ts` | `src/prompts/templates/hooks/HookTemplates.ts` | Template organization |
95
+ | `src/prompts/templates/HookTemplates.test.ts` | `src/prompts/templates/hooks/HookTemplates.test.ts` | Keep tests with source |
96
+
97
+ ### Phase 3: Delete Unnecessary Example Files
98
+
99
+ ```bash
100
+ rm src/prompts/examples.ts
101
+ rm src/prompts/templates/context-examples.ts
102
+ rm src/prompts/templates/example-usage.ts
103
+ rm src/prompts/templates/hook-integration-examples.ts
104
+ ```
105
+
106
+ ### Phase 4: Split Constants File
107
+
108
+ The large `constants.ts` file needs to be split:
109
+ - Core constants stay in `src/constants.ts`
110
+ - Prompt-related constants move to `src/prompts/constants.ts`
111
+
112
+ ### Phase 5: Update Imports
113
+
114
+ All imports will need to be updated to reflect the new structure. TypeScript path aliases should be added to `tsconfig.json`:
115
+
116
+ ```json
117
+ {
118
+ "compilerOptions": {
119
+ "baseUrl": "./src",
120
+ "paths": {
121
+ "@/bin/*": ["bin/*"],
122
+ "@/commands/*": ["commands/*"],
123
+ "@/core/*": ["core/*"],
124
+ "@/storage/*": ["storage/*"],
125
+ "@/prompts/*": ["prompts/*"],
126
+ "@/shared/*": ["shared/*"],
127
+ "@/*": ["*"]
128
+ }
129
+ }
130
+ }
131
+ ```
132
+
133
+ ### Phase 6: Clean Up
134
+
135
+ ```bash
136
+ rm -rf src/utils
137
+ ```
138
+
139
+ ## Import Update Examples
140
+
141
+ ### Before
142
+ ```typescript
143
+ import { TranscriptCompressor } from './utils/TranscriptCompressor.js';
144
+ import { WeaviateMCPAdapter } from './utils/weaviate-mcp-adapter.js';
145
+ import { log } from './utils/logger.js';
146
+ import { CONSTANTS } from './constants.js';
147
+ ```
148
+
149
+ ### After
150
+ ```typescript
151
+ import { TranscriptCompressor } from '@/core/compression/TranscriptCompressor.js';
152
+ import { WeaviateMCPAdapter } from '@/storage/adapters/weaviate-mcp-adapter.js';
153
+ import { log } from '@/shared/logger.js';
154
+ import { CONSTANTS } from '@/constants.js';
155
+ ```
156
+
157
+ ## Benefits
158
+
159
+ 1. **Clear separation of concerns**: Each folder has a single, clear purpose
160
+ 2. **No misleading names**: "utils" eliminated, all folders accurately describe contents
161
+ 3. **Better scalability**: Room for growth in each module
162
+ 4. **Improved maintainability**: Related code is co-located
163
+ 5. **Cleaner imports**: Path aliases make dependencies clear
164
+ 6. **Easier navigation**: Developers can quickly find what they need
165
+
166
+ ## Risk Assessment
167
+
168
+ - **Low Risk**: Directory creation, file moves
169
+ - **Medium Risk**: Import updates, constants file splitting
170
+ - **High Risk**: None identified
171
+
172
+ ## Testing Strategy
173
+
174
+ 1. Run TypeScript compiler after each phase to catch import errors
175
+ 2. Execute test suite after migration
176
+ 3. Test CLI commands manually
177
+ 4. Verify MCP server functionality
178
+
179
+ ## Rollback Plan
180
+
181
+ Keep git commits atomic for each phase to enable easy rollback if needed.
@@ -0,0 +1,22 @@
1
+ # Terminal Effects Decision
2
+
3
+ ## Technical Reality
4
+ - `terminaltexteffects` is Python-only
5
+ - Node.js cannot directly execute Python packages
6
+ - Integration would require complex subprocess management
7
+
8
+ ## Current State
9
+ - Installer already has excellent visual feedback via `@clack/prompts`
10
+ - System works reliably and provides clear user guidance
11
+ - No user complaints about current interface
12
+
13
+ ## Decision
14
+ Per the "Make It Work First" manifesto: **No cosmetic enhancements**.
15
+
16
+ The existing installer does its job. Adding visual effects would be:
17
+ - Defensive coding against a non-problem
18
+ - Complexity that hides core functionality
19
+ - Violation of KISS principles
20
+
21
+ ## Action
22
+ Keep current installer as-is. Focus on functionality, not appearance.