Expand description
Which of several workspace roots a session binds to, made visible (AP04-G7, owner decision 19.10.).
A host that reports several roots (MCP roots/list, Cursor’s
WORKSPACE_FOLDER_PATHS) still gets the first one (#699): the first root
with a project marker, else the first safe directory. What changed is that
the choice is no longer silent. Every selection among more than one
candidate is recorded under the chosen project’s partition, so the MCP
session (ctx_session status) and the dashboard (GET /api/scope) can
name the chosen project, the other candidates and how to change it:
lean-ctx project use <path> records a preference that later selections
honour when that folder is among the candidates.
Records hold paths only — no timestamps or counters — so every text built from them is a deterministic function of the stored state (#498).
Structs§
- Root
Selection - One root selection: the chosen root, every candidate in the order the host reported it, and the rule that chose.
Functions§
- prefer
- Prefer
root(canonical, an existing safe directory) whenever it is one of several workspace roots. - record
- Record a session’s selection so other surfaces can show it. A selection among several candidates is stored for the chosen root, and the records of the other candidates (no longer chosen) are removed; a selection without alternatives removes the chosen root’s record. Best effort: a failure only means the choice is not shown.
- recorded_
for - The recorded selection that chose
rootamong several candidates. - select
- Choose among
paths(absolute directory paths, in host order).