Skip to content

Autonomous OODA-loop pentesting agent. Hermes brain, Kali + Playwright tools over MCP, ATT&CK as the Orient language.

chore: update configuration files and documentation

irrazeef20191625b
diff --git a/.env.example b/.env.example
index ddb9db8..1c5d967 100644
--- a/.env.example
+++ b/.env.example
@@ -19,6 +19,24 @@ OPENROUTER_API_KEY=
# refuse the authorized-offensive pentest framing (the OpenRouter/Anthropic safety filter returns
# "violative cyber content" and does not respond). Overriding with such a model may make the
# agent refuse to work.
+#
+# FALLBACK AUTOMATICO: Hermes tiene configurado GLM-5.3 Flash (z-ai/glm-5.3-flash) como
+# fallback automático en agent-ooda/profile/config.yaml (fallback_providers). Si Mistral Large 4
+# falla por rate-limiting (429), server error (500/502/503) o auth failure (401/403), Hermes
+# cambia AUTOMATICAMENTE a GLM-5.3 Flash mid-session sin perder contexto. El fallback es
+# per-turn: cada mensaje nuevo intenta Mistral de nuevo; si vuelve a fallar, reactiva GLM.
+#
+# Para cambiar el modelo PRIMARIO manualmente (sin esperar fallo):
+# OPENROUTER_MODEL=z-ai/glm-5.3-flash
+#
+# GLM-5.3 Flash vs Mistral Large 4:
+# • Mismo Cyber Index (50% ambos)
+# • 20x más barato ($0.07/$0.21 vs $1.36/$4.18 per M tokens)
+# • Probado: end-to-end exploits, 0-days en navegador, caso Hugging Face
+# • Multimodal (screenshots de targets)
+# • CyberGym 84.5% (top), pero NexBench 29/100 (pentesting autónomo largo)
+#
+# Ver agent-ooda/profile/config.yaml sección fallback_providers para detalles completos.
OPENROUTER_MODEL=
# --- Local/remote Ollama inference (OPTIONAL, opt-in) -------------------------
diff --git a/.gitignore b/.gitignore
index 333d470..ceba97b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -58,3 +58,6 @@ backlog.md
# --- Labs: exploits ejecutables nunca se versionan (SEGURIDAD) ---
# Los labs documentan vulnerabilidades, pero exploits funcionales no deben estar en el repo.
labs/**/exploits/
+
+# --- Vulnerable lab (entorno de testing con Workers) ---
+vulnerable-lab/
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4c913f1..a4e12b2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+### Added
+
+- **Automatic LLM fallback with GLM-5.3 Flash** — Configured native Hermes `fallback_providers` chain with `z-ai/glm-5.3-flash` as automatic fallback. When Mistral Large 4 fails (rate-limit 429, server error 500/502/503, auth failure 401/403), Hermes automatically switches mid-session without losing context. Per-turn failover: each message attempts primary first. Same Cyber Index as Mistral (50%) but 20x cheaper ($0.07/$0.21 vs $1.36/$4.18). Proven in production for end-to-end exploits and 0-day discovery. Top CyberGym score (84.5%). Manual override via `OPENROUTER_MODEL` env var or `hermes config set model.default`. See `docs/modelos-cyberseguridad-openrouter-CORRECTED.md` for full analysis.
+- **Enhanced model documentation** — Updated `agent-ooda/profile/config.yaml` with detailed `fallback_providers` configuration and prompt cache cost warnings, `.env.example` with automatic fallback behavior, and README section on native Hermes fallback mechanism.
+
## [1.6.0] - 2026-10-22
### Added
diff --git a/README.md b/README.md
index 3565083..7b75393 100644
--- a/README.md
+++ b/README.md
@@ -206,10 +206,15 @@ The README is intentionally short. The detail lives under [`docs/`](docs/):
| Every `.env` variable, AWS creds, local Ollama inference | [`docs/configuration.md`](docs/configuration.md) |
| Driving a pentest (TUI, MCP client, raw HTTP), the Juice Shop lab, clean restarts | [`docs/usage.md`](docs/usage.md) |
| The no-guardrails model, opt-in scope-guard, MCP inbound token | [`docs/security.md`](docs/security.md) |
+| **Automatic LLM fallback** (Mistral Large 4 ↔ GLM-5.3 Flash) | [`docs/llm-fallback.md`](docs/llm-fallback.md) |
| Raw HTTP API reference (`:8642`) | [`docs/http-api.md`](docs/http-api.md) |
| Architecture, OODA design, findings-store schema | [`docs/design.md`](docs/design.md) |
| Sample redacted deliverable | [`docs/example-report.md`](docs/example-report.md) |
+## Models
+
+Hermes uses **Mistral Large 4** as primary with automatic fallback to **GLM-5.3 Flash** on rate limits or errors. Both models have the same Cyber Index (50%) but different cost/performance trade-offs. See [`docs/llm-fallback.md`](docs/llm-fallback.md) for configuration and comparison.
+
## ⚠️ Security & authorized use
> **By default this product has no guardrails: no scope-guard, no consent, no audit, no
diff --git a/agent-ooda/profile/config.yaml b/agent-ooda/profile/config.yaml
index e105fe5..52aef10 100644
--- a/agent-ooda/profile/config.yaml
+++ b/agent-ooda/profile/config.yaml
@@ -42,6 +42,36 @@ model:
# esta vacia/sin definir, el fallback es OpenRouter + este model.default (sin cambios).
default: "mistralai/mistral-large-4-0"
+# --- Fallback automatico (Hermes native) -------------------------------------
+# CADENA DE FALLBACK: si el modelo primario falla (rate-limit 429, server error 500/502/503,
+# auth failure 401/403), Hermes cambia AUTOMATICAMENTE al fallback mid-session sin perder
+# el contexto de la conversacion. El fallback es PER-TURN: cada mensaje nuevo intenta el
+# primario de nuevo; si vuelve a fallar, reactiva el fallback solo para ese turno.
+#
+# VENTAJAS GLM-5.3 Flash vs Mistral Large 4:
+# - Mismo Cyber Index (50% ambos en Artificial Analysis)
+# - 20x mas barato: $0.07/M in, $0.21/M out (vs $1.36/$4.18)
+# - Probado en produccion real: 0-days en navegador, Hugging Face incident response
+# - Multimodal: acepta imagenes (util para screenshots de targets web)
+# - Context: 1M tokens
+# - Safeguards bypasseables (pero en pentest autorizado es ventaja, no problema)
+# - CyberGym 84.5% (top score), ExploitBench 54.4%, caso real end-to-end exploits
+#
+# DESVENTAJAS:
+# - NexBench 29/100 (puesto 13): CyberGym no se traduce a pentesting autonomo largo
+# - Menos data publica de refusal rates en contexto corporativo (Mistral mas probado)
+#
+# ATENCION PROMPT CACHE: cuando el fallback se activa, el nuevo proveedor:modelo NO tiene el
+# prefix cacheado de tu conversacion, asi que el siguiente request re-lee toda la historia a
+# precio completo de input tokens (no 75-90% descuento de cache). Lo mismo aplica cuando el
+# turno termina y se restaura el primario. Es el costo de mantenerse vivo durante un outage.
+#
+# SINTAXIS: lista `fallback_providers` (no singular `fallback_model`). Cada entrada necesita
+# `provider` y `model`. Ver https://hermes-agent.nousresearch.com/docs/user-guide/features/fallback-providers
+fallback_providers:
+ - provider: openrouter
+ model: z-ai/glm-5.3-flash
+
# --- Primer servidor MCP: la Kali (contenedor `kali`) -----------------------
# Hermes es CLIENTE de este MCP: ejecuta las tools de pentest CLI DIRECTO sobre la Kali. Es la via
# principal al target (el navegador va por el segundo MCP, `playwright`, mas abajo). Sintaxis
diff --git a/docker-compose.yml b/docker-compose.yml
index 07b92e4..194137e 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -107,6 +107,8 @@ services:
cp -r /opt/profile-src/profile/skins/. "$$DEF/skins/" 2>/dev/null || true
# (b) inject the API server KEY (secret, not versioned) BEFORE starting.
hermes config set platforms.api_server.key "$$HERMES_API_SERVER_KEY" >/dev/null
+ # (b1.5) FALLBACK PROVIDERS: apply from config.yaml's fallback_providers section
+ hermes config set fallback_providers '[{"provider": "openrouter", "model": "z-ai/glm-5.3-flash"}]' >/dev/null
# (b2) LLM PROVIDER SELECTION (opt-in, fallback = OpenRouter):
if [ -n "$$OLLAMA_BASE_URL" ]; then
# --- Ollama mode -------------------------------------------------------
diff --git a/docs/llm-fallback.md b/docs/llm-fallback.md
new file mode 100644
index 0000000..ff5c3b4
--- /dev/null
+++ b/docs/llm-fallback.md
@@ -0,0 +1,63 @@
+# 🔄 Automatic LLM Fallback
+
+## Overview
+
+Hermes is configured with **native automatic fallback** to ensure continuous operation even when the primary model experiences issues. The system automatically switches between models without losing conversation context.
+
+## Model Configuration
+
+**Primary model**: Mistral Large 4 (`mistralai/mistral-large-4-0`)
+**Automatic fallback**: GLM-5.3 Flash (`z-ai/glm-5.3-flash`)
+
+The fallback is **per-turn**: each new message attempts the primary first; if it fails again, the fallback activates for that turn only.
+
+## When Fallback Activates
+
+The automatic fallback triggers when Mistral Large 4 encounters:
+- **Rate limits** (HTTP 429) — OpenRouter has tight limits: 20 req/min, 50-1000 req/day
+- **Server errors** (HTTP 500, 502, 503) — after retry attempts exhausted
+- **Auth failures** (HTTP 401, 403) — immediately
+
+## Model Comparison
+
+Both models have the **same Cyber Index score (50%)** but different trade-offs:
+
+| Aspect | Mistral Large 4 | GLM-5.3 Flash |
+|--------|-----------------|---------------|
+| **Cyber Index** | 50% | 50% (same) |
+| **Cost** | $1.36/M in, $4.18/M out | $0.07/M in, $0.21/M out (20x cheaper) |
+| **CyberGym** | ~74% | 84.5% (top score) |
+| **NexBench** (real pentest) | — | 29/100 (autonomous long engagement) |
+| **Production proof** | Corporate-tested | End-to-end exploits, 0-days, Hugging Face incident |
+| **Multimodal** | No | Yes (screenshots, PDFs) |
+| **Context** | 1M tokens | 1M tokens |
+| **Safeguards** | Robust | Bypassable (advantage in authorized pentests) |
+
+## Prompt Cache Behavior
+
+⚠️ **Important**: When fallback activates, the new model has no cached conversation prefix, so the next request re-reads the entire history at full input-token price (not the 75-90% cached discount). This also applies when returning to the primary. It's the cost of staying alive through an outage.
+
+## Manual Override
+
+To use GLM-5.3 Flash as the **primary** (instead of waiting for automatic fallback):
+
+### Before starting the stack
+
+Set in `.env`:
+```sh
+OPENROUTER_MODEL=z-ai/glm-5.3-flash
+```
+
+### Change it live in a running container
+
+```sh
+docker compose exec ooda-agent hermes config set model.default z-ai/glm-5.3-flash
+```
+
+## Configuration Details
+
+Configuration is managed in [`agent-ooda/profile/config.yaml`](../agent-ooda/profile/config.yaml) (see `fallback_providers` section).
+
+## Full Model Analysis
+
+See [`docs/modelos-cyberseguridad-openrouter-CORRECTED.md`](modelos-cyberseguridad-openrouter-CORRECTED.md) for the complete analysis of cybersecurity-focused models on OpenRouter.