Isometric section map — Plans Edit in FossFLOW ↗ Full size ↗
PlantUML — Plans Open SVG ↗ PlantUML server ↗
Plans PlantUML diagram

Mainframe Enablement Plan — Plugins, MCP, Rules, Skills & Tooling for Hermes

Goal: Configure Hermes as the primary operations console for the ProDG Mainframe (Docker Compose stack + Talos Track C + monitoring + apps), so routine ops (deploys, health checks, secret management, recovery) are executable directly from chat with minimal steering.

Architecture: Hermes already runs on the host with full terminal/computer-use access. The gap is curated context (rules/skills that encode Mainframe-specific lore), MCP servers for structured access to Docker/GitHub/monitoring, plugins for the dashboard, and scheduled cron jobs for watchdogs. Nothing here replaces the existing compose stack — it layers Hermes control on top.

Environment (verified): 25-service compose stack at /opt/prodg/compose (Caddy, headscale, postgres, redis, minio, infisical, vaultwarden, prometheus/grafana/loki/promtail, node-exporter, cadvisor, hermes-api, twenty, calcom, docuseal, mattermost, stirling-pdf, cryptgeon, passbolt, prodg-internal). Plus: /opt/prodg/talos/trackc (Talos VMs, kubectl+talosctl installed), /opt/prodg/quartz (docs site), /opt/prodg/camofox (browser server repo), /opt/prodg/backups, /opt/prodg/scripts/load-secrets.sh. tailscale installed. Hermes currently has only the context7 MCP server and a minimal toolset (hermes-cli, web, file).


Phase 1 — Rules (project context files)

Task 1.1: Write /opt/prodg/AGENTS.md

Encode as project rules (loaded automatically when working in that dir via workdir/terminal):

  • Stack layout map (compose/, talos/trackc, quartz, camofox, backups, scripts)
  • Hard-won lore from past incidents (all currently only in memory — write them down):
    • Prometheus runs as UID 65534 — data dir chown 65534:65534
    • Twenty CRM ≥2.8.3 needs TWENTY_ENCRYPTION_KEY or it crash-loops silently
    • Cal.com: Prisma needs postgres:// not postgresql://; healthcheck via node fetch /auth/setup; stale CALCOM_DATABASE_URL password pitfall
    • cryptgeon/docuseal healthchecks: wget + 127.0.0.1 (IPv6 not bound); Mattermost is distroless — no exec healthchecks
    • Docker json log bloat (113GB incident) — keep max-size limits on all services
    • Containers stuck in Created after host restart → docker compose start <svc>, don't recreate
    • Compose secrets loaded via /opt/prodg/scripts/load-secrets.sh + Infisical — never print secrets
    • Verify: cat /opt/prodg/AGENTS.md renders; cd /opt/prodg && hermes chat -q 'summarize the stack layout' picks it up.

Task 1.2: Write /root/.hermes/AGENTS.md (global rules)

  • Mainframe summary, pointers to the plan dir and /opt/prodg/AGENTS.md
  • Safety rules: no docker compose down on prod services without explicit approval; never expose secrets; change windows.

Phase 2 — MCP servers

Task 2.1: Add Docker MCP

hermes mcp add docker --transport stdio -- docker run -i --rm -v /var/run/docker.sock:/var/run/docker.sock alpine/docker-cli:latest

Better (no per-call container spin-up): install mcp-server-docker (npm/python) on host and register via stdio. Gives structured container/image/network inspect instead of parsing docker ps output.

  • Verify: hermes mcp list shows docker ✓; in-session tool call lists containers.

Task 2.2: Add GitHub MCP (or rely on gh CLI + github skills)

Only if PAT available — otherwise the existing github skills + gh CLI are sufficient and cheaper. Decision: skip MCP, use gh CLI.

Task 2.3: Add Grafana/Prometheus MCP

Register mcp-grafana (community) pointed at http://localhost:3000 with a service account token → natural-language queries of dashboards/alerts. Alternatively rely on terminal curl to Prometheus API (Task 5.2 covers this in a skill — YAGNI: start with the skill, add MCP only if queries get awkward).

  • Verify: hermes mcp list; ask "any alerts firing?" from chat.

Task 2.4 (keep): context7 — already enabled, used for docs lookups (Caddy/Talos/Twenty versions).

Phase 3 — Skills (create under ~/.hermes/skills/)

