claude-flow 2.7.30 ā 2.7.32
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/CHANGELOG.md +150 -0
- package/bin/claude-flow +1 -1
- package/dist/src/cli/help-formatter.js +3 -0
- package/dist/src/cli/help-formatter.js.map +1 -1
- package/dist/src/cli/simple-commands/memory.js +67 -17
- package/dist/src/cli/simple-commands/memory.js.map +1 -1
- package/dist/src/cli/validation-helper.js.map +1 -1
- package/dist/src/core/version.js.map +1 -1
- package/dist/src/memory/swarm-memory.js +421 -340
- package/dist/src/memory/swarm-memory.js.map +1 -1
- package/dist/src/utils/key-redactor.js.map +1 -1
- package/docs/AGENTDB_V1.6.1_DEEP_REVIEW.md +386 -0
- package/docs/BUG_REPORT_MEMORY_STATS.md +355 -0
- package/docs/FIX_VERIFICATION_MEMORY_STATS.md +235 -0
- package/docs/RECENT_RELEASES_SUMMARY.md +375 -0
- package/docs/V2.7.31_RELEASE_NOTES.md +375 -0
- package/package.json +2 -2
- package/src/cli/simple-commands/memory.js +93 -19
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,156 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.7.32] - 2025-11-10
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **memory stats command** - Fixed bug where `memory stats` always returned zeros instead of showing ReasoningBank data
|
|
12
|
+
- Now shows unified statistics for both JSON and ReasoningBank storage backends
|
|
13
|
+
- Added intelligent mode detection (auto, basic, reasoningbank)
|
|
14
|
+
- Displays database size, confidence scores, and embedding counts
|
|
15
|
+
- Maintains backward compatibility with JSON-only mode
|
|
16
|
+
- Resolves GitHub issue #865
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
- Enhanced `showMemoryStats()` function to support ReasoningBank mode detection
|
|
20
|
+
- Improved stats output with clear separation between JSON and ReasoningBank storage
|
|
21
|
+
- Added helpful tips for users to switch between storage modes
|
|
22
|
+
|
|
23
|
+
### Documentation
|
|
24
|
+
- Added `docs/BUG_REPORT_MEMORY_STATS.md` - Detailed bug analysis and root cause
|
|
25
|
+
- Added `docs/FIX_VERIFICATION_MEMORY_STATS.md` - Comprehensive test results and verification
|
|
26
|
+
|
|
27
|
+
## [2.7.31] - 2025-11-06
|
|
28
|
+
|
|
29
|
+
> **š¦ Dependency Update**: Updated agentic-flow to v1.9.4 with new enterprise features
|
|
30
|
+
|
|
31
|
+
### Summary
|
|
32
|
+
Updated `agentic-flow` dependency from `^1.8.10` to `^1.9.4` to add new enterprise features including Supabase cloud integration, provider fallback, circuit breaker patterns, and enhanced reliability features.
|
|
33
|
+
|
|
34
|
+
### š§ Changes Made
|
|
35
|
+
|
|
36
|
+
**Updated Dependency** (`package.json:123`):
|
|
37
|
+
```diff
|
|
38
|
+
"dependencies": {
|
|
39
|
+
- "agentic-flow": "^1.8.10", // ā Previous version
|
|
40
|
+
+ "agentic-flow": "^1.9.4", // ā
Latest with enterprise features
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### ⨠New Features (via agentic-flow v1.9.4)
|
|
45
|
+
|
|
46
|
+
**Enterprise Provider Fallback**:
|
|
47
|
+
- Automatic failover: Gemini ā Claude ā OpenRouter ā ONNX
|
|
48
|
+
- Circuit breaker for cascading failure prevention
|
|
49
|
+
- Real-time health monitoring and auto-recovery
|
|
50
|
+
- Cost optimization with provider selection (70% savings)
|
|
51
|
+
|
|
52
|
+
**Cloud Integration**:
|
|
53
|
+
- `@supabase/supabase-js@^2.78.0` for cloud database features
|
|
54
|
+
- Distributed agent coordination capabilities
|
|
55
|
+
- Real-time synchronization support
|
|
56
|
+
|
|
57
|
+
**Reliability Improvements**:
|
|
58
|
+
- Checkpointing for crash recovery
|
|
59
|
+
- Budget controls and cost tracking
|
|
60
|
+
- Enhanced error handling with retry logic
|
|
61
|
+
- Performance monitoring and diagnostics
|
|
62
|
+
|
|
63
|
+
### š Dependency Analysis
|
|
64
|
+
|
|
65
|
+
**Risk Assessment**: ā
**LOW** - Safe to upgrade
|
|
66
|
+
- **16 existing dependencies**: All unchanged (no version bumps)
|
|
67
|
+
- **1 new dependency**: `@supabase/supabase-js@^2.78.0` (optional cloud features)
|
|
68
|
+
- **agentdb**: Still v1.6.1 (no regression from v2.7.30)
|
|
69
|
+
- **Full backwards compatibility**: No breaking changes
|
|
70
|
+
|
|
71
|
+
**Comparison (v1.8.10 ā v1.9.4)**:
|
|
72
|
+
```
|
|
73
|
+
IDENTICAL:
|
|
74
|
+
@anthropic-ai/sdk: ^0.65.0
|
|
75
|
+
better-sqlite3: ^11.10.0
|
|
76
|
+
agentdb: ^1.4.3 (we use 1.6.1 - compatible)
|
|
77
|
+
... 13 other dependencies unchanged
|
|
78
|
+
|
|
79
|
+
NEW:
|
|
80
|
+
@supabase/supabase-js: ^2.78.0
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### š Testing
|
|
84
|
+
|
|
85
|
+
**Local Regression Tests**:
|
|
86
|
+
```bash
|
|
87
|
+
ā
CLI version: v2.7.31
|
|
88
|
+
ā
Memory command: Working
|
|
89
|
+
ā
ReasoningBank: Initialized successfully
|
|
90
|
+
ā
agentdb: Still v1.6.1 (no regression)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Docker Validation** (`tests/docker/Dockerfile.v2.7.31-test`):
|
|
94
|
+
```bash
|
|
95
|
+
# Build and test
|
|
96
|
+
docker build -f tests/docker/Dockerfile.v2.7.31-test -t test .
|
|
97
|
+
docker run --rm test
|
|
98
|
+
|
|
99
|
+
ā
Test 1: Claude-Flow version is v2.7.31
|
|
100
|
+
ā
Test 2: agentic-flow is ^1.9.4 in package.json
|
|
101
|
+
ā
Test 3: agentic-flow 1.9.4 installed
|
|
102
|
+
ā
Test 4: agentdb 1.6.1 still installed (no regression)
|
|
103
|
+
ā
Test 5: ReasoningBank initialization works
|
|
104
|
+
ā
Test 6: Memory command works
|
|
105
|
+
ā
Test 7: CLI executes successfully
|
|
106
|
+
ā
Test 8: @supabase/supabase-js v2.80.0 available
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### š Installation
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
# NPX users (recommended)
|
|
113
|
+
npx claude-flow@latest init
|
|
114
|
+
|
|
115
|
+
# Global installation
|
|
116
|
+
npm install -g claude-flow@latest
|
|
117
|
+
|
|
118
|
+
# Verify
|
|
119
|
+
claude-flow --version # v2.7.31
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### š” CLI Features (via agentic-flow v1.9.4)
|
|
123
|
+
|
|
124
|
+
**New Commands Available**:
|
|
125
|
+
```bash
|
|
126
|
+
# Enterprise provider management
|
|
127
|
+
npx agentic-flow@latest providers list
|
|
128
|
+
npx agentic-flow@latest providers health
|
|
129
|
+
|
|
130
|
+
# Cost optimization
|
|
131
|
+
npx agentic-flow@latest cost analyze
|
|
132
|
+
npx agentic-flow@latest cost budget --max 100
|
|
133
|
+
|
|
134
|
+
# Checkpointing
|
|
135
|
+
npx agentic-flow@latest checkpoint save
|
|
136
|
+
npx agentic-flow@latest checkpoint restore
|
|
137
|
+
|
|
138
|
+
# 66 specialized agents across 8 categories
|
|
139
|
+
npx agentic-flow@latest agents list
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### š Documentation
|
|
143
|
+
|
|
144
|
+
- **Dependency Comparison**: `/tmp/compare-versions.md`
|
|
145
|
+
- **agentdb Deep Review**: `docs/AGENTDB_V1.6.1_DEEP_REVIEW.md` (from v2.7.30)
|
|
146
|
+
- **Docker Tests**: `tests/docker/Dockerfile.v2.7.31-test`
|
|
147
|
+
|
|
148
|
+
### š¦ Package Information
|
|
149
|
+
|
|
150
|
+
**Installed Dependencies**:
|
|
151
|
+
- Added: 2 packages
|
|
152
|
+
- Removed: 16 packages
|
|
153
|
+
- Changed: 8 packages
|
|
154
|
+
- Install time: ~45 seconds (with --legacy-peer-deps)
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
8
158
|
## [2.7.30] - 2025-11-06
|
|
9
159
|
|
|
10
160
|
> **š¦ Dependency Update**: Updated agentdb to v1.6.1 for better compatibility
|
package/bin/claude-flow
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Claude-Flow Smart Dispatcher - Detects and uses the best available runtime
|
|
3
3
|
# Enhanced with NPX cache error handling and retry logic
|
|
4
4
|
|
|
5
|
-
VERSION="2.7.
|
|
5
|
+
VERSION="2.7.32"
|
|
6
6
|
|
|
7
7
|
# Determine the correct path based on how the script is invoked
|
|
8
8
|
if [ -L "$0" ]; then
|
|
@@ -24,6 +24,9 @@ export class HelpFormatter {
|
|
|
24
24
|
if (info.examples && info.examples.length > 0) {
|
|
25
25
|
sections.push(this.formatSection('EXAMPLES', info.examples));
|
|
26
26
|
}
|
|
27
|
+
if (info.details) {
|
|
28
|
+
sections.push('\n' + info.details);
|
|
29
|
+
}
|
|
27
30
|
if (info.commands && info.commands.length > 0) {
|
|
28
31
|
sections.push(`Run '${info.name} <command> --help' for more information on a command.`);
|
|
29
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/help-formatter.
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/help-formatter.js"],"sourcesContent":["/**\n * Standardized CLI Help Formatter\n * Follows Unix/Linux conventions for help output\n */\n\nexport class HelpFormatter {\n static INDENT = ' ';\n static COLUMN_GAP = 2;\n static MIN_DESCRIPTION_COLUMN = 25;\n\n /**\n * Format main command help\n */\n static formatHelp(info) {\n const sections = [];\n\n // NAME section\n sections.push(this.formatSection('NAME', [`${info.name} - ${info.description}`]));\n\n // SYNOPSIS section\n if (info.usage) {\n sections.push(this.formatSection('SYNOPSIS', [info.usage]));\n }\n\n // COMMANDS section\n if (info.commands && info.commands.length > 0) {\n sections.push(this.formatSection('COMMANDS', this.formatCommands(info.commands)));\n }\n\n // OPTIONS section\n if (info.options && info.options.length > 0) {\n sections.push(this.formatSection('OPTIONS', this.formatOptions(info.options)));\n }\n\n // GLOBAL OPTIONS section\n if (info.globalOptions && info.globalOptions.length > 0) {\n sections.push(this.formatSection('GLOBAL OPTIONS', this.formatOptions(info.globalOptions)));\n }\n\n // EXAMPLES section\n if (info.examples && info.examples.length > 0) {\n sections.push(this.formatSection('EXAMPLES', info.examples));\n }\n\n // DETAILS section (additional information)\n if (info.details) {\n sections.push('\\n' + info.details);\n }\n\n // Footer\n if (info.commands && info.commands.length > 0) {\n sections.push(`Run '${info.name} <command> --help' for more information on a command.`);\n }\n\n return sections.join('\\n\\n');\n }\n\n /**\n * Format error message with usage hint\n */\n static formatError(error, command, usage) {\n const lines = [`Error: ${error}`, ''];\n\n if (usage) {\n lines.push(`Usage: ${usage}`);\n }\n\n lines.push(`Try '${command} --help' for more information.`);\n\n return lines.join('\\n');\n }\n\n /**\n * Format validation error with valid options\n */\n static formatValidationError(value, paramName, validOptions, command) {\n return this.formatError(\n `'${value}' is not a valid ${paramName}. Valid options are: ${validOptions.join(', ')}.`,\n command,\n );\n }\n\n static formatSection(title, content) {\n return `${title}\\n${content.map((line) => `${this.INDENT}${line}`).join('\\n')}`;\n }\n\n static formatCommands(commands) {\n const maxNameLength = Math.max(\n this.MIN_DESCRIPTION_COLUMN,\n ...commands.map((cmd) => {\n const nameLength = cmd.name.length;\n const aliasLength = cmd.aliases ? ` (${cmd.aliases.join(', ')})`.length : 0;\n return nameLength + aliasLength;\n }),\n );\n\n return commands.map((cmd) => {\n let name = cmd.name;\n if (cmd.aliases && cmd.aliases.length > 0) {\n name += ` (${cmd.aliases.join(', ')})`;\n }\n const padding = ' '.repeat(maxNameLength - name.length + this.COLUMN_GAP);\n return `${name}${padding}${cmd.description}`;\n });\n }\n\n static formatOptions(options) {\n const maxFlagsLength = Math.max(\n this.MIN_DESCRIPTION_COLUMN,\n ...options.map((opt) => opt.flags.length),\n );\n\n return options.map((opt) => {\n const padding = ' '.repeat(maxFlagsLength - opt.flags.length + this.COLUMN_GAP);\n let description = opt.description;\n\n // Add default value\n if (opt.defaultValue !== undefined) {\n description += ` [default: ${opt.defaultValue}]`;\n }\n\n // Add valid values on next line if present\n if (opt.validValues && opt.validValues.length > 0) {\n const validValuesLine =\n ' '.repeat(maxFlagsLength + this.COLUMN_GAP) + `Valid: ${opt.validValues.join(', ')}`;\n return `${opt.flags}${padding}${description}\\n${this.INDENT}${validValuesLine}`;\n }\n\n return `${opt.flags}${padding}${description}`;\n });\n }\n\n /**\n * Strip ANSI color codes and emojis from text\n */\n static stripFormatting(text) {\n // Remove ANSI color codes\n text = text.replace(/\\x1b\\[[0-9;]*m/g, '');\n\n // Remove common emojis used in the CLI\n const emojiPattern =\n /[\\u{1F300}-\\u{1F9FF}]|[\\u{2600}-\\u{27BF}]|[\\u{1F000}-\\u{1F6FF}]|[\\u{1F680}-\\u{1F6FF}]/gu;\n text = text.replace(emojiPattern, '').trim();\n\n // Remove multiple spaces\n text = text.replace(/\\s+/g, ' ');\n\n return text;\n }\n}\n"],"names":["HelpFormatter","INDENT","COLUMN_GAP","MIN_DESCRIPTION_COLUMN","formatHelp","info","sections","push","formatSection","name","description","usage","commands","length","formatCommands","options","formatOptions","globalOptions","examples","details","join","formatError","error","command","lines","formatValidationError","value","paramName","validOptions","title","content","map","line","maxNameLength","Math","max","cmd","nameLength","aliasLength","aliases","padding","repeat","maxFlagsLength","opt","flags","defaultValue","undefined","validValues","validValuesLine","stripFormatting","text","replace","emojiPattern","trim"],"mappings":"AAKA,OAAO,MAAMA;IACX,OAAOC,SAAS,OAAO;IACvB,OAAOC,aAAa,EAAE;IACtB,OAAOC,yBAAyB,GAAG;IAKnC,OAAOC,WAAWC,IAAI,EAAE;QACtB,MAAMC,WAAW,EAAE;QAGnBA,SAASC,IAAI,CAAC,IAAI,CAACC,aAAa,CAAC,QAAQ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7 +56,7 @@ export async function memoryCommand(subArgs, flags) {
|
|
|
56
56
|
await queryMemory(subArgs, loadMemory, namespace, enableRedaction);
|
|
57
57
|
break;
|
|
58
58
|
case 'stats':
|
|
59
|
-
await showMemoryStats(loadMemory);
|
|
59
|
+
await showMemoryStats(loadMemory, mode);
|
|
60
60
|
break;
|
|
61
61
|
case 'export':
|
|
62
62
|
await exportMemory(subArgs, loadMemory, namespace);
|
|
@@ -169,23 +169,70 @@ async function queryMemory(subArgs, loadMemory, namespace, enableRedaction = fal
|
|
|
169
169
|
printError(`Failed to query: ${err.message}`);
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
|
-
async function showMemoryStats(loadMemory) {
|
|
172
|
+
async function showMemoryStats(loadMemory, mode) {
|
|
173
173
|
try {
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
console.log(
|
|
187
|
-
|
|
188
|
-
|
|
174
|
+
const rbInitialized = await isReasoningBankInitialized();
|
|
175
|
+
if (mode === 'reasoningbank' || rbInitialized && mode !== 'basic') {
|
|
176
|
+
printSuccess('Memory Bank Statistics:\n');
|
|
177
|
+
const data = await loadMemory();
|
|
178
|
+
let totalEntries = 0;
|
|
179
|
+
const namespaceStats = {};
|
|
180
|
+
for (const [namespace, entries] of Object.entries(data)){
|
|
181
|
+
namespaceStats[namespace] = entries.length;
|
|
182
|
+
totalEntries += entries.length;
|
|
183
|
+
}
|
|
184
|
+
console.log('š JSON Storage (./memory/memory-store.json):');
|
|
185
|
+
console.log(` Total Entries: ${totalEntries}`);
|
|
186
|
+
console.log(` Namespaces: ${Object.keys(data).length}`);
|
|
187
|
+
console.log(` Size: ${(new TextEncoder().encode(JSON.stringify(data)).length / 1024).toFixed(2)} KB`);
|
|
188
|
+
if (Object.keys(data).length > 0) {
|
|
189
|
+
console.log(' Namespace Breakdown:');
|
|
190
|
+
for (const [namespace, count] of Object.entries(namespaceStats)){
|
|
191
|
+
console.log(` ${namespace}: ${count} entries`);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (rbInitialized) {
|
|
195
|
+
try {
|
|
196
|
+
const { getStatus } = await import('../../reasoningbank/reasoningbank-adapter.js');
|
|
197
|
+
const rbStats = await getStatus();
|
|
198
|
+
console.log('\nš§ ReasoningBank Storage (.swarm/memory.db):');
|
|
199
|
+
console.log(` Total Memories: ${rbStats.total_memories}`);
|
|
200
|
+
console.log(` Categories: ${rbStats.total_categories}`);
|
|
201
|
+
console.log(` Average Confidence: ${(rbStats.avg_confidence * 100).toFixed(1)}%`);
|
|
202
|
+
console.log(` Embeddings: ${rbStats.total_embeddings}`);
|
|
203
|
+
console.log(` Trajectories: ${rbStats.total_trajectories}`);
|
|
204
|
+
try {
|
|
205
|
+
const dbPath = rbStats.database_path || '.swarm/memory.db';
|
|
206
|
+
const stats = await fs.stat(dbPath);
|
|
207
|
+
console.log(` Database Size: ${(stats.size / 1024 / 1024).toFixed(2)} MB`);
|
|
208
|
+
} catch (sizeErr) {}
|
|
209
|
+
console.log('\nš” Active Mode: ReasoningBank (auto-selected)');
|
|
210
|
+
console.log(' Use --basic flag to force JSON-only statistics');
|
|
211
|
+
} catch (rbErr) {
|
|
212
|
+
console.log('\nā ļø ReasoningBank stats unavailable:', rbErr.message);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
} else {
|
|
216
|
+
const data = await loadMemory();
|
|
217
|
+
let totalEntries = 0;
|
|
218
|
+
const namespaceStats = {};
|
|
219
|
+
for (const [namespace, entries] of Object.entries(data)){
|
|
220
|
+
namespaceStats[namespace] = entries.length;
|
|
221
|
+
totalEntries += entries.length;
|
|
222
|
+
}
|
|
223
|
+
printSuccess('Memory Bank Statistics (JSON Mode):');
|
|
224
|
+
console.log(` Total Entries: ${totalEntries}`);
|
|
225
|
+
console.log(` Namespaces: ${Object.keys(data).length}`);
|
|
226
|
+
console.log(` Size: ${(new TextEncoder().encode(JSON.stringify(data)).length / 1024).toFixed(2)} KB`);
|
|
227
|
+
if (Object.keys(data).length > 0) {
|
|
228
|
+
console.log('\nš Namespace Breakdown:');
|
|
229
|
+
for (const [namespace, count] of Object.entries(namespaceStats)){
|
|
230
|
+
console.log(` ${namespace}: ${count} entries`);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
if (!rbInitialized) {
|
|
234
|
+
console.log('\nš” Tip: Initialize ReasoningBank for AI-powered memory');
|
|
235
|
+
console.log(' Run: memory init --reasoningbank');
|
|
189
236
|
}
|
|
190
237
|
}
|
|
191
238
|
} catch (err) {
|
|
@@ -437,6 +484,9 @@ async function handleReasoningBankCommand(command, subArgs, flags) {
|
|
|
437
484
|
case 'status':
|
|
438
485
|
await handleReasoningBankStatus(getStatus);
|
|
439
486
|
break;
|
|
487
|
+
case 'stats':
|
|
488
|
+
await handleReasoningBankStatus(getStatus);
|
|
489
|
+
break;
|
|
440
490
|
case 'consolidate':
|
|
441
491
|
case 'demo':
|
|
442
492
|
case 'test':
|