Config

aphrodite.toml

IN THIS DOCUMENT

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

Aphrodite’s proxy listeners and compression engine are configured through a single TOML file.

This page documents every section, field, precedence rule, and validation check; the companion page Environment Variables lists every env var that overrides a value here.

This file is Aphrodite’s own proxy/engine config - a different file from Hermes Agent’s config.yaml.

See Troubleshooting: two separate config files if you came here looking for Hermes-side keys like plugins.enabled or context.engine.

File location

Defaultaphrodite.toml in the current working directory
Fallback (default path only)~/.hermes/aphrodite/aphrodite.toml - where aphrodite setup writes its generated config
OverrideAPHRODITE_CONFIG_PATH environment variable
If missingFalls back to CLI-flag mode (single proxy, see CLI equivalents)

The ~/.hermes/aphrodite/aphrodite.toml fallback only applies when APHRODITE_CONFIG_PATH was not explicitly set - an explicit override that points at a nonexistent file still falls through to CLI-flag mode rather than silently redirecting elsewhere.

aphrodite setup writes its generated config (with {cache_port} / {token_port} placeholders substituted) from the same embedded template that ships as aphrodite.toml.example in the repo root.

Precedence

For every field except the two noted below, the resolution order is env var → TOML (proxy entry → [defaults]) → compiled-in default:

  • an env var wins if set and parses
  • otherwise the proxy entry’s value wins
  • otherwise [defaults]
  • otherwise the default compiled into the binary.

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

Two exceptions:

  • api_key: TOML comes first (proxy.api_key → defaults.api_key → APHRODITE_API_KEY), because the explicit config is the primary way to set per-proxy keys. See API key resolution.
  • mode and listen: TOML-only per [[proxies]] entry - a single process-wide APHRODITE_MODE / APHRODITE_LISTEN would incorrectly apply to every proxy at once. The two port-specific overrides below are the only env influence on listen.

CLI flags apply only in CLI-fallback mode (no aphrodite.toml present at all) - see CLI equivalents.

Full schema

[defaults]
# Shared defaults applied to every [[proxies]] entry that doesn't override them.
ccr_ttl_seconds = 3600

[[proxies]]
name = "cache"
listen = "127.0.0.1:9797"
mode = "cache"
tool_relay = true
timeout = 120

[[proxies]]
name = "token"
listen = "127.0.0.1:9798"
mode = "token"
tool_relay = true
timeout = 300

[compression]
engine_threshold_pct = 30        # context-engine fill-% gate (dylib session); 0 = never, 100+ = off
engine_protect_first = 2         # context engine: turns kept at the start of the index
engine_protect_last = 5          # context engine: turns kept at the end of the index
engine_min_msgs = 8              # context engine: minimum archived turns before archiving
tool_threshold_token = 256       # token-proxy compression threshold, bytes
tool_threshold_cache = 2048      # cache-proxy compression threshold, bytes
terminal_threshold = 256         # terminal-output threshold, bytes (dylib)
inline_threshold = 1024          # inline-vs-durable CCR cutoff, bytes
code_multiplier = 1.0            # multiplies threshold for code_* types
auto_expand = true               # resolve stored content inline instead of a marker (byte-capped)
auto_expand_limit = 102400       # byte cap for auto-expanded content
live_container = false           # instant CCR markers with the 'live' type (dylib)
recursive_depth = 5              # nested marker expansion cap (dylib)
# max_request_body_size = 100000 # optional proxy request-body cap, bytes; absent = no cap
auto_reload = true               # watch aphrodite.toml and re-apply config on change (dylib)
chain_split = false              # opt-in fine-grained command splitting

[previews]
preview_max_chars = 0            # cap on rendered preview strings; 0 = unlimited
model_family = "code_first"      # selects the [templates.preview.<family>.*] family

[prompts]
session_inject = "..."           # first-turn orientation text; "" disables
retrieve_guidance = "minimal"    # "minimal" | "standard" | "verbose" - retrieval guidance line
ccr_marker_hint = false          # append a retrieval hint after markers
catalog_intent_hints = false     # intent hints in catalog output

