feat: CRM Clinicas SaaS - MVP completo
- Auth: Login/Register con creacion de clinica - Dashboard: KPIs reales, graficas recharts - Pacientes: CRUD completo con busqueda - Agenda: FullCalendar, drag-and-drop, vista recepcion - Expediente: Notas SOAP, signos vitales, CIE-10 - Facturacion: Facturas con IVA, campos CFDI SAT - Inventario: Productos, stock, movimientos, alertas - Configuracion: Clinica, equipo, catalogo servicios - Supabase self-hosted: 18 tablas con RLS multi-tenant - Docker + Nginx para produccion Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
54
.claude/commands/analysis/COMMAND_COMPLIANCE_REPORT.md
Normal file
54
.claude/commands/analysis/COMMAND_COMPLIANCE_REPORT.md
Normal file
@@ -0,0 +1,54 @@
|
||||
# Analysis Commands Compliance Report
|
||||
|
||||
## Overview
|
||||
Reviewed all command files in `.claude/commands/analysis/` directory to ensure proper usage of:
|
||||
- `mcp__claude-flow__*` tools (preferred)
|
||||
- `npx claude-flow` commands (as fallback)
|
||||
- No direct implementation calls
|
||||
|
||||
## Files Reviewed
|
||||
|
||||
### 1. token-efficiency.md
|
||||
**Status**: ✅ Updated
|
||||
**Changes Made**:
|
||||
- Replaced `npx ruv-swarm hook session-end --export-metrics` with proper MCP tool call
|
||||
- Updated to: `Tool: mcp__claude-flow__token_usage` with appropriate parameters
|
||||
- Maintained result format and context
|
||||
|
||||
**Before**:
|
||||
```bash
|
||||
npx ruv-swarm hook session-end --export-metrics
|
||||
```
|
||||
|
||||
**After**:
|
||||
```
|
||||
Tool: mcp__claude-flow__token_usage
|
||||
Parameters: {"operation": "session", "timeframe": "24h"}
|
||||
```
|
||||
|
||||
### 2. performance-bottlenecks.md
|
||||
**Status**: ✅ Compliant (No changes needed)
|
||||
**Reason**: Already uses proper `mcp__claude-flow__task_results` tool format
|
||||
|
||||
## Summary
|
||||
|
||||
- **Total files reviewed**: 2
|
||||
- **Files updated**: 1
|
||||
- **Files already compliant**: 1
|
||||
- **Compliance rate after updates**: 100%
|
||||
|
||||
## Compliance Patterns Enforced
|
||||
|
||||
1. **MCP Tool Usage**: All direct tool calls now use `mcp__claude-flow__*` format
|
||||
2. **Parameter Format**: JSON parameters properly structured
|
||||
3. **Command Context**: Preserved original functionality and expected results
|
||||
4. **Documentation**: Maintained clarity and examples
|
||||
|
||||
## Recommendations
|
||||
|
||||
1. All analysis commands now follow the proper pattern
|
||||
2. No direct bash commands or implementation calls remain
|
||||
3. Token usage analysis properly integrated with MCP tools
|
||||
4. Performance analysis already using correct tool format
|
||||
|
||||
The analysis directory is now fully compliant with the Claude Flow command standards.
|
||||
9
.claude/commands/analysis/README.md
Normal file
9
.claude/commands/analysis/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# Analysis Commands
|
||||
|
||||
Commands for analysis operations in Claude Flow.
|
||||
|
||||
## Available Commands
|
||||
|
||||
- [bottleneck-detect](./bottleneck-detect.md)
|
||||
- [token-usage](./token-usage.md)
|
||||
- [performance-report](./performance-report.md)
|
||||
162
.claude/commands/analysis/bottleneck-detect.md
Normal file
162
.claude/commands/analysis/bottleneck-detect.md
Normal file
@@ -0,0 +1,162 @@
|
||||
# bottleneck detect
|
||||
|
||||
Analyze performance bottlenecks in swarm operations and suggest optimizations.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
npx claude-flow bottleneck detect [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
- `--swarm-id, -s <id>` - Analyze specific swarm (default: current)
|
||||
- `--time-range, -t <range>` - Analysis period: 1h, 24h, 7d, all (default: 1h)
|
||||
- `--threshold <percent>` - Bottleneck threshold percentage (default: 20)
|
||||
- `--export, -e <file>` - Export analysis to file
|
||||
- `--fix` - Apply automatic optimizations
|
||||
|
||||
## Examples
|
||||
|
||||
### Basic bottleneck detection
|
||||
|
||||
```bash
|
||||
npx claude-flow bottleneck detect
|
||||
```
|
||||
|
||||
### Analyze specific swarm
|
||||
|
||||
```bash
|
||||
npx claude-flow bottleneck detect --swarm-id swarm-123
|
||||
```
|
||||
|
||||
### Last 24 hours with export
|
||||
|
||||
```bash
|
||||
npx claude-flow bottleneck detect -t 24h -e bottlenecks.json
|
||||
```
|
||||
|
||||
### Auto-fix detected issues
|
||||
|
||||
```bash
|
||||
npx claude-flow bottleneck detect --fix --threshold 15
|
||||
```
|
||||
|
||||
## Metrics Analyzed
|
||||
|
||||
### Communication Bottlenecks
|
||||
|
||||
- Message queue delays
|
||||
- Agent response times
|
||||
- Coordination overhead
|
||||
- Memory access patterns
|
||||
|
||||
### Processing Bottlenecks
|
||||
|
||||
- Task completion times
|
||||
- Agent utilization rates
|
||||
- Parallel execution efficiency
|
||||
- Resource contention
|
||||
|
||||
### Memory Bottlenecks
|
||||
|
||||
- Cache hit rates
|
||||
- Memory access patterns
|
||||
- Storage I/O performance
|
||||
- Neural pattern loading
|
||||
|
||||
### Network Bottlenecks
|
||||
|
||||
- API call latency
|
||||
- MCP communication delays
|
||||
- External service timeouts
|
||||
- Concurrent request limits
|
||||
|
||||
## Output Format
|
||||
|
||||
```
|
||||
🔍 Bottleneck Analysis Report
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
|
||||
📊 Summary
|
||||
├── Time Range: Last 1 hour
|
||||
├── Agents Analyzed: 6
|
||||
├── Tasks Processed: 42
|
||||
└── Critical Issues: 2
|
||||
|
||||
🚨 Critical Bottlenecks
|
||||
1. Agent Communication (35% impact)
|
||||
└── coordinator → coder-1 messages delayed by 2.3s avg
|
||||
|
||||
2. Memory Access (28% impact)
|
||||
└── Neural pattern loading taking 1.8s per access
|
||||
|
||||
⚠️ Warning Bottlenecks
|
||||
1. Task Queue (18% impact)
|
||||
└── 5 tasks waiting > 10s for assignment
|
||||
|
||||
💡 Recommendations
|
||||
1. Switch to hierarchical topology (est. 40% improvement)
|
||||
2. Enable memory caching (est. 25% improvement)
|
||||
3. Increase agent concurrency to 8 (est. 20% improvement)
|
||||
|
||||
✅ Quick Fixes Available
|
||||
Run with --fix to apply:
|
||||
- Enable smart caching
|
||||
- Optimize message routing
|
||||
- Adjust agent priorities
|
||||
```
|
||||
|
||||
## Automatic Fixes
|
||||
|
||||
When using `--fix`, the following optimizations may be applied:
|
||||
|
||||
1. **Topology Optimization**
|
||||
|
||||
- Switch to more efficient topology
|
||||
- Adjust communication patterns
|
||||
- Reduce coordination overhead
|
||||
|
||||
2. **Caching Enhancement**
|
||||
|
||||
- Enable memory caching
|
||||
- Optimize cache strategies
|
||||
- Preload common patterns
|
||||
|
||||
3. **Concurrency Tuning**
|
||||
|
||||
- Adjust agent counts
|
||||
- Optimize parallel execution
|
||||
- Balance workload distribution
|
||||
|
||||
4. **Priority Adjustment**
|
||||
- Reorder task queues
|
||||
- Prioritize critical paths
|
||||
- Reduce wait times
|
||||
|
||||
## Performance Impact
|
||||
|
||||
Typical improvements after bottleneck resolution:
|
||||
|
||||
- **Communication**: 30-50% faster message delivery
|
||||
- **Processing**: 20-40% reduced task completion time
|
||||
- **Memory**: 40-60% fewer cache misses
|
||||
- **Overall**: 25-45% performance improvement
|
||||
|
||||
## Integration with Claude Code
|
||||
|
||||
```javascript
|
||||
// Check for bottlenecks in Claude Code
|
||||
mcp__claude-flow__bottleneck_detect {
|
||||
timeRange: "1h",
|
||||
threshold: 20,
|
||||
autoFix: false
|
||||
}
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
- `performance report` - Detailed performance analysis
|
||||
- `token usage` - Token optimization analysis
|
||||
- `swarm monitor` - Real-time monitoring
|
||||
- `cache manage` - Cache optimization
|
||||
59
.claude/commands/analysis/performance-bottlenecks.md
Normal file
59
.claude/commands/analysis/performance-bottlenecks.md
Normal file
@@ -0,0 +1,59 @@
|
||||
# Performance Bottleneck Analysis
|
||||
|
||||
## Purpose
|
||||
Identify and resolve performance bottlenecks in your development workflow.
|
||||
|
||||
## Automated Analysis
|
||||
|
||||
### 1. Real-time Detection
|
||||
The post-task hook automatically analyzes:
|
||||
- Execution time vs. complexity
|
||||
- Agent utilization rates
|
||||
- Resource constraints
|
||||
- Operation patterns
|
||||
|
||||
### 2. Common Bottlenecks
|
||||
|
||||
**Time Bottlenecks:**
|
||||
- Tasks taking > 5 minutes
|
||||
- Sequential operations that could parallelize
|
||||
- Redundant file operations
|
||||
|
||||
**Coordination Bottlenecks:**
|
||||
- Single agent for complex tasks
|
||||
- Unbalanced agent workloads
|
||||
- Poor topology selection
|
||||
|
||||
**Resource Bottlenecks:**
|
||||
- High operation count (> 100)
|
||||
- Memory constraints
|
||||
- I/O limitations
|
||||
|
||||
### 3. Improvement Suggestions
|
||||
|
||||
```
|
||||
Tool: mcp__claude-flow__task_results
|
||||
Parameters: {"taskId": "task-123", "format": "detailed"}
|
||||
|
||||
Result includes:
|
||||
{
|
||||
"bottlenecks": [
|
||||
{
|
||||
"type": "coordination",
|
||||
"severity": "high",
|
||||
"description": "Single agent used for complex task",
|
||||
"recommendation": "Spawn specialized agents for parallel work"
|
||||
}
|
||||
],
|
||||
"improvements": [
|
||||
{
|
||||
"area": "execution_time",
|
||||
"suggestion": "Use parallel task execution",
|
||||
"expectedImprovement": "30-50% time reduction"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Continuous Optimization
|
||||
The system learns from each task to prevent future bottlenecks!
|
||||
25
.claude/commands/analysis/performance-report.md
Normal file
25
.claude/commands/analysis/performance-report.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# performance-report
|
||||
|
||||
Generate comprehensive performance reports for swarm operations.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow analysis performance-report [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--format <type>` - Report format (json, html, markdown)
|
||||
- `--include-metrics` - Include detailed metrics
|
||||
- `--compare <id>` - Compare with previous swarm
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# Generate HTML report
|
||||
npx claude-flow analysis performance-report --format html
|
||||
|
||||
# Compare swarms
|
||||
npx claude-flow analysis performance-report --compare swarm-123
|
||||
|
||||
# Full metrics report
|
||||
npx claude-flow analysis performance-report --include-metrics --format markdown
|
||||
```
|
||||
45
.claude/commands/analysis/token-efficiency.md
Normal file
45
.claude/commands/analysis/token-efficiency.md
Normal file
@@ -0,0 +1,45 @@
|
||||
# Token Usage Optimization
|
||||
|
||||
## Purpose
|
||||
Reduce token consumption while maintaining quality through intelligent coordination.
|
||||
|
||||
## Optimization Strategies
|
||||
|
||||
### 1. Smart Caching
|
||||
- Search results cached for 5 minutes
|
||||
- File content cached during session
|
||||
- Pattern recognition reduces redundant searches
|
||||
|
||||
### 2. Efficient Coordination
|
||||
- Agents share context automatically
|
||||
- Avoid duplicate file reads
|
||||
- Batch related operations
|
||||
|
||||
### 3. Measurement & Tracking
|
||||
|
||||
```bash
|
||||
# Check token savings after session
|
||||
Tool: mcp__claude-flow__token_usage
|
||||
Parameters: {"operation": "session", "timeframe": "24h"}
|
||||
|
||||
# Result shows:
|
||||
{
|
||||
"metrics": {
|
||||
"tokensSaved": 15420,
|
||||
"operations": 45,
|
||||
"efficiency": "343 tokens/operation"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
1. **Use Task tool** for complex searches
|
||||
2. **Enable caching** in pre-search hooks
|
||||
3. **Batch operations** when possible
|
||||
4. **Review session summaries** for insights
|
||||
|
||||
## Token Reduction Results
|
||||
- 📉 32.3% average token reduction
|
||||
- 🎯 More focused operations
|
||||
- 🔄 Intelligent result reuse
|
||||
- 📊 Cumulative improvements
|
||||
25
.claude/commands/analysis/token-usage.md
Normal file
25
.claude/commands/analysis/token-usage.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# token-usage
|
||||
|
||||
Analyze token usage patterns and optimize for efficiency.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow analysis token-usage [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--period <time>` - Analysis period (1h, 24h, 7d, 30d)
|
||||
- `--by-agent` - Break down by agent
|
||||
- `--by-operation` - Break down by operation type
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# Last 24 hours token usage
|
||||
npx claude-flow analysis token-usage --period 24h
|
||||
|
||||
# By agent breakdown
|
||||
npx claude-flow analysis token-usage --by-agent
|
||||
|
||||
# Export detailed report
|
||||
npx claude-flow analysis token-usage --period 7d --export tokens.csv
|
||||
```
|
||||
Reference in New Issue
Block a user