Commit bbaf5ff
feat(herd): heartbeat liveness and an immutable run record (PRD 0019 P0) (#542)
R2. A run moshcode started records a heartbeat, and herd state is read from
that before anything else. Output pattern matching stays, as a fallback, and
is now labelled as inference rather than as fact.
Every answer from sessionState() carries `confidence`. `known` when the run,
the engine hook or the process itself said so. `inferred` when a regular
expression looked at a terminal and decided. The roster marks an inferred
state with a trailing `?`. Both tiers are permanent: heartbeats exist only for
runs moshcode starts, so a pane somebody launched by hand is inferred forever
and says so.
The beat rides `moshcode herd report`, which was already the one socket any
process with $MOSHCODE_HERD_NAME can call and already what the engine hooks
are wired to. No second channel, and nothing new to install. When
$MOSHCODE_RUN names a run, the same report also writes the run's beat.
R3. A run record is immutable and versioned: an immutable `wx` header under
$OPENFLEET_HOME/fleets/<fleet>/runs/ carrying record_version, inputs, the
engine and the model, and run.start, run.step, run.end lines on the fleet's
existing ledger. It extends the OpenFleet ledger and opens no second store, so
`moshcode fleet log` reads a run with no new tool.
Files, not SQLite. PRD 0016 chose no daemon, no database, one host on purpose;
the record is append-only by nature, which is what a JSONL ledger is already
good at; other tools read these files; and the search R4 wants is over hundreds
of runs on one box. The full reasoning is written into the PRD as a resolution.
Retention ships with the record, because an immutable record grows forever.
`moshcode fleet gc` keeps the newest 20 ended runs per working directory and
drops anything ended over 30 days ago, with --dry-run to preview. Per directory
rather than globally, so one busy checkout cannot evict every other one. A run
with no run.end is never a candidate at any age, only this host's ledger is
rewritten, and only run.* lines are dropped.
R12. No em dashes in anything added here. Short sentences.
New: src/run-record.mjs, `moshcode fleet beat`, `moshcode fleet gc`.
Deliberately not here: R4 search, R5 DAGs, R6 doctor, R7 precedence, R8
.agents/skills, and nothing about the credential vault, which is PRD 0018 R8.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 172f930 commit bbaf5ff
14 files changed
Lines changed: 1742 additions & 42 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
103 | 106 | | |
104 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
105 | 111 | | |
106 | 112 | | |
107 | 113 | | |
| |||
158 | 164 | | |
159 | 165 | | |
160 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
161 | 175 | | |
162 | 176 | | |
163 | 177 | | |
164 | 178 | | |
165 | 179 | | |
166 | 180 | | |
167 | 181 | | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
172 | 225 | | |
173 | 226 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1597 | 1597 | | |
1598 | 1598 | | |
1599 | 1599 | | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
1600 | 1625 | | |
1601 | 1626 | | |
1602 | 1627 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| 33 | + | |
| 34 | + | |
31 | 35 | | |
32 | 36 | | |
33 | 37 | | |
| |||
526 | 530 | | |
527 | 531 | | |
528 | 532 | | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
529 | 538 | | |
530 | 539 | | |
531 | 540 | | |
532 | 541 | | |
533 | 542 | | |
534 | 543 | | |
535 | 544 | | |
536 | | - | |
| 545 | + | |
537 | 546 | | |
538 | 547 | | |
539 | 548 | | |
| |||
577 | 586 | | |
578 | 587 | | |
579 | 588 | | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
580 | 695 | | |
581 | 696 | | |
582 | | - | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
583 | 701 | | |
584 | 702 | | |
585 | 703 | | |
| |||
0 commit comments