@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/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
96
- YYYY-MM-DD, or <day>..<day>
124
+ ocnus host report [<period>] how often CPU, memory and disk were at their limit, the
125
+ steps, phases and test runs that used the most CPU and
126
+ memory, and where the steps' time went: <n>d or <n>h back
127
+ from now (7d when none is given), a day YYYY-MM-DD, or
128
+ <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
@@ -281,20 +386,9 @@ at their limit: CPU at least 90% busy across all cores, memory pressure at
281
386
  warning or critical, and under 10% of the home folder's disk free. Time with
282
387
  no reading, such as when no agent was open, is shown as missing, never as
283
388
  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.
389
+ runs included. Then it lists the 10 steps and the 10 phases, each one
390
+ card's own, that used the most CPU time, and that held the most memory at
391
+ once, then the 10 test runs that did.
298
392
 
299
393
  While the host is recorded, `task new` and `task build` also start claude
300
394
  with hooks that mark when its agent starts and stops, is given a prompt,
@@ -308,22 +402,41 @@ same for the 10 steps open longest, and how many steps had no split, as an
308
402
  agent started in another harness or while recording was off has none.
309
403
 
310
404
  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.
405
+ days.
315
406
 
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.
407
+ `host report --card <space> <card> --json` gives what the host recorded
408
+ while each of a card's steps ran, as one line of JSON for programs, so that
409
+ a slow step can be set beside how busy the host was then. `steps` lists
410
+ each time the card was in a step, oldest first: hand-offs of one step in a
411
+ row, from the hand-off before the first to the last, timed as `task log`
412
+ times them, so the time it waited on you is inside it. `task new` and
413
+ `task start` take no time there, so they have no entry. Each entry has its
414
+ `run` and `step`, its `start` and `end` in UTC, its `seconds`, and `open`,
415
+ true for the step the card is in now, which runs to now: the one whose
416
+ question waits on you or was just answered, or the one the latest hand-off
417
+ names as next, when an agent runs it. It also has `readings`, how many
418
+ readings have seconds inside the step, `recorded`, the seconds they cover,
419
+ and `points`, the readings themselves, oldest first. A point has the
420
+ `start` and `end` of the time it stands for, the recorded `seconds` in it,
421
+ `cpu_busy`, how busy the CPU was across all cores, as a percentage,
422
+ `mem_used_mb`, the memory used, and `mem_pressure`: normal, warning or
423
+ critical. They are the whole host's figures, not the card's own share. A
424
+ step with 60 readings or fewer comes back reading by reading. One with more
425
+ is cut into 60 equal parts, and each part with a reading in it gives one
426
+ point: the average of the CPU and of the memory over the part's recorded
427
+ seconds, and the worst memory pressure in it, so every reading counts and
428
+ none is dropped. Time with no reading has no point, so it is never given as
429
+ idle or as 0: a step with no reading has `readings` 0 and no points, and a
430
+ figure no reading in a point had is null. With recording off, `recording`
431
+ is false, and the steps are still listed, each with no readings. A card
432
+ with no hand-offs has no steps. It can be asked at any point in a card's
433
+ life, after its task is finished too, for as long as the readings are kept.
434
+ A request it cannot make sense of is refused with a message on stderr, exit
435
+ 1 and nothing on stdout, so that a program never reads words as JSON:
436
+ --card without a space and a card, --card without --json or --json without
437
+ --card, a period or any other word beside them, a space that does not
438
+ exist, a card that is not a card ID, and hand-offs or readings that cannot
439
+ be read.
327
440
 
328
441
  `tests run <command> [<arg>...]` runs a repo's test command, whole suite or
329
442
  part, as in `ocnus tests run npm test`: its output goes straight
@@ -348,7 +461,8 @@ Your spaces are in ~/.config/ocnus/spaces (OCNUS_HOME picks
348
461
  another ~/.config/ocnus), each with a SPACE.md.
349
462
  A machine set up before keeps ~/.config/ocnus/projects and PROJECT.md.
350
463
  Hand-offs are recorded beside them, in ocnus.db, with sqlite3
351
- (OCNUS_SQLITE picks another command).
464
+ (OCNUS_SQLITE picks another command), and so are the agents' sessions
465
+ and the last brief of each card.
352
466
 
353
467
  A profile is a Claude Code agent definition: the tools a session has,
354
468
  whatever your own sessions have. claude starts with one, ocnus-write-up
@@ -378,8 +492,8 @@ is opus at xhigh. A file that is not valid settings stops `task new` and
378
492
  `task build` before an agent starts, saying what in it is wrong, and
379
493
  `status` says so too. The file is read with jq. The settings button, a cog at
380
494
  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.
