claude-self-reflect 3.2.3 → 3.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/.claude/agents/claude-self-reflect-test.md +595 -528
- package/.claude/agents/documentation-writer.md +1 -1
- package/.claude/agents/qdrant-specialist.md +2 -2
- package/.claude/agents/reflection-specialist.md +61 -5
- package/.claude/agents/search-optimizer.md +9 -7
- package/README.md +16 -9
- package/mcp-server/pyproject.toml +1 -1
- package/mcp-server/run-mcp.sh +49 -5
- package/mcp-server/src/app_context.py +64 -0
- package/mcp-server/src/config.py +57 -0
- package/mcp-server/src/connection_pool.py +286 -0
- package/mcp-server/src/decay_manager.py +106 -0
- package/mcp-server/src/embedding_manager.py +64 -40
- package/mcp-server/src/embeddings_old.py +141 -0
- package/mcp-server/src/models.py +64 -0
- package/mcp-server/src/parallel_search.py +371 -0
- package/mcp-server/src/project_resolver.py +33 -46
- package/mcp-server/src/reflection_tools.py +206 -0
- package/mcp-server/src/rich_formatting.py +196 -0
- package/mcp-server/src/search_tools.py +826 -0
- package/mcp-server/src/server.py +140 -1715
- package/mcp-server/src/temporal_design.py +132 -0
- package/mcp-server/src/temporal_tools.py +597 -0
- package/mcp-server/src/temporal_utils.py +384 -0
- package/mcp-server/src/utils.py +150 -67
- package/package.json +11 -1
- package/scripts/add-timestamp-indexes.py +134 -0
- package/scripts/check-collections.py +29 -0
- package/scripts/debug-august-parsing.py +76 -0
- package/scripts/debug-import-single.py +91 -0
- package/scripts/debug-project-resolver.py +82 -0
- package/scripts/debug-temporal-tools.py +135 -0
- package/scripts/delta-metadata-update.py +547 -0
- package/scripts/import-conversations-unified.py +65 -6
- package/scripts/importer/utils/project_normalizer.py +22 -9
- package/scripts/precompact-hook.sh +33 -0
- package/scripts/streaming-watcher.py +1443 -0
- package/scripts/utils.py +39 -0
- package/shared/__init__.py +5 -0
- package/shared/normalization.py +54 -0
|
@@ -48,7 +48,7 @@ You are a technical documentation specialist for the Claude Self Reflect project
|
|
|
48
48
|
* @param query - Natural language search query
|
|
49
49
|
* @param options - Search configuration options
|
|
50
50
|
* @param options.limit - Maximum results to return (default: 10)
|
|
51
|
-
* @param options.threshold - Minimum similarity score 0-1 (
|
|
51
|
+
* @param options.threshold - Minimum similarity score 0-1 (removed in v3.2.4 - uses natural scoring)
|
|
52
52
|
* @param options.project - Filter by specific project name
|
|
53
53
|
* @returns Promise resolving to array of search results
|
|
54
54
|
*
|
|
@@ -12,7 +12,7 @@ You are a Qdrant vector database specialist for the claude-self-reflect project.
|
|
|
12
12
|
- Collections use per-project isolation: `conv_<md5_hash>_local` or `conv_<md5_hash>_voyage` naming
|
|
13
13
|
- Project paths: ~/.claude/projects/-Users-{username}-projects-{project-name}/*.jsonl
|
|
14
14
|
- Project name is extracted from path and MD5 hashed for collection naming
|
|
15
|
-
- Cross-collection search
|
|
15
|
+
- Cross-collection search uses Qdrant's natural scoring (no artificial thresholds since v3.2.4)
|
|
16
16
|
- Streaming importer detects file growth and processes new lines incrementally
|
|
17
17
|
- MCP server expects collections to match project name MD5 hash
|
|
18
18
|
|
|
@@ -195,7 +195,7 @@ docker stats qdrant
|
|
|
195
195
|
|
|
196
196
|
## Project-Specific Rules
|
|
197
197
|
- Always use Voyage AI embeddings for consistency
|
|
198
|
-
-
|
|
198
|
+
- Use Qdrant's natural scoring (no artificial thresholds since v3.2.4)
|
|
199
199
|
- Preserve per-project collection isolation
|
|
200
200
|
- Do not grep JSONL files unless explicitly asked
|
|
201
201
|
- Always verify the MCP integration works end-to-end
|
|
@@ -1,7 +1,7 @@
|
|
|
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-reflect__reflect_on_past, mcp__claude-self-reflect__store_reflection
|
|
4
|
+
tools: mcp__claude-self-reflect__reflect_on_past, mcp__claude-self-reflect__store_reflection, mcp__claude-self-reflect__get_recent_work, mcp__claude-self-reflect__search_by_recency, mcp__claude-self-reflect__get_timeline, mcp__claude-self-reflect__quick_search, mcp__claude-self-reflect__search_summary, mcp__claude-self-reflect__get_more_results, mcp__claude-self-reflect__search_by_file, mcp__claude-self-reflect__search_by_concept, mcp__claude-self-reflect__get_full_conversation, mcp__claude-self-reflect__get_next_results
|
|
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.
|
|
@@ -117,9 +117,65 @@ Save important insights and decisions for future retrieval.
|
|
|
117
117
|
}
|
|
118
118
|
```
|
|
119
119
|
|
|
120
|
-
###
|
|
120
|
+
### Temporal Query Tools (v3.x)
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
These tools answer time-based questions about your work and conversations.
|
|
123
|
+
|
|
124
|
+
#### get_recent_work
|
|
125
|
+
Returns recent conversations to answer "What did we work on last?" queries.
|
|
126
|
+
|
|
127
|
+
```javascript
|
|
128
|
+
// Get recent work (default: current project)
|
|
129
|
+
{
|
|
130
|
+
limit: 10,
|
|
131
|
+
group_by: "conversation", // Or "day" or "session"
|
|
132
|
+
include_reflections: true
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Get recent work across all projects
|
|
136
|
+
{
|
|
137
|
+
project: "all",
|
|
138
|
+
limit: 20,
|
|
139
|
+
group_by: "day"
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
#### search_by_recency
|
|
144
|
+
Time-constrained semantic search for queries like "docker issues last week".
|
|
145
|
+
|
|
146
|
+
```javascript
|
|
147
|
+
// Search with natural language time
|
|
148
|
+
{
|
|
149
|
+
query: "authentication bugs",
|
|
150
|
+
time_range: "last week",
|
|
151
|
+
limit: 10
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Search with specific dates
|
|
155
|
+
{
|
|
156
|
+
query: "performance optimization",
|
|
157
|
+
since: "2025-01-01",
|
|
158
|
+
until: "2025-01-10",
|
|
159
|
+
project: "all"
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
#### get_timeline
|
|
164
|
+
Show activity timeline for a project or across all projects.
|
|
165
|
+
|
|
166
|
+
```javascript
|
|
167
|
+
// Get activity timeline
|
|
168
|
+
{
|
|
169
|
+
time_range: "last week",
|
|
170
|
+
granularity: "day", // Or "hour", "week", "month"
|
|
171
|
+
include_stats: true,
|
|
172
|
+
project: "all"
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Specialized Search Tools
|
|
177
|
+
|
|
178
|
+
**Note**: These specialized tools complement the temporal tools for non-time-based queries.
|
|
123
179
|
|
|
124
180
|
#### quick_search
|
|
125
181
|
Fast search that returns only the count and top result. Perfect for quick checks and overview.
|
|
@@ -128,7 +184,7 @@ Fast search that returns only the count and top result. Perfect for quick checks
|
|
|
128
184
|
// Quick overview of matches
|
|
129
185
|
{
|
|
130
186
|
query: "authentication patterns",
|
|
131
|
-
min_score: 0.5, // Optional
|
|
187
|
+
min_score: 0.5, // Optional (v3.2.4+ ignores this - uses natural scoring)
|
|
132
188
|
project: "all" // Optional, defaults to current project
|
|
133
189
|
}
|
|
134
190
|
```
|
|
@@ -165,7 +221,7 @@ Pagination support for getting additional results after an initial search.
|
|
|
165
221
|
query: "original search query", // Must match original query
|
|
166
222
|
offset: 3, // Skip first 3 results
|
|
167
223
|
limit: 3, // Get next 3 results
|
|
168
|
-
min_score: 0.7, // Optional
|
|
224
|
+
min_score: 0.7, // Optional (v3.2.4+ ignores this)
|
|
169
225
|
project: "all" // Optional
|
|
170
226
|
}
|
|
171
227
|
```
|
|
@@ -9,7 +9,7 @@ You are a search optimization specialist for the claude-self-reflect project. Yo
|
|
|
9
9
|
## Project Context
|
|
10
10
|
- Current baseline: 66.1% search accuracy with Voyage AI
|
|
11
11
|
- Gemini comparison showed 70-77% accuracy but 50% slower
|
|
12
|
-
-
|
|
12
|
+
- Search scoring: Uses Qdrant's natural scoring (no artificial thresholds as of v3.2.4)
|
|
13
13
|
- Cross-collection search adds ~100ms overhead
|
|
14
14
|
- 24+ projects with 10,165+ conversation chunks
|
|
15
15
|
|
|
@@ -71,9 +71,11 @@ python scripts/analyze-search-quality.py
|
|
|
71
71
|
### Threshold Tuning
|
|
72
72
|
```bash
|
|
73
73
|
# Test different thresholds
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
# Note: As of v3.2.4, artificial thresholds removed
|
|
75
|
+
# Focus on embedding model comparison instead
|
|
76
|
+
for model in voyage openai gemini; do
|
|
77
|
+
echo "Testing model: $model"
|
|
78
|
+
EMBEDDING_MODEL=$model npm test
|
|
77
79
|
done
|
|
78
80
|
|
|
79
81
|
# Find optimal threshold
|
|
@@ -237,7 +239,7 @@ def calculate_mrr(queries, results):
|
|
|
237
239
|
interface ABTestConfig {
|
|
238
240
|
control: {
|
|
239
241
|
model: 'voyage',
|
|
240
|
-
|
|
242
|
+
scoring: 'natural',
|
|
241
243
|
limit: 10
|
|
242
244
|
},
|
|
243
245
|
variant: {
|
|
@@ -285,7 +287,7 @@ async function abTestSearch(query: string, userId: string) {
|
|
|
285
287
|
### Recommended Settings
|
|
286
288
|
```env
|
|
287
289
|
# Search Configuration
|
|
288
|
-
SIMILARITY_THRESHOLD
|
|
290
|
+
# SIMILARITY_THRESHOLD removed in v3.2.4 - uses natural scoring
|
|
289
291
|
SEARCH_LIMIT=10
|
|
290
292
|
CROSS_COLLECTION_LIMIT=5
|
|
291
293
|
|
|
@@ -300,7 +302,7 @@ SAMPLE_RATE=0.1
|
|
|
300
302
|
```
|
|
301
303
|
|
|
302
304
|
## Project-Specific Rules
|
|
303
|
-
-
|
|
305
|
+
- Use Qdrant's natural scoring (no artificial thresholds since v3.2.4)
|
|
304
306
|
- Always compare against Voyage AI baseline (66.1%)
|
|
305
307
|
- Consider search latency alongside accuracy
|
|
306
308
|
- Test with real conversation data
|
package/README.md
CHANGED
|
@@ -116,15 +116,18 @@ Works with [Claude Code Statusline](https://github.com/sirmalloc/ccstatusline) -
|
|
|
116
116
|
<summary><b>MCP Tools Available to Claude</b></summary>
|
|
117
117
|
|
|
118
118
|
**Search & Memory Tools:**
|
|
119
|
-
- `reflect_on_past` - Search past conversations using semantic similarity with time decay
|
|
119
|
+
- `reflect_on_past` - Search past conversations using semantic similarity with time decay (supports quick/summary modes)
|
|
120
120
|
- `store_reflection` - Store important insights or learnings for future reference
|
|
121
|
-
- `
|
|
122
|
-
- `search_summary` - Get aggregated insights without individual details
|
|
123
|
-
- `get_more_results` - Paginate through additional search results
|
|
121
|
+
- `get_next_results` - Paginate through additional search results
|
|
124
122
|
- `search_by_file` - Find conversations that analyzed specific files
|
|
125
123
|
- `search_by_concept` - Search for conversations about development concepts
|
|
126
124
|
- `get_full_conversation` - Retrieve complete JSONL conversation files (v2.8.8)
|
|
127
125
|
|
|
126
|
+
**NEW: Temporal Query Tools (v3.3.0):**
|
|
127
|
+
- `get_recent_work` - Answer "What did we work on last?" with session grouping
|
|
128
|
+
- `search_by_recency` - Time-constrained search like "docker issues last week"
|
|
129
|
+
- `get_timeline` - Activity timeline with statistics and patterns
|
|
130
|
+
|
|
128
131
|
**Status & Monitoring Tools:**
|
|
129
132
|
- `get_status` - Real-time import progress and system status
|
|
130
133
|
- `get_health` - Comprehensive system health check
|
|
@@ -288,11 +291,15 @@ npm uninstall -g claude-self-reflect
|
|
|
288
291
|
## What's New
|
|
289
292
|
|
|
290
293
|
<details>
|
|
291
|
-
<summary>
|
|
292
|
-
|
|
293
|
-
-
|
|
294
|
-
-
|
|
295
|
-
-
|
|
294
|
+
<summary>v3.3.0 - Latest Release</summary>
|
|
295
|
+
|
|
296
|
+
- **🚀 Major Architecture Overhaul**: Server modularized from 2,321 to 728 lines (68% reduction) for better maintainability
|
|
297
|
+
- **🔧 Critical Bug Fixes**: Fixed 100% CPU usage, store_reflection dimension mismatches, and SearchResult type errors
|
|
298
|
+
- **🕒 New Temporal Tools Suite**: `get_recent_work`, `search_by_recency`, `get_timeline` for time-based search and analysis
|
|
299
|
+
- **🎯 Enhanced UX**: Restored rich formatting with emojis for better readability and information hierarchy
|
|
300
|
+
- **⚡ All 15+ MCP Tools Operational**: Complete functionality with both local and cloud embedding modes
|
|
301
|
+
- **🏗️ Production Infrastructure**: Real-time indexing with smart intervals (2s hot files, 60s normal)
|
|
302
|
+
- **🔍 Enhanced Metadata**: Tool usage analysis, file tracking, and concept extraction for better search
|
|
296
303
|
|
|
297
304
|
</details>
|
|
298
305
|
|
package/mcp-server/run-mcp.sh
CHANGED
|
@@ -11,6 +11,34 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
11
11
|
# Navigate to the mcp-server directory
|
|
12
12
|
cd "$SCRIPT_DIR"
|
|
13
13
|
|
|
14
|
+
# CRITICAL: Load .env file from project root if it exists
|
|
15
|
+
# This ensures the MCP server uses the same settings as other scripts
|
|
16
|
+
if [ -f "../.env" ]; then
|
|
17
|
+
echo "[DEBUG] Loading .env file from project root" >&2
|
|
18
|
+
set -a # Export all variables
|
|
19
|
+
source ../.env
|
|
20
|
+
set +a # Stop exporting
|
|
21
|
+
else
|
|
22
|
+
echo "[DEBUG] No .env file found, using defaults" >&2
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
# Set smart defaults if not already set
|
|
26
|
+
# These match what the CLI setup wizard uses
|
|
27
|
+
if [ -z "$QDRANT_URL" ]; then
|
|
28
|
+
export QDRANT_URL="http://localhost:6333"
|
|
29
|
+
echo "[DEBUG] Using default QDRANT_URL: $QDRANT_URL" >&2
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
if [ -z "$PREFER_LOCAL_EMBEDDINGS" ]; then
|
|
33
|
+
export PREFER_LOCAL_EMBEDDINGS="true"
|
|
34
|
+
echo "[DEBUG] Using default PREFER_LOCAL_EMBEDDINGS: true (privacy-first)" >&2
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
if [ -z "$ENABLE_MEMORY_DECAY" ]; then
|
|
38
|
+
export ENABLE_MEMORY_DECAY="false"
|
|
39
|
+
echo "[DEBUG] Using default ENABLE_MEMORY_DECAY: false" >&2
|
|
40
|
+
fi
|
|
41
|
+
|
|
14
42
|
# Check if virtual environment exists
|
|
15
43
|
if [ ! -d "venv" ]; then
|
|
16
44
|
echo "Creating virtual environment..."
|
|
@@ -63,11 +91,27 @@ if [ -z "$FASTEMBED_SKIP_HUGGINGFACE" ]; then
|
|
|
63
91
|
fi
|
|
64
92
|
|
|
65
93
|
# Debug: Show what environment variables are being passed
|
|
66
|
-
echo "[DEBUG] Environment variables for MCP server:"
|
|
67
|
-
echo "[DEBUG] VOYAGE_KEY: ${VOYAGE_KEY:+set}"
|
|
68
|
-
echo "[DEBUG] PREFER_LOCAL_EMBEDDINGS: ${PREFER_LOCAL_EMBEDDINGS:-not set}"
|
|
69
|
-
echo "[DEBUG] QDRANT_URL: ${QDRANT_URL:-not set}"
|
|
70
|
-
echo "[DEBUG] ENABLE_MEMORY_DECAY: ${ENABLE_MEMORY_DECAY:-not set}"
|
|
94
|
+
echo "[DEBUG] Environment variables for MCP server:" >&2
|
|
95
|
+
echo "[DEBUG] VOYAGE_KEY: ${VOYAGE_KEY:+set}" >&2
|
|
96
|
+
echo "[DEBUG] PREFER_LOCAL_EMBEDDINGS: ${PREFER_LOCAL_EMBEDDINGS:-not set}" >&2
|
|
97
|
+
echo "[DEBUG] QDRANT_URL: ${QDRANT_URL:-not set}" >&2
|
|
98
|
+
echo "[DEBUG] ENABLE_MEMORY_DECAY: ${ENABLE_MEMORY_DECAY:-not set}" >&2
|
|
99
|
+
|
|
100
|
+
# Quick connectivity check for Qdrant
|
|
101
|
+
echo "[DEBUG] Checking Qdrant connectivity at $QDRANT_URL..." >&2
|
|
102
|
+
if command -v curl &> /dev/null; then
|
|
103
|
+
# Check root endpoint instead of /health which doesn't exist in Qdrant
|
|
104
|
+
if curl -s -f -m 2 "$QDRANT_URL/" > /dev/null 2>&1; then
|
|
105
|
+
echo "[DEBUG] ✅ Qdrant is reachable at $QDRANT_URL" >&2
|
|
106
|
+
else
|
|
107
|
+
echo "[WARNING] ⚠️ Cannot reach Qdrant at $QDRANT_URL" >&2
|
|
108
|
+
echo "[WARNING] Common fixes:" >&2
|
|
109
|
+
echo "[WARNING] 1. Start Qdrant: docker compose up -d qdrant" >&2
|
|
110
|
+
echo "[WARNING] 2. Check if port is different (e.g., 59999)" >&2
|
|
111
|
+
echo "[WARNING] 3. Update .env file with correct QDRANT_URL" >&2
|
|
112
|
+
echo "[WARNING] Continuing anyway - some features may not work..." >&2
|
|
113
|
+
fi
|
|
114
|
+
fi
|
|
71
115
|
|
|
72
116
|
# Run the MCP server
|
|
73
117
|
exec python -m src
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""Application context for sharing state across modules."""
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Optional, Any
|
|
5
|
+
from qdrant_client import AsyncQdrantClient
|
|
6
|
+
try:
|
|
7
|
+
from .embedding_manager import EmbeddingManager
|
|
8
|
+
from .decay_manager import DecayManager
|
|
9
|
+
from .utils import ProjectResolver
|
|
10
|
+
except ImportError:
|
|
11
|
+
# Fallback for testing
|
|
12
|
+
EmbeddingManager = None
|
|
13
|
+
DecayManager = None
|
|
14
|
+
ProjectResolver = None
|
|
15
|
+
|
|
16
|
+
@dataclass
|
|
17
|
+
class AppContext:
|
|
18
|
+
"""Shared application context for all MCP tools."""
|
|
19
|
+
|
|
20
|
+
qdrant_client: AsyncQdrantClient
|
|
21
|
+
embedding_manager: EmbeddingManager
|
|
22
|
+
decay_manager: DecayManager
|
|
23
|
+
project_resolver: ProjectResolver
|
|
24
|
+
|
|
25
|
+
# Optional context for debugging
|
|
26
|
+
debug_context: Optional[Any] = None
|
|
27
|
+
|
|
28
|
+
def __post_init__(self):
|
|
29
|
+
"""Initialize any additional state after dataclass creation."""
|
|
30
|
+
# Ensure all managers are properly initialized
|
|
31
|
+
if not self.embedding_manager:
|
|
32
|
+
self.embedding_manager = EmbeddingManager()
|
|
33
|
+
|
|
34
|
+
if not self.decay_manager:
|
|
35
|
+
self.decay_manager = DecayManager()
|
|
36
|
+
|
|
37
|
+
if not self.project_resolver:
|
|
38
|
+
self.project_resolver = ProjectResolver()
|
|
39
|
+
|
|
40
|
+
async def get_all_collections(self) -> list:
|
|
41
|
+
"""Get all collections from Qdrant."""
|
|
42
|
+
try:
|
|
43
|
+
collections = await self.qdrant_client.get_collections()
|
|
44
|
+
return [c.name for c in collections.collections]
|
|
45
|
+
except Exception as e:
|
|
46
|
+
if self.debug_context:
|
|
47
|
+
await self.debug_context.debug(f"Failed to get collections: {e}")
|
|
48
|
+
return []
|
|
49
|
+
|
|
50
|
+
async def generate_embedding(self, text: str, embedding_type: Optional[str] = None):
|
|
51
|
+
"""Generate embedding using the embedding manager."""
|
|
52
|
+
# The embedding_manager.embed method is synchronous, not async
|
|
53
|
+
embeddings = self.embedding_manager.embed(text, input_type="document")
|
|
54
|
+
if embeddings and len(embeddings) > 0:
|
|
55
|
+
return embeddings[0]
|
|
56
|
+
return None
|
|
57
|
+
|
|
58
|
+
def get_current_project(self) -> Optional[str]:
|
|
59
|
+
"""Get current project from resolver."""
|
|
60
|
+
return self.project_resolver.get_current_project()
|
|
61
|
+
|
|
62
|
+
def normalize_project_name(self, project_name: str) -> str:
|
|
63
|
+
"""Normalize project name using resolver."""
|
|
64
|
+
return self.project_resolver.normalize_project_name(project_name)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""Configuration and environment constants for Claude Self-Reflect MCP server."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from dotenv import load_dotenv
|
|
6
|
+
|
|
7
|
+
# Load environment variables
|
|
8
|
+
load_dotenv()
|
|
9
|
+
|
|
10
|
+
# API Keys
|
|
11
|
+
VOYAGE_API_KEY = os.getenv('VOYAGE_API_KEY', '')
|
|
12
|
+
QDRANT_URL = os.getenv('QDRANT_URL', 'http://localhost:6333')
|
|
13
|
+
|
|
14
|
+
# Embedding Configuration
|
|
15
|
+
PREFER_LOCAL_EMBEDDINGS = os.getenv('PREFER_LOCAL_EMBEDDINGS', 'true').lower() == 'true'
|
|
16
|
+
VOYAGE_MODEL = "voyage-3-lite"
|
|
17
|
+
LOCAL_MODEL = "sentence-transformers/all-MiniLM-L6-v2"
|
|
18
|
+
|
|
19
|
+
# Decay Configuration
|
|
20
|
+
USE_DECAY = os.getenv('USE_DECAY', 'false').lower() == 'true'
|
|
21
|
+
DECAY_SCALE_DAYS = int(os.getenv('DECAY_SCALE_DAYS', '90'))
|
|
22
|
+
DECAY_WEIGHT = float(os.getenv('DECAY_WEIGHT', '0.3'))
|
|
23
|
+
USE_NATIVE_DECAY = os.getenv('USE_NATIVE_DECAY', 'false').lower() == 'true'
|
|
24
|
+
|
|
25
|
+
# Search Configuration
|
|
26
|
+
DEFAULT_SEARCH_LIMIT = 5
|
|
27
|
+
MAX_SEARCH_LIMIT = 100
|
|
28
|
+
DEFAULT_MIN_SCORE = 0.3
|
|
29
|
+
|
|
30
|
+
# Memory Management
|
|
31
|
+
MAX_RESULTS_PER_COLLECTION = int(os.getenv('MAX_RESULTS_PER_COLLECTION', '10'))
|
|
32
|
+
MAX_TOTAL_RESULTS = int(os.getenv('MAX_TOTAL_RESULTS', '1000'))
|
|
33
|
+
MAX_MEMORY_MB = int(os.getenv('MAX_MEMORY_MB', '500'))
|
|
34
|
+
|
|
35
|
+
# Connection Pool Configuration
|
|
36
|
+
POOL_SIZE = int(os.getenv('QDRANT_POOL_SIZE', '10'))
|
|
37
|
+
POOL_MAX_OVERFLOW = int(os.getenv('QDRANT_POOL_OVERFLOW', '5'))
|
|
38
|
+
POOL_TIMEOUT = float(os.getenv('QDRANT_POOL_TIMEOUT', '30.0'))
|
|
39
|
+
RETRY_ATTEMPTS = int(os.getenv('QDRANT_RETRY_ATTEMPTS', '3'))
|
|
40
|
+
RETRY_DELAY = float(os.getenv('QDRANT_RETRY_DELAY', '1.0'))
|
|
41
|
+
|
|
42
|
+
# Performance Configuration
|
|
43
|
+
MAX_CONCURRENT_SEARCHES = int(os.getenv('MAX_CONCURRENT_SEARCHES', '10'))
|
|
44
|
+
ENABLE_PARALLEL_SEARCH = os.getenv('ENABLE_PARALLEL_SEARCH', 'true').lower() == 'true'
|
|
45
|
+
|
|
46
|
+
# Paths
|
|
47
|
+
CLAUDE_PROJECTS_PATH = Path.home() / '.claude' / 'projects'
|
|
48
|
+
CONFIG_PATH = Path.home() / '.claude-self-reflect' / 'config'
|
|
49
|
+
|
|
50
|
+
# Collection Naming
|
|
51
|
+
VOYAGE_SUFFIX = '_voyage'
|
|
52
|
+
LOCAL_SUFFIX = '_local'
|
|
53
|
+
|
|
54
|
+
# Logging
|
|
55
|
+
import logging
|
|
56
|
+
logging.basicConfig(level=logging.INFO)
|
|
57
|
+
logger = logging.getLogger(__name__)
|