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:
9
.claude/commands/automation/README.md
Normal file
9
.claude/commands/automation/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# Automation Commands
|
||||
|
||||
Commands for automation operations in Claude Flow.
|
||||
|
||||
## Available Commands
|
||||
|
||||
- [auto-agent](./auto-agent.md)
|
||||
- [smart-spawn](./smart-spawn.md)
|
||||
- [workflow-select](./workflow-select.md)
|
||||
122
.claude/commands/automation/auto-agent.md
Normal file
122
.claude/commands/automation/auto-agent.md
Normal file
@@ -0,0 +1,122 @@
|
||||
# auto agent
|
||||
|
||||
Automatically spawn and manage agents based on task requirements.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
npx claude-flow auto agent [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
- `--task, -t <description>` - Task description for agent analysis
|
||||
- `--max-agents, -m <number>` - Maximum agents to spawn (default: auto)
|
||||
- `--min-agents <number>` - Minimum agents required (default: 1)
|
||||
- `--strategy, -s <type>` - Selection strategy: optimal, minimal, balanced
|
||||
- `--no-spawn` - Analyze only, don't spawn agents
|
||||
|
||||
## Examples
|
||||
|
||||
### Basic auto-spawning
|
||||
|
||||
```bash
|
||||
npx claude-flow auto agent --task "Build a REST API with authentication"
|
||||
```
|
||||
|
||||
### Constrained spawning
|
||||
|
||||
```bash
|
||||
npx claude-flow auto agent -t "Debug performance issue" --max-agents 3
|
||||
```
|
||||
|
||||
### Analysis only
|
||||
|
||||
```bash
|
||||
npx claude-flow auto agent -t "Refactor codebase" --no-spawn
|
||||
```
|
||||
|
||||
### Minimal strategy
|
||||
|
||||
```bash
|
||||
npx claude-flow auto agent -t "Fix bug in login" -s minimal
|
||||
```
|
||||
|
||||
## How It Works
|
||||
|
||||
1. **Task Analysis**
|
||||
|
||||
- Parses task description
|
||||
- Identifies required skills
|
||||
- Estimates complexity
|
||||
- Determines parallelization opportunities
|
||||
|
||||
2. **Agent Selection**
|
||||
|
||||
- Matches skills to agent types
|
||||
- Considers task dependencies
|
||||
- Optimizes for efficiency
|
||||
- Respects constraints
|
||||
|
||||
3. **Topology Selection**
|
||||
|
||||
- Chooses optimal swarm structure
|
||||
- Configures communication patterns
|
||||
- Sets up coordination rules
|
||||
- Enables monitoring
|
||||
|
||||
4. **Automatic Spawning**
|
||||
- Creates selected agents
|
||||
- Assigns specific roles
|
||||
- Distributes subtasks
|
||||
- Initiates coordination
|
||||
|
||||
## Agent Types Selected
|
||||
|
||||
- **Architect**: System design, architecture decisions
|
||||
- **Coder**: Implementation, code generation
|
||||
- **Tester**: Test creation, quality assurance
|
||||
- **Analyst**: Performance, optimization
|
||||
- **Researcher**: Documentation, best practices
|
||||
- **Coordinator**: Task management, progress tracking
|
||||
|
||||
## Strategies
|
||||
|
||||
### Optimal
|
||||
|
||||
- Maximum efficiency
|
||||
- May spawn more agents
|
||||
- Best for complex tasks
|
||||
- Highest resource usage
|
||||
|
||||
### Minimal
|
||||
|
||||
- Minimum viable agents
|
||||
- Conservative approach
|
||||
- Good for simple tasks
|
||||
- Lowest resource usage
|
||||
|
||||
### Balanced
|
||||
|
||||
- Middle ground
|
||||
- Adaptive to complexity
|
||||
- Default strategy
|
||||
- Good performance/resource ratio
|
||||
|
||||
## Integration with Claude Code
|
||||
|
||||
```javascript
|
||||
// In Claude Code after auto-spawning
|
||||
mcp__claude-flow__auto_agent {
|
||||
task: "Build authentication system",
|
||||
strategy: "balanced",
|
||||
maxAgents: 6
|
||||
}
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
- `agent spawn` - Manual agent creation
|
||||
- `swarm init` - Initialize swarm manually
|
||||
- `smart spawn` - Intelligent agent spawning
|
||||
- `workflow select` - Choose predefined workflows
|
||||
106
.claude/commands/automation/self-healing.md
Normal file
106
.claude/commands/automation/self-healing.md
Normal file
@@ -0,0 +1,106 @@
|
||||
# Self-Healing Workflows
|
||||
|
||||
## Purpose
|
||||
Automatically detect and recover from errors without interrupting your flow.
|
||||
|
||||
## Self-Healing Features
|
||||
|
||||
### 1. Error Detection
|
||||
Monitors for:
|
||||
- Failed commands
|
||||
- Syntax errors
|
||||
- Missing dependencies
|
||||
- Broken tests
|
||||
|
||||
### 2. Automatic Recovery
|
||||
|
||||
**Missing Dependencies:**
|
||||
```
|
||||
Error: Cannot find module 'express'
|
||||
→ Automatically runs: npm install express
|
||||
→ Retries original command
|
||||
```
|
||||
|
||||
**Syntax Errors:**
|
||||
```
|
||||
Error: Unexpected token
|
||||
→ Analyzes error location
|
||||
→ Suggests fix through analyzer agent
|
||||
→ Applies fix with confirmation
|
||||
```
|
||||
|
||||
**Test Failures:**
|
||||
```
|
||||
Test failed: "user authentication"
|
||||
→ Spawns debugger agent
|
||||
→ Analyzes failure cause
|
||||
→ Implements fix
|
||||
→ Re-runs tests
|
||||
```
|
||||
|
||||
### 3. Learning from Failures
|
||||
Each recovery improves future prevention:
|
||||
- Patterns saved to knowledge base
|
||||
- Similar errors prevented proactively
|
||||
- Recovery strategies optimized
|
||||
|
||||
**Pattern Storage:**
|
||||
```javascript
|
||||
// Store error patterns
|
||||
mcp__claude-flow__memory_usage({
|
||||
"action": "store",
|
||||
"key": "error-pattern-" + Date.now(),
|
||||
"value": JSON.stringify(errorData),
|
||||
"namespace": "error-patterns",
|
||||
"ttl": 2592000 // 30 days
|
||||
})
|
||||
|
||||
// Analyze patterns
|
||||
mcp__claude-flow__neural_patterns({
|
||||
"action": "analyze",
|
||||
"operation": "error-recovery",
|
||||
"outcome": "success"
|
||||
})
|
||||
```
|
||||
|
||||
## Self-Healing Integration
|
||||
|
||||
### MCP Tool Coordination
|
||||
```javascript
|
||||
// Initialize self-healing swarm
|
||||
mcp__claude-flow__swarm_init({
|
||||
"topology": "star",
|
||||
"maxAgents": 4,
|
||||
"strategy": "adaptive"
|
||||
})
|
||||
|
||||
// Spawn recovery agents
|
||||
mcp__claude-flow__agent_spawn({
|
||||
"type": "monitor",
|
||||
"name": "Error Monitor",
|
||||
"capabilities": ["error-detection", "recovery"]
|
||||
})
|
||||
|
||||
// Orchestrate recovery
|
||||
mcp__claude-flow__task_orchestrate({
|
||||
"task": "recover from error",
|
||||
"strategy": "sequential",
|
||||
"priority": "critical"
|
||||
})
|
||||
```
|
||||
|
||||
### Fallback Hook Configuration
|
||||
```json
|
||||
{
|
||||
"PostToolUse": [{
|
||||
"matcher": "^Bash$",
|
||||
"command": "npx claude-flow hook post-bash --exit-code '${tool.result.exitCode}' --auto-recover"
|
||||
}]
|
||||
}
|
||||
```
|
||||
|
||||
## Benefits
|
||||
- 🛡️ Resilient workflows
|
||||
- 🔄 Automatic recovery
|
||||
- 📚 Learns from errors
|
||||
- ⏱️ Saves debugging time
|
||||
90
.claude/commands/automation/session-memory.md
Normal file
90
.claude/commands/automation/session-memory.md
Normal file
@@ -0,0 +1,90 @@
|
||||
# Cross-Session Memory
|
||||
|
||||
## Purpose
|
||||
Maintain context and learnings across Claude Code sessions for continuous improvement.
|
||||
|
||||
## Memory Features
|
||||
|
||||
### 1. Automatic State Persistence
|
||||
At session end, automatically saves:
|
||||
- Active agents and specializations
|
||||
- Task history and patterns
|
||||
- Performance metrics
|
||||
- Neural network weights
|
||||
- Knowledge base updates
|
||||
|
||||
### 2. Session Restoration
|
||||
```javascript
|
||||
// Using MCP tools for memory operations
|
||||
mcp__claude-flow__memory_usage({
|
||||
"action": "retrieve",
|
||||
"key": "session-state",
|
||||
"namespace": "sessions"
|
||||
})
|
||||
|
||||
// Restore swarm state
|
||||
mcp__claude-flow__context_restore({
|
||||
"snapshotId": "sess-123"
|
||||
})
|
||||
```
|
||||
|
||||
**Fallback with npx:**
|
||||
```bash
|
||||
npx claude-flow hook session-restore --session-id "sess-123"
|
||||
```
|
||||
|
||||
### 3. Memory Types
|
||||
|
||||
**Project Memory:**
|
||||
- File relationships
|
||||
- Common edit patterns
|
||||
- Testing approaches
|
||||
- Build configurations
|
||||
|
||||
**Agent Memory:**
|
||||
- Specialization levels
|
||||
- Task success rates
|
||||
- Optimization strategies
|
||||
- Error patterns
|
||||
|
||||
**Performance Memory:**
|
||||
- Bottleneck history
|
||||
- Optimization results
|
||||
- Token usage patterns
|
||||
- Efficiency trends
|
||||
|
||||
### 4. Privacy & Control
|
||||
```javascript
|
||||
// List memory contents
|
||||
mcp__claude-flow__memory_usage({
|
||||
"action": "list",
|
||||
"namespace": "sessions"
|
||||
})
|
||||
|
||||
// Delete specific memory
|
||||
mcp__claude-flow__memory_usage({
|
||||
"action": "delete",
|
||||
"key": "session-123",
|
||||
"namespace": "sessions"
|
||||
})
|
||||
|
||||
// Backup memory
|
||||
mcp__claude-flow__memory_backup({
|
||||
"path": "./backups/memory-backup.json"
|
||||
})
|
||||
```
|
||||
|
||||
**Manual control:**
|
||||
```bash
|
||||
# View stored memory
|
||||
ls .claude-flow/memory/
|
||||
|
||||
# Disable memory
|
||||
export CLAUDE_FLOW_MEMORY_PERSIST=false
|
||||
```
|
||||
|
||||
## Benefits
|
||||
- 🧠 Contextual awareness
|
||||
- 📈 Cumulative learning
|
||||
- ⚡ Faster task completion
|
||||
- 🎯 Personalized optimization
|
||||
73
.claude/commands/automation/smart-agents.md
Normal file
73
.claude/commands/automation/smart-agents.md
Normal file
@@ -0,0 +1,73 @@
|
||||
# Smart Agent Auto-Spawning
|
||||
|
||||
## Purpose
|
||||
Automatically spawn the right agents at the right time without manual intervention.
|
||||
|
||||
## Auto-Spawning Triggers
|
||||
|
||||
### 1. File Type Detection
|
||||
When editing files, agents auto-spawn:
|
||||
- **JavaScript/TypeScript**: Coder agent
|
||||
- **Markdown**: Researcher agent
|
||||
- **JSON/YAML**: Analyst agent
|
||||
- **Multiple files**: Coordinator agent
|
||||
|
||||
### 2. Task Complexity
|
||||
```
|
||||
Simple task: "Fix typo"
|
||||
→ Single coordinator agent
|
||||
|
||||
Complex task: "Implement OAuth with Google"
|
||||
→ Architect + Coder + Tester + Researcher
|
||||
```
|
||||
|
||||
### 3. Dynamic Scaling
|
||||
The system monitors workload and spawns additional agents when:
|
||||
- Task queue grows
|
||||
- Complexity increases
|
||||
- Parallel opportunities exist
|
||||
|
||||
**Status Monitoring:**
|
||||
```javascript
|
||||
// Check swarm health
|
||||
mcp__claude-flow__swarm_status({
|
||||
"swarmId": "current"
|
||||
})
|
||||
|
||||
// Monitor agent performance
|
||||
mcp__claude-flow__agent_metrics({
|
||||
"agentId": "agent-123"
|
||||
})
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### MCP Tool Integration
|
||||
Uses Claude Flow MCP tools for agent coordination:
|
||||
```javascript
|
||||
// Initialize swarm with appropriate topology
|
||||
mcp__claude-flow__swarm_init({
|
||||
"topology": "mesh",
|
||||
"maxAgents": 8,
|
||||
"strategy": "auto"
|
||||
})
|
||||
|
||||
// Spawn agents based on file type
|
||||
mcp__claude-flow__agent_spawn({
|
||||
"type": "coder",
|
||||
"name": "JavaScript Handler",
|
||||
"capabilities": ["javascript", "typescript"]
|
||||
})
|
||||
```
|
||||
|
||||
### Fallback Configuration
|
||||
If MCP tools are unavailable:
|
||||
```bash
|
||||
npx claude-flow hook pre-task --auto-spawn-agents
|
||||
```
|
||||
|
||||
## Benefits
|
||||
- 🤖 Zero manual agent management
|
||||
- 🎯 Perfect agent selection
|
||||
- 📈 Dynamic scaling
|
||||
- 💾 Resource efficiency
|
||||
25
.claude/commands/automation/smart-spawn.md
Normal file
25
.claude/commands/automation/smart-spawn.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# smart-spawn
|
||||
|
||||
Intelligently spawn agents based on workload analysis.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow automation smart-spawn [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--analyze` - Analyze before spawning
|
||||
- `--threshold <n>` - Spawn threshold
|
||||
- `--topology <type>` - Preferred topology
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# Smart spawn with analysis
|
||||
npx claude-flow automation smart-spawn --analyze
|
||||
|
||||
# Set spawn threshold
|
||||
npx claude-flow automation smart-spawn --threshold 5
|
||||
|
||||
# Force topology
|
||||
npx claude-flow automation smart-spawn --topology hierarchical
|
||||
```
|
||||
25
.claude/commands/automation/workflow-select.md
Normal file
25
.claude/commands/automation/workflow-select.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# workflow-select
|
||||
|
||||
Automatically select optimal workflow based on task type.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow automation workflow-select [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--task <description>` - Task description
|
||||
- `--constraints <list>` - Workflow constraints
|
||||
- `--preview` - Preview without executing
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# Select workflow for task
|
||||
npx claude-flow automation workflow-select --task "Deploy to production"
|
||||
|
||||
# With constraints
|
||||
npx claude-flow automation workflow-select --constraints "no-downtime,rollback"
|
||||
|
||||
# Preview mode
|
||||
npx claude-flow automation workflow-select --task "Database migration" --preview
|
||||
```
|
||||
Reference in New Issue
Block a user