Skip to content

feat: collapse decisions into tasks held for the captain - #2728

Merged
kunchenguid merged 11 commits into
mainfrom
fm/decisions-collapse-to-captain-task-r1
Aug 21, 2026
Merged

kunchenguid merged 11 commits into
mainfrom
fm/decisions-collapse-to-captain-task-r1

Conversation

@kunchenguid

Copy link
Copy Markdown
Owner

Intent

Collapse firstmate's separate 'decisions' concept into the one primitive the captain cares about: a decision is simply a task waiting on the captain - an ordinary backlog task held for the captain (tasks-axi hold --kind captain), identified by its task id. Captain-approved simplification grounded in two investigation reports (data/decisions-concept-ripout-investigation-s1, data/fm-decision-hold-noise-investigation-s1) which found the old decision type (the -decision- derived identity, the kind==captain projection filter, and the ~900-line bin/fm-decision-hold.sh) recorded which script created a row rather than what the captain has to do, and misclassified live data in both directions - surfacing noise AND hiding real captain-blocked work. All in ONE PR, per the captain's direction.

Requirements in their accepted form:

  1. The distinct decision type/identity goes away. bin/fm-captain-hold.sh replaces bin/fm-decision-hold.sh as the single owner of the surviving mechanics: guarded hold creation (create-or-hold, idempotent, --until deferral dates), the recorded-answer close (answer, with --release to free a captain-gated WORK item instead of completing it), the one channel-agnostic keyed-answer intake (answers + bind/unbind/binding; keys are task ids; optional 4th tab column carries a card-declared close mode done|release), and the investigation completion gate (complete/verify).
  2. Exactly two safety behaviors survive, attached to the plain captain-held task: (a) an investigation or visual review may NOT be torn down while the captain's open questions live only in its report - the complete/verify gate wired into scout teardown; (b) nothing the captain owns may be closed without recording what he actually said - the resolution record with digest idempotency, drift refusal, and retroactive recording for out-of-band closes (old repair semantics folded into answer).
  3. The fleet snapshot and bearings respect deferral: parse tasks-axi hold-until (previously ignored entirely); captain_actionable = queued + hold-kind captain + unblocked + due, INDEPENDENT of row kind; date-deferred holds render as Charted Next gates with an 'until :' reason and resurface on their date; prose-deferred rows (the pre-existing SUPERSEDED/NOT REQUIRED/DEFERRED marker set, extended from body-only to hold reason, computed once in the canonical snapshot as deferred_marker) leave the default decisions and gates views with an omitted[] disclosure, revealed by --all-decisions/--all-queued, except that a dated future hold always renders as a dated gate; Recently Landed excludes rows that closed while still captain-held (surviving hold-kind annotations on Done rows) instead of excluding kind==captain, so a work item released before completion lands normally.
  4. Migration is first-class; existing installs keep working on day one with nothing lost to the captain: legacy -decision- rows are already plain task ids and work unchanged through every surface; pre-collapse decision_keys= metadata short keys resolve through the legacy composed identity; a concrete-origin binding composes legacy channel keys; old resolution records are recognized wherever a record is read; bin/fm-decision-hold.sh remains for ONE release as a thin compat shim mapping every retired subcommand (id/hold/complete/verify/resolve/answer/decline/repair/answers/bind/unbind/binding) onto fm-captain-hold.sh so in-flight pre-collapse briefs keep working; the PR body must note that running homes pick up the instruction surface via the normal update path.
  5. Every consumer is preserved through the collapse: bin/fm-teardown.sh's scout verify gate; bin/fm-send.sh --resolve-key (status-ledger close unchanged; the hold fallback now resolves the key as a task id first, then the legacy composed identity, and feeds resolved ids to the intake); bin/fm-procevent.sh's binding/answers feed seam (CLI shape deliberately unchanged); bin/fm-procevent-lavish.sh answers (now relays the card-declared close mode, only from rows tagged choice); bin/fm-bearings-board.sh (binds the collapsed intake; the fm-bearings-board.v1 payload gains an optional per-card close: 'done'|'release' field, validated fail-closed, and the template forwards it in the answer context); the status-ledger needs-decision:/blocked:/resolved:/captain-held keyed flow in fm-classify-lib.sh is deliberately untouched.
  6. Policy surface trimmed to match: new .agents/skills/captain-hold-lifecycle (short collapsed policy: prefer holding the work item the question gates, one held task per genuine gate rather than a row per question, 'later' is recorded as an --until date, never close without the captain's words); the old decision-hold-lifecycle skill becomes a pointer stub kept one release for in-flight briefs; AGENTS.md sections 2/7/10/13 updated to the one-primitive statement; the bearings skill updated (card key = the captain-held task id, card typing is composer judgment since no backlog field types cards, gate-shaped cards declare close: release); docs/decision-hold-lifecycle.md replaced by docs/captain-hold-lifecycle.md; docs/scripts.md, docs/configuration.md, docs/verification/process-event-sources.md updated; fm-brief.sh scaffolds point at the new skill.
  7. Tests ported to the surviving behavior and exercising real interfaces: tests/fm-decision-hold-lifecycle.test.sh becomes tests/fm-captain-hold-lifecycle.test.sh (15 tests: completion gate + transfer, recorded answers, release mode, deferral due-gate, out-of-band recording, visual-review owner, secondmate routing, the channel intake through the real procevent runner with a fixture adapter, chat through real fm-send over a stubbed transport, legacy shim/metadata/binding compat, slug validation); fm-bearings-snapshot and fm-fleet-snapshot-view suites gain the collapsed-projection cases; the concurrent test-isolation proof was deliberately re-run on 2026-08-20 (24 candidates, 0 failed) and docs/fm-test-isolation-proof.{md,json} plus docs/fm-test-portable-shards.md were refreshed for the renamed suite - those recorded-evidence changes are intentional, not drift.
  8. Measurement - captain-ruled acceptance criterion: the live-fleet matched-pair measurement of the captain-facing Captain's Call (bearings default view; main home plus local secondmate aggregation; section-4a counting method) reads BEFORE (old code) decisions 8, AFTER (this branch) decisions 14, measured 2026-08-21T00:58Z. The captain/firstmate explicitly ruled the original must-shrink criterion SATISFIED AS-IS: the 8-to-14 growth is entirely formerly-hidden captain-gated work that SHOULD surface (the old kind filter hid real captain-blocked rows carrying prose-only deferral), it is not a regression, and those rows must NOT be hidden to make the count drop. The PR body must record these before/after numbers with that rationale, and note that the 4 already-dated deferred rows and 2 prose-marked rows leaving the default view is the deferral gate working as intended.
  9. The queued sibling task fm-bearings-board-ui-options-close-r1 (a board close/drop-decision button built on the old decision-card identity scheme) is superseded by this change; its intent is folded in as the composer-declared close: 'release' card mode. Note it as superseded in the PR body.

Deliberate decisions a diff-only reviewer would otherwise flag: the metadata attestation keeps the historical decisions_reviewed=1 / decision_keys= key names for compatibility with existing on-disk task metadata and the backend test fixtures that write them (entries are now task ids; legacy short entries resolve via origin composition, exact-task-id match wins). complete no longer enforces a per-status-key inventory mapping: with a non-empty verified inventory it transfers EVERY still-open keyed status decision to that inventory (the old per-key forcing produced the 28-holds-from-one-review pathology the reports document), while --none is still refused whenever lifecycle-open status decisions exist. answer closes a task even when work is routed behind it, because a Done blocker reads as resolved everywhere; the old routed 'resolve' path is retired and the shim maps it to answer plus recording the routed ids in the decision text and clearing the edges. The resolution block is written at the TOP of the body via --body-file with tasks-axi --archive-body, preserving the previous body below it so a released work item keeps its plan. A re-held task accepts a NEW answer as a new record on top; an interrupted-close retry has its recorded close mode checked so a retry cannot silently flip a release into a completion. The intake refuses to retro-record on already-closed items (reported skipped) except for an idempotent replay of the identical answer. hold no longer sets a kind on created tasks - kind is deliberately meaningless to captain surfaces now. Adding hold-until to the title metadata-stripping pattern also fixes a pre-existing bug where a dated row leaked '(hold-until: ...)' into its parsed title.

What Changed

  • Replaces derived decision identities with ordinary captain-held task IDs and adds fm-captain-hold.sh for idempotent holds, dated deferrals, recorded-answer completion or release, keyed answer intake, and investigation verification. Legacy identities, metadata, records, bindings, and all retired fm-decision-hold.sh commands remain compatible for one release; running homes receive the renamed policy surface through the normal update path.
  • Updates fleet snapshots, Bearings, chat, process-event, teardown, and board flows to treat due, unblocked captain holds as actionable regardless of row kind; dated holds become Charted Next gates, prose-deferred rows are disclosed but omitted by default, and released work can land normally. Board cards can declare close: release, superseding fm-bearings-board-ui-options-close-r1 and folding its intent into the task-ID model.
  • Records the 2026-08-21T00:58Z matched-pair Captain's Call measurement at 8 decisions before and 14 after: the increase is formerly hidden captain-gated work that should surface, not a regression. Four already-dated deferred rows and two prose-marked rows leave the default view as intended by the deferral gate.

Risk Assessment

✅ Low: The implementation is internally consistent with the required collapse, preserves legacy paths, and no material source-verifiable defect remains.

Testing

Inspected the target change, exercised the focused captain-hold lifecycle, Bearings snapshot/board, and fleet projection suites, then captured a rendered Captain’s Call board and an end-to-end release transcript showing the captain’s words recorded while the work remains queued and unheld; all checks succeeded and the worktree remained clean.

Evidence: End-to-end captain hold and release transcript with persisted task state

Source: End-to-end captain hold and release transcript with persisted task state

$ fm-captain-hold.sh hold sample-deploy-gate --reason "captain must choose deployment window"
sample-deploy-gate

$ tasks-axi show sample-deploy-gate  # before answer
task:
  id: sample-deploy-gate
  title: Deploy the release
  state: queued
  blocked: no
  blocked_by: none
  held: yes
  hold_reason: captain must choose deployment window
  hold_kind: captain
  hold_until: "-"
  kind: ship
  repo: sample
  priority: "-"
  created: 2026-08-21
  closed: "-"
  deps: none
  links: none
  body: Preserve this deployment plan after the captain answers.

$ fm-captain-hold.sh answer sample-deploy-gate --decision-file answer.txt --release
released: sample-deploy-gate

$ tasks-axi show sample-deploy-gate  # after answer
task:
  id: sample-deploy-gate
  title: Deploy the release
  state: queued
  blocked: no
  blocked_by: none
  held: no
  hold_reason: "-"
  hold_kind: "-"
  hold_until: "-"
  kind: ship
  repo: sample
  priority: "-"
  created: 2026-08-21
  closed: "-"
  deps: none
  links: none
  body: "Resolution recorded by fm-captain-hold.\nDecision digest: 155ae96a8a19c32db07d2c5a2dec5c23cd50b26727b431110182f51dd186e487\nResolution mode: released\n\nCaptain decision:\nMorning tide. Proceed with the deployment plan.\n\nPreserve this deployment plan after the captain answers."
Evidence: Generated Bearings board HTML

Source: Generated Bearings board HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Bearings - fleet board</title>
<style>
/* ============================================================
   Bearings board - Firstmate Design System, inlined for portability.
   Tokens copied verbatim from myfirstmate priv/static/assets/app.css
   (the compiled adoption of .agents/skills/firstmate-design).
   ============================================================ */
@import url("https://fonts.googleapis.com/css2?family=Chango&family=Jost:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap");

:root {
  --rust-700: #8f2f17; --rust-600: #a93a1f; --rust-500: #c0452a;
  --rust-400: #d35f3f; --rust-300: #e08365; --rust-100: #f4d8c9; --rust-050: #fbece3;
  --navy-700: #1a2238; --navy-600: #222c49; --navy-500: #2a3656;
  --navy-300: #6c7796; --navy-100: #d9deea;
  --gold-600: #b5791c; --gold-500: #e0a52e; --gold-300: #f0d38c; --gold-100: #f8ecc9;
  --ocean-600: #2f6688; --ocean-500: #3c7ea6; --ocean-200: #b6d4e2; --ocean-050: #e8f1f5;
  --sea-700: #234e3a; --sea-500: #2f6b4f; --sea-200: #b9d4c5; --sea-050: #e9f2ec;
  --paper-000: #fbf4e2; --paper-100: #f6ecd3; --paper-200: #f0e3c4; --paper-300: #e7d6ae;
  --cream-line: #ddc89c;
  --ink-900: #241c14; --ink-700: #3f3224; --ink-500: #6f5e46; --ink-300: #9c8a6c;
  --white: #fffdf7;
  --bg-page: var(--paper-100);
  --surface-card: var(--white);
  --surface-card-warm: var(--paper-000);
  --text-strong: var(--ink-900); --text-body: var(--ink-700);
  --text-muted: var(--ink-500); --text-faint: var(--ink-300);
  --border-default: var(--cream-line); --border-soft: var(--paper-300);
  --status-online: var(--sea-500); --status-online-soft: var(--sea-050);
  --status-warn: var(--gold-600); --status-warn-soft: var(--gold-100);
  --status-danger: var(--rust-600); --status-danger-soft: var(--rust-050);
  --status-info: var(--ocean-500); --status-info-soft: var(--ocean-050);
  --font-display: "Chango", "Cooper Black", Rockwell, Georgia, serif;
  --font-sans: "Jost", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --fs-h3: 1.4rem; --fs-h4: 1.15rem; --fs-base: 1rem; --fs-sm: 0.9375rem;
  --fs-xs: 0.8125rem; --fs-2xs: 0.6875rem;
  --ls-caps: 0.16em;
  --radius-xs: 6px; --radius-sm: 9px; --radius-md: 12px; --radius-banner: 7px;
  --radius-lg: 18px; --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(36, 28, 20, 0.06), 0 4px 10px rgba(36, 28, 20, 0.06);
  --shadow-hard: 4px 4px 0 var(--ink-900);
  --shadow-hard-sm: 3px 3px 0 var(--ink-900);
  --texture-paper: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.045'/%3E%3C/svg%3E");
  --focus-ring: 0 0 0 3px var(--gold-300);
  --container-app: 1180px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  color: var(--text-body);
  background: var(--bg-page);
  background-image: var(--texture-paper);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* ---- fm-badge (enamel sign-pin), verbatim contract ---- */
.fm-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-2xs); font-weight: 800; line-height: 1;
  padding: 5px 9px 4px; text-transform: uppercase; letter-spacing: 0.07em;
  border-radius: var(--radius-xs); border: 1.5px solid var(--ink-900);
  box-shadow: 2px 2px 0 var(--ink-900); white-space: nowrap;
}
.fm-badge--online  { background: var(--sea-500);  color: var(--paper-000); }
.fm-badge--warn    { background: var(--gold-500); color: var(--navy-700); }
.fm-badge--danger  { background: var(--rust-600); color: var(--paper-000); }
.fm-badge--info    { background: var(--ocean-500); color: var(--paper-000); }
.fm-badge--neutral { background: var(--paper-000); color: var(--ink-900); }
.fm-badge--solid   { background: var(--rust-500); color: var(--paper-000); }

