---
title: "Command reference"
description: "Every thinslice command grouped by what you're doing, from setting up a repo to creating worktrees and running your services."
---
# Command reference

## Setup

| Command | Description |
|---|---|
| `slice setup` | Transform a git repo into a managed thinslice workspace |

## Worktrees

| Command | Description |
|---|---|
| `slice local <name> [-b ref] [--from state] [hook] [args...]` | Create a worktree for your own work at `local/<name>` |
| `slice tmp <name> [-b ref] [--from state] [hook] [args...]` | Create a throwaway worktree at `tmp/<name>` |
| `slice pr checkout <number> [--from state] [hook] [args...]` | Fetch a PR and create a worktree at `pr/<number>` |
| `slice rm <worktree>` | Stop processes, remove worktree, delete branch, clean up throwaway state |
| `slice gc` | Remove all `tmp/` worktrees that aren't running |

The worktree path is also the git branch name. `slice local feature-auth` creates both the directory `local/feature-auth` and the branch `local/feature-auth`.

See [Worktrees](worktrees.md) for details.

## State

| Command | Description |
|---|---|
| `slice state new <name> [--from existing]` | Create a new state directory |
| `slice state ls` | List state directories with bindings and status |
| `slice state rm <name>` | Remove a state directory (refuses if bound or running) |

See [State](state.md) for details.

## Lifecycle

| Command | Description |
|---|---|
| `slice use <state>` | Bind the current worktree to a state directory |
| `slice up [profile]` | Start processes (optional tmux profile) |
| `slice down` | Stop processes, keep binding |
| `slice detach` | Stop processes and unbind worktree from state |
| `slice restart [profile]` | Stop and restart processes |
| `slice status` | Show all worktrees, states, bindings, ports, and status |

## Config and inspection

| Command | Description |
|---|---|
| `slice edit` | Open the slice config in `$EDITOR` (stored in state directory) |
| `slice config` | Print resolved configuration to stdout |
| `slice ports` | Show port allocations for the current slice |
| `slice logs [process]` | Tail process logs |

## Utility

| Command | Description |
|---|---|
| `slice give-me-a-port` | Allocate and return a free port (for use inside `thinslice.new-state`). See [Port Registry](port-registry.md) |
| `slice debug port <number>` | Look up what owns a specific port |
| `slice doctor` | Full reconciliation of the port registry |
