Expand description
The project a command-line invocation acts for, and the read boundary a command-line read enforces against it.
The root comes from --root/--project-root, then LEAN_CTX_PROJECT_ROOT
(reconciled with the working directory, AP04-G10), then project_root_of
the working directory. Shared by the CLI commands, the daemon client and the
shell-hook rewriters, so every entry point names the same project; the MCP
server derives its startup root with the same project_root_of (#1315).
Functions§
- cli_
read_ is_ refused - Whether
lean-ctx read <raw>from this process would be refused (#1903). Shell-hook rewriters keep such reads on the native command instead of turning a workingcatinto an access-denied error. - detect_
project_ root - The project this process acts for, from
argsand the working directory. - detect_
project_ root_ in detect_project_rootfor an explicit working directory.- jail_
cli_ read_ path - #1903:
lean-ctx readenforces the same boundary as MCPctx_read— the PathJail (project root +allow_paths/extra_roots/read_only_roots+ the lean-ctx state dir) and the secret-path policy — with the same error text. A relative path is resolved against the process CWD (a shell user’s intent), never re-anchored at the project root. A broad root (home,/, agent config dir) is refused likelean-ctx calldoes, unless the jail is disabled (path_jail = false), because jailing to~would admit every file the user owns. - project_
root_ of - #1315: the project
pathbelongs to, for the CLI and the MCP server alike — the nearest git root at or above it, else the outermost directory with a project marker (Cargo.toml,package.json, …; #1437: a monorepo sub-package is not its own project). A broad root (~as a dotfiles repository,/, an agent directory) never counts, and the walk continues past it. The result is canonical, so every entry point keys the project-scoped stores (local tasks, agent registry) on the same directory.Nonewhen no directory abovepathis a project. - promote_
to_ git_ root - require_
project_ root - The project a command that writes project-scoped state acts for;
Errinstead of~,/or an agent directory (AP04-G10).