---
title: "overlane task loop"
description: "Keep this session taking the next task each time it finishes one, until the queue is empty"
---

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

# overlane task loop

{/* Generated by apps/docs/scripts/generate.mjs (CLI pages from the command registry in packages/cli). Do not edit; run `pnpm --filter @overlane/docs gen`. */}

With the loop on, the stop hook hands the session the next ready task (paused tasks are skipped, and `overlane task next` skips them too) whenever its task is submitted, verified or cancelled and the working copy is clean, up to --max tasks (default 20). A raised failure that no longer happens is cancelled with its evidence and the session moves straight on. It ends by itself when nothing is ready; `off` while tasks are still ready needs --even-if-ready. `status` shows how many tasks were handed. Local to this working copy.

## Usage

```sh
overlane task loop [mode] [--max N] [--even-if-ready] [--dry-run]
```

## Arguments

| Argument | Required | Description |
| --- | --- | --- |
| `mode` | no | on, off or status (default status) |

## Flags

| Flag | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `--max` | string | no |  | Most tasks to hand this session (default 20) |
| `--even-if-ready` | boolean | no |  | Turn the loop off even though tasks are still ready |
| `--dry-run` | boolean | no |  | Print the requests and file changes this command would make, then stop. Needs no credentials. |

## Examples

```sh
overlane task loop on
overlane task loop on --max 5
overlane task loop off
```

## Behavior

- Effect: `write` (changes local or hosted state).
- Needs credentials: no. Uses the network: no.
- Supports `--dry-run`: yes. Accepts `--force`: no.
- Machine-readable description: `overlane schema task loop`.

## Result

With `--json` (the default when stdout is not a terminal) the command prints this JSON Schema's shape on stdout.

```json
{
  "anyOf": [
    {
      "type": "object",
      "properties": {
        "on": {
          "type": "boolean"
        },
        "state": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "on": {
                  "type": "boolean",
                  "const": true
                },
                "max": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "handed": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "last": {
                  "type": "string"
                },
                "startedAt": {
                  "type": "string"
                }
              },
              "required": [
                "on",
                "max",
                "handed",
                "startedAt"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "localFile": {
          "type": "string"
        }
      },
      "required": [
        "on",
        "state",
        "localFile"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "dryRun": {
          "type": "boolean",
          "const": true
        },
        "service": {
          "type": "string"
        },
        "requests": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "method": {
                "type": "string"
              },
              "path": {
                "type": "string"
              },
              "body": {},
              "note": {
                "type": "string"
              }
            },
            "required": [
              "method",
              "path"
            ],
            "additionalProperties": false
          }
        },
        "commands": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "writes": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "path": {
                "type": "string"
              },
              "action": {
                "type": "string",
                "enum": [
                  "write",
                  "append",
                  "delete"
                ]
              },
              "description": {
                "type": "string"
              }
            },
            "required": [
              "path",
              "action",
              "description"
            ],
            "additionalProperties": false
          }
        },
        "notes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "dryRun",
        "requests",
        "commands",
        "writes",
        "notes"
      ],
      "additionalProperties": false
    }
  ]
}
```

See [exit codes](/cli/#exit-codes) for the status the process returns.

Source: https://docs.overlane.app/cli/task-loop/index.mdx
