Skip to content

Environment variables

Single source of truth for documented public and operator-facing environment variables APM reads. Variables are grouped by purpose. Unless noted, scope is process (the running apm invocation and any child processes it spawns); a small number toggle behaviour for the entire shell session.

For CLI flags that pair with these variables, see the reference index. For token policy and supply-chain guidance, see Security model.

PAT / bearer credentials APM reads when cloning packages, calling host APIs, or wiring secrets into agent runtimes. Treat every value here as a secret: never commit, never log, never echo. See Authentication for the resolution chain and Security model for token scoping.

VariablePurposeDefaultNotes
GITHUB_APM_PATFine-grained PAT for APM module access on GitHub-class hosts (github.com, GHE Cloud, GHES). First in the GitHub modules precedence chain.unsetHighest precedence for module clones. Also re-exported into Copilot / Codex runtimes.
GITHUB_APM_PAT_<ORG>Per-org PAT override for github.com / GHE Cloud / GHES. <ORG> is the org name uppercased with non-alphanumeric chars replaced by _.unsetWins over GITHUB_APM_PAT when the package owner matches <ORG>.
GITHUB_TOKENStandard GitHub token. Falls back when GITHUB_APM_PAT is unset. Also forwarded to Codex.unsetUsed by modules, copilot, and models purposes.
GH_TOKENgh CLI token. Last in the GitHub modules chain before gh auth token and credential helpers.unsetForwarded to the Copilot runtime.
GITHUB_COPILOT_PATFirst-choice token for the Copilot runtime.unsetOnly consulted by the copilot purpose.
GITHUB_PERSONAL_ACCESS_TOKENForwarded to the Copilot runtime when present.unsetNot part of the modules resolution chain.
APM_STRICT_HOST_CREDENTIALSSet to 1 (or true/yes/on) to send GITHUB_APM_PAT_<ORG>, GITHUB_APM_PAT, GITHUB_TOKEN and GH_TOKEN only to the configured host (GITHUB_HOST, else github.com); other github.com / *.ghe.com hosts use gh auth token or a credential helper run without those variables.unsetUnrecognised values turn strict mode on and print a warning. See Authentication.
GITHUB_HOSTGHES / GHE Cloud hostname (e.g. ghe.example.com). Switches host classification, transport selection, and auth chain.github.comProcess-wide; affects clone URLs and host detection.
GITLAB_APM_PATAPM module access on GitLab SaaS or self-managed. First in the gitlab_modules chain.unset
GITLAB_TOKENGitLab fallback token.unset
GITLAB_HOSTSingle self-managed GitLab hostname (e.g. gitlab.example.com).unsetRecognised as GitLab-class for transport / auth.
APM_GITLAB_HOSTSComma-separated list of additional GitLab hostnames to classify as GitLab-class.unsetUse when you operate multiple GitLab instances.
ADO_APM_PATAzure DevOps PAT for ado_modules.unsetAzure DevOps Services falls back to AAD bearer via az, then path-scoped git credential fill. Azure DevOps Server uses the PAT then fill; it does not use az.
ADO_HOSTSingle on-prem Azure DevOps Server FQDN (e.g. ado.company.com). Registers the host as ADO-class for auth and API routing.unsetHostname only: no scheme, port, or path. Takes precedence over an overlapping GITHUB_HOST.
APM_ADO_HOSTSComma-separated list of on-prem ADO Server FQDNs, all classified as ADO-class.unsetEntries are trimmed and matched case-insensitively; use for multiple Server instances.
ARTIFACTORY_APM_TOKENJFrog Artifactory token for artifactory_modules.unsetDeprecated alias of PROXY_REGISTRY_TOKEN; sent only to the PROXY_REGISTRY_URL (or ARTIFACTORY_BASE_URL) origin; ignored with a warning when no proxy URL is set.
GIT_SSH_COMMANDStandard git SSH command override. APM reads it before composing its own SSH env.unsetIf you set it, APM preserves your value.
APM_GIT_CREDENTIAL_TIMEOUTSeconds to wait for a git credential fill response.60Integer-like string, clamped to 1-180; invalid values are ignored.

Controls how APM clones packages and enumerates refs on Git hosts: APM_GIT_PROTOCOL and APM_ALLOW_PROTOCOL_FALLBACK select the transport scheme, while APM_GITHUB_AUTH_FIRST changes credential order for exact-host github.com without affecting transport. These settings can also be persisted via apm config set to avoid repeating flags or environment-variable exports.

