claude-flow-novice 2.15.1 → 2.15.3
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/cfn-extras/agents/google-sheets-specialist.md +614 -0
- package/.claude/commands/cfn/create-handoff.md +224 -0
- package/.claude/hooks/cfn-BACKUP_USAGE.md +243 -243
- package/.claude/hooks/cfn-invoke-security-validation.sh +69 -69
- package/.claude/hooks/cfn-post-edit-cfn-retrospective.sh +78 -78
- package/.claude/hooks/cfn-post-edit.config.json +44 -44
- package/.claude/skills/agent-lifecycle/SKILL.md +60 -0
- package/.claude/skills/agent-lifecycle/execute-lifecycle-hook.sh +573 -0
- package/.claude/skills/agent-lifecycle/simple-audit.sh +31 -0
- package/.claude/skills/cfn-hybrid-routing/check-dependencies.sh +51 -51
- package/.claude/skills/cfn-loop-validation/orchestrate-cfn-loop.sh +252 -252
- package/.claude/skills/cfn-redis-coordination/agent-recovery.sh +74 -74
- package/.claude/skills/cfn-redis-coordination/get-context.sh +112 -112
- package/.claude/skills/cfn-transparency-middleware/middleware-config.sh +28 -28
- package/.claude/skills/cfn-transparency-middleware/performance-benchmark.sh +78 -78
- package/.claude/skills/cfn-transparency-middleware/test-integration.sh +161 -161
- package/.claude/skills/cfn-transparency-middleware/test-transparency-skill.sh +367 -367
- package/.claude/skills/cfn-transparency-middleware/tests/input-validation.sh +92 -92
- package/.claude/skills/cfn-transparency-middleware/wrap-agent.sh +131 -131
- package/claude-assets/agents/cfn-dev-team/coordinators/handoff-coordinator.md +662 -0
- package/claude-assets/agents/cfn-dev-team/dev-ops/docker-specialist.md +29 -0
- package/claude-assets/cfn-extras/agents/google-sheets-specialist.md +614 -0
- package/claude-assets/commands/cfn/create-handoff.md +224 -0
- package/claude-assets/hooks/cfn-BACKUP_USAGE.md +243 -243
- package/claude-assets/hooks/cfn-invoke-security-validation.sh +69 -69
- package/claude-assets/hooks/cfn-post-edit-cfn-retrospective.sh +78 -78
- package/claude-assets/hooks/cfn-post-edit.config.json +44 -44
- package/claude-assets/hooks/cfn-post-execution/memory-cleanup.sh +19 -19
- package/claude-assets/hooks/cfn-pre-execution/memory-check.sh +19 -19
- package/claude-assets/skills/agent-lifecycle/execute-lifecycle-hook.sh +572 -572
- package/claude-assets/skills/agent-lifecycle/simple-audit.sh +30 -30
- package/claude-assets/skills/cfn-automatic-memory-persistence/persist-agent-output.sh +48 -48
- package/claude-assets/skills/cfn-automatic-memory-persistence/query-agent-history.sh +34 -34
- package/claude-assets/skills/cfn-deliverable-validation/confidence-calculator.sh +261 -261
- package/claude-assets/skills/cfn-expert-update/update-expert.sh +345 -345
- package/claude-assets/skills/cfn-hybrid-routing/check-dependencies.sh +51 -51
- package/claude-assets/skills/cfn-intervention-detector/detect-intervention.sh +110 -110
- package/claude-assets/skills/cfn-intervention-orchestrator/execute-intervention.sh +58 -58
- package/claude-assets/skills/cfn-loop-validation/orchestrate-cfn-loop.sh +252 -252
- package/claude-assets/skills/cfn-loop2-output-processing/process-validator-output.sh +275 -275
- package/claude-assets/skills/cfn-memory-management/check-memory.sh +159 -159
- package/claude-assets/skills/cfn-memory-management/cleanup-memory.sh +196 -196
- package/claude-assets/skills/cfn-node-heap-sizer/task-mode-heap-limiter.sh +325 -325
- package/claude-assets/skills/cfn-playbook-auto-update/auto-update-playbook.sh +85 -85
- package/claude-assets/skills/cfn-redis-coordination/agent-recovery.sh +74 -74
- package/claude-assets/skills/cfn-redis-coordination/get-context.sh +112 -112
- package/claude-assets/skills/cfn-scope-simplifier/simplify-scope.sh +67 -67
- package/claude-assets/skills/cfn-specialist-injection/recommend-specialist.sh +56 -56
- package/claude-assets/skills/cfn-standardized-error-handling/capture-agent-error.sh +86 -86
- package/claude-assets/skills/cfn-standardized-error-handling/test-error-handling.sh +165 -165
- package/claude-assets/skills/cfn-task-config-init/initialize-config.sh +264 -264
- package/claude-assets/skills/cfn-task-decomposition/task-decomposer.sh +278 -278
- package/claude-assets/skills/cfn-transparency-middleware/middleware-config.sh +28 -28
- package/claude-assets/skills/cfn-transparency-middleware/performance-benchmark.sh +78 -78
- package/claude-assets/skills/cfn-transparency-middleware/test-integration.sh +161 -161
- package/claude-assets/skills/cfn-transparency-middleware/test-transparency-skill.sh +367 -367
- package/claude-assets/skills/cfn-transparency-middleware/tests/input-validation.sh +92 -92
- package/claude-assets/skills/cfn-transparency-middleware/wrap-agent.sh +131 -131
- package/claude-assets/skills/docker-build/SKILL.md +96 -203
- package/claude-assets/skills/docker-build/build.sh +73 -73
- package/claude-assets/skills/integration/agent-handoff.sh +494 -0
- package/claude-assets/skills/integration/file-operations.sh +414 -0
- package/claude-assets/skills/workflow-codification/APPROVAL_WORKFLOW.md +806 -0
- package/claude-assets/skills/workflow-codification/COST_TRACKING.md +637 -0
- package/claude-assets/skills/workflow-codification/EDGE_CASE_TRACKING.md +404 -0
- package/claude-assets/skills/workflow-codification/README_PHASE4.md +457 -0
- package/claude-assets/skills/workflow-codification/SKILL.md +110 -0
- package/claude-assets/skills/workflow-codification/analyze-patterns.sh +899 -0
- package/claude-assets/skills/workflow-codification/approval-workflow.sh +514 -0
- package/claude-assets/skills/workflow-codification/generate-skill-update.sh +525 -0
- package/claude-assets/skills/workflow-codification/review-skill.sh +643 -0
- package/claude-assets/skills/workflow-codification/templates/email-notification.txt +114 -0
- package/claude-assets/skills/workflow-codification/templates/slack-notification.md +85 -0
- package/claude-assets/skills/workflow-codification/test-integration.sh +281 -0
- package/claude-assets/skills/workflow-codification/track-cost-savings.sh +445 -0
- package/claude-assets/skills/workflow-codification/track-edge-case.sh +323 -0
- package/dist/agents/agent-loader.js +165 -146
- package/dist/agents/agent-loader.js.map +1 -1
- package/dist/cli/config-manager.js +91 -109
- package/dist/cli/config-manager.js.map +1 -1
- package/dist/integration/DatabaseHandoff.js +507 -0
- package/dist/integration/DatabaseHandoff.js.map +1 -0
- package/dist/integration/StandardAdapter.js +291 -0
- package/dist/integration/StandardAdapter.js.map +1 -0
- package/dist/lib/agent-output-parser.js +518 -0
- package/dist/lib/agent-output-parser.js.map +1 -0
- package/dist/lib/agent-output-validator.js +950 -0
- package/dist/lib/agent-output-validator.js.map +1 -0
- package/dist/lib/artifact-registry.js +443 -0
- package/dist/lib/artifact-registry.js.map +1 -0
- package/dist/lib/config-validator.js +687 -0
- package/dist/lib/config-validator.js.map +1 -0
- package/dist/types/agent-output.js +44 -0
- package/dist/types/agent-output.js.map +1 -0
- package/dist/types/config.js +28 -0
- package/dist/types/config.js.map +1 -0
- package/package.json +2 -1
- package/scripts/artifact-cleanup.sh +392 -0
- package/scripts/build-linux.sh +78 -0
- package/scripts/deploy-production.sh +355 -355
- package/scripts/docker-playwright-fix.sh +311 -311
- package/scripts/docker-rebuild-all-agents.sh +127 -127
- package/scripts/memory-leak-prevention.sh +305 -305
- package/scripts/migrate-artifacts.sh +563 -0
- package/scripts/migrate-yaml-to-json.sh +465 -0
- package/scripts/run-marketing-tests.sh +42 -42
- package/scripts/update_paths.sh +46 -46
|
@@ -1,160 +1,160 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Memory Check Script for CFN Operations
|
|
4
|
-
# Pre-execution hook to ensure sufficient memory is available
|
|
5
|
-
|
|
6
|
-
set -euo pipefail
|
|
7
|
-
|
|
8
|
-
# Configuration
|
|
9
|
-
MIN_FREE_MB=2048 # Minimum 2GB free memory required
|
|
10
|
-
WARNING_THRESHOLD_MB=4096 # Warning at 4GB
|
|
11
|
-
LOG_FILE="/tmp/cfn-memory-check.log"
|
|
12
|
-
|
|
13
|
-
# Colors
|
|
14
|
-
RED='\033[0;31m'
|
|
15
|
-
YELLOW='\033[1;33m'
|
|
16
|
-
GREEN='\033[0;32m'
|
|
17
|
-
NC='\033[0m'
|
|
18
|
-
|
|
19
|
-
log() {
|
|
20
|
-
echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" >> "$LOG_FILE"
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
check_system_memory() {
|
|
24
|
-
local total_mb=0
|
|
25
|
-
local available_mb=0
|
|
26
|
-
local used_mb=0
|
|
27
|
-
|
|
28
|
-
if command -v free &> /dev/null; then
|
|
29
|
-
# Linux/WSL
|
|
30
|
-
local mem_info=$(free -m | awk 'NR==2{print $2,$3,$7}')
|
|
31
|
-
total_mb=$(echo "$mem_info" | cut -d' ' -f1)
|
|
32
|
-
used_mb=$(echo "$mem_info" | cut -d' ' -f2)
|
|
33
|
-
available_mb=$(echo "$mem_info" | cut -d' ' -f3)
|
|
34
|
-
elif command -v vm_stat &> /dev/null; then
|
|
35
|
-
# macOS
|
|
36
|
-
local page_size=$(vm_stat | head -1 | sed 's/.*page size of \([0-9]*\).*/\1/')
|
|
37
|
-
local free_pages=$(vm_stat | awk '/free/ {gsub(/\./, "", $3); print $3}')
|
|
38
|
-
local active_pages=$(vm_stat | awk '/active/ {gsub(/\./, "", $3); print $3}')
|
|
39
|
-
local inactive_pages=$(vm_stat | awk '/inactive/ {gsub(/\./, "", $3); print $3}')
|
|
40
|
-
local wired_pages=$(vm_stat | awk '/wired/ {gsub(/\./, "", $3); print $3}')
|
|
41
|
-
|
|
42
|
-
total_mb=$(((active_pages + inactive_pages + wired_pages + free_pages) * page_size / 1024 / 1024))
|
|
43
|
-
available_mb=$((free_pages * page_size / 1024 / 1024))
|
|
44
|
-
used_mb=$((total_mb - available_mb))
|
|
45
|
-
else
|
|
46
|
-
log "ERROR: Cannot determine system memory (free/vm_stat not available)"
|
|
47
|
-
return 1
|
|
48
|
-
fi
|
|
49
|
-
|
|
50
|
-
echo "${total_mb},${used_mb},${available_mb}"
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
check_claude_processes() {
|
|
54
|
-
local claude_pids=$(pgrep -f "claude" || true)
|
|
55
|
-
local total_claude_memory=0
|
|
56
|
-
local process_count=0
|
|
57
|
-
|
|
58
|
-
if [[ -n "$claude_pids" ]]; then
|
|
59
|
-
while read -r pid; do
|
|
60
|
-
if [[ -n "$pid" ]] && kill -0 "$pid" 2>/dev/null; then
|
|
61
|
-
local rss_kb=$(ps -p "$pid" -o rss= --no-headers 2>/dev/null || echo "0")
|
|
62
|
-
local rss_mb=$((rss_kb / 1024))
|
|
63
|
-
total_claude_memory=$((total_claude_memory + rss_mb))
|
|
64
|
-
process_count=$((process_count + 1))
|
|
65
|
-
fi
|
|
66
|
-
done <<< "$claude_pids"
|
|
67
|
-
fi
|
|
68
|
-
|
|
69
|
-
echo "${process_count},${total_claude_memory}"
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
main() {
|
|
73
|
-
log "Starting memory check for CFN operation"
|
|
74
|
-
|
|
75
|
-
# Check system memory
|
|
76
|
-
local mem_info=$(check_system_memory)
|
|
77
|
-
IFS=',' read -r total_mb used_mb available_mb <<< "$mem_info"
|
|
78
|
-
|
|
79
|
-
echo "System Memory Status:"
|
|
80
|
-
echo " Total: ${total_mb}MB"
|
|
81
|
-
echo " Used: ${used_mb}MB"
|
|
82
|
-
echo " Available: ${available_mb}MB"
|
|
83
|
-
|
|
84
|
-
# Check Claude processes
|
|
85
|
-
local claude_info=$(check_claude_processes)
|
|
86
|
-
IFS=',' read -r claude_count claude_memory_mb <<< "$claude_info"
|
|
87
|
-
|
|
88
|
-
if [[ $claude_count -gt 0 ]]; then
|
|
89
|
-
echo "Claude Processes:"
|
|
90
|
-
echo " Count: $claude_count"
|
|
91
|
-
echo " Memory: ${claude_memory}MB"
|
|
92
|
-
fi
|
|
93
|
-
|
|
94
|
-
# Calculate available memory for new operation
|
|
95
|
-
local available_for_operation=$((available_mb - claude_memory_mb))
|
|
96
|
-
|
|
97
|
-
echo "Available for CFN operation: ${available_for_operation}MB"
|
|
98
|
-
|
|
99
|
-
# Check thresholds
|
|
100
|
-
if [[ $available_for_operation -lt $MIN_FREE_MB ]]; then
|
|
101
|
-
echo -e "${RED}❌ Insufficient memory for CFN operation${NC}"
|
|
102
|
-
echo "Required: ${MIN_FREE_MB}MB, Available: ${available_for_operation}MB"
|
|
103
|
-
echo ""
|
|
104
|
-
echo "Suggestions:"
|
|
105
|
-
echo " 1. Close existing Claude processes: pkill -f claude"
|
|
106
|
-
echo " 2. Free system memory: sudo sync && sudo sysctl vm.drop_caches=3"
|
|
107
|
-
echo " 3. Restart your terminal/shell session"
|
|
108
|
-
echo " 4. Reduce memory requirements with smaller tasks"
|
|
109
|
-
|
|
110
|
-
log "CRITICAL: Insufficient memory - Required: ${MIN_FREE_MB}MB, Available: ${available_for_operation}MB"
|
|
111
|
-
return 1
|
|
112
|
-
elif [[ $available_for_operation -lt $WARNING_THRESHOLD_MB ]]; then
|
|
113
|
-
echo -e "${YELLOW}⚠️ Low memory warning${NC}"
|
|
114
|
-
echo "Available: ${available_for_operation}MB (Recommended: ${WARNING_THRESHOLD_MB}MB+)"
|
|
115
|
-
echo "Consider closing other applications for optimal performance"
|
|
116
|
-
|
|
117
|
-
log "WARNING: Low memory - Available: ${available_for_operation}MB"
|
|
118
|
-
else
|
|
119
|
-
echo -e "${GREEN}✅ Sufficient memory available${NC}"
|
|
120
|
-
log "OK: Sufficient memory - Available: ${available_for_operation}MB"
|
|
121
|
-
fi
|
|
122
|
-
|
|
123
|
-
# Check for memory leak indicators
|
|
124
|
-
if [[ $claude_count -gt 0 ]]; then
|
|
125
|
-
local avg_claude_memory=$((claude_memory_mb / claude_count))
|
|
126
|
-
if [[ $avg_claude_memory -gt 4096 ]]; then
|
|
127
|
-
echo -e "${YELLOW}⚠️ High Claude memory usage detected${NC}"
|
|
128
|
-
echo "Average per process: ${avg_claude_memory}MB"
|
|
129
|
-
echo "Consider restarting Claude processes"
|
|
130
|
-
|
|
131
|
-
log "WARNING: High Claude memory usage - Average: ${avg_claude_memory}MB"
|
|
132
|
-
fi
|
|
133
|
-
fi
|
|
134
|
-
|
|
135
|
-
# Check WSL-specific issues
|
|
136
|
-
if [[ -f /proc/version ]] && grep -qi microsoft /proc/version; then
|
|
137
|
-
echo "WSL Environment Detected:"
|
|
138
|
-
|
|
139
|
-
# Check WSL memory limits
|
|
140
|
-
if [[ -f /proc/meminfo ]]; then
|
|
141
|
-
local wsl_total=$(grep MemTotal /proc/meminfo | awk '{print int($2/1024)}')
|
|
142
|
-
if [[ $wsl_total -lt 8192 ]]; then
|
|
143
|
-
echo -e "${YELLOW}⚠️ Low WSL memory limit: ${wsl_total}MB${NC}"
|
|
144
|
-
echo "Consider increasing WSL memory in .wslconfig"
|
|
145
|
-
echo ""
|
|
146
|
-
echo "Create %USERPROFILE%\\.wslconfig with:"
|
|
147
|
-
echo "[wsl2]"
|
|
148
|
-
echo "memory=16GB"
|
|
149
|
-
echo "swap=4GB"
|
|
150
|
-
fi
|
|
151
|
-
fi
|
|
152
|
-
fi
|
|
153
|
-
|
|
154
|
-
echo ""
|
|
155
|
-
echo "Memory check completed successfully"
|
|
156
|
-
return 0
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
# Run main function
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Memory Check Script for CFN Operations
|
|
4
|
+
# Pre-execution hook to ensure sufficient memory is available
|
|
5
|
+
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
|
|
8
|
+
# Configuration
|
|
9
|
+
MIN_FREE_MB=2048 # Minimum 2GB free memory required
|
|
10
|
+
WARNING_THRESHOLD_MB=4096 # Warning at 4GB
|
|
11
|
+
LOG_FILE="/tmp/cfn-memory-check.log"
|
|
12
|
+
|
|
13
|
+
# Colors
|
|
14
|
+
RED='\033[0;31m'
|
|
15
|
+
YELLOW='\033[1;33m'
|
|
16
|
+
GREEN='\033[0;32m'
|
|
17
|
+
NC='\033[0m'
|
|
18
|
+
|
|
19
|
+
log() {
|
|
20
|
+
echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" >> "$LOG_FILE"
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
check_system_memory() {
|
|
24
|
+
local total_mb=0
|
|
25
|
+
local available_mb=0
|
|
26
|
+
local used_mb=0
|
|
27
|
+
|
|
28
|
+
if command -v free &> /dev/null; then
|
|
29
|
+
# Linux/WSL
|
|
30
|
+
local mem_info=$(free -m | awk 'NR==2{print $2,$3,$7}')
|
|
31
|
+
total_mb=$(echo "$mem_info" | cut -d' ' -f1)
|
|
32
|
+
used_mb=$(echo "$mem_info" | cut -d' ' -f2)
|
|
33
|
+
available_mb=$(echo "$mem_info" | cut -d' ' -f3)
|
|
34
|
+
elif command -v vm_stat &> /dev/null; then
|
|
35
|
+
# macOS
|
|
36
|
+
local page_size=$(vm_stat | head -1 | sed 's/.*page size of \([0-9]*\).*/\1/')
|
|
37
|
+
local free_pages=$(vm_stat | awk '/free/ {gsub(/\./, "", $3); print $3}')
|
|
38
|
+
local active_pages=$(vm_stat | awk '/active/ {gsub(/\./, "", $3); print $3}')
|
|
39
|
+
local inactive_pages=$(vm_stat | awk '/inactive/ {gsub(/\./, "", $3); print $3}')
|
|
40
|
+
local wired_pages=$(vm_stat | awk '/wired/ {gsub(/\./, "", $3); print $3}')
|
|
41
|
+
|
|
42
|
+
total_mb=$(((active_pages + inactive_pages + wired_pages + free_pages) * page_size / 1024 / 1024))
|
|
43
|
+
available_mb=$((free_pages * page_size / 1024 / 1024))
|
|
44
|
+
used_mb=$((total_mb - available_mb))
|
|
45
|
+
else
|
|
46
|
+
log "ERROR: Cannot determine system memory (free/vm_stat not available)"
|
|
47
|
+
return 1
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
echo "${total_mb},${used_mb},${available_mb}"
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
check_claude_processes() {
|
|
54
|
+
local claude_pids=$(pgrep -f "claude" || true)
|
|
55
|
+
local total_claude_memory=0
|
|
56
|
+
local process_count=0
|
|
57
|
+
|
|
58
|
+
if [[ -n "$claude_pids" ]]; then
|
|
59
|
+
while read -r pid; do
|
|
60
|
+
if [[ -n "$pid" ]] && kill -0 "$pid" 2>/dev/null; then
|
|
61
|
+
local rss_kb=$(ps -p "$pid" -o rss= --no-headers 2>/dev/null || echo "0")
|
|
62
|
+
local rss_mb=$((rss_kb / 1024))
|
|
63
|
+
total_claude_memory=$((total_claude_memory + rss_mb))
|
|
64
|
+
process_count=$((process_count + 1))
|
|
65
|
+
fi
|
|
66
|
+
done <<< "$claude_pids"
|
|
67
|
+
fi
|
|
68
|
+
|
|
69
|
+
echo "${process_count},${total_claude_memory}"
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
main() {
|
|
73
|
+
log "Starting memory check for CFN operation"
|
|
74
|
+
|
|
75
|
+
# Check system memory
|
|
76
|
+
local mem_info=$(check_system_memory)
|
|
77
|
+
IFS=',' read -r total_mb used_mb available_mb <<< "$mem_info"
|
|
78
|
+
|
|
79
|
+
echo "System Memory Status:"
|
|
80
|
+
echo " Total: ${total_mb}MB"
|
|
81
|
+
echo " Used: ${used_mb}MB"
|
|
82
|
+
echo " Available: ${available_mb}MB"
|
|
83
|
+
|
|
84
|
+
# Check Claude processes
|
|
85
|
+
local claude_info=$(check_claude_processes)
|
|
86
|
+
IFS=',' read -r claude_count claude_memory_mb <<< "$claude_info"
|
|
87
|
+
|
|
88
|
+
if [[ $claude_count -gt 0 ]]; then
|
|
89
|
+
echo "Claude Processes:"
|
|
90
|
+
echo " Count: $claude_count"
|
|
91
|
+
echo " Memory: ${claude_memory}MB"
|
|
92
|
+
fi
|
|
93
|
+
|
|
94
|
+
# Calculate available memory for new operation
|
|
95
|
+
local available_for_operation=$((available_mb - claude_memory_mb))
|
|
96
|
+
|
|
97
|
+
echo "Available for CFN operation: ${available_for_operation}MB"
|
|
98
|
+
|
|
99
|
+
# Check thresholds
|
|
100
|
+
if [[ $available_for_operation -lt $MIN_FREE_MB ]]; then
|
|
101
|
+
echo -e "${RED}❌ Insufficient memory for CFN operation${NC}"
|
|
102
|
+
echo "Required: ${MIN_FREE_MB}MB, Available: ${available_for_operation}MB"
|
|
103
|
+
echo ""
|
|
104
|
+
echo "Suggestions:"
|
|
105
|
+
echo " 1. Close existing Claude processes: pkill -f claude"
|
|
106
|
+
echo " 2. Free system memory: sudo sync && sudo sysctl vm.drop_caches=3"
|
|
107
|
+
echo " 3. Restart your terminal/shell session"
|
|
108
|
+
echo " 4. Reduce memory requirements with smaller tasks"
|
|
109
|
+
|
|
110
|
+
log "CRITICAL: Insufficient memory - Required: ${MIN_FREE_MB}MB, Available: ${available_for_operation}MB"
|
|
111
|
+
return 1
|
|
112
|
+
elif [[ $available_for_operation -lt $WARNING_THRESHOLD_MB ]]; then
|
|
113
|
+
echo -e "${YELLOW}⚠️ Low memory warning${NC}"
|
|
114
|
+
echo "Available: ${available_for_operation}MB (Recommended: ${WARNING_THRESHOLD_MB}MB+)"
|
|
115
|
+
echo "Consider closing other applications for optimal performance"
|
|
116
|
+
|
|
117
|
+
log "WARNING: Low memory - Available: ${available_for_operation}MB"
|
|
118
|
+
else
|
|
119
|
+
echo -e "${GREEN}✅ Sufficient memory available${NC}"
|
|
120
|
+
log "OK: Sufficient memory - Available: ${available_for_operation}MB"
|
|
121
|
+
fi
|
|
122
|
+
|
|
123
|
+
# Check for memory leak indicators
|
|
124
|
+
if [[ $claude_count -gt 0 ]]; then
|
|
125
|
+
local avg_claude_memory=$((claude_memory_mb / claude_count))
|
|
126
|
+
if [[ $avg_claude_memory -gt 4096 ]]; then
|
|
127
|
+
echo -e "${YELLOW}⚠️ High Claude memory usage detected${NC}"
|
|
128
|
+
echo "Average per process: ${avg_claude_memory}MB"
|
|
129
|
+
echo "Consider restarting Claude processes"
|
|
130
|
+
|
|
131
|
+
log "WARNING: High Claude memory usage - Average: ${avg_claude_memory}MB"
|
|
132
|
+
fi
|
|
133
|
+
fi
|
|
134
|
+
|
|
135
|
+
# Check WSL-specific issues
|
|
136
|
+
if [[ -f /proc/version ]] && grep -qi microsoft /proc/version; then
|
|
137
|
+
echo "WSL Environment Detected:"
|
|
138
|
+
|
|
139
|
+
# Check WSL memory limits
|
|
140
|
+
if [[ -f /proc/meminfo ]]; then
|
|
141
|
+
local wsl_total=$(grep MemTotal /proc/meminfo | awk '{print int($2/1024)}')
|
|
142
|
+
if [[ $wsl_total -lt 8192 ]]; then
|
|
143
|
+
echo -e "${YELLOW}⚠️ Low WSL memory limit: ${wsl_total}MB${NC}"
|
|
144
|
+
echo "Consider increasing WSL memory in .wslconfig"
|
|
145
|
+
echo ""
|
|
146
|
+
echo "Create %USERPROFILE%\\.wslconfig with:"
|
|
147
|
+
echo "[wsl2]"
|
|
148
|
+
echo "memory=16GB"
|
|
149
|
+
echo "swap=4GB"
|
|
150
|
+
fi
|
|
151
|
+
fi
|
|
152
|
+
fi
|
|
153
|
+
|
|
154
|
+
echo ""
|
|
155
|
+
echo "Memory check completed successfully"
|
|
156
|
+
return 0
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
# Run main function
|
|
160
160
|
main "$@"
|