@north-light/cli 0.3.653 → 0.3.654

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,7 +26,7 @@ An app that signs people in with Northlight uses `OAuth2Client` and `oauth.clien
26
26
  | Option | Type | Default | Meaning |
27
27
  |---|---|---|---|
28
28
  | `baseURL` | `string` | `CRTR_BASE_URL`, else unset | `http(s)://host:port` of a daemon TCP listener. |
29
- | `socketPath` | `string` | `CRTR_SOCKET`, else `${CRTR_HOME}/crtrd.sock`, else `~/.crouter/canvas/crtrd.sock` | Unix socket. Node only; throws in a browser. |
29
+ | `socketPath` | `string` | `CRTR_SOCKET`, else `CRTR_API_SOCKET`, else `api.sock` in the runtime root (`${CRTR_HOME:-~/.crouter}/runtime/api.sock` on macOS, `/run/crtr/api.sock` on Linux) | Unix socket. Node only; throws in a browser. |
30
30
  | `token` | `string` | `CRTRD_TOKEN` | Sent as `Authorization: Bearer <token>`. The owner token or a scoped token from `crtr sys connect`; a scoped token's ceiling is enforced per request (see [[crouter-sdk/getting-started]]). Ignored by a unix-socket daemon, which authenticates by filesystem permission. |
31
31
  | `timeout` | `number` (ms) | `30_000` | Per-request wall clock. Does not apply to a stream. |
32
32
  | `maxRetries` | `number` | `2` | Transient-failure retries. Never applied to `POST` or `PATCH` — see [[crouter-sdk/errors]]. |
@@ -13,7 +13,7 @@ This directory is the runtime's **self- and developer-documentation**: operation
13
13
 
14
14
  ## The object model, in one page
15
15
 
16
- crtr keeps one graph of **objects** in one SQLite database (`canvas.db`). Documents, nodes, bash jobs, owners (person, app, repo, profile) and custom objects are all objects: each has an id, a name, an owner and a privacy level, and **the same verbs work on all of them** — `crtr canvas read`, `list`, `search`, `watch`, `unwatch`, `edges`. What differs is the object's *type*, which decides what events it can emit and how it renders. There are no memory stores, tiers or scopes: a thing an agent writes is a document, and who sees it is decided by its owner, its privacy and its delivery rules.
16
+ crtr keeps one graph of **objects** in one Postgres database — a cluster crtrd supervises on a Mac, or the shared cloud database behind Northlight's control plane. Documents, nodes, bash jobs, owners (person, app, repo, profile) and custom objects are all objects: each has an id, a name, an owner and a privacy level, and **the same verbs work on all of them** — `crtr canvas read`, `list`, `search`, `watch`, `unwatch`, `edges`. What differs is the object's *type*, which decides what events it can emit and how it renders. There are no memory stores, tiers or scopes: a thing an agent writes is a document, and who sees it is decided by its owner, its privacy and its delivery rules.
17
17
 
18
18
  - **Documents** are the one object type for written knowledge: what used to be called memories, reports and context documents. Write them with `crtr doc write|edit|move|history|delete|lint`; read them with `crtr canvas read`. Each has a required one-line **preview** ("When …, read this because …"), a body, optional summary, privacy (`public` default, or `private`: readable by you and the people you share it with, and by an app only with a private-read scope; share with `crtr canvas share`), delivery **rules**, and revisions — an edit is made from the revision you last read and is refused if the document moved on. A document's `kind` is `knowledge` (consulted) or `preference` (directs behavior); `report` documents are created only by `crtr push`. `crtr doc write -h` is the writing guide.
19
19
  - **Owners** are objects too: a node, the person (`user`), a profile, an app, or a repo. The owner decides who may read and change a document, where it syncs, and what deletes it. The default owner is the writing node (the document goes away with the node unless a kept document links to it); `--owner user|profile|app|repo` makes it outlive the node. A repo owns only public documents and syncs them to collaborators over the git ref `refs/crtr/docs`. An installed plugin is an app (`app:<plugin>`); crtr's own documents belong to the app `crtr`. Which owner to pick: [[internal/agent-shaping]].
