@johngaynor/ocnus 2.0.1-next.7 → 2.0.1-next.71

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.
Files changed (43) hide show
  1. package/README.md +506 -93
  2. package/cli/lib/agents.sh +32 -16
  3. package/cli/lib/asks.sh +762 -0
  4. package/cli/lib/banner.sh +181 -0
  5. package/cli/lib/brief.sh +375 -0
  6. package/cli/lib/chain.sh +363 -0
  7. package/cli/lib/close.sh +5 -3
  8. package/cli/lib/cost.sh +500 -0
  9. package/cli/lib/finish.sh +30 -4
  10. package/cli/lib/github.sh +106 -26
  11. package/cli/lib/guard.sh +39 -10
  12. package/cli/lib/handoff.sh +196 -31
  13. package/cli/lib/host.sh +186 -345
  14. package/cli/lib/linear.sh +552 -56
  15. package/cli/lib/links.sh +6 -3
  16. package/cli/lib/merges.sh +126 -27
  17. package/cli/lib/sessions.sh +132 -0
  18. package/cli/lib/settings.sh +31 -15
  19. package/cli/lib/task.sh +169 -54
  20. package/cli/lib/tests.sh +302 -7
  21. package/cli/lib/usage.sh +204 -0
  22. package/cli/ocnus +264 -72
  23. package/herdr/README.md +867 -223
  24. package/herdr/layouts/default.json +30 -11
  25. package/herdr/layouts/showcase.json +291 -0
  26. package/herdr/layouts/vibe.json +162 -0
  27. package/herdr/layouts/vibe.svg +41 -0
  28. package/herdr/mods/agent-settings/main.js +19 -7
  29. package/herdr/mods/memory/main.js +128 -0
  30. package/herdr/mods/memory/mod.json +1 -0
  31. package/herdr/mods/memory/reading.js +88 -0
  32. package/herdr/mods/names/main.js +22 -4
  33. package/herdr/mods/step-counts/main.js +281 -0
  34. package/herdr/mods/step-counts/mod.json +1 -0
  35. package/herdr/mods/usage/main.js +149 -0
  36. package/herdr/mods/usage/mod.json +1 -0
  37. package/package.json +1 -1
  38. package/prompts/task-new.md +1 -1
  39. package/skills/brief/SKILL.md +8 -0
  40. package/skills/sdlc-breakdown/SKILL.md +66 -18
  41. package/skills/sdlc-build/SKILL.md +6 -2
  42. package/skills/sdlc-pr/SKILL.md +2 -2
  43. package/skills/sdlc-review/SKILL.md +5 -5
package/herdr/README.md CHANGED
@@ -1,20 +1,25 @@
1
1
  # herdr
2
2
 
