Skip to main content

Module derive_policy

Module derive_policy 

Source
Expand description

Selectable derivation policies for derive_with_policy.

derive_context in Phase A is a single fixed pipeline: clone + experimental + enforce_on_messages + pairing repair. Phase B parameterises the pipeline with a DerivePolicy so different research directions can share the same &Session → DerivedContext signature.

§Variants

  • DerivePolicy::Legacy — the Phase A behaviour. Current default until the Pareto benchmark (plan step 23) demonstrates one of the alternatives is dominant.
  • DerivePolicy::ResetLu et al. reset-to-(prompt, summary) semantic from arXiv:2510.06727. When the token estimate exceeds the threshold, compresses the prefix to a single summary message and keeps only the most recent user turn. See derive_with_policy for the implementation.
  • [DerivePolicy::Incremental] (reserved, Phase B) — Liu et al. scoring + hierarchical summary lookup.
  • [DerivePolicy::OracleReplay] (reserved, Phase B) — ClawVM replay oracle with h-turn future-demand lookahead.

§Examples

use codetether_agent::session::derive_policy::DerivePolicy;

let legacy = DerivePolicy::Legacy;
let reset = DerivePolicy::Reset { threshold_tokens: 16_000 };

assert!(matches!(legacy, DerivePolicy::Legacy));
assert!(matches!(reset, DerivePolicy::Reset { .. }));

Enums§

DerivePolicy
Per-session derivation strategy selector.