/* ---- fm-btn ---- */
.fm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-sans); font-weight: 800; line-height: 1; white-space: nowrap;
  border: 2px solid transparent; border-radius: var(--radius-banner); cursor: pointer;
  text-decoration: none; transition: background 120ms, border-color 120ms, transform 120ms, box-shadow 120ms;
}
.fm-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.fm-btn:active { transform: translateY(1px); }
.fm-btn--sm { font-size: var(--fs-xs); padding: 8px 16px; }
.fm-btn--primary { background: var(--rust-500); color: var(--white); border-color: var(--ink-900); box-shadow: var(--shadow-hard-sm); }
.fm-btn--primary:hover { background: var(--rust-600); }
.fm-btn--gold { background: var(--gold-500); color: var(--navy-700); border-color: var(--ink-900); box-shadow: var(--shadow-hard-sm); }
.fm-btn--gold:hover { background: var(--gold-600); color: var(--white); }
.fm-btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---- fm-card ---- */
.fm-card {
  background: var(--surface-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden;
}
.fm-card--poster { border: 2px solid var(--ink-900); box-shadow: var(--shadow-hard); border-radius: var(--radius-md); }
.fm-card--warm { background: var(--surface-card-warm); }

/* ---- fm-sign (eyebrow section label) ---- */
.fm-sign {
  display: inline-flex; align-items: center; gap: 8px; font-weight: 800;
  text-transform: uppercase; letter-spacing: var(--ls-caps); font-size: var(--fs-xs);
  line-height: 1; white-space: nowrap;
}
.fm-sign--eyebrow { color: var(--rust-500); }
.fm-sign--muted { color: var(--ink-500); }
.fm-sign svg { width: 14px; height: 14px; }
.fm-ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.18em; }