@@ -27,7 +27,7 @@ crtr keeps one graph of **objects** in one SQLite database (`canvas.db`). Docume
27
27
  ## Contents
28
28
 
29
29
  - **nodes-and-canvas** — the agent-runtime model: nodes as objects on the canvas graph, spawn/delegate, the push/feed spine and watches, lifecycle (mode + lifecycle axes), jobs and custom objects, and revive (manual + daemon auto-revive).
30
- - **storage-tiers** — where state lives on disk: the scope root (prompts, plugins, personas, config), the canvas home (`canvas.db`, content-addressed document bodies, per-node files, diagnostics) and what git carries for repo documents.
30
+ - **storage-tiers** — where state lives: the Postgres database (objects, document bodies, settings, conversations), the blob store, the layout root's `runtime/`, `apps/` and `user/` directories, the project scope `.crouter/`, and what git carries for repo documents.
31
31
  - **memory-loading** — how documents load into a node: the delivery events, `deliver` levels, `if` conditions, listings, boot-render ordering and the reader's view — read when diagnosing why a document did or didn't load.
32
32
  - **agent-shaping** — the when-to-use-which layer over the four dials that shape a node: kinds (the builtin roster, sub-kinds, custom personas), modes (base vs orchestrator), profiles, and document owners (node/profile/repo/user).
33
33
  - **plugins** — authoring a crtr plugin: the plugin.json manifest, directory layout, the package-file format of its `memory/` documents, scopes, install mechanics, versioning, command-capable plugins and bare binaries on every node's PATH.
@@ -45,7 +45,7 @@ A rule's `if` is the eligibility predicate over the receiving node — kind, mod
45
45
 
46
46
  A full-body delivery is a read: `crtr canvas read <name>` and every content delivery expose, once per loaded context, the listing of each prefix of the document's name — one preview per document, one bare name per prefix that has names under it — then fire matching `document-read` rules. A document named `x` and documents named `x/…` coexist; reading `x` prints its body alone to stdout and delivers one listing of the names under it and the documents its body links to after command output in the node's tool result — previews only, not reads, never recursing. Content-delivered companions are read in turn until nothing new is delivered. `unlisted: true` suppresses a document from every listing. An owner's top level is never auto-listed — `crtr canvas list --type document` is the deliberate browse. Every content delivery, like every read, records a watch, so later edits reach the reader as pushes.
47
47
 
48
- Every delivery registers the document or listing and its level in the loaded context's exposure ledger, kept in canvas.db. System and transcript ranks max-fold, so a higher level pierces a lower one while a content delivery silences later lower-level deliveries and duplicate read attachments. A strict resume preserves that ledger and the byte-stable preference snapshot; yield or another new-session boundary clears it and replaces them with exactly the new system and first-message snapshots.
48
+ Every delivery registers the document or listing and its level in the loaded context's exposure ledger, kept in the canvas database. System and transcript ranks max-fold, so a higher level pierces a lower one while a content delivery silences later lower-level deliveries and duplicate read attachments. A strict resume preserves that ledger and the byte-stable preference snapshot; yield or another new-session boundary clears it and replaces them with exactly the new system and first-message snapshots.
49
49
 
50
50
  ## The reader's view
51
51
 
@@ -13,7 +13,18 @@ Every agent is a **node**, one kind of **object** on the **canvas** — the sing
13
13
 
14
14
  The node-to-node **spine** is the subscription edge: a subscriber receives its publisher's pushes (`node subscription add|remove`, stored as a watch the subscriber holds on the publisher), and that edge decides who-wakes-whom. It sits beside the general watch mechanism below, which lets any object's events reach any node.
15
15
 
