Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

πŸ”– Checkpoint: Edit /workspaces/claude-code-flow/src/cli/simple-commands/analysis.js

rUv9d71ca1cc228
diff --git a/.claude/checkpoints/1755116364.json b/.claude/checkpoints/1755116364.json
new file mode 100644
index 0000000000..2e542c1540
--- /dev/null
+++ b/.claude/checkpoints/1755116364.json
@@ -0,0 +1 @@
+{"branch": "checkpoint/pre-edit-20250813-201924", "file": "/workspaces/claude-code-flow/src/cli/simple-commands/analysis.js", "timestamp": "2025-08-13T20:19:24Z", "type": "pre-edit", "original_branch": "alpha-89"}
diff --git a/.claude/checkpoints/1755116365.json b/.claude/checkpoints/1755116365.json
new file mode 100644
index 0000000000..48c54ea304
--- /dev/null
+++ b/.claude/checkpoints/1755116365.json
@@ -0,0 +1 @@
+{"tag": "checkpoint-20250813-201925", "file": "/workspaces/claude-code-flow/src/cli/simple-commands/analysis.js", "timestamp": "2025-08-13T20:19:25Z", "type": "post-edit", "branch": "alpha-89", "diff_summary": " .claude-flow/metrics/performance.json | 2 +- .claude-flow/metrics/system-metrics.json | 36 ++++++++++++ .claude-flow/metrics/task-metrics.json | 6 +- .claude/checkpoints/1755116334.json | 1 + .claude/checkpoints/1755116336.json | 1 + analysis-reports/token-usage-1755116357970.csv | 8 +++ claude-flow-wiki | 0 src/cli/simple-commands/analysis.js | 76 ++++++++++++++++++++++++++ 8 files changed, 126 insertions(+), 4 deletions(-) "}
diff --git a/analysis-reports/bottleneck-1755116382311.json b/analysis-reports/bottleneck-1755116382311.json
new file mode 100644
index 0000000000..c7e993e273
--- /dev/null
+++ b/analysis-reports/bottleneck-1755116382311.json
@@ -0,0 +1,15 @@
+{
+ "scope": "system",
+ "target": "all",
+ "bottlenecks": [
+ {
+ "severity": "good",
+ "component": "Overall system",
+ "metric": "No bottlenecks detected"
+ }
+ ],
+ "recommendations": [],
+ "analysisDuration": 263.92715,
+ "confidenceScore": 0.85,
+ "issuesDetected": 0
+}
\ No newline at end of file
diff --git a/analysis-reports/token-usage-1755116390160.csv b/analysis-reports/token-usage-1755116390160.csv
new file mode 100644
index 0000000000..9d4f2b6113
--- /dev/null
+++ b/analysis-reports/token-usage-1755116390160.csv
@@ -0,0 +1,8 @@
+Timestamp,Session,Agent,Command,Input Tokens,Output Tokens,Total
+
+SUMMARY
+Total Input Tokens,0
+Total Output Tokens,0
+Total Tokens,0
+
+BY AGENT TYPE
diff --git a/analysis-reports/token-usage-1755116407862.csv b/analysis-reports/token-usage-1755116407862.csv
new file mode 100644
index 0000000000..9d4f2b6113
--- /dev/null
+++ b/analysis-reports/token-usage-1755116407862.csv
@@ -0,0 +1,8 @@
+Timestamp,Session,Agent,Command,Input Tokens,Output Tokens,Total
+
+SUMMARY
+Total Input Tokens,0
+Total Output Tokens,0
+Total Tokens,0
+
+BY AGENT TYPE
diff --git a/src/cli/simple-commands/analysis.js b/src/cli/simple-commands/analysis.js
index 85d3588e1e..7c71a528ba 100644
--- a/src/cli/simple-commands/analysis.js
+++ b/src/cli/simple-commands/analysis.js
@@ -297,43 +297,53 @@ async function tokenUsageCommand(subArgs, flags) {
printSuccess(`βœ… Token usage analysis completed`);
- // Display real token usage
- console.log(`\nπŸ”’ TOKEN USAGE SUMMARY:`);
- console.log(` πŸ“ Total tokens consumed: ${tokenData.total.toLocaleString()}`);
- console.log(` πŸ“₯ Input tokens: ${tokenData.input.toLocaleString()} (${((tokenData.input / tokenData.total) * 100).toFixed(1)}%)`);
- console.log(` πŸ“€ Output tokens: ${tokenData.output.toLocaleString()} (${((tokenData.output / tokenData.total) * 100).toFixed(1)}%)`);
-
- if (costAnalysis) {
- const cost = calculateCost(tokenData);
- console.log(` πŸ’° Estimated cost: $${cost.total.toFixed(2)}`);
- console.log(` Input cost: $${cost.input.toFixed(2)}`);
- console.log(` Output cost: $${cost.output.toFixed(2)}`);
- }
+ // Check if we have any data
+ if (tokenData.total === 0) {
+ // Show instructions when no data available
+ await showSimulatedTokenUsage(breakdown, costAnalysis);
+
+ // Still generate empty report for consistency
+ const reportPath = await generateTokenUsageReport(tokenData, agent);
+ console.log(`\nπŸ“„ Detailed usage log: ${reportPath}`);
+ } else {
+ // Display real token usage
+ console.log(`\nπŸ”’ TOKEN USAGE SUMMARY:`);
+ console.log(` πŸ“ Total tokens consumed: ${tokenData.total.toLocaleString()}`);
+ console.log(` πŸ“₯ Input tokens: ${tokenData.input.toLocaleString()} (${((tokenData.input / tokenData.total) * 100).toFixed(1)}%)`);
+ console.log(` πŸ“€ Output tokens: ${tokenData.output.toLocaleString()} (${((tokenData.output / tokenData.total) * 100).toFixed(1)}%)`);
+
+ if (costAnalysis) {
+ const cost = calculateCost(tokenData);
+ console.log(` πŸ’° Estimated cost: $${cost.total.toFixed(2)}`);
+ console.log(` Input cost: $${cost.input.toFixed(2)}`);
+ console.log(` Output cost: $${cost.output.toFixed(2)}`);
+ }
- if (breakdown && tokenData.byAgent) {
- console.log(`\nπŸ“Š BREAKDOWN BY AGENT TYPE:`);
- Object.entries(tokenData.byAgent).forEach(([agentType, usage]) => {
- const percentage = ((usage / tokenData.total) * 100).toFixed(1);
- const icon = getAgentIcon(agentType);
- console.log(` ${icon} ${agentType}: ${usage.toLocaleString()} tokens (${percentage}%)`);
- });
+ if (breakdown && tokenData.byAgent) {
+ console.log(`\nπŸ“Š BREAKDOWN BY AGENT TYPE:`);
+ Object.entries(tokenData.byAgent).forEach(([agentType, usage]) => {
+ const percentage = ((usage / tokenData.total) * 100).toFixed(1);
+ const icon = getAgentIcon(agentType);
+ console.log(` ${icon} ${agentType}: ${usage.toLocaleString()} tokens (${percentage}%)`);
+ });
- console.log(`\nπŸ’‘ OPTIMIZATION OPPORTUNITIES:`);
- const opportunities = generateOptimizationSuggestions(tokenData);
- opportunities.forEach(suggestion => {
- console.log(` β€’ ${suggestion}`);
- });
- }
+ console.log(`\nπŸ’‘ OPTIMIZATION OPPORTUNITIES:`);
+ const opportunities = generateOptimizationSuggestions(tokenData);
+ opportunities.forEach(suggestion => {
+ console.log(` β€’ ${suggestion}`);
+ });
+ }
- // Generate real CSV report
- const reportPath = await generateTokenUsageReport(tokenData, agent);
- console.log(`\nπŸ“„ Detailed usage log: ${reportPath}`);
+ // Generate real CSV report
+ const reportPath = await generateTokenUsageReport(tokenData, agent);
+ console.log(`\nπŸ“„ Detailed usage log: ${reportPath}`);
+ }
} catch (err) {
printError(`Failed to get real token usage: ${err.message}`);
- printWarning('Falling back to simulated data...');
+ printWarning('Falling back to help instructions...');
- // Fallback to simulated data
+ // Fallback to instructions
await showSimulatedTokenUsage(breakdown, costAnalysis);
}
}