Nightly checks

Run housekeeping while you sleep: a cron job asks an agent to check dependencies, read the advisories and write a report you see first thing in the morning.

note

Cron jobs drive a running session, so leave the BeSwarm TUI open on that session, for example in a terminal window on an always-on machine. Without a TUI, agent start fails with "no beswarm is running" and the job exits.

The script

Save as ~/bin/nightly-deps.sh and make it executable:

#!/usr/bin/env bash
set -uo pipefail
export PATH="$HOME/.local/bin:$PATH"   # cron has a minimal PATH
repo="$HOME/code/api"
day=$(date +%F)
name="deps-$(date +%m%d)"
 
beswarm --session nightly agent start --name "$name" --agent claude --group nightly --no-focus \
  --prompt "In $repo: list outdated dependencies and any with known security advisories. For each give current version, latest version, severity and whether the upgrade is breaking. Don't change any files. Write to $repo/reports/deps/$day.md." \
  --wait --timeout 3600
 
beswarm --session nightly sound play --sound default
beswarm --session nightly agent close --group nightly

Schedule it

crontab -e
0 3 * * 1-5 $HOME/bin/nightly-deps.sh >> $HOME/nightly-deps.log 2>&1

Read it in the morning

The report lands in reports/deps/ and shows in the Artifacts tab. From a shell:

cd ~/code/api && beswarm artifact list

More nightly jobs

The same shape works for any read-only check that ends in a report:

  • dead code and unused exports,
  • TODOs and FIXMEs older than a month,
  • flaky tests from the last day's CI runs,
  • docs that mention removed flags.

Keep nightly agents read-only. Changes made while nobody watches are the hardest to review.