@remits/remits-cli 0.1.128 → 0.1.130

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remits/remits-cli",
3
- "version": "0.1.128",
3
+ "version": "0.1.130",
4
4
  "description": "Local CLI for auth, component sync, and live test execution against Remits",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -136,8 +136,13 @@ reference named after it.
136
136
  returns both lanes mixed; filter it yourself. (`account-targeting.md`)
137
137
  - **"Tool call succeeded" means DISPATCHED, not that the tool did what you asked.** A tool that runs and
138
138
  refuses returns HTTP 200 with its own `success: false`. For any mutating call, read `result.success`
139
- from `./.remits-cli/tool-responses/<callId>.json` before reporting the work as done.
139
+ from `./.remits-cli/actors/<local-agent>/tool-responses/<callId>.json` (or the legacy flat fallback
140
+ if `doctor local-state` says the response is there) before reporting the work as done.
140
141
  (`tool-reference.md`)
142
+ - **Workspace and local actor are different.** `workspace` is the server-side staging lane namespace;
143
+ `local actor` is the repo-local filesystem namespace for session logs, tool responses, and verification
144
+ mirrors. Use `REMITS_AGENT_ID=<name>` or `--local-agent <name>` when agents share a checkout, and run
145
+ `remits-cli doctor local-state` when inheriting one. (`cli-state.md`, `component-resolution.md`)
141
146
  - **Writing the code is not finishing the job.** A change is complete when it is verified — a Test
142
147
  component (preferred, because it becomes regression protection) or a browser flow through
143
148
  `remits-cli token`. "Just do it" and "that's fine, commit it" are not evidence. If you genuinely
@@ -183,6 +188,7 @@ reference named after it.
183
188
  ```bash
184
189
  remits-cli whoami # account, user, branch, data mode, host for the NEXT tool call
185
190
  remits-cli workspace use --auto # your own staging lane, named after this checkout
191
+ remits-cli doctor local-state # active local actor, state dir, tracked .remits-cli, legacy state
186
192
  remits-cli components status # trunk or variant checkout, staging lane, workset vs overlay, who else is staging
187
193
  remits-cli tools # which tools this account actually has (tools are per-account)
188
194
  ```
@@ -197,8 +203,12 @@ non-default host).
197
203
  **Files that are decision inputs — read the one that governs the decision, do not rely on memory:**
198
204
  `~/.remits-cli/account-repos.json` (every local repo, plus the reserved `platform` entry for the core
199
205
  platform clone), `~/.remits-cli/sessions.json` (auth state and lanes), `~/.remits-cli/agents.json`
200
- (agents registered here), `./.remits-cli/tool-responses/<callId>.json` (the full tool payload), and the
201
- repo's `account-info.json`. `cli-state.md` maps every remaining question to its file.
206
+ (agents registered here), `./.remits-cli/actors/<local-agent>/tool-responses/<callId>.json` (the full
207
+ tool payload), and the repo's `account-info.json`. `cli-state.md` maps every remaining question to its
208
+ file, including legacy flat `.remits-cli/` fallbacks.
209
+ Repo-local session JSONL is intentionally a bounded audit log: request payloads and ordinary response
210
+ bodies are summarized with keys, sizes, hashes, and redaction markers. Open actor-scoped tool response
211
+ files when you need the full tool result.
202
212
 
203
213
  ## Efficiency rules
204
214
 
@@ -209,8 +219,8 @@ Keep support and development sessions lean:
209
219
  or for confirming what the live DB has stored after you already understand the files. For a ticket
210
220
  with `implementationAccountId`, resolve that account's indexed repo first, pull the appropriate
211
221
  branch when the checkout is clean, and inspect `account-info.json` + `components/` there.
212
- - Do not read entire `.remits-cli/sessions/*.jsonl` or large tool response files unless you first narrow
213
- to the relevant request, endpoint, tool, or ticket.
222
+ - Do not read entire `.remits-cli/actors/<local-agent>/sessions/*.jsonl` (or legacy flat session logs) or
223
+ large tool response files unless you first narrow to the relevant request, endpoint, tool, or ticket.
214
224
  - Prefer targeted Firestore queries: use `documentId`, tight `filters`, narrow `fields`, and low `limit`
215
225
  values instead of broad collection scans.
216
226
  - Do not call `mcp_account_view` repeatedly once you already have the needed account/component context.
@@ -363,7 +363,9 @@ The analogous hazard is different, and you must still respect it:
363
363
  explicitly.
364
364
  - **Use `components sync --dry-run` before risky variant syncs.** It reports `overridden`, `added`,
365
365
  `removed`, `unchanged`, `skipped`, and `errors` without writing rows, caching the sync SHA, or clearing
