pub struct Config {Show 31 fields
pub ultra_compact: bool,
pub tee_mode: TeeMode,
pub output_density: OutputDensity,
pub checkpoint_interval: u32,
pub excluded_commands: Vec<String>,
pub passthrough_urls: Vec<String>,
pub custom_aliases: Vec<AliasEntry>,
pub slow_command_threshold_ms: u64,
pub theme: String,
pub cloud: CloudConfig,
pub autonomy: AutonomyConfig,
pub proxy: ProxyConfig,
pub buddy_enabled: bool,
pub redirect_exclude: Vec<String>,
pub disabled_tools: Vec<String>,
pub loop_detection: LoopDetectionConfig,
pub rules_scope: Option<String>,
pub extra_ignore_patterns: Vec<String>,
pub terse_agent: TerseAgent,
pub compression_level: CompressionLevel,
pub archive: ArchiveConfig,
pub memory: MemoryPolicy,
pub allow_paths: Vec<String>,
pub content_defined_chunking: bool,
pub minimal_overhead: bool,
pub shell_hook_disabled: bool,
pub shell_activation: ShellActivation,
pub update_check_disabled: bool,
pub bm25_max_cache_mb: u64,
pub memory_profile: MemoryProfile,
pub memory_cleanup: MemoryCleanup,
}Expand description
Global lean-ctx configuration loaded from config.toml, merged with project-local overrides.
Fields§
§ultra_compact: bool§tee_mode: TeeMode§output_density: OutputDensity§checkpoint_interval: u32§excluded_commands: Vec<String>§passthrough_urls: Vec<String>§custom_aliases: Vec<AliasEntry>§slow_command_threshold_ms: u64Commands taking longer than this threshold (ms) are recorded in the slow log. Set to 0 to disable slow logging.
theme: String§cloud: CloudConfig§autonomy: AutonomyConfig§proxy: ProxyConfig§buddy_enabled: bool§redirect_exclude: Vec<String>§disabled_tools: Vec<String>Tools to exclude from the MCP tool list returned by list_tools.
Accepts exact tool names (e.g. ["ctx_graph", "ctx_agent"]).
Empty by default — all tools listed, no behaviour change.
loop_detection: LoopDetectionConfig§rules_scope: Option<String>Controls where lean-ctx installs agent rule files. Values: “both” (default), “global” (home-dir only), “project” (repo-local only). Override via LEAN_CTX_RULES_SCOPE env var.
extra_ignore_patterns: Vec<String>Extra glob patterns to ignore in graph/overview/preload (repo-local).
Example: ["externals/**", "target/**", "temp/**"]
terse_agent: TerseAgentControls agent output verbosity via instructions injection. Values: “off” (default), “lite”, “full”, “ultra”. Override via LEAN_CTX_TERSE_AGENT env var.
compression_level: CompressionLevelUnified compression level (replaces separate terse_agent + output_density). Values: “off” (default), “lite”, “standard”, “max”. Override via LEAN_CTX_COMPRESSION env var.
archive: ArchiveConfigArchive configuration for zero-loss compression.
memory: MemoryPolicyMemory policy (knowledge/episodic/procedural/lifecycle budgets & thresholds).
allow_paths: Vec<String>Additional paths allowed by PathJail (absolute). Useful for multi-project workspaces where the jail root is a parent directory. Override via LEAN_CTX_ALLOW_PATH env var (path-list separator).
content_defined_chunking: boolEnable content-defined chunking (Rabin-Karp) for cache-optimal output ordering. Stable chunks are emitted first to maximize prompt cache hits.
minimal_overhead: boolSkip session/knowledge/gotcha blocks in MCP instructions to minimize token overhead. Override via LEAN_CTX_MINIMAL env var.
shell_hook_disabled: boolDisable shell hook injection (the _lc() function that wraps CLI commands). Override via LEAN_CTX_NO_HOOK env var.
shell_activation: ShellActivationControls when the shell hook auto-activates aliases.
always: (Default) Aliases active in every interactive shell.agents-only: Aliases only active when an AI agent env var is detected.off: Aliases never auto-activate (user must calllean-ctx-onmanually).
Override via LEAN_CTX_SHELL_ACTIVATION env var.
update_check_disabled: boolDisable the daily version check against leanctx.com/version.txt. Override via LEAN_CTX_NO_UPDATE_CHECK env var.
bm25_max_cache_mb: u64Maximum BM25 cache file size in MB. Indexes exceeding this are quarantined on load and refused on save. Override via LEAN_CTX_BM25_MAX_CACHE_MB env var.
memory_profile: MemoryProfileControls RAM vs feature trade-off. Values: “low”, “balanced” (default), “performance”. Override via LEAN_CTX_MEMORY_PROFILE env var.
memory_cleanup: MemoryCleanupControls how aggressively memory is freed when idle. Values: “aggressive” (default, 5 min TTL), “shared” (30 min TTL for multi-IDE use). Override via LEAN_CTX_MEMORY_CLEANUP env var.
Implementations§
Source§impl Config
impl Config
Sourcepub fn rules_scope_effective(&self) -> RulesScope
pub fn rules_scope_effective(&self) -> RulesScope
Returns the effective rules scope, preferring env var over config file.
Sourcepub fn disabled_tools_effective(&self) -> Vec<String>
pub fn disabled_tools_effective(&self) -> Vec<String>
Returns the effective disabled tools list, preferring env var over config file.
Sourcepub fn minimal_overhead_effective(&self) -> bool
pub fn minimal_overhead_effective(&self) -> bool
Returns true if minimal overhead is enabled via env var or config.
Sourcepub fn minimal_overhead_effective_for_client(&self, client_name: &str) -> bool
pub fn minimal_overhead_effective_for_client(&self, client_name: &str) -> bool
Returns true if minimal overhead should be enabled for this MCP client.
This is a superset of minimal_overhead_effective():
LEAN_CTX_OVERHEAD_MODE=minimalforces minimal overheadLEAN_CTX_OVERHEAD_MODE=fulldisables client/model heuristics (still honors LEAN_CTX_MINIMAL / config)- In auto mode (default), certain low-context clients/models are treated as minimal to prevent large metadata blocks from destabilizing smaller context windows (e.g. Hermes + MiniMax).
Sourcepub fn shell_hook_disabled_effective(&self) -> bool
pub fn shell_hook_disabled_effective(&self) -> bool
Returns true if shell hook injection is disabled via env var or config.
Sourcepub fn shell_activation_effective(&self) -> ShellActivation
pub fn shell_activation_effective(&self) -> ShellActivation
Returns the effective shell activation mode (env var > config > default).
Sourcepub fn update_check_disabled_effective(&self) -> bool
pub fn update_check_disabled_effective(&self) -> bool
Returns true if the daily update check is disabled via env var or config.
pub fn memory_policy_effective(&self) -> Result<MemoryPolicy, String>
Source§impl Config
impl Config
Sourcepub fn path() -> Option<PathBuf>
pub fn path() -> Option<PathBuf>
Returns the path to the global config file (~/.lean-ctx/config.toml).
Sourcepub fn local_path(project_root: &str) -> PathBuf
pub fn local_path(project_root: &str) -> PathBuf
Returns the path to the project-local config override file.
Sourcepub fn load() -> Self
pub fn load() -> Self
Loads config from disk with caching, merging global + project-local overrides.
Sourcepub fn save(&self) -> Result<(), LeanCtxError>
pub fn save(&self) -> Result<(), LeanCtxError>
Persists the current config to the global config file.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
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 Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
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,
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