#!/bin/bash set -euo pipefail XDG_RUNTIME_DIR="/run/user/$(id -u)" export PATH="$HOME/.local/bin:$PATH" XDG_RUNTIME_DIR sudo loginctl enable-linger "$(id -un)" for _ in $(seq 1 60); do systemctl --user show-environment >/dev/null 2>&1 && break sleep 1 done curl -fsSL https://herdr.dev/install.sh | sh for agent in claude codex pi; do herdr integration install "$agent" || echo "Skipped the herdr hooks for $agent." done mkdir -p "$HOME/.config/systemd/user" cat >"$HOME/.config/systemd/user/herdr.service" <<'UNIT' [Unit] Description=herdr server [Service] ExecStart=%h/.local/bin/herdr server Environment=PATH=%h/.local/bin:/usr/local/bin:/usr/bin:/bin Restart=always RestartSec=2 [Install] WantedBy=default.target UNIT systemctl --user daemon-reload systemctl --user enable --now herdr curl -fsSL https://pocketty.app/install.sh | sh