VariablePurposeDefaultNotes
APM_GIT_PROTOCOLPreferred Git protocol for cloning and ref enumeration on shorthand (owner/repo) dependencies. Accepted values: ssh, https (http is accepted as an alias for https).unsetEquivalent to --ssh / --https flag. Resolution: CLI flag → env var → prefer_ssh in ~/.apm/config.json (set with apm config set prefer-ssh) → git insteadOf rules → HTTPS.
APM_ALLOW_PROTOCOL_FALLBACKSet to 1 (or true/yes/on) to enable the legacy cross-protocol fallback chain. When enabled, a failed clone is retried with the opposite protocol.unsetEquivalent to --allow-protocol-fallback. Resolution: CLI flag → env var → allow_protocol_fallback in ~/.apm/config.json (set with apm config set allow-protocol-fallback) → false.
APM_GITHUB_AUTH_FIRSTSet to 1 (or true/yes/on) to skip the initial anonymous HTTPS attempt for exact-host github.com when a credential resolves.unsetEquivalent to --auth-first. Resolution: CLI flag, then env var, then github_auth_first in ~/.apm/config.json (set with apm config set github-auth-first), then false. See Authentication.

APM verifies package-management HTTPS against the operating-system trust store by default, with bundled certifi as the Requests fallback. See SSL / TLS issues for the full troubleshooting flow.

VariablePurposeDefaultNotes
REQUESTS_CA_BUNDLEPEM bundle replacing APM’s normal Requests trust.unsetWins over CURL_CA_BUNDLE, additive trust, and OS injection.
CURL_CA_BUNDLEReplacement PEM bundle honored by Requests.unsetUsed when REQUESTS_CA_BUNDLE is unset; suppresses additive trust and OS injection.
APM_DISABLE_TRUSTSTORESet to 1 (or true/yes/on) to disable OS/additive trust.unsetRestores bundled certifi unless an explicit Requests/curl replacement is set.
APM_EXTRA_CA_BUNDLECertificate-only PEM bundle added to APM package-management HTTPS.unsetRetains OS roots, or certifi roots on Requests fallback. Invalid selected input fails closed: it must be a readable, non-empty regular file, no larger than 8 MiB, containing ASCII PEM certificates and no private keys.

Trust resolution is ordered: REQUESTS_CA_BUNDLE, CURL_CA_BUNDLE, APM_DISABLE_TRUSTSTORE, APM_EXTRA_CA_BUNDLE, then the normal OS/certifi defaults. Higher-precedence controls suppress additive-bundle validation. Unset or blank APM_EXTRA_CA_BUNDLE preserves existing behavior.

The additive setting does not derive trust settings for apm run children or configure Git, Node, or Rust. Those retain their existing settings; see runtime coverage. For isolated Git attempts to GitHub hosts (github.com, GHE Cloud *.ghe.com and GitHub Enterprise Server), APM inherits your Git http.sslBackend, http.sslCAInfo, and http.sslCAPath; see Authentication.