Task 3.1: mainframe-ops (umbrella runbook)

  • Map of all paths/services; health-check-all procedure (docker compose ps, docker ps -a | grep Created, curl Caddy endpoints); restart/recover procedures with the incident lore inline; log-bloat check (du -sh /var/lib/docker/containers/*).

Task 3.2: mainframe-secrets

  • Infisical + load-secrets.sh workflow; rules for reading/changing compose/.env; TWENTY_ENCRYPTION_KEY/CALCOM_DATABASE_URL sync procedure.

Task 3.3: mainframe-monitoring

  • Prometheus API query patterns (node_exporter, cadvisor, container metrics), Grafana dashboard URLs, log bloat watchdog.

Task 3.4: talos-trackc

  • Validated Track C procedure from memory: talhelper+libvirt, pinned MACs, boot-to-talos kexec mode, .raw.zst images, FSCONFIG_CMD_CREATE EINVAL caveat, KubeFlannelCNIConfig strip. Prototype paths and VM IPs (192.168.100.207 CP).

Task 3.5: k3d-local-dev (local testing / redeployment / development)

  • Install k3d on host if missing (curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash; kubectl already present).
  • Encoded workflows:
    • Local testing: disposable clusters k3d cluster create dev -p "8081:80@loadbalancer" for testing manifests/helm charts before they hit the Talos Track C cluster.
    • Redeployment: fast iterate — delete/recreate cluster or kubectl apply -k; import local images via k3d image import <img> -c dev (no registry round-trip).
    • Development: k3d cluster create dev --registry-create registry.localhost:5000 for build→push→deploy loops.
  • Conventions: cluster name dev; ports offset from prod (8081/8444) to avoid collisions with the compose stack; tear down after use.
  • Parity note: k3d = k3s in Docker — good proxy for Track C for manifest-level work; document Talos differences (machine configs, CNI defaults).
  • Pitfalls: clusters don't survive docker daemon restarts cleanly — recreate rather than debug; loadbalancer port mappings only settable at create time.
  • Verify: k3d cluster create dev && kubectl get nodes → Ready; k3d cluster delete dev cleans up.

Task 3.6: quartz-docs-site

  • rebuild.sh workflow, Infisical install bits, Dockerfile; how to re-enable Quartz container in compose (user request pending).

Each: trigger conditions, exact commands, pitfalls section, verification steps. Patch/update as new incidents occur.

Phase 4 — Plugins

Task 4.1: Dashboard exposure on tailnet (already user-requested)

  • Already solved per memory: dashboard.basic_auth + --host 0.0.0.0, Caddy reverse proxy at hermes.mainframe.prodg.studio (Tailnet/Headscale DNS). Re-verify it's live; if not, re-apply.
  • Verify: curl -u user:pass https://hermes.mainframe.prodg.studio returns the dashboard.

Task 4.2: Camofox browser plugin (optional)

  • /opt/prodg/camofox already contains openclaw.plugin.json + mcp/ dir — evaluate wiring its MCP/browser-control into Hermes for web tasks. Load camofox-browser-server skill before touching it. Defer unless browser automation is needed.

Phase 5 — Scheduled jobs (cronjob tool)

Task 5.1: Mainframe health watchdog (no_agent)

  • Script /root/.hermes/scripts/mainframe_health.sh: docker compose -f /opt/prodg/compose/docker-compose.yml ps + docker ps -a --filter status=created; emit report ONLY on anomalies (Created-state containers, unhealthy, exited non-zero). Silent otherwise.
  • Schedule: every 15m, no_agent: true, deliver to this Telegram chat.

Task 5.2: Docker log-bloat watchdog

  • du -sh /var/lib/docker/containers/* | sort -h | tail -5; alert if any >5GB. Daily.

Task 5.3: Prometheus alert digest (agent-driven)

  • Every 6h: query Prometheus /api/v1/alerts + key metrics (disk, mem, container restarts), summarize, deliver only if actionable. continuity: true.

Phase 6 — Delegation & profiles

Task 6.1: mainframe workdir conventions

  • Cron jobs and delegated maintenance tasks use workdir: /opt/prodg so AGENTS.md rules auto-load.
  • Verify: run a hermes chat -q one-shot from /opt/prodg and confirm it cites the rules.

Ordering & effort

  1. Phase 1 (rules) — 30 min, highest value (encodes lore that's currently only in volatile memory)
  2. Phase 3 (skills) — 1-2 h, mostly transcription from memory + repo inspection
  3. Phase 5 (watchdogs) — 30 min, immediate operational value
  4. Phase 2.1 (docker MCP) — 20 min
  5. Phase 4.1 (dashboard verify) — 10 min
  6. Phase 4.2, 2.3, 6 — optional/deferred

Risks / open questions

  • Docker MCP socket exposure = root-equivalent; acceptable (Hermes already has host shell), but note in security review.
  • Grafana MCP needs a service token — user mentioned fixing a service token issue; may already exist.
  • Quartz re-enablement is a separate pending user request — not part of this plan's scope except the skill (3.5).
  • Everything in memory is currently at 97% capacity — Phase 1 offloads lore to disk, freeing memory budget. After transcription, trim memory entries to pointers.