> Documentation index: https://docs.kiste.run/llms.txt, a list of every page in this documentation.

# Lifecycle

> Stop, stop with session, resume, restart, automatic stops, idle behaviour, and what each one keeps.

## Overview

| Command | Disk | Memory and processes | Next start |
| --- | --- | --- | --- |
| `kiste stop` | kept | discarded (clean shutdown) | fresh boot from the disk |
| `kiste stop --snapshot` | kept | saved | resumes the session in about a second |
| `kiste restart` | kept | discarded | it boots right away |
| `kiste resume` | kept | restored when saved |  |
| `kiste delete` | deleted | discarded | there is none |

A stopped Kiste uses no compute. Its disk, its checkpoints and its published
ports stay; a published port answers again once the Kiste runs.

## Stop

```bash
kiste stop review-42
```

The Kiste flushes its disk and shuts down cleanly, like powering off a
computer. Before it stops, a [checkpoint](https://docs.kiste.run/kisten/snapshots.md) is taken when the
disk changed. The next start is a fresh boot from the same disk: your files and
installed packages are there, running programs are not.

## Stop and keep the session

```bash
kiste stop review-42 --snapshot
```

Before stopping, the Kiste writes its memory to its disk. The next start
resumes every process, terminal and desktop window exactly as it was, in about
a second. Stopping takes a little longer because the memory is written first.

`kiste list` and `kiste status` show whether a stopped Kiste has a saved
session. If a saved session can't be restored, the Kiste starts fresh from its
disk instead and raises a `session_not_restored` [alert](https://docs.kiste.run/account/webhooks-alerts.md):
it never fails silently.

## Resume or start

```bash
kiste resume review-42
kiste start review-42     # the same for a stopped Kiste; attaches SSH afterwards
```

A Kiste with a saved session continues it; one without boots from its disk.
Resuming makes the Kiste your current one.

## Restart

```bash
kiste restart review-42
kiste restart review-42 --no-ssh
```

Reboots the Kiste from its own disk: files stay, processes start fresh, and a
pending [image update](https://docs.kiste.run/kisten/manage.md#update) is applied. A checkpoint is taken
before. Restarting a *stopped* Kiste boots it fresh too and drops a saved
session; use `resume` to keep the session. Without `--no-ssh` the CLI reconnects
your shell afterwards.

## Automatic stop (lifetime)

A Kiste created with `--ttl` (or forked with `--ttl`) has a deadline. When it
passes, the Kiste stops, keeps its disk and, when the guest answers, saves its
session. `kiste status` shows the deadline; `kiste extend` pushes it out:

```bash
kiste extend review-42 --hours 12
kiste extend review-42 --ttl 30m
```

Without a lifetime, a Kiste runs until you stop it.

## Idle Kisten

During early access a running Kiste keeps running when nobody is connected,
until you stop it or its lifetime ends. Use `--ttl` for Kisten you might
forget.

When billing starts, trial accounts will have idle Kisten *parked*: a Kiste
that has had no SSH connection, terminal or desktop viewer and used less than a
tenth of a CPU for 30 minutes is stopped with its session kept, never deleted.
`kiste start` brings it back exactly as it was. See
[Plans and billing](https://docs.kiste.run/account/billing.md).

## Long operations

Stopping a large Kiste with its session or starting one under load can take
longer than a request should wait. The API then answers `202 Accepted` with the
Kiste's current state (`stopping` or `starting`) and the operation continues;
the CLI keeps waiting and shows the final state. While one change is in
progress, another one answers [K05](https://docs.kiste.run/errors/k.md#k05) (`machine_busy`).

## Errors

A Kiste in state `error` crashed or failed to start. Its disk is kept. Read
what happened with `kiste logs NAME`, then start it again with `kiste start NAME`. An `instance_error` [alert](https://docs.kiste.run/account/webhooks-alerts.md) is raised as well.

| Code | Meaning |
| --- | --- |
| [K03](https://docs.kiste.run/errors/k.md#k03) | The Kiste isn't running, and the command needs it running. |
| [K04](https://docs.kiste.run/errors/k.md#k04) | The Kiste is still starting. Wait a moment. |
| [K05](https://docs.kiste.run/errors/k.md#k05) | Another change to this Kiste is in progress. |
| [K07](https://docs.kiste.run/errors/k.md#k07) | The Kiste couldn't start; its disk is kept. |

## Related topics

- [Overview](https://docs.kiste.run/kisten.md)
- [Create a Kiste](https://docs.kiste.run/kisten/create.md)
- [Checkpoints and snapshots](https://docs.kiste.run/kisten/snapshots.md)
- [Fork](https://docs.kiste.run/kisten/fork.md)
- [Manage](https://docs.kiste.run/kisten/manage.md)
- [Images and environments](https://docs.kiste.run/kisten/images.md)
- [Automation](https://docs.kiste.run/kisten/automation.md)
- Previous: [Create a Kiste](https://docs.kiste.run/kisten/create.md)
- Next: [Checkpoints and snapshots](https://docs.kiste.run/kisten/snapshots.md)