VariablePurposeDefaultNotes
MCP_REGISTRY_URLOverride the MCP registry endpoint used by apm mcp, apm install --mcp NAME, and manifest-driven dependencies.mcp installs. HTTPS by default; HTTP requires MCP_REGISTRY_ALLOW_HTTP=1.public registryWhen set, registry commands print Registry: <url> (from MCP_REGISTRY_URL) and installs print Using MCP registry: <url> (from MCP_REGISTRY_URL). See apm mcp.
MCP_REGISTRY_ALLOW_HTTPSet to 1 to permit a plaintext http:// MCP_REGISTRY_URL (development only).unsetRequired to opt in to HTTP; production should always use HTTPS.
MCP_REGISTRY_CONNECT_TIMEOUTConnect timeout for registry HTTP calls, in seconds (float).implementation defaultNon-positive / non-numeric values are ignored.
MCP_REGISTRY_READ_TIMEOUTRead timeout for registry HTTP calls, in seconds (float).implementation defaultNon-positive / non-numeric values are ignored.
PROXY_REGISTRY_URLEnterprise package proxy base URL. See Registry proxy.unsetWhen set, APM resolves package downloads through the proxy.
PROXY_REGISTRY_TOKENBearer token for PROXY_REGISTRY_URL.unsetRequired for authenticated proxies.
PROXY_REGISTRY_ALLOW_HTTPSet to 1 to authorize sending PROXY_REGISTRY_TOKEN over http:// to a host that is not loopback or a private network address.unsetWithout it, the token is sent over http:// only to loopback or private network hosts. Use only for a trusted internal proxy.
PROXY_REGISTRY_ONLYSet to 1 to refuse any dependency content not served by the proxy, including marketplace catalogs and lookups in the default MCP registry. Policy fetches and apm self-update stay direct; the automatic update check is skipped.unsetAir-gapped deployments.
APM_REGISTRY_TOKEN_<NAME>Bearer token for configured package registry <NAME>.unset<NAME> is the registry name uppercased, with - and . replaced by _.
APM_REGISTRY_USER_<NAME> / APM_REGISTRY_PASS_<NAME>Basic-auth credentials for configured package registry <NAME>.unsetUsed when a bearer token is not supplied.
APM_MARKETPLACE_TOKEN_<NAME>Bearer token for a hosted marketplace.json registered with apm marketplace add URL --name <NAME>.unset<NAME> normalized like registry names. Sent only within the registered URL’s scope; never to packages. See Private hosted catalogs.
APM_MARKETPLACE_USER_<NAME> / APM_MARKETPLACE_PASS_<NAME>Basic-auth credentials for that hosted catalog.unsetUsed when no bearer token is set.
ARTIFACTORY_BASE_URLLegacy alias for PROXY_REGISTRY_URL.unsetPrefer PROXY_REGISTRY_URL in new setups.
ARTIFACTORY_ONLYLegacy alias for PROXY_REGISTRY_ONLY.unsetPrefer PROXY_REGISTRY_ONLY.
ARTIFACTORY_MAX_ARCHIVE_MBMaximum archive size accepted from Artifactory, in MB.500Integer-like string.
VariablePurposeDefaultNotes
APM_CACHE_DIROverride the APM cache root.platform default (XDG / LOCALAPPDATA)Must be writable. Do not share or restore the cache across trust boundaries. See apm cache.
APM_NO_CACHE1/true/yes disables read and write of the cache for the current invocation.unsetEquivalent to --no-cache on commands that support it.
APM_TEMP_DIROverride the temp directory used by clone and download operations.system defaultUseful on Windows when endpoint security blocks %TEMP%. Resolution: env var > temp_dir in ~/.apm/config.json > system default.
APM_HOMEOverride the root for APM-owned user metadata and configuration.~/.apmMust be writable. Does not redirect files deployed to agent targets.
APM_INSTALL_FAST_PATH0/false/no/off turns off the locked-install fast path, so a bare apm install or apm install --frozen always runs the full pipeline. trace prints one stderr line saying whether the fast path applied or why it ran the full pipeline.unset (fast path on)The fast path applies only when the lockfile, the caches and the live policy prove the full pipeline would produce the same files; any doubt runs the full pipeline.
APM_AUDIT_RECORDS0 makes the apm audit drift replay re-integrate every package instead of serving byte-copy packages from the records the verifying install wrote.unset (records on)A record serves a package only when the lockfile, the current policy and the package’s own source bytes prove the same output; apm audit --ci prints how many packages it served.
APM_NO_REFLINKAny non-empty value disables copy-on-write (reflink) optimisation; APM falls back to plain copies.unsetDiagnostic / portability escape hatch.
APM_COPILOT_COWORK_SKILLS_DIROverride the destination directory for Copilot cowork skills.platform auto-detectResolution: env var > config > auto-detect.
APM_COPILOT_APP_DBOverride the path to the GitHub Copilot desktop App SQLite database used by the copilot-app target.platform auto-detectUseful for tests or non-standard Copilot installs. Resolution: env var > auto-detect.
COPILOT_HOMEOverride the GitHub Copilot CLI home for user-scope detection and writes: apm install -g instructions, agents, hooks, MCP config (mcp-config.json), LSP config (lsp-config.json), plugin settings, and skills with --legacy-skill-paths.~/.copilotSee harness home variables. Default skills stay in ~/.agents/skills/, which Copilot CLI also reads. The Copilot desktop app (copilot-app) and copilot-cowork targets ignore it; global canvas installs are refused when it is non-default.
CODEX_HOMEOverride the Codex home used for user-scope writes: apm compile --global (AGENTS.md) and apm install -g agents, hooks, and MCP config (config.toml).~/.codexSee harness home variables. Codex skills stay in ~/.agents/skills/. User-scope auto-detection checks the same directory ($CODEX_HOME when set, else ~/.codex/).
HERMES_HOMEOverride the Hermes home used by user-scope skills and MCP config.~/.hermesSee harness home variables. Used by the explicit hermes target; it does not enable auto-detection.
APM_BROAD_FETCH_DEPTHMaximum commit depth used by the bare-cache broad fetch when resolving git refs.50Integer-like string; tune for very deep histories where ref resolution misses.
XDG_CACHE_HOMEStandard XDG base-directory variable APM consults when APM_CACHE_DIR is unset (Linux / macOS).unsetHonoured per the XDG spec.
LOCALAPPDATAStandard Windows variable APM consults when APM_CACHE_DIR is unset.OS-providedUsed to derive the default Windows cache path.
CLAUDE_CONFIG_DIROverride the user-scope destination Claude reads for skills, agents, LSP plugin, and MCP config.~/.claudeSee harness home variables. User-scope MCP servers are managed in $CLAUDE_CONFIG_DIR/.claude.json (including installation and stale cleanup); when unset or blank, APM uses ~/.claude.json.

