--- name: sf-loop-pruner description: Recurring health watch for deployed bots. One invocation = one pass. Flags decaying / dead bots, can auto-pause them, persists a log so consecutive runs don't double-fire. Pair with the /loop skill for an always-on roster cleaner. Use when the user asks "watch my bots for edge decay automatically / auto-pause dying bots / kill dead edges on a loop / monitor roster health". --- # sf-loop-pruner The "always-on roster cleaner". Companion to [`sf-loop-hunter`](../sf-loop-hunter/SKILL.md) — where the hunter looks outward for fresh edges, the pruner looks inward at your deployed bots and pulls the dying ones. State lives at `~/.claude/skills/sf-skills/pruner-state.json` so a bot that's been auto-paused once doesn't keep getting flagged on every loop. Wrap with the `/loop` skill for continuous operation: ``` /loop 30m python SF-Skills/sf-loop-pruner/pruner.py --apply --include dead ``` ## What each run does 1. Pull all ACTIVE bots. 2. For each, fetch the underlying strategy and run the edge-decay heuristic from `sf-edge-watch` / `sf_client.edge_health`. 3. Drop any bot already auto-paused in a prior run (from state file). 4. Report decaying / dead bots. With `--apply`, PATCH them to PAUSED and record the action in state. ## When to use - "Auto-pause dying bots on a 30-minute loop" - "Run a roster health check in the background during the stream" - "Keep the bot list pruned without me babysitting" ## How to run ``` # Dry-run, default thresholds (decaying + dead) python sf-loop-pruner/pruner.py # Auto-pause anything DEAD only (most conservative) python sf-loop-pruner/pruner.py --include dead --apply # Auto-pause decaying + dead python sf-loop-pruner/pruner.py --include decaying,dead --apply ``` ## Safety - `--apply` respects the 10-second per-bot PATCH cooldown. - State file means a bot is only auto-paused once per loop history. To re-arm, delete the state file or remove that bot's entry. - Without `--apply`, the script is read-only and safe to schedule arbitrarily. - This loop never creates bots; pair with `sf-rebalance` or `sf-deploy` to actually replace what's been pruned.