Repository navigation
Upgrade notes
- Managed configuration (MDM): the keys are now
cloud.url,cloud.org,cloud.require,
cloud.root_key(andcloud.idp_hint); a profile that still uses the previous key names is
refused as a whole and must be updated.
Added
-
Record team decisions in LeanCTX Cloud from LeanCTX Code. The local read kind
decisions.create(andlean-ctx cloud decisions create --json --decision '<JSON>' [--project-root P]) records a decision through the connected engine, which acts as the person it is linked to, with that person's role and plan; a project linked to a vault records it in that vault, otherwise it is the team's. LeanCTX Cloud's recorded decision is the answer; a taken id answersconflict, a refused fieldinvalid_argument. The app still holds no Cloud token. -
Cloud decisions for the app.
lean-ctx cloud decisions list --json --project-root P(and the local read kinddecisions.list,GET /v1/local/cloud/decisions) lists the decisions of the project's LeanCTX Cloud vault, next to the repo's own.leanctx/decisionsrecords. -
Plan lease refresh.
lean-ctx cloud lease refresh --json(and the local read kindcloud.lease.refresh,POST /v1/local/cloud/lease/refresh) renews this computer's plan lease with LeanCTX Cloud right away, so a new plan applies without waiting for the next scheduled renewal. The engine only renews its signed lease; it holds no payment keys and contacts no payment provider. -
Model credit in LeanCTX Code. The local read kind
cloud.billing.credit(andlean-ctx cloud billing credit --json) reads the team's model credit for the month from LeanCTX Cloud through the connected engine, as the person it is linked to (an owner or admin): agent-hours used, left and in total, the reset date, the soft or hard state, the credit pack on sale and whether this person may buy it (manage_billing: an owner of a team not billed through a company). Only these fields reach the app; buying more happens on the Cloud's billing page in the browser and the engine never talks to Stripe. A Cloud without the engine route answersunavailable, so the app opens billing in the browser. -
Team billing links in LeanCTX Code. The local read kinds
cloud.billing.checkoutandcloud.billing.portal(andlean-ctx cloud billing checkout|portal --json) ask LeanCTX Cloud for the team's Stripe checkout or billing portal link through the connected engine, which acts as the person it is linked to (an owner or admin, with that person's two-factor rule). Only a link on Stripe's checkout or billing host reaches the app; the engine never talks to Stripe and the app still holds no Cloud token. Refusals answerconflict(already subscribed),not_found(no subscription yet),forbidden(billed through the company, two-factor or SSO needed in the browser, not an owner or admin) orunavailable. -
Team chat in LeanCTX Code. The local read kinds
chat.channels,chat.messages,chat.replies,chat.post,chat.read,chat.dmandchat.mentions(andlean-ctx cloud chat <verb> --json) reach the team chat through the connected engine, which acts as the person it is linked to, with that person's membership, plan and limits. LeanCTX Cloud's reasons (plan_required,invalid_state,invalid_field,forbidden,not_found,rate_limited) reach the app unchanged, with the HTTP status of each on the local socket; a machine the Cloud no longer accepts isforbiddenwith what to do. The app still holds no Cloud token. -
Release benchmark gate for agents (rel12 WP4). A fixed ten-task agent
suite is scored from content-free session traces against a stored baseline;
a failed task or a drop of more than 5 percentage points in LeanCTX step
share, compose-first or median tokens saved refuses the release, and
missing or invalid traces fail closed. Until the first baseline is recorded
the gate runs on every release in report-only mode and does not block. -
LeanCTX knows when LeanCTX Code manages the machine (rel12 WP7). The
free desktop app writes one documented marker file on every start
(docs/contracts/app-presence-v1.md) and never removes it; the
dashboard then answersGET /api/appand its start page shows a calm
"Managed in LeanCTX Code" state that points to the app instead of
install instructions.
A plainlean-ctx doctoron a terminal shows one constant hint about
LeanCTX Code at most once per minor version, in place of its Cockpit
line; never for--json, piped output, CI, a managed machine or with
LEAN_CTX_NO_APP_HINTset. Two content-free telemetry feature codes,
app.code.detectedandapp.code_hint.shown, are documented in the
telemetry data dictionary. -
Task receipts.
lean-ctx task receipt <task> --json --session <id>…(and the local read kindtask.receipt) answers, per session of a board task, which context LeanCTX delivered to which agent under which policy, with the savings-ledger and audit-trail hashes a third person can verify. Content-free, deterministic and free for everyone (contractdocs/contracts/task-receipt-v1.md). -
Remote MCP clients connect with OAuth 2.1 instead of a static token (ux16).
lean-ctx serve --oauth(and--oauth-issuer https://<public host>off loopback)
serves the MCP authorization flow: protected resource metadata (RFC 9728) in the
WWW-Authenticateof a 401, authorization server metadata (RFC 8414), dynamic
registration of public clients (RFC 7591), the authorization code flow with PKCE S256
only, theissresponse parameter (RFC 9207) and revocation (RFC 7009). The owner
approves each client on a consent page with the instance token, which never reaches the
client. Access tokens live one hour, refresh tokens rotate, and a replayed code or refresh
token revokes the whole grant. Tokens and the instance-token fingerprint are stored only
as HMAC-SHA256 under a per-install secret (oauth-secret.key); the secret and the store
are owner-only files (0600 on Linux and macOS, a current-user-only ACL on Windows), and
losing the secret ends every grant. The secret is created exclusively, so two servers
starting at once share one; a secret that others can read or another user owns is
replaced, which ends every grant. HMAC comes from thehmaccrate, and stored hashes
are compared in constant time. A client that fails five times in ten minutes at the
token endpoint or the consent page is locked out for 30 seconds, doubling with each
further failure up to 15 minutes (429 withRetry-After); the lockout refuses only
invalid attempts, so a valid refresh token, a valid code with its PKCE verifier or the
right instance token still succeeds, and the lockout table is bounded and kept in
memory only.servewarns when OAuth is bound to a non-loopback address
(it speaks plain HTTP, so TLS belongs in a reverse proxy in front) and when a public
issuer has no explicit--auth-token. An OAuth token reaches only the MCP endpoint (/
and/mcp) and the read-only discovery routes (health, manifest, capabilities, OpenAPI,
tool list, agent cards); every other route answers 403 and needs the instance token.
Changing an explicit--auth-tokenrevokes every client and grant. Errors are redirected
only to clients the owner approved before. A grant renews while it is used and expires
after 30 days unused; the owner lists and revokes clients at/v1/oauth/clients. -
Decide and stop a vault's tasks from LeanCTX Code.
lean-ctx tasks decide <n> --accept|--decline [--reason R]andlean-ctx tasks stop <n> --reason R(alsocloud tasks decide|stop --jsonandPOST /v1/local/tasks/{n}/decide|stop) now work on a project linked to a LeanCTX Cloud vault: the connected engine calls LeanCTX Cloud, which acts as the person the machine is linked to, with that person's role and plan. A declined proposal answersdeclined, a reason longer than LeanCTX Cloud's 280 characters is cut, a task whose state does not allow it answersconflict, and a machine LeanCTX Cloud no longer accepts answersforbiddenwith how to reconnect.capabilitieslistsdecideandstopundercloud.tasks. An agent never decides as the linked person. -
lean-ctx doctorandlean-ctx statussay when an agent connects but
never calls LeanCTX. The MCP server keeps a small private ledger of each
client's last five sessions (mode 0600, local only, no telemetry). When all
five ran at least a minute and ended without a ctx call, one line names the
client and a conditional fix, for examplePi: connected 5 times without a ctx call; if your agent should use LeanCTX, run lean-ctx init --agent pi.
Health checks and reconnects are not counted, and nothing is shown when you
declined rule steering. -
LeanCTX computers from the CLI.
lean-ctx cloud computer list|create|start|stoplists, creates, starts and stops your LeanCTX computers, andadd,ssh-configandsshreach them over SSH with pinned host keys.createandstartcan cost money: they ask for you at a terminal or in LeanCTX Code (a script or agent without a terminal is refused before anything is sent; this guards against accidental agent calls and is not a security boundary), and without--yesnothing is sent: the command shows who would pay (billed to the top-up, or free hours where LeanCTX Cloud reports them, at the price per hour LeanCTX Cloud reported) and exits withconfirmation_required. Until LeanCTX Cloud offers computers, the commands say "LeanCTX computers are not available yet." (computer_not_available) before any cost is shown. On a machine connected to your Personal account,createuses the rolegeneral; a Weave host is for teams. With--yesthe request passes the release point first and is sent confirmed. A computer runs, and is billed, until you stop it.createuses the team or personal account this machine is connected to. LeanCTX Code reaches the same commands through the local service (/v1/local/cloud/computers). -
lean-ctx cloud cpaofor people. The lines mark each period:(provisional)while its revert window is open,(status unknown)when the cloud did not say; a settled period is not marked. Amounts round to the nearest cent and a change of zero prints0.0%. Not connected and connected to a Personal account each get their own line, and neither sends a request. A403naming a team role says that only owners and admins of the team see CPAO; any other refusal prints the server's message, or a plain refusal when it sent none.lean-ctx cloud cpao --jsonis unchanged and answersforbiddenfor every403. -
Plan updates reach running agents. After a person clicks "Send to
agents" in LeanCTX Code and confirms, Cloud announces the new plan
version. The relay pulls the plan, checks its digest
and Cloud signature against the enrolled vault, and gives each local agent
aclouddirective on the agent bus; nothing is typed into an agent and no
agent is restarted. Agents answer withctx_agent action=ack, and the
relay reports the answers to Cloud without local agent ids or free text.
lean-ctx cloud plan updates --jsonlists the applied versions and
answers. Without a Cloud signing key the relay shows "plan updates not
available" and applies nothing. The agent shell policy judges reads of the
agent records over the whole command line (variables, directory changes,
substitutions, pipes and listers). -
Stop a team's cloud work from the terminal (team kill switch).
lean-ctx cloud stop --reason <text>stops the team in LeanCTX Cloud (contributor and up), andlean-ctx cloud stop --release --confirm <team-slug>releases it (team or company admin, confirmed with two-factor in the browser; the command prints the page).lean-ctx cloud stop --statusreads the state. LeanCTX Cloud enforces the stop: while it holds, the team's cloud calls, landings and Code sessions are refused. Nothing on the machine is gated, and local agent tools keep working. The same acts are the Local Read kindscloud.stop,cloud.stop.releaseandcloud.stop.status.cloud status --jsonaddsteam_stop,role,org_slug,companyandstep_up_url. It reads them only from the answer the scheduler and these commands keep, never from the Cloud, and names that answer's age (cache,age_s).team_stopisnullwhile no answer is kept yet (unknown, never a running team). A Cloud without the team stop answers the new Local Read codenot_offered(HTTP 501 on the local socket), a refusal that is not retried, unlikeunavailable. -
Top-up from LeanCTX Code. The local read kind
cloud.billing.topup(POST /v1/local/cloud/billing/topup, andlean-ctx cloud billing topup [--packs N] [--json]) opens a Stripe checkout for prepaid credit through LeanCTX on this computer, as the person LeanCTX Code is signed in as. A top-up is 1 to 10 packs of $10 (the Cloud sells $20 when no count is given). It pays model use once the plan's model credit is used up, and computer minutes after the free hours; computer minutes beyond the free hours come from the top-up only. A top-up needs no two-factor confirmation. LeanCTX Cloud decides who may buy: no top-up during the trial (plan_required), a confirmed email address first (the new error codeemail_unverified, a403likeforbidden), and only an owner of the team (forbidden). Only the Stripe link reaches the app. An optionalidempotency_key(--idempotency-key UUID) is passed on as theIdempotency-Keyheader, so a retried top-up opens the same checkout. -
Model list in LeanCTX Code. The local read kind
cloud.models.catalog(andlean-ctx cloud models catalog --jsonorlean-ctx models --json) hands LeanCTX Cloud's model catalog to the app unchanged, withverified(the catalog's Ed25519 signature checked against the Cloud's policy key;nullwhen the Cloud sent none), whether the plan includes the LeanCTX models (models_subscription) and the gateway address. Vendors' own APIs stay listed as bring-your-own-key; LeanCTX serves only the models inmodels. No token reaches the output. -
lean-ctx run [--cloud]: a coding agent on a task in a fresh worktree.lean-ctx run "<task>"starts Claude Code or Codex (--agent) in a new git worktree on branchleanctx/run/<id>, with the agent's own login or the LeanCTX balance (--model-access);run list|status|events|stop|fetchfollow it (contract §35).--cloudis for a LeanCTX computer, which is not available yet (until LeanCTX Cloud offers computers it ends withcomputer_not_available, "LeanCTX computers are not available yet.", and nothing is started); then the code goes there only over SSH as a git push, never through LeanCTX Cloud. A run is billed from its first minute and starts only from a terminal: without one nothing is sent ("Starting a paid computer needs you at a terminal or in LeanCTX Code."), and without--yes(or a yes at the prompt) the command exits withconfirmation_requiredand the price.run stopand--max-minuteskill the agent's process group 10 s after SIGTERM;run fetchfast-forwards the run branch; a run whose computer was stopped for an empty balance ends asstoppedwithstop_reason: balance_empty. -
The
lean-ctx-binnpm package declares"mcpName": "io.github.yvgude/lean-ctx"(#2263). MCP registries that verify npm package identity (such as Agentregistry) can register LeanCTX from the published package.
Changed
-
One claims model: explicit
ctx_agentclaims are unit claims.claim/releasewith
unitsnow record and drop claims in the same agent lease store as the edit tools' unit
claims, so the pre-edit gate of every other agent sees them (fn:parsecovers an edit of
parse; warn, or refuse underLEAN_CTX_CLAIM_MODE=strict), andclaimslists edit-made
and explicit claims once each with their overlaps. Three changes for callers of the explicit
claims: a unit another agent already holds is not claimed and the reply names the holder
(one holder per unit);ttl_minutesis capped at 60 (was 1440), and re-claiming renews a
claim, at 60 too;release units=[]drops all of the agent's unit claims in the
repository, edit-made ones included. The old advisory storeagents/edit_claims.jsonis no
longer read or written; while it exists,claimssays so in one line. -
lean-ctx init --mode governor-mcpdisables the LeanCTX Claude plugin in your user settings, once. The core pluginlean-ctx@lean-ctxfront-loads lean-ctx tool schemas, which the governor-mcp setup keeps deferred. That explicit init now runsclaude plugin disable lean-ctx@lean-ctx --scope user(never uninstalls) and says so; the jobs plugin stays enabled. Where the core plugin is also enabled in local or checked-in project settings, it is only named with the command to turn it off for you, never changed, since a project change would turn it off for the whole team.claude plugin enable lean-ctx@lean-ctx --scope userundoes it, and the choice stays: a marker keeps every later setup, update or init from disabling it again, and leaving governor-mcp says the plugin stays as it was left. Plain setup and the post-update rewire never disable the plugin. -
Governor R5: a large code file's first whole Read comes as its outline.
With the governor hooks, the first nativeReadwithoutoffset/limitof
a code file over 300 lines now returns its symbols with line spans
(fn … @L64-72) instead of every line, when that outline is at most half
the file. The model then reads the parts it needs; a second whole-file Read
in the same context returns the full content, so nothing is out of reach.
Ranged reads, small files, prose/data formats, instruction files and files
without extractable symbols pass through. When the host's Read stops at its
line cap (2000 lines in Claude Code), the outline covers only the returned
lines and names the rest to read withoffset/limit. R5 is on by default;
governor installs also write[governor] r5 = "on"(a value you set
stays).[governor] r5 = "shadow"orLEAN_CTX_GOVERNOR_R5=shadowkeeps
the native Read and logs a receipt;offturns it off. As with any Read, an outline Read
satisfies Claude Code's read-before-write check, so read the region before
rewriting a large file whole. -
Governor in Claude Code's Code Mode: scripts get native results, the
model gets the governed view. Tool calls aREPLscript makes are never
rewritten (a collapsed output or an outline would change what the script
parses), and they leave no R1 record. When the script hands such a result to
the model verbatim (console output, a returned string, JSON), theREPL
result carries the R2/R4 collapse or R5 outline in its place; anything the
script cut or reformatted stays as it is. Governor installs addREPLto the
PostToolUse matcher. -
SSO refusals in team billing keep their own code. When LeanCTX Cloud refuses engine billing because the team requires SSO for the person (
403 sso_required, also as the reason of a step-up), the local read kindscloud.billing.checkout,cloud.billing.portalandcloud.billing.credit(andlean-ctx cloud billing … --json) now answer the error codesso_requiredinstead offorbidden. The local socket still answers HTTP403and the message stays "sign in with SSO in the browser". LeanCTX Code offers the SSO sign-in in the browser on that code; a reader that does not know it treats it asforbiddenand still shows the message. -
Personal rules are free and compiled by the engine. The personal-rules
compiler behindlean-ctx policy personal <status|preview|apply>is now part
of the free Apache-2.0 engine (core::policy::personal_rules). Preview and
apply work locally without an account, license or installed runtime, with the
same rule format and limits as before; the compiled rules still land in
.lean-ctx/policy.toml.policy personal status --jsonno longer reports
pro_required_for_changes. Ready-made industry rule sets stay a LeanCTX Cloud
Personal feature in the same format. -
Pi, Antigravity and Codex get their lean-ctx rules where they actually read them. Pi rules now go into
AGENTS.mdin the Pi agent directory (~/.pi/agent, orPI_CODING_AGENT_DIR, where a leading~is expanded and a relative value is ignored). Antigravity rules go into~/.gemini/AGENTS.md. Withrules_injection = "dedicated", Antigravity gets its own~/.gemini/config/rules/lean-ctx.mdwith thetrigger: always_onheader it needs, and Pi is skipped, because dedicated mode never edits shared files. Codex no longer writesinstructions.md, which Codex does not read. Setup removes the old files and blocks in~/.pi/rules/,~/.gemini/antigravity/rules/andinstructions.md, and so doeslean-ctx uninstall.lean-ctx doctorreports a shared rules file without the lean-ctx block as missing. -
The Pi extension now steers the agent toward the ctx_ tools by default.* In additive mode,
ctx_read,ctx_grep,ctx_find,ctx_lsandctx_shelleach add a "prefer ctx_X over the built-in X" bullet to Pi's prompt guidelines, left out when the builtin is suppressed. A new session also gets one hidden note naming the active pairs, unless Pi'sAGENTS.mdalready carries the lean-ctx rules block fromlean-ctx setup, so Pi keeps one rules channel. Nothing is removed. Turn both off withLEAN_CTX_PI_GUIDANCE=0or"guidance": falsein the extension'sconfig.json. -
In allowlist mode, a few rarely used command forms are refused as a whole. This is a known, conservative limitation; they are judged more precisely in a later release.
-
The shell policy refuses unlimited-depth listings of the home directory and searches in the LeanCTX data directory.
tree ~andls -R ~are refused; a listing with a depth limit such astree -L 2 ~still runs. -
Pseudonymous telemetry no longer counts governor-only MCP sessions as empty. When the host's hooks (the governor) handled tool calls during an MCP session without a single MCP tool call, the session ends as
mcp.session.hookedinstead ofmcp.session.empty, and the day totalmcp.session.hook_callscarries how many calls those hooks handled. The count is kept per host session, so parallel sessions in one checkout never count each other's calls; LeanCTX's own MCP tools (mcp__lean-ctx__*) are not counted twice; nothing is written while telemetry is off; and a session without MCP tool calls whose server knows no host session id gets no outcome instead ofempty. Seedocs/privacy/TELEMETRY-DATA-DICTIONARY.md.
Security
-
Nested secrets are masked in knowledge recall, export and CLI export documents. A
secret below a credential's name ({"token":["S"]},{"auth":{"value":"S"}}, at any depth,
as a number or boolean, or inside JSON kept in a string value, whole or after other text)
passed every text rule, which read a secret only as a string right after its name.
ctx_knowledgerecall/export and the CLI's document release now mask the whole value of
such a member; a masked value copied elsewhere in the document withholds it, and ajsonl
export line that carries a value another line masks is left out. Readable documents keep
their bytes. -
A secret before a closing bracket is masked (#2255). The value of
(password: <x>?),{token: <x>}or[password: <x>?]was captured with the bracket,
and the shared credential baseline (lean-ctx-protocol) read the bracket as type syntax
and kept the secret visible. Unbalanced trailing),],}and:are now stripped
before the judgement, as core redaction does;fun f(token: Session?)and primitive type
annotations (fn f(token: u64)) stay visible in both layers. -
Ported from integration/3.12.3: the detector skips placeholder URL passwords, and declared nullable
types (private var token: Session? = null) stay visible whilepassword: <x>?outside a
declaration stays masked (#2255). -
Security fix in
lean-ctx decisions check. Upgrade is recommended; see advisory
GHSA-qmwq-pghf-v5q2. -
Shell allowlist: stricter parsing of nested expansions (#2258).
-
A session started without a project adopts its first project through a hardened check, once, and audited. When a host starts the MCP server in
~,/or an agent config directory, the first absolute path inside a project binds that project as the session's normal, writable project (#580/#649 keep working). The path is resolved first (symlinks,.., letter case), and the outermost project marker below home becomes the root, so a submodule or a monorepo package adopts its enclosing repository. A folder directly in home, or directly in~/Documents,~/Desktopor~/Downloads, becomes the root only when it is a git repository, so a stray~/Documents/package.jsonor~/Documents/Work/package.jsondoes not make that folder writable. It is never adopted from the home directory or anything above it, another account's home, system directories, protected home zones such as~/.ssh,~/.awsand~/.gnupg, secret-like paths, agent config directories, LeanCTX's own stores, a path inside.gitor other version-control metadata or an execution hook (.githooks/,.husky/,.envrc,.vscode/tasks.json), or (on Linux and macOS) a directory owned by another user. Windows has no ownership check yet. In an adopted project, writes into version-control metadata, those hooks and git'score.hooksPathare refused until the user declares the project withlean-ctx allow-path. Each adoption writes anx-project_adoptedevent to the local audit trail, naming the tool and the adopted root, before the call can be cancelled; it is not counted as a block or as cross-project access, and older readers accept it as an additive event. The log line names only the tool. A path whose check hangs, for example on a network mount, adopts nothing after two seconds. Calls that race to be first adopt one project, and the other call is judged against that root. With a home of/, or a home that does not resolve, the hardened adoption adopts nothing, and the session keeps the previous re-root unchanged, as does a markerless client working directory. -
Updated the
urldependency to 2.5.9 (RUSTSEC-2026-0592). The engine,
the Rust client, the Rust SDK,lean-ctx-ocla-grpcand the enterprise
governance and intelligence crates now lockurl2.5.9, which no
longer recurses into nestedblob:URLs inUrl::origin(). -
Shell policy: hardened checks for commands that can start other programs or change
lean-ctx state. Update recommended. -
Shell policy hardening. Commands are judged more strictly in allowlist
and strict mode (covered by the 3.12.7 security advisory).
Fixed
-
The write-guard hook runs from an install path with a space.
lean-ctx initwrote
hook write-guardwith an unquoted binary, so PowerShell split paths such as
…/Author Software/…/lean-ctx.exeand every Write failed its PreToolUse hook. It is now
quoted like every other hook;lean-ctx initorupdaterepairs existing settings. -
lean-ctx -cenforces the shell timeout when stdout is a regular file (#2268). -
GitHub Copilot CLI shows why lean-ctx denied a tool call (#2254). The deny output now
carriespermissionDecisionReasonbeside the decision instead of "No reason provided". -
Nullable type annotations are no longer redacted (#2255).
private var token: Session? = null(Kotlin, Swift) kept the type masked. AName?value now stays visible only on a
line that starts by declaring it (val/var/let, or afun/func/init/constructor
parameter list);password: Welcome?in.env, YAML, URLs or prose stays masked. -
Pi: a failed read no longer prints into the prompt editor (#2256).
ctx_readon a missing
file printed "bridge call failed, falling back to CLI: ENOENT" into Pi's editor. The file
error now reaches the transcript as the tool's error, and bridge fallbacks, transport
errors and reconnects are no longer written to the console;/lean-ctxshows the last one. -
The presence "working on" line no longer leaks folder names.
working_onkept paths behind a flag or key (--root=/Users/ada/acme-bank,
-I/…,path:/…) whole and cut only the first word of a path with spaces,
so/Users/ada/My Projects/acme-bank/login.rsleft
Projects/acme-bank/login.rs. A path now starts at any/,\,~/,
~user/, UNC or drive spelling that no name character precedes, and
everything through the last separator in the rest of its segment is cut,
so only the final part stays (C:\Users\ada\OneDrive - Acme Bank\x.rs→
x.rs). The cut is deliberately generous: a relative path that follows an
absolute one in the same segment goes too (read /repo/a.md src/main.rs→
read main.rs). -
lean-ctx doctorcounts what it lists, and the receipt store is CRIT only when it really refuses.--jsonpassed/total/needs_attentionare now counted from the emittedchecks(each entry carriesneeds_attention; unscored entries that are not ok are counted asoptional), and the text summary uses the same counts.Capacity [gateway receipts]no longer says CRIT far below its ceiling because a maintenance pass under another, smaller ceiling stamped the store full: the stamp records the bytes the pass left and every reader judges them against the one ceiling the write path, the pass and doctor share. -
The installers confirm that the daemon came back after an upgrade.
install.shandinstall.ps1restarted a daemon that ran before the binary
swap and took a zero exit fromlean-ctx daemon restartas success, although
an autostart unit starts the daemon asynchronously and may fail afterwards.
Both now poll the new binary'sdaemon statusfor up to
LEAN_CTX_DAEMON_WAIT_SECSseconds (default 10), print
Daemon running on the new binary.once it is up, and warn with the
commands to check and start it when it is not. The install itself stays
successful; a faileddaemon restartis reported on stderr without waiting. -
lean-ctx restartandlean-ctx daemon restartexit 0 only once the daemon is up. Both commands used to report success right after asking the autostart service (or the spawner) to start the daemon, without checking that it came up. They now wait up to 10 s for a verified daemon process and its socket in the active data dir, and otherwise print "Daemon did not come up within 10 s …" and exit 1, so LeanCTX Code can roll back an update whose daemon does not start. -
lean-ctx updaterestarts the daemon on the new binary and checks it.
The self-updater replaced the binary but left a running daemon on the old
one until the next login. After a successful update it now restarts the
daemon only when it ran before the swap, through the same channel as
lean-ctx daemon restart(the LaunchAgent on macOS, the systemd user unit on
Linux, a direct start by the new binary on Windows or without a unit), and
waits until a deadline ofLEAN_CTX_DAEMON_WAIT_SECSseconds (default 10,
as the installers; an invalid value is named and ignored) for the daemon to
report the new version. The deadline covers only that check: the restart
before it is bounded by the stop sequence and the service manager's own
timeouts (systemctl --user stop/startwaits up to the unit's
TimeoutStopSec/TimeoutStartSec, 90 s by default). A daemon that does
not come back, or reports
another version, is named on stderr with the commands to check it; the
update stays installed andlean-ctx update --rollbackremains available.
A daemon that was stopped stays stopped, and a deferred Windows swap says
to restart it afterwards. An unattended update (--scheduled, or
--quietalone as older timer units and cron entries run it) without an
autostart unit does not start the daemon itself (on macOS it would inherit
the updater's deny-~/Documents sandbox, on Linux it would die with the
timer unit) and says to runlean-ctx daemon restart. On macOS the
LaunchAgent re-wrap's restart is not repeated, but a daemon started by
hand next to the LaunchAgent is still stopped and restarted. -
Pi replace mode keeps the
<skills>section in the system prompt
(#2260). Pi renders the section only while itsreadorbashtool is
active, and replace mode removes both, so the model was never told that a
skill exists. pi-lean-ctx now adds the section inbefore_agent_startwith
Pi's own layout and namesctx_readas the tool that loads a skill's
SKILL.md. Additive mode and hybrid shell routing are unchanged, since Pi
renders the section itself there. -
ctx_readandctx_patchsay which base a relative path used (#2262).
After actx_shellcall whosecwdis in another git checkout (a worktree),
relative paths resolve against thatcwd, not the project root (#707), but
the schemas still said "project-relative". Thectx_readpathand
ctx_patchdescriptions now state the rule, and both tools add a
[lean-ctx: path base moved: …]line naming the base and the project root
the first time a session resolves a relative path against a moved base; a
refusedctx_patchalways carries it. A path written relative to the
project root that points into the active checkout (the doubled path) is now
resolved the same way by both tools:ctx_readreads andctx_patch
patches that file, when it exists, is a regular file inside the active
checkout and the path jail admits it; otherwisectx_patchrefuses as
before.ctx_patchsays it patched that file only when it actually rewrote
it, never on a dry run, a no-op or a refusal.ctx_patchops[]paths now
resolve against the same base as a single op; a batch is never substituted,
so it never reports a file it did not patch. -
Team decisions work right after
cloud link. On a connected machine
the plainlean-ctx cloud link <ws>/<vault>now shares the project at
once, ascloud link --jsonalready did, socloud decisions push,
listandcreateno longer answer "not linked" until acloud sync.
A first share that waits for a yes names the command to answer it. -
cloud statusno longer asks a connected machine to connect again.
A linked project that is not shared yet now says which vault it is
linked to and suggestslean-ctx cloud sync. -
Policy refusals are named as such. When LeanCTX Cloud's policy
refuses a decision (policy_denied, a policy chain that does not merge
or sharing that is not confirmed),cloud decisions create --jsonand
list --jsonanswer the new Local Read errorpolicy_denied(socket
403) withcloud_code,member,levelandaction, instead of
forbiddenorinternal. -
ctx_shellno longer refuses agh apiloop as a program run on lean-ctx's own state when a reassigned variable also appears inside single quotes (#2261). Inc=""; for p in 1; do gh api -f c="$c" -f q='($c)' …; c=$(echo q); donethe state guard also substituted the literal$cinside'($c)', so the run-time value ofcwas read as a path into~/.config/lean-ctx. A$or backtick inside single quotes is now text, as in the shell. A variable that really expands to the state directory is still refused, and segments that may run a word as shell code later (trap,ssh,watch, a shell or a wrapper,git) or use$'…'or a here-document keep the old reading. -
ctx_shellno longer refuses a copy to a variable that holds literal text around adatesubstitution as a write to lean-ctx's own state (#2267). Inbackup=".git/backups/x.$(date -u +%Y%m%dT%H%M%SZ).$$.bak" && cp -p f "$backup"the state guard boundbackupto~/.config/lean-ctxalone and dropped the literal text, an overblock. Where every substitution in the value is adate +FORMATwhose output holds no/or., and the literal text before it is a relative path inside the working directory, the value now stays literal and the substitution is judged as a glob (.git/backups/x.*.bak). Any other run-time value keeps the fail-closed reading, and its refusal now names the words the command wrote (cp -p f $b) instead of the state directory. -
Rules setup and uninstall no longer drop user text around the lean-ctx block.
A rules file whose<!-- /lean-ctx-rules -->line went missing is now
refused with a hint by setup, and left untouched by uninstall, instead of
losing everything after the start marker, and
a marker quoted inline in your own prose no longer counts as a block.
Uninstall removes only the marked block from a lean-ctx rules file and keeps
your notes beside it; a file that merely mentions lean-ctx stays, and
Antigravity's and Pi'sAGENTS.mdneed both marker lines. Antigravity
frontmatter saved with CRLF or a byte-order mark is kept, and a CRLF file
keeps its line endings when setup or uninstall rewrites it; a setup and
uninstall round trip gives a CRLF file back byte for byte. Uninstall
rewrites rules files atomically and never through a symlink that leaves your
home directory. -
Dedicated mode now edits shared rules files once: with
rules_injection = "dedicated", setup removes the lean-ctx block an earlier
shared install left in~/.gemini/GEMINI.md,~/.gemini/AGENTS.mdor
OpenCode'sAGENTS.md(your own text stays, a backup is kept), so the rules
load once. This happens only after the dedicated rules file was written. -
Pi: the block names the extension's
ctx_grep(pattern, path),
ctx_find(pattern, path)andctx_ls(path)tools,lean-ctx rules diffno
longer reports a freshly synced Pi block as drifted, setup detects Pi through
itsAGENTS.md(also underPI_CODING_AGENT_DIR), and
PI_CODING_AGENT_DIR=~\piworks on Windows in setup and in the pi-lean-ctx
extension, as it does in Pi. -
lean-ctx savings --period allreports all recorded savings instead of stopping with an error. -
Shell policy:
#comments are read like the shell reads them in nested scripts.
The per-command checks fortrapactions, alias bodies, inline scripts,
command substitutions and PowerShell argument groups now remove comments
the way POSIX sh does (a#at the start of a word, outside quotes and
${…}, up to the end of its line) before splitting the script into
commands, so a quote, backtick,$(or backslash inside a comment no
longer changes how the following lines are read. A#inside a word
(a#b,$#,${#x},${x#y}) or inside quotes keeps its meaning. A
script with comments whose quoting the shells read differently is refused. -
Shell policy:
casearms with a comment or here-document. An arm
holding a#comment or a here-document (<<; a<<<here-string stays
fine) is refused instead of being split at a;;inside it. Acasein a
command substitution is read both as written and without its comments,
and the arm bodies of both readings are checked. Without an allowlist,
trapactions, alias bodies and the commandswatchorgit --execrun
now get the same substitution and here-document handling as the line itself. -
Background vault sync no longer retries a
404or a401forever.
A404was retried with every backoff, without end (thousands of retries
on one machine). It still backs off like any failure, but the third404
in a row, each at least 10 minutes after the last counted one, pauses the
vault (parked: true, codenot_found), so a snapshot that changes during
a download or a short proxy error during a LeanCTX Cloud deploy does not
pause it. A paused vault is tried again every 6 h, and at once after
lean-ctx cloud connector a change of[cloud] url. A reconnect clears
the oldnot_foundcode and error text. A401now sets
needs_login: truewith codeneeds_login(formerlyunauthorized): the
vault is not paused, but a push on write skips it and the background sync
tries it again only after 6 h, then every 24 h, so a short sign-in outage
on LeanCTX Cloud heals by itself; a reconnect or a successful
lean-ctx cloud syncends it at once.
lean-ctx cloud sync status --jsonnow always writesparkedand
needs_login. The error log gets one line when a vault is paused or needs
a login.
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.6...v3.12.7