# Changelog
All notable changes to lean-ctx are documented here.
Format follows [Keep a Changelog](https://keepachangelog.com/).
Current positioning: [LeanCTX Engine — Context Gateway for AI Systems](docs/POSITIONING_CANONICAL.md).
## [Unreleased]
## [3.12.4] — 2026-11-12
### Added
- **Policy enforcement acknowledged to Hive (D4).** The bus hello now names the features
`policy_advanced` and `policy_applied`, so Hive delivers its `policy.advanced` nudge (it
sends that nudge only to Instances that name the feature). Once per version and digest of a
verified policy that is in force and that Hive acknowledged, the Instance sends one
`policy.applied` frame: `version`, `digest`, `key_id`, `applied_at` and `sessions` (the live
app sessions enforcing it). It sends the frame only when Hive's `hello.ack.features` names
`policy_applied`. An expired, outdated or unverified policy is never reported. Local Read
`policy.sessions` adds `installed.enforcement` (`applied_version`, `acknowledged_at`,
`sessions`, `reported_at`), additively.
- **ECCP L/I/G change classifier (task 156).** `scripts/change-class
`
prints `L` (no public Rust item changed), `I` (public items only added) or `G`
(public item changed or removed, Cargo features or dependency tables,
`Cargo.lock`, `build.rs`, Cargo config, toolchain pin, CI configuration or a
generated registry) from the git objects alone, without a build or network,
and serves as `$ECCP_CLASSIFIER` for `scripts/eccp-envelope`.
- **ECCP change envelope in git notes (task 157).** `scripts/eccp-envelope` writes,
shows and verifies a `leanctx.change-envelope/v1` JSON note under
`refs/notes/eccp` on a merge request head: intent, base, class, read set,
derivations and check evidence (`docs/contracts/change-envelope-v1.md`).
- **Audit entries v2 bind each tool call to its session (ent3-1).** Every new
audit-trail entry carries `v: 2` and a chained `v2_hash` over its timestamp
and, for a call of an MCP session, the `session_id`, a per-session `seq`,
the decision and an output digest, so an edited timestamp, seq or fact fails
`verify_chain` and `verify_chain_full` at that entry. Input and output digests
are HMAC-SHA256 under the engine-local key (`hive/receipts.hmac-key`, never
uploaded). The v1 `entry_hash` is unchanged: older engines and
`leanctx-verify` still verify a mixed trail, and an entry of a newer version
counts as forward-compatible, not as tampering.
- **Managed configuration for MDM-provisioned machines (task 169).** An organisation can
preconfigure an Instance through a macOS configuration profile, the Windows policy key
`HKLM\SOFTWARE\Policies\LeanCTX\Managed` or `/etc/lean-ctx/managed.toml`
(`leanctx.managed-config/v1`, `docs/contracts/managed-config-v1.md`). Managed
`hive.url` and `hive.root_key` win over `[hive]` and `config set` on them is refused;
`hive.org` refuses an enrollment for another org; `hive.require` makes tools refuse
until the machine is signed in and has a policy floor. A carrier that is malformed,
a symlink, or not root-owned (it or its directory) fails closed; it is checked and
read through one open handle. `hive status` and the cockpit `hive status --json`
(`managed`, since 1.7) show the carrier and each member.
- **Unit claims warn before two agents edit the same code.** A `ctx_patch` or `ctx_edit`
write claims the functions, types and Markdown sections it touches for the editing agent
(10-minute lease, renewed on each edit). When another agent holds a claim on a touched
unit, the write goes ahead and the result names the holder (`LEAN_CTX_CLAIM_MODE=warn`,
the default). `strict` refuses the write before anything is written, and `off` turns the
check off. `ctx_agent action=claims` lists the live claims. `action=plan_claims` plans a
task against them, through an optional local planner (`LEAN_CTX_CLAIM_PLANNER`) or a
built-in fallback without network, and claims the free units. Claims are released when
the agent reports `status=finished` and when the server shuts down.
### Security
The first five fixes below were reported by @dkiaulakis.
- **A redirection written another way cannot write past the gate (GHSA-4gm5-2mgw-9r9r).** A
redirection with a file-descriptor prefix, an `&>`/`>|`/`<>` operator, a quoted or escaped
target, or no space before its target was missed, so an agent shell could write lean-ctx's
own state or an unlisted file. The gate now reads every redirection in its canonical form
before any other check.
- **A command inside `( … )` or `{ …; }` is checked like any other (GHSA-9jrf-q94p-frhr).** A
subshell or group was one segment to the gate, whose first word (`(eval`, `(rm`) matched no
rule, and a redirection after the group was dropped. Every group is now opened into its
commands for the checks, and a redirection after it is checked too; a command in a `case`
arm or after `then`, `do`, `else` or `coproc` is judged as its own command. The line that
runs is unchanged.
- **The state guard follows the working directory and the values a line builds
(GHSA-cfmv-qg29-3rvp).** Repeated or conditional `cd ..`, a `cd` in a loop, function or trap,
`CDPATH`/`HOME`/`OLDPWD` assignments, variables assigned or read at run time (also
`${d:=…}` and `set --` arguments, also inside a longer word), the shell's own
`$PWD`/`$OLDPWD`/`$_` and `~+`/`~-`/`~N`, brace and parameter expansions, function
arguments, `alias` bodies, `GIT_DIR`-style variables, versioned interpreter names
(`python3.12`, `node@20`), `deno eval`/`bun -e`, awk `system()`/pipes/output redirection
(also in `-e`/`--source` programs; a program read from stdin with `-f -` or `-f /dev/stdin`
is refused) and in-place writers (`sed`, `perl -i`, `sort -o`, `gzip`,
`patch`, `split`, `tar`/`unzip` extraction) could reach lean-ctx's own state unseen. A write
whose target cannot be placed is now refused (fail closed); read-only commands are unchanged.
- **A read-only git subcommand cannot write lean-ctx's state or run a program
(GHSA-fv44-pm58-9c8p).** When git runs at or above lean-ctx's state, `log`/`diff`/`show`/`grep`
and the other read subcommands were allowed whatever their options, so `--output=…`,
`--ext-diff` with `-c diff.external=…`, a `-c`/`--config-env` pager, fsmonitor or alias,
`--paginate`, `--textconv` or `grep -O` could write a file or run a program. Those options are
now refused there; plain reads such as `log --oneline` and `diff --stat` still pass.
- **Context admission never delivers a value the secret detector flagged
(GHSA-xmx8-69qv-7f86).** The detector and the redactor read different spans of one
comparison or key/value expression: the operand with or without the rest of its operator
(`==`, `:=`), with or without a trailing `)` or `:`. The redactor could judge a flagged value
benign and leave it unchanged, and admission then delivered it as `AllowRedacted`, because it
only re-checked text it had rewritten. Both layers now judge the same operand, so a
comparison operand is masked exactly when its `key=` form is. Unchanged text is
re-checked after a reported value too and is withheld (`redaction.incomplete`) when the value
is still there. A benign comparison such as `if (token==unit_reference):` is no longer withheld.
- **Memory compaction, context bundles and rule exports do not write through a symlink
(GHSA-mq5c-rjv9-2fc3).** Reported by @kasparovabi. `ctx_compress_memory` wrote its backup
(`.original.md`) and the compacted file, and `ctx_pack` / `lean-ctx pack` wrote the
bundle file, with a plain write after the path jail check. The jail leaves a dangling link
unresolved, so a symlink a cloned repository shipped could redirect the write to a file
outside the project. These writes now go through the confined write, which refuses a
symlinked component below the project root, and a memory file that is itself a symlink is
refused before it is read. The compacted file and its backup keep the original's permissions.
The same applies to `lean-ctx export-rules` (`AGENTS.md`, `CLAUDE.md`, `CODEBUDDY.md`,
`.cursor/rules/…`) and to the artifact registry that `ctx_artifacts action=remove` rewrites.
A rule file that links to another file, such as `CLAUDE.md` → `AGENTS.md`, is now refused
with an error instead of written through, and a new bundle file is readable only by its
owner (0600).
### Changed
- **Library crates carry new versions.** `lean-ctx-protocol` 0.7.0 adds the Hive model catalog,
three routing members of the security policy and the `models.subscription` right, which
changes its public types; `lean-ctx-ocla` 7.0.0, `lean-ctx-workgraph` 0.3.0 and
`lean-ctx-tasks` 0.2.0 expose those types and move with it.
### Fixed
- **A PowerShell-shaped command with a non-ASCII character no longer panics the shell gate.**
The verb-prefix check sliced the command name at a byte that could fall inside a
multi-byte character (`A-bᲳ`); it now compares bytes, so such a name is no match.
- **The cockpit's proof no longer pins a core per session on a large audit trail (#2240).**
`lean-ctx value --session` read the whole segmented trail into memory and the savings
ledger twice; it now streams both once, skips segments sealed before the session began
and lines that cannot name the session. The cockpit proves only in a session whose
sidebar was drawn (background spare sessions never draw one), backs off up to an hour
after a failed or timed-out proof, and `/cockpit` still proves at once. Thanks
@jenseinar for the report.
## [3.12.3] — 2026-11-10
### Added
- **Process v1 G6 and checker ≠ author on Hive tasks.** Submitting a task that carries
`process` now runs the G6 gate in the Instance: the locked tests must be unchanged against
`spec_commit` and must actually run and pass in a clean rerun, else the submit is refused
with the rule and the paths, and nothing is sent. A verify is refused for the session that
claimed or submitted the result. Tasks without `process` keep today's path, and no Hive
serves process tasks yet. Known gap: code under test runs as the agent's Unix user and
could forge a passing report; details and the planned fix are in the module documentation
of `rust/crates/lean-ctx-hive/src/tasks/process.rs`.
G6 also asks the compiler which locked tests exist at `spec_commit` (one extra build in a
private copy; no test of `spec_commit` runs), so a locked test the parser cannot name
(macro-generated, `#[cfg_attr(test, test)]`) must still pass in the judged run. This can
roughly double a G6 run's time.
G6 runs on Linux, macOS and Windows. On macOS a kqueue watch notices a renamed or removed
ancestor of the run tree (as inotify does on Linux). On Windows the run uses Git for
Windows' `sh`, an environment built from the known folders and a job object; there the
tree's ancestors have no rename protection and locked files are pinned by content,
attributes and write time (details in `tasks/gate_run.rs`).
- **P4 tripwires: new crate `lean-ctx-tripwires`.** A pure, deterministic diff analyzer that flags the documented reward-hacking tricks (touched tests or graders, removed or weakened asserts, new skips, a falling test count, fixture constants, branches on test inputs, time/hash/assert overrides, swallowed errors, mock-only tests, edit cycles, plus `unparsable`) and returns a `leanctx.process.tripwires/v1` report; a hit routes to a person, never to automatic acceptance. Not wired into the gate yet.
- **Each app session is its own Hive worker (E48).** An agent registered with
`LEAN_CTX_SESSION_ID` set gets the role `-s`, where the tag is 8 base32
characters of a blake3 hash of the session id. It is stable across MCP restarts, so every Hive
Desktop session appears on Hive and in the roster as its own worker (`coder-s…`). A reviewer
session on the same Instance can now pass Hive's `self_verify`, while a subagent of the same
session is still the same worker and is refused. Without a session id the shared
`(host, role)` worker is kept as before. One key (`attach::agent_worker_key`) now drives task
links, attach, roster, friction and worker accounting. The session id comes from the
environment, so this separates sessions as hygiene, not as a trust boundary: the boundary
stays the Instance. Upgrade note: a claim taken before the upgrade by the shared worker
belongs to a different `wkr_`, so let it expire or release it and claim again.
- **Meta Muse Code agent target (#2198).** `lean-ctx init --agent muse` and `setup` register the
lean-ctx MCP server in `$XDG_CONFIG_HOME/muse/settings.json` (default
`~/.config/muse/settings.json`). The writer adds the mandatory `"schema_version": 1` when it is
missing, keeps every other key and server, and merges into the root the file already uses —
canonical `mcpServers` or legacy `mcp_servers` — because Muse disables MCP when both appear;
a file that already mixes them is left untouched with an error. Re-runs are no-ops, `uninstall`
removes only the `lean-ctx` entry, and `doctor` checks the entry. Muse Code is MCP-only: its
PreToolUse output schema is closed and an `allow` never skips approval, so shell rewrites would
add prompts. Guidance reaches it through the project `AGENTS.md` it auto-loads.
- **Task priority: the boards carry the order of work.** A task's priority (`high` |
`normal`) and labels (up to 16 of `[a-z0-9-]{1,32}`) are set with
`lean-ctx hive tasks priority high|normal` / `labels a,b|--clear` (C0 2.2 E47
`PATCH` at the task's `fields_version`, read again and resent once on `stale_base`), from
Hive Desktop over `/v1/local/hive/tasks/{n}/priority|labels` (`tasks.ack`), and by a Queen
session with `ctx_tasks action=prioritize`. Local tasks take the same verbs
(`lean-ctx tasks priority|labels`, `/v1/local/tasks/{n}/priority|labels`, event
`fields`). Lists show high first, then by number, an older high task included (the high
tasks are fetched beside Hive's newest-100 page); a list a full Hive answer may have cut
is marked `partial` (JSON `partial: true`, a `(partial: …)` line in text). JSON
rows carry `priority`, `labels` and `fields_version`. A wrong value is refused before any
request. Only a person (the app, the person's own CLI) and Queen sessions the app
registered over the local socket (`/v1/local/queens`, socket only) set them; workers read
them. A self-declared bus role is never enough.
- **The bus refuses approvals in a person's name (process v1 §7).** `ctx_agent post` and
`send` refuse an agent's message, with a named rule and nothing rewritten, when it
speaks for a person (`on_behalf_of`, `400 invalid_field`: the `on_behalf_of` field or
"on behalf of …" / "in the name of …" in its text), states or hands off a person's
decision (`approval_on_behalf`, `403 forbidden_right`: decision fields with a person as
decider, a handoff of an Inbox item, consent, G2/G9/G10 approval, release, deploy,
secret or rights decision, or a sentence such as "the owner approved …"; questions,
negations and "waiting for" never match), or passes on what was refused for the sender
(`denied_forwarded`, `403 forbidden_right`: a place Hive denied, a publish Hive refused,
a vetoed lock or handoff). These three are always enforced. The checks cover questions,
answers, offers and handoffs; `status`, `progress` and `finding` posts are not checked.
The relay applies the same rules to older queued posts and keeps a post that breaks
them local (counted as `withheld`). Publishes the Hive refuses are remembered per sender
in the new `bus/refused.json` (7 days, at most 1000), so no agent passes them on. Only a
registered Queen session appears as the Queen: under the new `[hive] queen_identity`
(`warn` | `enforce`, env `LEAN_CTX_HIVE_QUEEN_IDENTITY`, which wins) the default `warn`
passes a sender presenting as the Queen (role `queen`, the name "Queen", a "From the
Queen:" label) that is no registered Queen session, puts
`[unverified Queen sender: , agent , role ]` in front of its text and
logs it in the new `bus/queen-warnings.json`; `enforce` refuses it, and any other value
counts as `enforce`. Switch to `enforce` only once `queen-sessions.json` lists every
Queen session: Queens on another machine are not registered with the host yet. Not
covered yet: app session messages (`hive_message_session`, an app tool, not the bus).
- **Rights per session (process v1 §9).** The launcher (Hive Desktop) writes one rights file
per session (`leanctx.session-rights/v1`) and starts the session with the new
`LEAN_CTX_RIGHTS_FILE=`. It narrows what that session may write, below the
Instance's own path jail: writes only inside the role's write scopes, such as its own
worktree (`write_scope`); after G2 no role, the Spec Writer included, writes a locked path
(the feature list, a locked test, a directory or hard link holding one;
`feature_list_locked`); a `deny_write` class refuses (`deny_write:`); the rights
file itself is never written (`rights_file`); `denied_tools` refuses a tool, aliases
included (`denied_tools`). It applies to `ctx_shell`/`shell` (a command whose writes
cannot be judged is refused: `unanalysable`), `ctx_execute`, LeanCTX's own writes, the new
`lean-ctx hook rights` for native `Edit`/`Write`/`MultiEdit`/`NotebookEdit`/`Bash`/
`apply_patch` (an unknown native tool is refused: `unknown_tool`), and calls forwarded to
the daemon, which carry the file as the new `/v1/tools/call` field `rightsFile` (local
socket only, else `400 rights_file_refused`; a profiled session may not use the daemon
socket itself: `daemon_socket`). Every refusal names its rule. Reads are not narrowed. A
rights file that is set but missing, unreadable, insecure or invalid refuses every tool
call and every write; it never falls back to the Instance's rules. **No rights file set
means no change:** the Instance's rules apply as before. This is a best-effort first line;
the guarantee is the G6 locked-path check, and the known limits are listed in the module
doc (`rust/src/core/session_rights.rs`).
- **Local Read / Local Service contract for LeanCTX | Hive Desktop.** Every Local Read kind
is a versioned JSON document on the CLI and a `/v1/local` route of the daemon socket,
released with one receipt for the bytes sent, and listed in one `capabilities` document
with every verb and the transports that answer it (`docs/contracts/local-read-v1.md`,
`local-service-v1.md`): session stats and cost per `LEAN_CTX_SESSION_ID`, gain/spend
rollups (daily and per project), the agent bus (`bus list|read|post|leases|claim|release`),
`presence list`, knowledge writes, evidence verification and export, providers, effective
policies with the organization policy's signature state, `agents`, and the new
`lean-ctx daemon status --json` (`running`, `pid`, `socket`, `autostart`, `service_name`).
- **Sync and policy evidence on the local service.** `hive.sync`, `policy.sessions` and
`policy.session`, CLI-only before, are served on the daemon socket at `/v1/local/hive/sync`,
`/v1/local/hive/policy/sessions` and `/v1/local/hive/policy/sessions/{id}`, released through
the same release point (one receipt) and listed in capabilities. `policy.sessions`
`installed` adds `vaults`: one row per vault the installed policy reaches on this machine
(`vault_id`, `ns`, `name`, linked `roots`) and which policy applies (`vault`, `default`, or
`unverified` when the installed policy files are damaged or too old — fails closed). Read
only, from local files; nothing contacts Hive (`docs/contracts/local-read-v1.md` §23).
- **Presence with names.** `LEAN_CTX_SESSION_NAME` names an agent session; `presence list`
rows carry the session name, agent host, Instance (machine) and project with its vault;
`hive presence` rows carry the names a Hive relays with a presence.
- **A person's bus post can leave the machine.** `bus post` answers `cloud` (`queued`,
`local_only`, `withheld` or `held`, with the reason); a post to a vault bus is published as the
person once the Hive accepts a person's publish (`hello.ack` feature `person_publish`).
- **`tasks amend`: correct a submitted result, record a done task's merge.** A submit ends
the claim, so a new head or a merge commit could not be recorded afterwards ("this machine
holds no claim"). `lean-ctx tasks amend` / `hive tasks amend`, `ctx_tasks action=amend` and
`POST /v1/local/tasks/{n}/amend` (listed in capabilities) let the agent that submitted a
result replace its evidence and summary while it is submitted; once it is done, the
submitter, a person or a registered Queen session records the merge commit once (`--merge
`, `result.merge`); never the reviewer (`not_merger`).
Every amendment passes the release first (a withheld one writes nothing) and lands in the
task history as old → new (update `kind: amendment`, `amended_from`, `amended_to`). On a
vault it needs the Hive route `POST /v1/vaults/{id}/tasks/{n}/amend`, which no Hive serves
yet: it fails closed with "not supported by Hive yet" and sends nothing.
- **Hive background sync: a connected Instance keeps its shared vaults in sync by itself.**
`lean-ctx setup` and `lean-ctx hive connect` now install the daemon as a supervised service
that starts at login and restarts after a crash: the systemd user unit `lean-ctx-daemon`
on Linux (`loginctl enable-linger ` keeps it running on a headless machine while
logged out), the LaunchAgent `com.leanctx.daemon` on macOS. This changes an upgrade: the
next `setup` or `hive connect` installs a service that was not there before. The daemon
syncs a local change (a remembered fact, a written doc page) 5 s after the last change and
at most once every 30 s per vault, syncs at once when Hive announces a change of the vault
(bus `log.advanced`, `trust.advanced`), and otherwise every `[hive] pull_interval_minutes`
(default 5). Only vaults already shared from this machine sync. `lean-ctx doctor` reports
`Hive sync needs a supervised daemon (run: lean-ctx daemon enable)` when the machine is
connected to Hive and the service is missing. `lean-ctx hive sync` still works and syncs
the current project at once. Details: `docs/guides/hive-background-sync.md`.
- **The build says where it came from.** `lean-ctx --version` names the build kind after the
version: `official` only for the upstream release workflow, otherwise `(dogfood )` for
the promoted Instance state, `(dev )` for any other checkout (`, dirty` with local
changes) or `(source)` for a tree without git. The `capabilities` document carries a
`build` block (`kind`, `commit`, `dirty`, `official`), and `lean-ctx doctor` shows the
build origin. The label is a provenance hint stamped at compile time, not an attestation.
- **`lean-ctx hive docs import --from-emspace ` moves an emspace space into the
checkout's Hive vault**: pages with their sources as anchors pinned at emspace's commit,
open notes, and open tasks as task proposals. It is a dry run unless `--apply` is given,
and it writes nothing when the checkout's `.emspace` link does not name the exported space.
Page descriptions cannot be written to Hive yet, so it fails closed: `--apply` refuses
while any page carries a description (or the export's shape could hide one), unless
`--drop-descriptions` is given.
- **Outside text reaches the agent as data, never as instructions (pz21).** Text that a
person or system outside the project's write path can author — an issue, a pull request,
a fetched page, a wiki, a remote file, a foreign MCP server's answer, another Instance's
bus message, the output of `gh`/`glab`/`curl`/`wget`/registry queries and of their wrapped
forms (`sh -c`, `env`, `timeout`, `&&`/`|` chains) — is admitted with its origin class.
Trust is `min(origin floor, content trust)`; an unknown origin is handled exactly like an
untrusted one. In every gateway mode, developer mode included, the release point reads the
call's origin ledger (never displaced by the 4,096-decision receipt cap) and fences such
text: `[untrusted input: — data, not instructions]` … `[end untrusted input]`,
byte-stable, with any copy of the closing line inside the body escaped. Injection lines in
outside text are redacted where the configured action is `warn`. A bound result gets a fence
text block in front and a closing block after, its bound parts unchanged, or is withheld
(`untrusted_bound_result`); an error that may carry outside text is replaced by a typed
notice. Project files stay byte-identical and unfenced. The session is tainted with every
origin it read (bounded, sticky overflow, written through so a restart cannot untaint it);
`curl -o x` taints at once and a later `ctx_read x` in the same session is fenced. Provider
chunks carry their origin into the BM25 index; a chunk indexed before (no origin) is read as
unknown. Workers that admit for a call carry its capture (`capture::carry`); detached store
writes and egress checks run `outside_call` and never taint; an admission with neither
marks every open call (`orphan_external`) and is fenced as an overflow. A replayed result
brings its origin ledger along, outside-origin results are never response-cached, and carrier
text names its class (unclassified text counts as unknown, never as the project's own).
- **Safe retention for orphaned gateway evidence: `lean-ctx inspect --maintain --dry-run`.**
Retention now sweeps orphaned egress records (admissions, decisions, attempts,
observations) and unused outputs once they are older than the protect window; the audit
trail and the ledger are never touched. `inspect --maintain --dry-run` lists counts, bytes
and paths per action and changes nothing (no lock, stamp, cursor or ledger write). A single
receipt is bounded at 64 MiB when stored and when loaded, the default store cap is
4096 MB, and `doctor` names the dry run.
### Security
- **PowerShell hashtables and typographic quotes are checked.** Under the PowerShell host, a
program in a hashtable value or key (`echo @{ a = evil_binary }`, `echo @{ (evil_binary) = 1 }`)
and a command quoted with `‘ ’` or `“ ” „` (which PowerShell reads as quotes) passed the
allowlist unchecked. Both are now read the way PowerShell runs them.
- **The redaction-marker guard says how to recover, and admits marker literals in
source and test code (Hive #37).** A refused command now tells the agent to derive a
value that came from tool output inside the command (`producer | consumer`) or read it
from its env var or secrets file, instead of retyping the marker. One quoted heredoc
into a Rust file or a test file (`cat > src/x_tests.rs <<'EOF'`), and a
`client fs write` to such a file, may now hold the marker literal. Config and data
files, scripts and anything riding along on the heredoc line stay refused.
- **Writes to project data paths refuse symlinked components.** A symlinked `.lean-ctx`,
`proofs` or handoff directory, or a symlinked target file, could redirect a LeanCTX write outside
the project. Writes now rebuild the destination below a trusted root and refuse every symlinked
component; on Unix they walk directory handles (`O_NOFOLLOW`), so a link swapped in after the
check cannot redirect them.
- **A Codex approval nobody gave no longer runs an unlisted program.** Under Codex's
`approval_policy = "never"` with full disk access, and with its automatic reviewer, Codex
accepted the `ctx_shell` / `ctx_execute` approval prompt itself, and the gate ran the
command as approved: with `shell_security = "enforce"` and only `winapp ui list-windows *`
listed, `winapp ui status` ran. Codex now gets the same approval form with a choice as every
client, and a person answers it with a choice. A decline under its `never` policy and an accept
from its automatic reviewer both refuse the command and name `lean-ctx allow`; an accept without
a choice runs nothing.
- **Look-alikes of the Queen are read as written.** The Hive bus Queen rule
(`queen_identity`) and the receiver's mark (`[unverified Queen sender: …]`) now match
on a folded text: NFKC, every `Default_Ignorable_Code_Point` removed (zero-width
characters, the combining grapheme joiner, variation selectors), visible blanks such
as the Hangul fillers read both as a space and as nothing, and every character that
looks like printable ASCII reads as that ASCII by its UTS #39 skeleton — the whole
Unicode 18.0 `confusables.txt`, not a hand-picked list, so a small capital `ᴜ`, an
Armenian `գ` or a Coptic `Ⲛ` is caught like a Cyrillic `е`. So `From the Que\u{34F}en:`,
a role `Qu\u{FE0F}een` or `Qᴜeen`, or a forged `[unverif\u{34F}ied Queen sender: …]` or
`[unᴠerified Queen sender: …]`, or one with an ASCII `l`, `1` or `|` for an `I`
(`[UNVERlFIED QUEEN SENDER: …]`) no longer pass unmarked; ordinary Cyrillic, Greek or
Armenian text is not affected. The sender's name, agent id and role in the mark are
escaped (no bracket or line break) and cut to 80 characters, so they can no longer
end the mark early. New dependencies: `unicode-general-category`, `unicode-security`
(with `unicode-script`).
- **A bus text over its limit is refused before it is sent (`text_too_long`).** A
question, answer, offer or handoff whose text — trimmed, with the receiver's mark in
front when it gets one — is over its type's limit is refused with how many characters
the mark takes and how many to cut. A question the relay must still send over the
limit is delivered cut, with a visible `[cut on sending: N more characters did not
fit]` note, never withheld.
- **Dependencies with published advisories are updated.** The bundled SQLite moves to the
release `rusqlite` 0.41 ships, fixing RUSTSEC-2026-0459. The vendored MCP SDK `rmcp` moves
from 2.0 to 3.9, which bounds HTTP response bodies an MCP server sends to `lean-ctx`
(RUSTSEC-2026-0462) and stops OAuth discovery for HTTP MCP servers from following metadata
URLs to private or loopback addresses (RUSTSEC-2026-0457). The lean-ctx patches on top of
`rmcp` shrink to two, since 3.9 contains the other fixes; one keeps the #1454 answer, so a
client that probes with `server/discover` before `initialize` (MCP Go SDK, Antigravity) still
gets -32601 and falls back to `initialize`. `lean-ctx-embed` now declares the Rust 1.89 its
dependencies need.
- **PowerShell here-strings and backtick escapes cannot hide a command (GHSA-8549-rc5m-4qwh).**
Under the PowerShell host, a here-string (`@'` … `'@`, `@"` … `"@`) was read as ordinary
quotes, and a backtick before a quote or `#` as a substitution, so a `;` and an unlisted program
after the construct stood inside what the gate took for one argument and ran unchecked. A
here-string, and a backtick escape before a quote, `#`, `;`, `|` or `&`, are now refused as
unvalidatable under the PowerShell host; POSIX hosts are unchanged. Reported and fixed by
Robin Norberg (@RobinNorberg).
- **The PowerShell stop-parsing token `--%` cannot hide a command.** After `--%` PowerShell
passes the rest of the line to a native program verbatim up to a `|` or line break, so quotes
no longer pair and a pipe into an unlisted program could stand inside what the gate read as one
quoted argument; an argument whose value is exactly `--%` (`"--%"`) also makes PowerShell
re-split the following arguments at spaces. Under the PowerShell host every `--%`, quoted or
not, is now refused as unvalidatable unless it is glued into a plain word of letters, digits,
`_`, `-` and `=` (`--format=--%`, `a--%`). The forms written with typographic dashes are
refused conservatively as well (pwsh 7.4.6 does not stop parsing at them; Windows PowerShell
5.1 is untested). POSIX hosts are unchanged.
- **A PowerShell braced variable `${…}` cannot hide a command.** PowerShell ends `${…}` at the
first `}`, with quotes inside it belonging to the variable name, while the gate read it the
shell way and paired those quotes first: `echo ${x'}; evil_binary #'}` was one argument to the
gate and ran `evil_binary` under PowerShell. Under the PowerShell host a `${…}` that holds a
quote, `$`, a backtick, `(`, `)`, `{`, a line break or a non-ASCII character before
its first `}` (or has no `}`) is now refused as unvalidatable; plain names such as `${x}` and
`${env:PATH}` pass. POSIX hosts are unchanged.
- **PowerShell `<<` and an attached `#` cannot hide a command.** PowerShell has no
here-documents, so `echo a<` is a block
comment the gate's lexer did not know, so an unlisted program could pass under the
PowerShell host inside either. Argument groups, also inside function bodies, are now
checked against the allowlist like any command, `<# … #>` is read as a comment, and an
unclosed string, group or block comment is refused. Groups count toward the 64-level
nesting bound, so deeply nested parentheses are refused instead of overflowing the stack.
### Changed
- **The `x86_64-unknown-linux-gnu` binary budget is 110 MB.** The 3.12.3 release
binary measures 101,999,384 bytes (3.12.2: 96,853,528) after this release's
additions — the Hive G6 gate on Windows and macOS, the shell-policy and symlink
hardening, the change-envelope contract and classifier — and crossed the 100 MB
ceiling set on 2026-10-15; `product/binary-budget.json` records the new measurement.
- **Changelog entries are fragments, so merge requests stop conflicting on
`CHANGELOG.md`.** A merge request adds its entry as one file in `changelog.d/`
(front matter `section`, optional `version`, then the bullet) instead of editing
`[Unreleased]`. `scripts/changelog-fragments.py --check` validates them (run in CI
through `scripts/tests`), `--preview` shows the folded section, and the release
runs `--write --release X.Y.Z`, which folds the fragments in file-name order,
versions `[Unreleased]` and deletes the folded files. The narrative-governance
check reads pending fragments as part of `[Unreleased]`, and the MR test gate
warns when a merge request edits `CHANGELOG.md` directly.
- **Bus posts: `--as` only from the own session, `queen` as an address, every post
rate-limited.** `bus post --as` is accepted only from the agent's own app session
(`LEAN_CTX_SESSION_ID`). A post to `queen` reaches the registered Queen (`no_queen` when
there is none) in the CLI, socket and `ctx_agent post`; a role named `queen` stays a label.
`ctx_agent post` takes `kind`, `task_id` and `thread` with the CLI's checks, and the
per-sender rate limit now holds for every post, not only one with a kind (the 21st plain
post within a minute is refused). The socket post routes (`POST /v1/local/messages`,
`/v1/local/bus/post`) are a person's posts and no longer take `kind` or `as`: both are
unknown parameters. Relay frames carry `task_id` and `thread` independently of the kind.
- **Library crate versions for crates.io.** The engine's public library crates changed their
API since their last release and get new versions: `lean-ctx-protocol` 0.6.0,
`lean-ctx-workgraph` 0.2.0, `lean-ctx-ocla` 6.0.0, `lean-ctx-doc` 0.2.0 and
`lean-ctx-fs` 0.2.0. Their dependents require exactly these versions.
### Fixed
- **Rule injection respects its token cap for the first rule too.** A large `AGENTS.md` or `CLAUDE.md` is no longer appended in full to every `ctx_read` reply; a rule that does not fit is replaced by a pointer to its file (or only named, and offered again later) (#2229).
- **`LEAN_CTX_KERNEL_*` settings apply in every process**: one-shot CLI commands and library users now read the Context Kernel switches from the environment on first use instead of silently using the defaults (#2228)
- **No more chmod storm on the data directory**: lean-ctx now changes a private directory's permissions only when they are not already 0700, so file watchers, backup and sync tools no longer see an attribute change on every tool call (#2227).
- **`-h` after a subcommand prints help instead of running it**: `lean-ctx cache prune -h` and `cache clear -h` no longer prune or clear; `-h` before `--` now means help like `--help`, except for `read`, `grep`, `ls` and similar commands whose arguments may be a pattern or path, and `cache invalidate -- -h` invalidates a file named `-h` (#2230)
- **Running the test suite no longer rewrites your real hooks.** A `cargo test` binary (`target/debug/deps/…`) is never written into `~/.claude/settings.json`, agent hooks or shell hooks of the real account; an installed `lean-ctx` on PATH is used instead, and a developer's own `target/release/lean-ctx` stays allowed (#2232).
- **`timeout`, `nice`, `env` and `for` loops no longer trip the state guard**: `timeout 120 find ~ -name x`, `nice ls ~`, `for d in ~ /tmp; do ls $d; done` and `timeout 300 node x.js "a rm -rf b"` now run like the unwrapped commands, while writes into lean-ctx's state through a wrapper, a loop variable or a redirection stay refused (#2231)
- **Hooks run when the lean-ctx path contains a space** (reported on Discord). An npm
install under `C:/Users/…/AppData/Local/Author Software/…/lean-ctx.exe` was written
unquoted, so the host shell split it and every hook failed with "The term
'C:/Users/…/Author' is not recognized". Hook commands for every agent now quote a
binary path with whitespace or shell metacharacters (plain paths stay byte-identical).
On Windows, Claude Code hooks for such a path use exec form (`command` + `args`, no
shell), because PowerShell does not run a quoted path. `init`, `update` and
`doctor --fix` replace existing unquoted entries, and `doctor` reports them as stale.
- **`ctx_patch op=create` fills an existing empty file** (#2223, reported by @HaleTom). A
0-byte file had no lines to anchor and no text for `replace_unique`, so no op could write
it. `create` now accepts an existing empty regular file (not a symlink) and keeps its
permissions; non-empty files are still refused. `replace_unique` with an empty
`old_text` now fills an existing empty file too, through the same guarded write path;
on a missing file it points to `op=create`, on a file with content to anchored ops, and
nothing is overwritten (#2223).
- **`ctx_knowledge remember` answers in one short line.** The reply names category, key,
revision and size — "Updated [cat] key → revision N: previous value superseded and
archived" — and no longer echoes the new text or both texts as `⚠ CONTRADICTION` on a
same-key rewrite (one hand-off write cost ~5k chars). Cross-key SIMILAR FACTS previews
stay capped at 60 characters, now cut on a char boundary instead of panicking on
multi-byte text.
- **The config could be moved into an explicit dir override.** With a `LEAN_CTX_*_DIR`
override set, resolving a config member could move `config.toml` (or providers, personas,
multi-repo config) out of the default config dir into the override dir, and the startup
config heal could move the real `config.toml` there too. Legacy adoption, the startup
config heal, the XDG split and data-dir consolidation now do nothing while any dir
override is active. Legacy adoption copies first and then keeps the original as
`.adopted`, and the XDG split now puts providers, personas and the multi-repo
config in the config dir, so an edited member no longer reverts after `doctor --fix`.
- **A compaction under the governor profile re-delivers files in full.** Claude Code's (and
CodeBuddy's) PreCompact, PostCompact and SessionStart (`compact`/`clear`) go to `hook govern` there,
which did not write the `last_compaction.json` marker that only `hook observe` wrote, so a
`ctx_read` after the compaction still answered `[unchanged]`. `hook govern` now writes
the marker for these events.
- **`ctx_session compact` belongs to the session that armed it.** The directive was
one global file, so with several sessions behind one proxy an agent's summary
replaced another session's history, and any request without a session got it
too; a restore or the anti-obsession interval also hit every session. The
directive is now stored per app session (`LEAN_CTX_SESSION_ID`) and applied
only to requests with that `x-leanctx-session-id`; a request without a valid
session id is never compacted. The reply says "armed" only when a proxy has
carried the session recently; otherwise it says plainly that nothing was armed
and why.
- **The shell allowlist no longer treats operands of `unset`, `export`, `readonly`,
`declare`, `local`, `typeset` and `umask` as programs.** `unset CLAUDECODE …` asked
"allow CLAUDECODE?" and hung the worker. Command substitutions in those operands
(`export X=$(cmd)`, backticks), any command after them, and `export -f` stay checked.
- **`hook rewrite` honours `excluded_commands` (#2194).** With `excluded_commands =
["git"]` the shell hook still wrapped `git …` in `lean-ctx -c`, which broke Claude Code's
worktree-isolated subagents. The hook now reads the same merged config as the shell path
(global `config.toml` plus the project's `.lean-ctx.toml`) on every call and uses the same
matcher (case-insensitive, the whole command or the entry followed by a space), applied to
the whole command, to each line and each `&&`/`||`/`;`/`|` segment, and with a leading
`VAR=value` prefix removed. Such a command is not rewritten on any rewrite entry point
(Claude Code, Cursor, Copilot, Gemini, Codex, Vibe, PowerShell, `rewrite-inline`). Replace
mode no longer denies it in three places: the Codex hook, the Vibe hook, and `hook deny`
for native shell tools (Claude Code's `Bash`, Cursor's `Shell` and the other spellings
`hook deny` covers). A shell read (`cat`/`head`/`tail`/`sed -n`/`awk`/`Get-Content`)
of a `redirect_exclude` path stays native the same way. The shell allowlist still applies:
a refused excluded command is denied, never wrapped. A config change takes effect on the
next hook call. Known gaps: a command named by path or through a wrapper (`/usr/bin/git`,
`env git`) is not excluded, as on the shell path; one excluded segment keeps the whole
line native, so `cargo test && git status` loses compression for `cargo test` too; and in
Replace mode an excluded segment lets the whole line past the Replace denial
(`x; git status`), which loosens routing only, since the allowlist still judges every
command.
- **PathJail no longer probes every editor on each check (#2195).** With
`allow_ide_config_dirs`, every jailed path check rebuilt the editor registry's target
list, which on Windows ran `where.exe` per editor (about 80 process spawns a minute). The
list is now cached per home directory and config generation (a new `Config::generation()`
that advances whenever a changed global or project config is loaded) and the environment
the registry reads (`PATH`, `HOME`, `APPDATA`, `CLAUDE_CONFIG_DIR`, `PI_CODING_AGENT_DIR`,
`DEEPSEEK_MCP_CONFIG`, `CODEX_HOME`, `CODEX_PROFILE`, …; a test derives the list from the
registry's sources, so it cannot drift); because installing or
removing an editor changes neither, an entry also expires after 60 seconds. Only the list
is cached: the directory checks that turn it into allow dirs still run on every check, so
the jail admits and refuses exactly what it did before.
- **Hive status over the local service no longer needs a project.** `GET /v1/local/status`
without `project_root`, or with one that is no project (`~`, `/`, a missing path), answered
`no_project`, so LeanCTX | Hive Desktop showed "Status unknown". It now answers the
folder-less `hive.status` document: every field as before, `project` `null`, never the
service's own working directory. `hive status --json --contract local-read/1` prints
`project: null` the same way when the cwd is `~` or `/`. With a project the answer is
unchanged; a path outside the Workspace stays `forbidden`. Capabilities mark the route
`"project": "optional"` (`true` and `false` keep their meaning).
- **One repository stays in one Hive vault.** Two checkouts of the same git origin could
sync into two vaults without a warning: a `.lean-ctx-id` an earlier `hive link` wrote
(32 random hex characters) outranked the origin, so every linked checkout had its own
identity, and a re-run `hive connect` kept the vault it had resolved before `hive link`
named another one. `hive link` never writes an id next to a git origin, and such an id now
gives way to the origin for Hive (a hand-written id, or one in a checkout without an origin,
stays the identity; local knowledge stores do not move). A recorded vault that the link file
or the identity no longer backs is dropped and resolved again, with the first-share consent
where it applies: `hive link` says so, `hive status` flags it (`MISMATCH` and, in `--json`,
`vault_mismatch`), and nothing is sent into it any more: tasks, bus posts and leases, docs,
the live bus, task proposals, sync and `hive connect` refuse with `vault_mismatch` until
`hive connect` or sync resolved the project again. When Hive
keeps the repository in another vault than the link file names (another Instance bound it
first), sync and connect refuse with `vault_mismatch` instead of splitting it, and connect
warns when Hive binds the repository to another vault than this machine uses. Migration:
nothing to run; the next `hive connect` or sync re-resolves affected checkouts. Keep or
commit the existing `.lean-ctx-id` (removing it moves the local knowledge store); if a
repository already has knowledge in two vaults, pick one and run `lean-ctx hive link
/` with it on every machine.
- **Daemon control commands act on the active data dir's daemon only.** `lean-ctx serve
--stop` ran `systemctl --user stop lean-ctx-daemon` (macOS: `launchctl bootout` of the
LaunchAgent) before it looked at the data dir. The service manager addresses that unit by
name, so `serve --stop` with a scratch `LEAN_CTX_DATA_DIR` stopped the user's real,
supervised daemon. Now `serve --stop`, `daemon stop|restart` and the lifecycle `stop`/`restart`
resolve the daemon only through the active data dir's `daemon.pid`, identity file and
`daemon.sock`, and stop the autostart service only when it runs exactly that PID. When no
daemon runs for that data dir, `serve --stop` and `daemon stop` print `No lean-ctx daemon
is running for data dir . Nothing was stopped.` and exit 1, signalling nothing.
The daemon `serve --daemon` starts now leads its own process group. Before, it stayed in
the caller's group, so a script or an app running `serve --daemon`, `serve --status` and
`serve --stop` in one group saw it as `not running (stale PID file …)`. A daemon that
`serve --stop` ends through its endpoint is reported as stopped and exits 0.
`serve --status` and `daemon status` name the data dir. The autostart services (daemon and
proxy) belong to the default install, which means the account's own HOME and no directory
override. A process with `LEAN_CTX_DATA_DIR` (or another directory override) or a sandbox
HOME never stops, starts, installs or removes them. `daemon enable|disable` refuse there
with exit 1, and `doctor` no longer reports or recommends them. `lean-ctx stop` from such an
instance also no longer counts the proxy on the account's default port as its own.
- **The proxy autostart, the updater's proxy restart and the update schedule act for the
default install only.** Three paths still drove user-wide services by name from any
instance. The proxy autostart install (`proxy enable`, `proxy start --autostart`, `wrap`,
`setup`, `dev-install`, the updater) stopped `lean-ctx-proxy`, handed off the proxy on the
account's default port, rewrote the unit and ran `enable --now`. `proxy disable` and
`uninstall` stopped, disabled and removed it. After an update, `systemctl --user restart
lean-ctx-proxy` ran, and on macOS the proxy and auto-update LaunchAgents were reinstalled.
The update schedule (LaunchAgent, systemd timer, crontab, scheduled task) was installed and
removed the same way. `crontab` is per user and ignores HOME, so `lean-ctx uninstall` with a
sandbox HOME deleted the real `lean-ctx … update` cron line. Now, with `LEAN_CTX_DATA_DIR`
(or another directory override) or a sandbox HOME, all of them leave the services alone and
print `Not this instance: …`. `update --schedule N|notify|off` exit 1. `update --schedule
status` reports `Auto-update: disabled` without querying the service manager. The proxy
service reads as not installed and not loaded. A managed hand-off never signals the proxy
on the account's default port. `proxy --help` and `update --help` say so.
- **`lean-ctx serve` refuses unknown flags and arguments.** An unknown flag, a stray argument,
a missing or non-numeric value now prints `lean-ctx serve: ` and exits 2 without
starting anything. Before, `serve` skipped what it did not know and started HTTP on
127.0.0.1:8080, so a feature probe such as `serve --print-socket` opened a listener.
`serve --help` now lists every supported flag.
- **Editor and binary detection resolve executables in-process (#2195, #2199).** No more `where`/`which`
spawns (each one a `conhost.exe` on a console-less Windows daemon), and on Windows the `PATHEXT`
match wins over the bare name like `cmd` does, so an npm install embeds `lean-ctx.cmd` rather than the
extensionless shell shim beside it.
- **The Cockpit starts on Windows (#2203).** It was started with a cleared environment, which also
removed `SystemRoot`; Winsock could not load (os error 10106), so it never opened its port and the
dashboard answered `503 start_failed`. `SystemRoot` is now passed and the Cockpit starts without a
console window, so the hidden background server no longer flashes one on every retry. The official
`x86_64-pc-windows-gnu` build looked for a Cockpit package target no channel publishes and reported
every Cockpit as `verification_failed`; it now runs the MSVC package like every x86_64 Windows host.
- **A PowerShell tool call is checked as PowerShell (#2215).** A host that launches its hooks through
Git Bash (Claude Code on Windows does) hands the hook a POSIX `SHELL`/`MSYSTEM`, so ordinary
PowerShell lines such as `$f = "C:\x"; Test-Path $f` were denied as POSIX. The PowerShell tool
hook now reads its line under the PowerShell host whatever the environment says. Under that host
a .NET member call's attached `(` (`[Math]::Max(1,2)`) is accepted at statement start or as a
local assignment value, and the reader still decides whether the member is safe. The call
operator `&` no longer hides its target: a literal is checked against the allowlist, a run-time
target is refused, a script block is walked, a trailing redirect is allowed, and nesting is
depth-bounded. A quoted call-operator target used to pass unchecked under the PowerShell host.
- **A remembered fact reaches the other Instances of a Hive team within
seconds, not after half a minute (#270).** The agent's own LeanCTX process
now pushes the vault about 0.3 s after `ctx_knowledge` changed a fact
(remember, a conflict's update, forget, import), on its own thread and
coalesced per project; the daemon's background sync waits 1 s after a
local change instead of 5 s and answers Hive's `log.advanced` hint 2 s
after its previous sync instead of 30 s. Every process of the machine
(the daemon and each agent's push on write) takes its turn from one
budget per vault: at most 6 syncs per vault and minute (a purge
excepted). A failing vault backs off for all of them, and a rate limit
waits as long as Hive's `Retry-After` asks.
- **A Hive vault's sync hold is bounded, and a manual sync counts toward
the shared budget (#270).** No process waits longer than 36 minutes (the
longest backoff) after a failure: a hold stamped further out in the
shared budget file, as after the wall clock was set back during a
backoff, is cut to that, and so is a longer `Retry-After` from Hive. A
manual `lean-ctx hive sync` is still never held, but it now counts
toward the 6 syncs per vault and minute that every other sync of the
machine shares. A vault's sync lock is released explicitly when dropped,
so a child process another thread spawns at that moment no longer keeps
the vault busy.
- **A Hive vault that spent its sync burst is held for 10 seconds at most,
not up to a minute (#270).** After a connect, a push on write and the
daemon's own triggers spent a vault's 6 quick syncs, the vault neither
pushed nor pulled until the first of them was a minute old, so a fact
from another Instance could take over 45 seconds to arrive. The shared
budget now paces a vault at one sync per 10 seconds after a burst of 6,
the same rate as before.
- **Two Instances' concurrent values of one shared fact read `[conflicting]` as
soon as both are pulled (#286).** Before, an Instance served the two values as
plain claims until the one `contradicts` edge the Hive resolution names had been
written by the other Instance and pulled again, so `ctx_knowledge recall` and
`lean-ctx knowledge list` disagreed between machines for a sync round. Recall and
list now derive the same resolution from the replica's save history on read: a
sequential edit hides the older value at once, concurrent values are both kept
and both marked `[conflicting]`. The edge is still written and changes nothing
once it arrives.
- **`bus list --all` and `agent messages --all` release every project's messages again.** The
all-projects read ran under an empty project root, whose policy resolves to deny-all, so the
whole feed came back `withheld` (`release.unadmitted_content`) and Hive Desktop, which reads
each host's bus with `bus list --json --all`, stalled. Every message is now released under its
own project's policy, one by one: a message that trips the release is withheld on its own and
counted in the document's `withheld`; the others are returned.
- **The G6 gate runs on macOS.** Without `/run/user/` the gate's run base was `/tmp`,
which macOS makes a symlink to `/private/tmp`; the gate refuses to run in a symlink, so every
process-task submit on macOS was refused with "/tmp is no directory". The base is now `/tmp`
as the system resolves it (`/private/tmp` on macOS); Linux is unchanged.
- **Project-less Local Service reads are no longer withheld.** On the local service socket,
routes that name no project (`/v1/local/gain/daily`, `/v1/local/agents`, `/v1/local/daemon`,
session, spend, audit and evidence reads) and `all` event streams were released under an empty
project root, which the policy resolver refuses; every such document came back as
`withheld — release.unadmitted_content` while the CLI answered. The Hive sync and policy
session reads were withheld the same way on the CLI too. They are now released under the
filesystem root as a folder-less authority (organization and user policy apply, never the
service's working directory). A named project that is no directory still fails closed.
- **`/v1/local/daemon` no longer reports the daemon serving it as stopped.**
The process sweep behind the daemon check leaves out the calling process,
so the daemon answering its own route returned `running: false`, no PID and
no socket while `lean-ctx daemon status` showed it running. The route now
recognizes itself when `daemon.pid` names its PID.
- **Hive task reads survive the request limit.** Many Queens and workers on one machine used
up the Instance's task-read budget; every one then got 429 and `hive_start_on_task`
reported a missing task. Task list and show answers are now shared for 15 seconds by every
process of an Instance, callers asking at the same time share one request, and a 429 holds
further requests until it ends (honouring `Retry-After`) while the last good answer is
served marked stale (`age_s`, `reason`, `retry_after_s`). Without a kept answer the caller
gets `rate_limited`, never "not found"; Local Read v1 gains that code and the optional
`stale` field. New `lean-ctx hive worker retire |--idle ` gives up workers; a
session's own workers are given up when it ends and the sync pass retires idle ones.
- **A task proposal reaches Hive at once (#280).** `ctx_tasks propose` and
`hive tasks propose` only queued the proposal until the next sync (up to 5 minutes); it is
now sent off the call like a claim or submit, and stays queued when it cannot go out.
- **A worker's Hive message reaches its live sessions (#28).** The relay mapped a worker to
its local sessions once per connection, so a session that reconnected under a new id
missed its worker's messages for good. Recipients are now resolved at delivery time; a
message for another machine's worker no longer lands as a post on every local session.
- **A claim refused for presence retries once and says whom Hive looked up (#27).** A
role-gated claim refused for presence or role now asks the running relay to announce and
tries once more; a refusal that stands names the worker id sent, the bus agent and role it
stands for, and whether a relay answered.
- **The daemon's Hive bus relay survives a crash (#252).** A panic in the relay thread ended
it for the daemon's lifetime, and Hive dropped the worker's presence. The relay now runs
under a supervisor that records the panic for `hive status` and restarts it with backoff
(5 seconds doubling, at most 5 minutes). `hive bus relay` prints each announcement and why
an agent is not announced.
- **A local task notice is no longer lost after a failed bus write (#39).** When the bus
write behind a task transition failed, its notice was only logged. The task store now keeps
how far the bus has taken the journal and re-posts what is due on the next board read or
write; notice keys stay idempotent.
- **Every signal and PID-file read goes through one validator.** A PID-file value of 0 or
one above `i32::MAX` could turn into a signal to the whole process group or to every
process of the user. Signal targets now accept only 1 to `i32::MAX` and refuse PID 1, the
own PID and the own process group; garbage, negative, 0, 1 and overflowing PID files are
rejected and removed, and PID files are written atomically.
## [3.12.2] — 2026-11-04
### Added
- **LeanCTX | Hive is open.** `lean-ctx hive connect` and `hive link` connect an instance to
hive.leanctx.com (or a self-hosted Hive), and `hive` is back in help, suggestions and
completions; 3.12.0 and 3.12.1 shipped the connector switched off.
### Security
- **Write destinations stay inside the project without a Workspace (GHSA-483j-9vcj-2gxx).**
`ctx_package save`, `ctx_pack export`, the `ctx_edit`/`ctx_patch` backups, `ctx_checkpoint
restore` and the `ctx_knowledge` export wrote to the path the model passed, so an absolute or
`../` path left the project in the default configuration. A write destination now goes
through the path jail with or without a Workspace; reads are unchanged. Reported by
kasparovabi.
### Fixed
- **A directory granted with `lean-ctx allow-path` is walkable (#2190).** `ctx_search`,
`ctx_tree` and `ctx_glob` refused a granted folder below a protected home location such as
`~/Library` although `ctx_read` read its files. A walk inside a granted directory now runs;
a grant never makes home, a filesystem root or a privacy-guarded home folder walkable.
- **A dogfood or release-candidate build updates to its release.** The update check read
`3.12.1-dogfood.9` as 3.12.9 and answered "already up to date"; a prerelease now sorts
before its release, as in SemVer.
- **Updates no longer switch an existing setup to the governor, and 3.12.1's switch is
undone.** The 3.12.1 update moved every unpinned Claude Code, CodeBuddy, Cursor, Codex,
Gemini and Copilot CLI setup to the governor without the lean-ctx MCP server. An update or
setup refresh now keeps the MCP, hybrid or replace setup it finds. A host that 3.12.1 switched
automatically (a `*.pre-governor-.bak` backup or an interrupted migration, and no
governor pin) gets its previous mode back on the next `lean-ctx setup`, `lean-ctx update` or
`init --agent `. The mode is read from the backup and pinned. `init --agent
--mode governor|governor-mcp` now pins that choice too, so the repair leaves it alone.
- **New Claude Code installs get `governor-mcp`.** Governor hooks plus the lean-ctx MCP server
with deferred tools, so Hive, the agent bus and knowledge work from the first session. New
installs of the other hosts get the standard MCP setup.
- **Claude Code always keeps a search tool.** The standard setup denied native Grep/Glob even
when `~/.claude.json` had no lean-ctx MCP server. That happened after the 3.12.1 migration,
when a server or daemon of the previous build re-rendered the standard hooks, and sessions
then had neither native search nor `ctx_search`. The deny is now written only together with
the MCP entry, and a refresh removes it when the entry is missing. `lean-ctx doctor` reports
a pinned standard mode or a native-tool deny without the MCP server, with the repair command.
- **An older binary no longer overwrites a newer setup.** Every explicit setup and init records
its version. The silent hook refresh of a server or daemon still running from before an update
leaves the setup alone when a newer build wrote it.
- **A host pin selects the mode of later refreshes.** `[governor] pinned.` (written by
`init --agent --mode `) is honoured by every setup and refresh path, not only by the
governor default.
- **`gain` and the cockpit count the governor's applied savings.** Applied R1.bash, R2 and R4
decisions are recorded as `governor:` savings; shadow decisions still count nothing.
R1.read already did.
- **Test processes of every LeanCTX crate stay off production endpoints.** The guard that
sends test traffic to a loopback sink recognised only the Engine's own unit tests and
processes cargo launched for the Engine or `lean-ctx` package. Since the crate split, the
unit tests of the server, Hive, hooks and proxy crates, and the binaries they spawn, sent
telemetry to production, each as a new installation. Any process of a `lean-ctx…` or
`leanctx…` package, and every sandboxed unit-test harness, now gets the loopback sink; an
installed binary keeps its configured endpoint.
## [3.12.1] — 2026-11-03
### Security
- **The skill's `curl | bash` installer verifies the binary.** It installed whatever archive
it downloaded; like `install.sh` it now checks it against the release's `SHA256SUMS` and
refuses to install without a hash tool, without the sums file, without exactly one entry for
the archive or on a different digest.
- **A Cockpit bundle with two checksum entries is refused.** `install.sh`, `install.ps1` and the
npm postinstall took the first matching line of `COCKPIT_SHA256SUMS`; they now require exactly
one entry for the bundle, as for the engine archive.
- **`npm install lean-ctx-bin@X` installs engine X.** The postinstall downloaded whatever
release was newest on GitHub; it now fetches the release that matches the package's own
version and refuses another.
- **The Hermes plugin names its own client.** Its `requirements.txt` asked for `leanctx`, which
on PyPI is an unrelated third-party package; it now pins `lean-ctx-client==0.1.0`, the final
release of the retired HTTP `/v1` client the plugin imports as `leanctx`.
- **Hive connect names no project before a yes and lists exactly what it shares.** Against a
Hive with the C0 2.1 device setup, `hive connect` sent the folder name and git remote to
Hive before anyone agreed, and the sharing question named daily usage totals and context
receipts, which this version never sends, but not fact states, the automatic 1.x merges
and objections, friction counts or task traffic. It now asks before the approval and sends
the project only after a yes (or `--yes`); the question lists exactly what leaves the
machine, the device setup announces only `knowledge` and `bus`, and a no also keeps fact
states and the automatic 1.x merges and objections on the machine.
- **Hive screening fails closed on a broken rule.** A forbidden pattern
(`[egress] forbidden_patterns` or a Hive filter pack) that did not compile was dropped
silently, so what it should have blocked went to Hive. Such a rule now pauses every Hive
content channel until it is fixed, and the Hive status names it; the policy pull that may
bring a fixed rule goes on. The paths and symbol names of the code graph and the new place
of a moved fact anchor now pass the same screen.
- **Hive fencing tokens are no longer printed.** `ctx_agent lease_acquire` answered
`scope=hive fencing_token=…`, and the debug output of a task claim carried its lease id and
token. Both stay in their 0600 files; the answer says `scope=hive`.
- **A dashboard request that names a project is answered for that project or refused.**
The dashboard accepted an `X-LeanCTX-Project` header on routes outside its project list
(`/api/tree`, `/api/architecture`, `/api/compression-demo`, `/api/tools-health` and others)
and then answered them for its own project. Every route that reads or writes project data
now runs inside the named project, device-wide routes (`/api/telemetry`,
`/api/context-summary`, `/api/context-history`, …) answer as before, and any other route
answers `400` instead of another project's data. Cockpit writes (`/api/knowledge/edit`,
`/api/knowledge-relations/edit`, `/api/context-overlay`, `/api/context-policy`,
`/api/episodes/annotate`) now also land in the selected project.
- **`POST /api/session/note` writes to the project's own session.** It appended to the
newest session of whatever project the dashboard process ran in, without the project
binding or admission. It now takes the dashboard's (or the named) project, admits the note
under that project's policy like the episode annotation, and answers `400` when the
dashboard has no project or the project no session.
- **Native Read and Grep now follow the secret-path rule.** `ctx_read` and `ctx_search`
refused `.env`, keys and credential files, but the host's own Read and Grep did not:
Claude Code keeps the Read redirect off and the redirect hook passed `.env` straight to
the native tool. The PreToolUse `hook redirect` now denies a native read or search whose
file, search root, file glob or symlink target is secret-like, with the same detector,
role switch (`io.allow_secret_paths`), warn/enforce mode and policy event as `ctx_read`,
in Hybrid mode and on the shadow surface too, on Claude Code, CodeBuddy, Cursor, Copilot
CLI and Gemini CLI. Behaviour change: native reads of files such as `*.pem` test
certificates or a `.npmrc` are now denied under the default role; allow them through the
role. Not covered: a directory-wide search, shell reads (`cat .env`), Windsurf and
Antigravity; see Security & Governance §4.0.
- **The shell hooks check every command they let run without the `lean-ctx -c` wrap.**
The PreToolUse hooks enforce the shell allowlist by wrapping a violating command in
`lean-ctx -c`. Several kinds of command were neither wrapped nor checked and ran natively
without any allowlist check:
- a command with a heredoc (`<<`), which cannot be wrapped: inline code ran that
`python -c` is blocked for (since v3.10.0);
- a command whose program is lean-ctx, which is never wrapped again. The hooks recognised
it by its first word alone, so a compound behind a `lean-ctx …` prefix ran unchecked
(since v3.10.0), and `lean-ctx allow …`, `lean-ctx yolo` or
`lean-ctx config set shell_security …` could loosen the agent's own policy from the
host's shell, which `ctx_shell` refuses (since v3.11.1);
- a `&&`/`;` chain with a file read in it, whose read was rewritten to `lean-ctx read` in
place while the other commands of the chain ran natively (since v3.10.0);
- every Bash command on Mistral Vibe (`hook vibe-pre-tool`, since v3.10.0), and on Codex
(`hook codex-pretooluse`) and `hook copilot` every command the hook did not rewrite to a
read-only one (since the hooks enforce the allowlist, v3.10.0);
- PowerShell, and any command whose wrap the host's permissions did not let through, in
the governor's `hook rewrite-enforce` (new in 3.12).
All of these are now checked in the hook and denied when they violate the allowlist, in
`enforce` mode; `warn` logs and `off` lets them run, as configured. lean-ctx is recognised
by its program word, with or without a path, quotes, `VAR=value` or `env`; `lean-ctx-x` is
another program. A plain `lean-ctx …` call needs no allowlist entry; one with braces, globs,
substitutions, operators or non-ASCII characters (PowerShell reads `“ ”` as quotes) gets
the full check. Quoted heredoc bodies still count as data, so
`git commit -m "$(cat <<'EOF' … EOF)"` and allowlisted chains such as
`cargo test && git status` are still allowed.
- **The shell gate's policy no longer comes from the agent's environment.** lean-ctx read
its shell security mode and allowlist from `LEAN_CTX_SHELL_*` variables and its config from
`HOME`/`XDG_*`/`LEAN_CTX_CONFIG_DIR`, so a command could set them for the lean-ctx it
started and turn the check off for itself. This affects all releases that read
`LEAN_CTX_SHELL_*` from the environment (the allowlist since v3.6.4, the security mode
since v3.8.12). Release builds now take shell-security settings only from the built-in
defaults and the `config.toml` in the account's home as the operating system records it,
and ignore those variables, in the hooks, inside `lean-ctx -c` and in `ctx_shell`;
`lean-ctx -c` from an agent's shell also enforces when it has a terminal. Command lines may
still set only the run-control switches (`LEAN_CTX_DISABLED`, `LEAN_CTX_NO_HOOK`,
`LEAN_CTX_RAW`, `LEAN_CTX_COMPRESS`, `LEAN_CTX_QUIET`, `LEAN_CTX_ACTIVE`); other
`LEAN_CTX_*` assignments, names built at run time, `declare -n`, and `HOME`/`XDG_*_HOME`
in a line that starts lean-ctx are refused. Behaviour change: set shell-security options
in that `config.toml` (see the 3.12 upgrade guide); `LEAN_CTX_PROFILE=… lean-ctx …` and
similar settings from an agent's shell are refused. Remaining limit: the allowlist is not a
sandbox (#1367). Code it admits — a script, a compiled program, `cargo run` in a lean-ctx
checkout, a copied lean-ctx binary — can still write that config; only an OS sandbox closes
that. Known limits, also covered by "not a sandbox": `cd` sequences that do not take effect
as written (a failed `cd`, a `cd` in a subshell or pipeline), `command cd`/`builtin cd`,
`CDPATH` and `pushd +N`, paths through a symlink followed by `..`, and write operands that
come from variables or brace expansion.
- **lean-ctx calls from an agent's shell follow an allowlist.** Instead of refusing known
widening subcommands, the gate lets an agent's shell run only reads, views and searches,
`-c`/`-t` (whose inner command is checked like any other line), the read actions of
`config`, `knowledge` and `session`, the forms that tighten, and `config set` of
presentation and compression keys. The words that select what runs must be literal, and
lean-ctx cannot run as an `xargs`/`parallel` target or without a subcommand. Other
subcommands are refused with a note to run them in the person's own terminal.
- **Writes to lean-ctx's state are recognised in more spellings.** `<>` and `>&FILE`
redirects, a state path inside a `sed`/`awk` script, abbreviated GNU options (`--in-pl`),
`ln` with a state path as either operand, globs, `cd`/`pushd` into the state directories,
programs that are not known to only read and name the state or a directory above it
(plain single-file copies are judged by the file they create), attached
option values (`-o…`), `-Dkey=…` words, `find -ok`, paths relative to the directory the
command runs in (including a literal `cd` on the same line), lean-ctx's own writing
subcommands (`--out`, `--export`, `--output` into the state),
`$XDG_CONFIG_HOME`/`~user`/Windows path forms and symlinked paths now count; macOS and
Windows compare paths case-insensitively. On PowerShell, `\` is read as an ordinary
character and unquoted `,`/`@` in a lean-ctx call are refused.
- **lean-ctx's own guardrails hold in more cases.** A subcommand written with an unquoted
brace or glob (which the shell expands after the check) is refused; the guardrails also
apply with an empty allowlist (blocklist-only mode), where `env lean-ctx yolo` and
`lean-ctx yolo | cat` passed (since v3.11.1); and `config set shell_hook_mode`/
`hook_mode`/`shell_strict_mode`, `uninstall`, `unwrap`, `wrap --unwrap`,
`addon install` and `policy org install/uninstall/untrust` are refused from an agent's
shell like `lean-ctx allow`. Only the first argument selects one of lean-ctx's internal
`__` modes, so `lean-ctx read __init__.py` is no longer refused.
- **The shell gate refuses what it cannot validate in time.** In `enforce` mode it refuses
commands longer than 64 KiB and substitutions nested more than 64 levels deep; before,
deep nesting could crash the hook, which then let the command run. Each refusal names its
limit and what to do instead: split the command, write long content to a file with the
host's file-write tool, or put deeply nested logic in a script file.
- **LeanCTX approves a shell command only when your AI tool would have run it without
asking.** The shell and file hooks answered "allow" for every call they passed through or
wrapped, which skipped the AI tool's permission prompt for any command. They now mirror the
AI tool's own decision instead of granting one. Claude Code gets every rewrite, with "allow"
only when its permission settings (allow rules, its built-in read-only commands,
`bypassPermissions`) would have run the original command without a prompt; a command that a
deny or ask rule names, or may name, is left unchanged so the rule still applies. Cursor,
Copilot CLI and Codex, which take a rewrite only as an approval, get one only for a fixed set
of side-effect-free commands (`git status`/`log`/`diff`/`show`, `cat`, `ls`, `grep`, `rg`,
`find` without actions, …); builds, tests and every other command run unchanged under their
own approval. Gemini CLI never gets an approval, and a command its settings allow or
restrict by name is left unchanged. Unhandled calls and the timeout fallback carry no
decision.
- **`report-issue` redacts secrets before a report can become a public issue.** The whole
report body, including the raw tee excerpt that `--include-tee` attaches, now goes through
the engine's secret redaction (tokens, keys, credentials become `[REDACTED:…]`), whatever
the role or `[secret_detection]` settings; before, only home paths and the user name were
masked. The GitHub token it asks for when `gh` is missing is read without echo.
- **PathJail writes stay in the active project by default.** The default `path_jail_scope`
is `projects` again instead of `home`: every project below `~` stays readable, but tools
write only in the session's project, host-declared roots and allowed paths, so an agent
working in one repository can no longer plant `~/code/other/.git/hooks/pre-commit`.
`lean-ctx config set path_jail_scope home` (or `LEAN_CTX_PATH_JAIL_SCOPE=home`) restores
the 3.11.3 behaviour, and `lean-ctx doctor` and the server's startup warning now list it as
a jail relaxation. The Claude Code and CodeBuddy auto-memory exception
(`.claude/projects//memory/`) now applies only under your own home directory (or
`CLAUDE_CONFIG_DIR`), not to a look-alike directory anywhere on disk. Upgrade note: see the
upgrade guide.
- **`ctx_multi_repo add_root` passes PathJail.** The root was taken from the raw `path`
argument, so an agent could register `/` or `~` and then search and read it through
`repo=`. The root is now resolved through the jail like every other path argument,
and a root the jail refuses is not registered; `allow-path` and the other allow entries
still admit one.
- **Project policies cannot drop the security defaults.** A project's
`.lean-ctx/policies.json` replaced the built-in exclusions for `.env*`, private keys and
credentials, and a later `Pin` or `Include` overrode them. The security defaults are now
always loaded ahead of the project's policies (a project policy reusing their names is
ignored), and their `Exclude` wins over any later action.
- **`ctx_patch op="replace_all"` writes through the shared edit boundary.** It now takes the
per-file lock before reading, reads with the edit size cap and symlink refusal, refuses to
write when the file changed since it was read (TOCTOU guard), keeps the file's permissions
and invalidates the read dedup state, like every other `ctx_edit` and `ctx_patch` write.
- **No approximate edit after a lossy read.** When the last read of a file was a compressed or
reduced view (`map`, `signatures`, `aggressive`, `entropy`, `task`, density or reference
modes), `ctx_edit` applies only an exact match against the file on disk; the
whitespace-tolerant and re-indent matchers are skipped, and a miss asks for a re-read with
`mode="full"`, so text quoted from a summary can no longer be written back into the file.
- **A context capsule is delivered only with a verified signature.** `capsule_transport`
checked a capsule's structure and key and signature lengths, then queued it; it now
verifies the signature against the pinned signer first and refuses a forged, tampered or
foreign-key capsule.
- **Every signed audit-trail entry is verified.** The audit chain checked signatures only on
drift and seal entries; any entry that carries a signature is now checked against the
LeanCTX key, so a forged signature on an ordinary entry fails verification. Unsigned
entries from older versions still verify, and the first pass after the update re-reads the
whole chain once.
- **Context packages need a trusted publisher by default.** `pack import`, `pack install
--file` and `pack receive` used to accept any package signed with the key embedded in the
package itself; they now require a publisher pinned in `trusted-signers.toml`, a local
identity or this machine's own key. `--allow-untrusted-signer` restores the old check.
- **Addons need a trusted publisher by default.** `addon add` accepted any validly signed
addon behind its consent prompt, although the signing key travels inside the package. It now
applies the same rule as `pack import`: a publisher pinned in `trusted-signers.toml`, a local
identity or this machine's own key (`addon release` output installs as before).
`--allow-untrusted-signer` restores the old check.
Restoring a context snapshot checks out only a full hex commit id, so an imported snapshot
can no longer pass an option or refspec to `git checkout`.
- **`compliance verify` checks who signed the report.** A compliance report was "verified"
against the public key it carried itself, so a re-signed report passed. `compliance verify`
now checks against this installation's key, or the key given with `--pubkey`; a valid
signature from any other key is reported as `SELF-SIGNED / UNPINNED` (exit code 3), a
mismatch with `--pubkey` as invalid. An unverified plan no longer reports a 0-day retention
coverage; it shows as unverified.
- **Secrets stay off command lines.** The macOS signing keychain's password was passed to
`security` and `openssl` as an argument, where any local process can read it from the
process list; `codesign-setup` and every signed build now hand it over on standard input
(`security -i`, `openssl -passout stdin`). `serve` reads the A2A signing key from a file
with the new `--a2a-signing-key-file ` (or `LEAN_CTX_A2A_SIGNING_KEY_FILE`) besides
`LEAN_CTX_A2A_SIGNING_KEY`. The Rust client's `Debug` output of `LeanCtxClient` and its
builder shows a set bearer token as ``.
- **`serve` reads its HTTP auth token from a file.** `--auth-token ` left the Bearer
token in the process list; the new `--auth-token-file ` (or `LEAN_CTX_HTTP_TOKEN_FILE`)
reads it from a bounded regular file, besides `LEAN_CTX_HTTP_TOKEN`. Giving both the token
and a token file is refused.
- **`cockpit` reads its auth token from a file too.** `--auth-token=` (and `--token=`)
left the Bearer token in the process list; `--auth-token-file ` (or
`LEAN_CTX_HTTP_TOKEN_FILE` while `LEAN_CTX_HTTP_TOKEN` is unset) reads it from a bounded
regular file, and a background server reads the same file instead of getting the token.
Giving both the token and a token file is refused.
- **Role and policy denials are tool errors.** A tool blocked by the active role, a context
policy pack or its egress rules came back as a successful result; it now carries
`isError: true` with the same reason, and its audit entry names the calling agent instead
of `unknown`. The daemon socket is bound in a private directory and moved into place
already `0600`, so no umask leaves a reachable moment before the mode is set.
- **The Windows daemon pipe is the user's own.** Its named pipe was created with the default
DACL, which also lets Everyone and Anonymous open it for reading, while the daemon's routes
take no token. Every pipe instance now carries an explicit security descriptor: owned by
the current user, a protected DACL that grants that user alone access, and local clients
only.
- **Workflow and IDE-permission refusals are tool errors too.** A tool held back by the active
workflow or by inherited IDE permissions (OpenCode) came back as a successful result; it now
carries `isError: true` with the same reason. Content-filter audit entries name this
process's agent attribution (`LEAN_CTX_AGENT_ID`, else the MCP client and bus id) instead
of `unknown`, and `policy enforce` names its agent id.
- **The Replace-mode deny hook lets native tools through when no LeanCTX MCP server runs.**
A missing daemon PID file counted as reachable; now a live daemon or a live MCP presence
(the stdio server registers one) is required, otherwise native tools pass.
- **Claude Code `settings.json` permission writes are atomic and keep a backup**, and are
refused instead of overwriting a concurrent change.
### Added
- **Instance metrics and receipts reach LeanCTX | Hive, only where sharing is allowed.**
A connected instance sends hourly instance metrics (counters and closed names, never a
path, command or prompt) and its tool receipts (digests keyed on this machine, counts
and measurements) to its Hive workspace. Nothing is collected or sent unless the
workspace's "Share instance metrics" rule allows it; a Personal workspace asks once in a
terminal (`lean-ctx hive metrics confirm`). `hive.metrics_upload = false` and
`hive.receipts_upload = false` switch them off for this instance.
- **Claude Code `SendMessage` shows up on the local agent bus.** A message one Claude session
sends another is mirrored as a `direct` bus entry (sender, recipient, body), so `ctx_agent read`
and the dashboard see that traffic too. It stays on this machine, is redacted before it is
stored, capped at 8 KiB with a truncation marker, and written once per tool call; the hook
never blocks or fails the send. Standard and governor setups both install it.
- **Long agent sessions through the proxy cost about a quarter less.** Once an Anthropic
conversation passes 180 000 characters, tool output older than the last few messages and
longer than 2 000 characters leaves as a one-line stub; the full text stays in a private
file under the LeanCTX state directory that the stub names, so the model can `cat` it back.
The cut advances in steps of 16 messages, so the prompt cache is rewritten once per step,
not every turn; your own prompts send the same shortened history, so they read the cache
instead of writing it again. Off by default:
measured on Claude Code with Haiku 5.5 over three runs (44 long tasks per arm) it cut cost to
x0.67–0.92 against native, but solved 37 of 44 against 42 of 44, when the model answered
without reading back an elided early output. Turn it on with `[proxy] long_session_elide = true` or
`LEAN_CTX_PROXY_LONG_SESSION_ELIDE=on`.
- **`lean-ctx hive docs import --markdown …` turns docs into Hive pages.** One
page per markdown file, one section per heading, each anchored to its file; running it
again revises only the sections that changed. `--dry-run` shows what would be written.
A section that screening refuses is held back alone, and the command names it as
`file › heading: reason`; the rest of the page goes through. Long sections are split, so
long docs are never blocked by size. (`lean-ctx import docs` still turns docs into
single facts for the knowledge store.)
- **A project linked to an emspace space uses it without setup.** `ctx_read` indexes the
space in the background (detached, bounded, one pass per project at a time) and names the
page that documents the file, `stale` when its sources moved; a once-a-minute journal check
re-reads the pages only after the space changed, so an idle space costs one 40 ms read a
minute. `ctx_provider` reads a page's outline or one section (`resource=page`,
`mode=text`) instead of the whole body. `ctx_agent read`/`list` show the space's open
sessions, screened for secrets; `ctx_shell` shortens the header of a single
`emspace page show` and passes page bodies, `--json`, `schema` and `run` output unchanged.
Pages are no longer copied into `ctx_knowledge` facts. Needs the optional `emspace` CLI;
without a `.emspace` link nothing runs.
- **The knowledge store keeps a change journal.** Every save appends the facts it added,
changed or removed under a growing LSN (identity and changed field names, never a value;
local only). `ctx_knowledge action=changes query=` lists what changed since then and
`query=session` what a session wrote, which a `ctx_session` handoff now names.
`action=repin` re-anchors a fact marked to verify to its code as it is now without
retyping it, and `action=coverage` lists the most edited files that no fact is anchored to.
- **`ctx_provider query mode=text`** lists each item with its body, for every provider.
- **A connected instance keeps the vault in line with what its agents changed.** Until now a
fact reached the Hive vault once, when it was captured; correcting, superseding, removing or
re-pinning it later never left the machine, so other instances kept receiving knowledge its
author had withdrawn. Each sync now compares the instance's own vault items with its knowledge
store: a superseded fact whose successor is shared gets `supersedes` (the vault shows it
outdated), a withdrawn one is retracted (reason "withdrawn by author", no content), and a
fact re-pinned locally is re-anchored in the vault. Only items this checkout captured, the
raw store decides (a fact a policy view withholds is never retracted), an unreadable or
empty store changes nothing, and the server's retraction limits and review holds apply
unchanged. The knowledge journal gates the pass (nothing to do while it stands still, a full
pass hourly); `hive sync` reports what it queued.
- **Governor rule R4: template collapse for large Bash output.** R2 folds only
byte-identical lines, so real logs, lint output and exports, whose lines differ in a
timestamp, sequence number or id, never shrank and the governor wrote no receipts. R4
shows lines that differ only in numbers, timestamps, hex ids or UUIDs once, where the
first one was, as `[N× like] … last: `
(groups of at least 8). The exact original goes to the content-addressed archive and the
result names it (`ctx_expand(id="…")`); without a usable archive (archive off, policy,
`LEAN_CTX_MINIMAL`) R4 does not fire. Unlike R2 it also runs on output with error lines:
error, warning and failure lines stay verbatim while all of them fit in 4 KB, otherwise
each distinct normalized message is kept once with its count, never merged with plain
lines; traceback blocks and test-runner lines always stay verbatim, and output with a
diff is left alone. JSON records (lines opening with `{`, or a `[` line that parses as
JSON) are never grouped, so exports stay countable. Unlike R1–R3, R4 also applies to
file viewers (`cat`, `head`, `tail`, `sed`, `awk`, also at the end of a pipe), except
when a file read looks like source code or data (`.rs`, `.py`, `.json`, `.jsonl`, `.csv`,
`.yaml`, `.toml`, `.sql` …); user-excluded and other verbatim commands stay untouched.
Bash only, from 2,000 tokens and when it at least halves the output.
`LEAN_CTX_GOVERNOR_R4` (default `shadow`: receipt only, nothing stored).
- **`ctx_read` reads one function or class by name.** `symbol="name"` (or
`"Class.method"`) serves exactly that definition's lines, located by its tree-sitter
span, instead of a `full` read or a run of scrolling `lines:` windows; with
`mode="anchored"` the window is edit-ready for `ctx_patch`. An unknown name returns the
file's outline in the same call. Files without a tree-sitter grammar, `raw=true` and an
active context policy refuse `symbol=`. The `ctx_read` description now tells the model
to omit `mode` when exploring (auto: small files whole, large code as an outline), and
the compact-view footer points at `symbol=`/`lines:` instead of a full re-read and names
the path once (auto reads 7 % smaller). Offline replay of a 42-run Haiku pilot's 151
reads: 90.6k → 80.3k tokens (−11 %), counting a follow-up window for every outline served
in place of a `full` read.
- **Opt-in governor setup for Claude Code.** `lean-ctx init --agent claude --mode governor`
installs a near-zero-prefix setup: no MCP server, no instructions, no skill listing and a
two-line rule block (86 tokens per turn instead of 2,952 for the default setup). `--mode
governor-mcp` keeps the MCP server with no instructions and schemas deferred behind Tool
Search. One PostToolUse hook, `lean-ctx hook govern` (explicit 5 s timeout, 1.5 s internal
deadline, native output on any miss), may replace only the newest Read or Bash result:
R1 turns an identical re-read or re-run into an `[unchanged]` stub, R2 collapses runs of
identical lines losslessly (`expand` restores every byte), R3 notes output already in
context. Errors, diffs and test results are recognised by content and never touched.
R1 for Read keeps today's read-dedup behaviour; R1 for Bash, R2 and R3 only write
decision receipts for now (`LEAN_CTX_GOVERNOR_R1_BASH=on` / `LEAN_CTX_GOVERNOR_R2=on`
enable them, `LEAN_CTX_GOVERNOR=off|shadow` caps every rule). Each decision is a
savings-ledger event with a new optional `governor` receipt (rule, decision, would-save
tokens). The PreToolUse hook keeps only security: the shell-allowlist wrap, now with raw
output, and the secret-path deny for native Read, Grep and Glob. `--mode hybrid` reverts
the setup; the default setup is unchanged.
- **Governor setup on every host with tool hooks.** `lean-ctx init --agent --mode
governor` now works for CodeBuddy (full governor: `hook rewrite-enforce` + `hook govern`,
the same Claude-compatible payloads), and for Cursor, Codex CLI, Gemini CLI and Copilot CLI
(enforcement only: their pre-tool hooks deny an allowlist violation or a secret-like read
in the host's own dialect and never approve; their post-tool hooks cannot replace a tool
result). Each writes the governor rules block into the host's one rules channel and removes
the LeanCTX MCP server; `--mode hybrid` reverts and pins. New installs of these hosts
get it by default, and an existing standard setup switches once per version on update,
after backups, as on Claude Code; a pin (`[governor] pinned.` or a global
`hook_mode`) keeps the chosen mode. Codex uses a new `hook codex-enforce`, because a
Claude-dialect rewrite would be ignored there. Hosts without hooks, or with a hook dialect
not yet verified (Qoder, Windsurf, Vibe, Antigravity), keep today's setup
([governor-hosts.md](docs/reference/governor-hosts.md)).
- **`ctx_shell` asks you before refusing an unlisted program.** When a command is refused
only because programs in it are not on the shell allowlist, lean-ctx asks in your AI
tool's approval dialog (MCP form elicitation): allow once, allow for this session, always
allow (written to `shell_allowlist_extra`, like `lean-ctx allow`) or deny. Hard blocks
(`eval`, `$()` at command position, inline interpreter code, dangerous flags,
self-reconfiguration) are never asked about, and an approval names programs: the command
is checked again with exactly those programs counted as listed. A declined command is not
asked about again in the session, prompts are rate limited, and every answer is recorded
in the audit trail with a digest of the command. Clients without form elicitation keep the
earlier behaviour; `shell_approval = "off"` (global only) or `LEAN_CTX_SHELL_APPROVAL=off`
turns it off. Idea from #2145.
### Changed
- **An instance, not an engine.** lean-ctx on one machine is now called an instance
everywhere LeanCTX | Hive shows it: the CLI, the MCP tool texts, the web app and the
protocol. The MCP server is listed as `LeanCTX`. Hive's protocol (C0 2.2) uses the new
names too (`instance_version`, `instance=self`, the `Hive-Min-Instance` header, the
`/me/instances/…` routes); this version speaks only that form, and no earlier release
connects to Hive.
- **The capture gate refuses fragments.** A claim that starts with Not, Listed, See, Also,
e.g. or i.e., that is mostly code in backticks, or that has fewer than four words outside
code stays on the machine (`not_sentence`). Instance and Hive decide from the same
published test vectors.
- **Claude Code uses the governor setup by default.** Measured on Claude Code, it costs
less per request than the standard setup (×0.88 against native Claude Code on long
conversations, where the standard setup measured ×1.08–1.23), mostly because it drops the
~5.8k-token fixed prefix of MCP tool schemas and rules; it writes no rules block either,
because Claude Code wraps any `CLAUDE.md` in ~220 tokens of its own frame and the
`[unchanged …]` stubs explain themselves (measured on Haiku 5.5: without the block it is
level with native Claude Code on short tasks, with it +7 %). A new install
(`lean-ctx setup`, `onboard`, `init --agent claude`) gets Claude Code's native tools plus
two hooks — `hook govern` (PostToolUse: rules R1.read, R1.bash, R2 and R4 on, R3 shadow,
written to the new `[governor]` config section; `LEAN_CTX_GOVERNOR_*` override it) and
`hook rewrite-enforce` (PreToolUse: shell allowlist and secret-path deny only) — and no
lean-ctx MCP server; an earlier lean-ctx block in `~/.claude/CLAUDE.md` is removed. An existing Claude Code
setup is switched on the next `update`, `setup` or `init --agent claude`, once per
version: `settings.json`, `~/.claude.json`, `CLAUDE.md` and the lean-ctx config are first
copied to `*.pre-governor-.bak`, text outside the lean-ctx markers stays, and an
interrupted switch is completed on the next run. For the `ctx_*` MCP tools run
`lean-ctx init --agent claude --mode hybrid` (or `replace`, `mcp`); the choice is recorded
in `[governor] pinned` and no later update changes it, and a global `hook_mode` (written by
`lean-ctx harden`) counts as a choice too. A governor setup chosen earlier with
`--mode governor`/`governor-mcp` gets the same rule modes where `[governor]` does not set
them, once, after a config backup. With `governor-mcp`, setup no longer installs the Claude
Code plugin, which would front-load lean-ctx tool schemas. CodeBuddy, Cursor, Codex CLI,
Gemini CLI and Copilot CLI get the same default and the same once-per-version switch
(see the host governor entry); hosts without tool hooks keep their setup.
`doctor` names the setup and, for an unpinned standard Claude Code setup, the one command
to switch.
- **The instance speaks Hive-Protocol 2.2: agents check each other's task results.** Every
Hive request, the enrollment (`/v1/device/code`, `/token`, `/setup`), the token mint and
the bus upgrade included, sends `Hive-Protocol: 2.2`; the instance records the minor Hive
answers (2.0, 2.1 or 2.2) at start and writes the 2.2 shapes only to a 2.2 Hive: a captured
decision now carries its anchors there. A task result leaves the task `submitted` until
another agent checks it: `ctx_tasks action=verify verdict=accept|reject` (a reject names
its reason and opens the task again; Hive refuses the agent that did the work). Hive's
new `task.event` bus frame reaches every instance of the vault: the instance refreshes its
task list and tells its own agents on the local bus, every agent of the project when a
task is open (again), and every agent but the one that did the work when a result waits
for its check. The vault bus knows six message types (`question`, `offer`, `handoff`,
`finding`, `answer` and `progress` as a status line); `need`, `claim`, `result`, the
progress `goal` and `~` swarm addresses are gone. The consent kinds `procedure_confirm`
and `reviewer_enable` are gone with Hive's review gates; the instance never runs a shared
procedure's commands (delivery shows its title and steps). A delivered vault item no longer has an `[unconfirmed]` bucket, and the
knowledge state follows the 2.2 vectors (no `unconfirmed` reason). Hive answers the
enrollment with key set v3; the instance accepts it and checks it, and the lease it signs, as it checks every stored v3 set (the
lease key is the v3 key of purpose `policy`). Enrollments with key set v1 keep working.
- **Hive's TOML org policy is no longer read.** Hive-Protocol 2.1 has none: the instance
ignores `org_policy`, `unpin` and `policy_version` in the policy bundle and the lease's
`policy_signer_keys`, installs no org policy from Hive and no longer refuses a bundle that
drops one ("drops the org policy without a signed unpin"). Org-policy state an older
instance kept in `/hive/policy/` is ignored and dropped on the next save, so it can
never refuse a bundle. Hive filter packs are verified and applied as before. `hive status`
no longer prints a "Company policy" or "Required" line, `hive status --json` has no
`policy` field, and `hive sync` reports "Policy bundle verified (N filter packs)". Hive no
longer sends these fields at all, and `lean-ctx doctor` reports the verified filter packs
instead of an org policy. The local org policy (`lean-ctx policy org`) is unchanged.
- **`ctx_agent`'s `to_agent` says where a post goes.** It names the three targets: an agent
of this machine, `@wkr_…` for a worker of another machine, and `#workspace/vault` for that
vault's Hive bus. A post without a target stays on this machine and never reaches the
Hive bus.
- **The Rust library is split into crates published in lockstep.** Besides `lean-ctx` and
`lean-ctx-engine`, 3.12.1 publishes `lean-ctx-hive` (the LeanCTX | Hive connector),
`lean-ctx-server` (the MCP server and its tools), `lean-ctx-hooks` (agent hook handlers
and installers) and `lean-ctx-proxy` (the model-API proxy) at the same version, plus the
leaf crates `lean-ctx-patterns`, `lean-ctx-workgraph`, `lean-ctx-compress`, `lean-ctx-fs`,
`lean-ctx-syntax` and `lean-ctx-doc`. `cargo install lean-ctx` is unchanged.
- **`ctx_search` drops the `[∈ enclosing symbol → …]` legend line.** The `∈name@Lstart`
tags on hits stay — agents read those symbols by name and line — but no agent in the
benchmark transcripts used the `handle=` form the legend described; it cost about 30
tokens per run.
- **The telemetry data dictionary says which events LeanCTX | OSS sends.** Of the 24
contract events the engine sends eleven; nine (trial, subscription, team and
orchestration) belong to the hosted service and are never built by the engine, and four
(`autopilot_aggregate`, `autopilot_fallback_aggregate`, `sync_aggregate`,
`checkout_started`) have a counter nothing increments. The engine never sets `account_id`
or `organization_id`. The contract itself is unchanged.
- **The daemon keeps its endpoint files in the data directory.** `daemon.pid`,
`daemon.sock`, the start lock and the stderr log lived in the OS data-local directory
whatever `LEAN_CTX_DATA_DIR` or the XDG layout said, so an isolated data directory reached
the default install's daemon. They now live in the data directory (the Windows pipe name
follows it); a daemon an earlier release started in the old place is stopped when a new
one starts and by `daemon stop`.
- **`ctx_shell` steers large logs to a narrower command, not to `raw=true`.** The tool
description and the `raw` parameter now say `raw=true` is for exact bytes only (a diff to
apply, hashes, encoded output) and that a large log is read by narrowing the command
(`grep`, `sed -n`, `head`/`tail`); the firewall digest's guidance names the same narrowing
next to `ctx_expand(search=…)`. In pilot P10 an agent answered its first firewalled log
grep by passing `raw=true` on every later call, which by contract skips the firewall: six
outputs of 6.7k–15.7k chars. `raw` itself is unchanged. Same wording for the `shell`
alias, the granular tool set, the Pi template and the Pi extension.
- **`ctx_read` outlines (`signatures`, `map`, and a read without a range of a large file)
stay within ~1,500 tokens.** The outline of a 4,188-line module with 260 decoders was
13k chars. Above the budget, runs of three or more consecutive symbols sharing a name
prefix fold into one line (`fn pub decode_cart_{created,paid,voided}(payload) @L206-327`),
keeping every name; then the shorter prefix; then methods collapse into a count on
their class; only then is the tail cut, with the count and the line it starts at. A note
says so and points at `symbol=` and `lines:N-M`. Smaller outlines are unchanged.
- **`emspace` is on the default shell allowlist**, so agents in a checkout linked to an emspace
space can query it directly without an approval prompt.
- **`ctx_read` names the issues, PRs and pages that reference a file by default.**
`output_hints.cross_source_hint` is now on in every built-in profile; it adds a line only
when a provider (GitHub, GitLab, Jira, emspace, ...) linked a reference to the file. A
profile can set it to `false`.
- **Cross-source hints name each source once, in a fixed order.** A provider edge is stored
in both directions, and a source could appear twice (as `documents` and `mentioned_in`),
each line costing tokens; it now appears once, at its strongest relation. Ties are ordered
by URI and relation, so the same graph always yields the same hint lines, whatever order
its rows come back in. Applies to every provider.
- **`ctx_read` without a range: whole up to 300 lines, an outline above.** A read with no
`mode` (or `mode="auto"`), no window and no `symbol` now returns a file of up to 300
lines whole and a larger file as its outline: every symbol with its line span, the data
or prose structure for JSON/YAML/TOML/Markdown, or the line count for a file without
extractable structure, plus the `symbol=`/`lines:N-M` pointer. Before, the resolver
could compress a small file to signatures (followed by a whole-file read in both pilot
cases), return a large one whole or aggressively compressed, or replay the previous
`lines:` window of the same file. Only `mode="full"` returns a large file whole;
`lines:`, `symbol=`, `anchored:N-M`, `signatures`, `map`, a configured default mode, a
saved per-file view, instruction files, `[unchanged]` stubs and deltas are unchanged.
The context gate's heuristics (bounce prevention, intent target, graph and knowledge
hints) no longer override such a read. A `lines` argument (`"40-80"`, `"40:80"`,
`[40, 80]`, or a start line with `limit`), which models pass although the schema has
none, is now read as that window instead of being ignored. Offline replay of the 42
default-arm runs of pilot P8: ctx_read output 8,515 → 8,019 chars per run (−6 %), or
7,627 (−10 %) counting the whole-file re-reads that become `[unchanged]` stubs.
- **Knowledge has no fact limit.** The Cockpit no longer shows slots, a budget or a
capacity share, and the Engine no longer archives facts by count, refuses a snapshot
restore for size, or scales a fact cap with the disk budget; facts leave memory only by
quality (decay, near-duplicate merge, low confidence, staleness). An existing
`max_facts` setting (or `LEAN_CTX_KNOWLEDGE_MAX_FACTS`) is ignored and still loads.
- **Edits read only the region they change, and paths are project-relative.** In a
42-run Haiku pilot 13 of 130 `ctx_read` calls were whole-file `mode="anchored"` reads
(the Claude Code rules block said so), a quarter of all `ctx_read` output, yet 72 of the 78
`ctx_patch` ops that followed were `replace_unique`, which needs no anchors; and about
90 % of each `ctx_read` input was the absolute repository path the schema asked for.
The Claude Code block (v13), the `ctx_read` and `ctx_patch` descriptions now say: read the
region (`symbol=` or `lines:N-M`), edit with `replace_unique`, use `anchored:N-M` only for
line+hash ops, and name paths relative to the project root (absolute paths still work).
A cross-file `ctx_patch` batch labels each receipt with the project-relative path, and a
one-file batch no longer repeats a label its receipts already carry. Offline replay of the
pilot's 190 `ctx_read`/`ctx_patch` calls: identical reads and edited files with absolute
or relative paths; `ctx_patch` receipts 275 → 105 chars per run; relative paths would cut
the model-written `ctx_read` input by 69 % and `ctx_patch` input by 17 % (a replay cannot
show how far the model follows the new wording).
- **Nothing in the open engine is "Pro" any more.** Context ranking in `ctx_compose`,
`ctx_semantic_search` and the context planner is always the free local ranking; the engine
no longer asks an installed licensed runtime to rescore context (that path also no longer
adds a `private_context_*` reason or an `adaptive_context_v1` plan extension). Messages that
said "Pro" now say "LeanCTX Hive" where the feature is the separately licensed runtime
(code hints, personal rules, paid policy packs) or are neutral otherwise.
- **Memory selection and read-strategy policies are local only.** `knowledge consolidate`
(including `--adaptive` and the scheduled pass) always uses the local salience- and
budget-based import; no runtime selects memories any more. The planner no longer reads a
runtime-promoted read-strategy policy. `lean-ctx autopilot policy` and
`lean-ctx autopilot evidence --learn` (both needed the licensed runtime) are deprecated and
have no effect (see Deprecated); `autopilot evidence` still shows the local evidence. The config key
`intelligence_runtime.context_policy_apply` is still accepted but has no effect, and a
previously promoted policy file under `context-policy/` in the data directory is ignored.
- lean-ctx-ocla → 5.0.0 (breaking): its public traits and verifiers use lean-ctx-protocol
types (`CapabilityManifestV1`, receipts, decisions), so moving to protocol 0.5.0 is a
breaking change for ocla as well. Its API is otherwise unchanged.
- lean-ctx-protocol → 0.5.0 (breaking): every dependent's version requirement and lockfile
now asks for 0.5.0, since 0.4.0 on crates.io holds the earlier contract. The status output types
(`HiveCliStatusV1` and its siblings) drop `deny_unknown_fields` (or become
`#[non_exhaustive]`), as the contract's convention for response types says, so later
additive fields are not breaking for typed readers. The same bump removes
`hive::compute` (Hive Task Compute), and with Hive Protocol 2.1 also
`hive::swarm`, the swarm network and sender (`NetworkV1::Swarm`, `SenderV1::Swarm`,
`NetworkKind`; `MessageBodyV1::validate` takes no network), swarm handles and limits
(`profiles::HandleV1`, `HANDLE_SCHEMA`, `SWARM_LIMITS`, `handle_ok`),
`EngineOptinV1.topics` and `TaskOriginKind::QuarantineTimeout` (a task naming it parses
as `Unknown`). `EnrollmentV1.keys` becomes `EnrollmentKeySet`: key set v1 (`kid`) or v3
(`HiveKeySetV3`, `key_id` and `purposes`, told apart by `schema`), and `validate()`
checks that the lease `kid` names a lease key of the set. The TOML org policy is gone:
`PolicyBundleV1` loses `org_policy`, `unpin` and `policy_version`, `HiveLeaseV1` loses
`policy_signer_keys` (with `PolicySignerKeyV1`), `validate_required_filter_packs` and
`unmet_required_packs` go, and `HiveCliStatusV1` loses `policy` (with
`HiveStatusPolicyV1`, `HiveOrgPolicyStateV1` and `HiveStatusRequiredPackV1`). Neither
the bundle nor the lease denies unknown fields, so what a Hive still sends there is
ignored; `RequiredFilterPackV1` stays for the engine's policy runtime. Sealed vaults are
gone, so the bump also removes `hive::sealed` (`SealedBlobV1`, `WrappedKeyV1`,
`SealedKeyV1`, `SealedPendingV1`, `SealedGrantRequestV1`, `SealedDraftContentV1`,
`kx_fingerprint`, the AAD helpers and their schemas), `SEALED_MESSAGE_SCHEMA` and the
`SEALED_TASK_*` schemas, and every `sealed` field (knowledge revisions, patches and
puts, messages and deliveries, task proposals, updates, results and views);
`CodeGraphPutV1.graph` is required. A revision, put, draft or message without its clear
content no longer validates, and `VaultV1` drops `key_epoch`: `sealed` stays as a
constant, and `sealed: true` fails `validate()` (`SEALED_VAULT_UNSUPPORTED`: sealed
vaults are not supported). `FactStateReportV1` loses `counts` (with
`FactStateCountsV1`) and its `states` is required. `HiveRight::Sealed` and
`ProposalState::Ready` still decode. With Hive Protocol 2.2 the bump also removes
`hive::automerge` (`AutoMergeV1`, the proposal confirm and ack shapes), `VaultV1.auto_merge`
and `SharingPolicyV1.auto_merge_results`, and adds the task shapes of 2.2:
`TaskVerifyRequestV1` with `TaskVerdict`, `TaskFieldsRequestV1` with `TaskPriority` and
`validate_labels`, `TaskVerificationV1`, `TaskUpdateKind`, `TaskLifecycle::Submitted`, and
`verified_by`, `verified_at`, `verification`, `priority`, `labels` and `fields_version` on
`TaskV1` (`priority`, `labels`, `fields_version` on `TaskSummaryV1`; `kind`, `verdict` on
`TaskUpdateV1`).
- `lean-ctx gain` and the savings ROI report a higher, more honest prefix overhead.
A cached prefix token now costs 0.1× input instead of nothing, and a cache miss
costs the 1.25× write (Anthropic, OpenAI GPT-5.6+). At the default 75% hit rate the
per-turn factor goes from 0.25 to 0.39. The ~2,400-token native-tool baseline is
subtracted only in Replace mode; Hybrid and MCP keep the native tools, so their
prefix adds to lean-ctx's. `gain --deep` explains both.
- **One lean-ctx rules channel per host.** Claude Code and Gemini CLI now get the
one-line anchor in the MCP `instructions` once their own rules file (`CLAUDE.md` block,
`GEMINI.md`) carries the lean-ctx block, as Cursor, Codex and OpenCode already did.
Before, the same tool mapping arrived twice, and the two copies could disagree. Together
with the cuts below, the Claude Code MCP instructions drop from 468 to 112 tokens per
turn, and the default per-turn prefix drops from 2969 to 2548 tokens (Codex: 2770 to
2548, Cursor: 3248 to 2499). `lean-ctx doctor`
has a new "Rules channels" line, and `lean-ctx doctor overhead` lists each host that
still loads the rules more than once, with the files, the estimated tokens and the fix
(`lean-ctx rules dedup --apply`, which `setup` and `doctor --fix` also run). The dedup
now also retires `~/.claude/rules/lean-ctx.md` and user-extended `rules-v9` copies. In
shared mode, the SessionStart hook nudge now goes out only while the host's rules file
lacks the block, because otherwise it is a third copy. The channel matrix is in the
setup reference.
- The Claude Code `CLAUDE.md` block (now `lean-ctx-claude-v12`) and the setup message no
longer say "Replace mode" when the default Hybrid install hides native Grep/Glob.
- **Less steering in the per-turn text.** In benchmark pilot P6, on short tasks,
"ALWAYS use ctx_*" and "orient with ctx_compose FIRST" added model steps. The
per-turn text now states the routing once and neutrally:
- The MCP instructions anchor, the `CLAUDE.md` block and the SessionStart/UserPromptSubmit
hook texts are reworded, and the Claude Code mod recognizes both the old and the new
hook texts.
- The "SOLUTION EFFICIENCY" coding advice is no longer in the MCP instructions or the
rules files by default (`[solution] inject_in_instructions` / `inject_in_subagents`
now default to `false`). The on-demand `LEAN-CTX.md` keeps it.
- The rules themselves (rules version 13) state the routing once: a short header, the
tool map, a scope line and a short "by task" table. "CRITICAL: ALWAYS",
"NEVER … SELF-CORRECT", "ACTUALLY EMIT" and "orient FIRST" are gone. The
anti-pattern, parallel-call and end-of-file preference lines now appear only in the
on-demand `LEAN-CTX.md`. Every rules file is rewritten on the next sync.
- In dedicated mode (`rules_injection = "dedicated"`), the MCP instructions shrink to the
anchor when the SessionStart hook carries the rules.
- `lean-ctx doctor` no longer counts the MCP instructions as a channel for a host that
has no lean-ctx MCP entry.
- `prompt_reinject = "auto"` (the default) now means off. `"on"` restores the per-turn
reminder of about 45 tokens.
- **Leaner tool results.** The session wake-up briefing (`--- AUTO CONTEXT ---`) and
the shared-context hint are no longer prepended to the first `ctx_compose`,
`ctx_search` or `ctx_read` result; they come with the first `ctx_session` call with
`action="load"`, `"status"` or `"show"`, so every other result stays a byte-stable
function of its inputs (#498). Auto-load context packages are still applied on the
first call. `ctx_patch` and `ctx_edit` answer a successful edit with one line
(`patched : N lines (+a -b)`); the pre/postimage digests and the diff come only
with `evidence=true` (which now defaults to `false`). In Claude Code with the lean-ctx
mod installed, the diff goes to the content-addressed tool archive instead and the
receipt names it in a `[diff:]` line (about 13 tokens); the mod reads it from there and
still draws the diff, while the model does not read it unless it asks. Like every
archive entry, the stored diff (redacted, bounded) is also found by archive search and
`ctx_expand`, and follows the archive's retention. A direct `ctx_edit` gets no trailer. `ctx_search` carries at most one
note: the `Results span … directories` hint is gone and the legend for `∈` is left out
when a coverage note (result cap, deadline, budget) is shown, and that note is shorter.
- **A blocked inline script no longer rejects the whole shell line.** When a `ctx_shell`
command is a list of independent statements (separated by `;` or newlines) and each
blocked statement is a bare interpreter call (`python3 -c …` with no `&&`, `||`, pipe,
redirect or substitution), the other statements run and each skipped one is named in
a line `skipped: ()`; the call reports exit 126 unless the part
that ran failed. Everything else is still rejected as a whole: comments, heredocs,
line continuations, control structures, and any use of `exit`, `return`, `set`,
`command`, `builtin`, `eval`, `exec`, `source` or `trap`. What runs is checked again
as one command. Inline-script blocks are two lines instead of seven.
- **A read no longer leaves a Hot scent.** Every `ctx_read` started a thread that took the
scent-field file lock to record the read. Reads now leave nothing in the field; claims,
releases, handoffs and the Stuck scents of bounces and failed edits are unchanged, and
`ctx_agent sync` and the dashboard drop Hot entries a field file still holds.
### Removed
- **Human review of Hive knowledge** (owner decision 2026-11-01: in Hive agents work
together and people only watch). Gone are `lean-ctx hive review` (list and merge
proposals), the `ctx_tasks` actions `read`, `confirm` and `object` on knowledge
proposals, and the automatic objections an instance sent to 1.x proposals that contradicted
its knowledge. The sharing question no longer lists 1.x merges and objections. A
submitted task result now says another agent checks it before it is done. On a C0 2.0
Hive the instance queues no 1.x knowledge draft any more: neither a session draft for a
project that is not linked or bound, nor an import draft (`lean-ctx import docs|git`).
Knowledge reaches the vault as signed events through capture, and a draft still queued
from before is dropped on the next sync.
- **Sealed vaults** (owner decision 2026-11-01: Hive removed them; self-hosting Hive or a
private cloud covers protection from the operator). Gone are `lean-ctx hive grant`,
`lean-ctx hive review decide`, `lean-ctx hive status --health` and the config key
`hive.sealed_grants` (no longer read), the sealed key store, the `v2_plain` sealing
conversion with its cursors under `/hive/convert/`, sealed event bodies and sealed
places in sync (epoch keys, place secrets, `{converted: true}` tail stubs), sealed bus
messages, sealed drafts, revisions, code graphs and task texts, the instance-side merge of
`ready` sealed proposals and the re-seal after a key rotation, the instance-side review
decision (E41), the local trust and health figures of sealed places, and the "Key print"
line of `hive status`. A vault that Hive reports as sealed is refused with an error that
says sealed vaults are not supported. Capture keeps only `public` claims.
- **`lean-ctx hive review rollback`.** Hive answers `GET …/knowledge?revision=n` with the
newest revision only (Hive bf30976d) and undoes knowledge per node (retract or restore);
`hive review merge` stays, and an unknown `hive review` subcommand is refused with the
usage.
- **The last Hive swarm remnants.** With Hive swarms, pledges and the conductor gone
(C0 2.1), a `~` bus address is no longer an address: such a post never left the
machine and now never will (`invalid_address`). Messages on a swarm network are no
longer decoded, and the own-text screening for public swarm writes is gone. The consent
kinds `swarm_join`, `pledge_change` and `unattended_start` are gone: a stored record of
one is an invalid record and approves nothing, a Hive refusal naming one is a refusal of
an unknown kind, and the macOS consent helper no longer shows their dialogs. Worker keys
are fetched for vault places only. The `quarantine_timeout` task origin is gone (Hive
creates no such tasks); such a task shows origin `unknown`.
- **Episodic and procedural memory** (owner decision 2026-11-01, measured on 126 real
tasks: procedures were never selected into a kernel plan, and episodes, tool/file run
logs, never reached the delivered kernel trailer for code queries; decisions, findings
and gotchas already live in project knowledge). Gone are `core::episodic_memory`,
`core::procedural_memory`, the `memory.episodic` / `memory.procedural` kernel
providers, the episode recorded at MCP shutdown and on a completed `ctx_session` task
(the `Episode auto-recorded` note), the procedure capacity reclaim and its
`Procedures:` line in the consolidation report, the `episodic`/`procedural` lines of
`ctx_knowledge action=lifecycle_report` and of the effective-config summary, the doctor
capacity checks for both stores, and the `episodes`, `procedures` and `existing_paths`
inputs of the dashboard's work analysis (its work view now reports `available: false`).
Existing files under `memory/episodes`, `memory/procedures` and
`memory/archive/procedures` stay on disk; nothing reads them, and only the existing
orphaned-project prune still removes a removed project's episode file.
- **Dormant Context Kernel code without a caller:** `enforce_plan` (the mode never reached
filtering), `activation::should_suppress_in_mode`, `health::format_health` and
`health_api::one_line_status`. No command, route or tool output changes.
- **The unused A2A transport counters** (`core::a2a::telemetry`): nothing recorded a
delivery or read the snapshot. The A2A health view keeps its own delivery outcomes.
- **Research and evaluation tooling** leaves the engine (owner decision 2026-10-30):
`lean-ctx eval` (`init`, `ab`, `verify`, `footprint`, `frontier`, `testbench`),
`quality-lab`, `measure`, `prove speed`, and the `benchmark` subcommands `tasks`,
`study`, `eval`, `eval-ab`, `replay` and `compare`, with the proxy route
`GET/POST /v1/quality-lab`, the `benchmark-study` workflow and the CI output-quality
and testbench gates. The commands print a removal notice and exit with 2. With them go
the speed line in `gain --wrapped` (the prompt segment's `speed` stays `null`), the
footprint note in `tools health` and the task-benchmark section of `evidence-export`.
`benchmark run|report|scorecard|dual-arm`, `gain` and `doctor overhead` are unchanged.
- **Hive swarms and Task Compute** (owner decision 2026-10-30; Hive answers `404` on every
`/v1/swarms/*` and `/v1/compute/*` route). The instance drops the swarm client, participation,
pledges and conductor, the Task Compute client, the `ctx_compute` MCP tool, `ctx_tasks`
`scope=swarm`, `ctx_agent send swarm_id`, and `lean-ctx hive swarm`, `hive compute` and
`hive replica --swarm` (`hive swarm` and `hive compute` are unknown subcommands); such
calls are refused instead of reaching the org channel. Hive
tasks, worker mode and its opt-in, durable workers and the agent bus stay.
- **The Hive 1.x protocol fallback** (owner decision 2026-10-31; Hive has not shipped, keeps
no 1.x compatibility and answers `Hive-Protocol: 1.x` with `426`). A session no longer
drops to `Hive-Protocol: 1.9` when the instance card was not answered: every request
sends 2.0, and an answer that names another major is an error saying the instance requires
`Hive-Protocol 2.x`, instead of being accepted as 1.x.
- **The client of the daily Hive metrics upload** (`POST /v1/metrics`, a route Hive does
not have). It was always off; `hive sync` and `hive status` no longer print a "Metrics"
line. Instance metrics v2 (hourly, the "Instance metrics" line) carry the same figures.
- Internal clean-up, no behaviour change: modules and functions without a production
caller are gone from the Engine (among them the process-slot guard, the recovery
verifier, the cognitive chunker, the context-checkpoint adapters, branch/merge and
migrator, the context-kernel gate and feedback stubs, the proxy web-app request
normaliser and conversation tracker, the multi-read and smart-read handlers, the CLI
provider-run harness and unused terminal animations), together with four tracked
source files that were never compiled. Rust embedders that imported these internal
paths must drop the imports.
- `lean-ctx doctor` no longer shows the "Budget SLOs" line. It always passed and checked
nothing, so the board has one check fewer.
- The Cargo features `experimental` and `context_kernel` are removed. Neither switched
any code; a build that names them must drop them.
- The compression-feedback store (`core/feedback.rs`) is gone. Nothing recorded into it,
so the bandit and mode-predictor paths that read it never received data. An existing
`feedback.json` is left untouched.
- **Learned `auto` read modes** (opt-in since #683): the mode predictor, the mode bandit
and the adaptive mode policy are gone, and the built-in OCLA config tuner proposes the
requested mode unchanged. On the MCP path the learned choice could only switch
`map`/`signatures` for files over 300 lines; `auto` is now always the deterministic
capability-guard and size/task cascade. Reads and `ctx_feedback` no longer write
`mode_stats.json` or `adaptive_mode_policy.json` (existing files are left alone), and
`ctx_feedback reset` clears only the LLM feedback log.
- **Threshold bandit and learned field weights:** `core/bandit.rs`, the arm selection,
reward and bounce/edit-failure penalties in `adaptive_thresholds` and the field-weight
presets in `context_field` are gone, with the `field_weights_bandit` entry of
`lean-ctx introspect cognition`. The per-language and compressibility thresholds of
`mode=entropy` stay. Entropy reads no longer load and save `bandits.json` (an existing
file is left alone).
- **The background cognition loop** (off by default) and its idle replay are removed, with
cluster compaction into digests, replay consolidation and observation synthesis. The
scheduled consolidation keeps running the memory lifecycle (decay, merge, archival), so
a default install behaves as before. `lean-ctx introspect cognition` no longer lists the
memory consolidation, idle replay and observation synthesis subsystems.
- **LITM placement calibration** is removed. It only acted with `minimal_overhead = false`,
where it moved session items between the begin and end blocks over time; that block now
always uses the static layout. `ctx_metrics` no longer prints the calibration section,
`lean-ctx learning status` and the efficacy snapshots drop the placement hit rate, and
`/api/learning` no longer has a `litm` field.
- **The optional LLM enhancement layer** (`core::llm_enhance`: LLM query expansion and
observation enhancement, off by default). Nothing called it since the cognition loop and
its observation synthesis were removed; LeanCTX calls no model itself.
- Session files no longer carry `wakeup_manifest`, the LITM placement manifest that nothing
has read since LITM calibration was removed. An older session file with it still loads;
its next save drops the field.
### Deprecated
- The `[llm]` config section (`enabled`, `backend`, `model`, `base_url`, `timeout_secs`) has
no effect any more: the LLM enhancement layer it configured is removed. The keys stay
accepted so existing configs keep loading; earliest removal 3.15.0
(`rust/data/DEPRECATIONS.toml`).
- `ctx_session action=episodes|procedures` (every value), `ctx_knowledge action=restore
store=procedures` (and `lean-ctx knowledge restore --store procedures`), the dashboard
routes `GET /api/episodes`, `GET /api/procedures`, `POST /api/episodes/annotate`, and
the config sections `memory.episodic` / `memory.procedural` with their
`LEAN_CTX_EPISODIC_*` / `LEAN_CTX_PROCEDURAL_*` variables are retired with the episode
and procedure memory. They stay accepted, answer that they were retired (decisions,
findings and gotchas live in `ctx_knowledge`) and have no effect; earliest removal
3.15.0 (`rust/data/DEPRECATIONS.toml`).
- `ctx_agent action=poll_events` has its own parameters: `workspace_id`, `channel_id`,
`since_id`, `kinds` and `limit`. The parameters it borrowed for them (`to_agent`,
`category`, `message`, `privacy`, `ttl_hours`) stay accepted as aliases; the new names win
when both are given; earliest removal 3.15.0 (`rust/data/DEPRECATIONS.toml`).
- `lean-ctx autopilot policy`, `lean-ctx autopilot evidence --learn` and the config key
`intelligence_runtime.context_policy_apply` have no effect any more: learned
read-strategy policies are retired and the read strategy is chosen locally. They stay
accepted, report `retired` and warn on stderr; earliest removal 3.15.0
(`rust/data/DEPRECATIONS.toml`, shown by `lean-ctx doctor`).
- `lean-ctx setup --no-auto-approve` never changed what setup writes. It stays accepted,
warns on stderr and has no effect; earliest removal 3.15.0. The interactive setup no
longer suggests it.
- `lean-ctx serve --a2a-signing-key ` puts the key in the process list. It still works
and warns on stderr; use `--a2a-signing-key-file ` or `LEAN_CTX_A2A_SIGNING_KEY`
instead. Earliest removal 3.15.0.
- `lean-ctx serve --auth-token ` puts the Bearer token in the process list. It still
works and warns on stderr; use `--auth-token-file `, `LEAN_CTX_HTTP_TOKEN_FILE` or
`LEAN_CTX_HTTP_TOKEN` instead. Earliest removal 3.15.0.
- `lean-ctx cockpit --auth-token=` (alias `--token=`) puts the Bearer token in the
process list. It still works and warns on stderr; use `--auth-token-file `,
`LEAN_CTX_HTTP_TOKEN_FILE` or `LEAN_CTX_HTTP_TOKEN` instead. Earliest removal 3.15.0.
- The config key `auto_mode_learning` and its env var `LEAN_CTX_AUTO_MODE_LEARNING` have no
effect any more: the learned `auto` signals they switched on are retired. Both stay
accepted; earliest removal 3.15.0 (`rust/data/DEPRECATIONS.toml`).
- The env var `LEAN_CTX_STOCHASTIC` has no effect any more: the bandits whose sampling it
enabled are retired. Earliest removal 3.15.0.
- `ctx_knowledge action=cognition_loop`, the config keys `autonomy.cognition_loop_enabled`,
`cognition_loop_interval_secs`, `cognition_loop_max_steps` and
`cognition_synthesis_min_cluster`, the `[memory.compaction]` section and the variables
`LEAN_CTX_COGNITION_*` and `LEAN_CTX_COMPACTION_*` have no effect any more: the cognition
loop is retired. They stay accepted (the action answers that it was retired; use
`action=consolidate`); earliest removal 3.15.0 (`rust/data/DEPRECATIONS.toml`).
- `lean-ctx learning export` and `learning import` carried the retired LITM calibration.
They stay accepted, say on stderr that they were retired and have no effect; earliest
removal 3.15.0.
- The kernel mode variable is now `LEAN_CTX_KERNEL_MODE`, like every other variable. The
old `LEANCTX_KERNEL_MODE` is still read and warns once per process; the new name wins when
both are set. Earliest removal 3.15.0 (`rust/data/DEPRECATIONS.toml`).
### Fixed
- **A flaky lib test no longer blocks a release build.** The release workflow runs a test that
failed once more on its own; a failure that repeats still fails the build, and one that
passes alone is named in the job summary.
- **A Hive lease renews after the keyset v3 rotation.** An instance verified a renewed lease
only against the key set it enrolled with, so a lease signed with the v3 policy key failed
and the instance fell into its grace period a day after enrolling. A failed renewal also
stopped the background pass for good, so knowledge, policy, metrics and receipts paused
until the next restart. Renewal now picks the key set that names the lease's key, a failed
renewal is retried on the next pass, and `hive status` shows the last renewal error.
- **A `ctx_read` cut by the turn budget is read again in full.** A full read larger than the
per-turn budget reaches the model only as a prefix, but the session cache recorded it as
delivered, so the next full read of the unchanged file answered `[unchanged]` while the cut
part had never been shown. Such a read no longer counts as delivered, as the read dedup
already decided (#2172).
- **`lean-ctx restart` and `stop` end only the services lean-ctx started (#2176).** On
Windows, `restart` ended the MCP servers of running Claude Code sessions as "orphan
processes": the name-based sweep relied on `wmic`, which current Windows versions no longer
ship. `restart`, `stop`, `config apply`, `uninstall` and `dev-install` now stop only the
daemon, proxy and Cockpit this instance recorded, each checked again by command line, user
and process identity right before the signal; MCP servers, `-c` runs, hooks and other
installs are never touched. Unrecorded lean-ctx services are listed with the command that
stops them (also in `doctor`) instead of a false "All stopped", `restart` brings back a
proxy it stopped, and on Windows the daemon and proxy no longer stay in the caller's job or
hold its handles, so a captured `lean-ctx restart` (or PowerShell `Start-Job`) no longer
hangs.
- **The Cockpit starts on Windows (#2174).** `lean-ctx cockpit` and `dashboard` refused
every port with "Port N is used by another program": Windows refuses a connect to a
closed loopback port only after about 2 s, so the 400 ms probe took every free port for
a busy one. A port now counts as free when it can be bound and nothing answers on it,
as `doctor` already checked. A port that answers nothing but cannot be bound (a Windows
excluded port range) gets its own message.
- **The config migration warning no longer repeats on every command (#2175).** Once the
v4 migration had run, every later migration was refused because its journal was still
there, and every command warned that the journal "already exists". A later migration
now resumes an interrupted one, extends a completed one or archives a journal that later
edits superseded; `lean-ctx migrate config --rollback` still restores the original
pre-v4 config. A migration that cannot be verified is reported once and names both
journal files and the rollback command. The empty `config.toml.v4-migration.lock` left
by 3.11 is removed.
- **The Windows MSVC build runs on a clean Windows (#2178).** It needed the Visual C++
Redistributable (`VCRUNTIME140.dll`) and exited silently with `0xC0000135` without it.
The C runtime is now linked statically, and the release refuses a Windows binary that
imports a Visual C++ or MinGW runtime DLL.
- **`doctor` finishes (#2179).** Its search-index and graph checks loaded the whole
project index to count files, which on a large project ran for minutes after the last
check was printed. They now read the stored counts read-only, run with a 10 s limit and
report "skipped (busy)" instead of waiting. `doctor --json` prints a single JSON
document; daemon diagnostics no longer precede it on stdout.
- **The Claude Code cockpit counts a session started outside the project (#2181).** With
Claude Code started in the home directory and the agent working in a project, the pane
showed 0 for every value: it kept only sessions whose project contained the start
directory, before it looked at which Claude Code a session belongs to. The Claude Code
that started a session now decides, as for the status line; among several of its
sessions the start directory's project wins.
- **A single `*` in `ctx_glob` stays in its directory (#2182).** `rust/src/*.rs` also
returned files from subdirectories such as `rust/src/core/`, because `*` matched across
`/`. In a pattern with a `/`, `*` and `?` now stay within one directory and only `**`
recurses; a pattern without `/`, such as `*.rs`, still finds matching files at any depth.
- **Freed memory goes back to the operating system (#2075).** The allocator's purge was a
silent no-op, tree-sitter allocated outside it and the search index kept every project
resident, so the daemon's memory only grew. Freed pages are now returned, the index drops
roots it no longer needs, memory is reclaimed before a search, and `daemon_max_rss_mb`
caps the daemon.
- **Docs, test values and key ids no longer trip Hive's screening.** Instance and Hive
refused text that only documents a secret: an `Authorization: Bearer …` placeholder
(`…`, ``, `$TOKEN`, `hive_p_…`), one of Stripe's published test card numbers, a
public key id or digest (`ed25519-` with 32 hex, `sha256:`/`blake3:` with 64 hex) and a
redaction marker shown inside a code span. These narrow cases now pass; a real-looking
token, any other valid card number, a key id of another length and a marker outside a
code span are refused as before. Both sides read the same published vectors.
- **An agent no longer misses a task that opens while it reconnects.** Task notices are
not stored on Hive; an agent that registered just before a task opened could miss it.
After every reconnect the instance now fetches the open tasks once and tells its agents.
- **A new role gets its own Hive worker when the machine has 32.** Hive allows 32 workers
per instance; on a machine at that limit a new role's session was attached to an
unrelated worker, so Hive refused its task claims ("not on the bus"). Now the
longest-unused worker without a session gives way and is retired on Hive; a worker that
comes back keeps its id. `lean-ctx hive status` shows the count at the limit and any
retirements still waiting.
- **An agent that registers again with another role is announced afresh.** After
`ctx_agent register role=…` other machines kept listing the agent under its old role and
could not address it, so messages and handoffs to it went nowhere. A changed role now
announces the agent again on the Hive bus.
- **A git worktree is a project LeanCTX can share.** In a linked worktree `.git` is a file,
and `hive connect` said the folder had no git remote; the instance now follows it to the
repository's remote. Local knowledge of existing worktrees keeps its place.
- **`lean-ctx import docs` reaches a 2.x Hive.** Imported doc facts only went through the
old 1.x draft path and never reached a 2.x vault; the capture now includes them.
- **`ctx_agent register` refuses `project_root`.** It accepted the argument and ignored it;
an agent joins the bus of the project its MCP session runs in, and the answer now says so.
- **`lean-ctx import --help` lists `docs` and `git`.**
- **`lean-ctx init --agent --dry-run` writes nothing.** The agent and governor setup
ran before the dry-run check, so a preview already wrote MCP, hook and rules files; it now
prints what it would configure and stops. Claude Code hook matchers drop the lowercase
aliases (`bash`, `read`, `grep`, …), which Claude Code never sends because tool names are
case-sensitive; an install from before keeps exactly one hook after the next refresh.
Reimplements community PR #2169 by ZacKienzle2.
- **The kernel trailer no longer ends in an empty heading.** When the 150-token budget cut
right after a provider heading, the delivered `--- kernel context ---` block ended in
`## Relevant …` with no entry under it. A heading whose entries were all cut is now
dropped with them; a trailer that would hold only headings is not delivered.
- **`ctx_read` finds a file named relative to a search root on the wrong prefix.** A
`ctx_search` under `tests/` lists hits as `signal/test_x.py`; agents then asked for
`src/app/signal/test_x.py`, got "file not found" and spent a request on the retry. When
exactly one file in the project shares the longest trailing part (at least directory and
file name) with the missing path, `ctx_read` reads it and says so, as it already did for
a wrong leading directory.
- **Edit receipts count the lines that changed.** `ctx_patch`/`ctx_edit` reported the spans
the caller sent, so inserting one import line with its block as anchor read `(+4 -3)` and a
74-line test appended after a 6-line anchor `(+80 -6)`; agents ran `git diff` to see what
had been removed. The receipt now leaves out lines that are the same at the start and end
of the replaced span: `(+1 -0)`, `(+74 -0)`.
- **No "run `lean-ctx setup`" tip for a set-up Claude Code.** The first tool result of every
session told Claude Code users to run setup although its `CLAUDE.md` block was installed:
the check looked only at rules files, and Claude Code (like CodeBuddy) has none. The tip
now appears only when no host carries lean-ctx guidance.
- **The context ledger's Phi no longer depends on earlier entropy reads (#498).** Every
`mode=entropy` read picked a threshold-bandit arm and installed its field weights for
the whole process; with tied arms the first read switched the ledger from the default
to the `conservative` weights, so the same files scored, ordered and were evicted
differently depending on what had been read before. Phi now always uses the fixed
default weights, for the ledger and the context kernel.
- **A Claude Code `settings.json` that does not parse is left alone.** The permission writers
replaced it with an empty object plus the lean-ctx entries, dropping every other setting
(only the `.bak` kept them), and the hook installer skipped it while reporting the hooks as
installed. Both now refuse: the file stays unchanged, and the error names the file, the
parse error and that `lean-ctx init --agent claude` sets it up once it is fixed. The same
holds for a project's `.claude/settings.local.json`.
- **A CodeBuddy `settings.json` or a Cursor or Windsurf `hooks.json` that does not parse is
left alone.** The installers replaced it with an empty object plus the lean-ctx entries,
dropping the user's own settings and hooks. They now refuse: the file stays unchanged, and
the error names the file, the parse error and that `lean-ctx init --agent ` sets it
up once it is fixed.
- **A loop-throttle block is a tool error.** A call the loop detector refused came back as a
successful result carrying the `LOOP DETECTED` message; like a role or policy denial it now
carries `isError`, so the host and the agent see that the call did not run.
- **Dashboard relation edits no longer drop concurrent edges.** `POST
/api/knowledge-relations/edit` loaded and saved the relation graph without the knowledge
lock, so an edge the MCP server wrote at the same time could be lost; it now edits under
the same cross-process lock as `ctx_knowledge relate`/`unrelate`.
- **A failed `POST /api/graph/enrich` answers an error status.** It answered `200 OK` with
`{"error": …}`; it now answers `503` when the project graph cannot be opened and `500`
when enrichment fails, with the dashboard's usual `{"error": ""}` body.
- **The config-keys reference puts `/mcp/{id}` on the right server.** It said the
`[[gateway_server.mcp_servers]]` route is served on the proxy port; the enterprise gateway
server serves it, the local proxy mounts no `/mcp/{id}` routes.
- **The Hermes plugin tests no longer look for the removed `clients/python`.** The test
bootstrap and the benchmark runner put that directory on `sys.path`; the client now comes
only from the installed `lean-ctx-client`, and the live test skips when it is missing.
- **A moved fact anchor is reported as moved.** The guarded anchor resolver refused an
anchor as soon as its path was not readable, and a moved file's old path never is, so
every move read as `missing`. An unreadable anchor path is still never read; the anchor is
now looked for elsewhere through the code graph, among readable files only.
- **Each proxied request is counted once in the kernel evidence.** A forwarded request was
recorded by the forward path and again when its measured usage arrived, so the usage
normalizer counted it three times and the receipt chain, identity attribution and ETPAO
twice. The forward path (and the Responses WebSocket bridge, per turn) now records it once;
measured usage only updates the per-provider statistics and dispatch counters. The
savings ledger is untouched: earlier entries keep their bytes and still verify.
`lean-ctx gain --pipeline` no longer promises per-layer stats that nothing records.
- **Proxy routes and policies match their docs.** The startup banner listed
`/mcp/{id}` routes for `[[gateway_server.mcp_servers]]` that this proxy does not serve
(404); it now says the entries are not served here. The DNS-rebinding Host check now runs
before token auth and rate limiting, so a foreign Host gets `403` before any credential
check. An outbound `router-policy.toml` refusal names its rule:
`destination.model_policy_invalid`, `destination.model_not_allowed`,
`destination.cost_ceiling_unverifiable` (any `max_cost_micros` refuses every request
until a verified cost estimate exists) or `destination.reasoning_budget_missing`; the
docs now say `400`, which is what the proxy answers.
- **Context Kernel startup and selection tell the truth.** The MCP server, the HTTP server and
daemon, and the proxy now initialize the kernel once at start, so the
`LEAN_CTX_KERNEL_*` switches apply and kernel health no longer reports "not initialized".
With `retention_days` in `kernel-policy.toml`, enrichment outside an MCP task is
evaluated at the current time instead of rejecting every candidate. Code-search and
code-graph selections, which spent supplement budget, are now delivered ("Relevant Code",
"Related Files"). The kernel mode (`shadow`, `enforce`, `explain`) is documented as
reported only: every mode removes policy violations before selection.
- **`/api/telemetry` reports what the sender does.** `enabled` was the config flag alone,
which is on by default, so `DO_NOT_TRACK=1`, `LEAN_CTX_TELEMETRY=off` and CI showed as on.
It now says whether telemetry is sent right now, decided like the sender, and the new
`blocked_by` names why not (`preference`, `environment`, `ci`, `config_unreadable`).
`current_payload` is the exact batch the next send would carry (as
`lean-ctx telemetry show` prints it), with the installation ID masked and the deletion-token
hash left out, instead of four fields; `payload_error` says why no preview is available.
- **Cockpit map views say "building" or the error instead of showing nothing.**
`/api/graph`, `/api/graph-files`, `/api/heatmap`, `/api/routes` and `/api/architecture`
waited up to 30 s for a cold index while the Cockpit gave up after 8–20 s, then answered
`200` with an empty list; they now answer `202 {"status":"building",…}` at once, like
`/api/tree` and `/api/symbols`, while the shared indexer builds. The building answer carries
the scan's real file counts instead of `0/0`. `/api/compression-demo` answers `400` without
a path and `404` for a file it cannot read (same error JSON) instead of `200`.
- **Dashboard GETs no longer write.** `GET /api/context-control` saved the context ledger
and the project's overlay store, and `GET /api/telemetry` created the installation ID; both
now only read (`installation_id` is `null` until an ID exists). Graph enrichment, which
writes commits, tests and knowledge into the project graph, moved to
`POST /api/graph/enrich` with the same answer; a GET answers `405`.
- **Dashboard reads show a write at once.** After a successful dashboard write (an overlay,
a pin or eviction, a knowledge edit, a policy, settings) the cached reads such as
`/api/context-risk` and `/api/session` were served for up to 5 s more; they are now
dropped. `/api/roi` (300 s) and `/api/doctor` (600 s) honour the Cockpit's explicit reload
(`_refresh=1`, "Re-check" / "Run again") instead of answering from the cache, and a settings
write clears both. The call graph is rebuilt when a file changed in place: its persisted
copy compared file paths only and its resident copy outlived index rebuilds.
- **Knowledge relation edits no longer lose each other's edges.** `ctx_knowledge relate`,
`unrelate` and the OKF import loaded and saved the relation graph without the lock fact
edits and the cognition loop hold, so a concurrent writer could drop an edge. They now
change the graph under that in-process and cross-process lock
(`KnowledgeRelationGraph::mutate_locked`).
- **A stale BM25 index is reloaded once, not once per search.** While a stale index was
served, every search started another background reload of the same index. One reload per
project now runs at a time.
- **The telemetry ledger records the endpoint the batch went to.** It read
`LEAN_CTX_API_URL` itself, so a test or cargo-launched process whose send went to the
loopback sink recorded the production URL. It now uses the same `api_url()` as the send.
- **The telemetry aggregate recognises a client that filters its MCP server's environment.**
`client_family` read the client markers (`CLAUDECODE`, `CODEX_HOME`, `CURSOR_TRACE_ID`,
`GEMINI_CLI`) from the process environment only; like the CI and consent markers it now
also finds them in the nearest ancestor on Linux.
- **A stray `Makefile` or `package.json` in a parent directory no longer becomes the project
root.** Project detection took the outermost ancestor with any marker, so
`~/code/Makefile` made `~/code` the project of every repository below it. Now the
outermost `.git` wins (monorepos stay one project), else the outermost workspace
(`go.work`, `pnpm-workspace.yaml`, a `[workspace]` `Cargo.toml`, …), else the innermost
generic marker.
- **Edit provenance is keyed by project like every other per-project store.** It was keyed
by a SHA-256 of the raw path, so `D:/repo` and `D:\repo`, or two projects mounted at one
path, were mixed up or split. It now uses the project key (normalized path plus project
identity); an existing store is moved to the new key on first open and read in place if
the move fails.
- **`ctx_verify` no longer promises budget claims.** Its description listed a budget claim
the proof never produced; the proof carries one PathJail claim per touched file.
- **A2A transport health reports delivery failures.** `check_transport_health` always
reported zero consecutive failures and no last delivery, so `readiness` could never mark a
failing transport unavailable. Work-graph capsule deliveries now record their outcome, and
the snapshot carries the count and both timestamps.
- **Archive ids stay the same across builds.** An archived output was named by
`DefaultHasher`, which Rust does not keep stable, so the same content could get another id
after an update. New ids are the first 16 hex digits of its BLAKE3 hash; existing ids keep
resolving.
- **Project store names no longer depend on the Rust toolchain.** The directory names of a
project's knowledge, archives and session stores came from `DefaultHasher`, so a
toolchain update could have moved them and lost their contents. The same algorithm is
now fixed in LeanCTX: existing directories keep their names and nothing moves.
- **Interactive checks on Windows never wait on a stdin pipe (#2176).** A lean-ctx command
whose input was a pipe its parent read at the same time (PowerShell `Start-Job`) could
hang while checking for a terminal. The check now asks the console directly and uses
the terminal test only inside MSYS, Git Bash or Cygwin.
- **A project with a non-UTF-8 source file keeps its cached call graph.** The build skipped
such files silently, so the cached graph never matched the file list and was rebuilt on
every load. Skipped files are now recorded in the graph (`skipped_files`) and count as
covered.
- **A CLI cache hit stays a hit when the cache is busy.** `lean-ctx read` re-sent the full
file when the cache lock timed out or the hit counters could not be saved. It now serves
the hit and logs the failure.
- **Primary models whose names contain "mini" or "fast" are recorded again.** The
background-model filter matched substrings, so `gemini-2.5-pro`, `minimax-m2` or `grok-
code-fast-1` never became the detected or last-seen model. It now matches the known
background model ids (Haiku, `gpt-4o-mini`, `gpt-4.1-nano`, `gpt-5-nano`, the Gemini
flash-lite models) exactly.
- **`lean-ctx call` names the phase that is actually running.** Concurrent calls shared one
phase slot, so a finished call could leave its phase behind or clear another call's; every
phase now owns its own entry.
- **Hive bus controls no longer stop local work.** A Hive `hold` or `stop`, and a damaged or
unknown-version `control.json`, refused every mutating tool, lease and handoff on the
machine, also offline, until Hive replayed its controls. They now pause Hive traffic only:
`ctx_tasks`, bus messages, the Hive side of a lease and a handoff through Hive. Local tools,
local leases (the answer says `scope=local (Hive control: …)`) and handoffs on the same
machine go ahead.
- **Switching the Hive bus off reaches a running relay.** The bus relay read `[hive]` once at
start and kept relaying after `bus = "off"` or `enabled = false` until the daemon
restarted. It now reads it before every connect and on every tick, closes its socket when
switched off and connects again when switched back on.
- **Hive never holds up a tool call.** `ctx_tasks`, the Hive side of a `ctx_agent` lease and
the first-call briefing waited for Hive inside the call (up to 3-5 s each). Task lists, tasks
and the briefing now answer at once from the last data Hive sent and say when it is stale or
not loaded yet; claims, updates, results, releases and reviews are queued, and Hive's answer
comes with the agent's next call. A Hive lease is pending (`scope=pending`, no fencing
token) until Hive grants it; a refusal or veto that arrives later reaches the agent with its
next `ctx_agent` call and releases the local lease, and a renewal or release waits for the
grant.
- **`ctx_read` reads a range passed as a key or next to a bare mode.** A call such as
`{"path": "schema.py", "lines:1939-1952": "lines:1939-1952"}` ignored the range and
returned the 13k-char outline of a 4,188-line file; `{"mode": "anchored", "lines": "22-30"}`
returned the whole file anchored. A `lines:` key now reads like the `lines`
argument, and a range next to a bare `anchored`, `full` or `auto` mode narrows it
(`anchored:` resp. `lines:`); any other mode still wins.
- **`ctx_read(symbol=…)` finds module-level constants and answers a miss briefly.**
A top-level binding (Python assignment, Rust `const`/`static`, JS/TS `const`/`let`/`var`,
Go `const`/`var`) was not a symbol, and any miss returned the whole outline (12k chars
for `_SIZE_UNITS` in a 4,188-line module). Bindings now resolve to their statement; a
name the file does not define returns the closest defined names and the first lines
that mention it (at most eight), read through the ordinary `lines:` path.
- **A failed background `ctx_shell` job keeps its output when it leaves a process running.**
If the command exited while a process it started still held its output pipe, the status
poll answered "retained output withheld by storage policy" with no stdout, no stderr and
no archive, whether the job succeeded or failed. The captured streams are now returned
(and archived) with the partial-output note, as the foreground path does; a governed
gateway still withholds them, and truncated, timed-out or cancelled captures are unchanged.
(#2164)
- **The shell approval dialog preselects "once" in Claude Code, so Accept works there.** The
form asked for a required choice with nothing preselected, and Claude Code does not
submit a form while a required field is empty: Accept only marked the field as required
and the dialog stayed open. In Claude Code, Accept on an untouched form now allows this
one command; "session" and "always" still need an explicit choice, and an accept without
content still approves nothing. Other clients keep the form with nothing preselected.
(#2171)
- **`ctx_read` and `ctx_expand` deliver the lines that were asked for.** A read larger than
the turn budget reached the model cut, yet was recorded as delivered, so asking for the
same file or range again answered "unchanged, already in context" for lines never shown.
Such reads are no longer recorded or answered with that reference. A cut `ctx_expand`
reply was archived again under a new id, so following ids gave nested archives; it now
uses the verbatim budget, is never re-archived and says how to narrow the same id. Its
output also skips terse compression, and `search` on a shell log ignores case like the
archive search does. (#2172)
- **`ctx_search` semantic no longer waits indefinitely on its source scan.** Without a
`mode`, the tool reads and admits every project source on each call; it resolved the
gateway configuration (re-reading the config files) for every file, so on slow storage the
per-file cost could add up to minutes with no sign of progress. It now takes one configuration snapshot per scan, stops after 90 s with an
error that says how to narrow the scan, names its stages (listing files, reading and
admitting files, persisted external items) instead of "BM25 index", and
`LEAN_CTX_PHASE_TIMING=1` prints each stage as it starts and every source that takes
longer than 500 ms. (#2063)
- **Reading lean-ctx's own config from an agent shell is no longer refused as a change.**
The check that keeps agents from changing lean-ctx's config and data directories decided by
program name, so `sed -n 1,3p ~/.config/lean-ctx/config.toml` was blocked as "changes
lean-ctx's own state" while `head` on the same file ran. It now judges what the command
does: `sed` without `-i`/`--in-place` and without a `w`/`e` command reads, and so do `awk`
without output redirection or `system()`, and `cp` from those directories elsewhere.
Writes stay refused: `sed -i`, `perl -i`, `tee`, `rm`, `mv`, a copy onto those files, any
`ln` that names them (a link lets a later write reach them), and
now also a `>`/`>>` redirect into them, which passed before when the program itself only
reads. A program whose effect cannot be told from the command, such as a script, is still
refused, with a message that says it may change the state and how to read the file
instead (#2165).
- **`plan`, `compile`, `overview` and `ledger` work again.** They asked the daemon for the
MCP tools `ctx_plan`, `ctx_compile`, `ctx_overview` and `ctx_ledger`, which 3.12.0 removed,
so with a running daemon they printed "was removed" instead of a result. They now render
locally from the same implementation; a test keeps every daemon call in the CLI on a live
tool.
- **`pack migrate` and `pack rollback` stay subcommands.** With a file named `migrate` or
`rollback` in the working directory, `pack` built a chat bundle of it instead.
- **CLI errors exit non-zero.** `checkpoints`, `import`, `config init` and `gotchas` printed
their errors (bad options, unknown source or action, unwritable config or store) and exited
0; usage errors now exit 2, failures 1. `status` and `token-report` report a report file they
could not save as an error and exit 1.
- **Fewer extra model steps on edit tasks.** Four causes of extra steps that benchmark
transcripts showed against the native tools are gone. A passing `python -m unittest` run
through `ctx_shell` keeps its `OK` line; before, the output ended at `Ran N tests` and the
agent ran the suite again to learn the result. `ctx_search`, `ctx_tree` and `ctx_glob` no
longer answer a repeated call from the response cache after the files changed. Before, a
search after an edit could return the matches from before the edit, and the agent read the
file again. `ctx_patch` `insert_after` accepts a line number without `hash`, like
`replace_lines` already does. The edit is then not checked for conflicts. An
`insert_after` that passes anchor text instead of a line number gets an error that points
to `replace_unique`. The message for a blocked inline script now says to write the snippet
with the host's file-write tool, because `ctx_patch` cannot write to `/tmp`.
- **`ctx_compose` includes the small files it names.** Files from its ranked results,
exact matches and symbol bodies are added in full and unchanged when they have at most
150 lines and 800 tokens. At most four files and 2,000 tokens are added per call.
`LEAN_CTX_COMPOSE_INLINE_TOKENS` sets the limit, and `0` turns this off. The files pass
the same checks as `ctx_read`: path jail, binary detection and policy. Secret-like
files are left out. In the benchmark, agents read these files in the step right after
the overview.
- **`policy org uninstall` restores the endpoint.** It now also removes the trust pins of the
removed policy's organization. Before, `install --trust` followed by `uninstall` left the
pin behind, and a pinned organization without a policy refuses every governed call, so
reads stayed "withheld by the project or organization policy". Pins of other
organizations stay, and `uninstall` lists them with the `untrust` command that removes them.
- **Custom REST connectors are read-only.** A provider config whose resource uses `PUT`,
`PATCH` or `DELETE` is rejected with a message that says why; `GET` and a body-less `POST`
for search endpoints remain, and the request layer refuses any other method as well.
- **The security docs describe `ctx_execute` as it works.** They said its scripts run outside
the shell allowlist. Shell code in `ctx_execute` is checked by the same allowlist as
`ctx_shell`, and code in other languages runs under `shell_security = "enforce"` only after
you approve it.
- **A compression addon's answer is redacted.** The output of a downstream compression addon
now goes through the same secret scanner as every other gateway result
(GHSA-gvg8-285q-m62g); before, it was admitted but not scanned.
- **A withheld read is in the audit trail.** When the I/O boundary refuses a read, the trail
records it for the calling tool with its reason class and never the path or content:
`content_withheld:1|reason=secret_path` for a secret-like path such as `.env`,
`path_blocked:1|reason=outside_root` (or `protected_path`) for the path jail, which before
was recorded as `resolve_path` with no agent. `ctx_read` with `paths` records its refusals
the same way, and a `ctx_search` that skipped secret-like files records one entry with
their count. The status line, `lean-ctx value` and the evidence bundle count them as
withheld or blocked; a missing file is no refusal and is not recorded.
- **`cockpit --export` writes the Cockpit report, not the old Visualizer page.** Without a
terminal, or with `--output=FILE`, it writes a self-contained `LeanCTX Report` page: what
was delivered, withheld, redacted and blocked (audit trail, savings ledger), the savings
with their trust labels (measured, derived, estimated), the top tools and models with a
recorded saving, and the state of both chains, from the same verified sources as
`lean-ctx value` and `lean-ctx roi`. The dependency graph and the per-file "0 tokens
saved" rows are gone, with the unused Visualizer module.
- **Retiring a stale lean-ctx rules file no longer deletes user text.** `setup`, `init` and
the Claude Code sync used to delete `.claude/rules/lean-ctx.md` (and the CodeBuddy
equivalent) whenever it carried a lean-ctx marker, including any lines a user had added.
Now they remove only the lean-ctx region and keep a `.bak` backup.
- **No more `*.v4-migration.lock` files in your project.** `lean-ctx init --agent …` writes
project files such as `CLAUDE.md` through the config writer, whose lock file sat beside
each written file and showed up in `git status`. Locks now live under the lean-ctx data
directory (`locks/`), keyed by the file's resolved path; existing stray lock files can
be deleted.
- **Governor setup: identical re-reads are stubbed by default.** With `--mode governor`,
R1 for Read only applied when `LEAN_CTX_READ_DEDUP=on` was set; it now applies unless
`read_dedup = off`. `lean-ctx doctor overhead` now measures the installed governor setup
(rule block, plus deferred tool names for `governor-mcp`) instead of the default prefix.
- `python -m pytest -p no:cacheprovider` (and `-m unittest`, `pip`, `venv`, `mypy`) is no
longer blocked as inline code: `-m` ends python's own options, so the module's flags
are not interpreter eval flags. Options before `-m` are still checked.
- `python -m timeit ""` (and `-m pdb`, `-m IPython`, `-m code`) is now blocked as
inline code execution, like `python -c`; it ran its argument as code unchecked.
- `ctx_patch` accepts the argument shapes models send most often instead of failing:
`ops` as a JSON-encoded string, `new_string`/`content` for `create`, `new_string` for
anchored ops, and `find`/`replace` for `replace_unique`. An ambiguous
`replace_unique`/`ctx_edit` match names the lines it was found on.
- **A session can no longer be locked out by the context gateway.** A restricted block is now
withheld in place, with a stable id, instead of refusing the whole request; such a refusal
answers `400 invalid_request_error` naming the block ids rather than `403 permission_error`,
and lowercase banner words no longer mark a block. `lean-ctx gateway why`, `list`,
`allow-once` and `revoke` explain a withheld block and let the person at the terminal release
it once or undo that.
- **Failure templates keep only LeanCTX's own wording.** Before a failure message is counted,
every word that is not part of LeanCTX's messages becomes a placeholder, and a path with
spaces in it (`./My Notes/list.md`) collapses into one `‹path›`, so no word of a file or
folder name reaches telemetry.
- **Refused requests are no longer counted as LeanCTX errors.** A tool call refused for a stale
edit, a bad argument, a missing file, a size limit or a policy counts as a validation error,
a timeout as a timeout; only an unexplained failure stays an internal error. Words are
matched whole, so "unexpected" is no longer read as "expected".
- **`ctx_edit` gives clearer answers.** An `old_string` found several times names the lines
it was found on; repeating an edit this process already applied answers "No change"
instead of "not found"; and an empty `old_string` creates a missing or empty file, while a
file with content is refused instead of replaced.
- **A project policy's block now holds in Claude Code.** When `.lean-ctx/policy.toml` blocked a
native shell or file call, the `hook rewrite`/`redirect`/`copilot` verdict carried a
top-level `decision: "deny"`, which Claude Code rejects as invalid output and ignores, so
the call ran. Claude Code now gets the deny in its own `hookSpecificOutput` form; other AI
tools keep the shared form.
- **Shell rewrites now apply in Gemini CLI.** Gemini reads a hook's new arguments from
`hookSpecificOutput.tool_input`, not `updatedInput`, so it ran every command unrewritten. It
now gets the rewrite in its own field and no decision, since a Gemini hook cannot approve a
call and Gemini checks its policy on the rewritten command. File-tool redirects stay off on
Gemini, whose file tools refuse the temp file outside the workspace.
- **A fresh clone builds with `cargo fast` again.** The alias that `make build`, the README
and `dev-install` use lived only in a configuration file the public repository did not
carry; `rust/.cargo/config.toml` now ships it (the alias only, no job or target settings,
so your own Cargo configuration still applies). `rust/scripts/setup-fast-build.sh` writes
its machine-local linker and sccache settings to the repository-root `.cargo/config.toml`.
- **Tool descriptions stay with their tools for Cursor, VS Code and Zed.** The description
optimizer for these clients re-sorts and trims its list; descriptions were then paired with
tools by position, so tools got another tool's description and the tail of the list lost its
text. They are now matched by name, and a tool the optimizer skipped keeps its own description.
- **Upgrading the npm package no longer stops unrelated processes.** Its preinstall step ran
`pkill -f lean-ctx` (`taskkill /IM lean-ctx.exe` on Windows), which ended the proxy, the
dashboard, other installs and any command whose line mentioned lean-ctx. It now asks the
installed binary to stop only its own daemon (`lean-ctx daemon stop`) and does nothing on a
fresh install; on Windows a binary that is still open is moved aside as before.
- **Upgrading with `install.sh` or `install.ps1` no longer stops unrelated processes.** Both
ran the full `lean-ctx stop` before replacing the binary, which ended every lean-ctx process
by name and unloaded the user's proxy and daemon services. They now stop only the daemon of
the binary they replace, right before the swap, and restart it on the new binary when it ran
or had autostart before; `install.ps1` moves a binary that is still open aside (`.old`).
- **`lean-ctx uninstall` refuses unknown arguments.** A typo such as `--dry-rnu` was ignored
and ran a full, irreversible uninstall; it now exits 2 with a usage hint and removes nothing.
- **`install.sh` names the installed version.** Its closing line always read "Done! lean-ctx
installed." because the version call was quoted wrongly; it now prints the version, e.g.
"Done! lean-ctx 3.12.1 (…)".
- **The skill's `curl | bash` installer succeeds again.** Its cleanup trap referred to a
variable that no longer existed once the install step returned, so under `set -u` it exited 1
after a successful install and left its temp directory behind; on macOS it also misread the
release tag. It now exits 0 and removes the temp directory.
- **`lean-ctx wrap` uses the proxy's port.** Without `--port` it pointed the agent at 4444,
ignoring `LEAN_CTX_PROXY_PORT`, the `proxy_port` setting and the per-user port on multi-user
systems, so the agent missed a proxy listening elsewhere. It now resolves the port the same
way the proxy does; `--port` still overrides it.
- **Every CLI output passes the release point.** `knowledge contradict` and `retract`,
`autopilot`, `gotchas`, `pack receive` (a peer's payload) and the daemon answers of `read`,
`grep`, `glob` and `ls` printed their text directly, past the policy and the masking every
other CLI output goes through; a secret in a gotcha, a Hive refusal reason or a daemon answer
could reach the terminal unmasked. They now print through the shared CLI run; `autopilot` and
`gotchas export` keep valid JSON with the masked value in place.
- **`pack` errors exit non-zero.** Its subcommands printed their errors (missing arguments, an
unknown subcommand, a registry that cannot be opened, a failed import, export, send or write)
and exited 0, and `pack remove` exited 0 when no package matched. Usage errors now exit 2,
failures 1.
- **`benchmark --help` lists every form.** It showed only the pipeline benchmark; the usage of
`benchmark run`, `report`, `scorecard` and `dual-arm` was unreachable. An unknown subcommand
now prints the full usage and exits 2.
- **Packaging matches the release.** The AUR recipe in `aur/lean-ctx` named 3.10.5; it now
names 3.12.0, and `scripts/check-package-versions.py` fails when it trails the engine by more
than one release. The cookbook TypeScript client carries the repository's Apache-2.0 license
(its `package.json` said MIT) and `publish-clients.yml` no longer has a job that would publish
this private example. `examples/sprint-poc` is marked unmaintained: it needs the retired
Python SDK, which is no longer in this repository.
## [3.12.0] — 2026-10-28
Focus release. The local Engine and the whole Cockpit are free and local, with no
account and no plan checks; the hosted services that needed an account close. LeanCTX
Hive (shared knowledge for teams and your own machines) follows with 3.12.1. LeanCTX also keeps what
selects, controls and proves context and drops what measured no benefit. 3.12.0 includes
every change prepared for 3.11.5, which is not released separately. Upgrade notes:
[docs/guides/upgrade-3.12.md](docs/guides/upgrade-3.12.md) (retired services) and
[docs/migration/focus-2026-10.md](docs/migration/focus-2026-10.md) (focus changes,
successor tools and restore lines).
**Breaking changes at a glance:** Personal Cloud, the ctxpkg.com registry and the hosted
per-customer team servers close on the 3.12.0 release day (writes stop, the services answer
`410`) and their stored data is deleted 30 days after release, without migration; the
engine's cloud client, the `login`, `register`, `account`, `sync`, `cloud`, `team` and
`enterprise` commands, remote `pack install|update|publish` and `addon add ns/name` are
removed; hosted Wrapped publication, the leaderboard, the README badge and the billing CLI
are gone; the capability registry is schema 3 (price classes `hive` and `retired`); the
built-in personal-data detectors are email, phone and payment cards. From the focus work:
36 MCP tools are removed (34 retired plus `ctx_intent` and `ctx_task`; a call names the
successor); the Autonomy Drivers, Workflow Evidence Ledger, Intent Route,
invocation-context-binding, invocation-evidence-manifest and tokenizer-translation-driver
contracts are withdrawn; `ctx_work_graph action="execute"` and `lean-ctx pair` are removed
(the host starts agents with `action="start"`); `cognitive_mode` and the read-path autonomy
drivers are retired; role budgets, SLOs and anomaly detection are gone; domain and
compliance packs moved to Pro/Enterprise; `.lean-ctx.toml` write and read-only keys apply
only in a trusted workspace; decision receipts are `schema_version: 2` with keyed object
digests, so SDKs before 3.12.0 reject them (engine and SDK ship together); the engine's
built-in dashboard UI is replaced by the Cockpit. The SDK Agent Tools v1 contract is
unchanged. Telemetry is unchanged. `lean-ctx-protocol` renames `hive::project` to
`hive::vault` (`VaultV1`, `VaultRefV1`, `vault_id`); the published crates need Rust 1.87.
### Added
- **ctx_execute code needs your approval (GHSA-rxv5-4c3x-g4q6).** Code in any language other
than shell runs only after approval in the same dialog as ctx_shell — once, for this
session, always (global execute_allowed_languages) or deny, per language; a batch asks once
per language and runs nothing if one is denied. Without the dialog (client without
elicitation, shell_approval=off) the code is refused — list the language in
execute_allowed_languages to run it without asking.
- **Knowledge from the repository itself.** `lean-ctx import docs […]` turns
`AGENTS.md`, `CLAUDE.md`, `.cursorrules`, `.cursor/rules` and `docs/` into project facts:
each bullet or paragraph is one fact, categorised by its nearest heading (conventions,
procedures, decisions, architecture, gotchas, dead ends, experiences) and anchored to its file
and section. `lean-ctx import git [--limit N]` mines the local history: reverts become dead
ends, fixes experiences, and commits that decide, switch or replace something decisions, each
anchored to its commit; trailers and lines naming a person by email are dropped first, and no
diff or author is read. Every file and every fact passes the same admission as any other import
(path rules, project policy, secret and PII detection): a masked value stays masked, a withheld
one yields nothing and is counted. A re-import updates the fact at the same anchor instead of
adding a second one. Each fact under a heading carries a code anchor on its section, so an edit
there marks it *to verify*; a fact whose section (or file) is gone on re-import is marked *to
verify* (`source_removed`) and becomes current again when the section returns.
`lean-ctx knowledge export-agents-md [--write]` writes these categories as a marked section of
`AGENTS.md` (only public facts; the rest of the file is kept), and importing that section yields
the same facts again.
- **The whole Cockpit is free and ships with official installs.** Improvements, Spend
history, Ledger filters and export, Report, Delivery insights, Memory Care, Package
Studio, recipes and comparison always render, without an account, plan check, teaser or
trial banner. The Cockpit computes the analyses itself against two lease-free engine
routes (`POST /api/dashboard-analysis/inputs` and `/apply`). Every figure carries a
trust label (measured, estimated, evidenced, derived) and *Numbers explained* gives each
one's formula and price source; *Decisions* lists what the gateway decided on this device,
without content. Former `#account` and `#cloud` links land on Settings, and Security
shows the active filter packs. `install.sh` (`LEAN_CTX_NO_COCKPIT` skips it), `install.ps1`
(`-NoCockpit`), npm and Homebrew install the signed Cockpit bundle beside the Engine;
`lean-ctx cockpit install --from [--allow-downgrade]` installs one
offline. The Cockpit is a free binary under the LeanCTX Cockpit EULA; its source stays
private. Source builds show a page pointing to the official installs.
- **`GET /api/gateway/detectors`** names what content is screened for:
`{"pii": {"sources": [...], "policy_filters": [...]}, "filter_packs": [...]}` —
`pii.sources` in every source (the checksum-validated payment cards),
`pii.policy_filters` when a policy pack's `[filters] pii` is on (cards, email,
phone), and the labels of the installed filter-pack rules. The control
document carries the same object as `detectors`.
- **Knowledge validity classes (S05).** A fact is a `convention` (category convention or
decision, or `validity:"convention"`) or `content` (bound to its sources). Checkouts linked
to the same team project with `lean-ctx project link` share conventions whatever their
branch; a code-bound fact is served there only while its files are identical, otherwise
it is withheld as stale. Recall shows the class, `/api/knowledge` adds `validity_class`.
- **Launcher-bound Workspace authority (#2120).** A launcher starts the MCP server with
`LEAN_CTX_WORKSPACE_FILE=`; the file's primary root and up to 64 additional roots
(read-write or read-only; `/`, the home directory, its ancestors and agent config
directories are refused) are then the only roots that server's tools, MCP resources, search indexes and
repo roots reach (lean-ctx's own data directories included). Client roots,
`extra_roots`/`allow_paths`, the home jail scope and `ctx_multi_repo` roots grant nothing
while bound; response and file caches are not served across revisions. Each tool call
takes one snapshot, so a root detached with `lean-ctx workspace remove` is gone on the
next call without a restart; concurrent servers with the same primary root keep their
own roots. The file is checked fail-closed (owner, mode 0600, no symlink, no
foreign-writable directory, outside its own roots and lean-ctx's directories; Unix hosts
only for now) and changed only by compare-and-swap on its revision (`lean-ctx workspace
create|add|remove|show|diagnose`). Without the variable nothing changes. Guide:
`docs/reference/13-security-and-governance.md` §1.6.
- **Choose and preview what a context package holds.** `pack create` takes `--layers`,
`--category`, `--key` and `--fact `; `--preview` lists exactly what would be
packed (fact titles, status, sources, validity, counts, what is left out) and writes
nothing. `ctx_pack action=create` takes the same as `layers`, `categories`, `keys`,
`facts` and `preview`. Knowledge facts carry a `status`: `verified` when a provider (or a
derivation from sourced facts) backs them, else `assumption`; it is recorded in the
package. `--redistributable` (`redistributable: true` over MCP) grants recipients the
right to pass the package on. Without a selection, `pack create` builds the same layers as
before; at `--level 2` the context graph now follows the chosen layers too.
- **`lean-ctx project use `.** When several workspace roots
were candidates, `ctx_session status` and the Cockpit name the chosen project and how to
switch (`lean-ctx project use `); the first root is still chosen by default.
- **Provider credentials and checks.** `lean-ctx provider check --json --stdin`
tests candidate credentials read from stdin; `provider credentials set|list|remove` keeps
them in the engine's store (values never printed); `provider init --project-root `.
PostgreSQL connection strings are passed to `psql` through its environment, never argv.
- **Idempotent retries.** `ctx_agent action=post` and `ctx_handoff action=create` accept a
`request_id`: a retry returns the first result, a changed request with the same id is
refused. A team knowledge write with `--if-revision` whose reply was lost is sent once
more and reported as already stored.
- **Reproducible context packages.** Package timestamps come from `SOURCE_DATE_EPOCH` or the
newest source, so the same input builds the same bytes.
- **Dashboard stages Connect → Select → Control → Deliver → Prove.** The cockpit is organised along the path context takes. New views: *Sources & Hosts* (each connector's declared capabilities, each configured host's coverage), *Policy & Decisions* (gateway mode, organization and project policy layers, the reasons content was withheld or changed; rule patterns are never shown), *Delivery & Egress* (how far each delivery is known to have gone; an observed model egress kept apart from context handed to a host) and *Audit & Coverage* (audit chain, observations, coverage gaps). Earlier links such as `#context/live` still open the same view.
- **Connector contract for GitLab, GitHub and Jira.** Every connector declares what it supports (search, list, get, delta, per-item access and revision re-check, delete events); a stored item is reused for another reader only after a re-check with that reader's own credential. GitHub answers are no longer cached; an expired cache entry is never served.
- **One context decision vocabulary.** `lean-ctx inspect --json` and the dashboard show each receipt's lineage: the request route, the decision per object (allow, deny, redact, transform, unavailable) and how far the delivery is known to have gone. A receipt that records no per-source access check says so (`source_rights: not_recorded`) instead of implying permission.
- **Pi and Oh My Pi are recognised as AI clients.** Pi has no built-in MCP client and connects through extensions that announce themselves as `pi-lean-ctx`, `pi-mcp-adapter` or `pi-mcp-probe`; Oh My Pi announces itself as `omp-coding-agent`. Both were counted as an unrecognised client (`other`) in the anonymous usage statistics and are now reported as `pi` and `oh_my_pi`. Only the existing client-family field gains two values; no client name is sent and nothing new is collected. Capabilities offered over MCP stay as before.
- **Semantic search without ONNX Runtime.** A new built-in embedding model, `potion-code` (potion-code-16M, a static model2vec table, MIT), runs in pure Rust: no `libonnxruntime`, no attention pass. When no model is configured, lean-ctx now uses MiniLM where ONNX Runtime is installed and `potion-code` everywhere else — installations without ONNX Runtime previously had no semantic search at all. Measured on 8,086 documented functions of the lean-ctx source (docstring → code, `core/embeddings/eval.rs`): MiniLM reaches MRR 0.348 / recall@10 0.570 and indexed them in 557 s on CPU; `potion-code` reaches MRR 0.247 / recall@10 0.431 and indexed them in 0.07 s, answering a query in 9 µs instead of 26 ms. The model is pinned to an exact revision and the SHA-256 of both files, and its safetensors weights are bounds-checked before any read. Choose explicitly with `[embedding] model = "potion-code"` or `"minilm"`.
- **lean-ctx results drawn like Claude Code's own.** The Claude Code plugin draws `ctx_patch` evidence through Claude Code's diff renderer (gutters, colored `+`/`-`, syntax highlighting), `ctx_read` code (`lines`, `anchored`, `full`, `raw`, several files) syntax-highlighted and numbered from the real line with anchor hashes hidden on screen, and `ctx_search` hits with a dim `path:line`, the highlighted line and the enclosing symbol. Only the display changes: Claude receives every result unchanged, and output the plugin does not recognise is drawn as before. Turn it off with the plugin's **Color lean-ctx output** setting. Inspired by community member Kirill Naumenko's [leanctx-colored](https://github.com/ReDev1L/leanctx-colored).
- **`ctx_read` reads the file that was clearly meant.** When the requested path does not exist but exactly one file matches it unambiguously — the same name in another case, or the same relative path under one other directory (`src/x.rs` for `rust/src/x.rs`) — `ctx_read` reads that file and says so in a closing `[lean-ctx: …]` line, after the same path-jail check as any read. Typos and other extensions remain suggestions only, and byte-exact reads (`raw`) never substitute. "File not found" was the most frequent `ctx_read` failure in 3.11.4.
- **Fewer shell blocks.** The default shell allowlist admits the read-only byte inspectors `od`, `hexdump`, `strings` and `cmp`. A nested `bash -c`/`sh -c` is still not run, but the message now says to pass the inner command directly — it already runs in a shell — instead of suggesting `lean-ctx allow bash`, which would admit every script. Blocked inline code (`python3 -c`, heredoc stdin, `node -e`, `perl -0pi -e` — together ~400 of ~500 measured shell blocks) now comes with the allowed path in one step: the exact script file to write (with the interpreter's extension) and the command to run it, or the Edit tool / `ctx_patch` for in-place text changes. The restriction itself is unchanged.
- **More argument spellings.** `ctx_compose` accepts `query`, `question`, `prompt` or `goal` for `task`; a `ctx_search` `queries[]` entry accepts `regex`/`query` for `pattern` and `glob` for `include`.
- **A long `lean-ctx call` reports where it is and stops instead of hanging** (#2063). Every 30 seconds it names the phase it is in on stderr (for example `dense: embedding engine load`), and after 300 seconds it stops with exit code 124, like `timeout`. `LEAN_CTX_CALL_TIMEOUT_SECS` sets the limit (`0` = none). `LEAN_CTX_PHASE_TIMING=1` prints the duration of every phase of semantic search and `ctx_compose`, so a slow call can be attributed to the index, the embedding engine, ranking or graph enrichment.
- **The Claude Code cockpit sidebar can be turned off** (#2057). `/cockpit off` closes the sidebar and keeps it closed in new sessions; `/cockpit on` brings it back, and `/cockpit` still opens it once. The choice is stored as the plugin's **Open the LeanCTX cockpit sidebar** option, also in `/config`. With the sidebar off, the five-minute receipt re-verification that only the sidebar shows stops too; the pulse line, spinner and turn cards stay.
- **The cockpit's pulse line and turn cards can be turned off too** (#2057). `/cockpit pulse off` hides the line above the prompt that follows lean-ctx calls while Claude works; `/cockpit cards off` hides the card shown when a turn ends or a milestone is reached, the milestone notification, and the gateway summary added to Claude Code's "done in" line. Both hold for new sessions, `on` brings them back, and both are options in `/config` (**Show the LeanCTX pulse line**, **Show LeanCTX turn and milestone cards**). The sidebar still lists every turn and milestone, and the spinner stays.
- **Fewer "Prompt from the lean-ctx plugin" wakes, and a switch to turn them off.** Background jobs that finished one after another while Claude was idle each started their own wake, a row in the transcript and a turn each. A job that finishes while an earlier wake still waits for its turn is now held like one that finishes mid-turn: if Claude reads it in that turn, no wake follows; otherwise it wakes once afterwards. A wake that never starts its turn holds nothing back for longer than a minute. The plugin option **Wake Claude when a lean-ctx background job finishes** (`wake_on_job_finish`) turns watching off, and the live skill then tells Claude to check jobs itself. Claude Code keeps plugin prompts in the transcript; it offers no hidden variant.
- **The proxy's context snapshot says how long it has measured** (#703). The cumulative section of `proxy-introspect.json` gains `measurement_started_at_epoch_seconds` and `measurement_elapsed_seconds` (monotonic, from the first request this proxy process saw), so the vision-encoding go/no-go can tell a normal usage day from a short sample. The file stays local and holds no prompt content; vision encoding stays off.
- **`ctx_handoff action=export ledger=`** exports a stored ledger (e.g. a merged
one) as a signed transfer bundle; with `lean-ctx team artifact publish` and `import`
this is the team path for merged ledgers — no extra store.
- **`ctx_handoff action=merge`: one ledger from several agents.** Parallel agents of one
project hand their ledgers to `merge` (2–8); the result is a new ledger another agent
pulls. Every input is re-authorized first (a withheld input refuses the merge), the
result is a byte-for-byte subset of the inputs (duplicates collapse, conflicting fact
values are all kept and reported, nothing is ranked or rewritten), each part keeps the
binding it had, every input source is re-read for the result's lineage, and the same
set of ledgers always merges to the same bytes and file. The new optional ledger field
`merged_from` lists the inputs' content digests. Replaces the never-wired
`result_fusion`/`capsule_wire` modules.
- **Engine:** `lean-ctx engine context-presented-use` — the holder of a presenter
capability asks whether text delivered under it is still usable (`check`), keeps a
recovery copy (`retain`) and gets a kept copy back (`expand`). Every answer re-checks
the capability and the current source rights; the capability enters through
`--presenter-capability-file` only. Contract: `docs/contracts/engine-context-sources-v2.md`.
- **Enterprise suite:** `POST /v1/engine/presented-use`, behind the API key, its tenant
and its current rights to exactly the sources the text derives from. Presenter
operations have their own audit labels (`materialize_v2`, `presented_use`,
`presenter_revoke`); a revocation now leaves an audit record.
- **SDK:** use and revoke in Python, Go, Rust, JVM, .NET and TypeScript; the TypeScript
`EnterpriseEngineClient` gains `contextMaterializeSourcesV2`. V1 methods and routes
are unchanged.
### Changed
- **lean-ctx-protocol: vaults (breaking).** `hive::project` is `hive::vault`; `ProjectV1`,
`ProjectResolveRequestV1`, `MetricsProjectV1` and `RepoRefV1` are `VaultV1`,
`VaultResolveRequestV1`, `MetricsVaultV1` and `VaultRefV1`; `project_id` is `vault_id`,
`repo` is `vault` and opt-in `repos` is `vaults` on the wire; schemas
`leanctx.hive.vault/v1` and `vault-resolve-request/v1`; bus channels
`org:/vault:/`. `invisible()` covers the soft hyphen, the Mongolian
vowel separator, the combining grapheme joiner, the Hangul fillers, the Khmer inherent
vowels, U+2060–206F, the line and paragraph separators, interlinear annotations and the
remaining format controls; `list` value items are text. The identity domain bytes, the
vault id value and the sealed AADs are unchanged.
- **Rust 1.87.** `lean-ctx-protocol`, `lean-ctx-ocla` and `lean-ctx-embed` declare
`rust-version = "1.87"` (was 1.85), for ctutils 0.4.4 (see Security).
- **You choose which AI tools lean-ctx configures, and updates stay inside that choice.**
`lean-ctx setup` and the first `lean-ctx onboard` on a terminal (including `install.sh`)
ask which of the detected tools to connect and remember the answer as `setup.agents`.
`--agents claude,cursor` (or `none`; install.sh: `LEAN_CTX_AGENTS`) sets it without a
prompt and rejects unknown names. `lean-ctx update` now refreshes only the chosen tools —
or, on installs without a recorded choice, only tools that are already connected — and
never configures a newly installed tool; it lists those it left untouched.
`lean-ctx init --agent ` adds a tool to a recorded choice. New `--dry-run` for
`setup`, `onboard` and `update` shows which files and tools a run would touch and writes
nothing. Without a terminal and without a choice (npm install, CI), `onboard` configures
no new tool and points to `lean-ctx setup`; `LEAN_CTX_AGENTS=all` or `onboard --yes`
restores connecting every detected tool.
- **The local audit trail is sealed into segments.** After the first full verification on
3.12.0 the trail rotates at 64 MB or at day change into signed, immutable segments; the
existing trail becomes segment 0 and nothing is deleted. Readers no longer hold the trail
lock through a pass, so a large trail no longer withholds agent reads while the Cockpit is
open. Downgrading to 3.11.x after a rotation is not supported for audit verification (an
older engine reports the chain as invalid).
- **The gateway evidence store is bounded.** Receipts are stored packed, an existing packed
store from earlier development builds is read as is, and a background pass keeps the store
under its cap by removing the oldest unprotected evidence (the last 24 hours, the latest
receipts and open tasks are kept). `lean-ctx doctor` shows the store's size, cap and last
maintenance; `lean-ctx inspect --maintain` runs a pass now.
- **Prompt-injection detection is precise (detector set 2.1.0).** Patterns match instructions
rather than words in code or logs, and a flagged object is recorded once per process, so
security counts, receipts and Hive metrics no longer multiply one finding.
- **Intelligence runtime packages need Engine 3.12.0.** New runtime packages no longer declare
the retired hosted index; a 3.11.x Engine keeps its installed runtime but does not take new
packages. Engine 3.12.0 also accepts an already installed runtime from the 3.11 line.
- **Capability registry schema 3.** New price classes `hive` (with `hive_plan` =
`pro`, `team` or `enterprise`) and `retired`, and the delivery `hive_service`; the
classes `pro_paid`, `cloud_paid`, `team_paid` and `enterprise_paid` are refused in a
schema-3 record. Free and local: `pro.dashboard.knowledge_workflows`,
`pro.runtime.adaptive_context`, `memory_curation`, `context_policy`. Hive Pro:
`pro.runtime.semantic_detectors`, `code_security`, `personal_protection`. Hive Team:
team coordination, artifacts, `private_registry`, `managed_connectors`. Hive Enterprise:
`enterprise.*`, `team.sso_oidc`, `team.audit_retention`. Retired: `pro.cloud_sync`,
`pro.hosted_index`, `team.revenue_share`. Ids and aliases are unchanged.
- **Local features never depend on a plan.** Contract
[docs/contracts/local-free-invariant-v2.md](docs/contracts/local-free-invariant-v2.md):
local decisions do not change under `LEAN_CTX_LICENSE`, `LEAN_CTX_PLAN`,
`LEAN_CTX_ACCOUNT` or a forged entitlement cache, every free capability is accountless,
and plan checks may only live in `core/hive` (`scripts/check-local-free.py`, wired into
preflight and CI).
- **Built-in personal-data detectors: email, phone and payment cards.** Swiss AHV, IBAN
and US SSN with their validators leave the Engine (built-in detector set 2.1.0) and are
delivered as Hive filter packs; IBANs no longer raise a text to Confidential. The
Cockpit's Security views name the built-in classes and the installed filter packs.
- **Telemetry is unchanged.** Its transport and send loop moved out of the removed cloud
code with the same endpoints, cadence, consent and opt-out; the version is still
recorded on the first and every hundredth call.
- **The optional runtime is licensed through Hive or a commercial licence.** Its own
activation, provisioning, renewal and sync services are gone; the runtime disclosure
names Hive or a commercial licence.
- **Session continuity is per agent.** The wake-up briefing, session search results and
every other session read or write, including consolidation, use only the agent's own
session or an explicit handoff, never the project's latest one. Project knowledge stays shared.
Resume your own session after a restart with `ctx_session` `{"action":"load","session_id":""}`.
- **There is only the Cockpit.** `lean-ctx cockpit [--no-open] [--port N]` (alias
`lean-ctx dashboard`, port 3333) starts or opens the local server that hosts the
Cockpit, a signed runtime package. The server stays the single entry point: after its
token check it forwards the Cockpit's pages and `/api/gateway/*` to the Cockpit and
answers every other `/api/*` route itself. The engine's built-in web UI is removed;
without the Cockpit, `/` says how to install it. `lean-ctx gain --web` opens the
Savings view, `gain --live` the Calls (Ledger) view of recorded calls (the terminal
live loop is gone; there is no separate Live view), and `lean-ctx gain --terminal`
is the terminal summary. Reads may name their project with
`X-LeanCTX-Project` (workspace pool only, per request; anything else is 403), and slow
reads (`/api/roi`, `/api/value`, `/api/health`, …) are served from labelled display
snapshots (`X-LeanCTX-Observed-At`, `X-LeanCTX-Snapshot`, `X-LeanCTX-Refreshing`).
- **Every dashboard command opens the Cockpit.** `lean-ctx cockpit` is the command and
`lean-ctx dashboard` an equal alias. On a terminal it reuses the server already running
for this data dir or starts one in the background, waits until it answers (bounded),
lets it start the Cockpit, opens the browser at the view and returns the prompt
(`Opened the Cockpit → #route`; the token goes only to the browser and is never
printed). `lean-ctx cockpit --foreground` keeps the server in the terminal (the mode
without a terminal, e.g. Docker), and `lean-ctx cockpit stop` stops the background server
by its recorded PID. On a terminal, `lean-ctx gain` and its views (`--graph`, `--daily`,
`--by-tool`, `--score`, `--tasks`, `--deep`, `--pipeline` → `#savings`; `--cost`,
`--agents` → `#spend`; `--heatmap` → `#context?detail=heatmap`), `gain --web`
(`#savings`), `gain --live` and `watch` (`#calls`), `wrapped` and `cockpit --export`
(`#report`) open the Cockpit. Without a terminal, in CI, with `LEAN_CTX_NO_COCKPIT`, with
`--terminal` or a machine format (`--json`, `--md`, `--raw`, `--export`,
`--format json|markdown`, `--svg`, `--share`, `--copy`, `--reset`) the text output is
unchanged, so agent shells and scripts see what they saw before; `gain --web|--live`
there print the view instead of starting a server. Without an installed Cockpit the
text report is printed with one line: `Cockpit not installed — lean-ctx cockpit
install`. `cockpit --export --output=FILE` keeps writing the offline report, and
`gain --wrapped`, `--svg` and `--share` keep exporting. The proxy's `GET /dashboard`
page names `lean-ctx cockpit` and links the running Cockpit (`/api/stats` stays).
- **The Cockpit starts reliably.** The server records itself (PID, process identity,
port, version; no secret) in `dashboard.launch.json` in the state dir. A start reuses
this data dir's healthy server, restarts its own background server when it hangs,
rejects the saved token or runs an older engine version, and moves past a port another
program or another LeanCTX data dir holds (also IPv6-only listeners on `localhost`) to
the next free one — an explicit `--port`/`LEAN_CTX_PORT` is never swapped but named
with the fix. The server ends cleanly on `SIGTERM` and removes its record.
- **Reports point at the Cockpit.** Setup, onboarding, `help`, the cheat sheet name
`lean-ctx cockpit` (Savings · Spend · Proof). On a terminal, the human output of
`spend`, `savings`, `roi`, `value`, `output-savings`, `token-report`, `cep`, `heatmap`
and `doctor` ends with one dim stderr line naming the matching Cockpit view; never with
`--json`, `--md`, `--raw`, `--export` or `--format json|markdown`, never when stdout is
redirected, in CI or with `LEAN_CTX_NO_COCKPIT` set. The reports themselves are
unchanged.
- **Decision receipts v2: keyed object digests.** New receipts carry `schema_version: 2`;
each `decisions[].object` is an HMAC-SHA256 under the installation's receipt key
(`/gateway/receipt.key`), named in the new `object_digest` field (algorithm and key
id), so a receipt no longer confirms a guessed plaintext. Version 1 receipts still parse
and verify. Without a usable receipt key no receipt is issued: governed and sovereign
mode refuse the delivery, developer mode sends without a receipt. All six SDKs parse v1
and v2 and offer key-holder verification (`receipt_key_id`, `keyed_object_digest`).
Contract: `docs/contracts/context-gateway-v2.md`.
- **A live provider list is admitted item by item.** Under `classification = "block"` one
confidential issue no longer withholds the whole `ctx_provider` answer: that item is
left out (title included), an injection-like title stays fenced as data, the rest is
delivered, and knowledge is derived from the delivered items only.
- **Stored context gets a full semantic check later.** When the bounded check of stored
context (knowledge, archive, handoff, recovery) stays partial, the text is queued and
checked in full while the agent is idle; the next use applies the result (redact,
withhold or `not_inspected`). Live reads keep their 2 s budget. A model set that does
not declare its languages and document types claims no coverage (`not_inspected`).
- **`doctor` and `status` report what is really active.** Shadow mode reads "active" only
for hosts with installed hooks; `gain` and `doctor` share one proxy check (configured
and answering as lean-ctx); `doctor` prints no colour without a TTY, with `NO_COLOR` or
`TERM=dumb`, and exits non-zero only for a failed scored check (a fresh install exits 0).
- **`install.sh` fails closed.** A missing `SHA256SUMS` or a missing entry for the
download aborts the install. The script says it does not verify the cosign signature
(`lean-ctx update` does) and what onboarding will change (`LEAN_CTX_NO_ONBOARD=1` skips it).
- **Received packages are passed on only under their author's grant.** `pack export`
(signed or not), `pack send`, `pack publish` and `ctx_pack action=export` refuse a package
this machine received (import, registry install, receive) unless its manifest carries
`redistributable: true` under the full manifest signature. Packages built here with
`pack create` export as before; a package stored before 3.12.0 counts as received until it
is re-created. Facts merged from a package without that grant stay out of `pack create`.
- **Auto-loaded packages belong to their project.** A package enabled for auto-load in one
project no longer loads in any other project (entries from earlier versions must be
re-enabled per project); package facts reach the model fenced as untrusted data and are
never written into agent rule files.
- **Work Graph: the host starts agents, LeanCTX controls them.** New `ctx_work_graph
action="start"` binds a host-launched child to its node: fenced claim, node and path
leases, verified hand-over of the signed context capsule, and the child's narrow
delivery profile as launch environment when the host is configured as delivery issuer.
A receipt, `cancel` or lease expiry stops the node and revokes the child's delivery
immediately. `receipt` and `cancel` also accept the owner of the delegating parent node
([docs/architecture/work-graph-host-start.md](docs/architecture/work-graph-host-start.md)).
- **Context packages: the signature covers the whole manifest.** Packages are additionally
signed over the full manifest (`signature.manifest_value`), so kind, visibility,
dependencies, scope, provenance or licence cannot be changed after signing. Older packages
verify as "identity only" and say so. The hosted registry and `pack publish` recompute
integrity from the bytes instead of trusting the manifest.
- **Cockpit: which project and which knowledge.** The dashboard reports
the project it is bound to and where that binding came from (`GET /api/scope`); without a
binding it shows no project data instead of the most recently active project. Knowledge
shows its visibility and state.
- **Semantic model sets declare what they cover.** A model set can declare the languages and
document types (prose, code, data) it was qualified for; text outside that coverage is
reported as not inspected instead of covered, and a host that does not apply declarations is
refused by the worker. The built-in floor stays authoritative in every case.
- **Leases are bound to their project.** Path and symbol leases of `ctx_agent` and the Work
Graph name the project, so the same relative path in two projects no longer conflicts, and
a Work Graph claim and an agent lease on the same file now exclude each other. Lease paths
must lie inside the project. `if_revision` on mutating `ctx_work_graph` actions refuses a
write when the graph changed since `observe` (`write_revision`).
- **Context packages:** the spec's map form for `dependencies` and `optional_dependencies` is
read; optional dependencies are attempted and their failures reported instead of skipped;
integrity and signature hex must be lowercase; the seven conformance vectors run in CI.
- **`lean-ctx migrate legacy-context`** lists data from earlier releases that is no longer
served because it carries no project (old `ctx_memory` facts, global archived facts,
unbound archives, project-less handoff ledgers, quarantined shared knowledge) and adopts
chosen items into one project you name, through normal admission, with a journal
(`--dry-run` first). Archives and facts whose recorded session proves the project are
adopted automatically.
- **The background cognition loop is off by default** (`[autonomy]
cognition_loop_enabled`): it rewrote stored knowledge without a recorded decision.
- **The `[cognitive: high echo ratio]` suffix is removed.**
- **`structure_first`, `journal_enabled` and `auto_capture` default to `false`
everywhere.** Their docs said opt-in and every user with a `config.toml` already got
`false`; only installs without a config file got `true`. Set them explicitly to keep
the old behaviour.
- **OCaml, Haskell and Julia tree-sitter grammars are no longer in the default build**
(−14.6 MB, −13 % binary). `.ml/.mli/.hs/.jl` signatures fall back to the regex
extractors; build with `--features grammars-long-tail` to keep the parsers.
- **The Engine identifies itself as the Context Gateway for AI Systems.** README, agent instructions, CLI help, MCP server metadata and package descriptions use Select · Control · Learn · Prove, with local knowledge and observable-evidence limits stated. Security and support contacts use `hello@thinkery.ch`.
- **Usage statistics arrive within half an hour.** While LeanCTX is in use, the anonymous daily totals are now re-sent every 30 minutes (at most 48 times per UTC day) instead of at doubling intervals that stretched to two hours after a handful of sends, which left a day's evening activity unreported until the next morning. Only the timing changes: the same cumulative totals are sent, and nothing new is collected. `lean-ctx telemetry show` states the limit.
- **`ctx_read` with `engine_interface="v1"` says how to recover.** The engine interface reads one file per call. Its refusal of `paths` now tells the agent to pass `path` once per file or to leave out `engine_interface` for a batch read, and its refusal of other modes says to leave it out; one OpenCode installation had repeated the same refused call 802 times.
- **Native tool calls are no longer refused by default.** Codex, Cursor, Windsurf, OpenCode, Gemini and CodeBuddy defaulted to Replace mode, whose hooks refused native Bash, Grep and Glob calls. Each refusal cost the agent a whole extra request (in 30 days of Codex sessions: 249 refusals, median 67k prompt tokens re-read per refusal) — mostly for commands like `pwd`, `mkdir -p`, `wc -l` or `shasum` whose native output costs next to nothing — and users found it disruptive. Every hook-capable agent now defaults to Hybrid: lean-ctx steers agents to `ctx_*` tools and rewrites known shell reads and searches, and other native calls go through. Deny hooks check the setting on every call, so hooks installed by earlier versions stand down as soon as the binary updates. Claude Code keeps native Grep and Glob out of its tool list in the default mode: Claude Code drops a tool named in `permissions.deny`, so this costs no error and no retry (0 refusals in 380 measured sessions), and native Glob returned ~12× the tokens of `ctx_glob` for the same patterns. `hook_mode = "hybrid"` gives Claude both tools back; CodeBuddy, which shares that contract, does the same and gets native Bash back (it was hidden too). OpenCode no longer sets native read, grep, glob and bash to `ask`, which prompted on every call and refused them in headless runs; the entries an earlier version wrote are removed on the next MCP server start, also after an update through a package manager. Replace stays available on request: `lean-ctx config set hook_mode replace` or `lean-ctx harden --hard` (which now records the choice), `lean-ctx harden --undo` to go back. `hook_mode` is now part of the config schema (`auto`, `hybrid`, `replace`, `mcp`).
- **`.lean-ctx.toml` follows one rule per key class.** Project keys (compression,
read/search, memory, archive, conversation, response shaping, code health,
timeouts — about 60) win wherever the project file sets them, also back to the default
(before, a value equal to the default was ignored, a key mentioned only in a comment
could count as set, and an omitted `silent_preload` reset the global value).
User- and machine-level keys (theme, shell hooks, memory profile, proxy timeout) are no
longer taken from a repository. **Security:** `write_allow_paths`, `read_only_roots`
and `read_redirect = "off"` now apply only in a trusted workspace. A project file
without profiles is used as written when a global profile is selected (it used to be
skipped as a parse error).
- **Handoff ledgers are stored only if they can be read back now** — the whole source
lineage re-read under one budget, as a reader does.
- **`.lean-ctx.toml` keys without effect are named.** A project key the merge does not
apply (global-only, one-way, or equal to the default while the global differs) is
logged as "not applied" instead of being ignored silently.
- **Settings audit: every setting now does what it says, or is gone.**
- Fixed: an `[autonomy]` section without `cognition_loop_enabled` switched the
background knowledge loop back on; it now stays off unless set. `[conversation]`
bounds (`preserve_last_n_turns`, `compression_threshold_tokens`,
`min_score_to_preserve`, `drop_score_below`) were hard-coded and are now applied; the
stub for a dropped message no longer promises a recovery that never existed.
`[cache] l2_ttl_secs` is applied (it was fixed at one hour), and `[cache]` is the one
place for the delivery-cache bounds (`[ocla.delivery.cache]` moves there).
`[memory.gotcha] max_gotchas_per_project` is applied, as are a gotcha's own
`expires_at` and `decay_rate_override`.
- Retired (never applied): `session_token_limit`, `allow_auto_reroot`,
`shadow.auto_record`, `shadow.baseline_model`, `agents.identity_ttl_hours`,
`agents.max_concurrent_*`, `context.diet_*`, `cloud.last_contribute`,
`code_health.coupling`, `boundary_policy.audit_cross_access`,
`gateway_server.admin_bind_host`/`usage_retention_days`, `[solution.commercial]`,
the `response_shaping` sub-sections, `proxy.reasoning_budget`,
`proxy.pipeline.enable_effort`, `conversation.summarize_score_range`/
`ccr_store_dropped`, `cache.l1_max_entries`/`l3_gc_threshold`, and four
`memory.gotcha` keys. Profiles lose `translation`, `layout`, `budget`, `constraints`,
`capabilities`, `pipeline`, `read.max_tokens_per_file`, `read.prefer_cache`,
`compression.output_density`/`terse_mode`/`adaptive`/`entropy_threshold`,
`routing.max_model_tier` and `autonomy.auto_response`/`response_min_tokens`; the
built-in profiles no longer suggest budgets they never enforced.
- Migration: older files keep loading. A writable global `config.toml` has retired
keys removed automatically (the comments of other keys are kept); `lean-ctx doctor` and
`lean-ctx config apply` name any that remain as "retired" instead of "unknown".
### Removed
- **Personal Cloud.** Cloud sync, knowledge and gotcha sync, the hosted personal index and
the cloud dashboard metrics close on the 3.12.0 release day: writes stop and the hosted
endpoints answer `410` with `{"error":{"code":"personal_cloud_ended"}}`. Stored Personal
Cloud content is deleted 30 days after release; there is no export. Local data is unaffected. The engine side goes: the cloud client and cloud sync,
`lean-ctx login`, `register`, `forgot-password`, `account`, `sync`, `contribute`, `cloud`
and `enterprise`, the knowledge vault and index bundles, and the `[cloud]` config
section (a retired key; the legacy `cloud.contribute_enabled` opt-in is still migrated
to `telemetry.enabled`).
- **Hosted index.** `pro.hosted_index` is retired; the hosted index stack (upload,
pairing, egress admission, the semantic search shortcut) is removed.
- **Hosted team servers.** They close on the 3.12.0 release day. Removed: the `team` CLI and its completions, the dashboard's
`/api/knowledge/{publish,team}`, the shared-artifact store and team artifact runtime
modules, `savings push` and `savings team` with the daemon's savings auto-push, and the
`team_url`, `team_token` and `team_auto_push` keys (now retired). Local savings,
`savings sign`, `verify-batch` and ROI stay.
- **ctxpkg.com connection.** ctxpkg.com closes on the 3.12.0 release day and its packages
are archived without migration. Removed: the hosted-registry client, the remote
dependency resolver, `pack update`, `pack publish`, remote `pack install ns/name`,
`addon add ns/name` and `ctxpkg.lock`. Packages and add-ons install from local files; a
scoped `ns/name` is refused with that hint. The `.ctxpkg` format, signing and
verification stay.
- **Pro gating and promotion.** The leaderboard route and proxy rank header, the README
badge command, Pro conversion nudges (`session dismiss-pro|show-pro`), the billing CLI,
the dashboard value-gate summary and `/api/billing-badge`, and hosted Wrapped
publication (`gain --publish|--leaderboard|--link|--rejoin|--unpublish`, the publish
prompt, startup auto-publish, the weekly nudge and the recovery-phrase identity it
used). `[gain]` is a retired config key. Local `gain --wrapped`, `--svg`, `--share`,
`--copy` and `--open` stay. In the Cockpit: the Account and Cloud pages, the checkout
flow, the team memory tab, team pills, the share sheet, `/api/gateway/entitlement`,
`/api/gateway/teasers` and `/api/gateway/pro/*` (now `/api/gateway/analysis/*`). In the
engine: the licensed `/api/runtime/pro.dashboard.knowledge_workflows` route, the
dashboard exchange, `core::billing` (plans, signed entitlements, metering, settlement
evidence) and the savings ledger's evidence projection, and the runtime's personal
licence activation, provisioning, renewal, project sync, context sharing and
`engine context-personal-sync`.
- `ctx_work_graph action="execute"` with its `connector`, `model` and `max_attempts`
parameters, and the agent connector layer behind it (Claude Code/Codex/Cursor CLI
launch, process supervision, cancellation signals, retry, usage parsed from CLI
output). Calling `execute` returns the host-start path.
- `lean-ctx pair`: remote pairing was never implemented; the command prints a pointer.
- **34 retired MCP tools are removed** (30 from this release plus the four #509
aliases `ctx_smart_read`, `ctx_multi_read`, `ctx_semantic_search`, `ctx_symbol`).
A call — directly or through `ctx_call` — fails with a message naming the
successor (`ctx_compose`, `ctx_graph`, `ctx_search`, `ctx_expand`, `ctx_read`) or
the way forward. The default profile advertised none of them; every tool with real
use had a direct successor. Ledger eviction under context pressure moved to
`ctx_control action="evict"`. List: `docs/migration/focus-2026-10.md` §3–4.
- **The read-path autonomy drivers are removed** (session-start project overview,
related-file hint, silent import preload, post-read prefetch, automatic cache dedup).
An A/B on the retrieval corpus (3 interleaved repetitions, warm index) returned
byte-identical responses and equal R@5/MRR without them, while the first call of a
session took 2–14 s longer. The overview carried the wake-up briefing but exceeded the
400-token injection cap on real projects, so the briefing never arrived: it is now
delivered on its own as `--- AUTO CONTEXT ---` on the first call, its project facts
fitted to the cap (most salient first). On 932 real knowledge stores every briefing
now arrives; before, the facts block alone exceeded the cap for 19 %. Retired keys:
`[autonomy] auto_preload`, `silent_preload`, `auto_related`, `auto_dedup`,
`dedup_threshold` (and their `LEAN_CTX_*` variables; profile `[autonomy]` keeps
`enabled` and `checkpoint_interval`). **Breaking:** the Autonomy Drivers contract
and `ctx_proof`'s `autonomy-drivers-v1` export are withdrawn with their producer.
- **The workflow evidence ledger is removed** (`workflows/evidence-ledger-v1.json`).
`ctx_proof`, `ctx_agent` snapshot and `ctx_handoff` exports indexed their files
there, but nothing read it; the contract still described the removed `ctx_workflow`.
A snapshot export no longer reports an error when only that index could not be
written. Receipts stay in the execution ledger, security events in the audit trail.
**Breaking:** the Workflow Evidence Ledger contract and
`leanctx.contract.workflow_evidence_ledger_v1.schema_version` are withdrawn.
- **`ctx_intent` and `ctx_task` are removed** (no call from any installation in the
30 days measured). Intent is inferred from the tool calls; `ctx_compose(task=…)`
selects context for a task and `ctx_knowledge action="remember"` stores a fact (the
JSON `knowledge_fact` intent did the same). Task assignment is host execution:
`ctx_work_graph` keeps the shared coordination state, A2A peers keep `/a2a`, and
`ctx_agent` still lists an agent's tasks. **Breaking:** the Intent Route contract
(v1 historical, v2 `ctx_intent format=json`) is withdrawn with its only surface;
`leanctx.contract.intent_route_v2.schema_version` is gone from the contract keys.
- **Grammar-addon remnants and two OCLA execution modules without callers**
(`reference_adapters`, `regression_gate`).
- **CLI commands `visualize`, `demo`, `calibrate`, `benchmark-run`** and the modules
only they used (`visualizer`, `calibrator`, `local_runner`): calling one prints where
the measurement lives now and exits with 2.
- **Domain and compliance packs left the Community engine.** `healthcare` and
`finance-eu` are LeanCTX Pro; `eu-ai-act-deployer`, `iso42001-aligned`,
`soc2-context` and the EU AI Act / ISO 42001 / SOC 2 mappings are LeanCTX Enterprise.
`lean-ctx compliance report` (signed CISO report), `policy coverage --framework` and
`audit evidence --framework` stay in the engine and take their framework assessment from
the licensed Enterprise runtime; without it they name the tier. New:
`lean-ctx compliance facts` prints exactly what the runtime assesses (policy facts, no
patterns, no content); `lean-ctx compliance verify` checks a report offline, no license.
**Breaking:** a project pack with `extends = "healthcare"` (or another former
built-in) no longer loads; the error names the tier. Switch `extends` to
`strict-redaction` and add your own patterns, or install the paid pack. Built-ins
are now `baseline`, `strict-redaction`, `open-source`; the Community PII filter
(IBAN, cards, e-mail, phone, SSN, AHV) is unchanged. Evidence bundles keep
`manifest.framework` (always `null`). Released versions up to 3.11.x keep their
Apache license.
- **Hebbian cache-eviction bonus, FEP prefetch and Boltzmann eviction are removed.** A
replay of 4,906 real reads showed the bonus lowered re-read cache hits (47.1 % → 51.5 %
without it, −11 % resent tokens); the prefetch hint only reached a debug log; Boltzmann
eviction had no caller. `ctx_read`/`ctx_search` outputs are otherwise unchanged.
- **OCLA modules without a production caller are removed:** `runtime`, `wire_middleware`,
`openapi` (never mounted; `/openapi` is served by `core::openapi`), `wire_stream`,
`ledger_export`, `policy_bundle`, `tracing` (its health component always reported zero
spans and is gone from `/ocla/v1/health`), the never-started `sidecar` and `grpc_bridge`
listeners, the scheduler cluster (`reference_scheduler`, `scheduler_service`,
`policy_constraints`, `catalogue`, `OclaRegistry::discover`), the experiment execution
helpers, and the RTK capability manifest whose adapter was already gone. Native
`engine_interface` plans keep byte-identical scheduler evidence, so stored plans
still validate. `[ocla.sidecar]` and `[ocla.grpc]` in a config are ignored.
**Breaking for library users:** the deprecated `lean_ctx::ocla` manifest module
(superseded by `lean_ctx_protocol::CapabilityManifestV1`) is removed.
- **Dead code without a production caller is removed:** five source files that were never
compiled, the old `wrap` module (superseded by `lean-ctx wrap`), unused copies of the read
reuse / search grouping / inference manifest / provider header logic, the proxy modules
`image_compression`, `latency_guard`, `usage_azure` and `sensitive_transport`, nine unused
`core` and `context_kernel` modules, and four unused functions in learning modules. The
proxy no longer copies every request's message list for the removed `ctx_live_zone` tool.
Tool descriptions and the full-tier read hint no longer name removed tools.
A second pass removed the blanket `allow(dead_code)` on the proxy and twelve modules, so
the compiler guards dead code again, and with it what that exposed: the edit-snapshot
and read-provenance stores (every redirected read re-read and kept the file for a guard
that was never wired), the never-used stream shaper, the web-app detection middleware
and tracker (their per-request result was never read), the agent-execution capability
adapter, `benchmark_spec`, `saliency` and two test-only kernel modules.
- **Never-wired surfaces are withdrawn.** The frozen protocol contracts
`invocation-context-binding-v1` and `invocation-evidence-manifest-v1` (types, schemas,
vectors) are withdrawn — nothing produced or consumed them — so `lean-ctx-protocol`
moves to 0.4.0. The stable contract
`tokenizer-translation-driver-v1` is withdrawn: its driver was never called by the
engine (no output ever used it). `lean-ctx introspect qubo` (QUBO selection spike) and
the deprecated `context_kernel::policy_engine` alias are removed; two internal modules
that were never wired (a signed invocation-admission verifier and a reader for a
never-written "v2" receipt layout) are removed — Engine receipts remain the canonical v1
artifacts. The daemon no longer sends the one-way handshake to an enterprise sidecar,
and the sidecar itself is removed: it synced policies only to count them and never
recorded metering. The gateway proof register's case 5 now cites only the production
enforcement tests (`policy::floor`, config merge).
- **Commercial leases stop carrying three unused features** (`graph_analysis`,
`multi_agent_orchestration`, `quality_experiments`): no runtime ever checked them.
Older leases that carry them still decode; `model_routing` stays (older runtimes
check it as the base-runtime right).
- **`cognitive_mode` and its science features are retired.** Measured on the retrieval
A/B corpus, `full` (the default of every 3.11 release) produced +74 % read output with
no retrieval gain (R@5 and MRR identical). Removed: Wasserstein chunk allocation, the
FSRS recency boost in knowledge recall, file-trajectory prediction and cache warming,
verbosity learning, anti-interruption events, intent-keyword enrichment in
`ctx_compose`, `auto` choosing the `cognitive` view, the cockpit science panel and
`lean-ctx cognitive`. `ctx_read mode="cognitive"` and `"mdl"` render the map view.
The key is retired: older configs load, the migration removes it.
- **Learned co-access ranking is retired** (`[graph] traversal_edges`): it wrote on every
read, changed no retrieval result in the A/B corpus, made ranking depend on history,
and as a cache bonus it lowered the hit rate (−4.4 points, −29 % tokens saved).
- **Learned compression-threshold shifts are retired.** Since #1910 the rendered read
ignored them, yet every entropy read still loaded the feedback and learner stores, the
cockpit showed per-extension "learned behavior" and `lean-ctx learning` exported it.
The bandit arm that feeds the adaptive planner's weights stays. Learning bundles move
to schema 2 (LITM calibration only); v1 bundles still import.
- **`/evidence_ledger.jsonl` is no longer written.** Nothing ever read it and its
savings column was always 0; the existing file can be deleted.
- **`ctx_compose` drops its "Related (associative)" section.** Measured over 882 replies
of the retrieval A/B corpus: it appeared in ~5 % of replies, ~110 tokens each, with
~10 % precision, and never surfaced a relevant file the ranked list had missed. The
spreading-activation module and `LEAN_CTX_COMPOSE_GRAPH_BUDGET_MS` go with it.
- **Retired enterprise leftovers:** the archived platform server, its deploy kit,
Dockerfile and installer (`leanctx-cli`), and the unused `engine-integration` copies in
`commercial-core`. One canonical JSON helper (`core::canonical`) replaces eight private
byte-identical copies.
- **Capability `pro.result_fusion` is retired** together with the two never-wired
`context_kernel` modules behind it (`capsule_wire`, `result_fusion`): no tool, agent
or runtime ever called them, and the catalog entry pointed at an unrelated file. It is
no longer granted by any plan; entitlements signed with it still verify.
- **Bare `lean-ctx prove` (simulated decision-loop self-test) is removed**; it runs in the
test suite instead. `lean-ctx prove speed`, `ctx_proof` and `lean-ctx audit evidence`
stay. `lean-ctx evidence-export` no longer writes `proof_result.json` or the
"Decision Loop Proof" and "Semantic Model: READY FOR TRAINING" lines: they reported a
simulation (and a fixed string) as evidence.
- **Role budgets, SLOs, anomaly detection and the degradation policy.** Role token/shell/cost limits (`[limits]` in role files), the session cost cap (`[cost] max_session_cost_usd`, `LEAN_CTX_COST_CAP_OVERRIDE`), budget warnings and nudges, `slos.toml` evaluation, the anomaly detector (`anomaly_detector.json`), and the profile `[degradation]` policy with its context-pressure read-mode downgrade are gone, along with `ctx_session action=budget` / `action=slo`, the dashboard `/api/slos` and `/api/anomaly` routes and their SLO/Anomalies views, the `BudgetWarning`, `BudgetExhausted`, `SloViolation` and `Anomaly` events, the `degradation-policy-v1` contract and proof artifact, and the Prometheus series `lean_ctx_session_cost_usd`, `lean_ctx_session_context_tokens`, `lean_ctx_shell_invocations_total`, `lean_ctx_slo_violations_total`, `lean_ctx_anomalies_total` (Datadog `leanctx.slo.violations`). Existing role, profile and config files that still contain these keys load unchanged (the keys are ignored), and older event journals with the retired event kinds stay readable. Per-agent context budgets (`agent_token_budget`) are unchanged.
### Deprecated
- **`quality-lab` and `eval`** still run and print a one-line notice on stderr.
- `[shadow] baseline_model` is deprecated and ignored; existing configuration
files still load. Reports keep the note that the baseline is simulated.
### Fixed
- **Claude Code requests through the proxy are no longer refused (HTTP 403).** Anthropic's
safeguard metadata carries boolean flags whose key names read like classification
markings, so the egress check flagged them as restricted content for a remote destination.
On the Anthropic route a known boolean field in the root `safeguards` array is protocol,
not a classification banner; project policy and every other detector still apply, and
every key a caller chose is still inspected in full.
- **A busy agent store no longer fails a tool call after 750 ms.** The file lock of the
agent registry, the task store, the work graph and agent leases is polled and not a fair
queue, so under load a call behind other writers could time out and report
`lock … timed out`. It now waits up to 5 s; nothing was lost before, the call failed. A
fair lock follows in a later release.
- **Claude Code: the mod no longer defers `ctx_patch`, `ctx_glob` and `ctx_tree`.** The
Claude Code mod kept only six lean-ctx tools in the prompt and deferred the rest behind
ToolSearch, overriding `alwaysLoad`, so models fell back to native Edit/Glob although the
rules route editing and file finding to lean-ctx. The default `front_loaded_tools` now
covers every core tool the rules route to, and a test keeps the two in step.
- **Two first `ctx_handoff create` calls with one `request_id` store one ledger.** Keyed
creates of one agent in one project are serialized under a bounded lock; the second
call is served the first call's ledger.
- **A refused source re-check is in the decision receipt.** When a search serves a
provider chunk admitted before and its source now refuses it (revoked, unavailable, …),
the call's receipt records a content-free denial with that source state
(`source.revoked`, …) instead of a debug log line only.
- **Concurrent writers no longer lose shared memory entries** (`ctx_memory`): one project's
store is now locked from load to save.
- **A server switching roots no longer takes over another agent's saved session**, and
cross-project knowledge search no longer serves other projects' session findings.
- **Installing a `.ctxpkg` file verifies before it pins.** The original bytes are stored,
every check runs before anything is written, and a failed install exits non-zero and
leaves nothing installed or pinned. `pack send` refuses packages that fail admission and no
longer sends the local path or project hash; uppercase package scopes are refused.
- **An interrupted legacy adoption or knowledge migration resumes cleanly** instead of
duplicating facts or leaving a partial project partition.
- **A governed proxy request whose every object is withheld** is refused with its reasons
and a withheld receipt, like the call routes, instead of failing for want of a receipt.
- **Crash logs redact secrets** in the panic payload.
- **`read -m signatures` keeps parameter types** (`fn f0(a:i32)` instead of `a:n`).
- **`ctx_agent share_knowledge` no longer crosses projects.** Shared facts were kept in one
installation-wide file, so a fact shared in one project reached the agents of every other
project. Facts are now stored per project, admitted before they are stored and re-authorized
for each reader, and written atomically. The old file is moved unread into
`agents/shared_knowledge/quarantine/` and never served.
- A Work Graph child taken with `action="claim"` could never finish: its fenced receipt
required a measured connector receipt that nothing produced. Receipts are now bound to
the fence and recorded as reported usage (`usage_source: "reported"`), still bounded by
the node and chain budgets. Reported figures no longer free the parent's reservation.
- A started Work Graph child that exhausted its budget kept its concurrency slot and path
claims forever; every terminal transition now ends the incarnation. A stopped child's
paths stay exclusive until the window granted at start ends.
- **Projects no longer leak into each other.** Archived facts, `ctx_memory` facts and the
hint they add to tool answers, the archive search (`ctx_expand` search, list, count and id
lookup), scent and claims, diaries, handoff lists and `clear`, the multi-agent sync counts,
and BM25/vector index directories are now partitioned by project; another project's items
are neither served nor counted nor named. Two clones of one repository no longer share an
index.
- **A request keeps its project.** A slow call that finishes after the host switched roots
writes into the session it started in; tools no longer load "the latest session" of the
process directory; configuration, policy helpers and writable roots follow the request's
project; the HTTP daemon's shared session ignores client roots; a home directory with a
dotfiles `.git` is never adopted as a project root; session restore requires an exact
project match.
- **Concurrent writes are no longer lost** in knowledge import and bridge pull/publish,
session summaries and the local package index; a received package version is immutable,
while `pack create` replaces your own local build.
- **Egress:** tool errors pass the release gate like results; the request URL (path and
query, percent-decoded) and relayed header values are admitted like the body, with
provider credentials exempt only for their own destination; WebSocket frames are checked
right before they are sent and observed after; a lost retry observation is stated on the
reply (`x-leanctx-egress-evidence`); receipts name the caller by a keyed reference. Logs no
longer print error text that may carry content.
- **Provider sources:** items of two sources with the same id no longer replace each other in
the index, and a classification stamp in a provider title is detected.
- **Adding a git remote or renaming the package no longer empties a project.** The project's
knowledge, gotchas, archives, `ctx_memory` facts, shared agent knowledge, diaries and shares
are carried into the new identity on first use, proven by the project root they record
(copied, never moved). This also repairs knowledge stores an earlier path-only migration had
copied but then refused to load.
- **Background work follows its project:** auto-capture, consolidation, summaries and
archives started by a request use that project's configuration; a request without a project
gets `project_unresolved` instead of the process directory. Agent presence and messages
compare projects by path identity (symlinks, separators), and the dashboard binds a folder
exactly as an MCP session would.
- **Context packages marked auto-load apply again.** They were applied only by the
session-start project overview, which this release retired, so `ctx_pack
auto_load` had no effect over MCP. They now apply once per session on the first
call, and the `--- AUTO CONTEXT ---` block names them.
- **SDK Agent Tools v1 keeps its contract.** The engine had dropped `ctx_symbol`
and `ctx_fill` from the negotiated capabilities with their MCP tools, so every
published SDK (all six languages) would have refused the handshake. The v1 set
is back: `ctx_symbol` runs as `ctx_search action=symbol`; `ctx_fill` answers that
it has no successor.
- **No hint names a removed tool any more:** the `ctx_context` and `ctx_edit`
descriptions, the `context-focus`/`context-review` MCP prompts, the semantic-index
"building" message, the LSP-missing error, `lean-ctx cheatsheet`, the impact
"not found" hint and the removal message for `ctx_analyze`/`ctx_compare` (which
named a non-existent `lean-ctx compress --diff`).
- **Hermes plugin:** it offered `ctx_semantic_search` and `ctx_summary` to the
model and called `ctx_summary` at session end; it now exposes `ctx_search`
(with `action=semantic`) and saves the session with `ctx_session action=save`.
- The unused `ctx_semantic_search` entry of the default
`[loop_detection] tool_total_limits` and of the lead-gen persona is gone (no
behaviour change: semantic search counts against `ctx_search`).
- Guides and references (`docs/guides`, `docs/reference`, README, llms.txt,
package READMEs) name the successors.
- **`ctx_work_graph` names every missing field at once.** 45 of 64 calls failed in the
30 days measured; the largest class was a missing argument reported one field at a
time, so agents retried field by field. An incomplete call now lists the fields the
action requires and the ones missing; concurrency and duplicate-graph errors say how
to proceed.
- **The project graph is the same on every build.** Orphan files got their "sibling" edge
from the first match in hash order, so two builds of an unchanged project differed in
about 40 % of their edges, and graph-based impact and
ranking changed from run to run. Files are now visited in sorted order; the
index backend's symbol lookup also caps its 100 hits in path/line order like the
property graph does (#498).
- **Semantic redaction reaches the agent.** The release point re-ran the advisory semantic
detector on text it had already redacted; a model is not idempotent on its own output, so
every `ctx_read` with a semantic redaction was withheld as `release.unadmitted_content` and
each read paid the model twice. The release point now re-checks with the built-in floor.
- **Sessions and observations save under a semantic PII detector.** Identifiers, configuration
tags and paths must stay exact; a model finding there (a user name in a project path) failed
every session save. Exact positions are decided by the built-in floor, content fields keep
the semantic stage.
- **Dense texts are inspected beyond 32 findings.** When the runtime stops at the findings
bound, the Engine asks for the rest (with context) within the same time budget.
- **`ctx_search` batch queries accept `path`/`file_path`** — the handler read them,
but the key check refused them (265 failures across 74 installations in 30 days).
Unambiguous near-misses (`regex`, `query`, `maxResults`, `limit`, `glob`, …) are
mapped to the canonical key; other unknown keys are still named.
- **`ctx_read` is about eight to twelve times faster** (release build, 2,500-file repository:
p50 1,263 ms → 158 ms on first read, ~1,210 ms → ~100 ms on re-reads). The built-in `coder` profile ran a prefetch — a graph walk plus up to ten
admitted file reads under the session-cache lock — after every read, for a result only an
internal event saw; it is no longer on by default. `minimal_overhead` now defaults to
`true` also when a config.toml does not name it (it read `false` there). The read path no
longer loads the code graph per call: post-read enrichment, the session-start hook and
the pre-read mode gate use only a built graph and otherwise schedule the background build.
- **`ctx_compose` no longer refuses unchanged results** with "source authority changed"
(a timed-out worker invalidated its caller's ended policy view) and reuses the resident
search index instead of loading it from disk per call. While the index of a cold project is
still building, ranked sections can still differ between sessions.
- **The path jail admits the host's own session output read-only** — Claude Code's
`tool-results`/`subagents`, Cursor's `agent-tools`/`terminals`, Claude Code's private
scratch dir — and `~/.pyenv/versions`; credentials beside them stay jailed.
- **Gateway refusals name the setting behind them**; **passwords in `https://…` and other
URLs are redacted**; `ctx_work_graph` errors say what to do next.
- **Provider items are found by search again.** Issues, tickets and other provider results were indexed but never returned by `ctx_search` (also with `action=semantic`) in BM25 mode. They are now part of the search view whenever their source still returns them to the current reader; an item the reader may not see adds nothing to the ranking — no title, count, snippet or term statistic.
- **Governed search is about three times faster and no longer refused by an MCP server's memory target.** Admitted files are chunked in parallel (admission itself stays on the request's thread), freed memory is returned before each search, and a search is refused only at the hard memory level. On a 2,782-file tree: about 7 s per search instead of 19–21 s, and the MCP server answered all 18 searches of the measurement instead of 6 at its default 512 MB target.
- **A query in words finds `snake_case` identifiers.** `admit_source_typed` is also indexed as `admit`, `source`, `typed`, as camelCase names already were. Only the index splits: a query for `settle_canary` still means that identifier. On 18 labelled code questions recall@5 rose from 0.50 to 0.72 and MRR from 0.32 to 0.54.
- **Provider results under a symlinked project path are searchable** (macOS `/var` → `/private/var`); they were written to an index no search read. Two provider queries in quick succession no longer race on the index file, and an item queried again replaces its earlier copy.
- **The Provenance view of the dashboard loads again** (it called an API method that does not exist).
- **An expired team artifact's kept copy is removed** at the next use, which refuses it.
- **Agents outside a project are told what is missing (OpenCode).** When a host starts lean-ctx outside a project (OpenCode launched from the home directory) and reports no project directory, a search or tree without `path` said only "active project root is required", and a relative read failed as "file not found: ~/src/main.rs". Both now say that the session has no project yet and to pass the absolute project path, after which that project stays bound. OpenCode installations hit this four times as often per installation as Claude Code.
- **Rules name only the tools the session is offered.** With no profile pinned, the injected rules and MCP instructions were written for the full tool set, while `tools/list` offers the lean core (OpenCode, Cursor and other clients: 11 tools). They named `ctx_knowledge` and, for native-editor clients, `ctx_patch` as if callable, and agents called tools their list did not contain. Guidance now describes the lean core and points to `ctx_call` for the rest; the skill shows non-core tools in their `ctx_call` form. A pinned profile keeps its full set.
- **Reading a file in windows is no longer booked as a correction.** A `lines:` window (and the `head`, `tail` and `sed -n` reads the shell hook maps onto it) counted as a compressed read, and `head`/`tail` through `ctx_shell` as a full re-read, so paging through a long file produced a correction for nearly every window — hundreds on a single long instruction file in Codex sessions. A correction is now only a lossy compressed view (`map`, `signatures`, `aggressive`, `entropy`, `task`, `reference`, `cognitive`, `mdl`, `density:`, `auto` resolved to one of them) followed by the full content (`full`, `raw`, whole-file `anchored`, or `cat`/`bat`/`less`/`more` without a range). Windows, `head`, `tail`, `sed -n` ranges and `diff` deltas are partial reads: they neither start nor complete a correction. `anchored`, which is verbatim plus line anchors, no longer starts one either. A failed edit after a window read is no longer charged to a compressed read.
- **Edits made through the shell cancel a provisional correction.** `sed -i`, `perl -i`, output redirection (`>`, `>>`, `>|`, `&>`), `tee [-a]`, `cp`/`mv`/`install` onto a file and `apply_patch` bodies — through `ctx_shell`, also in `&&`/`;` chains, after `cd` and inside `sh -c`/`lean-ctx -c` — now count as edits of their target files, like `ctx_patch`. Native shell commands seen by the Claude Code, Cursor and Codex Bash hooks and Codex `apply_patch` calls (the Codex observer hook now also matches `apply_patch`) report the edit through the edit beacon. `2>/dev/null`, `2>&1`, `>&2` and targets built from `$VAR` are never edits. Shell reads are resolved against the command's working directory, so a relative `cat src/x.rs` now matches the file `ctx_read` read.
- **Reading a file before editing it is no longer booked as a correction.** A compressed read followed by a full read of the same file was booked as a bounce (a correction that cancels the read's savings) at once, even when the full read was the preparation for an edit — the flow lean-ctx itself recommends (map to orient, full to edit). A detected bounce is now provisional for 10 read ticks: an edit of the file inside that window — `ctx_patch`, `ctx_edit`, or a native host edit (Claude Code `Edit`/`Write`, Cursor `StrReplace`, …) reported by the hook through a small edit beacon in the data directory — cancels it; otherwise it is booked when the window passes, and at shutdown at the latest. Only booked bounces reach the ledger, the per-path memory, the quality signal and the scent field.
- **A file lean-ctx learned is always re-read in full is delivered in full for explicit compressing modes too.** The per-path memory (#496) only steered `mode=auto`, so an explicit `map`, `signatures`, `aggressive`, `entropy`, `task`, `reference` (or `cognitive`, `mdl`, `density:`) read of such a file still bounced. It is now served in full with the notice `[mode overridden: map -> full, reason=learned-full, pass fresh=true to keep the requested mode]`; `lines:`, `diff`, `raw` and `anchored` stay untouched.
- **Agent instruction files are served complete on every read path.** `ctx_read` already delivered `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `LEAN-CTX.md`, `SKILL.md` and the documents under `skills/`, `.claude/rules/`, `.cursor/rules/` in full; the internal read path behind CLI and helper tools did so only for `auto`, and a relative path that starts with the directory (`skills/…/guide.md`, `.claude/rules/x.md`) was not recognised. Both now follow the same rule, and a relayed compressed view from another agent no longer stands in for an instruction file.
- **Savings-ledger events say which agent produced them.** Every event carried `agent_id: "local"` unless `LEAN_CTX_AGENT_ID` was set, so corrections could not be attributed per agent. A single-client MCP server now records `:` (for example `claude-code:mcp-1274-…`), hook and CLI processes record their host (`claude`, `codex`, `cursor`), and `LEAN_CTX_AGENT_ID` still wins. A server that sees a second, different client falls back rather than mislabel. Signing keys and the hash-chain format are unchanged; existing entries verify as before.
- **The shell hook intercepts commands in non-interactive bash** (#2092). Bash expands aliases only in interactive shells, and agent harnesses run their Bash tool non-interactively — OpenCode through `BASH_ENV` — so `lean-ctx-on` defined `git`, `cargo`, `npm` and the rest as aliases that were never used, and every command ran raw without a warning. The bash hook (and the container `env.sh` built from it) now enables `expand_aliases`; zsh already expanded them. `lean-ctx-status` now answers on a pipe too (bash, zsh and fish), so an agent can check the hook's state: it printed nothing whenever stdout was not a terminal.
- **The Claude Code plugin shapes native Bash output again** (#2089). Claude Code 2.1.296 and later lets a plugin call only the tools an MCP server lists, and `ctx_shape` is deliberately unlisted, so every call was refused and large Bash output always came back unchanged (`/leanctx` showed "Bash outputs shaped 0"). The plugin now reaches `ctx_shape` through the listed `ctx_call`; `ctx_shape` stays out of the tool list and out of `ctx_discover_tools`. A refusal on the way (workflow, role, policy, budget or rate limit) is now returned as an error, so the plugin keeps the native output instead of putting the block message in its place, and repeated identical commands no longer count as a lean-ctx loop.
- **A hook no longer wraps its own `lean-ctx -c` call again** (#2088). The allowlist wrap recognised only a bare `lean-ctx …`, not the binary path the hook itself writes (`C:/…/lean-ctx-bin/bin/lean-ctx.exe -c '…'` on Windows npm installs). Every time a hook saw such a command it added another `-c` layer, and the nested quoting then broke in the inner shell, so the command was blocked as a mis-split fragment (`'lean-ctx.exe -c '`). A command that already runs lean-ctx, by bare name or by that path, now passes unchanged; the PowerShell path checks the same way.
- **`ctx_shell` follows `cd $TMPDIR` and `cd $D` before a relative target** (#2079). The redirect and download checks place a relative target in the directory its command runs in, but a `cd` through any variable made that directory unknown and the target was refused — although both refusals name `$TMPDIR` as an allowed destination and `$TMPDIR/x/f` passed. A `cd` through `$TMPDIR`, or through a variable the same command set to a literal path earlier (`D=/tmp/x; cd $D && curl -o f …`), is now followed like the literal. A command that rebinds `TMPDIR` to something the check cannot read (`TMPDIR=$PWD`, `read TMPDIR`, `unset TMPDIR`) no longer counts as the scratch directory — this also closes that spelling for download targets (`TMPDIR=$PWD; curl -o $TMPDIR/f`), which were judged against the environment's `$TMPDIR`. Any other variable still leaves the directory unknown.
- **The word `cd` in a quoted argument is no longer a directory change** (#2081). `printf '… cd /tmp …' > f` was refused because the check read the words of the string as commands. Only words the shell runs count now. A quoted command name (`"cd" /x`, `c'd' /x`) still runs and still counts, and any `eval` leaves the directory unknown.
- **`ctx_shell` downloads may write where `>` may** (#2080). A download (`curl -o`/`-O`/`--output-dir`, `wget`, `dd of=`) was allowed only into a scratch path, and the refusal claimed the `>` capture rule applied "as well" and that "a literal path" would do — so agents fetching a model or an asset into their project retried variable, literal and chained spellings and were refused each time with the same text. A download now follows the capture rule: the session's project, `allow_paths` / `extra_roots`, `write_allow_paths` or a scratch path, judged where the target lands (relative to the directory its command runs in, through variables the command set to a literal). wget is judged by every file it writes (document, `-P` directory, `-o`/`-a` log) instead of being refused outright. A variable that cannot be followed is still refused, and the message states the rule.
- **Files with a database connection string are no longer withheld whole.** The context gateway masks the credentials of a Postgres, MySQL, MongoDB or Redis URL, then re-scans its output to make sure no secret is left. The masked form still looked like a `user:password` pair to that re-scan, so every file holding a real connection string — `docker-compose.yml`, `.env`, settings modules — was withheld entirely with `secret.redacted, redaction.incomplete` instead of being delivered with the password masked. In 3.11.4 this was 250 failed `ctx_read` calls on 33 installations in three days. Detector and redactor now share one rule, so masked output never matches again. The rule also masks a password that contains an unencoded `@` in full and covers the user-less Redis form; an `Authorization :` header with a space before the colon is masked like one without.
- **Agents can read their own settings and MCP configs.** `ctx_read` refused `~/.claude/settings.json`, `~/.codex/config.toml`, `~/.cursor/mcp.json` and the like as a "protected location" — in 3.11.4 the refusal seen on the most installations (103 of 591 in three days), typically an agent checking its own setup. These files now open read-only for the session, file by file, like skills and rules already did; a token in them is masked by the context gateway. Credential files (`~/.claude/.credentials.json`, `~/.codex/auth.json`), `~/.claude.json`, sessions and transcripts stay jailed, and lean-ctx still never writes there.
- **`ctx_compose` no longer throws away a finished result because the policy check was busy.** Every source read is checked against one verified policy snapshot, once before and once after the work. Both checks go through a single shared worker with a 2-second deadline; with many parallel tool calls it answered "busy" or "deadline exceeded", and the finished compose result was discarded as "source authority changed or could not be verified" (43 times on 14 installations in three days on 3.11.4). A check the worker could not serve is now asked once more; an invalid or changed policy still fails on the first answer. The error also names which check failed.
- **The daemon no longer grows with every project root it indexes** (#2075). Measured with 16 copies of the lean-ctx source tree (4,541 files each) indexed one after another on Linux: 3.11.4 grew linearly to 1.3 GB (peak 1.6 GB) and released nothing when idle; it now levels off at ~550 MB after eight roots (peak 0.8 GB). Four causes, all fixed:
- Freed memory was never returned to the OS. `arena..purge` takes no value, but lean-ctx passed one, so every purge failed and the failure was logged only at debug level. In a macOS test, a dropped 900 MB parse working set stayed in the footprint; with the call fixed it falls to ~50 MB.
- tree-sitter's parse trees came from the system allocator, which kept the pages: on macOS 336–404 MB stayed after the trees were dropped, and `malloc_zone_pressure_relief` released none of it. tree-sitter now allocates from jemalloc, so the purge reaches its memory too. On Linux, glibc's free pages (SQLite and other C code) are also trimmed.
- The search index stayed resident for every root, without limit. The daemon now keeps at most eight, dropping the least recently used first, as the graph cache already did.
- The daemon's memory guard only cleared the file-content cache, even at hard pressure. It now runs the same eviction as an MCP server, dropping resident search, graph and embedding indexes too. A new `daemon_max_rss_mb` (2048 MB, env `LEAN_CTX_DAEMON_MAX_RSS_MB`, `0` = percent only) caps its target on large machines, where 5 % of RAM let a daemon reach several GB first.
- **Windows: rooted reads of a relative path open the file inside the project.** The read checked the path against the project root but then opened it relative to the process's working directory, which for the daemon is not the project; such reads failed or were refused as outside the root. They now open the path the check resolved, as on macOS and Linux. With the path jail off (`path_jail = false`), a relative path was not resolved against the project at all on any platform; it now is.
- **Self-signing after an update can no longer hang.** On macOS, `security` and `codesign` ran without a time limit; a test with an isolated data directory reached the real signing keychain and waited for a password prompt forever. Each step is now bounded by its own budget within one shared deadline, and a tool that does not answer is ended before the fallback; a timeout falls back to the ad-hoc signature as before.
- **Parallel `remember` calls on a busy machine no longer fail.** Knowledge writes waited at most 2 seconds for the project lock, so seven parallel writers on a loaded machine could answer "knowledge lock unavailable" and drop a fact. The wait is now bounded at 10 seconds.
- **`lean-ctx doctor` names hooks that run a missing program.** A Codex `hooks.json` with an extra `SessionStart` entry pointing at a deleted temporary binary failed every session start with exit 127, while doctor reported the hooks as healthy. Doctor now reports any Codex or Claude Code hook whose absolute program no longer exists, whoever wrote it, and names the file to remove it from; it does not delete entries lean-ctx did not write. A stale lean-ctx binary is also reported when a current one is configured next to it, since every configured hook runs.
- **`lean-ctx claude-mod install` finds Claude Code when PATH does not show it yet.** A terminal or editor started before Claude Code was installed reported it missing. After PATH, the installers' default locations are checked (`~/.local/bin`, and on Windows `%APPDATA%\npm\claude.cmd`), under the same trusted-location check.
- **Refreshing Codex hooks keeps your own hooks.** Recognising lean-ctx's entries by "contains `lean-ctx`" also matched user wrappers such as `/custom/lean-ctx-wrapper hook rewrite` or an `echo lean-ctx …` hook, and setup replaced or removed them. Only commands that run the lean-ctx binary itself count as lean-ctx's now; other hooks in a shared entry stay, and outdated lean-ctx commands in it are updated to the current binary.
- **`cargo build --no-default-features` compiles again** (#586). The featureless build that FreeBSD and other ports were told to use had decayed to 99 compile errors after CI switched to checking only feature sets that include `http-server`. `http-server` now gates the servers alone: the HTTP client (`reqwest`), `hex` and the proxy's accounting (CCR archive behind `ctx_expand`, usage meters, savings, introspection) build in every configuration, while the proxy server and its provider adapters stay behind the feature. A new CI step checks the build with no features at all.
- **`ctx_search` with a file `path` honours `include` and `exclude`** (#2059). Pointing `path` at one file and adding `include="*.rs"` scanned 0 files and suggested fixing the glob: the glob was matched against the file's path relative to itself, which is empty. A file root is now matched by its name.
- **`lean-ctx call` always returns the content** (#2060). A one-shot `lean-ctx call ctx_compose` (or `ctx_read`) could print only `[cross-agent cache · compose · produced by …]` when another process had delivered the same result in the same Claude Code conversation. The caller of a one-shot process never received that delivery, so such a process now never serves a stub or cache reference. Cached `ctx_compose` results also expire when the embedding model changes or the dense index is rebuilt; they were ranked with the old vectors.
- **`lean-ctx call ctx_compose` waits for its ranking** (#2049). On a large project the BM25 ranking section read "local BM25 ranking deferred" because it had the 4-second budget meant to keep an agent loop responsive, and the finished ranking was then discarded. A one-shot call now gives it up to 120 seconds; MCP sessions keep 4 seconds. The note names `LEAN_CTX_COMPOSE_BUDGET_MS`, which overrides both.
- **`lean-ctx index status` no longer reports a differing daemon root for the same directory** (#2049). `G:/project` and `G:\project` (or `\\?\G:\project`) were compared as text.
- **Semantic search headers show Windows project roots as written** (#2063). `ctx_search` with `action:"semantic"` printed the root as `\\?\C:\…`.
- **`lean-ctx claude-mod install` finds Claude Code on Windows** (#2061). It reported "Claude Code not found on PATH" for npm installs (`claude.cmd`, previously not accepted) and for the native installer's `%USERPROFILE%\.local\bin\claude.exe`; multi-segment trusted roots also never matched canonical `\\?\` paths. Both are now recognised under the same trusted-location check, and the message names the actual reason (not on PATH, untrusted location, or failed to run).
- **`ctx_callgraph` finds calls written with a module path.** A call such as `crate::config_io::write_atomic_with_backup(..)` or `compound_lexer::split_compound(..)` was invisible to `callers`, `callees`, `trace` and `risk`: `write_atomic_with_backup` showed 3 callers instead of 83. Queries now match a call by its path segments, so `write`, `config_io::write` and `crate::config_io::write` all find it, while `a::save` never matches `b::save`. A path call whose module or type names exactly one defining file (`config_io::write` → `config_io.rs`, `Repo::save` → the file defining `Repo`) is now bound to that file as `[resolved]` instead of `[ambiguous]`. Stored code graphs rebuild once on the next query.
- **`entropy` no longer drops facts or hides what it dropped.** The view used to delete a file's most predictable lines without a trace, which removed rows such as `re("git", Category::Vcs)` from a look-alike table and every variant of an enum, and left code that looked complete. A line that holds a string literal or code identifier found nowhere else in the view is now kept, and every omitted run reads `[lean-ctx: omitted N lines]`. On dense source the default therefore saves less than before: those savings came from the silent deletions. Higher `aggressiveness` still sheds more.
- **`density:X` works on source code.** It fell back to the full file for almost every Rust file at any target: its quality guard demanded an information density that unmodified code does not reach, and a fixed identifier share only a view of 80% or more could meet. A density view now keeps definitions and imports first, then lines that add identifiers the view lacks, then the highest-entropy rest; omitted runs are marked and their markers count against the budget. The guard checks the result against the original file and the requested budget.
- **Claude Code: re-reading a file with `ctx_read` costs a stub, not the whole result.** The MCP server withholds its `[unchanged]` stub on Claude Code because sub-agents share their parent's connection (#1801), so every re-read was delivered in full. The `read-dedup` hook now also covers `ctx_read`: when the identical result was already delivered to the same conversation or sub-agent for the same arguments, it is replaced by a one-line stub; `fresh=true` still delivers it. The installed hook is extended automatically when the next session starts.
- **Task-filtered reads are no longer steered by `git diff` counters.** Without a stated task the session took the `git diff --stat` summary line ("Modified: 2 files changed, 19 insertions(+) …") as its task, and its words filtered `task` and `entropy` reads. An inferred task now names the uncommitted files, is refreshed instead of persisting across sessions, and never steers a read.
- **Semantic search and `ctx_compose` ranking work in a subdirectory of a large project.** A search scoped with `path` walked and counted the whole project first and failed with "source file budget exceeded" once the project held more than `bm25_max_files` (5000) files. The walk now starts at the requested directory and counts only sources the search can return; the error names `path`, `languages` and `bm25_max_files`. Linked git worktrees checked out inside a project are skipped by every scan like other worktree copies.
- **Searches and indexes no longer read `.git` internals.** Content walks include hidden paths so tracked dotfiles such as `.github/` are found (#1792), which also let `ctx_search`, `ctx_compose`, globbing and the BM25 corpus walk `.git` (`.hg`, `.svn`, `.jj`): a project-wide search returned `.git/rr-cache` conflict images as uses in code. Version-control metadata is now skipped below the walk root; asking for `.git` itself still works.
- **`ctx_compose` shows the code first.** Its exact matches came from a single search capped at ten hits in directory order, so root-level docs and agent rule files filled the section. It now lists definitions, then uses in code, and prose only when code has none.
- **`lean-ctx read -m density:X`, `-m reference` and `-m task` return the requested view** instead of the whole file when the CLI renders locally.
- **`reference` is described as what it is**: a one-line pointer (path, lines, tokens) without content. The tool schema called it "quotes".
- **The Claude Code plugin no longer announces a background job the agent already read.** A job that finished during a long turn was announced at once; Claude Code held that wake until the turn ended, and by then the agent had usually read the job itself, so the stale wake cost a whole extra turn. Wakes for jobs that finish mid-turn are now held and sent after the turn only for jobs the agent has not read.
- **Context Gateway:** a CLI tool run stored a Decision Receipt only under
protection. In developer mode a stand-alone `lean-ctx read` (no daemon) admitted
its source and recorded nothing, so `lean-ctx inspect` could not show the
decision. The CLI now follows the MCP call's rule in every mode: a plain receipt
when a source was admitted, no sidecar and no anchor duty without protection.
- **Context Gateway:** the evidence store (`/gateway`) is packed and bounded.
Receipts are stored zstd-packed (`.json.zst`; plain `.json` receipts still
load). A background maintenance pass in the MCP server and the daemon — at startup,
hourly and soon after a write that did not fit under the ceiling
(`LEAN_CTX_GATEWAY_STORE_MAX_MB`, else 10 % of `max_disk_mb`, else 1024 MB) —
counts the store's files and rebuilds its usage ledger from the count, removes
receipts older than 30 days (`LEAN_CTX_GATEWAY_RETENTION_DAYS`), brings the store
down to 80 % of its ceiling, oldest first, each with its sidecar and observation,
and packs the plain receipts that stay; an unfinished pass is continued by the next
process. The last 24 hours (`LEAN_CTX_GATEWAY_PROTECT_HOURS`), receipts a project's
latest index lists and receipts of a task in progress are always kept; only when a
pass found them alone filling the store are new receipts refused (developer mode
delivers and logs the missing receipt, protected mode withholds the release). A
stale or copied ledger never refuses a write, and the write path never counts
files. `lean-ctx inspect --maintain` runs a pass now; `lean-ctx doctor` always shows
size, ceiling and the last pass. On the first start after the
update a long-used store is brought within its ceiling in the background; see
"The store's ceiling" in the security reference.
- Shadow Mode priced the uncompressed baseline with a fixed reference model
(`[shadow] baseline_model`, default `gpt-4o`). Whenever the host used another
model, the report labelled the task `model_routing`, recommended "Model
routing" between the two models, and counted their price difference as a
saving. The baseline now uses the model the host chose for each task, so
only context changes count, and no model is ever recommended.
### Security
- **Project provider configs load only in trusted workspaces (GHSA-rrww-7924-w72f, high).** A
project-local `.lean-ctx/providers.toml` (or `.lean-ctx/providers/`) is loaded only after the
workspace is trusted with `lean-ctx trust`; an untrusted checkout can no longer bring its own
provider definitions. Upgrade note: in an untrusted workspace its project providers are no
longer available until you run `lean-ctx trust` there (see the upgrade guide). Hardening of
workspace trust continues.
- **Gateway-held provider keys need the lean-ctx token (GHSA-53h5-q4m8-vg3x, medium).** On a
loopback proxy with `proxy_require_token = false`, a request carrying any provider key
header could reach a `/providers/{id}` route whose key the proxy injects (`api_key_env`,
Bedrock), also through a routing alias on `/v1/chat/completions`. Such routes now require
the lean-ctx proxy token before the operator's key is injected.
- **Proof and knowledge export paths stay inside the project (GHSA-pv78-9chr-hj3c, medium).**
`ctx_proof` export accepts only a plain file name, and `ctx_knowledge` OKF export and import
paths are kept inside the project jail. Upgrade note: a relative OKF `path` now resolves
against the project root instead of the server's working directory.
- **Untrusted project config cannot widen write paths (GHSA-79fg-7cj5-4xmm, low).** An
untrusted project's `.lean-ctx.toml` no longer sets `write_allow_paths`, like the other
sensitive overrides it already could not set.
- **Constant-time helpers.** ctutils 0.4.4 (RUSTSEC-2026-0385: mask generation and `u128`
comparisons could branch on secret values), in the engine and the cloud and edge services.
- **TLS certificate verification.** rustls-webpki 0.103.16 and webpki-roots /
webpki-root-certs 1.0.10 (RUSTSEC-2026-0381, -0382, -0383).
- **Agent bus handoffs.** `/v1/a2a/handoff` verifies the envelope HMAC when
`LEAN_CTX_HANDOFF_SECRET` is set (`401 signature_required` / `invalid_signature`) and
refuses signed envelopes when no secret is configured (fail closed); unsigned handoffs
without a secret behave as before. Addressed handoffs reach only their recipient, live
and after replay. The task store is read under its file lock, so `ctx_agent` export
pruning and concurrent task updates no longer lose writes.
- **Secret files.** Each owner-only secret-file write uses its own random temporary file,
so concurrent writers of the same path no longer collide; on Windows a writer no longer
fails when another one already removed the old file.
### Coming in 3.12.1
The Hive connector code ships in 3.12.0 but stays switched off: `lean-ctx hive connect`
and `lean-ctx hive link` refuse with "LeanCTX Hive comes with 3.12.1; this version does not
connect to a Hive.", and `hive` is not listed in help or completions. The items below take
effect with 3.12.1.
- **What leaves for a swarm is checked on the machine.** Results, proposals, verdicts (reason
and value) and report notes pass the secret and personal-data screening. For a public
swarm they also must not contain text of a repository linked to a vault on this machine
(three consecutive lines or about 200 bytes of one file; the refusal names no file, and a
check that cannot run refuses). Text fields and every string of a value refuse invisible,
direction and control characters; list items are single lines of at most 500 characters.
A team swarm of another organization is left out of listings, reported by count only, and
refused before anything is sent to it.
- **Engine metrics for Hive workspaces (not released yet).** A connected engine can send its
workspace hourly counts of what the local cockpit shows, per vault: tokens and savings (by
trust label), read modes, tool calls by tool name, compression, protection and policy-block
counts by rule, sessions, agents used, model spend where it is measured, and redacted secrets
as per-workspace fingerprints. It never sends file content, paths, prompts, model output,
secret values or command lines: every name on the wire is a closed pattern or `other`. Batches
are signed with the engine's instance key, idempotent per hour (`rev`), buffered offline (at
most 720 hours / 8 MiB, oldest dropped and counted) and backed off on 429/5xx. Nothing is
collected or buffered unless the workspace's "Share engine metrics" rule is on (Team and
Business by default; Community and Pro after `lean-ctx hive metrics confirm` in a terminal),
and turning it off drops the buffer. `lean-ctx hive status` shows the line "Sharing engine
metrics with …", `lean-ctx hive metrics preview [--json]` prints exactly what would be sent
for the last hour, `lean-ctx hive metrics delete` removes what the engine buffered. Sending
stays switched off in this build until the privacy review is done; the guide follows with
3.12.1.
- **`lean-ctx hive connect` is the one step to Hive.** It signs in through the browser
(device flow), where the person chooses the workspace for this machine; then it asks once
per workspace what this machine shares with it and lists each channel that is on (captured
knowledge, daily usage totals, context receipts, agent presence and bus messages). The
answer is kept in `/hive/sharing.json`, so a later connect or session asks
nothing; `--yes` answers yes without asking. A "no" turns every outbound channel off in
`[hive]` while the workspace's knowledge and policy are still pulled. Without a terminal
and without `--yes`, the `[hive]` settings apply unchanged. Running it again on a
connected machine only does the steps not yet answered.
- **Projects find their vault on their own.** At connect, and in the background sync for
other projects whose sessions queued knowledge, the engine asks Hive for the vault of the current project from org-salted
digests of its identity (`.lean-ctx-id`, the normalized origin URL, the repository's first
commit; never a path, user or host name). A vault this machine may already read is mapped
at once. A suggested vault, a new private vault for the project, a committed link file, or a
vault that moved to another workspace waits for one confirmation by the person: at
`hive connect` in a terminal, or with `lean-ctx hive consent approve `. Agents, MCP
calls and `--yes` never confirm it; until then the project's knowledge stays on the machine
and sync reports `consent_required`. The same repository URL alone never gives access.
`lean-ctx hive link /` stays as the manual override. A Hive without
the match route keeps the earlier resolve, after the same confirmation.
- **Knowledge states in delivery.** Knowledge delivered from a vault replica carries one of
five states, derived on every read from the folded replica, the same way Hive derives it:
`verified`, `provisional`, `outdated`, `conflicting` or `rejected`. Outdated items (anchor
changed or gone) are labelled `[outdated: re-verify]` and conflicting ones `[conflicting]`,
after the current ones; rejected and superseded items are not delivered.
- **Citing delivered knowledge.** Each delivered vault item shows its `node:`, and each
section says once how to cite it. A claim that names `node:` in
`ctx_knowledge action=remember refs` gets a `derived_from` edge to that item, the evidence
Hive counts as verified reuse across engines.
- **`lean-ctx hive maintain / --stale`** re-checks every anchored claim
against the code in this checkout and marks changed ones *to verify* and missing ones
*gone* (no model, no cost; the same check runs after each capture during sync).
`--stale --confirm ` re-anchors a claim the person checked at the current code.
It prints counts, never claim texts.
- **A task result can be a failure.** `lean-ctx hive tasks submit … --failed` and
`ctx_tasks action=submit outcome=failed` end the task as failed; the default stays
completed. Against Hive v5 a result ends the task at once, without a person's decision; an
Hive before v5 takes no `--failed` (release the task instead).
- `lean-ctx hive status` names the filter packs the org policy requires and whether each
is installed exactly as signed (`policy.required_filter_packs` in `--json`, a
`Required:` line in the text output); the Cockpit's organization policy view lists them.
- **Task claims made with `lean-ctx hive tasks claim` stay alive while their agent works.**
The CLI ends right after claiming, so nothing renewed the claim and an agent running a long
gate lost it before submitting. The daemon that runs the bus relay now takes over such a
claim while its agent is registered and active within 30 minutes, and renews it at
half-time; once the agent stops, the claim ends at its expiry.
- **How Hive helped, in the Hive metrics.** For each vault and day, the metrics
upload now also carries counts and durations only: how many Hive facts agents asked for and
got, the tokens and list price the project's host sessions used while this machine held a
task's claim (per task), and the median time from a session's start to its first Hive
knowledge. They are recorded locally in a private file; sealed vaults report the same
counts, and no text, path or fact leaves with them.
- **Hive tasks in the engine.** `ctx_tasks` (MCP) and `lean-ctx hive tasks` read a vault's
tasks, claim one, report one-line summaries, submit the result with evidence
(commit, receipt, CI run, URL, fact, or a code anchor on a file or symbol as it is now) and
give it back; `propose` queues an agent task that a person approves in Hive, sent with the
next sync and created once however often it is resent. A claim passes the engine's worker
gate (the person's opt-in for the vault, pause, today's budget) and goes out under that opt-in;
Hive checks it again, and the engine shows any refusal as it is. The claim's lease id and
fencing token stay in a private file on the machine, every write carries them, and the session
renews its claims while it runs and gives them back on stop. Summaries, proposals and release
reasons pass the outbox screening (a text holding a credential or personal data is not sent)
and go out sealed in sealed vaults. Task text from Hive reaches the agent fenced as foreign
data, never as an instruction. A session starts with the claims held in the project and its
open tasks. Every task call from a tool ends within five seconds; offline or without the
`tasks.*` rights the tools answer at once.
- **Confirmations, auto-merge and rollback for Hive knowledge.** An agent confirms or objects
to a knowledge proposal through its own session (`ctx_tasks action=confirm|object`); this
counts toward the vault's auto-merge threshold; a session never confirms what it wrote, nor does
any session of the machine that wrote it or submitted the task result (in Pro the owner's other
machine confirms), and an objection leaves the proposal to a person (in a sealed vault its
reason stays on the machine). People confirm on the web. When an agent here judged a fact to contradict another one, the
engine objects to a proposal that adds it, once. A sealed proposal that reached its threshold
is merged by the next sync of an engine that may merge, since Hive cannot read it.
`lean-ctx hive review rollback /` restores the document of an earlier
revision as a new one; in a sealed vault the engine opens it with that revision's key and seals
it again under the current key, and says so when this machine holds no key for it.
- **Sealed vaults (end to end).** A vault marked sealed in Hive is encrypted on the machines
that hold its key; Hive stores and relays ciphertext only. A maintainer approves each
engine after comparing its fingerprint (`lean-ctx hive status`), and `lean-ctx hive
grant` passes the vault key to approved engines. Drafts from a sealed vault carry no readable
summary, title, reason or sources, and Hive refuses any that do. `lean-ctx hive review`
reads and merges sealed proposals on a machine that holds the key. Removing an engine, its
member or its access rotates the key.
- **Hive metrics and receipts.** A connected engine uploads Cockpit metrics and Decision
Receipt summaries (which context went to which model, no content) to Hive for the team
statistics and proof views. Both are on by default and can be switched off per machine
(`[hive] metrics_upload`, `receipts_upload`) and per organization in Hive; Hive refuses
an upload kind that is switched off.
- **Agents across machines.** `ctx_agent` leases on a file or symbol are coordinated through
Hive when the machine is connected and the repository is linked to a vault, and an agent can hand a task
to an agent on another machine of the organization. The answer always names the scope
(`scope=hive` with a fencing token, or `scope=local` with the reason); Hive sees only a
hash of project, kind and repo-relative path. Organization controls (hold, stop, veto,
resume) apply to that machine's agents while its lease is valid.
- **LeanCTX Hive connector.** `lean-ctx hive connect [--url ] [--label ]
[--no-browser]` enrolls this machine as an engine instance of your organization through a
device flow (approve the shown code in the browser). The instance key is generated
locally and never leaves the machine; access tokens are minted from signed assertions.
Community includes 1 connected engine, Pro 2, Team 2 per seat; Enterprise: contact us; a
further machine is refused with a message naming the limit, without retries. `lean-ctx hive status [--json]` shows
organization, plan, rights, lease, queued and refused drafts, the organization policy
and the filter packs from local state only (`--json` is the shape the Cockpit reads);
`lean-ctx hive link /` links this git repository to a vault
(`.lean-ctx-hive.json`, plus `.lean-ctx-id` when the repository has no identity);
`lean-ctx hive sync` sends queued drafts and pulls reviewed knowledge now;
`lean-ctx hive disconnect` frees the seat and removes the credentials, the lease, the
keys and the local Hive data (queued drafts, pulled bases, activity), which
`--keep-local` keeps. Leases move Valid → Grace → Lapsed; offline or lapsed only pauses
Hive, local tools never depend on it. State lives in `/hive` (directories
0700, files 0600) and `/hive`. New `[hive]` config section (`enabled`, `url`,
`root_key`, `auto_draft`, `pull_interval_minutes`, `metrics_upload`, `receipts_upload`,
`bus`, `vault_labels`, `runtime_consent`, `sealed_grants`); a self-hosted Hive needs its
`[hive] root_key`.
- **Vaults.** What you create in Hive is a vault, linked to exactly one git repository:
`lean-ctx hive link /`. Commands, help, MCP descriptions and errors say
vault; "repository" stays where the git repository is meant. The engine calls
`/v1/vaults/…` and sends `Hive-Names: vault` on every request and on the bus upgrade, so
Hive answers in vault names. `[hive] vault_labels` replaces `project_labels`: the old key
is read as the new one (the new one wins when both are set), the config migration renames
it with its comment, and `lean-ctx config validate` and `lean-ctx doctor` name it as renamed
instead of unknown. Files on disk keep their earlier names (`.lean-ctx-hive.json` writes
`repo`, `/hive/projects.json` and every local Hive file write `project_id`,
pulled facts keep the `hive-repo:` tag) and read the new ones too, so a team with mixed
engine builds shares one link file and a machine that goes back keeps its Hive state,
sealed vault keys included.
- **Worker mode and swarms.** With worker mode on for an engine in Hive, the engine's own
agents pull work: tasks of the vaults you chose and subtasks of swarms, within a daily
budget (`lean-ctx hive worker status|pause|resume|stop`; `[hive.worker]` can only lower
the budget). `lean-ctx hive swarm list|show|material|claim|renew|release|submit|propose|
verifications|commit|reveal|report` and `ctx_tasks scope=swarm` show swarm work the way an
agent sees it, everything others wrote fenced as data. Claims and verification commits
pass the worker gate (opt-in, budget, pause); a verdict is committed as a hash and revealed
later. A public swarm is open to everyone, a team swarm stays inside its organization.
- **Knowledge channel: drafts out, reviewed revisions in.** At session end, on
`ctx_session save` (debounced to 10 minutes per project) and at server shutdown, what
the agent learned is screened and queued as one draft proposal; no network call runs
inside a tool call or hook. Queued items are durable (`/hive/outbox`, retries
with backoff from 30 s to 1 h, refused items stay visible in `hive status`). Reviewed
revisions are pulled every `pull_interval_minutes` (default 15) into project knowledge
under the category `hive//`; nothing is written into the project tree.
- **Organization policy and filter packs from Hive.** `hive sync` and the daemon pull a
signed policy bundle. An organization policy is accepted only when signed by the key the
lease pins for the organization, inside its validity window and with a forward-only
version (a downgrade, the same version with other bytes, or a silently dropped policy is
refused). Filter packs (`leanctx.filter-pack/v1`, `redact` and `block` rules) must be
signed by a Hive key, digest-checked and stay within 128 rules in total; the policy
runtime applies them as redaction and blocked-content rules, also when no project or
organization policy exists. The signed organization policy names the filter packs it
requires (pack, version and digest; Hive protocol 1.8): a bundle that lacks one of them
or carries another version is refused, the engine keeps the last good bundle, and
`hive status` and `lean-ctx doctor` report the policy as not compliant while local work
continues. A refused bundle never replaces the last good one. On Team
and Enterprise the organization policy is enforced by the optional LeanCTX Intelligence
runtime, installed only with explicit consent (`lean-ctx hive runtime install [--yes]`,
`[hive] runtime_consent`) and licensed by the Hive lease; without it nothing is
written and local work is never gated.
- **Agent bus across machines.** With `[hive] bus = "auto"` the daemon relays the local
agent bus (`ctx_agent post`/`read`) to the other machines of the organization
(`lean-ctx hive bus relay [--for ]` runs it in the foreground). Outgoing
messages are screened like every outbound text, replays are deduplicated, and incoming
messages pass the normal admission. `bus = "off"` keeps the bus local.
- **Hive metrics upload again.** `lean-ctx hive sync` reported "metrics not sent: unknown
field `project`": a metrics day named its project where the 3.12 contract names its `vault`.
- **`lean-ctx hive bus relay` no longer panics at start.** The build enables both rustls
crypto providers (aws-lc-rs and ring), so rustls could not pick a process default, and the
bus WebSocket's TLS client aborted with "Could not automatically determine the process-level
CryptoProvider" (without a relay no agent presence reaches Hive, so no task can be claimed).
Every lean-ctx process now installs aws-lc-rs first, the provider reqwest and the update
verifier already use; the bus connect installs it as well.
- **An agent's registered role reaches Hive.** An MCP session announces its default role at
start; a later `ctx_agent register` with another role changed it only locally, because the
relay sent a new `hello` only for a new agent or vault, so Hive refused task claims that need
that role. The relay now announces a changed role at once, and announces its agents again
every 5 minutes, which also restores presence Hive closed meanwhile.
- **Hive refuses older engines.** Hive answers requests without a compatible
`Hive-Protocol` header with `426 upgrade_required` and `Hive-Min-Engine`, and device
enrollment requires engine 3.12.0 or later; 3.12.0 sends protocol 1.8 on every request.
- **Hive transport and screening.** HTTPS only (loopback HTTP for local testing), no
redirects, bounded response bodies, `Hive-Protocol` checked. The trust chain root key →
key set → lease is re-verified on every load and leases issued in the future are
refused. Screening is the single path into the outbox: credentials (including custom
patterns), redaction rules, personal data, card and account numbers, active egress
`forbidden_patterns` and home paths drop a fact instead of rewriting it, and drops are
counted. An end-to-end test asserts that no canary secret reaches any request body.
## [3.11.4] — 2026-10-11
A bugfix release: tool calls that an agent gets almost right are now served instead of refused, edits survive indentation slips, and the Claude Code plugin wakes the agent only once per finished background job. Agent Tools protocol and data formats are unchanged.
### Fixed
- **Searching a broad directory searches the project instead of failing.** `ctx_search`, `ctx_glob` and `ctx_tree` called on `~`, `/` or another directory that contains the session's project now walk the project and say so in the first line of the result. Before, they answered "refusing to scan" and agents repeated the same call. Without a bound project the refusal now names the fix: pass the project directory as `path`.
- **Agents can read their own instruction files.** Skills, commands, sub-agent definitions, rules and plans under `~/.claude`, `~/.codex/skills` and `~/.codex/prompts`, `~/.agents/skills`, `~/.cursor`, `~/.gemini/commands` and OpenCode's `~/.config/opencode`, plus the global `CLAUDE.md`, `AGENTS.md` and `GEMINI.md`, open read-only on first use. Credentials and settings beside them, such as `~/.codex/auth.json` or `~/.claude/.credentials.json`, stay closed, and LeanCTX tools cannot write there. A skill linked in from elsewhere below `~` is followed read-only; a link into a protected location or outside `~` is not, and links inside dependency folders such as `node_modules` are never followed.
- **A missing file comes with the file that was meant.** `ctx_read`, `ctx_search`, `ctx_glob` and `ctx_tree` name the existing path when the requested one has a typo, another extension, or was written relative to the wrong directory (`src/x.rs` for `rust/src/x.rs`).
- **Paths with spaces work when written shell-style.** On macOS and Linux a path such as `My\ Project/notes.md` or `'/Users/me/My Project'` turned into `My/ Project` and was reported as missing. Backslash escapes and surrounding quotes are now removed.
- **Common argument spellings are accepted.** `file_path`, `filePath`, `file` and `filename` work as `path`, `cmd` as `command` (for MCP calls and `lean-ctx call`), a `path` inside a `ctx_search` `queries[]` entry scopes that one query, `ctx_glob` accepts `glob` for `pattern`, and `ctx_patch` `replace_all` accepts `old_string`/`new_string`. A replacement must still be named explicitly, so a missing one is never taken as "delete every match"; two spellings with different values are rejected.
- **An edit whose indentation is off still applies.** When `old_string` matches exactly one place in the file at a uniformly different indentation, `ctx_edit` and `ctx_patch` (`replace_unique`) apply it there and shift `new_string` by the same amount, and say so. Uneven or ambiguous matches still fail with the exact-match error.
- **Read modes and glob patterns with small typos work.** `lines:72:92`, `lines:72..92`, `lines 72-92` and a capitalised `Full` are read as the mode they spell; `**.rs` and `src**` are read as `**/*.rs` and `src*/**`.
- **`ctx_read` no longer fails with "per-file lock contention".** When an earlier read of the same file holds its lock for more than 10 seconds, the read proceeds without it.
- **No more "Retry the read" after LeanCTX opened a dependency folder.** When a path in a dependency cache or an agent folder is still refused after it was opened read-only, the error now gives the actual reason. `lean-ctx call` resolves these paths the same way as the MCP server.
- **The Claude Code plugin wakes the agent once per finished job.** When the agent itself had already read a finished background job with `ctx_shell` (`background_action="status"` or `"cancel"`), the plugin announced the same result again on the next turn, costing a whole extra turn.
### Changed
- **The token-saving curve in the Claude Code cockpit is drawn true to time and to scale.** The x axis now runs from the session's first lean-ctx call to now, the y axis starts at zero, the raw total sits behind "kept out" as a dim envelope, moments in which tokens were kept out are lit, and an axis line shows the session span and the gain of the last ten minutes. Before, one column per sample scaled from the window's lowest value made a single saving look like a cliff.
## [3.11.3] — 2026-10-11
PathJail opens the home directory by default, the gateway keeps downstream MCP sessions alive between calls, Windows updates and CUDA 13 GPU embeddings work, and Claude Code gets a gateway cockpit. Agent Tools protocol and data formats are unchanged.
### Changed
- **PathJail opens your whole home directory by default.** The default `path_jail_scope = home` now admits everything below `~` for reading and writing; before, it admitted only paths inside a project, read-only outside the session's project. Protected locations stay closed: every top-level dot entry (`~/.ssh`, `~/.aws`, `~/.config`, shell rc files, other agents' `~/.claude`, `~/.codex`, …), `~/Library`, `~/AppData` and `~/snap`, and everything outside `~`. The previous behaviour is the new scope `projects` (`lean-ctx config set path_jail_scope projects`), the strictest one stays `project`. A scope you set yourself is kept; `home` set explicitly now means the wider scope too. Every installation without its own setting shows a one-time notice on its next interactive command.
### Fixed
- **Windows: a second update or `enable-gpu` no longer fails** (#2048). Each update moves the running `lean-ctx.exe` aside to `lean-ctx.old.exe`. The process that does this is still running from that file, so it cannot delete it, and the next update refused to start with `stale Windows rollback binary exists`. The next update now deletes the leftover file. If an old lean-ctx process (an editor's MCP server, a daemon) still runs from it, the file is renamed aside and removed by a later update once that process has exited; only when even that rename fails does the update stop and say which process to close. `lean-ctx dev-install` uses the same cleanup.
- **`lean-ctx enable-gpu` on the CUDA build it would install says so** (#2048) instead of downloading and reinstalling the same binary. `lean-ctx enable-gpu --force` still reinstalls it.
- **GPU embeddings work with CUDA 13 runtimes** (#2049). `onnxruntime-gpu` on PyPI is built for CUDA 13 since 1.27, and `pip install "onnxruntime-gpu[cuda,cudnn]"` installs the CUDA 13 wheels, which put the DLLs into `site-packages\nvidia\cu13\bin\x86_64` (Linux: `nvidia/cu13/lib`). LeanCTX looked only for CUDA 12 libraries (`cudart64_12.dll`, `libcudart.so.12`) in the CUDA 12 wheel directories, so `lean-ctx embeddings status` reported `CUDA runtime: not loadable` although everything was installed. LeanCTX now reads which CUDA major the selected ONNX Runtime's CUDA provider was built for from the provider's import table and searches and preloads the matching CUDA 12 or CUDA 13 libraries, including the new wheel layout and `CUDA_PATH_V13_*` toolkits.
- **Windows: the CUDA check no longer fails on every machine** (#2049). The check loads `onnxruntime_providers_cuda.dll` directly; outside ONNX Runtime its initialisation refuses to run, which Windows reports as error 1114 after every dependency has already loaded (Linux reports the same case as a missing `Provider_GetHost`, which was already handled). `embeddings status` therefore said `not loadable` and indexing warned about a CPU fallback while ONNX Runtime was in fact using the GPU, and GPU-sized embedding batches were never used. Error 1114 now counts as loaded; other loader errors show their Windows error code and meaning instead of a bare `LoadLibraryExW failed`.
- **`CUDA runtime: OK` means the GPU is really used** (#2049). ONNX Runtime loads cudart and cuDNN by name only when a session starts, so a provider DLL that loads (for example through a CUDA toolkit on `PATH`) could still fall back to CPU without a word. `embeddings status` now also requires the CUDA runtime and cuDNN to resolve, preloads them before the provider is registered, and names the library that is missing otherwise.
- **Clearer CUDA diagnostics on Windows** (#2048, #2049). Instead of a bare `LoadLibraryExW failed`, `lean-ctx embeddings status` lists the missing DLLs and every directory it searched, says when no NVIDIA driver (`nvcuda.dll`) is installed, and states the CUDA major the provider needs instead of the CUDA version of the ONNX Runtime LeanCTX was compiled against.
- **ONNX Runtime and CUDA libraries from more Windows Python installs are found** (#2048): every `python.exe` on `PATH`, system-wide installs under `%ProgramFiles%\Python3*` and `C:\Python3*`, the Python install manager's `%LOCALAPPDATA%\Python\pythoncore-*` (the default for Python 3.14) and the Microsoft Store Python, in addition to the per-user installs and active virtual or conda environments.
- **`lean-ctx embeddings status` says which setting chose the embedding model** (#2049): `LEAN_CTX_EMBEDDING_MODEL` (which overrides the config), `[embedding] model` in the named `config.toml`, or the default, plus how to change it.
- **Every second gateway call no longer fails with `Transport closed`** (#2040, reported by @smollgreymouse). `ctx_tools` (find, list, call) and gateway compression addons each built their own Tokio runtime per call and dropped it afterwards. A pooled downstream MCP session's transport lives on the runtime that opened it, so the next call got a session whose connection was already gone. All gateway I/O now runs on one runtime that lives as long as the process, so a downstream server is started once and reused across calls.
- **The status line shows this conversation's numbers.** When several agents run LeanCTX in the same project, the Claude Code status line showed whichever session had written last, so its figures jumped between conversations or stood still. Each session now records the process of the AI client it serves, and the status line reads the session that belongs to its own client.
- **Polling a background shell job no longer inflates the session counts.** Every `ctx_shell` status or cancel call for a background job counted as one more tool call and one more command in the session statistics; a single long build polled by an agent could add hundreds. These polls no longer count.
Tool calls that failed although the agent's request was sound, found in the usage telemetry of 3.11.1 and 3.11.2:
- **`ctx_read` answers an empty file, an SVG and a directory.** An empty file returned `File is empty` as an error; it now reads as `: empty file (0 bytes)`. SVG files were rejected as binary; they are XML text and read like source (a real binary behind any extension is still caught by its content). A directory failed with the OS error `Is a directory`; it now lists its entries.
- **`ctx_search` searches an invalid regex literally.** Code text such as `foo(`, `items[0` or `fn run(&self` is not valid regex and failed the call; it is now searched verbatim, with a one-line note. `action=symbol` also takes the symbol name from `symbol`, `query` or `pattern` when `name` is missing.
- **`ctx_patch` infers `replace_unique`.** An edit with old and new text but no `op` failed with `missing 'op'`; such an edit can only be `replace_unique`, at the top level and inside `ops[]`.
- **An edit whose result already holds is not an error.** `ctx_edit` (and `ctx_patch` `replace_unique`) with identical old and new text, where that text is in the file, reports `No change:` instead of failing. Text that is absent still fails.
- **Dependency source reads on the first call.** Reading a file in a language cache registered the cache as a read-only root but still failed the call with "Retry the read"; it now resolves in the same call. The Rust toolchain source (`~/.rustup/toolchains`), Cargo git dependencies (`~/.cargo/git/checkouts`) and the Bun, Dart pub and Ruby gem caches are recognized alongside the existing ones. Credential and configuration directories (`~/.claude`, `~/.codex`, `~/.config`, `~/.cargo/credentials.toml`) stay jailed, and writes into any cache stay denied.
- **Usage telemetry counts each tool call once.** The daily total of tool calls and failures, and the latency histogram, counted every call twice: once where the call is dispatched and again when its lifecycle finished. The per-tool counts were already right; the totals now match them.
- **A failed inline shell command is one error, filed as a failed command.** The shell worker also recorded every non-zero exit of a command that finished in the foreground as a LeanCTX-internal error, next to the pipeline's own `command` entry, and did so even for `exit 1` with output (grep, diff, test), which is not an error. The worker now records only background jobs, as `command` or `timeout`; inline runs are classified once by the call pipeline.
- **Telemetry opt-outs and CI detection reach MCP servers started by Codex.** Codex starts MCP servers with only `HOME`, `PATH`, `USER`, `LANG` and a few more variables, so a server it started could not see `DO_NOT_TRACK=1`, `LEAN_CTX_TELEMETRY=off` or the CI markers set in the shell or job around it: an opt-out did not reach the server, and a CI job counted as a local machine. On Linux the server now also reads these few keys, and the runtime-environment markers, from its nearest ancestor processes. Nothing else from their environment is read or kept.
- **Containers under cgroup v2 report as `container`.** A container that has no `/.dockerenv` (containerd, Kubernetes, Podman) and runs under cgroup v2 reported as a local machine. Its overlay root filesystem, the `container` variable and the Kubernetes service-account directory now mark it too.
### Added
- **Notices from the LeanCTX team reach the installations they concern.** The acknowledgement of a telemetry send can carry up to three short notices, for example "the fix for this `ctx_read` failure is in 3.11.3". The server picks them by what the batch already reports (version, AI client, OS, runtime environment, a tool that failed), so nothing extra is sent and nobody needs to know who you are. A notice is shown once, on the terminal of the next interactive `lean-ctx` command, and never in an MCP response: text from a server does not reach the AI model. Only plain text up to 280 characters with an optional link to leanctx.com or the LeanCTX GitHub repository is accepted. With telemetry off, no notices arrive.
- **Usage telemetry counts MCP server starts that answered no tool call.** Some clients start every configured MCP server, often in a throwaway container, and their agent never calls a tool. Such a start is now counted as an empty session (`mcp.session.empty`, next to `mcp.session`), so these starts can be told apart from real sessions.
- **Gateway cockpit for Claude Code.** The LeanCTX plugin for Claude Code adds a sidebar that shows what passed the gateway in this conversation: which sources Claude saw and at what depth (structure, passage, full file, search, command), the two checks every delivery passed (may it be read, may it leave), the receipts, and the tokens kept out of the context. A line above the prompt pulses while LeanCTX works and shows the handoff from sources to Claude; short overlays mark a finished turn and milestones. The status line below the prompt groups the session as SELECT (files and commands), CONTROL (enforced decisions) and TOKENS (kept out, leaner, cached). It only reads LeanCTX's local session data; nothing is sent anywhere.
- **The Claude Code plugin is set up with LeanCTX.** When Claude Code is installed, `lean-ctx setup`, `lean-ctx onboard` and every update install or refresh the plugin. If you remove it with `lean-ctx claude-mod uninstall`, it stays removed until you run `lean-ctx claude-mod install`.
## [3.11.2] — 2026-10-09
Updater and security hotfix for 3.11.1. Agent Tools protocol, configuration and data formats are unchanged.
### Upgrade notes
- **Updating from 3.11.0 or 3.11.1 needs one manual step.** Their built-in updater stops after downloading and verifying a release with `Failed to complete durable update transaction: prepared transaction is missing its integrity digest`, and scheduled automatic updates fail the same way. Nothing is changed or damaged: the installed binary keeps running. Install this release once through the channel you installed with — `curl -fsSL https://leanctx.com/install.sh | sh`, `brew upgrade lean-ctx`, `npm i -g lean-ctx-bin@latest`, `cargo install lean-ctx --force` or your AUR helper — and `lean-ctx update` and automatic updates work again from then on.
- **Windows on 3.11.0** (#2039): the 3.11.0 updater also needs the external `cosign` tool and looks for it under that exact name; installing cosign does not help, because its update then stops at the error above. Extract the Windows ZIP of this release over your `lean-ctx.exe`, or update through npm. From 3.11.1 on, no external tool is needed.
### Security
- **The `home` jail scope opens projects, not your home directory.** 3.11.1 admitted every path below `~` for reading, so a prompt-injected agent could pull loose personal files (`~/Documents/taxes.pdf`, `~/Downloads`, `~/Desktop`) into the model context. A path is now admitted only when a folder between it and `~` holds a project marker (`.git`, `Cargo.toml`, `package.json`, `go.mod`, `pyproject.toml`, `Makefile`, …). Every repository below `~` stays readable; anything else needs `lean-ctx allow-path `, and the refusal says so.
- **`redirect_exclude` from an untrusted workspace is withheld (#2034).** Paths in `redirect_exclude` skip the native-read hook redirect and with it the redaction that path applies. In 3.11.1 a repository's own `.lean-ctx.toml` could extend the list even when the workspace was not trusted, so a cloned repository could opt its reads out (for example with `["**"]`) on hosts where the read redirect is active. Such a list is now ignored with a `[SECURITY]` warning until you run `lean-ctx trust`; the global config and `LEAN_CTX_HOOK_EXCLUDE` still apply.
### Fixed
- **Codex threads recorded while ChatGPT routing was on stay resumable.** Codex stamps `model_provider = "leanctx-chatgpt"` into every such thread and refuses to resume it once that provider is missing (`Model provider 'leanctx-chatgpt' not found`). `lean-ctx doctor --fix`, `proxy` runs and stale-proxy cleanup deleted the `[model_providers.leanctx-chatgpt]` block by name, including the direct one users restored by hand. Cleanup now only touches a block that targets the local proxy, and repoints it at `https://chatgpt.com/backend-api/codex` instead of deleting it; a block aimed anywhere else is kept verbatim and no longer reported as routed or broken.
- **`ctx_multi_repo action=search` without a query says so.** While a content policy was active, the call was refused with the cross-project policy message instead of `query is required for search`.
- **No downgrade as "update".** Without an explicit version, `lean-ctx update` and scheduled updates only install a release newer than the running build; a build ahead of GitHub's latest release was offered, and on a schedule installed, the older release. `lean-ctx update ` and `--pin` still install any version on purpose.
- **GitHub API rate limit** (#2037): the updater now sends `GITHUB_TOKEN`, `GH_TOKEN` or `LEAN_CTX_GITHUB_TOKEN` when set (only to api.github.com, without following redirects), raising GitHub's limit from 60 requests per hour per IP address to 5000. An exhausted quota now says so, with the reset time and the fix, instead of `http status: 403`; a rejected token reports `401 Bad credentials`. The background version check uses the same client.
- **`lean-ctx update` and `lean-ctx update --rollback` complete again.** The updater sealed each prepared transaction with its integrity digest when writing it to disk, but then executed the unsealed copy, which the integrity check rejected every time. The updater now executes exactly the sealed transaction it persisted. A new test runs the real prepare → execute → recover path on a stand-in binary.
- **macOS: the update signature is applied before the swap.** The updater re-signed the installed binary after moving it into place (#356, so the TCC grant survives), which changed its bytes after the transaction had recorded them; the update then stopped with "active binary does not match prepared target". The staged binary is now signed first, and the receipt records exactly the bytes that are installed; the release manifest and archive digests still record its provenance.
- **A reinstall no longer blocks later updates.** A failed 3.11.0/3.11.1 run leaves a prepared transaction behind; after a manual reinstall the updater refused every update with "active binary matches neither prepared state". Recovery now recognizes a transaction that a build at least as new as its target has superseded and removes its staged files without touching the binary. Likewise, an update receipt from a different, earlier version no longer refuses updates ("current binary differs from the active receipt"); the updater starts a new receipt from the running binary. A binary that differs from a receipt of the same version is still refused.
## [3.11.1] — 2026-10-09
### Highlights
- Agents can read across all your projects at once: the path jail now admits every project below your home directory for reading by default, while writes stay in the session's own project and `~/.ssh`, `~/.aws`, `~/.config`, other top-level dot directories, `~/Library`, `~/AppData` and `~/snap` stay closed.
- Each agent session binds to the project it was started in. Setup no longer pins one project into an agent's global MCP config, and existing pins are removed.
### Upgrade notes
- **Path jail scope:** the new `path_jail_scope` setting defaults to `"home"`: reads anywhere below your home directory outside the protected zones; writes only in the session's project, host-declared roots and allow entries. Set `lean-ctx config set path_jail_scope project` to keep the previous single-project boundary. The setting is global-only; a project-local `.lean-ctx.toml` cannot change it. With an implausible `$HOME` (`/`, a single path component, not owned by you) the scope falls back to `project`. `path_jail = false` still disables the jail.
- **Protected zones are a hard deny in both scopes:** a project root or allow entry that only contains a zone (for example a dotfiles repository at `~`) no longer opens `~/.ssh` and the like; add an entry inside the zone (`lean-ctx allow-path ~/.config/myapp`) if a tool must reach it.
- **Project pins:** earlier `lean-ctx setup` / `doctor --fix` runs and MCP-start hook refreshes copied the installing session's `LEAN_CTX_PROJECT_ROOT` and `LEAN_CTX_EXTRA_ROOTS` into user-global agent configs (`~/.codex/config.toml`, `~/.grok/config.toml`, global JSON MCP entries), so every later session of that agent opened the same project. The Codex and Grok entries are cleaned on the next agent refresh; `lean-ctx doctor` reports remaining pins under "Project binding" and `lean-ctx doctor --fix` removes them line by line, keeping key order and comments (a pin that shares a line with other keys is listed for a manual edit). `LEAN_CTX_EXTRA_ROOTS` values move into `extra_roots`; per-project entries in `~/.claude.json` are left alone. Restart the agent once afterwards.
- **Telemetry:** the daily aggregates report more (see Changed), and setup no longer asks: setup and the first interactive command after this update print a three-line notice instead. Turn telemetry off any time with `lean-ctx telemetry off`, `DO_NOT_TRACK=1` or `LEAN_CTX_TELEMETRY=off`; an explicit opt-out made since 3.11.0 stays in effect, and `lean-ctx telemetry show` prints the exact payload. What the server keeps, including a keyed network hash and the network operator's public name derived from the connection (never the IP address), and how long, is described at leanctx.com/privacy.
### Security
- **Agent shells can no longer loosen lean-ctx itself.** `lean-ctx` is on the default shell allowlist, so an agent could run `lean-ctx yolo --yes`, `lean-ctx allow `, `lean-ctx allow-path `, `lean-ctx trust`, `lean-ctx security open`, `lean-ctx security secrets off` or `lean-ctx config set ` through ctx_shell (or a hook-rewritten Bash call) and then do what the jail or the allowlist had just refused. Those subcommands are now blocked in agent shells with a message to ask the user; listing (`--list`, `status`, `config show`), narrowing (`--remove`) and tightening (`secure`, `untrust`, `security secrets on`) still run. Run the blocked commands in your own terminal.
- **Path jail writes:** the new `home` scope opens other projects for reading only; writes outside the session's project need an explicit `lean-ctx allow-path`, so an agent in one repository cannot plant another repository's Git hooks or a binary on your `PATH`.
### Added
- `lean-ctx allow-path ` admits one directory for reading and writing — outside your home directory, a sibling project to edit, or one protected location — effective on the next tool call without a restart. `--list` shows the jail scope and added directories; `--remove` takes one out. It refuses `/`, the home directory and any directory containing it.
- `lean-ctx security status` shows the active jail scope, and `lean-ctx doctor` reports global project pins.
### Changed
- A refused path names the one command that admits it (`lean-ctx allow-path `, offered for the enclosing project) for the user to run in their terminal. The previous hints to open a new IDE window or set an env var that the running server cannot see are gone.
- When a stale `LEAN_CTX_PROJECT_ROOT` pin is still set and the MCP server starts inside a different real project, the session binds to that project and logs a warning. Host-specific roots (`CLAUDE_PROJECT_DIR`, workspace folders) keep their precedence.
- **Telemetry reports where and how long LeanCTX runs, as coarse ranges.** The daily heartbeat adds the runtime environment (local, container, Codespaces, Gitpod, Replit, cloud agent, CI), the installation age (under an hour … 30+ days) and the number of active days in the last 30 (1 … 15+), each as a closed value. They let usage numbers separate people from short-lived agent sandboxes. No machine, account, network or path information is sent. The disclosure lists the new category, so every installation sees the one-time notice again; `DO_NOT_TRACK=1`, `LEAN_CTX_TELEMETRY=off` and `lean-ctx telemetry off` still turn telemetry off.
- **The install channel is detected.** It was `unknown` for every installation because no build set it; it now follows the location of the running executable (npm, Homebrew, cargo, PyPI, AUR, release binary). Only the channel name is sent.
- **Telemetry reports token savings and per-tool latency.** The daily tool aggregate adds the day's total tool-output tokens before and after compression, and each built-in tool's summed latency. Counts only; no content.
- **Telemetry includes the daily usage record and why tools fail.** The batch carries the last 90 days of the installation's own `lean-ctx gain` record (operations and tokens before/after compression per day, lifetime totals, month of first use), so usage through shell hooks and before telemetry is counted. Failed tool calls are reported by class (invalid input, not found, permission, policy, timeout, edit conflict, too large, unavailable), together with the five most frequent error messages per tool and day as templates: the client replaces every quoted text, path, file name, number, identifier, URL and e-mail address with a placeholder before anything is sent, and drops a message entirely when no safe wording remains. Shell commands that exit non-zero are now reported as `command` instead of `internal`.
- **Upgrades turn on telemetry that was only off by the old default.** Before 3.11 telemetry was opt-in, so `telemetry.enabled = false` without a recorded choice is re-enabled once on upgrade, and the one-time notice explains it. An opt-out made since 3.11 (`lean-ctx telemetry off`, declining in setup, and now also `lean-ctx config set telemetry.enabled false`) is recorded as explicit and never overridden; `DO_NOT_TRACK=1` and `LEAN_CTX_TELEMETRY=off` always win, and a read-only config is left untouched.
- **Telemetry counts which LeanCTX features are used.** A daily `feature_aggregate` reports how often each CLI command runs (`lean-ctx pack export` → `cli.pack.export`, `graph build`, `index build-full`, `telemetry off` …) and every graph, BM25 and semantic index build with its failures. Commands and verbs come from a fixed registry; arguments, paths and queries never become part of a code, and hot-path commands (shell hooks, `-c`, `read`, `grep`, statusline) are not counted.
- **Telemetry names 21 more AI clients.** Cline, Roo Code, Kilo Code, Continue, OpenCode, Goose, Amp, Augment, JetBrains, Warp, Trae, Qwen Code, Crush, Claude Desktop, ChatGPT, LM Studio, Copilot CLI, Visual Studio, Neovim, Emacs and Factory are reported as their own family, and `none` separates installations used only through the CLI and shell hooks from an unrecognised MCP client (`other`). The client's name is never sent, and what LeanCTX offers each client over MCP is unchanged.
- **Setup no longer asks about telemetry.** Setup and the first interactive command after an install or update show a three-line notice instead: telemetry is on, how to turn it off (`lean-ctx telemetry off`, or `enabled = false` under `[telemetry]` in the `config.toml` it names) and where to see what is sent. The full list stays on `lean-ctx telemetry on|off` and the payload on `lean-ctx telemetry show`. An earlier explicit choice is kept.
### Fixed
- **ctx_shell output capture works in your project.** Redirects and `tee` (`> build.log`, `>> notes.txt`, `| tee out.txt`) were refused everywhere except `/tmp`, `$TMPDIR` and `write_allow_paths`; the project root stayed refused even when listed, and `allow_paths` / `extra_roots` were not consulted. Capture may now also go to the session's project and the jail's allow entries. `/`, `~`, its ancestors and `read_only_roots` are never capture targets; downloads (`curl -o`, `wget`, `dd of=`) keep the scratch-only rule.
- **ctx_shell no longer relocates, queues or throttles your builds.** Three multi-agent build settings were on by default: `agents.shared_cargo_target` pointed every `cargo build`/`test` run through ctx_shell at `/build-cache/cargo-target`, so `./target` kept a stale binary; `agents.serialize_build_commands` made each build wait for builds from other sessions on the machine; `agents.cargo_build_jobs = 3` capped cargo at three jobs. All three are now opt-in (`false`, `false`, `0`) and documented in the config reference under `[agents]`. Set them again in `config.toml` if you relied on the shared cache.
- **ctx_shell walk hint judges each invocation on its own (#2027).** A scoped `grep -r … tariff` followed by a stdin-reading `grep` in the same command line (`…; echo x | grep -c x`, `| grep -v _test`) was treated as a recursive walk of the working directory, so the hint named `.claude/worktrees/`, `node_modules/` or `.venv/` although nothing entered them. Only invocations that walk (`find`, or a grep-like with its own `-r`/`-R`) now contribute search roots. With `raw: true` the hint is no longer appended, matching the verbatim promise.
- **`lean-ctx update` and `enable-gpu` no longer require a `cosign` binary.** 3.11.0 verified release signatures by running `cosign`, so on machines without it every binary update and `enable-gpu` stopped with "cosign is unavailable; refusing unsigned release". The updater now verifies the keyless signature in-process: the certificate must chain to the embedded Sigstore Fulcio root, carry a valid SCT from the Sigstore CT log, name the release workflow at the exact release tag with the GitHub Actions OIDC issuer, and sign the file. When `cosign` is installed it still runs as an additional check (Rekor transparency log). **3.11.0 installations** cannot self-update to this release unless `cosign` is on `PATH` (`winget install -e --id Sigstore.Cosign`, `brew install cosign`, or a binary from github.com/sigstore/cosign/releases); alternatively reinstall with the install script (macOS/Linux), npm, Homebrew or Cargo, or replace the binary from the release archive.
- **Semantic index builds keep their progress.** Embeddings were written only after the last chunk, and `lean-ctx index build-semantic` gave up after 10 minutes, which ended the process and discarded the work — on CPU-only machines and with larger models the index was never built. Builds now save finished files every minute and on errors, Ctrl-C or memory aborts, the next run resumes where the last one stopped, and the CLI waits until the build finishes. `index status` and `doctor` report an interrupted build as `partial` with the resume command.
- **`ctx_index` builds the semantic index in the background.** `build-semantic` and `build-full` no longer block the tool call, wait for the BM25 index instead of embedding an empty or stale one, and a per-project lock keeps two processes from building the same semantic index at once.
- **CLAUDE.md is read in full.** Automatic `ctx_read` modes (and redirected native reads) returned a large CLAUDE.md as a headings-only map, because only SKILL.md, AGENTS.md and a few rule files were treated as instructions. `CLAUDE.md`, `CLAUDE.local.md`, `GEMINI.md`, `copilot-instructions.md`, `.windsurfrules`, and documents under `.claude/agents/` and `.claude/commands/` are now always delivered complete.
- **`redirect_exclude` works again.** The key was loaded but never applied, so listing a file there changed nothing. Matching paths (globs on the trailing path components, e.g. `CLAUDE.md`, `*.json`, `docs/**`) now skip the native-read hook redirect and are returned in full by automatic `ctx_read` modes; `LEAN_CTX_HOOK_EXCLUDE` (comma-separated) takes precedence, as documented since 2.17.4.
- **`lean-ctx index build` / `build-full` no longer stop after 5 minutes** while graph and BM25 are still building, which ended the process before the index was saved. A build worker that fails unexpectedly now always releases its slot, so the command reports the failure instead of waiting.
## [3.11.0] — 2026-10-07
### Highlights
- (Preview) Context Gateway admission screens supported reads, derived stores, and supported proxy requests by default, and reports when content was not fully inspected.
- Semantic code views use language-server evidence when available, label uncertain relationships, and avoid linking same-named symbols across language families.
- The optional Claude Code mod shapes large native Bash output, wakes a turn when a watched background job finishes, and restores lean-ctx session context after compaction.
- CLI reads use the same path boundary as MCP reads, command help is side-effect free, and multi-word shell allowlist entries are scoped to their subcommand.
- Anonymous telemetry v2 reports bounded usage aggregates without prompts, source text, paths, commands, or tool arguments, with explicit opt-outs.
- Windows indexing accepts legacy UTF-16 and Windows-1252 text, and Windows CUDA embeddings report missing CUDA 12/cuDNN 9 libraries by name.
- (Preview) The Context Store links one task's plan, delivery and outcome, measures read strategies per workload, and records a learned read policy in shadow unless you opt in.
- `lean-ctx pack --limit` produces a bounded context bundle, and `lean-ctx index why` explains why a file is or is not indexed.
### Upgrade notes
- **Context Gateway (Preview):** admission is on by default. Set `LEAN_CTX_CONTEXT_GATEWAY=off` for one run, or set `context_gateway.enabled = false` in the global config to disable it persistently. The CLI `lean-ctx read` path used by shell hooks is outside gateway admission unless a policy pack is active; output redaction still applies.
- **Telemetry:** v2 is on by default. Setup now asks "Keep anonymous telemetry on? [Y/n]" and lists what is sent; answering `n` stores an explicit opt-out that every later upgrade keeps. Earlier versions did not store a declined prompt, so an installation that declined before 3.11.0 is on after the upgrade: the first interactive command shows a one-time notice with the full list, and `lean-ctx telemetry off` turns it off. Disable it any time with `DO_NOT_TRACK=1`, `LEAN_CTX_TELEMETRY=off`, or `lean-ctx telemetry off`; an earlier explicit opt-out remains in effect. CI jobs (`CI`, `GITHUB_ACTIONS`, `GITLAB_CI`, and other common CI markers) never collect or send telemetry; `LEAN_CTX_TELEMETRY_IN_CI=1` opts a non-CI machine with such a marker back in. Use `lean-ctx telemetry status|show|history|purge-local|delete-remote|reset-id` to inspect or manage its payload and ledger.
- **Indexes:** `GRAPH_ENGINE_VERSION` and graph `INDEX_VERSION` are now 7. Existing graph indexes rebuild before use; do not reuse a version 6 graph.
- **Semantic mode:** `semantic_mode = "auto"` is the default. It uses running language servers or a live IDE; it does not start servers unless `semantic_mode = "eager"` is selected in a trusted workspace. Use `semantic_mode = "off"` to disable semantic enrichment.
- **Shell allowlist:** multi-word entries now match the exact command unless they end in *. For example, use `"git status *"` for prefix matching. Set `shell_allowlist_subcommand_scoping = false` to restore the former base-binary matching.
- **Other new defaults:** `intelligence_runtime.context_policy_apply = false`. Each stdio MCP server targets `mcp_max_rss_mb = 512` (raise it, or set `LEAN_CTX_MCP_MAX_RSS_MB`, for very large indexes); `mcp_idle_exit_minutes = 0` keeps idle servers running. The `engine-context-store-v1` contract and `context-gateway-v1` vocabulary are experimental, not stable compatibility promises.
- **Claude Code mod:** the mod is installed explicitly. When active, set its `keep_hook_context` option to retain lean-ctx hook context, or `shape_native_output` to disable native Bash shaping.
- **Removed runtime paths:** automatic model routing is gone; a leftover `proxy.routing.tiers` table is ignored and reported by `lean-ctx doctor`. Rust embedders importing removed internal modules must move to `ContextEngine` or `lean-ctx-sdk`.
- **Removed shell cache:** the opt-in shell output cache was removed; legacy config files still load, but `shell_cache_enabled` no longer enables cached results.
### Security
- **lean-ctx -c and -t enforce the shell allowlist under pass-through (#2004).** An agent process can inherit LEAN_CTX_WRAPPED from a wrapped parent; lean-ctx -c then passed the command through raw and skipped the allowlist, so a command ctx_shell blocks ran through the Bash-hook rewrite. Pass-through now skips only compression; the allowlist applies on every route, with the same warn-only rule for an interactive terminal.
- **Graph summaries are admitted before indexing.** The graph index no longer stores each file's first source line verbatim; summaries pass admission, and files with secret-like paths receive no summary. The graph index version advances to 7.
- **Context Gateway admission (Preview).** Reads through ctx_read in every mode, plus its shared readers, pass built-in secret, checksum-validated PII, prompt-injection, and classification checks before caching, compression, rendering, or indexing. Search, recovery, and provider paths use admitted content as well. Redactions and withheld reads report reason codes without exposing values; blocking evaluates the original text and withholds content if a redaction leaves a detectable value behind.
- BM25/trigram indexes, dense snippets, caches, archives and their full-text index, tee/reference results, project knowledge, handoffs, and provider artifacts store admitted text only. Policy changes invalidate affected indexes and caches; recovery is rechecked under the current policy.
- The local BYOK proxy applies admission to parsed content for supported Anthropic, OpenAI Chat/Responses (including WebSocket), Gemini, and Bedrock request paths, including token-count probes. Provider-sealed fields are not rewritten. Media, malformed bodies, partial scans under max_inspected_bytes, detector timeouts, and invalid custom patterns are reported as not fully inspected; governed/sovereign modes withhold those cases. Restricted content is not sent to a remote model.
- lean-ctx inspect reports receipt-backed sources, detector coverage, and delivered/withheld outcomes. Receipts include the policy digest and returned-byte digest; tampered receipts are not displayed. context_gateway.hud = auto keeps pure-redaction counts out of the installed Claude Code status line.
- **Secret redaction covers more forms.** Detection now includes AWS session keys, fine-grained GitHub and GitLab tokens, Anthropic/OpenAI keys, JWTs, Slack/Stripe/npm tokens, private-key blocks, URL-encoded and JSON-escaped values, and secrets split by zero-width or full-width characters. UUIDs and already-masked values are left intact. MCP resources, prompts, lean-ctx call, the agent-tools CLI, and the embed crate use the same output-redaction path.
- **Recovery handles are verified before use.** Tee, archive, reference-store, and context-ledger handles are checked for resolution, expiry, digest match, and path escape without exposing content; policy refusals are reported as unavailable to the model rather than as broken handles.
- **CLI reads and shell allowlists enforce their stated boundaries (#1901, #1903, #1906, #1419, #1930).**
- lean-ctx read uses the MCP ctx_read PathJail and secret-path rules. Broad roots are refused unless path_jail = false; relative paths resolve from the current directory. Shell rewrites leave refused reads on the native command, and worktrees under .claude/worktrees are treated as projects.
- lean-ctx COMMAND --help prints help without running the command; only handlers with verified side-effect-free help receive the flag. upgrade --check only checks.
- Multi-word allowlist entries such as "git status" match that command only; add a trailing * for a prefix. Binary-specific entries take precedence over project-root auto-allow. lean-ctx doctor reports entries whose meaning changed or is shadowed; the compatibility switch is trust-gated.
- PowerShell statements are split and checked at their executable commands, including conditions, expressions, and script-block bodies. Only read-only .NET members count as inert; file writers, process starters, and compilers remain blocked. Under bash or zsh, operators and script blocks keep their native meaning; only single inert operands are treated as inert PowerShell.
### Added
- `mcp_idle_exit_minutes` (`LEAN_CTX_MCP_IDLE_EXIT_MINUTES`, default `0` =
off) ends a stdio MCP server after that many idle minutes. It is opt-in
because Codex does not restart exited MCP servers. stdin EOF and a dead
parent already end the server.
- **Gateway proof registry and source planning.** A proof registry maps admission cases and bypass checks to their tests, and the release gate can refuse while a proof entry is open. engine context-plan-sources omits caller-supplied sources unrelated to the task even when budget remains; it drops stop words, splits identifiers, and keeps sources related by task terms. lean-ctx inspect shows receipt-derived redaction, withholding, and source-use facts. A local claims catalog records what the release can say and what it does not claim.
- **Per-host gateway coverage.** lean-ctx doctor reports whether each configured host is enforced, partial, MCP-only/not observable, or unsupported; partial means lean-ctx tools and rewritten shell commands are covered while host-native file tools can bypass admission, and not_observable means MCP-only. lean-ctx inspect shows the same coverage. The generated matrix does not claim observation without an integration that provides it. Claude Code traffic is enforced only with an Anthropic API key; Pro/Max sign-in cannot be proxied. Credential-forwarding journeys for Claude Code /v1/messages and Codex subscription /backend-api/codex/responses show a tool-result credential withheld while the rest of the turn proceeds.
- **Claude Code mod (#1981, #1986, #1989, #1991, #1997, #1998).** lean-ctx claude-mod install|status|uninstall manages an embedded local plugin for Claude Code 2.1.287 or later; interactive setup offers installation, while non-interactive setup and update only refresh an existing install. MCP is marked always-load, and the mod shapes native Bash output of at least 2,000 characters with fail-open behavior. The shell deny lets Bash(run_in_background) through only when the exact command passes the enforced allowlist; ctx_shape remains an internal hook rather than a listed tool.
- A configurable set of tool descriptions is front-loaded while the rest is deferred. A watched ctx_shell background job wakes the model once instead of requiring status polling; the mod also answers a bare sleep N while a job is watched.
- SessionStart/UserPromptSubmit attachments authored by lean-ctx are removed to avoid repeating the same guidance; other hooks and non-lean-ctx text pass through. Use keep_hook_context to opt out. /leanctx shows session-only request, token, ToolSearch, wake, and dropped-context counts; it does not persist them or send telemetry.
- Before main-conversation compaction, the mod saves session state and asks the summarizer to keep recovery handles and still-reporting job IDs. The first following prompt carries that state once; user compaction instructions and subagent compactions are preserved. Plugin versions include a content hash, and doctor recognizes Claude Code's normalized cache directory name.
- **Semantic code intelligence (#1976, #1979, #1983, #1990, #1996).** Tree-sitter remains the baseline; semantic_mode = auto uses an already-running language server or live IDE to verify uncertain structure, with bounded background refreshes that do not interrupt a backend call. Call edges carry evidence and are shown as verified, resolved, or heuristic; ambiguous callees do not bind to the alphabetically first match. Per-language capability status appears in ctx_graph status and lean-ctx doctor.
- ctx_impact propagates exact and weaker name-match paths separately. ctx_repomap uses verified graph call edges or caller-scope resolution, and an ambiguous name or vetoed guess does not become a link. Calls are bound within the caller's language family.
- implements and extends relations are collected where a backend offers them; references are checked on demand by ctx_impact rather than stored as graph edges. TypeScript 7 projects use tsc --lsp --stdio; older projects use typescript-language-server.
- A VS Code/Cursor/Windsurf extension bridges the editor's existing language features through a per-workspace, token-protected, read-only local navigation endpoint. It does not edit files, start servers, or displace a live server or IDE.
- **Context Store (Preview; experimental contract `engine-context-store-v1`).** One task's plan → delivery → outcome lineage, joined from the execution ledger and Decision Receipts and scoped per tenant/project, is shown by `lean-ctx inspect --task` and `lean-ctx engine context-lineage`; missing links are listed as gaps rather than filled in.
- Read-strategy evidence per workload: quality, security (deliveries without full inspection) and runtime friction (re-reads, expansions, failed edits after a compressed read) are measured per task, and anything unmeasured is reported as unmeasured. Available through `lean-ctx autopilot evidence`, `lean-ctx engine context-policy-evidence` and `lean-ctx eval frontier --save-evidence`.
- `lean-ctx autopilot policy status|promote|monitor|rollback` keeps a promoted read-strategy policy (active plus last stable) supplied by the optional licensed runtime. Planning records it in shadow only; `intelligence_runtime.context_policy_apply = true` applies it, and security rules and explicit user choices still take precedence.
- The context kernel also draws on the BM25 search index and the code graph; it never builds or refreshes an index while planning. Surprise, graph proximity and redundancy are measured from the candidate set.
- **lean-ctx pack --limit (#1885).** Writes a deterministic, self-contained XML bundle under a hard character or token cap, ranking files by the task and import graph. It can include current curated knowledge, with that material counted inside the cap; secret-bearing files and secret-like paths are withheld. Emit modes, output files, clipboard, stats, include/ignore globs, and ctx_pack action=bundle are supported. Exit 1 means even the frame could not fit; exit 2 means invalid flags.
- **Browser OAuth for HTTP MCP servers (#1391).** `lean-ctx addon auth NAME` supports OAuth 2.1 discovery, registration, PKCE, loopback redirect, token attachment, and refresh; --status, --logout, and --no-browser are available. Credentials are encrypted per server using the macOS Keychain, Windows Credential Manager, or a Linux 0600 key file. OAuth declarations on stdio servers or alongside an Authorization header are refused.
- **`lean-ctx index why FILE`.** Explains which indexing rule included or excluded a file, reports encoding and BM25 chunk/freshness information for eligible files, supports --json, and exits 1 for an excluded file. MCP: `ctx_index action=why path=FILE`.
- **Windows CUDA embeddings.** The x86_64 Windows CUDA build is installed and retained by enable-gpu and update. CUDA 12/cuDNN 9 libraries can be loaded from installed pip wheels, the CUDA Toolkit, or the cuDNN installer without changing PATH; CPU-fallback diagnostics name missing DLLs and explain that CUDA 13 alone does not provide CUDA 12 DLLs.
- **Clearer ONNX Runtime setup diagnostics.** ORT_DYLIB_PATH errors identify whether the variable is absent or malformed and explain process versus MCP configuration scope. Hints identify JSON control characters, quotes, and unexpanded %VAR%, $VAR, or ~ values. lean-ctx embeddings status reports the selected runtime, version check, and execution-provider policy, with platform-specific setup guidance.
### Changed
- **Bounded memory for long-lived MCP servers.** Each stdio MCP server now
has a per-process RSS target, `mcp_max_rss_mb` (default 512 MB,
`LEAN_CTX_MCP_MAX_RSS_MB`). The guardian uses the lower of it and
`max_ram_percent`, which on large machines was several GB per process. A
Codex app-server that keeps one server per loaded thread therefore no longer
accumulates ~1 GB instances.
- **Idle MCP servers release their caches.** After the `memory_cleanup` TTL
without a tool call, a server drops its read cache and resident indexes
without waiting for the next call. A running call or background job keeps
it busy. The release logs process memory and live heap before and after.
- **macOS: the memory guard measures physical footprint.** It now uses the
figure Activity Monitor shows instead of resident size, which leaves out
pages the memory compressor has taken. An idle server measured 40 MB
resident while still holding a ~180 MB heap. Footprint is read through
`proc_pid_rusage`, which also replaces a `ps` spawn per sample.
- **Quieter, cheaper guardian.** Eviction rounds that reclaim nothing back off
(1 s → 60 s, then a five-minute pause) at every pressure level, not only
Critical. Sampling stays at one second, so a rise to a higher level still
evicts at once. Pressure lines log on a level change and at most once a
minute after that; a baseline above a small cap used to log every second.
- **Bundled MCP SDK 1.32.1 in the pi extension (#2017).** `@modelcontextprotocol/sdk` 1.30.0 → 1.32.1, `proxy-addr` 2.0.8 and `source-map-js` 1.2.2; THIRD_PARTY_NOTICES and the asset manifest record the new versions and digests.
- **One capability registry.** Capability IDs remain stable lookup names, while one registry determines which capabilities are backed by the local source tree and how their availability is described.
- **Local use remains accountless.** Signing in alone no longer enables shared agent-presence or lease paths; a single developer's local Runtime remains available without an account.
- **Quality evidence reports its limits (#1905).** Eval/A-B/footprint/frontier reports label runs with fewer than 30 paired tasks or without bootstrap as underpowered; --gate fails those runs. --mechanism is for small wiring fixtures, fails only on regression, and cannot support a quality claim. Non-regression is reported as NON-INFERIOR, and schema v2 reports evidence tiers from mechanism through production; fixture recordings are mechanism evidence only. Shadow reports identify their baseline as simulated and describe outcome acceptance relative to that baseline.
- Footprint pruning requires powered real-model evidence. --export and --compare evaluate the same tasks against a baseline. eval frontier compares strategies against one baseline and guards against leaking gold answers into task metadata.
- **quality-lab** uses representation_grade, which describes representation fidelity rather than task quality. Its receipt reports retention, recovery, security, and task-quality dimensions, with unmeasured dimensions shown as UNMEASURED; --gate also fails when a critical fact is lost. quality_floor and max_context_tokens remain offline-only; other profile constraint fields are not read.
- **Prompt-cache requests stay stable (#1912).** Complexity-driven thinking blocks stay consistent across turns, are capped at half of max_tokens, and respect the client's OpenAI reasoning_effort; requests with max_tokens below 2048 do not receive an injected block. Unchanged or reverted proxy requests forward the client's original bytes, and rewritten gzip/zstd bodies are re-encoded. A warm conversation does not alternate between compressed and uncompressed system prompts.
- **Anonymous telemetry v2 is on by default.** The former opt-in heartbeat is replaced by a typed batch. It sends version, platform, a random installation ID, client family, integration/embedding state, bounded daily built-in-tool call/failure counts, and coarse session/sync/error aggregates; tool calls are now counted in production. It never sends prompts, code, file contents, paths, commands, tool arguments, or foreign MCP tool names. Counters are per UTC day; resends replace daily totals. An unreadable config fails closed and prior opt-outs remain effective. Setup, `telemetry on` and a one-time notice on the first interactive command show the same list of what is sent; a declined setup prompt is stored as an explicit opt-out; CI jobs never collect or send.
- **Agent registration records presence without a session cap (#1765).** New sessions keep their explicit role and available tools regardless of how many other sessions are present. Build and test commands remain serialized where they run; cargo_build_jobs and shared_cargo_target still apply. agents.max_concurrent_mutating_workers remains readable for compatibility but is no longer used.
- **Public copy is consistent across shipped surfaces (#1987).** README, current documentation, package descriptions, help, and skill templates now use one product category and state implementation and evidence boundaries consistently. Measurement documentation distinguishes local hash-chain integrity from an explicitly signed batch export and describes what each comparison measures.
- **Compression holdout is available as an opt-in measurement (#1977).** proxy.compression_holdout / LEAN_CTX_PROXY_COMPRESSION_HOLDOUT defaults to 0; a deterministic conversation cohort forwards the control arm without input compression and records token counts for both arms. The report is pending until each arm has 30 turns, then reports a reduction with a Welch 95% interval. Quality remains unknown in every state, and the holdout does not change thresholds or policy.
### Removed
- **Automatic model routing.** Intent-tier selection, routing-quality fallback, Thompson-sampling feedback, the OCLA ModelRouter, built-in router registry/API/health entries, routing evals, experiment arms, and routing savings are removed. A released runtime package can still be recognized, but its model-ranking capability is not invoked. Existing routing ledger events and previously recorded history remain readable/exportable; operator-written aliases, outbound allow/deny policy, model ceilings, budgets, rate limits, and reasoning budgets remain. A stale proxy.routing.tiers table is ignored and reported by lean-ctx doctor.
- **Unused modules and unsupported proof claims (#1914, #1915, #1923).** Uncalled internals were removed, including core::solution_rules, predictive_prefetch, multiscale_index, context_column, adaptive_chunking, cognitive_load, graph_features, progressive_compression, structural_diff, structural_tokenizer, adaptive_compression, agent_attribution, cache_diagnostics, chain_compression, content_handle, cross_customer_learning, delta_response, evidence_classification, evidence_flow, fleet_analytics, json_sample, negative_knowledge, query_aware, rule_scorer, session_budget, token_calibration, the unused context-kernel feedback, learning and attribution modules, the marginal-information gate, attention placement, MDL selector, gamma cover, predictive-coding deltas, attention-weighted context assembly, U-curve attention model, semantic chunk reorder, and io_boundary::read_file_scanned.
- The execution ledger and work graph are kept: they back the Context Store lineage and Decision Receipts.
- No CLI command, MCP tool, configuration key, or contract was removed by these module deletions. Rust embedders that imported the internal paths must drop those imports; core::solution_types and the OCP export adapter remain. The supported embedding surfaces are ContextEngine and lean-ctx-sdk.
- ctx_verify action=proof no longer reports Lean4 or FormallyVerified; its highest level is PolicyChecked. Empty BM25 indexes report empty, and graph metadata-file size is no longer presented as graph-index size. review no longer sets the no-op layout.enabled; no layout driver or regulated role is available, and regulated redaction belongs to policy-pack filters. Documentation and source comments no longer claim cognitive-mode savings or Jira access without evidence.
- **Opt-in shell result cache (#1982).** Cached shell results are removed because command output depends on workspace state outside the old cache key; old config files still load.
### Fixed
- **Parallel reads no longer time out on file locks (#2016).** Every completed ctx_read persists its ledger entry before it is acknowledged; 16 parallel reads on Windows queued past the 750 ms lock wait and failed with a misleading "agent registry lock" error. Ledger persistence now waits up to 10 s, lock errors name the lock file, and concurrent first tool calls register the session's bus presence once instead of racing.
- **Runtime install no longer reports Busy for a lock it just released (#2019).** A child process forked by another thread briefly shares the install and configuration locks; install now retries for up to 2 s before reporting Busy.
- **ctx_read honours the documented bare multi-select (#2000).** mode="3,7-9" selects those lines like lines:3,7-9 instead of falling through to a full read; malformed comma payloads still reach the unknown-mode path.
- **Control flow inside a shell function body passes the allowlist (#2002).** A function body is expanded like a top-level line, so for, if, while and case are control flow and only the commands inside them are checked; the block message no longer contains a stray run of spaces.
- **A heredoc after a multi-line quoted string is recognised (#2003).** The heredoc scanner keeps the quote state across lines, so `echo "a⏎b"; cat <<'EOF'` no longer gates the heredoc body as commands; an apostrophe in a comment cannot hide a later heredoc.
- **A directory override never touches the real install (#2007).** With LEAN_CTX_CONFIG_DIR, LEAN_CTX_DATA_DIR, LEAN_CTX_STATE_DIR or LEAN_CTX_CACHE_DIR set, startup layout healing no longer moves the default ~/.lean-ctx or XDG config files or writes the layout pin; previously a scratch run renamed the real ~/.lean-ctx/config.toml to config.toml.superseded.
- **MCP startup no longer waits on recently used files (#2006).** Collecting the cache-warming history resolved every recently touched file synchronously before the server answered initialize; with the project on a network drive that took 95-150 s. It now runs on the warming thread before that thread takes the cache lock, and each session's project root is resolved once instead of once per file. Daily background housekeeping removes orphaned session save locks and prunes stores above 300 sessions by session_retention_days (at least 1 day; the newest session per project and the latest pointer are kept).
- **ctx_expand(id=) works without a status poll (#2005).** A finished background job is archived on expand; a running job is reported as still running and an unknown ID as nonexistent, instead of "unavailable or expired" for all three.
- **gain no longer presents an estimate as a bill saving.** When the provider request path is not observed, lean-ctx gain reports provider bill impact as unknown, labels gross tool-output savings as a local estimate, and leaves ROI unavailable. ctx_gain exposes the evidence type, provider-path observability, and null net bill impact when it cannot be observed.
- **Other gateways keep their endpoint (#1972).** Install, uninstall, cleanup, doctor, and supported host wiring treat only configured, UID-derived, or historical lean-ctx ports as lean-ctx endpoints. Other local or remote URLs are preserved unless --force is used; Codex no longer receives a duplicate base URL.
- **lean-ctx-status reflects OFF (#1971).** Bash, zsh, and fish read the value of LEAN_CTX_ENABLED; the command exits 0 for ON and 1 for OFF/DISABLED.
- **Raw tail windows stay bounded (#1965).** mode=-N, raw=true returns the requested final lines verbatim, like lines:-N, rather than the whole file.
- **Package upgrades refresh stale shell hooks (#1959).** On MCP server start, existing stale hook files are refreshed without rewriting shell rc files; disabled hooks are skipped, and present env.sh and _lc PATH shims are refreshed with bash/zsh hooks.
- **Background maintenance preserves config edits (#1934).** It writes only timestamps it changed and writes nothing when none changed, so concurrent config set or editor changes are not overwritten. Test configuration is passed directly instead of leaking through process-wide state.
- **Read stubs are only reused by the caller that received them (#1904, #1909).** Delivery IDs are per process rather than shared across Claude Code processes. A content-free “already in your context” stub is returned only when delivery to that conversation is known; Claude Code subagent re-reads return compressed content. Relayed content must match the requested view. LEAN_CTX_SCOPE opts back in for integrations that run one agent per process.
- **Compressed reads do not expand output or silently lose facts (#1910, #1911).** Auto mode falls back to bare file content when a mode cannot shrink it; explicit modes keep their notice. Over-budget reads name the truncation and raw=true. Cache entries distinguish auto from explicit modes. Entropy filtering is deterministic and uses file-relative thresholds; higher aggressiveness drops more. Terse shell/tool output falls back when compression would lose critical status, error, count, or location facts. Proxy CCR handles resolve in ctx_expand, map exports preserve nested Rust generics, and repeated edit failures escalate to full mode.
- **The agent surface reports callable operations (#1913).** Agent cards list tools that are available through the public tool endpoints, authentication descriptions match enforced /a2a checks, and task cancellation is limited to the caller's own task. Agent action schemas follow the dispatcher's actions; the inactive OclaBus no-op was removed.
- **Windows timeouts stop child processes (#1920).** ctx_shell, ctx_execute, and sandbox commands run in a private job object, so timeout, cancellation, or an unexpected lean-ctx exit ends the process tree. Deliberately started background processes still survive a normally completed command, as on Unix.
- **Integration tests use an isolated data directory.** The cargo test --test main binary uses a per-process temporary data directory unless LEAN_CTX_DATA_DIR is set, and clears ambient agent-scope variables.
- **Hook rewrites preserve visible content (#1916, #1917, #1918).** Read dedup is per agent; a named file can be searched up to 64 MB, skipped files and timeouts are reported, and lean-ctx grep exits 2 when the search was incomplete or errored. Unquoted shell globs are expanded by the shell before a whole-command rewrite; quoted patterns keep the direct rewrite.
- **Parallel first reads no longer fail on cache contention.** Tokenizer and path-protection config load before the cache lock; if a read cannot obtain the lock in time, its content is returned without caching.
- **Legacy Windows text encodings are indexed.** UTF-16 LE/BE, UTF-8 with or without a BOM, lossy UTF-8, and Windows-1252 are decoded with line numbers preserved. NUL-byte binary detection no longer rejects UTF-16 text; run lean-ctx index build once to add affected files.
- **Pip ONNX Runtime libraries are found.** lean-ctx locates onnxruntime and onnxruntime-gpu libraries in active environments, PYTHONPATH, user sites, and system sites without running an interpreter. ORT_DYLIB_PATH accepts a containing directory, and versioned library names are recognized.
- **Write refusals, batch reads, and zero-hit search are precise (#1995; fixes #1992, #1993, #1994).** Redirect/tee/heredoc/download refusals explain the read-before-write path and are unchanged by smaller commands or raw=true. Batch ctx_read appends kernel enrichment once after the summary and never in raw mode; supplements stop on line boundaries, and out-of-project episodes are not offered. ctx_search zero-hit output reports its scanned scope, index-pruned files count as covered, empty scopes explain why, and comma-separated include values are glob lists.
- **Wide project source directories are valid scan roots (#1985; tracked in #1984).** A broad directory inside a marked project can be searched using its ancestor project marker; directories without a marker in their ancestry remain protected.
- **Shell and proxy outputs are not replayed from stale state (#1982).** Shell commands run again against current workspace state. Proxy dedup is stateless across requests and replaces output only with a same-request reference or reconstructable line delta; the newest two outputs remain verbatim, outputs without a tool-call ID are not referenced, and dedup runs after compression.
## [3.10.5] — 2026-09-27
### Fixed — MCP configs survive package-manager updates
- Scoop, Homebrew, npm and mise run lean-ctx from a versioned directory that
the next update removes. `setup`, `init`, `doctor --fix` and `wrap` wrote
that directory into every agent's MCP `command` and hooks, so after an
update the agent pointed at a deleted binary (#1873). They now write the
stable launcher on `PATH` (the Scoop shim, the Homebrew symlink), as the
shell hooks already did since #1851. `lean-ctx doctor` reports an old
versioned path as drift, and `lean-ctx doctor --fix` rewrites it.
### Fixed — `ctx_search query=` searches the session's project
- With `project_root` pinned in `config.toml` (or `LEAN_CTX_PROJECT_ROOT`),
the BM25 form of `ctx_search` (`query=`, `action=semantic`, and the
"Ranked files" section of `ctx_compose`) searched the pinned project's
corpus from any session, while `action=regex` and `action=symbol` searched
the session's own project (#1875). A pinned root now applies only to paths
inside it. The result header names the root it searched
(`… from 1994 indexed chunks in /path/to/project`).
### Fixed — concurrent identical `ctx_shell` calls all get their answer
- Two or more identical foreground `ctx_shell` calls issued at once share one
job. The first to finish removed it, so the others waited until their soft
cap and returned "detached" with a job id that no longer existed (#1876).
The job is now removed only after every waiting call has read it, and never
while a background caller can still poll it by id. A call that arrives
after the shared job finished but before its result was read joins that
result instead of replacing the entry, which lost the answer for fast
commands such as `true`.
### Fixed — warn-only shell findings no longer read as a block
- With `shell_security = "warn"`, a command outside the allowlist runs, but
the log line was the enforce-mode block message ("BLOCKED — DO NOT RETRY
… permanent restriction") at WARN level (#1874). It is now logged at INFO
as `warn-only: … it ran ()`.
### Fixed — `lean-ctx serve --help` prints real line breaks
- The option list printed literal `\n\` sequences on one line. It is now one
option per line.
## [3.10.4] — 2026-09-26
### Fixed — `lean-ctx update --help` no longer installs an update
- `lean-ctx update --help` (and `-h`, and the same flags on `enable-gpu`)
now print the command's options. Before, the flag was ignored and the
command downloaded and installed the latest release.
- An unknown option, for example a typo like `--chek`, is refused with exit
code 2 instead of running an update. `--force` and `--rewire` are still
accepted, and still have no effect, because older instructions mention them.
### Fixed — the value status line now reaches existing Claude Code installs
- 3.10.3 added lean-ctx's status line (`◆ lean-ctx −13.1K tok`) to Claude
Code, but it was only written by `lean-ctx init --agent claude`. Installs
that were updated, or set up with `lean-ctx setup`, never got it. The hook
refresh that runs on update and when the MCP server starts now sets it too.
A status line of your own is never replaced. To switch the status line off,
set `[value_display] mode = "off"`.
- A `"statusLine": null` entry in Claude's `settings.json` is now replaced.
Before, lean-ctx reported the status line as set but wrote nothing.
- Turn recaps now appear in a normal session: every 5 turns when the window
saved at least 10K tokens (was every 10 turns and 50K, which most sessions
never reached). A security event still always gets a recap. Existing
`recap_every_turns` / `recap_min_tokens` settings are kept.
### Fixed — OpenCode, Windows paths and allowlist noise
- OpenCode: shadow mode now sets `read`, `grep`, `glob` and `bash` to `"ask"`
instead of `"deny"` in `opencode.json` (#1864). OpenCode removes a denied
tool from the request, and the OpenCode Zen free tier refuses requests
without `bash` and `read` with a 403. `lean-ctx setup` rewrites the
`"deny"` entries older releases wrote; uninstall removes both values.
- The rewritten `lean-ctx read`/`grep`/`ls` commands now quote the lean-ctx
path. Before, a binary under a path with a space, such as
`C:\Program Files\...`, was split by the shell and the command failed with
exit 127 (#1865).
- Warn-only allowlist findings (command substitution, pipe into an
interpreter) are logged at `info` instead of `warn`, so they no longer show
up on stderr of every command. Log output carries ANSI colour codes only
when stderr is a terminal (#1866).
- `git --version | head -1; python --version` is no longer reported as a pipe
into a bare interpreter. Only the command that actually receives the pipe is
checked (#1867).
### Fixed — `ctx_shell` can no longer suspend the agent in your terminal
- A command run through `ctx_shell` now starts in its own session without a
controlling terminal. Before, an interactive shell somewhere below it (a
test suite that runs `zsh -i` or `bash -i`, for example) took over the
terminal, and the terminal stopped Claude Code: zsh printed
`suspended (tty input) claude` and the terminal was left in mouse mode.
Commands that need a terminal now fail right away instead of freezing
the agent.
- lean-ctx's own prompt-integration tests no longer take over the terminal
when `cargo test` runs in one.
## [3.10.3] — 2026-09-25
### Added — `lean-ctx value`: what lean-ctx did, with proof
- `lean-ctx value` shows the tokens kept out of the model's context and the
security events of the current session. `--session ` picks another
session, `--all` covers every session, and `--json` prints the result as
JSON. The numbers do not come from the display counters. They are
recomputed from the hash-chained savings ledger and the signed audit trail.
Both chains are checked from their first entry, and the output names the
first and last entry hash each number rests on. When a chain is broken, the
numbers are marked as not proven and the command exits 1.
- Ledger events now include the session id in their hash (canonical v7), so
a session's savings can be proven on their own. Entries written as v1–v6
still verify.
- Protections that fire by default now leave a signed audit-trail entry:
- a secret redacted from tool output (counted once, on the output that
reaches the model)
- a shell command blocked by the allowlist
- a path refused by the project jail
The entry records the kind, the count and the session.
- New `[value_display]` config section (`mode = off | minimal | milestones |
verbose`, default `minimal`, env `LEAN_CTX_VALUE_DISPLAY`). It controls the
value surfaces added in later changes. The proof chains are written
regardless of the mode.
### Added — Claude Code shows what lean-ctx did, outside the model's context
- **Status line.** `lean-ctx statusline` prints one dim line for Claude Code's
`statusLine`, for example `◆ lean-ctx −1.2M tok · 41 cached · ⛨ 3` (⛨ counts
security events). It reads the snapshot of the project Claude Code is
working in. It prints nothing when nothing was measured yet, when the
numbers are older than 12 hours, or when they belong to an earlier
conversation. `init --agent claude` sets it only when there is no status
line yet, or when the existing one is already lean-ctx's. If you have your
own status line, it stays untouched and `init` prints the command that
chains it: `lean-ctx statusline --wrap ''`. The wrapped
command gets the same input, and lean-ctx's segment is appended to its
first line. Uninstall gives your wrapped command back and removes only
lean-ctx's own entry.
- **Turn recap.** Every 10 turns (`recap_every_turns`), the Stop hook shows a
one-line `systemMessage` such as `◆ lean-ctx · last 10 turns: −312.0K
tokens`, but only when at least 50,000 tokens were saved
(`recap_min_tokens`) or a security event happened. A quiet window keeps
growing until it is worth a line.
- **Session recap and weekly digest.** On a fresh start, SessionStart shows
the last session once, with its share of tool input
(`◆ lean-ctx · last session (62% of tool input): −1.4M tokens`). Once a
week it shows a digest of all sessions instead. Nothing is shown on
resume, compact or clear.
- These lines are `systemMessage` and status-line output. They never reach
the model's context. The SessionStart rules and the recap are written as a
single JSON object, because a host reads only one per hook. Hosts that do
not show `systemMessage` (Codex, Cursor) get no recap. `mode = off` turns
all of it off, and `lean-ctx value` proves every number.
### Added — what lean-ctx did, in your prompt, your desktop and your commits
- **Prompt segment.** `lean-ctx init --prompt` adds a dim segment such as
`◆ −1.2M tok ⛨ 3` for the project you are in. It goes on the right in zsh
and fish, and in front of `PS1` in bash. The segment has its own rc block,
your prompt stays as it is, and `init --prompt off` or `lean-ctx uninstall`
removes it. Under Starship, `init` prints a `custom` module instead of
editing rc files. `lean-ctx prompt-segment --shell plain` serves any other
prompt engine. It reads one small snapshot file and prints nothing when
there is nothing current to show.
- **Milestone notifications** with `mode = milestones`: a desktop notification
the first time you reach 1M/10M/100M/1B tokens kept out of context, the
first secret kept out of context, the first risky command blocked, or a
7/30/100-day streak.
- At most one a day, and of a ladder only the highest new rung is shown.
- Milestones are computed from the verified chains. A chain that fails
verification triggers none.
- Every notification ends with `Proof: lean-ctx value --all`.
- They use `osascript`, `notify-send` or a Windows toast, with no new
dependency. The text is passed as arguments, never as script.
- **Commit trailer.** `lean-ctx init --git-trailer` installs a
`prepare-commit-msg` hook that adds `lean-ctx: 840.0K tokens saved, 1 secret
kept out of context` to a commit message.
- It counts only what happened in this project since the last trailered
commit.
- It skips merges, squashes and amends.
- It can never fail a commit, and it leaves an existing hook untouched
(printing the line to add instead).
- **Wrapped security section.** `gain --wrapped` and its compact form list the
period's security events, re-counted from the audit trail. They appear only
when the trail verifies.
- The guide [Seeing what lean-ctx did](docs/guides/value-display.md) covers
every surface, including Starship and Powerlevel10k.
### Added — `lean-ctx prove speed`: a signed measurement instead of a speed claim
- `lean-ctx prove speed --suite ` asks your model each task of an eval
suite twice per run: once with a raw context dump, once with lean-ctx's
context, both within the same token budget (`--budget`, default 4000). It
needs a live, OpenAI-compatible endpoint (`LEAN_CTX_EVAL_MODEL_URL`,
`LEAN_CTX_EVAL_MODEL`, optional `LEAN_CTX_EVAL_MODEL_KEY`), local Ollama
included. Recorded responses are refused, since they have no latency.
- The measurement is built to be fair: one warm-up request is not counted, the
arm that goes first alternates per task and round, and each arm's latency is
the median of `--runs` rounds (default 3). Every answer is scored, so a
faster but worse result is reported as worse.
- The result is a signed proof (`/value/speed/`, `--out` for a
copy, `--json` to print it). `prove speed --verify [FILE]` re-checks the
signature and recomputes the summary from the raw timings. A modified proof
prints `TAMPERED` and exits 1.
- `gain --wrapped` quotes your latest proof (`% faster model answers with
lean-ctx`, with date, tasks, runs and model) only when it verifies and
lean-ctx was faster without answering fewer tasks correctly. The figure
describes your suite, model and machine, not lean-ctx in general. No
surface estimates speed from live sessions.
### Added — what lean-ctx did, in your editor and in signed savings batches
- **VS Code, Cursor and Windsurf extension** (`packages/vscode-lean-ctx`,
source only in this release; it is not yet published to an extension
registry): one quiet status bar item for the open project, for example
`◆ −1.2M tok ⛨ 3`.
- Hovering it shows the breakdown, each line labelled `✓` (counted) or `≈`
(derived), plus the verified speed proof if you have one.
- Clicking it runs `lean-ctx value`.
- It is hidden when nothing was measured, the numbers are stale, or
`mode = off` is set.
- The extension computes nothing itself and never writes to the model's
context.
- `lean-ctx prompt-segment --json [--dir PATH]` prints the segment, the
labelled breakdown, the speed proof, the directory to watch and the verify
command as a stable JSON contract (`schema: 1`) for editor status bars.
- **Local Protection view:** the Protection page that `lean-ctx dashboard`
serves on your machine opens with **Guards that fired**.
- It shows the lifetime counts of secrets kept out of context, risky
commands blocked, paths outside the project blocked, and prompt-injection
patterns flagged.
- Every count is re-derived from the local audit trail, the same as
`lean-ctx value --all`.
- It shows whether the trail is intact, or where the chain breaks.
- **Signed savings batches:** a signed savings batch now carries a separately
signed security tally.
- The tally holds the counts, the audit trail's entry count, and its first
and last hash.
- It is bound to the batch's last entry hash, so a copied or edited tally
fails `lean-ctx savings verify-batch`, which lists it.
- The batch's own signature is unchanged, so a verifier that does not read
the tally keeps verifying batches as before.
### Fixed — the `savings_footer` default is documented as `never`
- The config schema and reference said `savings_footer` defaults to `always`.
The real default has always been `never`, so no footer tokens are added to
tool output unless you turn it on.
### Fixed — `init --help` prints help, and the rules name only tools the agent has (#1849)
- `lean-ctx init --help` (and `-h`) ran a full `init` instead of printing the
help text, so a user checking the options rewrote their shell and agent
configuration. Both flags now print the usage and change nothing.
- The session instructions and the injected rules files listed tools that
`tools/list` hides. With `disabled_tools = ["ctx_callgraph"]` the agent was
still told to use `ctx_callgraph`. With `prefer_native_editor`, or on a
native-editor client, it was told "if denied, use ctx_patch". The guidance
is now built from the same profile, `disabled_tools` list and client rules
that decide `tools/list`, one profile per rules target. The parallel-calls
and "ACTUALLY EMIT" lines mention `ctx_compose` only when the profile has
it, and the graph anti-pattern names only the graph tools still enabled.
- The shadow-mode edit line said "native Edit/StrReplace". Codex edits with
`apply_patch`, so the line now says "the host's native edit tool". Rules
version 11 rewrites the installed files on the next start. The Codex guide
no longer tells Codex to use a native `Glob` it does not have.
Thanks to @skonebrant for the detailed report.
### Fixed — `_lc` shims and shell hooks survive package-manager installs and updates (#1851)
- `lean-ctx init --global` wrote the `_lc`/`_lc_compress` PATH shims next to
the running binary. With scoop, Homebrew, npm or mise that is a versioned
directory off `PATH` (`scoop/apps/lean-ctx/3.10.2`, `Cellar/…`,
`node_modules/…`, `mise/installs/…`). The shims were therefore never found.
Hosts that replay a shell snapshot without the `_lc` function, such as
Claude Code's Bash tool, kept the `alias git='_lc git'` aliases, and every
aliased command failed with `_lc: command not found`.
- The shims now go to the running binary's directory only when it is on
`PATH`. Otherwise they go to the `PATH` directory holding the `lean-ctx`
launcher: the Homebrew symlink, the scoop shim, the npm or mise launcher.
`~/.local/bin` is the last choice when it is on `PATH`, and the first
writable directory wins. `lean-ctx uninstall` also removes shims from the
`PATH` directories, and still removes only files carrying the lean-ctx
marker.
- `shell-hook.*` and `env.sh` embedded the same versioned path, which stopped
existing after `scoop update` + `scoop cleanup` or `brew upgrade`. They now
embed the stable `PATH` launcher when the binary is off `PATH`. Installs
whose binary sits on `PATH` (the `install.sh` and Windows ZIP layouts) are
unchanged. Run `lean-ctx init --global` once after updating to rewrite the
hook. Thanks to @ZacKienzle2 for the detailed report.
### Fixed — `ctx_shell` places a relative redirect after a `cd` where it lands (#1850)
- The write guard placed a relative redirect or `tee` target in the call's
`cwd`, even after a `cd` earlier in the same command. `cd /tmp/x && echo a >
out.txt` was therefore refused, although `out.txt` lands in a scratch
directory. With a scratch `cwd`, `cd && echo a > f` was allowed,
although `f` lands inside the project. Each command is now judged in the
directory it actually runs in: the call's `cwd`, moved by a plain
`cd ` that is certain to have run before it. When that directory cannot
be known, a relative target is refused, and the message asks for an
absolute path. That covers a `cd` through a variable, `pushd`, a `cd` in a
subshell or a group, a `cd` that may fail or be skipped, and a backgrounded
list. Absolute targets are judged as before. Thanks to @andig for the report.
### Fixed — the PowerShell tool no longer gets a Bash command back (#1848)
- On Windows, Claude Code and Copilot CLI send PowerShell tool calls through
`lean-ctx hook rewrite`. The hook answered them the way it answers Bash:
compounds and commands outside the shell allowlist came back wrapped as
`'…\lean-ctx.exe' -c '…'`. PowerShell cannot parse that
(`Unexpected token '-c'`), so every such call failed. Quoting alone would not
have fixed it: `lean-ctx -c` runs its command in the shell lean-ctx detects
for itself, which is Git Bash on most Windows machines, not PowerShell.
- PowerShell calls now take their own path. A single `Get-Content`,
`Select-String` or `Get-ChildItem` (and the other read, search and list
commands) becomes `& '…\lean-ctx.exe' read …`, quoted for PowerShell.
Windows paths such as `src\main.rs` keep their backslashes. Everything else
runs in PowerShell unchanged. A word that PowerShell would evaluate first,
such as `$env:X`, `@args`, `a,b`, `*.md` or `(…)`, is never rewritten.
- The shell allowlist still applies. In `enforce` mode a PowerShell command it
blocks (for example `Remove-Item`) is refused with the allowlist's reason,
not wrapped. `warn` and `off` behave as before.
- PowerShell quoting elsewhere in lean-ctx now also quotes `@` and `,`, which
PowerShell treats as operators.
- Thanks to @ZacKienzle2 for the precise root-cause analysis.
### Fixed — a task overview no longer lists facts that share only a generic verb (#1832)
- `lean-ctx overview ''` listed any fact that shared a single word with
the task as a "relevant fact". A task like "Inspect alpha parser header
validation." therefore showed an unrelated fact such as "Inspect and review
gamma certificate deployment sequencing." because both contain "inspect".
Two unrelated tasks got the same unrelated facts. Only the task's content
words are matched now: words like "the", "and", "inspect", "review", "check"
or "fix" are ignored, punctuation is trimmed ("validation." matches
"validation") and words are split the way facts are indexed. A task made
only of such words lists no facts. The sub-agent briefing pack uses the same
matching. An explicit `ctx_knowledge` recall still matches every word you
pass. Thanks to @rtbe for the isolated reproduction.
### Fixed — Pi: `ctx_shell`'s `timeout` now reaches `lean-ctx -c` (#1833)
- In `pi-lean-ctx`, `ctx_shell(command, timeout=)` passed the timeout
only to Pi's outer bash tool. The `lean-ctx -c` wrapper inside it kept its
default of 120 s. A call with `timeout=200` was therefore stopped after
about two minutes with `output truncated at 8 MB / 120s limit`. The
per-call timeout is now passed to `lean-ctx -c` as
`LEAN_CTX_SHELL_TIMEOUT_MS`, capped at the same one-hour ceiling the MCP
`timeout_ms` has. A `LEAN_CTX_SHELL_TIMEOUT_MS` you set yourself still wins,
and `raw=true` is unchanged because it does not go through lean-ctx. Thanks
to @rtbe for the precise report.
### Fixed — a `jq` program in single quotes is no longer blocked as `source` (#1829)
- A quoted `jq` filter such as `'… | . as $r | …'` was blocked. The block said
the command runs `eval`/`exec`/`source` or a substitution. The quick
pre-scan for `| . ` and similar separators looked through quotes, so it read
jq's identity filter as the shell's `.` (source) builtin. That scan now
ignores text inside single quotes. The per-segment check still decides
every command, so a real `.` or `source` at command position is still
blocked, next to quotes too. The block message now names `source` and `.`.
Thanks to @andig for the report and the reproductions.
### Fixed — Claude Code's Bash sandbox no longer blocks every command (#1834)
- With `sandbox.enabled`, Claude Code spawns each Bash call as
`env SANDBOX_RUNTIME=1 … /usr/bin/sandbox-exec -p '' /bin/zsh -c ''`
through `zsh -c`. The `.zshenv` redirect forwarded that launcher to
`lean-ctx -c`, nothing recognised it, and the allowlist hard-blocked on the
inner `eval` — exit 126 for every command, even `echo`. `lean-ctx -c` now
recognises exactly the launcher Claude Code builds
(`/usr/bin/sandbox-exec -p ` followed by `/bin/zsh`, `/bin/bash`,
`/bin/sh` or the user's own `$SHELL`, then `-c