claude-self-reflect 2.0.0 → 2.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.
package/README.md CHANGED
@@ -1,363 +1,180 @@
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
 
16
+ ### Quick Start (Recommended)
29
17
  ```bash
30
- # One command setup - handles everything interactively
31
- npm install -g claude-self-reflect && claude-self-reflect setup
32
- ```
33
-
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)
44
-
45
- ## Architecture Overview
46
-
47
- ![Architecture Diagram](docs/diagrams/architecture.png)
48
-
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
54
-
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
59
-
60
- ## Why Qdrant Over Neo4j?
61
-
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
- ```
83
-
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
96
-
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?"
115
- ```
116
-
117
- Or explicitly request it:
118
- ```
119
- "Use the reflection agent to search for our API discussions"
120
- ```
18
+ # Step 1: Get your free Voyage AI key
19
+ # Sign up at https://www.voyageai.com/ - it takes 30 seconds
121
20
 
122
- ### Direct Tool Usage (Advanced)
123
- You can also ask Claude to search directly:
124
-
125
- ```
126
- User: Can you check our past conversations about authentication?
127
- Claude: I'll search through our conversation history about authentication...
21
+ # Step 2: Install and run automatic setup
22
+ npm install -g claude-self-reflect
23
+ claude-self-reflect setup --voyage-key=YOUR_ACTUAL_KEY_HERE
128
24
 
129
- User: Remember that we decided to use JWT tokens for the API
130
- Claude: I'll store this decision for future reference...
25
+ # That's it! The setup will:
26
+ # Configure everything automatically
27
+ # ✅ Install the MCP in Claude Code
28
+ # ✅ Start monitoring for new conversations
29
+ # ✅ Verify the reflection tools work
131
30
  ```
132
31
 
133
- ## 🧪 Testing & Dry-Run Mode
134
-
135
- ### Validate Your Setup
136
-
137
- Before importing, validate that everything is configured correctly:
138
-
32
+ ### Alternative: Local Mode (No API Key)
139
33
  ```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
34
+ npm install -g claude-self-reflect
35
+ claude-self-reflect setup --local
148
36
  ```
37
+ *Note: Local mode uses basic embeddings. Semantic search won't be as good.*
149
38
 
150
- ### Dry-Run Mode
39
+ 5 minutes. Everything automatic. Just works.
151
40
 
152
- Test the import process without making any changes:
41
+ ## The Magic
153
42
 
154
- ```bash
155
- # See what would be imported (no API calls, no database changes)
156
- python scripts/import-openai-enhanced.py --dry-run
43
+ ![Self Reflection vs The Grind](docs/images/red-reflection.webp)
157
44
 
158
- # Dry-run with preview of sample chunks
159
- python scripts/import-openai-enhanced.py --dry-run --preview
45
+ ## Before & After
160
46
 
161
- # Validate setup only (checks connections, API keys, etc.)
162
- python scripts/import-openai-enhanced.py --validate-only
163
- ```
47
+ ![Before and After Claude Self-Reflect](docs/diagrams/before-after-combined.webp)
164
48
 
165
- ### Example Dry-Run Output
49
+ ## Real Examples That Made Us Build This
166
50
 
167
51
  ```
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.
52
+ You: "What was that PostgreSQL optimization we figured out?"
53
+ Claude: "Found it - conversation from Dec 15th. You discovered that adding
54
+ a GIN index on the metadata JSONB column reduced query time from
55
+ 2.3s to 45ms."
209
56
 
210
- ### Continuous Testing
57
+ You: "Remember that React hooks bug?"
58
+ Claude: "Yes, from last week. The useEffect was missing a dependency on
59
+ userId, causing stale closures in the event handler."
211
60
 
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
61
+ You: "Have we discussed WebSocket authentication before?"
62
+ Claude: "3 conversations found:
63
+ - Oct 12: Implemented JWT handshake for Socket.io
64
+ - Nov 3: Solved reconnection auth with refresh tokens
65
+ - Nov 20: Added rate limiting per authenticated connection"
218
66
  ```
219
67
 
220
- ## 🚀 Advanced Features
68
+ ## The Secret Sauce: Sub-Agents
221
69
 
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.
70
+ Here's what makes this magical: **The Reflection Specialist sub-agent**.
224
71
 
