Back to library
AI
best practice

Use Durable /loop for Persistent Long-Running Background Tasks

Maintain long-running AI tasks even after terminal or system restarts.

Deploy the /loop command to ensure that long-running tasks continue executing in the background, even if you close your terminal or restart your computer.

Qwen

The Scenario

You are running a massive codebase scan or a long-running data migrations task that might take longer than your current session allows.

Before & after

The old way

Users had to keep a terminal window open and monitor long-running background tasks, which would often fail or stop if the session was closed, costing 20-30 minutes of re-setup time.

With AI

Run `/loop` to schedule the task; it will persist through terminal restarts or system reboots until finished. You can check progress for 30 seconds and walk away.

The Prompt

/loop [TASK_DESCRIPTION_E.G._SCAN_ENTIRE_REPO_FOR_SECURITY_VULNERABILITIES_AND_LOG_TO_CSV]

Durable scheduled tasks (/loop) in v0.18.3 allow long-running agentic operations to survive environment restarts.

Source

Qwen Code Blog: AI Coding Updates and Guides | Qwen Code Docs
"Durable /loop scheduled tasks surviving restart, /cd in-session directory switching."