Skip to main content

build_microcompactor_from_env

Function build_microcompactor_from_env 

Source
pub fn build_microcompactor_from_env(
    trigger_raw: Option<&str>,
    keep_raw: Option<&str>,
) -> Option<Microcompactor>
Expand description

Build a Microcompactor from environment-variable strings.

Disabled by default. Set RECURSIVE_MICROCOMPACT_TRIGGER=<n> (e.g. 40) to enable. Disabled when unset or when the value is 0, off, or false.

Rationale: the old default of 12 was too aggressive for large-context models (1 M+). At 12 tool messages the pruner fires when the session is only ~50–80 K tokens — 5–8 % of a 1 M window — causing surprising ctx gauge drops. Opt-in lets operators tune the threshold to their model size.

trigger_raw — the value of RECURSIVE_MICROCOMPACT_TRIGGER. keep_raw — the value of RECURSIVE_MICROCOMPACT_KEEP.