claude-flow-novice 1.6.2 → 1.6.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.
Files changed (32) hide show
  1. package/.claude/settings.json +4 -3
  2. package/.claude-flow-novice/dist/src/api/auth-service.js +84 -38
  3. package/.claude-flow-novice/dist/src/api/auth-service.js.map +1 -1
  4. package/.claude-flow-novice/dist/src/monitoring/apm/apm-integration.js +719 -0
  5. package/.claude-flow-novice/dist/src/monitoring/apm/apm-integration.js.map +1 -0
  6. package/.claude-flow-novice/dist/src/monitoring/apm/datadog-collector.js +363 -0
  7. package/.claude-flow-novice/dist/src/monitoring/apm/datadog-collector.js.map +1 -0
  8. package/.claude-flow-novice/dist/src/monitoring/apm/index.js +97 -0
  9. package/.claude-flow-novice/dist/src/monitoring/apm/index.js.map +1 -0
  10. package/.claude-flow-novice/dist/src/monitoring/apm/newrelic-collector.js +384 -0
  11. package/.claude-flow-novice/dist/src/monitoring/apm/newrelic-collector.js.map +1 -0
  12. package/.claude-flow-novice/dist/src/monitoring/apm/performance-optimizer.js +612 -0
  13. package/.claude-flow-novice/dist/src/monitoring/apm/performance-optimizer.js.map +1 -0
  14. package/.claude-flow-novice/dist/src/monitoring/metrics-collector.js +282 -0
  15. package/.claude-flow-novice/dist/src/monitoring/metrics-collector.js.map +1 -0
  16. package/.claude-flow-novice/dist/src/web/api/apm-routes.js +355 -0
  17. package/.claude-flow-novice/dist/src/web/api/apm-routes.js.map +1 -0
  18. package/.claude-flow-novice/dist/src/web/frontend/src/utils/security.js +425 -0
  19. package/.claude-flow-novice/dist/src/web/frontend/src/utils/security.js.map +1 -0
  20. package/.claude-flow-novice/dist/src/web/security/security-middleware.js +379 -0
  21. package/.claude-flow-novice/dist/src/web/security/security-middleware.js.map +1 -0
  22. package/.claude-flow-novice/dist/src/web/websocket/apm-websocket-handler.js +441 -0
  23. package/.claude-flow-novice/dist/src/web/websocket/apm-websocket-handler.js.map +1 -0
  24. package/.claude-flow-novice/dist/src/web/websocket/websocket-manager.js +255 -1
  25. package/.claude-flow-novice/dist/src/web/websocket/websocket-manager.js.map +1 -1
  26. package/AGENT_PERFORMANCE_GUIDELINES.md +88 -0
  27. package/CLAUDE.md +31 -3
  28. package/MEMORY_LEAK_ROOT_CAUSE.md +149 -0
  29. package/package.json +4 -2
  30. package/scripts/monitor-loop.sh +65 -0
  31. package/scripts/monitor-memory.sh +47 -0
  32. package/scripts/monitor.py +43 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-flow-novice",
3
- "version": "1.6.2",
3
+ "version": "1.6.3",
4
4
  "description": "Standalone Claude Flow for beginners - AI agent orchestration made easy with enhanced TDD testing pipeline. Enhanced init command creates complete agent system, MCP configuration with 30 essential tools, and automated hooks with single-file testing, real-time coverage analysis, and advanced validation. Fully standalone with zero external dependencies, complete project setup in one command.",
5
5
  "mcpName": "io.github.ruvnet/claude-flow",
6
6
  "main": ".claude-flow-novice/dist/index.js",
@@ -212,7 +212,9 @@
212
212
  "README.md",
213
213
  "README-NPM.md",
214
214
  "LICENSE",
215
- "CHANGELOG.md"
215
+ "CHANGELOG.md",
216
+ "AGENT_PERFORMANCE_GUIDELINES.md",
217
+ "MEMORY_LEAK_ROOT_CAUSE.md"
216
218
  ],