[directives]
active = ["lazy", "lazy-eval", "foresight"]

[flow]
budget_chars = 2600              # hard cap on per-turn injected context (dylib)

The root aphrodite.toml.example ships the full annotated version, including the [templates.*] blocks.

The schema is not strict: unknown keys parse and are ignored, and every section above is optional.

[[proxies]] fields

FieldMeaningDefault
nameProxy label, also used for port-override matchinglisten address
listenBind address (loopback-only unless changed - see below)127.0.0.1:9797
mode"cache" or "token" - backend + compression threshold (see Modes)"token"
api_keyUpstream API key, overrides [defaults]-
api_urlUpstream API base URL, overrides [defaults]-
modelModel name to forward, overrides [defaults]-
tool_relayEnable the /tool/relay endpointfalse
devVerbose request/response loggingfalse
ccr_ttl_secondsCCR entry time-to-live, seconds3600
ccr_db_pathSQLite path for the token proxy~/.hermes/aphrodite/ccr.db
notify_url / notify_keyHermes callback URL + bearer token for CCR-create notifications-
timeoutUpstream request timeout, seconds (clamped to 600)300
max_contextMax context tokens1,000,000
max_outputMax output tokens (must be less than max_context)384,000

[defaults] accepts api_url, model, ccr_ttl_seconds, and api_key; each applies to every proxy that doesn’t set its own value.

No provider-specific defaults are baked in - api_url / model resolve from env or config, and fall back to https://api.openai.com / default-model only when neither is set.

All listeners bind loopback by default, and the proxy rejects non-loopback peers (and non-loopback Host headers) on every route except /health.

