Paths and resolution order
Where urna keeps the embedder payload, the setup venv and the embed cache, and the exact order it searches for data directories, scripts and Python.
This page lists every place urna reads from or writes to outside your corpus files, and the order in which it searches. The orders are the ones the code implements; when a lookup behaves unexpectedly, urna doctor prints what it found.
Data directories
Every command that needs the embedder payload, the build tool or the setup venv searches these data directories, in order. Each one is expected to hold an urna/ directory. Unset or empty variables are skipped, and a directory equal to the one before it is dropped.
$URNA_DATA_DIR$XDG_DATA_HOME$HOME/.local/share, also whenXDG_DATA_HOMEis set%LOCALAPPDATA%, read on every operating system<directory of the urna binary>/../share
The last entry lets an unpacked release archive work with a share/urna/forge tree placed next to its bin/.
Install root
urna setup and urna setup --uninstall write to one directory, the install root. It is resolved from the current environment each time:
$URNA_DATA_DIR- on Windows only,
%LOCALAPPDATA% $XDG_DATA_HOME$HOME/.local/share
Setup never writes to the binary-relative share/: the package manager that installed the binary owns it. With none of these set, the payload step is blocked and --uninstall fails with "no data dir (set URNA_DATA_DIR)".
The one-liner installers pick their directories the same way:
| Installer | Binary | Data directory |
|---|---|---|
install.sh | ${URNA_BIN_DIR:-$HOME/.local/bin}/urna | ${URNA_DATA_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}} |
install.ps1 | $URNA_BIN_DIR\urna.exe, else ~\.local\bin\urna.exe | $URNA_DATA_DIR, else %LOCALAPPDATA%, else $HOME\.local\share |
What lives in a data directory
| Path | Written by | Content |
|---|---|---|
<root>/urna/forge/ | urna setup, install.sh, install.ps1 | the embedder payload: the potion query embedder scripts and the potion-base-8M table (model.safetensors is 30.2 MB) |
<root>/urna/venv/ | urna setup | a venv with numpy and tokenizers; interpreter bin/python, or Scripts\python.exe on Windows |
<root>/.urna-payload-<pid>.tar.gz | urna setup, during a download | a partial download; removed at the end of the step and swept by the next run |
<root>/.urna-setup-<pid>/ | urna setup, during unpacking | the staging directory; removed the same way |
The temporary files sit at the top level of the install root, next to urna/, not inside it.
On a default Linux or macOS install the data directory is ~/.local/share/urna (or $XDG_DATA_HOME/urna); on Windows it is %LOCALAPPDATA%\urna.
Script lookup
The query embedders and the build tool are Python scripts. The binary looks for each one in this order and takes the first that exists:
- The repo layout,
python/<dir>/<script>, under the working directory, then under its parent, then under the checkout of a dev-built binary (a binary at<repo>/target/<profile>/urnawhose<repo>has apython/directory). <root>/urna/<dir>/<script>for each data directory, in order.- Otherwise the relative path
python/<dir>/<script>, which then fails as "not found".
| Script | <dir> | Used by | Shipped in the payload |
|---|---|---|---|
embed_query_potion.py | forge | ask, retrieve and the explorer on potion corpora; urna doctor | yes |
embed_query_model.py | forge | ask, retrieve on registry-model corpora | no |
urna_forge.py | tools | urna build | no |
embed_query.py | none (python/embed_query.py) | search-text by default | no; looked up in the repo layout only |
Only the first script ships, so on an installed binary the others resolve only from a repo checkout. --embedder on ask, retrieve and search-text bypasses the lookup.
Because the repo layout comes first, running urna from inside a checkout uses the checkout's scripts and table, even when a payload is installed. urna doctor shows the path it picked.
Interpreter lookup
The query embedders and the build tool run under one Python interpreter, chosen in this order:
$URNA_PYTHON, used verbatim.- The setup venv: the first data directory whose
urna/venv/bin/python(urna\venv\Scripts\python.exeon Windows) exists. .venv/bin/pythonin the working directory or one of its three parents.python3fromPATH.
The choice is printed to stderr as [urna] embedder interpreter: <path> (not inside the explorer or during setup).
Step 3 runs the nearest .venv it finds, by position in the filesystem alone. In a directory tree you do not trust, set URNA_PYTHON so no discovered interpreter runs.
On Windows, step 3 looks for the Unix layout (bin/python), so it never finds a Windows .venv\Scripts\python.exe, and python3 is usually absent from PATH. Run urna setup or set URNA_PYTHON.
Embed cache
urna build caches embeddings and model probes under one root, shared across specs:
--cache-diron the command line[output] cache_dirin the spec$URNA_CACHE_DIR${XDG_CACHE_HOME:-~/.cache}/urna
| Path under the root | Content |
|---|---|
embed/<preset>/<16 hex>.npz | cached vectors for one model, recipe and corpus input; with .npz.sha256 and .npz.lock next to it |
models/model_hash.<preset>.<16 hex>.json | a model probe: the computed model_hash and a fingerprint of the model directory |
The cache key and invalidation rules are in reproducible builds and build artifacts.
Model directories
Registry models (used by urna build and the registry query embedder, both in a checkout) are loaded from the first of:
- an explicit model path:
model_pathin the spec's[[models]]at build time,--model-pathonaskandretrieve $URNA_MODEL_DIR_<NAME>, for exampleURNA_MODEL_DIR_WEMM_2B- the preset's own local directory, when it exists
- for the wemm and jina presets, the Hugging Face cache snapshot that
refs/mainpoints to (under$HF_HOME/hub, default~/.cache/huggingface/hub)
Nothing is downloaded unless URNA_ALLOW_DOWNLOAD=1. See the model registry.
The pip wheel
The wheel carries its own copy of the potion table inside the package, at <site-packages>/urna/models/potion-base-8M. urna.potion_model_path() returns that path. The wheel reads no data directory and uses no setup venv.
All variables named here are described in environment variables.
Environment variables
Every URNA_* environment variable urna reads, plus the other variables that change its behavior, with the component that reads each, its default and effect.
Exit codes
Exit codes of every urna command: the typed codes of doctor, setup and build, the engine and agent verbs, the explorer, the installers and the wheel's command.