@remits/remits-cli 0.1.109 → 0.1.112

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.109",
3
+ "version": "0.1.112",
4
4
  "description": "Local CLI for auth, component sync, and live test execution against Remits",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -20,6 +20,12 @@ description: Use remits-cli for fast branch-scoped component staging, test execu
20
20
  - [Required Local Index Reads](#required-local-index-reads)
21
21
  - [Big Picture: How remits-cli State Is Organized](#big-picture-how-remits-cli-state-is-organized)
22
22
  - [Support Ticket Mental Model](#support-ticket-mental-model)
23
+ - [You are an agent, and you register yourself](#you-are-an-agent-and-you-register-yourself)
24
+ - [Autonomous: one ticket, one process](#autonomous-one-ticket-one-process)
25
+ - [If you are the worker](#if-you-are-the-worker)
26
+ - [Moving a ticket through its lifecycle](#moving-a-ticket-through-its-lifecycle)
27
+ - [When a worker needs a decision from a human](#when-a-worker-needs-a-decision-from-a-human)
28
+ - [The manual loop](#the-manual-loop)
23
29
  - [Efficiency Rules](#efficiency-rules)
24
30
  - [Account Repository Index](#account-repository-index)
25
31
  - [Two Workflows](#two-workflows)
@@ -107,8 +113,10 @@ description: Use remits-cli for fast branch-scoped component staging, test execu
107
113
  - [Multi-Session Support](#multi-session-support)
108
114
  - [Registering This Session As An Agent](#registering-this-session-as-an-agent)
109
115
  - [What registration actually does](#what-registration-actually-does)
116
+ - [What `serve` adds](#what-serve-adds)
110
117
  - [Resolving which agent a command means](#resolving-which-agent-a-command-means)
111
118
  - [Which agent gets a ticket](#which-agent-gets-a-ticket)
119
+ - [Why a routed ticket might not have started](#why-a-routed-ticket-might-not-have-started)
112
120
  - [Background Service and Control Center](#background-service-and-control-center)
113
121
  - [Control Center](#control-center)
114
122
  - [Configuring the Preferred Agent](#configuring-the-preferred-agent)
@@ -289,8 +297,8 @@ every live component present at its real id, and nothing extra.
289
297
  | Command | What it touches | Danger |
290
298
  |---|---|---|
291
299
  | `remits-cli components stage` (alias: deprecated `push`) | **Redis staging cache only.** Never mutates the DB or git. The safe iteration surface. | none |
292
- | `remits-cli components status` | Reads the local branch/user staging scope and branch resolution. | none |
293
- | `remits-cli components clear` | Clears the local branch/user staging cache without changing DB or git. | none |
300
+ | `remits-cli components status` | Reads this lane's staging scope (account/user/branch/workspace) and branch resolution, and lists every other lane on the branch. | none |
301
+ | `remits-cli components clear` | Clears THIS lane's staging cache without changing DB or git. Never touches another workspace lane. | none |
294
302
  | `remits-cli components sync` **on trunk** | **Server-side git→DB reconcile of the whole account** (create/update/**delete**/rename). Reads the pushed remote; ignores local files. | **high** |
295
303
  | `remits-cli components sync` **on a variant branch** | Writes `ComponentVariant` overlays for that branch only. Never touches trunk rows or the account's trunk branch. When the checkout identifies a subscribing account, the branch-local `account-info.json` is refreshed for that subscriber; `--dry-run` reports the plan without writes. | medium (a missing file becomes a **tombstone** that hides the component from subscribers) |
296
304
  | `remits-cli components commit` | **One shot:** `git add -A` + commit + `git push` + **`components sync`** + `git pull --ff-only`. Blindly stages the *entire* working tree (including any drift) and reconciles it into prod. Inherits the danger of whichever sync mode the branch selects. | **highest on trunk** |
@@ -304,7 +312,7 @@ Key implications:
304
312
  - **`components sync` acts on the pushed remote**, so local edits are invisible to it until committed **and
305
313
  pushed**, and a drifted **remote** is dangerous even when your local tree looks fine.
306
314
  - After a successful non-dry-run `components sync` / `components commit`, the server clears the full
307
- branch/user staging scope. This is the expected clean state: old Redis aliases should not keep shadowing
315
+ staging scope for that lane (account/user/branch/workspace). This is the expected clean state: old Redis aliases should not keep shadowing
308
316
  the newly synced DB rows. `components sync --dry-run` intentionally leaves staging untouched.
309
317
 
310
318
  ### Intended workflows
@@ -460,16 +468,25 @@ workflows, and never one product's view of it.
460
468
 
461
469
  ### You are an agent, and you register yourself
462
470
 
463
- Work reaches you because **this terminal session registered itself as available**:
471
+ **If the user says anything like "register to become a support agent", or "work support tickets",
472
+ run exactly this and nothing else first:**
464
473
 
465
474
  ```bash
466
- remits-cli agent register # this tab is now a routable agent
467
- remits-cli agent work # ask for the tickets routed to it
475
+ remits-cli agent serve
468
476
  ```
469
477
 
470
- Three tabs running Claude are three agents. Each is independently routable, each reports its own
471
- activity, and each stops receiving work when its tab closes — a heartbeat process is anchored to the
472
- session and dies with it, so a crashed agent and a quit agent look identical to the platform.
478
+ No flags, no setup, **no need to be in an account repo** — run it from wherever the session started.
479
+ It registers this terminal for every account repo indexed on this machine that your user can reach,
480
+ against the production platform and the production lane, and then **starts working tickets on its
481
+ own**. It returns immediately; a background supervisor does the rest.
482
+
483
+ Use `remits-cli agent register` instead **only** when the user wants presence without autonomy — a
484
+ human, or you in this very tab, will work the tickets by hand. Registering alone starts nothing: it
485
+ makes the session routable and then waits to be asked.
486
+
487
+ Three tabs running an agent are three agents. Each is independently routable, each reports its own
488
+ activity, and each stops receiving work when its tab closes — a heartbeat anchored to the session dies
489
+ with it, so a crashed agent and a quit agent look identical to the platform.
473
490
 
474
491
  **Nothing is pushed at you.** A terminal mid-task cannot receive a push, so delivery is you asking.
475
492
  That is why the routing decision is a durable field on the ticket rather than a message: you can
@@ -480,28 +497,96 @@ Two facts about a ticket are separate and must stay separate:
480
497
  | Fact | Field | Means |
481
498
  |---|---|---|
482
499
  | **Routed** | `routedAgentId` | which agent session should pick this up — delivery |
500
+ | **Claimed** | `claimedAgentId` | a worker process is running on it *right now* |
483
501
  | **Owned** | `assignedTo` | who has claimed it — accountability |
484
502
  | **Status** | `status` | where it is in the workflow |
485
503
 
486
504
  A ticket routed to you is not yet yours. Claim it with `accept`, and the queue then shows it owned.
487
505
 
488
- ### The loop
506
+ The **claim** is the supervisor's, not yours — it exists so two workers never start on one ticket,
507
+ and it expires on its own so a killed worker cannot park a ticket forever. You do not manage it.
508
+
509
+ ### Autonomous: one ticket, one process
489
510
 
490
511
  ```bash
491
- remits-cli agent register --label "claude@merchant-statements"
492
- remits-cli agent work --wait 300 # blocks until something arrives
512
+ remits-cli agent serve # workers are whichever agent THIS session is
513
+ remits-cli agent serve --worker-agent codex --max-concurrent 2
514
+ remits-cli agent serve --mode investigate # read-only workers: no file edits
515
+ remits-cli agent workers # what is running right now
516
+ remits-cli agent release # stop serving, go offline
517
+ ```
518
+
519
+ **Run it in a plain terminal tab.** That tab becomes the agent host: `serve` returns immediately, a
520
+ detached supervisor is anchored to the tab's shell, and closing the tab stops the agent. Nothing in
521
+ that tab is an AI session — the AI only ever appears as the worker processes the supervisor spawns.
522
+
523
+ Starting it from inside an AI session works too and self-detects the worker kind, but it is the
524
+ lesser setup: it parks an interactive session as a heartbeat holder while its workers do the work.
525
+
526
+ When a ticket is routed to this session, the supervisor launches **a fresh headless agent process
527
+ for that ticket**, in that account's repo, with a brief the platform generates. That process exits
528
+ when the ticket is done.
529
+
530
+ **One ticket = one process is the point, and it is why nothing here ever needs `/clear`.** Context
531
+ grooming cannot be a discipline: `/clear` and `/new` are commands a *human types into a TUI*, and no
532
+ model can invoke them — so a long-lived session working ticket after ticket has no way to reset
533
+ itself. A process that exits has nothing to reset. Do not try to solve context growth by being tidy
534
+ inside one session; let the session end.
535
+
536
+ **`serve` returns immediately, and that is correct.** Do not follow it with a wait, a poll, or a
537
+ loop. The supervisor is detached precisely so this tab is free. Report that you are serving and
538
+ stop; you have not left the job half done.
539
+
540
+ What the supervisor handles for you, so you do not have to think about any of it: collecting routed
541
+ work, claiming each ticket so no second worker starts on it, renewing that claim while the worker
542
+ runs, reporting the worker's activity to the dashboard, dropping the claim when it exits, retrying a
543
+ failed ticket once, and releasing a ticket back to the queue when it has failed too often. Closing
544
+ the terminal stops everything and hands any in-flight work back.
545
+
546
+ ### The manual loop
547
+
548
+ Only when the session registered with `agent register` rather than `agent serve`.
549
+
550
+ ```bash
551
+ remits-cli agent work --wait 600 # returns as soon as work arrives
493
552
  remits-cli agent status --state working --ticket 22454 --activity "reproducing the upload failure"
494
- # ... investigate, fix, verify ...
495
- remits-cli agent status --activity "verifying the fix on localhost"
496
- # ... then close the ticket lifecycle through mcp_support_ticket ...
497
- remits-cli agent status --state idle # ready for the next one
553
+ # ... investigate, fix, verify — keep `status` current as what you are doing changes ...
554
+ # ... close the ticket lifecycle through remits-cli ticket (accept -> status -> complete, ask, or release) ...
555
+ remits-cli agent status --state idle # then ask for work again
498
556
  ```
499
557
 
558
+ **Nothing wakes this tab.** A routed ticket sits there until someone in this session asks for it, so
559
+ if you are working the manual loop you have to keep asking. If you find yourself wishing you could
560
+ be woken up, that is what `agent serve` is.
561
+
500
562
  **Report what you are doing.** `agent status` is how an operator watching the dashboard, or another
501
563
  agent, knows this session is alive and what it is on. It costs one command and it is the difference
502
564
  between a visible queue and a silent one. Update it when you change what you are doing, not on a
503
565
  timer.
504
566
 
567
+ **Work the ticket in the right repo.** A ticket names its `accountId`, and often an
568
+ `implementationAccountId` — the platform/product account whose repo holds the code. Resolve that to a
569
+ local directory through `~/.remits-cli/account-repos.json` and `cd` there before making changes. You
570
+ registered from anywhere; you do not fix anything from anywhere.
571
+
572
+ **Capacity is real, not advisory.** A serving session tells the platform how many workers it can run
573
+ (`--max-concurrent`, default 1), and the router will not send it more than that. So a session at
574
+ capacity is skipped in favour of one that is free, rather than accumulating tickets it will never
575
+ start.
576
+
577
+ **Lane note:** `register` and `serve` default to the production lane because a support agent works real tickets.
578
+ `--data-mode test` registers a fixture agent instead, which will never be routed a production ticket —
579
+ use it only when you are deliberately testing the routing itself.
580
+
581
+ ### If you are the worker
582
+
583
+ You know you are one when `REMITS_SUPPORT_TICKET_ID` is set in your environment. Your whole job is
584
+ that one ticket, and your brief is your prompt — follow it. Two things it says that are worth
585
+ repeating: **report progress** with `remits-cli agent status --ticket <id> --activity "..."` (a
586
+ headless run is invisible otherwise), and **end in a terminal state** — `complete` with a real
587
+ resolution, or `update_status` with what you established and what the next agent should try. Exiting
588
+ quietly leaves a ticket that looks in-flight forever.
589
+
505
590
  ### Seeing the queue as a human does
506
591
 
507
592
  `remits-cli start` opens a browser control center showing the same facts you are acting on: which
@@ -509,7 +594,79 @@ agents are registered and what each is doing, which tickets are open, and which
509
594
  to. An operator can route a ticket to a specific agent from there. It is a view, not a second system —
510
595
  what it shows and what `remits-cli agent work` returns come from the same records.
511
596
 
512
- Use `mcp_support_ticket` to manage lifecycle:Use `mcp_support_ticket` to manage lifecycle:
597
+ ### Agent components are workers too
598
+
599
+ An Agent component that works support tickets must register itself in the same presence registry as
600
+ CLI sessions. That makes it visible in `cliAgents()` and `remits-cli agent map`, and lets
601
+ `dispatch(...)` / `ticket route` target it by the same `agentId` field:
602
+
603
+ ```groovy
604
+ def me = workerId() // component:Agent:34
605
+ registerWorker([agentId: me, label: 'Support Triage Agent'])
606
+ def work = workerWork([agentId: me, runId: threadGroupingId()])
607
+ workerStatus([agentId: me, ticketId: work.tickets[0]?.id, activity: 'investigating'])
608
+ ```
609
+
610
+ `workerWork(...)` is the component-side analogue of `remits-cli agent work` — the same code runs behind
611
+ both, so a component and a terminal session get the same answer to the same question. It reads tickets
612
+ routed to that worker, claims what it may start, sweeps eligible unrouted work when it is idle (reported
613
+ separately as `sweptTicketIds`), takes the repository edit lease when available, and returns `phase`,
614
+ `brief`, `briefFacts`, and `editLease`. `phase:'editing'` means the component may edit and stage;
615
+ `phase:'investigating'` means another worker holds the repo lease and the component must stay read-only.
616
+ When a component reaches a resting point, pass `agentId` to `complete(...)`, `ask(...)`, or
617
+ `release(...)` so the ticket verb frees the edit lease and drops its claim.
618
+
619
+ Route to a component by its **id** (`component:Agent:34`) — that is what `workerId()` returns and what
620
+ the component polls on. `ticket route --agent component:Agent:MyAgent` also works: the name is resolved
621
+ and the id form is what gets stored.
622
+
623
+ ### Moving a ticket through its lifecycle
624
+
625
+ **`remits-cli ticket` is the platform surface, and it is what you should reach for.** It reads and
626
+ writes the platform's own ticket record, so the same commands work on every Remits platform.
627
+
628
+ ```bash
629
+ remits-cli ticket read --ticket 22454 # the full record
630
+ remits-cli ticket accept --ticket 22454 # claim it before changing anything
631
+ remits-cli ticket progress --ticket 22454 --summary "Traced it to the posting Action" --category investigation
632
+ remits-cli ticket status --ticket 22454 --status in_progress
633
+ remits-cli ticket complete --ticket 22454 --resolution "What you found and did"
634
+ remits-cli ticket ask --ticket 22454 --question "Re-issue or skip?" --context "412 affected"
635
+ remits-cli ticket reply --ticket 22454 --message "Skip them."
636
+ remits-cli ticket release --ticket 22454 # hand it back to the queue
637
+ ```
638
+
639
+ ### When a worker needs a decision from a human
640
+
641
+ There are **three** ways a run can end, not two, and the third is what stops an agent guessing:
642
+
643
+ | Outcome | Verb | Means |
644
+ |---|---|---|
645
+ | Done | `ticket complete --resolution` | finished, here is what I did |
646
+ | **Blocked on a choice** | `ticket ask --question` | I understand the work; the DECISION is not mine |
647
+ | Could not finish | `ticket status --status pending_review` + `ticket progress` | stuck, here is the hand-off |
648
+
649
+ `ask` puts the question on the ticket as an outbound message and parks it. The queue then shows it as
650
+ **awaiting a response** — distinct from "done, review me", which `pending_review` alone cannot express.
651
+
652
+ Someone answers with `remits-cli ticket reply --message "..."` (or through an operator Embeddable).
653
+ That **re-routes the ticket by default**, so the supervisor's next poll starts a **fresh worker whose
654
+ brief already contains the exchange**. Resumption costs nothing because a worker is one process per
655
+ ticket — there is no session to restore.
656
+
657
+ Ask when the choice is genuinely not yours: which of two behaviours is wanted, whether to touch live
658
+ data, an ambiguity in the request. Do not ask for reassurance about something you can determine
659
+ yourself, and ask **once**, with the options laid out.
660
+
661
+ Inside an autonomous worker `--ticket` defaults to the ticket that worker was launched for.
662
+
663
+ A refusal is an **answer**: "accept it first", "already assigned to someone else", "reopen it
664
+ first". Act on the sentence — do not go looking for another tool that lets you skip the step.
665
+
666
+ **`mcp_support_ticket` is an account convention, not a platform guarantee.** It belongs to one
667
+ particular System Account: it may not exist on the platform you are on, it scopes to its own
668
+ account, and it will refuse a ticket owned by a different one. Use it only when you are working in
669
+ that account and want its product-specific workflow on top of the record. It offers:
513
670
  - `read` — always start here to load current state
514
671
  - `accept` — claim the ticket so other agents do not work it concurrently
515
672
  - `update_status` — move to `in_progress` or `pending_review`
@@ -1050,7 +1207,7 @@ If verification reveals issues, repeat the loop: **edit → stage → run**. Eve
1050
1207
  Don't ask the user for permission to re-iterate — just do it. Only stop to ask if you're stuck or unsure about the intended behavior.
1051
1208
 
1052
1209
  If the work is tied to a support ticket:
1053
- - Use `mcp_support_ticket` to mark the ticket `in_progress` once you have started substantive work.
1210
+ - Use `remits-cli ticket status --status in_progress` once you have started substantive work.
1054
1211
  - If a new reply arrives, re-read the ticket and incorporate the reply into your current plan.
1055
1212
 
1056
1213
  #### Step 6: Update Documentation
@@ -1130,8 +1287,8 @@ unexpectedly, stop and inspect the repo-local session log before running any mut
1130
1287
  If the request came from a support ticket, the task is not complete until you update the ticket lifecycle yourself:
1131
1288
 
1132
1289
  1. Re-read the ticket if needed to confirm the latest state and replies.
1133
- 2. If the work is done and verified, call `mcp_support_ticket` with `complete` and include a concise resolution summary.
1134
- 3. If you cannot finish, use `update_status` or `release` with clear notes so the next agent can continue.
1290
+ 2. If the work is done and verified, call `remits-cli ticket complete` and include a concise resolution summary.
1291
+ 3. If you cannot finish, use `remits-cli ticket status` or `remits-cli ticket release` with clear notes so the next agent can continue.
1135
1292
  4. Do this automatically. The human user should not need to instruct you to update the ticket.
1136
1293
 
1137
1294
  Options:
@@ -1182,10 +1339,17 @@ Plus the compile cache:
1182
1339
  ### Staging cache key format
1183
1340
 
1184
1341
  ```
1342
+ # default lane (no workspace)
1185
1343
  account:<accountId>:cli:<cliUserId>:components:<branch>:<family>:id:<componentId>
1186
1344
  account:<accountId>:cli:<cliUserId>:components:<branch>:<family>:name:<normalizedName>
1345
+
1346
+ # workspace lane
1347
+ account:<accountId>:cli:<cliUserId>:components:<branch>:ws:<workspace>:<family>:id:<componentId>
1187
1348
  ```
1188
1349
 
1350
+ The staging scope is therefore **account + cli user + branch + workspace**. `workspace` is optional and
1351
+ absent by default; see "Working alongside other agents: the staging WORKSPACE" above.
1352
+
1189
1353
  `<family>` is the lowercased component family (`reader`, `action`, `test`, `embeddable`, ...). Both an
1190
1354
  `id:` and a `name:` key are written per stage. The entry value carries: `kind` (the family), `type` (the
1191
1355
  component's OWN type enum such as `ObjectType`/`RuleType`, or absent — **never** the family), `hash`,
@@ -1263,15 +1427,51 @@ TestMode still uses the committed DB source. Staging remains a dev/verification
1263
1427
  `No enum constant ObjectType.reader`).
1264
1428
  - **Confirm the DB version:** `mcp_component_view` reads the live DB source directly (no staging, no compile
1265
1429
  cache), so it is the source of truth for "what was committed."
1266
- - **Ask the CLI what is staged:** `remits-cli components status` lists the current branch/user staged entries,
1430
+ - **Ask the CLI what is staged:** `remits-cli components status` lists this lane's staged entries,
1267
1431
  including staged fields, aliases, hashes, and TTLs. The default terminal output is concise; pass `--json` or
1268
1432
  `--verbose` when you need the full staged-entry payload. `remits-cli components clear` removes those entries
1269
1433
  when you intentionally want to fall back to DB source.
1270
1434
 
1435
+ ### Working alongside other agents: the staging WORKSPACE
1436
+
1437
+ Staging is scoped by `(account, cli user, branch, workspace)`. Account and user are fixed for a repo, so
1438
+ **without a workspace the git branch is the only isolation axis** — and `components stage` uploads the
1439
+ ENTIRE repo and REPLACES the lane rather than merging into it. Two agents on one branch therefore
1440
+ overwrite each other, and a `components commit` clears the lane out from under the other one.
1441
+
1442
+ If more than one agent is working on the same branch, give each its own workspace:
1443
+
1444
+ ```bash
1445
+ git worktree add ../repo-agent-a forked # one checkout per agent, same branch
1446
+ cd ../repo-agent-a
1447
+ remits-cli workspace use --auto # names the lane after this directory
1448
+ remits-cli components stage # isolated: nobody else sees it, nobody overwrites it
1449
+ remits-cli test run --test 42
1450
+ remits-cli token --path /page/whatever
1451
+ ```
1452
+
1453
+ A workspace narrows STAGING and nothing else. A commit still targets the same branch and the same owner
1454
+ account, and the run still resolves whatever committed variant branch the account subscribes to — so it
1455
+ does **not** have the side effects of inventing a throwaway git branch per agent (which would make a
1456
+ commit write `ComponentVariant` overlays for a branch nobody subscribes to).
1457
+
1458
+ - `.remits-cli/workspace` is per-checkout and gitignored, so each worktree keeps its own lane.
1459
+ - Precedence: `--workspace NAME` > `REMITS_WORKSPACE` > `.remits-cli/workspace` > shared default lane.
1460
+ - `--no-workspace` targets the shared lane for one command without clearing the file.
1461
+ - Every stage / test run / token / clear prints its `Staging lane:` — if a change seems to have had no
1462
+ effect, check that line FIRST. A mismatched lane resolves committed source, which looks identical to
1463
+ "the stage did not work".
1464
+ - `remits-cli components status` lists every lane staged on the branch, so you can see whether another
1465
+ agent is working alongside you.
1466
+ - `remits-cli components clear --all` is scoped to YOUR lane and never touches another agent's.
1467
+
1271
1468
  ### Stage / sync / clear with remits-cli
1272
1469
 
1273
1470
  - `remits-cli components stage` writes local file changes into the Redis staging cache for the current
1274
- branch/user scope. This is the normal edit/test loop.
1471
+ branch/user/workspace scope. This is the normal edit/test loop.
1472
+ - `remits-cli components stage --changed-only` stages just the components this working tree edited. It
1473
+ does NOT reconcile, so entries for components it did not mention are left alone rather than deleted.
1474
+ Useful on a large repo; a full stage is still the default and the safest.
1275
1475
  - `remits-cli components status` shows which branch/variant world the checkout resolves, plus staged entries,
1276
1476
  staged fields, aliases, hashes, and TTLs. Use `--json` or `--verbose` for the full staged-entry payload.
1277
1477
  - **A full `stage` makes the `.meta.yml` AUTHORITATIVE.** Staging layers a payload over what is already
@@ -2708,8 +2908,11 @@ ticket with `mcp_support_ticket read` before lifecycle work and honor `mirrorOnl
2708
2908
  | `priorities` / `types` / `sources` / `tags` | no | Additional filters |
2709
2909
  | `assignedTo` / `unassigned` | no | Assignment filters |
2710
2910
  | `implementationAccountId` | no | Filter by owning `PLATFORM`/`PRODUCT` account |
2711
- | `search` | no | Case-insensitive across subject, description, account, affected component, sender, tags |
2712
- | `sortBy` / `sortDirection` | no | `triage` (default-style: critical/high unassigned first), `updated`, `priority`, `status`, `account` |
2911
+ | `workstream` / `plannedIn` / `boardStage` / `size` / `blockedBy` | no | SDLC-agnostic planning filters; exact matches on compact queue fields |
2912
+ | `rank` / `minRank` / `maxRank` | no | Exact or inclusive range filters for numeric planning rank |
2913
+ | `search` | no | Case-insensitive across subject, description, account, affected component, sender, tags, workstream, and planning fields |
2914
+ | `sortBy` | no | `triage` (default-style: critical/high unassigned first), `updated`, `priority`, `status`, `account`, `plannedIn`, `boardStage`, `rank`, `size` |
2915
+ | `sortDirection` | no | `asc` / `desc`, and it means the same thing on every axis. Natural order is `desc` for `triage`/`updated`/`priority` and `asc` for `status`/`account`/`rank`/`plannedIn`/`boardStage`/`size`, so pass it only to invert one |
2713
2916
  | `limit` / `offset` / `scanLimitPerAccount` | no | Paging and scan bounds |
2714
2917
  | `dataMode` | no | Normal agent work uses the **prod** ticket queue |
2715
2918
 
@@ -2750,25 +2953,80 @@ so in its own output; when a test run genuinely needs prod data, pass the flag.
2750
2953
  independent of everything else — no background service is required, and every tab is its own agent.
2751
2954
 
2752
2955
  ```bash
2753
- remits-cli agent register # this session is now routable
2754
- remits-cli agent work --wait 300 # ask for tickets routed here
2956
+ remits-cli agent serve # routable AND autonomously working tickets — the usual choice
2957
+ remits-cli agent workers # what this session is running right now
2958
+ remits-cli agent list # who else is available across the accounts you cover
2959
+ remits-cli agent release # stop serving and stop receiving tickets right now
2960
+
2961
+ remits-cli agent register # presence ONLY — nothing starts on its own
2962
+ remits-cli agent work --wait 300 # ask for tickets routed here (manual loop)
2755
2963
  remits-cli agent status --state working --ticket 22454 --activity "reproducing"
2756
- remits-cli agent list # who else is available for this account
2757
- remits-cli agent release # stop receiving tickets right now
2758
2964
  ```
2759
2965
 
2966
+ `serve` is `register` plus a supervisor. Everything below about registration applies to both.
2967
+
2968
+ **Defaults exist so the user does not have to type them.** With no flags, `register` targets the
2969
+ production platform (`REMITS_BASE_URL` when set) and the **prod** lane, and claims every account repo
2970
+ indexed on this machine. That is a deliberate exception to the CLI's test-first default: registering
2971
+ presence mutates no business data, and a test-lane agent is silently useless for support — it appears
2972
+ online and can never be routed a production ticket. Every command after `register` reuses the
2973
+ platform, lane and identity it registered with.
2974
+
2760
2975
  ### What registration actually does
2761
2976
 
2762
2977
  - Mints an `agentId` for this session and tells the platform which account repos this machine has
2763
- checked out. The platform **verifies** those claims against what your user can access and returns
2764
- the ones it refused, so "I registered but never get tickets for account 52" is answerable from the
2765
- registration output alone.
2978
+ checked out — read from the machine-wide index (`~/.remits-cli/account-repos.json`), which is why
2979
+ the working directory does not matter. The platform **verifies** those claims against what your user
2980
+ can access and returns the ones it refused, so "I registered but never get tickets for account 52"
2981
+ is answerable from the registration output alone.
2766
2982
  - Starts a small detached heartbeat process **anchored to the agent process that owns this terminal**
2767
2983
  (it walks up the process tree to find `claude`/`codex`/`gemini`, then an interactive shell). When
2768
2984
  that process ends, the heartbeat ends and the session stops being routable within a couple of
2769
2985
  minutes. Closing the tab is a valid way to go offline; `agent release` just makes it immediate.
2770
2986
  - Registers in the session's **data lane**. A `test`-lane run only ever reaches a `test`-lane agent,
2771
2987
  which is what keeps fixture traffic away from a production terminal.
2988
+ - Declares **capacity** — how many tickets this session can genuinely run at once (`--max-concurrent`,
2989
+ default 1). The router will not exceed it.
2990
+
2991
+ ### What `serve` adds
2992
+
2993
+ The same detached process that maintains presence also polls for work. On each poll it publishes the
2994
+ tickets it currently has running, renews their claims, and takes at most enough new ones to fill its
2995
+ capacity. For each new ticket it launches a headless worker:
2996
+
2997
+ | | headless invocation | edit mode | investigate mode |
2998
+ |---|---|---|---|
2999
+ | `codex` | `codex exec --cd <repo>` | `--sandbox workspace-write` | `--sandbox read-only` |
3000
+ | `claude` | `claude -p --add-dir <repo>` | `--permission-mode acceptEdits` | `--permission-mode plan` |
3001
+ | `gemini` | `gemini -p` in `<repo>` | `--approval-mode auto_edit` | `--approval-mode plan` |
3002
+
3003
+ **Which of the three it launches:** `--worker-agent` if you pass it, otherwise **whatever agent this
3004
+ session is** (detected from the process the agent anchored to — which finds nothing in a plain tab),
3005
+ otherwise `~/.remits-cli/config.json`'s `agent` (set it with `remits-cli config set --agent NAME`),
3006
+ otherwise `claude`. **It prints which it chose and why on startup**, because in the intended
3007
+ plain-tab setup the choice comes from a config file you may have set months ago. So running `agent serve` inside a Codex tab gives you Codex workers
3008
+ without a flag, and the label the operator sees (`codex@repo`) is resolved the same way — the label
3009
+ and the worker are one answer, not two.
3010
+
3011
+ The brief always arrives on **stdin**, never in argv — it is a page of prose and argv has a hard
3012
+ length limit, so an argv brief would fail on exactly the detailed tickets that most need the detail.
3013
+ The brief itself is generated by the platform, so all three worker types are told the same thing.
3014
+
3015
+ **Following a run.** `remits-cli start`'s control center lists every worker; **Follow live** streams
3016
+ that run's transcript into the page, rendering commands with their exit codes, file edits, and the
3017
+ agent's own messages as distinct things. It keeps working after the worker exits — a finished run is
3018
+ usually the one worth reading. For a terminal instead, each worker prints a `tail -f` for its log in
3019
+ `~/.remits-cli/workers/`.
3020
+
3021
+ **There is no terminal to attach to, by design.** A worker is spawned with pipes and runs
3022
+ non-interactively (`codex exec`, `claude -p`), so there is no tty and no prompt to type at — the
3023
+ whole point is that it needs no supervision. Following the transcript is the way to watch, and it is
3024
+ strictly better than a terminal would be: the output is structured, so it can be read as events
3025
+ rather than scraped back out of ANSI text.
3026
+
3027
+ **No worker ever commits.** The brief forbids `git commit`/`git push` and nothing in the supervisor
3028
+ runs git — a worker leaves its changes in the working tree and says so on the ticket, for a human to
3029
+ review.
2772
3030
 
2773
3031
  ### Resolving which agent a command means
2774
3032
 
@@ -2783,7 +3041,22 @@ usually fixed in the platform repo above it), then the ticket's own account, the
2783
3041
  `PLATFORM`/`PRODUCT` ancestors — and takes the first account with an available agent. Among those it
2784
3042
  prefers an **idle** agent, then the one that has waited longest, so work spreads across your tabs
2785
3043
  instead of piling onto whichever one most recently ran a command. A `paused` agent stays visible and
2786
- is never routed to.
3044
+ is never routed to, and so is one **at capacity** — those are different facts and stay separate:
3045
+ `paused` means a human stopped this session, at-capacity means its workers are all busy.
3046
+
3047
+ ### Why a routed ticket might not have started
3048
+
3049
+ In order of likelihood:
3050
+
3051
+ 1. **The session registered but never served.** `agent register` starts nothing. `agent workers`
3052
+ showing none while a ticket is routed here is this.
3053
+ 2. **At capacity.** Check `agent workers`; the ticket starts when one finishes.
3054
+ 3. **Another session is running it.** A claim held by a different agent blocks it until that claim is
3055
+ dropped or expires.
3056
+ 4. **No local checkout.** The worker still starts, and its brief tells it to locate the repo rather
3057
+ than guess — but if the account genuinely is not on this machine it will say so and stop.
3058
+ 5. **It failed twice already** and was released back to the queue. The transcripts in
3059
+ `~/.remits-cli/workers/` say why.
2787
3060
 
2788
3061
  ## Background Service and Control Center
2789
3062
 
@@ -2897,18 +3170,25 @@ Reading rules:
2897
3170
  remits-cli auth [--base-url URL] [--account-id ID] [--data-mode test|prod]
2898
3171
  remits-cli sessions [list|remove] [--account-id ID]
2899
3172
  remits-cli config [set] [--agent claude|codex|gemini]
2900
- remits-cli agent register [--label NAME] [--data-mode test|prod] [--account-id ID]
3173
+ remits-cli agent serve [--worker-agent claude|codex|gemini] [--max-concurrent N] [--mode edit|investigate] [--label NAME] [--data-mode test|prod]
3174
+ remits-cli agent workers [--json]
3175
+ remits-cli agent register [--label NAME] [--data-mode test|prod] [--account-id ID] [--max-concurrent N]
2901
3176
  remits-cli agent work [--wait SECONDS] [--json]
2902
3177
  remits-cli agent status [--state idle|working|paused] [--ticket ID] [--activity "..."] [--step "..."]
2903
3178
  remits-cli agent list [--account-id ID] [--json]
3179
+ remits-cli agent map [--account-ids 1,4] [--json] # who is EDITING which repository, from which checkout/branch/staging lane
2904
3180
  remits-cli agent release
3181
+ remits-cli ticket read|accept|status|progress|complete|release|reopen|assign|planning --ticket ID [--status S] [--resolution "..."] [--summary "..."] [--category C] [--assignee EMAIL] [--workstream VALUE] [--planned-in VALUE] [--board-stage VALUE] [--rank N] [--size VALUE] [--blocked-by VALUE] [--notes "..."]
3182
+ remits-cli ticket lease|unlease|force-unlease --ticket ID [--reason "..."] # force-unlease breaks SOMEBODY ELSE'S lease; operator only
3183
+ remits-cli ticket where --ticket ID # WHERE this work is: repo account, checkout, branch, staging lane, live lease + holder's location, claim, your phase
2905
3184
  remits-cli start [--foreground true] [--port 8787]
2906
3185
  remits-cli stop
2907
3186
  remits-cli status [--base-url URL] [--account-id ID] [--data-mode test|prod] [--json]
2908
3187
  remits-cli whoami [--base-url URL] [--account-id ID] [--data-mode test|prod] [--json]
2909
3188
  remits-cli listen [stop|status] [--foreground true] # compatibility alias
2910
3189
  remits-cli data-mode [set test|prod]
2911
- remits-cli components stage [--branch <name>] [--data-mode test|prod] [--json|--verbose]
3190
+ remits-cli components stage [--branch <name>] [--workspace <name>] [--changed-only] [--data-mode test|prod] [--json|--verbose]
3191
+ remits-cli workspace [show | use <name> | use --auto | clear]
2912
3192
  remits-cli components status [--branch <name>] [--component-type <type>] [--component-id <id>] [--json|--verbose]
2913
3193
  remits-cli components clear [--branch <name>] [--component-type <type>] [--component-id <id>] [--all] [--json|--verbose] # id alone scopes to one component when unambiguous (ids are type-local; add --component-type if the same id is staged in multiple families); no filter clears the whole branch scope; --all forces the full wipe
2914
3194
  remits-cli components sync [--branch <name>] [--data-mode test|prod] [--force-tombstones] [--dry-run] [--summary] [--changed-only [--changed-since <ref>]] # gated; on trunk = full repo->DB reconcile, on a variant branch = ComponentVariant overlays only