/* ============================================================
   Board chrome (bb-*) - built on the same tokens
   ============================================================ */
.bb-nav {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper-100) 86%, transparent);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--border-default);
}
.bb-nav__inner {
  max-width: var(--container-app); margin: 0 auto; padding: 0 28px; height: 64px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.bb-brand { display: inline-flex; align-items: center; gap: 12px; }
.bb-brand__disc {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none;
  border-radius: 999px; background: var(--rust-500); color: var(--paper-000);
  border: 2px solid var(--ink-900); box-shadow: var(--shadow-hard-sm);
}
.bb-brand__disc svg { width: 60%; height: 60%; }
.bb-brand__wm { font-family: var(--font-display); font-size: 23px; color: var(--text-strong); line-height: 1; }
.bb-meta-mono { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-faint); white-space: nowrap; }

.bb-main {
  max-width: var(--container-app); margin: 0 auto;
  padding: 26px 28px 72px; display: flex; flex-direction: column; gap: 22px;
}

/* stat strip */
.bb-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.bb-stat {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; min-width: 0;
  background: var(--surface-card-warm); border: 1px solid var(--border-soft); border-radius: var(--radius-md);
}
.bb-stat--call { background: var(--rust-050); border: 2px solid var(--rust-500); }
.bb-stat__num { font-family: var(--font-mono); font-size: var(--fs-h3); font-weight: 600; line-height: 1; color: var(--text-strong); }
.bb-stat--call .bb-stat__num { color: var(--rust-600); }
.bb-stat__label { font-family: var(--fon

... [20387 bytes truncated] ...

_hint || "or answer in your own words…";
      form.appendChild(ff);
    }

    var foot = el("div", "bb-decision__foot");
    var btn = el("button", "fm-btn fm-btn--sm " + (item.type === "merge" ? "fm-btn--gold" : "fm-btn--primary"), "Queue answer");
    btn.type = "submit";
    foot.appendChild(btn);
    var q = el("span", "bb-queued");
    q.innerHTML = CHECK_SVG + " queued";
    foot.appendChild(q);
    var answerLimit = el("span", "bb-limit");
    answerLimit.setAttribute("role", "alert");
    foot.appendChild(answerLimit);
    form.appendChild(foot);

    form.addEventListener("submit", function (ev) {
      ev.preventDefault();
      answerLimit.classList.remove("is-visible");
      var fd = new FormData(form);
      var value = fd.get("answer");
      var note = (fd.get("note") || "").trim();
      /* picked option, optionally annotated; a bare note is itself the answer */
      var answer = value ? (note ? value + " - " + note : value) : note;
      if (!answer) return;
      if (utf8ByteLength(answer) > 512) {
        answerLimit.textContent = "Answer is too long to queue (512 bytes maximum).";
        answerLimit.classList.add("is-visible");
        return;
      }
      if (window.lavish && window.lavish.queuePrompt) {
        /* close carries the composer-declared close mode: "release" frees a
           captain-gated work item instead of completing a question task */
        var ctxData = { question: item.key, answer: answer };
        if (item.close) ctxData.close = item.close;
        window.lavish.queuePrompt(
          "Captain's Call answer - " + item.title + ": " + answer,
          { tag: "choice", text: item.title + " -> " + answer, element: form,
            data: ctxData }
        );
      }
      card.classList.add("is-queued");
      /* deal the next card once this one is answered */
      setTimeout(function () { showCard(active < cards.length - 1 ? active + 1 : active); }, 450);
    });

    pad.appendChild(form);
    card.appendChild(pad);
    deck.appendChild(card);
  });

  /* stack navigation: one card at a time, dealt off the pile */
  var cards = Array.prototype.slice.call(deck.children);
  var active = 0;
  var stackCount = document.getElementById("bb-stack-count");
  var stackPrev = document.getElementById("bb-stack-prev");
  var stackNext = document.getElementById("bb-stack-next");
  var stackNav = stackCount.parentNode;
  function showCard(i) {
    active = Math.max(0, Math.min(cards.length - 1, i));
    cards.forEach(function (c, j) { c.hidden = j !== active; });
    var answered = deck.querySelectorAll(".is-queued").length;
    stackCount.textContent = "card " + (active + 1) + " of " + cards.length +
      (answered ? " · " + answered + " answered" : "");
    stackPrev.disabled = active === 0;
    stackNext.disabled = active === cards.length - 1;
    /* the pile thins as the deal approaches the bottom */
    deck.classList.toggle("bb-call--penult", active === cards.length - 2);
    deck.classList.toggle("bb-call--last", active === cards.length - 1);
  }
  if (cards.length) {
    stackPrev.addEventListener("click", function () { showCard(active - 1); });
    stackNext.addEventListener("click", function () { showCard(active + 1); });
    showCard(0);
  } else {
    deck.classList.add("bb-call--empty");
    deck.appendChild(el("div", "bb-empty", "Nothing needs your action right now."));
    stackNav.hidden = true;
  }

  /* Underway */
  var uw = document.getElementById("bb-underway");
  if (!data.underway.length) uw.appendChild(el("div", "bb-empty", "Nothing is underway."));
  data.underway.forEach(function (t) {
    var row = el("div", "bb-row");
    row.appendChild(badge(t.state === "working" ? "online" : "info", t.state));
    var main = el("div", "bb-row__main");
    main.appendChild(el("div", "bb-row__title", t.doing));
    /* captain-facing rows name the repo; the internal task id shows only when
       no repo is known */
    main.appendChild(el("div", "bb-row__sub", t.kind + " · " + (t.repo || t.id)));
    row.appendChild(main);
    uw.appendChild(row);
  });

  /* Landed */
  var ld = document.getElementById("bb-landed");
  if (!data.landed.length) ld.appendChild(el("div", "bb-empty", "No recent completions are in the current baseline."));
  data.landed.forEach(function (t) {
    var row = el("div", "bb-row");
    var chk = el("span", "bb-row__check");
    chk.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>';
    row.appendChild(chk);
    var main = el("div", "bb-row__main");
    main.appendChild(el("div", "bb-row__title", t.what));
    main.appendChild(el("div", "bb-row__sub", (t.repo || t.id) + " · " + t.owner));
    row.appendChild(main);
    if (t.pr_url) {
      var a = el("a", "bb-row__pr", "#" + t.pr_url.split("/").pop());
      a.href = t.pr_url; a.title = t.pr_url; a.target = "_blank"; a.rel = "noopener";
      row.appendChild(a);
    }
    ld.appendChild(row);
  });

  /* Charted Next + dispatch picker */
  var ch = document.getElementById("bb-charted");
  var bar = document.getElementById("bb-dispatch");
  var barCount = document.getElementById("bb-dispatch-count");
  var barBtn = document.getElementById("bb-dispatch-btn");
  var anyPickable = false;

  function pickedIds() {
    return Array.prototype.map.call(ch.querySelectorAll(".bb-pick:checked"), function (c) { return c.value; });
  }
  function refreshBar(limitMessage) {
    var n = pickedIds().length;
    barCount.textContent = limitMessage || (n ? n + " picked for dispatch" : "pick queued work to dispatch");
    barBtn.disabled = !n;
  }

  if (!data.charted.length) ch.appendChild(el("div", "bb-empty", "Nothing is queued."));
  data.charted.forEach(function (t) {
    var row = el("div", "bb-row");
    if (t.dispatchable) {
      anyPickable = true;
      var pick = document.createElement("input");
      pick.type = "checkbox"; pick.className = "bb-pick"; pick.value = t.id;
      pick.setAttribute("aria-label", "Pick " + t.id + " for dispatch");
      pick.addEventListener("change", function () {
        if (pick.checked && utf8ByteLength(pickedIds().join(",")) > 512) {
          pick.checked = false;
          refreshBar("Selection limit reached (512 bytes maximum). ");
          return;
        }
        refreshBar();
      });
      row.appendChild(pick);
    } else {
      row.appendChild(el("span", "bb-pick-spacer"));
    }
    var main = el("div", "bb-row__main");
    main.appendChild(el("div", "bb-row__title", t.title));
    /* second line keeps the title uncrowded in the half-width column */
    var chSub = t.repo || t.id;
    main.appendChild(el("div", "bb-row__sub", t.reason ? t.reason + " · " + chSub : chSub));
    row.appendChild(main);
    if (t.reason) row.appendChild(badge("warn", "waiting"));
    ch.appendChild(row);
  });
  var chartedTotal = data.charted.length + (data.charted_more || 0);
  document.getElementById("bb-charted-sub").textContent =
    data.charted_more ? "showing " + data.charted.length + " of " + chartedTotal : "";
  if (data.charted_more) {
    ch.appendChild(el("span", "bb-morechip", "+" + data.charted_more + " more queued - ask firstmate for the full chart"));
  }

  if (anyPickable) {
    bar.hidden = false;
    refreshBar();
    barBtn.addEventListener("click", function () {
      var ids = pickedIds();
      var dispatchAnswer = ids.join(",");
      if (!ids.length) return;
      if (utf8ByteLength(dispatchAnswer) > 512) {
        refreshBar("Selection is too long to queue (512 bytes maximum). ");
        return;
      }
      if (window.lavish && window.lavish.queuePrompt) {
        window.lavish.queuePrompt(
          "Dispatch order - start this queued work now: " + ids.join(", "),
          { tag: "choice", text: "Dispatch: " + ids.join(", "), element: bar,
            queueKey: "dispatch.charted",
            data: { question: "dispatch.charted", answer: dispatchAnswer } }
        );
      }
      bar.classList.add("is-queued");
    });
  }
  } catch (e) {
    renderBoardError("The board data could not be rendered");
  }
})();
</script>
</body>
</html>

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 3 issues found → auto-fixed (6) ✅
  • 🚨 bin/fm-captain-hold.sh:702 - After a release answer, tasks-axi unhold removes the captain hold annotations. Replaying the identical keyed answer therefore reaches this guard and is reported as skipped instead of the promised idempotent no-op, despite command_answer having a released-record replay path. Check the recorded digest/mode before rejecting an unheld queued task, or delegate this case to answer.
  • 🚨 bin/fm-captain-hold.sh:331 - The hand-written JSON-style unescape corrupts existing bodies containing literal escape sequences. For example, a shown \\n sequence matches the \n replacement before escaped backslashes are decoded, turning literal text into a newline. Unicode escapes are also not restored. Since answer --release rewrites the active work item's body, its preserved plan can be changed silently. Decode the quoted field with a real JSON-string decoder or consume an authoritative raw-body interface.
  • ⚠️ bin/fm-captain-hold.sh:681 - A pre-collapse keyed-answer record hashed the legacy text containing Decision key: &lt;short-key&gt;, while the new intake hashes Task: &lt;resolved-id&gt;. Replaying the same captured legacy answer after upgrade therefore fails the digest comparison at line 693 and is reported skipped, contrary to legacy-record recognition and digest idempotency. Accept the legacy keyed-text digest when the stored record was written by fm-decision-hold.sh.

🔧 Fix: Fix captain answer replay and body preservation
2 issues (1 error, 1 warning) still open:

  • 🚨 bin/fm-captain-hold.sh:409 - The idempotency check compares the requested title with tasks-axi's encoded display value. Titles containing structural characters such as : or , are shown as quoted JSON-style strings, so repeating an identical create/hold command fails with “different title.” Decode the shown title before comparison, ideally at the shared show-field boundary.
  • ⚠️ bin/fm-captain-hold.sh:697 - Legacy digest reconstruction only handles the explicit (any) origin. The new no-origin intake is documented as equivalent, but replaying a pre-collapse keyed answer with its full legacy task id and no origin computes only the new Task: digest and reports the already-closed task as skipped. Treat an empty origin like (any) when deriving the legacy short key.

🔧 Fix: Fix captain hold idempotency and legacy replay
2 errors still open:

  • 🚨 bin/fm-procevent-lavish.sh:224 - A captured choice declaring an unsupported close mode is silently converted to an omitted mode, which the intake interprets as done. For example, &#34;close&#34;:&#34;drop&#34; on a valid captain-held task completes it instead of failing closed. Distinguish an absent close field from a present invalid value and skip or forward the invalid value so the intake refuses it.
  • 🚨 bin/fm-decision-hold.sh:86 - The compatibility resolve closes and records the legacy decision before checking any routed task or edge, and line 95 suppresses every unblock failure despite claiming it is loud. A nonexistent routed id or a task not blocked by this decision therefore reports resolved after closing the decision, whereas the retired command refused before mutation. Validate all routed tasks and blocker edges before answer, then surface any edge-clearing failure.

