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

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 +518 -98
  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 +340 -384
  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 +274 -76
  23. package/herdr/README.md +930 -232
  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/cli/ocnus CHANGED
@@ -33,28 +33,50 @@ Usage:
33
33
  ocnus task start <space> <card> [--type <type> --title <title>] [<repo>[:<group>[,<group>...]] ...]
34
34
  start the work: a worktree per repo, opened as a tab
35
35
  where the agent builds the card
36
+ ocnus task ready <space> start every card of the space's Linear teams that is ready:
37
+ in Todo, with a Specification and a Plan, and with every
38
+ card that blocks it done (ocnus's watch runs it for every
39
+ space each half hour)
36
40
  ocnus task build <space> <card> [--continue <message>]
37
41
  start the agent that builds the card, in its task's tab
38
- (--continue: continue claude's last session there, with the message)
42
+ (--continue: continue the agent's session there, with the message)
39
43
  ocnus task close <space> <card> put away the card's write-up session once its agent's turn
40
44
  ends: end its Claude session with /exit, then close its tab
41
45
  (task start runs it once the build tab is open)
42
46
  ocnus task finish <space> <card> end a task whose work has merged: remove its worktrees,
43
47
  its branch in each repo and its folder, and close its tab
44
48
  ocnus task merges [--once | --wake] ocnus's watch on the merges: record the merge of each card
45
- whose pull requests have all merged and finish its task, and
46
- wake the agent of one that is closed or in conflict, checking
47
- every minute until no card waits (--once: check once; --wake:
48
- only start it, while a card waits and herdr-core runs, as the
49
- launchd agent install writes does every minute)
49
+ whose pull requests have all merged, finish its task and
50
+ start the cards it was blocking that are ready, and wake the
51
+ agent of one that is closed or in conflict, checking every
52
+ minute until no card waits (--once: check once; --wake: only
53
+ start it, while a card waits or its half-hourly look for
54
+ ready cards is due, and herdr-core runs, as the launchd
55
+ agent install writes does every minute)
50
56
  ocnus task handoff <space> <card> record how a step ended: a handoff block on stdin
51
57
  ocnus task log <space> [<card>] [--json]
52
- list a card's hand-offs and how long each step took,
53
- or with no card the cards that have hand-offs and where each stands
54
- ocnus linear key save your Linear API key, so ocnus can read and write Linear cards
58
+ list a card's hand-offs, how long each step took and what
59
+ its agents used in tokens and dollars, or with no card the
60
+ cards that have hand-offs, where each stands and its total
61
+ ocnus task asks <space> [--json] list the questions that wait on you in the space, each with
62
+ its card, its kind, its options and when it was asked: an
63
+ approval, a merge, an agent's own question or a Claude Code
64
+ permission prompt (--json for programs)
65
+ ocnus task answer <space> <card> <question> <answer>
66
+ answer one of them with no one typing in its agent's tab:
67
+ with one of its options or, for any kind but a permission
68
+ prompt, your own words; merge merges the card's open pull
69
+ requests on GitHub
70
+ ocnus task brief <space> <card> [--json] [--refresh]
71
+ give the brief of the card's agent without going to its tab:
72
+ its task, what has happened so far and what it is doing now
73
+ (a model call; the last brief is kept until the card's next
74
+ hand-off, and --refresh makes a new one)
75
+ ocnus linear key save your Linear API key, so ocnus can read and write Linear cards
55
76
  (it says when the key can read cards but not change them)
56
- ocnus linear read <card> [--json] print a card whole: its head, description, comments and
57
- sub-issues (--json for programs)
77
+ ocnus linear read <card> [--json] print a card whole: its head, with the cards that block it
78
+ and that it blocks, description, comments and sub-issues
79
+ (--json for programs)
58
80
  ocnus linear type <card> <feat|fix|chore>
59
81
  set a card's type, its label in the Type group
60
82
  ocnus linear section <card> <Specification|Plan|Breakdown|Review> [--replace]
@@ -62,6 +84,9 @@ Usage:
62
84
  ocnus linear slices <card> make a card's slices as its sub-issues, each with the card's
63
85
  type and blocked by the one before; the slices on stdin,
64
86
  and a run again makes only the ones still missing
87
+ ocnus linear block <card> <blocker>...
88
+ record in Linear that each blocker blocks the card, skipping
89
+ one it has already; it removes none
65
90
  ocnus linear move <card> <approved|started|review|done>
66
91
  move a card forward in Linear: to its team's first
67
92
  not-started status (Todo) with its sub-issues, its first
@@ -71,6 +96,10 @@ Usage:
71
96
  ocnus tests [share|queue|--json] say whether the runs of ocnus's own tests on this
72
97
  machine share its processors or go one at a time, or set it
73
98
  (--json for programs)
99
+ ocnus tests ls [--json] list the runs of ocnus's own tests going on this machine,
100
+ each with its card or folder, whether it is sharing, waiting,
101
+ having its turn or running with OCNUS_TEST_JOBS, how long
102
+ ago it started and the processors it holds (--json for programs)
74
103
  ocnus tests run <command> [<arg>...] run a test command as it is, and record the test run while
75
104
  the host is recorded, as the build phase's skills do
76
105
  ocnus approval [--json | --breakdown on|off]
@@ -82,18 +111,26 @@ Usage:
82
111
  or on an Anthropic API key, or set it (--json for programs)
83
112
  ocnus billing key save the Anthropic API key the agents run on with billing
84
113
  on api
114
+ ocnus chain [on|off|--json] say whether ocnus's watch starts each card once the cards
115
+ that block it are done, or turn that on or off (--json for
116
+ programs)
117
+ ocnus usage [--json] say how much of your Claude subscription's five-hour and
118
+ weekly usage limits is used, and when each resets, as the
119
+ agents ocnus starts last read it, and with billing on api
120
+ what they spent today and this week (--json for programs)
85
121
  ocnus host say whether how hard this machine works is recorded
86
122
  ocnus host on record it every 10 seconds while an agent is open
87
123
  ocnus host off stop recording, and delete every reading
88
- ocnus host report [<period>] how often CPU, memory and disk were at their limit, how often
89
- CPU or memory was with each number of agents working, and
90
- how much slower test runs were then, the work going in the
91
- 5 longest stretches when it was, the steps, phases and test
92
- runs that used the most CPU and memory, where the steps'
93
- time went, whether the network may be the cause of slow
94
- waits on the model, and a verdict on what to upgrade first:
95
- <n>d or <n>h back from now (7d when none is given), a day
124
+ ocnus host report [<period>] the host's CPU, memory, disk, network, and power and heat,
125
+ summed up, the steps, phases and test runs that used the
126
+ most CPU and memory, and where the steps' time went: <n>d
127
+ or <n>h back from now (7d when none is given), a day
96
128
  YYYY-MM-DD, or <day>..<day>
129
+ ocnus host report --card <space> <card> --json
130
+ what the host recorded while each of a card's steps ran, as
131
+ one line of JSON for programs: each step's start and end,
132
+ and its readings of the CPU, the memory used and the memory
133
+ pressure, 60 points a step at most
97
134
  ocnus help
98
135
 
99
136
  A space groups repos that belong together, with a SPACE.md saying what
@@ -105,12 +142,20 @@ by the trust question. It needs jq; without it Claude Code asks once.
105
142
  A task is one piece of work in a space, usually a Linear card.
106
143
  `task ls` lists the cards `task new` can be given: every card of the
107
144
  space's Linear teams that is not done, cancelled or a duplicate, under its
108
- status. It needs two things set once. `linear key` asks for a Linear API key
145
+ status. With --json, for programs, each card also says where it stands: its
146
+ parent card, with how many sub-issues the parent has and how many of them
147
+ are done, its place among them in the order they were made, the cards that
148
+ block it, and whether it is held, with the cards it waits on. A card is held
149
+ when it is in a not-started status and a card that blocks it, or its parent,
150
+ is not done, which is when `task start` holds it. That asks Linear up to two
151
+ more questions, for the sub-issues and for the blockers; the plain list asks
152
+ for neither.
153
+ `task ls` needs two things set once. `linear key` asks for a Linear API key
109
154
  and saves it (make one in Linear, under Settings, Account, Security & access,
110
155
  Personal API keys; Read permission is enough to list cards and for
111
156
  `linear read`, which the card skills read a card with, and the card skills'
112
- writes, `linear type`, `linear section`, `linear slices` and `linear move`,
113
- need Write too).
157
+ writes, `linear type`, `linear section`, `linear slices`, `linear block` and
158
+ `linear move`, need Write too).
114
159
  `linear key` and `status` check whether the key can change cards, by asking
115
160
  Linear to change a card that cannot exist, which changes nothing. A key that
116
161
  can read cards but not change them is still saved, and `linear key` says
@@ -140,8 +185,8 @@ a, an and the, like feat/abc-122-export-orders-as-csv. It stops before it
140
185
  makes anything when Linear has no such card, the card has no type, no key is
141
186
  saved, or Linear cannot be asked. It also holds a card, making nothing and
142
187
  leaving it in Todo, while a card that blocks it, or the card it was sliced
143
- from, is not done yet: it names each such card, and you run it again once
144
- they are done. Without a key Linear accepts, give the
188
+ from, is not done yet: it names each such card, and ocnus's watch starts
189
+ the card once they are done (see `chain` below). Without a key Linear accepts, give the
145
190
  card's type and title after it, as the command the write-up phase runs or
146
191
  gives you then does: `--type feat --title 'Export orders as CSV'` names the
147
192
  branch Linear's would. They are used only when no key is saved or Linear cannot be
@@ -168,8 +213,10 @@ and with the first message in prompts/task-build.md: build the card
168
213
  with the sdlc-build skill, review the build with the sdlc-review skill, then
169
214
  put it up as a pull request with the sdlc-pr skill.
170
215
  Run it again in the tab if the agent stops. With `--continue <message>` it
171
- continues claude's last session in the task instead, with that message, on
172
- the same profile, model and effort; another harness refuses it. The build step makes the change
216
+ continues the card's build session instead, with that message, on the same
217
+ profile, model and effort: the session of the build agent it started last,
218
+ by the ID it gave claude, or claude's last session in the task when it has
219
+ none recorded; another harness refuses it. The build step makes the change
173
220
  the card's Plan describes, runs the tests and commits on the task's branch.
174
221
  It first installs what the tests need, the way the repo's docs say, and
175
222
  starts no app, server or database. The review step runs the tests, unless
@@ -183,7 +230,8 @@ and runs no watch of its own: ocnus's watch is the only one. It records
183
230
  the merge once every pull request for the card has merged, with no one
184
231
  typing in the tab, and finishes the task, within a few minutes, with the
185
232
  Herdr app open or closed; telling the agent in the tab that they have merged
186
- has it say so, and do nothing more. That watch is `task merges`, in a
233
+ has it say so, and do nothing more. Then it starts each card the merged card
234
+ was blocking that is ready (see `chain` below). That watch is `task merges`, in a
187
235
  herdr-core terminal called ocnus-merges, which `task handoff` wakes once
188
236
  the pull requests wait on you, as do `task new`, `task start`, `task build`
189
237
  and `update`. After a restart, a launchd agent that `install` and `update`
@@ -191,7 +239,8 @@ write wakes it, with `task merges --wake` every minute, so it is back within
191
239
  a minute of herdr-core starting, however herdr-core was started; a machine
192
240
  with no launchctl has none. It checks every minute while a card waits,
193
241
  records nothing while the card's agent is busy, leaving it for a later pass,
194
- and never starts herdr-core. Once
242
+ and never starts herdr-core. While no card waits, a wake starts it only for
243
+ its half-hourly look for ready cards. Once
195
244
  the merge is recorded, `task handoff` refuses any other block for the card,
196
245
  so it is recorded once. When one is closed, or in conflict, ocnus's
197
246
  watch wakes the card's agent once for it: an agent idle in the tab is told
@@ -229,8 +278,10 @@ session with /exit, which archives it in the Claude app's list, then closes
229
278
  its tab, or with the Herdr app closed ends its terminal. It never kills a
230
279
  live agent: one that has not exited 30 seconds after /exit, or a program in
231
280
  the tab that reports no status, leaves the tab open. A task start that
232
- stops, or holds the card, leaves the write-up session open until task start
233
- is run again and opens the build tab. Run in the write-up tab itself, task close refuses.
281
+ holds the card puts the write-up session away too: the card waits in Linear,
282
+ and the watch opens its build tab once it starts it. A task start that stops
283
+ leaves the write-up session open until task start is run again and opens the
284
+ build tab. Run in the write-up tab itself, task close refuses.
234
285
  `task finish` ends a task once its work has merged: it removes the task's
235
286
  worktrees, deletes its branch in each repo, deletes its folder and closes its
236
287
  tab, or with the Herdr app closed ends the tab's terminals in herdr-core. It
@@ -246,9 +297,63 @@ records it. `task log` lists what was recorded for a card, with how long each
246
297
  step took and how long it waited on the human. With no card it lists the
247
298
  space's cards that have hand-offs, newest first, each with where it stands
248
299
  and for how long: a card whose pull requests have merged stands at merged.
300
+ Under each row it says what the agents used in the step that row ended: the
301
+ tokens that went in, how much of them was read from the cache, the tokens
302
+ out, and the cost Claude Code reported. On the subscription a cost is what
303
+ the work would cost at API prices, not money paid, and starts with ≈; on an
304
+ API key it is money spent. Then it says what the step the card is in has
305
+ used so far, and the card in all, and the list gives each card's total. A
306
+ step whose agent ran before this was recorded, or whose figures could not
307
+ be recorded, says not recorded, never 0, and a total that leaves one out
308
+ says it is not the whole card. The figures come from the agents' status
309
+ line, in cost.db in ocnus's folder, so they move while an agent works and
310
+ stay once the card has merged.
249
311
  With --json it prints the same view as one line, for
250
312
  programs: the Steps panel in Herdr draws it. Run
251
313
  `ocnus task handoff <space> <card>` with no block to see the rules.
314
+ `task asks` lists what waits on you in a space, oldest first: each question
315
+ with its card, its kind, its id, when it was asked, its text and its
316
+ options. A question is an approval, which sdlc-breakdown asks for; a merge,
317
+ sdlc-pr's wait for you to merge the card's pull requests, listed with the
318
+ links of those still open; a choice, any other question an agent handed off
319
+ with options of its own; or a permission, a Claude Code prompt to allow a
320
+ tool, naming the tool and what it would do. One whose agent is not running
321
+ says so. With --json it prints the same as one line, for programs.
322
+ `task answer` answers one, named by its card and its id, with no one typing
323
+ in the agent's tab: with one of its options, or for any kind but a
324
+ permission prompt with your own words, which the agent gets as if you had
325
+ typed them. A permission prompt takes allow, refuse or, where the prompt
326
+ offers it, allow from now on. Answering a merge with merge merges each of
327
+ the card's open pull requests on GitHub, by the method GitHub's merge button
328
+ would use for you in that repo, and only when GitHub would merge every one
329
+ of them as it stands: when it would not, none is merged, nothing is forced,
330
+ no auto-merge is turned on, and it names the pull request and why. An answer
331
+ is for that one question: when it was answered already, in the tab or by an
332
+ earlier answer, when its agent has asked another since, or when its agent is
333
+ not running, nothing is sent and it says why; a merge alone needs no agent
334
+ running. It exits zero only once the agent has taken the answer or the pull
335
+ requests have merged. Only you answer: run from inside the session of an
336
+ agent ocnus started, it sends nothing and merges nothing. A permission
337
+ prompt is seen through a hook that `task new` and `task build` give every
338
+ claude they start, `task hold`, which Claude Code runs beside the prompt.
339
+ `task new` and `task build` give claude the ID of its session, with
340
+ --session-id=, and record it as the card's write-up or build session, so
341
+ that `task log <space> <card> --json` lists a card's sessions, each with its
342
+ phase. `task brief` gives the brief of the card's newest agent, as the
343
+ agent would give it in its tab: Task, So far and Now, in no more than five
344
+ lines. It leaves the agent alone: claude makes the brief in a copy of the
345
+ agent's session, with the brief skill and no tools, so nothing is sent to
346
+ the tab and the agent's conversation gains no message. It works once the
347
+ card has merged and its task is finished too, while Claude Code keeps the
348
+ session's transcript. A new brief is a model call, on haiku at low effort
349
+ (OCNUS_BRIEF_MODEL picks another model), paid for as the agents are, so
350
+ the last one is kept: asked again before the card's next hand-off, or its
351
+ next agent, it gives the kept one, saying when it was made, with no model
352
+ call. --refresh makes a new one. A card with no session recorded, one whose
353
+ agent runs in another harness, and one whose transcript Claude Code no
354
+ longer keeps get no brief: it says why, and exits non-zero, as it does when
355
+ Claude Code could not make the brief. --json gives the brief, or why there
356
+ is none, as one line for programs.
252
357
 
253
358
  `host on` turns on a record of how hard this machine, the host, works while
254
359
  ocnus's agents are open, and `host off` turns it off and deletes every
@@ -276,25 +381,20 @@ run's command is kept only as a fingerprint, a number the same for the same
276
381
  command, from which its text cannot be read back. It needs no admin rights,
277
382
  and is never sent off the machine. Readings are kept for 90 days, in
278
383
  ~/.config/ocnus/host/readings.db. `host report` says, for a period, how
279
- much of it was recorded and how much of that CPU, memory and disk were each
280
- at their limit: CPU at least 90% busy across all cores, memory pressure at
281
- warning or critical, and under 10% of the home folder's disk free. Time with
282
- no reading, such as when no agent was open, is shown as missing, never as
283
- idle. It also says how much of the CPU recording used, watching the test
284
- runs included. For each number of agents working at once, it says how long
285
- that many were working and how much of that time CPU or memory was at its
286
- limit, and names the fewest working at which that was at least a quarter of
287
- the time, as the number from which the host was the limit. For each number
288
- from 2 up, it says how much slower test runs were than with one working,
289
- setting only runs of the same command in the same repo against each other,
290
- once a command has run at least 3 times with each; until then, it says it
291
- cannot tell yet. It names the 5 longest stretches when CPU or memory was at
292
- its limit, each with when it started, how long it lasted, which was at its
293
- limit, and every card's step and every test run going then, with its share
294
- of the CPU and the most memory it held, and for each card how much of the
295
- stretch its agent was working. Then it lists the 10 steps and the 10
296
- phases, each one card's own, that used the most CPU time, and that held the
297
- most memory at once, then the 10 test runs that did.
384
+ much of it was recorded, in all and on each day. Time with no reading, such
385
+ as when no agent was open, is shown as missing, never as idle. Then it sums
386
+ up each number the readings hold of the host, and judges none of them: a
387
+ total for an amount, such as the bytes read from the disk; an average and
388
+ the most in one reading for a level, such as how busy the CPU was, or the
389
+ least for the disk's free space and the Wi-Fi's signal; and how long each
390
+ state lasted, such as each level of memory pressure. An average weighs each
391
+ reading by its seconds in the period. One of the levels is how much of the
392
+ CPU recording used, its average with watching the test runs included. A
393
+ number that no reading in the period holds, as on a Mac without it or in
394
+ readings from before it was recorded, is shown as not read, never as 0.
395
+ Then it lists the 10 steps and the 10 phases, each one card's own, that
396
+ used the most CPU time, and that held the most memory at once, then the 10
397
+ test runs that did.
298
398
 
299
399
  While the host is recorded, `task new` and `task build` also start claude
300
400
  with hooks that mark when its agent starts and stops, is given a prompt,
@@ -308,22 +408,41 @@ same for the 10 steps open longest, and how many steps had no split, as an
308
408
  agent started in another harness or while recording was off has none.
309
409
 
310
410
  Each wait on the model is kept too, as its start and end alone, for 90
311
- days. A wait is slow when it took over twice the median of every wait
312
- kept. When waits in the period were slow while CPU, memory and disk were
313
- all below their limit, `host report` says the network may be the cause,
314
- with how many were slow and the median.
411
+ days.
315
412
 
316
- Last, `host report` gives its verdict, one line with its numbers. With
317
- fewer than 10 steps with their time split in the period, or under an hour
318
- of the agents' time on the host, the time their tools ran, there is too
319
- little data yet. Otherwise, of CPU, memory and disk, the one at its limit
320
- for the most of the agents' time on the host, when that is at least 10% of
321
- it, is the one to upgrade first, unless over half of its time at its limit
322
- was on battery, in Low Power Mode or with the thermal state at serious or
323
- critical: then the power state was the limit. With none at 10%, the network
324
- was the limit when at least 10% of the period's waits on the model were
325
- slow while CPU, memory and disk were below their limit, and otherwise no
326
- upgrade is needed.
413
+ `host report --card <space> <card> --json` gives what the host recorded
414
+ while each of a card's steps ran, as one line of JSON for programs, so that
415
+ a slow step can be set beside how busy the host was then. `steps` lists
416
+ each time the card was in a step, oldest first: hand-offs of one step in a
417
+ row, from the hand-off before the first to the last, timed as `task log`
418
+ times them, so the time it waited on you is inside it. `task new` and
419
+ `task start` take no time there, so they have no entry. Each entry has its
420
+ `run` and `step`, its `start` and `end` in UTC, its `seconds`, and `open`,
421
+ true for the step the card is in now, which runs to now: the one whose
422
+ question waits on you or was just answered, or the one the latest hand-off
423
+ names as next, when an agent runs it. It also has `readings`, how many
424
+ readings have seconds inside the step, `recorded`, the seconds they cover,
425
+ and `points`, the readings themselves, oldest first. A point has the
426
+ `start` and `end` of the time it stands for, the recorded `seconds` in it,
427
+ `cpu_busy`, how busy the CPU was across all cores, as a percentage,
428
+ `mem_used_mb`, the memory used, and `mem_pressure`: normal, warning or
429
+ critical. They are the whole host's figures, not the card's own share. A
430
+ step with 60 readings or fewer comes back reading by reading. One with more
431
+ is cut into 60 equal parts, and each part with a reading in it gives one
432
+ point: the average of the CPU and of the memory over the part's recorded
433
+ seconds, and the worst memory pressure in it, so every reading counts and
434
+ none is dropped. Time with no reading has no point, so it is never given as
435
+ idle or as 0: a step with no reading has `readings` 0 and no points, and a
436
+ figure no reading in a point had is null. With recording off, `recording`
437
+ is false, and the steps are still listed, each with no readings. A card
438
+ with no hand-offs has no steps. It can be asked at any point in a card's
439
+ life, after its task is finished too, for as long as the readings are kept.
440
+ A request it cannot make sense of is refused with a message on stderr, exit
441
+ 1 and nothing on stdout, so that a program never reads words as JSON:
442
+ --card without a space and a card, --card without --json or --json without
443
+ --card, a period or any other word beside them, a space that does not
444
+ exist, a card that is not a card ID, and hand-offs or readings that cannot
445
+ be read.
327
446
 
328
447
  `tests run <command> [<arg>...]` runs a repo's test command, whole suite or
329
448
  part, as in `ocnus tests run npm test`: its output goes straight
@@ -348,7 +467,8 @@ Your spaces are in ~/.config/ocnus/spaces (OCNUS_HOME picks
348
467
  another ~/.config/ocnus), each with a SPACE.md.
349
468
  A machine set up before keeps ~/.config/ocnus/projects and PROJECT.md.
350
469
  Hand-offs are recorded beside them, in ocnus.db, with sqlite3
351
- (OCNUS_SQLITE picks another command).
470
+ (OCNUS_SQLITE picks another command), and so are the agents' sessions
471
+ and the last brief of each card.
352
472
 
353
473
  A profile is a Claude Code agent definition: the tools a session has,
354
474
  whatever your own sessions have. claude starts with one, ocnus-write-up
@@ -378,8 +498,8 @@ is opus at xhigh. A file that is not valid settings stops `task new` and
378
498
  `task build` before an agent starts, saying what in it is wrong, and
379
499
  `status` says so too. The file is read with jq. The settings button, a cog at
380
500
  the right end of Herdr's tab bar, shows and changes them with these commands,
381
- and the "archive", "tests", "approval" and "billing" settings below with
382
- their own.
501
+ and the "archive", "tests", "approval", "billing" and "chain" settings below
502
+ with their own.
383
503
  The file also holds "archive", true or false: `linear archive on` and
384
504
  `linear archive off` set it, leaving the profiles as they are, and
385
505
  `linear archive` says whether it is on. It is off with no "archive", and
@@ -403,6 +523,19 @@ how many runs are ahead of it, and starts no case until none that started
403
523
  before it is going; then it has every processor. A run with
404
524
  OCNUS_TEST_JOBS set waits its turn too. Each run reads the file as it
405
525
  starts.
526
+ `tests ls` lists the runs going, from test-runs in ocnus's folder, in the
527
+ order they started, which is the order the waiting ones get their turns.
528
+ Each line names the run's card, such as LAB-241, when it was started in a
529
+ task's folder, and its folder's name otherwise, then says whether it is
530
+ sharing the processors, waiting its turn, having its turn or running with
531
+ OCNUS_TEST_JOBS, how long ago it started, its wait included, and how many
532
+ processors it holds out of the machine's, such as 5/10. A run still going
533
+ the other way from the setting, since it started before the switch, is
534
+ marked old mode: one that runs beside a run that started before it, with
535
+ queue, and one that waits its turn, with share. With no run going it says so
536
+ in one line, and `tests ls --json` says the same as one line for programs.
537
+ It only reads: a run whose process has gone, as after kill -9, has no line,
538
+ and its entry stays in the pool.
406
539
  The file holds "approval" too, as {"breakdown": true} or false: whether
407
540
  breakdown, the last step of the write-up phase, asks you to approve each card
408
541
  and waits for your answer. `approval --breakdown off` turns that off and
@@ -423,8 +556,9 @@ On the subscription, claude starts without ANTHROPIC_API_KEY and
423
556
  ANTHROPIC_AUTH_TOKEN, so it runs on the Claude subscription it is signed in
424
557
  to with /login, even when your shell exports either. On api, it runs on the
425
558
  Anthropic API key `billing key` saved, which it asks ocnus for through an
426
- apiKeyHelper given with --settings=, so the key is in no argument and in no
427
- agent's environment; an exported key is still kept from it. `billing key`
559
+ apiKeyHelper, given with its statusLine in --settings=, so the key is in no
560
+ argument and in no agent's environment; an exported key is still kept from
561
+ it. `billing key`
428
562
  asks for the key, or reads it from stdin, and saves it in the env file as
429
563
  `linear key` saves the Linear key; the key is never an argument, and it is not
430
564
  checked with Anthropic. On api with no key saved, `task new` and `task build`
@@ -435,6 +569,49 @@ harness starts as it always has. A Claude Code signed in with /login to a
435
569
  Console API key uses that key whatever is set. The settings button switches
436
570
  it with `billing api` and `billing subscription`; the key is saved in a
437
571
  terminal.
572
+ The file holds "chain" too, true or false: whether ocnus's watch starts
573
+ each card once the cards that block it are done. `chain off` and `chain on`
574
+ set it, leaving the rest of the file as it is, and `chain` says which is
575
+ set. It is on with no "chain", and `install` and `update` never write one.
576
+ With it on, once the watch has recorded a card's merge and finished its
577
+ task, it asks Linear once for the cards that card was blocking, and those
578
+ the card it was sliced from was blocking when the merge closed that card
579
+ too, and starts each one that is ready with `task start`, in the merged
580
+ card's space when its teams hold the card's team, or else in the one space
581
+ that lists the team. A card is ready when it is in a not-started status
582
+ (Todo), its team is in a space's teams, its description has a Specification
583
+ and a Plan, and every card that blocks it, or the card it was sliced from,
584
+ is done; a canceled blocker still holds it. A ready card that was sliced
585
+ starts through its first sub-issue that is not started, done or canceled.
586
+ Each starts from its repos' default branches as they are after the merge.
587
+ The merge's flags, which `task log` shows, name each card started and each
588
+ card not started, with why. `task ready <space>` starts every ready card
589
+ of the space's teams, whatever freed it: a blocker closed by hand in
590
+ Linear, a start that stopped, a merge recorded while Linear could not be
591
+ asked or the chain was off. It asks Linear for the cards that wait, 20 to a
592
+ question, and says what became of each. The watch runs it for every space
593
+ once its last run is half an hour old, starting none whose team more than
594
+ one space lists. With the chain off, the watch starts no card, at a merge or
595
+ each half hour, and `task ready` still starts them when you run it. With no
596
+ Linear key saved, the watch looks for none.
597
+
598
+ `usage` says how much of your Claude subscription's five-hour and weekly
599
+ usage limits is used, and when each resets. On either account, claude
600
+ starts with a statusLine, given with --settings=, that runs
601
+ `usage record` with the agent's space, card, phase and account. It saves
602
+ the limits Claude Code hands it to usage.json in ocnus's folder, and adds
603
+ what the agent's session has used to cost.db there, for `task log`; it
604
+ prints nothing, so the agents' status line is blank. An agent on an API key
605
+ hands it no limits. So the reading is as fresh as the last turn of an agent
606
+ ocnus started on the subscription, and says how old it is; a limit whose
607
+ reset has passed since is shown as reset. With billing on api, `usage` also
608
+ says what the agents ocnus started on an API key have spent today, from
609
+ midnight, and this week, from Monday at midnight, in this machine's time,
610
+ with the card that spent the most today, and how many cards the week's
611
+ spend is for and how many of them have merged; work on the subscription is
612
+ in none of it. Claude Code sessions you start yourself are not read. The
613
+ Usage section, above CPU in Herdr's sidebar, shows the limits with
614
+ `usage --json`.
438
615
 
439
616
  These variables, and your Linear key as LINEAR_API_KEY, can be exported in
440
617
  your shell or written as NAME=value lines in ~/.config/ocnus/.env, which
@@ -447,13 +624,30 @@ mod's run of ocnus needs has to be in the file. OCNUS_HOME,
447
624
  OCNUS_LIVE, OCNUS_SPACE and OCNUS_CARD are the variables the
448
625
  file cannot set.
449
626
 
627
+ In a terminal, `install` and `help`, which ocnus with no command is too,
628
+ open with a banner: OCNUS in block letters beside Ocnus on his rock,
629
+ plaiting a rope that his donkey eats as fast as he makes it. A terminal at
630
+ least 79 columns wide and 24 rows tall, whose TERM is not dumb, shows the
631
+ whole banner. It moves once, for about three seconds, then stays, and the
632
+ command goes on below it; Ctrl-C while it moves stops ocnus before the
633
+ command runs. With NO_COLOR set, it is still and has no colour. Any other
634
+ terminal at least 44 columns wide gets the OCNUS letters alone, six lines,
635
+ in colour unless NO_COLOR is set or TERM is dumb. Piped or sent to a file,
636
+ or in a terminal narrower than 44 columns, both print what they print
637
+ without it, with no banner and no letters. No other command shows either,
638
+ nor does the usage an unknown command gets. NO_COLOR and TERM are read from
639
+ the environment alone: the env file sets neither.
640
+
450
641
  The copy of ocnus in a git worktree of the ocnus repo, run as
451
642
  ./cli/ocnus, is a change being built. It runs only the commands that
452
643
  read: help, status, space ls, space team <name> with no teams,
453
- profile ls, linear archive alone or with --json, tests alone or with
454
- --json, approval alone or with --json, billing alone or with --json, task ls
455
- and task log. Every other command
456
- stops before it does anything, says why, and leaves this machine as it was.
644
+ profile ls, linear archive alone or with --json, tests and tests ls, each
645
+ alone or with --json, approval alone or with --json, billing alone or with
646
+ --json, chain alone or with --json, usage alone or with --json, task ls,
647
+ task log and task asks. task log and usage read cost.db as they read the
648
+ hand-off store, without changing either, and usage record, which writes the
649
+ usage reading and cost.db, is refused. Every other command stops before it
650
+ does anything, says why, and leaves this machine as it was.
457
651
  OCNUS_LIVE=1, set for that one run, runs it for real. The installed
458
652
  ocnus is never stopped, whatever folder it is run from.
459
653
  EOF
@@ -607,7 +801,7 @@ TEMPLATE_MARK='<!-- ocnus:template -->'
607
801
 
608
802
  # Sourced, so every file shares the settings above and each other's functions.
609
803
  LIB=$REPO/cli/lib
610
- for part in common guard links recipes trust settings space linear archive tests approval billing task finish close agents github merges handoff host commands; do
804
+ for part in common guard banner links recipes trust settings space linear archive tests approval billing chain usage cost task finish close agents github merges handoff asks sessions brief host commands; do
611
805
  [ -f "$LIB/$part.sh" ] ||
612
806
  { printf 'ocnus: %s is missing; reinstall ocnus\n' "$LIB/$part.sh" >&2; exit 1; }
613
807
  # shellcheck source=/dev/null
@@ -617,8 +811,10 @@ done
617
811
  # A worktree's copy runs only the commands that read, unless asked (guard.sh).
618
812
  guard_worktree "$@"
619
813
 
814
+ # install and help open with the banner, in a terminal that can show it
815
+ # (banner.sh). The usage an unknown command gets does not.
620
816
  case ${1:-help} in
621
- install) shift; cmd_install "$@" ;;
817
+ install) shift; banner; cmd_install "$@" ;;
622
818
  update) shift; cmd_update "$@" ;;
623
819
  status) shift; cmd_status "$@" ;;
624
820
  space) shift; cmd_space "$@" ;;
@@ -628,7 +824,9 @@ case ${1:-help} in
628
824
  tests) shift; cmd_tests "$@" ;;
629
825
  approval) shift; cmd_approval "$@" ;;
630
826
  billing) shift; cmd_billing "$@" ;;
827
+ chain) shift; cmd_chain "$@" ;;
828
+ usage) shift; cmd_usage "$@" ;;
631
829
  host) shift; cmd_host "$@" ;;
632
- help | -h | --help) usage ;;
830
+ help | -h | --help) banner; usage ;;
633
831
  *) usage >&2; exit 2 ;;
634
832
  esac