50 KiB
Appendix — Configuration Keys (generated)
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 keys
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_ide_config_dirs(bool, defaultnull— envLEAN_CTX_ALLOW_IDE_DIRS) — Allow jailed ctx_* tools to read home-level IDE config dirs (registry-derived; covers all editors). Off by default — exposes other agents' sessions/credentialsallow_paths(string[], default[]— envLEAN_CTX_ALLOW_PATH) — Additional paths allowed by PathJail (absolute)allow_symlink_roots(string[], default[]— envLEAN_CTX_ALLOW_SYMLINK_ROOTS) — Trusted roots OUTSIDE $HOME lean-ctx may follow when an agent config is symlinked there (#596). Empty = strict $HOME-onlyauto_capture(bool, defaulttrue) — Automatic knowledge capture from tool findingsauto_mode_learning(bool, defaultfalse— envLEAN_CTX_AUTO_MODE_LEARNING) — Opt-in: let adaptive learning signals (predictor, bandit, heatmap, adaptive policy, bounce/path memory) influenceautomode. Off by default for a deterministic, I/O-light cascade (capability guards + size/task heuristic only) that keeps output byte-stable for prompt caching. Override via LEAN_CTX_AUTO_MODE_LEARNINGbm25_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 coordinationbypass_hints(enum: on | off | aggressive, defaulton— envLEAN_CTX_BYPASS_HINTS) — Bypass-hint mode: when agents use native Read/Grep instead of lean-ctx tools, a hint is appended to the next tool response. on (default), off, aggressive (hint on every call, no cooldown). Override via LEAN_CTX_BYPASS_HINTScache_max_tokens(usize, default0— envLEAN_CTX_CACHE_MAX_TOKENS) — Token budget for the in-memory ctx_read cache (0 = built-in default 500k). When exceeded, least-valuable entries are evicted immediately via RRF (recency x frequency x size) so reads never block; eviction is not deferred to the staleness TTLcache_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_aggressiveness(f64, defaultnull— envLEAN_CTX_AGGRESSIVENESS) — Global compression intensity 0.0 (lossless) – 1.0 (max), mapped onto read modes/entropy/IB. Empty = per-mode defaultscompression_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 orderingcrush_verbatim_json(bool, defaultfalse— envLEAN_CTX_CRUSH_VERBATIM_JSON) — Opt-in: losslessly crush array-heavy JSON from verbatim data commands (gh api, jq, kubectl get -o json, curl). Off by default keeps them verbatim. Reshapes only when it at least halves the payload; fully reconstructiblecustom_aliases(array, default[]) — Custom command aliases (array of {command, alias} entries)dashboard_auth(bool, defaulttrue) — Require Bearer-token auth for the dashboard (default true). Set false for no-auth mode protected by Sec-Fetch-Site/Origin/Host checks. Override per-run with --no-auth or LEAN_CTX_DASHBOARD_AUTHdebug_log(bool, defaultfalse— envLEAN_CTX_DEBUG_LOG) — Opt-in (default off): write a human-readable debug log of intercepted MCP tool calls and hook routing decisions (lean-ctx vs native, with the reason) to <state_dir>/logs/debug.log. View withlean-ctx debug-logdefault_tool_categories(string[], default[]) — Tool categories active by default (core, arch, debug, memory, metrics, session). Override via LCTX_DEFAULT_CATEGORIESdelta_explicit(boolean, defaultfalse) — Serve explicit full/lines re-reads of changed cached files as diffs (opt-in). Override via LCTX_DELTA_EXPLICIT=1disabled_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, default15000) — Maximum files in graph index. 0 = unlimited (default). Set >0 to cap for constrained systemshook_binary(string?, defaultnull— envLEAN_CTX_HOOK_BINARY) — Verbatim binary path/expression for generated agent-hook commands (e.g. $HOME/.local/bin/lean-ctx) — for settings files synced across machines with different usernames. Shell-expanded by the hook host at run time; doctor accepts it as current. Empty = automatic absolute-path resolutionjournal_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_index_threads(usize, default0— envLEANCTX_INDEX_THREADS) — Cap rayon threads for the CPU-heavy index build (0 = all cores). Bounds per-instance CPU so concurrent sessions don't saturate the host on startupmax_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 interceptionpath_jail(bool?, defaultnull) — Filesystem path jail. null/true = enforced (tools confined to the project root + allow_paths). false = the blanket "any path" opt-out — every tool path is allowed (for containers/sandboxes where the boundary is external). Compression and secret redaction are unaffected. Flip both planes at once withlean-ctx yolo/lean-ctx securepermission_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_INHERITANCEpersona(string, defaultcoding— envLEAN_CTX_PERSONA) — Active context persona (persona-spec-v1): selects the domain bundle — tool surface, read-mode/compressor/chunker defaults, intent taxonomy, sensitivity floor. Built-ins: coding (default), research, lead-gen, support, data-analysis; or a custom .toml from the personas dir. Override via LEAN_CTX_PERSONAprefer_native_editor(bool, defaultfalse) — Disable lean-ctx edit tools (ctx_edit, ctx_patch) so the host's native editor handles edits (#454)preserve_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_loopback_open(bool, defaultfalse) — Skip ALL proxy authentication on loopback binds. MCP/HTTP clients work without tokens. Ignored on non-loopback (gateway mode)proxy_port(u16?, defaultnull) — Custom proxy port (default: 4444). Useful for multi-user systems. Env: LEAN_CTX_PROXY_PORTproxy_require_token(bool, defaultfalse) — Require lean-ctx Bearer token authentication and disable provider API key fallbackproxy_timeout_ms(u64?, defaultnull) — Proxy reachability timeout in ms (default: 200). Override via LEAN_CTX_PROXY_TIMEOUT_MSread_dedup(enum: auto | on | off, defaultauto— envLEAN_CTX_READ_DEDUP) — Controls the PostToolUse native-Read re-read dedup. auto (default): replace only re-reads of unchanged files with the compact stub, and only on guard hosts (Claude Code / CodeBuddy) where the PreToolUse redirect is off — first reads stay byte-identical and the read-before-write guard is untouched. on: dedup wherever the hook fires. off: never replace a Read resultread_only_roots(string[], default[]— envLEAN_CTX_READ_ONLY_ROOTS) — Read-only sibling roots: reads allowed, writes always denied (edit/refactor/export)read_redirect(enum: auto | on | off, defaultauto— envLEAN_CTX_READ_REDIRECT) — Controls the native-Read → ctx_read redirect hook. auto (default): redirect everywhere except hosts with a native read-before-write guard (Claude Code / CodeBuddy), where rewriting Read to a temp copy breaks native Write/Edit (#637). on: always redirect. off: never redirect native Read (ctx_read MCP tool + Grep/Glob redirect stay active)recovery_hints(enum: off | minimal | full, defaultminimal) — Verbosity of the reactive recovery footer on compressed output (path-first, MCP-optional)redirect_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, defaultagents-only— envLEAN_CTX_SHELL_ACTIVATION) — Controls when the shell hook auto-activates aliases (agents-only since #699: transparent in plain human terminals)shell_allow_writes(bool, defaultfalse— envLEAN_CTX_SHELL_ALLOW_WRITES) — Allow ctx_shell file-write redirects (>, >>, tee, heredoc-to-file, curl -o, wget default mode). Default false — prefer the native Write/Edit tool. The real command gating (allowlist, dangerous-pattern, interpreter-eval) still appliesshell_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_heavy_timeout_secs(u64?, defaultnull— envLEAN_CTX_SHELL_HEAVY_TIMEOUT_SECS) — Shell command timeout (seconds) for heavy commands (cargo build/test, make, docker build, git commit/push). null = built-in 10-minute ceilingshell_hook_disabled(bool, defaultfalse— envLEAN_CTX_NO_HOOK) — Disable shell hook injectionshell_security(string, defaultenforce— envLEAN_CTX_SHELL_SECURITY) — Shell command gating: enforce (default, secure), warn (log only, never block) or off (skip allowlist + hard blocks; compression stays active)shell_strict_mode(bool, defaultfalse) — Block $(), backticks, <() in shell arguments. Default false = warn only.shell_timeout_secs(u64?, defaultnull— envLEAN_CTX_SHELL_TIMEOUT_SECS) — Shell command timeout (seconds) for normal commands. null = built-in 2-minute default. LEAN_CTX_SHELL_TIMEOUT_MS overrides both tiers (in ms)skip_agent_aliases(bool, defaultfalse) — Do not install agent CLI aliases (claude, codex, gemini) into shell rc files. Existing alias blocks are removed on next setupslow_command_threshold_ms(u64, default5000) — Commands taking longer than this (ms) are recorded in the slow log. Set to 0 to disablestructure_first(bool, defaultfalse— envLEAN_CTX_STRUCTURE_FIRST) — Opt-in: biasautotoward structure-first reads (map) for medium code files on a cold read. Off by default — for phase-isolated harnesses with no warm-session cache payback. Override via LEAN_CTX_STRUCTURE_FIRSTsymbol_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 | highcompression | always, defaulthighcompression) — 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 (5 tools), standard (16), power (all). Override via LEAN_CTX_TOOL_PROFILEtools_enabled(string[], default[]) — Explicit list of enabled tool names. Used only when no tool_profile is pinned (tool_profile takes precedence); leave tool_profile unset to apply this list. The universal invoker ctx_call stays advertised so unlisted tools remain reachable — add it to disabled_tools (disabled_tools = ["ctx_call"]) to make this allowlist authoritative.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
[addons]
Addon ecosystem security floor: install policy, signature requirement, per-addon capability sandbox (#863, P1). Global-only.
allow_bootstrap(bool, defaulttrue) — Allowaddon addto install an addon's upstream package via a pinned manager (uv/pip/cargo/npm/brew/dotnet). Off = refuse bootstrap installsallowlist(array, default[]) — Addon slugs permitted when policy = allowlistblock_risky(bool, defaultfalse) — Refuse to install an addon that has a high-risk (Danger) capabilityenforce_capabilities(bool, defaultfalse) — Fail closed when an addon declares restricted [capabilities] but no OS sandbox launcher is available to enforce themgrammar_auto_fetch(bool, defaulttrue) — Zero-config grammar-addon fetch (#690): download a SHA-256-pinned grammar dylib on first use of a covered extension. Off = regex-signature fallback only (strict egress/DLP posture)metering(bool, defaulttrue) — Record per-addon / per-tool gateway usage to <data_dir>/addons/usage.json (analytics + billing base)policy(enum: open | verified_only | allowlist | locked, defaultopen) — Addon install policy: open (any) | verified_only | allowlist | lockedrequire_signature(bool, defaultfalse) — Honour a user-override registry only if signed by a trusted org keysandbox(enum: off | auto | strict, defaultoff) — Sandbox spawned addon stdio servers: off | auto (block network) | strict (read-only fs + refuse if no launcher)
[archive]
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
[autonomy]
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, default9— envLEAN_CTX_COGNITION_LOOP_MAX_STEPS) — Maximum steps per cognition loop iteration (>= 9 enables observation synthesis)cognition_synthesis_min_cluster(usize, default3— envLEAN_CTX_COGNITION_SYNTHESIS_MIN_CLUSTER) — Minimum facts per entity before observation synthesis writes a summary (needs cognition_loop_max_steps >= 9)consolidate_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
[boundary_policy]
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]
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
[context]
Fixed-context budget accounting (#964)
budget_tokens(usize, default8000— envLEAN_CTX_CONTEXT_BUDGET_TOKENS) — Fixed per-session context budget (tool schemas + MCP instructions + auto-loaded rules + wakeup briefing).doctor overheadwarns past this;doctor overhead --gateexits non-zero for CI. 0 disables the warning
[cost]
Model declaration for measured-vs-estimated cost reporting
default_model(string?, defaultnull) — Fallback pricing model for MCP-only IDEs whose real model lean-ctx cannot observe (Cursor, Copilot, Windsurf, …). Unset → blended heuristic. Per-IDE overrides live in [cost.models]prices(table?, default[]) — Operator price overrides per model, USD per million tokens: [cost.prices.""] with input_per_m / output_per_m / cache_write_per_m / cache_read_per_m. For negotiated enterprise rates (committed-use discounts, Azure PTU, zero-rated internal models); overrides embedded and live catalog rows, only a provider-measured bill beats it
[custom_aliases]
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')
[embedding]
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.deterministic(bool, defaultnull— envLEAN_CTX_EMBEDDING_DETERMINISTIC) — Pin embedding inference to a single CPU thread with no GPU provider so vectors are bit-identical across machines (default: off, multi-threaded GPU-capable path). Extractive prose ranking is already deterministic via score quantization; enable this only for cross-machine reproducibility, at a throughput cost.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), nomic (768d) — or any HuggingFace repo with an ONNX export via hf:org/repo[@revision] (e.g. hf:jinaai/jina-embeddings-v2-base-code for code). Switching models re-indexes once on the next search.
[gain]
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
[gateway]
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)
[gateway.servers]
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)
[gateway_server.mcp_servers]
Org-gateway MCP registry (array of tables: [[gateway_server.mcp_servers]]): reverse-proxied under /mcp/{id} with per-person keys, metered into mcp_events, tool definitions hash-tracked (observe stage, GL#91)
auth_env(string, default"") — Env var holding the upstream credential the gateway injects asAuthorization: Bearer <env value>(callers never see it)enabled(bool, defaulttrue) — Per-server switch (default true)id(string, default"") — Registry id; becomes the governed route/mcp/{id}on the proxy port (lowercase alnum/-/_)url(string, default"") — Upstream Streamable-HTTP endpoint (HTTPS; loopback HTTP ok; plain HTTP needs [proxy] allow_insecure_http_upstream)
[graph]
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.
[ide_paths]
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).
[index]
Index-time file filters: declare the retrieval corpus explicitly (BM25 + graph + semantic + watch share one filter layer, #735)
exclude(string[], default[]) — Globs dropped from the index corpus (root-relative, forward slashes), e.g. ["/*.csv", "fixtures/"]. Wins over include. CLI --exclude appends per run. Excluded files produce no chunks, graph nodes, or embeddings.include(string[], default[]) — When non-empty, ONLY matching files enter the index corpus, e.g. ["/*.rs", "/*.ts"]. Empty = no restriction. CLI --include replaces this set per run.respect_gitignore(bool, defaulttrue) — Honor .gitignore / global gitignore / .git/info/exclude during index walks. false indexes ignored files too (the vendor-directory guard still applies). CLI override: --no-gitignore / --respect-gitignore.
[llm]
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]
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]
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
[memory.embeddings]
Embeddings memory settings for semantic search
max_facts(usize, default2000) — Maximum number of embedding facts stored
[memory.episodic]
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
[memory.gotcha]
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
[memory.knowledge]
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
[memory.lifecycle]
Knowledge lifecycle policy (decay, staleness, dedup)
archetype_aware_decay(bool, defaultfalse) — Scale Ebbinghaus stability by fact archetype so structural evidence decays slower than inference (default false)base_stability_days(f32, default90.0) — Characteristic memory stability (days) for the Ebbinghaus curvedecay_rate(f32, default0.01) — Rate at which knowledge confidence decays over timeforgetting_model(string, defaultebbinghaus) — Forgetting curve: ebbinghaus (default, exponential + spacing) or linearlow_confidence_threshold(f32, default0.3) — Threshold below which facts are considered low-confidencereclaim_enabled(bool, defaulttrue— envLEAN_CTX_LIFECYCLE_RECLAIM_ENABLED) — Master switch for the proactive capacity reclaim (#995). false trims only the overflow (escape hatch, no headroom); eviction stays lossless either wayreclaim_headroom_pct(f32, default0.25— envLEAN_CTX_LIFECYCLE_RECLAIM_HEADROOM_PCT) — Proactive headroom on a capacity reclaim: settle a full store at 1 - this fraction (0.25 = 75%) instead of churning at the cap. Lossless — the reclaimed tail is archived and restorablesimilarity_threshold(f32, default0.85) — Similarity threshold for deduplicationstale_days(i64, default30) — Days after which unused facts are considered stale
[memory.procedural]
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
[model_context_windows]
Per-model context-window overrides in tokens. Keys are model names (case-insensitive), values override every registry layer — use for models the bundled/local registry does not know yet. Bracketed window markers in the model name itself (e.g. claude-opus-4-8[1m]) are parsed automatically and need no entry here. Example: [model_context_windows]\n"my-custom-model" = 500000
No sub-keys (presence of the section toggles the feature).
[providers]
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]
Proxy upstream configuration for API routing
allow_custom_upstream(bool, defaultfalse— envLEAN_CTX_ALLOW_CUSTOM_UPSTREAM) — Allow a custom (non-allowlisted) HTTPS upstream host, e.g. a corporate gateway in front of the provider API. Opt-in; default false. Unlike the env var, this config flag reaches the managed (service-spawned) proxy started byproxy enable/restart(#590)allow_insecure_http_upstream(bool, defaultfalse— envLEAN_CTX_ALLOW_INSECURE_HTTP_UPSTREAM) — Allow a non-loopback plaintext http:// upstream (trusted local network only, e.g. http://host.docker.internal:2455 in front of codex-lb). Opt-in; default falseanthropic_upstream(string?, defaultnull) — Custom upstream URL for Anthropic API proxycache_align_relocate(bool, defaultfalse— envLEAN_CTX_PROXY_CACHE_ALIGN_RELOCATE) — Opt-in active cache-aligner relocate (#974). When on, the proxy rewrites an unanchored Anthropic system prompt into a stable block (volatile values - ISO dates/datetimes, UUIDs, git SHAs - replaced by constant placeholders) carrying the cache_control breakpoint, plus an uncached trailing block that re-states the relocated values. The cacheable prefix then stays byte-stable turn-to-turn and finally caches; only the small tail is reprocessed. Anthropic-only, Treatment-arm, gated on a client that anchored nothing and on Anthropic's minimum cacheable size. Deterministic (#498) and idempotent. The cache_aligner telemetry is the precursor that quantifies the saving. Default falsecache_aligner(bool, defaulttrue— envLEAN_CTX_PROXY_CACHE_ALIGNER) — Cache-aligner volatile-field telemetry (#940), on by default. The proxy scans each unanchored Anthropic system prompt for volatile, cache-busting fields (ISO dates/datetimes, UUIDs, git SHAs) and reports how many it found on /status cache_safety (volatile_system_requests, volatile_fields_detected) - purely to quantify how much prompt-cache the client leaks. Measurement only: the request body is never mutated, so it is strictly cache-safe, which is why it ships on for every proxy (#986 premium defaults). The deterministic scan is the precursor to the opt-in tail-relocate below. Set false to opt out of the per-request scan. Default truecache_breakpoint(bool, defaultfalse— envLEAN_CTX_PROXY_CACHE_BREAKPOINT) — Opt-in active prompt-cache breakpoint injection for Anthropic (#939). When on and the client set no cache_control of its own, the proxy adds one cache_control: {type:ephemeral} marker to the system field so an otherwise-uncached, stable system prompt bills later turns at the cached rate (the win a raw API client leaves on the table). Anthropic-only: OpenAI/Gemini cache prefixes automatically and ignore the marker, so those paths stay byte-unchanged. Deterministic, never adds a second breakpoint, and skipped below Anthropic's minimum cacheable size. Default falsecache_policy(bool, defaulttrue— envLEAN_CTX_PROXY_CACHE_POLICY) — Cache-economics (#986), on by default. Enables prompt-cache miss attribution telemetry (per turn, classify the outcome as cold start / warm reuse / TTL lapse / prefix change and report cumulative gauges on /status cache_attribution) plus a net-cost gate on the cold-prefix repack that skips re-seeding prefixes too small to be cached (below Anthropic's ~1024-token minimum). The telemetry never mutates the body and the gate only makes repacking more conservative, so it can never bust a cache that would otherwise have been kept - both halves are strictly safe, so every proxy gets them out of the box (#986 premium defaults). Set false to opt out (drops the /status attribution gauges and the per-request prefix hash). Default trueccr_inband(bool, defaultfalse— envLEAN_CTX_PROXY_CCR_INBAND) — Opt-in in-band CCR retrieval for a remote proxy with no shared filesystem (#493). When on, a lossy stub advertises a compact <lc_expand:HASH> marker instead of a local tee path; when the model echoes that marker, the proxy splices the verbatim original (from its local tee store) back inline next turn — one turn of latency, no MCP/filesystem on the agent host. The splice is a strict no-op on marker-less turns, so it never perturbs the provider cache prefix unless the model asked to expand. Default falsechatgpt_upstream(string?, defaultnull) — Custom upstream URL for ChatGPT/Codex subscription API proxycodex_chatgpt_proxy(bool, defaultfalse— envLEAN_CTX_CODEX_CHATGPT_PROXY) — Opt-in routing of a Codex ChatGPT-subscription login through the proxy for model-turn compression (#603/#616). Default false leaves Codex native (history visible, cloud/remote intact, no #597). When true, setup pins model_provider = leanctx-chatgpt + chatgpt_base_url + a [model_providers.leanctx-chatgpt] block, so model turns route through /backend-api/codex/responses (the proxy strips the responses-lite marker so every model incl. gpt-5.5 works); pinning a provider scopes Codex history to it (#597), hence opt-in. Toggle durably withlean-ctx proxy codex-chatgpt on|off|status. Default falsecold_prefix_repack(bool, defaultfalse— envLEAN_CTX_PROXY_COLD_PREFIX_REPACK) — Opt-in big-gap cold-prefix repack (#480): on a session-resume request the proxy may predict (from idle time vs the provider cache TTL) that the client-cached prefix has already expired, then prune that now-cold prefix to re-seed a leaner cache and keep applying the same deterministic compression on later turns so warm follow-ups hit it (sticky; baselines persist across restarts, #499). A wrong guess re-bills cache reads as writes (~12x), so default falsecompress_protect(string[], default[]) — File-path globs whose reads are never compressed (#1150): a matching path is returned verbatim (full) by the read tools, for files where exact bytes matter more than token savings (golden snapshots, byte-asserted fixtures, security-sensitive configs). Globs (*/**/?) match the path and its file name, so .snap, /golden/, tests/fixtures/ all work. Empty (default) protects nothing — the lossless crushers and beneficial gate already keep compression safe; this is an explicit escape hatchcost_response_header(string, defaultnull) — Extra response header carrying the upstream gateway's billed USD for the turn (e.g. a corporate gateway's cost header). LiteLLM's x-litellm-response-cost is always recognized. Measured header costs beat table estimates; body-reported costs (OpenRouter usage.cost) beat headerscounterfactual_metering(bool, defaultfalse— envLEAN_CTX_PROXY_COUNTERFACTUAL) — Opt-in counterfactual savings metering (#701): each rewritten Anthropic /v1/messages request fires a free count_tokens probe with the original, uncompressed body, concurrently with the real forward. The provider-counted answer is paired with the same response's billed usage — provider-authoritative savings receipts ('would have cost N, billed M') instead of local tokenizer estimates, shown as verified_savings on /status. The probe never mutates or delays the forwarded request; failures degrade to the estimate. Default false (one extra free HTTP call per compressed request)effort(enum: off | minimal | low | medium | high, defaultoff— envLEAN_CTX_PROXY_EFFORT) — Cache-safe cross-provider reasoning-effort control (#834). off (default) = no-op. minimal|low|medium|high pins the model's reasoning depth across providers: lean-ctx translates it to OpenAI reasoning_effort / reasoning.effort, Anthropic output_config.effort, and Gemini thinkingConfig (thinkingLevel on 3.x, thinkingBudget on 2.5 pro/flash), only on models that accept it and only when the client didn't set its own value. The level is a constant, so it never breaks the provider prompt cache (unlike per-turn effort routing). Anthropic is dialed only when the client already requested adaptive thinkinggemini_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 prunelive_compress(bool, defaulttrue— envLEAN_CTX_PROXY_LIVE_COMPRESS) — Live-compress non-protected tool_result content on the wire (#481). Default true. Set false for a meter-only proxy — real billed/cache token metering with zero request rewriting (combine with history_mode = "off" and no role_aggressiveness for a byte-unchanged body)live_compress_exclude(string[], default["serena"]) — Tool-name patterns (case-insensitive substring) whose tool_result is never live-compressed — treated as protected, like a file read (#481). Unset protects Serena's code-reading tools; set an explicit list to narrow it, or [] to disablemeter_openai_usage(bool, defaulttrue) — Inject stream_options.include_usage into streamed OpenAI Chat Completions so the final chunk reports real token usage for the measured spend meter. Default trueopenai_upstream(string?, defaultnull) — Custom upstream URL for OpenAI API proxyoutput_holdout(f64, default0.0— envLEAN_CTX_PROXY_OUTPUT_HOLDOUT) — Fraction 0.0-1.0 of conversations placed in the output-savings control arm (#895). 0 (default) = no holdout (every conversation is output-shaped). When > 0, a deterministic cohort = blake3(system + first user message) puts ~this fraction in a control arm that skips output-shaping (effort control + verbosity steer) but is still metered, yielding an honest measured output-token reduction (lean-ctx output-savings). The cohort is a pure function of conversation identity, so a conversation keeps one arm across all turns - cache-safeprose_ranker(enum: auto | extractive | truncate, defaultauto— envLEAN_CTX_PROXY_PROSE_RANKER) — How the proxy squeezes prose it must shrink (#895). auto (default) and extractive use embedding-based extractive ranking — keeping the most central sentences instead of just the prefix — when the local embedding engine is available, else fall back to truncation; truncate keeps the original deterministic FIFO squeeze and never loads the engine. Wire rewrites are memoized per content so the engine's cold→warm transition never changes an already-emitted frozen-region rewrite (cache-safe, #448/#498)verbosity_steer(bool, defaultfalse— envLEAN_CTX_PROXY_VERBOSITY_STEER) — Opt-in cache-safe wire verbosity steer (#895). When true, the proxy appends a single constant 'be concise' instruction to the last user turn of each request - output-shaping for raw API clients that do not load lean-ctx rules. The suffix is constant and appended strictly after the last cache_control breakpoint (a new trailing text block, never modifying a cache-anchored block), so the provider prompt-cache prefix stays byte-stable. Under an output_holdout the control arm skips it so its effect is measured. Default false
[proxy.role_aggressiveness]
Opt-in per-role prose compression for the proxy's frozen request region (#710). Assistant turns are always passed through verbatim
system(f64, defaultnull— envLEAN_CTX_PROXY_SYSTEM_AGGR) — Opt-in prose compression intensity (0.0–1.0) for system prompts in the proxy's frozen request region. Unset = leave untouched. Higher = more aggressive. Cache-safe (deterministic, never touches the client-cached prefix)user(f64, defaultnull— envLEAN_CTX_PROXY_USER_AGGR) — Opt-in prose compression intensity (0.0–1.0) for free-text user turns (never tool results) in the proxy's frozen request region. Unset = leave untouched
[search]
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_enabled(bool, defaulttrue) — Enable the dense (embedding) retrieval path. false → hybrid search ranks with BM25 + graph + rerank (+ SPLADE) only, skipping the embedding engine and the persistent embeddings.json (lighter footprint, no embed latency). An explicit mode=dense query still forces dense.dense_weight(f64, default1.0) — Dense vector search weight in RRF fusionsplade_weight(f64, default0.5) — SPLADE expansion weight (0.0 to disable)
[secret_detection]
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 outputsexclude_patterns(array, default[]) — Subtractive allowlist: matches covered by these regexes are never reported or redacted (#718)redact(bool, defaulttrue) — Redact detected secrets from output
[sensitivity]
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
[setup]
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]
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).
[summaries]
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).
[updates]
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