@johngaynor/ocnus 2.0.1-next.78 → 2.0.1-next.80

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
@@ -1336,7 +1336,7 @@ read afterwards. It is off until you turn it on, and works on macOS only.
1336
1336
 
1337
1337
  ```sh
1338
1338
  ocnus host on # turn recording on
1339
- ocnus host report [<period>] # the host's numbers summed up, what used the most, and where the steps' time went
1339
+ ocnus host report [<period>] # the host's numbers and the work summed up, and where the steps' time went
1340
1340
  ocnus host report --card <space> <card> --json # what the host recorded while each of a card's steps ran, as JSON for programs
1341
1341
  ocnus host off # turn it off, and delete every reading
1342
1342
  ocnus host # whether recording is on, and what it has
@@ -1415,16 +1415,21 @@ of memory pressure. An average weighs each reading by its seconds in the
1415
1415
  period. One of the levels is how much of the CPU recording used, its
1416
1416
  average with watching the test runs included. A number that no reading in
1417
1417
  the period holds, as on a Mac without it or in readings from before it was
1418
- recorded, is shown as not read, never as 0. Then it lists the
1419
- 10 steps and the 10 phases that used the most CPU time in the period, and
1420
- the 10 of each that held the most memory at once, each one card's own, such
1421
- as LAB-150's build step, with how long it ran. Then come the 10 test runs
1422
- that used the most CPU time, and the 10 that held the most memory at once,
1423
- each named by its card, its repo and when it started, with how long it ran.
1424
- Then it says where the steps' time went: the agents' time in all on the
1425
- host, waiting on the model and the rest, then the same for the 10 steps open
1426
- longest, each one card's own, such as LAB-152's build step, and how many
1427
- steps had no split.
1418
+ recorded, is shown as not read, never as 0. Then it sums up the work in
1419
+ the period by kind, never card by card, and ranks none of it. For each
1420
+ step, in their order from `define` to `pr`, and each phase, `write-up` then
1421
+ `build`: how many cards were in it, how long their agents were open in all,
1422
+ on average and at the longest, the CPU time they used, and the most memory
1423
+ one card held at once. A tab that holds its shell alone counts for none of
1424
+ it. For each repo's test runs that started in the period, the repos in the
1425
+ order of their names: how many there were, how long those that ended took
1426
+ in all, on average and at the longest, the CPU time they used, the most
1427
+ memory one held, and how many were cut short or are still going. A figure
1428
+ that was not read, such as the CPU time in readings from before the cores
1429
+ were counted, is shown as not read, and a list with none says
1430
+ `none recorded`. Then it says where the steps' time went: the agents' time
1431
+ in all on the host, waiting on the model and the rest, then the same for
1432
+ each step, every card's in it together, and how many steps had no split.
1428
1433
 
1429
1434
  `ocnus host report --card <space> <card> --json` gives a program what
1430
1435
  the host recorded while each of a card's steps ran, as one line of JSON, so
package/cli/lib/host.sh CHANGED
@@ -27,8 +27,8 @@
27
27
  # so that no process counts toward two, and the shares add up to the agents'
28
28
  # totals. A share names its terminal's work by the card its labels give, the
29
29
  # phase its tab gives, and the step that card is in, from the hand-off store,
30
- # which the recorder only ever reads. `host report` ranks the steps and
31
- # phases by them.
30
+ # which the recorder only ever reads. `host report` sums them up by step and
31
+ # by phase, never card by card.
32
32
  #
33
33
  # Each reading also counts the agents open as working or waiting, and each
34
34
  # share says which its agent was. An agent is working while it takes its
@@ -43,7 +43,7 @@
43
43
  # memory it held at once. A test run is named by its card and repo alone.
44
44
  # Its command is kept only as a fingerprint, a number the same for the same
45
45
  # command and from which its text cannot be read back, and nothing else of
46
- # its command line is kept. `host report` ranks the test runs too.
46
+ # its command line is kept. `host report` sums the test runs up by repo.
47
47
  #
48
48
  # With each reading go the shares of the test runs going then, too, each
49
49
  # worked out as a terminal's is, from the processes under the run's job,
@@ -1214,11 +1214,11 @@ host_day() {
1214
1214
  # How the host worked over a period, in its numbers alone: how much of the
1215
1215
  # period was recorded, in all and on each day, with time with no reading
1216
1216
  # shown as missing, never as idle (host_report_sql). Then the host's numbers
1217
- # summed up (host_numbers_sql), the steps, phases and test runs that used the
1218
- # most (host_ranks_sql), and it ends with where the steps' time went
1219
- # (host_split_sql).
1217
+ # summed up (host_numbers_sql), the work summed up by step, by phase and by
1218
+ # repo (host_work_sql), and it ends with where the steps' time went, by step
1219
+ # (host_split_sql). It ranks nothing, and names no card.
1220
1220
  host_report() {
1221
- local period=${1:-7d} now start end n first last row have ranks=0 works=0 splits=0
1221
+ local period=${1:-7d} now start end n first last row have
1222
1222
  # A card's readings, as JSON, are a form of their own.
1223
1223
  for n in "$@"; do
1224
1224
  case $n in --card | --json) host_card "$@"; return ;; esac
@@ -1264,23 +1264,13 @@ host_report() {
1264
1264
  fi
1265
1265
  # A store the recorder has not opened since a table or a column came has
1266
1266
  # none of it, and the report only reads the store, so it never adds them.
1267
- # A number whose column the store lacks is not read. The lists of what
1268
- # used the most need the readings' cores, the shares and the test runs,
1269
- # and where the steps' time went needs the shares, and the splits to split
1270
- # it.
1267
+ # A column the store lacks is read as null, so that its number is not
1268
+ # read, and a table it lacks as one with no rows (host_select).
1271
1269
  have=$(host_columns) || have=' '
1272
- case $have in *' shares.'*) works=1 ;; esac
1273
- case $have in *' splits.'*) splits=$works ;; esac
1274
- case $have in *' readings.cores '*) case $have in *' test_runs.'*) ranks=$works ;; esac ;; esac
1275
1270
  store "$HOST_DB" "$(host_report_sql "$start" "$end" "$period")" || die "could not read $HOST_DB"
1276
1271
  store "$HOST_DB" "$(host_numbers_sql "$start" "$end" "$have")" || die "could not read $HOST_DB"
1277
- if [ "$ranks" = 1 ]; then
1278
- store "$HOST_DB" "$(host_ranks_sql "$start" "$end")" || die "could not read $HOST_DB"
1279
- else
1280
- say ''
1281
- say 'No step, phase or test run was recorded in this period.'
1282
- fi
1283
- store "$HOST_DB" "$(host_split_sql "$start" "$end" "$works" "$splits")" || die "could not read $HOST_DB"
1272
+ store "$HOST_DB" "$(host_work_sql "$start" "$end" "$have")" || die "could not read $HOST_DB"
1273
+ store "$HOST_DB" "$(host_split_sql "$start" "$end" "$have")" || die "could not read $HOST_DB"
1284
1274
  }
1285
1275
 
1286
1276
  # The tables and the columns the readings' store has, each column as its
@@ -1290,6 +1280,33 @@ host_columns() {
1290
1280
  from sqlite_master m join pragma_table_info(m.name) p where m.type = 'table';"
1291
1281
  }
1292
1282
 
1283
+ # SQL that selects the columns $3 onward of the table $2, from a store whose
1284
+ # tables and columns $1 lists, as host_columns gives them: a column the
1285
+ # store lacks as null, and no row at all when it lacks the table.
1286
+ host_select() {
1287
+ local have=$1 table=$2 c cols=''
1288
+ shift 2
1289
+ for c in "$@"; do
1290
+ case $have in *" $table.$c "*) cols="$cols, $c" ;; *) cols="$cols, null as $c" ;; esac
1291
+ done
1292
+ case $have in
1293
+ *" $table."*) printf 'select %s from %s' "${cols#, }" "$table" ;;
1294
+ *) printf 'select %s where 0' "${cols#, }" ;;
1295
+ esac
1296
+ }
1297
+
1298
+ # SQL for the place of the value of the column $1 among the names $2 onward,
1299
+ # from 1 in their order; a value that is none of them comes after them all.
1300
+ host_order() {
1301
+ local col=$1 name sql='' n=0
1302
+ shift
1303
+ for name in "$@"; do
1304
+ n=$((n + 1))
1305
+ sql="$sql when '$name' then $n"
1306
+ done
1307
+ printf 'case %s%s else %s end' "$col" "$sql" $((n + 1))
1308
+ }
1309
+
1293
1310
  # The top of the report, for the period from $1 to $2, named $3: how much of
1294
1311
  # it was recorded and how much is missing, then the same for each day. A
1295
1312
  # reading covers the secs before its at, so each one counts for the part of
@@ -1459,128 +1476,147 @@ host_state() {
1459
1476
  else $shown || case when $left > 0 then ', $none ' || $(sql_took "($left)") else '' end end"
1460
1477
  }
1461
1478
 
1462
- # The steps and the phases that used the most CPU time, and that held the
1463
- # most memory at once, from $1 to $2: ten of each, each one card's own. Each
1464
- # counts what its shares say for the part of their reading in the period,
1465
- # as the report counts a reading: its CPU time is its share of all cores
1466
- # times that part times the cores, its memory the most its shares held in one
1467
- # reading, and its time those parts together.
1479
+ # The work from $1 to $2, summed up by kind, never card by card: each step,
1480
+ # each phase, and each repo's test runs. $3 lists the store's tables and
1481
+ # columns, as host_columns gives them: a column the store lacks is read as
1482
+ # null, and a table it lacks as one with no rows (host_select).
1483
+ #
1484
+ # A step or a phase counts each card's shares while its agent was open, for
1485
+ # the part of their reading in the period, as the report counts a reading,
1486
+ # and once a reading however many of the card's tabs were in it: so a
1487
+ # step's time in all is the time its agents were open, which where the
1488
+ # steps' time went splits. A card's CPU time in it is its shares' share of
1489
+ # all cores, over that part, on the reading's cores, and its memory the most
1490
+ # its shares held in one reading. Its line gives how many cards were in it,
1491
+ # their time in all, on average and at the longest, their CPU time added up,
1492
+ # and the most memory one of them held.
1493
+ #
1494
+ # A repo's line counts its test runs that started in the period: how many,
1495
+ # the time in all, on average and at the longest of those that ended, their
1496
+ # CPU time added up, and the most memory one held. When any were cut short,
1497
+ # ended by the recorder as their process had gone, or are still going, it
1498
+ # ends with how many of each.
1468
1499
  #
1469
- # Then the ten test runs that started in the period and used the most CPU
1470
- # time, and the ten that held the most memory at once, each named by its
1471
- # card, its repo and when it started, with how long it ran. A run the
1472
- # recorder cut short says so, and has as its CPU what the recorder counted
1473
- # of it: with none counted, it is only ranked by its memory. One still going
1474
- # says that in place of its time. With no step, phase or test run in the
1475
- # period, it says so in place of the lists.
1476
- host_ranks_sql() {
1477
- local s=$1 e=$2 name ran
1478
- name="' ' || printf('%-32s', card || ' ' || repo || ' ' || strftime('%Y-%m-%d %H:%M', started, 'unixepoch', 'localtime'))"
1479
- ran="case when ended is null then ', still going'
1480
- else ', ran ' || $(sql_took "cast(round(secs) as integer)") || case when cut = 1 then ', cut short' else '' end end"
1500
+ # The order is fixed, never by size: the steps from define to pr, write-up
1501
+ # before build, the repos by name. A list with none says none recorded, and
1502
+ # with no step, phase or test run at all, it says so in place of the lists.
1503
+ # A figure no row holds says not read, as SQLite's printf would print a null
1504
+ # as 0, and sql_took of a null is null.
1505
+ host_work_sql() {
1506
+ local s=$1 e=$2 have=$3 line
1507
+ line="' ' || printf('%-18s ', name) || many || noun || ', '
1508
+ || case when ran is null then 'time not read'
1509
+ else $(sql_took ran) || ' in all, ' || $(sql_took mean) || ' on average, ' || $(sql_took longest) || ' at the longest' end
1510
+ || '; CPU time ' || case when cpu is null then 'not read' else $(sql_took cpu) end
1511
+ || '; memory ' || case when mem is null then 'not read' else mem || ' MB at most' end || tail"
1481
1512
  cat <<EOF
1482
1513
  with
1483
- runs(card, repo, started, ended, secs, cpu, mem, cut) as (
1484
- select card, repo, started, ended, secs, cpu_secs, mem_mb, cut from test_runs where started >= $s and started < $e),
1514
+ r(at, secs, cores) as ($(host_select "$have" readings at secs cores)),
1485
1515
  parts(at, d, cores) as (
1486
- select at, max(0, min(at, $e) - max(at - secs, $s)), cores from readings
1516
+ select at, max(0, min(at, $e) - max(at - secs, $s)), cores from r
1487
1517
  where at > $s and at < $e + $HOST_GAP and at - secs < $e),
1518
+ sh(at, card, phase, step, open, cpu, mem) as ($(host_select "$have" shares at card phase step open cpu mem_mb)),
1488
1519
  owned(kind, card, what, at, d, cpu, mem) as (
1489
- select 'step', s.card, s.step, p.at, p.d, s.cpu * p.d * p.cores / 100.0, s.mem_mb
1490
- from parts p join shares s on s.at = p.at where s.card is not null and s.step is not null
1520
+ select 'step', s.card, s.step, p.at, p.d, s.cpu * p.d * p.cores / 100.0, s.mem
1521
+ from parts p join sh s on s.at = p.at where s.open = 1 and s.card is not null and s.step is not null
1491
1522
  union all
1492
- select 'phase', s.card, s.phase, p.at, p.d, s.cpu * p.d * p.cores / 100.0, s.mem_mb
1493
- from parts p join shares s on s.at = p.at where s.card is not null and s.phase is not null),
1523
+ select 'phase', s.card, s.phase, p.at, p.d, s.cpu * p.d * p.cores / 100.0, s.mem
1524
+ from parts p join sh s on s.at = p.at where s.open = 1 and s.card is not null and s.phase is not null),
1494
1525
  once(kind, card, what, d, cpu, mem) as (
1495
1526
  select kind, card, what, max(d), sum(cpu), sum(mem) from owned group by kind, card, what, at),
1496
1527
  totals(kind, card, what, ran, cpu, mem) as (
1497
- select kind, card, what, sum(d), cast(round(sum(cpu)) as integer), max(mem) from once group by kind, card, what),
1498
- ranked(n, k, line) as (
1499
- select case kind when 'step' then 1 else 3 end, row_number() over (partition by kind order by cpu desc, card, what),
1500
- ' ' || printf('%-24s', card || ' ' || what || ' ' || kind) || ' CPU time ' || $(sql_took cpu) || ', ran ' || $(sql_took ran)
1501
- from totals where cpu is not null
1528
+ select kind, card, what, sum(d), sum(cpu), max(mem) from once group by kind, card, what),
1529
+ t(repo, started, ended, secs, cpu, mem, cut) as ($(host_select "$have" test_runs repo started ended secs cpu_secs mem_mb cut)),
1530
+ runs(repo, many, ran, mean, longest, cpu, mem, cut, going) as (
1531
+ select repo, count(*), sum(took), avg(took), max(took), sum(cpu), max(mem),
1532
+ sum(case when cut = 1 then 1 else 0 end), sum(case when ended is null then 1 else 0 end)
1533
+ from (select repo, case when ended is not null then secs end as took, ended, cpu, mem, cut from t
1534
+ where started >= $s and started < $e)
1535
+ group by repo),
1536
+ sums(n, o, name, many, noun, ran, mean, longest, cpu, mem, tail) as (
1537
+ select case kind when 'step' then 1 else 2 end,
1538
+ case kind when 'step' then $(host_order what $HOST_WRITE_UP_STEPS $HOST_BUILD_STEPS) else $(host_order what write-up build) end,
1539
+ what, count(*), case when count(*) = 1 then ' card' else ' cards' end,
1540
+ sum(ran), avg(ran), max(ran), sum(cpu), max(mem), ''
1541
+ from totals group by kind, what
1502
1542
  union all
1503
- select case kind when 'step' then 2 else 4 end, row_number() over (partition by kind order by mem desc, card, what),
1504
- ' ' || printf('%-24s', card || ' ' || what || ' ' || kind) || ' memory ' || mem || ' MB, ran ' || $(sql_took ran)
1505
- from totals where mem is not null
1506
- union all
1507
- select 5, row_number() over (order by cpu desc, started, card, repo),
1508
- $name || ' CPU time ' || $(sql_took "cast(round(cpu) as integer)") || $ran
1509
- from runs where cpu is not null
1510
- union all
1511
- select 6, row_number() over (order by mem desc, started, card, repo),
1512
- $name || ' memory ' || mem || ' MB' || $ran
1513
- from runs where mem is not null),
1514
- heads(n, head) as (values (1, 'Steps that used the most CPU time:'), (2, 'Steps that held the most memory at once:'),
1515
- (3, 'Phases that used the most CPU time:'), (4, 'Phases that held the most memory at once:'),
1516
- (5, 'Test runs that used the most CPU time:'), (6, 'Test runs that held the most memory at once:')),
1517
- found(yes) as (select exists (select 1 from totals) or exists (select 1 from runs)),
1518
- lines(n, k, line) as (
1519
- select 0, 0, ''
1520
- union all select 0, 1, 'No step, phase or test run was recorded in this period.' from found where not yes
1521
- union all select n, 0, head from heads, found where yes
1522
- union all select n, 1, ' none recorded' from heads h, found
1523
- where yes and not exists (select 1 from ranked r where r.n = h.n)
1524
- union all select n, k, line from ranked where k <= 10)
1525
- select line from lines order by n, k;
1543
+ select 3, 1, repo, many, case when many = 1 then ' run' else ' runs' end, ran, mean, longest, cpu, mem,
1544
+ case when cut > 0 then '; ' || cut || ' cut short' else '' end
1545
+ || case when going > 0 then case when cut > 0 then ', ' else '; ' end || going || ' still going' else '' end
1546
+ from runs),
1547
+ shown(n, o, name, line) as (
1548
+ select n, o, name, $line from (
1549
+ select n, o, name, many, noun, cast(round(ran) as integer) as ran, cast(round(mean) as integer) as mean,
1550
+ cast(round(longest) as integer) as longest, cast(round(cpu) as integer) as cpu,
1551
+ cast(round(mem) as integer) as mem, tail
1552
+ from sums)),
1553
+ heads(n, head) as (values (1, 'Steps:'), (2, 'Phases:'), (3, 'Test runs:')),
1554
+ found(yes) as (select exists (select 1 from sums)),
1555
+ lines(n, o, name, line) as (
1556
+ select 0, 0, '', ''
1557
+ union all select 0, 1, '', 'No step, phase or test run was recorded in this period.' from found where not yes
1558
+ union all select n, 0, '', head from heads, found where yes
1559
+ union all select n, 1, '', ' none recorded' from heads h, found
1560
+ where yes and not exists (select 1 from sums s where s.n = h.n)
1561
+ union all select n, o, name, line from shown)
1562
+ select line from lines order by n, o, name;
1526
1563
  EOF
1527
1564
  }
1528
1565
 
1529
- # Where the steps' time went from $1 to $2, from the shares when $3 is 1 and
1530
- # the splits when $4 is 1: first the agents' time in all on the host,
1531
- # waiting on the model and the rest, over the splits, then the same for the
1532
- # 10 steps open longest with a split, each one card's own, longest first.
1533
- # Each split counts for the part of its reading in the period, as the report
1534
- # counts a reading: its seconds on the host and on the model in that
1535
- # proportion, and the rest is that part less the two. Each line says how
1536
- # long it was open, and its three parts, to the second, which add up to
1537
- # that. Then how many steps were open in the period with no split. With no
1538
- # split, it says no step was split, and why.
1566
+ # Where the steps' time went from $1 to $2, from the splits: first the
1567
+ # agents' time in all on the host, waiting on the model and the rest, then
1568
+ # the same for each step, every card's splits in it added up, in the order
1569
+ # the steps go, from define to pr. Each split counts for the part of its
1570
+ # reading in the period, as the report counts a reading: its seconds on the
1571
+ # host and on the model in that proportion, and the rest is that part less
1572
+ # the two. Each line says how long it was open, and its three parts, to the
1573
+ # second, which add up to that. Then how many steps were open in the period
1574
+ # with no split, each card's step counted once. With no split, it says no
1575
+ # step was split, and why. $3 lists the store's tables and columns, as
1576
+ # host_columns gives them: a store with no table of shares or of splits is
1577
+ # read as one with none of them (host_select).
1539
1578
  HOST_NO_SPLIT="an agent's time is split only when it starts in Claude Code while recording is on"
1540
1579
  host_split_sql() {
1541
- local s=$1 e=$2 shares splits line why
1580
+ local s=$1 e=$2 have=$3 line why
1542
1581
  why=$(sql_str "$HOST_NO_SPLIT")
1543
- shares='select at, card, step, open from shares'
1544
- [ "${3:-0}" = 1 ] || shares='select null, null, null, null where 0'
1545
- splits='select at, card, step, host_secs, model_secs from splits'
1546
- [ "${4:-0}" = 1 ] || splits='select null, null, null, null, null where 0'
1547
- line="' ' || printf('%-24s', name) || ' open ' || $(sql_took d) || ': on the host ' || $(sql_took h)
1582
+ line="' ' || printf('%-18s ', name) || 'open ' || $(sql_took d) || ': on the host ' || $(sql_took h)
1548
1583
  || ', waiting on the model ' || $(sql_took m) || ', the rest ' || $(sql_took r)"
1549
1584
  cat <<EOF
1550
1585
  with
1551
1586
  parts(at, secs, d) as (
1552
1587
  select at, secs, max(0, min(at, $e) - max(at - secs, $s)) from readings
1553
1588
  where at > $s and at < $e + $HOST_GAP and at - secs < $e and secs > 0),
1554
- sh(at, card, step, open) as ($shares),
1555
- x(at, card, step, host, model) as ($splits),
1589
+ sh(at, card, step, open) as ($(host_select "$have" shares at card step open)),
1590
+ x(at, card, step, host, model) as ($(host_select "$have" splits at card step host_secs model_secs)),
1556
1591
  sp(card, step, d, host, model) as (
1557
1592
  select x.card, x.step, p.d, 1.0 * x.host * p.d / p.secs, 1.0 * x.model * p.d / p.secs
1558
1593
  from parts p join x on x.at = p.at),
1559
1594
  steps(card, step, d, host, model) as (
1560
1595
  select card, step, sum(d), sum(host), sum(model) from sp
1561
1596
  where card is not null and step is not null group by card, step),
1562
- shown(k, name, d, host, model) as (
1563
- select 0, 'all agents', d, host, model from (select count(*) n, sum(d) d, sum(host) host, sum(model) model from sp) where n > 0
1597
+ shown(k, o, name, d, host, model) as (
1598
+ select 0, 0, 'all agents', d, host, model from (select count(*) n, sum(d) d, sum(host) host, sum(model) model from sp) where n > 0
1564
1599
  union all
1565
- select row_number() over (order by d desc, card, step), card || ' ' || step || ' step', d, host, model from steps),
1566
- timed(k, name, d, h, m, r) as (
1567
- select k, name, d, cast(round(host) as integer),
1600
+ select 1, $(host_order step $HOST_WRITE_UP_STEPS $HOST_BUILD_STEPS), step, sum(d), sum(host), sum(model)
1601
+ from steps group by step),
1602
+ timed(k, o, name, d, h, m, r) as (
1603
+ select k, o, name, d, cast(round(host) as integer),
1568
1604
  cast(round(host + model) as integer) - cast(round(host) as integer),
1569
1605
  max(0, d - cast(round(host + model) as integer))
1570
- from shown where k <= 10),
1606
+ from shown),
1571
1607
  unsplit(n) as (
1572
1608
  select count(*) from (
1573
1609
  select distinct sh.card, sh.step from parts p join sh on sh.at = p.at
1574
1610
  where sh.open = 1 and sh.card is not null and sh.step is not null
1575
1611
  except select card, step from steps)),
1576
- lines(k, line) as (
1577
- select -2, '' union all select -1, 'Where the steps'' time went:'
1578
- union all select k, $line from timed
1579
- union all select 11, ' ' || n || case when n = 1 then ' step' else ' steps' end
1612
+ lines(k, o, name, line) as (
1613
+ select -2, 0, '', '' union all select -1, 0, '', 'Where the steps'' time went:'
1614
+ union all select k, o, name, $line from timed
1615
+ union all select 2, 0, '', ' ' || n || case when n = 1 then ' step' else ' steps' end
1580
1616
  || ' had no split, as ' || $why from unsplit
1581
1617
  where n > 0 and exists (select 1 from sp)
1582
- union all select 0, ' no step was split, as ' || $why where not exists (select 1 from sp))
1583
- select line from lines order by k;
1618
+ union all select 0, 0, '', ' no step was split, as ' || $why where not exists (select 1 from sp))
1619
+ select line from lines order by k, o, name;
1584
1620
  EOF
1585
1621
  }
1586
1622
 
package/cli/ocnus CHANGED
@@ -127,10 +127,9 @@ Usage:
127
127
  ocnus host on record it every 10 seconds while an agent is open
128
128
  ocnus host off stop recording, and delete every reading
129
129
  ocnus host report [<period>] the host's CPU, memory, disk, network, and power and heat,
130
- summed up, the steps, phases and test runs that used the
131
- most CPU and memory, and where the steps' time went: <n>d
132
- or <n>h back from now (7d when none is given), a day
133
- YYYY-MM-DD, or <day>..<day>
130
+ and the work by step, phase and repo, summed up, and where
131
+ the steps' time went: <n>d or <n>h back from now (7d when
132
+ none is given), a day YYYY-MM-DD, or <day>..<day>
134
133
  ocnus host report --card <space> <card> --json
135
134
  what the host recorded while each of a card's steps ran, as
136
135
  one line of JSON for programs: each step's start and end,
@@ -415,9 +414,13 @@ reading by its seconds in the period. One of the levels is how much of the
415
414
  CPU recording used, its average with watching the test runs included. A
416
415
  number that no reading in the period holds, as on a Mac without it or in
417
416
  readings from before it was recorded, is shown as not read, never as 0.
418
- Then it lists the 10 steps and the 10 phases, each one card's own, that
419
- used the most CPU time, and that held the most memory at once, then the 10
420
- test runs that did.
417
+ Then it sums up the work by kind, never card by card, and ranks none of
418
+ it: for each step from define to pr, and each phase, how many cards were in
419
+ it, how long their agents were open in all, on average and at the longest,
420
+ the CPU time they used and the most memory one held at once; and for each
421
+ repo's test runs, how many there were, how long they took in all, on
422
+ average and at the longest, the CPU time they used, the most memory one
423
+ held, and how many were cut short or are still going.
421
424
 
422
425
  While the host is recorded, `task new` and `task build` also start claude
423
426
  with hooks that mark when its agent starts and stops, is given a prompt,
@@ -427,8 +430,9 @@ or did. From them each reading splits each agent's time into time on the
427
430
  host, while its tools run, waiting on the model, and the rest, such as
428
431
  waiting on you. Then `host report` says where the steps' time went: the
429
432
  agents' time in all on the host, waiting on the model and the rest, the
430
- same for the 10 steps open longest, and how many steps had no split, as an
431
- agent started in another harness or while recording was off has none.
433
+ same for each step, every card's in it together, and how many steps had no
434
+ split, as an agent started in another harness or while recording was off
435
+ has none.
432
436
 
433
437
  Each wait on the model is kept too, as its start and end alone, for 90
434
438
  days.
package/herdr/README.md CHANGED
@@ -2400,7 +2400,7 @@ turn it on, and works on macOS only.
2400
2400
  ocnus host # whether recording is on, and what it has
2401
2401
  ocnus host on # turn recording on
2402
2402
  ocnus host off # turn it off, and delete every reading
2403
- ocnus host report [<period>] # the host's numbers summed up, what used the most, and where the steps' time went
2403
+ ocnus host report [<period>] # the host's numbers and the work summed up, and where the steps' time went
2404
2404
  ocnus host report --card <space> <card> --json # what the host recorded while each of a card's steps ran, as JSON for programs
2405
2405
  ocnus tests run <command> # run a test command, and record the test run
2406
2406
  ```
@@ -2764,21 +2764,30 @@ of it, summed up as what it is, and none is judged:
2764
2764
  has no Wi-Fi signal, or readings from before the network and the power and
2765
2765
  heat were recorded. It is never shown as 0.
2766
2766
 
2767
- Then come the steps, the phases and the test runs that used the most:
2768
-
2769
- - **The 10 steps and the 10 phases that used the most CPU time** in the
2770
- period, and **the 10 of each that held the most memory at once**. Each is
2771
- one card's own, such as LAB-150's build step or its write-up phase. A
2772
- step's CPU time is its shares' CPU, as a share of all cores, over the part
2773
- of each reading in the period, on that reading's cores, and a phase's is
2774
- its steps' together. Its memory is the most its shares held in one
2775
- reading. Beside each is how long it ran: the recorded time it was in.
2776
- - **The 10 test runs that used the most CPU time**, of those that started in
2777
- the period, and **the 10 that held the most memory at once**, each named by
2778
- its card, its repo and when it started, with how long it ran. A run the
2779
- recorder cut short says so, and is ranked by the CPU the recorder counted
2780
- of it, or by its memory alone when it counted none; one still going says
2781
- that in place of its time.
2767
+ Then comes the work, summed up by kind, never card by card. None of it is
2768
+ ranked, and no card is named:
2769
+
2770
+ - **Each step and each phase** in the period, under `Steps:` and
2771
+ `Phases:`, the steps in their order from `define` to `pr` and the phases
2772
+ `write-up` then `build`, each with how many cards were in it, how long
2773
+ their agents were open in all, on average and at the longest, the CPU time
2774
+ they used, and the most memory one card held at once. A card counts for
2775
+ its shares while its agent was open, for the part of each reading in the
2776
+ period, once a reading however many of its tabs were in the step, and a
2777
+ tab that holds its shell alone counts for nothing. Its CPU time is its
2778
+ shares' CPU, as a share of all cores, over that part, on that reading's
2779
+ cores, and its memory is the most its shares held in one reading. So a
2780
+ step's time in all is how long its agents were open, as where the steps'
2781
+ time went counts it.
2782
+ - **Each repo's test runs**, under `Test runs:`, of those that started in
2783
+ the period, the repos in the order of their names: how many there were,
2784
+ how long those that ended took in all, on average and at the longest, the
2785
+ CPU time they used, and the most memory one held. When any were cut short
2786
+ by the recorder, as their process had gone, or are still going, the line
2787
+ ends with how many of each.
2788
+ - **Not read** stands in place of a figure nothing in the period holds,
2789
+ such as the CPU time in readings from before the cores were counted, or
2790
+ the time of a repo whose runs are all still going.
2782
2791
  - **With no step, phase or test run in the period**, as when no agent was
