# Phase

Phases are versioned and layered images for micro-VMs.

A **phase** object is a layered and versioned image with instructions for building and updating it. Each **beam** micro-VM uses a specific phase image.

To create your first phase, use [Getting Started](/docs/phases/getting-started/). For troubleshooting, read [troubleshooting guide](/docs/guides/troubleshoot-phases/).



## The phase object

A phase object records its name, immutable parent, build configuration, and current build status.





The `status` field is read only. Check [build states](#build-states) before using a phase image.





## Create a phase

The CLI shortcut`tsh phase add [name]` starts an interactive **build beam** micro-vm with phase operations enabled.

Use `--from=parent` to create a child following that parent's successful images; without it, a new phase starts from `default:v1`.



```sh
# --no-console will return an ID of the build beam
tsh phase add sdk-work --from=app-config --no-console --format=json
tsh beams ssh [id-of the beam]
```





Creation returns the phase and its provisioned build beam.

**Response**

```json
{
  "name": "sdk-work",
  "owner": "alice",
  "strategy": "snapshot",
  "parent": "app-config",
  "state": "building",
  "build_beam": "example-build-beam",
  "region": "example-region"
}
```





### Creation parameters




**CLI parameters**

| Parameter | Meaning / default |
| --- | --- |
| `name` _(string; conditionally required)_ (positional) | Optional, omit to generate a name. It is required when `replace` is true. At most **54** lowercase letters, digits, or hyphens and begins and ends with a letter or digit. In CLI, omit to generate a name, required for `phase edit` |
| `--from=parent` _(string; optional)_ | New phase defaults to `default:v1`; use `phase edit` to replace an existing phase |
| `--fork-from=source, --commands-file=path, --copy=destination:source` _(string; optional)_ | Select the build input; see Build choices below |
| `--region=region` _(string; optional)_ | Select region for a beam. |
| `--roles=role-a,role-b` _(string list; optional)_ | Narrow the roles delegated to builds, cannot accompany replacement. |
| `--no-console` _(boolean; optional)_ | Does not connect to the build shell or logs. |
| `--format` _(string; optional)_ Possible values: `text` — Human-readable output. Required for an interactive shell connection.; `json` — Structured JSON output.; `yaml` — Structured YAML output.. | Format output. |


Build permissions inherit owner's standing roles that could be delegated. You can narrow permissions by explicitly selecting roles.

The first build pins the phase's region. Children, refreshes, and beams consuming its images stay in the region. Changing proxies does not move an image. Build beams count against beam quota and expire. See `tsh beams ls` for the deadlines. Expiry does not save unsaved files.

<span id="images-builds-and-strategies"></span>

### Build choices

**Build type** selects what one build does. It is separate from the phase's [refresh strategy](#refresh-a-phase).




**CLI build choices**

| Build input | Completion |
| --- | --- |
| `phase add`, `phase edit` | Interactive `SNAPSHOT` build; explicitly save a snapshot, optionally ending the build |
| `--fork-from=source`, edit `--from=source` | Start from a saved snapshot, then work interactively |
| `--commands-file=path`, command stages in `phase apply` | `REBUILD` successful command result is saved automatically. |
| `--copy=destination:source`, file stages in `phase apply` | `COPY`; CLI finishes the copy before returning |


`--no-console` suppresses shell/log connection. Interactive and raw command builds then return after provisioning, with a `build_beam` identifier: success means **started**, not saved or finished. Without it, command builds stream logs and wait. Copy builds still finish before returning. `--format=json` or `--format=yaml` provides structured results for add, edit, apply, snapshot, and listings; an interactive shell connection requires text output.

## Edit or replace a phase

In CLI, `tsh phase edit name` opens an interactive build from that phase's saved snapshot. `tsh phase edit name --from=source` starts from another eligible snapshot with the same parent. For commands or files, use `--commands-file` or `--copy`, those cannot also use `--from`.



- Interactive edits - use fork and supply source name. To supply a resolved snapshot directly, use phase build's "interactive from" parameters.
- For command replacement update commands.
- For copy replacement update copy and finish copy build.

Replacement requires an existing phase and keeps its parent and role selection. A copy phase accepts only copy snapshots and replacements. Command replacement keeps the existing parent; a copy replacement rebuilds the copy layer from the current parent.

```sh
tsh phase edit sdk-work --no-console --format=json
```





Replace operation returns the result as create: the current phase and a new build beam. Connect to that beam, edit, and save the changes you want to keep.

**Response**

```json
{
  "name": "sdk-work",
  "owner": "alice",
  "strategy": "snapshot",
  "parent": "app-config",
  "state": "building",
  "build_beam": "example-edit-beam",
  "image_digest": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "region": "example-region",
  "published_at": "2026-06-01T12:00:00Z"
}
```








**CLI parameters**

| Parameter | Meaning |
| --- | --- |
| `name` _(string; required)_ (positional) | Existing phase to edit |
| `--from=source` _(string; optional)_ | Eligible saved snapshot with the same parent; cannot accompany command or copy input |
| `--commands-file=path, --copy=destination:source` _(string; optional)_ | Replace using commands or files instead of an interactive snapshot |
| `--no-console` _(boolean; optional)_, `--format` _(string; optional)_ Possible values: `text` — Human-readable output. Required for an interactive shell connection.; `json` — Structured JSON output.; `yaml` — Structured YAML output.. | Return without connecting; use structured output |


### Snapshot and edit restrictions

A phase cannot have two active edits. A snapshot phase cannot be edited or saved while it has snapshot descendants, including indirect descendants or snapshot builds in progress. Rebuild and copy children alone do not prevent editing. Fork to a new phase when descendants prevent replacement. Recovery steps are in [Troubleshoot phases](/docs/guides/troubleshoot-phases/).

`exit` and Ctrl-D disconnect without saving or ending the build. To end without another save, use `tsh beams rm <build-beam>`. Ending or expiring the build discards unsaved changes, not previously saved checkpoints.

## Fork a phase

Use `tsh phase add experiment --fork-from=source` to create an independent phase from the source's saved snapshot. **Inside a build beam**, use `tsh phase add experiment --fork` to capture the current allowed files and create a fork. `--fork` takes no source argument.

A fork keeps the **source's parent**. Later edits to the source do not update the fork. A child created with `--from=source` has the **source itself as its parent**. Future source images affect the child.

`--fork-from` excludes unsaved edits in the source beam. You cannot fork rebuild or copy phases, even with an explicit digest. Use those phases as parents instead.







Outside a beam, you must supply the original region when using an explicit built-in-parent snapshot. For example, use `tsh phase add experiment --fork-from='default:v1@sha256:<digest>' --region=<original-region>`. An explicit reference does not move an image across regions.



```sh
tsh phase add experiment --fork-from=sdk-work --no-console --format=json
```








**CLI parameters**

| Parameter | Meaning |
| --- | --- |
| `name` _(string; optional)_ (positional) | New phase name. Omit it to generate a name. |
| `--fork-from=source` _(string; conditionally required)_ | Saved source phase or snapshot reference. Excludes unsaved edits. Choose this or `--fork` inside a build beam. |
| `--fork` _(boolean; conditionally required)_ | Capture current allowed files inside a build beam. Takes no source argument. Choose this or `--fork-from`. |
| `--region=region` _(string; conditionally required)_ | Supply the original region when using an explicit built-in-parent snapshot outside a beam. |


Forking returns the new phase and its build beam in a creation result. It does not return the source phase. Save the new build to publish its image.

**Response**

```json
{
  "name": "experiment",
  "owner": "alice",
  "strategy": "snapshot",
  "parent": "app-config",
  "state": "building",
  "build_beam": "example-fork-beam",
  "region": "example-region"
}
```





## Save and publish snapshots

**Inside the interactive build beam**, use `tsh phase snapshot` to save allowed changes and keep working. Add `--final` to end the build after a successful save.



The examples below save `sdk-work` after editing. Do the work you want to keep before running a save.

```sh
tsh phase snapshot --final --format=json
```








**CLI parameters**

| Parameter | Meaning / default |
| --- | --- |
| `name` _(string; conditionally required)_ (positional) | Target phase name. Inside a build beam, omit it to use the beam's phase. |
| `--final` _(boolean; optional)_ | End the interactive build after successful publication and verification. Without this flag, the build keeps running. |
| `--force` _(boolean; optional)_ | Omit disallowed changes from the image. The running filesystem stays unchanged. False by default. |
| `--from=reference` _(string; optional)_ | Publish a captured snapshot for the target. Cannot be combined with `--final`. |
| `--format` _(string; optional)_ Possible values: `text` — Human-readable output. Required for an interactive shell connection.; `json` — Structured JSON output.; `yaml` — Structured YAML output.. | Return a structured result. |


You cannot combine `--final` with `--from`. Publishing a snapshot alone does not end the build or change its command configuration. A supplied snapshot must belong to the target and match its parent and provenance.

If a final save fails or its outcome is uncertain, the build stays available for diagnosis. See [Verify an uncertain save](/docs/guides/troubleshoot-phases/#verify-an-uncertain-save).

Snapshot helpers return the saved phase directly, not wrapped in a `phase` field. The low-level methods `publish_phase` and `publishPhase` return `PublishPhaseResponse`. A final CLI save also writes `Quitting this build.` to stderr.

**Response**

```json
{
  "name": "sdk-work",
  "owner": "alice",
  "strategy": "snapshot",
  "parent": "app-config",
  "state": "ready",
  "image_digest": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "region": "example-region",
  "published_at": "2026-06-01T12:00:00Z"
}
```





Publishing a snapshot does not clean up the build. Use the final-save helper when you also need to end an interactive build.

### Filesystem capture rules

Interactive snapshots save allowed changes under `/home`. By default, capture rejects changed paths outside the allowed set. It also rejects paths reserved by ancestor rebuilds.

Use `--force` to omit those changes from the saved image. The files in the running beam stay unchanged. Omitted changes disappear when the beam is removed.

Some files are always excluded, regardless of strategy or `--force`:

- Temporary/runtime trees: `/run`, `/tmp`, `/var/tmp`, `/proc`, `/dev`, and `/sys`.
- Per-beam configuration: `/etc/environment`, `/etc/hosts`, `/etc/hostname`, `/etc/resolv.conf`, and `/etc/motd`.
- Under `/home/beams`: `.tsh`, `.cache`, and `.kube`.
- Platform Codex/Claude configuration under `/etc/codex` and `/etc/claude-code`, login accounting files, and protected platform launcher/helper binaries.

Snapshots save build output in `/var/log/beam/build.log`. You can also save personal settings, repositories, instructions, and allowed tool state under `/home`. **Credentials in saved paths can be included too**. The exclusions do not detect all secrets. A snapshot does not push Git commits or restore a running agent session.

Rebuild commands must leave `/home` unchanged except for paths declared in `metadata.rebuild_home_paths`. These must be clean absolute paths. Rebuild commands regenerate those paths. Descendant interactive snapshots cannot save them.

### Snapshot references and retention

| Context | Reference | Prefix identifies |
| --- | --- | --- |
| Build input, fork, or publication | `parent@sha256:<digest>` | Base parent of the captured snapshot |
| Runtime or failed-build inspection | `producing-phase@sha256:<digest>` | Phase that produced the image and controls access |

A canonical digest is `sha256:` plus **64 lowercase hexadecimal digits**. `<digest>` is a placeholder, not a usable digest. Prefer phase names for routine work.

To publish a captured snapshot for its existing target, use `--from`. This does not capture current files:

```sh
tsh phase snapshot sdk-work --from='app-config@sha256:<digest>'
```

Snapshot history is not guaranteed to be retained indefinitely. Successful snapshots have no guaranteed retention period.

You can inspect up to three recent failed rebuild snapshots, listed newest first. Their estimated expiry is normally 24 hours after failure. See [Inspect failed builds](/docs/guides/troubleshoot-phases/#inspect-failed-builds) before the images expire.

## Apply a configuration

Use `tsh phase apply -f phase.yaml` to create or replace command and copy stages. Stages run in document order. The command waits for each stage to finish.

`--region` selects the region for new phases. `--no-console` suppresses command logs but still waits for completion. Progress goes to stderr. Structured results for completed stages go to stdout.



Reapplying a configuration preserves existing parents and strategies. Each stage runs once during application. Children being explicitly replaced do not also refresh automatically during application. Dependents outside the file still follow updates.

If a stage fails, later stages do not run. Completed stages remain saved. Applying a configuration is **not an all-or-nothing transaction**.




**CLI parameters**

| Parameter | Meaning |
| --- | --- |
| `-f path` _(string; required)_ | Local YAML configuration file. Stages run in document order. |
| `--region=region` _(string; optional)_ | Region for new phases. Does not move existing images. |
| `--no-console` _(boolean; optional)_ | Suppress log connection. The command still waits for its stages. |
| `--format` _(string; optional)_ Possible values: `text` — Human-readable output. Required for an interactive shell connection.; `json` — Structured JSON output.; `yaml` — Structured YAML output.. | Return structured results for the applied phases. |


### YAML configuration reference

Each YAML document must contain either a nonempty `commands` list or `files`, not both. Use `files: []` for an empty copy stage.

Separate documents with `---`. Each stage must have a unique name. The first stage can omit `metadata.from` to use `default:v1`. Each later stage must name the immediately preceding stage as its parent.

| Field | Meaning / default |
| --- | --- |
| `version` _(string; required)_ Possible values: `v1` — Supported authoring format version. | Authoring format version. Must be `v1`. |
| `metadata.name` _(string; required)_ | Phase name. Up to 54 characters. |
| `metadata.from` _(string; conditionally required)_ | Immutable parent. The first stage defaults to `default:v1`. Later stages must name the preceding stage. |
| `metadata.rebuild_home_paths` _(string list; optional)_ | Home paths that command stages may change. Use clean absolute paths, not globs. Applies only to command stages. |
| `commands` _(command list; conditionally required)_ | Commands to run as root, in order. Command stages require a nonempty list. |
| `files` _(file mapping list; conditionally required)_ | Local file or directory mappings. Required for copy stages. |
| `files[].from` _(string; required)_ | Source for each mapping. Required. Relative paths resolve against the YAML directory. |
| `files[].to` _(string; required)_ | Destination for each mapping. Required. Use a clean absolute path outside `/home`. |
| `files[].comment` _(string; optional)_ | Description of the copy. |
| `services` _(service list; optional)_ | Named startup programs saved in the image. |

Commands and services share these fields:

| Field | Meaning |
| --- | --- |
| `shell` _(string; conditionally required)_ | Shell script run with `/bin/sh -ec`. Cannot be combined with `command` or `args`. |
| `command` _(string; conditionally required)_ | Executable to run. Use instead of `shell`. |
| `args` _(string list; optional)_ | Argument list. No implicit shell expansion. |
| `comment` _(string; optional)_ | Description displayed before a build command. Optional. |
| `env` _(environment override list; optional)_ | List of `{name, value}` environment overrides. |
| `workdir` _(string; optional)_ | Working directory. Use a clean absolute path. Defaults to `/` for commands and `/home/beams` for services. |

Validation rejects unknown fields, malformed paths, duplicate names, and incompatible stage kinds. Encoded command configuration cannot exceed **32 KiB**. Copied file bytes do not count toward that limit.







### Two-stage example

Save the configuration below as `phase.yaml`. Create `./config/app.json` relative to the YAML file's directory. Applying the configuration installs tools and copies local files. Reading this page does not run it.

```yaml
version: v1
metadata:
  name: app-tools
commands:
  - comment: Install development tools
    shell: apt-get update && apt-get install -y git curl python3
---
version: v1
metadata:
  name: app-config
  from: app-tools
files:
  - from: ./config
    to: /opt/app-config
services:
  - name: prepare-config
    type: pre-start
    context: user
    shell: cp /opt/app-config/app.json /home/beams/app.json
```

Apply the configuration. **Running the commands below creates or replaces real phases.**

```sh
tsh phase apply -f phase.yaml --no-console --format=json
```





Applying the configuration returns the completed stages in order. The CLI response below shows stdout only. Stage progress and command logs go to stderr.

**Response**

```json
[
  {
    "name": "app-tools",
    "owner": "alice",
    "strategy": "rebuild",
    "parent": "default:v1",
    "state": "ready",
    "image_digest": "sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
    "region": "example-region",
    "published_at": "2026-06-01T11:00:00Z"
  },
  {
    "name": "app-config",
    "owner": "alice",
    "strategy": "copy",
    "parent": "app-tools",
    "state": "ready",
    "image_digest": "sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
    "region": "example-region",
    "published_at": "2026-06-01T11:05:00Z"
  }
]
```





## Run command builds

Command builds run stored commands as root. They save successful output automatically. Use command stages in `phase apply` for a YAML configuration. To use a single raw configuration, supply `--commands-file`:

```sh
tsh phase add raw-tools --commands-file=raw-build.yaml
tsh phase edit raw-tools --commands-file=raw-build.yaml
```

The raw file must contain exactly one YAML document with a nonempty `commands` list. Each command requires `command`. You can also supply `args`, `comment`, `env`, and `workdir`. The raw format has no `shell` shortcut. Optional `services` must use the executable form.

`protected_paths` is the raw equivalent of `metadata.rebuild_home_paths`. Validation rejects unknown fields and multiple documents.



Creation starts the build. Use the [wait and log methods](#inspect-phases-and-builds) to observe completion. You do not need to take a snapshot after a successful command build.




**CLI parameters**

| Parameter | Meaning |
| --- | --- |
| `--commands-file=path` _(string; required)_ | Raw builder YAML. Must contain exactly one document with a nonempty list of executable `commands`. |
| `--no-console` _(boolean; optional)_ | Return after the build beam is provisioned. Do not follow logs or wait for the build to finish. |


## Copy files into a phase

Use file stages in `phase apply` for repeatable configuration. For a one-off copy, use `--copy=/absolute/destination:local-source`. Repeat `--copy` for each mapping:

```sh
tsh phase add app-files --copy=/opt/app/config:./config
tsh phase edit app-files --copy=/opt/app/config:./updated-config
```

Destinations must be outside `/home`. Directory copies merge without deleting unrelated parent files. A file destination ending in `/` keeps the local filename. Otherwise, the destination specifies the output filename.

A copy **replacement starts from the current parent**, not the previous copy layer. Include every file you want to retain. You cannot combine `--copy` with command input, forking, or `phase edit --from`.







The finish helper uploads files, captures a snapshot, publishes it, and ends the build. Creating a copy build alone does not upload or save files.




**CLI parameters**

| Parameter | Meaning |
| --- | --- |
| `--copy=destination:source` _(string list; required)_ | Repeat for each local mapping. Destinations must be outside `/home`. Relative sources resolve against the local working directory. |
| `name` _(string; conditionally required)_ (positional) | New or existing phase name. `phase edit` replaces the copy layer from its current parent. |


## Configure startup services

Save startup programs in the `services` list of a command or file stage. Apply the YAML with `phase apply`.





See the [configuration fields](#yaml-configuration-reference) and the parameters under [Apply a configuration](#apply-a-configuration) or [Copy files into a phase](#copy-files-into-a-phase).

### Service lifecycle

| Field | Meaning / default |
| --- | --- |
| `name` _(string; required)_ | Service name. Reusing an inherited name replaces that service. |
| `type` _(string; optional)_ Possible values: `background` — Long-running program. The default.; `pre-start` — Run in declaration order before background services.. | Defaults to `background`. |
| `context` _(string; optional)_ Possible values: `user` — Interactive snapshot build and runtime beam. The default.; `snapshot` — Interactive snapshot build only.; `rebuild` — Command build only.; `runtime` — Runtime beam only.; `build` — Interactive snapshot build and command build.; `all` — Interactive snapshot build, command build, and runtime beam.. | Selects the beam contexts that run the service. Defaults to `user`. |

Each service requires `name` and a shell script or executable. Use the [shared command fields](#yaml-configuration-reference). Reusing an inherited name replaces the whole definition, including type and context.

Services run as `beams`. Command builds run their commands as root. Use explicit `sudo` only when a service needs elevated privileges.

Services with `type: pre-start` run in declaration order before background services. Use `type: background` for long-running programs. It is the default.

A pre-start failure is logged. The remaining services still run. In a command build, a pre-start failure fails the build before commands run. SSH remains available for diagnosis. To read service logs, use `beamctl logs <service-name>` inside the beam.

| `context` | Interactive snapshot build | Command build | Runtime beam |
| --- | --- | --- | --- |
| `user` (default) | Yes | No | Yes |
| `snapshot` | Yes | No | No |
| `rebuild` | No | Yes | No |
| `runtime` | No | No | Yes |
| `build` | Yes | Yes | No |
| `all` | Yes | Yes | Yes |

**Copy builds never run services**, including inherited services. They save the definitions for later beams.

## Refresh a phase

Non-static phases refresh every **24 hours**. They also refresh after a successful refresh of a non-static parent. The strategy determines what repeats:

| Strategy | Saved content | Refresh behavior |
| --- | --- | --- |
| `STATIC` | Initial interactive or non-rebase-safe image | Does not refresh automatically. Cannot be the parent of a new phase. |
| `REBUILD` | Commands and their output | Reruns commands on the parent. |
| `SNAPSHOT` | Rebase-safe interactive filesystem layer | Applies saved changes to the parent. Does not replay interactive work. |
| `COPY` | Protected-path file layer | Applies saved changes to the parent. Does not run services during copying. |

An interactive phase starts with the static strategy. Publishing an eligible snapshot can change the strategy to snapshot or copy. Once a phase uses the copy strategy, it accepts only copy snapshots and replacements.

Saved child files override the corresponding parent files. A parent update can change the child's digest even if you have not edited the child.

Automatic refresh needs no separate call and has no parameters. To rebuild command or copy configuration yourself, use `phase edit` or reapply the YAML. Use `tsh phase ls` to check the result.







See the [replacement parameters](#edit-or-replace-a-phase) or [configuration parameters](#apply-a-configuration) for your language.

If a build fails, the previous successful image stays usable when one exists. Dependents of a failed parent keep their images and wait. A phase with no successful image is not ready for runtime use.

## Inspect phases and builds

Use `tsh phase ls` to list your phases. Add `--all` to list all phases you are authorized to access. Use `tsh phase ls-failed [--all]` to list retained failed-build snapshots for inspection. Both commands support `--format=json` and `--format=yaml`.




**CLI parameters**

| Parameter | Meaning / default |
| --- | --- |
| `--all` _(boolean; optional)_ | List all phases you are authorized to access. Without this flag, list only your phases. This does not grant unrestricted access. |
| `--format` _(string; optional)_ Possible values: `text` — Human-readable output. Required for an interactive shell connection.; `json` — Structured JSON output.; `yaml` — Structured YAML output.. | Return structured results for `phase ls` and `phase ls-failed`. |
| `phase ls-failed` | List retained failed-build snapshots for inspection. |


Phase responses include build status and retained failed-build snapshots.







```sh
tsh phase ls --all --format=json
```





The listing helpers collect all pages and return a collection directly. They do not return `ListPhasesResponse` or a pagination token. Use `get_phase(name)` or `getPhase(name)` to get one phase directly, as in the saved-phase example.

CLI JSON uses a flattened, formatted resource.

**Response**

```json
[
  {
    "name": "sdk-work",
    "owner": "alice",
    "strategy": "snapshot",
    "parent": "app-config",
    "state": "ready",
    "image_digest": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    "region": "example-region",
    "published_at": "2026-06-01T12:00:00Z"
  }
]
```





### Build states

| State | Meaning |
| --- | --- |
| `UNSPECIFIED` | No build has started |
| `BUILDING` | Build or refresh is active |
| `READY` | Most recent build succeeded |
| `FAILED` | Most recent build failed. An older image may remain usable. |
| `BLOCKED` | A usable image exists. Refresh is waiting for the parent. |
| `DELETING` | Cleanup is in progress. New work is prevented. |

## Start a beam from a phase

Use `tsh beams add --phase=name` to start a runtime beam from the phase's latest successful image. Beams that are already running keep the image they started with.

If you start a runtime beam like that **cannot save or fork its filesystem back to a phase**. Use an interactive phase build using `tsh phases add` to get interactive snapshots and forks.

To inspect a saved or failed image, use `tsh beams add --phase='producing-phase@sha256:<digest>'`. An inspection beam cannot save its filesystem back to a phase.



You must be authorized to use the phase that produced the image. The image must have a valid recorded phase identity. The image must not have expired. Creating a new phase with a deleted phase's name does not grant access to the deleted phase's snapshots.

```sh
tsh beams add --phase=sdk-work --no-console --format=json
```








**CLI parameters**

| Parameter | Meaning |
| --- | --- |
| `--phase=name` _(string; optional)_ | Phase name. The beam uses the phase's latest successful image. You can also supply a saved-image reference. |
| `--no-console` _(boolean; optional)_ | Create the beam without opening a shell. |
| `--format` _(string; optional)_ Possible values: `text` — Human-readable output. Required for an interactive shell connection.; `json` — Structured JSON output.; `yaml` — Structured YAML output.. | Return the beam's identifiers as structured output. |


Creation returns a beam name. You'd need the name to connect to or delete the beam.

The CLI example creates the beam without opening a shell. To connect, use `tsh beams ssh` with the returned `id` (alias) or `uuid`.

**Response**

```json
{
  "id": "example-runtime",
  "uuid": "example-runtime-beam",
  "owner": "alice",
  "expires": "2026-06-01T14:00:00Z",
  "region": "example-region",
  "phase": "sdk-work"
}
```





## Delete a phase

Deleging phase also deletes any active build beam.

You have to delete dependent phases first. You cannot delete a parent while dependent phases still use it. Deleting the build beam loses any unsaved work in the beam.

If you get a concurrent-change error, [check whether deletion took effect before retrying](/docs/guides/troubleshoot-phases/#retry-without-starting-duplicate-work).

```sh
tsh phase rm sdk-work
```








**CLI parameters**

| Parameter | Meaning |
| --- | --- |
| `name` _(string; required)_ | Phase name to delete. Required. Delete dependent phases first. |


**Response**

```text
Phase "sdk-work" successfully deleted.
```





