225
- #### What is Memory Decay?
72
+ When you ask about past conversations, Claude doesn't search in your main chat. Instead, it spawns a specialized sub-agent that:
73
+ - Searches your conversation history in its own context
74
+ - Brings back only the relevant results
75
+ - Keeps your main conversation clean and focused
226
76
 
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.
77
+ **Your main context stays pristine**. No clutter. No token waste.
228
78
 
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
79
+ ![Reflection Agent in Action](docs/images/Reflection-specialist.png)
232
80
 
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
81
+ ## How It Works (10 Second Version)
238
82
 
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!**
83
+ Your conversations Vector embeddings → Semantic search → Claude remembers
244
84
 
245
- #### How It Works - The Technical Deep Dive
85
+ Technical details exist. You don't need them to start.
246
86
 
247
- The decay formula elegantly combines semantic similarity with time-based relevance:
87
+ ## Using It
248
88
 
249
- ```
250
- final_score = semantic_score × (1 - decay_weight) + decay_factor × decay_weight
251
- ```
89
+ Once installed, just talk naturally:
252
90
 
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)
91
+ - "What did we discuss about database optimization?"
92
+ - "Find our debugging session from last week"
93
+ - "Remember this solution for next time"
258
94
 
259
- #### Real-World Example
95
+ The reflection specialist automatically activates. No special commands needed.
260
96
 
261
- Let's say you search for "authentication strategy":
97
+ ## Memory Decay
262
98
 
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)
99
+ Recent conversations matter more. Old ones fade. Like your brain, but reliable.
269
100
 
