@johngaynor/ocnus 2.0.1-next.15 → 2.0.1-next.20

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 CHANGED
@@ -73,7 +73,8 @@ worked out. Until then the build step itself installs into each worktree what
73
73
  the tests need, and [`just`](https://just.systems) matters only once setup is
74
74
  on; see [what a repo provides](herdr/README.md#what-a-repo-provides). On
75
75
  Linux, the CPU mod in the `default` layout shows an error where its reading
76
- would be, since it reads macOS's `/usr/bin/top`.
76
+ would be, since it reads macOS's `/usr/bin/top`, and so does the Memory mod
77
+ above it, which reads macOS's `sysctl`, `vm_stat` and `ps`.
77
78
 
78
79
  ## Setting up a machine
79
80
 
@@ -88,8 +89,8 @@ and the two phase profiles in [agents/](agents/), which it links into
88
89
  `~/.claude/agents`; see [herdr/README.md](herdr/README.md) for the full
89
90
  walkthrough. `install` ends by telling you to switch Herdr to the `default`
90
91
  layout, which holds ocnus's panels: the Ocnus spaces panel, the Cards
91
- and Steps panels, the Usage section right above CPU, the Layout dropdown and
92
- the settings button. Herdr's own Agents section is not on it. Herdr starts on
92
+ and Steps panels, the Usage section above Memory and CPU, the Layout dropdown
93
+ and the settings button. Herdr's own Agents section is not on it. Herdr starts on
93
94
  its own layout, which has no Layout dropdown, so the first switch is
94
95
  `ctrl-shift-l`, pressed until `default` shows.
95
96
 
@@ -302,7 +303,7 @@ In Herdr, the settings button shows which is set and switches it with a
302
303
  click, through `billing subscription` and `billing api`; the key is saved in a
303
304
  terminal, with `billing key`.
304
305
 
305
- On the subscription, the Usage section, right above CPU in the `default`
306
+ On the subscription, the Usage section, above Memory and CPU in the `default`
306
307
  layout's sidebar, shows how much of your Claude subscription's five-hour and
307
308
  weekly usage limits is used, as a percentage and a bar each, and when each
308
309
  resets.
package/herdr/README.md CHANGED
@@ -8,14 +8,15 @@ 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
+ | `mods/memory/` | Live memory use with a scrolling history, like the CPU mod's: memory used out of the Mac's total, in GB, as Activity Monitor's Memory Used counts it. Each reading is a bar as high as the share of the Mac's memory in use, coloured by macOS's memory pressure: green for normal, yellow for warning, red for critical. Under the figure, `claude` is the resident memory of every process whose command is `claude`: ocnus's agents, while their harness is `claude`, and any Claude Code session you opened yourself, but not what they run, such as a test run, which counts in memory used alone. So it is not the recorder's `mem_agents_mb`, which counts every process under a terminal labelled with one of your spaces (see [Recording the host](#recording-the-host)). `swap` is the swap in use. It reads macOS itself, so it shows the same whether recording is on or off. macOS only (reads `sysctl`, `vm_stat` and `ps`). |
12
+ | `mods/usage/` | The Usage section, above Memory and CPU, and as small: how much of your Claude subscription's five-hour and weekly usage limits is used, as a percentage and a bar each, and when each resets, as the agents ocnus starts last read them. See [The Usage section](#the-usage-section). |
12
13
  | `mods/layout-switch/` | A dropdown that shows the current layout and switches to another. |
13
14
  | `mods/ocnus-spaces/` | The Ocnus spaces panel: every space in your config, open or not. Click one to show it; `+` makes a new one. It is not `spaces`, which is Herdr's own list of the spaces it has open. |
14
15
  | `mods/cards/` | The open Linear cards of the space that is showing, under their statuses. Start writes a card up with `task new`; Open shows the tab of a card already started. |
15
16
  | `mods/steps/` | The steps of the card whose tab is selected: what each did, how long it took, and how long it waited on you. With no card's tab selected, the space's cards and where each stands. |
16
17
  | `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). |
17
18
  | `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). |
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. |
19
+ | `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, the Memory mod and the CPU mod in the sidebar, with Usage above Memory and CPU, and Memory right above CPU; and the settings button beside the tabs. Herdr's Agents section, its `agents` mod, is not on it. The tab bar is a row of Herdr's `tabs`, `agent-settings` and `names`, in a block 1px wide, since a mod runs only while a layout places it. |
19
20
  | `spaces/template/` | The starting `SPACE.md` for every new space. |
20
21
 
21
22
  The skills are in [../skills/](../skills/), outside this folder. They are
@@ -1575,8 +1576,8 @@ ocnus billing key
1575
1576
 
1576
1577
  ### The Usage section
1577
1578
 
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
1579
+ On the `default` layout, the Usage section sits in the sidebar above Memory
1580
+ and CPU, and is as small: how much of your Claude subscription's usage limits is
1580
1581
  used, and when each resets, so you can pace the agents without leaving
1581
1582
  Herdr.
1582
1583
 
@@ -80,6 +80,16 @@
80
80
  "mod": "usage"
81
81
  }
82
82
  },
83
+ {
84
+ "id": "memory",
85
+ "type": "block",
86
+ "size": {
87
+ "px": 64
88
+ },
89
+ "content": {
90
+ "mod": "memory"
91
+ }
92
+ },
83
93
  {
84
94
  "id": "cpu",
85
95
  "type": "block",
@@ -0,0 +1,128 @@
1
+ // Live memory use, drawn as a scrolling history like the CPU mod's, which it
2
+ // sits above: memory used out of the Mac's total, a bar a reading whose
3
+ // colour is macOS's memory pressure, what the claude processes hold, and the
4
+ // swap in use.
5
+ //
6
+ // macOS only. It reads what macOS's own sysctl, vm_stat and ps print, and
7
+ // nothing that the host's recorder keeps, so it shows the same whether
8
+ // recording is on or off. What a reading is worked out from, and how, is in
9
+ // reading.js, which the tests run with node.
10
+ import { View, div } from "gpui-kit";
11
+ import { h_flex, v_flex } from "gpui-base";
12
+ import { exec, theme, window, checking, settings } from "herdr";
13
+ import { GB, reading, share, gb, outOf } from "./reading.js";
14
+
15
+ const SAMPLE_MS = 2000; // one reading every two seconds
16
+ const TIMEOUT_MS = 10000;
17
+ const BAR = 3; // px per reading
18
+ const GAP = 1;
19
+ const KEEP = 600; // readings kept, enough for a very wide panel
20
+ const HEIGHT = 64; // the block's own, as the layout gives it
21
+
22
+ // `herdr-app check` draws the mod once, and a reading there would run
23
+ // macOS's tools for nothing. It draws these instead: a reading at each
24
+ // pressure, so that a bar of each colour is drawn.
25
+ const SAMPLE = [
26
+ { total: 16 * GB, used: 9.4 * GB, pressure: "normal", swap: 0, claude: 3.3 * GB },
27
+ { total: 16 * GB, used: 13.1 * GB, pressure: "warning", swap: 1.5 * GB, claude: 4.2 * GB },
28
+ { total: 16 * GB, used: 15.2 * GB, pressure: "critical", swap: 6 * GB, claude: 4.4 * GB },
29
+ ];
30
+
31
+ // What a tool printed, or nothing when it could not be run or took too long.
32
+ // reading.js then says which tool gave no reading, in a line short enough to
33
+ // show whole, which Herdr's own words for a tool that is not there are not.
34
+ const printed = (run) => run.then((r) => r.stdout, () => "");
35
+
36
+ export default class Memory extends View {
37
+ init(_props, cx) {
38
+ this.samples = [];
39
+ this.busy = false;
40
+ this.error = null;
41
+ this.graph = { width: 240, height: 40 };
42
+ if (checking()) return;
43
+ cx.timer.every(SAMPLE_MS, (cx) => this.sample(cx));
44
+ this.sample(cx);
45
+ }
46
+
47
+ sample(cx) {
48
+ // Skip while a reading is in flight or nobody can see the window.
49
+ if (this.busy || window()?.visible === false) return;
50
+ this.busy = true;
51
+ cx.spawn(async (cx) => {
52
+ try {
53
+ const [sysctl, vmStat, ps] = await Promise.all([
54
+ printed(exec("/usr/sbin/sysctl", ["hw.memsize", "kern.memorystatus_vm_pressure_level", "vm.swapusage"], { timeout: TIMEOUT_MS })),
55
+ printed(exec("/usr/bin/vm_stat", [], { timeout: TIMEOUT_MS })),
56
+ printed(exec("/bin/ps", ["-axc", "-o", "rss=,comm="], { timeout: TIMEOUT_MS })),
57
+ ]);
58
+ const r = reading(sysctl, vmStat, ps);
59
+ if (r.reason) {
60
+ this.error = r.reason;
61
+ } else {
62
+ this.samples.push(r);
63
+ if (this.samples.length > KEEP) this.samples.shift();
64
+ this.error = null;
65
+ }
66
+ } catch (e) {
67
+ this.error = String(e?.message ?? e);
68
+ }
69
+ this.busy = false;
70
+ cx.notify();
71
+ });
72
+ }
73
+
74
+ render() {
75
+ if (checking()) {
76
+ // Both faces, so that a check draws each of them once: the figures
77
+ // beside a bar of each colour, and the line that takes the figures'
78
+ // place when there is no reading.
79
+ return v_flex().size_full()
80
+ .child(div().h(HEIGHT).child(this.face(SAMPLE, null, "sample")))
81
+ .child(div().h(HEIGHT).child(this.face([], "no reading from sysctl", "none")));
82
+ }
83
+ return this.face(this.samples, this.error, "memory");
84
+ }
85
+
86
+ // The readout, and the history beside it.
87
+ // samples the readings to draw, the newest last
88
+ // error why there is no reading now, or null
89
+ // key what the ids in it start with
90
+ face(samples, error, key) {
91
+ const t = theme();
92
+ // Activity Monitor's colours for memory pressure. A reading whose
93
+ // pressure could not be read has none of them.
94
+ const colors = { normal: t.ansi2, warning: t.ansi3, critical: t.ansi1 };
95
+ // With no reading now, the last one's figures would be stale.
96
+ const last = error ? null : samples.at(-1);
97
+
98
+ const fit = Math.max(1, Math.floor(this.graph.width / (BAR + GAP)));
99
+ const shown = samples.slice(-fit);
100
+ const h = Math.max(1, this.graph.height);
101
+
102
+ const readout = v_flex().flex_none().w(132).gap(2).justify_center()
103
+ .child(h_flex().gap(8).items_end()
104
+ .child(div().text_size(11).text_color(t.muted).child("MEM"))
105
+ .child(div().text_size(20).font_semibold().text_color(t.foreground).child(last ? gb(last.used) : "–"))
106
+ .when(Boolean(last), (el) => el.child(div().text_size(11).text_color(t.muted).child(outOf(last.total)))))
107
+ .child(error
108
+ ? div().text_size(11).text_color(t.blocked).truncate().child(error)
109
+ : h_flex().gap(10).text_size(11).text_color(t.muted)
110
+ .child(div().child(last ? `claude ${gb(last.claude)}` : "claude"))
111
+ .child(div().child(last ? `swap ${gb(last.swap)}` : "swap")));
112
+
113
+ const bars = h_flex().id(`${key}-graph`).flex_1().h_full().min_w(0).overflow_hidden()
114
+ .items_end().justify_end().gap(GAP).rounded(4).bg(t.surface)
115
+ .on_size_change((size, cx) => {
116
+ const zoom = Number(settings().zoom) || 1;
117
+ this.graph = { width: size.width / zoom, height: size.height / zoom };
118
+ cx.notify();
119
+ })
120
+ .children(shown.map((s) =>
121
+ div().flex_none().w(BAR).h(Math.round(share(s) * h)).bg(colors[s.pressure] ?? t.muted)));
122
+
123
+ return h_flex().size_full().px(14).py(8).gap(12).items_center()
124
+ .bg(t.chrome).border_t(1).border_color(t.border)
125
+ .child(readout)
126
+ .child(bars);
127
+ }
128
+ }
@@ -0,0 +1 @@
1
+ { "place": "none", "title": "Memory" }
@@ -0,0 +1,88 @@
1
+ // The Memory mod's arithmetic: from what macOS's tools print to a reading,
2
+ // and from a reading to what main.js draws of it. It is apart from main.js,
3
+ // and imports nothing, so that the tests can run it with node
4
+ // (test/memory.sh). So it uses only what any JavaScript has: nothing of
5
+ // Herdr's, and nothing of node's.
6
+
7
+ export const GB = 1024 ** 3;
8
+ // What `sysctl kern.memorystatus_vm_pressure_level` prints. macOS has these
9
+ // three levels and no other.
10
+ const PRESSURE = { 1: "normal", 2: "warning", 4: "critical" };
11
+ // The units `sysctl vm.swapusage` writes an amount in, in bytes.
12
+ const UNIT = { K: 1024, M: 1024 ** 2, G: GB };
13
+ // The counts of vm_stat's that memory used is worked out from, each by the
14
+ // name its line starts with.
15
+ const COUNTS = ["Anonymous pages", "Pages purgeable", "Pages wired down", "Pages occupied by compressor"];
16
+
17
+ // One of vm_stat's counts, in pages, or null when it has no line for it.
18
+ function pages(vmStat, name) {
19
+ const m = vmStat.match(new RegExp(`^${name}:\\s+(\\d+)\\.?\\s*$`, "m"));
20
+ return m ? Number(m[1]) : null;
21
+ }
22
+
23
+ // The reading that the three tools' output gives:
24
+ // sysctl what sysctl prints for hw.memsize, vm.swapusage and
25
+ // kern.memorystatus_vm_pressure_level, each after its name
26
+ // vmStat what vm_stat prints
27
+ // ps what `ps -axc -o rss=,comm=` prints: each process's resident
28
+ // memory in KB, then its command's name
29
+ // It is { total, used, pressure, swap, claude }: bytes, but for the
30
+ // pressure, which is "normal", "warning" or "critical".
31
+ //
32
+ // Memory used is counted as Activity Monitor's Memory Used counts it, which
33
+ // is how the host's recorder counts mem_used_mb (cli/lib/host.sh): the
34
+ // anonymous pages less the purgeable ones, plus the wired ones and those the
35
+ // compressor occupies. claude is the resident memory of every process whose
36
+ // command is exactly claude, and 0 when ps lists none.
37
+ //
38
+ // Without the Mac's total or memory used there is nothing to draw, so the
39
+ // reading is { reason } instead: one short line that says which tool gave
40
+ // none. Any other value that cannot be read is null, and the rest of the
41
+ // reading is kept.
42
+ export function reading(sysctl = "", vmStat = "", ps = "") {
43
+ const total = Number(sysctl.match(/^hw\.memsize:\s*(\d+)\s*$/m)?.[1] ?? 0);
44
+ if (!(total > 0)) return { reason: "no reading from sysctl" };
45
+
46
+ const page = Number(vmStat.match(/page size of (\d+) bytes/)?.[1] ?? 0);
47
+ const counts = COUNTS.map((name) => pages(vmStat, name));
48
+ if (!(page > 0) || counts.includes(null)) return { reason: "no reading from vm_stat" };
49
+ const [anonymous, purgeable, wired, compressor] = counts;
50
+
51
+ const level = sysctl.match(/^kern\.memorystatus_vm_pressure_level:\s*(\d+)\s*$/m)?.[1];
52
+ const swap = sysctl.match(/^vm\.swapusage:.*\bused = (\d+(?:\.\d+)?)([KMG])/m);
53
+
54
+ // ps lists every process, so one that lists none did not run.
55
+ let listed = 0;
56
+ let held = 0;
57
+ for (const line of ps.split("\n")) {
58
+ const m = line.match(/^\s*(\d+)\s+(.*?)\s*$/);
59
+ if (!m) continue;
60
+ listed += 1;
61
+ if (m[2] === "claude") held += Number(m[1]) * 1024;
62
+ }
63
+
64
+ return {
65
+ total,
66
+ used: (anonymous - purgeable + wired + compressor) * page,
67
+ pressure: PRESSURE[level] ?? null,
68
+ swap: swap ? Math.round(Number(swap[1]) * UNIT[swap[2]]) : null,
69
+ claude: listed ? held : null,
70
+ };
71
+ }
72
+
73
+ // The share of the Mac's memory in use, which is how high a reading's bar
74
+ // is: from 0 to 1, whatever the counts say.
75
+ export const share = (r) => Math.min(1, Math.max(0, r.used / r.total));
76
+
77
+ // An amount of memory as the readout writes it, in GB to one decimal: 9.4.
78
+ // None at all is 0, so that no claude process, or no swap in use, reads as
79
+ // none and not as 0.0, which is an amount too small to show. One that could
80
+ // not be read is –.
81
+ export function gb(bytes) {
82
+ if (bytes == null) return "–";
83
+ return bytes === 0 ? "0" : (bytes / GB).toFixed(1);
84
+ }
85
+
86
+ // The Mac's total as the readout writes it after memory used: / 16 GB. A
87
+ // whole number of GB has no decimal.
88
+ export const outOf = (total) => `/ ${Math.round((total / GB) * 10) / 10} GB`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johngaynor/ocnus",
3
- "version": "2.0.1-next.15",
3
+ "version": "2.0.1-next.20",
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": {
@@ -58,6 +58,10 @@ The build step changes nothing on the card. The hand-off records how it ended.
58
58
 
59
59
  When every Done when item has its change, run the repo's whole test suite, in every worktree you changed. It is the build step's first whole run. Run it through `ocnus tests run`, as section 2 says, as in `ocnus tests run npm test`. The build step is done only when the tests pass, but for any test the human let stand, as below. Run it once, and keep what it prints, in a file if it is long, rather than running it again to read another part of it.
60
60
 
61
+ Just before the run, note the tree it tests, in each worktree: `git add -A && git write-tree` prints it. When the run passes, say in the hand-off's `summary` which tree it passed on, as in `The whole suite passed on tree 4b825dc.`, with the repo's name before each tree when there are several. The review step finds that tree in the hand-off, and when the commit it checks holds the same tree, it uses this run rather than running the suite again. Make every change before your last whole run: a file changed after it, even by a commit hook, gives another tree, and the review step runs the suite again.
62
+
63
+ **A change to docs alone.** When every file the change touches is documentation, the whole suite shows nothing about it, so run only the tests that read those files. List the files with `git add -A && git diff --cached --name-only <the commit the task started from>`, which the check on the default branch below says how to find. Documentation is a file nothing runs or loads, such as a README, a `docs/` page or a changelog. A Markdown file a program loads or an agent follows, such as a skill, a prompt or a template, is not documentation. To find the tests that read a file, search the repo's tests for its path and its name with `git grep -l`. Run the part of the suite that holds them through `ocnus tests run`, as in `ocnus tests run npm test -- install`, or the whole suite when the repo can't run less. When no test reads them, run nothing. Either way, note the tree as above, and say in `summary` that the change touches docs alone, which tests ran, and the tree, as in `Docs alone: the install tests passed on tree 4b825dc.`
64
+
61
65
  If a test fails, find out why and fix it. Change a test only when the Plan changes what that test checks. A test made to pass by weakening it is a failure you have hidden from the human.
62
66
 
63
67
  When a test fails that your change doesn't explain, find out whether it fails on the default branch too, without touching the task's worktree:
@@ -94,7 +98,7 @@ ocnus task handoff <space> <card ID> <<'EOF'
94
98
  step: build
95
99
  status: done
96
100
  next: review
97
- summary: <what was built, in which repos, how many commits, and that the tests pass; any detail where you followed the code rather than the Plan>
101
+ summary: <what was built, in which repos, how many commits, and the tree the tests passed on; any detail where you followed the code rather than the Plan>
98
102
  flags: <any Done when item you could not show to be true, and why; anything you found outside the Plan>
99
103
  EOF
100
104
  ```
@@ -176,7 +180,7 @@ ocnus task handoff shop ABC-122 <<'EOF'
176
180
  step: build
177
181
  status: done
178
182
  next: review
179
- summary: Installed each worktree's dependencies as its README says, then built the CSV export in api and the Download CSV button in web, in two commits. Both test suites pass. The CSV helper is csv_rows in shop/api/app/common/export.py, not csv_stream as the Plan said.
183
+ summary: Installed each worktree's dependencies as its README says, then built the CSV export in api and the Download CSV button in web, in two commits. Both test suites pass: on tree 9c1e4a2 in api and 5f03b7d in web. The CSV helper is csv_rows in shop/api/app/common/export.py, not csv_stream as the Plan said.
180
184
  flags: The orders page's tests can't set its filters yet, so item 3 is shown by the API test alone. The orders list also ignores the date range on page 2, which is outside this card.
181
185
  EOF
182
186
  ```
@@ -166,7 +166,7 @@ In the worktree of each repo whose pull request is in conflict, on the task's br
166
166
 
167
167
  1. Run `git fetch origin`, then `git merge origin/<default branch>`, with the default branch section 2 found. git stops with the files in conflict, and `git status` lists them. Note them: the hand-off and the pull request name them. When git merges it with no conflict, as it does when the default branch has moved again since GitHub looked, it commits the merge itself: go on to item 3.
168
168
  2. Resolve each one, keeping both what the card's work does and what the default branch has done since. `git log HEAD..origin/<default branch> -- <file>` lists the commits that changed it there.
169
- 3. Run the repo's whole test suite through `ocnus tests run`, as section 6 does. If a test fails, other than one the human let stand, find out why and fix it. Change a test only when the default branch changed what that test checks. The review step that follows in this session relies on this run, so the suite runs once on the merge.
169
+ 3. Run the repo's whole test suite through `ocnus tests run`, as section 6 does. Just before the run, note the tree it tests with `git add -A && git write-tree`, as the build step does. If a test fails, other than one the human let stand, find out why and fix it, then note the tree again and run the suite again. Change a test only when the default branch changed what that test checks. The review step that follows relies on this run, so the suite runs once on the merge: it uses the run when the merge commit holds the tree it passed on.
170
170
  4. Commit the merge with `git commit`, by the repo's rules for commits. Where they say nothing of a merge, keep the message git wrote for it, with `git commit --no-edit`. Don't skip its commit hooks. A fix the tests needed goes in the merge, or in a commit after it. `git status` shows no changes after.
171
171
  5. Push nothing yet. The review step checks the merge first, and section 4 pushes it once the review step has passed the work again.
172
172
 
@@ -191,7 +191,7 @@ ocnus task handoff <space> <card ID> <<'EOF'
191
191
  step: pr
192
192
  status: done
193
193
  next: review
194
- summary: <the pull request brought up to date, the merge commit, the files that conflicted and what the fix changed, and that the tests pass>
194
+ summary: <the pull request brought up to date, the merge commit, the files that conflicted and what the fix changed, and the tree the tests passed on>
195
195
  EOF
196
196
  ```
197
197
 
@@ -31,14 +31,14 @@ Read the guidance in each worktree with commits: its `CLAUDE.md`, `AGENTS.md`, `
31
31
 
32
32
  ## 2. Run the tests
33
33
 
34
- Run the repo's whole test suite in each worktree with commits, unless this session has already seen it pass on exactly what that worktree holds now. That is so only when all of these hold:
34
+ Run the repo's whole test suite in each worktree with commits, unless a step has already seen it pass on exactly what that worktree holds now. Find out with `ocnus task log <space> <card ID>`: take the last `done` hand-off from the build step, or from the pr step after a conflict merge. Its `summary` names the tree its run passed on, as in `The whole suite passed on tree 4b825dc.` The run counts for this worktree only when all of these hold:
35
35
 
36
- - This session ran the build step, or the pr step after a conflict merge, and that step's last whole run passed, but for any test the human let stand.
37
- - Nothing changed a file in the worktree after that run: that step only committed what the run tested, and every commit since the run is one that step made. A commit hook that refused a commit, so that a file was fixed after the run, means the run no longer counts.
38
- - The repo runs no commit hook that can change what is committed, such as through `.husky/`, `lint-staged` or `.pre-commit-config.yaml`.
36
+ - That hand-off names a tree for this worktree, and `git rev-parse --short HEAD^{tree}` prints the same tree. The same tree is the same files, whichever session ran the tests, so a file changed after that run, by a fix or by a commit hook, gives another tree and means the run no longer counts.
39
37
  - `git status` shows no changes.
40
38
 
41
- Then don't run it again, and say so on the Review's round line, as in `The tests pass, in the build step's run.` When the build step ran in another session, when anything changed after that run, or when you can't tell, run it yourself: the review step is what shows it.
39
+ Then don't run it again, and say so on the Review's round line, as in `The tests pass, in the build step's run on tree 4b825dc.` When no hand-off names a tree, when the trees differ, or when you can't tell, run it yourself: the review step is what shows it.
40
+
41
+ When that hand-off says the change touches docs alone, its run was the tests that read those files, not the whole suite, and it counts in the same way. When you run the tests yourself and every file the task's commits change is documentation, as the build step's section 3 says, run only the tests that read them, as it says there, and say so on the round line.
42
42
 
43
43
  When you run it, run it once, and keep what it prints, in a file if it is long, rather than running it again to read another part of it. Run it through `ocnus tests run`, as the build step does, as in `ocnus tests run npm test`, so that the test run is recorded as this card's.
44
44