xmemcli 2.0.1__tar.gz → 2.0.2__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: xmemcli
3
- Version: 2.0.1
3
+ Version: 2.0.2
4
4
  Summary: Command-line client for the xmemory HTTP API: PKCE auth, instances, read/write, schema and XMD tools.
5
5
  Keywords: api,cli,llm,memory,xmemory
6
6
  Requires-Python: <4,>=3.12
@@ -61,7 +61,7 @@ Two local files, same discovery rule, different jobs: `.xmemrc.json` holds the c
61
61
  | `xmemcli read --read-mode xresponse` | `mode: "xresponse"` |
62
62
  | `xmemcli read --related-types` | `include_related_types: "types"` — the response's `related_types` object is kept in the curated output |
63
63
  | `xmemcli read --related-types-depth 2` | `include_related_types: "types"` and `related_types_depth: 2` — the catalog entries carry their `distance` and, below the last level, their own edges |
64
- | `xmemcli read --return-sql` | `return_sql: true`. The curated output keeps `sql`, `sqls` (`sub_query` and `sql`), and the safe `sql_attempts` fields (`sql`, `read_query`, `row_count`, `is_success`, `attempt_outcome`, `error_message`, `sqlstate`). When the response includes none of them, the output carries `sql_unavailable` and does not say why. The flag is off by default: the request omits `return_sql`, and any of those fields on a response are dropped |
64
+ | `xmemcli read --return-sql` | `return_sql: true`. The curated output keeps `sql`, `sqls` (`sub_query` and `sql`), and the safe `sql_attempts` fields (`sql`, `read_query`, `row_count`, `is_success`, `attempt_outcome`, `error_message`, `sqlstate`). When curation retains none of the three SQL fields, the output carries `sql_unavailable`. The flag is off by default: the request omits `return_sql`, and any of those fields on a response are dropped |
65
65
 
66
66
  `--read-mode` selects the **server-side answer shape**; `--json` and the TTY rule govern stdout format.
67
67
 
@@ -69,11 +69,13 @@ Two local files, same discovery rule, different jobs: `.xmemrc.json` holds the c
69
69
 
70
70
  Interactive help and trace JSON use a dark-terminal palette by default. When `COLORFGBG` reports a white background (`7` or `15`), xmemcli uses darker colors for light terminals. Set `XMEMCLI_THEME=light` or `XMEMCLI_THEME=dark` to choose explicitly when the terminal does not report its background. `NO_COLOR` still disables colors.
71
71
 
72
- ## Curated output
72
+ ## Command output
73
73
 
74
- The CLI does not echo raw API payloads. Server internals (`diff_plan`, extraction trees) are never emitted. `sql`, `sqls`, and `sql_attempts` are kept only for `read --return-sql`, and only as the fields the read API already returns for that option; other keys on an attempt are dropped. If that flag is set and the response includes none of them, the output says SQL was requested and not included (`sql_unavailable`): the server may have withheld it, or no statement was executed. Read responses keep `pending_suggestions` (schema-evolution hint). A text write keeps a compact `extracted` summary (`Type(identifier)` tags); a structured write runs no extraction and has none. `write` and `write-status` keep the server's `changes` block (created / updated with old → new / deleted, bulk summaries, advisory records) when the write changed something. `--verbose` adds `trace_id` and `console_url` when present.
74
+ Commands such as `read`, `write`, and `instance get` curate their output and omit server internals such as `diff_plan` and extraction trees. `sql`, `sqls`, and `sql_attempts` are kept only for `read --return-sql`, and only as the fields the read API already returns for that option; other keys on an attempt are dropped. If that flag is set and curation retains none of the three SQL fields, the output carries `sql_unavailable`. Read responses keep `pending_suggestions` (schema-evolution hint). A text write keeps a compact `extracted` summary (`Type(identifier)` tags); a structured write runs no extraction and has none. `write` and `write-status` keep the server's `changes` block (created / updated with old → new / deleted, bulk summaries, advisory records) when the write changed something. Where supported, `--verbose` adds command-specific context such as `trace_id` and `console_url`. Added context appears in JSON output. With `--verbose`, `org list keys` includes every metadata field the API returns for each key (never the plaintext key). Terminal output shows the prefix, name, and active status.
75
75
 
76
- **`trace …` is the one deliberate exception.** Those commands return the Console's own operation documents — the paged operations list, the Inspect search, and the per-operation detail — **verbatim**, because the Console already curates them per caller (a privileged caller sees LLM calls and raw token counts; everyone else does not). They are JSON on every stream and carry every internal id the Console does: `trace_id`, `instance_id`, `session_id`, `user_id`, `api_key_id`, and on detail documents `source_id`, `migration_id`, `llm_call_id`, `gateway_request_id`, …
76
+ Commands such as `instance setup`, `schema get`, and `xmd generate` use the unwrapped API document as their payload. Commands such as `org manage roles list` and `org memberships list` use the account management reply as their payload.
77
+
78
+ Trace commands emit the Console's own operation documents, including the paged operations list, Inspect search, and per-operation detail. The Console curates them per caller and exposes LLM calls and raw token counts only to privileged callers. Trace documents are printed as JSON on every stream and carry the IDs the Console returns, including `trace_id`, `instance_id`, `session_id`, `user_id`, `api_key_id`, and on detail documents `source_id`, `migration_id`, `llm_call_id`, and `gateway_request_id`. In JSON mode, when the CLI records warnings, it adds or extends the `warnings` key on object payloads, including trace documents.
77
79
 
78
80
  ## Trace — the Console's operation traces, from the CLI
79
81
 
@@ -177,7 +179,7 @@ xmemcli version
177
179
  xmemcli auth login
