Added
- Runtime
tools/list_changednotifications (GH #1250).
When the user changestool_profile,tools_enabled, ordisabled_tools
via dashboard, CLI, or manual config edit, the MCP server now automatically
sends anotifications/tools/list_changedto the IDE client on the next
tool call. No more "restart IDE to pick up profile changes" — Cursor,
Claude Code, and all MCP clients refresh their tool surface immediately.
New module:server/tools_config_watchwith hash-based change detection. - CLI profile-switch messaging updated.
lean-ctx tools <profile>now prints "Changes take effect on the next
tool call (auto-detected)" instead of "Restart your AI tool / IDE".
Fixed
lean-ctx index buildmemory explosion capped (GH #790).
Six fixes that together prevent unbounded RAM growth during index builds:- Memory Guardian activated for CLI builds —
start_guard()now runs
beforeensure_all_background(), so pressure/abort checks in graph and
BM25 code actually fire (previously only started in daemon mode). graph_index_max_filesdefault 0 → 15 000 — caps the graph scan;
override withgraph_index_max_files = 0for unlimited.- Graph
content_cachecapped at 256 MB — stops caching file contents
once the budget is hit; the edge builder falls back to disk reads. - Edge build batched (500 files/batch) —
par_iter(ALL)replaced with
chunked parallel batches and memory-pressure checks between them. - BM25 chunk content truncated to 10-line snippets during build — full
text is tokenised for scoring, then the stored body is snipped immediately
(no more holding every file's full content in the chunk vector). - BM25 save streams through zstd —
postcard::to_allocvecreplaced with
postcard::to_io→zstd::Encoder→ temp file; eliminates the
intermediate uncompressedVec<u8>allocation entirely.
- Memory Guardian activated for CLI builds —
- Cursor Read redirect removed — savings jump from 9.5 % to 73+ % (GH #1250).
Cursor'sStrReplaceinternally triggers a nativeReadthat the
redirect hook intercepted, producing verbatimcli_fulloutput with
~0.5 % savings. This dominated the token stats (68 % of all input tokens!)
and dragged the overall savings rate to single digits. The Read matcher
is now removed from Cursor'spreToolUseredirect hook — native Reads
pass through unmodified (StrReplace works), and the agent usesctx_read
(MCP) for compressed reads, matching how Claude Code already works
(read_redirect = auto). Grep redirect remains for compression.
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.
Full Changelog: v3.9.7...v3.9.7