Repeat

From softspark/ai-toolkit · View interactive version

Repeat is an AI agent skill from the GitHub repository softspark/ai-toolkit. Runs prompt/slash command on recurring interval until done or limit. Triggers: repeat, recurring task, poll status, run every N minutes, interval.

How to use this skill

Skill file

/repeat - Autonomous Recurring Execution

$ARGUMENTS

Argument Parsing

Parse the user input into three components:

  1. Interval — duration between iterations (default: 10m)
  1. Command or prompt — the slash command or freeform prompt to execute each iteration
  2. Flags:

Examples of parsed input:

Safety Controls

These limits are constitutionally mandated (Article I, Section 4). Violating them is not permitted.

Max Iterations

Circuit Breaker

Minimum Interval

Exit Detection

After each iteration, inspect the output for completion signals:

Execution Protocol

For iteration = 1 to max_iterations:
    1. Log iteration start (timestamp, iteration number)
    2. Execute the command or prompt
    3. Capture output and exit status
    4. Check exit detection:
       - If completion marker found -> STOP, report success
    5. Check circuit breaker:
       - If failure: increment consecutive_failures
       - If success: reset consecutive_failures to 0
       - If consecutive_failures >= 3 -> HARD STOP, report failure
    6. Log iteration result to stats
    7. If not last iteration: wait for interval duration
    8. Repeat

After loop ends:
    - Print summary: total iterations, pass/fail counts, elapsed time
    - Final status: COMPLETED | EARLY_SUCCESS | CIRCUIT_BREAKER | MAX_ITERATIONS

Stats Logging

Each iteration MUST be logged to ~/.softspark/ai-toolkit/stats.json:

{
  "loop_runs": [
    {
      "id": "loop-<timestamp>",
      "command": "/test",
      "interval": "5m",
      "max_iterations": 5,
      "started_at": "2026-04-01T10:00:00Z",
      "iterations": [
        {
          "number": 1,
          "timestamp": "2026-04-01T10:00:00Z",
          "result": "pass",
          "exit_code": 0,
          "summary": "All 42 tests passed"
        },
        {
          "number": 2,
          "timestamp": "2026-04-01T10:05:00Z",
          "result": "fail",
          "exit_code": 1,
          "summary": "3 tests failed"
        }
      ],
      "final_status": "EARLY_SUCCESS",
      "ended_at": "2026-04-01T10:10:00Z"
    }
  ]
}

Ensure the stats directory and file exist before writing. Append to existing data, never overwrite.

Usage Examples

# Run tests every 5 minutes until all pass (max 5 iterations)
/repeat 5m /test

# Poll deployment status every 10 minutes
/repeat 10m "check deploy status"

# Run review max 3 times at default interval
/repeat --iterations 3 /review

# Lint every 2 minutes, up to 10 times
/repeat 2m --iterations 10 /lint

# Monitor CI pipeline every 5 minutes
/repeat 5m "check if CI pipeline passed for current branch"

When to Use

When NOT to Use

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.