Files
SuperClaude/.claude/commands/shared/performance.yml
NomenAK ff61676f74 refactor: Remove all hard claims, metrics, and numeric targets
Comprehensive update to remove specific performance claims and replace with qualitative descriptions:

- Replace percentage claims (65%, 70%, 99.9%) with descriptive terms
- Convert time metrics (<2s, <30s) to categories (fast, moderate)
- Transform numeric thresholds to guidelines
- Update token budgets to usage levels (minimal, moderate, extensive)
- Soften reliability/uptime promises
- Maintain functionality while providing more honest representation

Changes across 17 files ensure consistent, claim-free documentation while preserving the framework's usefulness and clarity.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-24 22:02:29 +02:00

318 lines
12 KiB
YAML

# Performance Monitoring & Optimization System
## Legend
| Symbol | Meaning | | Abbrev | Meaning |
|--------|---------|---|--------|---------|
| ⚡ | fast/optimized | | perf | performance |
| 📊 | metrics/data | | exec | execution |
| ⏱ | timing/duration | | tok | token |
| 🔄 | continuous | | opt | optimization |
## Performance Metrics
```yaml
Command_Performance:
Timing_Metrics:
Start_Time: "Record command initiation timestamp"
End_Time: "Record command completion timestamp"
Duration: "end_time - start_time"
Phases: "Breakdown by major operations (analysis, execution, reporting)"
Token_Metrics:
Input_Tokens: "Tokens in user command + context"
Output_Tokens: "Tokens in response + tool calls"
MCP_Tokens: "Tokens consumed by MCP servers"
Efficiency_Ratio: "output_value / total_tokens"
Context_Size: "Total context size throughout operation"
Operation_Metrics:
Tools_Used: "List of tools called (Read, Edit, Bash, etc)"
Files_Accessed: "Number of files read/written/analyzed"
MCP_Calls: "Which MCP servers used + frequency"
Error_Count: "Number of errors encountered"
Retry_Count: "Number of retry attempts needed"
Success_Metrics:
Completion_Status: "success|partial|failure"
User_Satisfaction: "Interruptions, corrections, positive signals"
Quality_Score: "Estimated output quality (1-10)"
Objectives_Met: "Did operation achieve stated goals?"
Op_Duration_Tracking:
Average_vs_Current: "Compare current execution to historical average"
Trend_Analysis: "Track performance changes over time"
Baseline_Comparison: "Measure against established benchmarks"
Token_Consumption_Analysis:
Usage_per_Operation: "Token consumption by command type"
Baseline_Comparison: "Compare to expected token usage"
Efficiency_Ratios: "Value delivered per token consumed"
Optimization_Opportunities: "Areas for token reduction"
Success_Rate_Monitoring:
Command_Completion_Rate: "Percentage of successful completions"
Error_Frequency: "Types and frequency of errors"
Retry_Patterns: "When and why retries are needed"
User_Intervention_Rate: "How often users need to correct/guide"
```
## Performance Baselines & Thresholds
```yaml
Command_Benchmarks:
Simple_Commands:
read_file: "fast, minimal tokens"
edit_file: "fast, minimal tokens"
analyze_single_file: "fast, minimal tokens"
git_status: "fast, minimal tokens"
Medium_Commands:
build_component: "moderate duration, moderate tokens"
test_execution: "moderate duration, moderate tokens"
security_scan: "moderate duration, moderate tokens"
analyze_multiple_files: "moderate duration, moderate tokens"
Complex_Commands:
full_codebase_analysis: "extended duration, extensive tokens"
architecture_design: "extended duration, extensive tokens"
comprehensive_security_audit: "extended duration, extensive tokens"
MCP_Server_Performance:
Context7: "fast response, minimal to moderate tokens typical"
Sequential: "moderate analysis time, moderate to extensive tokens typical"
Magic: "fast generation, moderate tokens typical"
Puppeteer: "fast operation, minimal tokens"
Performance_Thresholds:
Time_Limits:
Yellow_Warning: "Extended operations → Consider alternatives"
Red_Alert: "Very long operations → Force timeout, explain delay, offer cancellation"
Critical: "Excessive duration → Immediate intervention required"
Token_Limits:
Moderate_Usage: "High token usage single op → Simplify approach"
High_Usage: "Very high session usage → Suggest /compact mode"
Critical_Usage: "Excessive usage → Force optimization"
Error_Patterns:
Concern_Level: "Multiple retries same operation → Switch strategy"
Critical_Level: "Repeated failures → Escalate to manual approach"
System_Issue: "Many consecutive failures → System health check"
```
## Adaptive Optimization Strategies
```yaml
Real_Time_Performance_Optimization:
Slow_Operations_Response:
Detection: "Operations exceeding moderate duration threshold"
Immediate_Actions:
- Switch to faster tools (rg vs grep, parallel processing)
- Reduce operation scope (specific files vs full scan)
- Enable parallel processing where possible
- Break large operations into smaller chunks
High_Token_Usage_Response:
Detection: "High context usage or extensive tokens in single operation"
Immediate_Actions:
- Auto-suggest UltraCompressed mode (--uc)
- Cache repeated content and use references
- Summarize large outputs instead of full details
- Use shared templates instead of duplicating content
Error_Pattern_Response:
Repeated_Failures:
Detection: "Multiple failures of same operation type"
Actions:
- Switch to alternative tool/approach
- Adjust strategy based on error type
- Request user guidance for complex issues
- Document known issue for future prevention
Workflow_Acceleration:
Pattern_Recognition:
Successful_Sequences: "Learn from effective command chains"
Efficient_Combinations: "Track optimal persona + command + flag combinations"
User_Preferences: "Adapt to user's working style over time"
Predictive_Optimization:
Context_Preloading: "Anticipate likely-needed resources"
Smart_Caching: "Store and reuse expensive analysis results"
Skip_Redundant: "Avoid re-analysis of unchanged files"
Progressive_Refinement: "Start broad, narrow focus as needed"
When_Slow_Strategies:
File_Operations: "Use faster tools (rg vs grep, fd vs find)"
Large_Codebases: "Focus on specific areas, progressive analysis"
Complex_Analysis: "Break into phases, provide interim results"
Network_Operations: "Parallel requests, intelligent caching"
When_High_Token_Usage:
Verbose_Output: "Switch to concise/compressed mode automatically"
Repeated_Content: "Use cross-references instead of duplication"
Large_Responses: "Summarize key points, provide detailed links"
Context_Management: "Smart context trimming, keep only essential"
When_Errors_Occur:
Tool_Failures: "Try alternative tools/approaches immediately"
Permission_Issues: "Provide specific fix guidance"
Missing_Dependencies: "Guide installation with exact commands"
Configuration_Problems: "Auto-detect and suggest corrections"
```
## Monitoring Implementation
```yaml
Data_Collection:
Lightweight_Tracking:
Performance_Impact: "Minimal overhead on operations"
Background_Collection: "No user interruption during monitoring"
Privacy_Preserving: "Local storage only, no external transmission"
User_Configurable: "Can be disabled via settings"
Storage_Format:
Location: ".claudedocs/metrics/performance-YYYY-MM-DD.jsonl"
Format: "JSON Lines (one record per command execution)"
Retention_Policy: "30 days rolling storage, monthly aggregation"
Size_Management: "10MB max per day, auto-rotation"
Data_Structure:
timestamp: "ISO 8601 format"
command: "Full command with flags"
persona: "Active persona (if any)"
duration_ms: "Execution time in milliseconds"
tokens_input: "Input token count"
tokens_output: "Output token count"
tools_used: "Array of tool names"
mcp_servers: "Array of MCP servers used"
success: "Boolean completion status"
error_count: "Number of errors encountered"
user_corrections: "Number of user interruptions/corrections"
optimization_applied: "Any auto-optimizations used"
```
## Performance Reporting
```yaml
Real_Time_Feedback:
Transparency_Messages:
- "Operation taking longer than expected, switching to faster method"
- "Optimizing approach to reduce token usage"
- "Primary method failed, trying backup approach"
- "Completed efficiently using optimized strategy"
Progress_Updates:
- Show percentage completion for long operations
- Indicate optimization strategies being applied
- Provide ETAs for remaining work
- Alert when alternative approaches are being tried
Automated_Reports:
Daily_Summary:
Location: ".claudedocs/metrics/daily-summary-YYYY-MM-DD.md"
Content:
- Command execution statistics
- Token efficiency metrics
- Error frequency analysis
- Optimization wins and opportunities
- Performance trend indicators
Weekly_Trends:
Location: ".claudedocs/metrics/weekly-trends-YYYY-WW.md"
Content:
- Performance trend analysis over 7 days
- Usage pattern identification
- Efficiency improvements over time
- Bottleneck identification and resolution
- User workflow optimization suggestions
Monthly_Insights:
Location: ".claudedocs/metrics/monthly-insights-YYYY-MM.md"
Content:
- Long-term performance trends
- System optimization recommendations
- User productivity analysis
- Technology stack efficiency assessment
Performance_Insights:
Bottleneck_Identification: "Which operations consume most resources"
Efficiency_Trends: "Performance improvement over time"
User_Patterns: "Most effective workflows and flag combinations"
Optimization_Recommendations: "Specific suggestions for improvement"
Success_Factor_Analysis: "What leads to successful outcomes"
```
## Integration Points
```yaml
Command_Wrapper_Integration:
Pre_Execution:
- Record start timestamp and context state
- Capture input context size and complexity
- Note active persona, flags, and user preferences
- Check for known performance issues with operation
During_Execution:
- Track tool usage and performance
- Monitor MCP server response times
- Count errors, retries, and optimization attempts
- Provide real-time feedback on long operations
Post_Execution:
- Record completion time and final status
- Calculate total token consumption
- Assess success metrics and quality
- Store performance record for future analysis
- Generate optimization recommendations
Auto_Optimization_Features:
Context_Size_Management:
- Auto-suggest /compact when context >70%
- Enable --uc mode for responses >2K tokens
- Cache expensive analysis results
- Trim redundant context intelligently
Tool_Selection_Optimization:
- Prefer faster tools for routine operations
- Use parallel execution when safe and beneficial
- Skip redundant file reads and analyses
- Choose optimal MCP server for each task
User_Experience_Enhancement:
- Proactive performance feedback during operations
- Intelligent optimization suggestions
- Alternative approach recommendations
- Learning from user preferences and corrections
```
## Configuration & Customization
```yaml
Performance_Settings:
Monitoring_Level:
minimal: "Basic timing and success tracking"
standard: "Full performance monitoring (default)"
detailed: "Comprehensive analysis with detailed breakdowns"
disabled: "No performance tracking"
Optimization_Aggressiveness:
conservative: "Optimize only when significant benefit"
balanced: "Reasonable optimization vs consistency trade-offs"
aggressive: "Maximum optimization, accept some workflow changes"
Alert_Preferences:
real_time: "Show optimization messages during operations"
summary: "Daily/weekly performance summaries only"
critical_only: "Alert only on significant issues"
silent: "No performance notifications"
Auto_Optimization_Controls:
Enable_Auto_UC: "Automatically enable UltraCompressed mode"
Enable_Tool_Switching: "Allow automatic tool substitution"
Enable_Scope_Reduction: "Automatically reduce operation scope when slow"
Enable_Parallel_Processing: "Use parallel execution when beneficial"
```
---
*Performance System v4.0.0 - Comprehensive monitoring, analysis, and optimization for SuperClaude*