diff --git a/k8s/openclaw/AGENTS.md b/k8s/openclaw/AGENTS.md index cc72678..f2f21a7 100644 --- a/k8s/openclaw/AGENTS.md +++ b/k8s/openclaw/AGENTS.md @@ -55,6 +55,30 @@ To perform modifications or rotate api keys: kubectl apply -f k8s/openclaw/openclaw-instance.secret.yaml kubectl apply -f k8s/openclaw/cronjob-wiki-backup.secret.yaml ``` +4. **Register / Sync Automations**: Run `setup-itguy-cron.sh` to ensure the weekly health audit automation is registered in OpenClaw: + ```bash + ./k8s/openclaw/setup-itguy-cron.sh + ``` + +--- + +### 4. 🗂️ The Three Core Repositories Architecture & Weekly Self-Audit + +OpenClaw connects to three foundational Git repositories: +1. **`infrapuzzle`** (`/home/node/.openclaw/repos/infrapuzzle` on PVC): + - **Scope**: Source of truth for cluster infrastructure (`haumdaucher`), Kubespray bootstrap, K8s manifests, Terraform DNS, ESPHome IoT, and Architecture Decision Records (`docs/adr/`). +2. **`mop-skills`** (`/home/node/mop-skills/mop-skills` via `git-sync` sidecar): + - **Scope**: Custom Python skills, CLI utilities, and MCP bridges (`openclaw-audit`, `garmin-auth`, `brother-printer`, `google-calendar`, etc.). +3. **`knowledge-wiki`** (`/home/node/.openclaw/wiki/main`): + - **Scope**: Agents-as-code (`agents/*.md`), active task dispatch queue (`tasks/antigravity.md`), family knowledge vault, and audit archives (`operations/audits/`). + +#### 🩺 Autonomous Weekly Health Audit (`itguy-weekly-health-audit`) +- Scheduled via OpenClaw Cron on **Sundays at 03:00 Europe/Berlin** (`0 3 * * 0`). +- Executes `uv run /home/node/mop-skills/mop-skills/skills/openclaw-audit/scripts/audit_openclaw.py --since 7d --write-report --add-task --git-push`. +- Correlates errors (pod stdout & session transcripts) with recent git commits across the 3 repositories. +- Archives diagnostic reports into `operations/audits/YYYY-Wxx.md`. +- Appends newly detected, actionable tasks into `tasks/antigravity.md` under `## 📥 Pending Tasks`. +- **Telegram Notification Policy**: Alerts Topic `#IT Guy` (thread `119`) if new issues are filed; returns `NO_REPLY` for intentional silence when clean. --- diff --git a/k8s/openclaw/README.md b/k8s/openclaw/README.md index 0d23d5f..f04e571 100644 --- a/k8s/openclaw/README.md +++ b/k8s/openclaw/README.md @@ -54,6 +54,9 @@ kubectl apply -f k8s/openclaw/openclaw-instance.secret.yaml # Apply the automated daily knowledge-wiki backup CronJob kubectl apply -f k8s/openclaw/cronjob-wiki-backup.secret.yaml + +# Register the IT Guy weekly health audit automation +./k8s/openclaw/setup-itguy-cron.sh ``` --- diff --git a/k8s/openclaw/openclaw-instance.secret.yaml b/k8s/openclaw/openclaw-instance.secret.yaml index 432d172..44316fb 100644 Binary files a/k8s/openclaw/openclaw-instance.secret.yaml and b/k8s/openclaw/openclaw-instance.secret.yaml differ diff --git a/k8s/openclaw/setup-itguy-cron.sh b/k8s/openclaw/setup-itguy-cron.sh new file mode 100755 index 0000000..fa7e272 --- /dev/null +++ b/k8s/openclaw/setup-itguy-cron.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash +# ============================================================================== +# setup-itguy-cron.sh +# Declaratively registers the IT Guy weekly health audit in OpenClaw. +# Schedule: Every Sunday at 03:00 Europe/Berlin (cron: 0 3 * * 0) +# ============================================================================== + +set -euo pipefail + +NAMESPACE="${NAMESPACE:-openclaw}" +POD_NAME="${POD_NAME:-openclaw-0}" +CONTAINER_NAME="${CONTAINER_NAME:-openclaw}" + +JOB_NAME="itguy-weekly-health-audit" +CRON_SCHEDULE="0 3 * * 0" +TIMEZONE="Europe/Berlin" +TELEGRAM_GROUP="-1004326921510" +TELEGRAM_TOPIC="119" + +echo "=== Registering IT Guy Weekly Health Audit in OpenClaw ($POD_NAME) ===" + +# 1. Check if job already exists +EXISTING_ID=$(kubectl exec -n "$NAMESPACE" "$POD_NAME" -c "$CONTAINER_NAME" -- openclaw cron list 2>/dev/null | grep "$JOB_NAME" | awk '{print $1}' || true) + +if [ -n "$EXISTING_ID" ]; then + echo "Found existing job with ID $EXISTING_ID. Removing for idempotent recreation..." + kubectl exec -n "$NAMESPACE" "$POD_NAME" -c "$CONTAINER_NAME" -- openclaw cron rm "$EXISTING_ID" || true +fi + +# 2. Add the job +echo "Creating automation $JOB_NAME ($CRON_SCHEDULE @ $TIMEZONE)..." + +MESSAGE=$(cat << 'EOF' +Führe den wöchentlichen OpenClaw System- und Log-Audit durch. +Vorgehen: +1. Führe den Audit-Befehl aus: + uv run /home/node/mop-skills/mop-skills/skills/openclaw-audit/scripts/audit_openclaw.py --since 7d --write-report --add-task --git-push +2. Analysiere die Ausgabe und korreliere eventuelle Fehler-Cluster mit den jüngsten Commits in infrapuzzle, mop-skills und knowledge-wiki. +3. Finale Antwort: + - Wenn NEUE Probleme gefunden oder Tasks in tasks/antigravity.md eingetragen wurden: Fasse die Ergebnisse kurz, präzise und lösungsorientiert zusammen (betroffene Tools, vermutete Ursache, Link zur Task-Queue) und gib diese Zusammenfassung als finale Antwort aus. + - Wenn das System gesund ist und KEINE neuen Tasks erzeugt wurden: Gib als finale Antwort exakt 'NO_REPLY' aus (intentional silence, kein Telegram-Spam). +EOF +) + +kubectl exec -n "$NAMESPACE" "$POD_NAME" -c "$CONTAINER_NAME" -- openclaw cron add \ + --name "$JOB_NAME" \ + --description "Wöchentlicher Self-Audit der OpenClaw-Logs, Tool-Failures und Session-Transkripte mit Git-Commit-Korrelation" \ + --cron "$CRON_SCHEDULE" \ + --tz "$TIMEZONE" \ + --agent "itguy" \ + --model "openrouter/deepseek/deepseek-v4.1-flash" \ + --session "isolated" \ + --channel "telegram" \ + --to "$TELEGRAM_GROUP" \ + --thread-id "$TELEGRAM_TOPIC" \ + --announce \ + --message "$MESSAGE" + +echo "=== Automation successfully registered! ===" +kubectl exec -n "$NAMESPACE" "$POD_NAME" -c "$CONTAINER_NAME" -- openclaw cron list | grep "$JOB_NAME" || true diff --git a/knowledge-wiki b/knowledge-wiki index 5fe1208..85cb53f 160000 --- a/knowledge-wiki +++ b/knowledge-wiki @@ -1 +1 @@ -Subproject commit 5fe12084dc2a8fe8dfb57e16f30fba96c158a7b9 +Subproject commit 85cb53ffbb3f9d9474f0c9f6b4bf0bf28a187acc