claude-self-reflect 2.0.0 → 2.2.1

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 (2) hide show
  1. package/README.md +75 -310
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,363 +1,128 @@
1
- # Claude-Self-Reflect - Conversation Memory for Claude
1
+ # Claude Self-Reflect
2
2
 
3
- Give Claude perfect memory across all conversations. Semantic search over your entire conversation history using vector database and MCP (Model Context Protocol).
3
+ Claude forgets everything. This fixes that.
4
4
 
5
- ## Motivation, Alternatives & Past Attempts
5
+ ## What You Get
6
6
 
7
- **Motivation**: Claude has no memory between conversations. Every chat starts from scratch, requiring you to re-explain context, repeat solutions, and manually search through conversation files.
7
+ Ask Claude about past conversations. Get actual answers.
8
8
 
9
- **Our Solution**: A semantic memory layer that automatically indexes your conversations and provides instant search through Claude's native tools.
9
+ **Before**: "I don't have access to previous conversations"
10
+ **After**: "We discussed JWT auth on Tuesday. You decided on 15-minute tokens."
10
11
 
11
- **Past Attempts**:
12
- - Neo4j graph database - Too complex for simple conversation retrieval
13
- - Keyword search - Missed semantically similar content
14
- - Manual organization - Doesn't scale with hundreds of conversations
12
+ Your conversations become searchable. Your decisions stay remembered. Your context persists.
15
13
 
16
- **Why Qdrant + Vectors**: Industry-standard approach used by LangChain, Dify, and others. Optimized for semantic similarity, not complex relationships.
17
-
18
- ## Glimpse of the Future
19
-
20
- Imagine asking Claude:
21
- - "What did we discuss about database design last month?"
22
- - "Find that debugging solution we discovered together"
23
- - "Have we encountered this error before?"
24
-
25
- And getting instant, accurate answers from your entire conversation history. That's Claude-Self-Reflect.
26
-
27
- ## Quick Start
14
+ ## Install
28
15
 
29
16
  ```bash
30
- # One command setup - handles everything interactively
31
17
  npm install -g claude-self-reflect && claude-self-reflect setup
32
18
  ```
33
19
 
