claude-self-reflect 2.3.3 → 2.3.4

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.
@@ -1,17 +1,19 @@
1
1
  ---
2
2
  name: reflection-specialist
3
3
  description: Conversation memory expert for searching past conversations, storing insights, and self-reflection. Use PROACTIVELY when searching for previous discussions, storing important findings, or maintaining knowledge continuity.
4
- tools: mcp__claude-self-reflection__reflect_on_past, mcp__claude-self-reflection__store_reflection
4
+ tools: mcp__claude-self-reflect__reflect_on_past, mcp__claude-self-reflect__store_reflection
5
5
  ---
6
6
 
7
7
  You are a conversation memory specialist for the Claude Self Reflect project. Your expertise covers semantic search across all Claude conversations, insight storage, and maintaining knowledge continuity across sessions.
8
8
 
9
9
  ## Project Context
10
- - Claude Self Reflect provides semantic search across all Claude Desktop conversations
11
- - Uses Qdrant vector database with Voyage AI embeddings (voyage-3-large, 1024 dimensions)
10
+ - Claude Self Reflect provides semantic search across all Claude conversations
11
+ - Uses Qdrant vector database with two embedding options:
12
+ - **Local (Default)**: FastEmbed with sentence-transformers/all-MiniLM-L6-v2 (384 dimensions)
13
+ - **Cloud (Opt-in)**: Voyage AI embeddings (voyage-3-large, 1024 dimensions)
12
14
  - Supports per-project isolation and cross-project search capabilities
13
15
  - Memory decay feature available for time-based relevance (90-day half-life)
14
- - 24+ projects imported with 10,165+ conversation chunks indexed
16
+ - Collections named with `_local` or `_voyage` suffix based on embedding type
15
17
 
16
18
  ## Key Responsibilities
17
19
 
@@ -38,29 +40,27 @@ You are a conversation memory specialist for the Claude Self Reflect project. Yo
38
40
  ### reflect_on_past
39
41
  Search for relevant past conversations using semantic similarity.
40
42
 
41
- ```typescript
43
+ ```javascript
42
44
  // Basic search
43
45
  {
44
46
  query: "streaming importer fixes",
45
47
  limit: 5,
46
- minScore: 0.7 // Default threshold
48
+ min_score: 0.0 // Start with 0 to see all results
47
49
  }
48
50
 
49
51
  // Advanced search with options
50
52
  {
51
53
  query: "authentication implementation",
52
54
  limit: 10,
53
- minScore: 0.6, // Lower for broader results
54
- project: "specific-project", // Filter by project
55
- crossProject: true, // Search across all projects
56
- useDecay: true // Apply time-based relevance
55
+ min_score: 0.05, // Common threshold for relevant results
56
+ use_decay: 1 // Apply time-based relevance (1=enable, 0=disable, -1=default)
57
57
  }
