workspace-v1/orchestration/_MAP.md
rckrdmrd ff3038f183 feat(orchestration): Add subagent token management system
Sistema completo de gestión de tokens para subagentes NEXUS v4.0:

Nuevas directivas SIMCO:
- SIMCO-SUBAGENTE.md: Protocolo para agentes en modo subagente
- SIMCO-CCA-SUBAGENTE.md: CCA ligero para subagentes (~1,500 tokens)
- SIMCO-CONTROL-TOKENS.md: Gestión de límites de tokens
- SIMCO-DELEGACION-PARALELA.md: Delegación paralela

Perfiles compact (~250 tokens cada uno):
- PERFIL-BACKEND-COMPACT.md
- PERFIL-FRONTEND-COMPACT.md
- PERFIL-DATABASE-COMPACT.md
- PERFIL-DEVOPS-COMPACT.md
- PERFIL-ML-COMPACT.md
- PERFIL-GENERIC-SUBAGENT.md

Templates de delegación escalonados:
- TEMPLATE-DELEGACION-MINIMA.md (~250 tokens)
- TEMPLATE-DELEGACION-ESTANDAR.md (~600 tokens)
- TEMPLATE-DELEGACION-COMPLETA.md (~1,800 tokens)

Nuevos perfiles especializados:
- PERFIL-MCP-ARCHITECT.md
- PERFIL-MCP-DEVELOPER.md
- PERFIL-RAG-ENGINEER.md
- PERFIL-CICD-SPECIALIST.md
- PERFIL-PRODUCTION-MANAGER.md
- PERFIL-MONITORING-AGENT.md
- PERFIL-SECRETS-MANAGER.md
- PERFIL-PROPAGATION-TRACKER.md

Checklists y documentación:
- CHECKLIST-PRE-DELEGACION.md
- Análisis y planes de implementación

Métricas de mejora:
- ~59% reducción de tokens por delegación
- Perfiles compact: 69% más ligeros
- CCA subagente: 85% más ligero

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 04:43:01 -06:00

319 lines
11 KiB
Markdown

