Loading...
Loading...
Self-diagnosis skill for 5dive agents. Trigger this skill whenever the user says something is broken, not working, or behaving unexpectedly — or when any tool or command exits with an error. Runs a structured health check covering auth state, service health, disk, memory, recent CLI errors, and skill integrity. Surfaces a root-cause summary so the agent can fix the problem itself instead of asking the user. Also exposes a security audit sub-command for SSH keys, open ports, auth failures, and risky file permissions.
npx skill4agent add 5dive-ai/skills diagnoseStopFailuregenerictimeout# Check which agent types are authenticated on this host.
sudo 5dive doctor --json | jq '.data.checks | map(select(.name | startswith("auth")))'status: "fail"auth setauth start# API key path — pipe the key, never leave it in the shell history.
echo "$KEY" | sudo 5dive agent auth set claude --api-key=- --json# Last 50 error/warning lines from the CLI audit log.
sudo journalctl -u '5dive-agent@*' -p warning -n 50 --no-pagerauth_requirednot_runningtimeout# Overall host check — exits 0 even with failures, read data.summary.errors.
sudo 5dive doctor --json
# Per-agent status (running / stopped / failed).
sudo 5dive agent list --json | jq '.data.agents | to_entries[] | {name:.key, status:.value.status}'
# Full systemd state for a specific agent:
sudo systemctl status '5dive-agent@<name>'failedjournalctl -u 5dive-agent@<name> -n 30 --no-pager# Filesystem usage — warn if any mount is over 80 %.
df -h | awk 'NR==1 || $5+0 > 80'
# Top 10 disk consumers under /home and /var/lib/5dive:
du -sh /home/*/ /var/lib/5dive/ 2>/dev/null | sort -rh | head -10sudo journalctl --vacuum-size=200Mfree -h
# Swap usage over 50 % with low free RAM = OOM risk.status=1/KILLEDKilled processsudo 5dive agent rm <heavy-agent># List installed skills for each running agent.
for agent in $(sudo 5dive agent list --json | jq -r '.data.agents | keys[]'); do
echo "=== $agent ===";
sudo 5dive agent skill "$agent" list --json | jq -r '.data.skills[].name';
donesudo 5dive agent skill <name> add --source=<source> --skill=<skillId> --json## Diagnosis
**Status:** [Healthy / Degraded / Critical]
### Findings
- [auth] claude: authenticated ✓
- [service] agent-worker: failed — exit code 1, OOM at 03:12 UTC
- [disk] /var/lib: 87 % full — journals consuming 4.2 GB
- [skill] worker: brainstorming missing
### Root cause
<one sentence>
### Actions taken
- Vacuumed journals (freed 3.8 GB)
- Re-installed brainstorming skill on worker
### Remaining issues
- worker OOM: recommend reducing concurrent agents or adding 2 GB swapagent asksudo systemctl restart 5dive-agent@<name>
sudo 5dive agent list --json | jq '.data.agents["<name>"].status'sudo journalctl --vacuum-size=200M
docker system prune -f 2>/dev/null || true# API key (non-interactive, safe from an agent):
echo "$KEY" | sudo 5dive agent auth set <type> --api-key=- --json
# OAuth (needs a human — give them the URL):
sudo 5dive agent auth start <type> --json
# Relay the URL to the user; they paste back the callback code:
sudo 5dive agent auth submit <type> --code=<callback-code> --jsonsudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab# 1. SSH authorized keys — list all keys across all users.
for f in /root/.ssh/authorized_keys /home/*/.ssh/authorized_keys; do
[ -f "$f" ] && echo "=== $f ===" && cat "$f";
done
# 2. Open listening ports.
ss -tlnp
# 3. Recent auth failures (last 50).
sudo journalctl -u ssh -n 50 --no-pager | grep -i 'fail\|invalid\|refused'
# 4. World-writable files under /etc and /var/lib/5dive (should be empty).
find /etc /var/lib/5dive -maxdepth 4 -perm -o+w -type f 2>/dev/null
# 5. Setuid/setgid binaries not in the baseline (spot new surprises).
find / -maxdepth 5 \( -perm -4000 -o -perm -2000 \) -type f 2>/dev/null \
| grep -v '^/usr/\|^/bin/\|^/sbin/'
# 6. Agent env files — confirm they are root-readable only.
ls -la /etc/5dive/connectors/LowMediumHigh