@johngaynor/ocnus 2.0.0 → 2.0.1-next.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -18
- package/cli/lib/approval.sh +1 -1
- package/cli/lib/guard.sh +5 -3
- package/cli/lib/handoff.sh +1 -1
- package/cli/lib/linear.sh +200 -34
- package/cli/lib/task.sh +61 -11
- package/cli/lib/usage.sh +159 -0
- package/cli/ocnus +34 -13
- package/herdr/README.md +155 -56
- package/herdr/layouts/default.json +10 -11
- package/herdr/mods/usage/main.js +149 -0
- package/herdr/mods/usage/mod.json +1 -0
- package/package.json +2 -2
- package/prompts/task-new.md +2 -2
- package/skills/brief/SKILL.md +4 -4
- package/skills/sdlc-breakdown/SKILL.md +69 -23
package/herdr/README.md
CHANGED
|
@@ -8,13 +8,14 @@ a layout (a whole-window arrangement of mods).
|
|
|
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/usage/` | The Usage section, right above 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
12
|
| `mods/layout-switch/` | A dropdown that shows the current layout and switches to another. |
|
|
12
13
|
| `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
14
|
| `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
15
|
| `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. |
|
|
15
16
|
| `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
17
|
| `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. |
|
|
18
|
+
| `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 Usage section and the CPU mod in the sidebar, with Usage 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. |
|
|
18
19
|
| `spaces/template/` | The starting `SPACE.md` for every new space. |
|
|
19
20
|
|
|
20
21
|
The skills are in [../skills/](../skills/), outside this folder. They are
|
|
@@ -170,7 +171,7 @@ opened, and links them with the app open or closed once it has.
|
|
|
170
171
|
| It says | When | Its exit code |
|
|
171
172
|
|---|---|---|
|
|
172
173
|
| `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 |
|
|
174
|
+
| `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
175
|
| `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
176
|
|
|
176
177
|
The key itself is never shown.
|
|
@@ -264,7 +265,9 @@ that name, and its `CLAUDE.md` and `AGENTS.md` link to it.
|
|
|
264
265
|
|
|
265
266
|
A task is one piece of work in a space, usually a Linear card. Two
|
|
266
267
|
commands make it, in this order: `task new`, then `task start`, which the
|
|
267
|
-
write-up phase runs for you
|
|
268
|
+
write-up phase runs for you as soon as you approve the card. `task start`
|
|
269
|
+
holds a card that a card not done yet blocks (see
|
|
270
|
+
[Starting the work](#starting-the-work)).
|
|
268
271
|
Two more, `task handoff` and `task log`, record and show how each step ended.
|
|
269
272
|
`task ls` lists the cards there are to start.
|
|
270
273
|
|
|
@@ -392,10 +395,12 @@ ocnus task new <space> <card>
|
|
|
392
395
|
--agent=ocnus-write-up --strict-mcp-config
|
|
393
396
|
--mcp-config=<repo>/agents/linear-mcp.json --model=opus --effort=xhigh`.
|
|
394
397
|
`env` keeps the two variables out, so the agent runs on your Claude
|
|
395
|
-
subscription (see [ocnus's variables](#ocnuss-variables))
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
398
|
+
subscription (see [ocnus's variables](#ocnuss-variables)), and
|
|
399
|
+
`--settings=` with a `statusLine` comes after `--effort=`, which saves
|
|
400
|
+
the subscription's usage limits for the Usage section (see
|
|
401
|
+
[The Usage section](#the-usage-section)). With billing on `api`, that
|
|
402
|
+
`--settings=` holds an `apiKeyHelper` instead, and the agent runs on the
|
|
403
|
+
Anthropic API key you saved (see [Billing](#billing)).
|
|
399
404
|
The profile gives the session only the tools the write-up phase uses, the
|
|
400
405
|
MCP config gives it Linear's server alone, whatever your own sessions have,
|
|
401
406
|
and the model and effort are the ones `~/.config/ocnus/settings.json`
|
|
@@ -415,12 +420,28 @@ ocnus task new <space> <card>
|
|
|
415
420
|
with the card and space filled in. It tells the agent to start with
|
|
416
421
|
`sdlc-define` and follow each skill's handoff block to the next
|
|
417
422
|
(`sdlc-plan`, then `sdlc-breakdown`), in that one session, and to wait for
|
|
418
|
-
your approval at the end, then start the build phase
|
|
423
|
+
your approval at the end, then start the build phase.
|
|
419
424
|
With the breakdown approval off, it tells the agent that `sdlc-breakdown`
|
|
420
425
|
approves a card it has no doubt about by itself, and that the agent then
|
|
421
|
-
runs `task start` as for
|
|
426
|
+
runs `task start` as for your approval (see
|
|
422
427
|
[The breakdown approval](#the-breakdown-approval)). Edit that file to change
|
|
423
428
|
what the agent is told.
|
|
429
|
+
- **Breakdown records the cards a card waits on.** `sdlc-breakdown` looks
|
|
430
|
+
for every other card that the card, or one of its slices, needs merged
|
|
431
|
+
first: in the card's description, Specification and Plan, and among the
|
|
432
|
+
open cards of the space's teams (`task ls`), a slice of another card too.
|
|
433
|
+
The Breakdown names them under the slice they block, or below a card of
|
|
434
|
+
one piece; one the whole card needs goes on its first slice. It also
|
|
435
|
+
looks for cards already approved and not started, in Todo, that need this
|
|
436
|
+
card's work first, and the summary you approve from names both kinds.
|
|
437
|
+
Nothing is recorded before you approve. Once you do, before the approval
|
|
438
|
+
is recorded and `task start` runs, it records each with
|
|
439
|
+
`ocnus linear block` (see the table below): the card's own blockers on
|
|
440
|
+
the card, or on the slice they block, and this card, or its first slice
|
|
441
|
+
that the other card needs, as a blocker of each card in Todo that needs
|
|
442
|
+
it. Since `task start` holds a card while a card that blocks it is not
|
|
443
|
+
done, that keeps the work in the order it needs. `ocnus linear read`
|
|
444
|
+
shows a card's blockers, and the cards it blocks.
|
|
424
445
|
- **Your approval moves the card.** Once you approve it, and its sub-issues
|
|
425
446
|
exist when it was sliced, the agent records the approval, and recording it
|
|
426
447
|
moves the card in Linear to its team's first not-started status (Todo in
|
|
@@ -431,34 +452,35 @@ ocnus task new <space> <card>
|
|
|
431
452
|
With the breakdown approval off, an approval the setting gave, on a card
|
|
432
453
|
the agent has no doubt about, moves the card the same way, and its summary
|
|
433
454
|
says that the setting gave it.
|
|
434
|
-
- **Your approval starts the build phase
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
455
|
+
- **Your approval starts the build phase.** The approval asks `approve`,
|
|
456
|
+
`change breakdown`, `change plan` or `change specification`. Once you
|
|
457
|
+
approve, the agent records the approval and runs `ocnus task start` itself
|
|
458
|
+
(see [Starting the work](#starting-the-work)), and the task's new tab
|
|
459
|
+
opens, in the Herdr app, or in herdr-core while the app is closed, as when
|
|
460
|
+
you run it yourself. For a card that was sliced, it starts the first
|
|
461
|
+
sub-issue that is not already started, done or canceled. No approval holds
|
|
462
|
+
the build phase back: a card you want to hold, leave unapproved, and it
|
|
463
|
+
stays in Backlog. A card that another card blocks needs no holding back,
|
|
464
|
+
since `task start` holds it by itself, making nothing and leaving it in
|
|
465
|
+
Todo, until every card that blocks it, or the card it was sliced from, is
|
|
466
|
+
done; the agent tells you which cards it named, and you run `task start`
|
|
467
|
+
once they are. The agent passes on what `task start` says still needs you,
|
|
468
|
+
such as a repo Claude Code will ask about trusting. When `task start` stops,
|
|
469
|
+
the agent does not run it again: it tells you what it said and what to run
|
|
470
|
+
once that is fixed. A started task adds a `start` row under the card it
|
|
449
471
|
started, which for a sliced card is the sub-issue, so it is in that
|
|
450
472
|
sub-issue's log. With the breakdown approval off, the agent asks you
|
|
451
|
-
nothing on a card it has no doubt about: the setting's approval
|
|
452
|
-
|
|
453
|
-
waits for your answer.
|
|
473
|
+
nothing on a card it has no doubt about: the setting's approval starts the
|
|
474
|
+
card as yours does, so it runs `task start` itself. A card it has a doubt
|
|
475
|
+
about still waits for your answer.
|
|
454
476
|
- **The write-up session is put away once the build phase starts.** The
|
|
455
477
|
approval itself closes nothing. Once `task start` has opened the build tab,
|
|
456
478
|
the write-up agent's session ends when its turn does, and its tab closes
|
|
457
|
-
(see [Putting the write-up away](#putting-the-write-up-away)). So
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
479
|
+
(see [Putting the write-up away](#putting-the-write-up-away)). So the
|
|
480
|
+
agent passes on what `task start` said in the turn that ran it, and asks
|
|
481
|
+
nothing after. When `task start` holds the card, the session stays open
|
|
482
|
+
until you run `task start` again, from any terminal. When `task start`
|
|
483
|
+
stops, it stays open, and the agent says what to run next.
|
|
462
484
|
- **It makes no branch, worktree or task folder.** The card has no type until
|
|
463
485
|
the agent has defined it, and the type is the start of the branch name.
|
|
464
486
|
- **It checks first.** An unknown space, something that is not a card ID,
|
|
@@ -475,32 +497,36 @@ ocnus task new <space> <card>
|
|
|
475
497
|
not asked, and when Linear cannot be asked (the network, a rejected key, no
|
|
476
498
|
`curl` or `jq`), the card starts as before, with a note saying why.
|
|
477
499
|
- **The skills read and write the card through ocnus.** The agent reads
|
|
478
|
-
the card with one ocnus command, and sets the type, writes each section
|
|
479
|
-
|
|
480
|
-
writes go the same way on every run. A
|
|
481
|
-
pull requests are open, moves the
|
|
482
|
-
agent's own Linear tools are for
|
|
483
|
-
card, and for other reads, such as a
|
|
500
|
+
the card with one ocnus command, and sets the type, writes each section,
|
|
501
|
+
makes a sliced card's sub-issues and records the cards that block a card
|
|
502
|
+
with four more, so the read and the writes go the same way on every run. A
|
|
503
|
+
sixth, which `sdlc-pr` runs once its pull requests are open, moves the
|
|
504
|
+
card (see [Hand-offs](#hand-offs)). The agent's own Linear tools are for
|
|
505
|
+
when ocnus cannot read or write the card, and for other reads, such as a
|
|
506
|
+
related card:
|
|
484
507
|
|
|
485
508
|
| Command | What it does |
|
|
486
509
|
|---|---|
|
|
487
|
-
| `ocnus linear read <card> [--json]` | Prints the card whole: its ID and title, then its status, labels
|
|
510
|
+
| `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. |
|
|
488
511
|
| `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. |
|
|
489
512
|
| `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. |
|
|
490
513
|
| `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. |
|
|
514
|
+
| `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. |
|
|
491
515
|
| `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. |
|
|
492
516
|
|
|
493
|
-
The
|
|
517
|
+
The five that write read back what Linear saved before they say they are
|
|
494
518
|
done: one type, the one asked for; the section there once, and the text
|
|
495
519
|
above it as it was; each slice made a sub-issue of the card, with the
|
|
496
|
-
slice's name and the card's type, and each blocker added;
|
|
497
|
-
|
|
520
|
+
slice's name and the card's type, and each blocker added; each blocker
|
|
521
|
+
`linear block` records, from the blocker to the card; the card in the
|
|
522
|
+
status it was moved to. All five need your key to have Write permission.
|
|
498
523
|
With no key saved, or a key Linear rejects, the skills read the card, and
|
|
499
|
-
write the type and the sections
|
|
500
|
-
Linear tools instead, and say so in the hand-off's flags;
|
|
501
|
-
moved then, and `sdlc-pr` says so. `sdlc-review` writes
|
|
502
|
-
them, and `sdlc-breakdown` the Breakdown
|
|
503
|
-
the write with an error too, as it does
|
|
524
|
+
write the type and the sections, make the slices and record the blockers,
|
|
525
|
+
with the agent's Linear tools instead, and say so in the hand-off's flags;
|
|
526
|
+
the card is not moved then, and `sdlc-pr` says so. `sdlc-review` writes
|
|
527
|
+
the Review with them, and `sdlc-breakdown` the Breakdown, the slices and
|
|
528
|
+
the blockers, when Linear answers the write with an error too, as it does
|
|
529
|
+
for a key without Write permission.
|
|
504
530
|
|
|
505
531
|
### The Cards panel
|
|
506
532
|
|
|
@@ -559,8 +585,8 @@ Each step of the write-up phase ends by handing off: which step it was, how it
|
|
|
559
585
|
ended (`done`, `needs-human` or `failed`) and what comes next. Breakdown, the
|
|
560
586
|
last of them, hands off `done` with `start` next once you approve the card,
|
|
561
587
|
or once the setting does, with the breakdown approval off (see below):
|
|
562
|
-
the next step is `ocnus task start`, which the agent runs
|
|
563
|
-
|
|
588
|
+
the next step is `ocnus task start`, which the agent runs as soon as the
|
|
589
|
+
card is approved. Recording that hand-off moves the card in Linear to its team's first not-started status (Todo
|
|
564
590
|
in Lab, Ready for Dev in PHY), and each of its sub-issues with it, by its own
|
|
565
591
|
team's statuses. What happened to each card is said on stderr; when one cannot
|
|
566
592
|
be moved, the hand-off is still recorded, the note names each card that was
|
|
@@ -882,8 +908,7 @@ ocnus task start <space> <card> [--type <type> --title <title>] [<repo>[:<group>
|
|
|
882
908
|
```
|
|
883
909
|
|
|
884
910
|
- **The card is its ID**, like `ABC-122`, as for `task new`. The write-up
|
|
885
|
-
phase runs this command
|
|
886
|
-
you chose to start later. For a card that was sliced, it uses the first
|
|
911
|
+
phase runs this command as soon as you approve the card. For a card that was sliced, it uses the first
|
|
887
912
|
sub-issue that is not already started, done or canceled. When no Linear key
|
|
888
913
|
is saved, or Linear rejected the key, the command has that card's type and
|
|
889
914
|
title too.
|
|
@@ -915,6 +940,27 @@ ocnus task start <space> <card> [--type <type> --title <title>] [<repo>[:<group>
|
|
|
915
940
|
flag with no value, or an option it does not know stops it too, before
|
|
916
941
|
Herdr or Linear is asked. A branch in place of the card is refused too,
|
|
917
942
|
with a note that `task start` takes the card now.
|
|
943
|
+
- **It holds a card that a card not done yet blocks.** Linear's answer about
|
|
944
|
+
the card names the cards that block it, and those that block the card it
|
|
945
|
+
was sliced from. While any of them is not in a completed status, such as
|
|
946
|
+
Done, `task start` makes no branch, worktree or tab, sends Linear no change,
|
|
947
|
+
so the card stays in Todo, and exits non-zero. It names each such card,
|
|
948
|
+
with its status and the card it blocks:
|
|
949
|
+
|
|
950
|
+
```
|
|
951
|
+
ocnus: ABC-122 is held: a card that blocks it is not done yet, so no task was made for it.
|
|
952
|
+
blocker ABC-121, in In Progress, blocks ABC-122
|
|
953
|
+
blocker ABC-90, in Todo, blocks ABC-100, the card ABC-122 was sliced from
|
|
954
|
+
ABC-122 stays in Todo. Run this again once the cards that block it are done.
|
|
955
|
+
```
|
|
956
|
+
|
|
957
|
+
Run it again once they are done: it then starts the card as usual. A card
|
|
958
|
+
that is only related to another, or a blocker that is done, holds nothing.
|
|
959
|
+
When Linear is not asked, because the type and title are given and no key
|
|
960
|
+
is saved or Linear cannot be asked, the card starts with a note that its
|
|
961
|
+
blockers were not checked. A card, or the card it was sliced from, with
|
|
962
|
+
more than 50 relations in Linear starts with a note that a card that
|
|
963
|
+
blocks it may not have been checked.
|
|
918
964
|
- **Targets say what the task works on.** Each one names a repo of the
|
|
919
965
|
space by its folder name, and optionally groups inside it:
|
|
920
966
|
|
|
@@ -1434,7 +1480,7 @@ ocnus approval [--json | --breakdown on|off]
|
|
|
1434
1480
|
approval, so the setting as it is then is the one it goes by, not the one
|
|
1435
1481
|
when the card was started. With it off, it writes the Breakdown, makes the
|
|
1436
1482
|
sub-issues when the card is sliced, records its `done` hand-off as an
|
|
1437
|
-
approval
|
|
1483
|
+
approval, whose summary and `approved: setting` line say the
|
|
1438
1484
|
setting gave it (see [Hand-offs](#hand-offs)), and runs
|
|
1439
1485
|
`ocnus task start` itself, without asking. Recording it moves the card
|
|
1440
1486
|
as your approval does. `task handoff` refuses that line while the approval
|
|
@@ -1527,6 +1573,56 @@ ocnus billing key
|
|
|
1527
1573
|
as the installed copy does; `api`, `subscription`, `key` and `key --print`
|
|
1528
1574
|
are refused.
|
|
1529
1575
|
|
|
1576
|
+
### The Usage section
|
|
1577
|
+
|
|
1578
|
+
On the `default` layout, the Usage section sits in the sidebar right above
|
|
1579
|
+
CPU, and is as small: how much of your Claude subscription's usage limits is
|
|
1580
|
+
used, and when each resets, so you can pace the agents without leaving
|
|
1581
|
+
Herdr.
|
|
1582
|
+
|
|
1583
|
+
```sh
|
|
1584
|
+
ocnus usage [--json]
|
|
1585
|
+
```
|
|
1586
|
+
|
|
1587
|
+
- **Two rows, one for each limit**: `5-hour` and `Weekly`, each with how much
|
|
1588
|
+
of it is used, as a percentage and a bar, and when it resets, in this
|
|
1589
|
+
machine's time: the clock alone on the same day, as `3:40pm`, the weekday
|
|
1590
|
+
too within six days, as `Tue 9am`, and the date further away. A bar
|
|
1591
|
+
changes colour from 75% used, and again from 90%.
|
|
1592
|
+
- **The reading comes from the agents ocnus starts.** Claude Code hands a
|
|
1593
|
+
status line command the subscription's limits each time it updates the
|
|
1594
|
+
status line, which it does as the agent works. With billing on the
|
|
1595
|
+
subscription, `task new` and `task build` start `claude` with a
|
|
1596
|
+
`statusLine` in `--settings=` that runs `ocnus usage record`, which
|
|
1597
|
+
saves the two limits, and when it read them, to
|
|
1598
|
+
`~/.config/ocnus/usage.json`. It prints nothing, so the agents' status
|
|
1599
|
+
line is blank, and it takes the place of a status line of your own in
|
|
1600
|
+
those agents alone. A status line with no limits in it, as before an
|
|
1601
|
+
agent's first answer, leaves the last reading as it was.
|
|
1602
|
+
- **So it is as fresh as the last turn of an agent ocnus started**, and
|
|
1603
|
+
matches Claude Code's own `/usage` then. While no agent works it ages: a
|
|
1604
|
+
reading older than ten minutes says how old it is, as `read 12m ago`, and
|
|
1605
|
+
a limit whose reset has passed since shows no number, and when it reset.
|
|
1606
|
+
Claude Code sessions you start yourself are not read, since their settings
|
|
1607
|
+
are your own.
|
|
1608
|
+
- **With no reading, one line says so** in place of the numbers: no reading
|
|
1609
|
+
yet, as before the first agent on the subscription has answered, a file
|
|
1610
|
+
that cannot be read, or both limits reset since the last reading. The rest
|
|
1611
|
+
of the sidebar works as before.
|
|
1612
|
+
- **On `api` there is none**: an agent on an Anthropic API key has no usage
|
|
1613
|
+
limits, so it gets no `statusLine`, and the section keeps the last
|
|
1614
|
+
reading, ageing. `ocnus usage` says billing is on the API.
|
|
1615
|
+
- **It reads every 30 seconds** while the window can be seen, with
|
|
1616
|
+
`ocnus usage --json`, and works nothing out itself: each reset time, the
|
|
1617
|
+
reading's age and the line to show with no numbers come from the command.
|
|
1618
|
+
When `ocnus` is not on Herdr's `PATH`, it runs the copy the mod is linked
|
|
1619
|
+
from. `--json` prints one line for programs:
|
|
1620
|
+
`{"file":"…/usage.json","read_at":…,"age":"3m","stale":false,"five_hour":{"used":42,"resets_at":…,"reset":false,"resets":"3:40pm"},"seven_day":{…},"note":null}`.
|
|
1621
|
+
- **It needs `jq`.** Without it `ocnus usage` stops and says so, and an
|
|
1622
|
+
agent's `usage record` saves nothing.
|
|
1623
|
+
- **In a worktree**, `./cli/ocnus usage`, alone or with `--json`, reads as
|
|
1624
|
+
the installed copy does; `usage record` is refused.
|
|
1625
|
+
|
|
1530
1626
|
## Recording the host
|
|
1531
1627
|
|
|
1532
1628
|
ocnus can keep a record of how hard the host, the machine it runs on,
|
|
@@ -1604,9 +1700,11 @@ ocnus tests run <command> # run a test command, and record the test run
|
|
|
1604
1700
|
for before every reading, so it asks hc for nothing more. A tab that
|
|
1605
1701
|
holds its shell alone is not open, so it is neither, whatever its status.
|
|
1606
1702
|
- **Each agent's time, split in three.** While recording is on, `task new`
|
|
1607
|
-
and `task build` start `claude` with
|
|
1608
|
-
|
|
1609
|
-
|
|
1703
|
+
and `task build` start `claude` with Claude Code hooks in `--settings=`,
|
|
1704
|
+
which mark the agent's time, for the first start and for
|
|
1705
|
+
`task build --continue`. On the subscription they are in the one
|
|
1706
|
+
`--settings=` that holds the agent's `statusLine` (see
|
|
1707
|
+
[The Usage section](#the-usage-section)); on `api`, in one of their own. Each hook runs
|
|
1610
1708
|
`cli/host-mark <mark> <file>`, which appends one line, `<mark> <time>`, to
|
|
1611
1709
|
the file, with the time in seconds since 1970, to the millisecond, from
|
|
1612
1710
|
`perl`'s `Time::HiRes`. The file is
|
|
@@ -2228,7 +2326,8 @@ shell, or written as a `NAME=value` line in ocnus's env file,
|
|
|
2228
2326
|
repo, runs only the commands that read: `help`, `status`, `space ls`,
|
|
2229
2327
|
`space team <name>`, `profile ls`, `linear archive` (alone or with
|
|
2230
2328
|
`--json`), `tests` (alone or with `--json`), `billing` (alone or with
|
|
2231
|
-
`--json`), `task ls`, `task log`,
|
|
2329
|
+
`--json`), `usage` (alone or with `--json`), `task ls`, `task log`,
|
|
2330
|
+
`host` and `host report`. Any other command stops
|
|
2232
2331
|
before it changes anything, and says to run plain `ocnus` for a card's
|
|
2233
2332
|
own steps, to write a test case to try the command, or to run it for real
|
|
2234
2333
|
with `OCNUS_LIVE=1 ./cli/ocnus …`. Plain `ocnus` is never
|
|
@@ -57,17 +57,6 @@
|
|
|
57
57
|
},
|
|
58
58
|
"min": 90
|
|
59
59
|
},
|
|
60
|
-
{
|
|
61
|
-
"id": "agents",
|
|
62
|
-
"type": "block",
|
|
63
|
-
"content": {
|
|
64
|
-
"mod": "agents"
|
|
65
|
-
},
|
|
66
|
-
"size": {
|
|
67
|
-
"weight": 1
|
|
68
|
-
},
|
|
69
|
-
"min": 90
|
|
70
|
-
},
|
|
71
60
|
{
|
|
72
61
|
"id": "steps",
|
|
73
62
|
"type": "block",
|
|
@@ -81,6 +70,16 @@
|
|
|
81
70
|
}
|
|
82
71
|
]
|
|
83
72
|
},
|
|
73
|
+
{
|
|
74
|
+
"id": "usage",
|
|
75
|
+
"type": "block",
|
|
76
|
+
"size": {
|
|
77
|
+
"px": 64
|
|
78
|
+
},
|
|
79
|
+
"content": {
|
|
80
|
+
"mod": "usage"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
84
83
|
{
|
|
85
84
|
"id": "cpu",
|
|
86
85
|
"type": "block",
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
// The Usage section: how much of the Claude subscription's five-hour and
|
|
2
|
+
// weekly usage limits is used, and when each resets. It sits above CPU in
|
|
3
|
+
// the default layout's sidebar, and is as small.
|
|
4
|
+
//
|
|
5
|
+
// All of that is worked out by `ocnus usage --json`, which reads what the
|
|
6
|
+
// status line of the agents ocnus starts on the subscription last saved.
|
|
7
|
+
// This mod draws what that command returns and holds no rules about the
|
|
8
|
+
// limits: each reset time and the reading's age arrive as text, and so does
|
|
9
|
+
// the one line to show when there are no numbers. A reading older than ten
|
|
10
|
+
// minutes says how old it is.
|
|
11
|
+
import { View, div } from "gpui-kit";
|
|
12
|
+
import { h_flex, v_flex } from "gpui-base";
|
|
13
|
+
import { exec, theme, window, checking, appHome } from "herdr";
|
|
14
|
+
|
|
15
|
+
// The reading changes at most once an agent's turn, so a read every half
|
|
16
|
+
// minute is fresh enough.
|
|
17
|
+
const READ_MS = 30000;
|
|
18
|
+
const TIMEOUT_MS = 10000;
|
|
19
|
+
// How this mod's own link into the repo that ships it ends.
|
|
20
|
+
const LINKED_AT = "/herdr/mods/usage";
|
|
21
|
+
// A limit this used shows in the warning colours.
|
|
22
|
+
const HIGH = 75;
|
|
23
|
+
const FULL = 90;
|
|
24
|
+
|
|
25
|
+
// `herdr-app check` draws the mod once, with nothing read. It is given
|
|
26
|
+
// this to draw, so a mistake in a row fails the check: a stale reading, one
|
|
27
|
+
// limit nearly used and the other reset since.
|
|
28
|
+
const SAMPLE = {
|
|
29
|
+
read_at: 1, age: "12m", stale: true, note: null,
|
|
30
|
+
five_hour: { used: 92.4, resets_at: 1, reset: false, resets: "3:40pm" },
|
|
31
|
+
seven_day: { used: null, resets_at: 1, reset: true, resets: "Tue 9am" },
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
function parse(text) {
|
|
35
|
+
try {
|
|
36
|
+
return JSON.parse(text);
|
|
37
|
+
} catch {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// What a failed command said, without the name it starts its errors with.
|
|
43
|
+
const said = (r) => (r.stderr || r.stdout).trim().replace(/^ocnus: /, "");
|
|
44
|
+
|
|
45
|
+
const OLD_CLI = "This ocnus is too old for Usage. Run: ocnus update";
|
|
46
|
+
// An ocnus from before `usage` answers with its help, not JSON.
|
|
47
|
+
const failure = (r) => {
|
|
48
|
+
const text = said(r);
|
|
49
|
+
return text.startsWith("set up and maintain") || text.startsWith("usage:") ? OLD_CLI : text || "ocnus usage failed";
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default class Usage extends View {
|
|
53
|
+
init(_props, cx) {
|
|
54
|
+
this.cmd = "ocnus"; // the one on PATH, until that cannot start
|
|
55
|
+
this.view = null;
|
|
56
|
+
this.error = null;
|
|
57
|
+
this.busy = false;
|
|
58
|
+
this.loaded = false; // whether a read has ended yet
|
|
59
|
+
this.drawn = null; // what the last redraw showed, to redraw only on a change
|
|
60
|
+
if (checking()) return;
|
|
61
|
+
cx.timer.every(READ_MS, (cx) => this.look(cx));
|
|
62
|
+
this.look(cx);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Runs the ocnus command. One that cannot run is tried again as the
|
|
66
|
+
// copy this mod is linked from: Herdr may have been started without the
|
|
67
|
+
// user's PATH. `usage --json` only reads, so twice is safe.
|
|
68
|
+
async ocnus(args) {
|
|
69
|
+
try {
|
|
70
|
+
return await exec(this.cmd, args, { timeout: TIMEOUT_MS });
|
|
71
|
+
} catch (e) {
|
|
72
|
+
if (this.cmd !== "ocnus") throw e;
|
|
73
|
+
const link = await exec("readlink", [`${appHome()}/mods/usage`]);
|
|
74
|
+
const at = link.stdout.trim();
|
|
75
|
+
if (link.code !== 0 || !at.endsWith(LINKED_AT)) throw e;
|
|
76
|
+
this.cmd = `${at.slice(0, -LINKED_AT.length)}/cli/ocnus`;
|
|
77
|
+
return exec(this.cmd, args, { timeout: TIMEOUT_MS });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Read the usage again, unless a read is in flight or nobody can see the
|
|
82
|
+
// window.
|
|
83
|
+
look(cx) {
|
|
84
|
+
if (this.busy || window()?.visible === false) return;
|
|
85
|
+
this.busy = true;
|
|
86
|
+
cx.spawn(async (cx) => {
|
|
87
|
+
let view = null;
|
|
88
|
+
let error = null;
|
|
89
|
+
try {
|
|
90
|
+
const r = await this.ocnus(["usage", "--json"]);
|
|
91
|
+
const got = r.code === 0 ? parse(r.stdout) : null;
|
|
92
|
+
if (got && typeof got === "object" && "five_hour" in got && "seven_day" in got) view = got;
|
|
93
|
+
else error = r.code === 0 ? OLD_CLI : failure(r);
|
|
94
|
+
} catch (e) {
|
|
95
|
+
error = `Could not run ocnus: ${e?.message ?? e}`;
|
|
96
|
+
}
|
|
97
|
+
this.view = view;
|
|
98
|
+
this.error = error;
|
|
99
|
+
this.loaded = true;
|
|
100
|
+
this.busy = false;
|
|
101
|
+
// A redraw of a mod redraws the whole window, so only when what it
|
|
102
|
+
// shows has changed: the age counts on, and shows only once stale.
|
|
103
|
+
const drawn = JSON.stringify([view && { ...view, age: view.stale ? view.age : null }, error]);
|
|
104
|
+
if (drawn !== this.drawn) {
|
|
105
|
+
this.drawn = drawn;
|
|
106
|
+
cx.notify();
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// One limit, on one line: its name, how much is used, a bar of it, and
|
|
112
|
+
// when it resets. A limit whose reset has passed since the reading shows
|
|
113
|
+
// no number, and when it reset.
|
|
114
|
+
row(name, w, t) {
|
|
115
|
+
const on = w && !w.reset && typeof w.used === "number";
|
|
116
|
+
const used = on ? Math.max(0, Math.min(100, w.used)) : 0;
|
|
117
|
+
const color = used >= FULL ? t.blocked : used >= HIGH ? t.ansi3 : t.ansi4;
|
|
118
|
+
const when = !w ? "" : w.reset ? `reset ${w.resets ?? ""}` : w.resets ?? "";
|
|
119
|
+
return h_flex().flex_none().gap(8).items_center()
|
|
120
|
+
.child(div().w(46).flex_none().text_size(11).text_color(t.muted).child(name))
|
|
121
|
+
.child(div().w(34).flex_none().text_size(12).font_semibold()
|
|
122
|
+
.text_color(on && used >= FULL ? t.blocked : t.foreground)
|
|
123
|
+
.child(on ? `${Math.round(used)}%` : "–"))
|
|
124
|
+
.child(div().flex_1().min_w(0).h(4).rounded(2).bg(t.surface).overflow_hidden()
|
|
125
|
+
.child(div().h_full().rounded(2).bg(color).w(`${used}%`)))
|
|
126
|
+
.child(div().flex_none().text_size(11).text_color(w?.reset ? t.dim : t.muted).child(when));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
render() {
|
|
130
|
+
const t = theme();
|
|
131
|
+
const sample = checking();
|
|
132
|
+
const view = sample ? SAMPLE : this.view;
|
|
133
|
+
const line = (text, color) =>
|
|
134
|
+
div().text_size(11).text_color(color).truncate().child(text);
|
|
135
|
+
let body;
|
|
136
|
+
if (!sample && !this.loaded) body = [line("Reading…", t.dim)];
|
|
137
|
+
else if (!sample && this.error) body = [line(this.error, t.blocked)];
|
|
138
|
+
else if (view.note) body = [line(view.note, t.dim)];
|
|
139
|
+
else body = [this.row("5-hour", view.five_hour, t), this.row("Weekly", view.seven_day, t)];
|
|
140
|
+
// A line height of its own, so that its three lines fit the 64px the
|
|
141
|
+
// layout gives it, as small as CPU, whatever the default is.
|
|
142
|
+
return v_flex().size_full().px(14).py(6).gap(2).justify_center().line_height(1.25).overflow_hidden()
|
|
143
|
+
.bg(t.chrome).border_t(1).border_color(t.border)
|
|
144
|
+
.child(h_flex().flex_none().justify_between().items_center().text_size(11)
|
|
145
|
+
.child(div().text_color(t.muted).child("Usage"))
|
|
146
|
+
.child(div().text_color(t.dim).child(view?.stale && view.age ? `read ${view.age} ago` : "")))
|
|
147
|
+
.children(body);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "place": "none", "title": "Usage" }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@johngaynor/ocnus",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1-next.12",
|
|
4
4
|
"description": "A software factory: agent skills and the Herdr setup to run them, installed with one command.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -24,6 +24,6 @@
|
|
|
24
24
|
],
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|
|
27
|
-
"url": "git+https://github.com/johngaynor/ocnus.git"
|
|
27
|
+
"url": "git+https://github.com/johngaynor/ocnus-ai.git"
|
|
28
28
|
}
|
|
29
29
|
}
|
package/prompts/task-new.md
CHANGED
|
@@ -10,8 +10,8 @@ If I ask for a change when I'm approving, sdlc-breakdown tells you which skill m
|
|
|
10
10
|
|
|
11
11
|
Do every step yourself, in this session. Don't hand a step to a subagent.
|
|
12
12
|
|
|
13
|
-
sdlc-breakdown asks me to approve the card, and
|
|
13
|
+
sdlc-breakdown asks me to approve the card, and approving it starts its build phase. With the breakdown approval off (`ocnus approval --breakdown off`), sdlc-breakdown approves a card it has no doubt about by itself, without asking me, and asks me only about one it has a doubt about. When it hands off with `next: start`, the card is approved, and the work starts with:
|
|
14
14
|
|
|
15
15
|
ocnus task start {space} {card}
|
|
16
16
|
|
|
17
|
-
It names the branch from the type you set on the card and from its title. If the card was sliced, it takes a sub-issue's ID in place of {card}. sdlc-breakdown's Start the build phase says which, and what to do when it stops. Run it yourself
|
|
17
|
+
It names the branch from the type you set on the card and from its title. If the card was sliced, it takes a sub-issue's ID in place of {card}. sdlc-breakdown's Start the build phase says which, and what to do when it stops. Run it yourself as soon as the card is approved, by me or by the setting. When a card that blocks it, or the card it was sliced from, is not done yet, it holds the card and makes nothing: tell me which cards it named, and give me the command to run once they are done. When sdlc-breakdown says to give the card's type and title, add `--type` and `--title` to the command, as the skill shows, whether you run it or give it to me.
|
package/skills/brief/SKILL.md
CHANGED
|
@@ -20,8 +20,8 @@ No more than five lines, in three parts, each starting with its name in bold:
|
|
|
20
20
|
Write each line in plain words, for someone who knows the work but has been away from it. Leave out what the human can't act on, such as which files you read. Give no more than the five lines: they can ask for more.
|
|
21
21
|
|
|
22
22
|
```
|
|
23
|
-
- **Task:** ABC-122, a Download CSV button on the orders page,
|
|
24
|
-
- **So far:**
|
|
23
|
+
- **Task:** ABC-122, a Download CSV button on the orders page, slice 2 of 3 of ABC-100 Orders, in the Linear project Shop.
|
|
24
|
+
- **So far:** Slice 1 (ABC-121) has merged. ABC-122 was approved and started, and the build step made the export in api and the button in web, in two commits; the tests pass.
|
|
25
25
|
- **Now:** Checking the work against the card's Done when, item 2 of 3.
|
|
26
26
|
```
|
|
27
27
|
|
|
@@ -31,8 +31,8 @@ Write each line in plain words, for someone who knows the work but has been away
|
|
|
31
31
|
|
|
32
32
|
The session's first message names a Linear card and an ocnus space, and has you record each hand-off for them. After a long run your memory of how it started may be gone, but the card, its log and its commits are not. So read them again for each brief, rather than going from memory:
|
|
33
33
|
|
|
34
|
-
- **Task:** `ocnus linear read <card>` gives the card's ask, in its title and its original description above the Specification, and, on lines of their own at the top, its parent card and its Linear project. Name the card, what it asks for, and its parent card and Linear project when it has them. When `ocnus linear read` can't read the card, because no Linear key is saved or Linear rejected the key, read it with the Linear tools.
|
|
35
|
-
- **So far:** `ocnus task log <space> <card>` gives each step recorded so far and how it ended. Once the task has started, the commits on the task's branch give what the build phase has made: `git log --oneline origin/<default branch>..HEAD` in each of the task's worktrees. What you say has happened agrees with both. Name the steps that are done and what came of them, not every row.
|
|
34
|
+
- **Task:** `ocnus linear read <card>` gives the card's ask, in its title and its original description above the Specification, and, on lines of their own at the top, its parent card and its Linear project. Name the card, what it asks for, and its parent card and Linear project when it has them. A card with a parent is a slice of it: read the parent too, with `ocnus linear read <parent>`, which lists its sub-issues, its slices, in the order breakdown made them. Give the card's place among them with the parent, as `slice N of M of <parent ID> <parent title>`: N is where the card is in that list, and M is how many slices it has. When `ocnus linear read` can't read the card or its parent, because no Linear key is saved or Linear rejected the key, read it with the Linear tools, and count the slices oldest first, by when each was made.
|
|
35
|
+
- **So far:** `ocnus task log <space> <card>` gives each step recorded so far and how it ended. Once the task has started, the commits on the task's branch give what the build phase has made: `git log --oneline origin/<default branch>..HEAD` in each of the task's worktrees. What you say has happened agrees with both. Name the steps that are done and what came of them, not every row. For a slice, open with what has shipped under its parent: name the parent's other slices that are Done, which a slice is once its pull requests have merged, or say that none has shipped yet. For a card with slices of its own, its sub-issues in `ocnus linear read <card>`, open the same way with those of them that are Done, or say that none has shipped yet. Name each Done slice by ID and slice number, as "Slice 1 (ABC-121) has merged.", not by its title, and all of them in one sentence, never a line each, so that the brief stays within five lines however many there are. A card with neither a parent nor slices of its own has no such sentence, and no place among slices on **Task:**.
|
|
36
36
|
- **Now:** this comes from you: the step you are in and what you are doing in it, or the question you are waiting on.
|
|
37
37
|
|
|
38
38
|
### In any other session
|