🔧 Fix: Validate card close modes and compatibility routing
1 error still open:

  • 🚨 bin/fm-captain-hold.sh:543 - After answer --release records the answer and unholds the task, replaying the same decision without --release reaches this branch and reports success even though the requested completion does not occur. This bypasses the required recorded close-mode check and can mislead callers into believing the task was completed. Require recorded_resolution_mode to be released and the current invocation to include --release; reject every mode mismatch.

🔧 Fix: Enforce release replay mode matching
2 errors still open:

  • 🚨 .agents/skills/captain-hold-lifecycle/SKILL.md:21 - The policy explicitly allows one task-backed gate to fan multiple questions out on the board, but every card uses that same task-id key and fm-procevent-lavish.sh:234 discards all but the last answer for duplicate keys. If delivered separately, the first answer closes the task and later answers skip instead. Either path violates criterion 2(b), “nothing the captain owns may be closed without recording what he actually said.” Decide whether the board must consolidate all questions into one recorded answer or reject duplicate task keys until aggregation is supported.
  • 🚨 bin/fm-captain-hold.sh:493 - A work item can be released, complete normally later, then receive the original decision again without --release. This branch checks only the digest and reports answered: even though the newest record says Resolution mode: released, bypassing the strict close-mode invariant added for queued released tasks. Read and validate the recorded mode before accepting a closed-task replay, and reject this mismatch while naming released.

