Treadmill : Exécution Récurrente de Commandes

VérifiéPrudence

Exécute une commande à intervalles réguliers avec une boucle en arrière-plan. Permet le polling, les tâches périodiques et la supervision.

Spar Skills Guide Bot
DeveloppementDébutant
1025/07/2026
Claude CodeCursorWindsurfCopilotCodex
#treadmill#recurring-tasks#background-processes#polling#automation

Recommandé pour

Notre avis

Exécute une commande ou une invite à intervalles réguliers à l'aide d'une boucle shell en arrière-plan.

Points forts

  • Portable sur tous les environnements d'agents
  • Permet des processus détachés qui survivent aux redémarrages de l'agent
  • Simple à utiliser avec des commandes start/stop/status
  • S'intègre avec labrat pour la recherche automatisée

Limites

  • Nécessite Bash comme outil sous-jacent
  • Pas aussi intégré que les boucles natives des agents
  • Ne gère pas la planification complexe (cron-like)
Quand l'utiliser

Quand vous avez besoin d'exécuter une commande de manière répétée en arrière-plan, indépendamment de l'agent.

Quand l'éviter

Quand l'agent dispose déjà d'une boucle intégrée (ex. /loop) ou que vous nécessitez une planification plus sophistiquée.

Analyse de sécurité

Prudence
Score qualité88/100

The skill provides a legitimate task-scheduling mechanism using Bash scripts. It does not itself contain destructive or exfiltrating instructions, but it enables the execution of arbitrary commands repeatedly in the background, which requires caution. The risk is acceptable for a development tool.

Points d'attention
  • Runs arbitrary user-supplied commands in a background loop
  • Stores command and state in .treadmill/ directory, which could be inspected by other processes
  • Could be used to execute persistent potentially harmful operations if misused

Exemples

Check research status every 5 minutes
Start a treadmill to run python .research/experiments/00-baseline/modal_app.py every 5 minutes.
Poll a deployment health endpoint
Start a treadmill to curl https://api.example.com/health every 2 minutes.
Run metrics script hourly
Start a treadmill to run python check_metrics.py every hour.

name: treadmill description: "Run a command or prompt on a recurring interval, like a lab rat on a wheel. Use when the user wants to poll, repeat a task periodically, set up a recurring check, or keep a long-running process supervised. Pairs with /labrat for overnight research sessions." license: Apache-2.0 compatibility: "Requires bash. Works on macOS and Linux." metadata: author: tau version: "1.0" allowed-tools: Bash

Treadmill

Run a command on a recurring interval using a background shell loop. Portable across all agent harnesses.

How to use

The bundled treadmill script handles start/stop/status. Set it up from the skill directory:

SKILL_DIR="$(cd "$(dirname "$0")" && pwd)"
export PATH="${SKILL_DIR}/scripts:$PATH"

Or reference it directly: bash ${CLAUDE_SKILL_DIR}/scripts/treadmill

Start a treadmill

treadmill start <interval> <command...>

Interval formats: 30s, 5m, 1h, or plain seconds (e.g. 300).

Examples:

# Check research status every 5 minutes
treadmill start 5m python .research/experiments/00-baseline/modal_app.py

# Poll a deployment
treadmill start 2m curl -s https://api.example.com/health

# Run a script every hour
treadmill start 1h python check_metrics.py

Stop

treadmill stop

Check status

treadmill status

View logs

treadmill log      # last 30 lines
treadmill log 100  # last 100 lines

State

Treadmill keeps its state in .treadmill/ in the current directory:

  • pid — PID of the background loop
  • config — interval, command, start time
  • log — stdout/stderr from each run

Pairing with labrat

For overnight ML research, start a treadmill that re-runs the labrat state-advance worker rather than a passive status printer:

# Reconcile state every 5 minutes
treadmill start 5m python /path/to/labrat/scripts/research-advance

Use research-status only for human-readable inspection. Use research-advance for automation, because it updates .research/state.json when artifacts appear.

If the harness is Codex, prefer the supervisor wrapper instead:

# Reconcile state, then wake Codex when the session is actionable
treadmill start 5m python /path/to/labrat/scripts/research-supervise

That wrapper gives you the missing /loop behavior: the background loop notices finished artifacts, updates .research/state.json, and only then starts a fresh non-interactive Codex run to do the next research step.

The agent can read treadmill logs to see what happened between invocations.

When to use this vs built-in loop

Some agent tools (like Claude Code) have a built-in /loop command. Use that when available. Use /treadmill when:

  • Your agent harness doesn't have a built-in loop
  • You want a detached background process that survives agent restarts
  • You need to run shell commands on a timer independent of the agent
Skills similaires