Repository navigation
v3.12.10
Upgrade notes
-
lean-ctx config validateexits with 1 when the loader cannot read the
config (gh-2283). A known key with a value the loader rejects made
lean-ctx run on defaults whilevalidatereported success; it now names the
value and fails, so scripts that ranvalidateon such a config see exit
code 1. -
Vault links now belong to the Cloud and account they were made on.
After connecting to another Cloud, or to another account on the
same Cloud, this computer no longer shows, syncs, uploads or reports
anything for the vaults of the previous one. Their links are removed at
the switch, like the rest of the previous team's local Cloud data since
3.12.8, and connecting back does not bring them back: link the repository
again withlean-ctx cloud link <workspace>/<vault>. Vault links recorded
by an earlier version carry no Cloud or account; they count as made on
the Cloud and account this computer last connected with, and are removed
when it connects to another one. If the computer was not connected when
it upgrades, they are removed at its next connect.
Security
-
The shell gate follows a dangling symlink to the state it names. A
cdor path through a link whose target does not exist yet (a link to
~/.configon a machine without one, or to a directory inside lean-ctx's
state not created yet) was judged at the link itself, so a git chain behind
such acdcould pass the state-tampering check. Links are now followed to
their target, up to 40 hops. -
resources/readno longer serves files outside the session's roots when
no project root is bound (GHSA-836r-2hg2-j56w). A session without a project
root (the client started lean-ctx in a directory outside any project) skipped
the jail forfile://resource reads, soresources/readreturned any UTF-8
file up to 2 MiB, such as/etc/hosts. A resource read now passes the same
PathJail resolver asctx_readand must lie inside the project root or an
extra_rootsentry; without a project root onlyextra_rootsare served,
and the refusal says how to bind a root. The resolved file, not a symlink
re-resolved later, is what is read.ctx_heatmap action=coldnow walks the
jail-resolvedpathinstead of the raw argument. -
An interpreter heredoc sent to ctx_shell now needs the same approval as
ctx_execute (GHSA-hqgc-cjh7-q3w4). ctx_shell hands a heredoc for an
interpreter such aspython3ornodeto ctx_execute. That hand-off skipped
the checks ctx_execute applies to its own calls: the session's rights profile
and, undershell_security = "enforce", the per-language approval
(execute_allowed_languagesor a prompt). It now applies both through one
shared check, and the approval prompt names the language. When the language
is not approved, the command is judged as a shell command instead and is
refused unless inline scripts are allowed. Commands that follow the heredoc
are checked against the shell allowlist before anything runs, not after the
heredoc has run. Heredocs into data readers such ascatare unchanged.
Added
-
Opt-in compression when stdout is a file (gh-2275).
lean-ctx -cpasses
output through verbatim when its stdout is a regular file, so a redirect
keeps its bytes. Some agent shell tools, such as Claude Code's Bash tool,
capture a command's output by writing it to a file, so they never got
compressed output. WithLEAN_CTX_COMPRESS_FILE_STDOUT=1they get the same
output a pipe gets. The variable is documented only: setup does not set it.
Caution: with it set, every regular file on lean-ctx's stdout is
compressed, including a user's ownlean-ctx -c "git diff" > patch.diff,
which then holds lossy output with markers. Set it only in the environment
of an agent's shell tool, never globally (shell profile). Only a redirect
inside the command string (#1303) stays verbatim either way. -
Background ctx_shell jobs as MCP Tasks (#1722). A client that declares the
MCP Tasks extension (SEP-2663,io.modelcontextprotocol/tasks) now receives a
task instead of the launch acknowledgement when a ctx_shell call starts or
auto-detaches onto a background job. The task id is theshell_*job id plus its
run generation (shell_…@g<N>), so a rerun of the same command is a new task:
tasks/getreportsworkingwhile the job runs and then returns, as its
result, the same tool resultctx_shell(background_action="status")returns —
a non-zero exit or a timeout (exit 124) completes withisError: true, a
cancelled job settlescancelled.tasks/cancelruns the
background_action="cancel"call through the same gates and kills the job.
Everytasks/getruns the status call under the caller's own rights; no
result is served from a cache. An
evicted job and an unknown task id are explicit-32602errors with
errorCodebackground_job_not_found_or_expiredandtask_not_found. The job
starts only after every gate of the ordinary call has passed. Clients that do
not declare the extension, and therun_in_background/
background_actionpolling API, are unchanged. Status changes are not pushed
(notifications/taskshas no delivery route in rmcp yet); clients poll
tasks/getat the advertisedpollIntervalMs. -
Trace per change. When an agent submits or verifies a Cloud task, LeanCTX on this machine pins the digest of the task receipt, keyed session refs, chain heads, delivery counts and the policy digests that permitted the context (
leanctx.cloud.task-evidence/v1, sent with the receipts and under the same switches; only to a Cloud that announceschange_trace).lean-ctx task trace <n> --jsonshows what was pinned and how to recompute the digest;lean-ctx tasks update <n> --brief-digest sha256:…records the digest of the session's brief. The contract also defines the decision → task → change link by ids and how a reader fetches and verifies the ECCP notes. Content stays on the machine (contractdocs/contracts/local-read-v1.md§36). -
lean-ctx cloud computer runner add|list|remove: CI runners for GitHub and GitLab on LeanCTX computers.runner add --gitlab https://<host>or--github <owner/repo>binds a runner to the existing LeanCTX computer of your team (--team, or the team this machine is connected to) or of your account (--personal); the computer keeps its role and price, andremoveunbinds the runner while the computer stays. Both run only with--yes. The registration token is read after--yesfrom standard input (--token-stdin) or a hidden prompt, checked for the forge's shape, goes only to the Cloud over TLS in a body that is wiped after sending, and is never a flag, printed, logged or stored.--jsonprints the Local Read kindscloud.runnersandcloud.runner.ack(local-read-v1 §45); the new error codestep_up_requiredasks the person to sign in again. -
lean-ctx computerruns on a LeanCTX cloud computer.lean-ctx computer run(started bylean-ctx-computer.serviceas the unprivileged
userleanctx, without capabilities) enrols the computer once with its
single-use enrolment token, reports a meter tick every minute (with
activewhile someone with access has a session or a job running, so the
idle stop waits), reports the SSH host key fingerprints once, and fetches
the SSH keys granted for the computer.lean-ctx computer sync-users
(root,lean-ctx-computer-users.service, started when the grants change)
turns them intolc-…Unix users in grouplc-userswithout sudo; a
revoked user is locked and logged out, never deleted, and a user it did
not create is never touched.lean-ctx computer diagis the fixed
diagnostic menu (status,help) for SSH logins. The tokens reach the
agent only as systemd credentials and never appear in arguments, logs or
output. The cloud computer itself is not available yet. -
Hotspots and a refactor plan.
lean-ctx hotspotslists the files that change most, are changed by merges, get reverted and are large, with a refactor plan per file (--json: Local Read kindhotspots.report,GET /v1/local/hotspots). The report formathotspots-v1is also read from Weave's.leanctx/hotspots.json.ctx_readandctx_composeend with a short--- Hotspot ---hint when they show a hotspot file. -
A team post that could not reach the Cloud can be sent again; one that arrived is not sent twice.
Changed
-
The CLI and the MCP server name the same project (#1315). Both now
resolve the project of a directory one way: the nearest git root, else the
outermost directory with a project marker (Cargo.toml,package.json, …),
never a broad root such as~, as a canonical path. Solean-ctx tasksand
ctx_tasksopen one local task store. Two layouts move to a new store key:
a project without.git, where the CLI used the bare working directory, and
a git repository inside an outer marker directory, where the MCP server used
the outer directory. Tasks kept under the old key stay on disk but are no
longer listed. Symlinked checkouts already shared one store. -
The rewrite hook reads
cat <file> | headandtailfrom the cache
(gh-2277).cat F | head -n N,cat F | tail -n Nandcat F | tail -n +N
(also-N,-nN, or no count) now become the samelean-ctx read F -m lines:…range ashead -n N F, also behind one leadingcd <dir> &&or
cd <dir>;, which stays in front of the read. Anything else keeps its
current handling: a second file or operand, byte counts,-v, follow, a
second pipe or anything after the sink, redirects,$, backticks, globs, a
secondcd,cd -,cd ~or a..component in the directory or file.
cd <dir> && <command>andsed -n N,Mp <file>were already rewritten.
head -n N a b(two files) no longer becomes a read ofbalone; it keeps
nativehead. -
CLI and tool messages say "the Cloud" instead of the product name.
Errors, status lines, help texts and tool descriptions oflean-ctx cloud,
lean-ctx tasks,lean-ctx docs,lean-ctx runand the MCP tools now name
the service as "the Cloud" (for example "Not connected to the Cloud.",
"Cloud tasks (2):" or "The Cloud asks to try again later"). Scripts that match
the old wording in these messages need the new text; error codes and JSON
field names are unchanged.
Fixed
-
Hybrid and dense
ctx_semantic_searchkeep working after the first query
(gh-2282). After the first search the resident index is shrunk to snippets,
and the cold-start guard counted every snippet as a pending embedding, so the
next hybrid search fell back to BM25 and dense reported "not built". The
embedding model loaded into an MCP server is also no longer counted against
its memory cap, which held a 512 MB server at hard pressure and refused every
later semantic search. -
The config reference matches the code (gh-2283).
response_verbosity
documentsfullandheaders_only; the valuesnormal,compactand
minimalfrom older docs still load instead of dropping the whole config to
defaults. The documented defaults ofauto_capture,journal_enabled,
memory_cleanup,shell_allowlistandgraph_index_max_filesare the ones
the code uses, andconfig-keys.mdlists every key the loader accepts. -
On Windows,
ctx_impactandctx_graphresolve Rust modules (gh-2269).
The graph index keys files with\, and the resolver found no crate root,
so every file showed unknown dependents. -
The team stop shows right after
cloud connect(#1314).cloud status
showedteam_stop: nulluntil the daemon's next pass, and a daemon the app
supervises, or one in an isolated instance, is not restarted by the connect,
so its Cloud scheduler and bus relay never started. The connect now reads
the team stop once, and a daemon that started before the connect starts its
scheduler and relay as soon as the machine is connected. -
A runtime install that fails says why in plain words. An expired
channel catalog is reported as such instead of as a manifest error, and
lean-ctx setup runtimewith wrong arguments names the install commands.
Since 3.12.8 the runtime is installed at connect without a question, and a
failed install is tried again at the next connect. -
A
cwdorcdin one ctx_shell call no longer moves every agent sharing
the connection (#2262). Claude Code subagents share one MCP connection, and
ctx_shell stored thecwdargument and any leadingcdon the session: one
agent's worktreecwdthen changed where the other agents' commands ran and
what their relative ctx_read and ctx_patch paths named, so a path that worked
a moment earlier came back doubled. Both now apply to that call only; a call
withoutcwdruns in the session's start directory. A relative path in
ctx_read, ctx_patch and the other path tools always names the file under the
project root, so a read and an edit of one path reach one file, and an edit of
a missing path names the file ctx_read would read in its place. Changed
contract: a caller that relied on a remembered directory passescwdon each
ctx_shell call, and reaches another checkout by absolute path or by its path
relative to the project root. -
ctx_impactuses the Rust module resolution ofgraph impact(gh-2269).
ctx_impact buildandupdatewrite the same structurally resolved Rust
importsandmoduleedges asctx_graph build, soctx_graph impact
gives the same answer for a.rsfile whichever built the graph; files
outside every module tree keep the previous resolution.updatere-resolves
every Rust file when a.rsfile orCargo.tomlchanged.ctx_impact analyzesays the dependents of an unresolved Rust file or crate root are
unknown, with the reason, instead of "No files depend on". A
#[cfg_attr(…, path = "…")]on amoddeclaration adds its target as
another file of the module, next to the default or#[path]file. -
ctx_graphserves the graphctx_impact buildwrote. With embeddings
enabled (the default build),ctx_impact buildandupdateleft the file
catalog empty, soctx_graphtreated the fresh graph as incomplete and
rebuilt its own index on the next call. Both now record every indexed file. -
graph impactresolves Rust module paths in a Cargo workspace (gh-2269).
use crate::/super::/self::, workspace crate names (-→_, renamed
dependencies),pub usere-exports and globs,modtrees withfoo.rs+
foo/,#[path], test modules and fully qualified paths now point at the
file that defines the item; mentions in comments or strings add nothing.
impacton a.rsfile lists direct and transitive dependents apart and
says "unknown" with a reason, never "No files depend", when the file is
outside every resolved module tree.graph statusshows the last scan for
the SQLite backend too. Graphs are rebuilt once (index version bump). -
The shell gate no longer refuses
time -pand assignments afterdo,
thenorelse(gh-2272).time -p ls ~ > /tmp/out.txtand
for d in ~; do n=$(ls $d); donenow pass like their plain forms.statand
lsofcount as metadata listers, and a pipe filter given only options
(| wc -l,| head -n 5,| sort | uniq -c) no longer counts as a reader of
the names reaching it. Reads of lean-ctx's records stay refused, including
wc --files0-from=-on a pipe. -
cd <repo> && git …is no longer refused when run from the home
directory (gh-2276). A line that starts with a literalcd <dir>
followed by&&and git commands only now places those git commands in
<dir>, like an absolutegit -C <dir>does. The directory must be
absolute,~,~/…,./…or../…, with no variable, glob or quote.
Acdinto lean-ctx's state still leaves git read-only, and acdto an
ancestor of the state (such ascd ~) still refuses work-tree writes.
Any other form (;,||, a subshell,cd $DIR, a secondcd) keeps the
earlier judgment. After acdthe gate cannot follow, git may now only
read unless an absolute-Cplaces it.GIT_DIR,GIT_WORK_TREE,
GIT_INDEX_FILE,GIT_OBJECT_DIRECTORYandGIT_COMMON_DIR(as a
prefix, behindenv, or exported earlier on the line) and
core.worktree(from-c,--config-envorgit config) are now
judged like--git-dirand--work-tree. A value set at run time is
judged conservatively.cd link/../diris also followed through the
symlink, the way bash falls back to it. When git is placed (by-C, such
acd, or the run directory) in a directory that is not a repository
itself, the gate now judges the repository git discovers above it: under
a dotfiles checkout of the home directory,git -C ~/notes checkout .
counts as working above lean-ctx's state and is refused, while a
directory inside a real project repository is unaffected.
Only the top-level command line is placed by itscd. A script that git
or a shell runs on its own (git submodule foreach,git rebase --exec,
git bisect run, ash -corbash -cbody, the inner command of
lean-ctx -c) runs where git puts it, so it keeps the earlier,
conservative judgment. Git configuration given through the environment
(GIT_CONFIG_COUNTwithGIT_CONFIG_KEY_n/GIT_CONFIG_VALUE_n,
GIT_CONFIG_PARAMETERS,GIT_CONFIG_GLOBAL,GIT_CONFIG_SYSTEM,
GIT_CONFIG) stays refused in every form, and so do the-cand
git configkeys that run a command or read another file (alias.*,
core.hooksPath,core.fsmonitor,core.sshCommand,include.path,
includeIf.*). -
Ordinary git on a user repository is no longer refused as a change to
lean-ctx's state (gh-2276). An absolutegit -C <repo>places the
repository, so the run directory no longer counts. In a repository above
lean-ctx's state (such as$HOME),fetch,commit,push,branch,
tag,remoteandworktreenow run. Inside the state git still only
reads, work-tree writes above it stay refused, and no writing git command
may name a path inside it (clone/worktree addinto the state were not
checked before). The refusal now names the built-in rule and says that
lean-ctx allowcannot lift it, instead of printing<dir>/(run directory). -
A ctx_shell call no longer holds its handler for the whole command when
the session is busy, and a cancelled call stops its command (#2279). When
the session lock was held by another reader, ctx_shell ran the command on a
separate path without the 90-second foreground cap and without the request's
cancellation: under concurrent load a long command kept its handler for the
full command timeout, long after the host had given up on the call. Such a
call now runs on the normal path. A call the client cancels no longer leaves
its command running unobserved: when no other call shares the job, the
command and its process group are stopped.lean-ctx doctornow also lists
handler threads that keep running after their request stopped waiting for
them, with their count and how long the oldest has been abandoned. -
lean-ctx setupandproxy enableno longer reroute a custom Anthropic
gateway that is exported in the shell (#2280). The guard that keeps a
custom endpoint only readANTHROPIC_BASE_URLfrom Claude Code's
settings.json. A gateway exported in.zshenvor a shell rc was missed:
setup wrote the proxy redirect over it, the proxy forwarded to its default
upstream, and the gateway's key came back from api.anthropic.com as
401 invalid x-api-key. Setup now treats a foreignANTHROPIC_BASE_URLin
its environment like one insettings.json: it leaves Claude Code's settings
and the shell block's Anthropic line alone and says why.--forcestill
routes through the proxy, and then forwards to that gateway. -
Maintenance passes and other locked jobs are no longer silently skipped
when another process starts at the same moment. A file lock was released by
closing its file, but a program that another thread was starting still held a
copy of that file until it ran, so the lock stayed taken for that moment. A
receipt-store retention pass, knowledge cleanup, archive registration, the
emspace index refresh, a telemetry send or a context-ledger update that came
next then saw the lock as busy and skipped its work or reported "busy". Every
such lock is now released explicitly when its holder finishes, also when it
fails or unwinds. -
Commands after an interpreter heredoc keep ctx_shell's foreground limits.
When ctx_shell hands an interpreter heredoc to ctx_execute and then runs the
commands that follow it, those commands now detach to a pollable background
job at the foreground cap (90 s by default,LEAN_CTX_SHELL_FG_CAP_MS) and
stop holding the call when the client cancels it, as every other ctx_shell
command does. Before, a long command there held the call until the host
aborted it and its output was lost. -
An absolute
ctx_readorctx_searchpath into a package cache no longer
moves the session's project root. Reading a PlatformIO framework file under
~/.platformio/packagesre-rooted a session to that package, whose own
project markers made it look like a project, so later relative paths such as
src/config.hresolved inside the package instead of the project (the #2262
leak, reached through read/search instead ofctx_shell). A path inside a
language or package cache now never moves the session,~/.platformio/packages
is admitted read-only like the other caches, andplatformio.inimarks a
project root. -
Pairing proposes the computer's own name (rc4-1). On macOS,
lean-ctx cloud connectwithout--labelnow proposes the computer name
shown in System Settings (e.g. "Alex's MacBook Air") on the approval page,
not the network host name ("Alex-MacBook-Air.local"). If that name cannot be
read, the host name is used as before. The proposed name keeps only
printable characters, has no spaces at either end and is at most 64
characters long. Other systems are unchanged.
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.12.9...v3.12.10