🔧 Fix: Prevent duplicate decision cards and released replay mismatches
2 errors still open:

  • 🚨 bin/fm-captain-hold.sh:676 - The tab-separated intake uses a whitespace IFS, which collapses an empty label column. A valid line like task-id&lt;TAB&gt;go&lt;TAB&gt;&lt;TAB&gt;release assigns release to label and leaves mode empty, so the task is completed instead of released without error. Parse the four columns while preserving empty fields.
  • 🚨 bin/fm-decision-hold.sh:119 - Intent requires that “old resolution records are recognized wherever a record is read” and that the resolve shim keep in-flight briefs working. A pre-collapse resolved record hashes only the original decision file, but the shim always appends Routed work: before calling answer; replaying the same legacy resolve therefore produces a different digest and fails. Detect a matching legacy routed record and replay using its historical digest/text while still validating and clearing the recorded edges.

🔧 Fix: Preserve answer columns and legacy resolve replays
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • bash tests/fm-captain-hold-lifecycle.test.sh
  • bash tests/fm-bearings-snapshot.test.sh
  • bash tests/fm-fleet-snapshot-view.test.sh
  • bash tests/fm-bearings-board.test.sh
  • Built a realistic board through bin/fm-bearings-board.sh build &lt;payload&gt; and rendered it with headless Google Chrome.
  • Manually held an ordinary queued work task, answered it through fm-captain-hold.sh answer --release, and inspected persisted tasks-axi show state before and after.
  • git status --short confirmed testing left the worktree clean.