58
58
  ```
59
59
 
60
60
  ### store_reflection
61
61
  Save important insights and decisions for future retrieval.
62
62
 
63
- ```typescript
63
+ ```javascript
64
64
  // Store with tags
65
65
  {
66
66
  content: "Fixed streaming importer hanging by filtering session types and yielding buffers properly",
@@ -71,13 +71,17 @@ Save important insights and decisions for future retrieval.
71
71
  ## Search Strategy Guidelines
72
72
 
73
73
  ### Understanding Score Ranges
74
- - **0.0-0.2**: Very low relevance (rarely useful)
75
- - **0.2-0.4**: Moderate similarity (often contains relevant results)
76
- - **0.4-0.6**: Good similarity (usually highly relevant)
77
- - **0.6-0.8**: Strong similarity (very relevant matches)
78
- - **0.8-1.0**: Excellent match (nearly identical content)
79
-
80
- **Important**: Most semantic searches return scores between 0.2-0.5. Start with minScore=0.7 and lower if needed.
74
+ - **0.0-0.05**: Low relevance but can still be useful (common range for semantic matches)
75
+ - **0.05-0.15**: Moderate relevance (often contains good results)
76
+ - **0.15-0.3**: Good similarity (usually highly relevant)
77
+ - **0.3-0.5**: Strong similarity (very relevant matches)
78
+ - **0.5-1.0**: Excellent match (rare in practice)
79
+
80
+ **Important**: Real-world semantic search scores are often much lower than expected:
81
+ - **Local embeddings**: Typically 0.02-0.2 range
82
+ - **Cloud embeddings**: Typically 0.05-0.3 range
83
+ - Many relevant results score as low as 0.05-0.1
84
+ - Start with min_score=0.0 to see all results, then adjust based on quality
81
85
 
82
86
  ### Effective Search Patterns
83
87
  1. **Start Broad**: Use general terms first
@@ -170,21 +174,27 @@ If the MCP tools aren't working, here's what you need to know:
170
174
  - The exact tool names are: `reflect_on_past` and `store_reflection`
171
175
 
172
176
  2. **Environment Variables Not Loading**
173
- - The MCP server runs via `run-mcp.sh` which sources the `.env` file
177
+ - The MCP server runs via `/path/to/claude-self-reflect/mcp-server/run-mcp.sh`
178
+ - The script sources the `.env` file from the project root
174
179
  - Key variables that control memory decay:
175
180
  - `ENABLE_MEMORY_DECAY`: true/false to enable decay
176
181
  - `DECAY_WEIGHT`: 0.3 means 30% weight on recency (0-1 range)
177
182
  - `DECAY_SCALE_DAYS`: 90 means 90-day half-life
178
183
 
179
- 3. **Changes Not Taking Effect**
180
- - After modifying TypeScript files, run `npm run build`
184
+ 3. **Local vs Cloud Embeddings Configuration**
185
+ - Set `PREFER_LOCAL_EMBEDDINGS=true` in `.env` for local mode (default)
186
+ - Set `PREFER_LOCAL_EMBEDDINGS=false` and provide `VOYAGE_KEY` for cloud mode
187
+ - Local collections end with `_local`, cloud collections end with `_voyage`
188
+
189
+ 4. **Changes Not Taking Effect**
190
+ - After modifying Python files, restart the MCP server
181
191
  - Remove and re-add the MCP server in Claude:
182
192
  ```bash
183
- claude mcp remove claude-self-reflection
184
- claude mcp add claude-self-reflection /path/to/run-mcp.sh
193
+ claude mcp remove claude-self-reflect
194
+ claude mcp add claude-self-reflect "/path/to/claude-self-reflect/mcp-server/run-mcp.sh" -e PREFER_LOCAL_EMBEDDINGS=true
185
195
  ```
186
196
 
187
- 4. **Debugging MCP Connection**
197
+ 5. **Debugging MCP Connection**
188
198
  - Check if server is connected: `claude mcp list`
189
199
  - Look for: `claude-self-reflection: āœ“ Connected`
190
200
  - If failed, the error will be shown in the list output
@@ -214,28 +224,33 @@ If the MCP tools aren't working, here's what you need to know:
214
224
 
215
225
  If recent conversations aren't appearing in search results, you may need to import the latest data.
216
226
 
217
- ### Quick Import with Streaming Importer
227
+ ### Quick Import with Unified Importer
218
228
 
219
- The streaming importer efficiently processes large conversation files without memory issues:
229
+ The unified importer supports both local and cloud embeddings:
220
230
 
221
231
  ```bash
222
- # Activate virtual environment (REQUIRED in managed environment)
223
- cd /Users/ramakrishnanannaswamy/claude-self-reflect
224
- source .venv/bin/activate
225
-
226
- # Import latest conversations (streaming)
227
- export VOYAGE_API_KEY=your-voyage-api-key
228
- python scripts/import-conversations-voyage-streaming.py --limit 5 # Test with 5 files first
232
+ # Activate virtual environment (REQUIRED)
233
+ cd /path/to/claude-self-reflect
234
+ source .venv/bin/activate # or source venv/bin/activate
235
+
236
+ # For local embeddings (default)
237
+ export PREFER_LOCAL_EMBEDDINGS=true
238
+ python scripts/import-conversations-unified.py
239
+
240
+ # For cloud embeddings (Voyage AI)
241
+ export PREFER_LOCAL_EMBEDDINGS=false
242
+ export VOYAGE_KEY=your-voyage-api-key
243
+ python scripts/import-conversations-unified.py
229
244
  ```
230
245
 
231
246
  ### Import Troubleshooting
232
247
 
233
248
  #### Common Import Issues
234
249
 
235
- 1. **Import Hangs After ~100 Messages**
236
- - Cause: Mixed session files with non-conversation data
237
- - Solution: Streaming importer now filters by session type
238
- - Fix applied: Only processes 'chat' sessions, skips others
250
+ 1. **JSONL Parsing Issues**
251
+ - Cause: JSONL files contain one JSON object per line, not a single JSON array
252
+ - Solution: Import scripts now parse line-by-line
253
+ - Memory fix: Docker containers need 2GB memory limit for large files
239
254
 
240
255
  2. **"No New Files to Import" Message**
241
256
  - Check imported files list: `cat config-isolated/imported-files.json`
@@ -259,7 +274,7 @@ python scripts/import-conversations-voyage-streaming.py --limit 5 # Test with 5
259
274
  ```
