Add athena-ai-profile-router skill

This commit is contained in:
Mikei386 committed 2026-09-11 15:58:25 +02:00
1 parent 18786a5c40
commit 9c7bfcc1c8
1 file changed
+120
@@ -0,0 +1,120 @@
---
name: athena-ai-profile-router
description: Use when operating the AI profile router on Athena.
metadata:
hermes:
editorial_name: "Athena AI-Profile-Router"
editorial_description: "Betrieb und Abfragen der lokalen KI-Plattform auf Athena: Profile, Status, Umschaltung."
---
# Athena AI-Profile-Router
Lokale KI-Plattform auf **Athena** (root@192.168.1.212, Debian 13, GPU-Host).
Repo: `/root/AI-Profile-Router` (Gitea: `michael/AI-Profile-Router`).
SSH: `ssh -i /opt/data/athena_key -o UserKnownHostsFile=/opt/data/.ssh/known_hosts -o IdentitiesOnly=yes root@192.168.1.212`
## Wichtigste Regel
**Der Host steht physisch in einer anderen Stadt. Es gibt keinen schnellen
Zugang.**
- **NIEMALS** herunterfahren (`shutdown`, `poweroff`, `halt`) oder neu
starten (`reboot`, `init 6`).
- Keine Aktion, die die Erreichbarkeit gefährdet: keine Änderungen an `lan0`,
Firewall-Default-Policies, `DOCKER-USER`-Regeln oder Routing ohne explizite
Freigabe und Rückfallplan; keine Reboot-Pflicht auslösenden Aktionen
(Kernel-, NVIDIA-Treiber-Installation, `apt full-upgrade` mit Kernel) ohne
ausdrückliche Freigabe; keine Abschaltung von WireGuard, SSH oder dem
Gateway-Container.
- Installer-Exit-Code 20 (NVIDIA-Treiber, Reboot nötig) wird nicht automatisch
nachgeholt — der Betreiber entscheidet.
- Nach jeder Netz-/Firewall-/WG-Änderung verifizieren: (1) SSH-Roundtrip,
(2) WG-Tunnel up, (3) Router `/health` und `/ready` = 200.
## Architektur (Kurzform)
- **Profile Router** (`mike-ai-router`, OpenAI-kompatible API, Port 8081):
einzige Client-Schnittstelle. Clients nutzen `http://<host>:8081/v1` mit
Bearer-Key aus `/etc/mike-ai/router-api-key`.
- **llama.cpp** (`mike-ai-llama-*`): ein Container pro Profil, immer exakt
einer aktiv; nur Docker-intern (Port 8080, nie direkt von Clients).
- **Profile Controller** (`mike-ai-profile-controller`): einziger Dienst mit
Docker-Socket; begrenzter Containerwechsel.
- **Open WebUI** (`mike-ai-open-webui`, Port 8080): einzige normale Oberfläche.
- **MCP-Tool-Stack** (`platform/mcp/`): getrennte Container für Web, HA, ARR,
Unraid — nur über internes `mike-ai-tools`-Netz.
- WireGuard-Isolation: KI-Dienste nur über WG-Adresse erreichbar,
fail-closed bei Tunnelausfall (Blackhole-Default-Route).
## Profile (Live-Stand 11.09.2026)
| Profil | Virtuelles Modell | Kontext | Zweck |
|---|---|---:|---|
| fast | `qwen-fast` | 76.800 | Alltag, Agenten, hohe Geschwindigkeit |
| medium | `qwen-medium` | 160.000 | mehr Kontext |
| large | `qwen-large` | 192.000 | lange Sitzungen |
| ultra | `qwen-ultra` | 262.144 | maximale Kontextlänge |
| uncensored | `qwen-uncensored` | 80.000 | unzensiert |
Aktives Profil: `GET /status` → `current_profile`.
Profilwechsel: `POST /fast`, `/medium`, `/large`, `/ultra`, `/uncensored`
(authentifiziert) oder manuell `llama-profile <name>` auf dem Host.
## Wichtige Befehle (per SSH auf Athena)
```bash
# Status (Router lebt, Profil, Upstream, Telemetrie)
KEY=$(cat /etc/mike-ai/router-api-key)
curl -s -H "Authorization: Bearer ***" http://172.30.20.3:8081/status
# Health / Ready (ohne Auth)
curl -s -o /dev/null -w '%{http_code}' http://172.30.20.3:8081/health # 200 = Router lebt
curl -s -o /dev/null -w '%{http_code}' http://172.30.20.3:8081/ready # 200 = Modell bereit
# Virtuelle Modelle
curl -s -H "Authorization: Bearer ***" http://172.30.20.3:8081/v1/models
# Profilwechsel
curl -s -X POST -H "Authorization: Bearer ***" http://172.30.20.3:8081/ultra
# Aktive Profile-Registry (Router-Container)
docker exec mike-ai-router cat /app/router_profiles.json
# Container-Status
docker ps --format '{{.Names}}\t{{.Status}}' | grep mike-ai
```
Router-IP auf dem internen `mike-ai_control`-Netz: `172.30.20.3`
(neu ermitteln: `docker inspect mike-ai-router --format '{{.NetworkSettings.Networks.mike-ai_control.IPAddress}}'`).
## Fehler- und Recovery-Verhalten
- `/health=200` + `/ready=503` → Router lebt, Modell lädt/wechselt noch.
- `429` → Parallelitätsgrenze (max. 16) erreicht; Client mit Backoff.
- Profilwechsel bricht ab, wenn laufende Chats den Drain-Timeout (600 s)
überschreiten — er beendet niemals absichtlich einen Chat.
- Nach Routerabsturz: letztes stabiles Profil aus atomarer Zustandsdatei
(`/var/lib/mike-ai-profile-router/state.json`) rekonstruiert.
- Upgrade-Regel: niemals Build, Quantisierung und Profil gleichzeitig ändern.
## Git / Repo
- Remote: `git@192.168.1.2:michael/AI-Profile-Router.git` (Gitea auf Unraid).
- Athena erreicht das Heimnetz **nur über WireGuard** — ist der WG-Tunnel
down, schlägt `git push` mit Connection timed out fehl. Nicht mit
Firewall-/Routing-Änderungen gegensteuern; Tunnel-Status prüfen und
melden. Commits bleiben lokal auf Athena, bis der Tunnel wieder up ist.
- Git-Identität auf Athena ist repo-lokal gesetzt (Mikei386).
## Sicherheitsregeln
- API-Key (`/etc/mike-ai/router-api-key`) nie in Chat, Repo oder URLs.
- Clients nie direkt Port 8080 (llama.cpp) — immer über Router 8081.
- `config/install.env` bleibt lokal (0600), wird nicht committet.
- Systempartition dauerhaft unter 85 % halten; nur ein Textmodell gleichzeitig.
## Backup
Gesichert: Repo, Modellmanifest (Hashes, ohne Secrets), `/etc/mike-ai`
verschlüsselt, systemd-Konfiguration, Benchmarkresultate.
Nicht nötig: Builds, Venvs, Caches, Modelle (Quelle + Prüfsumme dokumentiert).