Back to library
AI
tutorial

Automate Multi-Step Coding Tasks with Autonomous /loop Mode

Run persistent, self-correcting coding tasks while you are away from your desk.

Use the /loop command in Qwen Code to initiate an autonomous mode where the agent follows a provided markdown checklist (.qwen/loop.md) to complete multi-step tasks without manual intervention.

Qwen

The Scenario

You have a long list of repetitive coding tasks, such as refactoring multiple files or updating documentation across a large repository, but you need to step away from your computer.

Before & after

The old way

Developers must manually monitor long-running tasks, providing constant feedback and approving every individual step, often taking 30-60 minutes of focus time.

With AI

Run /loop and let the agent work through the checklist; you can even exit the terminal or change the file mid-task. It takes about 2 minutes to set up the file.

The Prompt

/loop [TASK_FILE_PATH]

Qwen Code's /loop mode allows you to define a task list in a specific .qwen/loop.md file. The agent will continuously iterate through these tasks autonomously. If you modify the file during the loop, the agent detects the changes and updates its plan in real-time.

Source

Qwen Code Blog: AI Coding Updates and Guides | Qwen Code Docs
"/loop autonomous mode — the agent advances established work while you’re gone, without inventing new tasks or performing irreversible operations."