16
- The **daemon** (`crtrd`) is the sole owner of canvas persistent state: it is the only process that opens `canvas.db`, launches brokers, and writes runtime/model-auth, all behind an HTTP+WS API on a unix socket (dockerd model). Every `crtr` command and viewer is a pure client of that `/v1` API — they never open the store. A local interactive viewer still streams a node's broker socket (`view.sock`) directly, because that is broker IPC, not canvas state.
16
+ The **daemon** (`crtrd`) is the sole owner of canvas persistent state: it is the only process that opens the canvas database, launches brokers, and writes runtime/model-auth, all behind the `/v1` HTTP+WS API (dockerd model). Every `crtr` command and viewer is a pure client of that API — they never open the store. A local interactive viewer still streams a node's broker socket (`view.sock`) directly, because that is broker IPC, not canvas state.
17
+
18
+ crtrd runs in one of four roles:
19
+
20
+ | Role | Where | What it does |
21
+ |---|---|---|
22
+ | none (default) | a Mac that has not been imported | everything in one process: API on a unix socket, reconcilers, and node processes on this machine; supervises its own Postgres |
23
+ | `--role api` | the cloud control plane | serves `/v1` for many people from the shared database; runs no reconcilers |
24
+ | `--role reconcile` | the cloud control plane | runs the reconcilers and boot sweeps; serves only a health check |
25
+ | `--role machine` | a Mac imported into an account (`runtime/machine.json` present) | opens no database and serves no API; holds an outbound link to the cloud and runs the processes of nodes whose environment is this machine |
26
+
27
+ A node runs in an **environment**. A `blaxel` environment runs its broker, shell and files in a Blaxel sandbox the cloud roles start and wake. A `machine` environment runs them on a Mac: directly under that Mac's own crtrd when it is not imported, or through the machine link when the cloud roles own it. `crtr sys import` moves a Mac or a hosted runtime into an account; `crtr sys machine rotate` replaces an imported Mac's machine credential.
17
28
 
18
29
  ## Spawn & delegate
19
30
 
@@ -61,4 +72,4 @@ Tear-down: `node lifecycle close` cascade-cancels a node + its exclusive subtree
61
72
 
62
73
  Use `node lifecycle revive <id>` to reopen one dormant or terminal node. It resumes an existing saved conversation by default; `--fresh` starts a new cycle on its existing session file, or a truly fresh session if no file exists. A finalized node requires `--reopen` before it can take a new mandate. Mass-reconnecting every eligible disconnected node after a reboot or outage is `canvas revive --all` instead. `reviveNode()` is the **only** sanctioned launcher of a node's broker engine — it builds the pi invocation, sets `CRTR_NODE_ID` + canvas extensions, runs `transition('revive')`, and starts the headless broker host, keeping the db row and broker process in lockstep. Never spawn `pi --session` raw, and never open a node by spawning pi directly — UIs go through `surface node focus` / `node lifecycle revive`.
63
74
 
64
- The daemon (`crtrd`, managed via `sys daemon start/stop/status`) supervises live broker exits. It releases an unattended broker after 15 minutes: residents with no live obligation become `done` and pruning-eligible, while terminal nodes and residents awaiting a live child, controller, human, deadline, or structured output become `idle` and remain wakeable. It applies a bounded respawn policy to interrupted nonterminal nodes: an interrupted saved turn resumes in the same conversation with a continuation, whether the broker persisted a clean abort or died abruptly. A pending refresh or pending cycle still starts a fresh cycle from the saved session. Repeated short-lived exits and boot failures terminalize the node as `dead`; no automatic recovery occurs after terminalization, so use an explicit lifecycle revive or an inbox wake. It does not host agents or open viewers. When activating source changes, build, run `npm run install-runtime`, then restart the daemon because new daemon/brokers select the atomically switched, immutable generation while live brokers retain their own. Restarting is safe: it never signals running nodes.
75
+ The daemon (`crtrd`, managed on a Mac via `sys daemon start/stop/status`) supervises live broker exits. It releases an unattended broker after 15 minutes: residents with no live obligation become `done` and pruning-eligible, while terminal nodes and residents awaiting a live child, controller, human, deadline, or structured output become `idle` and remain wakeable. It applies a bounded respawn policy to interrupted nonterminal nodes: an interrupted saved turn resumes in the same conversation with a continuation, whether the broker persisted a clean abort or died abruptly. A pending refresh or pending cycle still starts a fresh cycle from the saved session. Repeated short-lived exits and boot failures terminalize the node as `dead`; no automatic recovery occurs after terminalization, so use an explicit lifecycle revive or an inbox wake. It does not host agents or open viewers. When activating source changes, build, run `npm run install-runtime`, then restart the daemon because new daemon/brokers select the atomically switched, immutable generation while live brokers retain their own. Restarting is safe: it never signals running nodes. The cloud roles are never restarted this way; their orchestrator replaces them on release.
@@ -2,50 +2,70 @@
2
2
  name: internal/storage-tiers