366
- staging. Existing overlay ids appear as `variantId`; an `unchanged` row with `pruned:true` means the
366
+ staging. `overridden`/`added` are the branch's WHOLE overlay set; read the `Overlay changes:` line (or
367
+ `writes` in `--summary`) for what this sync actually changes, and `storedCurrent: true` on an entry for
368
+ an overlay that is already stored as-is. Existing overlay ids appear as `variantId`; an `unchanged` row with `pruned:true` means the
367
369
  branch has converged back to trunk and the overlay would be removed. It is rejected on trunk, and
368
370
  `components commit --dry-run` is unsupported because `commit` performs compile validation and local git
369
371
  writes before syncing.
@@ -36,14 +36,18 @@ These files are decision inputs. Read them when the related decision depends on
36
36
  - Read when diagnosing service lifecycle, websocket, agent registration, or ticket-routing failures.
37
37
  - `~/.remits-cli/sessions.json`
38
38
  - Read when authentication state, active accounts, base URLs, websocket topics, or per-account data mode matters.
39
- - `./.remits-cli/current-session.txt`
40
- - Read before opening repo-local session logs so you know which session file is current.
41
- - `./.remits-cli/sessions/<current-session>.jsonl`
42
- - Read when the question is about what HTTP calls the repo recently made through remits-cli, which payload was sent, or what response/error came back.
43
- - `./.remits-cli/tool-responses/<callId>.json`
39
+ - `./.remits-cli/workspace`
40
+ - The staging lane selector for this checkout. It is not the local filesystem session namespace.
41
+ - `./.remits-cli/actors/<local-agent>/current-session.txt`
42
+ - Read before opening repo-local session logs so you know which actor-scoped session file is current.
43
+ - `./.remits-cli/actors/<local-agent>/sessions/<current-session>.jsonl`
44
+ - Read when the question is about what HTTP calls this local actor recently made through remits-cli. Request entries and ordinary response bodies contain bounded summaries/hashes by default, not raw nested payloads.
45
+ - `./.remits-cli/actors/<local-agent>/tool-responses/<callId>.json`
44
46
  - Read when `remits-cli tool` says the full payload was stored externally.
45
- - `./.remits-cli/tools/tools.json`
47
+ - `./.remits-cli/shared/tools/tools.json`
46
48
  - Read when the question is about available tool names, cached schemas, or why a tool invocation shape may be invalid.
49
+ - `./.remits-cli/actors/<local-agent>/verification/`
50
+ - Local mirror and active pointers for verification envelopes for this actor.
47
51
  - `account-info.json`
48
52
  - Read in the target repo before making component changes or assuming account ownership.
49
53
  - `account-configurations.json`
@@ -67,15 +71,28 @@ Think about remits-cli as two cooperating layers:
67
71
  2. **Per-repo state** in `./.remits-cli/`
68
72
  - This is the request/response and cache layer for one specific working tree.
69
73
  - It answers questions like:
70
- - which repo-local session log is current
74
+ - which local actor/session log is current
71
75
  - which `/cli/*` calls were made from this repo
72
76
  - where a large tool response was written
73
77
  - which tool schemas were most recently cached here
74
78
 
75
- Tool response files under `./.remits-cli/tool-responses/` are the full CLI results. The CLI may print a
76
- size/hash hint for large files so you can inspect them selectively with `jq`, `rg`, or byte-range reads,
77
- but it does not truncate the local JSON file. Do not confuse this with the in-platform OpenRouter client,
78
- which can offload large tool results inside the model conversation and inject a read-back tool for the AI.
79
+ Per-repo state has two independent namespaces:
80
+
81
+ - **Workspace** (`--workspace`, `REMITS_WORKSPACE`, `.remits-cli/workspace`) chooses the server-side
82
+ Redis staging lane. It changes what staged entries a run resolves.
83
+ - **Local actor** (`--local-agent`, `REMITS_AGENT_ID`, generated fallback) chooses the local filesystem
84
+ namespace under `.remits-cli/actors/<local-agent>/`. It changes where session logs, tool responses,
85
+ verification mirrors, and diagnostics are written.
86
+
87
+ Run `remits-cli doctor local-state` to print the active actor, state directory, workspace source,
88
+ foreign actors, git-tracked `.remits-cli` files, legacy flat state, and large/suspicious logs.
89
+
90
+ Tool response files under `./.remits-cli/actors/<local-agent>/tool-responses/` are the full CLI results.
91
+ The CLI may print a size/hash hint for large files so you can inspect them selectively with `jq`, `rg`, or
92
+ byte-range reads, but it does not truncate the local JSON file. Legacy flat
93
+ `./.remits-cli/tool-responses/` files remain readable as fallback; `doctor local-state` labels them as
94
+ legacy state. Do not confuse this with the in-platform OpenRouter client, which can offload large tool
95
+ results inside the model conversation and inject a read-back tool for the AI.
79
96
 
80
97
  When a user asks an indirect question, map it to the right layer first:
81
98
 
@@ -143,21 +160,33 @@ If the index file doesn't exist yet, run any `remits-cli` command from an accoun
143
160
  - This is usually the best forensic file for "what happened?" questions.
144
161
 
145
162
  **Per-repo** (`./.remits-cli/`):
146
- - `tools/tools.json`
163
+ - `workspace`
164
+ - Staging lane selector for this checkout. Precedence is `--workspace` > `REMITS_WORKSPACE` >
165
+ `.remits-cli/workspace` > shared default lane. A workspace does not choose local log directories.
166
+ - `shared/tools/tools.json`
147
167
  - Cached tool definitions for this repo context.
148
168
  - Read this when tool availability or input shape is unclear.
149
- - `sessions/<name>.jsonl`
150
- - Repo-local HTTP request/response log for `/cli/*` calls.
151
- - Tokens are redacted and large content fields are summarized.
169
+ - `actors/<local-agent>/sessions/<name>.jsonl`
170
+ - Actor-scoped HTTP request/response log for `/cli/*` calls.
171
+ - Tokens are redacted. Request payloads are summarized with keys, sizes, hashes, and redaction markers
172
+ by default; raw nested tool input is not logged unless `REMITS_CLI_UNSAFE_LOG_PAYLOADS=1` was set.
173
+ - Ordinary response bodies are also summarized so guide syncs, verification packets, and other large
174
+ responses do not bloat the session log. Full `remits-cli tool` results are stored in
175
+ `actors/<local-agent>/tool-responses/<callId>.json`.
152
176
  - This is the first file to inspect when the question is "what exactly did remits-cli send or receive from this repo?"
153
- - `tool-responses/<callId>.json`
177
+ - `actors/<local-agent>/tool-responses/<callId>.json`
154
178
  - Full payload for `remits-cli tool` responses that were too large for the session log.
155
179
  - Prefer this over terminal summaries when investigating tool behavior.
156
- - `current-session.txt`
180
+ - `actors/<local-agent>/current-session.txt`
157
181
  - Pointer to the active repo-local session log name.
158
- - Always read this before opening `sessions/<name>.jsonl`.
182
+ - `actors/<local-agent>/verification/`
183
+ - Local verification envelope mirror and active context pointers for this actor.
184
+ - Legacy fallbacks: `sessions/`, `tool-responses/`, `verification/`, `tools/`, and `current-session.txt`
185
+ - New writes do not use these flat paths. Existing files remain readable for compatibility and are
186
+ reported by `remits-cli doctor local-state`.
159
187
 
160
188
  Reading rules:
161
- - Read `current-session.txt` before opening a session log by name.
162
- - When a tool call says the response was stored externally, open `tool-responses/<callId>.json` instead of inferring from the terminal summary.
189
+ - Read `actors/<local-agent>/current-session.txt` before opening a session log by name.
190
+ - When a tool call says the response was stored externally, open `actors/<local-agent>/tool-responses/<callId>.json` instead of inferring from the terminal summary.
191
+ - Use `remits-cli doctor local-state` first when inheriting a checkout or when more than one actor directory exists.
163
192
  - If a question spans both global and repo-local behavior, inspect both layers and explain which facts came from which layer.
@@ -85,10 +85,13 @@ deterministically:
85
85
  remits-cli tool --name "mcp_run_action" --input '{"accountId":49,"actionId":200,"executionMode":"async","actionRunId":"my-stable-run-id","actionInput":{"sourceDocumentId":"..."}}' --data-mode prod
