local-llm-agent/orchestration/BOOTLOADER.md
Adrian Flores Cortes 3def230d58 Initial commit: local-llm-agent infrastructure project
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 16:42:45 -06:00

194 lines
7.4 KiB
Markdown

# BOOTLOADER - Local LLM Agent
**Sistema:** NEXUS v4.0 - Protocolo de Arranque Local
**Proyecto:** Local LLM Agent
**Tipo:** STANDALONE (Infraestructura de Soporte)
**Version:** 1.0.0
**Fecha:** 2026-01-24
---
## 1. Proposito
Este BOOTLOADER define la secuencia de arranque especifica para Local LLM Agent.
Gateway de LLM local que permite a los agentes del workspace delegar tareas
simples para ahorrar contexto y tokens.
---
## 2. Arquitectura del Proyecto
```
Local LLM Agent (STANDALONE - Infraestructura)
├── apps/gateway <- NestJS API Gateway (puerto 3160)
├── apps/inference-engine <- FastAPI Inference (puerto 3161)
├── config/ <- Configuraciones
├── monitoring/ <- Prometheus + Grafana
├── lora-adapters/ <- Adaptadores LoRA por proyecto
└── scripts/ <- Scripts de setup
Backends de Inferencia:
├── Ollama (11434) <- CPU, desarrollo
└── vLLM (8000) <- GPU, produccion
```
---
## 3. Secuencia de Arranque (5 Pasos)
```
┌─────────────────────────────────────────────────────────────────────────┐
│ BOOTLOADER LOCAL-LLM-AGENT - 5 PASOS │
├─────────────────────────────────────────────────────────────────────────┤
│ │
│ PASO 1: Cargar L0 (Sistema - Workspace) │
│ ════════════════════════════════════════ │
│ ├── Leer workspace-v2/CLAUDE.md │
│ └── Tokens: ~4000 │
│ │ │
│ ▼ │
│ PASO 2: Cargar L1 (Proyecto) │
│ ════════════════════════════════════════ │
│ ├── Leer orchestration/CONTEXT-MAP.yml │
│ ├── Leer orchestration/_inheritance.yml (STANDALONE) │
│ ├── Leer INVENTARIO.yml (inventario principal) │
│ └── Tokens: ~1500 │
│ │ │
│ ▼ │
│ PASO 3: Determinar Dominio │
│ ════════════════════════════════════════ │
│ ├── ¿Tarea de Gateway (NestJS)? → apps/gateway │
│ ├── ¿Tarea de Inference (Python)? → apps/inference-engine │
│ ├── ¿Tarea de Infra (Docker)? → docker-compose.*.yml │
│ └── ¿Tarea de LoRA? → lora-adapters/ │
│ │ │
│ ▼ │
│ PASO 4: Verificar Estado de Servicios │
│ ════════════════════════════════════════ │
│ ├── Verificar si Docker esta corriendo │
│ ├── Verificar estado de Ollama/vLLM backend │
│ └── Cargar PROJECT-STATUS.md si necesario │
│ │ │
│ ▼ │
│ PASO 5: Iniciar Tarea │
│ ════════════════════════════════════════ │
│ ├── git fetch origin && git status │
│ └── Ejecutar FASE C de CAPVED │
│ │
└─────────────────────────────────────────────────────────────────────────┘
```
---
## 4. Rol STANDALONE (Infraestructura)
Local LLM Agent es infraestructura de soporte:
```yaml
herencia:
parent: null
tipo: STANDALONE
subtipo: INFRASTRUCTURE
razon: "Servicio de soporte para todo el workspace"
consumidores:
- proyecto: "*"
tipo: SERVICE
via: API (puerto 3160)
servicios:
gateway:
puerto: 3160
framework: NestJS
api: OpenAI-compatible
inference:
puerto: 3161
framework: FastAPI
backends:
- ollama (CPU)
- vllm (GPU)
mcp_tools:
- classify # Clasificar texto
- extract # Extraer datos
- rewrite # Reescribir
- summarize # Resumir
```
---
## 5. Variables Pre-Resueltas
```yaml
PROJECT_ROOT: projects/local-llm-agent
GATEWAY_ROOT: projects/local-llm-agent/apps/gateway
INFERENCE_ROOT: projects/local-llm-agent/apps/inference-engine
CONFIG_ROOT: projects/local-llm-agent/config
LORA_ROOT: projects/local-llm-agent/lora-adapters
PUERTOS:
gateway: 3160
inference: 3161
ollama: 11434
vllm: 8000
prometheus: 9090
grafana: 3000
DOCKER_COMPOSE:
desarrollo: docker-compose.yml
produccion: docker-compose.prod.yml
vllm_only: docker-compose.vllm.yml
monitoring: docker-compose.monitoring.yml
```
---
## 6. Checklist de Arranque
- [ ] PASO 1: workspace-v2/CLAUDE.md leido
- [ ] PASO 2: CONTEXT-MAP.yml cargado
- [ ] PASO 2: _inheritance.yml verificado (STANDALONE)
- [ ] PASO 2: INVENTARIO.yml revisado
- [ ] PASO 3: Dominio identificado (Gateway/Inference/Infra)
- [ ] PASO 4: Estado de Docker verificado
- [ ] PASO 5: git fetch ejecutado
- [ ] PASO 5: Tarea iniciada
---
## 7. Comandos Rapidos
```bash
# Desarrollo (CPU)
docker-compose up -d
# Produccion (GPU)
docker-compose -f docker-compose.prod.yml up -d
# Solo vLLM
docker-compose -f docker-compose.vllm.yml up -d
# Monitoring
docker-compose -f docker-compose.monitoring.yml up -d
# Verificar salud
curl http://localhost:3160/health
curl http://localhost:3161/health
```
---
## 8. Referencias
- **BOOTLOADER Global:** `workspace-v2/orchestration/directivas/simco/SIMCO-BOOTLOADER.md`
- **README:** `README.md` (quick start)
- **Arquitectura:** `docs/00-vision-general/ARQUITECTURA-LOCAL-LLM.md`
- **API Reference:** `docs/80-referencias/API-REFERENCE.md`
---
*BOOTLOADER Local LLM Agent v1.0.0 - Sistema NEXUS v4.0*
*Tipo: STANDALONE - Infraestructura de Soporte*