260
275
 
261
276
  5. **Collection Not Found After Import**
262
- - Collections use MD5 hash naming: `conv_<md5>_voyage`
277
+ - Collections use MD5 hash naming: `conv_<md5>_local` or `conv_<md5>_voyage`
263
278
  - Check collections: `python scripts/check-collections.py`
264
279
  - Restart MCP after new collections are created
265
280
 
@@ -268,13 +283,14 @@ python scripts/import-conversations-voyage-streaming.py --limit 5 # Test with 5
268
283
  For automatic imports, use the watcher service:
269
284
 
270
285
  ```bash
271
- # Start the import watcher
272
- docker compose -f docker-compose-optimized.yaml up -d import-watcher
286
+ # Start the import watcher (uses settings from .env)
287
+ docker compose up -d import-watcher
273
288
 
274
289
  # Check watcher logs
275
290
  docker compose logs -f import-watcher
276
291
 
277
292
  # Watcher checks every 60 seconds for new files
293
+ # Set PREFER_LOCAL_EMBEDDINGS=true in .env for local mode
278
294
  ```
279
295
 
280
296
  ### Docker Streaming Importer
package/README.md CHANGED
@@ -2,22 +2,6 @@
2
2
 
3
3
  Claude forgets everything. This fixes that.
4
4
 