3
3
  kind: knowledge
4
4
  description: Where crouter state belongs
5
- when-and-why-to-read: When locating crtr state on disk or deciding where a new file belongs, this reference should be read so files are found or placed in the right root — and so you do not look for documents on disk, since they are objects in canvas.db, not files.
6
- short-form: Where crtr state lives on disk — the scope root (prompts, plugins, personas, config), the canvas home (canvas.db with every object and document body, per-node files, human tickets, diagnostics), and the git ref that carries repo documents.
5
+ when-and-why-to-read: When locating crtr state on disk or deciding where a new file belongs, this reference should be read so files are found or placed in the right root — and so you do not look for documents, settings or conversations on disk, since they are rows in the canvas database, not files.
6
+ short-form: Where crtr state lives — the Postgres canvas database (every object, document body, setting, conversation index), the blob store, the layout root's runtime/user/apps directories, the project scope `.crouter/`, and the git ref that carries repo documents.
7
7
  surfaces:
8
8
  - on: boot
9
9
  at: name
10
10
  ---
11
11
 
12
- # Where everything lives on disk
12
+ # Where everything lives
13
13
 
14
- Everything on the canvas — documents, nodes, jobs, owners, custom objects — is an **object** in one SQLite database; see [[internal]] for the object model. Two places on disk hold the rest: the **scope root**, for configuration and prepared content that is files by nature, and the **canvas home**, for the database and per-node runtime files. This is the routing contract; precise resolver behavior lives in `src/core/scope.ts` and `src/core/canvas/paths.ts`.
14
+ Everything on the canvas — documents, nodes, jobs, owners, custom objects — is an **object** in one **Postgres database**; see [[internal]] for the object model. Large payloads go to a **blob store**. Files on disk are what is a file by nature: a node's context directory, its runtime files, diagnostics, and project configuration. Precise resolver behavior lives in `src/core/layout.ts`, `src/core/canvas/paths.ts` and `src/core/scope.ts`.
15
15
 
16
- Documents are not a third place. A document is an object row in `canvas.db` plus a content-addressed body, a row in the `bodies` table (a package document — crtr's own or a plugin's — is the same; its `source_path` only records where it shipped from and marks it read-only); who may read it comes from its privacy (`public` or `private`), the app's schema and its relation facts (`crtr doc write --owner -h`), not from a directory. Do not look for documents on disk, and do not write one as a file: use `crtr doc write`, and read with `crtr canvas read`.
16
+ ## 1. Where the database and blobs are
17
17
 
