claude-self-reflect 2.6.0 → 2.7.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.
- package/.env.example +19 -18
- package/Dockerfile.importer +6 -2
- package/Dockerfile.safe-watcher +44 -0
- package/README.md +3 -1
- package/docker-compose.yaml +43 -11
- package/mcp-server/pyproject.toml +1 -1
- package/mcp-server/src/project_resolver.py +527 -0
- package/mcp-server/src/server.py +14 -10
- package/mcp-server/src/utils.py +20 -3
- package/package.json +1 -1
- package/scripts/import-conversations-unified.backup.py +374 -0
- package/scripts/import-conversations-unified.py +297 -723
- package/scripts/import-latest.py +124 -0
package/.env.example
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
# Claude Self-Reflect Environment Variables
|
|
2
|
-
# Copy this file to .env and update with your values
|
|
3
|
-
|
|
4
|
-
# Voyage AI API Key (optional - only needed for cloud mode)
|
|
5
|
-
# Get your key at: https://www.voyageai.com/
|
|
6
|
-
VOYAGE_KEY=your-voyage-api-key-here
|
|
7
|
-
|
|
8
1
|
# Qdrant Configuration
|
|
9
2
|
QDRANT_URL=http://localhost:6333
|
|
3
|
+
QDRANT_PORT=6333
|
|
4
|
+
QDRANT_MEMORY=4g
|
|
10
5
|
|
|
11
6
|
# Embedding Configuration
|
|
12
|
-
# Set to true to use local embeddings (
|
|
13
|
-
# Set to false to use Voyage AI embeddings
|
|
7
|
+
# Set to true to use local FastEmbed embeddings (recommended for privacy)
|
|
8
|
+
# Set to false to use Voyage AI cloud embeddings
|
|
14
9
|
PREFER_LOCAL_EMBEDDINGS=true
|
|
15
10
|
|
|
16
|
-
#
|
|
11
|
+
# Voyage AI Configuration (optional - only needed if PREFER_LOCAL_EMBEDDINGS=false)
|
|
12
|
+
# Get your API key from https://www.voyageai.com/
|
|
13
|
+
VOYAGE_KEY=
|
|
14
|
+
|
|
15
|
+
# Memory Decay Configuration
|
|
17
16
|
ENABLE_MEMORY_DECAY=true
|
|
18
17
|
DECAY_WEIGHT=0.3
|
|
19
18
|
DECAY_SCALE_DAYS=90
|
|
20
19
|
|
|
21
|
-
#
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
WATCH_INTERVAL=60
|
|
20
|
+
# Docker Configuration
|
|
21
|
+
CLAUDE_LOGS_PATH=~/.claude/projects
|
|
22
|
+
CONFIG_PATH=~/.claude-self-reflect/config
|
|
25
23
|
|
|
26
|
-
#
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
# Performance Tuning
|
|
25
|
+
WATCH_INTERVAL=5
|
|
26
|
+
MAX_MEMORY_MB=600
|
|
27
|
+
CHUNK_SIZE=50
|
|
28
|
+
MAX_FILES_PER_CYCLE=10
|
|
29
|
+
HOT_WINDOW_MINUTES=15
|
|
30
|
+
MAX_COLD_FILES_PER_CYCLE=3
|
package/Dockerfile.importer
CHANGED
|
@@ -17,8 +17,12 @@ RUN pip install --no-cache-dir \
|
|
|
17
17
|
voyageai==0.3.4 \
|
|
18
18
|
tenacity==9.1.2
|
|
19
19
|
|
|
20
|
-
#
|
|
21
|
-
# This
|
|
20
|
+
# Copy scripts into the image for npm package compatibility
|
|
21
|
+
# This ensures scripts are available even without volume mounts
|
|
22
|
+
COPY scripts/ /app/scripts/
|
|
23
|
+
|
|
24
|
+
# Note: Volume mounts in docker-compose.yaml will override these files in local development
|
|
25
|
+
# This provides compatibility for both local development and global npm installs
|
|
22
26
|
|
|
23
27
|
# Default command (can be overridden by docker-compose)
|
|
24
28
|
CMD ["python", "--version"]
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
FROM python:3.12-slim
|
|
2
|
+
|
|
3
|
+
# Install system dependencies
|
|
4
|
+
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends \
|
|
5
|
+
gcc \
|
|
6
|
+
g++ \
|
|
7
|
+
procps \
|
|
8
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
9
|
+
|
|
10
|
+
# Upgrade pip and install setuptools
|
|
11
|
+
RUN pip install --upgrade pip setuptools wheel
|
|
12
|
+
|
|
13
|
+
# Install Python dependencies (matching importer)
|
|
14
|
+
RUN pip install --no-cache-dir \
|
|
15
|
+
qdrant-client==1.15.0 \
|
|
16
|
+
fastembed==0.7.1 \
|
|
17
|
+
numpy==1.26.4 \
|
|
18
|
+
psutil==7.0.0 \
|
|
19
|
+
python-dotenv==1.0.0 \
|
|
20
|
+
voyageai==0.3.4 \
|
|
21
|
+
tenacity==9.1.2 \
|
|
22
|
+
humanize==4.12.3 \
|
|
23
|
+
tqdm==4.67.1
|
|
24
|
+
|
|
25
|
+
# Pre-download and cache the FastEmbed model
|
|
26
|
+
ENV FASTEMBED_CACHE_PATH=/root/.cache/fastembed
|
|
27
|
+
RUN mkdir -p /root/.cache/fastembed && \
|
|
28
|
+
python -c "from fastembed import TextEmbedding; TextEmbedding(model_name='sentence-transformers/all-MiniLM-L6-v2')"
|
|
29
|
+
|
|
30
|
+
# Set working directory
|
|
31
|
+
WORKDIR /app
|
|
32
|
+
|
|
33
|
+
# Copy scripts
|
|
34
|
+
COPY scripts/ /scripts/
|
|
35
|
+
|
|
36
|
+
# Create config directory
|
|
37
|
+
RUN mkdir -p /config
|
|
38
|
+
|
|
39
|
+
# Set environment variables for memory management
|
|
40
|
+
ENV PYTHONUNBUFFERED=1
|
|
41
|
+
ENV MALLOC_ARENA_MAX=2
|
|
42
|
+
|
|
43
|
+
# Run the watcher loop
|
|
44
|
+
CMD ["/scripts/watcher-loop.sh"]
|
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Claude Self-Reflect
|
|
2
|
-
|
|
2
|
+
<div align="center">
|
|
3
|
+

