moflo 4.7.8 โ†’ 4.8.1

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 (77) hide show
  1. package/.claude/settings.local.json +4 -1
  2. package/.claude/workflow-state.json +3 -7
  3. package/README.md +3 -1
  4. package/bin/build-embeddings.mjs +59 -3
  5. package/bin/generate-code-map.mjs +3 -1
  6. package/bin/hooks.mjs +23 -20
  7. package/bin/index-guidance.mjs +3 -1
  8. package/bin/lib/moflo-resolve.mjs +14 -0
  9. package/bin/semantic-search.mjs +10 -5
  10. package/bin/session-start-launcher.mjs +116 -3
  11. package/package.json +6 -6
  12. package/src/@claude-flow/cli/dist/src/appliance/ruvllm-bridge.js +3 -7
  13. package/src/@claude-flow/cli/dist/src/commands/daemon.js +42 -95
  14. package/src/@claude-flow/cli/dist/src/commands/doctor.js +127 -6
  15. package/src/@claude-flow/cli/dist/src/commands/embeddings.js +4 -3
  16. package/src/@claude-flow/cli/dist/src/commands/hooks.js +3 -2
  17. package/src/@claude-flow/cli/dist/src/commands/mcp.js +38 -22
  18. package/src/@claude-flow/cli/dist/src/commands/memory.js +2 -1
  19. package/src/@claude-flow/cli/dist/src/commands/neural.js +10 -5
  20. package/src/@claude-flow/cli/dist/src/config/moflo-config.d.ts +5 -0
  21. package/src/@claude-flow/cli/dist/src/config/moflo-config.js +16 -0
  22. package/src/@claude-flow/cli/dist/src/index.js +12 -0
  23. package/src/@claude-flow/cli/dist/src/init/executor.js +74 -0
  24. package/src/@claude-flow/cli/dist/src/init/moflo-init.js +49 -0
  25. package/src/@claude-flow/cli/dist/src/mcp-tools/memory-tools.js +2 -2
  26. package/src/@claude-flow/cli/dist/src/mcp-tools/neural-tools.js +2 -1
  27. package/src/@claude-flow/cli/dist/src/memory/memory-bridge.js +5 -1
  28. package/src/@claude-flow/cli/dist/src/memory/memory-initializer.js +29 -24
  29. package/src/@claude-flow/cli/dist/src/ruvector/ast-analyzer.js +2 -1
  30. package/src/@claude-flow/cli/dist/src/ruvector/coverage-router.js +2 -1
  31. package/src/@claude-flow/cli/dist/src/ruvector/diff-classifier.js +2 -1
  32. package/src/@claude-flow/cli/dist/src/ruvector/enhanced-model-router.js +3 -3
  33. package/src/@claude-flow/cli/dist/src/ruvector/index.js +6 -13
  34. package/src/@claude-flow/cli/dist/src/ruvector/q-learning-router.js +4 -1
  35. package/src/@claude-flow/cli/dist/src/services/daemon-lock.d.ts +39 -0
  36. package/src/@claude-flow/cli/dist/src/services/daemon-lock.js +213 -0
  37. package/src/@claude-flow/cli/dist/src/services/learning-service.js +2 -1
  38. package/src/@claude-flow/cli/dist/src/services/moflo-require.d.ts +34 -0
  39. package/src/@claude-flow/cli/dist/src/services/moflo-require.js +67 -0
  40. package/src/@claude-flow/cli/dist/src/services/ruvector-training.js +8 -6
  41. package/src/@claude-flow/cli/package.json +6 -6
  42. package/.claude/helpers/README.md +0 -97
  43. package/.claude/helpers/adr-compliance.sh +0 -186
  44. package/.claude/helpers/aggressive-microcompact.mjs +0 -36
  45. package/.claude/helpers/auto-commit.sh +0 -178
  46. package/.claude/helpers/checkpoint-manager.sh +0 -251
  47. package/.claude/helpers/context-persistence-hook.mjs +0 -1979
  48. package/.claude/helpers/daemon-manager.sh +0 -252
  49. package/.claude/helpers/ddd-tracker.sh +0 -144
  50. package/.claude/helpers/github-safe.js +0 -106
  51. package/.claude/helpers/github-setup.sh +0 -28
  52. package/.claude/helpers/guidance-hook.sh +0 -13
  53. package/.claude/helpers/guidance-hooks.sh +0 -102
  54. package/.claude/helpers/health-monitor.sh +0 -108
  55. package/.claude/helpers/learning-hooks.sh +0 -329
  56. package/.claude/helpers/learning-optimizer.sh +0 -127
  57. package/.claude/helpers/learning-service.mjs +0 -1211
  58. package/.claude/helpers/memory.cjs +0 -84
  59. package/.claude/helpers/metrics-db.mjs +0 -492
  60. package/.claude/helpers/patch-aggressive-prune.mjs +0 -184
  61. package/.claude/helpers/pattern-consolidator.sh +0 -86
  62. package/.claude/helpers/perf-worker.sh +0 -160
  63. package/.claude/helpers/quick-start.sh +0 -19
  64. package/.claude/helpers/router.cjs +0 -62
  65. package/.claude/helpers/security-scanner.sh +0 -127
  66. package/.claude/helpers/session.cjs +0 -125
  67. package/.claude/helpers/setup-mcp.sh +0 -18
  68. package/.claude/helpers/standard-checkpoint-hooks.sh +0 -189
  69. package/.claude/helpers/swarm-comms.sh +0 -353
  70. package/.claude/helpers/swarm-hooks.sh +0 -761
  71. package/.claude/helpers/swarm-monitor.sh +0 -211
  72. package/.claude/helpers/sync-v3-metrics.sh +0 -245
  73. package/.claude/helpers/update-v3-progress.sh +0 -166
  74. package/.claude/helpers/v3-quick-status.sh +0 -58
  75. package/.claude/helpers/v3.sh +0 -111
  76. package/.claude/helpers/validate-v3-config.sh +0 -216
  77. package/.claude/helpers/worker-manager.sh +0 -170