495
+ and the "archive", "tests", "approval", "billing" and "chain" settings below
496
+ with their own.
383
497
  The file also holds "archive", true or false: `linear archive on` and
384
498
  `linear archive off` set it, leaving the profiles as they are, and
385
499
  `linear archive` says whether it is on. It is off with no "archive", and
@@ -403,6 +517,19 @@ how many runs are ahead of it, and starts no case until none that started
403
517
  before it is going; then it has every processor. A run with
404
518
  OCNUS_TEST_JOBS set waits its turn too. Each run reads the file as it
405
519
  starts.
520
+ `tests ls` lists the runs going, from test-runs in ocnus's folder, in the
521
+ order they started, which is the order the waiting ones get their turns.
522
+ Each line names the run's card, such as LAB-241, when it was started in a
523
+ task's folder, and its folder's name otherwise, then says whether it is
524
+ sharing the processors, waiting its turn, having its turn or running with
525
+ OCNUS_TEST_JOBS, how long ago it started, its wait included, and how many
526
+ processors it holds out of the machine's, such as 5/10. A run still going
527
+ the other way from the setting, since it started before the switch, is
528
+ marked old mode: one that runs beside a run that started before it, with
529
+ queue, and one that waits its turn, with share. With no run going it says so
530
+ in one line, and `tests ls --json` says the same as one line for programs.
531
+ It only reads: a run whose process has gone, as after kill -9, has no line,
532
+ and its entry stays in the pool.
406
533
  The file holds "approval" too, as {"breakdown": true} or false: whether
407
534
  breakdown, the last step of the write-up phase, asks you to approve each card
408
535
  and waits for your answer. `approval --breakdown off` turns that off and
@@ -423,8 +550,9 @@ On the subscription, claude starts without ANTHROPIC_API_KEY and
423
550
  ANTHROPIC_AUTH_TOKEN, so it runs on the Claude subscription it is signed in
424
551
  to with /login, even when your shell exports either. On api, it runs on the
