Skip to content

feat(bearings): fleet snapshot, view, and /bearings report (bearings stack) - #34

Merged
leo1oel merged 2 commits into
herdr-backendfrom
port-bearings
Jul 14, 2026
Merged

leo1oel merged 2 commits into
herdr-backendfrom
port-bearings

Conversation

@leo1oel

@leo1oel leo1oel commented Jul 14, 2026 •

Copy link
Copy Markdown
Owner

Ports upstream's bearings stack — a "pick up where I left off" report over the live fleet — adapted to the fork's herdr-native, Claude-only model.

What it adds

  • bin/fm-fleet-snapshot.sh — the read-only structured foundation (--json, schema fm-fleet-snapshot.v1): backlog (In flight / Queued / Done), one row per task meta with reconciled current state and herdr endpoint presence, open-decision hints, scout reports, and a secondmate-landed roll-up. No locks, wakes, or mutations.
  • bin/fm-fleet-view.sh — a human fleet table rendered from the snapshot JSON.
  • bin/fm-bearings-snapshot.sh — a compact TOON projection for the catch-up read; local-only by default (zero network), with --include-prs the sole opt-in that touches GitHub.
  • .agents/skills/bearings/SKILL.md — the /bearings skill: a dated data/status-report-<date>.md plus a four-section chat digest (Captain's Call / Recently Landed / Underway / Charted Next).

Fork adaptation

The snapshot is written against upstream's multi-backend abstraction; the fork is herdr-native with no fm_backend_* layer, so its backend integration was rewritten:

  • Meta reads via a plain grep helper instead of fm_meta_get.
  • Endpoint presence via fm_herdr_pane_exists (and secondmate agent-liveness the same way) instead of fm_backend_target_exists/fm_backend_agent_alive.
  • Dropped the fm-backend.sh source — in this fork it is a CLI that dispatches on $@ when sourced, not a library.
  • A fork-native open-decision model: the fork emits no [key=...] decision markers, so upstream's keyed status_open_decisions fold would degenerate; replaced with tracking the last unresolved needs-decision/blocked line, cleared by a later resolving verb, and reconciled against fm-crew-state (a provably-resumed run-step clears a stale gate).

fm-fleet-view.sh and fm-bearings-snapshot.sh port verbatim (plain gh is present in the fork env, so the opt-in PR path needs no change).

Validation

Local gate:

  • shellcheck bin/*.sh tests/*.sh — clean (exit 0).
  • All 25 tests/*.test.sh pass, including the two new tests:
    • fm-fleet-snapshot-view — schema, backlog parsing, a task row's kind/endpoint/current-state, the open-decision hint AND its lifecycle clearing when a run resumes, and the view render.
    • fm-bearings-snapshot — the projected schema, the local-only default (a stubbed gh is never invoked), and the landed roll-up from the Done backlog.

Note

Medium Risk
Large new surface area touches supervision hooks (fail-closed arm policy) and fleet state interpretation; read-only snapshot paths are lower risk than the PreToolUse deny paths on every Bash tool call.

Overview
Adds a bearings stack for “pick up where I left off” reads: a read-only fm-fleet-snapshot.sh (fm-fleet-snapshot.v1 JSON over backlog, task metas, reconciled crew state, herdr endpoint presence, open-decision hints, scout reports, and secondmate-landed roll-up), fm-fleet-view.sh as a human table renderer, and fm-bearings-snapshot.sh as a bounded TOON projection (local-only by default; --include-prs is the only network path). The new bearings skill drives /bearings: one dated data/status-report-<date>.md plus a fixed four-section chat digest, read-mostly with no fleet mutations.

Fork-specific snapshot behavior uses grep-based meta reads, fm_herdr_pane_exists for endpoints, and a last-unresolved needs-decision/blocked open-decision model cleared when fm-crew-state shows the crew resumed—instead of upstream’s multi-backend / keyed decision markers.

Also wires Claude PreToolUse Bash hooks in .claude/settings.json: fm-arm-pretool-check.sh (fail-closed on bad watcher arms and broad pkill -f fm-watch) and fm-cd-pretool-check.sh (blocks persistent top-level cd/pushd/popd in the primary checkout only), backed by shared shell lexing in fm-arm-command-policy.mjs and sibling fm-cd-command-policy.mjs, with docs and behavior tests.

Reviewed by Cursor Bugbot for commit 2a51552. Bugbot is set up for automated code reviews on this repo. Configure here.

leo1oel added 2 commits July 13, 2026 22:38
Port upstream's primary-session PreToolUse guard subsystem, adapted to
Claude-only. The two guards deny agent-mistake command shapes before they run.

- bin/fm-arm-command-policy.mjs: the sole owner of firstmate's shell command
  classification (ported verbatim) plus the watcher-arm decision procedure.
  Drops the Codex-only checkpoint identity and the X-mode source-setup blessing
  (this fork has neither), leaving the arm/watch identities and cd/export setup
  nodes.
- bin/fm-cd-command-policy.mjs: reuses that classifier to block a persistent
  top-level cd/pushd/popd that would relocate the primary shell.
- bin/fm-arm-pretool-check.sh, bin/fm-cd-pretool-check.sh: Claude PreToolUse
  transports (upstream's multi-harness transport trimmed to Claude), wired in
  .claude/settings.json on the Bash matcher. The cd-guard is scoped to a real
  primary checkout and is inert in a linked crew/scout worktree; both fail open
  on transport uncertainty, and the arm classifier fails closed on an
  unclassifiable protected command.
- docs/cd-guard.md, docs/arm-pretool-check.md, docs/scripts.md, AGENTS.md 8: the
  contracts and a one-line enforcement pointer.
- tests: fm-cd-pretool-check (full 63-case decision matrix + scoping) and
  fm-arm-pretool-check (representative matrix + reason codes + transport +
  fail-open + prefilter).

Local gate: shellcheck bin/*.sh tests/*.sh clean; all 23 tests/*.test.sh pass.
…stack kunchenguid#343+kunchenguid#300)

Port upstream's bearings stack - a "pick up where I left off" report over the
live fleet - adapted to the fork's herdr-native, Claude-only model.

- bin/fm-fleet-snapshot.sh: read-only structured (JSON, fm-fleet-snapshot.v1)
  snapshot of the whole fleet. Rewrote the backend-abstraction layer to herdr
  primitives: meta reads via grep, endpoint presence via fm_herdr_pane_exists,
  and a fork-native open-decision model (the last unresolved needs-decision or
  blocked line, cleared by a resolving verb, since the fork emits no [key=...]
  decision markers). Dropped the fm-backend.sh source (a CLI here, not a lib)
  and the fm_backend_* / fm_meta_get / keyed status_open_decisions deps the fork
  lacks.
- bin/fm-fleet-view.sh: verbatim human renderer over the snapshot JSON.
- bin/fm-bearings-snapshot.sh: verbatim TOON projection; local-only by default,
  with --include-prs the only network path (plain gh is present in the fork env).
- .agents/skills/bearings/SKILL.md: the /bearings skill (the four-section report).
- docs/scripts.md, AGENTS.md: the three script rows and the status-report artifact.
- tests: fm-fleet-snapshot-view (schema, backlog, endpoint, open-decision
  lifecycle, view render) and fm-bearings-snapshot (projection, local-only, landed).

Local gate: shellcheck bin/*.sh tests/*.sh clean; all 25 tests/*.test.sh pass.
@cursor

cursor Bot commented Jul 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_cd6240a7-dce9-4d9e-86dc-7a951481534b)

@leo1oel
leo1oel merged commit 0a85e73 into herdr-backend Jul 14, 2026
1 check passed
@leo1oel
leo1oel deleted the port-bearings branch July 14, 2026 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant