Skip to content

v3.12.10

Choose a tag to compare

@github-actions github-actions released this 02 Dec 05:23
· 6 commits to main since this release
6bc6160

Upgrade notes

  • lean-ctx config validate exits 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 while validate reported success; it now names the
    value and fails, so scripts that ran validate on 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 with lean-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
    cd or path through a link whose target does not exist yet (a link to
    ~/.config on 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 a cd could pass the state-tampering check. Links are now followed to
    their target, up to 40 hops.

  • resources/read no 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 for file:// resource reads, so resources/read returned any UTF-8
    file up to 2 MiB, such as /etc/hosts. A resource read now passes the same
    PathJail resolver as ctx_read and must lie inside the project root or an
    extra_roots entry; without a project root only extra_roots are 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=cold now walks the
    jail-resolved path instead 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 as python3 or node to ctx_execute. That hand-off skipped
    the checks ctx_execute applies to its own calls: the session's rights profile
    and, under shell_security = "enforce", the per-language approval
    (execute_allowed_languages or 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 as cat are unchanged.

Added

  • Opt-in compression when stdout is a file (gh-2275). lean-ctx -c passes
    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. With LEAN_CTX_COMPRESS_FILE_STDOUT=1 they 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 own lean-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 the shell_* job id plus its
    run generation (shell_…@g<N>), so a rerun of the same command is a new task:
    tasks/get reports working while the job runs and then returns, as its
    result, the same tool result ctx_shell(background_action="status") returns —
    a non-zero exit or a timeout (exit 124) completes with isError: true, a
    cancelled job settles cancelled. tasks/cancel runs the
    background_action="cancel" call through the same gates and kills the job.
    Every tasks/get runs 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 -32602 errors with
    errorCode background_job_not_found_or_expired and task_not_found. The job
    starts only after every gate of the ordinary call has passed. Clients that do
    not declare the extension, and the run_in_background /
    background_action polling API, are unchanged. Status changes are not pushed
    (notifications/tasks has no delivery route in rmcp yet); clients poll
    tasks/get at the advertised pollIntervalMs.

  • 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 announces change_trace). lean-ctx task trace <n> --json shows 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 (contract docs/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, and remove unbinds the runner while the computer stays. Both run only with --yes. The registration token is read after --yes from 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. --json prints the Local Read kinds cloud.runners and cloud.runner.ack (local-read-v1 §45); the new error code step_up_required asks the person to sign in again.

  • lean-ctx computer runs on a LeanCTX cloud computer. lean-ctx computer run (started by lean-ctx-computer.service as the unprivileged
    user leanctx, without capabilities) enrols the computer once with its
    single-use enrolment token, reports a meter tick every minute (with
    active while 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 into lc-… Unix users in group lc-users without sudo; a
    revoked user is locked and logged out, never deleted, and a user it did
    not create is never touched. lean-ctx computer diag is 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 hotspots lists the files that change most, are changed by merges, get reverted and are large, with a refactor plan per file (--json: Local Read kind hotspots.report, GET /v1/local/hotspots). The report format hotspots-v1 is also read from Weave's .leanctx/hotspots.json. ctx_read and ctx_compose end 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. So lean-ctx tasks and
    ctx_tasks open 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> | head and tail from the cache
    (gh-2277).
    cat F | head -n N, cat F | tail -n N and cat F | tail -n +N
    (also -N, -nN, or no count) now become the same lean-ctx read F -m lines:… range as head -n N F, also behind one leading cd <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
    second cd, cd -, cd ~ or a .. component in the directory or file.
    cd <dir> && <command> and sed -n N,Mp <file> were already rewritten.
    head -n N a b (two files) no longer becomes a read of b alone; it keeps
    native head.

  • CLI and tool messages say "the Cloud" instead of the product name.
    Errors, status lines, help texts and tool descriptions of lean-ctx cloud,
    lean-ctx tasks, lean-ctx docs, lean-ctx run and 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_search keep 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
    documents full and headers_only; the values normal, compact and
    minimal from older docs still load instead of dropping the whole config to
    defaults. The documented defaults of auto_capture, journal_enabled,
    memory_cleanup, shell_allowlist and graph_index_max_files are the ones
    the code uses, and config-keys.md lists every key the loader accepts.

  • On Windows, ctx_impact and ctx_graph resolve 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
    showed team_stop: null until 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 runtime with 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 cwd or cd in one ctx_shell call no longer moves every agent sharing
    the connection (#2262).
    Claude Code subagents share one MCP connection, and
    ctx_shell stored the cwd argument and any leading cd on the session: one
    agent's worktree cwd then 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
    without cwd runs 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 passes cwd on each
    ctx_shell call, and reaches another checkout by absolute path or by its path
    relative to the project root.

  • ctx_impact uses the Rust module resolution of graph impact (gh-2269).
    ctx_impact build and update write the same structurally resolved Rust
    imports and module edges as ctx_graph build, so ctx_graph impact
    gives the same answer for a .rs file whichever built the graph; files
    outside every module tree keep the previous resolution. update re-resolves
    every Rust file when a .rs file or Cargo.toml changed. ctx_impact analyze says 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 a mod declaration adds its target as
    another file of the module, next to the default or #[path] file.

  • ctx_graph serves the graph ctx_impact build wrote. With embeddings
    enabled (the default build), ctx_impact build and update left the file
    catalog empty, so ctx_graph treated the fresh graph as incomplete and
    rebuilt its own index on the next call. Both now record every indexed file.

  • graph impact resolves Rust module paths in a Cargo workspace (gh-2269).
    use crate::/super::/self::, workspace crate names (- → _, renamed
    dependencies), pub use re-exports and globs, mod trees with foo.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.
    impact on a .rs file 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 status shows the last scan for
    the SQLite backend too. Graphs are rebuilt once (index version bump).

  • The shell gate no longer refuses time -p and assignments after do,
    then or else (gh-2272).
    time -p ls ~ > /tmp/out.txt and
    for d in ~; do n=$(ls $d); done now pass like their plain forms. stat and
    lsof count 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 literal cd <dir>
    followed by && and git commands only now places those git commands in
    <dir>, like an absolute git -C <dir> does. The directory must be
    absolute, ~, ~/…, ./… or ../…, with no variable, glob or quote.
    A cd into lean-ctx's state still leaves git read-only, and a cd to an
    ancestor of the state (such as cd ~) still refuses work-tree writes.
    Any other form (;, ||, a subshell, cd $DIR, a second cd) keeps the
    earlier judgment. After a cd the gate cannot follow, git may now only
    read unless an absolute -C places it. GIT_DIR, GIT_WORK_TREE,
    GIT_INDEX_FILE, GIT_OBJECT_DIRECTORY and GIT_COMMON_DIR (as a
    prefix, behind env, or exported earlier on the line) and
    core.worktree (from -c, --config-env or git config) are now
    judged like --git-dir and --work-tree. A value set at run time is
    judged conservatively. cd link/../dir is also followed through the
    symlink, the way bash falls back to it. When git is placed (by -C, such
    a cd, 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 its cd. A script that git
    or a shell runs on its own (git submodule foreach, git rebase --exec,
    git bisect run, a sh -c or bash -c body, 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_COUNT with GIT_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 -c and
    git config keys 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 absolute git -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, remote and worktree now 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 add into the state were not
    checked before). The refusal now names the built-in rule and says that
    lean-ctx allow cannot 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 doctor now 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 setup and proxy enable no longer reroute a custom Anthropic
    gateway that is exported in the shell (#2280).
    The guard that keeps a
    custom endpoint only read ANTHROPIC_BASE_URL from Claude Code's
    settings.json. A gateway exported in .zshenv or 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 foreign ANTHROPIC_BASE_URL in
    its environment like one in settings.json: it leaves Claude Code's settings
    and the shell block's Anthropic line alone and says why. --force still
    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_read or ctx_search path into a package cache no longer
    moves the session's project root.
    Reading a PlatformIO framework file under
    ~/.platformio/packages re-rooted a session to that package, whose own
    project markers made it look like a project, so later relative paths such as
    src/config.h resolved inside the package instead of the project (the #2262
    leak, reached through read/search instead of ctx_shell). A path inside a
    language or package cache now never moves the session, ~/.platformio/packages
    is admitted read-only like the other caches, and platformio.ini marks a
    project root.

  • Pairing proposes the computer's own name (rc4-1). On macOS,
    lean-ctx cloud connect without --label now 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-ctx

Note: After upgrading via cargo/npm/brew, run lean-ctx setup to refresh shell aliases. lean-ctx update does this automatically.

Full Changelog: v3.12.9...v3.12.10