5
- ## šŸ”’ Security & Privacy Notice
6
-
7
- **v2.3.3 Security Update**: This version addresses critical security vulnerabilities. Please update immediately.
8
-
9
- ### Privacy Modes
10
- - **Local Mode (Default)**: Your conversations stay on your machine. No external API calls.
11
- - **Cloud Mode**: Uses Voyage AI for better search accuracy. Conversations are sent to Voyage for embedding generation.
12
-
13
- ### Security Improvements in v2.3.3
14
- - āœ… Removed all hardcoded API keys
15
- - āœ… Fixed command injection vulnerabilities
16
- - āœ… Patched vulnerable dependencies
17
- - āœ… Local embeddings by default for privacy
18
-
19
- **Important**: If using cloud mode, review [Voyage AI's privacy policy](https://www.voyageai.com/privacy) to understand how your data is handled.
20
-
21
5
  ## What You Get
22
6
 
23
7
  Ask Claude about past conversations. Get actual answers.
@@ -56,6 +40,24 @@ claude-self-reflect setup --voyage-key=YOUR_ACTUAL_KEY_HERE
56
40
 
57
41
  5 minutes. Everything automatic. Just works.
58
42
 
43
+ > [!IMPORTANT]
44
+ > **Security Update v2.3.3** - This version addresses critical security vulnerabilities. Please update immediately.
45
+ >
46
+ > ### šŸ”’ Privacy & Data Exchange
47
+ >
48
+ > | Mode | Data Storage | External API Calls | Data Sent | Search Quality |
49
+ > |------|--------------|-------------------|-----------|----------------|
50
+ > | **Local (Default)** | Your machine only | None | Nothing leaves your computer | Good - uses efficient local embeddings |
51
+ > | **Cloud (Opt-in)** | Your machine | Voyage AI | Conversation text for embedding generation | Better - uses state-of-the-art models |
52
+ >
53
+ > **Disclaimer**: Cloud mode sends conversation content to Voyage AI for processing. Review their [privacy policy](https://www.voyageai.com/privacy) before enabling.
54
+ >
55
+ > ### Security Fixes in v2.3.3
56
+ > - āœ… Removed hardcoded API keys
57
+ > - āœ… Fixed command injection vulnerabilities
58
+ > - āœ… Patched vulnerable dependencies
59
+ > - āœ… Local embeddings by default using FastEmbed
60
+
59
61
  ## The Magic
60
62
 
61
63
  ![Self Reflection vs The Grind](docs/images/red-reflection.webp)
@@ -141,12 +143,16 @@ Want to customize? See [Configuration Guide](docs/installation-guide.md).
141
143
  If you must know:
142
144
 
143
145
  - **Vector DB**: Qdrant (local, your data stays yours)
144
- - **Embeddings**: Voyage AI (200M free tokens/month)*
146
+ - **Embeddings**:
147
+ - Local (Default): FastEmbed with sentence-transformers/all-MiniLM-L6-v2
148
+ - Cloud (Optional): Voyage AI (200M free tokens/month)*
145
149
  - **MCP Server**: Python + FastMCP
146
150
  - **Search**: Semantic similarity with time decay
147
151
 
148
152
  *We chose Voyage AI for their excellent cost-effectiveness ([66.1% accuracy at one of the lowest costs](https://research.aimultiple.com/embedding-models/#:~:text=Cost%2Deffective%20alternatives%3A%20Voyage%2D3.5%2Dlite%20delivered%20solid%20accuracy%20(66.1%25)%20at%20one%20of%20the%20lowest%20costs%2C%20making%20it%20attractive%20for%20budget%2Dsensitive%20implementations.)). We are not affiliated with Voyage AI.
149
153
 
154
+ **Note**: Local mode uses FastEmbed, the same efficient embedding library used by the Qdrant MCP server, ensuring fast and private semantic search without external dependencies.
155
+
150
156
  ### Want More Details?
151
157
 
152
158
  - [Architecture Deep Dive](docs/architecture-details.md) - How it actually works
@@ -596,8 +596,24 @@ async function showPreSetupInstructions() {
596
596
  console.log('šŸ“‹ Before we begin, you\'ll need:');
597
597
  console.log(' 1. Docker Desktop installed and running');
598
598
  console.log(' 2. Python 3.10 or higher');
599
- console.log('\nšŸ”’ By default, we use local embeddings (private but less accurate)');
600
- console.log(' For better accuracy, run with: --voyage-key=<your-key>\n');
599
+
600
+ console.log('\nāš ļø IMPORTANT: Embedding Mode Choice');
601
+ console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
602
+ console.log('You must choose between Local or Cloud embeddings:');
603
+ console.log('\nšŸ”’ Local Mode (Default):');
604
+ console.log(' • Privacy: All processing on your machine');
605
+ console.log(' • No API costs or internet required');
606
+ console.log(' • Good accuracy for most use cases');
607
+ console.log('\nā˜ļø Cloud Mode (Voyage AI):');
608
+ console.log(' • Better search accuracy');
609
+ console.log(' • Requires API key and internet');
610
+ console.log(' • Conversations sent to Voyage for processing');
611
+ console.log('\nāš ļø This choice is SEMI-PERMANENT. Switching later requires:');
612
+ console.log(' • Re-importing all conversations (30+ minutes)');
613
+ console.log(' • Separate storage for each mode');
614
+ console.log(' • Cannot search across modes\n');
615
+ console.log('For Cloud mode, run with: --voyage-key=<your-key>');
616
+ console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
601
617
 
602
618
  if (isInteractive) {
603
619
  await question('Press Enter to continue...');
@@ -1212,10 +1228,20 @@ async function main() {
1212
1228
  // In non-interactive mode, just use defaults (local mode unless key provided)
1213
1229
  if (!isInteractive) {
1214
1230
  console.log(voyageKey ? '🌐 Using Voyage AI embeddings' : 'šŸ”’ Using local embeddings for privacy');
1231
+ } else if (!voyageKey) {
1232
+ // In interactive mode without a key, confirm local mode choice
1233
+ await showPreSetupInstructions();
1234
+ const confirmLocal = await question('Continue with Local embeddings (privacy mode)? (y/n): ');
1235
+ if (confirmLocal.toLowerCase() !== 'y') {
1236
+ console.log('\nTo use Cloud mode, restart with: claude-self-reflect setup --voyage-key=<your-key>');
1237
+ console.log('Get your free API key at: https://www.voyageai.com/');
1238
+ if (rl) rl.close();
1239
+ process.exit(0);
1240
+ }
1241
+ } else {
1242
+ await showPreSetupInstructions();
1215
1243
  }
1216
1244
 
1217
- await showPreSetupInstructions();
1218
-
1219
1245
  // Check prerequisites
1220
1246
  const pythonOk = await checkPython();
1221
1247
  if (!pythonOk) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-self-reflect",
3
- "version": "2.3.3",
3
+ "version": "2.3.4",
4
4
  "description": "Give Claude perfect memory of all your conversations - Installation wizard for Python MCP server",
5
5
  "keywords": [
6
6
  "claude",