COPILOT_HOME, CODEX_HOME, CLAUDE_CONFIG_DIR and HERMES_HOME follow one rule for user-scope (-g) commands:

  • Unset or blank: the harness default (~/.copilot, ~/.codex, ~/.claude, ~/.hermes).
  • Absolute path (~ is expanded): that directory, inside or outside your home.
  • Relative path: rejected with an error naming the variable. APM never resolves it against the current directory.

Each value is a separate profile of the same harness. Profiles share one user lockfile; a global install or uninstall changes files only under the selected profile. Files written to another profile, such as ~/.copilot before you set COPILOT_HOME, stay in place.

APM_HOME is the single root for APM-owned user metadata. When it is unset or empty, the root is ~/.apm. When set, global commands and lifecycle processing use the same overridden root:

StatePath
User manifest$APM_HOME/apm.yml
User lockfile$APM_HOME/apm.lock.yaml
Installed package metadata and content$APM_HOME/apm_modules/
User configuration$APM_HOME/config.json
Marketplace registrations$APM_HOME/marketplaces.json
Marketplace cache and version pins$APM_HOME/cache/marketplace/
Lifecycle trust$APM_HOME/scripts-trust.json
Lifecycle logs$APM_HOME/logs/
Lifecycle lock and deployment receipts$APM_HOME/.apm-lifecycle.lock, $APM_HOME/deployment-receipts/

This applies to user-scope operations such as apm install --global, apm update --global, apm uninstall --global, apm lock --global, apm deps ... --global, apm compile --global, apm marketplace, apm lifecycle, and apm config. apm prune is project-scope only. Other pages write ~/.apm for the default location.

A leading ~ is expanded, and a relative APM_HOME resolves against the directory APM started in, so commands that change directory keep using the same root. If that directory no longer exists, APM exits with an error; set an absolute APM_HOME instead. Changing APM_HOME does not move an existing ~/.apm; copy the files yourself if you want to keep them.

These paths are outside the contract:

  • The download cache follows APM_CACHE_DIR (see above); the update-check timestamp stays in the operating-system cache directory.
  • Runtimes installed by apm runtime setup stay under ~/.apm/runtimes/.
  • apm install --global keeps its installation identity at ~/.apm-local/, beside the deployment root, like deployed target files.
  • State-changing commands also hold ~/.apm-local/.apm-lifecycle.lock, so commands run with different APM_HOME values wait for each other instead of racing on the same project or target directories.

APM_HOME does not redirect target deployment. Precedence:

  1. APM metadata: APM_HOME, then ~/.apm.
  2. Target files: the target’s own home variable when it has one (for example CLAUDE_CONFIG_DIR, CODEX_HOME, COPILOT_HOME, or HERMES_HOME), then the operating-system home.

The two families never fall back to each other: a target variable does not move APM metadata, and APM_HOME does not move target files.

To isolate APM metadata for a temporary global install:

Terminal window
export APM_HOME="$(mktemp -d)/apm"
apm install --global example-org/example-package

