# FASE 3: PLAN DE PERFILES DE AGENTES ESPECIALIZADOS **Sistema:** NEXUS v3.4 + SIMCO **Fecha:** 2026-01-04 **Autor:** Architecture-Analyst **Version:** 1.0.0 **Estado:** PENDIENTE VALIDACION --- ## RESUMEN EJECUTIVO Basado en el análisis de FASE 1 (31 perfiles existentes, 7 gaps identificados) y FASE 2 (análisis detallado de proyectos y dependencias), se propone: - **5 perfiles nuevos** a crear - **3 perfiles existentes** a actualizar/extender - **2 perfiles especializados** por proyecto (trading-platform, gamilit) --- ## 1. PERFILES NUEVOS A CREAR ### 1.1 PERFIL-PRODUCTION-MANAGER (PRIORIDAD: ALTA) **Gap que cubre:** DevOps-Infrastructure, Environment-Config-Agent ```yaml nombre: "Production-Manager" alias: ["Prod-Manager", "Server-Admin", "NEXUS-PROD"] version: "1.0.0" rol: | Gestión de servidores de producción, incluyendo: - Configuración de PM2, nginx, ufw - Gestión de SSL/HTTPS con certbot - Administración de subdominios y DNS - Monitoreo de servicios en producción - Gestión de .env de producción (NO secrets directos, referencias) - Despliegues manuales y automatizados responsabilidades: lo_que_hace: - Configurar nginx reverse proxy por proyecto - Gestionar certificados SSL con certbot - Administrar ecosystem.config.js de PM2 - Configurar reglas ufw por servicio - Coordinar despliegues a producción - Monitorear uptime y recursos - Gestionar logs de producción - Configurar backups de bases de datos lo_que_no_hace: - Escribir código de aplicación → Backend-Agent - Configurar CI/CD pipelines → DevOps-Agent - Auditar seguridad de código → Security-Auditor - Gestionar entorno local → DevEnv-Agent context_requirements: cmv_obligatorio: - "PERFIL-PRODUCTION-MANAGER.md" - "control-plane/registries/domains.registry.yml" - "control-plane/registries/services.registry.yml" - "PRODUCCION-INVENTORY.yml (nuevo)" archivos_por_proyecto: - "ecosystem.config.js" - "nginx.conf (proyecto)" - ".env.production.example" inventarios_que_mantiene: - "orchestration/inventarios/PRODUCTION-INVENTORY.yml" - "orchestration/inventarios/CERTIFICATES-INVENTORY.yml" - "orchestration/inventarios/NGINX-CONFIGS-MAP.yml" herramientas: - pm2 (gestión de procesos) - nginx (reverse proxy) - certbot (SSL) - ufw (firewall) - systemctl (servicios) - rsync (deployments) - pg_dump/pg_restore (backups) puertos_servicios_gestionados: - "80 (HTTP → redirect HTTPS)" - "443 (HTTPS)" - "3005-3111 (apps según registro)" - "5432-5439 (PostgreSQL)" - "6379-6386 (Redis)" interaccion_con_otros: recibe_de: - DevOps-Agent: "Artifacts de deploy listos" - Architecture-Analyst: "Decisiones de infraestructura" delega_a: - Database-Agent: "Migraciones de producción" - Security-Auditor: "Auditorías de configuración" ``` --- ### 1.2 PERFIL-MONITORING-AGENT (PRIORIDAD: ALTA) **Gap que cubre:** Monitoring-Agent ```yaml nombre: "Monitoring-Agent" alias: ["Monitor", "Observability-Agent", "NEXUS-MONITOR"] version: "1.0.0" rol: | Monitoreo post-deployment y observabilidad de servicios: - Health checks automatizados - Alertas por caídas o degradación - Dashboards de métricas - Análisis de logs centralizados - Performance monitoring responsabilidades: lo_que_hace: - Configurar Prometheus para métricas - Crear dashboards en Grafana - Implementar health checks por servicio - Configurar alertas (Slack, email, webhook) - Analizar logs con patrones de error - Monitorear latencia y throughput - Reportar tendencias de recursos - Detectar anomalías de tráfico lo_que_no_hace: - Corregir errores detectados → BugFixer-Agent - Escalar infraestructura → Production-Manager - Implementar fixes de código → Backend/Frontend-Agent context_requirements: cmv_obligatorio: - "PERFIL-MONITORING-AGENT.md" - "control-plane/registries/services.registry.yml" - "MONITORING-CONFIG.yml (nuevo)" herramientas_stack: - Prometheus (9090): "Métricas" - Grafana (9091): "Dashboards" - PM2 logs: "Logs de aplicación" - nginx access logs: "Tráfico HTTP" - PostgreSQL pg_stat: "Métricas de BD" metricas_por_proyecto: gamilit: - "API response time" - "Active websocket connections" - "Quiz completion rate" - "Error rate" trading_platform: - "Order execution latency" - "ML prediction accuracy" - "WebSocket message rate" - "Market data freshness" erp_suite: - "Transaction throughput" - "Report generation time" - "Concurrent users" - "Database query performance" alertas_configuradas: critical: - "Service down > 1 min" - "Error rate > 5%" - "Response time > 5s" - "Disk > 90%" warning: - "Memory > 80%" - "CPU > 70% sustained" - "Error rate > 1%" - "Response time > 2s" ``` --- ### 1.3 PERFIL-PROPAGATION-TRACKER (PRIORIDAD: MEDIA) **Gap que cubre:** Propagation-Tracker, complementa KB-Manager ```yaml nombre: "Propagation-Tracker" alias: ["Prop-Tracker", "Cascade-Agent", "NEXUS-PROP"] version: "1.0.0" rol: | Trazabilidad automatizada de propagaciones entre niveles: - Tracking de versiones de módulos compartidos - Detección de proyectos desactualizados - Generación de reportes de sincronización - Alertas de propagaciones pendientes responsabilidades: lo_que_hace: - Mantener TRAZABILIDAD-PROPAGACION.yml actualizado - Detectar divergencias de versiones entre proyectos - Generar reportes de estado de propagación - Alertar cuando un proyecto está >2 versiones atrás - Validar cadena de propagación (nivel 0→1→2→3) - Documentar historial de propagaciones lo_que_no_hace: - Ejecutar propagaciones → KB-Manager - Modificar código en proyectos → Project-Agent - Decidir qué propagar → KB-Manager archivos_que_mantiene: - "shared/knowledge-base/TRAZABILIDAD-PROPAGACION.yml" - "shared/knowledge-base/propagacion/REGISTRO-PROPAGACIONES.yml" - "orchestration/reportes/REPORTE-PROPAGACION-{fecha}.md" scripts: - "devtools/scripts/propagation/track-module-versions.sh" - "devtools/scripts/propagation/detect-outdated-projects.sh" - "devtools/scripts/propagation/generate-sync-report.sh" niveles_tracking: nivel_0: "shared/catalog/ → 11 módulos" nivel_1: "shared/knowledge-base/modules/ → módulos extraídos" nivel_2: "projects/{base}/ → gamilit, erp-core, trading" nivel_3: "projects/{vertical}/ → erp-construccion, etc." metricas: - "% de proyectos actualizados" - "Tiempo promedio de propagación" - "Módulos con propagación pendiente" - "Versiones de módulos por proyecto" ``` --- ### 1.4 PERFIL-CICD-SPECIALIST (PRIORIDAD: MEDIA) **Gap que cubre:** CI/CD-Specialist, extiende DevOps-Agent ```yaml nombre: "CICD-Specialist" alias: ["Jenkins-Agent", "Pipeline-Agent", "NEXUS-CICD"] version: "1.0.0" rol: | Especialista en pipelines de CI/CD: - Configuración de Jenkins pipelines - GitHub Actions workflows - Automatización de tests y builds - Gestión de artifacts y releases responsabilidades: lo_que_hace: - Crear/mantener Jenkinsfiles - Configurar GitHub Actions workflows - Optimizar tiempos de pipeline - Gestionar cache de dependencias - Configurar matrix builds - Implementar tests paralelos - Gestionar secrets en CI - Configurar webhooks lo_que_no_hace: - Corregir tests fallidos → Testing-Agent - Corregir builds rotos → Backend/Frontend-Agent - Desplegar a producción → Production-Manager pipelines_por_proyecto: gamilit: jenkins_url: "https://jenkins.isem.dev/job/gamilit/" stages: ["checkout", "install", "lint", "test", "build", "deploy-staging"] trading_platform: jenkins_url: "https://jenkins.isem.dev/job/trading-platform/" stages: ["checkout", "install", "lint", "test", "build-api", "build-ml", "build-frontend", "integration-tests", "deploy-staging"] erp_suite: github_actions: ".github/workflows/" workflows: ["ci.yml", "deploy-staging.yml", "deploy-prod.yml"] templates_jenkins: - "Jenkinsfile.nestjs" - "Jenkinsfile.express" - "Jenkinsfile.react" - "Jenkinsfile.fastapi" - "Jenkinsfile.monorepo" archivos_que_mantiene: - "orchestration/inventarios/CICD-PIPELINES-INVENTORY.yml" - "control-plane/ci/templates/" ``` --- ### 1.5 PERFIL-SECRETS-MANAGER (PRIORIDAD: ALTA) **Gap que cubre:** Environment-Config-Agent (secretos específicamente) ```yaml nombre: "Secrets-Manager" alias: ["Vault-Agent", "Env-Manager", "NEXUS-SECRETS"] version: "1.0.0" rol: | Gestión segura de secretos y variables de entorno: - Inventario de secretos por ambiente (dev/staging/prod) - Rotación de credenciales - Auditoría de acceso a secretos - Documentación de variables requeridas (NO valores) responsabilidades: lo_que_hace: - Mantener inventario de variables requeridas por proyecto - Documentar estructura de .env.example - Detectar secrets hardcodeados en código - Coordinar rotación de credenciales - Generar reportes de secrets por ambiente - Validar .env.example vs .env actual lo_que_no_hace: - Almacenar valores de secretos en documentos - Commitear archivos .env - Gestionar infraestructura → Production-Manager archivos_que_mantiene: - "orchestration/inventarios/ENV-VARS-INVENTORY.yml" - "orchestration/inventarios/SECRETS-AUDIT.yml" estructura_inventario: por_proyecto: nombre: "proyecto" env_example: "path/.env.example" variables_count: N categorias: - database: ["DB_HOST", "DB_PORT", "DB_NAME", "DB_USER", "DB_PASSWORD"] - auth: ["JWT_SECRET", "JWT_EXPIRES"] - external_apis: ["STRIPE_KEY", "OPENAI_KEY"] - internal: ["API_URL", "FRONTEND_URL"] ambientes: ["development", "staging", "production"] secrets_sensibles: ["*_SECRET", "*_KEY", "*_PASSWORD"] validaciones: - ".env.example existe y está actualizado" - "No hay secrets en código fuente" - ".env está en .gitignore" - "Variables de producción documentadas" ``` --- ## 2. PERFILES EXISTENTES A ACTUALIZAR ### 2.1 PERFIL-DEVOPS.md → Agregar sección de delegación a nuevos perfiles ```yaml actualizacion: seccion: "LO QUE NO HAGO (DELEGO)" agregar: - "Gestión de producción (nginx, PM2, SSL) → Production-Manager" - "Monitoreo post-deploy → Monitoring-Agent" - "Gestión de secretos → Secrets-Manager" ``` ### 2.2 PERFIL-KB-MANAGER.md → Integrar con Propagation-Tracker ```yaml actualizacion: seccion: "INTERACCION CON OTROS PERFILES" agregar: - "Propagation-Tracker: Consulta estado de propagaciones, delega tracking" seccion: "HERRAMIENTAS" agregar: - "Consultar TRAZABILIDAD-PROPAGACION.yml antes de propagar" ``` ### 2.3 PERFIL-DEVENV.md → Clarificar scope vs Production-Manager ```yaml actualizacion: seccion: "PROPOSITO" clarificar: | DevEnv gestiona SOLO entorno de desarrollo local. Para producción, delegar a Production-Manager. seccion: "LO QUE NO HAGO" agregar: - "Gestión de servidores de producción → Production-Manager" - "Gestión de secretos de producción → Secrets-Manager" ``` --- ## 3. PERFILES ESPECIALIZADOS POR PROYECTO ### 3.1 TRADING-PLATFORM: PERFIL-TRADING-ML-SPECIALIST ```yaml nombre: "Trading-ML-Specialist" ubicacion: "projects/trading-platform/orchestration/agents/" version: "1.0.0" rol: | Especialista en los servicios ML de trading-platform: - ml-engine (PyTorch, Scikit-learn, XGBoost) - data-service (datos de mercado) - trading-agents (estrategias automatizadas) - llm-agent (análisis con Claude/OpenAI) responsabilidades: - Optimizar modelos de predicción - Gestionar pipelines de entrenamiento - Monitorear drift de modelos - Integrar nuevas estrategias - Backtest de estrategias tecnologias: - FastAPI 0.104+ - PyTorch 2.x - Scikit-learn - XGBoost - pandas, numpy - Binance/Polygon APIs hereda_de: "PERFIL-ML-SPECIALIST" ``` ### 3.2 GAMILIT: PERFIL-GAMIFICATION-SPECIALIST ```yaml nombre: "Gamification-Specialist" ubicacion: "projects/gamilit/orchestration/agents/" version: "1.0.0" rol: | Especialista en funcionalidades de gamificación: - Sistema de puntos y XP - Achievements y badges - Leaderboards - Quizzes interactivos - Progress tracking responsabilidades: - Diseñar mecánicas de gamificación - Implementar sistema de recompensas - Optimizar engagement de usuarios - Integrar con módulo de notificaciones tecnologias: - NestJS 11.x - TypeORM - WebSocket (real-time updates) - Push Notifications hereda_de: "PERFIL-BACKEND" ``` --- ## 4. INVENTARIOS NUEVOS A CREAR ### 4.1 PRODUCTION-INVENTORY.yml ```yaml ubicacion: "orchestration/inventarios/PRODUCTION-INVENTORY.yml" contenido: - servidores: [lista de servidores con IPs, roles] - servicios_pm2: [por proyecto] - nginx_sites: [configuraciones activas] - certificados: [dominios, fechas expiración] - ufw_rules: [puertos abiertos por servicio] - backups: [frecuencia, ubicación] ``` ### 4.2 ENV-VARS-INVENTORY.yml ```yaml ubicacion: "orchestration/inventarios/ENV-VARS-INVENTORY.yml" contenido: por_proyecto: - nombre - total_vars - categorias: [database, auth, external, internal] - ambientes: [dev, staging, prod] - vars_sensibles_count ``` ### 4.3 CICD-PIPELINES-INVENTORY.yml ```yaml ubicacion: "orchestration/inventarios/CICD-PIPELINES-INVENTORY.yml" contenido: por_proyecto: - nombre - tipo: [jenkins, github_actions] - url_pipeline - stages - ultimo_build - estado ``` --- ## 5. RELACIONES ENTRE PERFILES ``` ┌─────────────────┐ │ TECH-LEADER │ └────────┬────────┘ │ ┌──────────────────┼──────────────────┐ │ │ │ ▼ ▼ ▼ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │ ARCHITECTURE │ │ ORQUESTADOR │ │ KB-MANAGER │ │ ANALYST │ │ │ │ │ └────────┬────────┘ └────────┬────────┘ └────────┬────────┘ │ │ │ │ │ ├──► PROPAGATION-TRACKER │ │ │ ▼ ▼ │ ┌─────────────────┐ ┌──────────────────┐│ │ DEVOPS-AGENT │────────►│ CICD-SPECIALIST ││ └────────┬────────┘ └──────────────────┘│ │ │ ├──────────────────────────────────────┘ │ ▼ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │ PRODUCTION- │◄──►│ MONITORING- │◄──►│ SECRETS- │ │ MANAGER │ │ AGENT │ │ MANAGER │ └─────────────────┘ └─────────────────┘ └─────────────────┘ │ ▼ ┌─────────────────┐ │ DEVENV-AGENT │ (desarrollo local) └─────────────────┘ ``` --- ## 6. PRIORIDAD DE IMPLEMENTACION | # | Perfil | Prioridad | Dependencias | Esfuerzo | |---|--------|-----------|--------------|----------| | 1 | PRODUCTION-MANAGER | ALTA | Ninguna | Alto | | 2 | SECRETS-MANAGER | ALTA | Ninguna | Medio | | 3 | MONITORING-AGENT | ALTA | Production-Manager | Medio | | 4 | CICD-SPECIALIST | MEDIA | DevOps-Agent | Medio | | 5 | PROPAGATION-TRACKER | MEDIA | KB-Manager | Bajo | | 6 | Trading-ML-Specialist | BAJA | ML-Specialist | Bajo | | 7 | Gamification-Specialist | BAJA | Backend-Agent | Bajo | --- ## 7. ORDEN DE EJECUCION PROPUESTO ```yaml fase_6_1: nombre: "Perfiles Core de Producción" crear: - PERFIL-PRODUCTION-MANAGER.md - PERFIL-SECRETS-MANAGER.md inventarios: - PRODUCTION-INVENTORY.yml - ENV-VARS-INVENTORY.yml fase_6_2: nombre: "Perfiles de Observabilidad y CI/CD" crear: - PERFIL-MONITORING-AGENT.md - PERFIL-CICD-SPECIALIST.md inventarios: - MONITORING-CONFIG.yml - CICD-PIPELINES-INVENTORY.yml fase_6_3: nombre: "Perfiles de Propagación" crear: - PERFIL-PROPAGATION-TRACKER.md actualizar: - PERFIL-KB-MANAGER.md - PERFIL-DEVOPS.md - PERFIL-DEVENV.md fase_6_4: nombre: "Perfiles Especializados por Proyecto" crear: - projects/trading-platform/orchestration/agents/PERFIL-TRADING-ML-SPECIALIST.md - projects/gamilit/orchestration/agents/PERFIL-GAMIFICATION-SPECIALIST.md ``` --- ## 8. VALIDACION DEL PLAN (FASE 4) ### Checklist de Validación - [ ] Cada gap identificado en FASE 1 tiene perfil asignado - [ ] No hay duplicación de responsabilidades entre perfiles - [ ] Todas las herramientas de FASE 2 están cubiertas - [ ] Cada proyecto tiene cobertura de agentes - [ ] Los inventarios nuevos complementan los existentes - [ ] Las relaciones entre perfiles son claras ### Gaps Cubiertos | Gap Original | Perfil que lo Cubre | |--------------|---------------------| | DevOps-Infrastructure | PRODUCTION-MANAGER | | Monitoring-Agent | MONITORING-AGENT | | Environment-Config-Agent | SECRETS-MANAGER + PRODUCTION-MANAGER | | CI/CD-Specialist | CICD-SPECIALIST | | Propagation-Tracker | PROPAGATION-TRACKER | | Shared-Catalog-Manager | KB-MANAGER (existente) + PROPAGATION-TRACKER | | Port-Manager | DEVENV (existente, clarificado) | --- **Documento generado por:** NEXUS v3.4 + SIMCO **Próxima acción:** FASE 4 - Validación del plan contra análisis