178
180
  ```
179
181
 
180
- Version: **2.0.1**.
182
+ Version: **2.0.2**.
181
183
 
182
184
 
183
185
  ---
@@ -298,7 +300,7 @@ Each login binds its own port and names it in the login URL, so concurrent login
298
300
 
299
301
  # `xmemcli` — capabilities reference
300
302
 
301
- **Version:** `2.0.1` (see `xmemcli version`)
303
+ **Version:** `2.0.2` (see `xmemcli version`)
302
304
 
303
305
  `xmemcli` is the command-line client for the **xmemory HTTP API**. It is **human-approved for key acquisition**: an AI-assisted IDE may run reads, writes, and inventory, and may initiate `auth login`, but a key is only issued after one explicit human approval — a click in the Console UI (PKCE handoff), an approval of a sign-in email (`--email`), or, with `--auto-approve`, the Console session the human already holds in that browser (signed in before, or right then through the Console's own email, Google, GitHub or OIDC sign-in). The one exception derives from such a key rather than replacing the approval: `org create key` lets a key that was already approved mint a key no wider than itself, for the same user, on one of its own clusters, deactivated with it. Quota limits change only in the **Console UI**. The full acquisition contract is in the auth-flow reference bundled with this package.
304
306
 
@@ -318,7 +320,7 @@ Every command below has dedicated help — see [Help](#help).
318
320
  |---------|-------------|
319
321
  | **`write`** `[text]` | Sync write (`POST …/write`). `--extraction fast\|deep` (default `fast`). `--no-wait` queues async write, returns `write_id`. `--scope TYPE:ID` (repeatable) anchors the write to existing objects: only they may be modified/deleted; by default new objects and links to them are allowed and anything else fails, and under `--scope-mode drop` only the objects a `--scope` names may be created and everything else is skipped; works with either extraction mode. `--scope-mode drop` (needs `--scope`) skips out-of-scope changes instead of failing and lists them under `changes.skipped_out_of_scope` (a server change, not a CLI one: past 100 entries the server folds the rest into lines shown with `folded=true` and no key or fields); it creates only records a `--scope` names by primary key, and such a record need not be stored yet — create-or-update exactly the named record. `reject` is the server default and is not sent. Instead of text, a **structured write** sends `structured_mutations` — deterministic creates, updates and deletes with no extraction: `--mutations-file PATH` or `--mutations-stdin` (one JSON array, same shape as the API's `structured_mutations`; see [Structured writes](#structured-writes)) and/or `--delete TYPE:ID` (repeatable, `--scope` syntax: `Person:name=Ada`; appended after the file's entries) and/or `--delete-match TYPE:field=value` (repeatable; a type without a primary key, by values its one record holds; appended after the `--delete` entries). Text and mutations are exclusive, as are the file and stdin forms; mutations refuse `--scope` and `--extraction deep`; empty or whitespace-only text is refused (exit **2**, before anything is read or sent). A text write's output lists what it extracted as `Type(identifier)` tags (`extracted`); a structured write's does not. Both carry the server's `changes` block (`created` / `updated` with per-field `old_value` → `new_value` / `deleted`, and any other bucket such as `created_keyless_objects`) whenever the write changed something, and on a drop-mode write that skipped everything, where the block carries `skipped_out_of_scope` alone; a scoped write that left a scoped record untouched carries it too, with `untouched_scope_records`. A `--no-wait` answer carries only the `write_id`; `write-status` reports the `changes` once the write completes. |
320
322
  | **`write-status`** `<write_id>` … | Poll async writes until terminal or `--timeout` (default 60s). Accepts multiple ids. A completed write's non-empty `changes` block is kept, as on `write`. |
321
- | **`read`** `<query>` | Read from active instance. `--read-mode single\|raw\|xresponse`, `--scope TYPE:ID` (repeatable), `--scope-relations`, `--related-types` (also return `related_types`: per object type the read touched, the fields it did not return and the object types a declared relation links it to; needs `instance.get` on the key), `--related-types-depth N` (1, 2 or 3, refused as a usage error otherwise; follow the relations N levels out, each catalog entry saying its distance; implies `--related-types`), `--return-sql` (send `return_sql: true` and keep the response's `sql`, `sqls`, and the safe `sql_attempts` fields in JSON and pretty output, where pretty output prints `sql` only when there are no per-sub-query `sqls` entries, since those already show each statement; without the flag those fields are dropped even if a server sent them; when the flag is set and the response includes none, say so without guessing why). |
323
+ | **`read`** `<query>` | Read from active instance. `--read-mode single\|raw\|xresponse`, `--scope TYPE:ID` (repeatable), `--scope-relations`, `--related-types` (also return `related_types`: per object type the read touched, the fields it did not return and the object types a declared relation links it to; needs `instance.get` on the key), `--related-types-depth N` (1, 2 or 3, refused as a usage error otherwise; follow the relations N levels out, each catalog entry saying its distance; implies `--related-types`), `--return-sql` (send `return_sql: true` and keep the response's `sql`, `sqls`, and the safe `sql_attempts` fields in JSON and pretty output, where pretty output prints `sql` only when there are no per-sub-query `sqls` entries, since those already show each statement; without the flag those fields are dropped even if a server sent them; when the flag is set and curation retains none of those fields, include `sql_unavailable`). |
322
324
 
323
325
  Requires **`--instance-id`** or **`$XMEM_INSTANCE_ID`** for read/write (or auto-pick when exactly one instance is visible — see [Global flags](#global-flags--environment)).
324
326
 
@@ -345,7 +347,7 @@ Permission-filtered view of what this API key can see.
345
347
  | **`org list instances`** | Instances visible to this credential, as a bare array of records. A key minted with `data.read` but not `instance.get` (the supported shape for `trace …`) gets the ids only — the same set `trace ls` is scoped to — as a **degraded document** rather than an array: `{"items": [{"id": …}, …], "degraded": true, "missing_permission": "instance.get"}` (`"instance.get_own"` from a server before scoped role assignments, which names the permission so), with the warning on stderr and in the document's `warnings`. The shape changes so a script cannot read an ids-only listing as a complete one; an array is never wrapped just to carry a warning. |
346
348
  | **`org list keys`** | API keys visible to this credential (metadata only; plaintext never returned) |
347
349
  | **`org key`** `[name-or-prefix]` | Metadata and assignments for a visible key, loaded from `/scoped-api-keys`, `/assignments` and `/roles?include_permissions=true`. Each assignment retains its role permissions, scope UUID, access mode and scope rules; no flat union is presented as access to every target. Older servers use the legacy single-role representation. UUID role and resource identities remain separate; names/prefixes select a unique visible result or report ambiguity. Secrets are never listed. |
348
- | **`org create key`** `--name` `--role` `--cluster` `--out` | Mint a key for this user bound to exactly one cluster this key can already see. `--cluster` is a name or an id; `--role` is the role's name (`org key` shows the role of each key you hold), or its id when two roles share the name. The new role cannot grant a permission this key lacks, and the issuing key must itself hold `api_key.create`. The key is written only to `--out`, a new file created 0600 (an existing file is refused); output carries `key_prefix` and `key_file`, never the key, and nothing goes to `.xmemrc.json`. The new key keeps that one cluster (clusters created later are not added), expires no later than this key, and is deactivated when this key is, or unlinked from the cluster when this key is. To contain a leaked key, deactivate it in the Console: what it minted goes with it. A lost reply or a 5xx says a key may still exist, except the server's own **503** (busy), which created nothing; a **429** is a temporary mint limit whose message says which (another mint by this user is still running, this user's keys created too many keys recently, or the server is tracking as many minting users as it can), and a **400** a request the server refuses (such as a `--name` over 255 characters): neither created a key, and a 429 or 503 is safe to retry after a short wait (the server's `Retry-After` is not shown). A 404 means `--cluster` is not linked to this key; a 422 that names `api_role_name` means the server predates this command, which needs a server from the same release as this CLI; a 403 saying only `Insufficient permissions` means the server predates the release that lets a key create keys, and any other 403 that it will not mint this key: the role, the owner's permission, this key or the cluster. Current servers require the issuing key’s own create permission and delegation authority; older servers can instead report an owner-permission refusal through the legacy `user_may_mint_keys` diagnostic. |
350
+ | **`org create key`** `--name` `--role` `--cluster` `--out` | Mint a key for this user bound to exactly one cluster this key can already see. `--cluster` is a name or an id; `--role` is the role's name (`org key` shows the role of each key you hold), or its id when two roles share the name. The new role cannot grant a permission this key lacks, and the issuing key must itself hold `api_key.create`. The key is written only to `--out`, a new file created 0600 (an existing file is refused); output carries `key_prefix` and `key_file`, never the key, and nothing goes to `.xmemrc.json`. The new key keeps that one cluster (clusters created later are not added), expires no later than this key, and is deactivated when this key is, or unlinked from the cluster when this key is. To contain a leaked key, deactivate it in the Console: what it minted goes with it. A lost reply or a 5xx says a key may still exist, except the server's own **503** (busy), which created nothing; a **429** is a temporary mint limit whose message says which (another mint by this user is still running, this user's keys created too many keys recently, or the server is tracking as many minting users as it can), and a **400** a request the server refuses (such as a `--name` over 255 characters): neither created a key, and a 429 or 503 is safe to retry after a short wait (for a 429, the CLI shows the delay when the server gives `Retry-After` in seconds as up to ten ASCII digits and includes the value as sent, including zero, as `retry_after_seconds` in JSON). A 404 means `--cluster` is not linked to this key; a 422 that names `api_role_name` means the server predates this command, which needs a server from the same release as this CLI; a 403 saying only `Insufficient permissions` means the server predates the release that lets a key create keys, and any other 403 that it will not mint this key: the role, the owner's permission, this key or the cluster. Current servers require the issuing key’s own create permission and delegation authority; older servers can instead report an owner-permission refusal through the legacy `user_may_mint_keys` diagnostic. |
349
351
 
350
352
  ---
351
353
 
@@ -544,9 +546,9 @@ so a typo fails loudly rather than being ignored.
544
546
 
545
547
  What the Console shows on an instance's **Operations** tab (a paged list), on **Inspect** (a
546
548
  search across operations), and in each operation's detail pane, plus (for the few keys allowed to read them) the LLM calls of a
547
- session, which no Console view lists — fetched from the same Console endpoints, with this CLI's API key, and emitted **as the Console serves them**. Nothing is curated
548
- or reshaped: the Console already curates per caller, and a field the Console adds shows up here
549
- the same day. These documents are for scripts and agents; on a terminal they are only indented
549
+ session, which no Console view lists — fetched from the same Console endpoints, with this CLI's API key.
550
+ The Console curates these documents per caller. In JSON mode, the CLI adds or extends the
551
+ `warnings` key when it records warnings. These documents are for scripts and agents; in pretty mode they are only indented
550
552
  and coloured (`NO_COLOR` / `FORCE_COLOR` honoured). Flags only — there is no query language to
551
553
  learn; the CLI composes the Console's search clauses itself.
552
554
 
@@ -576,7 +578,7 @@ learn; the CLI composes the Console's search clauses itself.
576
578
 
577
579
  **Each `llm_calls[]` entry**, oldest first, is a call made under the operation's id that names the document's instance, or names none (calls recorded before the API sent one, and work that runs for no instance, such as a schema generation): trace ids are not unique, so another instance's operation can share the id. A call that names no instance carries `names_no_instance: true`, since it is listed by the operation id alone and may be that other operation's; a call that names the document's instance carries no such key. Its fields: `llm_call_id`; `sub_stage` (the pipeline stage that made the call); `model_type` (the model slot asked for) and `provider` (the one that served it); `called_at`; `time_taken_ms`; `prompt_tokens`, `completion_tokens`, `reasoning_tokens` (part of the completion, not added to it), `total_tokens`; `is_cached`, `is_success`, `is_refusal`, `error_message`, `gateway_request_id`; `prompt`, `json_schema`, `result`. Then what explains a call's outcome:
578
580
 
579
- - `reissue_of_llm_call_id` and `reissue_reason`: this call re-issues the earlier call with that id, which failed with that error code. A call sent to another model after it was refused, blocked for its content, or answered with replies that kept failing its schema, and the intent pipeline's verification call sent to its fallback model after a provider error; a reply cut at its output ceiling sent again with a higher one; on writes the same overflow sent to another model at the same ceiling; and the intent pipeline's operations call cut at its ceiling sent again to the same model at the same ceiling: all are re-issues. `reissued_as_llm_call_ids` is the other direction: the calls in the same list that re-issue this one. So either call leads to the other, with no second request.
581
+ - `reissue_of_llm_call_id` and `reissue_reason`: this call re-issues the earlier call with that id, which failed with that error code. A call sent to another model after it was refused, blocked for its content, or answered with replies that kept failing its schema, the intent pipeline's verification call sent to its fallback model after a provider error, and the SQL call of a read part routed to `reader.model_name_for_reader_sql` sent to the instance's reader model after a provider failure (its `reissue_reason` is then a gateway code such as `internal_rate_limit_exceeded`, or `attempt_cap_exceeded` or `unknown_slot`, which the reader names itself), or after the reader refused the plan that call wrote (`candidate_audit_rejected`, `fanned_out_aggregate`, `tie_broken_ranking` or `linked_rows_ranking`); a reply cut at its output ceiling sent again with a higher one; on writes the same overflow sent to another model at the same ceiling; and the intent pipeline's operations call cut at its ceiling sent again to the same model at the same ceiling: all are re-issues. `reissued_as_llm_call_ids` is the other direction: the calls in the same list that re-issue this one. So either call leads to the other, with no second request.
580
582
  - `max_tokens`, `temperature`, `schema_property_order`, `no_cache`: the settings the call requested, not necessarily what the model ran with: depending on the model and its settings, no temperature is sent at all. `schema_property_order` is also null for a call sent without a schema.
581
583
  - `finish_reason`: why the model stopped, in the provider's own words, not normalised. `end_turn`, `stop`, `STOP` and `tool_use` are normal stops; `max_tokens`, `length` or `MAX_TOKENS` means the reply hit its output ceiling, and `model_context_window_exceeded` means the prompt and reply outgrew the context window. On a failure it is set where the model side reports it: always for those two, and for a refusal, a content filter or safety stop, or a schema miss after the model side's own retry where it reports those too; null otherwise. Read a refusal from `is_refusal`. One exception to "the provider's words": a cached reply (`is_cached: true`) stored by an earlier release of the service can read `stop` whatever the provider reported.
582
584
  - `rejected_attempts`: the replies rejected before this call's answer or error (one that missed the schema, say), as an array; a recorded value that is not valid JSON is served as its text.
@@ -591,7 +593,7 @@ learn; the CLI composes the Console's search clauses itself.
591
593
 
592
594
  A value the call did not record is `null`, and `reissued_as_llm_call_ids` and `gateway_repairs` are `[]`; calls recorded before these fields existed read that way throughout.
593
595
 
594
- **Each `step_decisions[]` entry** is one record of what one step of the operation decided, oldest first (by `recorded_at`, then `sub_stage`). A step records each time it runs and decides something (a step that decided nothing records nothing), so one operation can hold several records of one step, and every record is served; none is merged into another. A write's deletion check records in its own process and again where the diff engine applies its gate, and a write retried whole under the same trace id (a stale-schema retry, a stall requeue, a stuck write claimed again) records every step again. Writes, reads and schema evolution record today. A write's extraction records too, under `extraction.` steps named like its model calls (`extraction.structured_output`, `extraction.description_merger`, `extraction.batch_field_extractor`, `extraction.field_verifier`, `extraction.relations_extractor`, `extraction.relations_verifier`, `extraction.phantom_record_check`, `extraction.deduplication`): what code decided about a reply (candidates folded into one, a reply set aside so the extracted values stand, connections dropped, a candidate left out of the write, a group of types split), and the verifiers' own rejections. The phantom record check records one `object` item per record whose key value a record of another type in the write carries (or, for a record with no key, whose stated values one states alike, with `detail.description`): `not_held` (the check found the text does not present the entity as that type, so the record is marked as one that does not hold), `kept`, `kept_unchecked` (the check did not decide, or the write had more such values than it checks), or `not_run` (the check did not run on the write; `detail.not_run_reason` is `switched_off` or `pinned_provider`), with the other types in `detail.shared_with`. Field verification records once per object type, when that type's field processing ends; a write that fails before then records none for that type. When the judge in front of field verification is configured but does not run on a write whose detection found something, the write records why, once, under the stage the judge's calls would journal under (`extraction.verification_judge`, or `shadow.extraction.verification_judge` in shadow mode): one item, `kind` `judge`, `decision` `not_run`, with `detail.not_run_reason` (`sampled_out`, `pinned_provider` or `config_unavailable`) and `detail.mode`. Extraction's items have the diff engine's shape: `kind` is `merge`, `object`, `relation`, `relation_type` or `type_group`; `decision` is `folded`, `skipped`, `not_held` (the verifier found the text does not state the object holds, so it is marked as one that does not), `kept_unverified`, `verifier_skipped` (field verification did not run because the judge in front of it cleared the object), `kept`, `kept_unchecked`, `key_restored`, `rejected`, `uncastable`, `dropped`, `split` or `escalation_disabled`; `detail` holds field names, candidate numbers and counts (`candidate_count`, `candidate_numbers`, `kept_number`, `ignored`, `basis`, `filled_fields`, `conflicting_fields`, `relations_repointed`, `fields`, `nulled`, `omitted`, `connection`, `field`, `candidates_per_link`, `relations`, `types`, `halves`, `refused_max_tokens`, `error_code`, `shared_with`), and no field's value except an object's key: in `key`, in a dropped relation's `links` (`Type(field='value')` per link), and a `description` for an object that has no key. `/extract` records its extraction the same way; it has no detail document of its own, so its records show only on a write's document when that write, on the same instance, reuses its trace id. A write's apply records what its merges did to the stored rows, under `write.merge_application`, once the write commits (a write that rolls back records none): one item per merge action, `kind` `merge`, named by the surviving row (the diff engine's `merge` items are named by the row merged away instead): its `object_type`, its `key` (absent for a type without a key, for a key with any part NULL or missing, which could name another row, and when the two rows were one) and its internal id, with `decision` `applied` and, in `detail`, the row merged away (by its internal id), `relations_repointed`, `relations_dropped` by reason (`linking_the_merged_rows`: a relation between the two merged rows; `removed_by_this_write`; `duplicate`: one the survivor already held) and `filled_fields`, the survivor's empty fields filled from the merged-away row, by name; or `decision` `nothing_to_merge` with why in `reason` (the two rows were one, or the row to merge away was already gone). Schema evolution records under `operation_kind` `evolution`: review, decide and apply each journal their steps' records once, when the stage ends, under their own trace, so an apply's show on its update document (its trace is the update id), and the detached pass that resolves an apply's gaps afterwards journals its own under the same trace. Its steps are the two model calls' names, `gap analyzer` (gaps never analysed or stored with no concepts, rows a reply left pending, concepts the parser dropped) and `semantic gate` (what the gate may do with each suggestion, candidates kept without a verdict, verdicts downgraded or not acted on), and the rule steps `evolution.backlog`, `evolution.resolution_filter`, `evolution.clustering`, `evolution.consolidation`, `evolution.prior_decisions`, `evolution.prerequisites`, `evolution.evidence_retirement` and `evolution.apply`; `kind` is `gap` (named by its feedback id in `key` and its concept's object and field), `suggestion` (its fingerprint in `key`, its change's names, and the gaps it was built from in `detail.gaps`, the first 20 with `gaps_total` when there are more), `cluster`, `decision`, `backlog`, `reply_entry`, `build` or `gate`, and no item carries what a user wrote. What a transaction did (a gap resolved, stored with no concepts, deleted or retired) is recorded only once it commits, and a row only when that step's own write or delete reached it. A build retried on a stale schema records both attempts: once the build runs again, every item the stage notes until it ends, the build's and the stage's own after it, carries `detail.attempt` (`2`), so an item without `attempt` was noted before the build ran again, and a `retried` item under `evolution.consolidation` records that it did; an `omitted` item is a marker, not a decision, and carries no `attempt`. A read records what the reader's own rules decided, under the name of the model call whose reply a decision is about (`read.question_decomposer`, `read.sql_syntax_fixer`, `read.empty_result_reviewer`, `read.overfetch_reviewer`, `read.answer_formatter`) or under a rule step (`read.scope`, `read.vector_grounding`, `read.sql_rewrites`, `read.sql_guard`, `read.sql_retries`, `read.answer`, and `read.other` for a family no step claims yet); a decision about a SQL statement a model call wrote goes under `read.sql_rewrites`, with the calling step in `detail.phase` where the rule names it. A read step that decided more than 101 times keeps its first and last 50 decisions, with one item (`decision` `omitted`, `detail.count`) where the rest were left out, cut further from the middle when they do not fit one record. A read journals its records once, when it ends, so a read still running has none yet, and a read retried on a stale schema runs again under the same trace id and records every step again; its items have `kind` (the decision family, such as `sql_guard_refused` or `distinct_order_by_case_dropped`), `decision` (`applied` or `not_applied`), `reason` where the rule says why, and `detail.part`, the part of a decomposed question the decision was made for, counted from 1, where it was made for one. `sub_stage` names the step in the `llm_calls[].sub_stage` vocabulary, so a step's decisions and its model calls join on it (a re-issued call journals under its step's name with a suffix such as `.refusal_fallback`, so it joins on the name as a prefix; the reader's rule steps, `extraction.deduplication` and `write.merge_application` have no model calls of their own) (`diff_engine.keyless_binding`, `diff_engine.deletion_check`, `diff_engine.intent_rules`, `diff_engine.value_span_containment`, `diff_engine.intent_verification_deep`, `diff_engine.alias_confirmation`, `diff_engine.object_resolution`, `diff_engine.unwritten_identity_verification`, `diff_engine.plan_construction`, the intent pipeline's `diff_engine.intent_gate`, `diff_engine.intent_operations`, `diff_engine.operations_repair` and `diff_engine.operations_verification`, Phase 1's `diff_engine.operations_second_opinion`, and the `read.` steps above). A model call made in shadow mode, beside the work it never changes and never charged, carries the prefix `shadow.` on its step's name; the intent pipeline and the verifiers' two judges are the steps that run in shadow today. The field verifier's judge, which can stand in front of `extraction.field_verifier` on a DEEP write or `/extract`, makes its calls under `extraction.verification_judge`, or `shadow.extraction.verification_judge` in shadow mode, and records under that same stage, once per object type, one item per object it was asked about: `kind` `object`, `decision` `flagged` (a field at or over its threshold, or one no question covered), `cleared` or `not_judged` (no verdict, which counts as every field flagged), with `detail.field_scores` (the flagged fields the judge scored, and their scores), `detail.unjudged_fields` (flagged fields no question covered), `detail.score`, `detail.field` and `detail.question` (the top score and where it came from), `detail.threshold`, `detail.questions_asked` and `detail.verifier` (`ran`, `ran on the flagged fields and the key`, or `skipped`). In on mode the verifier is asked only about the flagged fields and the key; in shadow mode it sees every field, and the item says what on mode would have sent it. A `verifier_skipped` item under `extraction.field_verifier` is an object an `extraction.verification_judge` call of the same operation cleared; every question and answer is in that call in `llm_calls[]`. The relation verifier's judge, which can stand in front of `extraction.relations_verifier` on DEEP writes and DEEP `/extract` calls, names its calls `extraction.relation_verification_judge`, or `shadow.extraction.relation_verification_judge` in shadow mode, and records under that same stage one verdict item per verifier call: `kind` `relation_type`, `decision` `flagged` (a proposed connection at or over its threshold), `cleared` or `not_judged` (no verdict, or two proposed connections sharing a unique key's values, which counts as flagged), with `detail.connection_scores` (the flagged connections' positions in the proposed list, counted from 1, and their scores), `detail.score` and `detail.top_connection` (the top score and its position), `detail.connections` (how many were proposed), `detail.threshold`, `detail.questions_asked` and `detail.verifier` (`ran`, or `skipped` when on mode kept the call's connections as proposed). A call on mode kept as proposed also records there any connection code dropped while building it (`kind` `relation`, `decision` `dropped`). A write it does not run on records one `kind` `judge`, `decision` `not_run` item under its stage, as the field verifier's judge does. The intent pipeline names its model calls by its step names above, with the prefix `shadow.` in shadow mode (`diff_engine.operations_repair` the operations step asked once more about the entries its checks dropped); `diff_engine.intent_operations` records what the write did with the answer in on mode only, where it stands in for `diff_engine.intent_rules`, and in either mode (with the prefix in shadow mode), once the run has finished, one item when the operations call ran out of its output budget and was asked once more: `kind` `intent_operations`, `decision` `retry_answered` or `retry_failed`, and `detail.model`, `detail.error` (the first call's code) and, on `retry_failed`, `detail.failure` (the type of the error the step then failed with); a run the write's grace cancelled with the retry in flight, or one whose gate closed or failed, records none, and the retried call is the step's `llm_calls[]` entry whose `reissue_reason` is `provider_output_token_limit_exceeded`. `diff_engine.operations_repair` (with the prefix in shadow mode) records one item, once the run has finished, when the operations step asked its model once more about the entries its checks dropped: `kind` `intent_operations`, `decision` `repaired` (the second reply stood), `repair_rejected` (it was not the first reply with those entries fixed, so the first stood with its drops) or `repair_failed` (the repair met an error, so the first reply stood with its drops), and `detail.model` (the model the repair asked last: the one that gave the first reply, or its fallback after an outage) and, on `repair_failed`, `detail.failure` (the type of the error it met); a run whose gate closed records none, and so does a reply over the cap, which is never repaired: the write falls back to the engine. `diff_engine.intent_gate` (with the prefix in shadow mode) records one item when the gate's deadline, the write's grace, opened it: `kind` `intent_gate`, `decision` `opened_by_deadline`, and `detail.deadline_seconds`, `detail.unanswered_calls` (the gate calls cut off) and `detail.sentence_count`. A step whose decisions act on another step's calls names itself the same way: `diff_engine.intent_rules` acts on the replies under `diff_engine.object_and_relations_deletion_detection` and `diff_engine.batch_field_erasure_detection`. The records hold what the engine decided that the operation's `llm_calls[]` (their prompts and replies) and its `diff_plan` do not already show, so the model's own answers are read in `llm_calls[]`, not here. `decision_count` is the step's true total and `decisions_truncated` marks a record cut to fit (for a read step, also one cut to its first and last 50 decisions), so `decisions` can hold fewer items than the count. `decisions` is the items as the step recorded them, a JSON array, or `null` when the stored text is not one (the count still shows). A pane serves at most 500 records and 4 MiB of `decisions` text, the newest; when it cut older ones it adds `step_decisions_truncated: true` beside the array, and otherwise the key is absent. A trace id a client reuses across writes serves every write's records together, ordered by time with nothing between the writes. The diff engine's items share one shape: `kind` (what the item is: `intent_gate`, `intent_operations`, `intent_verification`, `object`, `identity_change`, `merge`, `filtered_deletion`, `filtered_update`, `relation`, `deletion`, `alias`, `relabel`, `scope`, `detection`, `operation`, `intent_pipeline`, `second_opinion`) and `decision` (what was decided: `deletion_dropped`, `converted`, `rejected`, `kept`, `bound`, `not_bound`, `matched`, `left_out`, …), then, where set, `object_type` and `key` (the primary-key values as `field='value'`), `index` (the object's position in the diff engine's sorted object list, not in `extracted_objects[]`), internal id (the stored row), `reason`, and `detail` (anything else the step decided). `diff_engine.keyless_binding` records one `object` item per record of a keyed type that states no key but another field: `bound` to the one stored row it names (its `key` and internal id), or `not_bound` with why in `detail.outcome` (a record one stored row matches in every field it states carries that row's `key` and internal id when it is left `not_identifying`, matching only in yes/no and listed-value fields and never put to the verifier, or `rejected` or `unverified`, the verifier not confirming the text refers to it); `same_key_group` (the write holds records of different types with the same key, so nothing of it is looked up), `key_stated_for_another_type` (a record of another type in the write states the key of the row it would bind to), `key_of_another_type` (a stored row of another type has that key) and `key_check_unread` (the stored rows could not be read, or the key has more fields than the check looks up) are a temporary net against extraction copying a record's identifier onto another type; a binding left unbound for one of the last three carries the row it would have bound to (its `key` and internal id; a record not asked about its closest rows for them lists those rows in `detail.other_type_rows` instead), and the other types in `detail.other_types`: for `key_stated_for_another_type` and `key_of_another_type`, and for a record set aside unasked as `key_check_unread` whose rows stand down for different reasons, the types its rows' keys were found under. The same-key groups and the stated-key check go once extraction no longer returns such copies; the stored-key check goes only once the copies earlier writes stored are cleaned up too, or a scan finds none. A stored copy whose key differs only in case, surrounding spaces or accents is not found. In on mode, Phase 1's `record_where` lookup may also ask the verifier under `diff_engine.keyless_binding` (on a model that runs that check, when one stored row matches and the answer would be used once it is confirmed), about a rename's or a merge's record the text names by its fields whose extracted record carries the operation's new key, and records no item of its own: what came of it shows under `diff_engine.intent_operations`, where a bound rename is named by the stored row's key, or as `record_where_unbound` with `detail.sub` `stated_key`, or as the fallback a bound answer met later (such as `rename_old_key_unmatched`, or `rename_or_merge_rejected` when Phase 1.5 did not confirm every rename and merge of the answer); under `intent_pipeline_failures: refuse` a bound answer whose translation fails, or whose key-only lookup could not run, still goes to the engine as `record_where_unbound`, as before the lookup, and a failure of the verified relabel's own work as `relabel_failed`. `diff_engine.operations_second_opinion` records one item, `kind` `second_opinion`, on an on-mode write that the moves the verifier rejected would send to the engine, when the verification fallback is asked about them again: `decision` `confirmed` (they took the path a confirmed move takes; `diff_engine.intent_operations` says whether each was applied), `confirmed_beside_a_rejection` (another move still sent the write to the engine), `rejected`, `no_answer`, `not_asked` (its model gave the rejection) or `not_asked_model_unknown` (the write's result does not say which model rejected them), with `detail.model`, `detail.asked`, `detail.confirmed` and, when no verdict came, `detail.unanswered`; the call it made is that step's `llm_calls[]` entry. In on mode `diff_engine.intent_operations` says what the write did with the intent pipeline's answer: an `operation` item per operation it applied, its `decision` the operation's kind (`delete`, `unlink`, `unlink_all`, `move`, `clear`, `rename`, `merge`, `bulk_delete`, `bulk_update`) and its `reason` the passage that asks for it, then `not_applied` for one the write could not carry out (a delete of a record by the new name a rename of the same write gives it reads "it is also the target of a rename", as the engine's own rule says it, and a move with no end it leaves that the verifier confirmed, the old engine's gate closed, reads "the write's text read no removal or relink, so the stored link stays beside the one the write states") and `dropped` for one the pipeline dropped, each with why and `detail.position` (its place in the model's reply), then an `object` item `skip` for each record of a keyed type that states no key and that the write skipped, and `erase_refused` for each record bound to a stored row by its other fields whose clears were not applied (`detail.fields`); a `clear` item therefore names what the pipeline asked for, not what was written. When the engine's own detection decides the write instead, the step records one `intent_pipeline` item, `decision` `engine_decides`, whose `detail.fallback` names why (its `reason` says it in words) and beside which the engine's own steps record as with the pipeline off: `missing` (no result reached the write), `unreadable`, `translation` (the rows the operations name could not be read), `dropped` (the pipeline dropped an operation it proposed for a reason other than its verifier's rejection, so its answer is not the whole change; every drop of an answer that keeps nothing reads as no change when the write's presence check left the gate closed; `detail.sub` `gate_open` when this node read that gate open, `after_translation` or `after_key_only_lookup_failed` when such an answer then failed), `verifier_rejected` (a temporary net: the pipeline's verifier rejected a delete, a clear, an unlink, an unlink_all or a move it proposed, which may be about how the operation names its records rather than the change; a rejected bulk delete or update does not count, and a rename it rejects, or a merge while `execution.entity_merge` is on, goes to the engine as `rename_or_merge`; a move naming no end it leaves goes to the engine with `detail.sub` `move_fetch_cut_short` or `move_link_not_extracted` where that applies, and is otherwise left to the write's verification, which decides the stored link it would end; rejections of deletes, clears and moves that are the whole answer read as no change when the write's presence check left the gate closed, and otherwise as `verifier_rejected`, `detail.sub` `gate_open` when this node's own reading of that gate is open, or `after_translation` or `after_key_only_lookup_failed` when that step failed on such an answer), `record_where_unbound` (it names a record by the field values the text states, a key stated in part among them, and once verified, binding it through the write's own extraction found no single record for it; a writer that predates the binding decided it before the pipeline's verifier was asked; `detail.sub` `after_translation` or `after_key_only_lookup_failed` when a rename or merge the stored-row lookup bound then failed, whatever Phase 0's gate), `unresolved` (it saw a change whose records it could not name: a record described rather than named, records selected through a relation, some but not all links of a kind, or all of them handed over to another record; every one of them ending, but those the text keeps, is an `unlink_all`; `detail.sub` `after_translation` or `after_key_only_lookup_failed` when an answer of such changes alone, none naming a type, read as holding no operation while the write's presence check left the gate closed, then failed), `rename_or_merge` (it holds a rename or an unlink_all sharing a record with a merge, renames that swap, cycle, fork or converge, or an unlink_all whose record another operation names in its relation, decided before the pipeline's verifier is asked, or the verifier rejected a rename, or a merge while merges are on), `rename_old_key_unmatched` (it renames a record that no single stored record has by the name the text gives), `merge_loser_unmatched` (it merges away a record that no single stored record has by the name the text gives), `rename_onto_stored` (it renames a record onto a name another stored record already has), `rename_record_partly_stated` (the write states a record without the rest of a key a rename names, so whether it is that rename's old record, its new record or another one is unknown), `clear_in_question` (the text holds a question mark and Phase 1.5 did not confirm a clear the answer holds, `detail.sub` `rejected_in_phase_1_5`), `unlink_in_question`, `move_in_question`, `repoint_in_question` (temporary nets: while the text holds a question mark, it unlinks records of a relation type the extraction holds a relation of, or moves a relation, or, whatever it holds, the extraction holds a relation of a type keyed on some of its ends but not all, which written re-points the stored link those ends share, as with the pipeline off; Phase 1.5 cannot verify or take back any of these; `repoint_in_question`'s `detail.sub` is `after_translation` or `after_key_only_lookup_failed` when a question text's answer that stood while the write's presence check left the gate closed then failed), `delete_with_values` (it deletes a record the write's own extraction gives values other than its fields' defaults), `unlink_replaced` (it unlinks records while the write's own extraction holds another record the link may have moved to, which no new link joins to the unlink's other ends and no other operation ends or removes; `detail.sub` `after_translation` or `after_key_only_lookup_failed` when such an answer, read as holding no operation while the write's presence check left the gate closed, then failed), `unlink_all_with_links` (it ends every link of a kind that a record has, while the write's own extraction links that record by that kind to a record it does not keep, or holds another record of its type that nothing accounts for, as a transfer the answer misread would), `unlink_all_names_an_end` (the extraction holds a record of the kind an unlink_all ends that it does not keep, as when the text names the one link it ends, or the unlink_all keeps a record at only some of the roles its type takes), `key_rewritten` (an operation's key was read as the extraction's spelling), `unmatched_key_only` (the gate opened, while the extraction holds a record by its key alone that the answer would write and no stored row has; a delete's record, a rename's old and new records, a merge's survivor, a move's new end and a record an unlink_all keeps are not looked up; `detail.sub` `after_translation` when relation ends it was going there for, bound to their stored twins instead, then failed, whatever Phase 0's gate, or when an answer holding no operation it let stand beside such records, while the write's presence check left the gate closed, then failed), `key_only_lookup_failed` (the same, but whether those records are stored could not be read), `end_not_stored` (an unlink's end, an unlink_all's own record, or a move's old or kept end, binds no single stored row: none has its key, or several do, so the stored link would stay; a write whose every operation is so, with the old engine's gate closed as the presence check's verdicts stored beside the answer read it, does not fall back: it stores what was extracted and reports each as a `rejected` relationship outcome; `detail.sub` `gate_open` when the stored verdicts read that gate closed and this node read it open, `twin_bound` when a twin binding rewrote the extraction, so written alone a record would land on a stored row the old engine leaves alone), `kept_record_not_stored` (a record an unlink_all keeps binds no single stored row, so its link could not be told from the others and could end; a record the write creates counts too when the unlink_all would end a stored link, which could be that record under another spelling), `kept_link_missing` (a record an unlink_all keeps has no link to the unlink_all's record, stored or in the write, so the record would be left with no link of the kind), `unlink_all_partial_fetch` (an unlink_all's record's links were read from a fetch cut short, so the links not read would stay), `rename_or_merge_rejected` (the write's second verification did not confirm every rename and merge of the pipeline's answer, so the engine's own detection decided it again from the start; a temporary safety net, until the pipeline binds the records its operations name itself; it goes together with `unmatched_key_only` and the end guard, which would otherwise send most such writes to the engine), `end_not_extracted` (a move's new end is neither a stored row of its type nor a record the write's extraction holds, by its key: a key the pipeline made up, such as a name or part of an id), `empty_answer_check_found_intent` (a temporary net: the answer holds no operation while Phase 0's gate, which read the deletion check the write ran, is open other than by its bulk-update or merge verdict alone; where the pipeline's gate closed beside a deletion or relink verdict, the write path first asks the operations step once more, and an answer its verifier confirms goes through the usual nets in the empty answer's place; `detail.sub` `after_translation` or `after_key_only_lookup_failed` when an answer holding no operation whose gate the bulk-update or merge verdict opened alone, or the answer that second look confirmed, then failed), `date_field` (an operation names a field in which the write's extraction resolved a date token, or dropped one that named no day, which the pipeline does not yet state as the extraction resolves it; a temporary safety net, until the pipeline resolves those dates too), `inside_value` (the answer holds an operation beside a value the text assigns to a record's field, a long one quoted verbatim or any one an operation's quote touches, which may narrate changes the caller did not ask for, or the check could not tell, so the engine's own detection decides the write; while the write's presence check left the gate closed and this node reads it closed too, the answer is read as holding no operation instead and used, its operations dropped, and `detail.sub` is `after_translation` or `after_key_only_lookup_failed` when such an answer then failed), or the step a run without an answer stopped at (`gate`, `operations`, `verification`, `executor`, `late`, `not_run`). A write of an instance that pins its write text to a provider is no fallback: its instance's own mode is `off`, so the step records one `intent_pipeline` item, `decision` `instance_mode`, with `detail.mode` `off` and `detail.sub` `pinned_provider`, and the engine's own steps record beside it as with the pipeline off. Beside `fallback`, `detail.sub` gives why as one code with no value, when one is known (for `unmatched_key_only` what the records were, `relation_end`, `not_an_end`, `partial_key` or `empty_answer`; a failed stage's exception type, a not-run reason, the drop kinds and reasons, the rejected kinds, whether `rename_or_merge` was decided before or after verification), `detail.dropped_operations` lists each operation the pipeline dropped (`position` in the model's reply, `operation` kind when readable, `reason`, and `part`, a code for what within the reason failed, when known), and `detail.unresolved_changes` each change it could not name the records of (`position`, `evidence`, the passage that asks for it, `object_type` when the model gave one, and `shape`, a code, when the model gave one). `dropped_operations` carries no field values; an `unresolved_changes` entry's `evidence` is a passage of the write's own text, as an `operation` item's `reason` is. `diff_engine.intent_rules` logs what the engine's rules did to the detection model's answer, in the order they acted, so an item can be dropped and later restored (a rename whose old record is stated by part of a composite key is an `identity_change` item `completed`, bound to the one stored row its stated part matches and named by that row's internal id, or `not_bound`, left as stated so the write goes as it would without the step: no stored row or several match, the one row disagrees with the new record, a stored row with a NULL or blank key part matches, the database could not be asked, a value is not one its field can hold, the new record is of another type than the rename's, no index serves a lookup by the stated part, another rename or a merge lands on the same new record, or something else in the write may name the row or the key, its kind in `detail.named_by`); `diff_engine.plan_construction` says what building the plan decided after every earlier step, which the plan shows only by leaving it out (a merge the relation-budget re-check refused or re-admitted after alias binding, a deletion a rename overrides, an unlink dropped for a row a confirmed delete does not run on or a lookalike row the write does not bind, a move whose old link stays with the replacement guard's cause, a dropped merge or one already a single row, what a scoped write left out). A deletion that verification rejected reads `kind: "deletion"`, `decision: "rejected"` under `diff_engine.intent_verification_deep`, with what the object became and why; the proposal itself is the detection model's reply in `llm_calls[]`. Another part of the system may record items of its own shape here; they are served as recorded. Every detail pane serves its operation's records the same way; the write, read and evolution panes serve them for an operation still running or stale too (create and update have no such pane). A step that refuses the write still records what it decided first: the detector its rules, resolution what it found, plan construction the merges, unlinks and scope it changed. A caller who is not privileged gets neither `step_decisions` nor `step_decisions_truncated`, exactly as for `llm_calls[]`.
596
+ **Each `step_decisions[]` entry** is one record of what one step of the operation decided, oldest first (by `recorded_at`, then `sub_stage`). A step records each time it runs and decides something (a step that decided nothing records nothing), so one operation can hold several records of one step, and every record is served; none is merged into another. A write's deletion check records in its own process and again where the diff engine applies its gate, and a write retried whole under the same trace id (a stale-schema retry, a stall requeue, a stuck write claimed again) records every step again. Writes, reads and schema evolution record today. A write's extraction records too, under `extraction.` steps named like its model calls (`extraction.structured_output`, `extraction.description_merger`, `extraction.batch_field_extractor`, `extraction.field_verifier`, `extraction.relations_extractor`, `extraction.relations_verifier`, `extraction.phantom_record_check`, `extraction.linked_record_value_check`, `extraction.deduplication`): what code decided about a reply (candidates folded into one, a reply set aside so the extracted values stand, connections dropped, a candidate left out of the write, a group of types split), and the verifiers' own rejections. The phantom record check records one `object` item per record whose key value a record of another type in the write carries (or, for a record with no key, whose stated values one states alike, with `detail.description`): `not_held` (the check found the text does not present the entity as that type, so the record is marked as one that does not hold), `kept`, `kept_unchecked` (the check did not decide, or the write had more such values than it checks), or `not_run` (the check did not run on the write; `detail.not_run_reason` is `switched_off` or `pinned_provider`), with the other types in `detail.shared_with`. The linked-record value check records one `field` item per record and field holding a value a linked record holds too: `cleared` (the check found the text gives the value to another record holding it and not to this one, so it is cleared from this one), `kept`, `kept_no_key` (the check found the same, but this record states no key, which the deduplication folds by what it states, so it keeps the value), or `kept_unchecked` (the check of its group decided nothing); `detail.field` names the field, and `detail.shared_with_type` and `detail.shared_with_key` the linked record; `detail.description` names a record with no key. Field verification records once per object type, when that type's field processing ends; a write that fails before then records none for that type. When the judge in front of field verification is configured but does not run on a write whose detection found something, the write records why, once, under the stage the judge's calls would journal under (`extraction.verification_judge`, or `shadow.extraction.verification_judge` in shadow mode): one item, `kind` `judge`, `decision` `not_run`, with `detail.not_run_reason` (`sampled_out`, `pinned_provider` or `config_unavailable`) and `detail.mode`. Extraction's items have the diff engine's shape: `kind` is `merge`, `object`, `field`, `relation`, `relation_type` or `type_group`; `decision` is `folded`, `cleared`, `skipped`, `not_held` (the verifier found the text does not state the object holds, so it is marked as one that does not), `kept_unverified`, `verifier_skipped` (field verification did not run because the judge in front of it cleared the object), `kept`, `kept_no_key`, `kept_unchecked`, `key_restored`, `rejected`, `uncastable`, `dropped`, `split` or `escalation_disabled`; `detail` holds field names, candidate numbers and counts (`candidate_count`, `candidate_numbers`, `kept_number`, `ignored`, `basis`, `filled_fields`, `conflicting_fields`, `relations_repointed`, `fields`, `nulled`, `omitted`, `connection`, `field`, `candidates_per_link`, `relations`, `types`, `halves`, `refused_max_tokens`, `error_code`, `shared_with`, `shared_with_type`, `shared_with_key`), and no field's value except an object's key: in `key`, in a dropped relation's `links` (`Type(field='value')` per link), and a `description` for an object that has no key. `/extract` records its extraction the same way; it has no detail document of its own, so its records show only on a write's document when that write, on the same instance, reuses its trace id. A write's apply records what its merges did to the stored rows, under `write.merge_application`, once the write commits (a write that rolls back records none): one item per merge action, `kind` `merge`, named by the surviving row (the diff engine's `merge` items are named by the row merged away instead): its `object_type`, its `key` (absent for a type without a key, for a key with any part NULL or missing, which could name another row, and when the two rows were one) and its internal id, with `decision` `applied` and, in `detail`, the row merged away (by its internal id), `relations_repointed`, `relations_dropped` by reason (`linking_the_merged_rows`: a relation between the two merged rows; `removed_by_this_write`; `duplicate`: one the survivor already held) and `filled_fields`, the survivor's empty fields filled from the merged-away row, by name; or `decision` `nothing_to_merge` with why in `reason` (the two rows were one, or the row to merge away was already gone). Schema evolution records under `operation_kind` `evolution`: review, decide and apply each journal their steps' records once, when the stage ends, under their own trace, so an apply's show on its update document (its trace is the update id), and the detached pass that resolves an apply's gaps afterwards journals its own under the same trace. Its steps are the two model calls' names, `gap analyzer` (gaps never analysed or stored with no concepts, rows a reply left pending, concepts the parser dropped) and `semantic gate` (what the gate may do with each suggestion, candidates kept without a verdict, verdicts downgraded or not acted on), and the rule steps `evolution.backlog`, `evolution.resolution_filter`, `evolution.clustering`, `evolution.consolidation`, `evolution.prior_decisions`, `evolution.prerequisites`, `evolution.evidence_retirement` and `evolution.apply`; `kind` is `gap` (named by its feedback id in `key` and its concept's object and field), `suggestion` (its fingerprint in `key`, its change's names, and the gaps it was built from in `detail.gaps`, the first 20 with `gaps_total` when there are more), `cluster`, `decision`, `backlog`, `reply_entry`, `build` or `gate`, and no item carries what a user wrote. What a transaction did (a gap resolved, stored with no concepts, deleted or retired) is recorded only once it commits, and a row only when that step's own write or delete reached it. A build retried on a stale schema records both attempts: once the build runs again, every item the stage notes until it ends, the build's and the stage's own after it, carries `detail.attempt` (`2`), so an item without `attempt` was noted before the build ran again, and a `retried` item under `evolution.consolidation` records that it did; an `omitted` item is a marker, not a decision, and carries no `attempt`. A read records what the reader's own rules decided, under the name of the model call whose reply a decision is about (`read.question_decomposer`, `read.sql_syntax_fixer`, `read.empty_result_reviewer`, `read.overfetch_reviewer`, `read.answer_formatter`) or under a rule step (`read.scope`, `read.vector_grounding`, `read.sql_rewrites`, `read.sql_guard`, `read.sql_retries`, `read.answer`, and `read.other` for a family no step claims yet); a decision about a SQL statement a model call wrote goes under `read.sql_rewrites`, with the calling step in `detail.phase` where the rule names it. A read step that decided more than 101 times keeps its first and last 50 decisions, with one item (`decision` `omitted`, `detail.count`) where the rest were left out, cut further from the middle when they do not fit one record. A read journals its records once, when it ends, so a read still running has none yet, and a read retried on a stale schema runs again under the same trace id and records every step again; its items have `kind` (the decision family, such as `sql_guard_refused` or `distinct_order_by_case_dropped`), `decision` (`applied` or `not_applied`), `reason` where the rule says why, and `detail.part`, the part of a decomposed question the decision was made for, counted from 1, where it was made for one. `sub_stage` names the step in the `llm_calls[].sub_stage` vocabulary, so a step's decisions and its model calls join on it (a re-issued call journals under its step's name with a suffix such as `.refusal_fallback`, so it joins on the name as a prefix; the reader's rule steps, `extraction.deduplication` and `write.merge_application` have no model calls of their own) (`diff_engine.keyless_binding`, `diff_engine.deletion_check`, `diff_engine.intent_rules`, `diff_engine.value_span_containment`, `diff_engine.intent_verification_deep`, `diff_engine.alias_confirmation`, `diff_engine.object_resolution`, `diff_engine.unwritten_identity_verification`, `diff_engine.plan_construction`, the intent pipeline's `diff_engine.intent_gate`, `diff_engine.intent_operations`, `diff_engine.operations_repair` and `diff_engine.operations_verification`, Phase 1's `diff_engine.operations_second_opinion`, and the `read.` steps above). A model call made in shadow mode, beside the work it never changes and never charged, carries the prefix `shadow.` on its step's name; the intent pipeline and the verifiers' two judges are the steps that run in shadow today. The field verifier's judge, which can stand in front of `extraction.field_verifier` on a DEEP write or `/extract`, makes its calls under `extraction.verification_judge`, or `shadow.extraction.verification_judge` in shadow mode, and records under that same stage, once per object type, one item per object it was asked about: `kind` `object`, `decision` `flagged` (a field at or over its threshold, or one no question covered), `cleared` or `not_judged` (no verdict, which counts as every field flagged), with `detail.field_scores` (the flagged fields the judge scored, and their scores), `detail.unjudged_fields` (flagged fields no question covered), `detail.score`, `detail.field` and `detail.question` (the top score and where it came from), `detail.threshold`, `detail.questions_asked`, `detail.verifier` (`ran`, `ran on the flagged fields and the key`, `ran on the key`, or `skipped`) and `detail.empty_key` (the key fields field extraction left empty, when there are any). In on mode the verifier is asked only about the flagged fields and the key, and about a key field extraction left empty even on an object the judge cleared (`ran on the key`); in shadow mode it sees every field, and the item says what on mode would have sent it. A `verifier_skipped` item under `extraction.field_verifier` is an object an `extraction.verification_judge` call of the same operation cleared; every question and answer is in that call in `llm_calls[]`. The relation verifier's judge, which can stand in front of `extraction.relations_verifier` on DEEP writes and DEEP `/extract` calls, names its calls `extraction.relation_verification_judge`, or `shadow.extraction.relation_verification_judge` in shadow mode, and records under that same stage one verdict item per verifier call: `kind` `relation_type`, `decision` `flagged` (a proposed connection at or over its threshold), `cleared` or `not_judged` (no verdict, or two proposed connections sharing a unique key's values, which counts as flagged), with `detail.connection_scores` (the flagged connections' positions in the proposed list, counted from 1, and their scores), `detail.score` and `detail.top_connection` (the top score and its position), `detail.connections` (how many were proposed), `detail.threshold`, `detail.questions_asked` and `detail.verifier` (`ran`, or `skipped` when on mode kept the call's connections as proposed). A call on mode kept as proposed also records there any connection code dropped while building it (`kind` `relation`, `decision` `dropped`). A write it does not run on records one `kind` `judge`, `decision` `not_run` item under its stage, as the field verifier's judge does. The intent pipeline names its model calls by its step names above, with the prefix `shadow.` in shadow mode (`diff_engine.operations_repair` the operations step asked once more about the entries its checks dropped); `diff_engine.intent_operations` records what the write did with the answer in on mode only, where it stands in for `diff_engine.intent_rules`, and in either mode (with the prefix in shadow mode), once the run has finished, one item when the operations call ran out of its output budget and was asked once more: `kind` `intent_operations`, `decision` `retry_answered` or `retry_failed`, and `detail.model`, `detail.error` (the first call's code) and, on `retry_failed`, `detail.failure` (the type of the error the step then failed with); a run the write's grace cancelled with the retry in flight, or one whose gate closed or failed, records none, and the retried call is the step's `llm_calls[]` entry whose `reissue_reason` is `provider_output_token_limit_exceeded`. `diff_engine.operations_repair` (with the prefix in shadow mode) records one item, once the run has finished, when the operations step asked its model once more about the entries its checks dropped: `kind` `intent_operations`, `decision` `repaired` (the second reply stood), `repair_rejected` (it was not the first reply with those entries fixed, so the first stood with its drops) or `repair_failed` (the repair met an error, so the first reply stood with its drops), and `detail.model` (the model the repair asked last: the one that gave the first reply, or its fallback after an outage) and, on `repair_failed`, `detail.failure` (the type of the error it met); a run whose gate closed records none, and so does a reply over the cap, which is never repaired: the write falls back to the engine. `diff_engine.intent_gate` (with the prefix in shadow mode) records one item when the gate's deadline, the write's grace, opened it: `kind` `intent_gate`, `decision` `opened_by_deadline`, and `detail.deadline_seconds`, `detail.unanswered_calls` (the gate calls cut off) and `detail.sentence_count`. A step whose decisions act on another step's calls names itself the same way: `diff_engine.intent_rules` acts on the replies under `diff_engine.object_and_relations_deletion_detection` and `diff_engine.batch_field_erasure_detection`. The records hold what the engine decided that the operation's `llm_calls[]` (their prompts and replies) and its `diff_plan` do not already show, so the model's own answers are read in `llm_calls[]`, not here. `decision_count` is the step's true total and `decisions_truncated` marks a record cut to fit (for a read step, also one cut to its first and last 50 decisions), so `decisions` can hold fewer items than the count. `decisions` is the items as the step recorded them, a JSON array, or `null` when the stored text is not one (the count still shows). A pane serves at most 500 records and 4 MiB of `decisions` text, the newest; when it cut older ones it adds `step_decisions_truncated: true` beside the array, and otherwise the key is absent. A trace id a client reuses across writes serves every write's records together, ordered by time with nothing between the writes. The diff engine's items share one shape: `kind` (what the item is: `intent_gate`, `intent_operations`, `intent_verification`, `object`, `identity_change`, `merge`, `filtered_deletion`, `filtered_update`, `relation`, `deletion`, `alias`, `relabel`, `scope`, `detection`, `operation`, `intent_pipeline`, `second_opinion`) and `decision` (what was decided: `deletion_dropped`, `converted`, `rejected`, `kept`, `bound`, `not_bound`, `matched`, `left_out`, …), then, where set, `object_type` and `key` (the primary-key values as `field='value'`), `index` (the object's position in the diff engine's sorted object list, not in `extracted_objects[]`), internal id (the stored row), `reason`, and `detail` (anything else the step decided). `diff_engine.keyless_binding` records one `object` item per record of a keyed type that states no key but another field: `bound` to the one stored row it names (its `key` and internal id), or `not_bound` with why in `detail.outcome` (a record one stored row matches in every field it states carries that row's `key` and internal id when it is left `not_identifying`, matching only in yes/no and listed-value fields and never put to the verifier, or `rejected` or `unverified`, the verifier not confirming the text refers to it); `same_key_group` (the write holds records of different types with the same key, so nothing of it is looked up), `key_stated_for_another_type` (a record of another type in the write states the key of the row it would bind to), `key_of_another_type` (a stored row of another type has that key) and `key_check_unread` (the stored rows could not be read, or the key has more fields than the check looks up) are a temporary net against extraction copying a record's identifier onto another type; a binding left unbound for one of the last three carries the row it would have bound to (its `key` and internal id; a record not asked about its closest rows for them lists those rows in `detail.other_type_rows` instead), and the other types in `detail.other_types`: for `key_stated_for_another_type` and `key_of_another_type`, and for a record set aside unasked as `key_check_unread` whose rows stand down for different reasons, the types its rows' keys were found under. The same-key groups and the stated-key check go once extraction no longer returns such copies; the stored-key check goes only once the copies earlier writes stored are cleaned up too, or a scan finds none. A stored copy whose key differs only in case, surrounding spaces or accents is not found. In on mode, Phase 1's `record_where` lookup may also ask the verifier under `diff_engine.keyless_binding` (on a model that runs that check, when one stored row matches and the answer would be used once it is confirmed), about a rename's or a merge's record the text names by its fields whose extracted record carries the operation's new key, and records no item of its own: what came of it shows under `diff_engine.intent_operations`, where a bound rename is named by the stored row's key, or as `record_where_unbound` with `detail.sub` `stated_key`, or as the fallback a bound answer met later (such as `rename_old_key_unmatched`, or `rename_or_merge_rejected` when Phase 1.5 did not confirm every rename and merge of the answer); under `intent_pipeline_failures: refuse` a bound answer whose translation fails, or whose key-only lookup could not run, still goes to the engine as `record_where_unbound`, as before the lookup, and a failure of the verified relabel's own work as `relabel_failed`. `diff_engine.operations_second_opinion` records one item, `kind` `second_opinion`, on an on-mode write that the moves the verifier rejected would send to the engine, when the verification fallback is asked about them again: `decision` `confirmed` (they took the path a confirmed move takes; `diff_engine.intent_operations` says whether each was applied), `confirmed_beside_a_rejection` (another move still sent the write to the engine), `rejected`, `no_answer`, `not_asked` (its model gave the rejection) or `not_asked_model_unknown` (the write's result does not say which model rejected them), with `detail.model`, `detail.asked`, `detail.confirmed` and, when no verdict came, `detail.unanswered`; the call it made is that step's `llm_calls[]` entry. In on mode `diff_engine.intent_operations` says what the write did with the intent pipeline's answer: an `operation` item per operation it applied, its `decision` the operation's kind (`delete`, `unlink`, `unlink_all`, `move`, `clear`, `rename`, `merge`, `bulk_delete`, `bulk_update`) and its `reason` the passage that asks for it, then `not_applied` for one the write could not carry out (a delete of a record by the new name a rename of the same write gives it reads "it is also the target of a rename", as the engine's own rule says it, and a move with no end it leaves that the verifier confirmed, the old engine's gate closed, reads "the write's text read no removal or relink, so the stored link stays beside the one the write states") and `dropped` for one the pipeline dropped, each with why and `detail.position` (its place in the model's reply), then an `object` item `skip` for each record of a keyed type that states no key and that the write skipped, and `erase_refused` for each record bound to a stored row by its other fields whose clears were not applied (`detail.fields`); a `clear` item therefore names what the pipeline asked for, not what was written. When the engine's own detection decides the write instead, the step records one `intent_pipeline` item, `decision` `engine_decides`, whose `detail.fallback` names why (its `reason` says it in words) and beside which the engine's own steps record as with the pipeline off: `missing` (no result reached the write), `unreadable`, `translation` (the rows the operations name could not be read), `dropped` (the pipeline dropped an operation it proposed for a reason other than its verifier's rejection, so its answer is not the whole change; every drop of an answer that keeps nothing reads as no change when the write's presence check left the gate closed; `detail.sub` `gate_open` when this node read that gate open, `after_translation` or `after_key_only_lookup_failed` when such an answer then failed), `verifier_rejected` (a temporary net: the pipeline's verifier rejected a delete, a clear, an unlink, an unlink_all or a move it proposed, which may be about how the operation names its records rather than the change; a rejected bulk delete or update does not count, and a rename it rejects, or a merge while `execution.entity_merge` is on, goes to the engine as `rename_or_merge`; a move naming no end it leaves goes to the engine with `detail.sub` `move_fetch_cut_short` or `move_link_not_extracted` where that applies, and is otherwise left to the write's verification, which decides the stored link it would end; rejections of deletes, clears and moves that are the whole answer read as no change when the write's presence check left the gate closed, and otherwise as `verifier_rejected`, `detail.sub` `gate_open` when this node's own reading of that gate is open, or `after_translation` or `after_key_only_lookup_failed` when that step failed on such an answer), `record_where_unbound` (it names a record by the field values the text states, a key stated in part among them, and once verified, binding it through the write's own extraction found no single record for it; a writer that predates the binding decided it before the pipeline's verifier was asked; `detail.sub` `after_translation` or `after_key_only_lookup_failed` when a rename or merge the stored-row lookup bound then failed, whatever Phase 0's gate), `unresolved` (it saw a change whose records it could not name: a record described rather than named, records selected through a relation, some but not all links of a kind, or all of them handed over to another record; every one of them ending, but those the text keeps, is an `unlink_all`; `detail.sub` `after_translation` or `after_key_only_lookup_failed` when an answer of such changes alone, none naming a type, read as holding no operation while the write's presence check left the gate closed, then failed), `rename_or_merge` (it holds a rename or an unlink_all sharing a record with a merge, renames that swap, cycle, fork or converge, or an unlink_all whose record another operation names in its relation, decided before the pipeline's verifier is asked, or the verifier rejected a rename, or a merge while merges are on), `rename_old_key_unmatched` (it renames a record that no single stored record has by the name the text gives), `merge_loser_unmatched` (it merges away a record that no single stored record has by the name the text gives), `rename_onto_stored` (it renames a record onto a name another stored record already has), `rename_record_partly_stated` (the write states a record without the rest of a key a rename names, so whether it is that rename's old record, its new record or another one is unknown), `clear_in_question` (the text holds a question mark and Phase 1.5 did not confirm a clear the answer holds, `detail.sub` `rejected_in_phase_1_5`), `unlink_in_question`, `move_in_question`, `repoint_in_question` (temporary nets: while the text holds a question mark, it unlinks records of a relation type the extraction holds a relation of, or moves a relation, or, whatever it holds, the extraction holds a relation of a type keyed on some of its ends but not all, which written re-points the stored link those ends share, as with the pipeline off; Phase 1.5 cannot verify or take back any of these; `repoint_in_question`'s `detail.sub` is `after_translation` or `after_key_only_lookup_failed` when a question text's answer that stood while the write's presence check left the gate closed then failed), `delete_with_values` (it deletes a record the write's own extraction gives values other than its fields' defaults), `delete_not_stored` (it deletes a record no single stored row and no extracted record has by the key it names, while the write's own extraction holds a record of its type, which may be the stored record the text names in another form than its key, such as a name in another grammatical case), `unlink_replaced` (it unlinks records while the write's own extraction holds another record the link may have moved to, which no new link joins to the unlink's other ends and no other operation ends or removes; `detail.sub` `after_translation` or `after_key_only_lookup_failed` when such an answer, read as holding no operation while the write's presence check left the gate closed, then failed), `unlink_all_with_links` (it ends every link of a kind that a record has, while the write's own extraction links that record by that kind to a record it does not keep, or holds another record of its type that nothing accounts for, as a transfer the answer misread would), `unlink_all_names_an_end` (the extraction holds a record of the kind an unlink_all ends that it does not keep, as when the text names the one link it ends, or the unlink_all keeps a record at only some of the roles its type takes), `key_rewritten` (an operation's key was read as the extraction's spelling), `unmatched_key_only` (the gate opened, while the extraction holds a record by its key alone that the answer would write and no stored row has; a delete's record, a rename's old and new records, a merge's survivor, a move's new end and a record an unlink_all keeps are not looked up; `detail.sub` `after_translation` when relation ends it was going there for, bound to their stored twins instead, then failed, whatever Phase 0's gate, or when an answer holding no operation it let stand beside such records, while the write's presence check left the gate closed, then failed), `key_only_lookup_failed` (the same, but whether those records are stored could not be read), `end_not_stored` (an unlink's end, an unlink_all's own record, or a move's old or kept end, binds no single stored row: none has its key, or several do, so the stored link would stay; a write whose every operation is so, with the old engine's gate closed as the presence check's verdicts stored beside the answer read it, does not fall back: it stores what was extracted and reports each as a `rejected` relationship outcome; `detail.sub` `gate_open` when the stored verdicts read that gate closed and this node read it open, `twin_bound` when a twin binding rewrote the extraction, so written alone a record would land on a stored row the old engine leaves alone), `kept_record_not_stored` (a record an unlink_all keeps binds no single stored row, so its link could not be told from the others and could end; a record the write creates counts too when the unlink_all would end a stored link, which could be that record under another spelling), `kept_link_missing` (a record an unlink_all keeps has no link to the unlink_all's record, stored or in the write, so the record would be left with no link of the kind), `unlink_all_partial_fetch` (an unlink_all's record's links were read from a fetch cut short, so the links not read would stay), `rename_or_merge_rejected` (the write's second verification did not confirm every rename and merge of the pipeline's answer, so the engine's own detection decided it again from the start; a temporary safety net, until the pipeline binds the records its operations name itself; it goes together with `unmatched_key_only` and the end guard, which would otherwise send most such writes to the engine), `end_not_extracted` (a move's new end is neither a stored row of its type nor a record the write's extraction holds, by its key: a key the pipeline made up, such as a name or part of an id), `empty_answer_check_found_intent` (a temporary net: the answer holds no operation while Phase 0's gate, which read the deletion check the write ran, is open other than by its bulk-update or merge verdict alone; where the pipeline's gate closed beside a deletion or relink verdict, the write path first asks the operations step once more, and an answer its verifier confirms goes through the usual nets in the empty answer's place; `detail.sub` `after_translation` or `after_key_only_lookup_failed` when an answer holding no operation whose gate the bulk-update or merge verdict opened alone, or the answer that second look confirmed, then failed), `date_field` (an operation names a field in which the write's extraction resolved a date token, or dropped one that named no day, which the pipeline does not yet state as the extraction resolves it; a temporary safety net, until the pipeline resolves those dates too), `inside_value` (the answer holds an operation beside a value the text assigns to a record's field, a long one quoted verbatim or any one an operation's quote touches, which may narrate changes the caller did not ask for, or the check could not tell, so the engine's own detection decides the write; while the write's presence check left the gate closed and this node reads it closed too, the answer is read as holding no operation instead and used, its operations dropped, and `detail.sub` is `after_translation` or `after_key_only_lookup_failed` when such an answer then failed), or the step a run without an answer stopped at (`gate`, `operations`, `verification`, `executor`, `late`, `not_run`). A write of an instance that pins its write text to a provider is no fallback: its instance's own mode is `off`, so the step records one `intent_pipeline` item, `decision` `instance_mode`, with `detail.mode` `off` and `detail.sub` `pinned_provider`, and the engine's own steps record beside it as with the pipeline off. Beside `fallback`, `detail.sub` gives why as one code with no value, when one is known (for `unmatched_key_only` what the records were, `relation_end`, `not_an_end`, `partial_key` or `empty_answer`; a failed stage's exception type, a not-run reason, the drop kinds and reasons, the rejected kinds, whether `rename_or_merge` was decided before or after verification), `detail.dropped_operations` lists each operation the pipeline dropped (`position` in the model's reply, `operation` kind when readable, `reason`, and `part`, a code for what within the reason failed, when known), and `detail.unresolved_changes` each change it could not name the records of (`position`, `evidence`, the passage that asks for it, `object_type` when the model gave one, and `shape`, a code, when the model gave one). `dropped_operations` carries no field values; an `unresolved_changes` entry's `evidence` is a passage of the write's own text, as an `operation` item's `reason` is. `diff_engine.intent_rules` logs what the engine's rules did to the detection model's answer, in the order they acted, so an item can be dropped and later restored (a rename whose old record is stated by part of a composite key is an `identity_change` item `completed`, bound to the one stored row its stated part matches and named by that row's internal id, or `not_bound`, left as stated so the write goes as it would without the step: no stored row or several match, the one row disagrees with the new record, a stored row with a NULL or blank key part matches, the database could not be asked, a value is not one its field can hold, the new record is of another type than the rename's, no index serves a lookup by the stated part, another rename or a merge lands on the same new record, or something else in the write may name the row or the key, its kind in `detail.named_by`); `diff_engine.plan_construction` says what building the plan decided after every earlier step, which the plan shows only by leaving it out (a merge the relation-budget re-check refused or re-admitted after alias binding, a deletion a rename overrides, an unlink dropped for a row a confirmed delete does not run on or a lookalike row the write does not bind, a move whose old link stays with the replacement guard's cause, a dropped merge or one already a single row, what a scoped write left out). A deletion that verification rejected reads `kind: "deletion"`, `decision: "rejected"` under `diff_engine.intent_verification_deep`, with what the object became and why; the proposal itself is the detection model's reply in `llm_calls[]`. Another part of the system may record items of its own shape here; they are served as recorded. Every detail pane serves its operation's records the same way; the write, read and evolution panes serve them for an operation still running or stale too (create and update have no such pane). A step that refuses the write still records what it decided first: the detector its rules, resolution what it found, plan construction the merges, unlinks and scope it changed. A caller who is not privileged gets neither `step_decisions` nor `step_decisions_truncated`, exactly as for `llm_calls[]`.
595
597
 
596
598
  **A scoped key gets `[]` for `ddl_queries` / `schema_generation`, not the rows.** Those two come from records that carry no instance ownership — the schema generation's trace id is even client-supplied — so they cannot be scoped to an instance and are served only to callers with no instance restriction at all. This is a deliberate fail-closed choice, not a bug to work around: an empty array means "not available to this credential", never "this operation ran none". `llm_calls[]` behaves the same way (gated the same way) and always has. `sql_queries` is split: statements recorded with their owning instance reach every caller who may open the read, even when another instance reused the trace id, while statements recorded before ownership was tracked carry no owner and reach unrestricted callers only. A scoped key therefore sees `[]` for reads that old. To let a script tell the two apart, the Console sets a sibling boolean next to each — `sql_queries_withheld`, `ddl_queries_withheld`, `schema_generation_withheld` — that is `true` exactly when a row that exists was withheld from this caller: for `ddl_queries` / `schema_generation` that is every scoped caller, for `sql_queries` a scoped caller on a read that has ownerless rows. So `[]` with `…_withheld: false` is "none recorded", `[]` with `…_withheld: true` is "not yours to see". **Internal ids are hidden from every caller but a privileged one**, including on writes that carry no identity map — the substitution is done by the Console, server-side, so a caller with no browser sees `(record)` rather than a raw id.
597
599
 
@@ -758,6 +760,8 @@ Some commands attach a more specific `stage` (`validate`, `usage`, `limit`, `not
758
760
 
759
761
  **Breaking change in 0.0.5:** HTTP **403** previously exited **4** (`auth`); it now exits **3** (`permission`). Scripts that treated exit **4** as “any auth-layer failure” must check `stage` or handle exit **3** for permission denials.
760
762
 
763
+ **New in 2.0.2:** a write's `changes.unstored_field_values` prints as a note per value: a value the text gave that its field's type could not hold as given, such as `note: Company name='Acme' employees: 'about 200' was not stored: the field's type cannot hold it`, or `note: Deal name='Q3' won: 'maybe' was stored as false: the field's type cannot hold it as given` for one stored differently. `--json` is unchanged.
764
+
761
765
  **New in 2.0.1:** `auth login --email` no longer reads the organisation's default API role before minting: the server issues the key with it, so an account whose role lacks `role.get` signs in by email too. Afterwards the success line names the role where the account may read it and otherwise leaves it out, instead of printing the role's id. In the JSON result, `api_role` carries the name, else the id, else null, and the new `api_role_id` the id where it was read. An organisation with no default API role is told that xmemory sets it, and to sign in meanwhile with `auth login` and a key with a role created on the Console's API Keys page. The `--email` help and this reference describe the key's role instead of calling it org-wide. `auth status` and `org key` no longer include the boolean that said whether a key's access is unrestricted; scripts that read it should check the operation they need instead (a `trace calls` request, for example, is refused with exit **3** where it is not allowed).
