claude-self-reflect 5.0.5 → 5.0.6
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/Dockerfile.importer +4 -0
- package/Dockerfile.safe-watcher +4 -0
- package/package.json +2 -1
- package/scripts/watcher-loop.sh +56 -0
package/Dockerfile.importer
CHANGED
|
@@ -28,6 +28,10 @@ RUN pip install --no-cache-dir \
|
|
|
28
28
|
# This ensures scripts are available even without volume mounts
|
|
29
29
|
COPY scripts/ /app/scripts/
|
|
30
30
|
|
|
31
|
+
# Create symlink for backwards compatibility with /scripts path
|
|
32
|
+
# This allows both /app/scripts and /scripts to work
|
|
33
|
+
RUN ln -s /app/scripts /scripts
|
|
34
|
+
|
|
31
35
|
# Note: Volume mounts in docker-compose.yaml will override these files in local development
|
|
32
36
|
# This provides compatibility for both local development and global npm installs
|
|
33
37
|
|
package/Dockerfile.safe-watcher
CHANGED
|
@@ -43,6 +43,10 @@ WORKDIR /app
|
|
|
43
43
|
# Copy application scripts
|
|
44
44
|
COPY scripts/ /app/scripts/
|
|
45
45
|
|
|
46
|
+
# Create symlink for backwards compatibility with /scripts path
|
|
47
|
+
# This allows both /app/scripts and /scripts to work
|
|
48
|
+
RUN ln -s /app/scripts /scripts
|
|
49
|
+
|
|
46
50
|
# Make watcher-loop.sh executable
|
|
47
51
|
RUN chmod +x /app/scripts/watcher-loop.sh
|
|
48
52
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-self-reflect",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.6",
|
|
4
4
|
"description": "Give Claude perfect memory of all your conversations - Installation wizard for Python MCP server",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude",
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"scripts/delta-metadata-update-safe.py",
|
|
61
61
|
"scripts/force-metadata-recovery.py",
|
|
62
62
|
"scripts/precompact-hook.sh",
|
|
63
|
+
"scripts/watcher-loop.sh",
|
|
63
64
|
"scripts/import-latest.py",
|
|
64
65
|
"scripts/metadata_extractor.py",
|
|
65
66
|
"scripts/message_processors.py",
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Watcher loop for Docker container
|
|
3
|
+
# Runs the streaming-watcher.py with HOT/WARM/COLD prioritization
|
|
4
|
+
|
|
5
|
+
# Don't use set -e in retry loops - it can cause premature exits
|
|
6
|
+
|
|
7
|
+
echo "Starting Claude Self-Reflect Streaming Watcher v3.0.0"
|
|
8
|
+
echo "HOT/WARM/COLD prioritization enabled"
|
|
9
|
+
echo "=========================================="
|
|
10
|
+
|
|
11
|
+
# Ensure config directory exists
|
|
12
|
+
mkdir -p /config
|
|
13
|
+
|
|
14
|
+
# Set Python path to include scripts directory
|
|
15
|
+
export PYTHONPATH=/app/scripts:$PYTHONPATH
|
|
16
|
+
|
|
17
|
+
# Main loop - restart on failure with backoff
|
|
18
|
+
RETRY_COUNT=0
|
|
19
|
+
MAX_RETRIES=10
|
|
20
|
+
BACKOFF_SECONDS=5
|
|
21
|
+
|
|
22
|
+
while true; do
|
|
23
|
+
echo "[$(date)] Starting watcher (attempt $((RETRY_COUNT + 1))/$MAX_RETRIES)..."
|
|
24
|
+
|
|
25
|
+
# Run the streaming watcher
|
|
26
|
+
python /app/scripts/streaming-watcher.py
|
|
27
|
+
EXIT_CODE=$?
|
|
28
|
+
|
|
29
|
+
if [ $EXIT_CODE -eq 0 ]; then
|
|
30
|
+
echo "[$(date)] Watcher exited cleanly"
|
|
31
|
+
RETRY_COUNT=0
|
|
32
|
+
BACKOFF_SECONDS=5
|
|
33
|
+
else
|
|
34
|
+
echo "[$(date)] Watcher exited with code $EXIT_CODE"
|
|
35
|
+
|
|
36
|
+
RETRY_COUNT=$((RETRY_COUNT + 1))
|
|
37
|
+
if [ $RETRY_COUNT -ge $MAX_RETRIES ]; then
|
|
38
|
+
echo "[$(date)] Maximum retries reached. Exiting."
|
|
39
|
+
exit 1
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
# Add jitter to prevent thundering herd (±20% of backoff)
|
|
43
|
+
JITTER=$(( (RANDOM % (BACKOFF_SECONDS / 5 + 1)) - (BACKOFF_SECONDS / 10) ))
|
|
44
|
+
SLEEP_TIME=$((BACKOFF_SECONDS + JITTER))
|
|
45
|
+
[ $SLEEP_TIME -lt 1 ] && SLEEP_TIME=1
|
|
46
|
+
|
|
47
|
+
echo "[$(date)] Restarting in $SLEEP_TIME seconds (base: $BACKOFF_SECONDS, jitter: $JITTER)..."
|
|
48
|
+
sleep $SLEEP_TIME
|
|
49
|
+
|
|
50
|
+
# Exponential backoff (max 300 seconds)
|
|
51
|
+
BACKOFF_SECONDS=$((BACKOFF_SECONDS * 2))
|
|
52
|
+
if [ $BACKOFF_SECONDS -gt 300 ]; then
|
|
53
|
+
BACKOFF_SECONDS=300
|
|
54
|
+
fi
|
|
55
|
+
fi
|
|
56
|
+
done
|