> ## Documentation Index
> Fetch the complete documentation index at: https://ai-development-environment.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Edit command

> Update a saved command's script, target, concurrency, restart policy, and quick action.

<Frame>
  <img className="block dark:hidden" src="https://mintcdn.com/ai-development-environment/aldo79nFpNgOg3HT/images/light/command-edit.png?fit=max&auto=format&n=aldo79nFpNgOg3HT&q=85&s=f18ff9b0179d47d64bb5006b47c58787" alt="Edit command editor in light theme" width="3840" height="2160" data-path="images/light/command-edit.png" />

  <img className="hidden dark:block" src="https://mintcdn.com/ai-development-environment/aldo79nFpNgOg3HT/images/dark/command-edit.png?fit=max&auto=format&n=aldo79nFpNgOg3HT&q=85&s=3b6e5f4b84626cdb41609d2e35539b49" alt="Edit command editor in dark theme" width="3840" height="2160" data-path="images/dark/command-edit.png" />
</Frame>

The edit command page at `/commands/{id}/edit` updates an existing definition. It is the same editor as [New command](/commands/command-new), pre-filled with the saved values.

## What you can change

<Columns cols={2}>
  <Card title="Command" icon="file-code">
    **Name**, **Description**, and the **Shell script**.
  </Card>

  <Card title="Target scope" icon="crosshairs">
    Any agent home, a specific agent home, any worktree, or a worktree in a repository.
  </Card>

  <Card title="Concurrency" icon="layer-group">
    Requires exclusive, non-exclusive, or excluded from command concurrency, plus whether a worktree command blocks Git operations while it runs.
  </Card>

  <Card title="Restart policy" icon="repeat">
    Never, on failure, or always, plus the failed restart limit.
  </Card>

  <Card title="Notifications and quick action" icon="bell">
    Completion notifications, and whether the command appears as a button with its icon and style.
  </Card>
</Columns>

## How edits interact with history

Each run stores an immutable **snapshot** of the name, description, script, target kind, concurrency mode, Git-blocking setting, restart policy, restart limit, and notification setting that were in force when it started. Editing the definition never rewrites those snapshots.

| Change                  | Effect                                                                             |
| ----------------------- | ---------------------------------------------------------------------------------- |
| Script or name          | Applies to the next run; existing runs keep their snapshot                         |
| Target scope            | Applies to the next launch; runs already placed on an agent stay there             |
| Concurrency             | Applies to the next run; a queued or active run keeps the mode it started with     |
| Block Git operations    | Applies to the next run; an active run keeps the setting it started with           |
| Restart policy or limit | Applies to the next run — a run already in flight keeps the policy it started with |
| Quick action settings   | Applies immediately to the button                                                  |

<Note>
  Because **Rerun** replays a run's snapshot rather than the current definition, rerunning an old run executes the old script. Launch from the **Definitions** tab when you want the latest version.
</Note>

<Warning>
  Narrowing the target scope does not stop runs that are already executing on a target the new scope excludes. Terminate those runs if the change was meant to be immediate.
</Warning>

## Archiving instead of editing

If a command is obsolete, archive it from the [Commands](/commands/commands) page rather than repurposing it. Archiving keeps its run history intact and readable, whereas rewriting the script leaves history pointing at a name that no longer describes what ran.

## Related pages

<Columns cols={2}>
  <Card title="New command" icon="plus" href="/commands/command-new">
    Field-by-field reference for every setting in this editor.
  </Card>

  <Card title="Command run" icon="terminal" href="/commands/command-run">
    Where the immutable snapshot for a given run is displayed.
  </Card>
</Columns>