762
766
 
763
767
  **New in 2.0.0:** the release that goes out with the server release that moves keys, users and invitations to scoped role assignments. It is a major release because `org key` output changes: a key whose access is assignment-based shows its `assignments` instead of one role. Permission names follow the server's (`instance.get` and `cluster.get`, which replace `instance.get_own` and `cluster.get_own`), so `org list instances` reports `"missing_permission": "instance.get"` in its degraded document (a server before them still gets `"instance.get_own"`, its own name), which it now also returns when only some of the visible instances have readable metadata. In that case `org list instances --cluster` exits **3** (`stage: "permission"`) and asks you to drop the filter or use a key with `instance.get`, where 1.9.5 filtered the instances it could read. `hosted_deployments` in your own `~/.xmemcli.json` names the Console and MCP origins of a deployment whose origins cannot be inferred (see "`~/.xmemcli.json`" below), used for `auth login`, `trace`, `org manage`, `org memberships` and `mcp` as their built-in pairs are; `--console-url` and `--mcp-url` still win. New: `read --return-sql` keeps the SQL the read API returns (`sql`, `sqls`, `sql_attempts`, or `sql_unavailable`); `org manage <resource> <action>` and `org memberships list|edit` administer roles, assignments, keys, users, invitations, memberships and the default API role, signing in with `--email` or acting as the key with `--as-key`; `auth login --email` mints with the organisation's default API role as the server names it. An older server answers the new commands with an error and changes nothing.
@@ -906,7 +910,7 @@ These apply **before** any subcommand (`xmemcli help options`).
906
910
  | `--binding-dir` | `XMEM_BINDING_DIR` | Where `binding` commands look for `.xmemory.json`; reads walk **up** toward `$HOME` and **merge** every scope |
907
911
  | `--console-url` (accepted by `trace …`, `auth login`, `org manage` and `org memberships`; `$XMEM_CONSOLE_URL` is read by `auth status` too) | `XMEM_CONSOLE_URL` | Console origin serving the trace views, and the one `org manage` and `org memberships` sign in through (inferred for the public and local API pairs, a pair in `~/.xmemcli.json` and the `/console` sibling of a `/xmem` base; required for any other API origin). A named Console that provably does not pair with the API origin is refused; the refusal names the setting that supplied it, since `auth status` does not accept the flag |
908
912
  | `--json` | — | Force one JSON document on stdout |
909
- | `--verbose` | — | Add `trace_id` / `console_url` when present (never diff plans or other internals; SQL only via `read --return-sql`) |
913
+ | `--verbose` | — | Add command-specific context such as `trace_id` and `console_url` when available. Added context appears in JSON output. `org list keys` includes every metadata field the API returns for each key (never the plaintext key). Terminal output shows the prefix, name, and active status. Use `read --return-sql` for read SQL diagnostics. |
910
914
 
911
915
  **Credential resolution:** `--api-key` → `$XMEM_API_KEY` → nearest `.xmemrc.json` → *Not logged in — run `xmemcli auth login` first.*
912
916
 
@@ -942,7 +946,12 @@ with `--console-url` for an in-memory user session. `--as-key` is limited to
942
946
  visible inventory, capabilities, scoped child-key issuance and scoped membership edits. `--body FILE`
943
947
  supplies explicit JSON changes; assignment/membership batches require the
944
948
  `expected_revision` from a fresh list. Key creation requires `--out FILE` and
945
- never prints the secret. Run `org manage --help` for the command matrix. For example,
949
+ never prints the secret. On a key-creation 429, the CLI advises a short wait.
950
+ With `--as-key`, it also reports `retry_after_seconds` in JSON when the server
951
+ supplies a numeric `Retry-After` header. For both `org manage keys create --as-key`
952
+ and `org create key`, the CLI reports the delay as sent, including zero, from
953
+ headers with up to ten ASCII digits. Run `org manage --help` for the command
954
+ matrix. For example,
946
955
  `org manage assignments list --subject-kind user --subject-id USER_UUID --email you@example.com`
947
956
  reads assignments before a revision-checked edit.
948
957
 
@@ -53,7 +53,7 @@ Two local files, same discovery rule, different jobs: `.xmemrc.json` holds the c
53
53
  | `xmemcli read --read-mode xresponse` | `mode: "xresponse"` |
54
54
  | `xmemcli read --related-types` | `include_related_types: "types"` — the response's `related_types` object is kept in the curated output |
55
55
  | `xmemcli read --related-types-depth 2` | `include_related_types: "types"` and `related_types_depth: 2` — the catalog entries carry their `distance` and, below the last level, their own edges |
56
- | `xmemcli read --return-sql` | `return_sql: true`. The curated output keeps `sql`, `sqls` (`sub_query` and `sql`), and the safe `sql_attempts` fields (`sql`, `read_query`, `row_count`, `is_success`, `attempt_outcome`, `error_message`, `sqlstate`). When the response includes none of them, the output carries `sql_unavailable` and does not say why. The flag is off by default: the request omits `return_sql`, and any of those fields on a response are dropped |
56
+ | `xmemcli read --return-sql` | `return_sql: true`. The curated output keeps `sql`, `sqls` (`sub_query` and `sql`), and the safe `sql_attempts` fields (`sql`, `read_query`, `row_count`, `is_success`, `attempt_outcome`, `error_message`, `sqlstate`). When curation retains none of the three SQL fields, the output carries `sql_unavailable`. The flag is off by default: the request omits `return_sql`, and any of those fields on a response are dropped |
57
57
 
58
58
  `--read-mode` selects the **server-side answer shape**; `--json` and the TTY rule govern stdout format.
59
59
 
@@ -61,11 +61,13 @@ Two local files, same discovery rule, different jobs: `.xmemrc.json` holds the c
61
61
 
62
62
  Interactive help and trace JSON use a dark-terminal palette by default. When `COLORFGBG` reports a white background (`7` or `15`), xmemcli uses darker colors for light terminals. Set `XMEMCLI_THEME=light` or `XMEMCLI_THEME=dark` to choose explicitly when the terminal does not report its background. `NO_COLOR` still disables colors.
63
63
 
64
- ## Curated output
64
+ ## Command output
65
65
 
66
- The CLI does not echo raw API payloads. Server internals (`diff_plan`, extraction trees) are never emitted. `sql`, `sqls`, and `sql_attempts` are kept only for `read --return-sql`, and only as the fields the read API already returns for that option; other keys on an attempt are dropped. If that flag is set and the response includes none of them, the output says SQL was requested and not included (`sql_unavailable`): the server may have withheld it, or no statement was executed. Read responses keep `pending_suggestions` (schema-evolution hint). A text write keeps a compact `extracted` summary (`Type(identifier)` tags); a structured write runs no extraction and has none. `write` and `write-status` keep the server's `changes` block (created / updated with old → new / deleted, bulk summaries, advisory records) when the write changed something. `--verbose` adds `trace_id` and `console_url` when present.
66
+ Commands such as `read`, `write`, and `instance get` curate their output and omit server internals such as `diff_plan` and extraction trees. `sql`, `sqls`, and `sql_attempts` are kept only for `read --return-sql`, and only as the fields the read API already returns for that option; other keys on an attempt are dropped. If that flag is set and curation retains none of the three SQL fields, the output carries `sql_unavailable`. Read responses keep `pending_suggestions` (schema-evolution hint). A text write keeps a compact `extracted` summary (`Type(identifier)` tags); a structured write runs no extraction and has none. `write` and `write-status` keep the server's `changes` block (created / updated with old → new / deleted, bulk summaries, advisory records) when the write changed something. Where supported, `--verbose` adds command-specific context such as `trace_id` and `console_url`. Added context appears in JSON output. With `--verbose`, `org list keys` includes every metadata field the API returns for each key (never the plaintext key). Terminal output shows the prefix, name, and active status.
67
67
 
68
- **`trace …` is the one deliberate exception.** Those commands return the Console's own operation documents — the paged operations list, the Inspect search, and the per-operation detail — **verbatim**, because the Console already curates them per caller (a privileged caller sees LLM calls and raw token counts; everyone else does not). They are JSON on every stream and carry every internal id the Console does: `trace_id`, `instance_id`, `session_id`, `user_id`, `api_key_id`, and on detail documents `source_id`, `migration_id`, `llm_call_id`, `gateway_request_id`, …
68
+ Commands such as `instance setup`, `schema get`, and `xmd generate` use the unwrapped API document as their payload. Commands such as `org manage roles list` and `org memberships list` use the account management reply as their payload.
69
+
70
+ Trace commands emit the Console's own operation documents, including the paged operations list, Inspect search, and per-operation detail. The Console curates them per caller and exposes LLM calls and raw token counts only to privileged callers. Trace documents are printed as JSON on every stream and carry the IDs the Console returns, including `trace_id`, `instance_id`, `session_id`, `user_id`, `api_key_id`, and on detail documents `source_id`, `migration_id`, `llm_call_id`, and `gateway_request_id`. In JSON mode, when the CLI records warnings, it adds or extends the `warnings` key on object payloads, including trace documents.
69
71
 
70
72
  ## Trace — the Console's operation traces, from the CLI
71
73
 
@@ -169,7 +171,7 @@ xmemcli version
169
171
  xmemcli auth login
170
172
  ```
171
173
 
172
- Version: **2.0.1**.
174
+ Version: **2.0.2**.
173
175
 
174
176
 
175
177
  ---
@@ -290,7 +292,7 @@ Each login binds its own port and names it in the login URL, so concurrent login
290
292
 
291
293
  # `xmemcli` — capabilities reference
292
294
 
293
- **Version:** `2.0.1` (see `xmemcli version`)
295
+ **Version:** `2.0.2` (see `xmemcli version`)
294
296
 
295
297
  `xmemcli` is the command-line client for the **xmemory HTTP API**. It is **human-approved for key acquisition**: an AI-assisted IDE may run reads, writes, and inventory, and may initiate `auth login`, but a key is only issued after one explicit human approval — a click in the Console UI (PKCE handoff), an approval of a sign-in email (`--email`), or, with `--auto-approve`, the Console session the human already holds in that browser (signed in before, or right then through the Console's own email, Google, GitHub or OIDC sign-in). The one exception derives from such a key rather than replacing the approval: `org create key` lets a key that was already approved mint a key no wider than itself, for the same user, on one of its own clusters, deactivated with it. Quota limits change only in the **Console UI**. The full acquisition contract is in the auth-flow reference bundled with this package.
296
298
 
@@ -310,7 +312,7 @@ Every command below has dedicated help — see [Help](#help).
310
312
  |---------|-------------|
311
313
  | **`write`** `[text]` | Sync write (`POST …/write`). `--extraction fast\|deep` (default `fast`). `--no-wait` queues async write, returns `write_id`. `--scope TYPE:ID` (repeatable) anchors the write to existing objects: only they may be modified/deleted; by default new objects and links to them are allowed and anything else fails, and under `--scope-mode drop` only the objects a `--scope` names may be created and everything else is skipped; works with either extraction mode. `--scope-mode drop` (needs `--scope`) skips out-of-scope changes instead of failing and lists them under `changes.skipped_out_of_scope` (a server change, not a CLI one: past 100 entries the server folds the rest into lines shown with `folded=true` and no key or fields); it creates only records a `--scope` names by primary key, and such a record need not be stored yet — create-or-update exactly the named record. `reject` is the server default and is not sent. Instead of text, a **structured write** sends `structured_mutations` — deterministic creates, updates and deletes with no extraction: `--mutations-file PATH` or `--mutations-stdin` (one JSON array, same shape as the API's `structured_mutations`; see [Structured writes](#structured-writes)) and/or `--delete TYPE:ID` (repeatable, `--scope` syntax: `Person:name=Ada`; appended after the file's entries) and/or `--delete-match TYPE:field=value` (repeatable; a type without a primary key, by values its one record holds; appended after the `--delete` entries). Text and mutations are exclusive, as are the file and stdin forms; mutations refuse `--scope` and `--extraction deep`; empty or whitespace-only text is refused (exit **2**, before anything is read or sent). A text write's output lists what it extracted as `Type(identifier)` tags (`extracted`); a structured write's does not. Both carry the server's `changes` block (`created` / `updated` with per-field `old_value` → `new_value` / `deleted`, and any other bucket such as `created_keyless_objects`) whenever the write changed something, and on a drop-mode write that skipped everything, where the block carries `skipped_out_of_scope` alone; a scoped write that left a scoped record untouched carries it too, with `untouched_scope_records`. A `--no-wait` answer carries only the `write_id`; `write-status` reports the `changes` once the write completes. |
312
314
  | **`write-status`** `<write_id>` … | Poll async writes until terminal or `--timeout` (default 60s). Accepts multiple ids. A completed write's non-empty `changes` block is kept, as on `write`. |
313
- | **`read`** `<query>` | Read from active instance. `--read-mode single\|raw\|xresponse`, `--scope TYPE:ID` (repeatable), `--scope-relations`, `--related-types` (also return `related_types`: per object type the read touched, the fields it did not return and the object types a declared relation links it to; needs `instance.get` on the key), `--related-types-depth N` (1, 2 or 3, refused as a usage error otherwise; follow the relations N levels out, each catalog entry saying its distance; implies `--related-types`), `--return-sql` (send `return_sql: true` and keep the response's `sql`, `sqls`, and the safe `sql_attempts` fields in JSON and pretty output, where pretty output prints `sql` only when there are no per-sub-query `sqls` entries, since those already show each statement; without the flag those fields are dropped even if a server sent them; when the flag is set and the response includes none, say so without guessing why). |
315
+ | **`read`** `<query>` | Read from active instance. `--read-mode single\|raw\|xresponse`, `--scope TYPE:ID` (repeatable), `--scope-relations`, `--related-types` (also return `related_types`: per object type the read touched, the fields it did not return and the object types a declared relation links it to; needs `instance.get` on the key), `--related-types-depth N` (1, 2 or 3, refused as a usage error otherwise; follow the relations N levels out, each catalog entry saying its distance; implies `--related-types`), `--return-sql` (send `return_sql: true` and keep the response's `sql`, `sqls`, and the safe `sql_attempts` fields in JSON and pretty output, where pretty output prints `sql` only when there are no per-sub-query `sqls` entries, since those already show each statement; without the flag those fields are dropped even if a server sent them; when the flag is set and curation retains none of those fields, include `sql_unavailable`). |
314
316
 
315
317
  Requires **`--instance-id`** or **`$XMEM_INSTANCE_ID`** for read/write (or auto-pick when exactly one instance is visible — see [Global flags](#global-flags--environment)).
316
318
 
@@ -337,7 +339,7 @@ Permission-filtered view of what this API key can see.
337
339
  | **`org list instances`** | Instances visible to this credential, as a bare array of records. A key minted with `data.read` but not `instance.get` (the supported shape for `trace …`) gets the ids only — the same set `trace ls` is scoped to — as a **degraded document** rather than an array: `{"items": [{"id": …}, …], "degraded": true, "missing_permission": "instance.get"}` (`"instance.get_own"` from a server before scoped role assignments, which names the permission so), with the warning on stderr and in the document's `warnings`. The shape changes so a script cannot read an ids-only listing as a complete one; an array is never wrapped just to carry a warning. |
338
340
  | **`org list keys`** | API keys visible to this credential (metadata only; plaintext never returned) |
339
341
  | **`org key`** `[name-or-prefix]` | Metadata and assignments for a visible key, loaded from `/scoped-api-keys`, `/assignments` and `/roles?include_permissions=true`. Each assignment retains its role permissions, scope UUID, access mode and scope rules; no flat union is presented as access to every target. Older servers use the legacy single-role representation. UUID role and resource identities remain separate; names/prefixes select a unique visible result or report ambiguity. Secrets are never listed. |
340
- | **`org create key`** `--name` `--role` `--cluster` `--out` | Mint a key for this user bound to exactly one cluster this key can already see. `--cluster` is a name or an id; `--role` is the role's name (`org key` shows the role of each key you hold), or its id when two roles share the name. The new role cannot grant a permission this key lacks, and the issuing key must itself hold `api_key.create`. The key is written only to `--out`, a new file created 0600 (an existing file is refused); output carries `key_prefix` and `key_file`, never the key, and nothing goes to `.xmemrc.json`. The new key keeps that one cluster (clusters created later are not added), expires no later than this key, and is deactivated when this key is, or unlinked from the cluster when this key is. To contain a leaked key, deactivate it in the Console: what it minted goes with it. A lost reply or a 5xx says a key may still exist, except the server's own **503** (busy), which created nothing; a **429** is a temporary mint limit whose message says which (another mint by this user is still running, this user's keys created too many keys recently, or the server is tracking as many minting users as it can), and a **400** a request the server refuses (such as a `--name` over 255 characters): neither created a key, and a 429 or 503 is safe to retry after a short wait (the server's `Retry-After` is not shown). A 404 means `--cluster` is not linked to this key; a 422 that names `api_role_name` means the server predates this command, which needs a server from the same release as this CLI; a 403 saying only `Insufficient permissions` means the server predates the release that lets a key create keys, and any other 403 that it will not mint this key: the role, the owner's permission, this key or the cluster. Current servers require the issuing key’s own create permission and delegation authority; older servers can instead report an owner-permission refusal through the legacy `user_may_mint_keys` diagnostic. |
342
+ | **`org create key`** `--name` `--role` `--cluster` `--out` | Mint a key for this user bound to exactly one cluster this key can already see. `--cluster` is a name or an id; `--role` is the role's name (`org key` shows the role of each key you hold), or its id when two roles share the name. The new role cannot grant a permission this key lacks, and the issuing key must itself hold `api_key.create`. The key is written only to `--out`, a new file created 0600 (an existing file is refused); output carries `key_prefix` and `key_file`, never the key, and nothing goes to `.xmemrc.json`. The new key keeps that one cluster (clusters created later are not added), expires no later than this key, and is deactivated when this key is, or unlinked from the cluster when this key is. To contain a leaked key, deactivate it in the Console: what it minted goes with it. A lost reply or a 5xx says a key may still exist, except the server's own **503** (busy), which created nothing; a **429** is a temporary mint limit whose message says which (another mint by this user is still running, this user's keys created too many keys recently, or the server is tracking as many minting users as it can), and a **400** a request the server refuses (such as a `--name` over 255 characters): neither created a key, and a 429 or 503 is safe to retry after a short wait (for a 429, the CLI shows the delay when the server gives `Retry-After` in seconds as up to ten ASCII digits and includes the value as sent, including zero, as `retry_after_seconds` in JSON). A 404 means `--cluster` is not linked to this key; a 422 that names `api_role_name` means the server predates this command, which needs a server from the same release as this CLI; a 403 saying only `Insufficient permissions` means the server predates the release that lets a key create keys, and any other 403 that it will not mint this key: the role, the owner's permission, this key or the cluster. Current servers require the issuing key’s own create permission and delegation authority; older servers can instead report an owner-permission refusal through the legacy `user_may_mint_keys` diagnostic. |
341
343
 
342
344
  ---
343
345
 
@@ -536,9 +538,9 @@ so a typo fails loudly rather than being ignored.
536
538
 
537
539
  What the Console shows on an instance's **Operations** tab (a paged list), on **Inspect** (a
538
540
  search across operations), and in each operation's detail pane, plus (for the few keys allowed to read them) the LLM calls of a
539
- session, which no Console view lists — fetched from the same Console endpoints, with this CLI's API key, and emitted **as the Console serves them**. Nothing is curated
540
- or reshaped: the Console already curates per caller, and a field the Console adds shows up here
541
- the same day. These documents are for scripts and agents; on a terminal they are only indented
541
+ session, which no Console view lists — fetched from the same Console endpoints, with this CLI's API key.
542
+ The Console curates these documents per caller. In JSON mode, the CLI adds or extends the
543
+ `warnings` key when it records warnings. These documents are for scripts and agents; in pretty mode they are only indented
542
544
  and coloured (`NO_COLOR` / `FORCE_COLOR` honoured). Flags only — there is no query language to
543
545
  learn; the CLI composes the Console's search clauses itself.
544
546
 
@@ -568,7 +570,7 @@ learn; the CLI composes the Console's search clauses itself.
568
570
 
569
571
  **Each `llm_calls[]` entry**, oldest first, is a call made under the operation's id that names the document's instance, or names none (calls recorded before the API sent one, and work that runs for no instance, such as a schema generation): trace ids are not unique, so another instance's operation can share the id. A call that names no instance carries `names_no_instance: true`, since it is listed by the operation id alone and may be that other operation's; a call that names the document's instance carries no such key. Its fields: `llm_call_id`; `sub_stage` (the pipeline stage that made the call); `model_type` (the model slot asked for) and `provider` (the one that served it); `called_at`; `time_taken_ms`; `prompt_tokens`, `completion_tokens`, `reasoning_tokens` (part of the completion, not added to it), `total_tokens`; `is_cached`, `is_success`, `is_refusal`, `error_message`, `gateway_request_id`; `prompt`, `json_schema`, `result`. Then what explains a call's outcome:
570
572
 
571
- - `reissue_of_llm_call_id` and `reissue_reason`: this call re-issues the earlier call with that id, which failed with that error code. A call sent to another model after it was refused, blocked for its content, or answered with replies that kept failing its schema, and the intent pipeline's verification call sent to its fallback model after a provider error; a reply cut at its output ceiling sent again with a higher one; on writes the same overflow sent to another model at the same ceiling; and the intent pipeline's operations call cut at its ceiling sent again to the same model at the same ceiling: all are re-issues. `reissued_as_llm_call_ids` is the other direction: the calls in the same list that re-issue this one. So either call leads to the other, with no second request.
573
+ - `reissue_of_llm_call_id` and `reissue_reason`: this call re-issues the earlier call with that id, which failed with that error code. A call sent to another model after it was refused, blocked for its content, or answered with replies that kept failing its schema, the intent pipeline's verification call sent to its fallback model after a provider error, and the SQL call of a read part routed to `reader.model_name_for_reader_sql` sent to the instance's reader model after a provider failure (its `reissue_reason` is then a gateway code such as `internal_rate_limit_exceeded`, or `attempt_cap_exceeded` or `unknown_slot`, which the reader names itself), or after the reader refused the plan that call wrote (`candidate_audit_rejected`, `fanned_out_aggregate`, `tie_broken_ranking` or `linked_rows_ranking`); a reply cut at its output ceiling sent again with a higher one; on writes the same overflow sent to another model at the same ceiling; and the intent pipeline's operations call cut at its ceiling sent again to the same model at the same ceiling: all are re-issues. `reissued_as_llm_call_ids` is the other direction: the calls in the same list that re-issue this one. So either call leads to the other, with no second request.
572
574
  - `max_tokens`, `temperature`, `schema_property_order`, `no_cache`: the settings the call requested, not necessarily what the model ran with: depending on the model and its settings, no temperature is sent at all. `schema_property_order` is also null for a call sent without a schema.
573
575
  - `finish_reason`: why the model stopped, in the provider's own words, not normalised. `end_turn`, `stop`, `STOP` and `tool_use` are normal stops; `max_tokens`, `length` or `MAX_TOKENS` means the reply hit its output ceiling, and `model_context_window_exceeded` means the prompt and reply outgrew the context window. On a failure it is set where the model side reports it: always for those two, and for a refusal, a content filter or safety stop, or a schema miss after the model side's own retry where it reports those too; null otherwise. Read a refusal from `is_refusal`. One exception to "the provider's words": a cached reply (`is_cached: true`) stored by an earlier release of the service can read `stop` whatever the provider reported.
574
576
  - `rejected_attempts`: the replies rejected before this call's answer or error (one that missed the schema, say), as an array; a recorded value that is not valid JSON is served as its text.
@@ -583,7 +585,7 @@ learn; the CLI composes the Console's search clauses itself.
583
585
 
584
586
  A value the call did not record is `null`, and `reissued_as_llm_call_ids` and `gateway_repairs` are `[]`; calls recorded before these fields existed read that way throughout.
585
587
 
586
- **Each `step_decisions[]` entry** is one record of what one step of the operation decided, oldest first (by `recorded_at`, then `sub_stage`). A step records each time it runs and decides something (a step that decided nothing records nothing), so one operation can hold several records of one step, and every record is served; none is merged into another. A write's deletion check records in its own process and again where the diff engine applies its gate, and a write retried whole under the same trace id (a stale-schema retry, a stall requeue, a stuck write claimed again) records every step again. Writes, reads and schema evolution record today. A write's extraction records too, under `extraction.` steps named like its model calls (`extraction.structured_output`, `extraction.description_merger`, `extraction.batch_field_extractor`, `extraction.field_verifier`, `extraction.relations_extractor`, `extraction.relations_verifier`, `extraction.phantom_record_check`, `extraction.deduplication`): what code decided about a reply (candidates folded into one, a reply set aside so the extracted values stand, connections dropped, a candidate left out of the write, a group of types split), and the verifiers' own rejections. The phantom record check records one `object` item per record whose key value a record of another type in the write carries (or, for a record with no key, whose stated values one states alike, with `detail.description`): `not_held` (the check found the text does not present the entity as that type, so the record is marked as one that does not hold), `kept`, `kept_unchecked` (the check did not decide, or the write had more such values than it checks), or `not_run` (the check did not run on the write; `detail.not_run_reason` is `switched_off` or `pinned_provider`), with the other types in `detail.shared_with`. Field verification records once per object type, when that type's field processing ends; a write that fails before then records none for that type. When the judge in front of field verification is configured but does not run on a write whose detection found something, the write records why, once, under the stage the judge's calls would journal under (`extraction.verification_judge`, or `shadow.extraction.verification_judge` in shadow mode): one item, `kind` `judge`, `decision` `not_run`, with `detail.not_run_reason` (`sampled_out`, `pinned_provider` or `config_unavailable`) and `detail.mode`. Extraction's items have the diff engine's shape: `kind` is `merge`, `object`, `relation`, `relation_type` or `type_group`; `decision` is `folded`, `skipped`, `not_held` (the verifier found the text does not state the object holds, so it is marked as one that does not), `kept_unverified`, `verifier_skipped` (field verification did not run because the judge in front of it cleared the object), `kept`, `kept_unchecked`, `key_restored`, `rejected`, `uncastable`, `dropped`, `split` or `escalation_disabled`; `detail` holds field names, candidate numbers and counts (`candidate_count`, `candidate_numbers`, `kept_number`, `ignored`, `basis`, `filled_fields`, `conflicting_fields`, `relations_repointed`, `fields`, `nulled`, `omitted`, `connection`, `field`, `candidates_per_link`, `relations`, `types`, `halves`, `refused_max_tokens`, `error_code`, `shared_with`), and no field's value except an object's key: in `key`, in a dropped relation's `links` (`Type(field='value')` per link), and a `description` for an object that has no key. `/extract` records its extraction the same way; it has no detail document of its own, so its records show only on a write's document when that write, on the same instance, reuses its trace id. A write's apply records what its merges did to the stored rows, under `write.merge_application`, once the write commits (a write that rolls back records none): one item per merge action, `kind` `merge`, named by the surviving row (the diff engine's `merge` items are named by the row merged away instead): its `object_type`, its `key` (absent for a type without a key, for a key with any part NULL or missing, which could name another row, and when the two rows were one) and its internal id, with `decision` `applied` and, in `detail`, the row merged away (by its internal id), `relations_repointed`, `relations_dropped` by reason (`linking_the_merged_rows`: a relation between the two merged rows; `removed_by_this_write`; `duplicate`: one the survivor already held) and `filled_fields`, the survivor's empty fields filled from the merged-away row, by name; or `decision` `nothing_to_merge` with why in `reason` (the two rows were one, or the row to merge away was already gone). Schema evolution records under `operation_kind` `evolution`: review, decide and apply each journal their steps' records once, when the stage ends, under their own trace, so an apply's show on its update document (its trace is the update id), and the detached pass that resolves an apply's gaps afterwards journals its own under the same trace. Its steps are the two model calls' names, `gap analyzer` (gaps never analysed or stored with no concepts, rows a reply left pending, concepts the parser dropped) and `semantic gate` (what the gate may do with each suggestion, candidates kept without a verdict, verdicts downgraded or not acted on), and the rule steps `evolution.backlog`, `evolution.resolution_filter`, `evolution.clustering`, `evolution.consolidation`, `evolution.prior_decisions`, `evolution.prerequisites`, `evolution.evidence_retirement` and `evolution.apply`; `kind` is `gap` (named by its feedback id in `key` and its concept's object and field), `suggestion` (its fingerprint in `key`, its change's names, and the gaps it was built from in `detail.gaps`, the first 20 with `gaps_total` when there are more), `cluster`, `decision`, `backlog`, `reply_entry`, `build` or `gate`, and no item carries what a user wrote. What a transaction did (a gap resolved, stored with no concepts, deleted or retired) is recorded only once it commits, and a row only when that step's own write or delete reached it. A build retried on a stale schema records both attempts: once the build runs again, every item the stage notes until it ends, the build's and the stage's own after it, carries `detail.attempt` (`2`), so an item without `attempt` was noted before the build ran again, and a `retried` item under `evolution.consolidation` records that it did; an `omitted` item is a marker, not a decision, and carries no `attempt`. A read records what the reader's own rules decided, under the name of the model call whose reply a decision is about (`read.question_decomposer`, `read.sql_syntax_fixer`, `read.empty_result_reviewer`, `read.overfetch_reviewer`, `read.answer_formatter`) or under a rule step (`read.scope`, `read.vector_grounding`, `read.sql_rewrites`, `read.sql_guard`, `read.sql_retries`, `read.answer`, and `read.other` for a family no step claims yet); a decision about a SQL statement a model call wrote goes under `read.sql_rewrites`, with the calling step in `detail.phase` where the rule names it. A read step that decided more than 101 times keeps its first and last 50 decisions, with one item (`decision` `omitted`, `detail.count`) where the rest were left out, cut further from the middle when they do not fit one record. A read journals its records once, when it ends, so a read still running has none yet, and a read retried on a stale schema runs again under the same trace id and records every step again; its items have `kind` (the decision family, such as `sql_guard_refused` or `distinct_order_by_case_dropped`), `decision` (`applied` or `not_applied`), `reason` where the rule says why, and `detail.part`, the part of a decomposed question the decision was made for, counted from 1, where it was made for one. `sub_stage` names the step in the `llm_calls[].sub_stage` vocabulary, so a step's decisions and its model calls join on it (a re-issued call journals under its step's name with a suffix such as `.refusal_fallback`, so it joins on the name as a prefix; the reader's rule steps, `extraction.deduplication` and `write.merge_application` have no model calls of their own) (`diff_engine.keyless_binding`, `diff_engine.deletion_check`, `diff_engine.intent_rules`, `diff_engine.value_span_containment`, `diff_engine.intent_verification_deep`, `diff_engine.alias_confirmation`, `diff_engine.object_resolution`, `diff_engine.unwritten_identity_verification`, `diff_engine.plan_construction`, the intent pipeline's `diff_engine.intent_gate`, `diff_engine.intent_operations`, `diff_engine.operations_repair` and `diff_engine.operations_verification`, Phase 1's `diff_engine.operations_second_opinion`, and the `read.` steps above). A model call made in shadow mode, beside the work it never changes and never charged, carries the prefix `shadow.` on its step's name; the intent pipeline and the verifiers' two judges are the steps that run in shadow today. The field verifier's judge, which can stand in front of `extraction.field_verifier` on a DEEP write or `/extract`, makes its calls under `extraction.verification_judge`, or `shadow.extraction.verification_judge` in shadow mode, and records under that same stage, once per object type, one item per object it was asked about: `kind` `object`, `decision` `flagged` (a field at or over its threshold, or one no question covered), `cleared` or `not_judged` (no verdict, which counts as every field flagged), with `detail.field_scores` (the flagged fields the judge scored, and their scores), `detail.unjudged_fields` (flagged fields no question covered), `detail.score`, `detail.field` and `detail.question` (the top score and where it came from), `detail.threshold`, `detail.questions_asked` and `detail.verifier` (`ran`, `ran on the flagged fields and the key`, or `skipped`). In on mode the verifier is asked only about the flagged fields and the key; in shadow mode it sees every field, and the item says what on mode would have sent it. A `verifier_skipped` item under `extraction.field_verifier` is an object an `extraction.verification_judge` call of the same operation cleared; every question and answer is in that call in `llm_calls[]`. The relation verifier's judge, which can stand in front of `extraction.relations_verifier` on DEEP writes and DEEP `/extract` calls, names its calls `extraction.relation_verification_judge`, or `shadow.extraction.relation_verification_judge` in shadow mode, and records under that same stage one verdict item per verifier call: `kind` `relation_type`, `decision` `flagged` (a proposed connection at or over its threshold), `cleared` or `not_judged` (no verdict, or two proposed connections sharing a unique key's values, which counts as flagged), with `detail.connection_scores` (the flagged connections' positions in the proposed list, counted from 1, and their scores), `detail.score` and `detail.top_connection` (the top score and its position), `detail.connections` (how many were proposed), `detail.threshold`, `detail.questions_asked` and `detail.verifier` (`ran`, or `skipped` when on mode kept the call's connections as proposed). A call on mode kept as proposed also records there any connection code dropped while building it (`kind` `relation`, `decision` `dropped`). A write it does not run on records one `kind` `judge`, `decision` `not_run` item under its stage, as the field verifier's judge does. The intent pipeline names its model calls by its step names above, with the prefix `shadow.` in shadow mode (`diff_engine.operations_repair` the operations step asked once more about the entries its checks dropped); `diff_engine.intent_operations` records what the write did with the answer in on mode only, where it stands in for `diff_engine.intent_rules`, and in either mode (with the prefix in shadow mode), once the run has finished, one item when the operations call ran out of its output budget and was asked once more: `kind` `intent_operations`, `decision` `retry_answered` or `retry_failed`, and `detail.model`, `detail.error` (the first call's code) and, on `retry_failed`, `detail.failure` (the type of the error the step then failed with); a run the write's grace cancelled with the retry in flight, or one whose gate closed or failed, records none, and the retried call is the step's `llm_calls[]` entry whose `reissue_reason` is `provider_output_token_limit_exceeded`. `diff_engine.operations_repair` (with the prefix in shadow mode) records one item, once the run has finished, when the operations step asked its model once more about the entries its checks dropped: `kind` `intent_operations`, `decision` `repaired` (the second reply stood), `repair_rejected` (it was not the first reply with those entries fixed, so the first stood with its drops) or `repair_failed` (the repair met an error, so the first reply stood with its drops), and `detail.model` (the model the repair asked last: the one that gave the first reply, or its fallback after an outage) and, on `repair_failed`, `detail.failure` (the type of the error it met); a run whose gate closed records none, and so does a reply over the cap, which is never repaired: the write falls back to the engine. `diff_engine.intent_gate` (with the prefix in shadow mode) records one item when the gate's deadline, the write's grace, opened it: `kind` `intent_gate`, `decision` `opened_by_deadline`, and `detail.deadline_seconds`, `detail.unanswered_calls` (the gate calls cut off) and `detail.sentence_count`. A step whose decisions act on another step's calls names itself the same way: `diff_engine.intent_rules` acts on the replies under `diff_engine.object_and_relations_deletion_detection` and `diff_engine.batch_field_erasure_detection`. The records hold what the engine decided that the operation's `llm_calls[]` (their prompts and replies) and its `diff_plan` do not already show, so the model's own answers are read in `llm_calls[]`, not here. `decision_count` is the step's true total and `decisions_truncated` marks a record cut to fit (for a read step, also one cut to its first and last 50 decisions), so `decisions` can hold fewer items than the count. `decisions` is the items as the step recorded them, a JSON array, or `null` when the stored text is not one (the count still shows). A pane serves at most 500 records and 4 MiB of `decisions` text, the newest; when it cut older ones it adds `step_decisions_truncated: true` beside the array, and otherwise the key is absent. A trace id a client reuses across writes serves every write's records together, ordered by time with nothing between the writes. The diff engine's items share one shape: `kind` (what the item is: `intent_gate`, `intent_operations`, `intent_verification`, `object`, `identity_change`, `merge`, `filtered_deletion`, `filtered_update`, `relation`, `deletion`, `alias`, `relabel`, `scope`, `detection`, `operation`, `intent_pipeline`, `second_opinion`) and `decision` (what was decided: `deletion_dropped`, `converted`, `rejected`, `kept`, `bound`, `not_bound`, `matched`, `left_out`, …), then, where set, `object_type` and `key` (the primary-key values as `field='value'`), `index` (the object's position in the diff engine's sorted object list, not in `extracted_objects[]`), internal id (the stored row), `reason`, and `detail` (anything else the step decided). `diff_engine.keyless_binding` records one `object` item per record of a keyed type that states no key but another field: `bound` to the one stored row it names (its `key` and internal id), or `not_bound` with why in `detail.outcome` (a record one stored row matches in every field it states carries that row's `key` and internal id when it is left `not_identifying`, matching only in yes/no and listed-value fields and never put to the verifier, or `rejected` or `unverified`, the verifier not confirming the text refers to it); `same_key_group` (the write holds records of different types with the same key, so nothing of it is looked up), `key_stated_for_another_type` (a record of another type in the write states the key of the row it would bind to), `key_of_another_type` (a stored row of another type has that key) and `key_check_unread` (the stored rows could not be read, or the key has more fields than the check looks up) are a temporary net against extraction copying a record's identifier onto another type; a binding left unbound for one of the last three carries the row it would have bound to (its `key` and internal id; a record not asked about its closest rows for them lists those rows in `detail.other_type_rows` instead), and the other types in `detail.other_types`: for `key_stated_for_another_type` and `key_of_another_type`, and for a record set aside unasked as `key_check_unread` whose rows stand down for different reasons, the types its rows' keys were found under. The same-key groups and the stated-key check go once extraction no longer returns such copies; the stored-key check goes only once the copies earlier writes stored are cleaned up too, or a scan finds none. A stored copy whose key differs only in case, surrounding spaces or accents is not found. In on mode, Phase 1's `record_where` lookup may also ask the verifier under `diff_engine.keyless_binding` (on a model that runs that check, when one stored row matches and the answer would be used once it is confirmed), about a rename's or a merge's record the text names by its fields whose extracted record carries the operation's new key, and records no item of its own: what came of it shows under `diff_engine.intent_operations`, where a bound rename is named by the stored row's key, or as `record_where_unbound` with `detail.sub` `stated_key`, or as the fallback a bound answer met later (such as `rename_old_key_unmatched`, or `rename_or_merge_rejected` when Phase 1.5 did not confirm every rename and merge of the answer); under `intent_pipeline_failures: refuse` a bound answer whose translation fails, or whose key-only lookup could not run, still goes to the engine as `record_where_unbound`, as before the lookup, and a failure of the verified relabel's own work as `relabel_failed`. `diff_engine.operations_second_opinion` records one item, `kind` `second_opinion`, on an on-mode write that the moves the verifier rejected would send to the engine, when the verification fallback is asked about them again: `decision` `confirmed` (they took the path a confirmed move takes; `diff_engine.intent_operations` says whether each was applied), `confirmed_beside_a_rejection` (another move still sent the write to the engine), `rejected`, `no_answer`, `not_asked` (its model gave the rejection) or `not_asked_model_unknown` (the write's result does not say which model rejected them), with `detail.model`, `detail.asked`, `detail.confirmed` and, when no verdict came, `detail.unanswered`; the call it made is that step's `llm_calls[]` entry. In on mode `diff_engine.intent_operations` says what the write did with the intent pipeline's answer: an `operation` item per operation it applied, its `decision` the operation's kind (`delete`, `unlink`, `unlink_all`, `move`, `clear`, `rename`, `merge`, `bulk_delete`, `bulk_update`) and its `reason` the passage that asks for it, then `not_applied` for one the write could not carry out (a delete of a record by the new name a rename of the same write gives it reads "it is also the target of a rename", as the engine's own rule says it, and a move with no end it leaves that the verifier confirmed, the old engine's gate closed, reads "the write's text read no removal or relink, so the stored link stays beside the one the write states") and `dropped` for one the pipeline dropped, each with why and `detail.position` (its place in the model's reply), then an `object` item `skip` for each record of a keyed type that states no key and that the write skipped, and `erase_refused` for each record bound to a stored row by its other fields whose clears were not applied (`detail.fields`); a `clear` item therefore names what the pipeline asked for, not what was written. When the engine's own detection decides the write instead, the step records one `intent_pipeline` item, `decision` `engine_decides`, whose `detail.fallback` names why (its `reason` says it in words) and beside which the engine's own steps record as with the pipeline off: `missing` (no result reached the write), `unreadable`, `translation` (the rows the operations name could not be read), `dropped` (the pipeline dropped an operation it proposed for a reason other than its verifier's rejection, so its answer is not the whole change; every drop of an answer that keeps nothing reads as no change when the write's presence check left the gate closed; `detail.sub` `gate_open` when this node read that gate open, `after_translation` or `after_key_only_lookup_failed` when such an answer then failed), `verifier_rejected` (a temporary net: the pipeline's verifier rejected a delete, a clear, an unlink, an unlink_all or a move it proposed, which may be about how the operation names its records rather than the change; a rejected bulk delete or update does not count, and a rename it rejects, or a merge while `execution.entity_merge` is on, goes to the engine as `rename_or_merge`; a move naming no end it leaves goes to the engine with `detail.sub` `move_fetch_cut_short` or `move_link_not_extracted` where that applies, and is otherwise left to the write's verification, which decides the stored link it would end; rejections of deletes, clears and moves that are the whole answer read as no change when the write's presence check left the gate closed, and otherwise as `verifier_rejected`, `detail.sub` `gate_open` when this node's own reading of that gate is open, or `after_translation` or `after_key_only_lookup_failed` when that step failed on such an answer), `record_where_unbound` (it names a record by the field values the text states, a key stated in part among them, and once verified, binding it through the write's own extraction found no single record for it; a writer that predates the binding decided it before the pipeline's verifier was asked; `detail.sub` `after_translation` or `after_key_only_lookup_failed` when a rename or merge the stored-row lookup bound then failed, whatever Phase 0's gate), `unresolved` (it saw a change whose records it could not name: a record described rather than named, records selected through a relation, some but not all links of a kind, or all of them handed over to another record; every one of them ending, but those the text keeps, is an `unlink_all`; `detail.sub` `after_translation` or `after_key_only_lookup_failed` when an answer of such changes alone, none naming a type, read as holding no operation while the write's presence check left the gate closed, then failed), `rename_or_merge` (it holds a rename or an unlink_all sharing a record with a merge, renames that swap, cycle, fork or converge, or an unlink_all whose record another operation names in its relation, decided before the pipeline's verifier is asked, or the verifier rejected a rename, or a merge while merges are on), `rename_old_key_unmatched` (it renames a record that no single stored record has by the name the text gives), `merge_loser_unmatched` (it merges away a record that no single stored record has by the name the text gives), `rename_onto_stored` (it renames a record onto a name another stored record already has), `rename_record_partly_stated` (the write states a record without the rest of a key a rename names, so whether it is that rename's old record, its new record or another one is unknown), `clear_in_question` (the text holds a question mark and Phase 1.5 did not confirm a clear the answer holds, `detail.sub` `rejected_in_phase_1_5`), `unlink_in_question`, `move_in_question`, `repoint_in_question` (temporary nets: while the text holds a question mark, it unlinks records of a relation type the extraction holds a relation of, or moves a relation, or, whatever it holds, the extraction holds a relation of a type keyed on some of its ends but not all, which written re-points the stored link those ends share, as with the pipeline off; Phase 1.5 cannot verify or take back any of these; `repoint_in_question`'s `detail.sub` is `after_translation` or `after_key_only_lookup_failed` when a question text's answer that stood while the write's presence check left the gate closed then failed), `delete_with_values` (it deletes a record the write's own extraction gives values other than its fields' defaults), `unlink_replaced` (it unlinks records while the write's own extraction holds another record the link may have moved to, which no new link joins to the unlink's other ends and no other operation ends or removes; `detail.sub` `after_translation` or `after_key_only_lookup_failed` when such an answer, read as holding no operation while the write's presence check left the gate closed, then failed), `unlink_all_with_links` (it ends every link of a kind that a record has, while the write's own extraction links that record by that kind to a record it does not keep, or holds another record of its type that nothing accounts for, as a transfer the answer misread would), `unlink_all_names_an_end` (the extraction holds a record of the kind an unlink_all ends that it does not keep, as when the text names the one link it ends, or the unlink_all keeps a record at only some of the roles its type takes), `key_rewritten` (an operation's key was read as the extraction's spelling), `unmatched_key_only` (the gate opened, while the extraction holds a record by its key alone that the answer would write and no stored row has; a delete's record, a rename's old and new records, a merge's survivor, a move's new end and a record an unlink_all keeps are not looked up; `detail.sub` `after_translation` when relation ends it was going there for, bound to their stored twins instead, then failed, whatever Phase 0's gate, or when an answer holding no operation it let stand beside such records, while the write's presence check left the gate closed, then failed), `key_only_lookup_failed` (the same, but whether those records are stored could not be read), `end_not_stored` (an unlink's end, an unlink_all's own record, or a move's old or kept end, binds no single stored row: none has its key, or several do, so the stored link would stay; a write whose every operation is so, with the old engine's gate closed as the presence check's verdicts stored beside the answer read it, does not fall back: it stores what was extracted and reports each as a `rejected` relationship outcome; `detail.sub` `gate_open` when the stored verdicts read that gate closed and this node read it open, `twin_bound` when a twin binding rewrote the extraction, so written alone a record would land on a stored row the old engine leaves alone), `kept_record_not_stored` (a record an unlink_all keeps binds no single stored row, so its link could not be told from the others and could end; a record the write creates counts too when the unlink_all would end a stored link, which could be that record under another spelling), `kept_link_missing` (a record an unlink_all keeps has no link to the unlink_all's record, stored or in the write, so the record would be left with no link of the kind), `unlink_all_partial_fetch` (an unlink_all's record's links were read from a fetch cut short, so the links not read would stay), `rename_or_merge_rejected` (the write's second verification did not confirm every rename and merge of the pipeline's answer, so the engine's own detection decided it again from the start; a temporary safety net, until the pipeline binds the records its operations name itself; it goes together with `unmatched_key_only` and the end guard, which would otherwise send most such writes to the engine), `end_not_extracted` (a move's new end is neither a stored row of its type nor a record the write's extraction holds, by its key: a key the pipeline made up, such as a name or part of an id), `empty_answer_check_found_intent` (a temporary net: the answer holds no operation while Phase 0's gate, which read the deletion check the write ran, is open other than by its bulk-update or merge verdict alone; where the pipeline's gate closed beside a deletion or relink verdict, the write path first asks the operations step once more, and an answer its verifier confirms goes through the usual nets in the empty answer's place; `detail.sub` `after_translation` or `after_key_only_lookup_failed` when an answer holding no operation whose gate the bulk-update or merge verdict opened alone, or the answer that second look confirmed, then failed), `date_field` (an operation names a field in which the write's extraction resolved a date token, or dropped one that named no day, which the pipeline does not yet state as the extraction resolves it; a temporary safety net, until the pipeline resolves those dates too), `inside_value` (the answer holds an operation beside a value the text assigns to a record's field, a long one quoted verbatim or any one an operation's quote touches, which may narrate changes the caller did not ask for, or the check could not tell, so the engine's own detection decides the write; while the write's presence check left the gate closed and this node reads it closed too, the answer is read as holding no operation instead and used, its operations dropped, and `detail.sub` is `after_translation` or `after_key_only_lookup_failed` when such an answer then failed), or the step a run without an answer stopped at (`gate`, `operations`, `verification`, `executor`, `late`, `not_run`). A write of an instance that pins its write text to a provider is no fallback: its instance's own mode is `off`, so the step records one `intent_pipeline` item, `decision` `instance_mode`, with `detail.mode` `off` and `detail.sub` `pinned_provider`, and the engine's own steps record beside it as with the pipeline off. Beside `fallback`, `detail.sub` gives why as one code with no value, when one is known (for `unmatched_key_only` what the records were, `relation_end`, `not_an_end`, `partial_key` or `empty_answer`; a failed stage's exception type, a not-run reason, the drop kinds and reasons, the rejected kinds, whether `rename_or_merge` was decided before or after verification), `detail.dropped_operations` lists each operation the pipeline dropped (`position` in the model's reply, `operation` kind when readable, `reason`, and `part`, a code for what within the reason failed, when known), and `detail.unresolved_changes` each change it could not name the records of (`position`, `evidence`, the passage that asks for it, `object_type` when the model gave one, and `shape`, a code, when the model gave one). `dropped_operations` carries no field values; an `unresolved_changes` entry's `evidence` is a passage of the write's own text, as an `operation` item's `reason` is. `diff_engine.intent_rules` logs what the engine's rules did to the detection model's answer, in the order they acted, so an item can be dropped and later restored (a rename whose old record is stated by part of a composite key is an `identity_change` item `completed`, bound to the one stored row its stated part matches and named by that row's internal id, or `not_bound`, left as stated so the write goes as it would without the step: no stored row or several match, the one row disagrees with the new record, a stored row with a NULL or blank key part matches, the database could not be asked, a value is not one its field can hold, the new record is of another type than the rename's, no index serves a lookup by the stated part, another rename or a merge lands on the same new record, or something else in the write may name the row or the key, its kind in `detail.named_by`); `diff_engine.plan_construction` says what building the plan decided after every earlier step, which the plan shows only by leaving it out (a merge the relation-budget re-check refused or re-admitted after alias binding, a deletion a rename overrides, an unlink dropped for a row a confirmed delete does not run on or a lookalike row the write does not bind, a move whose old link stays with the replacement guard's cause, a dropped merge or one already a single row, what a scoped write left out). A deletion that verification rejected reads `kind: "deletion"`, `decision: "rejected"` under `diff_engine.intent_verification_deep`, with what the object became and why; the proposal itself is the detection model's reply in `llm_calls[]`. Another part of the system may record items of its own shape here; they are served as recorded. Every detail pane serves its operation's records the same way; the write, read and evolution panes serve them for an operation still running or stale too (create and update have no such pane). A step that refuses the write still records what it decided first: the detector its rules, resolution what it found, plan construction the merges, unlinks and scope it changed. A caller who is not privileged gets neither `step_decisions` nor `step_decisions_truncated`, exactly as for `llm_calls[]`.
588
+ **Each `step_decisions[]` entry** is one record of what one step of the operation decided, oldest first (by `recorded_at`, then `sub_stage`). A step records each time it runs and decides something (a step that decided nothing records nothing), so one operation can hold several records of one step, and every record is served; none is merged into another. A write's deletion check records in its own process and again where the diff engine applies its gate, and a write retried whole under the same trace id (a stale-schema retry, a stall requeue, a stuck write claimed again) records every step again. Writes, reads and schema evolution record today. A write's extraction records too, under `extraction.` steps named like its model calls (`extraction.structured_output`, `extraction.description_merger`, `extraction.batch_field_extractor`, `extraction.field_verifier`, `extraction.relations_extractor`, `extraction.relations_verifier`, `extraction.phantom_record_check`, `extraction.linked_record_value_check`, `extraction.deduplication`): what code decided about a reply (candidates folded into one, a reply set aside so the extracted values stand, connections dropped, a candidate left out of the write, a group of types split), and the verifiers' own rejections. The phantom record check records one `object` item per record whose key value a record of another type in the write carries (or, for a record with no key, whose stated values one states alike, with `detail.description`): `not_held` (the check found the text does not present the entity as that type, so the record is marked as one that does not hold), `kept`, `kept_unchecked` (the check did not decide, or the write had more such values than it checks), or `not_run` (the check did not run on the write; `detail.not_run_reason` is `switched_off` or `pinned_provider`), with the other types in `detail.shared_with`. The linked-record value check records one `field` item per record and field holding a value a linked record holds too: `cleared` (the check found the text gives the value to another record holding it and not to this one, so it is cleared from this one), `kept`, `kept_no_key` (the check found the same, but this record states no key, which the deduplication folds by what it states, so it keeps the value), or `kept_unchecked` (the check of its group decided nothing); `detail.field` names the field, and `detail.shared_with_type` and `detail.shared_with_key` the linked record; `detail.description` names a record with no key. Field verification records once per object type, when that type's field processing ends; a write that fails before then records none for that type. When the judge in front of field verification is configured but does not run on a write whose detection found something, the write records why, once, under the stage the judge's calls would journal under (`extraction.verification_judge`, or `shadow.extraction.verification_judge` in shadow mode): one item, `kind` `judge`, `decision` `not_run`, with `detail.not_run_reason` (`sampled_out`, `pinned_provider` or `config_unavailable`) and `detail.mode`. Extraction's items have the diff engine's shape: `kind` is `merge`, `object`, `field`, `relation`, `relation_type` or `type_group`; `decision` is `folded`, `cleared`, `skipped`, `not_held` (the verifier found the text does not state the object holds, so it is marked as one that does not), `kept_unverified`, `verifier_skipped` (field verification did not run because the judge in front of it cleared the object), `kept`, `kept_no_key`, `kept_unchecked`, `key_restored`, `rejected`, `uncastable`, `dropped`, `split` or `escalation_disabled`; `detail` holds field names, candidate numbers and counts (`candidate_count`, `candidate_numbers`, `kept_number`, `ignored`, `basis`, `filled_fields`, `conflicting_fields`, `relations_repointed`, `fields`, `nulled`, `omitted`, `connection`, `field`, `candidates_per_link`, `relations`, `types`, `halves`, `refused_max_tokens`, `error_code`, `shared_with`, `shared_with_type`, `shared_with_key`), and no field's value except an object's key: in `key`, in a dropped relation's `links` (`Type(field='value')` per link), and a `description` for an object that has no key. `/extract` records its extraction the same way; it has no detail document of its own, so its records show only on a write's document when that write, on the same instance, reuses its trace id. A write's apply records what its merges did to the stored rows, under `write.merge_application`, once the write commits (a write that rolls back records none): one item per merge action, `kind` `merge`, named by the surviving row (the diff engine's `merge` items are named by the row merged away instead): its `object_type`, its `key` (absent for a type without a key, for a key with any part NULL or missing, which could name another row, and when the two rows were one) and its internal id, with `decision` `applied` and, in `detail`, the row merged away (by its internal id), `relations_repointed`, `relations_dropped` by reason (`linking_the_merged_rows`: a relation between the two merged rows; `removed_by_this_write`; `duplicate`: one the survivor already held) and `filled_fields`, the survivor's empty fields filled from the merged-away row, by name; or `decision` `nothing_to_merge` with why in `reason` (the two rows were one, or the row to merge away was already gone). Schema evolution records under `operation_kind` `evolution`: review, decide and apply each journal their steps' records once, when the stage ends, under their own trace, so an apply's show on its update document (its trace is the update id), and the detached pass that resolves an apply's gaps afterwards journals its own under the same trace. Its steps are the two model calls' names, `gap analyzer` (gaps never analysed or stored with no concepts, rows a reply left pending, concepts the parser dropped) and `semantic gate` (what the gate may do with each suggestion, candidates kept without a verdict, verdicts downgraded or not acted on), and the rule steps `evolution.backlog`, `evolution.resolution_filter`, `evolution.clustering`, `evolution.consolidation`, `evolution.prior_decisions`, `evolution.prerequisites`, `evolution.evidence_retirement` and `evolution.apply`; `kind` is `gap` (named by its feedback id in `key` and its concept's object and field), `suggestion` (its fingerprint in `key`, its change's names, and the gaps it was built from in `detail.gaps`, the first 20 with `gaps_total` when there are more), `cluster`, `decision`, `backlog`, `reply_entry`, `build` or `gate`, and no item carries what a user wrote. What a transaction did (a gap resolved, stored with no concepts, deleted or retired) is recorded only once it commits, and a row only when that step's own write or delete reached it. A build retried on a stale schema records both attempts: once the build runs again, every item the stage notes until it ends, the build's and the stage's own after it, carries `detail.attempt` (`2`), so an item without `attempt` was noted before the build ran again, and a `retried` item under `evolution.consolidation` records that it did; an `omitted` item is a marker, not a decision, and carries no `attempt`. A read records what the reader's own rules decided, under the name of the model call whose reply a decision is about (`read.question_decomposer`, `read.sql_syntax_fixer`, `read.empty_result_reviewer`, `read.overfetch_reviewer`, `read.answer_formatter`) or under a rule step (`read.scope`, `read.vector_grounding`, `read.sql_rewrites`, `read.sql_guard`, `read.sql_retries`, `read.answer`, and `read.other` for a family no step claims yet); a decision about a SQL statement a model call wrote goes under `read.sql_rewrites`, with the calling step in `detail.phase` where the rule names it. A read step that decided more than 101 times keeps its first and last 50 decisions, with one item (`decision` `omitted`, `detail.count`) where the rest were left out, cut further from the middle when they do not fit one record. A read journals its records once, when it ends, so a read still running has none yet, and a read retried on a stale schema runs again under the same trace id and records every step again; its items have `kind` (the decision family, such as `sql_guard_refused` or `distinct_order_by_case_dropped`), `decision` (`applied` or `not_applied`), `reason` where the rule says why, and `detail.part`, the part of a decomposed question the decision was made for, counted from 1, where it was made for one. `sub_stage` names the step in the `llm_calls[].sub_stage` vocabulary, so a step's decisions and its model calls join on it (a re-issued call journals under its step's name with a suffix such as `.refusal_fallback`, so it joins on the name as a prefix; the reader's rule steps, `extraction.deduplication` and `write.merge_application` have no model calls of their own) (`diff_engine.keyless_binding`, `diff_engine.deletion_check`, `diff_engine.intent_rules`, `diff_engine.value_span_containment`, `diff_engine.intent_verification_deep`, `diff_engine.alias_confirmation`, `diff_engine.object_resolution`, `diff_engine.unwritten_identity_verification`, `diff_engine.plan_construction`, the intent pipeline's `diff_engine.intent_gate`, `diff_engine.intent_operations`, `diff_engine.operations_repair` and `diff_engine.operations_verification`, Phase 1's `diff_engine.operations_second_opinion`, and the `read.` steps above). A model call made in shadow mode, beside the work it never changes and never charged, carries the prefix `shadow.` on its step's name; the intent pipeline and the verifiers' two judges are the steps that run in shadow today. The field verifier's judge, which can stand in front of `extraction.field_verifier` on a DEEP write or `/extract`, makes its calls under `extraction.verification_judge`, or `shadow.extraction.verification_judge` in shadow mode, and records under that same stage, once per object type, one item per object it was asked about: `kind` `object`, `decision` `flagged` (a field at or over its threshold, or one no question covered), `cleared` or `not_judged` (no verdict, which counts as every field flagged), with `detail.field_scores` (the flagged fields the judge scored, and their scores), `detail.unjudged_fields` (flagged fields no question covered), `detail.score`, `detail.field` and `detail.question` (the top score and where it came from), `detail.threshold`, `detail.questions_asked`, `detail.verifier` (`ran`, `ran on the flagged fields and the key`, `ran on the key`, or `skipped`) and `detail.empty_key` (the key fields field extraction left empty, when there are any). In on mode the verifier is asked only about the flagged fields and the key, and about a key field extraction left empty even on an object the judge cleared (`ran on the key`); in shadow mode it sees every field, and the item says what on mode would have sent it. A `verifier_skipped` item under `extraction.field_verifier` is an object an `extraction.verification_judge` call of the same operation cleared; every question and answer is in that call in `llm_calls[]`. The relation verifier's judge, which can stand in front of `extraction.relations_verifier` on DEEP writes and DEEP `/extract` calls, names its calls `extraction.relation_verification_judge`, or `shadow.extraction.relation_verification_judge` in shadow mode, and records under that same stage one verdict item per verifier call: `kind` `relation_type`, `decision` `flagged` (a proposed connection at or over its threshold), `cleared` or `not_judged` (no verdict, or two proposed connections sharing a unique key's values, which counts as flagged), with `detail.connection_scores` (the flagged connections' positions in the proposed list, counted from 1, and their scores), `detail.score` and `detail.top_connection` (the top score and its position), `detail.connections` (how many were proposed), `detail.threshold`, `detail.questions_asked` and `detail.verifier` (`ran`, or `skipped` when on mode kept the call's connections as proposed). A call on mode kept as proposed also records there any connection code dropped while building it (`kind` `relation`, `decision` `dropped`). A write it does not run on records one `kind` `judge`, `decision` `not_run` item under its stage, as the field verifier's judge does. The intent pipeline names its model calls by its step names above, with the prefix `shadow.` in shadow mode (`diff_engine.operations_repair` the operations step asked once more about the entries its checks dropped); `diff_engine.intent_operations` records what the write did with the answer in on mode only, where it stands in for `diff_engine.intent_rules`, and in either mode (with the prefix in shadow mode), once the run has finished, one item when the operations call ran out of its output budget and was asked once more: `kind` `intent_operations`, `decision` `retry_answered` or `retry_failed`, and `detail.model`, `detail.error` (the first call's code) and, on `retry_failed`, `detail.failure` (the type of the error the step then failed with); a run the write's grace cancelled with the retry in flight, or one whose gate closed or failed, records none, and the retried call is the step's `llm_calls[]` entry whose `reissue_reason` is `provider_output_token_limit_exceeded`. `diff_engine.operations_repair` (with the prefix in shadow mode) records one item, once the run has finished, when the operations step asked its model once more about the entries its checks dropped: `kind` `intent_operations`, `decision` `repaired` (the second reply stood), `repair_rejected` (it was not the first reply with those entries fixed, so the first stood with its drops) or `repair_failed` (the repair met an error, so the first reply stood with its drops), and `detail.model` (the model the repair asked last: the one that gave the first reply, or its fallback after an outage) and, on `repair_failed`, `detail.failure` (the type of the error it met); a run whose gate closed records none, and so does a reply over the cap, which is never repaired: the write falls back to the engine. `diff_engine.intent_gate` (with the prefix in shadow mode) records one item when the gate's deadline, the write's grace, opened it: `kind` `intent_gate`, `decision` `opened_by_deadline`, and `detail.deadline_seconds`, `detail.unanswered_calls` (the gate calls cut off) and `detail.sentence_count`. A step whose decisions act on another step's calls names itself the same way: `diff_engine.intent_rules` acts on the replies under `diff_engine.object_and_relations_deletion_detection` and `diff_engine.batch_field_erasure_detection`. The records hold what the engine decided that the operation's `llm_calls[]` (their prompts and replies) and its `diff_plan` do not already show, so the model's own answers are read in `llm_calls[]`, not here. `decision_count` is the step's true total and `decisions_truncated` marks a record cut to fit (for a read step, also one cut to its first and last 50 decisions), so `decisions` can hold fewer items than the count. `decisions` is the items as the step recorded them, a JSON array, or `null` when the stored text is not one (the count still shows). A pane serves at most 500 records and 4 MiB of `decisions` text, the newest; when it cut older ones it adds `step_decisions_truncated: true` beside the array, and otherwise the key is absent. A trace id a client reuses across writes serves every write's records together, ordered by time with nothing between the writes. The diff engine's items share one shape: `kind` (what the item is: `intent_gate`, `intent_operations`, `intent_verification`, `object`, `identity_change`, `merge`, `filtered_deletion`, `filtered_update`, `relation`, `deletion`, `alias`, `relabel`, `scope`, `detection`, `operation`, `intent_pipeline`, `second_opinion`) and `decision` (what was decided: `deletion_dropped`, `converted`, `rejected`, `kept`, `bound`, `not_bound`, `matched`, `left_out`, …), then, where set, `object_type` and `key` (the primary-key values as `field='value'`), `index` (the object's position in the diff engine's sorted object list, not in `extracted_objects[]`), internal id (the stored row), `reason`, and `detail` (anything else the step decided). `diff_engine.keyless_binding` records one `object` item per record of a keyed type that states no key but another field: `bound` to the one stored row it names (its `key` and internal id), or `not_bound` with why in `detail.outcome` (a record one stored row matches in every field it states carries that row's `key` and internal id when it is left `not_identifying`, matching only in yes/no and listed-value fields and never put to the verifier, or `rejected` or `unverified`, the verifier not confirming the text refers to it); `same_key_group` (the write holds records of different types with the same key, so nothing of it is looked up), `key_stated_for_another_type` (a record of another type in the write states the key of the row it would bind to), `key_of_another_type` (a stored row of another type has that key) and `key_check_unread` (the stored rows could not be read, or the key has more fields than the check looks up) are a temporary net against extraction copying a record's identifier onto another type; a binding left unbound for one of the last three carries the row it would have bound to (its `key` and internal id; a record not asked about its closest rows for them lists those rows in `detail.other_type_rows` instead), and the other types in `detail.other_types`: for `key_stated_for_another_type` and `key_of_another_type`, and for a record set aside unasked as `key_check_unread` whose rows stand down for different reasons, the types its rows' keys were found under. The same-key groups and the stated-key check go once extraction no longer returns such copies; the stored-key check goes only once the copies earlier writes stored are cleaned up too, or a scan finds none. A stored copy whose key differs only in case, surrounding spaces or accents is not found. In on mode, Phase 1's `record_where` lookup may also ask the verifier under `diff_engine.keyless_binding` (on a model that runs that check, when one stored row matches and the answer would be used once it is confirmed), about a rename's or a merge's record the text names by its fields whose extracted record carries the operation's new key, and records no item of its own: what came of it shows under `diff_engine.intent_operations`, where a bound rename is named by the stored row's key, or as `record_where_unbound` with `detail.sub` `stated_key`, or as the fallback a bound answer met later (such as `rename_old_key_unmatched`, or `rename_or_merge_rejected` when Phase 1.5 did not confirm every rename and merge of the answer); under `intent_pipeline_failures: refuse` a bound answer whose translation fails, or whose key-only lookup could not run, still goes to the engine as `record_where_unbound`, as before the lookup, and a failure of the verified relabel's own work as `relabel_failed`. `diff_engine.operations_second_opinion` records one item, `kind` `second_opinion`, on an on-mode write that the moves the verifier rejected would send to the engine, when the verification fallback is asked about them again: `decision` `confirmed` (they took the path a confirmed move takes; `diff_engine.intent_operations` says whether each was applied), `confirmed_beside_a_rejection` (another move still sent the write to the engine), `rejected`, `no_answer`, `not_asked` (its model gave the rejection) or `not_asked_model_unknown` (the write's result does not say which model rejected them), with `detail.model`, `detail.asked`, `detail.confirmed` and, when no verdict came, `detail.unanswered`; the call it made is that step's `llm_calls[]` entry. In on mode `diff_engine.intent_operations` says what the write did with the intent pipeline's answer: an `operation` item per operation it applied, its `decision` the operation's kind (`delete`, `unlink`, `unlink_all`, `move`, `clear`, `rename`, `merge`, `bulk_delete`, `bulk_update`) and its `reason` the passage that asks for it, then `not_applied` for one the write could not carry out (a delete of a record by the new name a rename of the same write gives it reads "it is also the target of a rename", as the engine's own rule says it, and a move with no end it leaves that the verifier confirmed, the old engine's gate closed, reads "the write's text read no removal or relink, so the stored link stays beside the one the write states") and `dropped` for one the pipeline dropped, each with why and `detail.position` (its place in the model's reply), then an `object` item `skip` for each record of a keyed type that states no key and that the write skipped, and `erase_refused` for each record bound to a stored row by its other fields whose clears were not applied (`detail.fields`); a `clear` item therefore names what the pipeline asked for, not what was written. When the engine's own detection decides the write instead, the step records one `intent_pipeline` item, `decision` `engine_decides`, whose `detail.fallback` names why (its `reason` says it in words) and beside which the engine's own steps record as with the pipeline off: `missing` (no result reached the write), `unreadable`, `translation` (the rows the operations name could not be read), `dropped` (the pipeline dropped an operation it proposed for a reason other than its verifier's rejection, so its answer is not the whole change; every drop of an answer that keeps nothing reads as no change when the write's presence check left the gate closed; `detail.sub` `gate_open` when this node read that gate open, `after_translation` or `after_key_only_lookup_failed` when such an answer then failed), `verifier_rejected` (a temporary net: the pipeline's verifier rejected a delete, a clear, an unlink, an unlink_all or a move it proposed, which may be about how the operation names its records rather than the change; a rejected bulk delete or update does not count, and a rename it rejects, or a merge while `execution.entity_merge` is on, goes to the engine as `rename_or_merge`; a move naming no end it leaves goes to the engine with `detail.sub` `move_fetch_cut_short` or `move_link_not_extracted` where that applies, and is otherwise left to the write's verification, which decides the stored link it would end; rejections of deletes, clears and moves that are the whole answer read as no change when the write's presence check left the gate closed, and otherwise as `verifier_rejected`, `detail.sub` `gate_open` when this node's own reading of that gate is open, or `after_translation` or `after_key_only_lookup_failed` when that step failed on such an answer), `record_where_unbound` (it names a record by the field values the text states, a key stated in part among them, and once verified, binding it through the write's own extraction found no single record for it; a writer that predates the binding decided it before the pipeline's verifier was asked; `detail.sub` `after_translation` or `after_key_only_lookup_failed` when a rename or merge the stored-row lookup bound then failed, whatever Phase 0's gate), `unresolved` (it saw a change whose records it could not name: a record described rather than named, records selected through a relation, some but not all links of a kind, or all of them handed over to another record; every one of them ending, but those the text keeps, is an `unlink_all`; `detail.sub` `after_translation` or `after_key_only_lookup_failed` when an answer of such changes alone, none naming a type, read as holding no operation while the write's presence check left the gate closed, then failed), `rename_or_merge` (it holds a rename or an unlink_all sharing a record with a merge, renames that swap, cycle, fork or converge, or an unlink_all whose record another operation names in its relation, decided before the pipeline's verifier is asked, or the verifier rejected a rename, or a merge while merges are on), `rename_old_key_unmatched` (it renames a record that no single stored record has by the name the text gives), `merge_loser_unmatched` (it merges away a record that no single stored record has by the name the text gives), `rename_onto_stored` (it renames a record onto a name another stored record already has), `rename_record_partly_stated` (the write states a record without the rest of a key a rename names, so whether it is that rename's old record, its new record or another one is unknown), `clear_in_question` (the text holds a question mark and Phase 1.5 did not confirm a clear the answer holds, `detail.sub` `rejected_in_phase_1_5`), `unlink_in_question`, `move_in_question`, `repoint_in_question` (temporary nets: while the text holds a question mark, it unlinks records of a relation type the extraction holds a relation of, or moves a relation, or, whatever it holds, the extraction holds a relation of a type keyed on some of its ends but not all, which written re-points the stored link those ends share, as with the pipeline off; Phase 1.5 cannot verify or take back any of these; `repoint_in_question`'s `detail.sub` is `after_translation` or `after_key_only_lookup_failed` when a question text's answer that stood while the write's presence check left the gate closed then failed), `delete_with_values` (it deletes a record the write's own extraction gives values other than its fields' defaults), `delete_not_stored` (it deletes a record no single stored row and no extracted record has by the key it names, while the write's own extraction holds a record of its type, which may be the stored record the text names in another form than its key, such as a name in another grammatical case), `unlink_replaced` (it unlinks records while the write's own extraction holds another record the link may have moved to, which no new link joins to the unlink's other ends and no other operation ends or removes; `detail.sub` `after_translation` or `after_key_only_lookup_failed` when such an answer, read as holding no operation while the write's presence check left the gate closed, then failed), `unlink_all_with_links` (it ends every link of a kind that a record has, while the write's own extraction links that record by that kind to a record it does not keep, or holds another record of its type that nothing accounts for, as a transfer the answer misread would), `unlink_all_names_an_end` (the extraction holds a record of the kind an unlink_all ends that it does not keep, as when the text names the one link it ends, or the unlink_all keeps a record at only some of the roles its type takes), `key_rewritten` (an operation's key was read as the extraction's spelling), `unmatched_key_only` (the gate opened, while the extraction holds a record by its key alone that the answer would write and no stored row has; a delete's record, a rename's old and new records, a merge's survivor, a move's new end and a record an unlink_all keeps are not looked up; `detail.sub` `after_translation` when relation ends it was going there for, bound to their stored twins instead, then failed, whatever Phase 0's gate, or when an answer holding no operation it let stand beside such records, while the write's presence check left the gate closed, then failed), `key_only_lookup_failed` (the same, but whether those records are stored could not be read), `end_not_stored` (an unlink's end, an unlink_all's own record, or a move's old or kept end, binds no single stored row: none has its key, or several do, so the stored link would stay; a write whose every operation is so, with the old engine's gate closed as the presence check's verdicts stored beside the answer read it, does not fall back: it stores what was extracted and reports each as a `rejected` relationship outcome; `detail.sub` `gate_open` when the stored verdicts read that gate closed and this node read it open, `twin_bound` when a twin binding rewrote the extraction, so written alone a record would land on a stored row the old engine leaves alone), `kept_record_not_stored` (a record an unlink_all keeps binds no single stored row, so its link could not be told from the others and could end; a record the write creates counts too when the unlink_all would end a stored link, which could be that record under another spelling), `kept_link_missing` (a record an unlink_all keeps has no link to the unlink_all's record, stored or in the write, so the record would be left with no link of the kind), `unlink_all_partial_fetch` (an unlink_all's record's links were read from a fetch cut short, so the links not read would stay), `rename_or_merge_rejected` (the write's second verification did not confirm every rename and merge of the pipeline's answer, so the engine's own detection decided it again from the start; a temporary safety net, until the pipeline binds the records its operations name itself; it goes together with `unmatched_key_only` and the end guard, which would otherwise send most such writes to the engine), `end_not_extracted` (a move's new end is neither a stored row of its type nor a record the write's extraction holds, by its key: a key the pipeline made up, such as a name or part of an id), `empty_answer_check_found_intent` (a temporary net: the answer holds no operation while Phase 0's gate, which read the deletion check the write ran, is open other than by its bulk-update or merge verdict alone; where the pipeline's gate closed beside a deletion or relink verdict, the write path first asks the operations step once more, and an answer its verifier confirms goes through the usual nets in the empty answer's place; `detail.sub` `after_translation` or `after_key_only_lookup_failed` when an answer holding no operation whose gate the bulk-update or merge verdict opened alone, or the answer that second look confirmed, then failed), `date_field` (an operation names a field in which the write's extraction resolved a date token, or dropped one that named no day, which the pipeline does not yet state as the extraction resolves it; a temporary safety net, until the pipeline resolves those dates too), `inside_value` (the answer holds an operation beside a value the text assigns to a record's field, a long one quoted verbatim or any one an operation's quote touches, which may narrate changes the caller did not ask for, or the check could not tell, so the engine's own detection decides the write; while the write's presence check left the gate closed and this node reads it closed too, the answer is read as holding no operation instead and used, its operations dropped, and `detail.sub` is `after_translation` or `after_key_only_lookup_failed` when such an answer then failed), or the step a run without an answer stopped at (`gate`, `operations`, `verification`, `executor`, `late`, `not_run`). A write of an instance that pins its write text to a provider is no fallback: its instance's own mode is `off`, so the step records one `intent_pipeline` item, `decision` `instance_mode`, with `detail.mode` `off` and `detail.sub` `pinned_provider`, and the engine's own steps record beside it as with the pipeline off. Beside `fallback`, `detail.sub` gives why as one code with no value, when one is known (for `unmatched_key_only` what the records were, `relation_end`, `not_an_end`, `partial_key` or `empty_answer`; a failed stage's exception type, a not-run reason, the drop kinds and reasons, the rejected kinds, whether `rename_or_merge` was decided before or after verification), `detail.dropped_operations` lists each operation the pipeline dropped (`position` in the model's reply, `operation` kind when readable, `reason`, and `part`, a code for what within the reason failed, when known), and `detail.unresolved_changes` each change it could not name the records of (`position`, `evidence`, the passage that asks for it, `object_type` when the model gave one, and `shape`, a code, when the model gave one). `dropped_operations` carries no field values; an `unresolved_changes` entry's `evidence` is a passage of the write's own text, as an `operation` item's `reason` is. `diff_engine.intent_rules` logs what the engine's rules did to the detection model's answer, in the order they acted, so an item can be dropped and later restored (a rename whose old record is stated by part of a composite key is an `identity_change` item `completed`, bound to the one stored row its stated part matches and named by that row's internal id, or `not_bound`, left as stated so the write goes as it would without the step: no stored row or several match, the one row disagrees with the new record, a stored row with a NULL or blank key part matches, the database could not be asked, a value is not one its field can hold, the new record is of another type than the rename's, no index serves a lookup by the stated part, another rename or a merge lands on the same new record, or something else in the write may name the row or the key, its kind in `detail.named_by`); `diff_engine.plan_construction` says what building the plan decided after every earlier step, which the plan shows only by leaving it out (a merge the relation-budget re-check refused or re-admitted after alias binding, a deletion a rename overrides, an unlink dropped for a row a confirmed delete does not run on or a lookalike row the write does not bind, a move whose old link stays with the replacement guard's cause, a dropped merge or one already a single row, what a scoped write left out). A deletion that verification rejected reads `kind: "deletion"`, `decision: "rejected"` under `diff_engine.intent_verification_deep`, with what the object became and why; the proposal itself is the detection model's reply in `llm_calls[]`. Another part of the system may record items of its own shape here; they are served as recorded. Every detail pane serves its operation's records the same way; the write, read and evolution panes serve them for an operation still running or stale too (create and update have no such pane). A step that refuses the write still records what it decided first: the detector its rules, resolution what it found, plan construction the merges, unlinks and scope it changed. A caller who is not privileged gets neither `step_decisions` nor `step_decisions_truncated`, exactly as for `llm_calls[]`.
587
589
 
588
590
  **A scoped key gets `[]` for `ddl_queries` / `schema_generation`, not the rows.** Those two come from records that carry no instance ownership — the schema generation's trace id is even client-supplied — so they cannot be scoped to an instance and are served only to callers with no instance restriction at all. This is a deliberate fail-closed choice, not a bug to work around: an empty array means "not available to this credential", never "this operation ran none". `llm_calls[]` behaves the same way (gated the same way) and always has. `sql_queries` is split: statements recorded with their owning instance reach every caller who may open the read, even when another instance reused the trace id, while statements recorded before ownership was tracked carry no owner and reach unrestricted callers only. A scoped key therefore sees `[]` for reads that old. To let a script tell the two apart, the Console sets a sibling boolean next to each — `sql_queries_withheld`, `ddl_queries_withheld`, `schema_generation_withheld` — that is `true` exactly when a row that exists was withheld from this caller: for `ddl_queries` / `schema_generation` that is every scoped caller, for `sql_queries` a scoped caller on a read that has ownerless rows. So `[]` with `…_withheld: false` is "none recorded", `[]` with `…_withheld: true` is "not yours to see". **Internal ids are hidden from every caller but a privileged one**, including on writes that carry no identity map — the substitution is done by the Console, server-side, so a caller with no browser sees `(record)` rather than a raw id.
589
591
 
@@ -750,6 +752,8 @@ Some commands attach a more specific `stage` (`validate`, `usage`, `limit`, `not
750
752
 
