pub struct SessionConfig {Show 29 fields
pub max_context_tokens: usize,
pub compaction_threshold: usize,
pub compaction_buffer_percent: Option<u8>,
pub store_path: Option<PathBuf>,
pub auto_title: bool,
pub title_model: Option<String>,
pub tool_profile: String,
pub prompt_cache: String,
pub cache_warm_minutes: u64,
pub undo_depth: usize,
pub model_fast: Option<String>,
pub goal_max_turns: u32,
pub goal_model: Option<String>,
pub model_smol: Option<String>,
pub model_plan: Option<String>,
pub prewalk: Option<bool>,
pub model_race: String,
pub race_after_ms: u64,
pub fallback_models: Vec<String>,
pub stream_retry_secs: u64,
pub response_cache: String,
pub preconnect: bool,
pub intent_guidance: String,
pub compaction_llm: String,
pub compaction_method: String,
pub reasoning_effort: Option<String>,
pub magic_keywords: MagicKeywordsConfig,
pub stream_rules: Vec<StreamRuleConfig>,
pub headless_ask: Option<HeadlessAskMode>,
}Fields§
§max_context_tokens: usize§compaction_threshold: usize§compaction_buffer_percent: Option<u8>Share of the model’s context window to keep free. Auto-compaction
fires at the lower of compaction_threshold and
window × (100 − p) / 100. Unset uses compaction_threshold alone.
store_path: Option<PathBuf>§auto_title: boolAuto-name sessions: project placeholder → first-message heuristic → small-model refine after the first turn. Default on.
title_model: Option<String>Optional title model: provider/model or bare model id (same provider).
Empty = pick a known small/fast sibling (haiku / mini / flash).
tool_profile: StringTools advertised to the model: core (default, ~12 tools, faster TTFT)
or full (every built-in including github/web/lsp).
prompt_cache: StringAnthropic-style prompt cache policy: auto (default) or none.
cache_warm_minutes: u64Keep the prompt cache warm for this many idle minutes after a turn
(TUI). Each keep-alive is a paid request that re-reads the cached
prefix; 0 (default) turns it off.
undo_depth: usizeTurns /undo can step back. The oldest entries drop first past the
cap; 0 = unlimited (memory grows with every turn).
model_fast: Option<String>Fast model for trivial chat (provider/model or bare model id).
Empty = auto-pick small sibling of the session model (haiku/mini/flash).
goal_max_turns: u32Turns a /goal may take before it pauses (counted from when it was
set or last resumed); 0 = no cap.
goal_model: Option<String>Model that checks /goal (provider/model or bare id). Empty = the
session model.
model_smol: Option<String>Cheap model for task / swarm fan-out (provider/model or bare id).
Empty = auto-pick the small sibling of the session model.
model_plan: Option<String>Model used while the plan agent is active (provider/model or bare id).
prewalk: Option<bool>Plan on the strong model, then hand the rest of the turn to the cheap
one (model_smol, else the small sibling) after the first edit.
Unset = off.
model_race: StringFirst-token race partner: off (default), auto (small sibling), or
provider/model. When set, a slow primary TTFT starts the partner.
race_after_ms: u64How long to wait for the primary first token before opening model_race.
fallback_models: Vec<String>provider/model refs tried in order when the active model fails to
open a stream (rate limit after named credentials, 5xx, network,
timeout). Each needs a key: same provider, config api_key, or
<PROVIDER>_API_KEY.
stream_retry_secs: u64Re-send a step whose stream drops mid-response (network, timeout,
5xx, truncated body) for up to this many seconds after the first
drop. The partial draft is discarded. Default 60; 0 turns it off.
response_cache: StringProcess-local text-only response cache: auto (default) or off.
preconnect: boolOpen the provider connection while the prompt is being typed, so the first request skips DNS/TCP/TLS setup. Sends no credentials or prompt.
intent_guidance: StringHeuristic intent posture for build turns: auto (default), off, or always.
When enabled, high-confidence question/plan signals inject an ephemeral
<whycodes_intent> block into the LLM request (not session history) so
the model answers or plans instead of over-eager edits. Hard modes
(ask / plan) still enforce tool denylists regardless of this flag.
compaction_llm: StringFull-replace compact (manual /compact and auto over threshold):
"auto" (default) asks the session model for a structured summary;
"off" is the local stub only.
compaction_method: StringWhich compaction runs first: "auto" uses the provider’s own
compaction when the model has it (Anthropic on-demand compaction,
beta) and falls back to full-replace; "local" (default) is
full-replace only.
reasoning_effort: Option<String>OpenAI-compat / xAI reasoning_effort: low | medium | high | xhigh.
Empty = family default (medium when the model supports effort).
xhigh (Max) is grok-4.6+ and GLM-5+ only; a missing level clamps to
high (GLM-5+ has no medium and defaults to high).
magic_keywords: MagicKeywordsConfigStandalone prose keywords (ultrathink, orchestrate) that inject a
hidden per-turn instruction. Default on.
stream_rules: Vec<StreamRuleConfig>Regexes matched against streamed assistant text. A hit aborts the
current LLM request and injects hint before the next step.
headless_ask: Option<HeadlessAskMode>How --format json / stream-json treat permission ask.
Unset = deny (fail-closed). allow restores the old auto-approve
behaviour; --approve-tools on the CLI also forces allow. TUI and
--plain ignore this — they still prompt (or follow WHYCODES_AUTO_*).
Trait Implementations§
Source§impl Clone for SessionConfig
impl Clone for SessionConfig
Source§impl Debug for SessionConfig
impl Debug for SessionConfig
Source§impl Default for SessionConfig
impl Default for SessionConfig
Source§impl<'de> Deserialize<'de> for SessionConfig
impl<'de> Deserialize<'de> for SessionConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for SessionConfig
impl RefUnwindSafe for SessionConfig
impl Send for SessionConfig
impl Sync for SessionConfig
impl Unpin for SessionConfig
impl UnsafeUnpin for SessionConfig
impl UnwindSafe for SessionConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more