34
- **That's it!** The setup wizard will:
35
- - ✅ Check Python 3.10+ installation
36
- - ✅ Start Qdrant vector database
37
- - ✅ Install the Python MCP server
38
- - ✅ Configure your API keys
39
- - ✅ Set up Claude Code integration
40
-
41
- - **Need details?** See [Installation Guide](docs/installation-guide.md)
42
- - **Embedding providers?** See [Embedding Provider Guide](docs/embedding-providers.md)
43
- - **Manual setup?** See [Advanced Configuration](docs/installation-guide.md#manual-setup-advanced-users)
20
+ 5 minutes. That's it.
44
21
 
45
- ## Architecture Overview
22
+ ## The Magic
46
23
 
47
- ![Architecture Diagram](docs/diagrams/architecture.png)
24
+ ![Self Reflection vs The Grind](docs/images/red-reflection.webp)
48
25
 
49
- The system consists of four main components:
50
- - **Claude Code/Desktop**: The MCP client that requests memory operations
51
- - **MCP Server**: TypeScript service providing search and store tools
52
- - **Import Pipeline**: Python service that processes conversation logs
53
- - **Qdrant Database**: Vector storage with semantic search capabilities
26
+ ## Before & After
54
27
 
55
- See also:
56
- - [Data Flow Diagram](docs/diagrams/data-flow.png) - How data moves through the system
57
- - [Import Process](docs/diagrams/import-process.png) - Detailed import workflow
58
- - [Search Operation](docs/diagrams/search-operation.png) - How semantic search works
28
+ ![Before and After Claude Self-Reflect](docs/diagrams/before-after-combined.webp)
59
29
 
60
- ## Why Qdrant Over Neo4j?
30
+ ## Real Examples That Made Us Build This
61
31
 
62
- 1. **Simplicity**: Two tools (store/find) vs complex entity/relationship management
63
- 2. **Performance**: Optimized for semantic search, no graph traversal overhead
64
- 3. **Proven Pattern**: Industry standard for conversation memory (LangChain, Dify, etc.)
65
- 4. **No Import Issues**: Direct vector storage without entity extraction complexity
66
-
67
- ## Project Structure
68
-
69
- ```
70
- claude-self-reflect/
71
- ├── mcp-server/ # Python MCP server using FastMCP
72
- │ ├── src/ # Server source code
73
- │ ├── pyproject.toml # Python package configuration
74
- │ └── run-mcp.sh # MCP startup script
75
- ├── scripts/ # Import and utility scripts
76
- │ ├── import-*.py # Various import scripts for conversations
77
- │ └── test-*.py # Test scripts for features
78
- ├── .claude/agents/ # Claude sub-agents for specialized tasks
79
- ├── config/ # Configuration files
80
- ├── data/ # Qdrant vector database storage
81
- └── docs/ # Documentation and guides
82
32
  ```
33
+ You: "What was that PostgreSQL optimization we figured out?"
34
+ Claude: "Found it - conversation from Dec 15th. You discovered that adding
35
+ a GIN index on the metadata JSONB column reduced query time from
36
+ 2.3s to 45ms."
83
37
 
84
- ## Components
85
-
86
- ### 1. Qdrant Vector Database
87
- - Stores conversation embeddings with metadata
88
- - Provides fast semantic similarity search
89
- - Built-in vector indexing and retrieval
90
-
91
- ### 2. MCP Server for Conversation Memory
92
- - **Tool 1**: `store_reflection` - Store important insights and decisions
93
- - **Tool 2**: `reflect_on_past` - Search through conversation history
94
- - Simple semantic search without complex entity extraction
95
- - Python-based using FastMCP framework
38
+ You: "Remember that React hooks bug?"
39
+ Claude: "Yes, from last week. The useEffect was missing a dependency on
40
+ userId, causing stale closures in the event handler."
96
41
 
97
- ### 3. Python Importer
98
- - Reads JSONL files from Claude conversation logs
99
- - Creates conversation chunks for context
100
- - Generates embeddings using Voyage AI (voyage-3-large)
101
- - Stores directly in Qdrant with metadata
102
-
103
-
104
- ## Using the Reflection Agent
105
-
106
- ### In Claude Code
107
- The reflection agent activates automatically when you ask about past conversations:
108
-
109
- ![Reflection Agent in Action](docs/images/Reflection-specialist.png)
110
-
111
- ```
112
- "What did we discuss about database design?"
113
- "Find our previous debugging session"
114
- "Have we encountered this error before?"
42
+ You: "Have we discussed WebSocket authentication before?"
43
+ Claude: "3 conversations found:
44
+ - Oct 12: Implemented JWT handshake for Socket.io
45
+ - Nov 3: Solved reconnection auth with refresh tokens
46
+ - Nov 20: Added rate limiting per authenticated connection"
115
47
  ```
116
48
 
117
- Or explicitly request it:
118
- ```
119
- "Use the reflection agent to search for our API discussions"
120
- ```
49
+ ## The Secret Sauce: Sub-Agents
121
50
 
122
- ### Direct Tool Usage (Advanced)
123
- You can also ask Claude to search directly:
51
+ Here's what makes this magical: **The Reflection Specialist sub-agent**.
124
52
 
125
- ```
126
- User: Can you check our past conversations about authentication?
127
- Claude: I'll search through our conversation history about authentication...
128
-
129
- User: Remember that we decided to use JWT tokens for the API
130
- Claude: I'll store this decision for future reference...
131
- ```
132
-
133
- ## 🧪 Testing & Dry-Run Mode
134
-
135
- ### Validate Your Setup
136
-
137
- Before importing, validate that everything is configured correctly:
138
-
139
- ```bash
140
- # Run comprehensive validation
141
- python scripts/validate-setup.py
142
-
143
- # Example output:
144
- # ✅ API Key [PASS] Voyage API key is valid
145
- # ✅ Qdrant [PASS] Connected to http://localhost:6333
146
- # ✅ Claude Logs [PASS] 24 projects, 265 files, 125.3 MB
147
- # ✅ Disk Space [PASS] 45.2 GB free
148
- ```
53
+ When you ask about past conversations, Claude doesn't search in your main chat. Instead, it spawns a specialized sub-agent that:
54
+ - Searches your conversation history in its own context
55
+ - Brings back only the relevant results
56
+ - Keeps your main conversation clean and focused
149
57
 
150
- ### Dry-Run Mode
58
+ **Your main context stays pristine**. No clutter. No token waste.
151
59
 
152
- Test the import process without making any changes:
153
-
154
- ```bash
155
- # See what would be imported (no API calls, no database changes)
156
- python scripts/import-openai-enhanced.py --dry-run
157
-
158
- # Dry-run with preview of sample chunks
159
- python scripts/import-openai-enhanced.py --dry-run --preview
160
-
161
- # Validate setup only (checks connections, API keys, etc.)
162
- python scripts/import-openai-enhanced.py --validate-only
163
- ```
164
-
165
- ### Example Dry-Run Output
166
-
167
- ```
168
- 🔍 Running in DRY-RUN mode...
169
- ============================================================
170
- 🚀 Initializing Claude-Self-Reflect Importer...
171
-
172
- 📊 Import Summary:
173
- • Total files: 265
174
- • New files to import: 265
175
- • Estimated chunks: ~2,650
176
- • Estimated cost: FREE (within 200M token limit)
177
- • Embedding model: voyage-3.5-lite
178
-
179
- 🔍 DRY-RUN MODE - No changes will be made
180
-
181
- ⏳ Starting import...
182
-
183
- [DRY-RUN] Would ensure collection: conv_a1b2c3d4_voyage
184
- [DRY-RUN] Would import 127 chunks to collection: conv_a1b2c3d4_voyage
185
-
186
- 📊 Final Statistics:
187
- • Time elapsed: 2 seconds
188
- • Projects to import: 24
189
- • Messages processed: 10,165
190
- • Chunks created: 2,650
191
- • Embeddings would be generated: 2,650
192
- • API calls would be made: 133
193
- • 💰 Estimated cost: FREE (within 200M token limit)
194
- ```
195
-
196
- ### Cost Estimation
197
-
198
- The dry-run mode provides accurate cost estimates:
199
-
200
- **Free Tiers:**
201
- - Voyage AI: 200M tokens FREE, then $0.02 per 1M tokens
202
- - Google Gemini: Unlimited FREE (data used for training)
203
- - Local: Always FREE
204
-
205
- **Paid Only:**
206
- - OpenAI: $0.02 per 1M tokens (no free tier)
207
-
208
- **Reality Check:** With 500 tokens per conversation chunk, 200M free tokens = ~400,000 conversation chunks. Most users never reach the paid tier.
209
-
210
- ### Continuous Testing
211
-
212
- ```bash
213
- # Test import of a single project
214
- python scripts/import-openai-enhanced.py ~/.claude/projects/my-project --dry-run
215
-
216
- # Monitor import progress in real-time
217
- python scripts/import-openai-enhanced.py --dry-run | tee import-test.log
218
- ```
219
-
220
- ## 🚀 Advanced Features
221
-
222
- ### Memory Decay (v1.3.1)
223
- Remember that brilliant debugging session from last week? Memory Decay ensures it stays at your fingertips. That random chat from 6 months ago? It gracefully fades into the background, just like human memory.
224
-
225
- #### What is Memory Decay?
226
-
227
- Memory Decay transforms your conversation search from a flat, time-agnostic system into an intelligent memory that understands recency matters. When you search for "React hooks debugging", you want last week's breakthrough solution, not that outdated approach from last year.
228
-
229
- Here's the magic: Memory Decay applies an exponential decay function to search scores, blending semantic similarity with temporal relevance. The result? Recent conversations get a massive boost while older ones gradually diminish.
230
-
231
- #### The Numbers That Matter
232
-
233
- Without Memory Decay:
234
- - Search: "qdrant implementation"
235
- - Top result: 6-month-old conversation (Score: 0.361)
236
- - All results: Scores range from 0.35 to 0.36
237
- - No consideration of when discussions happened
238
-
239
- With Memory Decay Enabled:
240
- - Same search: "qdrant implementation"
241
- - Top result: Last week's conversation (Score: 0.605)
242
- - All results: Scores range from 0.59 to 0.61
243
- - **That's a 68% score boost for recent content!**
244
-
245
- #### How It Works - The Technical Deep Dive
246
-
247
- The decay formula elegantly combines semantic similarity with time-based relevance:
248
-
249
- ```
250
- final_score = semantic_score × (1 - decay_weight) + decay_factor × decay_weight
251
- ```
252
-
253
- Where:
254
- - `semantic_score`: How well the content matches your query (0.0 to 1.0)
255
- - `decay_weight`: How much recency matters (default: 0.3 or 30%)
256
- - `decay_factor`: Exponential decay based on age: `e^(-age_days / half_life)`
257
- - `half_life`: Days until relevance drops by 50% (default: 90 days)
258
-
259
- #### Real-World Example
260
-
261
- Let's say you search for "authentication strategy":
262
-
263
- **Identical content at different ages:**
264
- - Today's discussion: Score 1.000 (100% fresh)
265
- - 30 days old: Score 0.915 (still highly relevant)
266
- - 90 days old: Score 0.810 (starting to fade)
267
- - 180 days old: Score 0.741 (significantly diminished)
268
- - 365 days old: Score 0.705 (barely relevant)
269
-
270
- #### Configuration Options
271
-
272
- ```env
273
- # Enable/disable memory decay globally
274
- ENABLE_MEMORY_DECAY=true # Default: false (opt-in feature)
275
-
276
- # How much should recency affect scores? (0.0 to 1.0)
277
- DECAY_WEIGHT=0.3 # 30% weight on recency, 70% on content
278
-
279
- # How fast should memories fade?
280
- DECAY_SCALE_DAYS=90 # 90-day half-life (3 months)
281
- ```
282
-
283
- #### Per-Search Control
60
+ ![Reflection Agent in Action](docs/images/Reflection-specialist.png)
284
61
 
285
- You have complete control over decay on each search:
62
+ ## How It Works (10 Second Version)
286
63
 
287
- ```javascript
288
- // Search with decay (prioritize recent)
289
- await mcp.reflect_on_past({
290
- query: "database optimization",
291
- useDecay: true
292
- });
64
+ Your conversations → Vector embeddings → Semantic search → Claude remembers
293
65
 
294
- // Search without decay (all time periods equal)
295
- await mcp.reflect_on_past({
296
- query: "foundational architecture decisions",
297
- useDecay: false
298
- });
299
- ```
66
+ Technical details exist. You don't need them to start.
300
67
 
301
- #### Performance Characteristics
68
+ ## Using It
302
69
 
303
- We've optimized Memory Decay to be lightning fast:
304
- - **Overhead**: Just 0.009 seconds for 1000 search results
305
- - **Method**: Client-side calculation after vector search
306
- - **Scalability**: Linear with result count, not database size
70
+ Once installed, just talk naturally:
307
71
 
308
- #### The Philosophy
72
+ - "What did we discuss about database optimization?"
73
+ - "Find our debugging session from last week"
74
+ - "Remember this solution for next time"
309
75
 
310
- Memory Decay isn't just a feature - it's a recognition that not all memories are equal. Your conversation history should work like your brain: keeping recent, relevant information readily accessible while letting older details fade naturally. This isn't about losing information - every conversation remains searchable. It's about surfacing what matters most, when it matters most.
76
+ The reflection specialist automatically activates. No special commands needed.
311
77
 
312
- See [Memory Decay Guide](docs/memory-decay.md) for advanced configuration and implementation details.
78
+ ## Memory Decay
313
79
 
314
- ## 🤝 Why Claude-Self-Reflect?
80
+ Recent conversations matter more. Old ones fade. Like your brain, but reliable.
315
81
 
316
- ### Key Advantages
317
- - **Local-First**: Your conversations stay on your machine
318
- - **Zero Configuration**: Works out of the box with sensible defaults
319
- - **Claude-Native**: Built specifically for Claude Code & Desktop
320
- - **Semantic Search**: Understands meaning, not just keywords
321
- - **Continuous Import**: Automatically indexes new conversations
322
- - **Privacy-Focused**: No data leaves your local environment
82
+ Works perfectly out of the box. [Configure if you're particular](docs/memory-decay.md).
323
83
 
84
+ ## For the Skeptics
324
85
 
325
- ### CLAUDE.md vs Claude-Self-Reflect
86
+ **"Just use grep"** - Sure, enjoy your 10,000 matches for "database"
87
+ **"Overengineered"** - Two functions: store_reflection, reflect_on_past
88
+ **"Another vector DB"** - Yes, because semantic > string matching
326
89
 
327
- | Aspect | CLAUDE.md | Claude-Self-Reflect |
328
- |--------|-----------|-------------------|
329
- | **Purpose** | Project-specific instructions | Conversation memory across all projects |
330
- | **Scope** | Single project context | Global conversation history |
331
- | **Storage** | Text file in project | Vector database (Qdrant) |
332
- | **Search** | Exact text matching | Semantic similarity search |
333
- | **Updates** | Manual editing | Automatic indexing |
334
- | **Best For** | Project rules & guidelines | Finding past discussions & decisions |
90
+ Built by developers tired of re-explaining context every conversation.
335
91
 
336
- **Use both together**: CLAUDE.md for project-specific rules, Claude-Self-Reflect for conversation history.
92
+ ## Requirements
337
93
 
94
+ - Claude Code or Claude Desktop
95
+ - Python 3.10+
96
+ - 5 minutes for setup
338
97
 
98
+ ## Advanced Setup
339
99
 
340
- ## Troubleshooting
100
+ Want to customize? See [Configuration Guide](docs/installation-guide.md).
341
101
 
342
- Having issues? Check our [Troubleshooting Guide](docs/troubleshooting.md) or:
102
+ ## The Technical Stuff
343
103
 
344
- - Ask in [Discussions](https://github.com/ramakay/claude-self-reflect/discussions)
345
- - Report bugs in [Issues](https://github.com/ramakay/claude-self-reflect/issues)
104
+ If you must know:
346
105
 
347
- ## Roadmap
106
+ - **Vector DB**: Qdrant (local, your data stays yours)
107
+ - **Embeddings**: Voyage AI (200M free tokens/month)
108
+ - **MCP Server**: Python + FastMCP
109
+ - **Search**: Semantic similarity with time decay
348
110
 
349
- **Q1 2025**: Conversation summarization, time-based filtering, export history
350
- **Q2 2025**: Multi-modal memory, analytics dashboard, team sharing
351
- **Long Term**: Active learning, conversation graphs, enterprise features
111
+ ### Want More Details?
352
112
 
353
- [Full Roadmap & Contributing](CONTRIBUTING.md)
113
+ - [Architecture Deep Dive](docs/architecture-details.md) - How it actually works
114
+ - [Components Guide](docs/components.md) - Each piece explained
115
+ - [Why We Built This](docs/motivation-and-history.md) - The full story
116
+ - [Advanced Usage](docs/advanced-usage.md) - Power user features
354
117
 
355
- ## License
118
+ ## Problems?
356
119
 
357
- MIT License - see [LICENSE](LICENSE) for details.
120
+ - [Troubleshooting Guide](docs/troubleshooting.md)
121
+ - [GitHub Issues](https://github.com/ramakay/claude-self-reflect/issues)
122
+ - [Discussions](https://github.com/ramakay/claude-self-reflect/discussions)
358
123
 
359
124
  ---
360
125
 
361
- <p align="center">
362
- Built with ❤️ for the Claude community by <a href="https://github.com/ramakay">ramakay</a>
363
- </p>
126
+ Stop reading. Start installing. Your future self will thank you.
127
+
128
+ MIT License. Built with ❤️ for the Claude community.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-self-reflect",
3
- "version": "2.0.0",
3
+ "version": "2.2.1",
4
4
  "description": "Give Claude perfect memory of all your conversations - Installation wizard for Python MCP server",
5
5
  "keywords": [
6
6
  "claude",