Repository navigation
Conversation
* feat(brief): adopt sc-/type branch and PR-title convention for crews
Crew branches were always `fm/<id>`. Switch the scaffolded ship brief to
the new convention:
- Ticket-mandated repos (AGENTS.md requires a Shortcut story): create the
story first, then branch `sc-<story-id>-<short-slug>`.
- Ticketless work, including the firstmate repo itself: branch
`<type>/<short-slug>` with a conventional-commit type.
- Never `fm/` for a branch; that prefix stays reserved for the work window.
The scaffold cannot detect whether a repo mandates a ticket, so the brief
emits both rules and has the crewmate pick, mirroring its other
conditional steps. Every PR is now ticketed except genuinely-ticketless
firstmate-repo work.
The PR title must carry an `sc-<story-id>: ` or `<type>: ` prefix so it is
visible and Shortcut auto-links the story. no-mistakes generates the PR
title, so the no-mistakes brief now tells the crewmate to edit the title
right after the PR opens; direct-PR sets it at creation.
Consumer scripts that assumed an `fm/<id>` branch are updated to read the
actual branch instead:
- fm-merge-local.sh hardcoded `fm/<id>` with no fallback, so local-only
landing would have broken. It now discovers the ready branch from the
task worktree HEAD, keeping every existing merge guard.
- fm-review-diff.sh dropped its dead `fm/<id>` first-try (it already fell
back to the worktree branch).
- fm-promote.sh relays the new branch convention in its ship instructions.
- fm-bearings-snapshot.sh labels a candidate PR by its head branch instead
of stripping `fm/` (which now yields "-" for every PR).
- fm-tangle-lib.sh comment example refreshed.
Window naming (`fm-<id>`) and teardown/pr-check are unchanged: teardown and
fm-pr-check already read the actual branch, and the tangle guard keys on
"named non-default branch", not the prefix.
docs/architecture.md branch-naming reference updated. Backend-verification
evidence docs keep their historical `fm/` branch names as recorded facts.
Extends tests/fm-brief.test.sh with branch/PR-title coverage and updates
tests/fm-tangle-guard.test.sh and tests/fm-bearings-snapshot.test.sh for
the new convention.
* no-mistakes(document): docs already in sync with crew branch/PR-title convention
* no-mistakes(review): gate crew branch convention behind per-project ticket flag
* no-mistakes(review): harden branch resolution and generalize ticket tracker wording
* no-mistakes(review): warn on prefixless ticket flag; fix docs and title timing
* no-mistakes(review): honor misordered project modes; fix brief title timing
* refactor(brief): drop PR-title machinery; branch-name auto-linking suffices
Shortcut (and equivalent trackers) auto-link a PR from the branch name alone:
a branch named sc-<id>-<slug> links without any PR-title prefix. The title
prefix was never needed for linking, and the no-mistakes path could not set it
cleanly anyway (no-mistakes drafts the title itself). Remove all PR-title
machinery and keep the convention to branch names only:
- ticket-mandated repos (+ticket:<prefix> flag): branch <prefix>-<ticket-id>-<slug>;
the tracker auto-links from the branch name.
- ticketless work (including this repo): branch <type>/<slug>.
- windows keep the fm- prefix (unchanged).
Removes PR_TITLE_RULE / COMMIT_SUBJECT_RULE and their injection into every
delivery-mode definition of done, the commit-subject-prefix trick, and the
direct-PR set-title-at-creation line, plus the matching header, skill,
CONTRIBUTING, and test assertions.
Also folds the independent review's trims:
- Drop .serena/ from .gitignore - a local MCP tool dir has no place in a shared
public template.
- Safety: an unrecognized mode NAME in a registered bracket now REFUSES
(fm-project-mode.sh exits non-zero, no stdout) instead of defaulting to the
remote-pushing no-mistakes, so a mistyped local-only project can never become a
push-and-PR project. Every consumer fails closed on that exit: fm-fleet-sync.sh
skips the project (and no longer discards the warning), fm-brief.sh and
fm-spawn.sh abort, and fm-home-seed.sh returns an error.
- Soften the fm-merge-local.sh header overclaim (the no-other-task guarantee holds
only while the worktree HEAD is readable).
- Note the fm-bearings.v1 candidate_prs task->branch field change.
Adds a fm-project-mode.sh refuse test and updates the brief and project-mode
tests for the branch-only convention.
* fix(branch-convention): close review gaps in the mode-refuse and consumers
Second-opinion review of the PR-title removal surfaced real gaps, several in
this branch's own safety work:
- fm-project-mode.sh: the unknown-mode refusal only fired for a position-1 mode.
A typo written after a flag (e.g. `[+yolo locl-only]`) fell through to the
remote-pushing no-mistakes default, worse with +yolo. Now a leftover bracket
token with no valid position-1 mode also refuses (exit 3).
- fm-spawn.sh: the fail-closed abort on an unresolvable mode ran after the window
and worktree were created, stranding an orphan with no meta. Resolve the mode
before any window/worktree is acquired so the abort leaks nothing.
- fm-merge-local.sh: a --branch naming the default branch, or any no-op
fast-forward, was reported as a successful land. Refuse a ready branch equal to
the default and treat before==after as a failure.
- fm-promote.sh: emit the concrete branch rule from the project's ticket flag
(ticket-first for a +ticket project, else <type>/<slug>) so a promoted scout on
a ticket-mandated project does not branch without its ticket and lose the
auto-link; fail closed on an unresolvable mode before flipping state.
- Trim stale PR-title prose left in fm-project-mode.sh and README.md.
Also folds the reviewer's small trims: drop .serena/ from .gitignore (a local
tool dir has no place in a public template), soften the fm-merge-local header
overclaim, and note the fm-bearings.v1 candidate_prs task->branch field change.
Adds tests for the flag-first mode typo refusal and the ready-branch-equals-
default refusal. Lint clean (shellcheck 0.11.0); affected suites pass.
* fix: bash 3.2 brief parse and de-flake the jobs scheduler test
Two issues the full-suite run surfaced:
- bin/fm-brief.sh: removing the PR-title lines left the no-mistakes
definition-of-done heredoc with a single unbalanced apostrophe
("firstmate's"). macOS system bash 3.2 mis-parses an odd apostrophe count
inside a heredoc nested in $( ... ) (the issue kunchenguid#166 class), so the scaffold
failed to parse and every brief-dependent test cascaded. Rephrased to remove
the apostrophe; verified with `/bin/bash -n` under 3.2.57.
- tests/fm-test-run.test.sh: test_jobs_parallel_scheduler_and_failure_propagation
asserted an exact scheduler ordering (the replacement fixture must start before
the slow worker finished), which is inherently timing-flaky under load and was
intermittently failing the suite. Dropped that exact-ordering assertion per the
review ruling and kept the robust safety properties: all proven scripts run to
completion under --jobs 2, failures propagate, non-proven scripts are refused,
and gate-skips are recorded. Confirmed stable across repeated runs.
* test: track the reworded --yes wording in the ask-user authority test
The bash 3.2 apostrophe fix reworded the no-mistakes brief's "Avoid --yes" line
from "firstmate's authority check" to "the authority check firstmate applies".
tests/fm-ask-user-authority.test.sh pins that exact sentence to prove the brief
forbids silent ask-user auto-resolution, so update its expected string to match
the new (apostrophe-free) wording.
* fix: fold gate review/test fixes (spawn metadata, promote diagnostics, 3.2 test)
Carries over the fixes the no-mistakes pipeline surfaced during validation so the
branch stands on its own:
- bin/fm-spawn.sh: catch a metadata-publish redirection failure explicitly.
Stock bash 3.2 does not trip errexit on a compound command's redirection error
(bash 5 does), so an unwritable state/<id>.meta silently continued and left an
unrecorded endpoint; now it errors and keeps the backend abort-cleanup armed.
- bin/fm-promote.sh: stop discarding fm-project-mode.sh stderr, so the fail-closed
diagnostics (invalid-prefix warning, refusal reason) reach the operator.
- tests/fm-brief.test.sh: parse the scaffold under /bin/bash too, giving a macOS
developer the same stock-bash (3.2) signal a CI stock-bash lane would.
- tests/fm-project-mode.test.sh: drop the stale "and PR-title" from the header
comment, matching the branch-name-only convention.
Deferred: a repo-wide stock-bash-3.2 parse sweep in .github/workflows/ci.yml was
also produced by the gate, but pushing a workflow change needs a token with the
`workflow` scope, which this one lacks; it is a separable CI-infra follow-up.
.serena/ (the review agent's local MCP scratch dir) is deliberately not tracked
and stays out of the shared .gitignore, per the captain ruling.
* review: trim the diff and switch prohibitions to prescriptive wording
Trim-and-clarify pass; no behavior change (convention, fm-merge-local safety,
+ticket parsing, and the consent-boundary refuse are all untouched).
Smaller: tightened the verbose header/inline comments in fm-brief.sh,
fm-merge-local.sh, and fm-project-mode.sh to their load-bearing essentials
(net -32 lines). The behavior, its guards, and the tests that lock them stay.
Prescriptive wording: rewrote the crew-facing and doc prohibitions into the
positive rule the reader should follow -
- brief scaffold: "Never name the branch fm/..." -> "The fm/ prefix names the
work window; branch names use the rule above"; dropped the redundant
"- do not stop for this" from the collision-recovery step.
- fm-promote ship-instruction hints: dropped the trailing ", never fm/..."; the
positive branch rule is already stated.
- CONTRIBUTING.md: "A branch is never named fm/..." -> "The fm/ prefix names a
crewmate's work window, not its branch".
Kept as genuine warnings only the crew safety rules ("Never push to the default
branch. Never merge a PR.") and the runtime refusal diagnostics, which have no
positive equivalent.
Test assertions updated to the reworded brief/--help text.
…cision (#2) * docs(authority): sweep the defect class and decide it once An ask-user finding is often one instance of a class: one caller of a shared helper, one use of a repeated idiom, one site of a swallowed-failure convention. Deciding those instance by instance costs the captain one decision per site; one queue-refresh fix ran through roughly nine separate ask-user decisions before the class was swept and decided once. Extend ask-user-authority, the single owner of the ask-user decision procedure, with the proactive rule: enumerate the whole class before deciding one instance, fold the corrections into one round, and bring the captain one decision covering the class. Step 7's existing reactive same-theme rule now names that repeat as the signal to sweep rather than route the next instance, and cross-references the new section instead of restating it. Add one line to AGENTS.md section 11 so systemic-looking work is briefed to report every occurrence as one set, pointing at the same owner. The rule changes nothing about authority: enumeration establishes the real size of a defect the accepted contract already requires fixing, and whether the batched correction is autonomous or captain-owned still follows the numbered procedure and the stronger destructive, irreversible, and security-sensitive boundaries. * no-mistakes(review): clarify class-sweep authority and tighten its guard test * no-mistakes(review): reword class-sweep step 7 guard, drop stray serena config * no-mistakes(review): consolidate class-sweep authority wording and re-pin tests * docs(authority): gate the class sweep and keep parked decisions open Two corrections to the class-sweep rule, both prose-only. The enumeration steer could silently close a captain decision that was still unanswered. status_open_decisions drops a key on any resolved event, so a worker that parked on needs-decision, took an enumeration steer, and resumed would append resolved and remove the pending decision from the durable fold, hiding it from fleet snapshots and heartbeat review. The steer must now state that the decision stays open, and no resolved event is appended until the batched decision returns through the gate. The sweep also fired unconditionally, while both other surfaces gate it on a signal: AGENTS.md on systemic-looking work, step 7 on a repeated same-theme finding. It now fires only when the finding is one instance of such a class, so an isolated finding does not pay for an enumeration round trip. Both guarantees are pinned in the colocated test, and the duplication guard is re-anchored on the reworded procedure sentence. * no-mistakes(review): reuse assert_no_grep for the class-sweep duplication guard * no-mistakes(document): document class-sweep rule in ask-user-authority description
… an idle holder (#5) * feat(handover): replace a session at 250k and take the helm from an idle holder Two failures this closes. A session keeps working long past the point where it reasons well, because nothing measures that or offers a clean replacement. And a fresh session cannot take over from a holder that is alive but doing nothing: the lock tested liveness only, so a forked background window held the helm for hours while supervision stayed dead, and the only thing a new session could say was "another session holds the lock". The threshold is a flat 250,000 tokens, never a share of the context window: a percentage of a one-million-token window would park a session around 700,000, deep inside the degradation being avoided. Crossing it reports once and blocks nothing, because a stalled fleet is worse than a slower one. bin/fm-context-measure-lib.sh is the single owner of the measurement. The formula is lifted verbatim from the unlanded feat/context-budget-guardrail branch rather than re-derived, so the two converge on one owner when that parked work resumes; the verification record proves both produce the same number on a real transcript. The handover record points, it does not assert. Durable records win every disagreement with it, and the only content it carries is what exists nowhere else: the concrete next step and what each live worker is mid-way through. It lives in data/, never a temp directory. bin/fm-handover.sh release refuses until every open thread is backed by a durable record and every pointer still resolves, because once the outgoing session is gone a bad handover cannot be redone. It never stops a session, never touches unlanded work, and never drains the wake queue, so events queued during the gap survive for the replacement. Taking the helm needs two independent proofs, and a timer alone is never enough: measurable silence, from a turn-end activity marker that also watches the transcript so a long single turn reads as busy, and an unattended holder with no controlling terminal at all. An attended holder keeps the helm however long it has been quiet, and the refusal now names what holds it plus the one command that clears it. Session start leads with what waits on the captain and any released handover, because the answers that got re-asked were sitting hundreds of lines down. Answered decisions are searchable rather than preloaded: a preloaded list never shrinks and rebuilds the same wall of text, so startup carries one line and bin/fm-decided.sh search makes the lookup at the moment of asking cheap. It covers the decision logs already in data/ with no migration. Both list surfaces cap their output and say what they dropped; silent truncation would read as "nothing else is waiting". Not built here, deliberately: crewmate respawn, cross-provider handoff, and wedged agents that never end a turn. * no-mistakes(review): require positive activity evidence for helm takeover * no-mistakes(review): reuse the meta reader and report unread held decisions * no-mistakes(review): never render a failed read as nothing waiting * no-mistakes(review): gate the handover lifecycle on the helm and stamp only with a transcript * no-mistakes(review): make the helm evidence read decide, not the stamp * no-mistakes(document): point hold-model docs at their new single owner
…ling (#4) * feat(context-budget): enforce an absolute 180k context ceiling on claude Firstmate sessions balloon toward roughly 800,000 tokens before Claude's own auto-compaction fires. This adds a turn-end guardrail that measures the live session and blocks the turn end at an absolute 180,000 tokens, far earlier than anything the harness does on its own. It is a cost and reasoning-quality policy, not overflow prevention. bin/fm-context-budget.sh is the whole owner, registered as a third sibling Stop hook rather than folded into the turn-end supervision guard, which keeps owning exactly one predicate. Measurement reads transcript_path from the hook payload and never derives it from $HOME, because a non-default config directory puts the transcript where $HOME cannot predict. The total sums the four usage fields on the last non-sidechain assistant entry, and keeps three correctness rules: dedupe a multi-block turn by requestId, take last rather than max so compaction cannot disable the guard, and exclude sidechains. The ceiling is the only policy number; the advisory notice is derived as ceiling minus headroom so there is no second threshold to keep in sync. There is one valve: run /stow, write a handoff note, and clear. It is built on tracked /stow rather than the untracked personal /handoff skill. The guard only instructs; it never types into a pane, injects a command, or spawns an agent. A session cannot clear itself, so with no captain present the valve cannot close. The guard still gets the handoff written and then degrades to a visible allow once the block budget is spent. docs/context-budget.md records this limit rather than working around it with keystroke injection. Every measurement failure is a silent exit 0 and blocking is bounded, so the guard can never wedge a session. Scope binds primary and secondmate primary sessions and stays inert for crew subagent turns. Verified live end to end in a throwaway project: the block fired at a real 32,633 tokens against an overridden ceiling and named the valve. Claude Code 2.1.220 writes subagent turns to a separate subagents/agent-<id>.jsonl file carrying isSidechain, so a subagent's 24,461 tokens never reached the primary's 33,217 measurement. A marked secondmate home blocked while the same linked worktree without the marker stayed silent. docs/verification/context-budget.md records the commands and output. This slice supports claude only; per-harness fan-out lands separately. * no-mistakes(review): make context guard warn by default with sticky stand-down * no-mistakes(review): harden context-budget records and make notices visible * no-mistakes(review): add write-only trip record and compaction-boundary re-arm * no-mistakes(review): exclude sidechain compaction boundaries and correct re-arm claims * fix(context-budget): separate the notice keys and count crossings once Carries out the batched decision on the notice-record stage class, plus two corrections that were already outstanding against this branch. The count-not-recorded degrade now has its own notice key. The record's single stage field stood for two different messages, so whichever fired first silenced the other for the whole episode: a ceiling notice already shown made the guard go quiet about its own malfunction from the very first occurrence. The record now carries independent flags rather than one field, and the degrade still prints once per episode instead of at every turn end. An unparseable block record is read as no record, leaving the guard active, and the parse failure is traced once. Reading it as a spent stand-down conflated unknown with dismissed and let a corrupt file impersonate a dismissal. The retention bias still protects a stand-down the session was actually told about. Leaving the guard armed does not cost the block bound: a writable record is rewritten on the first blocked turn, and an unwritable one degrades to the visible warning. The trip record now writes one line per crossing rather than one per turn end above the advisory. It answered how long a session lingered instead of how often the guard fired; 12 turn ends at a steady 160,000 wrote 12 lines. The line is written where the stage is recorded, and the enforcing path records its crossing separately because it prints on every blocked turn. The ceiling straddle is left unfixed on purpose and recorded in the code with the numbers. Replayed twice over real transcripts, across 41,244 and then 41,353 measured turns, it occurred zero times, and the obvious fixes would make the independent-key case strictly worse. A test pins the current behavior so it is not fixed in passing. Also corrects two stale claims: the single-condition re-arm claims in the test file, one of which printed into test output, and the unqualified whole-session claim about staying out of the harness's consecutive-block accounting, which is false because the stand-down clears mid-session. A new assertion found a real defect: every record write suppressed its own failure with a trailing 2>/dev/null, which bash applies too late, so an unwritable record leaked the shell's "Permission denied" onto the same stderr the blocking path uses to reach the model. All five writes now suppress first. Enforcement stays opt-in and no behavior outside this component changes. * no-mistakes(review): route unrecorded-count degrade through stage_enter for a durable trip line * no-mistakes(document): correct stale trip-record and stand-down claims in context-budget docs * docs(context-budget): state the test bar and its one machine-local exception The verification record required a clean bin/fm-test-run.sh --all, which cannot hold on this host: tests/fm-kimi-harness.test.sh fails because the machine's python3 is an asdf shim that exits 126 under the overridden HOME that test uses. Records the suites this change is actually required to keep green, names the failing assertion and its cause, and states that it is pre-existing and reproduced on untouched base 1672d95 by two workers on two dates. Points at fm-kimi-harness-test-env as the thread that owns it, so the narrower bar reads as an evidenced exception rather than a shortcut. The failure is deliberately not repaired here: a change that also fixes an unrelated machine-local environment failure stops being reviewable. * fix(context-budget): let the handover own the valve and state the precedence The rebase brought this branch alongside the 250,000 handover threshold, and the two contracts contradicted each other. This guard told a session to stop and ask the captain to clear before continuing; the handover rule forbids stalling the fleet for the captain's answer. It also asserted that a session cannot clear itself, which was measured and true when written but is retired by bin/fm-handover.sh release, a helm, and a successor session. Three changes, the minimum that makes the contract coherent: - The ceiling no longer stalls. It reports, the session keeps working, and the captain hears at the next natural reply. - The false premise is deleted rather than hedged. Clearing is still something a session cannot do, and that no longer constrains anything, because a handover does not clear a context - it releases the helm. - AGENTS.md now states the precedence that neither side stated: which threshold fires first, that above 250,000 every threshold applies at once, and that the handover mechanism owns the valve in every case. The emitted valve text is re-pointed to match, so the one model-facing message this guard can send no longer instructs a session to do what the contract just retired. docs/context-budget.md drops the stall-and-ask claim everywhere, not only in the section that conflicted. Structural unification of the two thresholds is deliberately not attempted here and is tracked as fm-context-budget-handover-unification. Also from the rebase: the Stop array now carries four siblings, and the registration test pins the exact set and the auto-arm staying last, so a future rebase cannot silently drop either context hook. * docs(context-budget): record why the measurement lib is not adopted yet A review asked this branch to source bin/fm-context-measure-lib.sh and delete its inline measure_context, since the lib's header names this branch and docs/scripts.md calls it the single owner. That was declined by standing decision. This records the refusal with its evidence so a later reader sees a reasoned decision rather than a finding that was quietly skipped. The adoption is not refused in principle; one owner is the agreed end state. A straight swap today would delete working behavior, in four ways, the fourth found by that review: the lib slurps where this streams, it has no compaction-boundary tally that genuine-reset detection depends on, it dedupes multi-block turns by requestId, and it does not drop synthetic zero-usage entries. That fourth difference makes the lib's own caller wrong rather than merely different. On a transcript of one 300,010-token turn followed by the synthetic zero-usage entry written when a turn ends abnormally, the lib returns 0 with exit status 0, so a caller reads it as a real measurement. bin/fm-session-pulse.sh then takes its under-threshold branch and removes the once-per-session handover-due marker, so an interrupted turn makes that session forget a handover was due. Reproduced end to end. That is a defect in the sibling hook, is not repaired here, and is tracked as fm-session-pulse-false-zero. The agreed end state is the reverse move: put this streaming implementation, with rule 3 and the compaction tally, into the lib and have both callers adopt it, under its own tests and review as fm-context-measure-lib-adoption. * no-mistakes(document): add scripts.md toolbelt row for fm-context-budget.sh
…d work (#6) * feat(bin): add resolve --no-work to close captain holds with no routed work A decided-no-work outcome (already landed, intentionally nothing, or owned elsewhere) had no dependent task to route to, so such holds could not be closed durably and kept festering as open captain questions. --no-work <reason> is mutually exclusive with --routed-to: it records the captain decision and the stated reason in the hold body and marks the hold Done with no dependency edges to clear, using the same retry identity and idempotent-retry contract as the routed path. verify's refusal of holds that are neither actively held nor durably resolved is unchanged; a hand-closed hold still fails that check. * no-mistakes(document): update decision-hold verification record for --no-work tests * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes
) * feat(harness): add cursor-agent adapter for Cursor IDE and CLI crews Recognize Cursor Helper/Cursor.app for lock ownership so Cursor chat can run as primary, and launch crewmates with cursor-agent --force including workspace-trust handling and a verified busy footer signature. Co-authored-by: Cursor <cursoragent@cursor.com> * feat(supervision): add cursor-agent background-notify protocol Give Cursor IDE chat primaries a named wake recipe via sole Shell arm of the home watcher, matching grok's background-notify shape instead of falling through to the unknown harness fallback. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(harness): tighten cursor-agent review findings Send trust acceptance as typed input, document Cursor as a verified primary without claiming PreToolUse deny, and keep harness lists consistent. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
…ntent (#7) * feat(bin): require concise structured PR intent in no-mistakes ship briefs Real ship PRs (applypass/ai_backend#109, apply_pass_backend#406) shipped 6,000-10,000 char run-on `## Intent` sections because the no-mistakes DOD branch gave the worker no guidance on writing the intent that becomes the PR description. Scoped to the no-mistakes branch only, since direct-PR and scout tasks never invoke the pipeline. * no-mistakes: apply CI fixes
* fix(bin): trace stand-down and notice write failures instead of dropping them The block-budget-exhausted stand-down write ignored its own return status, so a failed write left the session-facing message falsely claiming the guard "now stands down for the rest of the session" on every later turn end, with no durable trace anywhere. It now checks the write, corrects the message when it fails, and records the failure once under stage=standdown-unrecorded, mirroring the existing ceiling-unrecorded degrade. The per-episode notice dedup record swallowed its own write failure. If the notice file specifically became unwritable while the rest of state/ stayed writable, stage_enter never deduped again and retraced every threshold crossing on every turn end, reopening the trip-file inflation commit a9fb47f removed. A fallback marker file now carries the same dedup fields when the primary notice file cannot be written, restoring once-per-crossing behavior without ever reading a decision back out of the write-only trip record. The fallback write itself is traced once under stage=notice-unwritable. Both new cases are covered in tests/fm-context-budget.test.sh and documented in docs/context-budget.md. * no-mistakes(document): add notice-degraded fallback file to AGENTS.md state inventory
…nt (#9) * fix(bin): exclude synthetic zero-usage entries from context measurement fm_context_measure_transcript could return a false 0/exit 0 when a transcript's last countable assistant entry was the synthetic all-zero-usage entry Claude Code writes on an abnormal turn end. That false 0 let fm-session-pulse.sh silently wipe a handover already due. Exclude zero-total candidates before the last/dedupe step, matching fm-context-budget.sh's own rule 3, so a trailing synthetic entry can no longer mask the last real measurement. * no-mistakes: apply CI fixes
… text (#10) The spawn isolation guard decided "this launch worktree is not the primary checkout" with a string compare of two canonicalized paths. bash's builtin `pwd -P` resolves symlinks, `.`, `..`, and trailing slashes, but it does not case-fold, so on a case-insensitive filesystem (macOS's default) the primary checkout reached under a different case survived canonicalization as unequal text and the guard blessed it as isolated. A crewmate then branched and committed inside the primary checkout, the exact tangle this guard exists to prevent. Compare device and inode instead, so every alias of one directory is recognized as that directory. Each side is confirmed to be an existing directory first, because `test -ef` is also false when a side cannot be stat'd and that would read as "distinct"; anything that cannot be proven distinct is now refused rather than allowed. The identity compare also drops a false rejection the text compare had: a genuinely distinct worktree whose launch path spelling differed from git's report of its root. Refs kunchenguid#2654
The fork drifted 329 commits behind kunchenguid/firstmate while carrying 11 applypass customizations. The captain has since decided each customization's end-state: five are dropped in favour of upstream, one is reduced to a manual core, and five are kept. Because the decided end-state drops more than it keeps, this merge takes upstream's tree wholesale and each kept customization is re-added as its own commit on top. That makes the drops self-evident (they are simply never re-added) and lets the captain review one concern per commit instead of reading a 329-commit conflict resolution. origin/main is recorded as a parent so the fork's history is preserved and the PR lands as an ordinary merge.
Keeps upstream's spawn_worktree_isolated as the base, including its git-common-dir check and its shared use by the worktree-discovery poll, and replaces its three path-text comparisons with device-and-inode identity tests. git rev-parse --show-toplevel returns the canonical spelling of a path while bash's pwd -P builtin does not case-fold, so on a case-insensitive filesystem the two disagree. Reproduced against both predicates: a genuine linked worktree reached as ".../WT1" rather than ".../wt1" compared unequal as text and was refused with a misleading "not a worktree root", killing the spawn. The primary checkout under a variant spelling was refused only as a side effect of that same text mismatch, not because it was recognised as the project. Identity compares fix the false refusal and refuse the primary for the reason that names it. Because -ef is also false when a side cannot be stat'd, each side is confirmed an existing directory first, so an unresolvable side reads as "refuse" rather than as "distinct". tests/fm-tangle-guard.test.sh gains the three proven rows. The case-variant rows probe the filesystem rather than the platform, so the suite stays green on a case-sensitive one; the canonical and primary-refusal rows are unconditional.
…cision An ask-user finding is often one instance of a class: one caller of a shared helper, one use of a repeated idiom, one site of a swallowed-failure convention. Deciding those instance by instance costs the captain one decision per site; one queue-refresh fix ran through roughly nine separate ask-user decisions before the class was swept and decided once. Upstream rewrote ask-user-authority from eight steps to five and decoupled authority from yolo, but added no batching rule. Its nearest equivalent is the reactive repeated-same-theme escalation, which this section builds on rather than replaces. The section is re-added on top of upstream's rewrite with its cross-reference moved off the retired step 7 and onto that step 4 bullet, and the old step-7 sentence dropped because upstream folded that escalation into step 4. Authority is unchanged: enumeration only establishes the real size of a defect the accepted contract already requires fixing, and whether the batched correction is autonomous or captain-owned still follows the numbered procedure and the stronger destructive, irreversible, and security-sensitive boundaries. AGENTS.md section 11 points at the owner rather than restating the procedure, and the colocated test pins both the rule and that the pointer stays a pointer.
Crew branches are not fm/<id>. The registry gains an additive +ticket:<prefix> flag; a ticket-mandated project branches <prefix>-<ticket-id>-<short-slug> so the tracker auto-links from the branch name, and a ticketless project branches <type>/<short-slug> with a conventional-commit type. The fm/ prefix keeps naming the work window only. bin/fm-project-mode.sh parses the flag and emits a third word only when the project is ticketed, so a caller reading "<mode> <yolo>" is unaffected. An invalid or prefixless prefix warns and drops the project to ticketless rather than scaffolding an unusable branch name. A mode written after the bracket flags is rescued with a warning instead of being discarded into the remote-pushing default. Upstream's warn-and-default on an unknown mode name and its --raw conditional-policy handling are left as they are. bin/fm-brief.sh renders exactly one branch rule from that flag - the only registry field it reads, since the delivery mode arrives as an explicit --mode - plus the collision guidance a shared branch namespace needs. bin/fm-dod-lib.sh's local-only definition of done stops naming fm/<id>. Consumers that assumed the old name now read the real branch: - fm-merge-local.sh discovers the ready branch from the task worktree HEAD and takes --branch <name> only when that HEAD cannot answer; a readable HEAD outranks a disagreeing override, a ready branch equal to the default is refused, and a no-op fast-forward is reported as a failure rather than a land. It also validates project= before any git -C runs there. - fm-review-diff.sh discovers the branch the same way, with the same --branch recovery and the same mismatch refusal. - fm-promote.sh resolves the ticket flag before flipping state and relays the concrete branch rule in its ship instructions. - fm-bearings-snapshot.sh labels a candidate PR by its head branch; the fm-bearings.v1 candidate_prs field is renamed task -> branch, because stripping "fm/" now yields "-" for every PR. - fm-fleet-sync.sh stops defaulting an unresolvable posture to "no-mistakes off", which would fetch and push a project the captain may have registered local-only on the strength of a read that did not succeed. The two obsolete parts of the original change are deliberately not re-ported: bin/fm-spawn.sh's pre-window fail-closed mode resolution (upstream now requires an explicit --mode) and its explicit meta-write failure check (upstream publishes meta atomically under a lock). Tests: new tests/fm-project-mode.test.sh and tests/fm-merge-local.test.sh, both registered with bin/fm-test-run.sh; branch-convention coverage in tests/fm-brief.test.sh; --branch recovery in tests/fm-review-diff.test.sh; the ticketed and ticketless promote hints in tests/fm-task-delivery.test.sh. The brief-isolation ordering check in tests/fm-tangle-guard.test.sh and the candidate_prs assertion in tests/fm-bearings-snapshot.test.sh now match the new branch step and field name.
Replacing a firstmate session loses everything the outgoing one knew that never reached disk. bin/fm-handover.sh writes that down: an advisory, durable record of the concrete next step and what each live worker is mid-way through, verified before the helm is given up and printed in full to the replacement at session start. Upstream has none of this machinery, so it lands whole. Only the manual core is re-ported. The fork also shipped an automatic trigger (bin/fm-session-pulse.sh measuring the transcript at every turn end against a 250,000-token threshold), automatic helm takeover from a holder measured as silent and unattended (bin/fm-helm-lib.sh, state/.helm-activity), and the awaiting-the-captain digest block built on bin/fm-decided.sh and bin/fm-backlog-record-lib.sh. None of that is here. Deciding a session has gone on too long is the captain's call, and the measurement that would automate it is the same measurement whose over-estimate lets a takeover displace a session someone is still using. What that leaves in bin/fm-lock.sh is the minimum a refusal needs to be actionable: release, which frees only the helm this session holds; clear --pid N, which drops the recorded helm for the pid that actually holds it and says plainly that it stopped nothing; and one line naming that exact command in every live- holder refusal and in status. Without it a captain is told something else holds the helm and given no way forward. The record's default pointer list drops data/decided.md, which has no owner in this tree. Session start prints a released handover as its own stage, between the wake queue and the supervision block, and the read-once contract now covers it so the replacement never re-reads the file. The stage list the truncation banner reports gains "handover" and its test asserts the new list. tests/fm-session-handover.test.sh carries the eight lifecycle cases from the fork's suite (its pulse, decided, and awaiting-captain cases have no subject here) plus two new ones for release and clear --pid, including that clear leaves the holder process running. The session-start case is ported without its awaiting-the-captain assertions.
Author
|
oops, this was supposed to be a PR against my fork. Sorry. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the problem
applypass/firstmatehad drifted 329 commits behind canonical upstreamkunchenguid/firstmatewhile carrying 11 local customizations. The merge base isa5fe1bcc. Every upstream fix, backend, and safety change since then was unavailable here, and the gap was growing faster than the fork was.The customizations were not all worth keeping. Several solved a problem upstream has since solved differently and better, so a straight "merge and preserve everything" would have re-introduced machinery upstream deliberately does not have, on top of a 329-commit conflict resolution nobody could review.
What was the fix
Base chosen: current
upstream/main(4768e98d), not the parked branch. The parkedorigin/reconcile/kunchenguid-upstream-20260821was built for the old "preserve all 11" plan and was already ~173 behind upstream. Because the decided end-state drops five customizations and reduces a sixth, continuing that branch would have meant folding everything in and then deleting it - more work and more ways to leave something behind. Basing on current upstream and re-adding only the kept delta makes the drops self-evident: a dropped customization is simply never re-added, and there is nothing to prove absent by inspection.The merge.
f1f110a2recordsorigin/mainas a second parent, so the fork's history is preserved and this lands as an ordinary merge, while the tree is upstream's exactly. The four commits on top are one per kept concern, so this is reviewable a concern at a time rather than as one 329-commit conflict resolution.Per customization:
sc-/type branch convention0cb7ebb8). The branch and PR-title convention, the+ticket:<prefix>registry flag,fm-merge-localbranch discovery with--branchrecovery, the same recovery infm-review-diff,fm-promote's ticket-aware ship-branch instruction, and thefm-bearings.v1task->branchfield rename. Two obsolete parts dropped: pre-window fail-closed mode resolution infm-spawn.sh(upstream now requires--mode) and the explicit meta-write failure check (upstream publishes meta atomically under lock).6a6b9748). Re-added on top of upstream's 5-stepask-user-authorityrewrite, cross-reference moved off the retired step 7 onto upstream's step 4.cursor-agentadaptercursoradapter, includingdocs/supervision-protocols/cursor.mdand upstream's restructured harness references.bin/fm-context-budget.sh, no ceiling stub, no hook slot.b8c77aba). Kept:bin/fm-handover.sh(prepare / check / release / show / consume / pending, helm-gated, captain-invoked),bin/fm-lock.sh releaseandclear --pid N, and one line naming the exact clear command in every live-holder refusal and instatus. Dropped: the automatic trigger (fm-session-pulse.sh), all token and silence measurement (fm-context-measure-lib.sh, transcript mtime), automatic helm takeover (fm-helm-lib.sh), the.helm-activitymarkers, and the awaiting-the-captain block with itsfm-decided.sh/fm-backlog-record-lib.shdependencies.resolve --no-workbin/fm-captain-hold.shand both thedecision-hold-lifecycleandcaptain-hold-lifecycleskills.--intentcontract taken as-is; the three sections are shaped after the PR opens, in the same post-open edit that sets thesc-title prefix. This PR body is that shape.2d99bcd3). Upstream'sspawn_worktree_isolatedkept as the base, including its git-common-dir check; its three path-text comparisons replaced with device-and-inode identity tests.The six expected conflict files.
bin/fm-spawn.shandbin/fm-supervision-instructions.shstopped being collisions when #3 was dropped and #1's spawn hunks were dropped as obsolete; both are upstream's verbatim, with #10's identity change applied on top of upstream's current predicate infm-spawn.sh.bin/fm-brief.sh,bin/fm-merge-local.sh,bin/fm-bearings-snapshot.sh, andbin/fm-fleet-sync.share upstream's current versions with #1's changes hand-applied - no textual merge was attempted on any of them.Proof of work
Lint.
bin/fm-lint.shexits 0: ShellCheck 0.11.0 (pinned), actionlint 1.7.12 (pinned), 3 workflow files valid.Tests.
bin/fm-test-run.sh --changed --base f1f110a2selects 75 files. Three of them drive real Herdr lifecycle behaviour, which this task is not scaffolded to run, so 72 were run: 63 pass, 9 fail, and every one of the 9 is an environment limit on this machine, not a regression.fm-captain-hold-lifecycle,fm-pr-merge,fm-bearings-board,fm-teardown,fm-backlog-atomicity,fm-bearings-snapshot,fm-backend,fm-control-relaunchbin/fm-tasks-axi-lib.shsetsFM_TASKS_AXI_MIN=0.2.4; the installedtasks-axiis 0.2.3. Each stops on the same refusal,fm-captain-hold: compatible tasks-axi is requiredorautomatic backlog transitions require tasks-axi 0.2.4 or newer. None of these scripts is touched by this branch.fm-calm-pi-extensionrender_export_dom ... on a Chrome that never finished. The whole fake-Chrome harness is defined insidetests/fm-calm-pi-extension.test.sh, which is upstream's at746fc0aaand unchanged here; nothing on this branch is in its dependency path.Four more failed on this machine's
asdfshims and pass once a real interpreter is on PATH, so they are listed as passing above:fm-claude-trust,fm-spawn-dispatch-profile,fm-trace-context-spawn, andfm-backend's trust step all hitnodeexiting 126 under the overriddenHOMEthese tests use, andfm-kimi-harnessneeds apython3withtomllibthat survives the same override (the shim exits 126,/usr/bin/python3is 3.9).fm-test-run.test.shfailed once on a debug file I had left intests/; removed, it exits 0.fm-bearings-snapshotstops at atasks-axi holdbefore reaching the case this branch changed, so that case was run on its own:--include-prs is the only path that fetches, and it enriches correctlypasses, including the.branch == "fm/ship-task"assertion.Directly relevant suites, all green:
fm-session-handover(10),fm-session-start(53),fm-tangle-guard,fm-brief,fm-merge-local,fm-project-mode,fm-review-diff,fm-ask-user-authority,fm-task-delivery,fm-documentation-audiences,fm-lint,fm-test-isolation-proof.Tests whose behavior changed, and why:
tests/fm-task-delivery.test.sh-fm-promote.shno longer emitsgit checkout -b fm/<id>, so the assertion on that literal was replaced with assertions on the new branch-hint wording, and the promote fixture's meta gainedproject=so the ticket flag resolves. A new case pins the ticketed variant. The contract changed; the assertions were re-pointed at it, not weakened.tests/fm-tangle-guard.test.sh- same reason, one grep re-pointed fromgit checkout -b fm/to the new first-action line.tests/fm-bearings-snapshot.test.sh-.task == "ship-task"became.branch == "fm/ship-task"for thefm-bearings.v1field rename.tests/fm-brief.test.sh- four new cases for the ticketless, ticketed, non-Shortcut-prefix, and--helpforms of the branch convention.tests/fm-session-start.test.sh- the truncation-banner case asserts the stage list, which gainshandover. One new case covers a replacement session finding a released handover.tests/fm-ask-user-authority.test.shandtests/fm-review-diff.test.sh- additions only. The first pins docs: polish README banner and repo housekeeping #2's batched-defect-class section on upstream's rewritten skill, the second pins--branchrecovery. No existing assertion in either file was touched.tests/fm-project-mode.test.sh,tests/fm-merge-local.test.sh,tests/fm-session-handover.test.sh, all registered inbin/fm-test-run.sh's family map and deliberately not in the proven-isolated parallel shard set.No test was deleted or weakened to make anything pass.
Kept items are functional. #1:
bin/fm-brief.shrenders both branch rules and--helpstates the convention;fm-project-mode.shemits the third+ticket:field;fm-merge-local.shandfm-review-diff.shboth discover the branch from the worktree HEAD and both accept--branchrecovery;fm-promote.shresolves the ticket flag before flipping state;fm-bearings-snapshot.shemitsbranch:. #2: the section is present in upstream's rewritten skill with the AGENTS.md line re-anchored. #5:fm-handover.shruns its whole lifecycle andfm-lock.shnames the clear command. #10:tests/fm-tangle-guard.test.sh'stest_spawn_isolation_is_identity_not_path_textpasses all four rows - the canonical worktree spawns, the same worktree under a case-variant spelling spawns instead of being refused as "not a worktree root", and the spawning project is refused under both spellings by the reason that names it.Dropped items are gone, with no orphan references. A tree-wide grep for
helm-activity,helm-takeover,context-budget,fm-decided,fm-session-pulse,fm-awaiting-captain,fm-context-measure,fm-helm-lib,fm-backlog-record-lib, andhandover-duereturns nothing outside.git. NoAGENTS.mdstate-inventory line, skill, doc, or.claude/settings.jsonhook slot describes machinery that is not here. The remainingcursor-agenthits are upstream's own references to the CLI binary name, which is stillcursor-agenteven though the adapter iscursor.#5 is reduced to its manual core.
bin/containsfm-handover.sh,fm-lock.sh,fm-lock-lib.sh, andfm-session-lock-lib.sh, and nothing else from the fork's handover or helm machinery. Nothing measures a session, and no code path takes the helm from a live holder.This rendered PR body shows all three sections. Confirmed after opening; see the follow-up edit.
Two things outside this PR
data/captain.mdstill says to setconfig/crew-harness=cursor-agent; the value is nowcursor. That file is gitignored and lives outside this worktree, so it is a follow-up for the captain's home rather than a change here.bin/fm-project-mode.sh's unknown-modeexit 3refusal was not re-ported. Upstream deliberately owns warn-and-default there and its header states the fallback; changing it is a cross-consumer contract change (fm-remote-home-seed.sh,fm-spawn.sh,fm-fleet-sync.sh,fm-home-seed.sh) that the agreed dispositions do not sanction. Consequence:fm-fleet-sync.sh's fail-closed guard now fires only whenfm-project-mode.shitself crashes or is missing, so a mistypedlocal-onlyin the registry is still not caught there.🤖 Generated with Claude Code