# MAPA DE ORQUESTACION: WORKSPACE-V1
**Sistema:** NEXUS v4.0 + SIMCO
**Propósito:** Orquestación central para todos los proyectos del workspace
**Última actualización:** 2026-01-04
---
## Estructura de Orquestación
```
orchestration/
├── agents/ # Perfiles de agentes
│ └── perfiles/ # Definiciones de roles
├── analisis/ # Análisis transversales
├── checklists/ # Checklists de validación
├── directivas/ # Directivas SIMCO y principios
│ ├── principios/ # 6 principios fundamentales
│ └── simco/ # 45 directivas SIMCO
├── errores/ # Registro global de errores
├── inventarios/ # Inventarios de workspace
├── patrones/ # Patrones arquitectónicos
├── procesos/ # Definiciones de procesos
├── referencias/ # Referencias y matrices
├── scrum/ # Templates Scrum
├── templates/ # Templates globales
│ ├── capved/ # Templates CAPVED++
│ ├── scrum/ # Templates Scrum
│ └── service-descriptor/ # Descriptores de servicio
└── tracking/ # Tracking de sesiones
```
---
## Archivos Principales
| Archivo | Propósito |
|---------|-----------|
| `README.md` | Descripción del sistema NEXUS v4.0 |
| `INDICE-DIRECTIVAS-WORKSPACE.yml` | Índice maestro de directivas |
| `_MAP.md` | Este archivo - mapa de navegación |
---
## Sistema NEXUS v4.0
### Niveles de Contexto
| Nivel | Tokens | Contenido | Obligatorio |
|-------|--------|-----------|-------------|
| L0 Sistema | ~4500 | Principios, perfil agente | Sí |
| L1 Proyecto | ~3000 | CONTEXTO-PROYECTO, PROXIMA-ACCION | Sí |
| L2 Operación | ~2500 | SIMCO por operación/dominio | Según tarea |
| L3 Tarea | max 8000 | docs/, código, histórico | Dinámico |
### Límites de Tokens
```yaml
limite_absoluto: 25000
limite_seguro: 18000
limite_alerta: 20000
```
---
## Principios Fundamentales (6)
| Principio | Archivo | Propósito |
|-----------|---------|-----------|
| CAPVED++ | `PRINCIPIO-CAPVED.md` | Ciclo de vida de tareas con gates |
| Doc-Primero | `PRINCIPIO-DOC-PRIMERO.md` | Documentación antes de código |
| Anti-Duplicación | `PRINCIPIO-ANTI-DUPLICACION.md` | Verificar catálogo antes de crear |
| Validación | `PRINCIPIO-VALIDACION-OBLIGATORIA.md` | Build/lint deben pasar |
| Economía Tokens | `PRINCIPIO-ECONOMIA-TOKENS.md` | Límites de contexto |
| No Asumir | `PRINCIPIO-NO-ASUMIR.md` | Preguntar si falta información |
**Path:** `directivas/principios/`
---
## Directivas SIMCO (45)
### Por Operación
| Directiva | Cuándo Usar |
|-----------|-------------|
| `SIMCO-CREAR.md` | Crear nuevos artefactos |
| `SIMCO-MODIFICAR.md` | Modificar artefactos existentes |
| `SIMCO-VALIDAR.md` | Validar coherencia/calidad |
| `SIMCO-BUSCAR.md` | Buscar información en codebase |
| `SIMCO-DOCUMENTAR.md` | Crear/actualizar documentación |
| `SIMCO-DELEGACION.md` | Delegar a subagentes |
| `SIMCO-PROPAGACION.md` | Propagar mejoras entre proyectos |
| `SIMCO-REUTILIZAR.md` | Reutilizar código existente |
| `SIMCO-CONTRIBUIR-CATALOGO.md` | Contribuir al catálogo compartido |
### Por Dominio
| Directiva | Dominio |
|-----------|---------|
| `SIMCO-DDL.md` | Base de datos PostgreSQL |
| `SIMCO-BACKEND.md` | Backend (NestJS, Express) |
| `SIMCO-FRONTEND.md` | Frontend (React, Vue) |
| `SIMCO-MOBILE.md` | Aplicaciones móviles |
| `SIMCO-DEVOPS.md` | DevOps y CI/CD |
| `SIMCO-ML.md` | Machine Learning |
| `SIMCO-ARQUITECTURA.md` | Decisiones arquitectónicas |
| `SIMCO-GIT.md` | Control de versiones |
### NEXUS v4.0 (Nuevas)
| Directiva | Propósito |
|-----------|-----------|
| `SIMCO-CAPVED-PLUS.md` | Ciclo extendido con gates |
| `SIMCO-CONTEXT-RESOLUTION.md` | Resolución automática de contexto |
| `SIMCO-CONTROL-TOKENS.md` | Gestión de límites de tokens |
| `SIMCO-DELEGACION-PARALELA.md` | Orquestación de subagentes |
| `SIMCO-ERROR-RECURRENTE.md` | Manejo de errores repetidos |
| `SIMCO-SCRUM-INTEGRATION.md` | Integración Scrum |
### Referencia
| Directiva | Propósito |
|-----------|-----------|
| `SIMCO-QUICK-REFERENCE.md` | Referencia rápida |
| `SIMCO-DECISION-MATRIZ.md` | Matriz de decisión |
| `SIMCO-NIVELES.md` | Tipos de proyectos |
| `SIMCO-ESTRUCTURA-REPOS.md` | Estructura de repositorios |
| `_INDEX.md` | Índice de directivas SIMCO |
**Path:** `directivas/simco/`
---
## Templates
### CAPVED++ (7)
| Template | Fase |
|----------|------|
| `TEMPLATE-FASE-C-OUTPUT.yml` | Contexto |
| `TEMPLATE-FASE-A-OUTPUT.yml` | Análisis |
| `TEMPLATE-FASE-P-OUTPUT.yml` | Planeación |
| `TEMPLATE-FASE-V-OUTPUT.yml` | Validación |
| `TEMPLATE-FASE-E-OUTPUT.yml` | Ejecución |
| `TEMPLATE-FASE-D-OUTPUT.yml` | Documentación |
| `TEMPLATE-POST-VALIDACION.yml` | Post-ejecución |
**Path:** `templates/capved/`
### Scrum (2)
| Template | Propósito |
|----------|-----------|
| `TEMPLATE-SPRINT-BACKLOG.yml` | Backlog de sprint |
| `TEMPLATE-RETROSPECTIVA.yml` | Retrospectiva |
**Path:** `templates/scrum/`
### Otros
| Template | Propósito |
|----------|-----------|
| `TEMPLATE-CONTEXT-MAP.yml` | Mapa de contexto por proyecto |
| `SESSION-TRACKING-TEMPLATE.yml` | Tracking de sesiones |
| `SERVICE-DESCRIPTOR-TEMPLATE.yml` | Descriptor de servicios |
**Path:** `templates/`
---
## Referencias
| Archivo | Propósito |
|---------|-----------|
| `ALIASES.yml` | Resolución de @ALIAS |
| `REPOSITORY-STRUCTURE.md` | Estructura de repositorios |
| `PROPAGATION-CRITERIA-MATRIX.yml` | Criterios de propagación |
**Path:** `referencias/`
---
## Registro de Errores
| Archivo | Propósito |
|---------|-----------|
| `REGISTRO-ERRORES.yml` | Historial global de errores |
**Path:** `errores/`
Estructura de error:
```yaml
errores:
- id: ERR-XXXX
descripcion: "..."
ocurrencias: 3
causa_raiz: "..."
solucion_definitiva: "..."
prevencion: "..."
```
---
## Perfiles de Agentes
| Perfil | Especialización |
|--------|-----------------|
| `PERFIL-AGENTE-BASE.md` | Base común |
| `PERFIL-DATABASE-DEVELOPER.md` | PostgreSQL, DDL |
| `PERFIL-BACKEND-DEVELOPER.md` | NestJS, Express |
| `PERFIL-FRONTEND-DEVELOPER.md` | React, Vue |
| `PERFIL-ARCHITECTURE-ANALYST.md` | Análisis arquitectónico |
| `PERFIL-MCP-ARCHITECT.md` | MCP Servers |
| `PERFIL-MCP-DEVELOPER.md` | Desarrollo MCP |
| `PERFIL-RAG-ENGINEER.md` | RAG Systems |
**Path:** `agents/perfiles/`
---
## Proyectos del Workspace
### Standalone
| Proyecto | CONTEXT-MAP |
|----------|-------------|
| gamilit | `projects/gamilit/orchestration/CONTEXT-MAP.yml` |
| trading-platform | `projects/trading-platform/orchestration/CONTEXT-MAP.yml` |
| betting-analytics | `projects/betting-analytics/orchestration/CONTEXT-MAP.yml` |
| inmobiliaria-analytics | `projects/inmobiliaria-analytics/orchestration/CONTEXT-MAP.yml` |
| platform_marketing_content | `projects/platform_marketing_content/orchestration/CONTEXT-MAP.yml` |
### Suite ERP
| Proyecto | Nivel | CONTEXT-MAP |
|----------|-------|-------------|
| erp-suite | SUITE | `projects/erp-suite/orchestration/CONTEXT-MAP.yml` |
| erp-core | CORE | `projects/erp-core/orchestration/CONTEXT-MAP.yml` |
| erp-clinicas | VERTICAL | `projects/erp-clinicas/orchestration/CONTEXT-MAP.yml` |
| erp-construccion | VERTICAL | `projects/erp-construccion/orchestration/CONTEXT-MAP.yml` |
| erp-mecanicas-diesel | VERTICAL | `projects/erp-mecanicas-diesel/orchestration/CONTEXT-MAP.yml` |
| erp-retail | VERTICAL | `projects/erp-retail/orchestration/CONTEXT-MAP.yml` |
| erp-vidrio-templado | VERTICAL | `projects/erp-vidrio-templado/orchestration/CONTEXT-MAP.yml` |
---
## Ciclo CAPVED++
```
┌─────────────────────────────────────────────────────────────────┐
│ FASE 0: Resolución Automática de Contexto │
│ └─ CONTEXT-MAP.yml → Cargar archivos por nivel/tarea │
├─────────────────────────────────────────────────────────────────┤
│ FASE C: Contexto (~5 min) │
│ └─ Gate: HU vinculada, tipo clasificado, catálogo verificado │
├─────────────────────────────────────────────────────────────────┤
│ FASE A: Análisis (~15 min) │
│ └─ Gate: Objetos mapeados, dependencias, riesgos │
├─────────────────────────────────────────────────────────────────┤
│ FASE P: Planeación (~10 min) │
│ └─ Gate: Subtareas definidas, agentes asignados │
├─────────────────────────────────────────────────────────────────┤
│ FASE V: Validación (~5 min) - NO DELEGAR │
│ └─ Gate: Cobertura A→P 100%, dependencias resueltas │
├─────────────────────────────────────────────────────────────────┤
│ FASE E: Ejecución (variable) │
│ └─ Gate por subtarea: build pasa, lint pasa │
├─────────────────────────────────────────────────────────────────┤
│ FASE D: Documentación (~10 min) │
│ └─ Gate: Inventarios, trazas, propagación │
├─────────────────────────────────────────────────────────────────┤
│ POST: Validación Post-Ejecución │
│ └─ Comparar plan vs real, verificar consistencia │
└─────────────────────────────────────────────────────────────────┘
```
---
## Uso Rápido
### Iniciar Tarea en Proyecto
```bash
# 1. Leer CONTEXT-MAP del proyecto
cat projects/{proyecto}/orchestration/CONTEXT-MAP.yml
# 2. Verificar errores previos
cat orchestration/errores/REGISTRO-ERRORES.yml
cat projects/{proyecto}/orchestration/errores/REGISTRO-ERRORES.yml
# 3. Seguir SIMCO correspondiente
cat orchestration/directivas/simco/SIMCO-{operacion}.md
cat orchestration/directivas/simco/SIMCO-{dominio}.md
```
### Delegar a Subagente
```bash
# 1. Usar SIMCO-DELEGACION-PARALELA.md
# 2. Crear SESSION-TRACKING
# 3. Heredar CONTEXT-MAP resuelto
```
---
## Recursos Compartidos
| Recurso | Path |
|---------|------|
| Knowledge Base | `shared/knowledge-base/` |
| Catálogo | `shared/catalog/` |
| Scripts | `scripts/` |
---
**Actualizado:** 2026-01-04
**Sistema:** NEXUS v4.0 + SIMCO