217
219
  "exports": {
218
220
  ".": "./.claude-flow-novice/dist/index.js",
@@ -0,0 +1,65 @@
1
+ #!/bin/bash
2
+ # Monitor memory every 30 seconds, 20 iterations
3
+
4
+ LOG_FILE="memory-monitor-$(date +%Y%m%d-%H%M%S).log"
5
+ ITERATIONS=20
6
+ INTERVAL=30
7
+
8
+ echo "=== Memory Monitor Started ===" | tee "$LOG_FILE"
9
+ echo "Monitoring for $((ITERATIONS * INTERVAL)) seconds ($ITERATIONS checks)" | tee -a "$LOG_FILE"
10
+ echo "Timestamp: $(date)" | tee -a "$LOG_FILE"
11
+ echo "" | tee -a "$LOG_FILE"
12
+
13
+ for i in $(seq 1 $ITERATIONS); do
14
+ TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S')
15
+
16
+ # Total memory usage
17
+ TOTAL_MEM=$(ps aux | grep -E "(claude|node)" | grep -v grep | awk '{sum+=$6} END {printf "%.1f", sum/1024}')
18
+
19
+ # Node process count
20
+ NODE_COUNT=$(ps aux | grep node | grep -v grep | grep -v snapfuse | wc -l)
21
+
22
+ # Claude process count
23
+ CLAUDE_COUNT=$(ps aux | grep claude | grep -v grep | wc -l)
24
+
25
+ # Zombie processes
26
+ ZOMBIE_COUNT=$(ps aux | grep "<defunct>" | grep -v grep | wc -l)
27
+
28
+ # Find processes (memory bombs)
29
+ FIND_COUNT=$(ps aux | grep "find /mnt/c" | grep -v grep | wc -l)
30
+
31
+ # Hook processes
32
+ HOOK_COUNT=$(ps aux | grep "npx claude-flow-novice hooks" | grep -v grep | wc -l)
33
+
34
+ echo "[$i/$ITERATIONS] [$TIMESTAMP] MEM: ${TOTAL_MEM}MB | Node: $NODE_COUNT | Claude: $CLAUDE_COUNT | Zombies: $ZOMBIE_COUNT | Find: $FIND_COUNT | Hooks: $HOOK_COUNT" | tee -a "$LOG_FILE"
35
+
36
+ # Alerts
37
+ if (( $(echo "$TOTAL_MEM > 10000" | bc -l 2>/dev/null || echo 0) )); then
38
+ echo " ⚠️ WARNING: Memory usage exceeds 10GB!" | tee -a "$LOG_FILE"
39
+ fi
40
+
41
+ if [ "$NODE_COUNT" -gt 20 ]; then
42
+ echo " ⚠️ WARNING: $NODE_COUNT node processes (orphaned agents?)" | tee -a "$LOG_FILE"
43
+ fi
44
+
45
+ if [ "$FIND_COUNT" -gt 0 ]; then
46
+ echo " 🔴 CRITICAL: $FIND_COUNT find commands on /mnt/c (MEMORY BOMB!)" | tee -a "$LOG_FILE"
47
+ fi
48
+
49
+ if [ "$ZOMBIE_COUNT" -gt 0 ]; then
50
+ echo " 💀 ZOMBIE: $ZOMBIE_COUNT zombie processes detected" | tee -a "$LOG_FILE"
51
+ fi
52
+
53
+ if [ "$HOOK_COUNT" -gt 5 ]; then
54
+ echo " 🔁 RECURSION: $HOOK_COUNT hook processes (possible recursion!)" | tee -a "$LOG_FILE"
55
+ fi
56
+
57
+ # Don't sleep on last iteration
58
+ if [ $i -lt $ITERATIONS ]; then
59
+ sleep $INTERVAL
60
+ fi
61
+ done
62
+
63
+ echo "" | tee -a "$LOG_FILE"
64
+ echo "=== Monitoring Complete ===" | tee -a "$LOG_FILE"
65
+ echo "Log saved to: $LOG_FILE" | tee -a "$LOG_FILE"
@@ -0,0 +1,47 @@
1
+ #!/bin/bash
2
+ # Memory monitoring script for agent swarms
3
+
4
+ LOG_FILE="memory-monitor.log"
5
+ INTERVAL=5 # seconds
6
+
7
+ echo "=== Memory Monitor Started ===" | tee -a "$LOG_FILE"
8
+ echo "Timestamp: $(date)" | tee -a "$LOG_FILE"
9
+ echo "" | tee -a "$LOG_FILE"
10
+
11
+ while true; do
12
+ TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S')
13
+
14
+ # Total memory usage
15
+ TOTAL_MEM=$(ps aux | grep -E "(claude|node)" | grep -v grep | awk '{sum+=$6} END {print sum/1024}')
16
+
17
+ # Node process count
18
+ NODE_COUNT=$(ps aux | grep node | grep -v grep | grep -v snapfuse | wc -l)
19
+
20
+ # Claude process count
21
+ CLAUDE_COUNT=$(ps aux | grep claude | grep -v grep | wc -l)
22
+
23
+ # Zombie processes
24
+ ZOMBIE_COUNT=$(ps aux | grep "<defunct>" | grep -v grep | wc -l)
25
+
26
+ # Find processes (stuck)
27
+ FIND_COUNT=$(ps aux | grep "find /mnt/c" | grep -v grep | wc -l)
28
+
29
+ echo "[$TIMESTAMP] MEM: ${TOTAL_MEM}MB | Node: $NODE_COUNT | Claude: $CLAUDE_COUNT | Zombies: $ZOMBIE_COUNT | Find: $FIND_COUNT" | tee -a "$LOG_FILE"
30
+
31
+ # Alert if memory exceeds 10GB
32
+ if (( $(echo "$TOTAL_MEM > 10000" | bc -l) )); then
33
+ echo "⚠️ WARNING: Memory usage exceeds 10GB!" | tee -a "$LOG_FILE"
34
+ fi
35
+
36
+ # Alert if too many node processes
37
+ if [ "$NODE_COUNT" -gt 20 ]; then
38
+ echo "⚠️ WARNING: $NODE_COUNT node processes detected (orphaned agents?)" | tee -a "$LOG_FILE"
39
+ fi
40
+
41
+ # Alert if find commands stuck
42
+ if [ "$FIND_COUNT" -gt 0 ]; then
43
+ echo "🔴 CRITICAL: $FIND_COUNT find commands running on /mnt/c (memory bomb!)" | tee -a "$LOG_FILE"
44
+ fi
45
+
46
+ sleep $INTERVAL
47
+ done
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env python3
2
+ import subprocess
3
+ import time
4
+ from datetime import datetime
5
+
6
+ ITERATIONS = 20
7
+ INTERVAL = 30
8
+
9
+ print("=== Memory Monitor Started ===")
10
+ print(f"Monitoring for {ITERATIONS * INTERVAL} seconds ({ITERATIONS} checks)")
11
+ print(f"Timestamp: {datetime.now()}")
12
+ print()
13
+
14
+ for i in range(1, ITERATIONS + 1):
15
+ timestamp = datetime.now().strftime('%H:%M:%S')
16
+
17
+ # Total memory
18
+ mem_cmd = "ps aux | grep -E '(claude|node)' | grep -v grep | awk '{sum+=$6} END {printf \"%.1f\", sum/1024}'"
19
+ total_mem = subprocess.getoutput(mem_cmd)
20
+
21
+ # Process counts
22
+ node_count = subprocess.getoutput("ps aux | grep node | grep -v grep | grep -v snapfuse | wc -l").strip()
23
+ claude_count = subprocess.getoutput("ps aux | grep claude | grep -v grep | wc -l").strip()
24
+ zombie_count = subprocess.getoutput("ps aux | grep '<defunct>' | grep -v grep | wc -l").strip()
25
+ find_count = subprocess.getoutput("ps aux | grep 'find /mnt/c' | grep -v grep | wc -l").strip()
26
+
27
+ print(f"[{i}/{ITERATIONS}] [{timestamp}] MEM: {total_mem}MB | Node: {node_count} | Claude: {claude_count} | Zombies: {zombie_count} | Find: {find_count}")
28
+
29
+ # Alerts
30
+ if total_mem and float(total_mem) > 10000:
31
+ print(" ⚠️ WARNING: Memory usage exceeds 10GB!")
32
+
33
+ if find_count and int(find_count) > 0:
34
+ print(f" 🔴 CRITICAL: {find_count} find commands on /mnt/c (MEMORY BOMB!)")
35
+
36
+ if zombie_count and int(zombie_count) > 0:
37
+ print(f" 💀 ZOMBIE: {zombie_count} zombie processes detected")
38
+
39
+ if i < ITERATIONS:
40
+ time.sleep(INTERVAL)
41
+
42
+ print()
43
+ print("=== Monitoring Complete ===")