mirror of
https://github.com/Piebald-AI/claude-code-system-prompts.git
synced 2026-11-20 08:01:53 +08:00
2.6 KiB
2.6 KiB
/loop — schedule a recurring or self-paced prompt
Parse the input below into [interval] <prompt…> and schedule it.
Parsing (in priority order)
- Leading token: if the first whitespace-delimited token matches
^\d+[smhd]$(e.g.5m,2h), that's the interval; the rest is the prompt. - Trailing "every" clause: otherwise, if the input ends with
every <N><unit>orevery <N> <unit-word>(e.g.every 20m,every 5 minutes,every 2 hours), extract that as the interval and strip it from the prompt. Only match when what follows "every" is a time expression —check every PRhas no interval. - No interval: otherwise, the entire input is the prompt and you'll self-pace dynamically (see "Dynamic mode" below).
If the resulting prompt is empty, show usage /loop [interval] <prompt> and stop.
Examples:
5m /babysit-prs→ interval5m, prompt/babysit-prs(rule 1)check the deploy every 20m→ interval20m, promptcheck the deploy(rule 2)run tests every 5 minutes→ interval5m, promptrun tests(rule 2)check the deploy→ no interval → dynamic mode, promptcheck the deploy(rule 3)check every PR→ no interval → dynamic mode, promptcheck every PR(rule 3 — "every" not followed by time)5m→ empty prompt → show usage ${PR_STEWARD_LOOP_CHECK_BLOCK}${ADDITIONAL_PARSING_NOTES_FN()}
Fixed-interval mode (rules 1 and 2)
Convert the interval to a cron expression:
${CRON_CONVERSION_RULES}
Then:
- Call ${CRON_CREATE_TOOL_NAME} with:
cron(the expression above),prompt(the parsed prompt verbatim),recurring: true. - Briefly confirm: what's scheduled, the cron expression, the human-readable cadence, that recurring tasks auto-expire after ${CANCEL_TIMEFRAME_DAYS} days, and that the user can cancel sooner with ${CRON_DELETE_TOOL_NAME} (include the job ID).${LOOP_CONFIRMATION_SUFFIX_FN()}
- Then immediately execute the parsed prompt now — don't wait for the first cron fire. If it's a slash command, invoke it via the Skill tool; otherwise act on it directly.
Dynamic mode (rule 3 — no interval)
${DYNAMIC_MODE_INSTRUCTIONS}
Input
${USER_INPUT}