Agent skill

Recurring Prompt Loop

by QwenLM in QwenLM/qwen-code

Runs a prompt now and repeats it on a fixed interval or through self-paced wakeups, with subcommands to list or clear scheduled loop jobs.

Apache-2.0Auto-check passedAgent Workflows

Install Recurring Prompt Loop

skills CLI
$ npx skills add QwenLM/qwen-code --skill loop -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install QwenLM/qwen-code loop --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/QwenLM/qwen-code.git skills-src && mkdir -p .claude/skills && cp -r skills-src/packages/core/src/skills/bundled/loop .claude/skills/loop && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
loop
GitHub stars
28k
Token cost
~2.5k tokens
SKILL.md length
1,431 words
Files
8
Skills in repo
41
Repo updated
First seen
Licence
Apache-2.0

At a glance

Runs a prompt now and repeats it on a fixed interval or through self-paced wakeups, with subcommands to list or clear scheduled loop jobs.

  • Works in 4 steps: Empty input (no prompt, no interval):… → Leading interval token: if the first… → Trailing "every" clause: otherwise, if… → …
  • Polling a build or deploy at a fixed interval
  • SKILL.md covers Subcommands, Parsing, Prompt-only self-paced path and Fixed-interval recurring path, plus 3 more sections
  • Runs TypeScript scripts from its folder

What it does

The /loop command reads its input to decide the mode. A leading interval token such as 5m or 2h, or a trailing every clause like every 20m, makes a fixed-interval recurring job. A prompt with no interval runs a self-paced loop that creates no cron job, empty input starts an autonomous loop, and an interval with no prompt gives a fixed-interval autonomous loop.

The word every only counts when a time expression follows, so check every PR is treated as a plain prompt. /loop list shows existing jobs through CronList, and /loop clear deletes every job returned and reports how many were cancelled. If a background task notification starts a tick, that event is handled before the prompt runs again. The skill folder includes TypeScript helpers for the autonomous loop, task files and tick resolution, each with tests.

When your agent uses it

  • Polling a build or deploy at a fixed interval
  • Re-running a prompt until a condition is met without choosing an interval
  • Listing or cancelling all scheduled loop jobs

Example prompts

  • “/loop 5m check the build”
  • “/loop check the PR every 30m”
  • “/loop list to show which loop jobs are active”
  • “Keep checking whether the deploy has finished, and pace the checks yourself.”

Requirements

  • An agent with CronCreate, CronList and CronDelete tools

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Empty input (no prompt, no interval): the autonomous path — run a self-paced autonomous loop. See the Autonomous mode section.
  2. Leading interval token: if the first whitespace-delimited token matches ^\d+[smhd]$ (e.g. 5m, 2h), this is the fixed-interval recurring…
  3. Trailing "every" clause: otherwise, if the input ends with every or every (e.g. every 20m, every 5 minutes, every 2 hours), this is the…
  4. Prompt-only input: otherwise, the entire input is the prompt and this is the prompt-only self-paced path.

What it can do on your machine

Read from SKILL.md and the folder at commit fe4d4e3. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (TypeScript), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Recurring Prompt Loop loads about 2.5k tokens when it runs. Until then it costs about 63 tokens; SKILL.md has 1,431 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~63
When it runs · the whole SKILL.md, loaded when a task matches
~2.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from QwenLM/qwen-code at commit fe4d4e3, republished under its Apache-2.0 licence (© QwenLM). 1,431 words, ~2,531 tokens.