751
753
  **Breaking change in 0.0.5:** HTTP **403** previously exited **4** (`auth`); it now exits **3** (`permission`). Scripts that treated exit **4** as “any auth-layer failure” must check `stage` or handle exit **3** for permission denials.
752
754
 
755
+ **New in 2.0.2:** a write's `changes.unstored_field_values` prints as a note per value: a value the text gave that its field's type could not hold as given, such as `note: Company name='Acme' employees: 'about 200' was not stored: the field's type cannot hold it`, or `note: Deal name='Q3' won: 'maybe' was stored as false: the field's type cannot hold it as given` for one stored differently. `--json` is unchanged.
756
+
753
757
  **New in 2.0.1:** `auth login --email` no longer reads the organisation's default API role before minting: the server issues the key with it, so an account whose role lacks `role.get` signs in by email too. Afterwards the success line names the role where the account may read it and otherwise leaves it out, instead of printing the role's id. In the JSON result, `api_role` carries the name, else the id, else null, and the new `api_role_id` the id where it was read. An organisation with no default API role is told that xmemory sets it, and to sign in meanwhile with `auth login` and a key with a role created on the Console's API Keys page. The `--email` help and this reference describe the key's role instead of calling it org-wide. `auth status` and `org key` no longer include the boolean that said whether a key's access is unrestricted; scripts that read it should check the operation they need instead (a `trace calls` request, for example, is refused with exit **3** where it is not allowed).
