Config

Environment Variables

IN THIS DOCUMENT

Crimson marks the heading currently in view; every entry is one of the document's own headings.

Aphrodite reads a set of APHRODITE_* environment variables (plus a few non-prefixed ones) across three surfaces: the Rust proxy, the aphrodite setup subcommand, and the Hermes-plugin dylib session.

This page lists every variable with a live reader, what precedence applies, and what it gates.

Variables with no reader anywhere are listed at the bottom under “Documented but currently inactive” - setting those is a silent no-op.

Precedence rule: where it says “env > TOML > default”,

  • the env var wins if set and parses
  • otherwise the matching aphrodite.toml key wins if present
  • otherwise the compiled-in default applies.

A present-but-malformed value (e.g. APHRODITE_CCR_TTL=abc) is never silently treated as absent - it logs a warning and falls through to the next precedence level.

Boolean env vars share one truthiness rule everywhere: "1" / "true" (case-insensitive) is true; anything else present, or absent, is false.

Rust proxy - multi-proxy mode (aphrodite.toml present)

Resolution lives in the multi-proxy config resolver; per-proxy TOML values beat [defaults], and env beats both.

VariablePrecedenceDefault (no override)Effect
APHRODITE_API_KEYproxy.api_key → defaults.api_key → env(must resolve to something)Upstream API key; the proxy refuses to start if the chain resolves empty
APHRODITE_API_URLenv > TOML > defaulthttps://api.openai.comUpstream API base URL
APHRODITE_MODELenv > TOML > defaultdefault-modelModel name to forward
APHRODITE_CCR_TTLenv > TOML > default3600CCR entry time-to-live, seconds
APHRODITE_STORE_MAX_ENTRIESenv > [compression] > default100000 (0 = unlimited)Max live rows in the SQLite CCR store; past it the least-recently-accessed rows are evicted
APHRODITE_STORE_MAX_BYTESenv > [compression] > default536870912 (0 = unlimited)Max stored payload bytes (SUM(LENGTH(original))); past it LRU rows are evicted
APHRODITE_DBenv > TOML(none - proxy uses ~/.hermes/aphrodite/ccr.db)SQLite path for the token proxy
APHRODITE_NOTIFY_URLenv > TOML-Hermes callback URL for CCR-create notifications
APHRODITE_NOTIFY_KEYenv > TOML-Bearer token for the callback
APHRODITE_CACHE_PORToverrides the listen port on the proxy named/moded cache only9797Per-instance port override (e.g. multiple Hermes Agents on one machine)
APHRODITE_TOKEN_PORToverrides the listen port on the proxy named/moded token only9798Same, for the token proxy
APHRODITE_TOOL_THRESHOLD_CACHEenv > [compression] > const8192 bytes (shipped example: 2048)Cache-proxy compression threshold
APHRODITE_TOOL_THRESHOLD_TOKENenv > [compression] > const1024 bytes (shipped example: 256)Token-proxy compression threshold
APHRODITE_INLINE_THRESHOLDenv > [compression] > const256 bytes (shipped example: 1024)Inline-vs-durable CCR storage cutoff
APHRODITE_CODE_MULTIPLIERenv > [compression] > const3.0 (shipped example: 1.0)Multiplies the threshold for code_* content types
APHRODITE_AUTO_EXPANDenv > [compression] > constfalse (shipped example: true)Resolve the just-stored content inline instead of emitting a CCR marker, capped at auto_expand_limit bytes
APHRODITE_AUTO_EXPAND_LIMITenv > [compression] > const102400 bytesByte cap for auto-expanded content
APHRODITE_MAX_REQUEST_BODY_SIZEenv > [compression] > constnone (no cap)Proxy request-body cap in bytes; over-size bodies are rejected with 413 while being read (startup-only)

APHRODITE_MODE / APHRODITE_LISTEN are deliberately not honored in multi-proxy mode - a single process-wide value would incorrectly apply to every [[proxies]] entry at once and break the cache/token split.

Use per-proxy TOML mode / listen (or the two port vars above) instead; they work in CLI-fallback mode only.

The threshold/multiplier vars, plus auto_expand / auto_expand_limit, are also what POST /reload and the config-file watcher re-resolve and apply live to a running proxy.

max_request_body_size is the exception: it is resolved at startup only (a /reload echoes it but cannot change a live cap).

Rust proxy - either mode

