> For AI agents: the complete documentation index is available at https://docs.phax.run/llms.txt, the full documentation bundle is available at https://docs.phax.run/llms-full.txt.

# The phax home \{#the-phax-home}

The phax home is the one directory holding phax's own machine-wide files. It is `~/.phax` unless the `PHAX_HOME` environment variable names another. This page is for an operator who wants a second phax configuration beside the daily one (a release candidate, a branch under test), or a CI machine whose phax files live outside the CI user's home.

## A second configuration \{#a-second-configuration}

```bash
export PHAX_HOME=$HOME/.phax-next
phax agent setup providers --write   # writes $HOME/.phax-next/providers.json
phax validate                        # home:    /Users/me/.phax-next (PHAX_HOME)
phax run --plan plan.md              # Claude Code, Codex and Vibe still use their own sign-ins
```

## What the home holds \{#what-the-home-holds}

```
$PHAX_HOME/            # ~/.phax when PHAX_HOME is unset
  config.json          # the global config layer
  providers.json       # provider enablement
  model-routing.json   # routing table (absent: the built-in table)
  telemetry.json       # telemetry switch
  <daily telemetry journals>
  <state root>         # registry.json, runs/, worktrees/, archive/, locks/, records/, …
                       # when no config layer names state.root
```

`phax report` reads the telemetry journals of the current home.

There is no fallback and no migration. With `PHAX_HOME` set, a file the directory does not hold takes its built-in default, and the copy in `~/.phax` is never read. phax does not copy anything from `~/.phax` into a new home, so an empty or missing one behaves like a fresh install.

## What never moves \{#what-never-moves}

`PHAX_HOME` moves nothing that belongs to a provider or to you. These stay under your user's home, whether the variable is set or not:

- the providers' own homes, stores and sign-ins: `~/.claude`, `~/.codex` and Vibe's home;
- the user-scope skills install under `~/.claude`;
- the `~` phax writes in a pull request body.

Do not change `HOME` to get a second phax configuration: the provider CLIs keep their sign-ins under it.

## The variable's rules \{#the-variables-rules}

`PHAX_HOME` is an absolute path to a directory. A directory that does not exist yet is accepted and created on first write. phax refuses, with exit 2 (config validation):

- an empty value;
- a relative path, including a `~/…` your shell did not expand (quoting `'~/phax-ci'` does that);
- an existing path that is not a directory.

```
$ PHAX_HOME='~/phax-ci' phax run --plan plan.md
PHAX_HOME must be an absolute path to a directory, got "~/phax-ci"
```

The refusal comes before the command reads anything. Help, `--version`, `--usage`, `--json-schema` and `phax completions` do not check the variable, so a shell that sources completions starts cleanly while the next real command fails.

## Which home is in use \{#which-home-is-in-use}

When `PHAX_HOME` chose the home, a command says so once on stderr:

```
phax home: /srv/ci/phax (PHAX_HOME)
```

With `--json` the same text is a `note` message line on stderr; stdout is unchanged (see [Machine answers](https://docs.phax.run/reference/json-output.md)). Help, `--version`, `--usage`, `--json-schema` and `phax completions` print no notice, and nothing is printed on the default home.

`phax validate` names the home in both cases, with its source:

```
$ PHAX_HOME=/srv/ci/phax phax validate
✓ config is valid (project: acme)
  home:    /srv/ci/phax (PHAX_HOME)
  project: /work/acme/phax.json
  local:   (none)
  global:  /srv/ci/phax/config.json

$ phax validate
✓ config is valid (project: acme)
  home:    /Users/me/.phax (default)
  …
```

`phax validate --json` carries it as `"home": { "path": "/srv/ci/phax", "from": "PHAX_HOME" }`, where `from` is `PHAX_HOME` or `default`.

## Where runs go \{#where-runs-go}

The state root holds everything about runs: the run registry (`registry.json`, which `phax ls`, `resume` and every command naming a run look up), `runs/`, `worktrees/`, `archive/`, the locks and the authoring and decision records. It is chosen in this order, weakest first:

1. the built-in `~/.phax`;
2. `PHAX_HOME`, when set;
3. an explicit `state.root` in any config layer (`phax.json`, `phax.local.json` or the home's `config.json`).

An explicit `state.root` always wins and is read as written, with `~` as your user's home. A repository that writes `"state": { "root": "~/.phax" }` therefore keeps its runs in `~/.phax` under a moved home too; to separate them, override `state.root` in a more personal layer. `phax init` does not write `state.root`, so a new project follows `PHAX_HOME`.

## Inside a run \{#inside-a-run}

The agent sessions of a run inherit the environment of the `phax run` or `phax resume` that starts them, `PHAX_HOME` included, so a phax command a session runs reads the same home. Resume a run under the home it started with: with the default state root, `phax resume` under another home does not find the run at all.

The home and the state root are separate. An explicit `state.root` moves the run registry and the run state only, never the home's files. Every home whose layers name the same `state.root` shares one registry and sees the same runs, and a run resumed under another home then uses that home's `config.json`, `providers.json` and routing.