|
|
4
|
+
</div>
|
|
3
5
|
<div align="center">
|
|
4
6
|
|
|
5
7
|
[](https://www.npmjs.com/package/claude-self-reflect)
|
package/docker-compose.yaml
CHANGED
|
@@ -8,7 +8,7 @@ services:
|
|
|
8
8
|
command: chown -R 1000:1000 /config
|
|
9
9
|
volumes:
|
|
10
10
|
- ${CONFIG_PATH:-~/.claude-self-reflect/config}:/config
|
|
11
|
-
profiles: ["watch", "mcp", "import", "async"]
|
|
11
|
+
profiles: ["watch", "mcp", "import", "async", "safe-watch"]
|
|
12
12
|
|
|
13
13
|
# Qdrant vector database - the heart of semantic search
|
|
14
14
|
qdrant:
|
|
@@ -45,7 +45,7 @@ services:
|
|
|
45
45
|
- OPENAI_API_KEY=${OPENAI_API_KEY:-}
|
|
46
46
|
- VOYAGE_API_KEY=${VOYAGE_API_KEY:-}
|
|
47
47
|
- VOYAGE_KEY=${VOYAGE_KEY:-}
|
|
48
|
-
- PREFER_LOCAL_EMBEDDINGS=${PREFER_LOCAL_EMBEDDINGS:-
|
|
48
|
+
- PREFER_LOCAL_EMBEDDINGS=${PREFER_LOCAL_EMBEDDINGS:-true}
|
|
49
49
|
- EMBEDDING_MODEL=${EMBEDDING_MODEL:-voyage-3}
|
|
50
50
|
- BATCH_SIZE=${BATCH_SIZE:-50}
|
|
51
51
|
- CHUNK_SIZE=${CHUNK_SIZE:-10}
|
|
@@ -108,10 +108,10 @@ services:
|
|
|
108
108
|
- MAX_CPU_PERCENT_PER_CORE=25 # 25% per core = 400% total on 16 cores
|
|
109
109
|
- MAX_CONCURRENT_EMBEDDINGS=1 # Limit concurrent embeddings
|
|
110
110
|
- MAX_CONCURRENT_QDRANT=2 # Limit concurrent Qdrant operations
|
|
111
|
-
- IMPORT_FREQUENCY=
|
|
112
|
-
- BATCH_SIZE=
|
|
113
|
-
- MEMORY_LIMIT_MB=
|
|
114
|
-
- MAX_QUEUE_SIZE=
|
|
111
|
+
- IMPORT_FREQUENCY=5 # Check every 5 seconds for faster processing
|
|
112
|
+
- BATCH_SIZE=20 # Process 20 files at a time (increased from 3)
|
|
113
|
+
- MEMORY_LIMIT_MB=1500 # Memory limit (increased to 1.5GB)
|
|
114
|
+
- MAX_QUEUE_SIZE=500 # Increased queue size to handle backlog
|
|
115
115
|
- MAX_BACKLOG_HOURS=24 # Alert if backlog > 24 hours
|
|
116
116
|
- QDRANT_TIMEOUT=10 # 10 second timeout for Qdrant ops
|
|
117
117
|
- MAX_RETRIES=3 # Retry failed operations
|
|
@@ -120,11 +120,11 @@ services:
|
|
|
120
120
|
- LOGS_DIR=/logs
|
|
121
121
|
- FASTEMBED_CACHE_PATH=/root/.cache/fastembed
|
|
122
122
|
- MALLOC_ARENA_MAX=2 # MEMORY LEAK FIX: Limit glibc malloc arenas
|
|
123
|
-
restart:
|
|
124
|
-
profiles: ["watch"]
|
|
125
|
-
mem_limit: 500m
|
|
126
|
-
memswap_limit:
|
|
127
|
-
cpus:
|
|
123
|
+
restart: "no" # DISABLED - causes system overload
|
|
124
|
+
profiles: ["watch-disabled"] # Changed from "watch" to disable auto-start
|
|
125
|
+
mem_limit: 2g # Increased from 500m to 2GB
|
|
126
|
+
memswap_limit: 2g
|
|
127
|
+
cpus: 8.0 # Increased CPU limit to 8 cores for faster processing
|
|
128
128
|
|
|
129
129
|
# Async streaming importer - Ground-up async rewrite
|
|
130
130
|
async-importer:
|
|
@@ -161,6 +161,38 @@ services:
|
|
|
161
161
|
mem_limit: 4g
|
|
162
162
|
memswap_limit: 4g
|
|
163
163
|
|
|
164
|
+
# Safe watcher with hot/warm/cold priority
|
|
165
|
+
safe-watcher:
|
|
166
|
+
build:
|
|
167
|
+
context: .
|
|
168
|
+
dockerfile: Dockerfile.safe-watcher
|
|
169
|
+
container_name: claude-reflection-safe-watcher
|
|
170
|
+
depends_on:
|
|
171
|
+
- init-permissions
|
|
172
|
+
- qdrant
|
|
173
|
+
volumes:
|
|
174
|
+
- ${CLAUDE_LOGS_PATH:-~/.claude/projects}:/logs:ro
|
|
175
|
+
- ${CONFIG_PATH:-~/.claude-self-reflect/config}:/config
|
|
176
|
+
- ./scripts:/scripts:ro
|
|
177
|
+
environment:
|
|
178
|
+
- QDRANT_URL=http://qdrant:6333
|
|
179
|
+
- STATE_FILE=/config/watcher-state.json
|
|
180
|
+
- VOYAGE_KEY=${VOYAGE_KEY:-}
|
|
181
|
+
- PREFER_LOCAL_EMBEDDINGS=${PREFER_LOCAL_EMBEDDINGS:-true}
|
|
182
|
+
- HOT_WINDOW_MINUTES=${HOT_WINDOW_MINUTES:-15}
|
|
183
|
+
- MAX_COLD_FILES_PER_CYCLE=${MAX_COLD_FILES_PER_CYCLE:-3}
|
|
184
|
+
- MAX_MEMORY_MB=${MAX_MEMORY_MB:-300}
|
|
185
|
+
- WATCH_INTERVAL_SECONDS=${WATCH_INTERVAL_SECONDS:-30}
|
|
186
|
+
- MAX_FILES_PER_CYCLE=${MAX_FILES_PER_CYCLE:-10}
|
|
187
|
+
- MAX_CHUNK_SIZE=${MAX_CHUNK_SIZE:-50} # Messages per chunk for streaming
|
|
188
|
+
- PYTHONUNBUFFERED=1
|
|
189
|
+
- MALLOC_ARENA_MAX=2
|
|
190
|
+
restart: "no" # Manual start only - prevent system overload
|
|
191
|
+
profiles: ["safe-watch"] # Requires explicit profile to run
|
|
192
|
+
mem_limit: 600m # Increased from 400m to handle large files safely
|
|
193
|
+
memswap_limit: 600m
|
|
194
|
+
cpus: 1.0 # Single CPU core limit
|
|
195
|
+
|
|
164
196
|
# MCP server for Claude integration
|
|
165
197
|
mcp-server:
|
|
166
198
|
build:
|