Environment Variables: A Guide¶
Set what you can in your config file, config.toml. Use an environment
variable for a one-off run, or for a CI override. Where a variable and a config
key do the same job, the variable wins over config.toml for as long as it is set.
This page groups the variables you may set by what they do. For each one it gives what it does, its default, where to set it, and the config key that does the same job, if there is one. Environment Variables is the complete inventory, and Configuration Keys lists every key.
Set a Variable¶
In your shell, for the programs you start from it:
$env:ALR_EMIT_COST_BASIS = "metered"
It holds for that PowerShell window and every program it starts, until you close the window or clear it:
Remove-Item Env:ALR_EMIT_COST_BASIS
export ALR_EMIT_COST_BASIS=metered
It holds for that shell and the programs it starts. For one command only, put it in front of the command:
ALR_EMIT_COST_BASIS=metered alr summary
Two kinds of process read OpenALR's variables, and each needs the variable in its own environment:
- Commands you type.
alr summary,alr plan, and the rest read the variables of the shell you type them in. - Hooks the harness runs. A harness starts its hooks with its own environment. Set these variables in the shell you start the harness from, or in the harness's own environment, before it starts. A running harness keeps the environment it started with.
In the lists below, "Set it in" says which of the two reads the variable.
Where Records Go¶
ALR_EMIT_SINK
: The record file itself, as a full path to a file. It wins over log_dir
and over every config layer.
- Default: unset. The record file is then `records.jsonl` in `log_dir`.
- Set it in: the shell (commands) and the harness's environment (hooks).
- Config key: none. `log_dir` names the folder instead.
ALR_LOG_DIR
: The folder of the record file records.jsonl. A leading ~ is expanded.
- Default: `~/.alr-emit`, so the record file is `~/.alr-emit/records.jsonl`
(on Windows, `%USERPROFILE%\.alr-emit\records.jsonl`).
- Set it in: the shell and the harness's environment.
- Config key: [`log_dir`](generated/config-keys.md#key-log-dir).
ALR_EMIT_HOME
: One folder that holds everything OpenALR keeps for itself: the record file,
session state, stored price books, and installer state. Your config file
stays where it was. ALR_EMIT_SINK and a configured log_dir still win
over the record file it moves.
- Default: unset. The record file is under `~/.alr-emit`, session state is
under `$XDG_STATE_HOME/openalr` (`~/.local/state/openalr` when
`XDG_STATE_HOME` is unset), and stored price books are in
`~/.alr-emit/prices`. Set, the session state is in
`$ALR_EMIT_HOME/state` and the price books are in
`$ALR_EMIT_HOME/prices`.
- Set it in: the shell and the harness's environment. Use the same value in
both, or the two will not find the same files.
- Config key: none.
ALR_TRANSMIT
: Whether records are forwarded. Nothing in this release transmits by this
setting, so the value is recorded and shown, and nothing is sent. Sending is
alr syslog send. It takes 1, true, yes, or
on, and 0, false, no, or off.
- Default: off.
- Set it in: the shell.
- Config key: [`transmit`](generated/config-keys.md#key-transmit). On the
managed profile the variable is ignored; the provisioned config decides.
ALR_DESTINATION
: Where forwarded records would go. Recorded and shown, never used to send.
- Default: empty.
- Set it in: the shell.
- Config key: [`destination`](generated/config-keys.md#key-destination).
On the managed profile the variable is ignored.
Prices and Costs¶
ALR_EMIT_PRICES_DIR
: The folder where alr prices update stores price books.
- Default: `prices` inside the OpenALR folder, which is `~/.alr-emit/prices`,
or `$ALR_EMIT_HOME/prices` when `ALR_EMIT_HOME` is set.
- Set it in: the shell.
- Config key: none.
ALR_EMIT_PRICES_URL
: The address alr prices update fetches the price book from. It must be an
https address, and the signature is the same address with .sig added.
--url wins over the variable.
- Default: `https://prices.openalr.org/prices/v2/latest.json.gz`.
- Set it in: the shell.
- Config key: none.
ALR_EMIT_COST_BASIS
: What a record's cost is: metered (money charged for the work) or
api-equivalent (a valuation at API list prices). A value that is neither
is ignored. A --cost-basis flag wins over the variable. alr plan
offers it as the first answer to its cost basis question.
- Default: unset. A record then leaves its cost basis unstated.
- Set it in: the harness's environment, for hooks. A session billed to an
API key is metered, so set `metered` before the harness starts.
- Config key: none.
ALR_EMIT_COST_ALLOCATION
: Claude Code only. With no per-turn cost of its own, a session's cost is
shared over its turns, weighted by tokens, when the session ends. Set this
to off, 0, or no to keep the cost on the session record alone.
- Default: unset, so the cost is shared.
- Set it in: the harness's environment, for hooks.
- Config key: none.
Who Paid¶
These four label who paid for the work. Set them in your own config, never in a repository.
ALR_PROVIDER
: Who billed the work. It overrides what the harness reported.
- Default: empty, so the provider comes from the harness, or is left out.
- Set it in: the harness's environment.
- Config key: [`provider`](generated/config-keys.md#key-provider).
ALR_CREDENTIAL_LABEL, ALR_CREDENTIAL_KIND, ALR_CREDENTIAL_ID
: The label, kind, and identifier of the credential that paid. The credential
is written to a record only when a label or an id is set.
- Default: empty.
- Set it in: the harness's environment.
- Config keys: [`credential_label`](generated/config-keys.md#key-credential-label),
[`credential_kind`](generated/config-keys.md#key-credential-kind), and
[`credential_id`](generated/config-keys.md#key-credential-id).
Agent Identity and Principal¶
ALR_EMIT_AGENT_ID
: The agent id on each record. A --agent-id flag wins over the variable.
Give a tag hook the same id as its emitter, so its events join its records.
- Default: your login name (`unknown` if none can be found).
- Set it in: the harness's environment, for hooks and emitters.
- Config key: none.
ALR_PRINCIPAL
: Who issues a plan or accepts a task, for alr plan, alr plan new,
alr plan revise, and alr accept. A --by flag wins over the variable.
It changes nothing about a record's agent.
- Default: none. It is never taken from your login name. Without `--by` or
this variable, the command refuses, and `alr plan` alone asks.
- Set it in: the shell.
- Config key: none.
ALR_TAGGER
: Who tags, for alr tag. A --by flag wins over the variable.
- Default: your login name.
- Set it in: the shell.
- Config key: none.
ALR_GRADER
: Who grades, for alr grade. A --grader flag wins over the variable.
- Default: your login name.
- Set it in: the shell.
- Config key: none.
ALR_EMIT_HARNESS_VERSION
: The Grok Build version written on each record. Grok Build's session files
do not carry it. A --harness-version flag wins over the variable.
- Default: unset, so the version is left out.
- Set it in: the harness's environment.
- Config key: none.
Tags, Lists, and Task Class¶
ALR_TAGS
: Tags added to every record, separated by commas or spaces. It sits above a
project's default_tags and below the session's own tags.
- Default: unset.
- Set it in: the harness's environment. On headless Grok Build and the
Anthropic SDK this, or a `.alr-tags` file in the project directory, is
how you tag.
- Config key: `default_tags` sets the same layer from a file; it has no
variable of its own.
ALR_TASK_CLASS
: How a record's work is classed. It takes lowercase letters, digits, and
. _ : -, from 1 to 64 characters, starting with a letter or digit. Any
other value is refused and listed.
- Default: `interactive`.
- Set it in: the harness's environment.
- Config key: [`task_class`](generated/config-keys.md#key-task-class).
ALR_PROJECTS, ALR_CLIENTS, ALR_COST_CENTERS
: The paths of your project list (alr-projects.csv), client list
(alr-clients.csv), and cost center list (alr-cost-centers.csv). The
--projects, --clients, and --cost-centers flags win over them. A path
that does not name a file is an error.
- Default: unset. The file is then looked for in the OpenALR folder
(`~/.alr-emit`, or `ALR_EMIT_HOME`), and a missing file there is not an
error.
- Set it in: the shell.
- Config key: none. The lists in the `clients` and `cost_centers` keys are
separate from these files.
Your Project and Plan File¶
ALR_PROJECT
: Your project's code. It is the default project: tag, and the default
--project of alr plan, alr ev, and alr accept. alr plan offers it
as its first answer.
- Default: empty.
- Set it in: the shell, or the harness's environment for the tag.
- Config key: [`project`](generated/config-keys.md#key-project). A
repository's `.alr/config.toml` may set it too.
ALR_PLAN_FILE
: The project's plan file, which alr plan new --from reads and alr plan
saves. It is a path relative to the repository root that never leaves the
repository, and it needs a repository root to resolve.
- Default: empty. Then `--from` is required, and `alr plan` offers
`plan.json`.
- Set it in: the shell.
- Config key: [`plan_file`](generated/config-keys.md#key-plan-file). A
repository's `.alr/config.toml` may set it too.
The Project Directory¶
ALR_EMIT_PROJECT_DIR
: Hermes only. The directory whose .alr/config.toml and tags apply, when the
Hermes session gives none of its own. A session's own directory wins.
- Default: unset. With neither, the project layer is skipped, and a
one-line note says why.
- Set it in: the environment of the Hermes gateway.
- Config key: none.
Locks and Timing¶
ALR_EMIT_LOCK_TIMEOUT_S
: Claude Code only. How many seconds a hook waits for the record file's lock.
A value that is not a number of zero or more falls back to the default.
alr-emit-claude backfill waits without a limit.
- Default: 10 seconds.
- Set it in: the harness's environment.
- Config key: none.
ALR_EMIT_SETTLE_S
: Claude Code only. How many seconds a Stop hook waits for its turn's last
transcript line. 0 turns the wait off. A value that is not a number of
zero or more falls back to the default.
- Default: 3 seconds.
- Set it in: the harness's environment.
- Config key: none.
ALR_EMIT_HERMES_TURN_TTL_S
: Hermes only. Idle seconds after which an open turn is written as an
orphan. 0 or less turns the flush off. A value that is not a number falls
back to the default.
- Default: 3600 seconds.
- Set it in: the environment of the Hermes gateway.
- Config key: none.
Diagnostics¶
These are not OpenALR's own settings. alr otel and alr check read them to
tell you where something differs.
CLAUDE_CONFIG_DIR
: Claude Code's settings folder. When it is set, alr otel start,
alr otel stop, and alr otel status use $CLAUDE_CONFIG_DIR/settings.json.
alr install claude-code still writes its hooks under ~/.claude, and
alr otel status says so.
- Default: unset, so the settings file is `~/.claude/settings.json`.
- Set it in: the shell you run `alr otel` from, and the shell you start
Claude Code from, the same value in both.
CLAUDE_CODE_ENABLE_TELEMETRY and the OTEL_* variables
: Claude Code's telemetry settings. alr otel status names each one set in
your shell that differs from the settings file. It never prints a value.
TZ
: The time zone OpenALR names beside local times. With it unset, OpenALR uses the
system's own zone, and --tz utc shows UTC.
Variables You Cannot Set¶
These are the names of config keys that only your own user config may set. A
variable of the same name is read only to refuse it: the command says
refused (provisioned config only) and uses your config or the default.
Put the key in config.toml instead.
| Variable | Config Key |
|---|---|
ALR_PROFILE |
profile |
ALR_REPO_SETTINGS |
repo_settings |
ALR_TAG_CHECKS |
tag_checks |
ALR_WORK_TYPES |
work_types |
ALR_RECORD_FILE_MODE |
record_file_mode |
ALR_LOCAL_RATES |
local_rates |
ALR_PROJECT_RATES_PAID |
project_rates_paid |
ALR_RATES_FILE |
rates_file |
ALR_RATES_SHA256 |
rates_sha256 |
ALR_PRICE_BOOK_KEYS |
price_book_keys |
Each key is described in Configuration Keys, and Configuration says why they are yours alone.
Variables a Harness Sets¶
OpenALR reads these to follow the harness. You do not set them for OpenALR.
GROK_HOOK_EVENT and GROK_SESSION_ID
: Grok Build sets them for its hooks. OpenALR reads them only when the hook's
own payload lacks the event name or the session id.
CLAUDE_CODE_USE_BEDROCK and CLAUDE_CODE_USE_VERTEX
: You set one for Claude Code to bill through Amazon Bedrock or Google Vertex
AI. OpenALR reads them to fill a record's provider. A value of 1, true,
yes, or on counts. With none set, the provider is anthropic. With two
set, or with any other variable that starts CLAUDE_CODE_USE_, the provider
is unknown and left out. The provider key overrides all of this.
GROK_HOME
: Grok Build's own folder. OpenALR reads Grok Build's session files from it.
Default ~/.grok. alr install grok only notes it when it differs from
the folder it installs into; pass --home to install there.
HERMES_HOME
: Hermes's own folder. alr install hermes only notes it when it differs from
the folder it installs into; pass --hermes-home to install there.
Standard System Variables¶
OpenALR reads these as any program does.
HOME, thenUSERPROFILE(Windows), name your home folder. With both unset, the operating system's own home is used.XDG_CONFIG_HOMEmoves your config file to$XDG_CONFIG_HOME/openalr/config.toml. Default:~/.config/openalr/config.toml(on Windows,%USERPROFILE%\.config\openalr\config.toml).XDG_STATE_HOMEmoves session state to$XDG_STATE_HOME/openalr. Default:~/.local/state/openalr.ALR_EMIT_HOMEwins over it.LOCALAPPDATA(Windows) locates Hermes's default folder,%LOCALAPPDATA%\hermes.PATHis searched for thehermesprogram.
Internal Variables¶
OpenALR sets a few variables for its own use when it checks a Hermes install,
and a few exist only for its own tests. They are not for you to set, and they
are not a supported interface. ALR_EMIT_PROBE_PLUGIN is one of them.