425
552
  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`
553
+ apiKeyHelper, given with its statusLine in --settings=, so the key is in no
554
+ argument and in no agent's environment; an exported key is still kept from
555
+ it. `billing key`
428
556
  asks for the key, or reads it from stdin, and saves it in the env file as
429
557
  `linear key` saves the Linear key; the key is never an argument, and it is not
430
558
  checked with Anthropic. On api with no key saved, `task new` and `task build`
@@ -435,6 +563,49 @@ harness starts as it always has. A Claude Code signed in with /login to a
435
563
  Console API key uses that key whatever is set. The settings button switches
436
564
  it with `billing api` and `billing subscription`; the key is saved in a
437
565
  terminal.
566
+ The file holds "chain" too, true or false: whether ocnus's watch starts
567
+ each card once the cards that block it are done. `chain off` and `chain on`
568
+ set it, leaving the rest of the file as it is, and `chain` says which is
569
+ set. It is on with no "chain", and `install` and `update` never write one.
570
+ With it on, once the watch has recorded a card's merge and finished its
571
+ task, it asks Linear once for the cards that card was blocking, and those
572
+ the card it was sliced from was blocking when the merge closed that card
573
+ too, and starts each one that is ready with `task start`, in the merged
574
+ card's space when its teams hold the card's team, or else in the one space
575
+ that lists the team. A card is ready when it is in a not-started status
576
+ (Todo), its team is in a space's teams, its description has a Specification
577
+ and a Plan, and every card that blocks it, or the card it was sliced from,
578
+ is done; a canceled blocker still holds it. A ready card that was sliced
579
+ starts through its first sub-issue that is not started, done or canceled.
580
+ Each starts from its repos' default branches as they are after the merge.
581
+ The merge's flags, which `task log` shows, name each card started and each
582
+ card not started, with why. `task ready <space>` starts every ready card
583
+ of the space's teams, whatever freed it: a blocker closed by hand in
584
+ Linear, a start that stopped, a merge recorded while Linear could not be
585
+ asked or the chain was off. It asks Linear for the cards that wait, 20 to a
586
+ question, and says what became of each. The watch runs it for every space
587
+ once its last run is half an hour old, starting none whose team more than
588
+ one space lists. With the chain off, the watch starts no card, at a merge or
589
+ each half hour, and `task ready` still starts them when you run it. With no
590
+ Linear key saved, the watch looks for none.
591
+
592
+ `usage` says how much of your Claude subscription's five-hour and weekly
593
+ usage limits is used, and when each resets. On either account, claude
594
+ starts with a statusLine, given with --settings=, that runs
595
+ `usage record` with the agent's space, card, phase and account. It saves
596
+ the limits Claude Code hands it to usage.json in ocnus's folder, and adds
597
+ what the agent's session has used to cost.db there, for `task log`; it
598
+ prints nothing, so the agents' status line is blank. An agent on an API key
599
+ hands it no limits. So the reading is as fresh as the last turn of an agent
600
+ ocnus started on the subscription, and says how old it is; a limit whose
601
+ reset has passed since is shown as reset. With billing on api, `usage` also
602
+ says what the agents ocnus started on an API key have spent today, from
603
+ midnight, and this week, from Monday at midnight, in this machine's time,
604
+ with the card that spent the most today, and how many cards the week's
605
+ spend is for and how many of them have merged; work on the subscription is
606
+ in none of it. Claude Code sessions you start yourself are not read. The
607
+ Usage section, above CPU in Herdr's sidebar, shows the limits with
608
+ `usage --json`.
438
609
 
439
610
  These variables, and your Linear key as LINEAR_API_KEY, can be exported in
440
611
  your shell or written as NAME=value lines in ~/.config/ocnus/.env, which
@@ -447,13 +618,30 @@ mod's run of ocnus needs has to be in the file. OCNUS_HOME,
447
618
  OCNUS_LIVE, OCNUS_SPACE and OCNUS_CARD are the variables the
448
619
  file cannot set.
449
620
 
621
+ In a terminal, `install` and `help`, which ocnus with no command is too,
622
+ open with a banner: OCNUS in block letters beside Ocnus on his rock,
623
+ plaiting a rope that his donkey eats as fast as he makes it. A terminal at
624
+ least 79 columns wide and 24 rows tall, whose TERM is not dumb, shows the
625
+ whole banner. It moves once, for about three seconds, then stays, and the
626
+ command goes on below it; Ctrl-C while it moves stops ocnus before the
627
+ command runs. With NO_COLOR set, it is still and has no colour. Any other
628
+ terminal at least 44 columns wide gets the OCNUS letters alone, six lines,
629
+ in colour unless NO_COLOR is set or TERM is dumb. Piped or sent to a file,
630
+ or in a terminal narrower than 44 columns, both print what they print
631
+ without it, with no banner and no letters. No other command shows either,
632
+ nor does the usage an unknown command gets. NO_COLOR and TERM are read from
633
+ the environment alone: the env file sets neither.
634
+
450
635
  The copy of ocnus in a git worktree of the ocnus repo, run as
451
636
  ./cli/ocnus, is a change being built. It runs only the commands that
452
637
  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.
638
+ profile ls, linear archive alone or with --json, tests and tests ls, each
639
+ alone or with --json, approval alone or with --json, billing alone or with
640
+ --json, chain alone or with --json, usage alone or with --json, task ls,
641
+ task log and task asks. task log and usage read cost.db as they read the
642
+ hand-off store, without changing either, and usage record, which writes the
643
+ usage reading and cost.db, is refused. Every other command stops before it
644
+ does anything, says why, and leaves this machine as it was.
457
645
  OCNUS_LIVE=1, set for that one run, runs it for real. The installed
458
646
  ocnus is never stopped, whatever folder it is run from.
459
647
  EOF
@@ -607,7 +795,7 @@ TEMPLATE_MARK='<!-- ocnus:template -->'
607
795
 
608
796
  # Sourced, so every file shares the settings above and each other's functions.
609
797
  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
798
+ 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
799
  [ -f "$LIB/$part.sh" ] ||
612
800
  { printf 'ocnus: %s is missing; reinstall ocnus\n' "$LIB/$part.sh" >&2; exit 1; }
613
801
  # shellcheck source=/dev/null
@@ -617,8 +805,10 @@ done
617
805
  # A worktree's copy runs only the commands that read, unless asked (guard.sh).
618
806
  guard_worktree "$@"
619
807
 
808
+ # install and help open with the banner, in a terminal that can show it
809
+ # (banner.sh). The usage an unknown command gets does not.
620
810
  case ${1:-help} in
621
- install) shift; cmd_install "$@" ;;
811
+ install) shift; banner; cmd_install "$@" ;;
622
812
  update) shift; cmd_update "$@" ;;
623
813
  status) shift; cmd_status "$@" ;;
624
814
  space) shift; cmd_space "$@" ;;
@@ -628,7 +818,9 @@ case ${1:-help} in
628
818
  tests) shift; cmd_tests "$@" ;;
629
819
  approval) shift; cmd_approval "$@" ;;
630
820
  billing) shift; cmd_billing "$@" ;;
821
+ chain) shift; cmd_chain "$@" ;;
822
+ usage) shift; cmd_usage "$@" ;;
631
823
  host) shift; cmd_host "$@" ;;
632
- help | -h | --help) usage ;;
824
+ help | -h | --help) banner; usage ;;
633
825
  *) usage >&2; exit 2 ;;
634
826
  esac