3
3
  Shared setup for the [Herdr](https://herdr.dev) desktop app: mods (panels) and
4
- a layout (a whole-window arrangement of mods).
4
+ layouts (whole-window arrangements of mods).
5
5
 
6
6
  ## What's here
7
7
 
8
8
  | Path | What it is |
9
9
  |---|---|
10
10
  | `mods/cpu/` | Live CPU usage with a scrolling history. macOS only (reads `/usr/bin/top`). |
11
+ | `mods/memory/` | Live memory use with a scrolling history, like the CPU mod's: memory used out of the Mac's total, in GB, as Activity Monitor's Memory Used counts it. Each reading is a bar as high as the share of the Mac's memory in use, coloured by macOS's memory pressure: green for normal, yellow for warning, red for critical. Under the figure, `claude` is the resident memory of every process whose command is `claude`: ocnus's agents, while their harness is `claude`, and any Claude Code session you opened yourself, but not what they run, such as a test run, which counts in memory used alone. So it is not the recorder's `mem_agents_mb`, which counts every process under a terminal labelled with one of your spaces (see [Recording the host](#recording-the-host)). `swap` is the swap in use. It reads macOS itself, so it shows the same whether recording is on or off. macOS only (reads `sysctl`, `vm_stat` and `ps`). |
12
+ | `mods/usage/` | The Usage section, above Memory and CPU, and as small: how much of your Claude subscription's five-hour and weekly usage limits is used, as a percentage and a bar each, and when each resets, as the agents ocnus starts last read them. See [The Usage section](#the-usage-section). |
11
13
  | `mods/layout-switch/` | A dropdown that shows the current layout and switches to another. |
12
14
  | `mods/ocnus-spaces/` | The Ocnus spaces panel: every space in your config, open or not. Click one to show it; `+` makes a new one. It is not `spaces`, which is Herdr's own list of the spaces it has open. |
13
15
  | `mods/cards/` | The open Linear cards of the space that is showing, under their statuses. Start writes a card up with `task new`; Open shows the tab of a card already started. |
14
16
  | `mods/steps/` | The steps of the card whose tab is selected: what each did, how long it took, and how long it waited on you. With no card's tab selected, the space's cards and where each stands. |
17
+ | `mods/step-counts/` | The Step counts section, right above Usage and about as small: the seven steps, each with a dot for every card of the space that is showing that stands on it, coloured by how the card's agent is doing, and how many there are. See [The Step counts section](#the-step-counts-section). |
15
18
  | `mods/agent-settings/` | The settings button, a cog at the right end of the tab bar, and the popup it opens: the model and effort of each phase profile and dev profile, then the breakdown approval, archiving, the tests setting and billing, each of which a click changes. See [The settings button](#the-settings-button). |
16
- | `mods/names/` | Draws nothing. It gives the spaces and tabs the app takes in from herdr-core, for agents started while the app was closed, the names ocnus gave them. See [Writing the card up](#writing-the-card-up). |
17
- | `layouts/default.json` | Herdr's own layout with ocnus's panels: the Ocnus spaces panel, the `ocnus-spaces` mod, in place of Herdr's own list of spaces; the layout dropdown, the Cards and Steps panels and the CPU mod in the sidebar; and the settings button beside the tabs. The tab bar is a row of Herdr's `tabs`, `agent-settings` and `names`, in a block 1px wide, since a mod runs only while a layout places it. |
19
+ | `mods/names/` | Draws nothing but a note saying what it does, and that only where a layout asks for it, as `showcase` does. It gives the spaces and tabs the app takes in from herdr-core, for agents started while the app was closed, the names ocnus gave them. See [Writing the card up](#writing-the-card-up). |
20
+ | `layouts/default.json` | Herdr's own layout with ocnus's panels: the Ocnus spaces panel, the `ocnus-spaces` mod, in place of Herdr's own list of spaces; the layout dropdown, the Cards and Steps panels, the Step counts section, the Usage section, the Memory mod and the CPU mod in the sidebar, with the Step counts right above Usage, Usage above Memory and CPU, and Memory right above CPU; and the settings button beside the tabs. Herdr's Agents section, its `agents` mod, is not on it. The tab bar is a row of Herdr's `tabs`, `agent-settings` and `names`, in a block 1px wide, since a mod runs only while a layout places it. |
21
+ | `layouts/showcase.json` | For seeing each mod working before you choose what to put in a layout of your own: it places every mod ocnus ships, each in a block of its own that shows as soon as the layout opens, and each is the mod itself, on this machine's own data, as on `default`. It is `default` with two changes: the Usage section, the Memory mod and the CPU mod leave the sidebar for a row along the bottom, under the terminals, and `names` sits at the end of that row, where it draws a note saying that it draws nothing, and what it does. `npm test` fails, naming the mod, when a mod in `mods/` is not on it, so a card that adds a mod adds it here too. |
22
+ | `layouts/vibe.json` | Three columns side by side, each the window's full height, for steering every agent without reading code. The left one is the sidebar, 268px wide as `default`'s is: Herdr's brand, the layout dropdown, the Ocnus spaces panel and, at its bottom, the Step counts section, the Usage section, the Memory mod and the CPU mod, stacked in that order with nothing between them. The middle one is the place for the card list (LAB-237) above the place for Brainstorm (LAB-240), and the right one is the place for Needs you (LAB-238), which turns into the opened agent (LAB-239). Those three places are still empty: each is a column with nothing in it, which its card swaps for the mod's block, so the layout names no mod that is not installed. It shows no files, diffs or split terminals: it has no Files panel, no Changes panel, no tab bar and no block for a tab's terminals, shown or hidden, so code is only in the pull requests. It has no settings button and no footer either: the settings button is on `default`, and Herdr's Settings still opens by its key. The `names` mod is beside the brand, in a block 1px wide. `layouts/vibe.svg`, beside it, is its picture in Herdr's Settings: `ocnus install` and `ocnus update` link it, and `ocnus status` lists it, as they do a layout. |
18
23
  | `spaces/template/` | The starting `SPACE.md` for every new space. |
19
24
 
20
25
  The skills are in [../skills/](../skills/), outside this folder. They are
@@ -26,7 +31,7 @@ profiles in [../agents/](../agents/), into `~/.claude/agents`: the ones
26
31
  ## How it works
27
32
 
28
33
  Herdr reads its whole interface from files in `~/.config/herdr-app`. This repo
29
- holds the mods and the layout we own, and each machine symlinks them into that
34
+ holds the mods and the layouts we own, and each machine symlinks them into that
30
35
  folder. The linked files are the tracked files, so a `git pull` is all it
31
36
  takes to update a machine.
32
37
 
@@ -59,7 +64,7 @@ Per-machine things stay out of the repo: the Herdr account, `settings.json`,
59
64
 
60
65
  2. Open Herdr once and sign in, now or after the next two steps. The first
61
66
  start creates `~/.config/herdr-app` and fills it with Herdr's own mods
62
- and layouts. ocnus links its own mods and layout into that folder, so
67
+ and layouts. ocnus links its own mods and layouts into that folder, so
63
68
  they wait until it is there.
64
69
 
65
70
  3. Install ocnus (needs Node):
@@ -97,7 +102,13 @@ Per-machine things stay out of the repo: the Herdr account, `settings.json`,
97
102
  5. Switch Herdr to the `default` layout, which holds ocnus's panels:
98
103
  press `ctrl-shift-l` until it shows. Herdr starts on its own layout, which
99
104
  has no Layout dropdown; on `default` the dropdown is at the top of the
100
- sidebar.
105
+ sidebar. It lists ocnus's other two layouts too, `vibe` and `showcase`.
106
+ `vibe` shows no files, diffs or split terminals (see
107
+ [What's here](#whats-here)), and has the dropdown in the same place: pick
108
+ `default` there to come back. `showcase` places every mod ocnus ships,
109
+ each in a block of its own, so that you can see each one working before
110
+ you choose what to put in a layout of your own. It has the dropdown as
111
+ well, where picking `default` goes back.
101
112
 
102
113
  ## Keeping a machine up to date
103
114
 
@@ -141,7 +152,7 @@ opened, and links them with the app open or closed once it has.
141
152
  | It says | When | Its exit code |
142
153
  |---|---|---|
143
154
  | `watch`, `running`, how long ago its last pass began, and how many cards wait on their merge | herdr-core runs, and the watch began a pass in the last 3 minutes (`merges/.alive`). | not changed |
144
- | `watch`, `not running`, and that no card waits on its merge | No card waits, so nothing needs it. | not changed |
155
+ | `watch`, `not running`, and that no card waits on its merge | No card waits, so nothing needs it but the half-hourly catch-up, which the launchd agent starts it for. | not changed |
145
156
  | `problem`, that the watch is not running, or has not begun a pass for how long, with how many cards wait, and to run `ocnus update` | Cards wait, herdr-core runs, and the watch has not begun a pass in the last 3 minutes. `update` wakes it. | non-zero |
146
157
  | `problem`, as above, saying that herdr-core is not running and to start it with `hc server start`, then run `ocnus update` | Cards wait, and herdr-core is not running. An update never starts it. With Herdr not installed, it says to install it instead. | non-zero |
147
158
  | `problem`, that `gh` needs signing in, with `gh`'s words, and to run `gh auth login` | Cards wait, and the watch's last pass, in the last 3 minutes, found `gh` signed out or its token refused (`merges/.gh`). | non-zero |
@@ -170,7 +181,7 @@ opened, and links them with the app open or closed once it has.
170
181
  | It says | When | Its exit code |
171
182
  |---|---|---|
172
183
  | `writes`, that the key can change cards | Linear said there is no such card. | not changed |
173
- | `problem`, that the key can read cards but not change them | Linear refused the change for want of Write permission. `task ls`, the Cards panel and `linear read` work, but `linear type`, `linear section`, `linear slices` and `linear move` fail, and the card skills fall back to the agent's own Linear tools. Make a key with Write permission in Linear and save it with `ocnus linear key`. | non-zero |
184
+ | `problem`, that the key can read cards but not change them | Linear refused the change for want of Write permission. `task ls`, the Cards panel and `linear read` work, but `linear type`, `linear section`, `linear slices`, `linear block` and `linear move` fail, and the card skills fall back to the agent's own Linear tools. Make a key with Write permission in Linear and save it with `ocnus linear key`. | non-zero |
174
185
  | `note`, that this was not checked, and why | Linear went out of reach, something between this machine and Linear answered for it, or Linear's answer said neither. It does not say the key cannot change cards. | not changed |
175
186
 
176
187
  The key itself is never shown.
@@ -234,11 +245,11 @@ that name, and its `CLAUDE.md` and `AGENTS.md` link to it.
234
245
  space is made: `ocnus space new <name> <path>...`. Every one is
235
246
  checked first, and a path that is not a repo stops it with nothing made.
236
247
  - **Make one in Herdr:** click the `+` at the top of the Ocnus spaces
237
- panel (on the `default` layout) and choose a repo's folder. The New space
238
- dialog suggests a name from the folder, lists the repo, and can add more.
239
- Create makes the space with `ocnus space new` and shows it; whatever
240
- the command refuses (a name in use, a folder that is not a repo) is shown
241
- in the dialog.
248
+ panel (on the `default`, `showcase` and `vibe` layouts) and choose a
249
+ repo's folder. The New space dialog suggests a name from the folder,
250
+ lists the repo, and can add more. Create makes the space with `ocnus space new` and shows it;
251
+ whatever the command refuses (a name in use, a folder that is not a repo)
252
+ is shown in the dialog.
242
253
  - **Open it:** `ocnus space open <name>` rebuilds the links and shows
243
254
  the space in Herdr, making Herdr's space for it if it is not open. Herdr's
244
255
  space has the space's folder as its folder. A Herdr space with that folder
@@ -266,7 +277,8 @@ A task is one piece of work in a space, usually a Linear card. Two
266
277
  commands make it, in this order: `task new`, then `task start`, which the
267
278
  write-up phase runs for you as soon as you approve the card. `task start`
268
279
  holds a card that a card not done yet blocks (see
269
- [Starting the work](#starting-the-work)).
280
+ [Starting the work](#starting-the-work)), and ocnus's watch starts it once
281
+ that card is done (see [The chain](#the-chain)).
270
282
  Two more, `task handoff` and `task log`, record and show how each step ended.
271
283
  `task ls` lists the cards there are to start.
272
284
 
@@ -323,8 +335,28 @@ ocnus task ls <space> [--json]
323
335
  `HTTPS_PROXY`, is still used.
324
336
  - **`--json` prints the list as one line for programs**: the space, under the
325
337
  key `space`, its teams, and each status with its `name`, its `type`
326
- (`triage`, `backlog`, `unstarted` or `started`) and its `cards`, each with an
327
- `id`, a `title` and a `url`. When it fails it prints nothing on stdout.
338
+ (`triage`, `backlog`, `unstarted` or `started`) and its `cards`. Each card
339
+ has an `id`, a `title` and a `url`, and then where it stands, which the
340
+ plain list does not show:
341
+
342
+ | Key | What it is |
343
+ |---|---|
344
+ | `parent` | The card it is a sub-issue of, as `{"id", "title", "subIssues", "done"}`, or `null` for a card with none. The parent is named whatever its status and its team: one that is done or canceled, or in a team the space does not list, is not in the list itself, and is still named here. `subIssues` is how many sub-issues the parent has, and `done` is how many of them are done. Every sub-issue counts towards `subIssues`, whatever its status and its team, a canceled one too. Only one in a completed status counts towards `done`, which is where a card is once its pull requests have merged. |
345
+ | `place` | Where the card comes among its parent's sub-issues, from 1, in the order they were made. That is the order `ocnus linear read` lists a card's sub-issues in, so the place agrees with the `slice N of M` a brief gives. It is `null` for a card with no parent, and for one that Linear's answer about the sub-issues no longer has, as when its parent changed while the list was read. With the parent's counts, a card can be shown as `place`/`subIssues`, and its parent as `done`/`subIssues` merged. |
346
+ | `blockedBy` | The cards that block it, each with its `id`, its `title` and its `status`, which is the `name` and the `type` of the status it is in: `[{"id", "title", "status": {"name", "type"}}]`, the form `linear read --json` gives them in. A blocker is listed done or not, and whatever team it is in. A card that is only related to it is not a blocker. A card nothing blocks has an empty list. |
347
+ | `held` | `true` when the card is in a not-started status, such as Todo, and a card that blocks it, or that blocks its parent, is not done. That is when `task start` holds a card (see [Starting the work](#starting-the-work)): a blocker that is canceled holds it, and one that is done does not. A card in any other status is never held, whatever blocks it. |
348
+ | `waitsOn` | For a card that is held, the blockers that are not done, its own and then its parent's, each once, in the form of `blockedBy`. Empty for a card that is not held. |
349
+ | `blockersCut` | `true` when the card may have blockers that were not read, so that `blockedBy` and `waitsOn` may not be all of them and `held` goes by the ones that were read. That is so when Linear has more than 20 relations from other cards to the card, or to the parent of a card in a not-started status, or when Linear's answer left the card or that parent out. |
350
+
351
+ To say this, `--json` asks Linear up to two more questions after the
352
+ list, each only when the list has something to ask about. The first is for
353
+ the sub-issues of every parent the cards name, all in one question. It is
354
+ read page by page to the last sub-issue, so a place or a count never stops
355
+ short. The second is for the blockers of the cards that another card is
356
+ related to, and of the parents of the cards in a not-started status, 50
357
+ cards at a time. When either fails, or cannot be read to its end, the
358
+ command fails rather than print a list without it. When it fails it prints
359
+ nothing on stdout.
328
360
  - **Two teams' cards share a group when their statuses have the same name and
329
361
  the same type**, such as a Backlog of type `backlog` in each. A status only
330
362
  one team has is a group of its own, and so is one whose name another team
@@ -367,9 +399,11 @@ ocnus task new <space> <card>
367
399
  It renames only a space or tab nobody has named, so a name you give
368
400
  stays, and asks for each name once while it runs, so one you give
369
401
  Herdr's own name again keeps it. It runs while a layout places it, and
370
- the `default` layout does, in the tab bar. The Cards panel finds a
371
- card's tab in the Herdr space whose folder is the space's, as it always
372
- has.
402
+ all three of ocnus's layouts do: `default` in the tab bar and `vibe`
403
+ beside the brand at the top of the sidebar, each in a block 1px wide,
404
+ and `showcase` in its bottom row, where it draws a note saying what it
405
+ does. The Cards panel finds a card's tab in the Herdr space whose folder
406
+ is the space's, as it always has.
373
407
  - **Closing or quitting the app stops no agent.** herdr-core keeps the
374
408
  terminal running, and opening the app again shows the tab again, in the
375
409
  same space.
@@ -394,10 +428,13 @@ ocnus task new <space> <card>
394
428
  --agent=ocnus-write-up --strict-mcp-config
395
429
  --mcp-config=<repo>/agents/linear-mcp.json --model=opus --effort=xhigh`.
396
430
  `env` keeps the two variables out, so the agent runs on your Claude
397
- subscription (see [ocnus's variables](#ocnuss-variables)). With
398
- billing on `api`, `--settings=` and an `apiKeyHelper` come after
399
- `--effort=`, and the agent runs on the Anthropic API key you saved instead
400
- (see [Billing](#billing)).
431
+ subscription (see [ocnus's variables](#ocnuss-variables)), and
432
+ `--settings=` with a `statusLine` comes after `--effort=`, which saves
433
+ the subscription's usage limits for the Usage section and records what
434
+ the agent's session uses as the card's (see
435
+ [The Usage section](#the-usage-section)). With billing on `api`, that
436
+ `--settings=` holds an `apiKeyHelper` too, and the agent runs on the
437
+ Anthropic API key you saved (see [Billing](#billing)).
401
438
  The profile gives the session only the tools the write-up phase uses, the
402
439
  MCP config gives it Linear's server alone, whatever your own sessions have,
403
440
  and the model and effort are the ones `~/.config/ocnus/settings.json`
@@ -423,6 +460,22 @@ ocnus task new <space> <card>
423
460
  runs `task start` as for your approval (see
424
461
  [The breakdown approval](#the-breakdown-approval)). Edit that file to change
425
462
  what the agent is told.
463
+ - **Breakdown records the cards a card waits on.** `sdlc-breakdown` looks
464
+ for every other card that the card, or one of its slices, needs merged
465
+ first: in the card's description, Specification and Plan, and among the
466
+ open cards of the space's teams (`task ls`), a slice of another card too.
467
+ The Breakdown names them under the slice they block, or below a card of
468
+ one piece; one the whole card needs goes on its first slice. It also
469
+ looks for cards already approved and not started, in Todo, that need this
470
+ card's work first, and the summary you approve from names both kinds.
471
+ Nothing is recorded before you approve. Once you do, before the approval
472
+ is recorded and `task start` runs, it records each with
473
+ `ocnus linear block` (see the table below): the card's own blockers on
474
+ the card, or on the slice they block, and this card, or its first slice
475
+ that the other card needs, as a blocker of each card in Todo that needs
476
+ it. Since `task start` holds a card while a card that blocks it is not
477
+ done, that keeps the work in the order it needs. `ocnus linear read`
478
+ shows a card's blockers, and the cards it blocks.
426
479
  - **Your approval moves the card.** Once you approve it, and its sub-issues
427
480
  exist when it was sliced, the agent records the approval, and recording it
428
481
  moves the card in Linear to its team's first not-started status (Todo in
@@ -444,8 +497,8 @@ ocnus task new <space> <card>
444
497
  stays in Backlog. A card that another card blocks needs no holding back,
445
498
  since `task start` holds it by itself, making nothing and leaving it in
446
499
  Todo, until every card that blocks it, or the card it was sliced from, is
447
- done; the agent tells you which cards it named, and you run `task start`
448
- once they are. The agent passes on what `task start` says still needs you,
500
+ done; the agent tells you which cards it named, and ocnus's watch starts
501
+ the card once they are (see [The chain](#the-chain)). The agent passes on what `task start` says still needs you,
449
502
  such as a repo Claude Code will ask about trusting. When `task start` stops,
450
503
  the agent does not run it again: it tells you what it said and what to run
451
504
  once that is fixed. A started task adds a `start` row under the card it
@@ -459,9 +512,10 @@ ocnus task new <space> <card>
459
512
  the write-up agent's session ends when its turn does, and its tab closes
460
513
  (see [Putting the write-up away](#putting-the-write-up-away)). So the
461
514
  agent passes on what `task start` said in the turn that ran it, and asks
462
- nothing after. When `task start` holds the card, the session stays open
463
- until you run `task start` again, from any terminal. When `task start`
464
- stops, it stays open, and the agent says what to run next.
515
+ nothing after. When `task start` holds the card, the session is put away
516
+ the same way, since the watch opens a new build tab once it starts the
517
+ card. When `task start` stops, it stays open, and the agent says what to
518
+ run next.
465
519
  - **It makes no branch, worktree or task folder.** The card has no type until
466
520
  the agent has defined it, and the type is the start of the branch name.
467
521
  - **It checks first.** An unknown space, something that is not a card ID,
@@ -478,32 +532,36 @@ ocnus task new <space> <card>
478
532
  not asked, and when Linear cannot be asked (the network, a rejected key, no
479
533
  `curl` or `jq`), the card starts as before, with a note saying why.
480
534
  - **The skills read and write the card through ocnus.** The agent reads
481
- the card with one ocnus command, and sets the type, writes each section
482
- and makes a sliced card's sub-issues with three more, so the read and the
483
- writes go the same way on every run. A fifth, which `sdlc-pr` runs once its
484
- pull requests are open, moves the card (see [Hand-offs](#hand-offs)). The
485
- agent's own Linear tools are for when ocnus cannot read or write the
486
- card, and for other reads, such as a related card:
535
+ the card with one ocnus command, and sets the type, writes each section,
536
+ makes a sliced card's sub-issues and records the cards that block a card
537
+ with four more, so the read and the writes go the same way on every run. A
538
+ sixth, which `sdlc-pr` runs once its pull requests are open, moves the
539
+ card (see [Hand-offs](#hand-offs)). The agent's own Linear tools are for
540
+ when ocnus cannot read or write the card, and for other reads, such as a
541
+ related card:
487
542
 
488
543
  | Command | What it does |
489
544
  |---|---|
490
- | `ocnus linear read <card> [--json]` | Prints the card whole: its ID and title, then its status, labels, parent and Linear project (each when it has one) and URL, the description with its sections as written, each comment with who wrote it and when, oldest first, and each sub-issue with its ID, status and title, oldest first, in the order they were made, which is the order `linear slices` makes a card's slices in. A comment an app made is the app's. Control characters become spaces, as in `task ls`, but the description and the comments keep their line breaks. `--json` prints the same as one line for programs such as a mod, with the text as Linear gave it: `{"id", "title", "url", "status": {"name", "type"}, "type", "labels", "parent": {"id", "title"}, "project": {"name"}, "description", "comments": [{"author", "createdAt", "body"}], "subIssues": [{"id", "title", "status": {"name", "type"}}]}`. `type` is the card's label in the `Type` group, `labels` the names of all its labels, and `type`, `parent` and the Linear project are `null` when the card has none. A card with more than 100 comments, 50 sub-issues or 100 labels is not printed, since what was read would pass for the whole: the command says so and exits non-zero. When it fails it prints nothing on stdout. It needs only Read permission. |
545
+ | `ocnus linear read <card> [--json]` | Prints the card whole: its ID and title, then its status, labels and parent, a line for each card that blocks it, `Blocked by: <ID> <status> <title>`, and for each card it blocks, `Blocks: <ID> <status> <title>`, done or not, then its Linear project (each when it has one) and URL, the description with its sections as written, each comment with who wrote it and when, oldest first, and each sub-issue with its ID, status and title, oldest first, in the order they were made, which is the order `linear slices` makes a card's slices in. A comment an app made is the app's. Control characters become spaces, as in `task ls`, but the description and the comments keep their line breaks. `--json` prints the same as one line for programs such as a mod, with the text as Linear gave it: `{"id", "title", "url", "status": {"name", "type"}, "type", "labels", "parent": {"id", "title"}, "blockedBy": [{"id", "title", "status": {"name", "type"}}], "blocks": [{"id", "title", "status": {"name", "type"}}], "project": {"name"}, "description", "comments": [{"author", "createdAt", "body"}], "subIssues": [{"id", "title", "status": {"name", "type"}}]}`. `type` is the card's label in the `Type` group, `labels` the names of all its labels, and `type`, `parent` and the Linear project are `null` when the card has none. `blockedBy` and `blocks` come from the card's relations of the kind blocks alone, so a card only related to another is in neither. A card with more than 100 comments, 50 sub-issues, 100 labels, or 50 relations to other cards or from them, is not printed, since what was read would pass for the whole: the command says so and exits non-zero. When it fails it prints nothing on stdout. It needs only Read permission. |
491
546
  | `ocnus linear type <card> <feat\|fix\|chore>` | Sets the card's type: its one label in the `Type` label group, the team's or else the workspace's. Any other type comes off; the card's other labels are never touched. A missing label is refused, never made. |
492
547
  | `ocnus linear section <card> <Specification\|Plan\|Breakdown\|Review> [--replace]` | Adds the section, its body on stdin, below the description. Specification, Plan and Review are folded away, in the form Linear keeps them in, `+++ ## <name>` … `+++` (one written as `>>>` is read the same); the Breakdown is left open, because you read it to approve the card. The Review, which the review step writes, comes after the Breakdown, and each later round puts its own in the last one's place with `--replace`. A section of that name already there is refused, unless `--replace` puts the new one in its place; `--replace` with none there is refused too. A body is refused when a line in it would end the section early or start a second one: a fold line, and in the Breakdown a `#` or `##` heading. A line inside a fenced code block is never taken for a section. |
493
548
  | `ocnus linear slices <card>` | Makes the card's slices, given on stdin, as its sub-issues, in order: for each slice a line `<n>. <name>`, and its description indented below it. Each is made in the card's team, with the name as its title, the description, and the card's type, its one label in the `Type` group; each but the first is marked as blocked by the slice before it. It prints a line for each slice, `Slice <n> of <total>: <ID> <name>`, saying whether it was made or was there already. A slice is there already when the card has a sub-issue with its name as its title, exactly: it is left as it is, and only its blocker is added when it lacks one. So a run that stopped partway, which says what it made and why it stopped, is finished by running it again with the same slices, and no slice is made twice. Any other sub-issue of the card is named, and left alone. It makes nothing when the slices are fewer than two, numbered out of order, of one name twice or without a description, or when the card has no type or more than one, is itself a sub-issue, has more than 50 sub-issues, or has two sub-issues of one slice's name. |
549
+ | `ocnus linear block <card> <blocker>...` | Records in Linear that each blocker given blocks the card: a relation of the kind blocks, from the blocker to the card, as `linear slices` makes between slices. Every card is read first, so an ID Linear does not have records nothing. A blocker the card has already is skipped, one given twice is recorded once, and nothing is ever removed. It prints a line for each blocker, `<card> is now blocked by <blocker>` or `<card> is blocked by <blocker> already`. A run that stopped partway says what it recorded and why it stopped, and is finished by running it again with the same cards. It records nothing when a card ID is not one, or when a blocker is the card itself. `sdlc-breakdown` runs it once the card is approved, for the cards a card or its slices depend on, and for a card in Todo that needs this one first. |
494
550
  | `ocnus linear move <card> <approved\|started\|review\|done>` | Moves the card forward to its team's first not-started status (Todo in Lab, Ready for Dev in PHY), its first started status (In Progress), its last started one (In Review), or its first completed one (Done), picked by its kind and its place in the team's order, not by its name. `approved` moves each of the card's sub-issues after it the same way, by its own team's statuses, and is the move your approval makes. For a slice, `started` and `done` move the card it was sliced from after it the same way: `started` as `task start` does, and `done` as the merge does, only once the slice is closed and every other sub-issue of that card is closed too, done, canceled or a duplicate. While any is open the parent stays where it is, and the command names the open ones, as `ABC-100 stays in In Progress: 2 of its 3 slices are still open (ABC-123, ABC-124)`, and exits zero. A parent with more than 50 sub-issues is not moved, since one it did not read may be open, and neither is the parent of a slice that was not moved. In a team with one started status, `review` is that status. A card already there, further on, done or canceled stays where it is, and the command says so and exits zero. A move that cannot be made, such as with Linear out of reach or a key without Write permission, exits non-zero, saying which card was not moved and why; the other cards still move. |
495
551
 
496
- The four that write read back what Linear saved before they say they are
552
+ The five that write read back what Linear saved before they say they are
497
553
  done: one type, the one asked for; the section there once, and the text
498
554
  above it as it was; each slice made a sub-issue of the card, with the
499
- slice's name and the card's type, and each blocker added; the card in the
500
- status it was moved to. All four need your key to have Write permission.
555
+ slice's name and the card's type, and each blocker added; each blocker
556
+ `linear block` records, from the blocker to the card; the card in the
557
+ status it was moved to. All five need your key to have Write permission.
501
558
  With no key saved, or a key Linear rejects, the skills read the card, and
502
- write the type and the sections and make the slices, with the agent's
503
- Linear tools instead, and say so in the hand-off's flags; the card is not
504
- moved then, and `sdlc-pr` says so. `sdlc-review` writes the Review with
505
- them, and `sdlc-breakdown` the Breakdown and the slices, when Linear answers
506
- the write with an error too, as it does for a key without Write permission.
559
+ write the type and the sections, make the slices and record the blockers,
560
+ with the agent's Linear tools instead, and say so in the hand-off's flags;
561
+ the card is not moved then, and `sdlc-pr` says so. `sdlc-review` writes
562
+ the Review with them, and `sdlc-breakdown` the Breakdown, the slices and
563
+ the blockers, when Linear answers the write with an error too, as it does
564
+ for a key without Write permission.
507
565
 
508
566
  ### The Cards panel
509
567
 
@@ -623,7 +681,8 @@ task with `ocnus task finish` (see
623
681
  [Finishing a task](#finishing-a-task)): its worktrees, its branch in each repo
624
682
  and its folder go, and then its tab closes. When that would lose work, it
625
683
  removes nothing, and the watch leaves the task as it is, with everything it
626
- named on the merge's flags. A pull request closed without merging finishes
684
+ named on the merge's flags. Then the watch starts the cards the merged card
685
+ was blocking that are ready (see [The chain](#the-chain)). A pull request closed without merging finishes
627
686
  nothing either: the agent asks you whether to stop. When it cannot push or open a pull
628
687
  request, such as when `gh` is not signed in or a repo has no remote, it hands
629
688
  off `failed` with the reason. `merged` is where a card ends: it is only ever
@@ -645,6 +704,13 @@ EOF
645
704
  ocnus task log <space> [<card>]
646
705
  ```
647
706
 
707
+ You see what waits on you, and answer it, with two more:
708
+
709
+ ```sh
710
+ ocnus task asks <space> [--json]
711
+ ocnus task answer <space> <card> <question> <answer>
712
+ ```
713
+
648
714
  - **The command holds the rules.** It refuses a block with a missing line, an
649
715
  unknown status or step, a line that doesn't belong to that status, or a
650
716
  value that runs onto a second line, and says what to fix. A block from an
@@ -686,7 +752,8 @@ ocnus task log <space> [<card>]
686
752
  herdr-core starting, however herdr-core was started, and a watch that died
687
753
  comes back the same way. herdr-core cannot bring it back itself: `--keep`
688
754
  puts a shell in place of a lost program and never runs it again. Each wake
689
- starts it only while a card waits on its merge and herdr-core is running:
755
+ starts it only while a card waits on its merge, or once its half-hourly
756
+ catch-up is due (see [The chain](#the-chain)), and herdr-core is running:
690
757
  it never starts herdr-core, and while one runs a second is not started.
691
758
  Every minute, it reads the store for each card, in any space, whose latest
692
759
  hand-off is `pr`
@@ -694,7 +761,10 @@ ocnus task log <space> [<card>]
694
761
  every such card in one call, with `gh api graphql`, however many cards wait
695
762
  and in however many spaces and repos (past 100 worktrees, in calls of 100).
696
763
  It names each worktree's repo by its `origin` on GitHub, and only a
697
- branch's newest pull request counts. A
764
+ branch's newest pull request counts. The same call asks whether each can
765
+ be merged and what its checks came to, which is how a pass knows that a
766
+ card is ready to merge (see
767
+ [The Step counts section](#the-step-counts-section)). A
698
768
  repo that GitHub answers with an error, or a worktree whose origin is not on
699
769
  GitHub, leaves only its own card as it is, and `task log` says why. It
700
770
  records the card's merge, as your answer
@@ -711,7 +781,10 @@ ocnus task log <space> [<card>]
711
781
  with `/exit`, as `task close`
712
782
  does, never killing it, then runs `task finish`. A task it cannot finish is
713
783
  left as it is, with `task not finished: …` on the merge's flags (see
714
- [Finishing a task](#finishing-a-task)). It runs itself again after each minute, so each check
784
+ [Finishing a task](#finishing-a-task)). Then it starts each card the merged
785
+ card was blocking that is ready, and adds each card it started, and each
786
+ one it left with why, to the merge's flags (see [The chain](#the-chain)).
787
+ It runs itself again after each minute, so each check
715
788
  runs the ocnus the machine has then, and ends once no card waits.
716
789
  `ocnus task merges --once` checks once. A worktree's copy of ocnus
717
790
  refuses it, since it records.
@@ -725,8 +798,8 @@ ocnus task log <space> [<card>]
725
798
  ask you whether to stop, as `sdlc-pr` says; with the agent exited
726
799
  and the tab's own shell in the foreground, the shell is sent
727
800
  `ocnus task build <space> <card> --continue '<message>'`, which starts
728
- `claude` again on its last session, with its build profile, model and
729
- effort. A busy agent, a program that reports no status, and a closed tab
801
+ `claude` again on the card's build session, with its build profile, model
802
+ and effort. A busy agent, a program that reports no status, and a closed tab
730
803
  get nothing: a later pass looks again. The agent then brings the pull
731
804
  request up to date, or asks you about the closed one, as `sdlc-pr` says;
732
805
  the watch records nothing and pushes nothing for it. It wakes the agent
@@ -754,6 +827,130 @@ ocnus task log <space> [<card>]
754
827
  waited on you as a line of its own, counted in no step. A question with no
755
828
  answer yet shows how long it has been waiting. A step that followed a
756
829
  question with no recorded answer is marked as including the wait.
830
+ - **`task asks` lists the questions that wait on you,** oldest first, for a
831
+ space: what a board needs to show each one as buttons. A question has one
832
+ of four kinds:
833
+
834
+ | Kind | What it is | Its options |
835
+ |---|---|---|
836
+ | `approval` | A `needs-human` hand-off of the breakdown step whose first option starts with `approve`: `sdlc-breakdown` asking you to approve the card | The skill's: `approve`, `change breakdown`, `change plan`, `change specification` |
837
+ | `merge` | A `needs-human` hand-off of the pr step whose first option is `merged`: `sdlc-pr` waiting for you to merge the card's pull requests | `merge`, in that option's place, then the skill's: `a change you want made`, `stop here` |
838
+ | `choice` | Any other `needs-human` hand-off: the agent's own list | The ones the agent recorded |
839
+ | `permission` | Claude Code asking to allow a tool, in the tab of an agent `task new` or `task build` started | `allow`, `refuse` and, when the prompt came with suggestions for it, `allow from now on` |
840
+
841
+ The first three are a card's latest hand-off, for as long as that is
842
+ `needs-human`, read from the store as `task log` reads it, and the
843
+ question's id is that row's number. So an answer the agent records, or a
844
+ newer question, makes the id stale. A permission prompt's id is `p` and
845
+ eight hex digits. Each line of the list has the card, the kind, the id and
846
+ when it was asked, then, indented, the text, a `summary:` when the agent
847
+ recorded one, `pull requests:` for a merge, and `options:`, separated by
848
+ ` | `. A question whose agent is not running ends its line with
849
+ `agent not running`. With none waiting it says so. `--json` prints one
850
+ line, `{"space": "<space>", "questions": [...]}`, the list empty when none
851
+ waits, each question with:
852
+
853
+ | Field | What it holds |
854
+ |---|---|
855
+ | `id` | The question's id, a string: what `task answer` takes |
856
+ | `card`, `kind`, `text` | The card, one of the four kinds, and what is asked. A permission prompt's text names the tool and what it would do, such as `Allow Bash to run: npm test` or `Allow Edit on the file: /repo/app.ts` |
857
+ | `options` | The options, a list of strings |
858
+ | `at`, `seconds` | When it was asked, in UTC, and how many seconds ago |
859
+ | `summary` | The summary the agent recorded with the question, or null |
860
+ | `words` | Whether it can be answered in your own words: false for a permission prompt |
861
+ | `running` | Whether the card's agent is running, in its tab: false with the tab closed, or its own shell alone in it |
862
+ | `pulls` | For a merge only: the links of its open pull requests, one in conflict among them, as ocnus's watch last saw them (`~/.config/ocnus/merges/<space>/<card>.pulls`), or before its first pass the links in the question's own text |
863
+ | `tool` | For a permission prompt only: the tool's name |
864
+
865
+ It reads the store, those files and Herdr, and changes nothing, so a
866
+ worktree's copy of ocnus runs it. It needs `sqlite3` and `jq`.
867
+ - **`task answer` answers one question,** the one the list showed under
868
+ that id, with no one typing in the agent's tab. How depends on the kind:
869
+
870
+ | Kind | An option | Your own words |
871
+ |---|---|---|
872
+ | `approval`, `choice` | Sent to the card's agent with `hc send`, as if typed in its tab | Sent the same way |
873
+ | `merge` | `merge` merges each open pull request on GitHub; any other option is sent to the agent | Sent to the agent |
874
+ | `permission` | Left for the prompt's hook, which closes the prompt with it | Refused, naming the options |
875
+
876
+ An answer sent to the agent goes to the terminal of the card's tab whose
877
+ turn has ended, the write-up phase's tab until the work starts, then the
878
+ task's. An agent still ending its turn is waited for, for 30 seconds. The
879
+ agent then records the answer itself, as when you answer in the tab, and
880
+ `task answer` records nothing. Words after the first are joined, and any
881
+ control character but a line break is refused. For `merge`, one
882
+ `gh api graphql` call asks, for the branch of each of the task's
883
+ worktrees, its newest pull request's state, GitHub's `mergeStateStatus`
884
+ for it, the commit at its head, and the repo's `viewerDefaultMergeMethod`,
885
+ the method GitHub's merge button would use for you there. Only when every
886
+ open one is `CLEAN`, `HAS_HOOKS` or `UNSTABLE` is each merged, with one
887
+ `mergePullRequest` each, by that method and only at that commit; then the
888
+ watch is woken, which records the merge and finishes the task as it does
889
+ when you merge on GitHub. One that is `DIRTY` (in conflict), `BLOCKED` (a
890
+ required check or review), `BEHIND`, a draft, closed without merging, or
891
+ not worked out yet stops it with none merged, and it names each and why.
892
+ It never forces a merge past what protects a branch and never turns on
893
+ auto-merge. A repo with no pull request on the task's branch, or one
894
+ already merged, is passed over. It exits zero only once the agent has
895
+ taken the answer (`hc` has sent it and the terminal shows the agent
896
+ working, or at a prompt it has come to since), the hook has taken the
897
+ option, or every open pull request has merged. It sends and merges
898
+ nothing, says why and exits non-zero when:
899
+
900
+ | When | What it says |
901
+ |---|---|
902
+ | The question was answered already, in the tab or by an earlier answer | that it no longer waits |
903
+ | The agent has asked another question since | the same, with the newer question's id |
904
+ | The agent is not running: its tab is closed, or holds its own shell alone | that an answer goes to a running agent. `merge` still merges |
905
+ | The agent is at a prompt in its tab, hit an error, runs a program that reports no status, or is still working after 30 seconds | which |
906
+ | `hc` refuses the send, or the agent does not start on the answer within 15 seconds | that; in the second case the text may still be in its prompt box |
907
+ | A permission prompt's terminal is no longer blocked, or its hook has gone | that it no longer waits |
908
+ | A permission prompt's hook does not take the option within 15 seconds | that the option was withdrawn, so nothing is allowed or refused later |
909
+ | It is run from inside the session of an agent ocnus started | that only you answer |
910
+
911
+ An agent's session is one whose `CLAUDE_CODE_AGENT` names one of the phase
912
+ profiles, or that has `OCNUS_SPACE` or `OCNUS_CARD`, which `task build`
913
+ sets and the env file cannot. A worktree's copy of ocnus refuses it,
914
+ as it does `task hold`.
915
+ - **A permission prompt is seen through a Claude Code hook.** `task new` and
916
+ `task build` start `claude` with a `PermissionRequest` hook for every
917
+ tool, in the one `--settings=` they give it: the command
918
+ `ocnus task hold <space> <card>`, with a week to wait. Claude Code runs
919
+ it beside the prompt, with the tool and its input on stdin, and takes the
920
+ decision it prints as the prompt's answer. The hook writes the question to
921
+ `~/.config/ocnus/asks/<space>/<card>/<id>.json`: its id, the card, when
922
+ it was asked, the tool, the text, whether the prompt came with suggestions
923
+ for allowing it from now on, its own process and its terminal, from
924
+ `HC_TERMINAL_ID`. Nothing else of what it was handed is kept, and the
925
+ file is readable by you alone, since the text copies a command. Then it
926
+ looks every second: at `hc`, for whether its terminal is still blocked,
927
+ and for an answer. `task answer` leaves the option beside the question, as
928
+ `<id>.answer`. The hook takes it, by renaming it, and prints `allow`,
929
+ `allow` with the prompt's own suggestions as `updatedPermissions`, or
930
+ `deny` with a message that you refused it, and no `interrupt`, so the
931
+ agent goes on with its turn. Once its terminal is no longer blocked, the
932
+ prompt was answered in the tab or the agent has gone: the hook ends with no
933
+ decision and removes its file. So the list shows a prompt only while its
934
+ file is there, its hook is alive and `hc` says its terminal is blocked. A
935
+ hook that was killed leaves its file, which is not listed, and the card's
936
+ next hook removes it. Whatever goes wrong, the hook prints nothing and
937
+ exits zero, which leaves the prompt in the tab as it was. It presses no
938
+ keys in the tab: a key would answer whatever prompt is there by then. What
939
+ the hook cannot see:
940
+
941
+ | Prompt | Why |
942
+ |---|---|
943
+ | `AskUserQuestion`, a question the agent asks mid-step, and `ExitPlanMode`, a plan to approve | Claude Code takes no answer to them from a hook, so the hook leaves them alone |
944
+ | Any other prompt of Claude Code's, such as a sign-in | It runs no such hook for them |
945
+ | A prompt of a harness other than `claude` | It has no such hook |
946
+ | A prompt of an agent started before the hook was given, or not by `task new` or `task build` | It has no hook until one of them starts it again |
947
+ | A prompt in a terminal that is not herdr-core's, or on a machine without `jq` or `hc` | The hook cannot ask about its terminal, so it ends at once |
948
+
949
+ `task log` still says that such an agent waits in its tab. When an agent
950
+ has two permission prompts at once, each has a hook and a question of its
951
+ own. One of them answered in the tab stays listed until the terminal is
952
+ no longer blocked, and an answer to it does nothing, since Claude Code has
953
+ closed that prompt already.
757
954
  - **It records when the setting approved a card, not you.** With the
758
955
  breakdown approval off (see [The breakdown approval](#the-breakdown-approval)),
759
956
  breakdown's `done` block with `start` next ends with `approved: setting`
@@ -779,9 +976,59 @@ ocnus task log <space> [<card>]
779
976
  - **With no card, it lists the space's cards.** `task log <space>` shows
780
977
  every card in the space that has hand-offs, newest first by its latest
781
978
  one, with where it stands (waiting on you, failed, the step it finished
782
- and the one that comes next, or merged once its pull requests have) and
783
- for how long. A card with no hand-offs is
784
- not listed: `task ls` lists the cards in Linear.
979
+ and the one that comes next, or merged once its pull requests have), for
980
+ how long, and what its agents have used in all (see below). A card with
981
+ no hand-offs is not listed: `task ls` lists the cards in Linear.
982
+ - **It says what each step's agents used,** in tokens and in dollars, from
983
+ `~/.config/ocnus/cost.db`, which each agent's status line adds to as it
984
+ works (see [The Usage section](#the-usage-section)). Under each row of a
985
+ card's log is a `tokens:` line: what its agents used in the step that row
986
+ ended, the turns after the row before it, as
987
+ `378k in (88% from cache), 42k out, ≈$1.09 at API prices`, or
988
+ `not recorded`. Then come `so far in <step>:`, what the step the card is
989
+ in has used since its latest row, and `in all:`, the card's total, which
990
+ says `not the whole card` and how many steps are not recorded when it
991
+ leaves one out. A card with nothing recorded says
992
+ `tokens: not recorded for this card` once. The list gives each card's
993
+ total after its time, as `685k tokens, ≈$1.09 at API prices`, or
994
+ `tokens not recorded`.
995
+ - **`--json` gives each of `steps` a `tokens` and a `cost`**, each null
996
+ when not recorded. `tokens` is
997
+ `{"total", "input", "output", "cache_read", "cache_write", "cache_share", "short", "text"}`:
998
+ `total` is the four added, `cache_share` the cache read over the input,
999
+ cache read and cache write together, from 0 to 1, `short` as `420k` or
1000
+ `1.2M`, and `text` as `378k in (88% from cache), 42k out`. `cost` is
1001
+ `{"usd", "spent", "kind", "text"}`: `usd` is the cost Claude Code
1002
+ reported, at API prices, `spent` the part of it from sessions on an
1003
+ Anthropic API key, `kind` `api-prices`, `spend` or `both`, and `text`
1004
+ `≈$1.09 at API prices`, `$1.09 spent on the API key`, or
1005
+ `≈$1.09 at API prices, $0.40 of it spent on the API key`. Which it is
1006
+ goes by the account each agent ran on, not by what `ocnus billing`
1007
+ says now. A step that used nothing says what the card's other steps
1008
+ say.
1009
+ - **The card's view adds `current` and `spent`.** `current` is
1010
+ `{"step", "tokens", "cost"}`: what the step the card is in has used
1011
+ since the latest row, null once the card has merged. `spent` is
1012
+ `{"tokens", "cost", "partial"}`: the rows' and `current`'s figures
1013
+ added, null when none is recorded, with `partial` true when a row or
1014
+ `current` is not recorded. The rows and `current` add up to `spent`, in
1015
+ tokens and in millionths of a dollar. Each of the list's `cards` has
1016
+ `tokens`, `cost` and `partial`, that same total, from one query for the
1017
+ space.
1018
+ - **Which rows are recorded.** A row's figures are recorded when a session
1019
+ of its phase had its first reading in the row's run and no later than
1020
+ the row: the build phase's for `build`, `review` and `pr` rows, the
1021
+ write-up phase's for `define`, `plan` and `breakdown` rows. A `new` or
1022
+ `start` row goes by the row after it. So a step whose agent ran before
1023
+ this version shows as not recorded, never as 0. The write-up agent's
1024
+ turns after `task start` has recorded its row count on that row, and the
1025
+ build phase's agent's turns after its merge is recorded count on the
1026
+ merge's row.
1027
+ - **The figures stay.** They are sums, by session, by the hand-off each
1028
+ turn came after, by day and by account, so they are still given once
1029
+ the card has merged, its task is finished and Claude Code no longer
1030
+ keeps the session's transcript. `task log` attaches the file read-only,
1031
+ in a worktree's copy too, and without it every row is not recorded.
785
1032
  - **It says when a card's agent is stuck or has stopped,** with the Herdr
786
1033
  app open or closed. A card's agent is the one running its current phase.
787
1034
  That is the write-up phase, in the tab named after the card, until the
@@ -817,12 +1064,19 @@ ocnus task log <space> [<card>]
817
1064
  before. `task log` learns what ocnus's watch saw from the files
818
1065
  each pass leaves: `~/.config/ocnus/merges/.alive`, the time its
819
1066
  latest pass began, and `~/.config/ocnus/merges/<space>/<card>`, the
820
- time and what it saw of the card's pull requests. Beside them, a pass
1067
+ time and what it saw of the card's pull requests: `closed` or `conflict`
1068
+ with each such pull request's URL, `failed` and why GitHub could not be
1069
+ asked, `ready` once every one of them is open and ready to merge, `open`
1070
+ while one is open and that does not hold, `merged`, or `none`. For `task
1071
+ asks`, a pass also keeps each pull request it saw, a line each, its state
1072
+ then its link, in `~/.config/ocnus/merges/<space>/<card>.pulls`, which
1073
+ goes with the others once the card no longer waits. Beside them, a pass
821
1074
  whose call to GitHub failed leaves `~/.config/ocnus/merges/.gh`, for
822
1075
  `ocnus status`: the time, `sign-in` when `gh` needs signing in or else
823
1076
  `failed`, and `gh`'s words. The next pass whose call works, or that asks
824
1077
  GitHub nothing, removes it, and it goes with the others once no card
825
- waits. A watch that has not
1078
+ waits. `~/.config/ocnus/merges/.ready`, the time the watch's last
1079
+ catch-up began, stays. A watch that has not
826
1080
  begun a pass in the last 3 minutes is not running, and what it saw longer
827
1081
  ago than that is not counted. For 15 seconds after `task new` or `task start`
828
1082
  records its start the agent is still starting, so it is not yet called
@@ -838,12 +1092,80 @@ ocnus task log <space> [<card>]
838
1092
  when closed), its `label`, `for`, `seconds` and `pulls`: the URLs of the
839
1093
  pull requests its label names, an empty list for any state but `closed`
840
1094
  and `conflict`. The card's own `state`, `for` and `seconds` keep
841
- their meaning. None of it is stored: it is read from Herdr and those
1095
+ their meaning. With no card, `--json` gives `counts` too, beside `cards`:
1096
+ the seven steps in order, each with its `step`, its `count`, how many
1097
+ cards stand on it, its `marks`, one for each of those cards (`stuck`,
1098
+ `needs-human`, `ready` or `working`, most urgent first, and none at
1099
+ `start`), and its `text`, the count as the Step counts section shows it,
1100
+ such as `2 held` at `start` (see
1101
+ [The Step counts section](#the-step-counts-section)). None of it is
1102
+ stored: it is read from Herdr and those
842
1103
  files each time, and no row or step's time changes with it. With `jq`
843
1104
  missing, every card shows as before. With `hc` missing, or with neither
844
1105
  herdr-core able to list its terminals nor the app open and able to list
845
1106
  its tabs, every card shows as before but one whose pull requests wait on
846
1107
  you, for which no agent is running then.
1108
+ - **It records each agent's Claude Code session.** `task new` and
1109
+ `task build` choose the ID of the session they start `claude` in, give it
1110
+ as `--session-id=<ID>`, the last flag before the first message, and record
1111
+ it, with the card, its phase (`write-up` or `build`) and the harness, in
1112
+ the store's `sessions` table, which the first such start makes. A build
1113
+ agent started again gets a session of its own, and a row. Another harness
1114
+ gets no flag, and its row has no session. A session that cannot be recorded,
1115
+ with no `sqlite3` or a store that cannot be written, is a note, and the
1116
+ agent starts all the same. `task build --continue` continues the card's
1117
+ newest build session by its ID, with `--resume=<ID>`, while Claude Code
1118
+ keeps its transcript, and records no row; with none recorded it is given
1119
+ `--continue`, as before. `task log <space> <card> --json` gives the card's
1120
+ `sessions`, oldest first, each with its `session` ID, its `phase` and `at`,
1121
+ when it was started, for the rows that have a session: `[]` for a card
1122
+ with none, with no store, and for a store made before sessions were, which
1123
+ `task log` leaves as it is. The list with no card has none.
1124
+ - **`task brief` gives the brief of a card's agent, without a word to it.**
1125
+
1126
+ ```sh
1127
+ ocnus task brief <space> <card> [--json] [--refresh]
1128
+ ```
1129
+
1130
+ The card's newest session, its latest row in `sessions`, is the agent's:
1131
+ `claude` makes the brief in a copy of it, as
1132
+ `claude -p --resume=<ID> --fork-session --no-session-persistence --tools= --strict-mcp-config --model=haiku --effort=low --output-format=json`,
1133
+ run in the space's folder, where it finds the session whatever folder the
1134
+ agent ran in, the task's included once `task finish` has removed it. The
1135
+ copy is a session of its own that is never saved, with no tools and no MCP
1136
+ servers, so the agent's transcript and its tab are left as they were. Its
1137
+ prompt, on stdin, starts `/brief ocnus task brief <space> <card>`, which
1138
+ the `brief` skill's section for such a copy reads, then what the agent
1139
+ would read for a brief in its tab, read by ocnus: `task log <space>
1140
+ <card>`, `ocnus linear read` for the card and for its parent, and
1141
+ `git log --oneline <default branch>..HEAD` in each of the task's
1142
+ worktrees while its folder is there. A part that cannot be read says why,
1143
+ and the brief is still made. `claude` starts as the agents do, without
1144
+ `ANTHROPIC_API_KEY` and `ANTHROPIC_AUTH_TOKEN`, with the `apiKeyHelper` on
1145
+ `api` (see [Billing](#billing)), and without the variables of a Claude Code
1146
+ session that ran the command. `OCNUS_BRIEF_MODEL` names another model.
1147
+ ocnus takes the text after `**Task:**`, `**So far:**` and `**Now:**` out
1148
+ of the answer, each part one line, and drops what comes before Task and
1149
+ after Now's line, such as the agent's question asked again. It keeps the
1150
+ card's last brief in the store's `briefs` table, with the hand-off and the
1151
+ session it was made at, and gives it again, with no model call, until the
1152
+ card has another hand-off or another agent, or `--refresh` is given; a
1153
+ brief that cannot be kept is still given, with a note. In words it prints
1154
+ a line naming the card, its agent's phase, when the brief was made and
1155
+ whether it is the kept one, then `Task:`, `So far:` and `Now:`, a line
1156
+ each. `--json` prints one line, with `space`, `card`, `phase` (`write-up`
1157
+ or `build`), `session`, the session's ID, `at`, when the brief was made, in
1158
+ UTC as `task log --json` gives times, `kept`, true for the kept brief,
1159
+ `task`, `so_far`, `now` and `why`. With no brief, `task`, `so_far`, `now`
1160
+ and `at` are null, `why` says why, and the command exits 1, as it does in
1161
+ words, with the reason on stderr: no session of the card's agent is
1162
+ recorded, its agent runs in another harness, Claude Code no longer keeps
1163
+ the session's transcript, the `brief` skill is not installed, billing is on
1164
+ `api` with no key saved, `OCNUS_BRIEF_MODEL` is not a model, or Claude Code
1165
+ could not make it, when `claude` exits non-zero, marks its answer as an
1166
+ error or gives no brief with all three parts, with what it said. Each of
1167
+ them but the last is found before any model call. A worktree's copy of
1168
+ ocnus refuses `task brief`, since it is a model call and keeps the brief.
847
1169
  - **They are kept in `~/.config/ocnus/ocnus.db`,** a SQLite file
848
1170
  beside your spaces, on this machine only, each one with its space. It
849
1171
  needs `sqlite3`, which macOS ships; `OCNUS_SQLITE` picks another
@@ -875,6 +1197,86 @@ ocnus task log <space> [<card>]
875
1197
  tab opens, closes or is renamed, or one of its terminals reports another
876
1198
  status. They also read it again every 6 seconds.
877
1199
 
1200
+ ### The Step counts section
1201
+
1202
+ On the `default` layout, the Step counts section sits in the sidebar right
1203
+ above Usage, under a line like the one above Usage, and is about as small:
1204
+ how many cards are at each step in the space that is showing, and how each
1205
+ card's agent is doing, so you can see where the work stands, and what needs
1206
+ you, without opening a tab.
1207
+
1208
+ - **Seven rows, one for each step**, in two columns: `define`, `plan`,
1209
+ `breakdown` and `start`, then `build`, `review` and `pr`. A row has a dot
1210
+ for each card that stands on its step, and how many there are: `0`, with
1211
+ no dots, when there are none.
1212
+ - **A card stands where `ocnus task log <space>` has it**: on the step
1213
+ that comes next after one that is done, or on the step that is asking
1214
+ while it waits on you; and so on the step that was answered, or that
1215
+ failed. Each card is counted once. A card whose pull requests have merged
1216
+ is on no row, and neither is a card with no hand-offs.
1217
+ - **A dot's colour says how its card is doing:**
1218
+
1219
+ | Colour | The card |
1220
+ |---|---|
1221
+ | Amber | Needs you: it is waiting on you, or its agent is blocked on a prompt in its tab |
1222
+ | Blue | Its agent is working: its step is under way |
1223
+ | Green | Is ready to merge, at `pr`: its pull requests are all open, none is in conflict, and every check on them has passed |
1224
+ | Red | `task log` says its agent is stuck or has stopped: it hit an error, stopped without handing off or is not running, or a pull request of the card's is closed, in conflict or unwatched. A card whose step failed is red too |
1225
+
1226
+ The first of these that holds gives the colour: an agent blocked on a
1227
+ prompt is amber, whatever else holds; any other state `task log` gives
1228
+ the agent (see [Hand-offs](#hand-offs)), or a step that failed, is red; a
1229
+ card waiting on you is green when it is ready to merge and amber
1230
+ otherwise; and anything else is blue. A row's dots come most urgent
1231
+ first: red, amber, green, then blue.
1232
+ - **Green takes the place of amber at `pr`.** A card whose pull requests
1233
+ wait on you to merge them is amber until they are ready, and green once
1234
+ they are. ocnus's watch on the merges asks GitHub about them once a
1235
+ minute, so a card turns green within about a minute of its last check
1236
+ passing, and amber again within a minute of a new commit whose checks are
1237
+ running. A pull request with no checks, as in a repo that has none, has
1238
+ nothing to wait for and counts as passed. A review that the repo's rules
1239
+ ask for is not a check, so green does not say that GitHub will let you
1240
+ merge. The card is amber while a check is running or has failed, while
1241
+ GitHub has not yet said whether a pull request can be merged, once one of
1242
+ several has merged, and when the watch has not seen the card in the last 3
1243
+ minutes. It stays amber, too, when GitHub will not say what a pull
1244
+ request's checks came to, as when `gh`'s token may not read them.
1245
+ - **`start` has no dots**, since no agent runs that step. Its row says how
1246
+ many cards are held there, as `2 held`: approved, with their work not yet
1247
+ started. `task start` has recorded no start for them, as while a card that
1248
+ blocks one is not done yet (see [Starting the work](#starting-the-work)).
1249
+ Once it records the start, the card is on `build`.
1250
+ - **A row with more dots than fit** shows the ones that fit and `+N` for the
1251
+ rest. Its count still says how many there are in all.
1252
+ - **It updates on its own** while Herdr's window is visible, with no click
1253
+ or restart. It looks at Herdr's tabs in the space every 2 seconds, and
1254
+ reads the counts again as soon as a tab opens, closes or is renamed, or
1255
+ one of its terminals reports another status: a change in an agent's state
1256
+ shows within 5 seconds, as in the Cards and Steps panels. It also reads
1257
+ them again every 6 seconds, so a card's move to another step shows within
1258
+ 10.
1259
+ - **One line stands in place of the rows** when the space that is showing is
1260
+ not an ocnus space, when the counts cannot be read, in which case it is
1261
+ what `ocnus` said, and when the `ocnus` on the machine is too old to give
1262
+ them. A read that failed is tried again. The rest of the sidebar works as
1263
+ before. On the sidebar's rail, the section draws only its line.
1264
+ - **It works nothing out itself.** It draws the `counts` that
1265
+ `ocnus task log <space> --json` prints, so the section and `task log`
1266
+ always agree. When `ocnus` is not on Herdr's `PATH`, it runs the copy the
1267
+ mod is linked from. Each entry of `counts` is a step: its name, how many
1268
+ cards stand on it, a mark for each of them, and the text to show:
1269
+
1270
+ ```
1271
+ "counts":[{"step":"define","count":0,"marks":[],"text":"0"},…,{"step":"start","count":2,"marks":[],"text":"2 held"},{"step":"build","count":3,"marks":["stuck","needs-human","working"],"text":"3"},…]
1272
+ ```
1273
+
1274
+ A mark is `stuck`, which shows red, `needs-human`, amber, `ready`, green,
1275
+ or `working`, blue.
1276
+ - **It needs `jq` to say how an agent is doing.** Without it, `task log`
1277
+ reads no agent and no pull request, so a card is amber when it waits on
1278
+ you, red when its step failed, and blue otherwise.
1279
+
878
1280
  ### Starting the work
879
1281
 
880
1282
  One branch for an approved card, checked out as a git worktree of the repos
@@ -928,10 +1330,13 @@ ocnus task start <space> <card> [--type <type> --title <title>] [<repo>[:<group>
928
1330
  ocnus: ABC-122 is held: a card that blocks it is not done yet, so no task was made for it.
929
1331
  blocker ABC-121, in In Progress, blocks ABC-122
930
1332
  blocker ABC-90, in Todo, blocks ABC-100, the card ABC-122 was sliced from
931
- ABC-122 stays in Todo. Run this again once the cards that block it are done.
1333
+ ABC-122 stays in Todo. ocnus's watch starts it once the cards that block it are done.
932
1334
  ```
933
1335
 
934
- Run it again once they are done: it then starts the card as usual. A card
1336
+ ocnus's watch starts the card once they are done (see
1337
+ [The chain](#the-chain)); with the chain off, the last line says so, and
1338
+ to run `task start` again then. It puts the card's write-up session away
1339
+ too (see [Putting the write-up away](#putting-the-write-up-away)). A card
935
1340
  that is only related to another, or a blocker that is done, holds nothing.
936
1341
  When Linear is not asked, because the type and title are given and no key
937
1342
  is saved or Linear cannot be asked, the card starts with a note that its
@@ -1023,11 +1428,14 @@ ocnus task start <space> <card> [--type <type> --title <title>] [<repo>[:<group>
1023
1428
  refuses to run outside the card's own task folder, with no harness on your
1024
1429
  `PATH`, with the skills not linked, or, for `claude`, with the build phase
1025
1430
  profile not linked or a settings file that is not valid settings. If the agent stops, run the same command again in the
1026
- tab. `task build <space> <card> --continue <message>` continues `claude`'s
1027
- last session in the task instead, with the message, after the build
1028
- profile's flags: ocnus's watch types it into the tab's shell to wake an
1029
- agent that has exited, so that it comes back with its profile, model and
1030
- effort, which a bare `claude --continue` would lose. Another harness
1431
+ tab. `task build <space> <card> --continue <message>` continues the card's
1432
+ build session instead, with the message, after the build profile's flags.
1433
+ That is the session of the build agent it started last, by the ID it gave
1434
+ `claude`, with `--resume=<ID>`, or `claude`'s last session in the task,
1435
+ with `--continue`, when none is recorded or Claude Code no longer keeps its
1436
+ transcript (see [Hand-offs](#hand-offs)). ocnus's watch types it into the
1437
+ tab's shell to wake an agent that has exited, so that it comes back with its
1438
+ profile, model and effort, which a bare `claude --continue` would lose. Another harness
1031
1439
  refuses `--continue`, starting nothing.
1032
1440
  - **The card moves to In Progress.** Once the tab is open, `task start` moves
1033
1441
  the card in Linear to its team's first started status: picked by its kind
@@ -1087,7 +1495,10 @@ ocnus task start <space> <card> [--type <type> --title <title>] [<repo>[:<group>
1087
1495
  ### Putting the write-up away
1088
1496
 
1089
1497
  Once a card's build phase has started, its write-up session has nothing left
1090
- to do. One command ends it and closes its tab. `task start` runs it itself, so
1498
+ to do. Nor has it once `task start` has held the card for a card that blocks
1499
+ it: all there is to know of a held card is in Linear, its status and its
1500
+ blockers, and the watch opens a new build tab once it starts the card. One
1501
+ command ends the session and closes its tab. `task start` runs it itself, so
1091
1502
  you run it only for a write-up session it left open.
1092
1503
 
1093
1504
  ```sh
@@ -1097,7 +1508,9 @@ ocnus task close <space> <card>
1097
1508
  - **`task start` runs it detached**, as
1098
1509
  `hc run --bg --no-parent --rm --name ocnus-close-<card> -- ocnus task close <space> <card>`,
1099
1510
  with the card in lower case in the name, as `ocnus-close-abc-122`, in
1100
- the space's folder, once the build tab is open. Its terminal has none of
1511
+ the space's folder, once the build tab is open, or once it has held the
1512
+ card and said so. A `task start` that stops for any other reason starts
1513
+ none. Its terminal has none of
1101
1514
  ocnus's or Herdr's labels, so the Herdr app shows no tab for it and
1102
1515
  `host` counts no agent for it, and `--rm` removes it once it has ended. It
1103
1516
  is not a child of the tab it was started from, so it goes on when that tab
@@ -1206,6 +1619,12 @@ ocnus task finish <space> <card>
1206
1619
  removed with the worktree without a word. Without `just`, or in a repo with
1207
1620
  no `made-by-setup` recipe, every ignored file counts as work, and it says
1208
1621
  why.
1622
+ - **What gpui-shell writes into a mod's folder goes too**, in any repo, with
1623
+ or without `just`: each ignored `gpui-kit.d.ts`, which gpui-shell rewrites
1624
+ on every run, and an ignored `jsconfig.json` while it is still the one
1625
+ gpui-shell wrote, saying so, with a `gpui-kit.d.ts` beside it. gpui-shell
1626
+ writes that one only once and leaves it to you after, so a `jsconfig.json`
1627
+ you wrote or changed is still counted as work.
1209
1628
  - **It forces nothing.** `git worktree remove` keeps git's own refusal, and
1210
1629
  the branch is deleted only while it is still on the commit that was
1211
1630
  checked.
@@ -1215,6 +1634,92 @@ ocnus task finish <space> <card>
1215
1634
  `git worktree remove --force <space folder>/tasks/<task>/<repo>` and
1216
1635
  `git branch -D <branch>`, then delete the task's folder and close its tab.
1217
1636
 
1637
+ ### The chain
1638
+
1639
+ A card that `task start` held starts by itself once the cards that block it
1640
+ are done: ocnus's watch starts it, with `task start`, as you would, so you
1641
+ do not come back for it. That is the chain. It is on until you turn it off
1642
+ (see [Starting blocked cards](#starting-blocked-cards)).
1643
+
1644
+ ```sh
1645
+ ocnus task ready <space>
1646
+ ```
1647
+
1648
+ - **At a merge, the watch starts the cards the merge frees.** Once it has
1649
+ recorded a card's merge and finished its task (see [Hand-offs](#hand-offs)),
1650
+ it asks Linear once for the cards that card was blocking: the ones its
1651
+ relations of the kind blocks name. When the merge closed the card it was
1652
+ sliced from, as the merge of a card's last open slice does, the cards that
1653
+ card was blocking come with them. It runs
1654
+ `ocnus task start <space> <card>` for each one that is ready.
1655
+ - **A card is ready when four things hold.** It is in a not-started status,
1656
+ where your approval puts it (Todo in Lab, Ready for Dev in PHY), so a card
1657
+ in Backlog is never started. Its team is in a space's teams. Its
1658
+ description has a Specification and a Plan, as `ocnus linear section`
1659
+ writes them; a heading inside a code block does not count. And every card
1660
+ that blocks it, or the card it was sliced from, is in a completed status: a
1661
+ canceled blocker still holds it. A card under another parent card is ready
1662
+ by the same four.
1663
+ - **A sliced card starts through a slice.** A ready card that has sub-issues
1664
+ starts through the first one, in the order they were made, that is not
1665
+ started, done or canceled, as breakdown picks one. That slice has to be
1666
+ approved, with a Specification and a Plan of its own, and `task start`
1667
+ still holds it while a card that blocks it is not done. A slice that waits
1668
+ in its own right is judged as a card of its own, so the watch runs no
1669
+ `task start` for one it can see is not ready.
1670
+ - **It starts in the space of its team**: the merged card's own space when
1671
+ that space's teams hold the card's team, or else the one space that lists
1672
+ the team. A card whose team more than one other space lists is left, since
1673
+ the watch cannot tell which one you mean.
1674
+ - **It starts from what is merged.** `task start` fetches each repo and cuts
1675
+ the branch from its default branch on `origin`, so the card starts from
1676
+ the default branches as they are after the merge. There is no limit on how
1677
+ many cards start at once.
1678
+ - **`task log` shows what it started and what it left.** Each card started,
1679
+ and each card left, with why, goes on the merge's flags, in Linear's order:
1680
+
1681
+ ```
1682
+ flags: ABC-123 was started; ABC-131 was started, the first open slice of ABC-130; ABC-124 was not started: ABC-121, in In Review, still blocks it; ABC-125 was not started: it has no Plan
1683
+ ```
1684
+
1685
+ A card that is started, done or canceled already does not wait, so it is
1686
+ not named. The flags hold 2,000 characters, and end with `...` when there
1687
+ was more to say.
1688
+ - **What it cannot be sure of, it leaves, and says so.** A card with more
1689
+ than 20 relations in Linear, or whose parent has, may have a blocker that
1690
+ was not read, and a card with more than 20 sub-issues a slice that was not
1691
+ read. A card that has a task in the space already, or whose merge is
1692
+ recorded there, is not started again, whatever Linear says of it. A
1693
+ `task start` that stops is named with what it said. When the merged card
1694
+ has more than 10 relations of its own, the flags say that some cards were
1695
+ not looked at, and when Linear cannot be asked, that none were looked for.
1696
+ None of this stops the merge from being recorded.
1697
+ - **The catch-up starts what a merge missed.** A start is missed when `task
1698
+ start` stopped, Linear could not be asked, the chain was off, or the last
1699
+ blocker was closed with no merge to see, such as by hand in Linear.
1700
+ `ocnus task ready <space>` asks Linear for the cards of the space's
1701
+ teams that are in a not-started status, 20 to a question, with their
1702
+ blockers, and starts each one that is ready, by the same rules, in
1703
+ that space. It prints a line for each card started and each card left,
1704
+ with why, and exits non-zero when a card that was ready could not be
1705
+ started. It needs herdr-core, a team for the space and a Linear key, and
1706
+ says which is missing.
1707
+ - **The watch runs the catch-up every half hour.** Each pass runs it for
1708
+ every space that has a team once its last one began 30 minutes ago or
1709
+ more, which `~/.config/ocnus/merges/.ready` says. So Linear is asked
1710
+ once for each space each half hour, while no more than 20 of its cards
1711
+ wait, not each minute, and a ready card
1712
+ starts within about half an hour, whatever freed it. With no card waiting
1713
+ on its merge, the launchd agent's wake starts the watch for a catch-up
1714
+ that is due, and the watch ends once it has run it. The watch names no
1715
+ space, so it leaves a card whose team more than one space lists. What it
1716
+ found is in its terminal, which `hc attach ocnus-merges` shows while it
1717
+ runs, and is recorded nowhere: a card that starts records its own start.
1718
+ - **With no Linear key saved, the watch looks for no card**, at a merge or at
1719
+ the catch-up, and says nothing of it.
1720
+ - **A worktree's copy of ocnus refuses `task ready`**, since it starts
1721
+ cards.
1722
+
1218
1723
  ## Agent settings
1219
1724
 
1220
1725
  Each of the four profiles, the two phase profiles and the two dev profiles,
@@ -1289,17 +1794,21 @@ room and drag the window as before, then the settings button at the right end.
1289
1794
  Picking one runs `ocnus profile set`, then reads the profiles again, so
1290
1795
  the popup shows what the file now holds and `ocnus profile ls` agrees.
1291
1796
  The next `task new` or `task build` starts with it.
1292
- - **Below the profiles, a row for each of four settings**, each with its
1797
+ - **Below the profiles, a row for each of five settings**, each with its
1293
1798
  two values and the one it is set to marked: the breakdown approval, on or
1294
- off ([The breakdown approval](#the-breakdown-approval)), archiving, on or off
1799
+ off ([The breakdown approval](#the-breakdown-approval)), Start blocked
1800
+ cards, which is the chain, on or off
1801
+ ([Starting blocked cards](#starting-blocked-cards)), archiving, on or off
1295
1802
  ([Archiving merged cards](#archiving-merged-cards)), test runs, share or
1296
1803
  queue ([Test runs one at a time](#test-runs-one-at-a-time)), and billing,
1297
1804
  subscription or API key ([Billing](#billing)). With nothing in the settings
1298
- file, they show the defaults: the approval on, archiving off, the test runs
1299
- sharing and billing on the subscription. Hover a name to see what it does.
1805
+ file, they show the defaults: the approval on, the chain on, archiving off,
1806
+ the test runs sharing and billing on the subscription. Hover a name to see
1807
+ what it does.
1300
1808
  - **A click on the value a setting is not set to sets it**, with
1301
- `ocnus approval --breakdown on|off`, `ocnus linear archive on|off`,
1302
- `ocnus tests share|queue` or `ocnus billing subscription|api`.
1809
+ `ocnus approval --breakdown on|off`, `ocnus chain on|off`,
1810
+ `ocnus linear archive on|off`, `ocnus tests share|queue` or
1811
+ `ocnus billing subscription|api`.
1303
1812
  Then the popup reads the profiles and the settings again, all at once, so
1304
1813
  it shows what the file now holds, and the command says the same. The rest
1305
1814
  of the file stays as it was.
@@ -1309,9 +1818,10 @@ room and drag the window as before, then the settings button at the right end.
1309
1818
  read shows neither value, and cannot be clicked.
1310
1819
  - **It works nothing out itself.** The profiles, their values and the choices
1311
1820
  come from `ocnus profile ls --json`, and a change is made with
1312
- `ocnus profile set`. The four settings come from
1313
- `ocnus approval --json`, `ocnus linear archive --json`,
1314
- `ocnus tests --json` and `ocnus billing --json`, and are set with
1821
+ `ocnus profile set`. The five settings come from
1822
+ `ocnus approval --json`, `ocnus chain --json`,
1823
+ `ocnus linear archive --json`, `ocnus tests --json` and
1824
+ `ocnus billing --json`, and are set with
1315
1825
  those commands. The mod reads no file, so the button and the command
1316
1826
  always agree. When `ocnus` is not on Herdr's `PATH`, it runs the copy
1317
1827
  the mod is linked from.
@@ -1382,6 +1892,7 @@ processors, as `"tests": "share"` or `"queue"` beside `"profiles"`.
1382
1892
 
1383
1893
  ```sh
1384
1894
  ocnus tests [share|queue|--json]
1895
+ ocnus tests ls [--json]
1385
1896
  ```
1386
1897
 
1387
1898
  - **They share until you choose otherwise.** With no `"tests"` in the file,
@@ -1413,11 +1924,45 @@ ocnus tests [share|queue|--json]
1413
1924
  is already going, or waiting, keeps to what it started with. A run that
1414
1925
  does not find `"queue"` there, with no file, no `jq` or a file that is not
1415
1926
  valid settings, shares.
1927
+ - **`tests ls` lists the runs going**, from `test-runs` in
1928
+ `~/.config/ocnus`, in the order they started, which is the order the
1929
+ waiting ones get their turns, under the setting's sentence as `tests` says
1930
+ it. A line names its run's card, such as `LAB-241`, when the run was
1931
+ started in a task's folder, in a worktree there or in the folder itself,
1932
+ and its folder's name otherwise, such as `ocnus` for a clone. Then it says
1933
+ how the run is going, in one of four words: `sharing` the processors,
1934
+ `waiting` its turn, `its turn`, for the first run going with `queue`,
1935
+ which has the processors, or `OCNUS_TEST_JOBS`, for a run with that set.
1936
+ Last come how long ago the run started, its wait for a turn included, such
1937
+ as `13m 02s ago`, and how many processors it holds now out of the
1938
+ machine's, such as `5/10 processors`: one for each case it has going, so a
1939
+ run with `OCNUS_TEST_JOBS` set can hold more than there are.
1940
+ - **`old mode` marks a run started before the switch** that still goes the
1941
+ way it started, since a run reads the setting only as it starts. With
1942
+ `queue`, it is a run sharing the processors, or running with
1943
+ `OCNUS_TEST_JOBS`, beside a run that started before it; with `share`, a run
1944
+ still waiting its turn. A run that waited its turn under `queue` and now
1945
+ has the processors reads `its turn`, and is not marked. The mark changes
1946
+ nothing: it says why a run still shares, or waits, after the switch.
1947
+ - **With no run going, `tests ls` says so in one line**, with the setting's
1948
+ sentence. A run whose process has gone, as after `kill -9`, has no line,
1949
+ and its entry stays in the pool until a test run removes it: `tests ls`
1950
+ only reads. When it cannot read the settings or the pool, or has no `jq`,
1951
+ it says why in one line, as `tests` does, and exits non-zero.
1952
+ - **`tests ls --json` prints the same as one line** for programs:
1953
+ `{"file":"…/settings.json","tests":"queue","cpus":10,"note":null,"runs":[…]}`,
1954
+ with `note` `"No test runs going"` when there are none. Each run is
1955
+ `{"number","pid","name","card","folder","state","doing","mark","tip","age","slots","holds"}`:
1956
+ `card` is null outside a task, `state` is `share`, `wait`, `jobs` or
1957
+ `turn`, and `doing` gives its words, `mark` is `"old mode"` or null, and
1958
+ `tip` says what the mark means, `age` is how long ago the run started, as
1959
+ text, and `holds` is its `slots` out of `cpus`, such as `"5/10"`.
1416
1960
  - **In Herdr, the settings button shows it and switches it** between share
1417
1961
  and queue with a click, through these commands (see
1418
1962
  [The settings button](#the-settings-button)).
1419
- - **In a worktree**, `./cli/ocnus tests`, alone or with `--json`, reads as
1420
- the installed copy does; `share`, `queue` and `run` are refused.
1963
+ - **In a worktree**, `./cli/ocnus tests` and `./cli/ocnus tests ls`, each
1964
+ alone or with `--json`, read as the installed copy does; `share`, `queue`
1965
+ and `run` are refused.
1421
1966
  - **`tests run <command>` is something else**: it runs a test command,
1422
1967
  whole suite or part, in any repo, and records the test run in the host's
1423
1968
  readings while recording is on (see [Recording the host](#recording-the-host)).
@@ -1515,11 +2060,14 @@ ocnus billing key
1515
2060
  `tests`, `approval`, `task new`, `task build` and `ocnus status` all
1516
2061
  say.
1517
2062
  - **On `api`, the agent runs on the saved key.** `claude` starts with
1518
- `--settings={"apiKeyHelper":"OCNUS_HOME='…' '<repo>/cli/ocnus'
1519
- billing key --print"}` after its profile's flags. Claude Code runs that
1520
- command to get the key, and takes a key from it ahead of the `/login`
1521
- sign-in, so its `/status` shows the API key, and it starts without asking
1522
- whether to use it. The key is in no argument given to `claude`, `hc` or
2063
+ `--settings={"hooks":{…},"apiKeyHelper":"OCNUS_HOME='…' '<repo>/cli/ocnus'
2064
+ billing key --print","statusLine":{…}}` after its profile's flags: one
2065
+ `--settings=` holds the helper, the `statusLine` (see
2066
+ [The Usage section](#the-usage-section)) and the hooks: the one behind
2067
+ the agent's permission prompts and, while the host is recorded, those
2068
+ that mark its time. Claude Code runs the helper to get the key, and
2069
+ takes a key from it ahead of the `/login` sign-in, so its `/status` shows
2070
+ the API key, and it starts without asking whether to use it. The key is in no argument given to `claude`, `hc` or
1523
2071
  `herdr-app`, and in no agent's environment: `billing key --print` prints it
1524
2072
  to Claude Code alone, read from the env file. `env` still keeps an exported
1525
2073
  `ANTHROPIC_API_KEY` or `ANTHROPIC_AUTH_TOKEN` out, since either would come
@@ -1529,6 +2077,8 @@ ocnus billing key
1529
2077
  - **A change reaches the next agent started.** One already running keeps the
1530
2078
  account it started on: the helper prints the saved key whatever is set when
1531
2079
  Claude Code asks, and an agent started on the subscription has no helper.
2080
+ What its session uses is recorded as on the account it started on, so
2081
+ `task log` says which each cost is: at API prices, or spent on the key.
1532
2082
  - **The profiles' model and effort hold either way.** The
1533
2083
  `ocnus-reviewer` and `ocnus-verifier` subagents bill as the session
1534
2084
  they run in. Another harness, named by `OCNUS_HARNESS`, starts as it
@@ -1550,6 +2100,119 @@ ocnus billing key
1550
2100
  as the installed copy does; `api`, `subscription`, `key` and `key --print`
1551
2101
  are refused.
1552
2102
 
2103
+ ### Starting blocked cards
2104
+
2105
+ The settings file also says whether the chain is on, as `"chain": true` or
2106
+ `false` beside `"profiles"`: whether ocnus's watch starts each card once
2107
+ the cards that block it are done (see [The chain](#the-chain)).
2108
+
2109
+ ```sh
2110
+ ocnus chain [on|off|--json]
2111
+ ```
2112
+
2113
+ - **It is on until you turn it off.** With no `"chain"` in the file, or no
2114
+ file, it is on, and `install` and `update` never write one.
2115
+ - **`chain` says whether it is on.** `--json` prints the same as one line for
2116
+ programs, with the file it is kept in:
2117
+ `{"file":"…/settings.json","chain":true}`.
2118
+ - **`chain off` and `chain on` set it**, and leave the rest of the file as it
2119
+ is. Anything else is refused, saying what it takes, and the file is left as
2120
+ it was. With no file yet, either makes one that names every profile on the
2121
+ defaults. A `"chain"` that is not `true` or `false` makes the file not
2122
+ valid settings, which every command that reads the file says, and
2123
+ `ocnus status` too.
2124
+ - **With it off, the watch starts no card.** After a merge, it asks Linear
2125
+ nothing about the cards the merge frees, and it runs no half-hourly
2126
+ catch-up. A card `task start` held waits in Todo until you start it, and
2127
+ `task start` says so as it holds one. `ocnus task ready <space>` still
2128
+ starts every ready card when you run it. Turned on again, the watch's next
2129
+ catch-up, once its last one is half an hour old, starts what became ready
2130
+ meanwhile.
2131
+ - **The watch reads the setting at each merge and at each pass**, so a change
2132
+ holds from the next one.
2133
+ - **In Herdr, the settings button shows it as Start blocked cards**, and
2134
+ turns it on or off with a click, through these commands (see
2135
+ [The settings button](#the-settings-button)).
2136
+ - **In a worktree**, `./cli/ocnus chain`, alone or with `--json`, reads
2137
+ as the installed copy does; `on` and `off` are refused.
2138
+
2139
+ ### The Usage section
2140
+
2141
+ On the `default` layout, the Usage section sits in the sidebar above Memory
2142
+ and CPU, and is as small: how much of your Claude subscription's usage limits is
2143
+ used, and when each resets, so you can pace the agents without leaving
2144
+ Herdr.
2145
+
2146
+ ```sh
2147
+ ocnus usage [--json]
2148
+ ```
2149
+
2150
+ - **Two rows, one for each limit**: `5-hour` and `Weekly`, each with how much
2151
+ of it is used, as a percentage and a bar, and when it resets, in this
2152
+ machine's time: the clock alone on the same day, as `3:40pm`, the weekday
2153
+ too within six days, as `Tue 9am`, and the date further away. A bar
2154
+ changes colour from 75% used, and again from 90%.
2155
+ - **The reading comes from the agents ocnus starts.** Claude Code hands a
2156
+ status line command the subscription's limits each time it updates the
2157
+ status line, which it does as the agent works. On either account,
2158
+ `task new` and `task build` start `claude` with a `statusLine` in
2159
+ `--settings=` that runs `ocnus usage record <space> <card> <phase>
2160
+ <account>`, which saves the two limits, and when it read them, to
2161
+ `~/.config/ocnus/usage.json`, and adds what the session has used to
2162
+ `~/.config/ocnus/cost.db`, as that card's, for `task log` (see
2163
+ [Hand-offs](#hand-offs)). The account is what billing is on as the agent
2164
+ starts. It prints nothing, so the agents' status line is blank, and it
2165
+ takes the place of a status line of your own in those agents alone. A
2166
+ status line with no limits in it, as before an agent's first answer or
2167
+ on an API key, leaves the last reading as it was. It sets no
2168
+ `refreshInterval`: a timer would save an idle agent's old limits as a new
2169
+ reading.
2170
+ - **What a session used is counted from its transcript.** Each time, `usage
2171
+ record` reads the whole lines Claude Code has added to the session's
2172
+ transcript since the last time, and to its subagents' transcripts, and
2173
+ counts each model turn's input, output, cache read and cache write tokens
2174
+ once, whatever number of lines its message was written on. The cost is
2175
+ the rise in `cost.total_cost_usd`, which Claude Code hands it with the
2176
+ limits. A session's first reading counts nothing it did before, as when it
2177
+ was continued or copied. A reading is saved whole, in one transaction,
2178
+ and only when no other reading of the session was saved since it began.
2179
+ Without `jq` or `sqlite3`, or when the file cannot be written, nothing is
2180
+ recorded and the agent works as before.
2181
+ - **So it is as fresh as the last turn of an agent ocnus started**, and
2182
+ matches Claude Code's own `/usage` then. While no agent works it ages: a
2183
+ reading older than ten minutes says how old it is, as `read 12m ago`, and
2184
+ a limit whose reset has passed since shows no number, and when it reset.
2185
+ Claude Code sessions you start yourself are not read, since their settings
2186
+ are your own.
2187
+ - **With no reading, one line says so** in place of the numbers: no reading
2188
+ yet, as before the first agent on the subscription has answered, a file
2189
+ that cannot be read, or both limits reset since the last reading. The rest
2190
+ of the sidebar works as before.
2191
+ - **On `api` there is none**: an agent on an Anthropic API key has no usage
2192
+ limits to hand its `statusLine`, so the section keeps the last reading,
2193
+ ageing. `ocnus usage` says billing is on the API, and what the agents
2194
+ ocnus started on an API key have spent: today, from midnight, with the
2195
+ card that has spent the most today and how much, and this week, from
2196
+ Monday at midnight, both in this machine's time, with how many cards the
2197
+ week's spend is for and how many of them have merged, their latest
2198
+ hand-off `done` with `merged` next. It goes by the day each reading was
2199
+ saved on. Work an agent did on the subscription is in none of it. The
2200
+ section does not show it.
2201
+ - **It reads every 30 seconds** while the window can be seen, with
2202
+ `ocnus usage --json`, and works nothing out itself: each reset time, the
2203
+ reading's age and the line to show with no numbers come from the command.
2204
+ When `ocnus` is not on Herdr's `PATH`, it runs the copy the mod is linked
2205
+ from. `--json` prints one line for programs:
2206
+ `{"file":"…/usage.json","read_at":…,"age":"3m","stale":false,"five_hour":{"used":42,"resets_at":…,"reset":false,"resets":"3:40pm"},"seven_day":{…},"note":null,"spend":null}`.
2207
+ `spend` is null on the subscription, and on `api`
2208
+ `{"today":{"usd","text","top":{"space","card","usd","text"}},"week":{"usd","text","from","cards","merged"}}`,
2209
+ where `top` is null with nothing spent today and `from` is Monday's date.
2210
+ - **It needs `jq`.** Without it `ocnus usage` stops and says so, and an
2211
+ agent's `usage record` saves nothing.
2212
+ - **In a worktree**, `./cli/ocnus usage`, alone or with `--json`, reads as
2213
+ the installed copy does, the cost file attached read-only; `usage
2214
+ record` is refused, with an agent's words or without.
2215
+
1553
2216
  ## Recording the host
1554
2217
 
1555
2218
  ocnus can keep a record of how hard the host, the machine it runs on,
@@ -1561,7 +2224,8 @@ turn it on, and works on macOS only.
1561
2224
  ocnus host # whether recording is on, and what it has
1562
2225
  ocnus host on # turn recording on
1563
2226
  ocnus host off # turn it off, and delete every reading
1564
- ocnus host report [<period>] # how often CPU, memory and disk were at their limit, with how many agents working and how much slower test runs were, what was going then, what used the most, where the steps' time went, whether the network may be the cause, and what to upgrade first
2227
+ ocnus host report [<period>] # how often CPU, memory and disk were at their limit, what used the most, and where the steps' time went
2228
+ ocnus host report --card <space> <card> --json # what the host recorded while each of a card's steps ran, as JSON for programs
1565
2229
  ocnus tests run <command> # run a test command, and record the test run
1566
2230
  ```
1567
2231
 
@@ -1627,9 +2291,11 @@ ocnus tests run <command> # run a test command, and record the test run
1627
2291
  for before every reading, so it asks hc for nothing more. A tab that
1628
2292
  holds its shell alone is not open, so it is neither, whatever its status.
1629
2293
  - **Each agent's time, split in three.** While recording is on, `task new`
1630
- and `task build` start `claude` with one more flag, `--settings=`, which
1631
- holds Claude Code hooks that mark the agent's time, for the first start
1632
- and for `task build --continue`. Each hook runs
2294
+ and `task build` start `claude` with Claude Code hooks in `--settings=`,
2295
+ which mark the agent's time, for the first start and for
2296
+ `task build --continue`. They are in the one `--settings=` that holds the
2297
+ agent's `statusLine` (see [The Usage section](#the-usage-section)), and
2298
+ on `api` its `apiKeyHelper` too. Each hook runs
1633
2299
  `cli/host-mark <mark> <file>`, which appends one line, `<mark> <time>`, to
1634
2300
  the file, with the time in seconds since 1970, to the millisecond, from
1635
2301
  `perl`'s `Time::HiRes`. The file is
@@ -1788,8 +2454,7 @@ ocnus tests run <command> # run a test command, and record the test run
1788
2454
  - **The fingerprint of its command.** Before the job starts,
1789
2455
  `/usr/bin/shasum -a 256` hashes the command's arguments, each ended by a
1790
2456
  NUL, and the first 15 hex digits of the hash, as a number, are the run's
1791
- `cmd`. The same arguments give the same number, so `host report` can set
1792
- runs of the same command in the same repo against each other, and the
2457
+ `cmd`. The same arguments give the same number, and the
1793
2458
  command's text cannot be read back from it. It is all that is kept of
1794
2459
  the command line. `shasum` runs as part of watching the run, so its CPU
1795
2460
  is in the run's `watch_secs`; without it, `cmd` is empty and the run is
@@ -1903,68 +2568,6 @@ figures.
1903
2568
  time no agent was open, as well as when the machine slept or recording was
1904
2569
  off. A period with no readings at all says so.
1905
2570
 
1906
- Then come the agents working at once, under `Agents working at once:`, to
1907
- tell how many agents to run at once:
1908
-
1909
- - **A line for each number of agents working** in the period, from none
1910
- up: how long that many were working, and how long and how much of that
1911
- time the CPU or the memory was at its limit. Each reading counts for the
1912
- part of it in the period, as above.
1913
- - **Readings from before the agents working were counted** hold no count.
1914
- They are left out of these lines, never counted as none working, and
1915
- their time is on a line of its own, `not counted`.
1916
- - **How much slower test runs were.** Under each number from 2 up comes
1917
- how much slower test runs were than with one agent working, as
1918
- `test runs 30% slower than with 1 working, from 3 runs of 1 command
1919
- against 3 with 1 working`, or as `faster` when they were faster:
1920
- - **A test run counts at one number of agents working**: the one that
1921
- covers most of its time, from when it started for as long as it took,
1922
- over the readings that counted them, and the larger number on a tie. A
1923
- run under 10 seconds, shorter than a reading, counts at the number of
1924
- the reading that holds most of it. Runs that started in the period
1925
- count, but a run cut short, one still going, one with no `cmd`, from
1926
- before the fingerprints were kept, and one that overlaps no reading
1927
- with a count of the agents working are left out.
1928
- - **A command is a repo and a `cmd`**, so only runs of the same command
1929
- in the same repo are set against each other. A command counts at a
1930
- number when it ran at least 3 times with that many working and 3 times
1931
- with one. Its ratio is the median time of its runs at that number over
1932
- the median of its runs at one, and the figure is the median of those
1933
- commands' ratios, with the runs and the commands it rests on, and the
1934
- runs with one working. Medians keep one odd run, such as one that
1935
- failed early, from moving the figure.
1936
- - **With no such command**, it says it cannot tell yet for that number.
1937
- - **A store from before the fingerprints** has no `cmd`, and the report
1938
- leaves these lines out. It never alters the store: the next test run or
1939
- recorder start adds the column.
1940
- - **The last line names the number from which the host was the limit**:
1941
- the fewest working at which the CPU or memory was at its limit for at
1942
- least a quarter of the time. With no such number, it says the host was
1943
- not the limit at any number of working agents in the period, and with no
1944
- reading that counted them, it says so.
1945
-
1946
- Then come the longest stretches when the CPU or the memory was at its limit:
1947
-
1948
- - **A stretch** is readings in a row, each starting where the one before
1949
- ended, each with the CPU or memory at its limit. A reading under the
1950
- limit, or time with no reading, ends it. Each reading counts for the part
1951
- of it in the period.
1952
- - **The 5 longest** in the period are listed, longest first, or fewer when
1953
- there are fewer. Each says when it started, how long it lasted, and
1954
- whether the CPU, the memory or both were at their limit in it.
1955
- - **Under each, the work going then**: every card, with its step, or its
1956
- phase when its card was in none of that phase's steps, then every test
1957
- run, by its card, its repo and when it started. Each has its share of all
1958
- cores over the stretch, each reading's share counted for that reading's
1959
- seconds, and the most memory it held in one reading. Each card also says
1960
- for how much of the stretch its agent was working, as `working 50% of
1961
- it`, or `working not read` for shares from before that was read. A share
1962
- that names no card is left out, and a stretch with no card or test run
1963
- going says so.
1964
- - **With none**, the report says the host was never at its limit for CPU or
1965
- memory in the period. Disk is not among the stretches: under 10% free is
1966
- not caused by a moment's work.
1967
-
1968
2571
  Then come the steps, the phases and the test runs that used the most:
1969
2572
 
1970
2573
  - **The 10 steps and the 10 phases that used the most CPU time** in the
@@ -1998,66 +2601,6 @@ Then comes where the steps' time went:
1998
2601
  With no split in the period, or a store made before the splits, the
1999
2602
  report says no step was split.
2000
2603
 
2001
- Then, after a blank line, it says whether the network may be the cause, as
2002
- a slow wait on the model can be the network rather than the host:
2003
-
2004
- - **A slow wait** took over twice the median of every wait in
2005
- `model_waits`, so 90 days at most. The median is the wait halfway in order
2006
- of length, the later of the two for an even count. A wait of exactly twice
2007
- it is not slow.
2008
- - **It counts for the network** when there is a reading over it, in whole or
2009
- in part, and every reading over it had the CPU, memory and disk below
2010
- their limit, as above. A slow wait with no reading over it does not count.
2011
- - **The period's waits** are those that ended in it, whenever they started.
2012
- - **With any that count**, it says how many of the period's waits on the
2013
- model were slow while the host was below its limit, and the median, to a
2014
- tenth of a second under a minute: `The network may be the cause: 14 of 412
2015
- waits on the model were slow (over twice the median of 6.2s) while CPU,
2016
- memory and disk were below their limit.` With none, or a store made before
2017
- the waits on the model, it says nothing.
2018
- - **It cannot tell a slow network from a slow model**: the line says only
2019
- that the network may be the cause.
2020
-
2021
- Last comes the verdict on the host, one line after a blank one, with the
2022
- numbers behind it, so that money goes on what slows the agents' work on the
2023
- host. It is the first of these that holds:
2024
-
2025
- - **Too little data yet**, with fewer than 10 steps with their time split in
2026
- the period, each one card's own, or under 1 hour of the agents' time on
2027
- the host. It says how many steps and how long, against the 10 and the
2028
- hour. With no split in the period, or a store made before the splits,
2029
- both are none.
2030
- - **The one to upgrade first**: of CPU, memory and disk, the one at its
2031
- limit, as above, for the most of the agents' time on the host, when that
2032
- is at least 10% of it; the CPU before memory, and memory before the disk,
2033
- when two were at their limit as long. The line gives its share of the
2034
- agents' time on the host, that time, and the other two's shares:
2035
- `upgrade memory first: it was at its limit for 23.0% of the agents' 6h
2036
- 10m on the host (CPU 8.0%, disk 0.0%)`.
2037
- - **The power state was the limit**, in place of an upgrade, when over half
2038
- of that one's time at its limit was on battery, in Low Power Mode, or with
2039
- the thermal state at serious or critical: plugging in, turning Low Power
2040
- Mode off or letting the machine cool costs nothing. The line gives how
2041
- much of that time it was, too. At exactly half it is an upgrade. A
2042
- reading from before the power state was read counts as on power.
2043
- - **The network was the limit**, when none of the three was at its limit
2044
- for 10% of the agents' time on the host, and the slow waits that count for
2045
- the network, as above, are at least 10% of the period's waits on the
2046
- model: `the network was the limit: 12.0% of the 100 waits on the model
2047
- were slow (over twice the median of 6.2s) while CPU, memory and disk were
2048
- below their limit, and each was at its limit for under 10% of the agents'
2049
- 2h 46m on the host (CPU 0.0%, memory 4.0%, disk 0.0%)`. Then no host
2050
- upgrade is bought that would not have helped. A store made before the
2051
- waits on the model never has it.
2052
- - **No upgrade is needed**, otherwise, with the three shares.
2053
-
2054
- The agents' time on the host is the seconds their tools ran, from the
2055
- splits, an agent's second each: two agents on the host for a second are two
2056
- seconds of it. A reading counts for the verdict by the agents' time on the
2057
- host in it, each split counted for the part of its reading in the period,
2058
- so time at the limit while the agents waited on the model or on you, or
2059
- with no split, counts for none of it.
2060
-
2061
2604
  ```
2062
2605
  The host from 2026-11-22 17:20 to 2026-11-29 17:20 (7d)
2063
2606
  recorded 9h 41m of 7d 00h
@@ -2070,15 +2613,6 @@ The host from 2026-11-22 17:20 to 2026-11-29 17:20 (7d)
2070
2613
  By day:
2071
2614
  ...
2072
2615
 
2073
- Longest stretches with CPU or memory at its limit:
2074
- 2026-11-29 14:02:40 for 12m 30s, CPU at its limit
2075
- LAB-150 build step CPU 61.4%, memory 3412 MB
2076
- LAB-151 write-up phase CPU 4.2%, memory 1204 MB
2077
- LAB-150 ocnus test run 2026-11-29 14:02 CPU 52.8%, memory 1830 MB
2078
- 2026-11-28 10:41:10 for 4m 20s, CPU and memory at their limit
2079
- LAB-149 review step CPU 48.0%, memory 1890 MB
2080
- LAB-149 ocnus test run 2026-11-28 10:41 CPU 41.5%, memory 1795 MB
2081
-
2082
2616
  Steps that used the most CPU time:
2083
2617
  LAB-150 build step CPU time 1h 12m, ran 2h 40m
2084
2618
  LAB-149 review step CPU time 22m 05s, ran 51m 10s
@@ -2103,14 +2637,122 @@ Where the steps' time went:
2103
2637
  LAB-150 build step open 2h 40m: on the host 51m 20s, waiting on the model 1h 22m, the rest 26m 40s
2104
2638
  LAB-149 review step open 51m 10s: on the host 10m 40s, waiting on the model 27m 00s, the rest 13m 30s
2105
2639
  1 step had no split, as an agent's time is split only when it starts in Claude Code while recording is on
2640
+ ```
2641
+
2642
+ `ocnus host report --card <space> <card> --json` gives what the host
2643
+ recorded while each of a card's steps ran, as one line of JSON for a
2644
+ program, such as one that draws the CPU under a card's timeline, so that a
2645
+ slow step can be set beside how busy the host was then. The report in words
2646
+ takes no card, and this form takes no period. At the top of the JSON:
2647
+
2648
+ | Key | What it holds |
2649
+ |---|---|
2650
+ | `space`, `card` | The space and the card asked for, the card ID in upper case |
2651
+ | `recording` | `true` while recording is on, `false` while it is off |
2652
+ | `steps` | Each time the card was in a step, oldest first; `[]` for a card with no hand-offs |
2653
+
2654
+ Each of the `steps`:
2106
2655
 
2107
- The network may be the cause: 14 of 412 waits on the model were slow (over twice the median of 6.2s) while CPU, memory and disk were below their limit.
2656
+ | Key | What it holds |
2657
+ |---|---|
2658
+ | `run` | Which run of the card it is in, as `task log --json` numbers them: each `task new` starts one |
2659
+ | `step` | The step's name, such as `plan` |
2660
+ | `start`, `end` | When the card came into the step and when it left it, in UTC, in the form of `at` in `task log --json`, as `2026-11-29T09:10:00Z`; for the step the card is in now, `end` is now |
2661
+ | `seconds` | The seconds from `start` to `end`, the time the step waited on you included |
2662
+ | `open` | `true` for the step the card is in now, `false` for one that has ended |
2663
+ | `readings` | How many readings have seconds inside the step; `0` when none was taken in it |
2664
+ | `recorded` | How many of the step's seconds those readings cover; the rest of `seconds` has no reading |
2665
+ | `points` | The readings, oldest first, 60 at most; `[]` when there are none |
2666
+
2667
+ Each of a step's `points`:
2668
+
2669
+ | Key | What it holds |
2670
+ |---|---|
2671
+ | `start`, `end` | The time the point stands for, in UTC: a reading's own, as far as it is inside the step, or, in a step that is thinned, one of the step's 60 equal parts |
2672
+ | `seconds` | The recorded seconds the point stands for: the reading's seconds inside the step, or, in a step that is thinned, those of every reading in the part |
2673
+ | `cpu_busy` | The share of all cores' time that was busy, as a percentage to one decimal, from the readings' `cpu_busy` |
2674
+ | `mem_used_mb` | The memory used, in MB, from the readings' `mem_used_mb` |
2675
+ | `mem_pressure` | `normal`, `warning` or `critical`, from the readings' `mem_pressure` |
2676
+
2677
+ - **A step** is each time the card was in it: hand-offs of one step in a
2678
+ row, from the hand-off before the first of them to the last. They are the
2679
+ times `task log` gives, from the same view of the hand-offs, so the two
2680
+ cannot disagree, and the time the step waited on you is inside it. A card
2681
+ that went from its build step to its review step and back has two entries
2682
+ for its build step. `task new` and `task start` take no time in
2683
+ `task log`, so they have no entry, and the time between your approval and
2684
+ `task start` is in no step.
2685
+ - **The step the card is in now** runs to now and is `open`, with its
2686
+ readings so far. It is the step whose question waits on you or was just
2687
+ answered, or the step the latest hand-off names as next, when an agent
2688
+ runs it: `task new` names define, and `task start` the build step. A card
2689
+ that is approved and not yet started, one whose step failed, and one
2690
+ whose pull requests have merged are in no step, so none of their steps is
2691
+ open.
2692
+ - **The figures are the whole host's**, as each reading holds them, and
2693
+ not the card's own share: another card's test run that kept the CPU busy
2694
+ shows in this card's step too. A reading that starts before the step or
2695
+ ends after it counts only for its seconds inside the step, as the report
2696
+ counts a reading in a period, so a reading that two steps share is in
2697
+ both.
2698
+ - **A step with 60 readings or fewer** comes back reading by reading, a
2699
+ point each.
2700
+ - **A step with more is thinned** to 60 points at most. Its time is cut
2701
+ into 60 equal parts, to the second, and each part with a reading in it
2702
+ gives one point, with the part as its `start` and `end`. Its `cpu_busy`
2703
+ and `mem_used_mb` are the average over the part's recorded seconds, each
2704
+ reading counted for its seconds in the part, and its `mem_pressure` is
2705
+ the worst in it. Every reading counts toward a point and none is dropped:
2706
+ the points' `seconds` add up to the step's `recorded`. A reading that two
2707
+ parts share counts toward each, for its seconds in it.
2708
+ - **Time with no reading has no point**, so it is never given as idle or as
2709
+ 0. In a step given reading by reading, the time between two readings that
2710
+ do not meet has no point. In a thinned step, a part with no reading gives
2711
+ no point, and one recorded for some of its seconds says how many in its
2712
+ `seconds`. A step with no reading at all, such as one from before
2713
+ recording was turned on, has `readings` 0, `recorded` 0 and no points. A
2714
+ figure that no reading in a point had is `null`, never 0.
2715
+ - **With recording off**, `recording` is `false`, and the steps are still
2716
+ listed, each with no readings, since `host off` deleted them. Either way
2717
+ it is JSON a program can read, so it can show "not recorded" in place of
2718
+ an empty chart: for a card when `recording` is `false`, for a step with
2719
+ `readings` 0, and for the time between two points.
2720
+ - **At any point in a card's life.** The steps come from the hand-offs and
2721
+ the readings alone, so the form answers while a step is under way, and
2722
+ after the card's pull requests have merged and its task is finished, for
2723
+ as long as the readings are kept: 90 days. A card with no hand-offs is
2724
+ not refused: it has no steps, as in `task log --json`.
2725
+ - **A request it cannot make sense of is refused**, with a message on
2726
+ stderr that says what was wrong, exit 1 and nothing on stdout, so that a
2727
+ program never reads words as JSON: `--card` without a space and a card,
2728
+ `--card` without `--json`, `--json` without `--card`, a period or any
2729
+ other word beside them, a space that does not exist, a card that is not a
2730
+ card ID, and hand-offs or readings that cannot be read.
2731
+
2732
+ Its one line, cut short and set out over several: a define step given
2733
+ reading by reading, a build step of an hour thinned to parts of a minute,
2734
+ with 3 minutes of it not recorded, and a review step under way with no
2735
+ reading yet.
2108
2736
 
2109
- Verdict: too little data yet: 2 steps had their time split, with 1h 02m of the agents' time on the host, and a verdict takes at least 10 steps and 1h 00m.
2737
+ ```
2738
+ {"space":"my-space","card":"LAB-150","recording":true,"steps":[
2739
+ {"run":1,"step":"define","start":"2026-11-29T09:00:00Z","end":"2026-11-29T09:00:40Z","seconds":40,"open":false,"readings":4,"recorded":40,"points":[
2740
+ {"start":"2026-11-29T09:00:00Z","end":"2026-11-29T09:00:10Z","seconds":10,"cpu_busy":35.5,"mem_used_mb":11803,"mem_pressure":"normal"},
2741
+ {"start":"2026-11-29T09:00:10Z","end":"2026-11-29T09:00:20Z","seconds":10,"cpu_busy":39.8,"mem_used_mb":11806,"mem_pressure":"normal"},
2742
+ ...]},
2743
+ ...
2744
+ {"run":1,"step":"build","start":"2026-11-29T09:10:00Z","end":"2026-11-29T10:10:00Z","seconds":3600,"open":false,"readings":341,"recorded":3410,"points":[
2745
+ ...
2746
+ {"start":"2026-11-29T09:34:00Z","end":"2026-11-29T09:35:00Z","seconds":60,"cpu_busy":75.0,"mem_used_mb":12748,"mem_pressure":"normal"},
2747
+ {"start":"2026-11-29T09:38:00Z","end":"2026-11-29T09:39:00Z","seconds":60,"cpu_busy":91.8,"mem_used_mb":13904,"mem_pressure":"warning"},
2748
+ ...
2749
+ {"start":"2026-11-29T10:09:00Z","end":"2026-11-29T10:10:00Z","seconds":50,"cpu_busy":92.2,"mem_used_mb":14089,"mem_pressure":"warning"}]},
2750
+ {"run":1,"step":"review","start":"2026-11-29T10:10:00Z","end":"2026-11-29T12:00:00Z","seconds":6600,"open":true,"readings":0,"recorded":0,"points":[]}]}
2110
2751
  ```
2111
2752
 
2112
- - **In a worktree**, `./cli/ocnus host` and `./cli/ocnus host report`
2113
- read as the installed copy does; `on`, `off` and `record` are refused.
2753
+ - **In a worktree**, `./cli/ocnus host`, `./cli/ocnus host report` and
2754
+ `./cli/ocnus host report --card <space> <card> --json` read as the
2755
+ installed copy does; `on`, `off` and `record` are refused.
2114
2756
 
2115
2757
  ## What a repo provides
2116
2758
 
@@ -2170,9 +2812,10 @@ shell, or written as a `NAME=value` line in ocnus's env file,
2170
2812
  | `ANTHROPIC_API_KEY` | The Anthropic API key every agent runs on with billing on `api` (see [Billing](#billing)). `ocnus billing key` writes this line for you. Read from the file alone: an `ANTHROPIC_API_KEY` you export is never taken for it. |
2171
2813
  | `OCNUS_HARNESS` | The harness: the command `task new` and `task build` start the agent with. `claude` when it is not set, which starts with a phase profile. Another harness starts as it is, with no profile. |
2172
2814
  | `OCNUS_SQLITE` | The command that records hand-offs. `sqlite3` when it is not set. |
2815
+ | `OCNUS_BRIEF_MODEL` | The model `task brief` has `claude` make a new brief on, at low effort. `haiku` when it is not set. A value that is not a model stops `task brief` before any model call. |
2173
2816
  | `OCNUS_SETUP` | `1` makes `task start` run each repo's `setup` recipe. Off when it is not set, for now. |
2174
2817
  | `HERDR_APP_HOME` | Herdr's folder. `~/.config/herdr-app` when it is not set. |
2175
- | `CLAUDE_CONFIG_DIR` | Claude Code's folder, where skills and phase profiles are linked and the dev profiles written. `~/.claude` when it is not set. |
2818
+ | `CLAUDE_CONFIG_DIR` | Claude Code's folder, where skills and phase profiles are linked and the dev profiles written, and where `task brief` finds the transcript of an agent's session. `~/.claude` when it is not set. |
2176
2819
  | `OCNUS_HOME` | ocnus's own folder. `~/.config/ocnus` when it is not set. Export only: it says where the env file is, so the file cannot set it. |
2177
2820
  | `OCNUS_LIVE` | `1` lets the copy of ocnus in a git worktree of its repo change the machine, for that run (see [Changing things](#changing-things)). Export only, best on the command line: the file cannot set it, so it is never left on. |
2178
2821
  | `OCNUS_SPACE`, `OCNUS_CARD` | The space and the card `task build` names to its agent, so that every command the agent runs has them, and `ocnus tests run` records its test runs as that card's (see [Recording the host](#recording-the-host)). Set by `task build`: the file cannot set them, so a test run outside an agent's tab is never named a card. |
@@ -2251,7 +2894,8 @@ shell, or written as a `NAME=value` line in ocnus's env file,
2251
2894
  repo, runs only the commands that read: `help`, `status`, `space ls`,
2252
2895
  `space team <name>`, `profile ls`, `linear archive` (alone or with
2253
2896
  `--json`), `tests` (alone or with `--json`), `billing` (alone or with
2254
- `--json`), `task ls`, `task log`, `host` and `host report`. Any other command stops
2897
+ `--json`), `usage` (alone or with `--json`), `task ls`, `task log`,
2898
+ `task asks`, `host` and `host report`. Any other command stops
2255
2899
  before it changes anything, and says to run plain `ocnus` for a card's
2256
2900
  own steps, to write a test case to try the command, or to run it for real
2257
2901
  with `OCNUS_LIVE=1 ./cli/ocnus …`. Plain `ocnus` is never