754
758
 
755
759
  **New in 2.0.0:** the release that goes out with the server release that moves keys, users and invitations to scoped role assignments. It is a major release because `org key` output changes: a key whose access is assignment-based shows its `assignments` instead of one role. Permission names follow the server's (`instance.get` and `cluster.get`, which replace `instance.get_own` and `cluster.get_own`), so `org list instances` reports `"missing_permission": "instance.get"` in its degraded document (a server before them still gets `"instance.get_own"`, its own name), which it now also returns when only some of the visible instances have readable metadata. In that case `org list instances --cluster` exits **3** (`stage: "permission"`) and asks you to drop the filter or use a key with `instance.get`, where 1.9.5 filtered the instances it could read. `hosted_deployments` in your own `~/.xmemcli.json` names the Console and MCP origins of a deployment whose origins cannot be inferred (see "`~/.xmemcli.json`" below), used for `auth login`, `trace`, `org manage`, `org memberships` and `mcp` as their built-in pairs are; `--console-url` and `--mcp-url` still win. New: `read --return-sql` keeps the SQL the read API returns (`sql`, `sqls`, `sql_attempts`, or `sql_unavailable`); `org manage <resource> <action>` and `org memberships list|edit` administer roles, assignments, keys, users, invitations, memberships and the default API role, signing in with `--email` or acting as the key with `--as-key`; `auth login --email` mints with the organisation's default API role as the server names it. An older server answers the new commands with an error and changes nothing.
@@ -898,7 +902,7 @@ These apply **before** any subcommand (`xmemcli help options`).
898
902
  | `--binding-dir` | `XMEM_BINDING_DIR` | Where `binding` commands look for `.xmemory.json`; reads walk **up** toward `$HOME` and **merge** every scope |
899
903
  | `--console-url` (accepted by `trace …`, `auth login`, `org manage` and `org memberships`; `$XMEM_CONSOLE_URL` is read by `auth status` too) | `XMEM_CONSOLE_URL` | Console origin serving the trace views, and the one `org manage` and `org memberships` sign in through (inferred for the public and local API pairs, a pair in `~/.xmemcli.json` and the `/console` sibling of a `/xmem` base; required for any other API origin). A named Console that provably does not pair with the API origin is refused; the refusal names the setting that supplied it, since `auth status` does not accept the flag |
900
904
  | `--json` | — | Force one JSON document on stdout |
901
- | `--verbose` | — | Add `trace_id` / `console_url` when present (never diff plans or other internals; SQL only via `read --return-sql`) |
905
+ | `--verbose` | — | Add command-specific context such as `trace_id` and `console_url` when available. Added context appears in JSON output. `org list keys` includes every metadata field the API returns for each key (never the plaintext key). Terminal output shows the prefix, name, and active status. Use `read --return-sql` for read SQL diagnostics. |
902
906
 
903
907
  **Credential resolution:** `--api-key` → `$XMEM_API_KEY` → nearest `.xmemrc.json` → *Not logged in — run `xmemcli auth login` first.*
904
908
 
@@ -934,7 +938,12 @@ with `--console-url` for an in-memory user session. `--as-key` is limited to
934
938
  visible inventory, capabilities, scoped child-key issuance and scoped membership edits. `--body FILE`
935
939
  supplies explicit JSON changes; assignment/membership batches require the
936
940
  `expected_revision` from a fresh list. Key creation requires `--out FILE` and
937
- never prints the secret. Run `org manage --help` for the command matrix. For example,
941
+ never prints the secret. On a key-creation 429, the CLI advises a short wait.
942
+ With `--as-key`, it also reports `retry_after_seconds` in JSON when the server
943
+ supplies a numeric `Retry-After` header. For both `org manage keys create --as-key`
944
+ and `org create key`, the CLI reports the delay as sent, including zero, from
945
+ headers with up to ten ASCII digits. Run `org manage --help` for the command
946
+ matrix. For example,
938
947
  `org manage assignments list --subject-kind user --subject-id USER_UUID --email you@example.com`
939
948
  reads assignments before a revision-checked edit.
940
949
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "xmemcli"
3
- version = "2.0.1"
3
+ version = "2.0.2"
4
4
  description = "Command-line client for the xmemory HTTP API: PKCE auth, instances, read/write, schema and XMD tools."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12,<4"
@@ -1,3 +1,3 @@
1
1
  """Standalone xmemcli package (``xmemcli`` console script)."""
2
2
 
3
- __version__ = "2.0.1"
3
+ __version__ = "2.0.2"
@@ -39,7 +39,7 @@ from typing import Any, Callable, NamedTuple, NoReturn, override
39
39
  from urllib.parse import quote, urlsplit
40
40
 
41
41
  from ._envelope import batch_envelope_error