86
86
  ```
87
87
 
88
- Every tool response is saved in full to `./.remits-cli/tool-responses/<callId>.json`. Large responses may
89
- print an early size/hash line and a selective-read hint before any preview text, but the saved CLI file is
90
- not truncated or offloaded. That is separate from the platform's OpenRouter model loop, where the AI
91
- client may offload large tool results before feeding context back to the model.
88
+ Every tool response is saved in full to
89
+ `./.remits-cli/actors/<local-agent>/tool-responses/<callId>.json`. Large responses may print an early
90
+ size/hash line and a selective-read hint before any preview text, but the saved CLI file is not truncated
91
+ or offloaded. Legacy flat `./.remits-cli/tool-responses/<callId>.json` files remain readable as fallback;
92
+ `remits-cli doctor local-state` shows which state belongs to the active actor. This is separate from the
93
+ platform's OpenRouter model loop, where the AI client may offload large tool results before feeding
94
+ context back to the model.
92
95
 
93
96
  ### Hierarchy-scoped tool reads
94
97
 
@@ -192,6 +195,7 @@ remits-cli start [--foreground true] [--port 8787]
192
195
  remits-cli stop
193
196
  remits-cli status [--base-url URL] [--account-id ID] [--data-mode test|prod] [--json]
194
197
  remits-cli whoami [--base-url URL] [--account-id ID] [--data-mode test|prod] [--json]
198
+ remits-cli doctor local-state [--json] # active local actor, workspace source, legacy state, tracked .remits-cli files
195
199
  remits-cli listen [stop|status] [--foreground true] # compatibility alias
196
200
  remits-cli data-mode [set test|prod]
197
201
  remits-cli components stage [--workset | --changed-only] [--branch <name>] [--workspace <name>] [--empty-workset clear] [--data-mode test|prod] [--json|--verbose] # default = FULL SNAPSHOT of the repo; --workset = only what git says changed, lane reconciled to it
@@ -210,7 +214,23 @@ remits-cli components branch <name> --subscribe <accountId> [--parent-account <i
210
214
  remits-cli components branch <name> --unsubscribe <accountId> # return that account to trunk
211
215
  remits-cli components branch <name> --retire [--force] # delete the branch's overlays
212
216
  remits-cli test run --test <id|name> [--branch <stagingScope>] [--names "a|b"] [--watch true|false] [--data-mode test|prod] [--as-account <ID>] [--variant-branch <name|none>] [--json]
213
- remits-cli test status --task-id <taskId> [--branch <stagingScope>] [--data-mode test|prod] [--json]
217
+ remits-cli test status --task-id <taskId> [--branch <stagingScope>] [--data-mode test|prod] [--json] # falls back to the DURABLE run record once the live status expires
218
+ remits-cli test runs [--test <id|name>] [--limit 20] [--compare] [--as-account <ID>] [--json] # durable run history: pass counts, live AI cost, lane, content hash
219
+ remits-cli test compare --base <taskId> --head <taskId> [--json] # per-case improved / regressed / changed, cost and world deltas
220
+ remits-cli corpus import --manifest corpus-manifest.json [--corpus <name>] [--as-account <ID>] [--data-mode test|prod --confirm-prod] [--json] # seed an evaluation corpus: cases + immutable artifacts; idempotent by caseKey
221
+ remits-cli corpus cases --corpus <name> [--split S] [--tag T|--tags T,U] [--key K|--keys K,L] [--include-values] [--include-retired] [--limit N] [--json]
222
+ remits-cli corpus runs --corpus <name> [--limit 20] [--json] # runs that measured the corpus: outcomes, AI mode (live|MOCKED|none), cost, world
223
+ remits-cli corpus results --corpus <name> [--case <caseKey>] [--task-id <taskId>] [--json]
224
+ remits-cli corpus compare --corpus <name> --base <taskId> --head <taskId> [--json] # per-case direction, metric deltas, expectedChanged
225
+ remits-cli corpus consistency --corpus <name> --case <caseKey> [--json] # did the case produce the same metrics every run?
226
+ remits-cli corpus retire --corpus <name> --case <caseKey> [--case ...] [--restore] [--json] # drop a case from future runs; past measurements stay readable
227
+ ```
228
+
229
+ A run labelled **`AI MOCKED`** replayed every AI turn from `aiMock`: it produces the same outcomes, scores and
230
+ metrics a measured run would, so read that label before treating green as evidence. `compare` warns when base and
231
+ head used different AI modes; `consistency` warns before calling a case unstable when its runs mixed modes.
232
+
233
+ ```bash
214
234
  remits-cli token [--path <embeddablePathOrId>] [--data-mode test|prod] [--as-account <ID>] [--variant-branch <name|none>]
215
235
  remits-cli token inspect --token <token|tokenKey|URL> # inspect token metadata, safety/dataMode evidence, and full context
216
236
  remits-cli tools [--branch <name>] [--data-mode test|prod] [--variant-branch <name|none>]
@@ -254,10 +274,12 @@ remits-cli components status
254
274
  remits-cli verify start --summary "Hosted upload updates an existing profile" --manifest acceptance.json
255
275
  ```
256
276
 
257
- An active envelope is stored per command world: `baseUrl + accountId + branch + workspace + dataMode`.
258
- The legacy `./.remits-cli/verification/active` pointer is still understood for compatibility, but normal
259
- auto-attachment uses `./.remits-cli/verification/active-contexts.json`, so a localhost envelope does not
260
- silently capture evidence from a production command. Stage/test/token/tool/sync commands attach evidence
277
+ An active envelope is stored per command world (`baseUrl + accountId + branch + workspace + dataMode`)
278
+ inside the active local actor's mirror:
279
+ `./.remits-cli/actors/<local-agent>/verification/active-contexts.json`. The legacy flat
280
+ `./.remits-cli/verification/active` pointer is still understood for compatibility, but normal
281
+ auto-attachment uses the actor-scoped context map, so one actor's localhost envelope does not silently
282
+ capture another actor's production command. Stage/test/token/tool/sync commands attach evidence
261
283
  automatically while an envelope is active for that context. The explicit wrappers do the same thing and
262
284
  make the intent visible in terminal history:
263
285
 