Download SKILL.mdSave it as .claude/skills/loop/SKILL.md (or your agent's skills folder). This skill also uses 7 other files; get the full folder from GitHub.
name
loop
description
Create a loop that runs a prompt now and follows up either on a fixed schedule or through self-paced wakeups. Usage - /loop check the build, /loop 5m check the build, /loop check the PR every 30m. /loop list to show jobs, /loop clear to cancel all.
argument-hint
[interval] [prompt] | list | clear

/loop — run a prompt repeatedly

Subcommands

If the input (after stripping the /loop prefix) is exactly one of these keywords, run the subcommand instead of scheduling:

  • list — call CronList and display the results. Done.
  • clear — call CronList, then call CronDelete for every job returned. Confirm how many were cancelled. Done.

Parsing

Parse the input after removing the /loop prefix:

  1. Empty input (no prompt, no interval): the autonomous path — run a self-paced autonomous loop. See the Autonomous mode section.
  2. Leading interval token: if the first whitespace-delimited token matches ^\d+[smhd]$ (e.g. 5m, 2h), this is the fixed-interval recurring path. The rest is the prompt.
  3. Trailing "every" clause: otherwise, if the input ends with every <N><unit> or every <N> <unit-word> (e.g. every 20m, every 5 minutes, every 2 hours), this is the fixed-interval recurring path. Extract that interval and strip it from the prompt. Only match when what follows "every" is a time expression — check every PR has no interval.
  4. Prompt-only input: otherwise, the entire input is the prompt and this is the prompt-only self-paced path.

If an interval was given but the prompt is empty (e.g. /loop 5m), this is a fixed-interval autonomous loop — see the Autonomous mode section.

Examples:

  • 5m /babysit-prs → fixed interval 5m, prompt /babysit-prs (leading interval token)
  • check the deploy every 20m → fixed interval 20m, prompt check the deploy (trailing "every" clause)
  • run tests every 5 minutes → fixed interval 5m, prompt run tests (trailing "every" clause)
  • check every PR → prompt-only self-paced path, prompt check every PR ("every" is not followed by a time expression)
  • check the deploy → prompt-only self-paced path, prompt check the deploy
  • (empty) → self-paced autonomous loop (sentinel <<autonomous-loop-dynamic>>)
  • 5m → fixed-interval autonomous loop (interval 5m, sentinel <<autonomous-loop>>)

Prompt-only self-paced path

Use this path only when the user supplied a prompt and no interval.

  1. Do not call CronCreate for this path.
  2. If this tick opens with a <task-notification> block (a monitor or background event re-invoked you, not a bare /loop wakeup prompt), handle that event before re-running the prompt.
    • If the notification says the watched condition was met, cancel any pending fallback LoopWakeup with CronDelete if you still have its ID, then finish the loop.
    • If a monitor auto-stopped on idle or max-events, restart it once if the watch is still useful, re-arm the fallback, report the restart count to the user, and include that count in the LoopWakeup prompt or reason (for example, monitor restarted 1/1 time) so it survives context compaction. If it auto-stops again on the next tick, end the loop and report the repeated auto-stop to the user.
    • If the signal is ambiguous, re-arm a shorter follow-up and investigate on the next tick. If the signal remains ambiguous for three consecutive ticks, end the loop and report that the watch could not reach a clear conclusion.
  3. Run the parsed prompt immediately now.
    • If it is a slash command, invoke it via the Skill tool.
    • Otherwise, act on it directly.
  4. Before ending the turn, decide whether another check is useful.
    • Call LoopWakeup only if continued follow-up is useful.
    • Do not call LoopWakeup if the task is complete.
    • Do not call LoopWakeup if the task is blocked on user input or external state that cannot be checked later.
    • Do not call LoopWakeup just to keep polling when no useful next check exists.
    • If you started a background agent or a Monitor, it wakes you via a terminal <task-notification> on exit, failure, cancellation, or monitor auto-stop — so set LoopWakeup as a long fallback rather than a short poll. Do not omit it just because something is watching: the work may hang, or a Monitor may auto-stop on idle or max-events (and one owned by another agent routes its notification only to that agent). Omit LoopWakeup only on the terminal conditions above (complete, blocked, or repeated monitor auto-stop).
  5. When scheduling a continuation, call LoopWakeup with:
    • delaySeconds: the next useful delay in seconds. The runtime clamps to 60–3600 (1–60 min); follow the tool's own guidance on picking a value — it accounts for the prompt-cache window and for the fallback-heartbeat case when a background task will wake you.
    • prompt: /loop ${original prompt} plus any state the next tick must preserve, such as monitor restarted 1/1 time.
    • reason: a short reason for the chosen delay. Include the monitor restart count here when re-arming after an auto-stop.
  6. Briefly tell the user what was done now. If a wakeup was scheduled, include when the next check is expected. If no wakeup was scheduled because a notification ended the loop, mention whether the stale fallback was cancelled; if the wakeup ID was lost, ignore or answer the stale wakeup briefly when it fires.

Fixed-interval recurring path

Use this path only for inputs with a leading interval token or a trailing "every" clause.

Interval to cron

Supported suffixes: s (seconds, rounded up to nearest minute, min 1), m (minutes), h (hours), d (days). Convert:

Interval patternCron expressionNotes
Nm where N <= 59*/N * * * *every N minutes
Nm where N >= 600 */H * * *round to hours (H = N/60, must divide 24)
Nh where N <= 230 */N * * *every N hours
Nd0 0 */N * *every N days at midnight local
Nstreat as ceil(N/60)mcron minimum granularity is 1 minute

If the interval does not cleanly divide its unit (for example 7m gives uneven gaps at :56 to :00, or 90m is 1.5 hours which cron cannot express), pick the nearest clean interval and tell the user what you rounded to before scheduling.

Show full SKILL.md (514 more words)Show less
Action
  1. Call CronCreate with:
    • cron: the expression from the table above
    • prompt: the parsed prompt from above, verbatim (slash commands are passed through unchanged)
    • recurring: true
    • durable: true if the user's language implies persistence ("keep doing this", "set this up permanently", "every day even after restart"). Otherwise omit (defaults to session-only).
  2. Briefly confirm: what is scheduled, the cron expression, the human-readable cadence, the auto-expiry (7 days after creation by default — the CronCreate tool description states the configured limit, which may differ or be disabled), and that they can cancel sooner with CronDelete (include the job ID).
  3. Then immediately execute the parsed prompt now. Do not wait for the first cron fire.
    • If it is a slash command, invoke it via the Skill tool.
    • Otherwise, act on it directly.

loop.md task-file mode

Use this when the user wants the loop to work a task list kept in a file (they say "work through my loop.md", "loop over the tasks in .qwen/loop.md", or point at such a file). Tasks live in .qwen/loop.md (project) or ~/.qwen/loop.md (home; project wins). Instead of a natural-language prompt, set the loop's prompt to a sentinel so each fire re-reads the file:

  • Self-paced (no interval) → LoopWakeup prompt: <<loop.md-dynamic>>
  • Fixed interval → CronCreate prompt: <<loop.md>> (with recurring: true, and durable: true if persistence is implied)

At each fire you receive either the full task list (first delivery, after the file changes, or after a compaction) or a short reminder to keep working the list established earlier. Work the tasks; in self-paced mode re-arm LoopWakeup with <<loop.md-dynamic>> only when continued follow-up is useful (same "don't re-arm if complete/blocked" rules as the prompt-only path). If .qwen/loop.md is absent at fire time, the loop falls back to autonomous mode (it keeps working autonomously instead of no-op'ing); a recreated file is picked up on the next fire. Confirm to the user in plain language ("looping over your .qwen/loop.md task list…"), not the raw sentinel.

Autonomous mode

Use this for a bare /loop (no prompt, no file) — the user wants you to keep their work moving while they're away. Arm the loop with an autonomous sentinel and run the first check now:

  • Self-paced (empty input) → LoopWakeup prompt: <<autonomous-loop-dynamic>>
  • Fixed interval (/loop <interval>, no prompt) → CronCreate prompt: <<autonomous-loop>> (with recurring: true, and durable: true if persistence is implied)

The first immediate check, and each scheduled fire, advance work the conversation already established — finish things the user started, maintain an in-progress PR (address review threads, fix failing CI, resolve conflicts), honor "I'll also…" commitments. You are a steward, not an initiator: act on what the transcript already established; never invent new work or make irreversible changes (push, delete, send) without clear authorization. If everything is genuinely quiet, say so in one sentence and stop. The first fire (and the first after a compaction) delivers fuller guidance; later fires send a short reminder pointing back to it. In self-paced mode re-arm LoopWakeup with <<autonomous-loop-dynamic>> (same "don't re-arm if complete/blocked" rules). Confirm to the user in plain language ("running an autonomous loop on your work…"), not the raw sentinel.

Input

© QwenLM, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 7 other files in packages/core/src/skills/bundled/loop of QwenLM/qwen-code.

  • SKILL.md
  • SKILL.test.ts
  • autonomous-loop.test.ts
  • autonomous-loop.ts
  • loop-task-file.test.ts
  • loop-task-file.ts
  • loop-tick-resolver.test.ts
  • loop-tick-resolver.ts

Open the folder on GitHubat commit fe4d4e3

Compare with similar skills

Recurring Prompt Loop next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Recurring Prompt Loop compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Recurring Prompt Loop this skillQwenLM/qwen-code28k—~2.5kAutomated safety check: PassApache-2.0
Harness 24hthu-nmrc/OpenHarness116—~3.6kAutomated safety check: PassApache-2.0
Autonomous Agent Harnessaffaan-m/ECC275k2 repos~2.9kAutomated safety check: PassMIT
Autonomous Agent Harnessaffaan-m/ECC275k—~859Automated safety check: PassMIT
Golem Custom Snapshot Moonbitgolemcloud/golem1.5k—~1.7kAutomated safety check: PassCustom licence
Golem Custom Snapshot Rustgolemcloud/golem1.5k—~2.2kAutomated safety check: PassCustom licence

Similar skills

  • Harness 24h

    thu-nmrc/OpenHarness

    A production-grade framework for long-running, autonomous agents based on Harness Engineering principles.

    116 GitHub stars~3.6k tokensUpdated 6 mo ago
    Agent WorkflowsAuto-check passed
  • Transform Claude Code into a fully autonomous agent system with persistent memory, scheduled operations, computer use, and task queuing.

    275k GitHub starsUsed in 2 repos~2.9k tokens
    Agent WorkflowsAuto-check passed
  • Claude Codeを永続的なメモリ、スケジュール済み操作、コンピュータ使用、タスクキューイングを備えた完全自動エージェントシステムに変換します。スタンドアロンエージェントフレームワーク(Hermes、AutoGPT)を、Claude Codeのネイティブcrons、dispatch、MCPツール、メモリを活用して置き換えます。ユーザーが継続的な自動操作、スケジュール済みタスク、または自己指令…

    275k GitHub stars~859 tokensUpdated 3 days ago
    Agent WorkflowsAuto-check passed
  • Enabling snapshot-based recovery and implementing custom snapshot save/load functions for MoonBit agents.

    1.5k GitHub stars~1.7k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Enabling snapshot-based recovery and implementing custom snapshot save/load functions for Rust agents.

    1.5k GitHub stars~2.2k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Enabling snapshot-based recovery and implementing custom snapshot save/load functions for Scala agents.

    1.5k GitHub stars~2k tokensUpdated today
    Agent WorkflowsAuto-check passed

More from QwenLM/qwen-code

All 41 skills in this repo
  • Reproduces a feature from Codex or Claude Code in Qwen Code by running the reference agent under capture, reading the traces, then implementing matching behavior.

    28k GitHub stars~1.5k tokensUpdated today
    Auto-check passed
  • Qwen Code E2E Testing

    QwenLM/qwen-code

    Guides end-to-end testing of the Qwen Code CLI in headless mode with real model calls, MCP test servers and inspection of raw API traffic.

    28k GitHub stars~2.1k tokensUpdated today
    Auto-check passed
  • Scheduled CI skill that scans a repository for small, certain docs, test and code hygiene issues and fixes them on one branch with a commit per finding.

    28k GitHub stars~1.7k tokensUpdated today
    Auto-check passed
  • Builds a rebranded Qwen Code desktop package from the Tauri shell using only a brand id and a logo, with sensible derived defaults.

    28k GitHub stars~2.1k tokensUpdated today
    Auto-check passed
  • Walks through capturing and comparing V8 heap snapshots to find memory leaks in the Qwen Code Node.js CLI, using tmux and the chrome-devtools CLI.

    28k GitHub stars~1.3k tokensUpdated today
    Auto-check passed
  • tmux Real User Testing

    QwenLM/qwen-code

    Drives Qwen Code in a real tmux session the way a user would and saves a readable step-by-step transcript of each screen for maintainers to review.

    28k GitHub stars~2.3k tokensUpdated today
    Auto-check passed

Questions about Recurring Prompt Loop

What does Recurring Prompt Loop do?

Runs a prompt now and repeats it on a fixed interval or through self-paced wakeups, with subcommands to list or clear scheduled loop jobs. The /loop command reads its input to decide the mode. A leading interval token such as 5m or 2h, or a trailing every clause like every 20m, makes a fixed-interval recurring job.

When should I use Recurring Prompt Loop?

Recurring Prompt Loop fits situations like: polling a build or deploy at a fixed interval; re-running a prompt until a condition is met without choosing an interval; listing or cancelling all scheduled loop jobs.

How do I install Recurring Prompt Loop in Claude Code?

Run `npx skills add QwenLM/qwen-code --skill loop -a claude-code`. Or copy the skill folder (packages/core/src/skills/bundled/loop in QwenLM/qwen-code) into .claude/skills/loop in your project. Claude Code loads it when a task matches its description.

How do I install Recurring Prompt Loop in Codex?

Run `npx skills add QwenLM/qwen-code --skill loop -a codex`. Or copy the skill folder (packages/core/src/skills/bundled/loop in QwenLM/qwen-code) into .agents/skills/loop in your project. Codex loads it when a task matches its description.

Can I use Recurring Prompt Loop in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add QwenLM/qwen-code --skill loop -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/loop, .gemini/skills/loop, .github/skills/loop and .opencode/skills/loop in your project.

What does Recurring Prompt Loop need to run?

Going by SKILL.md and its folder, Recurring Prompt Loop needs TypeScript for the scripts in its folder. Our summary lists: An agent with CronCreate, CronList and CronDelete tools.

Does Recurring Prompt Loop access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Recurring Prompt Loop safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Recurring Prompt Loop use?

Recurring Prompt Loop is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Recurring Prompt Loop use?

About 2.5k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Recurring Prompt Loop?

Skills that share tags, products or a category with Recurring Prompt Loop: Harness 24h (thu-nmrc/OpenHarness, 116 stars), Autonomous Agent Harness (affaan-m/ECC, 275k stars), Autonomous Agent Harness (affaan-m/ECC, 275k stars) and Golem Custom Snapshot Moonbit (golemcloud/golem, 1.5k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Recurring Prompt Loop?

QwenLM (a GitHub organization) maintains it in QwenLM/qwen-code, which has 28,349 GitHub stars. The repository holds 41 skills in this directory. The repository was last updated on October 8, 2026.

Source: QwenLM/qwen-code on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.