agentic-qe 1.4.0 → 1.4.2

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 (157) hide show
  1. package/CHANGELOG.md +234 -0
  2. package/README.md +18 -85
  3. package/dist/agents/index.d.ts.map +1 -1
  4. package/dist/agents/index.js +14 -15
  5. package/dist/agents/index.js.map +1 -1
  6. package/dist/cli/commands/config/set.d.ts.map +1 -1
  7. package/dist/cli/commands/config/set.js +10 -2
  8. package/dist/cli/commands/config/set.js.map +1 -1
  9. package/dist/cli/commands/init.d.ts.map +1 -1
  10. package/dist/cli/commands/init.js +26 -3
  11. package/dist/cli/commands/init.js.map +1 -1
  12. package/dist/core/Agent.d.ts +1 -1
  13. package/dist/core/Agent.d.ts.map +1 -1
  14. package/dist/core/Agent.js +2 -2
  15. package/dist/core/Agent.js.map +1 -1
  16. package/dist/core/MemoryManager.d.ts.map +1 -1
  17. package/dist/core/MemoryManager.js +4 -1
  18. package/dist/core/MemoryManager.js.map +1 -1
  19. package/dist/core/hooks/RollbackManager.js +2 -2
  20. package/dist/core/hooks/RollbackManager.js.map +1 -1
  21. package/dist/learning/LearningEngine.d.ts +21 -4
  22. package/dist/learning/LearningEngine.d.ts.map +1 -1
  23. package/dist/learning/LearningEngine.js +118 -131
  24. package/dist/learning/LearningEngine.js.map +1 -1
  25. package/dist/learning/LearningPersistenceAdapter.d.ts +84 -0
  26. package/dist/learning/LearningPersistenceAdapter.d.ts.map +1 -0
  27. package/dist/learning/LearningPersistenceAdapter.js +202 -0
  28. package/dist/learning/LearningPersistenceAdapter.js.map +1 -0
  29. package/dist/learning/index.d.ts +1 -0
  30. package/dist/learning/index.d.ts.map +1 -1
  31. package/dist/learning/index.js +1 -0
  32. package/dist/learning/index.js.map +1 -1
  33. package/dist/mcp/handlers/analysis/coverage-analyze-sublinear-handler.d.ts.map +1 -1
  34. package/dist/mcp/handlers/analysis/coverage-analyze-sublinear-handler.js +3 -7
  35. package/dist/mcp/handlers/analysis/coverage-analyze-sublinear-handler.js.map +1 -1
  36. package/dist/mcp/handlers/analysis/coverage-gaps-detect-handler.d.ts.map +1 -1
  37. package/dist/mcp/handlers/analysis/coverage-gaps-detect-handler.js +3 -7
  38. package/dist/mcp/handlers/analysis/coverage-gaps-detect-handler.js.map +1 -1
  39. package/dist/mcp/handlers/analysis/performance-benchmark-run-handler.d.ts.map +1 -1
  40. package/dist/mcp/handlers/analysis/performance-benchmark-run-handler.js +3 -7
  41. package/dist/mcp/handlers/analysis/performance-benchmark-run-handler.js.map +1 -1
  42. package/dist/mcp/handlers/analysis/performance-monitor-realtime-handler.d.ts.map +1 -1
  43. package/dist/mcp/handlers/analysis/performance-monitor-realtime-handler.js +3 -7
  44. package/dist/mcp/handlers/analysis/performance-monitor-realtime-handler.js.map +1 -1
  45. package/dist/mcp/handlers/analysis/security-scan-comprehensive-handler.d.ts.map +1 -1
  46. package/dist/mcp/handlers/analysis/security-scan-comprehensive-handler.js +3 -7
  47. package/dist/mcp/handlers/analysis/security-scan-comprehensive-handler.js.map +1 -1
  48. package/dist/mcp/handlers/base-handler.d.ts +30 -0
  49. package/dist/mcp/handlers/base-handler.d.ts.map +1 -1
  50. package/dist/mcp/handlers/base-handler.js +42 -0
  51. package/dist/mcp/handlers/base-handler.js.map +1 -1
  52. package/dist/mcp/handlers/coordination/event-emit.d.ts.map +1 -1
  53. package/dist/mcp/handlers/coordination/event-emit.js +4 -10
  54. package/dist/mcp/handlers/coordination/event-emit.js.map +1 -1
  55. package/dist/mcp/handlers/coordination/event-subscribe.d.ts.map +1 -1
  56. package/dist/mcp/handlers/coordination/event-subscribe.js +3 -9
  57. package/dist/mcp/handlers/coordination/event-subscribe.js.map +1 -1
  58. package/dist/mcp/handlers/coordination/task-status.d.ts.map +1 -1
  59. package/dist/mcp/handlers/coordination/task-status.js +4 -10
  60. package/dist/mcp/handlers/coordination/task-status.js.map +1 -1
  61. package/dist/mcp/handlers/coordination/workflow-checkpoint.d.ts.map +1 -1
  62. package/dist/mcp/handlers/coordination/workflow-checkpoint.js +4 -10
  63. package/dist/mcp/handlers/coordination/workflow-checkpoint.js.map +1 -1
  64. package/dist/mcp/handlers/coordination/workflow-create.d.ts.map +1 -1
  65. package/dist/mcp/handlers/coordination/workflow-create.js +4 -10
  66. package/dist/mcp/handlers/coordination/workflow-create.js.map +1 -1
  67. package/dist/mcp/handlers/coordination/workflow-execute.d.ts.map +1 -1
  68. package/dist/mcp/handlers/coordination/workflow-execute.js +4 -10
  69. package/dist/mcp/handlers/coordination/workflow-execute.js.map +1 -1
  70. package/dist/mcp/handlers/coordination/workflow-resume.d.ts.map +1 -1
  71. package/dist/mcp/handlers/coordination/workflow-resume.js +4 -10
  72. package/dist/mcp/handlers/coordination/workflow-resume.js.map +1 -1
  73. package/dist/mcp/handlers/memory/memory-backup.d.ts.map +1 -1
  74. package/dist/mcp/handlers/memory/memory-backup.js +3 -7
  75. package/dist/mcp/handlers/memory/memory-backup.js.map +1 -1
  76. package/dist/mcp/handlers/memory/memory-query.d.ts.map +1 -1
  77. package/dist/mcp/handlers/memory/memory-query.js +8 -8
  78. package/dist/mcp/handlers/memory/memory-query.js.map +1 -1
  79. package/dist/mcp/handlers/memory/memory-retrieve.d.ts.map +1 -1
  80. package/dist/mcp/handlers/memory/memory-retrieve.js +3 -7
  81. package/dist/mcp/handlers/memory/memory-retrieve.js.map +1 -1
  82. package/dist/mcp/handlers/memory/memory-share.d.ts.map +1 -1
  83. package/dist/mcp/handlers/memory/memory-share.js +3 -7
  84. package/dist/mcp/handlers/memory/memory-share.js.map +1 -1
  85. package/dist/mcp/handlers/memory/memory-store.d.ts.map +1 -1
  86. package/dist/mcp/handlers/memory/memory-store.js +3 -7
  87. package/dist/mcp/handlers/memory/memory-store.js.map +1 -1
  88. package/dist/mcp/handlers/prediction/deployment-readiness-check.d.ts.map +1 -1
  89. package/dist/mcp/handlers/prediction/deployment-readiness-check.js +4 -8
  90. package/dist/mcp/handlers/prediction/deployment-readiness-check.js.map +1 -1
  91. package/dist/mcp/handlers/prediction/flaky-test-detect.d.ts.map +1 -1
  92. package/dist/mcp/handlers/prediction/flaky-test-detect.js +4 -8
  93. package/dist/mcp/handlers/prediction/flaky-test-detect.js.map +1 -1
  94. package/dist/mcp/handlers/prediction/predict-defects-ai.d.ts.map +1 -1
  95. package/dist/mcp/handlers/prediction/predict-defects-ai.js +4 -8
  96. package/dist/mcp/handlers/prediction/predict-defects-ai.js.map +1 -1
  97. package/dist/mcp/handlers/prediction/regression-risk-analyze.d.ts.map +1 -1
  98. package/dist/mcp/handlers/prediction/regression-risk-analyze.js +4 -8
  99. package/dist/mcp/handlers/prediction/regression-risk-analyze.js.map +1 -1
  100. package/dist/mcp/handlers/prediction/visual-test-regression.d.ts.map +1 -1
  101. package/dist/mcp/handlers/prediction/visual-test-regression.js +4 -8
  102. package/dist/mcp/handlers/prediction/visual-test-regression.js.map +1 -1
  103. package/dist/mcp/handlers/quality/quality-decision-make.d.ts.map +1 -1
  104. package/dist/mcp/handlers/quality/quality-decision-make.js +9 -19
  105. package/dist/mcp/handlers/quality/quality-decision-make.js.map +1 -1
  106. package/dist/mcp/handlers/quality/quality-gate-execute.d.ts.map +1 -1
  107. package/dist/mcp/handlers/quality/quality-gate-execute.js +10 -22
  108. package/dist/mcp/handlers/quality/quality-gate-execute.js.map +1 -1
  109. package/dist/mcp/handlers/quality/quality-policy-check.d.ts.map +1 -1
  110. package/dist/mcp/handlers/quality/quality-policy-check.js +5 -15
  111. package/dist/mcp/handlers/quality/quality-policy-check.js.map +1 -1
  112. package/dist/mcp/handlers/quality/quality-risk-assess.d.ts.map +1 -1
  113. package/dist/mcp/handlers/quality/quality-risk-assess.js +5 -15
  114. package/dist/mcp/handlers/quality/quality-risk-assess.js.map +1 -1
  115. package/dist/mcp/handlers/quality/quality-validate-metrics.d.ts.map +1 -1
  116. package/dist/mcp/handlers/quality/quality-validate-metrics.js +4 -14
  117. package/dist/mcp/handlers/quality/quality-validate-metrics.js.map +1 -1
  118. package/dist/mcp/handlers/test/test-coverage-detailed.d.ts.map +1 -1
  119. package/dist/mcp/handlers/test/test-coverage-detailed.js +8 -12
  120. package/dist/mcp/handlers/test/test-coverage-detailed.js.map +1 -1
  121. package/dist/mcp/handlers/test/test-execute-parallel.d.ts.map +1 -1
  122. package/dist/mcp/handlers/test/test-execute-parallel.js +8 -12
  123. package/dist/mcp/handlers/test/test-execute-parallel.js.map +1 -1
  124. package/dist/mcp/handlers/test/test-generate-enhanced.d.ts.map +1 -1
  125. package/dist/mcp/handlers/test/test-generate-enhanced.js +4 -8
  126. package/dist/mcp/handlers/test/test-generate-enhanced.js.map +1 -1
  127. package/dist/mcp/handlers/test/test-optimize-sublinear.d.ts.map +1 -1
  128. package/dist/mcp/handlers/test/test-optimize-sublinear.js +8 -12
  129. package/dist/mcp/handlers/test/test-optimize-sublinear.js.map +1 -1
  130. package/dist/mcp/handlers/test/test-report-comprehensive.d.ts.map +1 -1
  131. package/dist/mcp/handlers/test/test-report-comprehensive.js +4 -8
  132. package/dist/mcp/handlers/test/test-report-comprehensive.js.map +1 -1
  133. package/dist/mcp/services/AgentRegistry.d.ts.map +1 -1
  134. package/dist/mcp/services/AgentRegistry.js +16 -4
  135. package/dist/mcp/services/AgentRegistry.js.map +1 -1
  136. package/dist/utils/Database.d.ts.map +1 -1
  137. package/dist/utils/Database.js +17 -4
  138. package/dist/utils/Database.js.map +1 -1
  139. package/dist/utils/__mocks__/Logger.d.ts.map +1 -1
  140. package/dist/utils/__mocks__/Logger.js +2 -0
  141. package/dist/utils/__mocks__/Logger.js.map +1 -1
  142. package/package.json +11 -10
  143. package/.claude/aqe-fleet.json +0 -47
  144. package/.claude/helpers/checkpoint-manager.sh +0 -251
  145. package/.claude/helpers/github-safe.js +0 -106
  146. package/.claude/helpers/github-setup.sh +0 -28
  147. package/.claude/helpers/quick-start.sh +0 -19
  148. package/.claude/helpers/setup-mcp.sh +0 -18
  149. package/.claude/helpers/standard-checkpoint-hooks.sh +0 -179
  150. package/.claude/settings.json +0 -153
  151. package/.claude/settings.local.json +0 -10
  152. package/.claude/statusline-command.sh +0 -176
  153. package/README.md.backup-20251026 +0 -1366
  154. package/dist/migrations/001_add_learning_tables.d.ts +0 -63
  155. package/dist/migrations/001_add_learning_tables.d.ts.map +0 -1
  156. package/dist/migrations/001_add_learning_tables.js +0 -287
  157. package/dist/migrations/001_add_learning_tables.js.map +0 -1
