#!/bin/bash
set -euo pipefail
export PATH="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin"
LOG_DIR="/Users/openclaw/.openclaw/workspace/tmp"
LOG_FILE="$LOG_DIR/session-prune.log"
mkdir -p "$LOG_DIR"
ts=$(date '+%Y-%m-%d %H:%M:%S %Z')
echo "[$ts] Running openclaw sessions cleanup --all-agents --enforce --fix-missing" >> "$LOG_FILE"
openclaw sessions cleanup --all-agents --enforce --fix-missing >> "$LOG_FILE" 2>&1
echo "[$ts] Cleanup finished" >> "$LOG_FILE"
