Federation Health
Three domains unified: Federation Orchestrator + VPS Telemetry Auto-Healer + Docker Entropy.
Containers are thermodynamic systems: CPU is energy, memory is state, disk is storage, network is exchange.
DITEMPA BUKAN DIBERI
Overview
Unified federation health covering three domains:
- Federation Orchestrator — Monitor and manage the arifOS federation: docker compose ps, restart dead services, MCP health probes, container drift detection, restart count monitoring.
- VPS Telemetry Auto-Healer — Real-time Caddy HTTP error spike monitor, Docker container log stream analyzer, and automated container health recovery watchdog.
- Docker Entropy — Thermodynamic reasoning lens for container fleet health, resource pressure, and safe/dangerous intervention boundaries.
arifOS-ACT Embedding
Before using this skill on any mutating, irreversible, or high-blast-radius task:
- ART — Attune (what is the real task?), Recognize (what class of power?), Test (fit · authority · evidence · blast · reversible).
- Kernel — Route to arifOS for F1–F13 judgment if action class is Maker/Messenger/Mutator/Destroyer/Sovereign.
- ACT — Apply narrow, Constrain scope, Trace witness, STOP before corruption.
- Receipt — Leave evidence of what changed, why, and under whose authority.
When to Use
- A Docker container or compose stack appears unhealthy, restarting, or resource-starved.
- Disk pressure, memory pressure, or CPU saturation is suspected on the VPS.
- You need to decide whether to restart, prune, inspect logs, or escalate.
- An MCP server returns connection refused, timeout, or 5xx.
- Caddy HTTP 502/504 error spikes detected.
- Federation status report needed.
- Container restart count tracking (flag containers with >3 restarts).
- After cron changes to verify telemetry pipeline.
When NOT to Use
- Do not use for non-Docker services (systemd-native, bare-metal processes) — use systemd skills.
- Do not use for Kubernetes or Swarm orchestration (not deployed).
- Do not use for Docker image authoring, Dockerfile creation, or CI/CD pipeline configuration.
- Do not use as authority to run destructive commands without 888 HOLD.
Section 1: Federation Orchestrator
Commands
# Full federation status
docker compose ps
docker ps -a --filter "status=restarting"
# Check organ endpoints (verified 2026-08-14)
for url in 8088 7071 7072 7073 7074 8081 18082 18083; do
curl -s -o /dev/null -w "%{http_code} :$url\n" --max-time 5 http://localhost:$url/health
done
# Restart dead container
docker compose restart <service>
docker restart <container>
# Restart count audit
docker inspect --format='{{.Name}} {{.RestartCount}}' $(docker ps -aq)
# Federation stack locations
cd /root/arifOS && docker compose ps
cd /root/AAA && docker compose ps
Health Probe Script
#!/bin/bash
for port in 8088 7071 7072 7073 7074 8081 18082 18083; do
code=$(curl -s -o /dev/null -w "%{http_code}" --max-time 5 http://localhost:$port/health)
if [ "$code" = "200" ]; then
echo "✅ MCP:$port OK"
else
echo "❌ MCP:$port FAILED (HTTP $code)"
fi
done
Restart Count Thresholds
| Restarts |
Severity |
Action |
| 0 |
✅ Healthy |
No action |
| 1–3 |
⚠️ Watch |
Log + warn |
| 4–9 |
🔴 Degraded |
Alert + review |
| 10+ |
⛔ Critical |
Auto-restart cooldown + human alert |
Observed Port Map (verified 2026-08-14 via ss + systemctl + curl)
| Port |
Service |
Owner |
| 8088 |
arifOS kernel |
systemd arifos.service |
| 7071 |
A-FORGE executor |
systemd a-forge.service |
| 7072 |
A-FORGE MCP gateway |
systemd a-forge-mcp.service |
| 7073 |
arifFlow daemon |
systemd arifflow.service |
| 7074 |
FED router |
systemd fed-router.service |
| 8081 |
GEOX MCP |
systemd geox-mcp.service |
| 18082 |
WEALTH |
systemd wealth-organ.service |
| 18083 |
WELL |
systemd (python3) |
| 8080 |
searxng (Docker) |
NOT an organ — do not probe as arifOS |
| 8083 |
headscale |
NOT an organ |
Federation Nodes (LEGACY docker-compose era — verify at runtime before trusting)
| Container |
Port |
Stack |
Criticality |
| arifosmcp |
8080 |
arifOS |
CRITICAL |
| geox_eic |
8081 |
GEOX |
CRITICAL |
| wealth-organ |
8082 |
WEALTH |
HIGH |
| well |
8083 |
WELL |
HIGH |
| vault999 |
— |
Vault999 |
CRITICAL |
| postgres |
5432 |
arifOS |
CRITICAL |
| qdrant |
6333 |
arifOS |
HIGH |
| redis |
6379 |
arifOS |
HIGH |
| nats |
4222 |
arifOS |
MEDIUM |
| aaa-a2a |
3001 |
AAA |
HIGH |
| searxng |
8080 |
Search |
LOW |
| netdata |
19999 |
Monitoring |
LOW |
Section 2: VPS Telemetry Auto-Healer
Diagnostic & Triage Workflow
1. Check Container Health & Memory Throttling
docker stats --no-stream --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.PIDs}}"
2. Scan Caddy Log Stream for 502 / 504 Spikes
tail -n 200 /var/log/caddy/access.log | grep -E "status\":(502|504|500)"
3. Graceful Container Self-Healing Circuit
# Verify container failure state before restart
if ! docker inspect --format='{{.State.Health.Status}}' searxng | grep -q "healthy"; then
echo "[AUTO-HEALER] SearXNG unhealthy. Restarting..."
docker restart searxng
fi
Best Practices
- Governed Recovery: Always verify container failure traceback before executing restart operations.
- Telemetry Log Receipt: Record all auto-healing actions in
telemetry_audit.log.
Section 3: Docker Entropy — Thermodynamic Fleet Health
Step 1: Read Fleet Entropy
Run these in order before any intervention:
docker ps — what is running, dead, or restarting?
docker stats --no-stream — who is consuming CPU/memory?
docker system df — how much disk entropy (images, volumes, build cache) has accumulated?
docker compose ps and docker compose config if a compose stack is involved.
Step 2: Interpret Signal Priority
Rank findings in this order:
- Container health status (Up vs Restarting vs Exited)
- Memory pressure (approaching limit)
- Disk entropy (dangling images, volumes, build cache)
- CPU saturation (sustained >80%)
- Log anomalies (error rate spikes)
Step 3: Choose the Intervention Class
Safe / reversible — proceed with witness:
docker compose config (validate, no mutation)
docker compose ps (state inspection)
docker logs --tail=N <service> (observation)
docker compose restart <service> (reversible)
docker compose up -d <service> (restore known state)
Dangerous / irreversible — 888 HOLD required:
docker system prune -af --volumes (irreversible disk purge)
docker rm -f <container> (data loss risk)
docker volume rm <volume> (permanent data destruction)
docker rmi <image> when the image is actively used
Step 4: Apply Uncertainty Protocol
- Container is Restarting → read logs before restarting again.
- Disk usage >85% → diagnose before pruning.
- Unsure whether a volume is in use → inspect; do not delete.
- Service unhealthy but cause unclear → 888 HOLD.
- Never prune without first running
docker system df.
Alert Conditions
| Condition |
Action |
| MCP HTTP 000/502/503 |
Auto-restart container + log |
| MCP response > 3s |
WARN in heartbeat |
| Model provider 401/402 |
Disable from fallback chain + alert |
| Ollama cold-start > 15s |
Pre-warm model via /api/generate |
| Caddy 502/504 spike |
Scan logs, identify target container, verify + restart |
| Container restart count > 3 |
Flag degraded, review logs |
| Disk entropy > 85% |
Diagnose before pruning, 888 HOLD for prune |
Allowed Tools
| Tool / Command |
Purpose |
docker ps |
Fleet state snapshot |
docker stats --no-stream |
Resource consumption |
docker system df |
Disk entropy inventory |
docker logs --tail=N <service> |
Diagnostic observation |
docker compose ps |
Compose stack state |
docker compose config |
Validate compose configuration |
docker compose restart <service> |
Reversible service restart |
docker compose up -d <service> |
Restore known-good state |
docker inspect |
Container health status, restart count |
curl |
MCP endpoint health probes |
tail / grep |
Caddy log stream analysis |
Forbidden Actions
- NEVER run
docker system prune -af as a first response to any problem (panic pruning).
- NEVER restart a container without reading its logs first.
- NEVER assume "container is Up" means "container is healthy".
- NEVER ignore disk entropy until it causes system failure.
- NEVER delete volumes without verifying they contain no critical data.
- NEVER run prune without human confirmation (F1 violation).
- NEVER restart Vault999 — append-only ledger, human ack required.
- NEVER restart multiple containers simultaneously — avoid federation cascade.
- Escalate to arifOS 888_JUDGE before any destructive action.
Output Format
## Skill Result: federation-health
### Summary
One-paragraph summary of fleet thermodynamic state and chosen intervention.
### Evidence
- Container state: <running / restarting / exited>
- Resource pressure: <CPU / memory / disk findings>
- Disk entropy: <docker system df output>
- Log anomalies: <yes/no with snippet>
- Caddy errors: <502/504 count in last N requests>
### Recommendations
- Safe reversible action, OR
- 888 HOLD with reason and proposed next step
### Escalations
- None / <list>
Escalation Path
| Condition |
Escalate To |
Method |
| Destructive or irreversible Docker action |
arifOS 888_JUDGE + Arif |
888 HOLD |
| Data-loss risk (volume/container removal) |
arifOS 888_JUDGE |
verdict_request |
| Scope creep into systemd/K8s/Dockerfile work |
STOP; route to correct skill |
A2A message |
| Root cause unclear after diagnosis |
arifOS 888_JUDGE |
hold with reason |
| All containers healthy but Caddy still 502 |
Caddy config review + arifOS |
health triage |
Consolidated 2026-08-26 from: FORGE-federation-orchestrator, vps-telemetry-auto-healer, FORGE-docker-entropy.
AAA Skill Library — version 2.0.0
1---2name: federation-health3description: Unified federation monitoring, container health, auto-recovery, and entropy reasoning. Covers federation orchestration (docker compose, restart, MCP health probes, container drift detection), VPS telemetry auto-healing (Caddy error spikes, container log analysis, automated recovery), and Docker entropy reasoning (thermodynamic fleet health, resource pressure, safe/dangerous intervention boundaries). Merges: FORGE-federation-orchestrator, vps-telemetry-auto-healer, FORGE-docker-entropy.4---56# Federation Health78> **Three domains unified:** Federation Orchestrator + VPS Telemetry Auto-Healer + Docker Entropy.9> Containers are thermodynamic systems: CPU is energy, memory is state, disk is storage, network is exchange.10> *DITEMPA BUKAN DIBERI*1112## Overview1314Unified federation health covering three domains:151. **Federation Orchestrator** — Monitor and manage the arifOS federation: docker compose ps, restart dead services, MCP health probes, container drift detection, restart count monitoring.162. **VPS Telemetry Auto-Healer** — Real-time Caddy HTTP error spike monitor, Docker container log stream analyzer, and automated container health recovery watchdog.173. **Docker Entropy** — Thermodynamic reasoning lens for container fleet health, resource pressure, and safe/dangerous intervention boundaries.1819## arifOS-ACT Embedding2021Before using this skill on any mutating, irreversible, or high-blast-radius task:221. **ART** — Attune (what is the real task?), Recognize (what class of power?), Test (fit · authority · evidence · blast · reversible).232. **Kernel** — Route to arifOS for F1–F13 judgment if action class is Maker/Messenger/Mutator/Destroyer/Sovereign.243. **ACT** — Apply narrow, Constrain scope, Trace witness, STOP before corruption.254. **Receipt** — Leave evidence of what changed, why, and under whose authority.2627## When to Use2829- A Docker container or compose stack appears unhealthy, restarting, or resource-starved.30- Disk pressure, memory pressure, or CPU saturation is suspected on the VPS.31- You need to decide whether to restart, prune, inspect logs, or escalate.32- An MCP server returns connection refused, timeout, or 5xx.33- Caddy HTTP 502/504 error spikes detected.34- Federation status report needed.35- Container restart count tracking (flag containers with >3 restarts).36- After cron changes to verify telemetry pipeline.3738## When NOT to Use3940- **Do not use** for non-Docker services (systemd-native, bare-metal processes) — use systemd skills.41- **Do not use** for Kubernetes or Swarm orchestration (not deployed).42- **Do not use** for Docker image authoring, Dockerfile creation, or CI/CD pipeline configuration.43- **Do not use** as authority to run destructive commands without 888 HOLD.4445---4647## Section 1: Federation Orchestrator4849### Commands5051```bash52# Full federation status53docker compose ps54docker ps -a --filter "status=restarting"5556# Check organ endpoints (verified 2026-08-14)57for url in 8088 7071 7072 7073 7074 8081 18082 18083; do58 curl -s -o /dev/null -w "%{http_code} :$url\n" --max-time 5 http://localhost:$url/health59done6061# Restart dead container62docker compose restart <service>63docker restart <container>6465# Restart count audit66docker inspect --format='{{.Name}} {{.RestartCount}}' $(docker ps -aq)6768# Federation stack locations69cd /root/arifOS && docker compose ps70cd /root/AAA && docker compose ps71```7273### Health Probe Script7475```bash76#!/bin/bash77for port in 8088 7071 7072 7073 7074 8081 18082 18083; do78 code=$(curl -s -o /dev/null -w "%{http_code}" --max-time 5 http://localhost:$port/health)79 if [ "$code" = "200" ]; then80 echo "✅ MCP:$port OK"81 else82 echo "❌ MCP:$port FAILED (HTTP $code)"83 fi84done85```8687### Restart Count Thresholds8889| Restarts | Severity | Action |90|---|---|---|91| 0 | ✅ Healthy | No action |92| 1–3 | ⚠️ Watch | Log + warn |93| 4–9 | 🔴 Degraded | Alert + review |94| 10+ | ⛔ Critical | Auto-restart cooldown + human alert |9596### Observed Port Map (verified 2026-08-14 via ss + systemctl + curl)9798| Port | Service | Owner |99|---|---|---|100| 8088 | arifOS kernel | systemd arifos.service |101| 7071 | A-FORGE executor | systemd a-forge.service |102| 7072 | A-FORGE MCP gateway | systemd a-forge-mcp.service |103| 7073 | arifFlow daemon | systemd arifflow.service |104| 7074 | FED router | systemd fed-router.service |105| 8081 | GEOX MCP | systemd geox-mcp.service |106| 18082 | WEALTH | systemd wealth-organ.service |107| 18083 | WELL | systemd (python3) |108| 8080 | searxng (Docker) | NOT an organ — do not probe as arifOS |109| 8083 | headscale | NOT an organ |110111### Federation Nodes (LEGACY docker-compose era — verify at runtime before trusting)112113| Container | Port | Stack | Criticality |114|---|---|---|---|115| arifosmcp | 8080 | arifOS | CRITICAL |116| geox_eic | 8081 | GEOX | CRITICAL |117| wealth-organ | 8082 | WEALTH | HIGH |118| well | 8083 | WELL | HIGH |119| vault999 | — | Vault999 | CRITICAL |120| postgres | 5432 | arifOS | CRITICAL |121| qdrant | 6333 | arifOS | HIGH |122| redis | 6379 | arifOS | HIGH |123| nats | 4222 | arifOS | MEDIUM |124| aaa-a2a | 3001 | AAA | HIGH |125| searxng | 8080 | Search | LOW |126| netdata | 19999 | Monitoring | LOW |127128---129130## Section 2: VPS Telemetry Auto-Healer131132### Diagnostic & Triage Workflow133134#### 1. Check Container Health & Memory Throttling135```bash136docker stats --no-stream --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.PIDs}}"137```138139#### 2. Scan Caddy Log Stream for 502 / 504 Spikes140```bash141tail -n 200 /var/log/caddy/access.log | grep -E "status\":(502|504|500)"142```143144#### 3. Graceful Container Self-Healing Circuit145```bash146# Verify container failure state before restart147if ! docker inspect --format='{{.State.Health.Status}}' searxng | grep -q "healthy"; then148 echo "[AUTO-HEALER] SearXNG unhealthy. Restarting..."149 docker restart searxng150fi151```152153### Best Practices1541. **Governed Recovery**: Always verify container failure traceback before executing restart operations.1552. **Telemetry Log Receipt**: Record all auto-healing actions in `telemetry_audit.log`.156157---158159## Section 3: Docker Entropy — Thermodynamic Fleet Health160161### Step 1: Read Fleet Entropy162163Run these in order before any intervention:1641651. `docker ps` — what is running, dead, or restarting?1662. `docker stats --no-stream` — who is consuming CPU/memory?1673. `docker system df` — how much disk entropy (images, volumes, build cache) has accumulated?1684. `docker compose ps` and `docker compose config` if a compose stack is involved.169170### Step 2: Interpret Signal Priority171172Rank findings in this order:1731. Container health status (Up vs Restarting vs Exited)1742. Memory pressure (approaching limit)1753. Disk entropy (dangling images, volumes, build cache)1764. CPU saturation (sustained >80%)1775. Log anomalies (error rate spikes)178179### Step 3: Choose the Intervention Class180181**Safe / reversible — proceed with witness:**182- `docker compose config` (validate, no mutation)183- `docker compose ps` (state inspection)184- `docker logs --tail=N <service>` (observation)185- `docker compose restart <service>` (reversible)186- `docker compose up -d <service>` (restore known state)187188**Dangerous / irreversible — 888 HOLD required:**189- `docker system prune -af --volumes` (irreversible disk purge)190- `docker rm -f <container>` (data loss risk)191- `docker volume rm <volume>` (permanent data destruction)192- `docker rmi <image>` when the image is actively used193194### Step 4: Apply Uncertainty Protocol195196- Container is Restarting → read logs before restarting again.197- Disk usage >85% → diagnose before pruning.198- Unsure whether a volume is in use → inspect; do not delete.199- Service unhealthy but cause unclear → 888 HOLD.200- Never prune without first running `docker system df`.201202---203204## Alert Conditions205206| Condition | Action |207|-----------|--------|208| MCP HTTP 000/502/503 | Auto-restart container + log |209| MCP response > 3s | WARN in heartbeat |210| Model provider 401/402 | Disable from fallback chain + alert |211| Ollama cold-start > 15s | Pre-warm model via `/api/generate` |212| Caddy 502/504 spike | Scan logs, identify target container, verify + restart |213| Container restart count > 3 | Flag degraded, review logs |214| Disk entropy > 85% | Diagnose before pruning, 888 HOLD for prune |215216## Allowed Tools217218| Tool / Command | Purpose |219|----------------|---------|220| `docker ps` | Fleet state snapshot |221| `docker stats --no-stream` | Resource consumption |222| `docker system df` | Disk entropy inventory |223| `docker logs --tail=N <service>` | Diagnostic observation |224| `docker compose ps` | Compose stack state |225| `docker compose config` | Validate compose configuration |226| `docker compose restart <service>` | Reversible service restart |227| `docker compose up -d <service>` | Restore known-good state |228| `docker inspect` | Container health status, restart count |229| `curl` | MCP endpoint health probes |230| `tail` / `grep` | Caddy log stream analysis |231232## Forbidden Actions233234- **NEVER** run `docker system prune -af` as a first response to any problem (panic pruning).235- **NEVER** restart a container without reading its logs first.236- **NEVER** assume "container is Up" means "container is healthy".237- **NEVER** ignore disk entropy until it causes system failure.238- **NEVER** delete volumes without verifying they contain no critical data.239- **NEVER** run prune without human confirmation (F1 violation).240- **NEVER** restart Vault999 — append-only ledger, human ack required.241- **NEVER** restart multiple containers simultaneously — avoid federation cascade.242- Escalate to **arifOS 888_JUDGE** before any destructive action.243244## Output Format245246```247## Skill Result: federation-health248249### Summary250One-paragraph summary of fleet thermodynamic state and chosen intervention.251252### Evidence253- Container state: <running / restarting / exited>254- Resource pressure: <CPU / memory / disk findings>255- Disk entropy: <docker system df output>256- Log anomalies: <yes/no with snippet>257- Caddy errors: <502/504 count in last N requests>258259### Recommendations260- Safe reversible action, OR261- 888 HOLD with reason and proposed next step262263### Escalations264- None / <list>265```266267## Escalation Path268269| Condition | Escalate To | Method |270|-----------|-------------|--------|271| Destructive or irreversible Docker action | arifOS 888_JUDGE + Arif | 888 HOLD |272| Data-loss risk (volume/container removal) | arifOS 888_JUDGE | verdict_request |273| Scope creep into systemd/K8s/Dockerfile work | STOP; route to correct skill | A2A message |274| Root cause unclear after diagnosis | arifOS 888_JUDGE | hold with reason |275| All containers healthy but Caddy still 502 | Caddy config review + arifOS | health triage |276277---278279*Consolidated 2026-08-26 from: FORGE-federation-orchestrator, vps-telemetry-auto-healer, FORGE-docker-entropy.*280*AAA Skill Library — version 2.0.0*