v3.3.3
Session Stability + Dashboard Clarity
Bug fixes — Session root handling (PR #138)
- Stale session root across checkouts: Fixed issue where switching between project directories could load a session from a different workspace. New
load_latest_for_project_root()scans all session files and returns the most recent session matching the target project root, using canonicalized path comparison. - Session normalization extracted:
normalize_loaded_session()now handles empty-string cleanup and stale project root healing in a single place, called from bothload_by_id()andload_latest_for_project_root(). - Startup context detection: New
detect_startup_context()derives the correct project root and shell working directory at MCP server startup, even when the IDE provides only a subdirectory path (e.g.repo/src). - Trusted re-rooting:
resolve_path()now checksstartup_project_rootbefore allowing session re-rooting from absolute paths. Only paths matching the trusted startup root can trigger a re-root, preventing accidental session takeover by untrusted paths. - Helper functions: Added
session_matches_project_root(),has_project_marker(), andis_agent_or_temp_dir()tosession.rsfor robust session matching and stale-root detection.
Improvements — Dashboard and metrics clarity
- 0%-savings tools hidden from
lean-ctx gain: Write-only tools likectx_editthat don't compress output are no longer shown in the "Top Commands" section, preventing confusing "0% savings" entries. - 0%-savings tools hidden from
ctx_metrics: The MCPctx_metricstool now filters out tools with zero token activity from the "By Tool" breakdown.
Code quality
- Fixed all clippy warnings: resolved
MutexGuardheld across await points in tests,vec!macro used where array literal suffices, andDefault::default()struct update with all fields specified. - All 1295 tests pass with zero warnings, zero clippy errors, full parallel execution.
Closed issues
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.3.3...v3.3.3