The manifest, lockfile, modules, configuration, and lifecycle state remain under $APM_HOME; deployed target files still go to their normal user-scope destinations. For complete filesystem isolation, also run with an isolated operating-system home and/or set the selected targets’ home variables.

VariablePurposeDefaultNotes
APM_POLICY_DISABLESet to 1 to skip policy discovery and enforcement for the entire shell session. Loudly logged.unsetEquivalent to the per-invocation --no-policy on commands that expose it. The only escape hatch for apm deps update. See apm policy.
APM_GITLAB_POLICY_REPOOverride the org policy project name auto-discovered on GitLab (gitlab.com and self-managed).apm-policyA single project-name segment only; no slash or leading . / _. GitLab rejects the GitHub-family candidate cascade (.github-private, .github, .apm, _apm). See Policy Files.

These keys are consumed by a third-party SARIF scanner (e.g. SkillSpector), not by APM itself. APM forwards them to the scanner subprocess only when LLM mode is active for that run (apm audit --external <name> --external-llm or external.<name>.llm true); otherwise they are stripped from the scanner’s environment. APM never stores them. Requires the external-scanners experimental flag.

VariablePurposeDefaultNotes
OPENAI_API_KEYAPI key SkillSpector uses for LLM-powered analysis.unsetForwarded only when LLM mode is active. If --external-llm is set and no key is present, the scan fails closed.
NVIDIA_INFERENCE_KEYAlternative API key SkillSpector accepts for LLM-powered analysis.unsetSame forwarding / fail-closed semantics as OPENAI_API_KEY.
VariablePurposeDefaultNotes
APM_DEBUGAny non-empty value enables low-level debug logging in download, file ops, and clone-cache paths.unsetVerbose; use for troubleshooting only.
APM_LOG_LEVELOverride the CLI logging level.implementation defaultDebugging escape hatch.
APM_VERBOSE1 enables verbose output for the install pipeline. APM also sets this internally when --verbose is passed.unset
APM_PROGRESSForce the install TUI on or off: always/on/1/true/yes to force on; never/quiet/off/0/false/no to force off; auto (default) lets APM decide based on CI, TERM, and TTY.autoThe CLI sets APM_PROGRESS=quiet when --quiet is passed.
CIStandard CI marker. When truthy (1/true/yes), APM disables the install TUI and adjusts a few interactive defaults.unsetRead; never written.
TERMStandard terminal type. "" or dumb disables the install TUI.OS-providedRead; never written.

These variables are documented with the command that reads them.

VariableRead bySee
GITHUB_URL, APM_REPO, VERSION, APM_RELEASE_METADATA_URL, APM_RELEASE_BASE_URL, APM_INSTALLER_BASE_URL, APM_PYPI_INDEX_URL, APM_NO_DIRECT_FALLBACKInstaller scripts and apm self-updateInstallation, apm self-update
SOURCE_DATE_EPOCHapm lock export (default SBOM timestamp) and apm pack --format agent-plugin (packed_at)apm lock

These variables exist in the codebase but are not part of the documented contract. Behaviour and naming may change without notice. Do not rely on them in production scripts.

VariablePurposeDefaultNotes
APM_RESOLVE_PARALLELTunes parallelism in the dependency resolver.implementation defaultSubject to change.
APM_TIERED_RESOLVERSet to 0/false/no/off to disable the tiered git-ref resolver (per-run cache + commits API + bare rev-parse + legacy clone) and force every install/update/outdated ref resolution through the legacy shallow-clone path. Emergency rollback for #1369.1 (on)Subject to change. Removal expected once the tiered stack has soaked through a release.
APM_LEGACY_SKILL_PATHSToggles legacy skill-path layout in integration targets.unsetCompatibility shim; will be removed.
APM_NO_SCRIPTSDisables all lifecycle scripts (install, update, uninstall, and compile).unsetInternal safety/test switch; prefer executable trust policy in production.
APM_NON_INTERACTIVEForces non-interactive behavior.unsetUsed by automation and tests.
APM_E2E_TESTSMarks the process as an end-to-end test run; relaxes some interactive guards.unsetTest harness only. Do not set in normal use.

Copyright (c) Microsoft Corporation. General documentation: CC-BY-4.0. Software, code examples and OpenAPM: Apache-2.0. See scope and exclusions.