Expand description
LeanCTX | Cloud connector: the engine side of the contract in
lean_ctx_protocol::cloud.
Rules every part keeps:
- Local work is never gated: offline, disabled, a lapsed lease, a bus
hold/stop/vetoor a damaged control file only pause Cloud traffic (bus::control). The one exception is the organization’s verified policy (effective_floor): it is policy, not Cloud state, so its last valid rules keep applying offline and afternot_after(lifting them would let a machine leave its policy by going offline), and a company-bound project is never mapped into a personal workspace (company_bound). - Cloud never blocks a tool call; network work runs in
scheduler, in the in-process queue a tool call hands its Cloud requests to (background) or in explicitlean-ctx cloud …commands. - Every outbound content item passes
knowledge::screeningbefore it is queued in theoutbox. - Tokens and keys never reach logs,
Debug, errors or crash output.
Re-exports§
pub use config::CloudConfigExt;pub use error::CloudError;pub use error::Revocation;pub use error::TaskRefusal;pub use state::CloudStore;
Modules§
- auth
- Enrollment (device flow), access tokens and lease renewal.
- background
- Cloud requests a tool call hands off (connector rule “Cloud never blocks a tool call”).
- bring_
local - Bringing a project’s local work into the vault it was just linked to
(
lean-ctx cloud link --bring-local): its local tasks (crate::tasks::local) become proposed tasks of the vault, and its local doc pages (crate::local_docs) pages of the vault, once each. - bus
- The cross-instance agent bus: the local bus (
ctx_agent) of every machine of an organization joined through Cloud. - capture
- Capture quality gate (Cloud v4 V1, SPEC-ENGINE §3.1).
- company_
bound - Personal beside the Company (owner decision 26.10.): a Personal workspace
stays private and never belongs to a company, and a company may keep its
teams’ project knowledge out of personal workspaces with the policy
member
sharing.personal_workspace: forbid(tighten-only, defaultallow). - computers
- LeanCTX Cloud computers (
/v1/computers, cloud designcloud-computer.md§4.3): list, create, start and stop the computers of the person and of their teams, forlean-ctx cloud computer …and LeanCTX Code. - config
[cloud]configuration: the section’s types come fromlean_ctx::core::config::cloud; this module adds the Cloud’s origin and root-key rules.- connect
- The steps of
lean-ctx cloud connectafter the device flow (CHECKLIST 2.1.1): the person confirms once per workspace what this machine shares with it, then the current project is mapped to its vault. - consent
- Out-of-band consent (SPEC-ENGINE §3.8; C0 2.0
consent.schema.json,enums/consent-kinds.json,vectors/consent_*.vectors.json). - cpao
- LeanCTX Cloud cost per accepted outcome (
GET /v1/cpao, contract W2): what the team’s agents cost over the last 7 and 30 days, divided by the outcomes that were accepted (a landed merge request or an accepted task result), for a local reader such as LeanCTX Code. - delivery
- Delivery of a place’s knowledge into an agent’s context (SPEC-ENGINE §3.5): which folded nodes a host session may see, in which bucket, and a deterministic rendering (#498) — the same replica and query give the same bytes, whatever the clock, the scores or the trust revision say.
- disconnect
lean-ctx cloud disconnect: Cloud is told first, local data goes after.- docs
- Docs in Cloud (C0 2.2): the engine adapter of
lean_ctx_doc. - effective_
floor - The Cloud effective policy as a floor of the gateway policy engine (Release B 3.1.4).
- effective_
policy - Unified Control on the engine (Release B 3.1.4, 3.1.6): receive, verify,
apply and acknowledge the signed effective policy a 2.x Cloud adds to
GET /v1/policy/bundle(effective_policy). - error
- Errors of the Cloud connector. Messages are safe to print: they never carry tokens, keys, device codes or request bodies.
- events
- C0 2.0 events on the engine (Cloud v4 V4.1, SPEC-ENGINE §3.3): ids,
the hybrid logical clock, signing and verification, and building events
from what the capture gate let through. Worker and alias keys come from
core/cloud/workers(ENGINE-2). - friction
- Collaboration friction per hour (V16.1, RESOLUTIONS R128): the local
friction log (
core::agents::friction) summed for one closed hour per vault into the C0 2.0 counts of a collaborationfinding(about: collaboration,counts,window; CONTRACT §3.19.2). Counts and ids only, never text. - gateway
- LeanCTX Cloud model gateway key (
POST /v1/gateway/key): a short-lived key with which this computer’s sessions run on models from LeanCTX, paid from the team’s balance. - identity_
v2 - Project identity v2 (CHECKLIST 2.1.2, design
ee/delivery/cloud-v5-project-mapping.md): the same repository has the same identity on every device, built from the committed.lean-ctx-id, the normalized origin remote and the root commit. Never the local path. - instance_
key - The instance’s long-lived keys: Ed25519 for token assertions and an X25519 key whose public half enrollment carries.
- keyset_
v3 - Key set v3 (E13; C0 2.0
keyset.schema.json,vectors/keyset_v3.vectors.json; RESOLUTIONS R55 as amended by R103). - knowledge
- Project knowledge with Cloud: session learnings stream out as draft
proposals (
draft), reviewed revisions stream back in (pull). - lease
- Lease and key-set verification, renewal and the service clock offset.
- link
lean-ctx cloud link <workspace>/<vault>[@<server>]: link a git repository to a vault.- local_
docs - A project’s docs on this Instance alone (
lean_ctx_doc::local): the store of a checkout that no vault is linked to. Keyed like knowledge (<data dir>/docs/<hash_project_root>), so the CLI, the MCP tool and Cloud Desktop find the same pages. Nothing here contacts Cloud. - mapping
- Project → vault mapping and the first-share confirmation (CHECKLIST
2.1.2, 2.1.3; design
ee/delivery/cloud-v5-project-mapping.md). - metrics
- Local inputs of engine metrics v2: the time-ordered store readers they
build on (
collect) and the Cloud use counters they sample (cloud_use). - metrics_
v2 - Engine metrics v2: hourly counters of this engine for its Cloud
workspace (
POST /v1/metrics/hours, telemetry SPEC, owner checklist K1–K4, K15, K16). - migrate
- Engine upgrade duties of the first 3.12 start (SPEC-ENGINE §3.16, V13.E1), from a 3.11.5 or a 3.12.0-rc data directory.
- models_
access - The subscription models through the Cloud models gateway (mz6,
docs/model-access-subscription.md§4): the connector’sCloudTokenSourcefor the proxy’s built-inleanctxprovider, and the catalog oflean-ctx modelsand of the Local Read kindcloud.models.catalog(read_catalog). - outbox
- Durable outbox: everything bound for Cloud is written here first and
sent later by the scheduler (or
lean-ctx cloud sync), so Cloud never blocks a tool call and nothing is lost while offline. - policy
- Filter packs from Cloud.
- policy_
sessions - Per-session enforcement evidence (3.12.3): which Cloud policy (version, digest, signature state) was in force for which app session, with the receipts made under it.
- queens
- Queen sessions: the sessions LeanCTX | Cloud Desktop started as a Queen, registered by the app over the 0600 local socket (an app-only call).
- receipts
POST /v1/receipts(receipts v2, C0 2.5 K2 M3): the Engine receipts of this machine’s Cloud vaults.- replica
- The engine’s offline replica of a place (Cloud v4 V4, SPEC-ENGINE §3.4): an encrypted SQLite store per place, the cursor into the server log, the queue of own events not yet in that log. Folding events and the sync routes follow the C0 2.0 wire shapes.
- resolution
- Local vault resolutions that no longer fit their checkout (dogfood 5.11.: one repository split across two vaults without a warning).
- review
- Reviewer and maintenance clients (SPEC-ENGINE §3.15, §3.15b).
- revoked
- The local record of a revocation (C0 2.0 E12,
401 instance_revoked). - root_
cert - Trust in a self-hosted Cloud: the vendor’s root certificate (C0 1.7).
- runtime_
lease - The Cloud lease as the Intelligence runtime’s licence.
- scheduler
- Background Cloud work, started once at MCP startup.
- session_
ref - V9
session_ref: the session a write names, and whether the enrolled Cloud may hear it. - state
- Durable Cloud state on this machine.
- status
- Local, network-free Cloud status: the cockpit’s
cloud status --jsonshape and the human report behindlean-ctx cloud status. - sync
- Engine sync with a place (Cloud v4 V4, SPEC-ENGINE §3.4.3–§3.4.4): verification of snapshot and tail records, the push of own events, and the driver that clones, tails and pushes a replica.
- tasks
- Tasks in the engine (H2, C0 1.9 §1): read a project’s tasks, claim one, report short summaries, submit one result with evidence, give it back.
- team_
decisions - Team rules for every agent of a vault (rc4-69).
- team_
stop - The team stop (kill switch) as the Cloud reports it to an engine
(
GET /v1/stop, acting as the person the instance is linked to). - throttle
- Quota and policy throttles (Release B, Cloud API §7.2 and §8.1).
- transport
- HTTP transport to the Cloud engine API (
<origin>/v1). - unlink
lean-ctx cloud unlink(rc4-6): stop sharing one project folder with its vault, on this machine only.- unlinked
<data_dir>/cloud/unlinked_roots.json(rc4-6): the project folders the person stopped sharing withcloud unlink. A folder listed here is never shared again on its own: it resolves no vault (also not through its main checkout or another checkout of the same repository),cloud syncand the knowledge sync do not map it, a write does not push it, a task proposal or message from it is not sent, and capture queues no draft for it. Only an explicitcloud linkin the folder that Cloud accepts takes it out of the list.- untrusted
- Foreign content as data (X5): every bus message, task body/update and
repo fact pulled from Cloud that reaches an agent’s context passes
wrapfirst. - usage
- LeanCTX Cloud usage (
GET /v1/usage): how far each quota of the workspace is used, so this machine warns at 80 % instead of meeting a refusal. - vault
- Repository identity and the local map of resolved Cloud vaults.
- vault_
address - Vault addresses
<ws>/<vault>[@<server>](C0 2.0common.schema.json$defs/vault_address,vectors/vault_address.vectors.json), used in.lean-ctx-cloud.json(link v2), CLI vault arguments and environment values. No server or@cloud.leanctx.comis the hosted service; a server with a dot or a port is self-hosted athttps://<server>. - worker
- Worker mode (Cloud plan v3 L1, owner decision O1): the person’s own agent pulls tasks through MCP; the engine never starts an agent by itself.
- workers
- Durable workers (SPEC-ENGINE §3.6, C0 2.0 section 2): the identity an agent has on Cloud instead of its process id.
Structs§
Constants§
- CLOUD_
AVAILABLE - Release switch: the connector shipped switched off in 3.12.0 and 3.12.1
(
cloud connect/cloud linkrefused,cloudhidden from help, suggestions and completions). Owner 2026-11-04: LeanCTX | Cloud opens with 3.12.2. - CLOUD_
TOOLS - Cloud MCP tools. They ship with the connector but follow its release switch
(
available_locally, owner 28.10.): while it is off they are in no tool list and every call answersTOOL_NOT_AVAILABLE. - NOT_
AVAILABLE - The one line
cloud connect/cloud linkprint while the switch is off. - PREVIEW_
ENV - Test switch:
LEAN_CTX_CLOUD_PREVIEW=1opens the connector before the release, for a loopback Cloud only (the FakeCloud of the test suite). - TOOL_
NOT_ AVAILABLE - The one line a call to a Cloud MCP tool (
ctx_tasks) answers while the switch is off; the tools stay out of every tool list.
Functions§
- available_
for - Whether this engine may connect to the Cloud at
origin. - available_
locally - Whether Cloud commands that name no origin (
cloud link) may run. - is_
loopback - Whether
originnames this machine (127.0.0.1,localhost,::1). - register_
hooks - Register the connector’s hooks into the engine. Every entry calls this
at start-up, before the first tool call (
cli::dispatch::run, next toproxy::register_shapers, and thelean-ctx-embedengine builder). Calling it again changes nothing: the first registration wins. Every hook here is bookkeeping or telemetry and decides no refusal, except the subscription-model token source (models_access): without it the proxy refuses theleanctxprovider (fail closed). The sign-in probe answers a question: the managedcloud.requiregate in the engine decides, and refuses when no probe is registered.