@johngaynor/ocnus 0.0.0-stage → 2.0.0

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 (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +988 -2
  3. package/agents/linear-mcp.json +1 -0
  4. package/agents/ocnus-build.md +23 -0
  5. package/agents/ocnus-write-up.md +20 -0
  6. package/cli/host-mark +36 -0
  7. package/cli/lib/agents.sh +350 -0
  8. package/cli/lib/approval.sh +94 -0
  9. package/cli/lib/archive.sh +447 -0
  10. package/cli/lib/billing.sh +166 -0
  11. package/cli/lib/close.sh +189 -0
  12. package/cli/lib/commands.sh +220 -0
  13. package/cli/lib/common.sh +215 -0
  14. package/cli/lib/finish.sh +288 -0
  15. package/cli/lib/github.sh +162 -0
  16. package/cli/lib/guard.sh +134 -0
  17. package/cli/lib/handoff.sh +551 -0
  18. package/cli/lib/host.sh +1802 -0
  19. package/cli/lib/linear.sh +1389 -0
  20. package/cli/lib/links.sh +135 -0
  21. package/cli/lib/merges.sh +853 -0
  22. package/cli/lib/recipes.sh +54 -0
  23. package/cli/lib/settings.sh +465 -0
  24. package/cli/lib/space.sh +343 -0
  25. package/cli/lib/task.sh +847 -0
  26. package/cli/lib/tests.sh +268 -0
  27. package/cli/lib/trust.sh +70 -0
  28. package/cli/ocnus +630 -0
  29. package/herdr/README.md +2238 -0
  30. package/herdr/layouts/default.json +259 -0
  31. package/herdr/mods/agent-settings/cog.svg +4 -0
  32. package/herdr/mods/agent-settings/main.js +356 -0
  33. package/herdr/mods/agent-settings/mod.json +1 -0
  34. package/herdr/mods/cards/main.js +450 -0
  35. package/herdr/mods/cards/mod.json +1 -0
  36. package/herdr/mods/cards/refresh.svg +4 -0
  37. package/herdr/mods/cpu/main.js +90 -0
  38. package/herdr/mods/cpu/mod.json +1 -0
  39. package/herdr/mods/layout-switch/main.js +48 -0
  40. package/herdr/mods/layout-switch/mod.json +1 -0
  41. package/herdr/mods/names/main.js +69 -0
  42. package/herdr/mods/names/mod.json +1 -0
  43. package/herdr/mods/ocnus-spaces/main.js +376 -0
  44. package/herdr/mods/ocnus-spaces/mod.json +1 -0
  45. package/herdr/mods/steps/main.js +354 -0
  46. package/herdr/mods/steps/mod.json +1 -0
  47. package/herdr/spaces/template/SPACE.md +19 -0
  48. package/package.json +27 -4
  49. package/prompts/task-build.md +11 -0
  50. package/prompts/task-new.md +17 -0
  51. package/skills/brief/SKILL.md +64 -0
  52. package/skills/sdlc-breakdown/SKILL.md +312 -0
  53. package/skills/sdlc-build/SKILL.md +182 -0
  54. package/skills/sdlc-define/SKILL.md +203 -0
  55. package/skills/sdlc-plan/SKILL.md +202 -0
  56. package/skills/sdlc-pr/SKILL.md +339 -0
  57. package/skills/sdlc-review/SKILL.md +227 -0
package/README.md CHANGED
@@ -1,3 +1,989 @@
1
- # Temporary Holding Version
1
+ # ocnus
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A software factory: agent skills, and the Herdr setup to run them, that take a
4
+ Linear card from its title to a merged pull request. The `ocnus` CLI is
5
+ the orchestrator in it: it opens a tab for each agent, starts it, records how
6
+ each step ended and moves the card in Linear. The words these docs use, such
7
+ as step, phase and harness, are in [GLOSSARY.md](GLOSSARY.md).
8
+
9
+ ## Status
10
+
11
+ ocnus takes a Linear card from its title to a merged pull request today.
12
+ Six skills do the work, one for each step an agent runs, and a seventh,
13
+ `brief`, catches you up on a session:
14
+
15
+ | Skill | What it does |
16
+ |---|---|
17
+ | `sdlc-define` | The define step: sets a card's type and writes its Specification |
18
+ | `sdlc-plan` | The plan step: reads the card and the code, and writes the Plan |
19
+ | `sdlc-breakdown` | The breakdown step: decides whether the card is one piece or several slices, then asks you to approve it, unless you have turned that approval off |
20
+ | `sdlc-build` | The build step: builds an approved card in its task, making the change the Plan describes, running the tests and committing, pushing nothing |
21
+ | `sdlc-review` | The review step: checks the build step's work against the card's Done when, writes what it found on the card as its Review, and sends what is not met back to the build step |
22
+ | `sdlc-pr` | The pr step: pushes a reviewed card's branch, opens its pull requests, moves the card to In Review and waits while you merge them, running no watch of its own: ocnus's watch records the merge and finishes the task. It never merges |
23
+ | `brief` | Not a step: a catch-up on the session, in no more than five lines and three parts: the original task, what has happened so far, and what the agent is working on right now. In a session ocnus started for a card, it reads the card, with its parent card and Linear project, `task log` and the branch's commits. Say "brief" or `/brief` in any Claude Code session for one. It records nothing, is never an answer to a question, and never stops a run |
24
+
25
+ They live in [skills/](skills/). `ocnus install` links them into
26
+ `~/.claude/skills`, so any Claude Code session on the machine can run one by
27
+ name, such as `/sdlc-define ABC-122`.
28
+
29
+ Whenever a skill ends or pauses, it hands off with a block: which step it was,
30
+ on the block's `step:` line, and whether it is `done`, `needs-human` or
31
+ `failed`. A `done` block also names
32
+ the step that comes next. The agent records each block with
33
+ `ocnus task handoff`, and your answer when you reply to a question.
34
+ `ocnus task log` shows them for a card, with how long each step took, and
35
+ the Steps panel in Herdr shows the same for the card whose tab is selected.
36
+ With no card, both list the space's cards and where each stands.
37
+ A `needs-human` stop opens with a brief, above its block, with the question
38
+ as what is happening now, and "brief" or `/brief` gets one at any time. A
39
+ brief is in the session only: it is never recorded, so the log and the Steps
40
+ panel read after it as they did before.
41
+
42
+ **What a machine needs.** ocnus runs on macOS or Linux. It needs:
43
+
44
+ - [Herdr](https://herdr.dev), with the `herdr-app` and `hc` commands its
45
+ install brings, and `~/.local/bin`, where it puts them, on your `PATH`.
46
+ Its app has to be opened once, and signed in, before
47
+ ocnus's panels can be linked into it, but not before
48
+ `ocnus install`; see
49
+ [herdr/README.md](herdr/README.md#set-up-a-clean-machine).
50
+ - [Claude Code](https://claude.com/claude-code), as the `claude` command: the
51
+ harness each agent runs in, unless `OCNUS_HARNESS` names another.
52
+ - Node, with npm, to install ocnus and to update it; see
53
+ [Setting up a machine](#setting-up-a-machine).
54
+ - A Linear API key with Write permission, saved with `ocnus linear key`;
55
+ see [herdr/README.md](herdr/README.md#seeing-a-spaces-cards).
56
+ - `git`, `jq`, `curl`, `sqlite3`, which macOS ships, and `gh`, signed in with
57
+ `gh auth login`. `curl` and `jq` reach Linear, `jq` also reads the settings
58
+ file, `sqlite3` records the hand-offs (see
59
+ [herdr/README.md](herdr/README.md#hand-offs)), and `gh` opens and watches
60
+ the pull requests (see [Tasks](#tasks)).
61
+
62
+ **What is still off.** `task start` runs no repo's `setup` recipe unless
63
+ `OCNUS_SETUP=1` is set, while the local environment each task gets is
64
+ worked out. Until then the build step itself installs into each worktree what
65
+ the tests need, and [`just`](https://just.systems) matters only once setup is
66
+ on; see [what a repo provides](herdr/README.md#what-a-repo-provides). On
67
+ Linux, the CPU mod in the `default` layout shows an error where its reading
68
+ would be, since it reads macOS's `/usr/bin/top`.
69
+
70
+ ## Setting up a machine
71
+
72
+ ```sh
73
+ npm install -g @johngaynor/ocnus
74
+ ocnus install
75
+ ```
76
+
77
+ `ocnus install` links this repo into the tools on a machine, and
78
+ `ocnus update` keeps it current. That covers the Herdr setup, the skills,
79
+ and the two phase profiles in [agents/](agents/), which it links into
80
+ `~/.claude/agents`; see [herdr/README.md](herdr/README.md) for the full
81
+ walkthrough. `install` ends by telling you to switch Herdr to the `default`
82
+ layout, which holds ocnus's panels: the Ocnus spaces panel, the Cards
83
+ and Steps panels, the Layout dropdown and the settings button. Herdr starts on
84
+ its own layout, which has no Layout dropdown, so the first switch is
85
+ `ctrl-shift-l`, pressed until `default` shows.
86
+
87
+ Neither `install` nor `update` needs the Herdr app open, or even opened
88
+ before. The mods and layouts go in Herdr's folder, `~/.config/herdr-app`,
89
+ which Herdr makes when it is first opened. Until then, both link the skills
90
+ and the profiles and make the settings file, and say that the mods and
91
+ layouts wait: open Herdr once, then run `ocnus update`. Once Herdr has
92
+ been opened, they link the mods and layouts whether the app is open or not.
93
+ With it open, they refresh it, so it reads them at once; with it closed, it
94
+ reads them when it starts.
95
+
96
+ Both also write a launchd agent,
97
+ `~/Library/LaunchAgents/com.johngaynor.ocnus.merges.plist`, and load it,
98
+ so that ocnus's watch on the merges (see [Tasks](#tasks)) comes back by
99
+ itself after a restart. launchd runs `ocnus task merges --wake` once the
100
+ launchd agent is loaded, as at login, and every minute after, with the `PATH`
101
+ of the `install` or `update` that wrote it, and its `OCNUS_HOME` if set.
102
+ `update` writes and loads it again when that has changed, such as after a
103
+ change to your `PATH`, and loads it again if it was booted out. Once the
104
+ `ocnus` it names is gone, as after `npm uninstall`, the launchd agent
105
+ removes its own file and boots itself out of launchd. On a machine with no
106
+ `launchctl`, both say so and write nothing, and the watch then comes back
107
+ only when an `ocnus` command wakes it.
108
+
109
+ `ocnus status` says whether herdr-core, which runs each agent's
110
+ terminal, is running. Not running is in order, since `task new` and
111
+ `task start` start it; Herdr not installed is a problem, which makes `status`
112
+ exit non-zero. The app being closed is in order, and so is Herdr never
113
+ opened: the mods and layouts are then listed as `waiting`. See
114
+ [herdr/README.md](herdr/README.md#keeping-a-machine-up-to-date).
115
+
116
+ Under `Watch on the merges:`, `status` also shows ocnus's watch on the
117
+ merges (see [Tasks](#tasks)), from what it leaves, and never starts it. The
118
+ first line says it is running, with how long ago its last pass began and how
119
+ many cards wait on their merge, or that it is not running and no card waits.
120
+ Either one is in order. While cards wait, it is a problem, which makes
121
+ `status` exit non-zero, when the watch has not begun a pass in the last 3
122
+ minutes: run `ocnus update`, which wakes it. With herdr-core not running,
123
+ the line says to start it first, with `hc server start`, since an update
124
+ never starts it. A last pass that found `gh` signed out, or its token
125
+ refused, is a problem too, naming `gh auth login`; one that could not reach
126
+ GitHub for another reason is a note, since the watch asks again each minute.
127
+ The last line is the launchd agent: `written`, or a problem when it is
128
+ missing or not what `update` would write, which `ocnus update` fixes. It
129
+ is compared with the `PATH` the agent has, not the one `status` runs with.
130
+ On a machine with no `launchctl`, it is a note.
131
+
132
+ A phase profile is a Claude Code agent definition: the tools a session has.
133
+ When the harness is `claude`, `task new` starts the agent with
134
+ `ocnus-write-up`, for the write-up phase, and `task build` with
135
+ `ocnus-build`, for the build phase, so each agent has only the tools its
136
+ steps use, whatever your own sessions have. Each also gets Linear's MCP
137
+ server alone, from [agents/linear-mcp.json](agents/linear-mcp.json), not the
138
+ servers of your own sessions. Claude Code asks once to sign in to Linear as
139
+ `linear-server` on a machine where it is not signed in under that name.
140
+ Both start `claude` without `ANTHROPIC_API_KEY` and `ANTHROPIC_AUTH_TOKEN`,
141
+ even when your shell profile or the terminal you run them from exports them,
142
+ so the agent runs on the Claude subscription you signed in to with `/login`,
143
+ not on the API, unless you switch every agent to an Anthropic API key you
144
+ save for ocnus, with `ocnus billing api` (see below). See
145
+ [herdr/README.md](herdr/README.md#ocnuss-variables).
146
+
147
+ Each of the four profiles, the two phase profiles and the two dev profiles,
148
+ runs on the model and effort you pick for it, kept in
149
+ `~/.config/ocnus/settings.json`. `ocnus install` makes the file, with
150
+ every profile on Opus at `xhigh` effort, and neither `install` nor `update`
151
+ changes it once it is there:
152
+
153
+ ```sh
154
+ ocnus profile ls # each profile's model and effort
155
+ ocnus profile set build effort high # change one
156
+ ocnus profile set write-up model sonnet
157
+ ```
158
+
159
+ | Profile | Kind | Runs |
160
+ |---|---|---|
161
+ | `write-up` | phase profile | the agent `task new` starts, for the write-up phase |
162
+ | `build` | phase profile | the agent `task build` starts, for the build phase |
163
+ | `reviewer`, `verifier` | dev profiles | the `ocnus-reviewer` and `ocnus-verifier` subagents, for work on ocnus itself |
164
+
165
+ A model is one of claude's aliases (`fable`, `opus`, `sonnet`, `haiku`) or a
166
+ full model name like `claude-opus-5-5`, and an effort is `low`, `medium`,
167
+ `high`, `xhigh` or `max`. `profile set` refuses anything else and leaves the
168
+ file as it was. `task new` and `task build` start `claude` with `--model=` and
169
+ `--effort=`, which beat the phase profile's own model and your own Claude Code
170
+ settings; only `CLAUDE_CODE_EFFORT_LEVEL` beats the effort. A profile or value
171
+ the file leaves out is Opus at `xhigh`. A file that is not valid settings
172
+ stops `task new` and `task build` before an agent starts, saying what in it is
173
+ wrong, and `ocnus status` says so too. The file is read with `jq`. In
174
+ Herdr, the settings button, a cog at the right end of the tab bar, shows and
175
+ changes the same values, and below them archiving, the tests setting, the
176
+ breakdown approval and billing, which follow here, each with a click; see
177
+ [herdr/README.md](herdr/README.md#the-settings-button).
178
+
179
+ The same file says whether a merged card is archived in Linear, as
180
+ `"archive": true` or `false`. It is off until you turn it on: with no
181
+ `"archive"` in the file, or no file, and `install` and `update` never write
182
+ one.
183
+
184
+ ```sh
185
+ ocnus linear archive # say whether archiving is on (--json for programs)
186
+ ocnus linear archive on # turn it on
187
+ ocnus linear archive off # turn it off
188
+ ```
189
+
190
+ `on` and `off` leave the profiles as they are, and anything else is refused,
191
+ with the file left as it was; an `"archive"` that is not `true` or `false`
192
+ makes the file not valid settings. With archiving on, recording a card's merge
193
+ archives the card, once its move has put it in Done, and every other card of
194
+ the space's teams that is done, canceled or a duplicate. On Linear's free
195
+ plan, which makes no new card once 250 are not archived, closed cards then stop
196
+ counting against that. Archiving is not deleting: an archived card still opens
197
+ by its ID, and can be restored from its team's archive. A sliced card is
198
+ archived with its slices, whether it is the merged card's family or another
199
+ one, once the card and every one of its slices are closed: each slice, and
200
+ then the card. Since archiving a card archives its sub-issues with it, a
201
+ family that is open anywhere stays as it is, and so does one that goes
202
+ deeper than a card and its slices.
203
+
204
+ The file also says how the runs of ocnus's own tests on this machine
205
+ (`npm test`, in a clone of ocnus or a worktree of one) use its
206
+ processors, as `"tests": "share"` or `"queue"`. They share until you choose
207
+ otherwise: with no `"tests"` in the file, or no file, and `install` and
208
+ `update` never write one.
209
+
210
+ ```sh
211
+ ocnus tests # say which is set (--json for programs)
212
+ ocnus tests queue # have test runs go one at a time
213
+ ocnus tests share # have them share the processors again
214
+ ```
215
+
216
+ Sharing, runs going at the same time run one case per processor between
217
+ them. With `queue`, a run that starts while another is going says that it
218
+ is waiting, and how many runs are ahead of it, and starts no case until none
219
+ that started before it is going, whether those ended or were stopped with
220
+ Ctrl-C or `kill -9`. Then it has every processor, though a case that a run
221
+ stopped with Ctrl-C still had going keeps its processor until it ends. Runs
222
+ that wait go in the order they started, and a run with `OCNUS_TEST_JOBS`
223
+ set waits its turn too. Each run reads the setting as it starts, so a run
224
+ already going or waiting keeps to the one it started with. `share` and
225
+ `queue` leave the profiles and `"archive"` as they are, and anything else is
226
+ refused, naming both, with the file left as it was; a `"tests"` that is not
227
+ `"share"` or `"queue"` makes the file not valid settings. A test run reads
228
+ the file with `jq` alone, and shares when it does not find `"queue"` there.
229
+
230
+ The file also says whether breakdown, the last step of the write-up phase,
231
+ asks you to approve each card, as `"approval": {"breakdown": true}` or
232
+ `false`. It is on until you turn it off: with no `"approval"` in the file, or
233
+ no file, and `install` and `update` never write one.
234
+
235
+ ```sh
236
+ ocnus approval # say whether it is on (--json for programs)
237
+ ocnus approval --breakdown off # have breakdown approve a card it has no doubt about
238
+ ocnus approval --breakdown on # have it ask you again
239
+ ```
240
+
241
+ With it on, breakdown asks you to approve the card and waits for your
242
+ answer. With it off, it approves a card it has no doubt about by itself and
243
+ starts its build phase, without asking; see [Tasks](#tasks). It reads the
244
+ setting when it gets to the approval, so a change reaches every card whose
245
+ breakdown has not got there yet. `--json` prints it as one line, such as
246
+ `{"file":"…/settings.json","approval":{"breakdown":true}}`. `--breakdown on`
247
+ and `--breakdown off` leave the rest of the file as it is, and anything else
248
+ is refused, saying what it takes, with the file left as it was. An
249
+ `"approval"` that is not an object, that names an approval other than
250
+ `breakdown`, or whose `breakdown` is not `true` or `false`, makes the file not
251
+ valid settings. When breakdown cannot read the setting, it asks you, and says
252
+ why.
253
+
254
+ The file also says which account every agent `task new` and `task build`
255
+ start runs on, as `"billing": "subscription"` or `"api"`: your Claude
256
+ subscription, or an Anthropic API key you save for ocnus. It is the
257
+ subscription until you choose otherwise: with no `"billing"` in the file, or
258
+ no file, and `install` and `update` never write one. Claude Code sessions you
259
+ start yourself keep their own login either way.
260
+
261
+ ```sh
262
+ ocnus billing # say which is set, and whether a key is saved (--json for programs)
263
+ ocnus billing key # save an Anthropic API key: it asks for it, or reads it from stdin
264
+ ocnus billing api # run every agent on that key
265
+ ocnus billing subscription # run them on the subscription again
266
+ ```
267
+
268
+ `billing key` saves the key in ocnus's env file, as `linear key` saves
269
+ the Linear key: it is never an argument, the file is left readable by you
270
+ alone, and a linked env file, or one in a git repo, is left alone. Only a key
271
+ that starts `sk-ant-` is taken, and it is not checked with Anthropic. On
272
+ `api`, `claude` starts with an `apiKeyHelper` in `--settings=`, a command it
273
+ runs to ask ocnus for the key, so the key is in no argument and in no
274
+ agent's environment, and the agent starts without asking whether to use it.
275
+ An `ANTHROPIC_API_KEY` or `ANTHROPIC_AUTH_TOKEN` you export is still kept from
276
+ it, and is never taken for the saved key. On `api` with no key saved, `task
277
+ new` and `task build` stop before an agent starts, and say how to save one. A
278
+ change reaches the next agent started; one already running keeps the account
279
+ it started on. The profiles' model and effort hold either way, and the
280
+ `ocnus-reviewer` and `ocnus-verifier` subagents bill as the session
281
+ they run in. `--json` prints it as one line, such as
282
+ `{"file":"…/settings.json","billing":"subscription","key":true}`. `api` and
283
+ `subscription` leave the rest of the file as it is, and anything else is
284
+ refused, with the file left as it was; a `"billing"` that is not
285
+ `"subscription"` or `"api"` makes the file not valid settings. A Claude Code
286
+ whose own `/login` is a Console API key uses that key whatever is set here.
287
+
288
+ `ocnus status` shows billing below the Linear key: a `mode` line saying
289
+ which is set, and a `key` line saying whether a key is saved, never the key
290
+ itself. On `api` with no key saved, a `problem` line takes the `key` line's
291
+ place, saying to run `ocnus billing key`, and `status` exits non-zero.
292
+ In Herdr, the settings button shows which is set and switches it with a
293
+ click, through `billing subscription` and `billing api`; the key is saved in a
294
+ terminal, with `billing key`.
295
+
296
+ ## Spaces
297
+
298
+ A space groups the repos that belong together, with a `SPACE.md` saying
299
+ what each repo is for, and opens in Herdr as one space, the word Herdr uses
300
+ for it too. A repo is cloned once and can be in several spaces.
301
+
302
+ ```sh
303
+ ocnus space new my-space
304
+ ocnus space add my-space ~/Dev/api
305
+ ocnus space add my-space ~/Dev/web
306
+ ocnus space open my-space
307
+ ```
308
+
309
+ `space new` also takes the repos after the name, to do the first three
310
+ lines in one: `ocnus space new my-space ~/Dev/api ~/Dev/web`.
311
+
312
+ `space open` shows the space in the Herdr app, so the app has to be open:
313
+ with it closed, it says so and changes nothing. When the space's agents were
314
+ started with the app closed, it shows the space the app put them in, rather
315
+ than making a second one.
316
+
317
+ In Herdr, the `+` at the top of the Ocnus spaces panel does the same
318
+ without a terminal: choose a repo's folder, name the space in the New space
319
+ dialog, and it opens. The panel is the `ocnus-spaces` mod, on the
320
+ `default` layout; Herdr's own list of spaces is its `spaces` mod.
321
+
322
+ Your spaces live in `~/.config/ocnus/spaces`, outside this repo, so
323
+ they are never published and survive updates.
324
+ A machine set up before keeps `~/.config/ocnus/projects` and `PROJECT.md`:
325
+ while it has no `spaces` folder, ocnus finds its spaces where they are,
326
+ makes a new one there too and moves nothing. See
327
+ [herdr/README.md](herdr/README.md#spaces) for how a space is laid out.
328
+
329
+ `space new` also marks the space's folder as trusted in Claude Code's own
330
+ file, `~/.claude.json`, so an agent started there is not stopped by the "do
331
+ you trust this folder?" question. Only a space folder that ocnus made is
332
+ marked: never a repo, and not a space folder you linked in from somewhere
333
+ else. This needs `jq`; without it Claude Code asks once.
334
+
335
+ ## Tasks
336
+
337
+ A task is one piece of work in a space, usually a Linear card. Two commands
338
+ make it, in this order: `task new`, then `task start`, which the write-up phase
339
+ runs once you approve the card, unless you hold it for later.
340
+
341
+ To see which cards there are first, `task ls` lists the open cards of the
342
+ space's Linear teams, under their statuses:
343
+
344
+ ```sh
345
+ ocnus linear key # once: save your Linear API key
346
+ ocnus space team my-space ABC # once: the team whose cards are ABC-122
347
+ ocnus task ls my-space
348
+ ```
349
+
350
+ It asks Linear itself, with no agent running. `ocnus status` checks the
351
+ saved key with Linear each time it runs: it says whose the key is when it
352
+ works, notes when no key is saved or when the key could not be checked, and
353
+ lists a key Linear rejects as a problem, which makes `status` exit non-zero.
354
+ For a key that works, it also checks whether the key can change cards, by
355
+ asking Linear to change a card that cannot exist, which changes nothing. A
356
+ key with Read permission alone lists cards, so `task ls` and the Cards panel
357
+ work with it, but `linear type`, `linear section`, `linear slices` and
358
+ `linear move` fail with it, and the card skills fall back to the agent's own
359
+ Linear tools.
360
+ `status` lists such a key as a problem too, and exits non-zero. `linear key`
361
+ checks the same before it saves a key: it saves one that cannot change cards,
362
+ then says so. Either way, the fix is a key with Write permission, saved with
363
+ `ocnus linear key`.
364
+ See [herdr/README.md](herdr/README.md#seeing-a-spaces-cards) for the details.
365
+
366
+ `task new` writes the card up. It opens a tab in the space, in Herdr, and
367
+ starts an agent there for the write-up phase, with the `ocnus-write-up`
368
+ phase profile on the `write-up` profile's model and effort. The agent runs
369
+ the phase's three skills on the card and then asks you to approve it, unless
370
+ the breakdown approval is off (see below):
371
+
372
+ ```sh
373
+ ocnus task new my-space ABC-122
374
+ ```
375
+
376
+ The Herdr app does not have to be open. The agent runs in a herdr-core
377
+ terminal either way: with the app open, the app opens its tab, as it always
378
+ has; with the app closed, `task new` starts the terminal in herdr-core itself
379
+ and says how to attach to it, and opening Herdr later shows it as a tab named
380
+ after the card, in a space named after the space. Closing or quitting the app
381
+ stops no agent, and opening it again shows them again. When herdr-core is not
382
+ running, `task new` starts it, without the variables of a Claude Code session
383
+ it was run from, so that a `claude` in its terminals still saves its
384
+ transcript. See [herdr/README.md](herdr/README.md#writing-the-card-up).
385
+
386
+ Recording your approval moves the card in Linear to its team's first
387
+ not-started status (Todo in Lab), and each of its sub-issues with it. When a
388
+ card cannot be moved, the approval is still recorded, and the agent tells you
389
+ which card, and why. `task log` shows that too, under the approval's row.
390
+ Then the agent starts the build phase with `task start`, unless you hold it
391
+ for later. The approval itself closes nothing: the write-up session stays
392
+ open until `task start` has opened the build tab, which then puts it away
393
+ (see below).
394
+
395
+ With the breakdown approval off (`ocnus approval --breakdown off`, see
396
+ [Setting up a machine](#setting-up-a-machine)), the agent does not ask you to
397
+ approve a card it has no doubt about: the setting approves it. It writes the
398
+ Breakdown, makes the sub-issues when the card is sliced, records the
399
+ approval, which moves the card as yours does and says the setting gave it,
400
+ and runs `task start` itself, as for an approval to start now. A card it
401
+ has a doubt about still waits for you, with the doubt in the summary: one
402
+ it thinks too big, one that looks like several cards, or a sub-issue that
403
+ looks too big to stay one piece. So do the questions define
404
+ and plan ask earlier in the write-up. The agent reads the setting when it
405
+ gets to the approval, so turning it off or on reaches a card already being
406
+ written up.
407
+
408
+ As it goes, the agent records how each step ended. `task log` lists that for
409
+ a card, oldest first, with how long each step took and how long a question
410
+ waited for your answer. It also shows what still needs you from `task start`
411
+ and from your approval, such as a repo Claude Code will ask about trusting or
412
+ a card that was not moved in Linear, as `flags:` under that row, so it is
413
+ there once the tab that printed it has gone:
414
+
415
+ ```sh
416
+ ocnus task log my-space ABC-122
417
+ ```
418
+
419
+ A card the setting approved, with the breakdown approval off, has no
420
+ question or answer for the approval, since no one was asked. Its breakdown
421
+ row has a line under it that says the setting approved it:
422
+
423
+ ```
424
+ 2026-11-30T10:41:53Z breakdown done, then start 2m 10s
425
+ summary: Approved by the setting, with the breakdown approval off, to start now. One piece.
426
+ approved: by the setting (ocnus approval --breakdown off), not the human
427
+ ```
428
+
429
+ Leave the card out to see every card in the space that has hand-offs,
430
+ newest first, with where each stands, such as waiting on you, or merged:
431
+
432
+ ```sh
433
+ ocnus task log my-space
434
+ ```
435
+
436
+ It also asks Herdr what each card's agent is doing, and says so when the
437
+ agent needs you or is not getting on with its step: waiting in its tab on a
438
+ permission prompt, a question or a sign-in, hit an error, stopped without
439
+ handing off, or not running. That shows in place of where the card stands,
440
+ and as the last line of the card's own log. It is read from herdr-core each
441
+ time and never stored, so it shows with the Herdr app closed too. See
442
+ [herdr/README.md](herdr/README.md#hand-offs).
443
+
444
+ While a card's pull requests wait on you to merge them, `task log` also
445
+ says when what should happen for them cannot. When one is closed without merging, or in conflict with
446
+ its default branch, and the card has no agent running to wake, since its
447
+ tab is closed or its shell is back in the foreground, it names the pull
448
+ request and says so: `acme/api#7 in conflict, no agent running`. When
449
+ nothing can watch them, because herdr-core is not running, Herdr's `hc` is
450
+ not installed, ocnus's watch is not running, or `gh` cannot ask
451
+ GitHub, such as when it is signed out, it says
452
+ `nothing watching its pull requests:` and why. That shows in the list, in
453
+ the card's own log and in the Steps and Cards panels, which draw what
454
+ `task log` says. While ocnus's watch (below) is watching and no pull
455
+ request is closed or in conflict, the card shows as waiting on you, as
456
+ before.
457
+
458
+ `task start` starts the work, once you have approved the card. It takes the
459
+ card too, makes a branch and a git worktree of it in every repo of the
460
+ space, opens a tab for it, and starts the agent there that runs the build
461
+ phase. The write-up phase runs it once you approve the card, or gives it to
462
+ you when you chose to start later:
463
+
464
+ ```sh
465
+ ocnus task start my-space ABC-122
466
+ ```
467
+
468
+ As with `task new`, the Herdr app does not have to be open. With the app
469
+ open, the app opens the task's tab, as it always has; with it closed, `task
470
+ start` starts the tab's terminal in herdr-core itself, in the folder the tab
471
+ would start in, and says how to attach to it, and opening Herdr later shows it
472
+ as a tab named after the task. When herdr-core is not running,
473
+ `task start` starts it; when Herdr is not installed, or herdr-core does not
474
+ start, it stops before it makes anything. See
475
+ [herdr/README.md](herdr/README.md#starting-the-work).
476
+
477
+ Once the build tab is open, `task start` puts the card's write-up session
478
+ away, so finished write-up sessions do not pile up. For a sub-issue it is the
479
+ session of the card it was sliced from, whose tab it was written up in. It
480
+ starts `task close` for that card in herdr-core, detached, with no tab:
481
+
482
+ ```sh
483
+ ocnus task close my-space ABC-122
484
+ ```
485
+
486
+ `task close` waits for the write-up agent's turn to end, which with start now
487
+ is the turn in which it ran `task start`. Then it ends the agent's Claude session with `/exit`, waits
488
+ for the tab's shell to come back, and closes the tab, or with the Herdr app
489
+ closed ends its terminal in herdr-core, so opening the app later shows no tab
490
+ for it. The clean exit is what archives the session in the Claude app's list
491
+ of sessions, with Remote Control on. Its transcript stays, so
492
+ `claude --resume` still opens it. A live agent is never killed: when it has
493
+ not exited 30 seconds after `/exit`, or the tab runs a program that reports
494
+ no status, the tab is left open. With start later, the write-up session stays
495
+ open until you run `task start`, from any terminal. When `task start` stops,
496
+ before it has made the task or without opening its tab, the write-up session
497
+ stays open. Only the card's own write-up tab is closed: the build tab, other
498
+ cards' write-up tabs and the terminal `task start` ran in stay open, and a
499
+ card with no write-up tab open starts as before. When Linear cannot be
500
+ asked, as with no key saved, `task start` cannot know a sub-issue's parent,
501
+ so the parent's write-up session stays open then. See
502
+ [herdr/README.md](herdr/README.md#putting-the-write-up-away).
503
+
504
+ Name targets after the card to take only what the task needs: a repo, or
505
+ groups inside a repo (`app:athlete`, or `app:athlete,coach` for several).
506
+
507
+ ```sh
508
+ ocnus task start my-space ABC-122 app:athlete billing
509
+ ```
510
+
511
+ It asks Linear for the card and names the branch from it:
512
+ `<type>/<card-id>-<short-name>`, following
513
+ [Conventional Branch](https://conventionalbranch.org). The type is the one
514
+ the write-up phase set on the card, and the short name is the first four
515
+ words of its title, leaving out a, an and the. "Insert the task here" gives
516
+ `feat/abc-122-insert-task-here`. Everything after the type names the task:
517
+
518
+ ```
519
+ ~/.config/ocnus/spaces/my-space/
520
+ tasks/
521
+ abc-122-insert-task-here/ one folder per task
522
+ api/ a worktree of api on feat/abc-122-insert-task-here
523
+ web/ a worktree of web on the same branch
524
+ ```
525
+
526
+ It asks Linear with your Linear key, as `task ls` does. When Linear can't be
527
+ asked, give the card's type and title after it instead. The write-up phase
528
+ adds them to the command it runs or gives you when no key is saved or Linear
529
+ rejected the key:
530
+
531
+ ```sh
532
+ ocnus task start my-space ABC-122 --type feat --title 'Insert the task here'
533
+ ```
534
+
535
+ That names the same branch, `feat/abc-122-insert-task-here`. The type and
536
+ title given are used only when no key is saved, or Linear can't be asked: it
537
+ rejects the key, it is out of reach, or `curl` or `jq` is missing. A note
538
+ says why. With a key Linear accepts, Linear's type and title name the branch
539
+ whatever is given, and a note names each given one that differs. Give both or
540
+ neither, anywhere after the card, before or among the targets. The title goes
541
+ between single quotes, with each `'` in it written as `'\''`, so that the
542
+ shell takes it as it is.
543
+
544
+ It stops before anything is made when Linear doesn't have the card, or the
545
+ card has no type yet. With no type and title given, it also stops when no key
546
+ is saved or Linear can't be asked; with no key, it says that the card can be
547
+ started with `--type` and `--title`. A given type that is not a branch type,
548
+ or only one of the two, stops it as well.
549
+
550
+ Setup is off for now, while the local environment each task gets is worked
551
+ out. With `OCNUS_SETUP=1`, a repo that has a `justfile` with a `setup`
552
+ recipe gets `just setup` run in the task's tab, so the checkout is ready to
553
+ work in. See [what a repo provides](herdr/README.md#what-a-repo-provides).
554
+
555
+ Then the task's tab runs this as its command, after `just setup` when setup
556
+ runs, so the agent starts once the checkout is ready, and nothing is typed
557
+ into a shell, by you or by ocnus:
558
+
559
+ ```sh
560
+ ocnus task build my-space ABC-122
561
+ ```
562
+
563
+ `task build` starts the agent for the build phase in the harness, `claude`
564
+ unless `OCNUS_HARNESS` names another, with the `ocnus-build` phase
565
+ profile on the `build` profile's model and effort, and a first message that
566
+ has it build the card with the `sdlc-build` skill, check that work with the
567
+ `sdlc-review` skill, and then put it up as a pull request with the `sdlc-pr`
568
+ skill. If the agent stops, run the same command again in the tab. It runs only
569
+ in the card's own task folder. With `--continue <message>` after the card, it
570
+ continues `claude`'s last session in the task instead, with that message, on
571
+ the same profile, model and effort, which a bare `claude --continue` would
572
+ not give it; ocnus's watch runs it to wake an agent that has exited (see
573
+ below). Another harness refuses `--continue`. When a phase profile is not linked, `task new`
574
+ and `task build` stop before they start anything, and say to run
575
+ `ocnus update`. Both start the agent on the account `ocnus billing`
576
+ sets, the subscription unless it is `api`; on `api` with no Anthropic key
577
+ saved they stop before they start anything, and say to run
578
+ `ocnus billing key`. Another harness, named by `OCNUS_HARNESS`, starts as it
579
+ always has, with no profile, model or effort. When the task has one repo and
580
+ Claude Code has not trusted that repo yet, `task start` says so: Claude Code
581
+ asks once in the tab, and not again for that repo. `task log` shows when the
582
+ work was started and, under it, each note `task start` printed that still
583
+ needs you, such as that one or a card it could not move in Linear, whoever
584
+ ran it.
585
+
586
+ See [herdr/README.md](herdr/README.md#tasks) for the details.
587
+
588
+ The build step reads the card's Plan, makes the change in the task's
589
+ worktrees, runs the tests and commits on the task's branch. Since setup is
590
+ off, it first installs into each worktree what the tests need, the way that
591
+ repo's own docs say. It installs only: it starts no app, server or database,
592
+ and asks you when the tests need one running. It runs the whole test suite
593
+ once its change is done, not before, and a test that fails then and that the
594
+ change does not explain, it runs on the commit the task started from, to tell
595
+ one it broke from one that was broken already. It pushes nothing and opens no
596
+ pull request: that comes after the review step. Like each step of the write-up
597
+ phase, it records how it ended, and `task log` shows it: `done` only when the
598
+ tests pass, `needs-human` with a question, or `failed` with the reason. A card
599
+ with no Plan is not built.
600
+
601
+ Then the review step runs the tests itself, unless its own session has just
602
+ seen them pass on exactly what it reviews, checks each Done when item against
603
+ the test the Plan names for it, and writes what it found on the card as a
604
+ Review. It changes no code, pushes nothing and opens no pull request. When
605
+ every item is met, it hands off `done` with `pr` next, and the pull request
606
+ comes next. When an item is not met or a test fails, it hands off with `build`
607
+ next, and `sdlc-build` builds only what the Review names. After one send-back,
608
+ it asks you whether to build again or stop.
609
+
610
+ Then the pr step. `sdlc-pr` reads the Review on the card and opens nothing
611
+ unless every item in it is met or left to you. Before it pushes anything, it
612
+ checks that `gh` is signed in and that each repo the work changed has an
613
+ `origin` GitHub knows; when one is not, it hands off `failed` with the reason
614
+ and what to run, and pushes nothing. Then, in each repo whose branch has
615
+ commits ahead of its default branch, and no other, it pushes the task's
616
+ branch, never forced, and opens a pull request into the default branch, by the
617
+ repo's own rules and pull request template. Each one links the card and says,
618
+ for each Done when item, how the review step showed it and what is left to
619
+ you. Once every one is open, it moves the card in Linear to In Review, the
620
+ team's last started status, with `ocnus linear move <card> review`; in a
621
+ team with one started status the card stays in it. When the card cannot be
622
+ moved, it says so, and why, and goes on.
623
+
624
+ Then it asks you to merge them, as `needs-human` with their links, and
625
+ waits, running no watch of its own. Merge each one on GitHub yourself; you
626
+ don't have to tell the agent. ocnus's watch on the merges (see below)
627
+ asks GitHub every minute, however long the pull requests have been open,
628
+ whatever the agent is doing, so a merge is seen within a minute or so. Once
629
+ every one has merged, it records the merge, as your answer, so `task log`
630
+ shows how long the pull requests waited on you, then `done` with `merged`
631
+ next, which ends the card, and finishes the task: `task log` shows the card
632
+ as merged, and recording it moves the card to Done in Linear,
633
+ as your approval moved it to Todo, `task start` moved it to In Progress and
634
+ opening the pull requests moved it to In Review. A sliced card follows its
635
+ slices: the first slice's `task start` moves it to In Progress, and a slice's
636
+ merge moves it to Done once every one of its sub-issues is closed (done,
637
+ canceled or a duplicate). While any is still open it stays where it is, and the note
638
+ says so, such as `ABC-100 stays in In Progress: 2 of its 3 slices are still
639
+ open (ABC-123, ABC-124)`. It is checked only when a slice's merge is
640
+ recorded, so one whose last open slice is canceled or closed by hand stays
641
+ for you to move. Each move picks the team's own status of that kind, goes
642
+ only forward, never touches a card that is done or canceled, and needs your
643
+ Linear key to have Write permission. A move that cannot be made is a note
644
+ saying why, and the step goes on. With archiving on
645
+ (`ocnus linear archive on`, see above), recording the merge then archives
646
+ the card in Linear, and every other done, canceled or duplicate card of the
647
+ space's teams. A slice or a sliced card is archived with its family once all
648
+ of it is closed, so the merge that closes a parent archives it with all its
649
+ slices, and a family with a card still open stays as it is. A card that is
650
+ not archived never stops the merge either: the note names it and says why,
651
+ such as no key saved, a key that cannot write, Linear out of reach, a card
652
+ that is not closed, or a parent with slices still open. The first call
653
+ Linear refuses or cannot answer ends the archiving, and the next merge goes
654
+ on with it. Telling the agent
655
+ in the tab that they have merged has it record your answer and ask again,
656
+ saying that ocnus's watch records the merge within a minute; it checks
657
+ nothing itself, records no merge and runs no `task finish`. When one is
658
+ closed without merging, ocnus's watch wakes the agent, which asks you
659
+ whether to stop. No agent merges a pull request.
660
+
661
+ When the default branch moves on and a pull request comes to conflict with it,
662
+ ocnus's watch wakes the agent, which brings it up to date without asking
663
+ you. It merges the default
664
+ branch into the task's branch, never by a rebase, fixes what the repo's tests
665
+ then find and commits the merge, and the review step checks each Done when
666
+ item again and revises the card's Review. Then it pushes, never forced, adds a
667
+ line under **Brought up to date:** to the pull request's description, saying
668
+ which files conflicted and what the fix changed, and waits for you again. A
669
+ pull request with no conflict gets no push. It asks you, as `needs-human`
670
+ naming the pull request and the files in conflict, only when it cannot get the
671
+ tests to pass or when the fix would change what a Done when item says, and
672
+ pushes nothing until you answer.
673
+
674
+ ocnus's watch on the merges is the only watch on the pull requests: one
675
+ for every card that waits on its merge, in a herdr-core terminal called
676
+ `ocnus-merges`. No agent runs one of its own, so it goes on when the
677
+ agent exits or its tab closes, and whatever the agent is doing:
678
+
679
+ ```sh
680
+ ocnus task merges [--once | --wake]
681
+ ```
682
+
683
+ Recording the agent's question with the pull requests' links wakes it, and
684
+ so do `task new`, `task start`, `task build` and `ocnus update`, which
685
+ wakes it for the cards that were waiting before it was there. So does the
686
+ launchd agent that `install` and `update` write (see
687
+ [Setting up a machine](#setting-up-a-machine)), which runs
688
+ `ocnus task merges --wake` every minute: after a restart, the watch is
689
+ back within a minute of herdr-core starting, whether the Herdr app, the
690
+ phone or an `ocnus` command started it, and a watch that died comes back
691
+ the same way. `--wake` only wakes it, and says nothing. It starts only
692
+ while a card waits on its merge and herdr-core is running, never starts
693
+ herdr-core, and never runs twice. Every minute, it asks GitHub about the
694
+ pull requests of every card whose latest hand-off is the pr step's question,
695
+ in any space and however long ago, in one call, with `gh api graphql`,
696
+ however many cards wait and in however many spaces and repos; past 100
697
+ worktrees, it asks in calls of 100. It names each worktree's repo by its
698
+ `origin`, `https://github.com/<owner>/<name>` or
699
+ `git@github.com:<owner>/<name>`, and its branch. Only the branch's newest
700
+ pull request counts, and an open one that GitHub says conflicts with its
701
+ default branch is in conflict; while GitHub is still working that out, it
702
+ is open. A
703
+ repo that GitHub answers with an error, or a worktree whose origin is not on
704
+ GitHub, leaves only its own card as it is, and `task log` says why; the
705
+ other cards are answered all the same. With `gh` signed out, or its token
706
+ refused, no card's pull requests can be seen, and the watch says to run
707
+ `gh auth login`. Once every pull request of a card has merged, it records
708
+ the merge: your answer, so `task log` shows how long the pull requests
709
+ waited on you, then `done` with `merged` next, which moves the card to Done
710
+ in Linear. It does so when the task's tab is closed, when the agent has
711
+ exited and left its shell, and when the agent is idle in the tab, its turn
712
+ over, without a turn from it. So the merge is recorded within a few minutes,
713
+ with the Herdr app open or closed, while herdr-core is running. It leaves the
714
+ card for a later pass while the agent is busy, and records nothing while a
715
+ pull request is open, closed without merging or in conflict; it pushes
716
+ nothing. Once it has recorded the merge, it finishes the task, which no
717
+ agent does: an agent idle in the task's tab is ended first,
718
+ as `task close` ends one, with `/exit` and up to 30 seconds for its shell to
719
+ come back, never killed, then `task finish` (below) removes the task and
720
+ closes its tab, with the Herdr app open or closed. When `task finish` refuses,
721
+ as for work it would lose, or the agent does not exit, the task is left as it
722
+ is, and `task log` shows why, as `task not finished: …` in the merge's flags;
723
+ run `task finish` yourself once you have dealt with it. It ends once no card
724
+ waits, and `--once` checks once. Once a card's merge is recorded,
725
+ `task handoff` refuses any other block for it, saying the merge is recorded
726
+ already, so it is recorded once. Then the agent records nothing more and
727
+ runs no `task finish`.
728
+
729
+ When a pull request is closed without merging, or comes into conflict with
730
+ its default branch, such as when you merge other pull requests overnight,
731
+ the watch wakes the card's agent, within a few minutes. An agent idle in
732
+ the task's tab is told what was seen, in a message that starts with
733
+ `ocnus-merges:`, and to bring it up to date, or to ask you whether to
734
+ stop. One that has exited, leaving the tab's shell in the foreground, is
735
+ started again there with
736
+ `ocnus task build <space> <card> --continue '<message>'`. The agent
737
+ then brings the pull request up to date, or asks you about the closed one;
738
+ the watch itself records and pushes nothing for it. It wakes the agent once
739
+ for each closed or conflicting pull request, and not again while it stays
740
+ so: a pull request seen again in another state, such as brought up to date,
741
+ can wake it again later. It never wakes it for one the agent saw itself and
742
+ is asking you about. A busy agent, or a closed tab, is woken at a later
743
+ pass, once it is idle or has exited.
744
+ What it woke each card's agent for is kept in
745
+ `~/.config/ocnus/merges/<space>/<card>.woke` while the card waits.
746
+ For `task log`, each pass also leaves when it began, in
747
+ `~/.config/ocnus/merges/.alive`, and what it saw of each card's pull
748
+ requests, in `~/.config/ocnus/merges/<space>/<card>`. For
749
+ `ocnus status`, a pass whose call to GitHub failed leaves when, whether
750
+ `gh` needs signing in, and `gh`'s words, in
751
+ `~/.config/ocnus/merges/.gh`, which the next pass whose call works, or
752
+ that asks GitHub nothing, removes. All of them go once no card waits.
753
+
754
+ To have something changed instead of merging, say what in the tab. The agent
755
+ makes the change on the task's branch, with its test, runs the whole test
756
+ suite, then commits and pushes it, never forced, so the pull request shows
757
+ it, and adds it to the pull request's description. Then it asks you again,
758
+ and `task log` shows another `pr` `needs-human` after your answer. A change
759
+ that would alter what you approved on the card, such as a Done when item or a
760
+ new dependency, it asks you about before it makes it. It takes changes only
761
+ from what you say in the tab, not from GitHub review comments or CI.
762
+
763
+ Once the merge is recorded, ocnus's watch ends the task with
764
+ `task finish`, so you remove nothing by hand:
765
+
766
+ ```sh
767
+ ocnus task finish my-space ABC-122
768
+ ```
769
+
770
+ It removes the task's worktrees, deletes its branch in each repo, deletes its
771
+ folder and, last, closes its tab, the one the agent ran in. With the Herdr
772
+ app closed, it ends the tab's terminals in herdr-core instead. It checks every
773
+ repo first, and removes nothing when that would lose work:
774
+ changes that are not committed, commits that never reached the default
775
+ branch (pushed or not), or git-ignored files that the repo's `made-by-setup`
776
+ recipe does not say its setup makes again. It names each one, and the watch
777
+ leaves the task as it is, with all it named under the merge in `task log`.
778
+ A pull request closed without merging leaves the task too. Run the command
779
+ yourself for a task ocnus's watch left, once you have kept what it
780
+ named. See
781
+ [herdr/README.md](herdr/README.md#finishing-a-task).
782
+
783
+ Each skill also runs on its own in any Claude Code session, as
784
+ `/sdlc-build ABC-122`, `/sdlc-review ABC-122` or `/sdlc-pr ABC-122`.
785
+
786
+ To work on ocnus itself, clone the repo and run `cli/ocnus install`
787
+ from the clone instead. A clone also writes the dev profiles, the
788
+ `ocnus-reviewer` and `ocnus-verifier` subagents, from
789
+ [.claude/profiles/](.claude/profiles/)
790
+ into `~/.claude/agents`, with the model and effort the settings file names for
791
+ the reviewer and the verifier, so a session can start them by name to review
792
+ a change or check what the reviewer found; see
793
+ [CLAUDE.md](CLAUDE.md#reviewing-a-change). It writes them again at each
794
+ `update`, and at each `profile set` for one of them, and replaces or removes
795
+ only a file it wrote: one of your own of the same name is left alone, and
796
+ `ocnus status` lists each as written, stale, missing or skipped. Run the CLI's tests with `npm test`. A run shows
797
+ only the cases that fail, each with all it printed, and ends with how many
798
+ cases passed and how many failed, such as `683 passed, 3 failed`. The cases run
799
+ side by side, one per processor. Test runs going at the same time on one
800
+ machine share its processors, through `test-runs` in `~/.config/ocnus`, so
801
+ that together they still run one case per processor, or, after
802
+ `ocnus tests queue`, go one at a time, each waiting its turn (see above).
803
+ `OCNUS_TEST_JOBS=<n> npm test` runs n at a time however many other runs
804
+ are going, though it still waits its turn when they go one at a time, and
805
+ `OCNUS_TEST_JOBS=1 npm test` runs the cases one at a time. Once
806
+ a pull request merges, `scripts/after-merge <name>`, run from the clone,
807
+ removes the Claude Code worktree under `.claude/worktrees/` that the work was
808
+ done in, deletes its branch and updates the clone; see
809
+ [CLAUDE.md](CLAUDE.md#after-a-pull-request-merges).
810
+
811
+ A git worktree of the repo, such as the one `task start` makes for one of
812
+ ocnus's own cards, holds a copy of the CLI that is a change being built.
813
+ Its `./cli/ocnus` runs only the commands that read: `help`, `status`,
814
+ `space ls`, `space team <name>`, `profile ls`, `linear archive` (alone or
815
+ with `--json`), `tests` (alone or with `--json`), `approval` (alone or with
816
+ `--json`), `billing` (alone or with `--json`), `task ls`, `task log`,
817
+ `host` and `host report`.
818
+ Any other command stops before it does anything, says that it is a
819
+ worktree's copy, and gives the command that runs it for real:
820
+ `OCNUS_LIVE=1 ./cli/ocnus …`, for that one run. The installed `ocnus` is never stopped, whatever folder
821
+ it is run from, so an agent in the worktree records its hand-offs with it.
822
+
823
+ ## Recording the host
824
+
825
+ ocnus can record how hard the host, the machine it runs on, works while
826
+ its agents are open, so that whether the machine holds the work back can be
827
+ read afterwards. It is off until you turn it on, and works on macOS only.
828
+
829
+ ```sh
830
+ ocnus host on # turn recording on
831
+ ocnus host report [<period>] # how often CPU, memory and disk were at their limit, with how many agents working and how much slower test runs were, what was going then, what used the most, where the steps' time went, whether the network may be the cause, and what to upgrade first
832
+ ocnus host off # turn it off, and delete every reading
833
+ ocnus host # whether recording is on, and what it has
834
+ ocnus tests run <command> # run a test command, and record the test run
835
+ ```
836
+
837
+ While it is on, `task new`, `task start` and `task build` start the
838
+ recorder, a terminal in herdr-core called `ocnus-host`. It takes a
839
+ reading every 10 seconds while an agent is open, and stops once none is.
840
+ Nothing starts it with the machine: after a restart it starts again with the
841
+ next agent. A reading is numbers: CPU (busy, system, and by core type),
842
+ memory (pressure, used, swap and compressed), disk (read, written and the
843
+ home folder's disk free), network (bytes in and out, Wi-Fi or wired, the
844
+ share of TCP bytes sent again, and the Wi-Fi's signal and noise), and power
845
+ and heat (on battery, Low Power Mode and the thermal state). It keeps the CPU
846
+ and memory of ocnus's agents, with everything running in their
847
+ terminals, apart from the rest of the machine, which is one number each.
848
+ With it goes each agent's own share of that CPU and memory, the commands it
849
+ started included, named by the card it works on, its phase and the step
850
+ that card is in, as ocnus's hand-offs say. Each reading also counts the
851
+ agents open as working or waiting, and each share says which its agent was.
852
+ An agent is working while it takes its turn, and waiting while it is open
853
+ but its turn has ended, it waits on you in its tab, it hit an error, or it
854
+ has reported no status, as herdr-core says. A tab that holds its shell
855
+ alone is neither.
856
+
857
+ While it is on, `task new` and `task build` also start `claude` with hooks
858
+ that mark the agent's time: when it starts and stops, when it is given a
859
+ prompt, when each of its tools starts and ends, and when one asks for
860
+ permission. Each mark is a word and a time, to the millisecond, in a file
861
+ for its card and phase in `~/.config/ocnus/host/marks`. With them each
862
+ reading splits each agent's time in its step into three: time on the host,
863
+ while its tools run, such as its commands and test runs; waiting on the
864
+ model; and the rest, such as waiting on you. The three add up to the time
865
+ the agent was open. An agent started in another harness, or while recording
866
+ was off, has no split. Each wait on the model is kept too, as its start
867
+ and end and nothing more: from a prompt, or the end of the last tool
868
+ running, to the next tool's start, a permission asked, or the end of the
869
+ turn.
870
+
871
+ Beside the readings go the test runs. The build phase's skills run every
872
+ test command through `ocnus tests run`, whole suite or part, as in
873
+ `ocnus tests run npm test`, in ocnus and in every other repo. It
874
+ runs the command as it is, with its output, its input and its exit code,
875
+ and while recording is on it records the test run: its card and repo, when
876
+ it started, how long it took, the CPU it used and the most memory it held at
877
+ once, so a run that starts and ends between two readings is there too. It
878
+ keeps a fingerprint of the command, never its text: a number that is the
879
+ same for the same command, from which the command cannot be read back.
880
+ `task build` names the card to its agent, and a test run is recorded only in
881
+ one of the space's repos, or a worktree of one; anywhere else it runs the
882
+ command alone. Each reading also holds the share of each test run going
883
+ then, the CPU and memory of everything the run started, which is in its
884
+ agent's share too. A run that ended since the reading before gets the rest
885
+ of its CPU in the next one.
886
+
887
+ The card, phase, step and repo are the only names the readings hold: no
888
+ app's name, command line, file, window title, prompt or reply, and no
889
+ address, host or site reached, or the network's name. A test run's command
890
+ is there only as its fingerprint. The marks hold only their words and
891
+ times, never what a tool was called with or gave back. It needs no admin
892
+ rights, and is never sent off the machine. Readings, test runs, marks and
893
+ waits on the model are kept for 90 days, in `~/.config/ocnus/host`, and
894
+ recording uses well under 1% of the CPU.
895
+
896
+ `host report` takes the last 7 days, `<n>d` or `<n>h` back from now, a day
897
+ such as `2026-11-29`, or `2026-11-01..2026-11-29`. For each of CPU, memory
898
+ and disk it says how much of the recorded time it was at its limit: the CPU
899
+ at least 90% busy across all cores, memory pressure at warning or critical,
900
+ or under 10% of the home folder's disk free. Time with no reading, such as
901
+ when no agent was open, is shown as missing, never as idle. It also says how
902
+ much of the CPU recording used, watching the test runs included. Then, for
903
+ each number of agents working at once, from none up, it says how long that
904
+ many were working and how much of that time the CPU or memory was at its
905
+ limit. It names the fewest working at which that was at least a quarter of
906
+ the time, as the number from which the host was the limit, so you can tell
907
+ how many agents to run at once, or says the host was not the limit at any
908
+ number. Readings from before the agents working were counted are left out
909
+ of these figures, and their time is counted on a line of its own. Under
910
+ each number from 2 up, it says how much slower test runs were than with one
911
+ agent working, as a percentage, such as `test runs 30% slower than with 1
912
+ working, from 3 runs of 1 command against 3 with 1 working`. It sets only
913
+ runs of the same command in the same repo against each other, and a command
914
+ counts only once it has run at least 3 times with that many working and 3
915
+ times with one; with none that has, it says it cannot tell yet. A test run
916
+ counts at the number of agents working for most of its time. Runs cut
917
+ short, runs from before the fingerprints were kept, and runs while no
918
+ reading counted the agents working are left out. Then it names the 5
919
+ longest stretches in the period when the CPU or memory was at its limit,
920
+ longest first: when each started, how long it lasted and which of the two
921
+ was at its limit, then every card going then, with its step, or its phase
922
+ when it was in none, and every test run going then, each with its share of
923
+ all cores over the stretch and the most memory it held. Each card also says
924
+ for how much of the stretch its agent was working. With none, it says the
925
+ host was never at its limit for CPU or memory. Disk is not among them: a
926
+ full disk is not caused by a moment's work. Then it lists the
927
+ 10 steps and the 10 phases that used the most CPU time in the period, and
928
+ the 10 of each that held the most memory at once, each one card's own, such
929
+ as LAB-150's build step, with how long it ran. Then come the 10 test runs
930
+ that used the most CPU time, and the 10 that held the most memory at once,
931
+ each named by its card, its repo and when it started, with how long it ran.
932
+ Then it says where the steps' time went: the agents' time in all on the
933
+ host, waiting on the model and the rest, then the same for the 10 steps open
934
+ longest, each one card's own, such as LAB-152's build step, and how many
935
+ steps had no split.
936
+
937
+ Then it says whether the network may be the cause, as a slow wait on the
938
+ model can be the network rather than the host. A wait is slow when it took
939
+ over twice the median of every wait on the model recorded, up to 90 days.
940
+ When waits that ended in the period were slow while CPU, memory and disk
941
+ were all below their limit, in every reading over the wait, it says so:
942
+ `The network may be the cause: 14 of 120 waits on the model were slow (over
943
+ twice the median of 6.2s) while CPU, memory and disk were below their
944
+ limit.` A slow wait with no reading over it does not count. With none, it
945
+ says nothing. It cannot tell a slow network from a slow model.
946
+
947
+ Last comes the verdict, one line with the numbers behind it, so that money
948
+ goes on what slows the agents' work on the host. It weighs each reading by
949
+ the agents' time on the host in it, the seconds their tools ran, an agent's
950
+ second each, from the splits. With fewer than 10 steps with their time
951
+ split in the period, or under 1 hour of the agents' time on the host, there
952
+ is too little data yet, and it says how many and how long. Otherwise, of
953
+ CPU, memory and disk, the one at its limit for the most of the agents' time
954
+ on the host, when that is at least 10% of it, is the one to upgrade first:
955
+ `upgrade memory first: it was at its limit for 23.0% of the agents' 6h 10m
956
+ on the host (CPU 8.0%, disk 0.0%)`. When over half of its time at its limit
957
+ was on battery, in Low Power Mode or with the thermal state at serious or
958
+ critical, the verdict is that the power state was the limit, in place of an
959
+ upgrade: plugging in, or letting the machine cool, costs nothing. With none
960
+ at its limit for 10%, the network was the limit when at least 10% of the
961
+ period's waits on the model were slow while CPU, memory and disk were below
962
+ their limit, so that no host upgrade is bought that would not have helped.
963
+ Otherwise no upgrade is needed.
964
+ See [herdr/README.md](herdr/README.md#recording-the-host) for what a
965
+ reading holds.
966
+
967
+ ## Releasing
968
+
969
+ A machine installed through npm gets changes only from a release:
970
+
971
+ ```sh
972
+ npm version patch # or minor / major; commits and tags vX.Y.Z
973
+ git push --follow-tags
974
+ ```
975
+
976
+ Then publish a GitHub release for that tag. The `Publish to npm` workflow runs
977
+ the tests and publishes the package. It signs in to npm by
978
+ [trusted publishing](https://docs.npmjs.com/trusted-publishers), so there is no
979
+ token to keep.
980
+
981
+ Every push to `main` is published too, as a merge build under the npm tag
982
+ `next` (`0.4.1-next.3`, for example). `ocnus update` does not install
983
+ those. To try one on a machine installed through npm:
984
+
985
+ ```sh
986
+ OCNUS_NPM_SPEC=@johngaynor/ocnus@next ocnus update
987
+ ```
988
+
989
+ A plain `ocnus update` goes back to the latest release.