VariableDefaultEffect
APHRODITE_CONFIG_PATH./aphrodite.toml, else ~/.hermes/aphrodite/aphrodite.toml, else CLI modeWhich config file to load; an explicit path that doesn’t exist falls through to CLI mode
APHRODITE_MGMT_TOKENunset (auth disabled - logs a startup warning)Gates the management routes (/stats, /stats/db, /history, /retrieve, /ccr/*, /reload, /tool/relay, /version, /health/upstream) via Authorization: Bearer <token>; /health and /metrics stay exempt, and the LLM-proxying /{*path} route is unaffected
APHRODITE_WORKER_THREADS4x CPU count (min 32)Tokio worker thread count
APHRODITE_LOG_COMPACToffCompact log format (no timestamps, no targets); also --log-compact in CLI mode
RUST_LOGinfoStandard Rust tracing filter (not APHRODITE_-prefixed)

Rust proxy - CLI-fallback mode only (no aphrodite.toml present)

The env-attributed CLI fields above (API_URL, MODEL, API_KEY, CCR_TTL, DB, NOTIFY_URL, NOTIFY_KEY, LOG_COMPACT) all work here via clap directly, PLUS:

VariableDefaultEffect
APHRODITE_MODEtokenProxy mode (cache / token)
APHRODITE_LISTEN127.0.0.1:9797Bind address

max_context, max_output, tool_relay, dev, timeout, and no_ccr_marker are flag-only in CLI mode - they have no env var.

aphrodite setup

The setup subcommand accepts these as flags or env vars (clap env attributes):

VariableDefaultEffect
APHRODITE_API_KEY-Upstream API key
APHRODITE_API_URL(empty)Upstream API base URL, written to config
APHRODITE_MODEL(empty)Model name, written to config
APHRODITE_CACHE_PORT9797Cache proxy port in the generated config
APHRODITE_TOKEN_PORT9798Token proxy port in the generated config

Hermes plugin / aphrodite-hermes dylib

The dylib initializes its session state from aphrodite.toml (searching ./aphrodite.toml then ~/.hermes/aphrodite/aphrodite.toml), with env vars on top - a separate resolution path from the Rust proxy above, feeding the Hermes hook/tool-dispatch session rather than the HTTP proxy.

The Python plugin reads a few vars of its own at registration time.

VariablePrecedenceDefaultEffect
APHRODITE_TOOL_THRESHOLD_TOKENenv > [compression] > default4096 bytes (dylib) / 1024 (proxy); shipped example 256Gates transform_tool_result compression (dylib 4096; the HTTP proxy’s token proxy defaults to 1024 - the two consumers differ)
APHRODITE_TERMINAL_THRESHOLDenv > [compression] > default1024 bytes (shipped example: 256)Gates transform_terminal_output compression
APHRODITE_ENGINE_THRESHOLD_PCTenv > [compression] > default45 (shipped example: 30)Context-engine fill-% gate: archives middle turns when the conversation index’s fill percent (total * 100 / 50) is at or above the threshold; 0 = never, 100+ = off. See Context Engine
APHRODITE_ENGINE_PROTECT_FIRSTenv > [compression] > default2Turns kept at the start of the index when the context engine archives middle turns
APHRODITE_ENGINE_PROTECT_LASTenv > [compression] > default5Turns kept at the end of the index when the context engine archives middle turns
APHRODITE_ENGINE_MIN_MSGSenv > [compression] > default8Minimum archived turns before the context engine may archive
APHRODITE_LIVE_CONTAINERenv > [compression] > defaultfalseInstant CCR markers with the live type: progressive retrieval with bytes-so-far / ETA progress
APHRODITE_RECURSIVE_DEPTHenv > [compression] > default5Nested marker expansion cap (how deep aphrodite_retrieve expands markers inside markers)
APHRODITE_AUTO_EXPANDenv > [compression] > defaultfalse (shipped example: true)Resolve stored content inline instead of emitting a CCR marker (capped at auto_expand_limit); also renders the [auto-expand: ...] guidance line
APHRODITE_AUTO_EXPAND_LIMITenv > [compression] > default102400 bytesByte cap for auto-expanded content
APHRODITE_AUTO_RELOADenv > [compression] > defaultfalse (shipped example: true)Watch aphrodite.toml and re-apply config fields on change (session CCR state is never touched)
APHRODITE_CONTEXT_ENGINE"1" / "true" enablesoffTwo independent live effects: (1) plugin registers a Hermes ContextEngine subclass only when set; (2) the dylib session’s context_engine_enabled status flag (env > TOML compression.context_engine > default true)
APHRODITE_RETRIEVE_GUIDANCEenv > [prompts] > default"minimal""minimal" | "standard" | "verbose" - how much guidance the per-turn assembler renders about CCR retrieval ([retrieval: ...] line)
APHRODITE_CCR_MARKER_HINTenv > [prompts] > defaultfalseAppend a retrieval hint after markers (fills the marker template’s {hint}); process-global, re-applied by /reload
APHRODITE_CATALOG_INTENT_HINTSenv > [prompts] > defaultfalseShow intent hints alongside hashes in catalog output
APHRODITE_PREVIEW_MAX_CHARSenv > [previews] > defaultunlimited (0 = no cap; shipped example 0)Caps the rendered preview string, enforced on every preview path
APHRODITE_FLOW_BUDGET_CHARSenv > [flow] > default4000 (shipped example 2600)Hard cap on ALL per-turn injected context (directives + nudges + recall catalog + retrieve hint)
APHRODITE_POLL_WORKERenv > [compression] > defaulttrueAuto-backgrounds slow terminal / process calls (pre-tool-call rewrite)
APHRODITE_CHAIN_SPLITenv > [compression] > defaultfalse (opt-in)Fine-grained command splitting: rewrites chained commands with segment markers, splits output per segment
APHRODITE_CHAIN_SPLIT_MIN_SEGMENTSenv > [compression] > default2Floor for the adaptive split threshold
APHRODITE_CHAIN_SPLIT_MAX_SEGMENTSenv > [compression] > default6Cap for the adaptive split threshold
APHRODITE_SESSION_INJECTenv > [prompts] > defaultshipped builtinFirst-turn orientation text injected on turn 0; empty string disables it
APHRODITE_DIRECTIVES_DIRexact directory (first candidate)-Directives directory override; checked before ./directives/, ~/.hermes/aphrodite/directives/, binary-relative
APHRODITE_HOMEwhole runtime home override$HERMES_HOME/aphrodite (else ~/.hermes/aphrodite)THE single runtime-home decision (issue 40): every artifact (binaries/, aphrodite.toml, ccr.db, directives/, logs) resolves under it for BOTH halves - the shim exports its own resolution here, and the Rust binary/proxy/dylib honor it; never second-guessed
APHRODITE_HERMES_DYLIB_PATHoverrides the dylib search path~/.hermes/aphrodite/binaries/<name>Which dylib the plugin loads
APHRODITE_BINARY_PATHoverrides the proxy binary path~/.hermes/aphrodite/binaries/aphroditeWhich proxy binary the plugin launches
APHRODITE_NO_AUTO_LAUNCH"1" / "true" skips auto-launchoffStops the plugin from launching the proxy on registration
APHRODITE_AUTO_DOWNLOAD"1" / "true" enablesoffLegacy opt-in: lets register() fetch missing binaries via download.sh (default is explicit-setup-only; PR 118488)
HERMES_HOMEbase home for the plugin~/.hermesHermes home: runtime home base ($HERMES_HOME/aphrodite), Hermes-owned plugin dir ($HERMES_HOME/plugins); read by __init__.py, layout_check.py, download.sh, and the Rust binary/dylib (issue 40 - one decision, both halves)
BINARY_DIRdownload destination${HERMES_HOME:-$HOME/.hermes}/aphrodite/binariesWhere download.sh writes the verified binary + dylib (also set by __init__.py when it runs the legacy auto-fetch)
REPOrelease repositoryPlayForm/AphroditeWhich GitHub repo download.sh fetches release assets from
APHRODITE_CACHE_PORT / APHRODITE_TOKEN_PORTsame as the Rust proxy table above9797 / 9798Proxy health-poll and the dylib’s own port resolution; malformed values warn and fall back

The plugin exports APHRODITE_HOME (its resolved runtime home - the single decision, so the dylib and the spawned proxy binary agree) and APHRODITE_DIRECTIVES_DIR (pointing at <runtime-home>/directives) into the environment it manages.

The startup log prints the resolved home and its source (runtime home: <path> (decided by ...)); on an upgrade the pre-2.2 ~/.hermes/aphrodite home is adopted (with a warning) when it holds the existing install and the Hermes-home-derived one does not.

Documented but currently inactive

These names appear in older docs or scripts but have no reader anywhere in this codebase as of this writing - setting them is a silent no-op.

Do not document them alongside the live vars above without this caveat; if one gets wired up, move its row into the tables above.

APHRODITE_DEBUG, APHRODITE_PASSTHROUGH, HERMES_DEV, APHRODITE_RECENT_MARKERS_MAX, APHRODITE_CATALOG (catalog mode is TOML-only, compression.catalog_mode, with no env override), APHRODITE_TOOL_THRESHOLD (no _TOKEN / _CACHE suffix - superseded by the two suffixed vars above), HEADROOM_SSE_BUFFER_MAX_BYTES (read only by the vendored headroom Python package this repo’s binaries don’t run).

Build-time metadata

APHRODITE_VERSION, APHRODITE_GIT_HASH, APHRODITE_PROFILE, APHRODITE_BUILD_DATE, and APHRODITE_TARGET are embedded at compile time and reported by --version and the root / endpoint.

They are read during the build, not at runtime - exporting them has no effect on a running proxy.

APHRODITE_SKIP_FFI_GEN ("1" / "true") is also build-time only: it skips the cbindgen+ctypesgen regeneration in crates/aphrodite-hermes/build.rs.