Fridays 17:00 Europe/Lisbon, pinned in the unit because the machine clock is UTC. Creates an Agent of Empires session in a fresh week-review/<ISO week> worktree, sends it /week-review, notifies ntfy. Interactive, not `claude -p`: the skill asks which carry-over issues to take and what to apply, so an unattended run would stall or decide on its own. link.sh links the units but does not enable them, since enabling on every machine spawns one session per box for the same week. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SC9zwjErud3jfeYVEkf2Zd
57 lines
2.0 KiB
Bash
Executable File
57 lines
2.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Create the weekly review as an Agent of Empires session, then ping the phone.
|
|
# See README "Weekly review timer" for why this is interactive and not `-p`.
|
|
set -euo pipefail
|
|
|
|
REPO="${WEEK_REVIEW_REPO:-$HOME/tea/yolo/agent-skills}"
|
|
PROMPT="${WEEK_REVIEW_PROMPT:-/week-review}"
|
|
TOPIC="${WEEK_REVIEW_NTFY_TOPIC:-homelab}"
|
|
AOE="${WEEK_REVIEW_AOE:-$HOME/.local/bin/aoe}"
|
|
LOG="$HOME/.local/state/week-review/run.log"
|
|
|
|
WEEK="$(date +%G-W%V)"
|
|
TITLE="week-review-$WEEK"
|
|
BRANCH="week-review/$WEEK"
|
|
|
|
mkdir -p "$(dirname "$LOG")"
|
|
exec >>"$LOG" 2>&1
|
|
echo "=== $(date -Is) starting $TITLE ==="
|
|
|
|
# NTFY_URL/NTFY_TOKEN live here; ~/.zshrc only sources it for interactive shells.
|
|
# shellcheck disable=SC1091
|
|
[ -f "$HOME/.env.claude" ] && . "$HOME/.env.claude"
|
|
|
|
notify() { # notify <title> <priority> <message>
|
|
[ -n "${NTFY_URL:-}" ] || { echo "no NTFY_URL, skipping notify"; return 0; }
|
|
curl -sS -m 10 -o /dev/null \
|
|
-H "Authorization: Bearer ${NTFY_TOKEN:-}" \
|
|
-H "Title: $1" -H "Priority: $2" -H "Tags: calendar" \
|
|
-d "$3" "$NTFY_URL/$TOPIC" || echo "notify failed"
|
|
}
|
|
|
|
open="$("$AOE" list 2>/dev/null | awk '$1 ~ /^week-review-/ { print $1 }' || true)"
|
|
if [ -n "$open" ]; then
|
|
echo "already open: $open — not starting a second one"
|
|
notify "Week review skipped" default \
|
|
"An earlier review is still open ($open). Finish or remove it."
|
|
exit 0
|
|
fi
|
|
|
|
"$AOE" add "$REPO" --title "$TITLE" --cmd claude --worktree "$BRANCH" --new-branch \
|
|
--yolo --trust-hooks
|
|
# not `add --launch`: that attaches, and attaching without a TTY fails the run
|
|
# after the session is already up.
|
|
"$AOE" session start "$TITLE"
|
|
|
|
# The agent needs its TUI up before it can take a prompt; `send` into a
|
|
# still-booting pane is dropped silently.
|
|
sleep 25
|
|
if "$AOE" send "$TITLE" "$PROMPT"; then
|
|
echo "session $TITLE launched and prompted"
|
|
notify "Week review ready" default "aoe: $TITLE — waiting on your first answer"
|
|
else
|
|
echo "failed to send prompt to $TITLE"
|
|
notify "Week review failed to start" high "session $TITLE — see $LOG"
|
|
exit 1
|
|
fi
|