270
- #### Configuration Options
101
+ Works perfectly out of the box. [Configure if you're particular](docs/memory-decay.md).
271
102
 
272
- ```env
273
- # Enable/disable memory decay globally
274
- ENABLE_MEMORY_DECAY=true # Default: false (opt-in feature)
103
+ ## For the Skeptics
275
104
 
276
- # How much should recency affect scores? (0.0 to 1.0)
277
- DECAY_WEIGHT=0.3 # 30% weight on recency, 70% on content
105
+ **"Just use grep"** - Sure, enjoy your 10,000 matches for "database"
106
+ **"Overengineered"** - Two functions: store_reflection, reflect_on_past
107
+ **"Another vector DB"** - Yes, because semantic > string matching
278
108
 
279
- # How fast should memories fade?
280
- DECAY_SCALE_DAYS=90 # 90-day half-life (3 months)
281
- ```
109
+ Built by developers tired of re-explaining context every conversation.
282
110
 
283
- #### Per-Search Control
111
+ ## Requirements
284
112
 
285
- You have complete control over decay on each search:
113
+ - Claude Code or Claude Desktop
114
+ - Python 3.10+
115
+ - 5 minutes for setup
286
116
 
287
- ```javascript
288
- // Search with decay (prioritize recent)
289
- await mcp.reflect_on_past({
290
- query: "database optimization",
291
- useDecay: true
292
- });
117
+ ## Advanced Setup
293
118
 
294
- // Search without decay (all time periods equal)
295
- await mcp.reflect_on_past({
296
- query: "foundational architecture decisions",
297
- useDecay: false
298
- });
299
- ```
119
+ Want to customize? See [Configuration Guide](docs/installation-guide.md).
300
120
 
301
- #### Performance Characteristics
121
+ ## The Technical Stuff
302
122
 
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
123
+ If you must know:
307
124
 
308
- #### The Philosophy
125
+ - **Vector DB**: Qdrant (local, your data stays yours)
126
+ - **Embeddings**: Voyage AI (200M free tokens/month)*
127
+ - **MCP Server**: Python + FastMCP
128
+ - **Search**: Semantic similarity with time decay
309
129
 
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.
130
+ *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.
311
131
 
312
- See [Memory Decay Guide](docs/memory-decay.md) for advanced configuration and implementation details.
132
+ ### Want More Details?
313
133
 
314
- ## 🤝 Why Claude-Self-Reflect?
134
+ - [Architecture Deep Dive](docs/architecture-details.md) - How it actually works
135
+ - [Components Guide](docs/components.md) - Each piece explained
136
+ - [Why We Built This](docs/motivation-and-history.md) - The full story
137
+ - [Advanced Usage](docs/advanced-usage.md) - Power user features
315
138
 
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
139
+ ## Problems?
323
140
 
141
+ - [Troubleshooting Guide](docs/troubleshooting.md)
142
+ - [GitHub Issues](https://github.com/ramakay/claude-self-reflect/issues)
143
+ - [Discussions](https://github.com/ramakay/claude-self-reflect/discussions)
324
144
 
325
- ### CLAUDE.md vs Claude-Self-Reflect
145
+ ## Contributing
326
146
 
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 |
147
+ See our [Contributing Guide](CONTRIBUTING.md) for development setup and guidelines.
335
148
 
336
- **Use both together**: CLAUDE.md for project-specific rules, Claude-Self-Reflect for conversation history.
149
+ ### Releasing New Versions (Maintainers)
337
150
 
151
+ Since our GitHub Actions automatically publish to npm, the release process is simple:
338
152
 
153
+ ```bash
154
+ # 1. Ensure you're logged into GitHub CLI
155
+ gh auth login # Only needed first time
339
156
 
340
- ## Troubleshooting
341
-
342
- Having issues? Check our [Troubleshooting Guide](docs/troubleshooting.md) or:
343
-
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)
346
-
347
- ## Roadmap
348
-
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
157
+ # 2. Create and push a new tag
158
+ git tag v2.3.0 # Use appropriate version number
159
+ git push origin v2.3.0
352
160
 
353
- [Full Roadmap & Contributing](CONTRIBUTING.md)
161
+ # 3. Create GitHub release (this triggers npm publish)
162
+ gh release create v2.3.0 \
163
+ --title "Release v2.3.0" \
164
+ --notes-file CHANGELOG.md \
165
+ --draft=false
354
166
 
355
- ## License
167
+ # The GitHub Action will automatically:
168
+ # - Build the package
169
+ # - Run tests
170
+ # - Publish to npm
171
+ # - Update release assets
172
+ ```
356
173
 
357
- MIT License - see [LICENSE](LICENSE) for details.
174
+ Monitor the release at: https://github.com/ramakay/claude-self-reflect/actions
358
175
 
359
176
  ---
360
177
 
361
- <p align="center">
362
- Built with ❤️ for the Claude community by <a href="https://github.com/ramakay">ramakay</a>
363
- </p>
178
+ Stop reading. Start installing. Your future self will thank you.
179
+
180
+ MIT License. Built with ❤️ for the Claude community.
package/installer/cli.js CHANGED
@@ -18,7 +18,9 @@ async function setup() {
18
18
  console.log('🚀 Claude Self-Reflect Setup Wizard\n');
19
19
 
20
20
  const setupPath = join(__dirname, 'setup-wizard.js');
21
- const child = spawn('node', [setupPath], { stdio: 'inherit' });
21
+ // Pass along any command line arguments after 'setup'
22
+ const args = process.argv.slice(3); // Skip node, script, and 'setup'
23
+ const child = spawn('node', [setupPath, ...args], { stdio: 'inherit' });
22
24
 
23
25
  child.on('exit', (code) => {
24
26
  process.exit(code || 0);
@@ -95,13 +97,21 @@ async function doctor() {
95
97
 
96
98
  function help() {
97
99
  console.log('Claude Self-Reflect - Perfect memory for Claude\n');
98
- console.log('Usage: claude-self-reflect <command>\n');
100
+ console.log('Usage: claude-self-reflect <command> [options]\n');
99
101
  console.log('Commands:');
100
102
 
101
103
  for (const [cmd, desc] of Object.entries(commands)) {
102
104
  console.log(` ${cmd.padEnd(10)} ${desc}`);
103
105
  }
104
106
 
107
+ console.log('\nSetup Options:');
108
+ console.log(' --voyage-key=<key> Provide Voyage AI API key (recommended)');
109
+ console.log(' --local Run in local mode without API key');
110
+
111
+ console.log('\nExamples:');
112
+ console.log(' claude-self-reflect setup --voyage-key=pa-1234567890');
113
+ console.log(' claude-self-reflect setup --local');
114
+
105
115
  console.log('\nFor more information: https://github.com/ramakay/claude-self-reflect');
106
116
  }
107
117