@@ -341,8 +363,9 @@ For tests specifically:
341
363
  - If `--data-mode` is omitted, `remits-cli test run` uses `test` and sends `dataModeSource:"cliDefault"`.
342
364
  An explicit `--data-mode prod` sends `dataModeSource:"explicitFlag"` so production test runs are
343
365
  auditable from the server status payload even when the original terminal history is gone.
344
- - `--names` is `|`-delimited (a comma still splits a single value) and may be repeated; an unmatched
345
- selector fails the run instead of reporting zero cases as success.
366
+ - `--names` is `|`-delimited and may be repeated. A selector containing commas matches a case with that
367
+ exact name first, else its comma-separated parts; an unmatched selector fails the run instead of
368
+ reporting zero cases as success.
346
369
  - `--as-account <ID>` runs AS a descendant subscriber so its edge selects the component branch
347
370
  (*"what does customer X get?"*); `--variant-branch <name>` probes a branch from any checkout
348
371
  (*"what does branch Y look like?"*), and `--variant-branch none` forces production/subscription semantics.
@@ -192,7 +192,8 @@ file is catastrophic.
192
192
  If sync reports unexpected `deleted` / `created` / `renamed`, uniqueness errors, or missing components — or you
193
193
  discover id drift — **stop. Do not re-run sync, do not `components commit`, and do not create replacement
194
194
  components to "make ids line up" or replace a deleted component.** Those actions compound the corruption.
195
- Preserve the repo-local session log and tool responses, and reconcile source-of-truth first.
195
+ Run `remits-cli doctor local-state`, preserve the active actor's repo-local session log and tool
196
+ responses, and reconcile source-of-truth first.
196
197
 
197
198
  **Safe recovery pattern (repo ↔ DB drift):**
198
199
  1. Establish DB truth: `mcp_account_view` for the full live inventory; `mcp_component_view` to confirm and read
@@ -202,6 +202,13 @@ account, and the run still resolves whatever committed variant branch the accoun
202
202
  does **not** have the side effects of inventing a throwaway git branch per agent (which would make a
203
203
  commit write `ComponentVariant` overlays for a branch nobody subscribes to).
204
204
 
205
+ Workspace is not the repo-local filesystem identity. The CLI also has a **local actor** namespace
206
+ (`REMITS_AGENT_ID` or `--local-agent`) for `.remits-cli/actors/<local-agent>/` session logs, tool
207
+ responses, verification mirrors, and diagnostics. Two agents that share one checkout should set distinct
208
+ local actors even if they intentionally use the same or different staging workspaces. Run
209
+ `remits-cli doctor local-state` to see the active actor, state directory, legacy flat state, and other
210
+ actor directories.
211
+
205
212
  - `.remits-cli/workspace` is per-checkout and gitignored, so each clone keeps its own lane.
206
213
  - Precedence: `--workspace NAME` > `REMITS_WORKSPACE` > `.remits-cli/workspace` > shared default lane.
207
214
  - `--no-workspace` targets the shared lane for one command without clearing the file.
@@ -77,8 +77,9 @@ remits-cli verify start --summary "Hosted upload updates an existing profile" --
77
77
  ```
78
78
 
79
79
  The envelope records the account, host, data lane, branch, workspace, git heads, staging lane, and the
80
- acceptance manifest. It is mirrored locally under `.remits-cli/verification/<envelopeId>/` and becomes
81
- active for this checkout. While active, `components stage`, `components status`, `test run`, `token`,
80
+ acceptance manifest. It is mirrored locally under
81
+ `.remits-cli/actors/<local-agent>/verification/<envelopeId>/` and becomes active for this local actor and
82
+ command world. While active, `components stage`, `components status`, `test run`, `token`,
82
83
  `token inspect`, `tool`, and `components sync` attach evidence packets automatically; pass
83
84
  `--verify-envelope <id>` to name one explicitly or `--no-verify-envelope` when a command should not be
84
85
  attached.
@@ -345,10 +346,26 @@ remits-cli test run --test "Invoice Tests" --names "specific test case"
345
346
  remits-cli test status --task-id <TASK_ID>
346
347
  ```
347
348
 