42
- from ._text import oneline
42
+ from ._text import oneline, parse_retry_after_seconds
43
43
  from ._login import (
44
44
  LOOPBACK_HOSTS,
45
45
  LoginAborted,
@@ -81,7 +81,7 @@ _ROLE_NAME_TIMEOUT_S = 10.0
81
81
  #: Secure, the jar then refuses to replay it, and every later step would fail slowly.
82
82
  PENDING_COOKIE_NAME = "XMEM_SIGNIN_PENDING"
83
83
 
84
- #: The API role every org is seeded with at signup; used when the org offers no other role.
84
+ #: Legacy signup role name, used only for servers predating the CLI login handoff.
85
85
  DEFAULT_API_ROLE_NAME = "Default"
86
86
 
87
87
  # Claim-poll cadence, mirroring the Console's own waiting tab so the CLI adds no load the
@@ -159,7 +159,7 @@ class _Reply(NamedTuple):
159
159
 
160
160
  status: int
161
161
  body: dict[str, Any]
162
- retry_after: float | None
162
+ retry_after: int | None
163
163
 
164
164
 
165
165
  #: Reads one line from stdin within a timeout; ``None`` when nothing was typed. Injectable so
@@ -243,24 +243,25 @@ def make_stdin_code_reader() -> CodeReader | None:
243
243
  return read
244
244
 
245
245
 
246
- def _retry_after_seconds(headers: Any) -> float | None:
247
- """The ``Retry-After`` delay in seconds, accepting only RFC 9110's digits form.
246
+ def _retry_after_seconds(headers: Any) -> int | None:
247
+ """Read the delay from the email sign-in response headers.
248
248
 
249
- A general float parse accepted ``inf`` and ``1e400``; the interval clamp bounds the damage,
250
- but a value that is not a delay at all should read as "no hint", not as the maximum pause.
249
+ A digit string longer than ten characters is the cap, not a missing hint, so a longer
250
+ requested wait does not fall through to the slow poll. Leading zeros still parse when the
251
+ significant digits fit in ten characters. The shared parser refuses to call ``int`` on an
252
+ unbounded digit string; this cap does not either.
251
253
  """
252
- raw = None
253
- if headers is not None:
254
- try:
255
- raw = headers.get("Retry-After")
256
- except AttributeError:
257
- raw = None
258
- if not raw:
259
- return None
260
- text = str(raw).strip()
261
- if not (text.isascii() and text.isdigit()):
254
+ raw = headers.get("Retry-After") if headers is not None else None
255
+ parsed = parse_retry_after_seconds(raw)
256
+ if parsed is not None:
257
+ return parsed
258
+ text = (raw or "").strip()
259
+ if not (text.isascii() and text.isdecimal()):
262
260
  return None
263
- return float(int(text))
261
+ significant = text.lstrip("0") or "0"
262
+ if len(significant) <= 10:
263
+ return int(significant)
264
+ return int(MAX_RETRY_AFTER_S)
264
265
 
265
266
 
266
267
  def _decode_json(raw: bytes) -> dict[str, Any]:
@@ -24,6 +24,7 @@ _INTERNAL_DESTS = frozenset(
24
24
  "org_command",
25
25
  "org_list_target",
26
26
  "org_create_target",
27
+ "membership_action",
27
28
  "cluster_command",
28
29
  "cluster_list_target",
29
30
  "auth_command",
@@ -331,8 +332,11 @@ _GLOBAL_OPTION_LINES: dict[str, tuple[str, str]] = {
331
332
  "TTY default is pretty text; pipes and redirects already emit JSON.",
332
333
  ),
333
334
  "verbose": (
334
- "Add trace_id and console_url when the server sends them.",
335
- "Never shows diff plans or other server internals; SQL is shown only by `read --return-sql`.",
335
+ "Add command-specific context such as trace_id and console_url when available. "
336
+ "Added context appears in JSON output.",
337
+ "`org list keys` includes every metadata field the API returns for each key (never the plaintext key). "
338
+ "Terminal output shows the prefix, name, and active status. "
339
+ "Use `read --return-sql` for read SQL diagnostics.",
336
340
  ),
337
341
  }
338
342
 
@@ -625,20 +629,27 @@ class CliParseError(Exception):
625
629
  super().__init__(message)
626
630
 
627
631
 
628
- # The rejected value is either quoted (`'abc'`, however it is spelled inside) or a bare integer: argparse prints a
629
- # `type=int` value bare on older 3.12 releases (3.12.4: `0`) and quoted on later ones (3.12.13: `'0'`). Only the bare
630
- # branch is limited to an integer, so a quoted value may hold parentheses or ` (choose from ...)` without being cut.
631
- _INVALID_CHOICE_RE = re.compile(
632
- r"argument (?P<arg>\S+): invalid choice: '?(?P<choice>(?<=')[^']+|(?<!')-?\d+)'?"
633
- r"(?: \(choose from (?P<choices>[^)]+)\))?"
632
+ _INVALID_CHOICE_PREFIX_RE = re.compile(r"argument (?P<arg>\S+): invalid choice: ")
633
+ _CHOICES_SUFFIX = r"(?: \(choose from (?P<choices>[^)]+)\))?"
634
+ # Keep argparse's original error for unrecognized option choice formats.
635
+ # Argparse can print a rejected integer bare or in single quotes, depending on the Python release.
636
+ _INVALID_CHOICE_RE = re.compile(r"(?P<choice>'[^'\\]+'|-?[0-9]+)" + _CHOICES_SUFFIX)
637
+ # Command errors must hide the parser destination. Keep repr escapes visible in the CLI output.
638
+ _INVALID_COMMAND_CHOICE_RE = re.compile(
639
+ r"""(?P<choice>'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*")"""
640
+ r"(?:, maybe you meant '[^']+'\?)?" + _CHOICES_SUFFIX
634
641
  )
635
642
 
636
643
 
637
644
  def _format_cli_parse_error(message: str) -> str:
638
- match = _INVALID_CHOICE_RE.search(message)
645
+ prefix = _INVALID_CHOICE_PREFIX_RE.match(message)
646
+ arg = prefix.group("arg") if prefix else ""
647
+ pattern = _INVALID_COMMAND_CHOICE_RE if arg in _INTERNAL_DESTS else _INVALID_CHOICE_RE
648
+ match = pattern.fullmatch(message, prefix.end()) if prefix else None
639
649
  if match:
640
- arg = match.group("arg")
641
650
  choice = match.group("choice")
651
+ if choice.startswith(("'", '"')):
652
+ choice = choice[1:-1]
642
653
  if arg == "command":
643
654
  return (
644
655
  f'{CLI_NAME}: unknown command "{choice}"\n\n'
@@ -10,8 +10,9 @@ from urllib.parse import urlencode
10
10
  from . import _email_login
11
11
  from ._envelope import batch_envelope_error
12
12
  from ._login import LoginAborted, LoginError, LoginTimeout
13
- from ._org_cluster import _reserve_key_file, _discard_key_file
13
+ from ._org_cluster import _add_key_mint_retry_advice, _discard_key_file, _reserve_key_file
14
14
  from ._output import CliOutput, OutputKind, make_error
15
+ from ._text import parse_retry_after_seconds
15
16
  from ._trace import console_origin
16
17
  from ._xmem_bridge import xmem_module, http_error_output
17
18
 
@@ -237,6 +238,7 @@ def _prepare(args):
237
238
 
238
239
  def cmd_manage(args: argparse.Namespace) -> tuple[CliOutput, int]:
239
240
  m = xmem_module()
241
+ creating_key = (args.resource, args.action) == ("keys", "create")
240
242
  fd = None
241
243
  written = False
242
244
  key_file = None
@@ -277,7 +279,10 @@ def cmd_manage(args: argparse.Namespace) -> tuple[CliOutput, int]:
277
279
  classified = m._http_error_classify(error, context="Account management request failed")
278
280
  if classified is not None:
279
281
  return classified
280
- return make_error(message, status=reply.status, stage="request"), m.EXIT_HTTP_ERROR
282
+ output = make_error(message, status=reply.status, stage="request")
283
+ if creating_key:
284
+ _add_key_mint_retry_advice(output, reply.retry_after)
285
+ return output, m.EXIT_HTTP_ERROR
281
286
  payload = reply.body
282
287
  error = batch_envelope_error(payload)
283
288
  if error:
@@ -305,6 +310,10 @@ def cmd_manage(args: argparse.Namespace) -> tuple[CliOutput, int]:
305
310
  except m.UsageError as exc:
306
311
  return exc.output, exc.exit_code
307
312
  except m.ApiError as exc:
313
+ if creating_key and exc.status == 429:
314
+ output, code = http_error_output(exc, context="Account management failed")
315
+ _add_key_mint_retry_advice(output, parse_retry_after_seconds(exc.retry_after))
316
+ return output, code
308
317
  return http_error_output(exc, context="Account management failed; read back before retrying a write")
309
318
  except (LoginAborted, KeyboardInterrupt):
310
319
  return make_error("Sign-in cancelled", stage="login"), m.EXIT_INTERRUPTED
@@ -8,6 +8,7 @@ from typing import Any
8
8
 
9
9
  from ._envelope import batch_envelope_error
10
10
  from ._output import CliOutput, OutputKind, make_error
11
+ from ._text import parse_retry_after_seconds
11
12
  from ._xmem_bridge import curate_instance, http_error_output, xmem_module
12
13
 
13
14
  _CLUSTER_FIELDS = ("id", "name", "description")
@@ -432,6 +433,20 @@ def _user_may_mint_keys(m: Any, base: str, api_key: str) -> bool | None:
432
433
  return value if isinstance(value, bool) else None
433
434
 
434
435
 
436
+ def _add_key_mint_retry_advice(output: CliOutput, seconds: int | None) -> None:
437
+ payload = output.payload
438
+ if not isinstance(payload, dict) or payload.get("status") != 429:
439
+ return
440
+ # The mint endpoint returns 429 before creating a key.
441
+ if seconds is None:
442
+ hint = "no key was created; it is safe to run this again after a short wait"
443
+ else:
444
+ payload["retry_after_seconds"] = seconds
445
+ unit = "second" if seconds == 1 else "seconds"
446
+ hint = f"no key was created; wait {seconds} {unit} before running this again"
447
+ payload["error"] = f"{payload['error']} ({hint})"
448
+
449
+
435
450
  def _create_failure_hint(
436
451
  m: Any, e: Any, name: str, cluster: str, *, user_may_mint_keys: bool | None = None, scoped: bool = False
437
452
  ) -> str | None:
@@ -449,9 +464,6 @@ def _create_failure_hint(
449
464
  if status == 0 or status >= 500:
450
465
  # The server may have committed before the reply was lost.
451
466
  return f'a key named "{name}" may still exist; check with `xmemcli org list keys` before running this again'
452
- if status == 429:
453
- # Every 429 refuses before the mint; the server's message says which limit.
454
- return "no key was created; it is safe to run this again after a short wait"
455
467
  if status == 400:
456
468
  return "no key was created"
457
469
  if status == 404:
@@ -609,6 +621,7 @@ def _mint_into(
609
621
  output, code = http_error_output(e, context="key creation failed")
610
622
  if hint is not None and isinstance(output.payload, dict) and isinstance(output.payload.get("error"), str):
611
623
  output.payload["error"] = f"{output.payload['error']} ({hint})"
624
+ _add_key_mint_retry_advice(output, parse_retry_after_seconds(e.retry_after))
612
625
  return output, code, False
613
626
  err = batch_envelope_error(created)
614
627
  if err:
@@ -11,7 +11,7 @@ keep strictly separated:
11
11
  ``result.stdout``), or any time the human explicitly passes ``--json``.
12
12
  In that mode every command MUST emit **exactly one** JSON document on
13
13
  stdout, so a downstream consumer can rely on ``xmem read … | jq .``
14
- yielding one document unconditionally — the curated payload each
14
+ yielding one document unconditionally — the payload each
15
15
  ``OutputKind`` below documents. For a read that is the reader_result
16
16
  subtree spliced to the top level, or ``{"reader_result": null}`` for a
17
17
  concept refusal.
@@ -51,14 +51,13 @@ Invariants
51
51
  Wire format
52
52
  -----------
53
53
 
54
- The JSON document emitted by `emit` is the CURATED payload built by
55
- the subcommand (see the ``_curate_*`` helpers in ``cli/xmem.py``) — the
56
- fields the user asked for, with server internals (diff plans, raw
57
- extraction trees) stripped in both output modes. ``read --return-sql`` is
58
- the one exception: it keeps the SQL the read API already returns. We do NOT
59
- wrap the document in a second envelope keyed by `OutputKind` — adding a
60
- layer the consumer didn't ask for would make scripts more fragile, not
61
- less. The kind is only used internally for pretty-print dispatch.
54
+ Commands such as ``read``, ``write``, and ``instance get`` curate their payloads before emission.
55
+ Where applicable, curation omits server internals such as diff plans and raw extraction trees in both output modes.
56
+ Commands such as ``schema get`` and ``xmd generate`` use the unwrapped API document as their payload.
57
+ Trace commands use the Console's documents as their payload.
58
+ ``read --return-sql`` includes supported SQL fields and adds ``sql_unavailable`` when curation retains none of them.
59
+ JSON output emits the payload directly and adds or extends a ``warnings`` key on object payloads when the CLI records warnings.
60
+ ``OutputKind`` selects the pretty-printer internally.
62
61
  """
63
62
 
64
63
  from __future__ import annotations
@@ -100,7 +99,7 @@ class OutputKind(StrEnum):
100
99
  #: Read in ``mode=single-answer``. Curated payload: ``answer`` (falls
101
100
  #: back to the reader_result subtree when no answer string exists).
102
101
  #: ``read --return-sql`` also keeps ``sql`` / ``sqls`` / ``sql_attempts``,
103
- #: or ``sql_unavailable`` when the response included none.
102
+ #: or ``sql_unavailable`` when curation retains none of those fields.
104
103
  READ_SINGLE = "read_single"
105
104
 
106
105
  #: Read in ``mode=raw-tables``. Curated payload: the reader_result
@@ -233,10 +232,9 @@ class OutputKind(StrEnum):
233
232
  #: Output of ``xmemcli xmd convert``.
234
233
  XMD_CONVERT = "xmd_convert"
235
234
 
236
- #: Output of every ``xmemcli trace …`` command: a Console operations document —
237
- #: the Home / Inspect view payloads or one operation's detail — emitted **verbatim**
238
- #: (see ``cli/_trace.py``). JSON in both modes; the pretty renderer only indents
239
- #: and colours it, because these documents are for scripts, not eyes.
235
+ #: Every ``xmemcli trace …`` command emits a Console operations document (see ``cli/_trace.py``).
236
+ #: In JSON mode, the CLI adds or extends the document's ``warnings`` key when it records warnings.
237
+ #: The pretty renderer indents and colours the Console document.
240
238
  TRACES = "traces"
241
239
 
242
240
  #: Structured help document from ``build_help_document`` (overview, options,
@@ -113,6 +113,7 @@ _ADVISORY_BUCKETS = frozenset(
113
113
  "overwritten_field_values",
114
114
  "merged_field_conflicts",
115
115
  "merge_contradictions",
116
+ "unstored_field_values",
116
117
  "skipped_candidates",
117
118
  "unmatched_deletes",
118
119
  "unbound_records",
@@ -460,6 +461,13 @@ def _advisory_lines(bucket: str, entry: Any) -> list[str]:
460
461
  )
461
462
  kept = _change_value_text(entry["kept_value"], erased="null")
462
463
  return [f"note: {subject}: kept {kept}, discarded {dropped} (records in this write shared a primary key)"]
464
+ if bucket == "unstored_field_values" and "given" in entry:
465
+ given = _change_value_text(entry["given"], erased="null")
466
+ stored = entry.get("stored")
467
+ if stored is None:
468
+ return [f"note: {subject}: {given} was not stored: the field's type cannot hold it"]
469
+ stored_text = _change_value_text(stored, erased="null")
470
+ return [f"note: {subject}: {given} was stored as {stored_text}: the field's type cannot hold it as given"]
463
471
  if bucket == "merge_contradictions" and entry.get("kept") in ("stored", "new"):
464
472
  stored = _change_value_text(entry.get("stored"), erased="null")
465
473
  new = _change_value_text(entry.get("new"), erased="null")
@@ -559,9 +567,7 @@ def _write_trace_lines(payload: dict[str, Any], stream: IO[str]) -> None:
559
567
  def _write_sql_diagnostics(payload: dict[str, Any], stream: IO[str]) -> None:
560
568
  """``--return-sql`` output. Absent keys print nothing, so a default read stays as it was.
561
569
 
562
- A request that came back without ``sql``, ``sqls`` or ``sql_attempts`` carries ``sql_unavailable``.
563
- That sentence is the whole of this block: it does not say the server withheld the SQL, and it does
564
- not say nothing was executed. Either may be true.
570
+ For a read with ``--return-sql``, curation adds ``sql_unavailable`` if it retains none of the three SQL fields.
565
571
  """
566
572
  note = payload.get("sql_unavailable")
567
573
  if isinstance(note, str) and note.strip():
@@ -1044,7 +1050,9 @@ def _render_instance_setup(payload: Any, stream: IO[str]) -> None:
1044
1050
  stream.write(f" - {_terminal_safe(note)}\n")
1045
1051
  paste = payload.get("paste_to_agent")
1046
1052
  if isinstance(paste, str) and paste.strip():
1047
- stream.write(f"\nor paste to an agent:\n {_terminal_safe(paste.strip())}\n")
1053
+ stream.write("\nor paste to an agent:\n")
1054
+ for line in paste.strip().splitlines():
1055
+ stream.write(f" {_terminal_safe(line)}\n")
1048
1056
  install = payload.get("install_page_url")
1049
1057
  if isinstance(install, str) and install.strip():
1050
1058
  stream.write(f"\ninstall page: {_terminal_safe(install.strip())}\n")
@@ -1,4 +1,4 @@
1
- """Making externally-supplied text safe to print.
1
+ """Making externally-supplied text safe to print, and reading a Retry-After delay.
2
2
 
3
3
  Its own module because both the structured-output layer and the pretty renderers
4
4
  need it, and having either import the other created a cycle. Earlier versions
@@ -130,3 +130,16 @@ def clamp_utf16(text: str, *, limit: int) -> str:
130
130
  kept.append(ch)
131
131
  units += width
132
132
  return "".join(kept) + "\u2026"
133
+
134
+
135
+ def parse_retry_after_seconds(value: str | None) -> int | None:
136
+ """Retry-After delay-seconds as an int (at most 10 ASCII digits).
137
+
138
+ ``None`` for an HTTP-date, for more than 10 digits, and for anything else. Callers that
139
+ should cap an over-long digit value do that themselves: this helper does not call ``int``
140
+ on an unbounded digit string.
141
+ """
142
+ text = (value or "").strip()
143
+ if not (text.isascii() and text.isdecimal() and len(text) <= 10):
144
+ return None
145
+ return int(text)
@@ -100,8 +100,8 @@ creating a key never gives it that access.
100
100
  Parity
101
101
  ------
102
102
 
103
- The payloads are emitted as the Console serves them. Unlike every other command in this
104
- CLI, nothing here is curated: the Console already curates per caller — a privileged caller sees
103
+ The CLI uses the Console's documents as its payloads. In JSON mode, it adds or extends their
104
+ ``warnings`` key when it records warnings. The Console curates per caller — a privileged caller sees
105
105
  ``llm_calls``, ``step_decisions`` and raw token counts, everyone else does not; a diff is sanitised for
106
106
  everyone else — and reshaping that here would be a second, drifting copy of
107
107
  the same policy. The same holds for ``--include-llm``: it asks for model-call hits, and the Console serves them only
@@ -4,7 +4,7 @@ import platform
4
4
  import re
5
5
 
6
6
  CLI_NAME = "xmemcli"
7
- __version__ = "2.0.1"
7
+ __version__ = "2.0.2"
8
8
 
9
9
  # The header this CLI sends its identity in, restated rather than imported: the published package is
10
10
  # standalone and must not import anything outside this directory. The server's own constant is the other
@@ -32,23 +32,21 @@ Inspect views fetch, answered for this API key with the scope the Console gives
32
32
 
33
33
  The CLI exposes only the parameters the API already supports.
34
34
 
35
- Curated output
35
+ Command output
36
36
  --------------
37
37
 
38
- The CLI does NOT echo the raw API payload. Every subcommand reduces the
39
- server response to the fields the user actually asked for (see the
40
- ``_curate_*`` helpers): a read returns the answer / rows, a write returns
41
- its ``write_id``, a status poll returns ``write_id`` + ``write_status``
42
- plus whichever timing fields the server set (and the restart count once
43
- it is non-zero).
44
- Server internals — ``diff_plan``, the raw ``cleaned_objects`` tree — are
45
- never emitted, in either output mode. ``sql``, ``sqls``, and
46
- ``sql_attempts`` are emitted only when ``read --return-sql`` asked for
38
+ Commands such as ``read``, ``write``, and ``write-status`` curate the
39
+ server response for both output modes (see the ``_curate_*`` helpers).
40
+ Curation omits server internals such as ``diff_plan`` and the raw
41
+ ``cleaned_objects`` tree. See "Command output" in ``cli/README.md`` for
42
+ commands that use the server document as their payload.
43
+
44
+ ``sql``, ``sqls``, and ``sql_attempts`` are emitted only when ``read --return-sql`` asked for
47
45
  them, and only as the fields the read API already returns: the statement,
48
46
  the per-sub-query ``sqls``, and per attempt ``sql``, ``read_query``,
49
47
  ``row_count``, ``is_success``, ``attempt_outcome``, ``error_message``, and
50
- ``sqlstate``. When that flag is set and the response includes none of
51
- them, the output says so in ``sql_unavailable`` and does not guess why.
48
+ ``sqlstate``. When that flag is set and curation retains none of the
49
+ three fields, the output carries ``sql_unavailable``.
52
50
  ``pending_suggestions``
53
51
  (a count of schema-evolution proposals waiting for review) is kept on
54
52
  read responses so agents know when to run ``schema suggestions review``.
@@ -381,10 +379,11 @@ def _with_cli_warnings(output: CliOutput, args: argparse.Namespace, *, force_jso
381
379
  class ApiError(Exception):
382
380
  """An HTTP error response from the API, carrying status + raw body."""
383
381
 
384
- def __init__(self, status: int, body: str, message: str):
382
+ def __init__(self, status: int, body: str, message: str, *, retry_after: str | None = None):
385
383
  super().__init__(message)
386
384
  self.status = status
387
385
  self.body = body
386
+ self.retry_after = retry_after
388
387
 
389
388
 
390
389
  # Human-friendly copy for each ``QuotaExceededKind`` the API may surface
@@ -829,7 +828,9 @@ def _read_json_response(
829
828
  # the first 200 characters of the raw body were the envelope's punctuation, cut mid-token.
830
829
  write_request = urlsplit(req.full_url).path.rstrip("/").rsplit("/", 1)[-1] in ("write", "write_async")
831
830
  detail = _structured_error_detail(ApiError(e.code, raw, ""), write_request=write_request) or raw[:200]
832
- raise ApiError(e.code, raw, f"HTTP {e.code}: {detail}") from None
831
+ raise ApiError(
832
+ e.code, raw, f"HTTP {e.code}: {detail}", retry_after=e.headers.get("Retry-After") if e.headers else None
833
+ ) from None
833
834
  except urllib.error.URLError as e:
834
835
  raise ApiError(0, "", f"Network error: {e.reason}") from None
835
836
  except (TimeoutError, http.client.HTTPException, OSError, UnicodeEncodeError, ValueError) as e:
@@ -1185,10 +1186,9 @@ def _unwrap_items(envelope: dict[str, Any]) -> dict[str, Any]:
1185
1186
 
1186
1187
 
1187
1188
  # ── Output curation ────────────────────────────────────────────────────────
1188
- # The CLI never echoes the raw API payload. Each ``_curate_*`` helper keeps
1189
- # only the fields the user asked for; ``--verbose`` adds the extra (but still
1190
- # non-internal) context below. Internals — ``diff_plan``, the raw
1191
- # ``cleaned_objects`` tree — are dropped in BOTH output modes, verbose or not.
1189
+ # The ``_curate_*`` helpers shape responses for both output modes and omit server internals such as
1190
+ # ``diff_plan`` and the raw ``cleaned_objects`` tree.
1191
+ # ``--verbose`` adds only the extra context allowed by the command.
1192
1192
  # ``sql``, ``sqls`` and ``sql_attempts`` are kept only for ``read --return-sql``.
1193
1193
  # ``pending_suggestions`` is kept on reads (schema-evolution hint).
1194
1194
 
@@ -1363,9 +1363,7 @@ def _safe_tagged_sql(raw: Any) -> dict[str, str] | None:
1363
1363
  def _attach_requested_sql(curated: dict[str, Any], item: dict[str, Any], *, return_sql: bool) -> None:
1364
1364
  """Copy the server's SQL echo onto ``curated`` when this read asked for it.
1365
1365
 
1366
- Without the request the keys are left off, including when a server sent them anyway. With the
1367
- request, a response that carries no statement, no ``sqls`` and no attempt gets ``sql_unavailable``:
1368
- the response did not include SQL, and this does not say whether the server withheld it or ran nothing.
1366
+ With the flag enabled, add ``sql_unavailable`` if curation retains none of ``sql``, ``sqls`` or ``sql_attempts``.
1369
1367
  """
1370
1368
  if not return_sql:
1371
1369
  return
@@ -3996,8 +3994,11 @@ def _build_parser() -> argparse.ArgumentParser:
3996
3994
  "--verbose",
3997
3995
  action="store_true",
3998
3996
  help=(
3999
- "Add trace_id and console_url when the server sends them. "
4000
- "Never shows diff plans or other server internals; SQL is shown only by `read --return-sql`."
3997
+ "Add command-specific context such as trace_id and console_url when available. "
3998
+ "Added context appears in JSON output. "
3999
+ "`org list keys` includes every metadata field the API returns for each key (never the plaintext key). "
4000
+ "Terminal output shows the prefix, name, and active status. "
4001
+ "Use `read --return-sql` for read SQL diagnostics."
4001
4002
  ),
4002
4003
  )
4003
4004
 
@@ -4147,7 +4148,7 @@ def _build_parser() -> argparse.ArgumentParser:
4147
4148
  help=(
4148
4149
  "Ask the API for the executed SQL (return_sql). Kept in JSON and pretty output only with this "
4149
4150
  "flag: sql, sqls, and the safe sql_attempts fields the server already returns. Without the flag "
4150
- "those fields are omitted. When the response includes none, the output says so and does not guess why."
4151
+ "those fields are omitted. When curation keeps none of those fields, output includes sql_unavailable."
4151
4152
  ),
4152
4153
  )
4153
4154
  pr.set_defaults(func=cmd_read)
@@ -4614,7 +4615,7 @@ def _build_parser() -> argparse.ArgumentParser:
4614
4615
 
4615
4616
  ptr = sub.add_parser(
4616
4617
  "trace",
4617
- help="Operation traces as the Console serves them (JSON, verbatim): ls / ls --search / get / calls / call",
4618
+ help="Console operation traces in JSON. JSON mode includes CLI warnings when recorded.",
4618
4619
  add_help=False,
4619
4620
  )
4620
4621
  ptr_sub = ptr.add_subparsers(dest="trace_command", required=True, parser_class=_help.XmemCliArgumentParser)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes