---
title: "af workspace"
description: "Create and locate workspaces"
---

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

# af workspace

<!-- Generated by tools/gen-reference.mjs from `af workspace --help`. Change the help text in crates/atoll-forge-cli/src/main.rs, then run `npm run gen:reference`. -->

A workspace is a local directory that holds some or all of a repository's files, where you make changes. Its state is kept in `.af/` at its root. When you run `af` inside a workspace, it finds the workspace from the current directory and uses its server and repository.

## Usage

```text
af workspace [OPTIONS] <COMMAND>
```

## Commands

| Command | What it does |
| --- | --- |
| [`add`](#af-workspace-add) | Create a workspace |
| [`root`](#af-workspace-root) | Print the root directory of the current workspace |

## Global options

Every `af` command also takes the [global options](https://docs.forge.workreef.dev/reference/af/#global-options).

## Examples

```sh
af workspace add ~/src/web
af workspace add ~/src/api --path 'services/api/**'
af workspace root
```

## af workspace add {#af-workspace-add}

Create a workspace

Creates a workspace in DIR holding the files that match the --path globs, at main's latest landing. The workspace records the server and repository, so commands run inside it use them. DIR must be new or empty; a workspace that cannot be made leaves nothing of it behind, and removes nothing it did not write, so the same command can be run again.

### Usage

```text
af workspace add [OPTIONS] <DIR>
```

### Arguments

- `<DIR>`

  Directory for the workspace, new or empty; created if missing

### Options

- `--path <PATHS>`

  Glob of files to include, from the repository root, such as `crates/foo/**`

  Repeat to include more. Every file is included if omitted.

### Global options

Every `af` command also takes the [global options](https://docs.forge.workreef.dev/reference/af/#global-options).

### Examples

```sh
af --repository web workspace add ~/src/web
af --repository web workspace add ~/src/api --path 'services/api/**' --path 'libs/**'
```

## af workspace root {#af-workspace-root}

Print the root directory of the current workspace

### Usage

```text
af workspace root [OPTIONS]
```

### Global options

Every `af` command also takes the [global options](https://docs.forge.workreef.dev/reference/af/#global-options).

Source: https://docs.forge.workreef.dev/reference/af/workspace/index.mdx
