π 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
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
π Checkpoint: Edit /workspaces/claude-code-flow/src/cli/simple-commands/analysis.js
rUv7eb71681402f
diff --git a/.claude/checkpoints/task-1755116261.json b/.claude/checkpoints/task-1755116261.jsonnew file mode 100644index 0000000000..a0bb8951bd--- /dev/null+++ b/.claude/checkpoints/task-1755116261.json@@ -0,0 +1 @@+{"checkpoint": "task-20250813-201740", "task": "add better instructions. for CLAUDE_CODE_ENABLE_TELEMETRY=1 with a flag that sets it. ", "timestamp": "2025-08-13T20:17:41Z", "commit": "f7793f159e9358771c8344917d612c3ea50d0247", "github_release": "true"}diff --git a/src/cli/simple-commands/analysis.js b/src/cli/simple-commands/analysis.jsindex 1d3962c325..91b36efb0e 100644--- a/src/cli/simple-commands/analysis.js+++ b/src/cli/simple-commands/analysis.js@@ -36,6 +36,12 @@ export async function analysisAction(subArgs, flags) {return;}+ // Handle telemetry setup+ if (subcommand === 'setup-telemetry' || options['enable-telemetry']) {+ await setupTelemetry();+ if (subcommand === 'setup-telemetry') return;+ }+try {switch (subcommand) {case 'bottleneck-detect':@@ -264,10 +270,24 @@ USAGE:claude-flow analysis <command> [options]COMMANDS:+ setup-telemetry Configure token tracking for Claude API callsbottleneck-detect Detect performance bottlenecks in the systemperformance-report Generate comprehensive performance reportstoken-usage Analyze token consumption and costs+GLOBAL OPTIONS:+ --enable-telemetry Enable token tracking for this session+ --help, -h Show this help message++TELEMETRY SETUP:+ claude-flow analysis setup-telemetry++ This command will:+ β’ Set CLAUDE_CODE_ENABLE_TELEMETRY=1 in your environment+ β’ Create .env file with telemetry settings+ β’ Initialize token tracking directory+ β’ Show current telemetry status+BOTTLENECK DETECT OPTIONS:--scope <scope> Analysis scope (default: system)Options: system, swarm, agent, task, memory@@ -284,29 +304,32 @@ TOKEN USAGE OPTIONS:--agent <agent> Filter by agent type or ID (default: all)--breakdown Include detailed breakdown by agent type--cost-analysis Include cost projections and optimization+ --enable-telemetry Enable token tracking for this sessionEXAMPLES:+ # First-time setup for token tracking+ claude-flow analysis setup-telemetry++ # Token usage with telemetry enabled+ claude-flow analysis token-usage --enable-telemetry --breakdown+# Detect system-wide bottlenecksclaude-flow analysis bottleneck-detect --scope system- # Agent-specific bottleneck analysis- claude-flow analysis bottleneck-detect --scope agent --target coordinator-1-# Weekly performance reportclaude-flow analysis performance-report --timeframe 7d --format detailed- # Token usage with breakdown+ # Token usage with full analysisclaude-flow analysis token-usage --breakdown --cost-analysis- # Swarm-specific analysis- claude-flow analysis bottleneck-detect --scope swarm --target swarm-123-π― Analysis helps with:+ β’ Token usage tracking & cost managementβ’ Performance optimization- β’ Cost managementβ’ Resource allocationβ’ Bottleneck identificationβ’ Trend analysis++π‘ TIP: Run 'analysis setup-telemetry' first to enable token tracking!`);}@@ -316,26 +339,44 @@ async function showSimulatedTokenUsage(breakdown, costAnalysis) {// Show honest message about no data instead of fake numbersconsole.log(`\nπ’ TOKEN USAGE ANALYSIS:`);console.log(` βΉοΈ No token usage data available yet.`);- console.log(`\n Token tracking requires:`);- console.log(` β’ Claude Code API calls to be made`);- console.log(` β’ Commands run with --claude flag`);- console.log(` β’ Or set CLAUDE_CODE_ENABLE_TELEMETRY=1`);- console.log(`\nπ‘ To start tracking tokens:`);- console.log(` 1. Run: export CLAUDE_CODE_ENABLE_TELEMETRY=1`);- console.log(` 2. Use: ./claude-flow swarm "task" --claude`);- console.log(` 3. Check back after running Claude commands`);+ console.log(`\nπ QUICK SETUP - Choose one option:`);+ console.log(`\n Option 1: Enable Telemetry (Recommended)`);+ console.log(` ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ`);+ console.log(` β ./claude-flow analysis setup-telemetry β`);+ console.log(` ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ`);++ console.log(`\n Option 2: Manual Environment Variable`);+ console.log(` ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ`);+ console.log(` β export CLAUDE_CODE_ENABLE_TELEMETRY=1 β`);+ console.log(` ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ`);++ console.log(`\n Option 3: Use --enable-telemetry Flag`);+ console.log(` ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ`);+ console.log(` β ./claude-flow analysis token-usage --enable-telemetry β`);+ console.log(` ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ`);++ console.log(`\nβ AFTER SETUP:`);+ console.log(` 1. Run Claude commands: ./claude-flow swarm "task" --claude`);+ console.log(` 2. Token usage will be automatically tracked`);+ console.log(` 3. Return here to see real metrics`);if (costAnalysis) {- console.log(`\nπ° Cost analysis will be available once tokens are tracked.`);- console.log(` Pricing: $15/1M input tokens, $75/1M output tokens (Claude 3 Opus)`);+ console.log(`\nπ° COST TRACKING:`);+ console.log(` β’ Claude 3 Opus: $15/1M input, $75/1M output tokens`);+ console.log(` β’ Claude 3 Sonnet: $3/1M input, $15/1M output tokens`);+ console.log(` β’ Claude 3 Haiku: $0.25/1M input, $1.25/1M output tokens`);}if (breakdown) {- console.log(`\nπ Agent breakdown will show once agents use Claude Code.`);- console.log(` Each agent type's token usage will be tracked separately.`);+ console.log(`\nπ AGENT BREAKDOWN:`);+ console.log(` β’ Each agent type's usage tracked separately`);+ console.log(` β’ Identifies high-consumption agents`);+ console.log(` β’ Provides optimization recommendations`);}- console.log(`\nπ Reports will be generated once data is available.`);- console.log(` Enable CLAUDE_CODE_ENABLE_TELEMETRY=1 for automatic tracking.`);+ console.log(`\nβ TROUBLESHOOTING:`);+ console.log(` β’ Check telemetry status: echo $CLAUDE_CODE_ENABLE_TELEMETRY`);+ console.log(` β’ View raw data: cat .claude-flow/metrics/token-usage.json`);+ console.log(` β’ Reset tracking: rm -rf .claude-flow/metrics/token-usage.json`);}