@@ -1,19 +0,0 @@
1
- #!/bin/bash
2
- # Quick start guide for Claude Flow
3
-
4
- echo "🚀 Claude Flow Quick Start"
5
- echo "=========================="
6
- echo ""
7
- echo "1. Initialize a swarm:"
8
- echo " npx claude-flow swarm init --topology hierarchical"
9
- echo ""
10
- echo "2. Spawn agents:"
11
- echo " npx claude-flow agent spawn --type coder --name "API Developer""
12
- echo ""
13
- echo "3. Orchestrate tasks:"
14
- echo " npx claude-flow task orchestrate --task "Build REST API""
15
- echo ""
16
- echo "4. Monitor progress:"
17
- echo " npx claude-flow swarm monitor"
18
- echo ""
19
- echo "📚 For more examples, see .claude/commands/"
@@ -1,18 +0,0 @@
1
- #!/bin/bash
2
- # Setup MCP server for Claude Flow
3
-
4
- echo "🚀 Setting up Claude Flow MCP server..."
5
-
6
- # Check if claude command exists
7
- if ! command -v claude &> /dev/null; then
8
- echo "❌ Error: Claude Code CLI not found"
9
- echo "Please install Claude Code first"
10
- exit 1
11
- fi
12
-
13
- # Add MCP server
14
- echo "📦 Adding Claude Flow MCP server..."
15
- claude mcp add claude-flow npx claude-flow mcp start
16
-
17
- echo "✅ MCP server setup complete!"
18
- echo "🎯 You can now use mcp__claude-flow__ tools in Claude Code"
@@ -1,179 +0,0 @@
1
- #!/bin/bash
2
- # Standard checkpoint hook functions for Claude settings.json (without GitHub features)
3
-
4
- # Function to handle pre-edit checkpoints
5
- pre_edit_checkpoint() {
6
- local tool_input="$1"
7
- local file=$(echo "$tool_input" | jq -r '.file_path // empty')
8
-
9
- if [ -n "$file" ]; then
10
- local checkpoint_branch="checkpoint/pre-edit-$(date +%Y%m%d-%H%M%S)"
11
- local current_branch=$(git branch --show-current)
12
-
13
- # Create checkpoint
14
- git add -A
15
- git stash push -m "Pre-edit checkpoint for $file" >/dev/null 2>&1
16
- git branch "$checkpoint_branch"
17
-
18
- # Store metadata
19
- mkdir -p .claude/checkpoints
20
- cat > ".claude/checkpoints/$(date +%s).json" <<EOF
21
- {
22
- "branch": "$checkpoint_branch",
23
- "file": "$file",
24
- "timestamp": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
25
- "type": "pre-edit",
26
- "original_branch": "$current_branch"
27
- }
28
- EOF
29
-
30
- # Restore working directory
31
- git stash pop --quiet >/dev/null 2>&1 || true
32
-
33
- echo "✅ Created checkpoint: $checkpoint_branch for $file"
34
- fi
35
- }
36
-
37
- # Function to handle post-edit checkpoints
38
- post_edit_checkpoint() {
39
- local tool_input="$1"
40
- local file=$(echo "$tool_input" | jq -r '.file_path // empty')
41
-
42
- if [ -n "$file" ] && [ -f "$file" ]; then
43
- # Check if file was modified - first check if file is tracked
44
- if ! git ls-files --error-unmatch "$file" >/dev/null 2>&1; then
45
- # File is not tracked, add it first
46
- git add "$file"
47
- fi
48
-
49
- # Now check if there are changes
50
- if git diff --cached --quiet "$file" 2>/dev/null && git diff --quiet "$file" 2>/dev/null; then
51
- echo "ℹ️ No changes to checkpoint for $file"
52
- else
53
- local tag_name="checkpoint-$(date +%Y%m%d-%H%M%S)"
54
- local current_branch=$(git branch --show-current)
55
-
56
- # Create commit
57
- git add "$file"
58
- if git commit -m "🔖 Checkpoint: Edit $file
59
-
60
- Automatic checkpoint created by Claude
61
- - File: $file
62
- - Branch: $current_branch
63
- - Timestamp: $(date -u +%Y-%m-%dT%H:%M:%SZ)
64
-
65
- [Auto-checkpoint]" --quiet; then
66
- # Create tag only if commit succeeded
67
- git tag -a "$tag_name" -m "Checkpoint after editing $file"
68
-
69
- # Store metadata
70
- mkdir -p .claude/checkpoints
71
- local diff_stats=$(git diff HEAD~1 --stat | tr '\n' ' ' | sed 's/"/\"/g')
72
- cat > ".claude/checkpoints/$(date +%s).json" <<EOF
73
- {
74
- "tag": "$tag_name",
75
- "file": "$file",
76
- "timestamp": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
77
- "type": "post-edit",
78
- "branch": "$current_branch",
79
- "diff_summary": "$diff_stats"
80
- }
81
- EOF
82
-
83
- echo "✅ Created checkpoint: $tag_name for $file"
84
- else
85
- echo "ℹ️ No commit created (no changes or commit failed)"
86
- fi
87
- fi
88
- fi
89
- }
90
-
91
- # Function to handle task checkpoints
92
- task_checkpoint() {
93
- local user_prompt="$1"
94
- local task=$(echo "$user_prompt" | head -c 100 | tr '\n' ' ')
95
-
96
- if [ -n "$task" ]; then
97
- local checkpoint_name="task-$(date +%Y%m%d-%H%M%S)"
98
-
99
- # Commit current state
100
- git add -A
101
- git commit -m "🔖 Task checkpoint: $task..." --quiet || true
102
-
103
- # Store metadata
104
- mkdir -p .claude/checkpoints
105
- cat > ".claude/checkpoints/task-$(date +%s).json" <<EOF
106
- {
107
- "checkpoint": "$checkpoint_name",
108
- "task": "$task",
109
- "timestamp": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
110
- "commit": "$(git rev-parse HEAD)"
111
- }
112
- EOF
113
-
114
- echo "✅ Created task checkpoint: $checkpoint_name"
115
- fi
116
- }
117
-
118
- # Function to handle session end
119
- session_end_checkpoint() {
120
- local session_id="session-$(date +%Y%m%d-%H%M%S)"
121
- local summary_file=".claude/checkpoints/summary-$session_id.md"
122
-
123
- mkdir -p .claude/checkpoints
124
-
125
- # Create summary
126
- cat > "$summary_file" <<EOF
127
- # Session Summary - $(date +'%Y-%m-%d %H:%M:%S')
128
-
129
- ## Checkpoints Created
130
- $(find .claude/checkpoints -name '*.json' -mtime -1 -exec basename {} \; | sort)
131
-
132
- ## Files Modified
133
- $(git diff --name-only $(git log --format=%H -n 1 --before="1 hour ago" 2>/dev/null) 2>/dev/null || echo "No files tracked")
134
-
135
- ## Recent Commits
136
- $(git log --oneline -10 --grep="Checkpoint" || echo "No checkpoint commits")
137
-
138
- ## Rollback Instructions
139
- To rollback to a specific checkpoint:
140
- \`\`\`bash
141
- # List all checkpoints
142
- git tag -l 'checkpoint-*' | sort -r
143
-
144
- # Rollback to a checkpoint
145
- git checkout checkpoint-YYYYMMDD-HHMMSS
146
-
147
- # Or reset to a checkpoint (destructive)
148
- git reset --hard checkpoint-YYYYMMDD-HHMMSS
149
- \`\`\`
150
- EOF
151
-
152
- # Create final checkpoint
153
- git add -A
154
- git commit -m "🏁 Session end checkpoint: $session_id" --quiet || true
155
- git tag -a "session-end-$session_id" -m "End of Claude session"
156
-
157
- echo "✅ Session summary saved to: $summary_file"
158
- echo "📌 Final checkpoint: session-end-$session_id"
159
- }
160
-
161
- # Main entry point
162
- case "$1" in
163
- pre-edit)
164
- pre_edit_checkpoint "$2"
165
- ;;
166
- post-edit)
167
- post_edit_checkpoint "$2"
168
- ;;
169
- task)
170
- task_checkpoint "$2"
171
- ;;
172
- session-end)
173
- session_end_checkpoint
174
- ;;
175
- *)
176
- echo "Usage: $0 {pre-edit|post-edit|task|session-end} [input]"
177
- exit 1
178
- ;;
179
- esac
@@ -1,153 +0,0 @@
1
-
2
- {
3
- "env": {
4
- "CLAUDE_FLOW_AUTO_COMMIT": "false",
5
- "CLAUDE_FLOW_AUTO_PUSH": "false",
6
- "CLAUDE_FLOW_HOOKS_ENABLED": "true",
7
- "CLAUDE_FLOW_TELEMETRY_ENABLED": "true",
8
- "CLAUDE_FLOW_REMOTE_EXECUTION": "true",
9
- "CLAUDE_FLOW_CHECKPOINTS_ENABLED": "true",
10
- "AGENTDB_LEARNING_ENABLED": "true",
11
- "AGENTDB_REASONING_ENABLED": "true",
12
- "AGENTDB_AUTO_TRAIN": "true"
13
- },
14
- "permissions": {
15
- "allow": [
16
- "Bash(npx claude-flow:*)",
17
- "Bash(npx agentdb:*)",
18
- "Bash(npm run lint)",
19
- "Bash(npm run test:*)",
20
- "Bash(npm test:*)",
21
- "Bash(git status)",
22
- "Bash(git diff:*)",
23
- "Bash(git log:*)",
24
- "Bash(git add:*)",
25
- "Bash(git commit:*)",
26
- "Bash(git push)",
27
- "Bash(git config:*)",
28
- "Bash(git tag:*)",
29
- "Bash(git branch:*)",
30
- "Bash(git checkout:*)",
31
- "Bash(git stash:*)",
32
- "Bash(jq:*)",
33
- "Bash(node:*)",
34
- "Bash(which:*)",
35
- "Bash(pwd)",
36
- "Bash(ls:*)"
37
- ],
38
- "deny": [
39
- "Bash(rm -rf /)"
40
- ]
41
- },
42
- "hooks": {
43
- "PreToolUse": [
44
- {
45
- "matcher": "Bash",
46
- "hooks": [
47
- {
48
- "type": "command",
49
- "command": "cat | jq -r '.tool_input.command // empty' | tr '\\n' '\\0' | xargs -0 -I {} npx claude-flow@alpha hooks pre-command --command '{}' --validate-safety true --prepare-resources true"
50
- }
51
- ]
52
- },
53
- {
54
- "matcher": "Write|Edit|MultiEdit",
55
- "hooks": [
56
- {
57
- "type": "command",
58
- "description": "3. Semantic Search Memory - Query similar successful past edits",
59
- "command": "cat | jq -r '.tool_input.file_path // .tool_input.path // empty' | tr '\\n' '\\0' | xargs -0 -I {} bash -c 'FILE=\"{}\"; echo \"🔍 Semantic Search: Querying similar successful edits for $FILE...\"; npx agentdb@latest query --domain \"successful-edits\" --query \"file:$FILE\" --k 5 --min-confidence 0.8 --format json 2>/dev/null || echo \"{}\" | jq -r \".memories[]? | \\\"💡 Past Success: \\(.pattern.summary // \\\"No similar patterns found\\\")\\\" \" 2>/dev/null; npx claude-flow@alpha hooks pre-edit --file \"$FILE\" --auto-assign-agents true --load-context true'"
60
- },
61
- {
62
- "type": "command",
63
- "description": "5. Failure Pattern Recognition - Warn about known failure patterns",
64
- "command": "cat | jq -r '.tool_input.file_path // .tool_input.path // empty' | tr '\\n' '\\0' | xargs -0 -I {} bash -c 'FILE=\"{}\"; echo \"⚠️ Failure Detection: Checking for known failure patterns...\"; npx agentdb@latest query --domain \"failed-edits\" --query \"file:$FILE\" --k 3 --min-confidence 0.7 --format json 2>/dev/null | jq -r \".memories[]? | \\\"🚨 Warning: Similar edit failed - \\(.pattern.reason // \\\"unknown\\\")\\\" \" 2>/dev/null || true'"
65
- }
66
- ]
67
- },
68
- {
69
- "matcher": "Task",
70
- "hooks": [
71
- {
72
- "type": "command",
73
- "description": "4. Trajectory Prediction - Predict optimal task sequence",
74
- "command": "cat | jq -r '.tool_input.prompt // .tool_input.task // empty' | tr '\\n' '\\0' | xargs -0 -I {} bash -c 'TASK=\"{}\"; echo \"🎯 Trajectory Prediction: Analyzing optimal workflow for task...\"; npx agentdb@latest query --domain \"task-trajectories\" --query \"task:$TASK\" --k 3 --min-confidence 0.75 --format json 2>/dev/null | jq -r \".memories[]? | \\\"📋 Predicted Steps: \\(.pattern.trajectory // \\\"No trajectory data\\\") (Success Rate: \\(.confidence // 0))\\\" \" 2>/dev/null || echo \"📋 No historical trajectory data - learning from this task...\"; npx claude-flow@alpha hooks pre-task --description \"$TASK\" --auto-spawn-agents true --load-memory true'"
75
- }
76
- ]
77
- }
78
- ],
79
- "PostToolUse": [
80
- {
81
- "matcher": "Bash",
82
- "hooks": [
83
- {
84
- "type": "command",
85
- "command": "cat | jq -r '.tool_input.command // empty' | tr '\\n' '\\0' | xargs -0 -I {} npx claude-flow@alpha hooks post-command --command '{}' --track-metrics true --store-results true"
86
- }
87
- ]
88
- },
89
- {
90
- "matcher": "Write|Edit|MultiEdit",
91
- "hooks": [
92
- {
93
- "type": "command",
94
- "description": "1. Experience Replay Developer - Capture edit as RL experience",
95
- "command": "cat | jq -r '.tool_input.file_path // .tool_input.path // empty' | tr '\\n' '\\0' | xargs -0 -I {} bash -c 'FILE=\"{}\"; echo \"💾 Experience Replay: Storing edit experience for $FILE...\"; TIMESTAMP=$(date +%s); npx agentdb@latest store-pattern --type \"experience\" --domain \"code-edits\" --pattern \"{\\\"file\\\":\\\"$FILE\\\",\\\"timestamp\\\":$TIMESTAMP,\\\"action\\\":\\\"edit\\\",\\\"state\\\":\\\"pre-test\\\"}\" --confidence 0.5 2>/dev/null || true; npx claude-flow@alpha hooks post-edit --file \"$FILE\" --format true --update-memory true --train-patterns true'"
96
- },
97
- {
98
- "type": "command",
99
- "description": "2. Verdict-Based Quality - Async verdict assignment after tests",
100
- "command": "cat | jq -r '.tool_input.file_path // .tool_input.path // empty' | tr '\\n' '\\0' | xargs -0 -I {} bash -c 'FILE=\"{}\"; (sleep 2; TEST_RESULT=$(npm test --silent 2>&1 | grep -q \"pass\" && echo \"ACCEPT\" || echo \"REJECT\"); REWARD=$([ \"$TEST_RESULT\" = \"ACCEPT\" ] && echo \"1.0\" || echo \"-1.0\"); echo \"⚖️ Verdict: $TEST_RESULT (reward: $REWARD) for $FILE\"; npx agentdb@latest store-pattern --type \"verdict\" --domain \"code-quality\" --pattern \"{\\\"file\\\":\\\"$FILE\\\",\\\"verdict\\\":\\\"$TEST_RESULT\\\",\\\"reward\\\":$REWARD}\" --confidence $([ \"$TEST_RESULT\" = \"ACCEPT\" ] && echo \"0.95\" || echo \"0.3\") 2>/dev/null; if [ \"$TEST_RESULT\" = \"ACCEPT\" ]; then npx agentdb@latest store-pattern --type \"success\" --domain \"successful-edits\" --pattern \"{\\\"file\\\":\\\"$FILE\\\",\\\"summary\\\":\\\"Edit passed tests\\\"}\" --confidence 0.9 2>/dev/null; else npx agentdb@latest store-pattern --type \"failure\" --domain \"failed-edits\" --pattern \"{\\\"file\\\":\\\"$FILE\\\",\\\"reason\\\":\\\"Tests failed\\\"}\" --confidence 0.8 2>/dev/null; fi) &'"
101
- }
102
- ]
103
- },
104
- {
105
- "matcher": "Task",
106
- "hooks": [
107
- {
108
- "type": "command",
109
- "description": "4. Trajectory Storage - Record task trajectory for learning",
110
- "command": "cat | jq -r '.tool_input.prompt // .tool_input.task // empty, .result.success // \"unknown\"' | tr '\\n' '\\0' | xargs -0 bash -c 'TASK=\"$1\"; SUCCESS=\"$2\"; echo \"📊 Trajectory Storage: Recording task workflow...\"; CONFIDENCE=$([ \"$SUCCESS\" = \"true\" ] && echo \"0.95\" || echo \"0.5\"); npx agentdb@latest store-pattern --type \"trajectory\" --domain \"task-trajectories\" --pattern \"{\\\"task\\\":\\\"$TASK\\\",\\\"success\\\":$SUCCESS,\\\"trajectory\\\":\\\"search→scaffold→test→refine\\\"}\" --confidence \"$CONFIDENCE\" 2>/dev/null || true; npx claude-flow@alpha hooks post-task --analyze-performance true --store-decisions true --export-learnings true' _"
111
- }
112
- ]
113
- }
114
- ],
115
- "PreCompact": [
116
- {
117
- "matcher": "manual",
118
- "hooks": [
119
- {
120
- "type": "command",
121
- "command": "/bin/bash -c 'INPUT=$(cat); CUSTOM=$(echo \"$INPUT\" | jq -r \".custom_instructions // \\\"\\\"\"); echo \"🔄 PreCompact Guidance:\"; echo \"📋 IMPORTANT: Review CLAUDE.md in project root for:\"; echo \" • 54 available agents and concurrent usage patterns\"; echo \" • Swarm coordination strategies (hierarchical, mesh, adaptive)\"; echo \" • SPARC methodology workflows with batchtools optimization\"; echo \" • Critical concurrent execution rules (GOLDEN RULE: 1 MESSAGE = ALL OPERATIONS)\"; if [ -n \"$CUSTOM\" ]; then echo \"🎯 Custom compact instructions: $CUSTOM\"; fi; echo \"✅ Ready for compact operation\"'"
122
- }
123
- ]
124
- },
125
- {
126
- "matcher": "auto",
127
- "hooks": [
128
- {
129
- "type": "command",
130
- "command": "/bin/bash -c 'echo \"🔄 Auto-Compact Guidance (Context Window Full):\"; echo \"📋 CRITICAL: Before compacting, ensure you understand:\"; echo \" • All 54 agents available in .claude/agents/ directory\"; echo \" • Concurrent execution patterns from CLAUDE.md\"; echo \" • Batchtools optimization for 300% performance gains\"; echo \" • Swarm coordination strategies for complex tasks\"; echo \"⚡ Apply GOLDEN RULE: Always batch operations in single messages\"; echo \"✅ Auto-compact proceeding with full agent context\"'"
131
- }
132
- ]
133
- }
134
- ],
135
- "Stop": [
136
- {
137
- "hooks": [
138
- {
139
- "type": "command",
140
- "description": "Session end - Train models and compress learnings",
141
- "command": "bash -c 'echo \"🎓 Session End: Training models on accumulated experiences...\"; npx agentdb@latest train --domain \"code-edits\" --epochs 10 --batch-size 32 2>/dev/null || echo \"⚠️ Training skipped (insufficient data)\"; echo \"🧠 Memory Distillation: Compressing session learnings...\"; npx agentdb@latest optimize-memory --compress true --consolidate-patterns true 2>/dev/null || true; npx claude-flow@alpha hooks session-end --generate-summary true --persist-state true --export-metrics true'"
142
- }
143
- ]
144
- }
145
- ]
146
- },
147
- "includeCoAuthoredBy": true,
148
- "enabledMcpjsonServers": ["claude-flow", "ruv-swarm", "agentic-qe"],
149
- "statusLine": {
150
- "type": "command",
151
- "command": ".claude/statusline-command.sh"
152
- }
153
- }
@@ -1,10 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "mcp__ruv-swarm",
5
- "mcp__claude-flow@alpha",
6
- "mcp__flow-nexus"
7
- ],
8
- "deny": []
9
- }
10
- }
@@ -1,176 +0,0 @@
1
-
2
- #!/bin/bash
3
-
4
- # Read JSON input from stdin
5
- INPUT=$(cat)
6
- MODEL=$(echo "$INPUT" | jq -r '.model.display_name // "Claude"')
7
- CWD=$(echo "$INPUT" | jq -r '.workspace.current_dir // .cwd')
8
- DIR=$(basename "$CWD")
9
-
10
- # Replace claude-code-flow with branded name
11
- if [ "$DIR" = "claude-code-flow" ]; then
12
- DIR="🌊 Claude Flow"
13
- fi
14
-
15
- # Get git branch
16
- BRANCH=$(cd "$CWD" 2>/dev/null && git branch --show-current 2>/dev/null)
17
-
18
- # Start building statusline
19
- printf "\033[1m$MODEL\033[0m in \033[36m$DIR\033[0m"
20
- [ -n "$BRANCH" ] && printf " on \033[33m⎇ $BRANCH\033[0m"
21
-
22
- # Claude-Flow integration
23
- FLOW_DIR="$CWD/.claude-flow"
24
-
25
- if [ -d "$FLOW_DIR" ]; then
26
- printf " │"
27
-
28
- # 1. Swarm Configuration & Topology
29
- if [ -f "$FLOW_DIR/swarm-config.json" ]; then
30
- STRATEGY=$(jq -r '.defaultStrategy // empty' "$FLOW_DIR/swarm-config.json" 2>/dev/null)
31
- if [ -n "$STRATEGY" ]; then
32
- # Map strategy to topology icon
33
- case "$STRATEGY" in
34
- "balanced") TOPO_ICON="⚡mesh" ;;
35
- "conservative") TOPO_ICON="⚡hier" ;;
36
- "aggressive") TOPO_ICON="⚡ring" ;;
37
- *) TOPO_ICON="⚡$STRATEGY" ;;
38
- esac
39
- printf " \033[35m$TOPO_ICON\033[0m"
40
-
41
- # Count agent profiles as "configured agents"
42
- AGENT_COUNT=$(jq -r '.agentProfiles | length' "$FLOW_DIR/swarm-config.json" 2>/dev/null)
43
- if [ -n "$AGENT_COUNT" ] && [ "$AGENT_COUNT" != "null" ] && [ "$AGENT_COUNT" -gt 0 ]; then
44
- printf " \033[35m🤖 $AGENT_COUNT\033[0m"
45
- fi
46
- fi
47
- fi
48
-
49
- # 2. Real-time System Metrics
50
- if [ -f "$FLOW_DIR/metrics/system-metrics.json" ]; then
51
- # Get latest metrics (last entry in array)
52
- LATEST=$(jq -r '.[-1]' "$FLOW_DIR/metrics/system-metrics.json" 2>/dev/null)
53
-
54
- if [ -n "$LATEST" ] && [ "$LATEST" != "null" ]; then
55
- # Memory usage
56
- MEM_PERCENT=$(echo "$LATEST" | jq -r '.memoryUsagePercent // 0' | awk '{printf "%.0f", $1}')
57
- if [ -n "$MEM_PERCENT" ] && [ "$MEM_PERCENT" != "null" ]; then
58
- # Color-coded memory (green <60%, yellow 60-80%, red >80%)
59
- if [ "$MEM_PERCENT" -lt 60 ]; then
60
- MEM_COLOR="\033[32m" # Green
61
- elif [ "$MEM_PERCENT" -lt 80 ]; then
62
- MEM_COLOR="\033[33m" # Yellow
63
- else
64
- MEM_COLOR="\033[31m" # Red
65
- fi
66
- printf " ${MEM_COLOR}💾 ${MEM_PERCENT}%\033[0m"
67
- fi
68
-
69
- # CPU load
70
- CPU_LOAD=$(echo "$LATEST" | jq -r '.cpuLoad // 0' | awk '{printf "%.0f", $1 * 100}')
71
- if [ -n "$CPU_LOAD" ] && [ "$CPU_LOAD" != "null" ]; then
72
- # Color-coded CPU (green <50%, yellow 50-75%, red >75%)
73
- if [ "$CPU_LOAD" -lt 50 ]; then
74
- CPU_COLOR="\033[32m" # Green
75
- elif [ "$CPU_LOAD" -lt 75 ]; then
76
- CPU_COLOR="\033[33m" # Yellow
77
- else
78
- CPU_COLOR="\033[31m" # Red
79
- fi
80
- printf " ${CPU_COLOR}⚙ ${CPU_LOAD}%\033[0m"
81
- fi
82
- fi
83
- fi
84
-
85
- # 3. Session State
86
- if [ -f "$FLOW_DIR/session-state.json" ]; then
87
- SESSION_ID=$(jq -r '.sessionId // empty' "$FLOW_DIR/session-state.json" 2>/dev/null)
88
- ACTIVE=$(jq -r '.active // false' "$FLOW_DIR/session-state.json" 2>/dev/null)
89
-
90
- if [ "$ACTIVE" = "true" ] && [ -n "$SESSION_ID" ]; then
91
- # Show abbreviated session ID
92
- SHORT_ID=$(echo "$SESSION_ID" | cut -d'-' -f1)
93
- printf " \033[34m🔄 $SHORT_ID\033[0m"
94
- fi
95
- fi
96
-
97
- # 4. Performance Metrics from task-metrics.json
98
- if [ -f "$FLOW_DIR/metrics/task-metrics.json" ]; then
99
- # Parse task metrics for success rate, avg time, and streak
100
- METRICS=$(jq -r '
101
- # Calculate metrics
102
- (map(select(.success == true)) | length) as $successful |
103
- (length) as $total |
104
- (if $total > 0 then ($successful / $total * 100) else 0 end) as $success_rate |
105
- (map(.duration // 0) | add / length) as $avg_duration |
106
- # Calculate streak (consecutive successes from end)
107
- (reverse |
108
- reduce .[] as $task (0;
109
- if $task.success == true then . + 1 else 0 end
110
- )
111
- ) as $streak |
112
- {
113
- success_rate: $success_rate,
114
- avg_duration: $avg_duration,
115
- streak: $streak,
116
- total: $total
117
- } | @json
118
- ' "$FLOW_DIR/metrics/task-metrics.json" 2>/dev/null)
119
-
120
- if [ -n "$METRICS" ] && [ "$METRICS" != "null" ]; then
121
- # Success Rate
122
- SUCCESS_RATE=$(echo "$METRICS" | jq -r '.success_rate // 0' | awk '{printf "%.0f", $1}')
123
- TOTAL_TASKS=$(echo "$METRICS" | jq -r '.total // 0')
124
-
125
- if [ -n "$SUCCESS_RATE" ] && [ "$TOTAL_TASKS" -gt 0 ]; then
126
- # Color-code: Green (>80%), Yellow (60-80%), Red (<60%)
127
- if [ "$SUCCESS_RATE" -gt 80 ]; then
128
- SUCCESS_COLOR="\033[32m" # Green
129
- elif [ "$SUCCESS_RATE" -ge 60 ]; then
130
- SUCCESS_COLOR="\033[33m" # Yellow
131
- else
132
- SUCCESS_COLOR="\033[31m" # Red
133
- fi
134
- printf " ${SUCCESS_COLOR}🎯 ${SUCCESS_RATE}%\033[0m"
135
- fi
136
-
137
- # Average Time
138
- AVG_TIME=$(echo "$METRICS" | jq -r '.avg_duration // 0')
139
- if [ -n "$AVG_TIME" ] && [ "$TOTAL_TASKS" -gt 0 ]; then
140
- # Format smartly: seconds, minutes, or hours
141
- if [ $(echo "$AVG_TIME < 60" | bc -l 2>/dev/null || echo 0) -eq 1 ]; then
142
- TIME_STR=$(echo "$AVG_TIME" | awk '{printf "%.1fs", $1}')
143
- elif [ $(echo "$AVG_TIME < 3600" | bc -l 2>/dev/null || echo 0) -eq 1 ]; then
144
- TIME_STR=$(echo "$AVG_TIME" | awk '{printf "%.1fm", $1/60}')
145
- else
146
- TIME_STR=$(echo "$AVG_TIME" | awk '{printf "%.1fh", $1/3600}')
147
- fi
148
- printf " \033[36m⏱️ $TIME_STR\033[0m"
149
- fi
150
-
151
- # Streak (only show if > 0)
152
- STREAK=$(echo "$METRICS" | jq -r '.streak // 0')
153
- if [ -n "$STREAK" ] && [ "$STREAK" -gt 0 ]; then
154
- printf " \033[91m🔥 $STREAK\033[0m"
155
- fi
156
- fi
157
- fi
158
-
159
- # 5. Active Tasks (check for task files)
160
- if [ -d "$FLOW_DIR/tasks" ]; then
161
- TASK_COUNT=$(find "$FLOW_DIR/tasks" -name "*.json" -type f 2>/dev/null | wc -l)
162
- if [ "$TASK_COUNT" -gt 0 ]; then
163
- printf " \033[36m📋 $TASK_COUNT\033[0m"
164
- fi
165
- fi
166
-
167
- # 6. Check for hooks activity
168
- if [ -f "$FLOW_DIR/hooks-state.json" ]; then
169
- HOOKS_ACTIVE=$(jq -r '.enabled // false' "$FLOW_DIR/hooks-state.json" 2>/dev/null)
170
- if [ "$HOOKS_ACTIVE" = "true" ]; then
171
- printf " \033[35m🔗\033[0m"
172
- fi
173
- fi
174
- fi
175
-
176
- echo