Fixed
- CRITICAL: Worktree data-loss prevention for
ctx_patch replace_symbol(#803).
When bothname_pathandpathare provided, the resolved symbol location
is now verified against the caller's explicit path viacanonicalize(). A
mismatch (e.g. main checkout vs linked git worktree) returns
ERROR: WORKTREE_MISMATCHinstead of silently writing to the wrong file. - CRITICAL: Agent wrapper detection for sandbox-exec wrapped commands (#745).
strip_outer_shell_invocationnow recursively removes/bin/{zsh,bash,sh} -c '...'
wrappers before detecting the inner agent command. Fixes cases where macOS
sandbox-execadded an outer shell invocation that brokehas_trailing_bare_pwd
detection due to a trailing quote character. - Compression-marker guard for Write/Edit hooks (#805).
PreToolUsedeny handler now intercepts Write, Edit, StrReplace, and MultiEdit
payloads containing[lean-ctx:compression markers and blocks the operation
before compressed output is written to disk. Escape hatch:
LEAN_CTX_ALLOW_COMPRESSED_WRITE=1. Fixed false-positive for Markdown links
like[lean-ctx docs](url)by removing the overly broad[lean-ctxpattern. - Hermes rules marker-based updates (#802).
install_hermes_rulesnow usesmarked_block::upsertwith<!-- lean-ctx -->
markers instead of a substring check, ensuring rules update correctly across
versions while preserving user content inHERMES.md. - CODEX_THREAD_ID forwarding via parent-env probe (#800).
When no captured agent runtime variables exist,load()now probes the parent
process environment (/proc/<ppid>/environon Linux,ps ewwon macOS) for
forwardableCODEX_*/CLAUDE_*variables. Filtered by prefix allowlist +
credential exclusion, persisted with 0o600 permissions and 2h TTL. - Tool health hint typo (PR #804). Config key in the "consider disabling"
hint corrected fromtools_disabledtodisabled_tools.
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.9...v3.9.9