> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qoder.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Continuously Achieve Goals

<div id="overview">
  # Overview
</div>

Goal is an autonomous execution mode in Qoder CLI. It is best suited for scenarios where you have a clear completion condition and want Qoder to work continuously until it is achieved. Once a goal is set, Qoder breaks it down into steps and executes them continuously, minimizing interruptions until the goal is completed or you manually stop it.

Goal is ideal for tasks with clear endpoints, such as "fixing all failing tests," "completing a refactoring until the build passes," or "implementing a feature according to requirements and passing self-tests."

<div id="set-goal">
  # Setting a Goal
</div>

In an interactive session, use `/goal set` to create a goal:

```shell theme={null}
/goal set <goal description>
```

For example:

```shell theme={null}
/goal set Fix all failing unit tests until all npm tests pass
```

After setting a goal:

* Qoder will start working continuously towards the goal, breaking it down into multiple steps if necessary.
* The permission mode will **automatically switch to `auto`** and lock the Shift+Tab toggle to minimize confirmation interruptions during execution. The previous permission mode is recorded and automatically restored when you clear or pause the goal.
* The interface will display a goal status indicator.

## Limiting Maximum Turns

Use the `--turns` parameter to limit the maximum number of conversation turns for goal execution. Once the limit is reached, Qoder will stop and wait for your instructions:

```shell theme={null}
/goal set Refactor the payment module and ensure tests pass --turns 30
```

The value of `--turns` must be a positive integer; otherwise, the parameter will be ignored.

<div id="check-status">
  # Checking Goal Status
</div>

Use `/goal status` to check the progress of the current goal:

```shell theme={null}
/goal status
```

It displays:

* **Goal**: The goal description.
* **Status**: Active, Paused, or TurnLimited.
* **Turns**: The number of turns used. If a limit is set, it is displayed as "used / limit".
* **Time**: The time consumed by the goal.

A goal is automatically cleared upon completion. Running `/goal status` afterward will prompt that there is no active goal.

If the goal is held by another session, the status will indicate this, and you can use `/goal take` to take over.

<div id="pause-resume">
  # Pausing and Resuming
</div>

When you need to temporarily interrupt the goal to handle something else, use `/goal pause` to pause:

```shell theme={null}
/goal pause
```

When paused, Qoder reverts to the permission mode used before the goal was set. Use `/goal resume` to continue later:

```shell theme={null}
/goal resume
```

Upon resuming, Qoder re-enters the autonomous execution state and continues working towards the goal. If the goal was in the Plan state before pausing, it will also be restored to that state.

<div id="take">
  # Taking Over a Goal
</div>

Goals can be persisted across sessions. If a goal was created and is held by another session, the current session cannot directly update it by default. Use `/goal take` to claim ownership of the goal for the current session:

```shell theme={null}
/goal take
```

After taking over, the current session becomes the holder of the goal and can continue to advance and update it.

<div id="clear">
  # Clearing a Goal
</div>

When a goal is completed or you no longer need it, use `/goal clear` to clear it:

```shell theme={null}
/goal clear
```

When clearing a goal, Qoder reverts to the permission mode used before the goal was set.

> When Qoder determines that the goal has been achieved, it will also automatically mark the goal as completed and clear it, without requiring manual intervention.

<div id="with-plan">
  # Working with Plan
</div>

Goal can be used in conjunction with Plan: use Plan first to analyze the problem and confirm the approach, then enter Goal to let Qoder execute autonomously until completion. If Plan is active before entering Goal, Qoder will re-enter the Plan state when resuming the goal, maintaining a consistent workflow.

For detailed information on Plan, see [Plan Before Execution (Plan)](/en/cli/03-using-qoder-cli/01-starting-a-task/plan).

<div id="command-summary">
  # Command Summary
</div>

| Command                        | Description                                                      |
| :----------------------------- | :--------------------------------------------------------------- |
| `/goal set <描述> [--turns <n>]` | Create or update a goal, with an optional limit on maximum turns |
| `/goal status`                 | View the current goal status                                     |
| `/goal pause`                  | Pause the current goal                                           |
| `/goal resume`                 | Resume a paused goal                                             |
| `/goal take`                   | Take over goal ownership for the current session                 |
| `/goal clear`                  | Clear the current goal                                           |

For complete command parameter descriptions, see Goal Command Reference.
