# .flowspace.json

> Every key a .flowspace.json file supports (workspace profiles, run commands, docs, providers, reviewers, quick links, code search, settings) with examples.

A `.flowspace.json` file describes how Flow works in a repository: saved layouts for new sessions, commands and docs for the New tab launcher, reviewers and quick links for pull requests, external code search, and per-repository setting values. Every key is optional. Check the file into a repository to share it with your team, or keep your own copy outside the repository.

## Where the file can live

Flow reads every flowspace file that applies to a session's directory, in this order:

| Order | File | Scope |
|---|---|---|
| 1 | `DIR/.flowspace.json`, when the session is in a subdirectory of its checkout | Directory |
| 2 | `~/.flow/repo_config/REPO/flowspace.json` (your own file for this repository, shared by its worktrees) | User repo |
| 3 | `WORKTREE_TOP/.flowspace.json` | Repo |
| 4 | `PRIMARY_CHECKOUT/.flowspace.json`, when it differs from the worktree top | Repo |
| 5 | `~/.flow/flowspace.json` (your global file) | User |

List keys merge across the files: entries add up and, when two files use the same name or label, the earlier file in this order wins. A file that lists a key in its top-level `"!important"` array moves to the front for that key. See [Settings scopes](https://flow.worldbreakstudios.com/docs/configuration/settings-scopes.md) for the full rules.

A missing or corrupt file, or a malformed entry, is skipped; it never stops Flow. Flow still reads a `.pwrspace.json` (the file's old name) when no `.flowspace.json` sits beside it, but always writes the new name.

## Keys at a glance

| Key | Type | Used by |
|---|---|---|
| `profiles` | array of profiles | the New session flow's Layout step; Save as workspace |
| `run` | array of `{label, command, cwd?, detail?}` | the New tab launcher's Run column |
| `docs` | array of `{label, url}` | the New tab launcher's Web column |
| `run_providers` | array of `{name, command}` | more Run entries, printed by a command |
| `reviewers` | object `{groups, starred, ignored}` | a PR review tab's reviewer picker |
| `quick_links` | object `{links, patterns}` | a PR review tab's Quick links |
| `code_search` | object `{url, by_lang, docs}` | go to definition when nothing is found on disk |
| `settings` | object of setting key → value | per-repository setting values |
| `!important` | array of key names | raises this file's value for those keys |

Any other top-level key is kept as it is when Flow saves a profile into the file.

## A complete example

```json
{
  "profiles": [
    {
      "name": "dev",
      "description": "Agent on the left, server and tests on the right",
      "layout": {
        "split": "row",
        "ratio": 0.6,
        "a": { "tabs": [{ "command": "claude" }] },
        "b": {
          "split": "column",
          "ratio": 0.5,
          "a": { "tabs": [{ "command": "npm run dev" }] },
          "b": { "tabs": [{}, { "command": "npm test -- --watch" }], "active": 1 }
        }
      }
    }
  ],
  "run": [
    { "label": "Dev server", "command": "npm run dev", "cwd": "web", "detail": "port 3000" },
    { "label": "Tests", "command": "cargo test" }
  ],
  "docs": [{ "label": "API docs", "url": "https://docs.example.com" }],
  "run_providers": [{ "name": "just", "command": "~/bin/just-flow" }],
  "reviewers": {
    "groups": [{ "name": "backend", "members": ["alice", "org/backend/{robin:1}"], "auto_merge": true }],
    "starred": ["alice"],
    "ignored": ["dependabot"]
  },
  "quick_links": {
    "links": [{ "label": "Deploy", "url": "https://deploy.example.com/{owner}/{repo}/{branch}" }],
    "patterns": [{ "label": "Ticket {1}", "match": "\\b(ABC-\\d+)\\b", "url": "https://jira.example.com/browse/{1}" }]
  },
  "code_search": {
    "url": "https://sourcegraph.example.com/search?q={symbol}",
    "by_lang": { "java": "https://opengrok.example.com/source/search?defs={symbol}" }
  },
  "settings": { "git.merge_method": "squash" },
  "!important": ["run"]
}
```

## profiles

A profile is a saved group layout: a split tree of tiles, each tile's tabs, and what each tab runs. Profiles are offered when you start a new session (the New session flow's Layout step, `⇧⌘N`), and `flow-cli new-session DIR --layout NAME` opens one by name.

| Field | Type | Meaning |
|---|---|---|
| `name` | string, required | The profile's name. Saving a profile with an existing name replaces it. When two files define the same name, the earlier file wins. |
| `description` | string | Shown in the picker. |
| `layout` | node, required | The root of the layout tree. |

A **node** is either a split or a leaf:

| Node | Fields |
|---|---|
| Split | `split`: `"row"` (children side by side, `a` on the left) or `"column"` (stacked, `a` on top); `ratio`: the share of space given to `a`, 0.0–1.0; `a` and `b`: child nodes |
| Leaf | `tabs`: an array of tabs; `active`: the index of the active tab (default 0) |

A **tab** is an object:

| Field | Meaning |
|---|---|
| (none) | `{}` is a plain terminal running your shell. |
| `command` | A command to run in the terminal tab. |
| `kind` | `"terminal"` (the default) or `"webview"`. |
| `url` | The page a webview tab loads. |
| `url_command` | A shell command run at launch in the session's directory; the first non-empty line it prints becomes the webview's URL. `url` is the fallback, and the page shown while the command runs. |

Webview tabs need the Web tabs experiment (`features.web_tabs`). While it is off, a profile's webview tabs are skipped; a webview tab with neither a usable `url` nor a `url_command` opens as a terminal.

To save the current session's layout, run **Save as workspace** (`⇧⌘S`): give the profile a name and an optional description, then pick which flowspace file to save it to.

## run, docs and run_providers

These three keys fill the New tab launcher, which opens on a tile strip's "+" or `⌘T` while Settings › General › Tabs › New tab is **Ask**.

| Key | Entry fields | Meaning |
|---|---|---|
| `run` | `label`, `command`, optional `cwd`, optional `detail` | A command that opens in a new terminal tab titled by its label. A relative `cwd` is relative to the directory of the file that names it (for your `repo_config` file: the worktree top); a leading `~/` is your home directory; absent means the session's directory. `detail` is shown instead of the command. |
| `docs` | `label`, `url` | A page in the launcher's Web column. The Web column only appears while the Web tabs experiment is on. |
| `run_providers` | `name`, `command` | A command that prints more Run entries as JSON each time the launcher opens. |

`⌥1`–`⌥9` launch the first nine visible Run rows. Run providers have their own contract: see [Run providers](https://flow.worldbreakstudios.com/docs/configuration/run-providers.md).

## reviewers

Reviewer groups and preferences for the PR review tab's Request picker.

| Field | Type | Meaning |
|---|---|---|
| `groups` | array of `{name, members, auto_merge?}` | Named reviewer groups. `"auto_merge": true` also enables auto-merge on the PR when you request that group. |
| `starred` | array of logins | Shown in their own section of the picker. |
| `ignored` | array of logins or teams | Never suggested or requested. |

A member is one of:

| Member | Means |
|---|---|
| `login` | that user (a leading `@` is dropped) |
| `org/team` | the team itself |
| `org/team/*` | each member of the team |
| `org/team/{random:N}` | N members, picked at random |
| `org/team/{robin:N}` | the N members requested least recently in this repository |

Groups from several files merge by name (compared case-insensitively), the earliest file winning; `starred` and `ignored` are the union of every file. The picker's **Save as group…** writes a group into a flowspace file.

## quick_links

Links shown in a PR review tab's meta column.

| Field | Entry fields |
|---|---|
| `links` | `label`, `url`, optional `repos` |
| `patterns` | `label`, `match` (a regular expression), optional `url` (default `{0}`), optional `in` (`["body"]` by default; add `"comments"` for comments and reviews), optional `repos` |

A pattern turns every match in the PR's text into a link (at most a fixed number per pattern). `repos` limits an entry to repositories matching `owner/name` globs (`*` matches any run of characters).

Tokens you can use in a label or URL:

| Token | Value |
|---|---|
| `{host}`, `{owner}`, `{repo}`, `{slug}` | the PR's host, owner, repository name and `owner/name` |
| `{number}`, `{branch}`, `{base}`, `{author}`, `{sha}`, `{title}` | the PR's number, head branch, base branch, author login, head commit and title |
| `{codeowners}` | the owners of the changed files, from `.github/CODEOWNERS`, `CODEOWNERS` or `docs/CODEOWNERS` |
| `{0}`, `{1}`, … | a pattern's whole match and its capture groups |

In a URL each token is percent-encoded. A link whose URL uses a token that resolves to nothing, or that is not `http://` or `https://`, is dropped. Links from every file are concatenated, then deduplicated by URL.

## code_search

Where go to definition and find references search when a symbol is not found on disk.

| Field | Type | Meaning |
|---|---|---|
| `url` | string | A search URL template for every language without its own. |
| `by_lang` | object | Per-language search templates. Keys: `rust`, `python`, `java`, `jsts`, `shell`, `c`, `cpp`. |
| `docs` | object | Per-language docs templates, same keys, with `{symbol}` and `{version}`. |

Templates take `{symbol}`, `{text}`, `{lang}`, `{module}`, `{package}`, `{path}`, `{repo}` and `{query}`. The earliest file wins `url` and each per-language key; Settings › Code fills in what the files leave out. See [Code navigation](https://flow.worldbreakstudios.com/docs/features/code-navigation.md) for what each placeholder holds.

## settings

A `settings` object holds setting values for this repository, using the same keys as `~/.flow/settings.json`. Only keys with a scope rule are read, and each only in the scopes its rule honours:

- In a checked-in `.flowspace.json` (Repo scope), Flow reads `git.merge_method` (`squash`, `merge` or `rebase`) and `pr.diff_groups` (the PR review tab's diff groups). Every other key there is ignored, so a team file can't pick your agent or run commands in your sessions.
- In your own `~/.flow/repo_config/REPO/flowspace.json` (User repo scope), every key in the [scoped settings table](https://flow.worldbreakstudios.com/docs/configuration/settings-scopes.md#the-scoped-settings) is read, including `session.primary_command`, `tabs.new_tab` and the `snooze.*` keys.

## !important

`"!important": ["run", "worktreeDir"]` lifts this file's value for the listed keys above every non-important value, whatever the order. A mark in a scope the key does not honour is ignored. See [Settings scopes](https://flow.worldbreakstudios.com/docs/configuration/settings-scopes.md#mark-a-value-important).

## Limits

- Sessions on remote hosts read only `~/.flow/flowspace.json` and run no providers.
- A session on a paired device lists only the `run` entries of that device's checkout (at most 64), plus your own `~/.flow/flowspace.json`; it never reads that device's `docs` or `run_providers`.
- Flow re-reads the files when it needs them (opening a launcher, fetching a PR), so an edit applies the next time, without a restart.
