Skip to main content

SessionConfig

Struct SessionConfig 

Source
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: bool

Auto-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: String

Tools advertised to the model: core (default, ~12 tools, faster TTFT) or full (every built-in including github/web/lsp).

§prompt_cache: String

Anthropic-style prompt cache policy: auto (default) or none.

§cache_warm_minutes: u64

Keep 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: usize

Turns /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: u32

Turns 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: String

First-token race partner: off (default), auto (small sibling), or provider/model. When set, a slow primary TTFT starts the partner.

§race_after_ms: u64

How 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: u64

Re-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: String

Process-local text-only response cache: auto (default) or off.

§preconnect: bool

Open 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: String

Heuristic 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: String

Full-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: String

Which 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: MagicKeywordsConfig

Standalone 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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SessionConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SessionConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for SessionConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for SessionConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more