✅ **Document** - passed

✅ No issues found.

🔧 **Lint** - 1 issue found → auto-fixed ✅
  • ⚠️ linter found issues (exit code 1)

🔧 Fix: Quote done literals to satisfy ShellCheck
✅ Re-checked - no issues remain.

✅ **Push** - passed

✅ No issues found.

…r the captain

A decision is no longer a separate type: it is an ordinary backlog task held
for the captain, identified by its task id. bin/fm-captain-hold.sh owns the
surviving behaviors - guarded hold creation, the recorded-answer close
(answer/answers with a release mode for captain-gated work), the source
bindings, and the investigation completion gate - and bin/fm-decision-hold.sh
becomes a one-release compatibility shim over it.

The fleet snapshot now parses hold-until and computes captain_actionable as
queued + captain-held + unblocked + due, independent of row kind, plus a
presentation-only deferred_marker for prose-deferred rows. Bearings renders
every due captain-held task in Captain's Call, date-deferred holds as dated
Charted Next gates, suppresses prose-deferred rows from default views with an
omitted disclosure, and excludes from Recently Landed anything that closed
while still held for the captain.

Legacy compatibility: pre-collapse <origin>-decision-<key> rows are already
plain task ids and keep working; short keys in recorded metadata, concrete
origin bindings, chat --resolve-key fallbacks, and old resolution records all
resolve in place.
@kunchenguid
kunchenguid force-pushed the fm/decisions-collapse-to-captain-task-r1 branch from ecd4ebb to 77ce20d Compare August 21, 2026 06:35
@kunchenguid
kunchenguid merged commit 99b21d8 into main Aug 21, 2026
13 checks passed
@kunchenguid
kunchenguid deleted the fm/decisions-collapse-to-captain-task-r1 branch August 21, 2026 07:58
quinnbot-ai added a commit to quinnbot-ai/firstmate that referenced this pull request Aug 21, 2026