docs

Experiments

dex ships no separate "experiments" registry — opt-in behavior is gated by environment variables (and, where noted, a config-file equivalent). These are the features that are off by default or can be turned off.

Opt-in (off by default)

Verification hook — DEX_VERIFY

DEX_VERIFY=1 auto-detects a verification command after a turn (cargo test / go test / npm test); or set DEX_VERIFY to an explicit command. A config verify_command: (if present) always wins over the env var.

Audit log — DEX_AUDIT=1

Writes audit.jsonl with one record per tool call. Off by default — the session JSONL already journals everything; the audit log is for a separate trail.

Durable sessions — DEX_DURABLE=1

fsyncs every session line instead of only the turn_*/effect_* markers. The default already bounds crash loss to the in-flight turn; this knob buys full per-line durability at a throughput cost.

Tool-result cache — DEX_TOOL_CACHE=1

Persists a dex-tool-cache.json so tool results are reused across runs instead of re-executed.

LLM compaction — DEX_COMPACTION=llm

By default compaction is deterministic (no model call). Set DEX_COMPACTION=llm (or =1) to have a model summarize the older history instead. The deprecated DEX_COMPACTION_LLM=1 is still honored with a one-time warning pointing at DEX_COMPACTION.

Jev verbatim pruning — DEX_COMPACTION=jev

Selects verbatim tool-output pruning for compaction. With TYPESAFE_API_KEY and a config jev: opt-in table, the Typesafe Jev API scores which tool outputs to prune (endpoint overridable via TYPESAFE_JEV_URL); without them, deterministic pruning heuristics are used.

On by default, with a kill switch

Prompt-cache warming — DEX_CACHE_WARMING=0

After a completed turn, the daemon re-sends its last request once before the provider's ~5-minute prompt cache expires, so the next turn reads the context at cache-hit price. Anthropic-native models only; pings are gated on estimated savings (≥ $0.05) and never enter the session. Config equivalent: cache_warming:.

Idle wake turns — DEX_AGENT_WAKE=0

When a child agent completes while the session is idle and a client is listening, the daemon runs one wake turn to surface the notice. Config equivalent: agent_wake:. Cadence overrides: DEX_AGENT_WAKE_DEBOUNCE_MS (2000), DEX_AGENT_WAKE_RETRY_MS (5000), DEX_AGENT_WAKE_RETRIES (12), DEX_AGENT_WAKE_PRESENCE_MS (30000).

Sub-agents — DEX_SUBAGENTS=0

The delegate tool (daemon sessions only) is registered by default; DEX_SUBAGENTS=0 unregisters it.

Strict-harness one-liner

DEX_DURABLE=1 DEX_AUDIT=1 DEX_VERIFY=1 DEX_COMPACTION=llm dex

dex doctor prints each resolved knob with its origin (env var or config file), including the wake/cache-warming and compaction modes above.