Token Overhead Reduction, JSONC Support, XDG Compliance, Shell Hook Control
Addresses GitHub issues #150, #151, #152, #153.
Changed (BREAKING)
- Lazy tools now the default — Only 9 core tools are exposed by default instead of 46. This reduces per-turn input token overhead by ~80%. Use
LEAN_CTX_FULL_TOOLS=1to opt back in to all tools. Thectx_discover_toolstool lets agents discover and load additional tools on demand. (#153)
Added
- JSONC comment support —
lean-ctx setupand all editor config writers now parse JSON with//and/* */comments using a built-in JSONC stripper. Config files with comments (e.g.opencode.json) are no longer treated as invalid and overwritten. (#151) - XDG Base Directory compliance — New installs use
$XDG_CONFIG_HOME/lean-ctx(default~/.config/lean-ctx/) instead of~/.lean-ctx. Existing~/.lean-ctxdirectories are detected and used automatically — no migration required. (#152) minimal_overheadconfig option — Setminimal_overhead = truein config orLEAN_CTX_MINIMAL=1env var to skip session/knowledge/gotcha blocks in MCP instructions, minimizing token overhead for cost-sensitive workflows. (#153)- Shell hook disable — New
--no-shell-hookflag forlean-ctx init,shell_hook_disabled = trueconfig option, andLEAN_CTX_NO_HOOK=1env var to disable the_lc()shell wrapper across all shells (bash, zsh, fish, PowerShell). MCP tools remain fully active. (#150)
Fixed
- Shell hook source lines now use the resolved data directory path instead of hardcoded
~/.lean-ctx, matching XDG-compliant installations. upsert_source_linedetection works for both legacy and XDG hook paths (including Windows backslash paths).- Flaky CI test
setup_bootstrap_doctor_status_json_smokeno longer fails whendoctor --fixreturns exit code 1 in environments without shell profiles.
Upgrade
lean-ctx update # recommended (auto-downloads + refreshes shell hooks)
cargo install lean-ctx # or
npm update -g lean-ctx-bin # or
brew upgrade lean-ctxNote: After upgrading via cargo/npm/brew, run
lean-ctx setupto refresh shell aliases.lean-ctx updatedoes this automatically.
Important: Shell hooks changed in this release (LEAN_CTX_NO_HOOKcheck added). Runlean-ctx setupto get the updated_lc()function.
Full Changelog: v3.3.9...v3.4.0