Source of truth: rust/src/core/config/schema.rs.
lean-ctx reads ~/.lean-ctx/config.toml (and a project .lean-ctx.toml overlay). Below is every recognized key with its type, default, and environment-variable override where one exists.
Top-level configuration keys
agent_token_budget(usize, default0) — Default per-agent token budget. 0 = unlimitedallow_auto_reroot(bool, defaultfalse— envLEAN_CTX_ALLOW_REROOT) — Allow automatic project-root re-rooting when absolute paths outside the jail are seenallow_paths(string[], default[]— envLEAN_CTX_ALLOW_PATH) — Additional paths allowed by PathJail (absolute)auto_capture(bool, defaulttrue) — Automatic knowledge capture from tool findingsbm25_max_cache_mb(u64, default128— envLEAN_CTX_BM25_MAX_CACHE_MB) — Maximum BM25 cache file size in MBbuddy_enabled(bool, defaulttrue) — Enable the buddy system for multi-agent coordinationcache_policy(enum(aggressive|safe|off), defaultaggressive— envLEAN_CTX_CACHE_POLICY) — Cache policy for ctx_read: aggressive (13-tok stubs), safe (map on hit), off (always disk)checkpoint_interval(u32, default15) — Session checkpoint interval in minutescompression_level(enum: off | lite | standard | max, defaultlite— envLEAN_CTX_COMPRESSION) — Unified output-style level for the model's prose (not tool-output compression). lite=plain concise (default), standard/max=denser symbolic 'power modes'content_defined_chunking(bool, defaultfalse) — Enable Rabin-Karp chunking for cache-optimal output orderingcustom_aliases(array, default[]) — Custom command aliases (array of {command, alias} entries)default_tool_categories(string[], default[]) — Tool categories active by default (core, arch, debug, memory, metrics, session). Override via LCTX_DEFAULT_CATEGORIESdisabled_tools(string[], default[]) — Tools to exclude from the MCP tool listenable_wakeup_ctx(bool, defaulttrue) — Append wakeup briefing (facts, session summary) to ctx_overview output. Set false to reduce context bloat when calling ctx_overview frequently.excluded_commands(string[], default[]) — Commands to exclude from shell hook interceptionextra_ignore_patterns(string[], default[]) — Extra glob patterns to ignore in graph/overview/preloadextra_roots(string[], default[]— envLEAN_CTX_EXTRA_ROOTS) — Extra project roots for multi-root workspaces (auto-added to PathJail allow-list)graph_index_max_files(u64, default0) — Maximum files in graph index. 0 = unlimited (default). Set >0 to cap for constrained systemsjournal_enabled(bool, defaulttrue) — Write human-readable activity journal to ~/.lean-ctx/journal.mdmax_disk_mb(u64, default0— envLEAN_CTX_MAX_DISK_MB) — Simplified disk budget in MB (0 = disabled). Distributes: archive ~25%, BM25 ~10%max_ram_percent(u8, default5— envLEAN_CTX_MAX_RAM_PERCENT) — Maximum percentage of system RAM that lean-ctx may use (1-50, default 5)max_staleness_days(u32, default0— envLEAN_CTX_MAX_STALENESS_DAYS) — Auto-purge data older than N days (0 = disabled). Flows into archive.max_age_hoursmemory_cleanup(enum: aggressive | shared, defaultaggressive— envLEAN_CTX_MEMORY_CLEANUP) — Controls how aggressively memory is freed when idlememory_profile(enum: low | balanced | performance, defaultperformance— envLEAN_CTX_MEMORY_PROFILE) — Controls RAM vs feature trade-off (performance = max quality)minimal_overhead(bool, defaulttrue— envLEAN_CTX_MINIMAL) — Skip session/knowledge/gotcha blocks in MCP instructionsno_degrade(boolean, defaultfalse) — Disable all automatic read-mode degradation. Override via LCTX_NO_DEGRADE=1output_density(enum: normal | terse | ultra, defaultnormal— envLEAN_CTX_OUTPUT_DENSITY) — Controls how dense/compact MCP tool output is formattedpassthrough_urls(string[], default[]) — URLs to pass through without proxy interceptionpermission_inheritance(enum: off | on, defaultoff) — Mirror the host IDE's permission rules onto lean-ctx tools (v1: OpenCode). When on, ctx_shell honors your bash/rm * rules instead of bypassing them. Override via LEAN_CTX_PERMISSION_INHERITANCEpreserve_compact_formats(string[], default["toon"]) — Already-compact output formats preserved verbatim instead of recompressed (e.g. ["toon"]). Set to [] to disableprofile(string, default"") — Persistent profile name. Checked after LEAN_CTX_PROFILE env var. Set via: lean-ctx config set profile passthroughproject_root(string?, defaultnull— envLEAN_CTX_PROJECT_ROOT) — Explicit project root directory. Prevents accidental home-directory scansproxy_enabled(bool?, defaultnull) — Enable/disable the proxy layer. null = auto-detect, true = force on, false = force offproxy_port(u16?, defaultnull) — Custom proxy port (default: 4444). Useful for multi-user systems. Env: LEAN_CTX_PROXY_PORTproxy_timeout_ms(u64?, defaultnull) — Proxy reachability timeout in ms (default: 200). Override via LEAN_CTX_PROXY_TIMEOUT_MSredirect_exclude(string[], default[]) — URL patterns to exclude from proxy redirectionreference_results(bool, defaultfalse— envLEAN_CTX_REFERENCE_RESULTS) — Store large tool outputs as references instead of inline contentresponse_verbosity(enum: normal | compact | minimal, defaultnormal— envLEAN_CTX_RESPONSE_VERBOSITY) — Controls how verbose tool responses arerules_injection(enum: shared | dedicated | off, defaultshared) — How rules load for CLAUDE.md/AGENTS.md/GEMINI.md agents: shared block, dedicated (no shared-file edits; SessionStart hook / instructions[] / context.fileName), or off (write no rules file — for hosts that supply their own steering or phase-isolated/non-caching harnesses). Override via LEAN_CTX_RULES_INJECTIONrules_scope(enum: both | global | project, defaultboth) — Where agent rule files are installed. Override via LEAN_CTX_RULES_SCOPEsandbox_level(u8, default0— envLEAN_CTX_SANDBOX_LEVEL) — Sandbox strictness level (0=default, 1=strict, 2=paranoid)savings_footer(enum: auto | always | never, defaultalways— envLEAN_CTX_SAVINGS_FOOTER) — Controls visibility of token savings footers: always (default, show on every response), never, auto (context-dependent). Also: LEAN_CTX_SHOW_SAVINGS=1|0shadow_mode(bool, defaultfalse— envLEAN_CTX_SHADOW_MODE) — Opt-in (default off): transparently route native Read/Grep/Edit/Shell through lean-ctx — via hooks for hook-based agents, via the interception plugin for OpenCodeshell_activation(enum: always | agents-only | off, defaultalways— envLEAN_CTX_SHELL_ACTIVATION) — Controls when the shell hook auto-activates aliasesshell_allowlist(array, default[]— envLEAN_CTX_SHELL_ALLOWLIST) — Optional shell command allowlist. When non-empty, only listed binaries are permittedshell_allowlist_extra(array, default[]) — Commands merged on top of shell_allowlist without replacing the defaults. Managed vialean-ctx allow <cmd>shell_hook_disabled(bool, defaultfalse— envLEAN_CTX_NO_HOOK) — Disable shell hook injectionshell_strict_mode(bool, defaultfalse) — Block $(), backticks, <() in shell arguments. Default false = warn only.slow_command_threshold_ms(u64, default5000) — Commands taking longer than this (ms) are recorded in the slow log. Set to 0 to disablesymbol_map_auto(bool, defaultfalse) — Opt-in: α-code identifier substitution in aggressive reads (>50-file projects). Off by default — abbreviated symbols hinder editing/refactoringteam_auto_push(bool, defaultfalse) — Opt-in: daemon periodically pushes your signed savings batch to team_url (off by default; requires team_url + team_token)team_token(string?, defaultnull) — Bearer token for the team server (push needs a member token; pull/auto-push needs the configured team token)team_url(string?, defaultnull) — Team server base URL for the opt-in savings roll-up (push/pull)tee_mode(enum: never | failures | always, defaultfailures) — Controls when shell output is tee'd to disk for later retrievalterse_agent(enum: off | lite | full | ultra, defaultoff— envLEAN_CTX_TERSE_AGENT) — Controls agent output verbosity via instructions injectiontheme(string, defaultdefault) — Dashboard color themetool_profile(enum: minimal | standard | power, default"") — Tool visibility profile: minimal (6 tools), standard (22), power (all). Override via LEAN_CTX_TOOL_PROFILEtools_enabled(string[], default[]) — Explicit list of enabled tool names (overrides tool_profile when non-empty)ultra_compact(bool, defaultfalse) — Legacy flag for maximum compression (use compression_level instead)update_check_disabled(bool, defaultfalse— envLEAN_CTX_NO_UPDATE_CHECK) — Disable the daily version check
Settings for the zero-loss compression archive (large tool outputs saved to disk)
enabled(bool, defaulttrue) — Enable zero-loss compression archiveephemeral(bool, defaulttrue) — Replace large results with summary+ref (ctx_expand to retrieve). Env: LEAN_CTX_EPHEMERALephemeral_min_tokens(usize, default2000) — Minimum output tokens before the ephemeral firewall replaces inline body with summary+ref. Env: LEAN_CTX_EPHEMERAL_MIN_TOKENSmax_age_hours(u64, default48) — Maximum age of archived entries before cleanupmax_disk_mb(u64, default500) — Maximum total disk usage for the archivethreshold_chars(usize, default800) — Minimum output size (chars) to trigger archiving
Controls autonomous background behaviors (preload, dedup, consolidation)
auto_consolidate(bool, defaulttrue) — Auto-consolidate knowledge periodicallyauto_dedup(bool, defaulttrue) — Auto-deduplicate repeated readsauto_preload(bool, defaulttrue) — Auto-preload related files on first readauto_related(bool, defaulttrue) — Auto-load graph-related filescognition_loop_enabled(bool, defaulttrue— envLEAN_CTX_COGNITION_LOOP_ENABLED) — Enable the background cognition loop (periodic knowledge consolidation)cognition_loop_interval_secs(u64, default3600— envLEAN_CTX_COGNITION_LOOP_INTERVAL_SECS) — Seconds between cognition loop iterationscognition_loop_max_steps(u8, default8— envLEAN_CTX_COGNITION_LOOP_MAX_STEPS) — Maximum steps per cognition loop iterationconsolidate_cooldown_secs(u64, default120) — Minimum seconds between consolidation runsconsolidate_every_calls(u32, default25) — Consolidate knowledge every N tool callsdedup_threshold(usize, default8) — Number of repeated reads before dedup triggersenabled(bool, defaulttrue) — Enable autonomous background behaviorssilent_preload(bool, defaulttrue) — Suppress preload notifications in output
Cross-project boundary and access control policies
audit_cross_access(bool, defaulttrue) — Log audit events when cross-project access occurscross_project_import(bool, defaultfalse) — Allow importing knowledge from other projectscross_project_search(bool, defaultfalse) — Allow searching across project boundariesuniversal_gotchas_enabled(bool, defaulttrue) — Load universal (cross-project) gotchas
Cloud feature settings
auto_sync(bool, defaultfalse) — Push the Personal Cloud (knowledge, commands, CEP, gotchas, buddy, feedback) silently once per day at session end (Pro; toggle:lean-ctx cloud autosync on|off)contribute_enabled(bool, defaultfalse) — Enable contributing anonymized stats to lean-ctx cloud
Custom command aliases (array of {command, alias} entries). Note: field names are 'command' and 'alias' (not 'name')
alias(string, default"") — The alias definition to executecommand(string, default"") — The command pattern to match (e.g. 'deploy')
Semantic-embedding engine settings (model selection for ctx_semantic_search)
auto_download(bool, defaultnull— envLEAN_CTX_EMBEDDINGS_AUTO_DOWNLOAD) — Download the embedding model in the background on first semantic need (default: allowed). Set false for air-gapped machines; semantic features then stay off until a model is provided manually.dimensions(integer, defaultnull) — Declared embedding width for hf: custom models (fallback only — the real width is probed from the ONNX graph at load time). Built-in models ignore this key.model(string, defaultminilm— envLEAN_CTX_EMBEDDING_MODEL) — Local ONNX embedding model for ctx_semantic_search. One of: minilm (all-MiniLM-L6-v2, 384d, default), jina-code-v2 (768d, code-optimized), nomic (768d) — or any HuggingFace repo with an ONNX export via hf:org/repo[@revision]. Switching models re-indexes once on the next search.
Token-savings recap publishing (gain --publish / auto-publish)
auto_publish(bool, defaultfalse) — Automatically (re)publish your Wrapped recap when you runlean-ctx gain(opt-in, off by default; throttled and sends only an aggregate payload)auto_publish_interval_hours(u64, default24) — Minimum hours between automatic publishes (throttle; default 24)display_name(string?, defaultnull) — Optional display name shown on your published card / leaderboard entrylast_auto_publish(string?, defaultnull) — Timestamp of the last automatic publish (written by lean-ctx for throttling — not meant to be edited)leaderboard(bool, defaulttrue) — When auto-publishing, also list the card on the public opt-in leaderboard
MCP Tool-Catalog Gateway: aggregate + query-route downstream MCP servers (#210). Global-only.
cache_ttl_secs(integer, default300) — Aggregated-catalog cache lifetime in secondscall_timeout_secs(integer, default30) — Per-operation timeout for downstream connect/list/call (seconds)enabled(bool, defaultfalse) — Enable the MCP Tool-Catalog Gateway (no-op when false)top_n(integer, default5) — How many toolsctx_tools findreturns per query (clamped 1..=50)
Downstream MCP servers (array of tables: [[gateway.servers]])
args(array, default[]) — Arguments for the spawned command (stdio transport)command(string, default"") — Executable to spawn (stdio transport)enabled(bool, defaulttrue) — Per-server switch (default true)env(table, default{}) — Extra environment variables for the child process (stdio transport)headers(table, default{}) — Extra request headers, e.g. Authorization (http transport)name(string, default"") — Stable server id; becomes the catalog namespace (name::tool)transport(string, defaultstdio) — Transport: stdio (spawn command) or http (connect to url)url(string, default"") — Streamable-HTTP endpoint (http transport)
Code-graph settings, including traversal (co-access) edges learned from sessions
traversal_edges(bool, defaulttrue) — Learn co-access edges from real sessions (files surfaced together), surface them as decayingco_accessgraph edges, and boost recall by them. Set false for a purely static AST-only graph.
Per-IDE allowed paths. Keys are agent names (cursor, codex, opencode, antigravity, etc.), values are arrays of paths to index for that agent
No sub-keys (presence of the section toggles the feature).
Optional LLM enhancement settings (query expansion, contradiction explanation). Deterministic fallback when disabled or unreachable.
api_key(string, default"") — API key for OpenRouter or Anthropic backendsbackend(enum: ollama | openrouter | anthropic, defaultollama) — LLM backend providerenabled(bool, defaultfalse) — Enable optional LLM enhancements (query expansion, contradiction explanation)model(string, defaultllama3.2) — Model name for the selected backendtimeout_secs(u64, default10) — HTTP timeout for LLM requests
Loop detection settings for preventing repeated identical tool calls
blocked_threshold(u32, default0) — Repetitions before blocking. 0 = disablednormal_threshold(u32, default2) — Repetitions before reducing outputreduced_threshold(u32, default4) — Repetitions before further reducing outputsearch_group_limit(u32, default10) — Maximum unique searches within a loop windowtool_total_limits(table, default{"ctx_read":100,"ctx_search":80,"ctx_semantic_search":60,"ctx_shell":50}) — Per-tool total call limits within a session. Keys are tool names, values are max callswindow_secs(u64, default300) — Time window in seconds for loop detection
LSP server binary overrides. Map language name to custom binary path
go(string?, defaultnull) — Custom path to gopls binarypython(string?, defaultnull) — Custom path to pylsp binaryrust(string?, defaultnull) — Custom path to rust-analyzer binarytypescript(string?, defaultnull) — Custom path to typescript-language-server binary
Embeddings memory settings for semantic search
max_facts(usize, default2000) — Maximum number of embedding facts stored
Episodic memory budgets (session episodes)
max_actions_per_episode(usize, default50) — Maximum actions tracked per episodemax_episodes(usize, default500) — Maximum number of episodes retainedsummary_max_chars(usize, default200) — Maximum characters in episode summary
Gotcha memory settings (project-specific warnings and pitfalls)
default_decay_rate(f32, default0.03) — Default decay rate for gotcha importancemax_gotchas_per_project(usize, default100) — Maximum gotchas stored per projectretrieval_budget_per_room(usize, default10) — Maximum gotchas retrieved per room per query
Knowledge memory budgets (facts, patterns, gotchas)
contradiction_threshold(f32, default0.5) — Confidence threshold for contradiction detectionmax_facts(usize, default200) — Maximum number of knowledge facts stored per projectmax_history(usize, default100) — Maximum history entries retainedmax_patterns(usize, default50) — Maximum number of patterns storedrecall_facts_limit(usize, default10) — Maximum facts returned per recall queryrelations_limit(usize, default40) — Maximum number of relations returnedrooms_limit(usize, default25) — Maximum number of rooms returnedtimeline_limit(usize, default25) — Maximum number of timeline entries returned
Knowledge lifecycle policy (decay, staleness, dedup)
decay_rate(f32, default0.01) — Rate at which knowledge confidence decays over timelow_confidence_threshold(f32, default0.3) — Threshold below which facts are considered low-confidencesimilarity_threshold(f32, default0.85) — Similarity threshold for deduplicationstale_days(i64, default30) — Days after which unused facts are considered stale
Procedural memory budgets (learned patterns)
max_procedures(usize, default100) — Maximum number of learned procedures storedmax_window_size(usize, default10) — Maximum window size for pattern analysismin_repetitions(usize, default3) — Minimum repetitions before a pattern is storedmin_sequence_len(usize, default2) — Minimum sequence length for procedure detection
External context providers (GitHub, GitLab, Jira, MCP bridges, etc.). Set tokens via env vars (GITHUB_TOKEN, GITLAB_TOKEN). MCP bridges connect external MCP servers as context sources.
auto_index(bool, defaulttrue) — Auto-ingest provider results into BM25/embedding indexescache_ttl_secs(u64, default120) — Default cache TTL for provider results (seconds)enabled(bool, defaulttrue) — Master switch for the provider subsystem (GitHub, GitLab, etc.)github.api_url(string, defaultnull) — GitHub API base URL (for GitHub Enterprise)github.enabled(bool, defaulttrue) — Enable/disable GitHub providergitlab.api_url(string, defaultnull) — GitLab API base URL (for self-hosted instances)gitlab.enabled(bool, defaulttrue) — Enable/disable GitLab providermcp_bridges.<name>.args(array, default[]) — Arguments for the MCP server commandmcp_bridges.<name>.auth_env(string, defaultnull) — Environment variable name containing auth token for MCP servermcp_bridges.<name>.command(string, defaultnull) — Command to spawn a local MCP server (stdio transport)mcp_bridges.<name>.url(string, defaultnull) — HTTP/SSE URL for a remote MCP server
Proxy upstream configuration for API routing
anthropic_upstream(string?, defaultnull) — Custom upstream URL for Anthropic API proxygemini_upstream(string?, defaultnull) — Custom upstream URL for Gemini API proxyhistory_mode(enum: cache-aware | rolling | off, defaultcache-aware— envLEAN_CTX_PROXY_HISTORY_MODE) — History pruning strategy. cache-aware: frozen boundaries that keep provider prompt caches valid (default). rolling: legacy moving window (max raw savings, breaks prompt caching). off: never pruneopenai_upstream(string?, defaultnull) — Custom upstream URL for OpenAI API proxy
Hybrid search weights for ctx_semantic_search (BM25 + dense vector + SPLADE + graph proximity)
bm25_candidates(usize, default75) — Number of BM25 candidates to retrieve before fusionbm25_weight(f64, default1.0) — BM25 lexical search weight in RRF fusiondense_candidates(usize, default75) — Number of dense candidates to retrieve before fusiondense_weight(f64, default1.0) — Dense vector search weight in RRF fusionsplade_weight(f64, default0.5) — SPLADE expansion weight (0.0 to disable)
Secret/credential detection and redaction settings
custom_patterns(array, default[]) — Additional regex patterns to detect as secretsenabled(bool, defaulttrue) — Enable secret/credential detection in tool outputsredact(bool, defaulttrue) — Redact detected secrets from output
Per-item sensitivity model with a uniform policy floor (#212)
action(string, defaultredact) — How to enforce the floor: redact (mask spans) or drop (withhold item)enabled(bool, defaultfalse) — Enable the per-item sensitivity policy floor (no-op when false)policy_floor(string, defaultsecret) — Block items at/above this level: public|internal|confidential|secret
Controls what lean-ctx injects during setup and updates. Fresh installs default to non-invasive (rules/skills off, MCP on).
auto_inject_rules(bool?, defaultnull) — Inject agent rule files during setup/update. null=auto (inject if already present), true=always, false=neverauto_inject_skills(bool?, defaultnull) — Install SKILL.md files during setup/update. null=auto (install if rules present), true=always, false=neverauto_update_mcp(bool, defaulttrue) — Register lean-ctx MCP server in editor configs during setup/update
Skillify miner: distill recurring session diary + knowledge patterns into rules
enabled(bool, defaulttrue) — Master switch for the skillify miner (codify recurring session patterns into .cursor/rules). Only acts when explicitly invoked.min_confidence(f32, default0.699999988079071) — Minimum confidence for a single curated knowledge fact to be codified without repetition (0.0..=1.0).min_recurrence(u32, default2) — Minimum reinforcements (confirmations / repeated mentions) before a sub-threshold-confidence pattern is codified.scope(enum: project | global, defaultproject) — Where generated rules are written: project (/.cursor/rules, git-committable) or global (~/.cursor/rules).
AI session summaries: periodic, semantically-recallable session digests
enabled(bool, defaulttrue) — Record periodic, semantically-recallable AI session summaries (what was done, files, decisions).every_n_turns(u32, default25) — Tool calls between automatic session summaries (gated by the auto-checkpoint cadence).max_kept(u32, default100) — Maximum session summaries kept per project (oldest pruned first).
Automatic update configuration
auto_update(bool, defaultfalse) — Enable automatic updates (requires explicit opt-in)check_interval_hours(u64, default6) — How often to check for updates (hours)notify_only(bool, defaultfalse) — Only notify about updates, don't install automatically