348
- Tests run on the platform against your staged snapshot. They stream results in real-time. If they fail,
349
- read the printed pivots first: failed cases include timing, trace ids, bounded `report(...)`
350
- diagnostics, live HTTP signals, and resolved component provenance when available. Fix the code,
351
- re-stage, and re-run only after those pivots explain the failure.
349
+ Tests run on the platform against your staged snapshot. They stream results in real-time. **Read the
350
+ `World:` block printed before the run** — host, execution account, data lane, component world, staging lane
351
+ id + content hash, platform sync vs local HEAD. If it is not the world you meant, stop: the result will be
352
+ about a different world.
353
+
354
+ If cases fail, read the printed summary and pivots first: each case has an `outcome`
355
+ (`failed`, `error`, `budget_exceeded`, `provider_unavailable`, …) with its reason, timing, trace id, AI usage
356
+ (live vs mocked, cost), bounded `report(...)` diagnostics, live HTTP signals, and resolved component
357
+ provenance. Fix the code, re-stage, and re-run only after those pivots explain the failure.
358
+
359
+ Every finished run is recorded durably: `remits-cli test status --task-id <id>` answers after the live status
360
+ expires, `remits-cli test runs --test <name> --compare` compares the latest run with the previous one, and
361
+ `remits-cli test compare --base <id> --head <id>` compares any two. For evaluation suites (a `corpus(name)` of
362
+ cases seeded with `remits-cli corpus import`, one case per corpus case, intentional live AI inside
363
+ `withAiBudget(...)`, measurements compared with `remits-cli corpus compare` / `corpus consistency`), read
364
+ `guides/test-components.md` → *Evaluation Suites And Corpora*.
365
+ Use `remits-cli corpus cases --corpus <name> --split dev --tag reviewed --key case-001` to inspect subsets;
366
+ `split`, repeated/comma-separated tags, keys and `limit` are applied on the platform before rows are returned.
367
+ For per-case AI totals, start and await the workflow inside that `test(...)` case; setup and late async calls are
368
+ only visible in the persisted run-level AI history.
352
369
 
353
370
  Important test-runner constraints:
354
371
  - `remits-cli test run` now defaults to `test` dataMode unless you explicitly pass `--data-mode prod`.
@@ -553,6 +570,8 @@ The CLI now returns the post-sync branch SHA from the platform and verifies that
553
570
  subcommand help variants such as `remits-cli components commit --help` to discover behavior. Consult the `remits-cli` skill and its references,
554
571
  the CLI source, or `remits-cli components` documentation instead. If an exploratory or commit command behaves
555
572
  unexpectedly, stop and inspect the repo-local session log before running any mutating follow-up command.
573
+ Use `remits-cli doctor local-state` first if you did not create the checkout; it names the active local
574
+ actor and points at the actor-scoped session log/tool-response directories.
556
575
 
557
576
  **Git is required for durable sync.** The platform syncs by pulling from the git remote (`GitHubClient.syncFromRepository`). If `git push` fails, the server has nothing new to sync. You can still **stage** and **test** without git — only durable sync requires it.
558
577
 
@@ -202,7 +202,9 @@ remits-cli verify start --ticket 22454 --summary "Fix hosted upload recovery"
202
202
  ```
203
203
 
204
204
  Keep it active while you stage, run Tests, mint browser tokens, call tools, and sync. Those commands
205
- attach evidence packets to the platform envelope and mirror them locally under `.remits-cli/verification/`.
205
+ attach evidence packets to the platform envelope and mirror them locally under
206
+ `.remits-cli/actors/<local-agent>/verification/`. Use `remits-cli doctor local-state` when handing off a
207
+ checkout so the next agent can see which local actor owns the mirror.
206
208
  Before completing or handing off the ticket, run:
207
209
 
208
210
  ```bash
@@ -47,7 +47,9 @@
47
47
  remits-cli tool --name "mcp_firestore_search" --input '{"accountId": 37, "collection": "invoices"}' --data-mode prod