2783
2792
  tied to a card, the report says so in place of the lists. With some, a
2784
2793
  list that has none says `none recorded`.
@@ -2789,12 +2798,12 @@ Then comes where the steps' time went:
2789
2798
  rest, from the splits in the period, each reading's split counted for the
2790
2799
  part of the reading in the period, as the report counts a reading. With
2791
2800
  it is how long they were open, which the three add up to.
2792
- - **The 10 steps open longest**, each one card's own, such as LAB-152's
2793
- build step, with the same: how long its agents were open with a split,
2801
+ - **Each step**, in their order from `define` to `pr`, with the same, every
2802
+ card's splits in it added up: how long its agents were open with a split,
2794
2803
  and its three parts, each to the second.
2795
- - **How many steps had no split**: steps open in the period with no split,
2796
- as of an agent started in another harness or while recording was off.
2797
- With no split in the period, or a store made before the splits, the
2804
+ - **How many steps had no split**: each card's step open in the period with
2805
+ no split, as of an agent started in another harness or while recording was
2806
+ off. With no split in the period, or a store made before the splits, the
2798
2807
  report says no step was split.
2799
2808
 
2800
2809
  ```
@@ -2843,30 +2852,21 @@ Power and heat:
2843
2852
  Low Power Mode on 0s, off 9h 41m
2844
2853
  thermal state nominal 9h 12m, fair 25m 00s, serious 4m 00s, critical 0s
2845
2854
 
2846
- Steps that used the most CPU time:
2847
- LAB-150 build step CPU time 1h 12m, ran 2h 40m
2848
- LAB-149 review step CPU time 22m 05s, ran 51m 10s
2849
- Steps that held the most memory at once:
2850
- LAB-150 build step memory 3412 MB, ran 2h 40m
2851
- LAB-149 review step memory 1890 MB, ran 51m 10s
2852
- Phases that used the most CPU time:
2853
- LAB-150 build phase CPU time 1h 31m, ran 3h 48m
2854
- LAB-151 write-up phase CPU time 9m 40s, ran 1h 05m
2855
- Phases that held the most memory at once:
2856
- LAB-150 build phase memory 3412 MB, ran 3h 48m
2857
- LAB-151 write-up phase memory 1204 MB, ran 1h 05m
2858
- Test runs that used the most CPU time:
2859
- LAB-150 ocnus 2026-11-29 14:02 CPU time 6m 10s, ran 2m 05s
2860
- LAB-149 ocnus 2026-11-28 10:41 CPU time 5m 58s, ran 2m 01s
2861
- Test runs that held the most memory at once:
2862
- LAB-150 ocnus 2026-11-29 14:02 memory 1830 MB, ran 2m 05s
2863
- LAB-149 ocnus 2026-11-28 10:41 memory 1795 MB, ran 2m 01s
2855
+ Steps:
2856
+ plan 2 cards, 1h 05m in all, 32m 30s on average, 41m 10s at the longest; CPU time 9m 40s; memory 1204 MB at most
2857
+ build 3 cards, 5h 12m in all, 1h 44m on average, 2h 40m at the longest; CPU time 2h 03m; memory 3412 MB at most
2858
+ review 2 cards, 1h 22m in all, 41m 00s on average, 51m 10s at the longest; CPU time 31m 20s; memory 1890 MB at most
2859
+ Phases:
2860
+ write-up 2 cards, 1h 05m in all, 32m 30s on average, 41m 10s at the longest; CPU time 9m 40s; memory 1204 MB at most
2861
+ build 3 cards, 6h 34m in all, 2h 11m on average, 3h 31m at the longest; CPU time 2h 34m; memory 3412 MB at most
2862
+ Test runs:
2863
+ ocnus 14 runs, 28m 10s in all, 2m 01s on average, 2m 05s at the longest; CPU time 1h 24m; memory 1830 MB at most
2864
2864
 
2865
2865
  Where the steps' time went:
2866
- all agents open 3h 31m: on the host 1h 02m, waiting on the model 1h 49m, the rest 40m 00s
2867
- LAB-150 build step open 2h 40m: on the host 51m 20s, waiting on the model 1h 22m, the rest 26m 40s
2868
- LAB-149 review step open 51m 10s: on the host 10m 40s, waiting on the model 27m 00s, the rest 13m 30s
2869
- 1 step had no split, as an agent's time is split only when it starts in Claude Code while recording is on
2866
+ all agents open 6h 34m: on the host 1h 31m, waiting on the model 3h 58m, the rest 1h 05m
2867
+ build open 5h 12m: on the host 1h 20m, waiting on the model 3h 02m, the rest 50m 00s
2868
+ review open 1h 22m: on the host 11m 00s, waiting on the model 56m 00s, the rest 15m 00s
2869
+ 2 steps had no split, as an agent's time is split only when it starts in Claude Code while recording is on
2870
2870
  ```
