<?xml version="1.0" encoding="UTF-8"?>
<spec xmlns="https://vibevm.org/spec/1">
  <title id="root">Settings, paths and environment</title>
  <status stage="doc" state="work" audience="user"/>
  <p p="1">vibe keeps its own files in one folder in your home directory and reads a few environment variables. This page lists the folder's contents, every variable, and which wins when they disagree.</p>
  <example id="vars" fixture="hello-vibe" p="2">
    <run>vibe vars</run>
    <expect>VIBEVM_INSTALL_ROOT=&lt;HOME&gt;/.vibe
VIBEVM_HOME=(none)
VIBE_INVOKED_BY=
VIBE_UNATTENDED=false
VIBE_LOG=warn</expect>
  </example>
  <section id="the-folder" title="The folder: ~/.vibe/">
    <table p="3">
      <tr>
        <td>Path</td>
        <td>What it holds</td>
      </tr>
      <tr>
        <td>`~/.vibe/cache/`</td>
        <td>the machine store of fetched packages, keyed by identity</td>
      </tr>
      <tr>
        <td>`~/.vibe/registries/`</td>
        <td>git clones of registries, used to fetch packages</td>
      </tr>
      <tr>
        <td>`~/.vibe/opt/`</td>
        <td>installed versions of vibe, their launchers in `opt/bin/`, and the downloaded reader shell</td>
      </tr>
      <tr>
        <td>`~/.vibe/registry.toml`</td>
        <td>machine-wide registries, mirrors and overrides, merged after each project's</td>
      </tr>
      <tr>
        <td>`~/.vibe/config.toml`</td>
        <td>user configuration: `[env]`, `[install]`, `[net]`</td>
      </tr>
      <tr>
        <td>`~/.vibe/settings.toml`</td>
        <td>your application preferences, the first of three layers</td>
      </tr>
      <tr>
        <td>`~/.vibe/&lt;host&gt;.publish.token`, `~/.vibe/git.publish.token`</td>
        <td>publish tokens, readable by you alone; never printed, never copied</td>
      </tr>
      <tr>
        <td>`~/.vibe/search-cache/`</td>
        <td>cached search results with a time to live</td>
      </tr>
    </table>
    <rule ref="spec://org.vibevm.core/vibevm/modules/vibe-registry/PROP-010#THE-SETTINGS-HOME-IS-DOT-VIBE-NOT-XDG" p="4"/>
    <rule ref="spec://org.vibevm.core/vibevm/modules/vibe-registry/PROP-010#REGISTRIES-KEEP-THEIR-OWN-FILE" p="5"/>
    <p p="6">On Windows the folder is `%USERPROFILE%\.vibe\`. The older location under `~/.vibevm/` is never read; move anything you kept there.</p>
  </section>
  <section id="inside-a-project" title="Inside a project">
    <table p="7">
      <tr>
        <td>Path</td>
        <td>What it holds</td>
      </tr>
      <tr>
        <td>`.vibe/settings.toml`</td>
        <td>the team's shared preferences, committed; the second layer</td>
      </tr>
      <tr>
        <td>`.vibe/settings.local.toml`</td>
        <td>your per-project fine-tuning, ignored by git; the third layer</td>
      </tr>
      <tr>
        <td>`.vibe/lifecycle.toml`, `.vibe/trace/`, `.vibe/agentic/`</td>
        <td>lifecycle fingerprints, compile traces and the agent relay mailbox; machine state, not committed</td>
      </tr>
    </table>
    <rule ref="spec://org.vibevm.core/vibevm/modules/vibe-settings/PROP-040#L2-REPO-SHARED" p="8"/>
    <p p="9">Preferences merge layer by layer: a scalar from a higher layer replaces, tables merge deeply, arrays replace as a whole. `vibe prefs list` shows every resolved value with its origin, `vibe prefs show-origins` the [contribution](../glossary/index.xml#contribution) of each layer, and `vibe prefs set` writes one key into one layer.</p>
    <rule ref="spec://org.vibevm.core/vibevm/modules/vibe-settings/PROP-040#MERGE-SCALARS" p="10"/>
    <rule ref="spec://org.vibevm.core/vibevm/modules/vibe-settings/PROP-040#MERGE-ARRAYS" p="11"/>
    <p p="12">The three layers are the machine, `~/.vibe/settings.toml`, the repository, `.vibe/settings.toml`, and your own copy for one project, `.vibe/settings.local.toml`, which `vibe init` adds to `.gitignore` so it is never committed by accident. The precedence between them is one fixed law, written in the binary. A missing or broken file counts as absent with a warning, never as an error. Every key is declared with a type and a default, and an unknown key is a loud warning at boot and in `vibe prefs check`. These files hold how vibe looks and behaves for you; project properties live in the manifest, and a committed settings file may carry no secrets. The commands are `vibe prefs get`, `set` with `--layer`, `list`, `check`, `migrate` and `show-origins`.</p>
    <rule ref="spec://org.vibevm.core/vibevm/modules/vibe-settings/PROP-040#L1-USER-MACHINE" p="13"/>
    <rule ref="spec://org.vibevm.core/vibevm/modules/vibe-settings/PROP-040#L3-USER-PROJECT" p="14"/>
    <rule ref="spec://org.vibevm.core/vibevm/modules/vibe-settings/PROP-040#gitignore-autogen" p="15"/>
    <rule ref="spec://org.vibevm.core/vibevm/modules/vibe-settings/PROP-040#precedence-law" p="16"/>
    <rule ref="spec://org.vibevm.core/vibevm/modules/vibe-settings/PROP-040#missing-is-default" p="17"/>
    <rule ref="spec://org.vibevm.core/vibevm/modules/vibe-settings/PROP-040#schema-first" p="18"/>
    <rule ref="spec://org.vibevm.core/vibevm/modules/vibe-settings/PROP-040#app-prefs-not-project" p="19"/>
    <rule ref="spec://org.vibevm.core/vibevm/modules/vibe-settings/PROP-040#no-secrets-in-committed" p="20"/>
    <rule ref="spec://org.vibevm.core/vibevm/modules/vibe-settings/PROP-040#prefs-command" p="21"/>
    <p p="22">`vibe prefs` without arguments opens a settings screen in the terminal: a tree of pages on the left, drawn by the same widget as `vibe tree`, and a form on the right. Editing a field writes to a layer you choose, your own project layer by default inside a project and the machine layer outside one. A field shows its provenance on demand, the winning layer and the shadowed ones, and lets you set or clear one layer without touching the others. A search finds settings by key, name, description and synonyms.</p>
    <rule ref="spec://org.vibevm.core/vibevm/modules/vibe-settings/PROP-041#tree-widget-req" p="23"/>
    <rule ref="spec://org.vibevm.core/vibevm/modules/vibe-settings/PROP-041#tree-context" p="24"/>
    <rule ref="spec://org.vibevm.core/vibevm/modules/vibe-settings/PROP-041#write-layer-choice" p="25"/>
    <rule ref="spec://org.vibevm.core/vibevm/modules/vibe-settings/PROP-041#provenance-view" p="26"/>
    <rule ref="spec://org.vibevm.core/vibevm/modules/vibe-settings/PROP-041#provenance-edit" p="27"/>
    <rule ref="spec://org.vibevm.core/vibevm/modules/vibe-settings/PROP-041#settings-search" p="28"/>
  </section>
  <section id="variables" title="Environment variables">
    <table p="29">
      <tr>
        <td>Variable</td>
        <td>Effect</td>
      </tr>
      <tr>
        <td>`VIBE_SETTINGS`</td>
        <td>moves the whole `~/.vibe/` folder to the given path, used verbatim</td>
      </tr>
      <tr>
        <td>`VIBE_REGISTRY_CACHE`</td>
        <td>moves the registry clone cache</td>
      </tr>
      <tr>
        <td>`VIBE_OFFLINE`</td>
        <td>forbids network access, like `--offline`; truthy values `1`, `true`, `yes`, `on`</td>
      </tr>
      <tr>
        <td>`VIBE_INVOKED_BY`</td>
        <td>names the calling agent, like `--invoked-by`; stamped into every JSON report</td>
      </tr>
      <tr>
        <td>`VIBE_UNATTENDED`</td>
        <td>answers every confirmation and refuses wizards, like `--unattended`</td>
      </tr>
      <tr>
        <td>`VIBE_NO_DEFAULT_REGISTRY`</td>
        <td>ignores the embedded registry of a source-built vibe</td>
      </tr>
      <tr>
        <td>`VIBEVM_INDEX_URL_&lt;REGISTRY&gt;`</td>
        <td>the index location of one registry; `none` switches its index off</td>
      </tr>
      <tr>
        <td>`VIBEVM_REGISTRY_TOKEN_&lt;HOST&gt;`</td>
        <td>the token a registry with `auth = "token-env"` reads</td>
      </tr>
      <tr>
        <td>`VIBEVM_PUBLISH_TOKEN`</td>
        <td>the publish token; wins over the token files</td>
      </tr>
      <tr>
        <td>`VIBEVM_HOME`, `VIBEVM_INSTALL_ROOT`</td>
        <td>advisory: where the installed versions live; the running binary's own location is the truth, and `vibe vars diff` shows where they disagree</td>
      </tr>
      <tr>
        <td>`VIBE_LOG`</td>
        <td>the log filter of the process</td>
      </tr>
    </table>
    <rule ref="spec://org.vibevm.core/vibevm/modules/vibe-registry/PROP-010#OFFLINE-LAYERING" p="30"/>
    <rule ref="spec://org.vibevm.core/vibevm/modules/vibe-index/PROP-005#INDEX-URL-TODAY-IS-AN-ENVIRONMENT-VARIABLE" p="31"/>
    <rule ref="spec://org.vibevm.core/vibevm/modules/vibe-registry/PROP-002#TOKEN-ENV-DEFAULTING" p="32"/>
    <rule ref="spec://org.vibevm.core/vibevm/common/PROP-019#LAYER-ENV-ADVISORY" p="33"/>
  </section>
  <section id="precedence" title="Precedence">
    <p p="34">For the same setting, a flag on the command line wins over an environment variable, which wins over the project's configuration, which wins over the user's, which wins over the built-in default. The same order holds for [registries](../glossary/index.xml#registry): a project's list wins over the machine's.</p>
    <rule ref="spec://org.vibevm.core/vibevm/modules/vibe-registry/PROP-010#PROJECT-OVERRIDES" p="35"/>
  </section>
  <section id="edge-cases" title="Edge cases and rules">
    <p p="36">Token files are surface secrets: restrict them to your user, never commit them, never paste their contents anywhere. vibe redacts a token in every output and error, and the discipline on your side is the same.</p>
    <rule ref="spec://org.vibevm.core/vibevm/common/PROP-000#token-secrecy" p="37"/>
    <rule ref="spec://org.vibevm.core/vibevm/common/PROP-000#TOKEN-SURFACE-SECRET" p="38"/>
    <p p="39">`vibe show config` is the project-configuration view with the origin of each value; `vibe prefs` is the application-preference file. They are different files and different commands.</p>
  </section>
</spec>
