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 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.30"
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.ts"],"sourcesContent":["/**\n * Standardized CLI Help Formatter\n * Follows Unix/Linux conventions for help output\n */\n\nexport interface CommandInfo {\n name: string;\n description: string;\n usage?: string;\n commands?: CommandItem[];\n options?: OptionItem[];\n examples?: string[];\n globalOptions?: OptionItem[];\n}\n\nexport interface CommandItem {\n name: string;\n description: string;\n aliases?: string[];\n}\n\nexport interface OptionItem {\n flags: string;\n description: string;\n defaultValue?: string;\n validValues?: string[];\n}\n\nexport class HelpFormatter {\n private static readonly INDENT = ' ';\n private static readonly COLUMN_GAP = 2;\n private static readonly MIN_DESCRIPTION_COLUMN = 25;\n\n /**\n * Format main command help\n */\n static formatHelp(info: CommandInfo): string {\n const sections: string[] = [];\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 // 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: string, command: string, usage?: string): string {\n const lines: string[] = [`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(\n value: string,\n paramName: string,\n validOptions: string[],\n command: string,\n ): string {\n return this.formatError(\n `'${value}' is not a valid ${paramName}. Valid options are: ${validOptions.join(', ')}.`,\n command,\n );\n }\n\n private static formatSection(title: string, content: string[]): string {\n return `${title}\\n${content.map((line) => `${this.INDENT}${line}`).join('\\n')}`;\n }\n\n private static formatCommands(commands: CommandItem[]): string[] {\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 private static formatOptions(options: OptionItem[]): string[] {\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: string): string {\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","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":"AA4BA,OAAO,MAAMA;IACX,OAAwBC,SAAS,OAAO;IACxC,OAAwBC,aAAa,EAAE;IACvC,OAAwBC,yBAAyB,GAAG;IAKpD,OAAOC,WAAWC,IAAiB,EAAU;QAC3C,MAAMC,WAAqB,EAAE;QAG7BA,SAASC,IAAI,CAAC,IAAI,CAACC,aAAa,CAAC,QAAQ;YAAC,GAAGH,KAAKI,IAAI,CAAC,GAAG,EAAEJ,KAAKK,WAAW,EAAE;SAAC;QAG/E,IAAIL,KAAKM,KAAK,EAAE;YACdL,SAASC,IAAI,CAAC,IAAI,CAACC,aAAa,CAAC,YAAY;gBAACH,KAAKM,KAAK;aAAC;QAC3D;QAGA,IAAIN,KAAKO,QAAQ,IAAIP,KAAKO,QAAQ,CAACC,MAA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Qe,GAAG,CAAC,CAACY;YAClB,MAAMH,UAAU,IAAIC,MAAM,CAACC,iBAAiBC,IAAIC,KAAK,CAAC9B,MAAM,GAAG,IAAI,CAACX,UAAU;YAC9E,IAAIQ,cAAcgC,IAAIhC,WAAW;YAGjC,IAAIgC,IAAIE,YAAY,KAAKC,WAAW;gBAClCnC,eAAe,CAAC,WAAW,EAAEgC,IAAIE,YAAY,CAAC,CAAC,CAAC;YAClD;YAGA,IAAIF,IAAII,WAAW,IAAIJ,IAAII,WAAW,CAACjC,MAAM,GAAG,GAAG;gBACjD,MAAMkC,kBACJ,IAAIP,MAAM,CAACC,iBAAiB,IAAI,CAACvC,UAAU,IAAI,CAAC,OAAO,EAAEwC,IAAII,WAAW,CAAC3B,IAAI,CAAC,OAAO;gBACvF,OAAO,GAAGuB,IAAIC,KAAK,GAAGJ,UAAU7B,YAAY,EAAE,EAAE,IAAI,CAACT,MAAM,GAAG8C,iBAAiB;YACjF;YAEA,OAAO,GAAGL,IAAIC,KAAK,GAAGJ,UAAU7B,aAAa;QAC/C;IACF;IAKA,OAAOsC,gBAAgBC,IAAY,EAAU;QAE3CA,OAAOA,KAAKC,OAAO,CAAC,mBAAmB;QAGvC,MAAMC,eACJ;QACFF,OAAOA,KAAKC,OAAO,CAACC,cAAc,IAAIC,IAAI;QAG1CH,OAAOA,KAAKC,OAAO,CAAC,QAAQ;QAE5B,OAAOD;IACT;AACF"}
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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ACF"}
@@ -56,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 data = await loadMemory();
175
- let totalEntries = 0;
176
- const namespaceStats = {};
177
- for (const [namespace, entries] of Object.entries(data)){
178
- namespaceStats[namespace] = entries.length;
179
- totalEntries += entries.length;
180
- }
181
- printSuccess('Memory Bank Statistics:');
182
- console.log(` Total Entries: ${totalEntries}`);
183
- console.log(` Namespaces: ${Object.keys(data).length}`);
184
- console.log(` Size: ${(new TextEncoder().encode(JSON.stringify(data)).length / 1024).toFixed(2)} KB`);
185
- if (Object.keys(data).length > 0) {
186
- console.log('\nšŸ“ Namespace Breakdown:');
187
- for (const [namespace, count] of Object.entries(namespaceStats)){
188
- console.log(` ${namespace}: ${count} entries`);
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':