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.
Files changed (40) hide show
  1. package/.claude/agents/claude-self-reflect-test.md +595 -528
  2. package/.claude/agents/documentation-writer.md +1 -1
  3. package/.claude/agents/qdrant-specialist.md +2 -2
  4. package/.claude/agents/reflection-specialist.md +61 -5
  5. package/.claude/agents/search-optimizer.md +9 -7
  6. package/README.md +16 -9
  7. package/mcp-server/pyproject.toml +1 -1
  8. package/mcp-server/run-mcp.sh +49 -5
  9. package/mcp-server/src/app_context.py +64 -0
  10. package/mcp-server/src/config.py +57 -0
  11. package/mcp-server/src/connection_pool.py +286 -0
  12. package/mcp-server/src/decay_manager.py +106 -0
  13. package/mcp-server/src/embedding_manager.py +64 -40
  14. package/mcp-server/src/embeddings_old.py +141 -0
  15. package/mcp-server/src/models.py +64 -0
  16. package/mcp-server/src/parallel_search.py +371 -0
  17. package/mcp-server/src/project_resolver.py +33 -46
  18. package/mcp-server/src/reflection_tools.py +206 -0
  19. package/mcp-server/src/rich_formatting.py +196 -0
  20. package/mcp-server/src/search_tools.py +826 -0
  21. package/mcp-server/src/server.py +140 -1715
  22. package/mcp-server/src/temporal_design.py +132 -0
  23. package/mcp-server/src/temporal_tools.py +597 -0
  24. package/mcp-server/src/temporal_utils.py +384 -0
  25. package/mcp-server/src/utils.py +150 -67
  26. package/package.json +11 -1
  27. package/scripts/add-timestamp-indexes.py +134 -0
  28. package/scripts/check-collections.py +29 -0
  29. package/scripts/debug-august-parsing.py +76 -0
  30. package/scripts/debug-import-single.py +91 -0
  31. package/scripts/debug-project-resolver.py +82 -0
  32. package/scripts/debug-temporal-tools.py +135 -0
  33. package/scripts/delta-metadata-update.py +547 -0
  34. package/scripts/import-conversations-unified.py +65 -6
  35. package/scripts/importer/utils/project_normalizer.py +22 -9
  36. package/scripts/precompact-hook.sh +33 -0
  37. package/scripts/streaming-watcher.py +1443 -0
  38. package/scripts/utils.py +39 -0
  39. package/shared/__init__.py +5 -0
  40. package/shared/normalization.py +54 -0
@@ -2,8 +2,17 @@
2
2
 
3
3
  import hashlib
4
4
  import logging
5
+ import sys
5
6
  from pathlib import Path
6
7
 
8
+ # Import from shared module for consistent normalization
9
+ sys.path.insert(0, str(Path(__file__).parent.parent.parent.parent))
10
+ try:
11
+ from shared.normalization import normalize_project_name as shared_normalize
12
+ except ImportError:
13
+ shared_normalize = None
14
+ logging.warning("Could not import shared normalization module")
15
+
7
16
  logger = logging.getLogger(__name__)
8
17
 
9
18
 
@@ -20,32 +29,36 @@ class ProjectNormalizer:
20
29
  """
21
30
  Normalize a project path to a consistent project name.
22
31
 
23
- CRITICAL: This must match the implementation in utils.py
32
+ Uses the shared normalization module to ensure consistency
33
+ across all components.
24
34
 
25
35
  Examples:
26
36
  - "-Users-name-projects-claude-self-reflect" -> "claude-self-reflect"
27
37
  - "claude-self-reflect" -> "claude-self-reflect"
28
38
  - "/path/to/-Users-name-projects-myapp" -> "myapp"
29
39
  """
30
- # Get the final component of the path
31
- if '/' in project_path:
32
- final_component = project_path.split('/')[-1]
33
- else:
34
- final_component = project_path
40
+ # Use shared normalization if available
41
+ if shared_normalize:
42
+ return shared_normalize(project_path)
43
+
44
+ # Fallback implementation (matches shared module)
45
+ if not project_path:
46
+ return ""
47
+
48
+ path = Path(project_path.rstrip('/'))
49
+ final_component = path.name
35
50
 
36
51
  # Handle Claude's dash-separated format
37
52
  if final_component.startswith('-') and 'projects' in final_component:
38
- # Find the last occurrence of 'projects-'
39
53
  idx = final_component.rfind('projects-')
40
54
  if idx != -1:
41
- # Extract everything after 'projects-'
42
55
  project_name = final_component[idx + len('projects-'):]
43
56
  logger.debug(f"Normalized '{project_path}' to '{project_name}'")
44
57
  return project_name
45
58
 
46
59
  # Already normalized or different format
47
60
  logger.debug(f"Project path '{project_path}' already normalized")
48
- return final_component
61
+ return final_component if final_component else path.parent.name
49
62
 
50
63
  def get_project_name(self, file_path: Path) -> str:
51
64
  """
@@ -0,0 +1,33 @@
1
+ #!/bin/bash
2
+ # PreCompact hook for Claude Self-Reflect
3
+ # Place this in ~/.claude/hooks/precompact or source it from there
4
+
5
+ # Configuration
6
+ CLAUDE_REFLECT_DIR="${CLAUDE_REFLECT_DIR:-$HOME/claude-self-reflect}"
7
+ VENV_PATH="${VENV_PATH:-$CLAUDE_REFLECT_DIR/.venv}"
8
+ IMPORT_TIMEOUT="${IMPORT_TIMEOUT:-30}"
9
+
10
+ # Check if Claude Self-Reflect is installed
11
+ if [ ! -d "$CLAUDE_REFLECT_DIR" ]; then
12
+ echo "Claude Self-Reflect not found at $CLAUDE_REFLECT_DIR" >&2
13
+ exit 0 # Exit gracefully
14
+ fi
15
+
16
+ # Check if virtual environment exists
17
+ if [ ! -d "$VENV_PATH" ]; then
18
+ echo "Virtual environment not found at $VENV_PATH" >&2
19
+ exit 0 # Exit gracefully
20
+ fi
21
+
22
+ # Run quick import with timeout
23
+ echo "Updating conversation memory..." >&2
24
+ timeout $IMPORT_TIMEOUT bash -c "
25
+ source '$VENV_PATH/bin/activate' 2>/dev/null
26
+ python '$CLAUDE_REFLECT_DIR/scripts/import-latest.py' 2>&1 | \
27
+ grep -E '(Quick import completed|Imported|Warning)' >&2
28
+ " || {
29
+ echo "Quick import timed out after ${IMPORT_TIMEOUT}s" >&2
30
+ }
31
+
32
+ # Always exit successfully to not block compacting
33
+ exit 0