Skip to main content

Module config

Module config 

Source

Modules§

risk
Risk classification for config set governance (#852).
schema
Auto-generated config schema from Config struct metadata.
setter
Generic config setter that works for ALL schema-known keys.

Structs§

AliasEntry
A user-defined command alias mapping for shell compression patterns.
ArchiveConfig
Settings for the zero-loss compression archive (large tool outputs saved to disk).
AutonomyConfig
Controls autonomous background behaviors (preload, dedup, consolidation).
CloudConfig
Cloud sync and contribution settings (pattern sharing, model pulls).
CodeHealthConfig
Code-health engine ([code_health]): clean code as a token-cost lever.
Config
Global lean-ctx configuration loaded from config.toml, merged with project-local overrides.
ConfigProvenance
Where the effective config comes from — the four shadowing mechanisms behind GH #450, captured in one snapshot.
ContextConfig
Fixed-context budget accounting (#964). The per-session footprint lean-ctx adds — tool schemas + MCP instructions + auto-loaded rules files + the wakeup briefing — is warned about once it crosses budget_tokens. The LEAN_CTX_CONTEXT_BUDGET_TOKENS env var overrides it; lean-ctx doctor overhead --gate turns a breach into a non-zero exit for CI.
CostConfig
Model declaration for measured-vs-estimated cost reporting.
EmbeddingConfig
Semantic-embedding engine settings.
EnvOverride
An active environment variable shadowing a persisted setting.
GainConfig
Settings for publishing your token-savings recap (gain --publish / auto-publish).
GraphConfig
Settings for the code graph — in particular the traversal (co-access) edges learned from real agent sessions (#289).
LoopDetectionConfig
Thresholds for detecting and throttling repetitive agent tool call loops.
McpBridgeEntry
MemoryGuardConfig
RSS-based memory guardian configuration.
ProviderEntryConfig
Per-provider configuration entry.
ProvidersConfig
Configuration for external context providers (GitHub, GitLab, Jira, etc.). Each provider can be enabled/disabled and configured with auth tokens. Override individual tokens via env vars (GITHUB_TOKEN, GITLAB_TOKEN, etc.).
ProxyConfig
API proxy upstream overrides. None = use provider default.
RoleAggressiveness
Per-role prose-compression intensity for the proxy’s frozen request region.
SecretDetectionConfig
SetupConfig
Controls what lean-ctx injects during setup and update --rewire. Fresh installs default to non-invasive (rules/skills off, MCP on). Users who ran setup interactively get explicit true/false. None = undecided (legacy: check if rules already exist and preserve behavior).
SkillifyConfig
Skillify (#290): mine the project’s session diary + knowledge facts into versioned, git-committable .cursor/rules/skillify-*.mdc rule files.
SummariesConfig
AI session summaries (#292): periodically distil the working session into a compact, semantically recallable summary so a future session can answer “what did I do last time on X?”. Deterministic and local-first — recall uses embeddings when the embeddings feature is on, else a lexical fallback.
UpdatesConfig
Controls automatic update behavior. All defaults are OFF — auto-updates require explicit opt-in via lean-ctx setup or lean-ctx update --schedule.
Upstreams
The three resolved provider upstreams a running proxy forwards to. Published to request handlers via a tokio::sync::watch channel so a config change is picked up live, without a proxy restart (#449).

Enums§

CompressionLevel
Each level maps to specific component settings via to_components().
Effort
Unified reasoning-effort level for the cache-safe, cross-provider effort control (#834). “Off” is represented by Option::None, not a variant — the feature is strictly opt-in.
HistoryMode
How the proxy prunes old tool results from conversation history.
MemoryCleanup
Controls how aggressively lean-ctx frees memory when idle.
MemoryProfile
Controls RAM usage vs. feature richness trade-off.
OutputDensity
Legacy: Controls how dense/compact MCP tool output is formatted. Superseded by CompressionLevel. Kept for backward compatibility with old config.toml files. New setups use compression_level instead. See CompressionLevel::effective().
PermissionInheritance
Whether lean-ctx mirrors the host IDE’s tool-permission rules onto its own MCP tools (“permission inheritance”).
ProseRanker
How the proxy squeezes prose it must shrink (#895).
ProseRole
The conversation roles whose prose the proxy may compress in the frozen region. Deliberately excludes assistant — model turns are never rewritten.
ProxyProvider
RecoveryHints
Controls the reactive recovery footer surfaced on compressed tool output (ctx_read, archive/firewall/spill handles, ctx_shell tee).
ResponseVerbosity
Unified compression level that replaces the 4 separate legacy concepts: terse_agent, output_density, terse_mode, and crp_mode.
RulesInjection
How agent rules are injected for AGENTS.md/CLAUDE.md/CODEBUDDY.md/GEMINI.md consumers.
RulesScope
Where agent rule files are installed: global home dir, project-local, or both.
SavingsFooter
Controls visibility of token savings footers in tool output.
SessionDegrade
Outcome of CompressionLevel::degrade_action: what to do with the session degrade given the current re-fetch pressure. Split from the dispatch so the threshold logic is a pure, testable function.
ShellActivation
Controls when the shell hook auto-activates command aliases.
TeeMode
Controls when shell output is tee’d to disk for later retrieval.
TerseAgent
Legacy: Controls agent output verbosity level injected into MCP instructions. Superseded by CompressionLevel. Kept for backward compatibility with old config.toml files. New setups use compression_level instead. See CompressionLevel::effective().
UpstreamDrift
Why a running proxy’s live upstream differs from what the operator expects.

Constants§

DEFAULT_BM25_PERSIST_MB
Effective on-disk ceiling (MB) for the persisted BM25 index when nothing is explicitly configured (no bm25_max_cache_mb, no max_disk_mb budget).
EDIT_TOOL_NAMES
lean-ctx tools whose sole purpose is editing the user’s source files. When prefer_native_editor is set (#454) these are hidden from list_tools and refused at dispatch so the host’s native editor handles edits instead.

Functions§

default_bm25_max_cache_mb
Default BM25 cache cap from config (also used by bm25_index heuristics).
diagnose_drift
Diagnose upstream drift for one provider from the CLI-visible env override (env), the config.toml value (disk) and the proxy’s live value (live). None means in sync.
env_upstream_override
The LEAN_CTX_*_UPSTREAM override visible to this process for a provider, normalized (None if unset/blank). Lets status/doctor explain why an env var a user exported in their shell never reaches an MCP/service-spawned proxy.
is_local_proxy_url
last_config_parse_error
Returns the most recent global config parse error, or None if the current config.toml parsed successfully (or no config file exists).
local_sensitive_overrides
Names of the SECURITY-sensitive overrides a project-local .lean-ctx.toml carries — the keys strip_sensitive_overrides would withhold for an untrusted workspace. Read-only (parses a throwaway Config); used by lean-ctx trust to tell the user exactly what trusting will enable.
normalize_url
normalize_url_opt
render_annotated_config
Builds the annotated config.toml text for cfg, documented via schema.