18
- ## 1. Scope root — configuration and prepared content
18
+ - **On a Mac**, crtrd supervises its own Postgres 18 cluster under `<runtime>/pg/`; `CRTR_DATABASE_URL` points it at any other Postgres instead. Blobs are files under `<runtime>/blobs/`.
19
+ - **In the cloud**, the `api` and `reconcile` crtrd roles share one RDS Postgres with the directory (crouter's tables are in schema `crtr`), and blobs are in R2 (`CRTR_R2_BUCKET` plus the other `CRTR_R2_*` variables). The API processes share no disk, so anything they must both see is a row or a blob.
20
+ - **An imported Mac** runs crtrd as the `machine` role: it opens no database and serves no API. It holds an outbound link to the cloud and runs that account's processes for nodes whose environment is this machine.
19
21
 
20
- `~/.crouter/` (user scope) or `<project>/.crouter/` (project scope), resolved by `src/core/scope.ts`. It holds `prompts/`, `plugins/`, `marketplaces/`, `personas/`, and `config.json`; a file belongs to the scope whose root it sits under (the user's, or the project's). `prompts/<name>.md` becomes `/<name>` in every node, with nested paths becoming colon-namespaced commands and the nearest resolved scope winning. The scope root does not decide document ownership.
22
+ The database holds every object and its edges, watches, events, delivery rules, revisions, the exposure ledger, the inbox and delivery queue, human-request state, the person's settings (profiles, profile defaults, user- and profile-scope `config.json` content, plugin and marketplace installs) and the conversation index. A document's text is a row in the `bodies` table keyed by the revision's `body_hash`; a package document (crtr's own or a plugin's) is the same, and its `source_path` only records where it shipped from and marks it read-only. Who may read a document comes from its privacy, the app's schema and its relation facts (`crtr doc write --owner -h`), not from a directory. Do not look for documents on disk and do not write one as a file: use `crtr doc write`, and read with `crtr canvas read`.
21
23
 
22
- `~/.crouter/support/<reference>/` is user-scope prepared local diagnostic material. A reference contains the prepared support bundle and manifest for explicit handling; it is not a document, a node context file, or a project-scoped support store. Preparation is local and zero-egress; submission is an explicit operation to its verified destination. Invocation, output, and artifact details belong on the relevant command leaf `-h` surfaces.
24
+ Blob keys: `conversations/<node>/<conversation>/<seq>.jsonl` (immutable conversation parts; the live tail is rows), `events/<node>/…` (run-event chunks), `jobs/<node>/<job>/output`, `attachments/<node>/<sha256>`, `requests/<id>/…` (human-request pages on a cloud role), and release artifacts.
23
25
 
24
- User-wide content with no cwd dimension also belongs here: `~/.crouter/profile-defaults.json` maps realpath'd directories to their selected profile, and `~/.crouter/prompt-reviews/` holds prompt-review exports.
26
+ ## 2. The layout root
25
27
 
26
- ## 2. Canvas home — the object database, per-node files, and bounded diagnostics
28
+ The layout root is `~/.crouter` on macOS and `/` on Linux (a container or sandbox); `CRTR_HOME` overrides it. It holds three directories.
27
29
 
28
- `~/.crouter/canvas/` (overridable with `CRTR_HOME`) is the cwd-agnostic node-graph home. `canvas.db` is the SQLite WAL store for every object and its edges, watches, events and rules, including durable tmux-pane focus. `nodes/<node_id>/` owns `meta.json`, `context/` (the node's context directory: scripts, data, logs and page modules — files only, not a way to share writing), `messages/`, `inbox.jsonl`, `transcript.jsonl`, `session.ptr`, and `job/` state. Human ticket files (`page.json`, `page.tsx`, `page.js`, optional `reply-route.json`, `action.json`, `response.json`, `review.json`, and `branch-point.jsonl`) live under `nodes/`, the single derived ticket root. A ticket is not owned by a node: reply-bearing tickets target the bridge recorded in `reply-route.json`, while a ticket created programmatically has no bridge and outlives the process that created it. `action.json` is the frozen action binding — the declared `humanActions` name, its resolved argv and cwd, and the opaque payload — written once at creation and never rewritten, so a later config edit cannot redirect an existing request. Whichever writer wins settlement is the one that queues delivery; the attempt schedule itself is crtrd scheduling state in `canvas.db`, not a ticket file, and delivery never rewrites the ticket's terminal result. Document text, including a package document's, is a content-addressed row in the `bodies` table keyed by the revision's `body_hash`; the old `bodies/` files on a Mac remain only for rollback. All records, revisions, delivery rules, edges and watches are rows in `canvas.db`. A repo-owned document also travels on the repo's git ref `refs/crtr/docs` (one JSON file per document), which is how collaborators receive it; the checkout's working tree never holds it.
30
+ ### `runtime/` — the canvas home
29
31
 
30
- A specification, plan or report is a document its node owns, named `<node-id>/<name>` and shared by `[[pointer]]`. It is deleted with that node unless a kept document links to it or it is given another owner (`crtr doc move --owner`).
32
+ `<layout>/runtime` is the runtime root, returned by `crtrHome()`. It is crtrd's own and is never mounted into an app sandbox.
31
33
 
32
- **Package documents.** crtr's own documents (`src/builtin-memory/` in the crouter repo, owner app `crtr`) and a plugin's `memory/` folder are the exception: they stay markdown files in their package and the daemon reconciles them into public, read-only document objects. See [[internal/plugins]].
34
+ - `pg/` (supervised Postgres), `blobs/`, `secrets/` (sealed env vars; the machine credential on an imported Mac), `machine.json` (an imported Mac's link: API URL, environment id, import run id, directory URL, account).
35
+ - `nodes/<node_id>/job/` — `log.jsonl` (the broker's event stream), `broker.log` (raw stdout/stderr), `telemetry.json` and `fault` (current state, not history). `nodes/<node_id>/messages/` holds inbox bodies too long to inline, written for the broker to read.
36
+ - The node's run folder — `nodes/<node_id>/run/` on macOS, `/run/crtr/nodes/<node_id>/` on Linux — holds `view.sock`, `cli.sock`, `broker-launch.json`, `scopes.json`, `situational-context.md` and per-run `job/` state. It is rebuilt each launch.
37
+ - `requests/<id>/` — a human request's page revisions (`revisions/<rev>/page.json`, `page.tsx`, `page.js`) and `action.json`, the action binding frozen at creation; `reviews/<id>/` — document review results. A cloud role keeps the same files under the blob prefix `requests/<id>`. A request is not owned by a node: settlement, outcome and the delivery schedule are database rows.
38
+ - `plugins/` and `marketplaces/` — user-scope plugin and marketplace checkouts. `repo-sync/<repo>/` — the bare git mirror of a repo object's `refs/crtr/docs`. `bin-shims/<address>/` — symlink shims for bare-binary contributions, prepended to every broker child's PATH and re-derived on demand.
39
+ - `scope/` — the user scope root (`userScopeRoot()`): local files with no database home, such as `feedback/`, `support/<reference>/` (prepared support bundles, zero-egress until submitted), `prompt-reviews/`, viewer pins and completion history. A `config.json` there is legacy: user-scope settings are database rows, read and written through `crtr sys config` and `crtr profile`.
40
+ - `crtrd.log` (the daemon's event stream), `crtrd.err` (raw residue), `generations/` and `selected` (sealed install generations — install machinery, not storage).
41
+ - The API socket `api.sock` is here on macOS and in `/run/crtr` on Linux.
33
42
 
34
- **Legacy memory directories.** Older runtimes kept documents as markdown in `.crouter/memory/` folders under a repo, profile or user root. `crtr sys migrate` imported those once into documents; the files are left on disk and never read again.
43
+ Leftovers from older layouts may remain and are never read in normal operation: `canvas.db.imported*` (the one-time SQLite import into Postgres), `bodies/` (body files copied once into the `bodies` table), and per-node `meta.json`, `inbox.jsonl` and `transcript.jsonl`.
44
+
45
+ ### `apps/<app>/` — what an app's processes may touch
46
+
47
+ Each app (the terminal, a plugin, a Northlight app) gets `apps/<app>/{profiles,conversations,nodes,files,home,cache}`. A node's agent folder is `apps/<app>/nodes/<node_id>/` with `context/` — the node's `$CRTR_CONTEXT_DIR`, for scripts, data, logs and page modules; files only, never the way to share writing — plus `reports/`, `attachments/`, `worktree/`, and `home/` for a node of an isolated run. `conversations/<node_id>/` is the path a broker reads its conversation at; the durable copy is rows and blobs.
48
+
49
+ ### `user/` — the person's files
35
50
 
36
- ### Canonical event streams
51
+ `user/files` is the person's files root on Linux. On a Mac it is the parent of `~/.crouter` (the person's home) unless `paths.user_files` says otherwise.
37
52
 
38
- Canonical diagnostics are bounded NDJSON `EventEnvelope` streams. The synchronous rotating writer retains one active file plus `.1` and `.2` generations at 5 MiB each, and each complete record is bounded to 64 KiB including its newline. Each long-lived daemon or broker process binds one fixed source and writes only that source's file; no caller selects an arbitrary destination.
53
+ ## 3. Project scope
39
54
 
40
- - `nodes/<node_id>/job/log.jsonl` is the node broker's canonical event stream. A broker-bound event carries that node identity; daemon events about a node stay in the daemon stream instead.
41
- - `<crtrHome>/crtrd.log` is the root daemon's canonical event stream. It contains daemon-owned events, including node-scoped data carried as `node_id` fields.
55
+ `<project>/.crouter/` is the project scope, found by walking up from the cwd. Its `config.json` and `state.json` stay files, with `operations.db` beside them; every crtr process auto-creates them in a project that has none. A project's plugins and marketplaces live in its `plugins/` and `marketplaces/`. The scope root does not decide document ownership.
42
56
 
43
- ### Current state and raw residue
57
+ **Legacy memory directories.** Older runtimes kept documents as markdown in `.crouter/memory/` folders under a repo, profile or user root. `crtr sys migrate` imported those once into documents; the files are left on disk and never read again.
58
+
59
+ ## 4. What git carries
60
+
61
+ A repo-owned document travels on the repo's git ref `refs/crtr/docs` (one JSON file per document), which is how collaborators receive it; the checkout's working tree never holds it. crtr's own documents (`src/builtin-memory/` in the crouter repo, owner app `crtr`) and a plugin's `memory/` folder stay markdown files in their package, and the daemon reconciles them into public, read-only document objects; see [[internal/plugins]].
62
+
63
+ A specification, plan or report is a document its node owns, named `<node-id>/<name>` and shared by `[[pointer]]`. It is deleted with that node unless a kept document links to it or it is given another owner (`crtr doc move --owner`).
44
64
 
45
- `nodes/<node_id>/job/fault` is mutable current fault state, not event history. `nodes/<node_id>/job/telemetry.json` is current node telemetry, not a log; both remain runtime state under the canvas home and are read as state rather than merged into canonical history.
65
+ ## Event streams and raw residue
46
66
 
47
- `<crtrHome>/crtrd.err` and `nodes/<node_id>/job/broker.log` are raw process/stdout-stderr residue for runtime warnings, third-party output, and last-resort evidence when canonical emission cannot complete. They are not canonical streams, are not parsed as event envelopes, and do not become JSON event output.
67
+ Canonical diagnostics are bounded NDJSON `EventEnvelope` streams. The writer keeps one active file plus `.1` and `.2` generations at 5 MiB each, and each record is at most 64 KiB including its newline. Each long-lived process binds one fixed source and writes only that file: a broker writes `nodes/<node_id>/job/log.jsonl`, and crtrd writes `<runtime>/crtrd.log` (node-scoped daemon events carry a `node_id` field there). `crtrd.err` and `job/broker.log` are raw process output — last-resort evidence, never parsed as events.
48
68
 
49
- `<crtrHome>/bin-shims/<address>/` holds the symlink shims for bare-binary contributions (`bin` in a plugin manifest or a scope `config.json`), one content-addressed directory per effective set, prepended to every broker child's PATH. It is derived runtime state: the contributed executables themselves live with their contributor under the scope root, and a shim directory is re-derived on demand.
69
+ ## Where a new file belongs
50
70
 
51
- The contributor rule: configuration, prompts, plugins and personas → scope root; objects (documents included), node files, human tickets, current state, canonical streams, and raw residue → canvas home. Runtime install generations under `~/.crouter/runtime/generations/` are sealed install machinery, not a place state is stored or an agent workspace.
71
+ Persistent state another process or role must see → a database row, or a blob when it is large. Configuration that belongs to a project → `<project>/.crouter/`. Per-node runtime files, diagnostics and crtrd's own local caches → `runtime/`. Anything an app's agent writes → its app space, usually the node's `context/`.
@@ -102,7 +102,7 @@ It refreshes every connection last saved before the cutoff, through the store's
102
102
 
103
103
  ## Acting without a sign-in
104
104
 
105
- A server that acts for a person on their hosted runtime, for example to publish events to the objects they watch, uses `oauth.appClient(userId)` instead of `oauth.client(userId)`. It stores no connection and refreshes nothing: the SDK signs a `client_credentials` request with your app's key for `sub=user:<id>`, and the directory answers a token and the person's `runtimeUrl`.
105
+ A server that acts for a person on their Northlight runtime, for example to publish events to the objects they watch, uses `oauth.appClient(userId)` instead of `oauth.client(userId)`. It stores no connection and refreshes nothing: the SDK signs a `client_credentials` request with your app's key for `sub=user:<id>`, and the directory answers a token and the person's `runtimeUrl`.
106
106
 
107
107
  ```ts
108
108
  const runtime = await oauth.appClient('user:o1');
@@ -113,7 +113,7 @@ It needs the app registered with the `app_token_for_user` operation, and an acti
113
113
 
114
114
  | Error | Code | Means |
115
115
  |---|---|---|
116
- | `NoHostedRuntimeError` | `no_hosted_runtime` (409) | The person has no hosted runtime. Not retryable. |
116
+ | `NoHostedRuntimeError` | `no_hosted_runtime` (409) | The person's account has no runtime to act on. Not retryable. |
117
117
  | `NotGrantedError` | `not_granted` (409) | The person has no active grant for your app, so they have not signed in to it. Not retryable. |
118
118
  | any error with `retryable: true` | `runtime_provisioning` (503), a directory 5xx or a 429 | Try again later. |
119
119
 
@@ -22,7 +22,7 @@ Codes the SDK raises itself are listed in `sdkErrorCodes`, and `CrouterError.cod
22
22
  | `oauth_nonce_missing` | `exchangeIdentity` was called without the `nonce` from `authorizeUrl`. | Save the nonce in the visitor's session and pass it back. |
23
23
  | `oauth_state_mismatch` | The callback's `state` was missing or differed from the saved one. | Refuse the callback. |
24
24
  | `not_connected` | `oauth.client(userId)` or a refresh found no stored connection for that person. | Show "sign in again". |
25
- | `no_hosted_runtime` (409, `NoHostedRuntimeError`) | `oauth.appClient(userId)`: the person has no hosted runtime to act on. Not retryable. | Skip them, or ask them to set up a hosted runtime. |
25
+ | `no_hosted_runtime` (409, `NoHostedRuntimeError`) | `oauth.appClient(userId)`: the person's account has no runtime to act on. Not retryable. | Skip them. |
26
26
  | `not_granted` (409, `NotGrantedError`) | `oauth.appClient(userId)`: the person has no active grant for your app. Not retryable. | Send them through sign-in ([[northlight-apps/concepts/connections]]). |
27
27
  | `refusal_handler_reentry` | An `onRefusal` handler called `oauth.client` (or a refresh) for the person whose connection it is handling. | Don't call the runtime for `refusal.userId` inside the handler. |
28
28
  | `unauthorized` (401, `AuthenticationError`) | The directory refused your app's client assertion (`invalid_client`) on `exchangeCode`, a refresh or `revoke`, including a refresh inside a client from `oauth.client(userId)`. The message names the key id (`kid`) you signed with and asks whether that key's public JWK is registered. `details` is `{oauth_error: 'invalid_client', kid}`, or `key_thumbprint` instead of `kid` for a key with no `kid`. | Check that the key's public JWK is on the app's **Sign-in** tab ([[northlight-apps/guides/manage-your-app]]). |
@@ -14,9 +14,9 @@ Your app runs on a server you choose. Northlight hosts two other things: the dir
14
14
  |---|---|---|
15
15
  | **Your server** | Anywhere you choose. Your laptop while you develop. | Your pages and logic. It holds the app's private signing key and a stored connection for each person. |
16
16
  | **The directory** | `https://account.northlight.ai`, hosted by Northlight | Accounts, app registration (the console at `/console`), consent, tokens and the marketplace. |
17
- | **The person's runtime** | Hosted by Northlight, one per person | Their agents, runs, files, documents and providers (sms, search and others), using their own AI subscription. |
17
+ | **The person's runtime** | Northlight's cloud. One shared control plane serves everyone; each of the person's agents runs in its own sandbox. | Their agents, runs, files, documents and providers (sms, search and others), using their own AI subscription. |
18
18
 
19
- "Build on Northlight" therefore means three things. Your app's agent work runs on the person's Northlight-hosted runtime. People sign in to your app with their Northlight account. And your app can be listed in the Northlight marketplace.
19
+ "Build on Northlight" therefore means three things. Your app's agent work runs on the person's Northlight runtime, in Northlight's cloud. People sign in to your app with their Northlight account. And your app can be listed in the Northlight marketplace.
20
20
 
21
21
  ```mermaid
22
22
  sequenceDiagram