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

# Run and archive scripts

> Configure reusable terminal commands and cleanup that runs before a worktree is archived.

Project settings support two reusable script types after a workspace has been
created:

| Script    | When it runs                                          | Where it runs            | Failure behavior                                       |
| --------- | ----------------------------------------------------- | ------------------------ | ------------------------------------------------------ |
| Named run | When you choose it from the terminal's **Run…** menu. | Active project terminal. | Reports the exit status without closing the workspace. |
| Archive   | Before Radius removes a worktree.                     | Worktree directory.      | Blocks removal when it fails.                          |

<Card title="Setup scripts" icon="code" href="/docs/project-settings/setup-scripts">
  Install dependencies and arrange the browser whenever Radius creates a worktree.
</Card>

## Named run commands

Named run commands appear in the terminal's **Run…** menu:

```toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
[scripts.run.dev]
name = "Development server"
command = "pnpm dev"

[scripts.run.test]
name = "Tests"
command = "pnpm test"
```

The table name after `scripts.run` is the stable script ID. `name` is the label
shown in Radius. If you omit the name, Radius derives one from the ID.

To hide a shared run command on one machine, add this to
`.radius/settings.local.toml`:

```toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
[scripts.run.dev]
hide = true
```

## Archive command

Use archive for cleanup or validation that must finish before a worktree is
removed:

```toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
[scripts]
archive = "pnpm run cleanup"
```

The command runs from the worktree directory with the effective project
environment. A non-zero exit status blocks deletion.

## Script environment

All project scripts receive variables from project settings plus:

* `RADIUS_PROJECT_ROOT`
* `RADIUS_WORKSPACE_PATH`
* `RADIUS_WORKSPACE_NAME`
* `RADIUS_DEFAULT_BRANCH`