Binding 0.0.0.0 is possible but exposes unauthenticated management routes (/retrieve, /history, /ccr/*) to your network - see the shipped example’s comments on the 0.0.0.0 lines.

[compression]

One shared table feeds two independent consumers:

Drives the Rust proxy (env var wins over these if set; editing and saving, or POST /reload, applies immediately with no restart):

FieldMeaningEnv overrideCompiled defaultShipped example
tool_threshold_tokenToken-proxy compression threshold, bytesAPHRODITE_TOOL_THRESHOLD_TOKEN1024256
tool_threshold_cacheCache-proxy compression threshold, bytesAPHRODITE_TOOL_THRESHOLD_CACHE81922048
inline_thresholdInline-vs-durable CCR storage cutoff, bytesAPHRODITE_INLINE_THRESHOLD2561024
code_multiplierMultiplies the threshold for code_* content types (keeps code inline)APHRODITE_CODE_MULTIPLIER3.01.0
auto_expandResolve the just-stored content inline instead of emitting a CCR marker, capped at auto_expand_limitAPHRODITE_AUTO_EXPANDfalsetrue
auto_expand_limitByte cap for auto-expanded contentAPHRODITE_AUTO_EXPAND_LIMIT102400102400
max_request_body_sizeProxy request-body cap, bytes; over-size bodies rejected with 413 while being readAPHRODITE_MAX_REQUEST_BODY_SIZEnone (no cap)-
store_max_entriesMax live rows in the SQLite CCR store; past it the least-recently-accessed rows are evicted (0 = off)APHRODITE_STORE_MAX_ENTRIES100000100000
store_max_bytesMax stored payload bytes (SUM(LENGTH(original))); past it LRU rows are evicted (0 = off)APHRODITE_STORE_MAX_BYTES536870912536870912

The compiled defaults apply when neither env nor TOML sets a value; the shipped example config sets the values in the last column, so installations using it see those instead.

Drives the Hermes-plugin dylib session (a separate process/codepath from the Rust proxy, read once at dylib load):

FieldMeaningEnv overrideDefault
terminal_thresholdTerminal-output compression threshold, bytes - gates transform_terminal_outputAPHRODITE_TERMINAL_THRESHOLD1024 (shipped example: 256)
poll_workerAuto-backgrounding of slow terminal / process calls (pre-tool-call rewrite)APHRODITE_POLL_WORKERtrue
chain_splitOpt-in fine-grained command splitting (SEG_MARKER segments); off by defaultAPHRODITE_CHAIN_SPLITfalse
chain_split_min_segmentsFloor for the adaptive split thresholdAPHRODITE_CHAIN_SPLIT_MIN_SEGMENTS2
chain_split_max_segmentsCap for the adaptive split thresholdAPHRODITE_CHAIN_SPLIT_MAX_SEGMENTS6
context_engineEnables the context engine (dylib session only; the standalone HTTP proxy never reads it)APHRODITE_CONTEXT_ENGINEtrue
engine_threshold_pctContext-engine fill-% gate: archives middle turns when the conversation index is at/above this fill percent; 0 = never, 100+ = offAPHRODITE_ENGINE_THRESHOLD_PCT45 (shipped example: 30)
engine_protect_firstTurns kept at the start of the index when the engine archives middle turnsAPHRODITE_ENGINE_PROTECT_FIRST2
engine_protect_lastTurns kept at the end of the index when the engine archives middle turnsAPHRODITE_ENGINE_PROTECT_LAST5
engine_min_msgsMinimum archived turns before the engine may archiveAPHRODITE_ENGINE_MIN_MSGS8
live_containerEmit instant CCR markers with the live type (progressive retrieval + ETA)APHRODITE_LIVE_CONTAINERfalse
auto_expandSame inline-resolution knob as the proxy path, read into the session (also renders the [auto-expand: ...] guidance)APHRODITE_AUTO_EXPANDfalse (shipped example: true)
auto_expand_limitByte cap for auto-expanded contentAPHRODITE_AUTO_EXPAND_LIMIT102400
recursive_depthNested marker expansion capAPHRODITE_RECURSIVE_DEPTH5
auto_reloadWatch aphrodite.toml and re-apply config fields on change (session CCR state is never touched)APHRODITE_AUTO_RELOADfalse (shipped example: true)

The engine_* family is load-bearing in the dylib session: engine_threshold_pct gates the context engine’s middle-turn archiving, and engine_protect_first / engine_protect_last / engine_min_msgs shape the slice it archives - see Context Engine for the full behavior.

Parsed for schema compatibility, echoed by /reload for visibility (no live effect): catalog_mode (catalog layout is compiled-in), classifier_poll, prefetch (the aphrodite_prefetch tool exists regardless of this key).

[previews] and [prompts]

SectionFieldMeaningStatus
[previews]preview_max_charsCaps the rendered preview string, in chars; absent/0 = unlimitedWired (env APHRODITE_PREVIEW_MAX_CHARS > TOML > unlimited; shipped example 0)
[previews]model_family"compact" | "code_first" | "balance" - selects the [templates.preview.<family>.*] familyWired as the template-family selector (default "code_first"; only matters when templates are configured)
[previews]code_structure_mapInclude function/struct/class signatures in code previewsReserved - no reader (WIP)
[previews]rust_preview_linesLines of Rust source to include in previewsReserved - no reader (WIP)
[prompts]session_injectFirst-turn orientation text injected by pre_llm_call on turn 0; "" disablesWired (env APHRODITE_SESSION_INJECT > TOML > shipped builtin)
[prompts]retrieve_guidance"minimal" | "standard" | "verbose" - how much guidance the per-turn assembler renders about CCR retrievalWired - rendered as the [retrieval: ...] line (env APHRODITE_RETRIEVE_GUIDANCE > TOML > "minimal")
[prompts]ccr_marker_hintAppend a retrieval hint after markersWired - fills the marker template’s {hint} (env APHRODITE_CCR_MARKER_HINT > TOML > false)
[prompts]catalog_intent_hintsShow intent hints alongside hashes in catalog outputWired (env APHRODITE_CATALOG_INTENT_HINTS > TOML > false)

“Reserved” means the value parses cleanly but nothing in the current codebase reads it back out; changing it does not change behavior, so treat it as reserved until that’s confirmed.

The remaining reserved keys are code_structure_map and rust_preview_lines.

preview_max_chars, session_inject, retrieve_guidance, ccr_marker_hint, catalog_intent_hints, and model_family all have live effects.

[templates.*]

The [templates] section customizes how previews, markers, and prompts render.

Every block is optional; when a block (or the whole section) is absent, the hardcoded builders and shipped defaults apply.

BlockPurpose
[templates.preview.<family>.<ctype>]Format string for the preview of content type <ctype> in family <family> (e.g. [templates.preview.code_first] code = "...")
[templates.marker]format = marker block layout; hint = retrieval hint appended after markers
[templates.prompts]Named prompt templates rendered into the per-turn context (session_inject, engine_offload, auto_expand_guidance, catalog_context_warn, and others)
[templates.reverse]ctype -> key remap: lets a content type borrow another type’s format string

Resolution per content type: family[ctype] → reverse[ctype] mapped key → family[_default] → the hardcoded builder.

The family is selected by [previews] model_family (default "code_first" when unset); an unknown family or type falls through to the hardcoded builder.

Substitution is defensive: unknown {variable}s render as empty.

Preview variables (brace-wrapped in format strings, e.g. {type}, {ln}, {size}): type, ln, size, first, err, warn, msg, exit, cmd, files, fn, plus, minus, keys, items, commit, hash, subject, pid, uptime, fns, structs, impls, classes, sigs, code, loc, errors, total, sig1, fx, cmx.

Marker variables (used in [templates.marker] format): preview, type, meta, center, center_seg, hash, size, hint.

[directives]

[directives]
active = ["lazy", "lazy-eval", "foresight"]  # e.g. ["focus", "foresight"]
FieldMeaning
activeWhich loaded directives start active. Directive .md files are discovered from APHRODITE_DIRECTIVES_DIR (if set) → ./directives/ → ~/.hermes/aphrodite/directives/ → binary-relative - the first directory that exists wins, and an existing-but-empty directives dir is intentional (no custom directives). If no directory exists, built-in directives are used. Names in active that aren’t in the loaded set are silently filtered out; if active resolves empty while directives ARE loaded, the session seeds focus / foresight / lazy from the loaded set instead. Loading is never gated on this list being non-empty.

Read by the Hermes-plugin dylib session, not the Rust proxy.

The active set is fully runtime-mutable via the aphrodite_directive tool - see Directives for the complete feature reference.

[flow]

FieldMeaningEnv overrideDefaultShipped example
budget_charsHard cap for ALL per-turn injected context (directives + nudges + recall catalog + retrieve hint)APHRODITE_FLOW_BUDGET_CHARS40002600

Sections drop bottom-up when over budget; directives and nudges never drop. Dylib-session only - the Rust proxy never reads [flow].

API key resolution

proxy.api_key
  → defaults.api_key
    → APHRODITE_API_KEY env var
      → error: no API key configured

Stops at the first non-empty value.

This chain is TOML-first by design; the two legacy provider-specific fallbacks (DEEPSEEK_API_KEY, HEADROOM_DEEPSEEK_KEY) no longer exist in the codebase.

The proxy refuses to start if the chain resolves empty.

Default value chain

FieldResolution
listenproxy.listen → 127.0.0.1:9797, then APHRODITE_CACHE_PORT / APHRODITE_TOKEN_PORT override just the port (name/mode-matched)
modeproxy.mode → "token" (unknown values fall back with a warning) - no env override in multi-proxy mode
api_urlAPHRODITE_API_URL → proxy.api_url → defaults.api_url → https://api.openai.com
modelAPHRODITE_MODEL → proxy.model → defaults.model → "default-model"
ccr_ttl_secondsAPHRODITE_CCR_TTL → proxy.ccr_ttl_seconds → defaults.ccr_ttl_seconds → 3600
ccr_db_pathAPHRODITE_DB → proxy.ccr_db_path (non-empty) → ~/.hermes/aphrodite/ccr.db (or /tmp fallback)
notify_url / notify_keyAPHRODITE_NOTIFY_URL / APHRODITE_NOTIFY_KEY → proxy.notify_url / notify_key → unset
tool_relayproxy.tool_relay → false
devproxy.dev → false
timeoutproxy.timeout → 300 (clamped to a max of 600 with a warning)
max_contextproxy.max_context → 1,000,000
max_outputproxy.max_output → 384,000

Hot-reload

POST /reload (per-listener) and the aphrodite.toml file watcher (all listeners at once) re-resolve the live [compression] fields (the four thresholds plus auto_expand / auto_expand_limit) and write them into the running proxy’s state immediately - no restart needed.

/reload also re-applies [previews] preview_max_chars and the process-global marker format/hint + ccr_marker_hint knob.

/reload’s JSON response has "applied": true, echoes the values that took effect, and carries a "parsed_only" object for the fields that don’t (see the [compression] breakdown above).

max_request_body_size is startup-only: a /reload echoes it but cannot change a live cap.

The file watcher applies the same hot-reloadable set.

Everything else about a proxy (listen, api_url, model, mode, …) is fixed at startup; changing those requires a restart.

Validation

CheckBehavior
max_output vs max_contextRefuses to start if max_output >= max_context
listen addressMust parse as a valid socket address, or the proxy refuses to start
API keyMust be non-empty after the full resolution chain, or the proxy refuses to start
timeoutClamped to a 600-second maximum, with a warning if the configured value exceeds it
modeUnknown values fall back to "token" with a warning; an unset mode also defaults to "token", silently

Modes

ModeBackendCompression thresholdNotes
"token"SQLite>1 KB (1024)Durable CCR storage; supports tool relay (per-proxy flag, default false)
"cache"In-memory>8 KB (8192)Lightweight caching; tool_relay is independent of mode, not disabled by it

Thresholds are the compiled defaults; the shipped example config lowers them (see [compression] above).

The token proxy’s SQLite path comes from ccr_db_path (or the default below) and its TTL from ccr_ttl_seconds; the cache proxy’s in-memory store uses the same TTL.

Database path resolution

A relative ccr_db_path is resolved against the binary’s own directory, not the current working directory - so a relative path behaves consistently regardless of where the proxy is launched from.

Parent directories are created automatically if missing.

CLI equivalents

When running without aphrodite.toml, CLI flags mirror these fields:

TOML fieldCLI flagEnv var
mode--modeAPHRODITE_MODE
listen--listenAPHRODITE_LISTEN
api_url--api-urlAPHRODITE_API_URL
api_key--api-keyAPHRODITE_API_KEY
model--modelAPHRODITE_MODEL
ccr_db_path--ccr-db-pathAPHRODITE_DB
ccr_ttl_seconds--ccr-ttlAPHRODITE_CCR_TTL
tool_relay--tool-relay-
notify_url--notify-urlAPHRODITE_NOTIFY_URL
notify_key--notify-keyAPHRODITE_NOTIFY_KEY
dev--dev-
log_compact--log-compactAPHRODITE_LOG_COMPACT
timeout--timeout-
max_context--max-context-
max_output--max-output-
(CCR off)--no-ccr-marker-

In CLI mode, max_context / max_output / tool_relay / dev / timeout / no_ccr_marker are flag-only; the env-attributed rows apply via clap directly.

Example: full multi-proxy

[defaults]
ccr_ttl_seconds = 7200

[compression]
tool_threshold_token = 256
tool_threshold_cache = 2048
inline_threshold = 1024
code_multiplier = 1.0
auto_expand = true
auto_expand_limit = 102400

[previews]
preview_max_chars = 0

[prompts]
session_inject = ""

[directives]
active = ["lazy", "lazy-eval", "foresight"]

[[proxies]]
name = "cache"
listen = "127.0.0.1:9797"
mode = "cache"
tool_relay = true
timeout = 120

[[proxies]]
name = "token"
listen = "127.0.0.1:9798"
mode = "token"
tool_relay = true
notify_url = "https://hermes.internal/callback"
notify_key = "hermes-api-key-123"
timeout = 300