48
48
  ```
49
49
 
50
- Response saved to `./.remits-cli/tool-responses/<callId>.json`. Read the file to see results.
50
+ Response saved to `./.remits-cli/actors/<local-agent>/tool-responses/<callId>.json`. Read the file to
51
+ see results. Legacy flat `./.remits-cli/tool-responses/<callId>.json` files remain readable as fallback;
52
+ `remits-cli doctor local-state` shows both locations.
51
53
 
52
54
  **"Tool call succeeded" means DISPATCHED, not that the tool did what you asked.** A tool that runs
53
55
  and refuses — an unmet precondition, a rejected enum value, a failed validation — returns HTTP 200
@@ -373,7 +375,9 @@ Front-stage references:
373
375
  | Parameter | Required | Description |
374
376
  |-----------|----------|-------------|
375
377
  | `action` | no | `search` (default), `detail`, or session control `pause`/`unpause`/`interrupt` |
376
- | `dataMode` | no | Explicit execution lane: `prod` or `test`. Response echoes `dataMode`, but persisted groupings do not have durable per-row lane flags. |
378
+ | `dataMode` | no | Explicit execution lane: `prod` or `test`. Response echoes the lane THIS CALL ran in. A grouping's own lane is on each row as `lanes` (from the per-turn lane the platform records). |
379
+ | `testTaskId` | no | Search mode: only groupings caused by this Test suite run (`taskId` from `remits-cli test run`) |
380
+ | `lane` | no | Search mode: `test` or `prod` — the lane the grouping's AI turns ran in |
377
381
  | `search` | no | Broad text match against session IDs and grouping IDs |
378
382
  | `sessionId` | no | Session ID filter in search mode, or grouping/session key in detail mode |
379
383
  | `groupingId` | no | Grouping ID filter in search mode, or grouping key in detail mode |
@@ -393,6 +397,13 @@ Front-stage references:
393
397
  | `toolCallIds` | no | Detail mode: return the FULL exact input/result from `ai_tool_call` for these tool-call ids (what the tool PRODUCED — see the lens caveat) |
394
398
  | `consolidateContext` | no | When `true`, collapses repeated XML-like prompt context into a consolidated section |
395
399
 
400
+ Spend: each search row carries `liveRequestCount`, `mockedRequestCount`, `lanes`, `testTaskId` and
401
+ `estimatedCost`/`estimatedCostUsd` = **live spend only** (a mocked turn is never priced, even when it replays a
402
+ recording with a cost). `pageTotals` sums the page. Turns recorded before the platform stored the mock flag are
403
+ `unclassified` — unverified, not spend. A custom `range` with an unparseable `from`/`to`, or an unknown `range`,
404
+ is refused rather than silently widened; the applied bounds are echoed as `filters.rangeStart`/`rangeEnd`.
405
+ To audit one Test run: `{"action":"search","testTaskId":"<taskId>","pageSize":100}`.
406
+
396
407
  Audit flow: `action:"search"` to find the grouping → `action:"detail"` + `summaryOnly:true` for the MAP → re-call detail with `recordIds`/`toolCallIds` + `parts` to open exactly what you need. Prefer the map → open flow over a full-detail dump. Remember the two-lens rule: `tool_calls`/`toolCallIds` is what the tool PRODUCED; `conversation_messages`/`transcript` is what the AI CONSUMED (after any `_offload`/`_hideResult`/`_message`/supersede/evict transform).
397
408
 
398
409
  ### `mcp_run_action`
@@ -448,6 +459,16 @@ Returned fields on the async/event start: `actionRunId`, `status:"running"`, `ex
448
459
  `threadGroupingId`, `componentSource`, `componentSignature`, and (event mode) `eventId`/`eventStatus`. The
449
460
  `status` poll adds `result` on completion, or `message`/`error` on failure.
450
461
 
