claude-self-reflect 3.3.0 → 4.0.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 +525 -11
- package/.claude/agents/quality-fixer.md +314 -0
- package/.claude/agents/reflection-specialist.md +40 -1
- package/installer/cli.js +16 -0
- package/installer/postinstall.js +14 -0
- package/installer/statusline-setup.js +289 -0
- package/mcp-server/run-mcp.sh +45 -7
- package/mcp-server/src/code_reload_tool.py +271 -0
- package/mcp-server/src/embedding_manager.py +60 -26
- package/mcp-server/src/enhanced_tool_registry.py +407 -0
- package/mcp-server/src/mode_switch_tool.py +181 -0
- package/mcp-server/src/parallel_search.py +24 -85
- package/mcp-server/src/project_resolver.py +20 -2
- package/mcp-server/src/reflection_tools.py +60 -13
- package/mcp-server/src/rich_formatting.py +103 -0
- package/mcp-server/src/search_tools.py +180 -79
- package/mcp-server/src/security_patches.py +555 -0
- package/mcp-server/src/server.py +318 -240
- package/mcp-server/src/status.py +13 -8
- package/mcp-server/src/temporal_tools.py +10 -3
- package/mcp-server/src/test_quality.py +153 -0
- package/package.json +6 -1
- package/scripts/ast_grep_final_analyzer.py +328 -0
- package/scripts/ast_grep_unified_registry.py +710 -0
- package/scripts/csr-status +511 -0
- package/scripts/import-conversations-unified.py +114 -28
- package/scripts/session_quality_tracker.py +661 -0
- package/scripts/streaming-watcher.py +140 -5
- package/scripts/update_patterns.py +334 -0
|
@@ -25,7 +25,12 @@ You are the comprehensive testing specialist for Claude Self-Reflect. You valida
|
|
|
25
25
|
- **State Management**: File locking, atomic writes, resume capability
|
|
26
26
|
- **Search Quality**: Relevance scores, metadata extraction, cross-project search
|
|
27
27
|
- **Memory Decay**: Client-side and native Qdrant decay
|
|
28
|
-
- **Modularization**: Server architecture with
|
|
28
|
+
- **Modularization**: Server architecture with search_tools, temporal_tools, reflection_tools, parallel_search modules
|
|
29
|
+
- **Metadata Extraction**: AST patterns, concepts, files analyzed, tools used
|
|
30
|
+
- **Hook System**: session-start, precompact, submit hooks
|
|
31
|
+
- **Sub-Agents**: All 6 specialized agents (reflection, import-debugger, docker, mcp, search, qdrant)
|
|
32
|
+
- **Embedding Modes**: Local (FastEmbed 384d) and Cloud (Voyage AI 1024d) with mode switching
|
|
33
|
+
- **Zero Vector Detection**: Root cause analysis and prevention
|
|
29
34
|
|
|
30
35
|
### Test Files Knowledge
|
|
31
36
|
```
|
|
@@ -333,6 +338,74 @@ test_unified_importer() {
|
|
|
333
338
|
fi
|
|
334
339
|
}
|
|
335
340
|
|
|
341
|
+
# Test for zero chunks/vectors - CRITICAL
|
|
342
|
+
test_zero_chunks_detection() {
|
|
343
|
+
echo "Testing zero chunks/vectors detection..."
|
|
344
|
+
|
|
345
|
+
# Check recent imports for zero chunks
|
|
346
|
+
IMPORT_LOG=$(python scripts/import-conversations-unified.py --limit 5 2>&1)
|
|
347
|
+
|
|
348
|
+
# Check for zero chunks warnings
|
|
349
|
+
if echo "$IMPORT_LOG" | grep -q "Imported 0 chunks"; then
|
|
350
|
+
echo "❌ CRITICAL: Found imports with 0 chunks!"
|
|
351
|
+
echo " Files producing 0 chunks:"
|
|
352
|
+
echo "$IMPORT_LOG" | grep -B1 "Imported 0 chunks" | grep "import of"
|
|
353
|
+
|
|
354
|
+
# Analyze why chunks are zero
|
|
355
|
+
echo " Analyzing root cause..."
|
|
356
|
+
|
|
357
|
+
# Check for thinking-only content
|
|
358
|
+
PROBLEM_FILE=$(echo "$IMPORT_LOG" | grep -B1 "Imported 0 chunks" | grep "\.jsonl" | head -1 | awk '{print $NF}')
|
|
359
|
+
if [ -n "$PROBLEM_FILE" ]; then
|
|
360
|
+
python -c "
|
|
361
|
+
import json
|
|
362
|
+
file_path = '$PROBLEM_FILE'
|
|
363
|
+
has_thinking = 0
|
|
364
|
+
has_text = 0
|
|
365
|
+
with open(file_path, 'r') as f:
|
|
366
|
+
for line in f:
|
|
367
|
+
data = json.loads(line.strip())
|
|
368
|
+
if 'message' in data and data['message']:
|
|
369
|
+
content = data['message'].get('content', [])
|
|
370
|
+
if isinstance(content, list):
|
|
371
|
+
for item in content:
|
|
372
|
+
if isinstance(item, dict):
|
|
373
|
+
if item.get('type') == 'thinking':
|
|
374
|
+
has_thinking += 1
|
|
375
|
+
elif item.get('type') == 'text':
|
|
376
|
+
has_text += 1
|
|
377
|
+
print(f' Thinking blocks: {has_thinking}')
|
|
378
|
+
print(f' Text blocks: {has_text}')
|
|
379
|
+
if has_thinking > 0 and has_text == 0:
|
|
380
|
+
print(' ⚠️ File has only thinking content - import script may need fix')
|
|
381
|
+
"
|
|
382
|
+
fi
|
|
383
|
+
|
|
384
|
+
# DO NOT CERTIFY WITH ZERO CHUNKS
|
|
385
|
+
echo " ⛔ CERTIFICATION BLOCKED: Fix zero chunks issue before certifying!"
|
|
386
|
+
return 1
|
|
387
|
+
else
|
|
388
|
+
echo "✅ No zero chunks detected in recent imports"
|
|
389
|
+
fi
|
|
390
|
+
|
|
391
|
+
# Also check Qdrant for empty collections
|
|
392
|
+
python -c "
|
|
393
|
+
from qdrant_client import QdrantClient
|
|
394
|
+
client = QdrantClient('http://localhost:6333')
|
|
395
|
+
collections = client.get_collections().collections
|
|
396
|
+
empty_collections = []
|
|
397
|
+
for col in collections:
|
|
398
|
+
count = client.count(collection_name=col.name).count
|
|
399
|
+
if count == 0:
|
|
400
|
+
empty_collections.append(col.name)
|
|
401
|
+
if empty_collections:
|
|
402
|
+
print(f'❌ Found {len(empty_collections)} empty collections: {empty_collections}')
|
|
403
|
+
print(' ⛔ CERTIFICATION BLOCKED: Empty collections detected!')
|
|
404
|
+
else:
|
|
405
|
+
print('✅ All collections have vectors')
|
|
406
|
+
" 2>/dev/null || echo "⚠️ Could not check Qdrant collections"
|
|
407
|
+
}
|
|
408
|
+
|
|
336
409
|
# Test streaming importer
|
|
337
410
|
test_streaming_importer() {
|
|
338
411
|
echo "Testing streaming importer..."
|
|
@@ -357,11 +430,361 @@ test_delta_metadata() {
|
|
|
357
430
|
}
|
|
358
431
|
|
|
359
432
|
test_unified_importer
|
|
433
|
+
test_zero_chunks_detection # CRITICAL: Must pass before certification
|
|
360
434
|
test_streaming_importer
|
|
361
435
|
test_delta_metadata
|
|
362
436
|
```
|
|
363
437
|
|
|
364
|
-
### 5.
|
|
438
|
+
### 5. Hook System Testing
|
|
439
|
+
```bash
|
|
440
|
+
#!/bin/bash
|
|
441
|
+
echo "=== HOOK SYSTEM TESTING ==="
|
|
442
|
+
|
|
443
|
+
# Test session-start hook
|
|
444
|
+
test_session_start_hook() {
|
|
445
|
+
echo "Testing session-start hook..."
|
|
446
|
+
HOOK_PATH="$HOME/.claude/hooks/session-start"
|
|
447
|
+
if [ -f "$HOOK_PATH" ]; then
|
|
448
|
+
echo "✅ session-start hook exists"
|
|
449
|
+
# Check if executable
|
|
450
|
+
[ -x "$HOOK_PATH" ] && echo "✅ Hook is executable" || echo "❌ Hook not executable"
|
|
451
|
+
else
|
|
452
|
+
echo "⚠️ session-start hook not configured"
|
|
453
|
+
fi
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
# Test precompact hook
|
|
457
|
+
test_precompact_hook() {
|
|
458
|
+
echo "Testing precompact hook..."
|
|
459
|
+
HOOK_PATH="$HOME/.claude/hooks/precompact"
|
|
460
|
+
if [ -f "$HOOK_PATH" ]; then
|
|
461
|
+
echo "✅ precompact hook exists"
|
|
462
|
+
# Test execution
|
|
463
|
+
timeout 10 "$HOOK_PATH" && echo "✅ Hook executes successfully" || echo "❌ Hook failed"
|
|
464
|
+
else
|
|
465
|
+
echo "⚠️ precompact hook not configured"
|
|
466
|
+
fi
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
test_session_start_hook
|
|
470
|
+
test_precompact_hook
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
### 6. Metadata Extraction Testing
|
|
474
|
+
```bash
|
|
475
|
+
#!/bin/bash
|
|
476
|
+
echo "=== METADATA EXTRACTION TESTING ==="
|
|
477
|
+
|
|
478
|
+
# Test metadata extraction
|
|
479
|
+
test_metadata_extraction() {
|
|
480
|
+
echo "Testing metadata extraction..."
|
|
481
|
+
python -c "
|
|
482
|
+
import json
|
|
483
|
+
from pathlib import Path
|
|
484
|
+
|
|
485
|
+
# Check if metadata is being extracted
|
|
486
|
+
config_dir = Path.home() / '.claude-self-reflect' / 'config'
|
|
487
|
+
delta_state = config_dir / 'delta-update-state.json'
|
|
488
|
+
|
|
489
|
+
if delta_state.exists():
|
|
490
|
+
with open(delta_state) as f:
|
|
491
|
+
state = json.load(f)
|
|
492
|
+
updated = state.get('updated_points', {})
|
|
493
|
+
if updated:
|
|
494
|
+
sample = list(updated.values())[0] if updated else {}
|
|
495
|
+
print(f'✅ Metadata extracted for {len(updated)} points')
|
|
496
|
+
if 'files_analyzed' in str(sample):
|
|
497
|
+
print('✅ files_analyzed metadata present')
|
|
498
|
+
if 'tools_used' in str(sample):
|
|
499
|
+
print('✅ tools_used metadata present')
|
|
500
|
+
if 'concepts' in str(sample):
|
|
501
|
+
print('✅ concepts metadata present')
|
|
502
|
+
if 'code_patterns' in str(sample):
|
|
503
|
+
print('✅ code_patterns (AST) metadata present')
|
|
504
|
+
else:
|
|
505
|
+
print('⚠️ No metadata updates found')
|
|
506
|
+
else:
|
|
507
|
+
print('❌ Delta update state file not found')
|
|
508
|
+
"
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
# Test AST pattern extraction
|
|
512
|
+
test_ast_patterns() {
|
|
513
|
+
echo "Testing AST pattern extraction..."
|
|
514
|
+
TEST_FILE=$(mktemp)
|
|
515
|
+
cat > "$TEST_FILE" << 'EOF'
|
|
516
|
+
import ast
|
|
517
|
+
text = "def test(): return True"
|
|
518
|
+
tree = ast.parse(text)
|
|
519
|
+
patterns = [node.__class__.__name__ for node in ast.walk(tree)]
|
|
520
|
+
print(f"AST patterns: {patterns}")
|
|
521
|
+
EOF
|
|
522
|
+
python "$TEST_FILE"
|
|
523
|
+
rm "$TEST_FILE"
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
test_metadata_extraction
|
|
527
|
+
test_ast_patterns
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
### 7. Zero Vector Investigation
|
|
531
|
+
```bash
|
|
532
|
+
#!/bin/bash
|
|
533
|
+
echo "=== ZERO VECTOR INVESTIGATION ==="
|
|
534
|
+
|
|
535
|
+
test_zero_vectors() {
|
|
536
|
+
python -c "
|
|
537
|
+
import numpy as np
|
|
538
|
+
from qdrant_client import QdrantClient
|
|
539
|
+
|
|
540
|
+
# Connect to Qdrant
|
|
541
|
+
client = QdrantClient('http://localhost:6333')
|
|
542
|
+
|
|
543
|
+
# Check for zero vectors
|
|
544
|
+
collections = client.get_collections().collections
|
|
545
|
+
zero_count = 0
|
|
546
|
+
total_checked = 0
|
|
547
|
+
|
|
548
|
+
for col in collections[:5]: # Check first 5 collections
|
|
549
|
+
try:
|
|
550
|
+
points = client.scroll(
|
|
551
|
+
collection_name=col.name,
|
|
552
|
+
limit=10,
|
|
553
|
+
with_vectors=True
|
|
554
|
+
)[0]
|
|
555
|
+
|
|
556
|
+
for point in points:
|
|
557
|
+
total_checked += 1
|
|
558
|
+
if point.vector:
|
|
559
|
+
if isinstance(point.vector, list) and all(v == 0 for v in point.vector):
|
|
560
|
+
zero_count += 1
|
|
561
|
+
print(f'❌ CRITICAL: Zero vector in {col.name}, point {point.id}')
|
|
562
|
+
elif isinstance(point.vector, dict):
|
|
563
|
+
for vec_name, vec in point.vector.items():
|
|
564
|
+
if all(v == 0 for v in vec):
|
|
565
|
+
zero_count += 1
|
|
566
|
+
print(f'❌ CRITICAL: Zero vector in {col.name}, point {point.id}, vector {vec_name}')
|
|
567
|
+
except Exception as e:
|
|
568
|
+
print(f'⚠️ Error checking {col.name}: {e}')
|
|
569
|
+
|
|
570
|
+
if zero_count == 0:
|
|
571
|
+
print(f'✅ No zero vectors found (checked {total_checked} points)')
|
|
572
|
+
else:
|
|
573
|
+
print(f'❌ Found {zero_count} zero vectors out of {total_checked} points')
|
|
574
|
+
"
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
# Test embedding generation
|
|
578
|
+
test_embedding_generation() {
|
|
579
|
+
echo "Testing embedding generation..."
|
|
580
|
+
python -c "
|
|
581
|
+
try:
|
|
582
|
+
from fastembed import TextEmbedding
|
|
583
|
+
model = TextEmbedding('sentence-transformers/all-MiniLM-L6-v2')
|
|
584
|
+
texts = ['test', 'hello world', '']
|
|
585
|
+
|
|
586
|
+
for text in texts:
|
|
587
|
+
embedding = list(model.embed([text]))[0]
|
|
588
|
+
is_zero = all(v == 0 for v in embedding)
|
|
589
|
+
if is_zero:
|
|
590
|
+
print(f'❌ CRITICAL: Zero embedding for \'{text}\'')
|
|
591
|
+
else:
|
|
592
|
+
import numpy as np
|
|
593
|
+
print(f'✅ Non-zero embedding for \'{text}\' (mean={np.mean(embedding):.4f})')
|
|
594
|
+
except ImportError:
|
|
595
|
+
print('❌ FastEmbed not installed')
|
|
596
|
+
"
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
test_zero_vectors
|
|
600
|
+
test_embedding_generation
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
### 8. Sub-Agent Testing
|
|
604
|
+
```bash
|
|
605
|
+
#!/bin/bash
|
|
606
|
+
echo "=== SUB-AGENT TESTING ==="
|
|
607
|
+
|
|
608
|
+
# List all sub-agents
|
|
609
|
+
test_subagent_availability() {
|
|
610
|
+
echo "Checking sub-agent availability..."
|
|
611
|
+
AGENTS_DIR="$HOME/projects/claude-self-reflect/.claude/agents"
|
|
612
|
+
|
|
613
|
+
EXPECTED_AGENTS=(
|
|
614
|
+
"claude-self-reflect-test.md"
|
|
615
|
+
"import-debugger.md"
|
|
616
|
+
"docker-orchestrator.md"
|
|
617
|
+
"mcp-integration.md"
|
|
618
|
+
"search-optimizer.md"
|
|
619
|
+
"reflection-specialist.md"
|
|
620
|
+
"qdrant-specialist.md"
|
|
621
|
+
)
|
|
622
|
+
|
|
623
|
+
for agent in "${EXPECTED_AGENTS[@]}"; do
|
|
624
|
+
if [ -f "$AGENTS_DIR/$agent" ]; then
|
|
625
|
+
echo "✅ $agent present"
|
|
626
|
+
else
|
|
627
|
+
echo "❌ $agent missing"
|
|
628
|
+
fi
|
|
629
|
+
done
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
test_subagent_availability
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
### 9. Embedding Mode Comprehensive Test
|
|
636
|
+
```bash
|
|
637
|
+
#!/bin/bash
|
|
638
|
+
echo "=== EMBEDDING MODE TESTING ==="
|
|
639
|
+
|
|
640
|
+
# CRITICAL: Instructions for switching to cloud mode
|
|
641
|
+
# The system needs new collections with 1024 dimensions for cloud mode
|
|
642
|
+
# This requires MCP restart with VOYAGE_KEY parameter
|
|
643
|
+
|
|
644
|
+
# Test both modes
|
|
645
|
+
test_both_embedding_modes() {
|
|
646
|
+
echo "Testing local mode (FastEmbed)..."
|
|
647
|
+
PREFER_LOCAL_EMBEDDINGS=true python -c "
|
|
648
|
+
from mcp_server.src.embedding_manager import get_embedding_manager
|
|
649
|
+
em = get_embedding_manager()
|
|
650
|
+
print(f'Local mode: {em.model_type}, dimension: {em.get_vector_dimension()}')
|
|
651
|
+
"
|
|
652
|
+
|
|
653
|
+
if [ -n "$VOYAGE_KEY" ]; then
|
|
654
|
+
echo "Testing cloud mode (Voyage AI)..."
|
|
655
|
+
PREFER_LOCAL_EMBEDDINGS=false python -c "
|
|
656
|
+
from mcp_server.src.embedding_manager import get_embedding_manager
|
|
657
|
+
em = get_embedding_manager()
|
|
658
|
+
print(f'Cloud mode: {em.model_type}, dimension: {em.get_vector_dimension()}')
|
|
659
|
+
"
|
|
660
|
+
else
|
|
661
|
+
echo "⚠️ VOYAGE_KEY not set, skipping cloud mode test"
|
|
662
|
+
fi
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
# CRITICAL CLOUD MODE SWITCH PROCEDURE
|
|
666
|
+
switch_to_cloud_mode() {
|
|
667
|
+
echo "=== SWITCHING TO CLOUD MODE (1024 dimensions) ==="
|
|
668
|
+
echo "This creates NEW collections with _voyage suffix"
|
|
669
|
+
|
|
670
|
+
# Step 1: Get VOYAGE_KEY from .env
|
|
671
|
+
VOYAGE_KEY=$(grep "^VOYAGE_KEY=" .env | cut -d'=' -f2)
|
|
672
|
+
if [ -z "$VOYAGE_KEY" ]; then
|
|
673
|
+
echo "❌ VOYAGE_KEY not found in .env file"
|
|
674
|
+
echo "Please add VOYAGE_KEY=your-key-here to .env file"
|
|
675
|
+
return 1
|
|
676
|
+
fi
|
|
677
|
+
|
|
678
|
+
# Step 2: Remove existing MCP
|
|
679
|
+
echo "Removing existing MCP configuration..."
|
|
680
|
+
claude mcp remove claude-self-reflect
|
|
681
|
+
|
|
682
|
+
# Step 3: Re-add with cloud parameters
|
|
683
|
+
echo "Adding MCP with cloud mode parameters..."
|
|
684
|
+
claude mcp add claude-self-reflect \
|
|
685
|
+
"/Users/$(whoami)/projects/claude-self-reflect/mcp-server/run-mcp.sh" \
|
|
686
|
+
-e PREFER_LOCAL_EMBEDDINGS="false" \
|
|
687
|
+
-e VOYAGE_KEY="$VOYAGE_KEY" \
|
|
688
|
+
-e QDRANT_URL="http://localhost:6333" \
|
|
689
|
+
-s user
|
|
690
|
+
|
|
691
|
+
# Step 4: Wait for MCP to initialize
|
|
692
|
+
echo "Waiting 30 seconds for MCP to initialize..."
|
|
693
|
+
sleep 30
|
|
694
|
+
|
|
695
|
+
# Step 5: Test MCP connection
|
|
696
|
+
echo "Testing MCP connection..."
|
|
697
|
+
claude mcp list | grep claude-self-reflect
|
|
698
|
+
|
|
699
|
+
echo "✅ Switched to CLOUD mode with 1024-dimensional embeddings"
|
|
700
|
+
echo "⚠️ New collections will be created with _voyage suffix"
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
# CRITICAL LOCAL MODE RESTORE PROCEDURE
|
|
704
|
+
switch_to_local_mode() {
|
|
705
|
+
echo "=== RESTORING LOCAL MODE (384 dimensions) ==="
|
|
706
|
+
echo "This uses collections with _local suffix"
|
|
707
|
+
|
|
708
|
+
# Step 1: Remove existing MCP
|
|
709
|
+
echo "Removing existing MCP configuration..."
|
|
710
|
+
claude mcp remove claude-self-reflect
|
|
711
|
+
|
|
712
|
+
# Step 2: Re-add with local parameters (default)
|
|
713
|
+
echo "Adding MCP with local mode parameters..."
|
|
714
|
+
claude mcp add claude-self-reflect \
|
|
715
|
+
"/Users/$(whoami)/projects/claude-self-reflect/mcp-server/run-mcp.sh" \
|
|
716
|
+
-e PREFER_LOCAL_EMBEDDINGS="true" \
|
|
717
|
+
-e QDRANT_URL="http://localhost:6333" \
|
|
718
|
+
-s user
|
|
719
|
+
|
|
720
|
+
# Step 3: Wait for MCP to initialize
|
|
721
|
+
echo "Waiting 30 seconds for MCP to initialize..."
|
|
722
|
+
sleep 30
|
|
723
|
+
|
|
724
|
+
# Step 4: Test MCP connection
|
|
725
|
+
echo "Testing MCP connection..."
|
|
726
|
+
claude mcp list | grep claude-self-reflect
|
|
727
|
+
|
|
728
|
+
echo "✅ Restored to LOCAL mode with 384-dimensional embeddings"
|
|
729
|
+
echo "Privacy-first mode active"
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
# Test mode switching
|
|
733
|
+
test_mode_switching() {
|
|
734
|
+
echo "Testing mode switching..."
|
|
735
|
+
python -c "
|
|
736
|
+
from pathlib import Path
|
|
737
|
+
env_file = Path('.env')
|
|
738
|
+
if env_file.exists():
|
|
739
|
+
content = env_file.read_text()
|
|
740
|
+
if 'PREFER_LOCAL_EMBEDDINGS=false' in content:
|
|
741
|
+
print('Currently in CLOUD mode (per .env file)')
|
|
742
|
+
else:
|
|
743
|
+
print('Currently in LOCAL mode (per .env file)')
|
|
744
|
+
else:
|
|
745
|
+
print('⚠️ .env file not found')
|
|
746
|
+
"
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
# Full cloud mode test procedure
|
|
750
|
+
full_cloud_mode_test() {
|
|
751
|
+
echo "=== FULL CLOUD MODE TEST PROCEDURE ==="
|
|
752
|
+
|
|
753
|
+
# 1. Switch to cloud mode
|
|
754
|
+
switch_to_cloud_mode
|
|
755
|
+
|
|
756
|
+
# 2. Test cloud embedding generation
|
|
757
|
+
echo "Testing cloud embedding generation..."
|
|
758
|
+
# This will create new collections with _voyage suffix
|
|
759
|
+
|
|
760
|
+
# 3. Run import with cloud embeddings
|
|
761
|
+
echo "Running test import with cloud embeddings..."
|
|
762
|
+
cd /Users/$(whoami)/projects/claude-self-reflect
|
|
763
|
+
source venv/bin/activate
|
|
764
|
+
PREFER_LOCAL_EMBEDDINGS=false python scripts/import-conversations-unified.py --limit 5
|
|
765
|
+
|
|
766
|
+
# 4. Verify cloud collections created
|
|
767
|
+
echo "Verifying cloud collections..."
|
|
768
|
+
curl -s http://localhost:6333/collections | jq '.result.collections[] | select(.name | endswith("_voyage")) | .name'
|
|
769
|
+
|
|
770
|
+
# 5. Test search with cloud embeddings
|
|
771
|
+
echo "Testing search with cloud embeddings..."
|
|
772
|
+
# Test via MCP tools
|
|
773
|
+
|
|
774
|
+
# 6. CRITICAL: Always restore to local mode
|
|
775
|
+
echo "⚠️ CRITICAL: Restoring to local mode..."
|
|
776
|
+
switch_to_local_mode
|
|
777
|
+
|
|
778
|
+
echo "✅ Cloud mode test complete, system restored to local mode"
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
test_both_embedding_modes
|
|
782
|
+
test_mode_switching
|
|
783
|
+
# Uncomment to run full cloud test:
|
|
784
|
+
# full_cloud_mode_test
|
|
785
|
+
```
|
|
786
|
+
|
|
787
|
+
### 10. MCP Tools Comprehensive Test
|
|
365
788
|
```bash
|
|
366
789
|
#!/bin/bash
|
|
367
790
|
echo "=== MCP TOOLS COMPREHENSIVE TEST ==="
|
|
@@ -689,17 +1112,97 @@ EOF
|
|
|
689
1112
|
echo "✅ Test report generated: $REPORT_FILE"
|
|
690
1113
|
```
|
|
691
1114
|
|
|
1115
|
+
## Pre-Test Validation Protocol
|
|
1116
|
+
|
|
1117
|
+
### Agent Self-Review
|
|
1118
|
+
Before running any tests, I MUST review myself to ensure comprehensive coverage:
|
|
1119
|
+
|
|
1120
|
+
```bash
|
|
1121
|
+
#!/bin/bash
|
|
1122
|
+
echo "=== PRE-TEST AGENT VALIDATION ==="
|
|
1123
|
+
|
|
1124
|
+
# Review this agent file for completeness
|
|
1125
|
+
review_agent_completeness() {
|
|
1126
|
+
echo "Reviewing CSR-tester agent for missing features..."
|
|
1127
|
+
|
|
1128
|
+
# Check if agent covers all known features
|
|
1129
|
+
AGENT_FILE="$HOME/projects/claude-self-reflect/.claude/agents/claude-self-reflect-test.md"
|
|
1130
|
+
|
|
1131
|
+
REQUIRED_FEATURES=(
|
|
1132
|
+
"15+ MCP tools"
|
|
1133
|
+
"Temporal tools"
|
|
1134
|
+
"Metadata extraction"
|
|
1135
|
+
"Hook system"
|
|
1136
|
+
"Sub-agents"
|
|
1137
|
+
"Embedding modes"
|
|
1138
|
+
"Zero vectors"
|
|
1139
|
+
"Streaming watcher"
|
|
1140
|
+
"Delta metadata"
|
|
1141
|
+
"Import pipeline"
|
|
1142
|
+
"Docker stack"
|
|
1143
|
+
"CLI tool"
|
|
1144
|
+
"State management"
|
|
1145
|
+
"Memory decay"
|
|
1146
|
+
"Parallel search"
|
|
1147
|
+
"Project scoping"
|
|
1148
|
+
"Collection naming"
|
|
1149
|
+
"Dimension validation"
|
|
1150
|
+
"XML escaping"
|
|
1151
|
+
"Error handling"
|
|
1152
|
+
)
|
|
1153
|
+
|
|
1154
|
+
for feature in "${REQUIRED_FEATURES[@]}"; do
|
|
1155
|
+
if grep -qi "$feature" "$AGENT_FILE"; then
|
|
1156
|
+
echo "✅ $feature: Covered"
|
|
1157
|
+
else
|
|
1158
|
+
echo "❌ $feature: MISSING - Add test coverage!"
|
|
1159
|
+
fi
|
|
1160
|
+
done
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
# Discover any new features from codebase
|
|
1164
|
+
discover_new_features() {
|
|
1165
|
+
echo "Scanning for undocumented features..."
|
|
1166
|
+
|
|
1167
|
+
# Check for new MCP tools
|
|
1168
|
+
NEW_TOOLS=$(grep -h "@mcp.tool()" mcp-server/src/*.py 2>/dev/null | wc -l)
|
|
1169
|
+
echo "MCP tools found: $NEW_TOOLS"
|
|
1170
|
+
|
|
1171
|
+
# Check for new scripts
|
|
1172
|
+
NEW_SCRIPTS=$(ls scripts/*.py 2>/dev/null | wc -l)
|
|
1173
|
+
echo "Python scripts found: $NEW_SCRIPTS"
|
|
1174
|
+
|
|
1175
|
+
# Check for new test files
|
|
1176
|
+
NEW_TESTS=$(find tests -name "*.py" 2>/dev/null | wc -l)
|
|
1177
|
+
echo "Test files found: $NEW_TESTS"
|
|
1178
|
+
|
|
1179
|
+
# Check for new hooks
|
|
1180
|
+
if [ -d "$HOME/.claude/hooks" ]; then
|
|
1181
|
+
HOOKS=$(ls "$HOME/.claude/hooks" 2>/dev/null | wc -l)
|
|
1182
|
+
echo "Hooks configured: $HOOKS"
|
|
1183
|
+
fi
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
review_agent_completeness
|
|
1187
|
+
discover_new_features
|
|
1188
|
+
```
|
|
1189
|
+
|
|
692
1190
|
## Test Execution Protocol
|
|
693
1191
|
|
|
694
1192
|
### Run Complete Test Suite
|
|
695
1193
|
```bash
|
|
696
1194
|
#!/bin/bash
|
|
697
|
-
# Master test runner
|
|
1195
|
+
# Master test runner - CSR-tester is the SOLE executor of all tests
|
|
698
1196
|
|
|
699
1197
|
echo "=== CLAUDE SELF-REFLECT COMPLETE TEST SUITE ==="
|
|
700
1198
|
echo "Starting at: $(date)"
|
|
1199
|
+
echo "Executor: CSR-tester agent (sole test runner)"
|
|
701
1200
|
echo ""
|
|
702
1201
|
|
|
1202
|
+
# Pre-test validation
|
|
1203
|
+
echo "Phase 0: Pre-test Validation..."
|
|
1204
|
+
./review_agent_completeness.sh
|
|
1205
|
+
|
|
703
1206
|
# Create test results directory
|
|
704
1207
|
mkdir -p test-results-$(date +%Y%m%d)
|
|
705
1208
|
cd test-results-$(date +%Y%m%d)
|
|
@@ -725,15 +1228,20 @@ echo "Report: test-report-*.md"
|
|
|
725
1228
|
## Success Criteria
|
|
726
1229
|
|
|
727
1230
|
### Must Pass
|
|
728
|
-
- [ ] All
|
|
1231
|
+
- [ ] All 15+ MCP tools functional
|
|
729
1232
|
- [ ] Temporal tools work with proper scoping
|
|
730
1233
|
- [ ] Timestamp indexes on all collections
|
|
731
1234
|
- [ ] CLI installs and runs globally
|
|
732
1235
|
- [ ] Docker containers healthy
|
|
733
|
-
- [ ] No critical bugs (native decay, XML injection)
|
|
1236
|
+
- [ ] No critical bugs (native decay, XML injection, dimension mismatch)
|
|
734
1237
|
- [ ] Search returns relevant results
|
|
735
1238
|
- [ ] Import pipeline processes files
|
|
736
1239
|
- [ ] State persists correctly
|
|
1240
|
+
- [ ] NO ZERO VECTORS in any collection
|
|
1241
|
+
- [ ] Metadata extraction working (files, tools, concepts, AST patterns)
|
|
1242
|
+
- [ ] Both embedding modes functional (local 384d, Voyage 1024d)
|
|
1243
|
+
- [ ] Hooks execute properly (session-start, precompact)
|
|
1244
|
+
- [ ] All 6 sub-agents available
|
|
737
1245
|
|
|
738
1246
|
### Should Pass
|
|
739
1247
|
- [ ] Performance within limits
|
|
@@ -749,12 +1257,18 @@ echo "Report: test-report-*.md"
|
|
|
749
1257
|
|
|
750
1258
|
## Final Notes
|
|
751
1259
|
|
|
752
|
-
This agent knows ALL features of Claude Self-Reflect including:
|
|
753
|
-
-
|
|
754
|
-
-
|
|
755
|
-
-
|
|
756
|
-
-
|
|
757
|
-
-
|
|
1260
|
+
This agent knows ALL features of Claude Self-Reflect v3.3.0 including:
|
|
1261
|
+
- 15+ MCP tools with temporal, search, reflection, pagination capabilities
|
|
1262
|
+
- Modularized architecture (search_tools.py, temporal_tools.py, reflection_tools.py, parallel_search.py)
|
|
1263
|
+
- Metadata extraction (AST patterns, concepts, files analyzed, tools used)
|
|
1264
|
+
- Hook system (session-start, precompact, submit hooks)
|
|
1265
|
+
- 6 specialized sub-agents for different domains
|
|
1266
|
+
- Dual embedding support (FastEmbed 384d, Voyage AI 1024d)
|
|
1267
|
+
- Zero vector detection and prevention
|
|
1268
|
+
- Streaming watcher and delta metadata updater
|
|
1269
|
+
- Project scoping and cross-collection search
|
|
1270
|
+
- Memory decay (client-side with 90-day half-life)
|
|
1271
|
+
- GPT-5 review recommendations and critical fixes
|
|
758
1272
|
- All test scripts and their purposes
|
|
759
1273
|
|
|
760
1274
|
The agent will ALWAYS restore the system to local mode after testing and provide comprehensive reports suitable for release decisions.
|