2871
2871
 
2872
2872
  `ocnus host report --card <space> <card> --json` gives what the host
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johngaynor/ocnus",
3
- "version": "2.0.1-next.78",
3
+ "version": "2.0.1-next.80",
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": {
@@ -42,7 +42,7 @@ Work through the Done when items in order, one at a time. In a later round, work
42
42
  2. Make the change the Plan's Changes list gives for it, in the files it names. Reuse the helpers it names.
43
43
  3. Run the test again and see it pass.
44
44
 
45
- Run every test command through `ocnus tests run`, whole suite or part, as in `ocnus tests run npm test -- orders`. It runs the command as it is, with its output, its input and its exit code, and while the host is recorded it records the test run as this card's, so that `ocnus host report` can say which test runs loaded the host. Give it the command and its arguments, not a line for a shell: what saves or pipes the output goes after them, as in `ocnus tests run npm test > <file> 2>&1`, and a `cd` goes before it.
45
+ Run every test command through `ocnus tests run`, whole suite or part, as in `ocnus tests run npm test -- orders`. It runs the command as it is, with its output, its input and its exit code, and while the host is recorded it records the test run as this card's, so that `ocnus host report` can sum up each repo's test runs. Give it the command and its arguments, not a line for a shell: what saves or pipes the output goes after them, as in `ocnus tests run npm test > <file> 2>&1`, and a `cd` goes before it.
46
46
 
47
47
  Each path in Changes starts with the repo's name, and that repo's worktree is the folder of the same name in the task. A task with one repo is its worktree.
48
48