462
+ Every response (describe, direct, async start, and failures) also states the world the run resolved:
463
+ `executionAccountId`, `componentOwnerAccountId`, `componentSource` (`staged` / `variant` / `db`),
464
+ `componentSignature`, `componentBranch`, `stagingLane`, `dataMode`, `workspace`, and `traceId`. Direct runs add
465
+ `aiUsage` (live vs mocked calls and live cost for the run's trace).
466
+
467
+ **A staged-only `new_` Action runs by name.** Its `actionId` is `null` and the response says why
468
+ (`componentIdNote`) — that is valid, not "missing". When a name does not resolve, the error lists the accounts
469
+ searched, the staging lane (branch + workspace) and the staged Actions it holds, the component branch, and the
470
+ closest existing names; check that the lane named there is the one you staged into.
471
+
451
472
  > **In event mode the EVENT is the source of truth, not the promise.** `status` is driven by the Event's
452
473
  > own state; the value the dispatch call returned is reported separately as `dispatchResult` and is **not**
453
474
  > the Action's result. Read `eventStatus` for the outcome.
@@ -22,13 +22,13 @@
22
22
  | Stage shows 0 updated | No changes since last stage (hash dedup) |
23
23
  | Test runs old code after edit | You forgot to stage, or you are looking at DB while a staged entry is still active. Run `remits-cli components status`; then `remits-cli components stage` to update staged code or `remits-cli components clear` to fall back to DB. |
24
24
  | "Git credentials" or `git push` error | Git auth is required for commit (server pulls from git remote). Fix git authentication (SSH keys or HTTPS credentials) before retrying. Staging and testing still work without git. |
25
- | Need to learn command behavior | Read the `remits-cli` skill and its references, repo docs, or CLI source. Do not run unsupported mutating subcommand variants such as `remits-cli components commit --help`; if a command unexpectedly mutates or commits, stop and inspect the repo-local session log before doing anything else. |
25
+ | Need to learn command behavior | Read the `remits-cli` skill and its references, repo docs, or CLI source. Do not run unsupported mutating subcommand variants such as `remits-cli components commit --help`; if a command unexpectedly mutates or commits, run `remits-cli doctor local-state` and inspect the active actor's repo-local session log before doing anything else. |
26
26
  | Sync response reports unexpected deletes, creates, renames, uniqueness errors, or component ID drift | Stop immediately. Do not rerun sync, do not create replacement components to paper over the mismatch, and do not promote more changes. Preserve session logs/tool responses, compare `account-info.json`, local filenames, live inventory, and git history, then prepare a repair/escalation summary. |
27
27
  | 500 / `Internal Server Error` from Remits | Stop normal task work. Capture the exact command, error, and response artifact, then escalate to a Remits system admin. Do not invent a workaround. |
28
- | Tool parameters rejected | Tool schemas may be cached. Run `remits-cli tools` to refresh `.remits-cli/tools/tools.json` with latest schemas. |
29
- | Tool response missing | Check `./.remits-cli/tool-responses/` |
28
+ | Tool parameters rejected | Tool schemas may be cached. Run `remits-cli tools` to refresh `.remits-cli/shared/tools/tools.json` with latest schemas. |
29
+ | Tool response missing | Run `remits-cli doctor local-state`, then check `./.remits-cli/actors/<local-agent>/tool-responses/` and any legacy flat `./.remits-cli/tool-responses/` fallback it reports. |
30
30
  | Long-running tool times out | For `mcp_run_action`/`mcp_run_agent`, use the tool's own `executionMode:"async"` and poll with a `controlAction:"status"` call (see `command-reference.md` → *Tool Execution Lifecycle*). For other long tools without their own async, use `remits-cli tool --async true` and poll `remits-cli tool status --call-id <callId>`. `--timeout-ms` only adjusts the per-request HTTP timeout; it is not a substitute for async. |
31
- | Need to continue tracking a long Action or Agent after terminal disconnect | Read `./.remits-cli/tool-responses/<callId>.json` for the returned `actionRunId`/`agentRunId`/`sessionId`/`threadGroupingId`. Re-poll the run with a `controlAction:"status"` call carrying that `actionRunId`/`agentRunId`, or inspect the agent session via `mcp_ai_session_search` with the `sessionId`. |
31
+ | Need to continue tracking a long Action or Agent after terminal disconnect | Read `./.remits-cli/actors/<local-agent>/tool-responses/<callId>.json` for the returned `actionRunId`/`agentRunId`/`sessionId`/`threadGroupingId` (or the legacy flat fallback if `doctor local-state` reports it there). Re-poll the run with a `controlAction:"status"` call carrying that `actionRunId`/`agentRunId`, or inspect the agent session via `mcp_ai_session_search` with the `sessionId`. |
32
32
  | Staged change has no effect in a live (non-CLI) run | Staged overrides resolve only under a CLI TestMode (`branchName`+`cliUserId`). Live webhooks and other non-CLI runtime paths still use the DB (trunk, or the account's subscribed variant). `commit` to make it durable. See `component-resolution.md`. |
33
33
  | Need to know an account's shape (role, type, parents, namespace, branch, host/login routes) | Read `resolution` — from the repo's `account-info.json`, or `mcp_account_user_admin` `action:'account'` (cheap), or `mcp_account_view` (full inventory): `role`/`summary`, `type`, `resolvedDatabaseName`, `domainName`/`resolvedDomainName`, `authPath`/`targetPath`, `relationships`, `componentBranch`, plus top-level `componentBranches`. Never infer structure from the account's name. |
34
34
  | Need the account tree below an account, or its users | In a local repo, read `account-hierarchy.json` for the generated tree. For live data, use `mcp_account_user_admin` (`action:'hierarchy'` with a `depth`, or `action:'users'`). `account-info.json` deliberately omits the tree. |
@@ -111,14 +111,16 @@ which is the source served to every account repo. Better guides over time are an
111
111
  - ticket ID if applicable
112
112
  - component names / IDs involved
113
113
  - Copies or references for the relevant supporting artifacts:
114
- - `./.remits-cli/current-session.txt`
115
- - the active repo session log from `./.remits-cli/sessions/`
116
- - any `./.remits-cli/tool-responses/<callId>.json` files involved
114
+ - `remits-cli doctor local-state` output
115
+ - `./.remits-cli/actors/<local-agent>/current-session.txt`
116
+ - the active actor's repo session log from `./.remits-cli/actors/<local-agent>/sessions/`
117
+ - any `./.remits-cli/actors/<local-agent>/tool-responses/<callId>.json` files involved
118
+ - legacy flat `.remits-cli/` files only when `doctor local-state` says the relevant artifact is there
117
119
  - `~/.remits-cli/account-repos.json` if repo resolution may be relevant
118
120
  - `~/.remits-cli/activity.log` if service / websocket / agent-routing behavior may be relevant
119
121
 
120
122
  2. **Use the global Remits CLI state to make the bundle self-contained.**
121
- - Read `./.remits-cli/current-session.txt` to identify the active repo session log.
123
+ - Run `remits-cli doctor local-state` to identify the active local actor and repo session log directory.
122
124
  - Record the exact repo directory and account context from `account-info.json`.
123
125
  - If repo selection or account targeting may be part of the issue, include the relevant entry from `~/.remits-cli/account-repos.json`.
124
126
  - If the problem involves support-ticket routing, agent registration, or websocket events, include the relevant lines from `~/.remits-cli/activity.log`.