@@ -1,36 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Aggressive Micro-Compaction Preload
4
- *
5
- * Claude Code's micro-compaction (Vd function) only prunes old tool results
6
- * when context is above the warning threshold (~80%) and only if it can save
7
- * at least 20K tokens. These hardcoded thresholds mean context can grow large
8
- * before any pruning happens.
9
- *
10
- * This script patches the environment to make micro-compaction more aggressive
11
- * by lowering the threshold at which it activates. It works by setting
12
- * CLAUDE_AUTOCOMPACT_PCT_OVERRIDE to trigger compaction earlier if micro-compaction
13
- * isn't enough, but the real win is keeping context lean through early pruning.
14
- *
15
- * The micro-compact function Vd() works like this:
16
- * 1. Collects all tool results from: Read, Bash, Grep, Glob, WebSearch, WebFetch, Edit, Write
17
- * 2. Keeps the last 3 tool results intact (Ly5=3)
18
- * 3. If total tool result tokens > 40K (Ny5) AND context is above warning threshold:
19
- * - Replaces old results with "[Old tool result content cleared]"
20
- * - Only if savings >= 20K tokens (qy5)
21
- * 4. This runs on EVERY query โ€” it IS automatic pruning
22
- *
23
- * The problem: Ny5=40000 and qy5=20000 are hardcoded. We can't change them.
24
- * The solution: Set CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=50 so the warning/error
25
- * thresholds drop, which makes micro-compaction activate much earlier.
26
- */
27
-
28
- // This file is sourced by settings.json hooks to document the strategy.
29
- // The actual configuration is in settings.json env vars:
30
- // CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=50 โ†’ lowers all thresholds
31
- // autoCompactEnabled=true โ†’ enables the auto-compact fallback
32
-
33
- console.log('[AggressiveMicrocompact] Strategy: CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=50');
34
- console.log('[AggressiveMicrocompact] Micro-compact activates when tokens > warning threshold');
35
- console.log('[AggressiveMicrocompact] Warning threshold = maxTokens - 20K (relative to override)');
36
- console.log('[AggressiveMicrocompact] Effect: pruning starts at ~45% instead of ~80%');
@@ -1,178 +0,0 @@
1
- #!/bin/bash
2
- # Auto-commit helper for Claude Code hooks
3
- # Handles git add, commit, and push in a robust way
4
-
5
- set -e
6
-
7
- # Colors
8
- GREEN='\033[0;32m'
9
- YELLOW='\033[1;33m'
10
- RED='\033[0;31m'
11
- NC='\033[0m'
12
-
13
- # Configuration
14
- MIN_CHANGES=${MIN_CHANGES:-1}
15
- COMMIT_PREFIX=${COMMIT_PREFIX:-"checkpoint"}
16
- AUTO_PUSH=${AUTO_PUSH:-true}
17
-
18
- log() {
19
- echo -e "${GREEN}[auto-commit]${NC} $1"
20
- }
21
-
22
- warn() {
23
- echo -e "${YELLOW}[auto-commit]${NC} $1"
24
- }
25
-
26
- error() {
27
- echo -e "${RED}[auto-commit]${NC} $1"
28
- }
29
-
30
- # Check if there are changes to commit
31
- has_changes() {
32
- ! git diff --quiet HEAD 2>/dev/null || ! git diff --cached --quiet 2>/dev/null || [ -n "$(git ls-files --others --exclude-standard)" ]
33
- }
34
-
35
- # Count changes
36
- count_changes() {
37
- local staged=$(git diff --cached --numstat | wc -l)
38
- local unstaged=$(git diff --numstat | wc -l)
39
- local untracked=$(git ls-files --others --exclude-standard | wc -l)
40
- echo $((staged + unstaged + untracked))
41
- }
42
-
43
- # Main auto-commit function
44
- auto_commit() {
45
- local message="$1"
46
- local file="$2" # Optional specific file
47
-
48
- # Check if in a git repo
49
- if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
50
- error "Not in a git repository"
51
- return 1
52
- fi
53
-
54
- # Check for changes
55
- if ! has_changes; then
56
- log "No changes to commit"
57
- return 0
58
- fi
59
-
60
- local change_count=$(count_changes)
61
- if [ "$change_count" -lt "$MIN_CHANGES" ]; then
62
- log "Only $change_count change(s), skipping (min: $MIN_CHANGES)"
63
- return 0
64
- fi
65
-
66
- # Stage changes
67
- if [ -n "$file" ] && [ -f "$file" ]; then
68
- git add "$file"
69
- log "Staged: $file"
70
- else
71
- git add -A
72
- log "Staged all changes ($change_count files)"
73
- fi
74
-
75
- # Create commit message
76
- local branch=$(git branch --show-current)
77
- local timestamp=$(date -u +%Y-%m-%dT%H:%M:%SZ)
78
-
79
- if [ -z "$message" ]; then
80
- message="$COMMIT_PREFIX: Auto-commit from Claude Code"
81
- fi
82
-
83
- # Commit
84
- if git commit -m "$message
85
-
86
- Automatic checkpoint created by Claude Code
87
- - Branch: $branch
88
- - Timestamp: $timestamp
89
- - Changes: $change_count file(s)
90
-
91
- ๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code)
92
-
93
- Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>" --quiet 2>/dev/null; then
94
- log "Created commit: $message"
95
-
96
- # Push if enabled
97
- if [ "$AUTO_PUSH" = "true" ]; then
98
- if git push origin "$branch" --quiet 2>/dev/null; then
99
- log "Pushed to origin/$branch"
100
- else
101
- warn "Push failed (will retry later)"
102
- fi
103
- fi
104
-
105
- return 0
106
- else
107
- warn "Commit failed (possibly nothing to commit)"
108
- return 1
109
- fi
110
- }
111
-
112
- # Batch commit (commits all changes together)
113
- batch_commit() {
114
- local message="${1:-Batch checkpoint}"
115
- auto_commit "$message"
116
- }
117
-
118
- # Single file commit
119
- file_commit() {
120
- local file="$1"
121
- local message="${2:-Checkpoint: $file}"
122
-
123
- if [ -z "$file" ]; then
124
- error "No file specified"
125
- return 1
126
- fi
127
-
128
- if [ ! -f "$file" ]; then
129
- error "File not found: $file"
130
- return 1
131
- fi
132
-
133
- auto_commit "$message" "$file"
134
- }
135
-
136
- # Push only (no commit)
137
- push_only() {
138
- local branch=$(git branch --show-current)
139
-
140
- if git push origin "$branch" 2>/dev/null; then
141
- log "Pushed to origin/$branch"
142
- else
143
- warn "Push failed"
144
- return 1
145
- fi
146
- }
147
-
148
- # Entry point
149
- case "${1:-batch}" in
150
- batch)
151
- batch_commit "$2"
152
- ;;
153
- file)
154
- file_commit "$2" "$3"
155
- ;;
156
- push)
157
- push_only
158
- ;;
159
- check)
160
- if has_changes; then
161
- echo "Changes detected: $(count_changes) files"
162
- exit 0
163
- else
164
- echo "No changes"
165
- exit 1
166
- fi
167
- ;;
168
- *)
169
- echo "Usage: $0 {batch|file|push|check} [args]"
170
- echo ""
171
- echo "Commands:"
172
- echo " batch [message] Commit all changes with optional message"
173
- echo " file <path> [msg] Commit specific file"
174
- echo " push Push without committing"
175
- echo " check Check if there are uncommitted changes"
176
- exit 1
177
- ;;
178
- esac
@@ -1,251 +0,0 @@
1
- #!/bin/bash
2
- # Claude Checkpoint Manager
3
- # Provides easy rollback and management of Claude Code checkpoints
4
-
5
- set -e
6
-
7
- # Colors
8
- RED='\033[0;31m'
9
- GREEN='\033[0;32m'
10
- YELLOW='\033[1;33m'
11
- BLUE='\033[0;34m'
12
- NC='\033[0m' # No Color
13
-
14
- # Configuration
15
- CHECKPOINT_DIR=".claude/checkpoints"
16
- BACKUP_DIR=".claude/backups"
17
-
18
- # Help function
19
- show_help() {
20
- cat << EOF
21
- Claude Checkpoint Manager
22
- ========================
23
-
24
- Usage: $0 <command> [options]
25
-
26
- Commands:
27
- list List all checkpoints
28
- show <id> Show details of a specific checkpoint
29
- rollback <id> Rollback to a specific checkpoint
30
- diff <id> Show diff since checkpoint
31
- clean Clean old checkpoints (older than 7 days)
32
- summary Show session summary
33
-
34
- Options:
35
- --hard For rollback: use git reset --hard (destructive)
36
- --soft For rollback: use git reset --soft (default)
37
- --branch For rollback: create new branch from checkpoint
38
-
39
- Examples:
40
- $0 list
41
- $0 show checkpoint-20240130-143022
42
- $0 rollback checkpoint-20240130-143022 --branch
43
- $0 diff session-end-session-20240130-150000
44
- EOF
45
- }
46
-
47
- # List all checkpoints
48
- function list_checkpoints() {
49
- echo -e "${BLUE}๐Ÿ“‹ Available Checkpoints:${NC}"
50
- echo ""
51
-
52
- # List checkpoint tags
53
- echo -e "${YELLOW}Git Tags:${NC}"
54
- local tags=$(git tag -l 'checkpoint-*' -l 'session-end-*' -l 'task-*' --sort=-creatordate | head -20)
55
- if [ -n "$tags" ]; then
56
- echo "$tags"
57
- else
58
- echo "No checkpoint tags found"
59
- fi
60
-
61
- echo ""
62
-
63
- # List checkpoint branches
64
- echo -e "${YELLOW}Checkpoint Branches:${NC}"
65
- local branches=$(git branch -a | grep "checkpoint/" | sed 's/^[ *]*//')
66
- if [ -n "$branches" ]; then
67
- echo "$branches"
68
- else
69
- echo "No checkpoint branches found"
70
- fi
71
-
72
- echo ""
73
-
74
- # List checkpoint files
75
- if [ -d "$CHECKPOINT_DIR" ]; then
76
- echo -e "${YELLOW}Recent Checkpoint Files:${NC}"
77
- find "$CHECKPOINT_DIR" -name "*.json" -type f -printf "%T@ %p\n" | \
78
- sort -rn | head -10 | cut -d' ' -f2- | xargs -I {} basename {}
79
- fi
80
- }
81
-
82
- # Show checkpoint details
83
- function show_checkpoint() {
84
- local checkpoint_id="$1"
85
-
86
- echo -e "${BLUE}๐Ÿ“ Checkpoint Details: $checkpoint_id${NC}"
87
- echo ""
88
-
89
- # Check if it's a tag
90
- if git tag -l "$checkpoint_id" | grep -q "$checkpoint_id"; then
91
- echo -e "${YELLOW}Type:${NC} Git Tag"
92
- echo -e "${YELLOW}Commit:${NC} $(git rev-list -n 1 "$checkpoint_id")"
93
- echo -e "${YELLOW}Date:${NC} $(git log -1 --format=%ai "$checkpoint_id")"
94
- echo -e "${YELLOW}Message:${NC}"
95
- git log -1 --format=%B "$checkpoint_id" | sed 's/^/ /'
96
- echo ""
97
- echo -e "${YELLOW}Files changed:${NC}"
98
- git diff-tree --no-commit-id --name-status -r "$checkpoint_id" | sed 's/^/ /'
99
- # Check if it's a branch
100
- elif git branch -a | grep -q "$checkpoint_id"; then
101
- echo -e "${YELLOW}Type:${NC} Git Branch"
102
- echo -e "${YELLOW}Latest commit:${NC}"
103
- git log -1 --oneline "$checkpoint_id"
104
- else
105
- echo -e "${RED}โŒ Checkpoint not found: $checkpoint_id${NC}"
106
- exit 1
107
- fi
108
- }
109
-
110
- # Rollback to checkpoint
111
- function rollback_checkpoint() {
112
- local checkpoint_id="$1"
113
- local mode="$2"
114
-
115
- echo -e "${YELLOW}๐Ÿ”„ Rolling back to checkpoint: $checkpoint_id${NC}"
116
- echo ""
117
-
118
- # Verify checkpoint exists
119
- if ! git tag -l "$checkpoint_id" | grep -q "$checkpoint_id" && \
120
- ! git branch -a | grep -q "$checkpoint_id"; then
121
- echo -e "${RED}โŒ Checkpoint not found: $checkpoint_id${NC}"
122
- exit 1
123
- fi
124
-
125
- # Create backup before rollback
126
- local backup_name="backup-$(date +%Y%m%d-%H%M%S)"
127
- echo "Creating backup: $backup_name"
128
- git tag "$backup_name" -m "Backup before rollback to $checkpoint_id"
129
-
130
- case "$mode" in
131
- "--hard")
132
- echo -e "${RED}โš ๏ธ Performing hard reset (destructive)${NC}"
133
- git reset --hard "$checkpoint_id"
134
- echo -e "${GREEN}โœ… Rolled back to $checkpoint_id (hard reset)${NC}"
135
- ;;
136
- "--branch")
137
- local branch_name="rollback-$checkpoint_id-$(date +%Y%m%d-%H%M%S)"
138
- echo "Creating new branch: $branch_name"
139
- git checkout -b "$branch_name" "$checkpoint_id"
140
- echo -e "${GREEN}โœ… Created branch $branch_name from $checkpoint_id${NC}"
141
- ;;
142
- "--stash"|*)
143
- echo "Stashing current changes..."
144
- git stash push -m "Stash before rollback to $checkpoint_id"
145
- git reset --soft "$checkpoint_id"
146
- echo -e "${GREEN}โœ… Rolled back to $checkpoint_id (soft reset)${NC}"
147
- echo "Your changes are stashed. Use 'git stash pop' to restore them."
148
- ;;
149
- esac
150
- }
151
-
152
- # Show diff since checkpoint
153
- function diff_checkpoint() {
154
- local checkpoint_id="$1"
155
-
156
- echo -e "${BLUE}๐Ÿ“Š Changes since checkpoint: $checkpoint_id${NC}"
157
- echo ""
158
-
159
- if git tag -l "$checkpoint_id" | grep -q "$checkpoint_id"; then
160
- git diff "$checkpoint_id"
161
- elif git branch -a | grep -q "$checkpoint_id"; then
162
- git diff "$checkpoint_id"
163
- else
164
- echo -e "${RED}โŒ Checkpoint not found: $checkpoint_id${NC}"
165
- exit 1
166
- fi
167
- }
168
-
169
- # Clean old checkpoints
170
- function clean_checkpoints() {
171
- local days=${1:-7}
172
-
173
- echo -e "${YELLOW}๐Ÿงน Cleaning checkpoints older than $days days...${NC}"
174
- echo ""
175
-
176
- # Clean old checkpoint files
177
- if [ -d "$CHECKPOINT_DIR" ]; then
178
- find "$CHECKPOINT_DIR" -name "*.json" -type f -mtime +$days -delete
179
- echo "โœ… Cleaned old checkpoint files"
180
- fi
181
-
182
- # List old tags (but don't delete automatically)
183
- echo ""
184
- echo "Old checkpoint tags (manual deletion required):"
185
- git tag -l 'checkpoint-*' --sort=-creatordate | tail -n +50 || echo "No old tags found"
186
- }
187
-
188
- # Show session summary
189
- function show_summary() {
190
- echo -e "${BLUE}๐Ÿ“Š Session Summary${NC}"
191
- echo ""
192
-
193
- # Find most recent session summary
194
- if [ -d "$CHECKPOINT_DIR" ]; then
195
- local latest_summary=$(find "$CHECKPOINT_DIR" -name "summary-*.md" -type f -printf "%T@ %p\n" | \
196
- sort -rn | head -1 | cut -d' ' -f2-)
197
-
198
- if [ -n "$latest_summary" ]; then
199
- echo -e "${YELLOW}Latest session summary:${NC}"
200
- cat "$latest_summary"
201
- else
202
- echo "No session summaries found"
203
- fi
204
- fi
205
- }
206
-
207
- # Main command handling
208
- case "$1" in
209
- list)
210
- list_checkpoints
211
- ;;
212
- show)
213
- if [ -z "$2" ]; then
214
- echo -e "${RED}Error: Please specify a checkpoint ID${NC}"
215
- show_help
216
- exit 1
217
- fi
218
- show_checkpoint "$2"
219
- ;;
220
- rollback)
221
- if [ -z "$2" ]; then
222
- echo -e "${RED}Error: Please specify a checkpoint ID${NC}"
223
- show_help
224
- exit 1
225
- fi
226
- rollback_checkpoint "$2" "$3"
227
- ;;
228
- diff)
229
- if [ -z "$2" ]; then
230
- echo -e "${RED}Error: Please specify a checkpoint ID${NC}"
231
- show_help
232
- exit 1
233
- fi
234
- diff_checkpoint "$2"
235
- ;;
236
- clean)
237
- clean_checkpoints "$2"
238
- ;;
239
- summary)
240
- show_summary
241
- ;;
242
- help|--help|-h)
243
- show_help
244
- ;;
245
- *)
246
- echo -e "${RED}Error: Unknown command: $1${NC}"
247
- echo ""
248
- show_help
249
- exit 1
250
- ;;
251
- esac