Skip to content

feat(bin): merge upstream firstmate while preserving the Cursor adapter - #2

Merged
davidx-secco merged 15 commits into
mainfrom
fm/upstream-merge-k1
Jul 29, 2026
Merged

davidx-secco merged 15 commits into
mainfrom
fm/upstream-merge-k1

Conversation

@davidx-secco

@davidx-secco davidx-secco commented Jul 28, 2026 •

Copy link
Copy Markdown
Collaborator

Intent

Bring this fork up to date with upstream firstmate (kunchenguid/firstmate) by merging upstream/main into the fork's main as a real merge commit, so the fork gains upstream's 12 commits while keeping its Cursor crewmate adapter and without rewriting the fork's already-published main history.

What Changed

  • Merged 12 upstream firstmate commits into the fork as a real merge commit (no rewrite of published fork main), bringing the Kimi crewmate adapter and its turn-end wake hook (bin/fm-kimi-turnend-hook.sh), the pi-signed runtime adapter, quota-window pace routing for crew dispatch, Grok Stop continuation handling with hardened endpoint teardown, watcher rearm across Pi session transitions, and structural bordered-composer/busy-detection fixes in bin/fm-tmux-lib.sh.
  • Preserved the fork's Cursor crewmate adapter through the conflicted regions, keeping Cursor refused for secondmate launches while adopting upstream's expanded harness list and busy-signature plumbing.
  • Reconciled post-merge documentation and one drifted code path: corrected the AGENTS.md verified-harness wording so Kimi is not authorized as a primary harness, fixed docs/cursor-agent-harness.md claims about tmux busy matching, the narrowed generic-interpreter gap, and the primary harness count, and collapsed the now-redundant BUSY_REGEX alias in bin/fm-watch.sh onto fm_busy_lines_match.

Risk Assessment

✅ Low: The follow-up commit applies exactly the four requested fixes as narrow, behavior-preserving edits (one AGENTS.md wording clause, two doc corrections, and a dead-branch removal in window_is_busy whose replacement has provably identical semantics), leaving the reviewed merge's Cursor and upstream integrations untouched.

Testing

I verified the merge at the git level (real two-parent merge commit, exactly upstream's 12 commits gained, fork's published main still an ancestor so no history rewrite, all Cursor-adapter commits reachable) and confirmed the conflict resolution dropped no upstream content by showing every file diverging from upstream's tip is one the fork itself modified. For product-level behavior I captured a CLI transcript of the merged tree resolving the fork's Cursor harness next to upstream's new kimi/pi-signed harnesses, including the Cursor crewmate/scout-only secondmate refusal, and a manual check that the follow-up commit's fm-watch.sh busy-regex refactor still detects Cursor's busy hint, avoids cross-harness leakage, and honors the documented FM_BUSY_REGEX override. Fourteen targeted behavior tests spanning both the fork's Cursor surfaces and the merged upstream features (spawn dispatch, secondmate harness, composer lib, tmux busy, kimi, quota pace, watch triage, grok, backend, pi watch, doc audiences) all pass. Two initial failures were environment-only and fixed before retest: fm-kimi-harness needs a python3 with tomllib (macOS system python is 3.9, supplied 3.11 via a temp PATH shim) and fm-secondmate-harness's pi-signed case was skewed by the inherited CLAUDECODE=1 marker of my own session. No screenshots apply — this is a Bash CLI/agent-orchestration repo with no rendered UI surface, so the evidence is command transcripts.

Evidence: Merge shape verification (two parents, 12 upstream commits, no rewrite, cursor commits reachable)

### 1. Merge commit d9d779b is a REAL merge (two parents) parents 0dc2f03ff9fab7ad309d33ac3064eee4484faf06 b6e351d341173dfee26f19dd74c173a1f4844873 ### 2. OK: 0dc2f03 is an ancestor of 61d408b (no history rewrite) first parent chain: d9d779b -> 0dc2f03 -> 34213e6 ### 3. Upstream commits gained: count: 12 b6e351d docs: slim quota-array-dispatch ... / 2459f77 test: stabilize tmux teardown ... / 514f0ab fix: restore stock macOS Bash 3.2 ... / fbece9c fix: adapt Grok Stop ... / fa0d85d feat: route crew dispatch using quota-window pace / 9ea1a1a fix(pi): rearm watcher ... / b29621b feat(bin): add verified pi-signed runtime adapter / a5fe1bc fix(tmux): classify bordered composers ... / 4d6992a feat(bin): add guarded Kimi turn-end wake / 39b450b fix: harden Kimi submission ... / c64ad1c feat: add verified Kimi crewmate adapter / aca3ad1 fix(tmux): scope busy detection ...

### 1. Merge commit d9d779b is a REAL merge (two parents), not a squash/rebase
commit  d9d779b2373b91455003d75595e273a85fd3ba16
subject Merge upstream/main into fork main, preserving the Cursor adapter
parents 0dc2f03ff9fab7ad309d33ac3064eee4484faf06 b6e351d341173dfee26f19dd74c173a1f4844873

### 2. Fork's previously published main tip (0dc2f03) is still an ancestor of HEAD -> no history rewrite
OK: 0dc2f03 is an ancestor of 61d408b
first parent chain of the merge:
  d9d779b Merge upstream/main into fork main, preserving the Cursor adapter
  0dc2f03 Merge pull request #1 from davidx-secco/fm/cursor-agent-adapter-j3
  34213e6 docs(agents): drop superseded interim quota-window rule (#1039)

### 3. Upstream commits gained by the merge (second-parent side, not previously in fork main)
b6e351d docs: slim quota-array-dispatch to the pace selection core (#1197)
2459f77 test: stabilize tmux teardown conformance baseline (#1209)
514f0ab fix: restore stock macOS Bash 3.2 brief scaffolding (#1093)
fbece9c fix: adapt Grok Stop continuation and harden endpoint cleanup (#1171)
fa0d85d feat: route crew dispatch using quota-window pace (#1172)
9ea1a1a fix(pi): rearm watcher across session transitions (#1166)
b29621b feat(bin): add verified pi-signed runtime adapter (#1145)
a5fe1bc fix(tmux): classify bordered composers across all rows (#1066)
4d6992a feat(bin): add guarded Kimi turn-end wake (#1059)
39b450b fix: harden Kimi submission and spinner matching (#1058)
c64ad1c feat: add verified Kimi crewmate adapter (#1047)
aca3ad1 fix(tmux): scope busy detection and recognize current Claude turns (#1049)
count: 12

### 4. Fork's own Cursor-adapter commits are still reachable from HEAD
0dc2f03 Merge pull request #1 from davidx-secco/fm/cursor-agent-adapter-j3
49df340 no-mistakes(document): sync backend and cursor harness docs with adapter behavior
dd6d8d5 no-mistakes(review): fix cursor secondmate inheritance, default-model effort, shared composer regex defaults
438256b no-mistakes(document): add cursor to firstmate-orca skill harness list
c8ea6f0 no-mistakes(review): add Cursor busy-hint short-circuit to herdr composer classifier
2eeb1aa no-mistakes(review): treat Cursor busy hint as submitted; restrict bare glyph to →
533ed92 no-mistakes(document): document Cursor composer and busy-regex env defaults
8d4a52d no-mistakes(review): make explicit Cursor model always win over effort mapping
e7757b8 add Cursor Agent crewmate adapter
bc1a21b fix(bin): repair fm-brief.sh parse error and harden set -u array expansion (#205)
c7f85d3 fix(backends): submit herdr slash commands reliably (#223)
3718fd0 fix: make composer detection ignore Claude ghost text (#59)
b7c933e feat(supervision): token-efficient sub-supervisor (closes #27) (#30)
Evidence: Merged tree still serves the Cursor adapter alongside upstream's new harnesses (CLI transcript)

$ echo cursor > config/crew-harness && bin/fm-harness.sh crew -> cursor $ echo kimi > config/crew-harness && bin/fm-harness.sh crew -> kimi $ echo pi-signed > config/crew-harness && bin/fm-harness.sh crew -> pi-signed $ echo grok > config/crew-harness && bin/fm-harness.sh crew -> grok $ bin/fm-harness.sh secondmate # crew-harness=cursor -> warning: crew-only-harness-skip: crew harness 'cursor' is a crewmate/scout-only harness and cannot back a secondmate; resolved to 'claude' instead -> claude # launch templates coexist: 460: kimi) printf '%s' 'KIMIBIN MODELFLAG--auto' ;; 465: cursor) printf '%s' 'agent --force --trust --workspace WORKSPACE MODELFLAG"$(OPINPUT encode launch-brief < BRIEF)"' ;; 511: echo "error: harness=cursor supports crewmate and scout spawns only; ..." >&2

# Merged tree resolves BOTH the fork's Cursor adapter and upstream's new adapters

$ echo cursor    > config/crew-harness && bin/fm-harness.sh crew
  -> cursor
$ echo kimi      > config/crew-harness && bin/fm-harness.sh crew
  -> kimi
$ echo pi-signed > config/crew-harness && bin/fm-harness.sh crew
  -> pi-signed
$ echo grok      > config/crew-harness && bin/fm-harness.sh crew
  -> grok

# Cursor stays crewmate/scout-only: it is never inherited as the secondmate harness
$ bin/fm-harness.sh secondmate      # crew-harness=cursor
  -> warning: crew-only-harness-skip: crew harness 'cursor' is a crewmate/scout-only harness and cannot back a secondmate; resolved to 'claude' instead (pin config/secondmate-harness to override)
  -> claude

# Cursor launch template survived the merge alongside upstream's kimi template
  460:    kimi) printf '%s' '__KIMIBIN__ __MODELFLAG__--auto' ;;
  465:    cursor) printf '%s' 'agent --force --trust --workspace __WORKSPACE__ __MODELFLAG__"$(__OPINPUT__ encode launch-brief < __BRIEF__)"' ;;

# Cursor secondmate spawn refusal (fork behavior) still present
  511:  echo "error: harness=cursor supports crewmate and scout spawns only; Cursor primary/secondmate supervision is not verified" >&2
Evidence: No upstream content dropped: every divergence from upstream tip is a fork-touched file
### Merged HEAD vs upstream tip (b6e351d): the only divergence is the fork's own Cursor/no-mistakes work
 bin/fm-bootstrap.sh                             |  30 +++-
 bin/fm-composer-lib.sh                          |  36 +++-
 bin/fm-harness.sh                               |  55 +++++-
 bin/fm-spawn.sh                                 |  55 +++++-
 bin/fm-tmux-lib.sh                              |  18 +-
 bin/fm-watch.sh                                 |  25 +--
 docs/architecture.md                            |   6 +-
 docs/cmux-backend.md                            |   5 +-
 docs/configuration.md                           |  23 ++-
 docs/cursor-agent-harness.md                    | 215 ++++++++++++++++++++++++
 docs/documentation-audiences.json               |   4 +
 docs/herdr-backend.md                           |   3 +-
 docs/orca-backend.md                            |   3 +-
 docs/tmux-backend.md                            |   3 +
 docs/verification/runtime-backends.md           |   8 +
 tests/fm-backend-cmux.test.sh                   |  43 ++++-
 tests/fm-backend-herdr.test.sh                  |  24 +++
 tests/fm-backend-orca.test.sh                   |  33 ++++
 tests/fm-bootstrap.test.sh                      |   1 +
 tests/fm-composer-lib.test.sh                   |  18 +-
 tests/fm-secondmate-harness.test.sh             |  46 ++++-
 tests/fm-secondmate-liveness.test.sh            |  56 ++++++
 tests/fm-spawn-dispatch-profile.test.sh         |  99 +++++++++++
 tests/fm-tmux-submit-busy.test.sh               |  20 +++
 34 files changed, 912 insertions(+), 104 deletions(-)

### Every upstream file blob at its tip is present unchanged in the merge, except files the fork also touched
  .agents/skills/afk/SKILL.md                   fork commits touching it: 1
  .agents/skills/bootstrap-diagnostics/SKILL.md fork commits touching it: 2
  .agents/skills/firstmate-orca/SKILL.md        fork commits touching it: 2
  .agents/skills/harness-adapters/SKILL.md      fork commits touching it: 6
  .agents/skills/secondmate-provisioning/SKILL.md fork commits touching it: 1
  AGENTS.md                                     fork commits touching it: 3
  README.md                                     fork commits touching it: 2
  bin/backends/cmux.sh                          fork commits touching it: 4
  bin/backends/herdr.sh                         fork commits touching it: 4
  bin/backends/orca.sh                          fork commits touching it: 3
  bin/fm-bootstrap.sh                           fork commits touching it: 4
  bin/fm-composer-lib.sh                        fork commits touching it: 4
  bin/fm-harness.sh                             fork commits touching it: 4
  bin/fm-spawn.sh                               fork commits touching it: 4
  bin/fm-tmux-lib.sh                            fork commits touching it: 3
  bin/fm-watch.sh                               fork commits touching it: 4
  docs/architecture.md                          fork commits touching it: 3
  docs/cmux-backend.md                          fork commits touching it: 1
  docs/configuration.md                         fork commits touching it: 7
  docs/cursor-agent-harness.md                  fork commits touching it: 7
  docs/documentation-audiences.json             fork commits touching it: 2
  docs/herdr-backend.md                         fork commits touching it: 2
  docs/orca-backend.md                          fork commits touching it: 1
  docs/tmux-backend.md                          fork commits touching it: 2
  docs/verification/runtime-backends.md         fork commits touching it: 2
  tests/fm-backend-cmux.test.sh                 fork commits touching it: 3
  tests/fm-backend-herdr.test.sh                fork commits touching it: 2
  tests/fm-backend-orca.test.sh                 fork commits touching it: 3
  tests/fm-bootstrap.test.sh                    fork commits touching it: 2
  tests/fm-composer-lib.test.sh                 fork commits touching it: 1
  tests/fm-secondmate-harness.test.sh           fork commits touching it: 3
  tests/fm-secondmate-liveness.test.sh          fork commits touching it: 3
  tests/fm-spawn-dispatch-profile.test.sh       fork commits touching it: 4
  tests/fm-tmux-submit-busy.test.sh             fork commits touching it: 2
Evidence: fm-watch busy detection after the 61d408b refactor (cursor hint, no leak, FM_BUSY_REGEX override)

harness=cursor capture="Generating... ctrl+c to stop" -> busy (want busy) harness=cursor capture="ready when you are" -> idle (want idle) harness=codex capture="Generating... ctrl+c to stop" -> idle (want idle: no cross-harness leak) harness=codex capture="MY-CUSTOM-BUSY" FM_BUSY_REGEX set -> busy (want busy: global override honored) harness=codex capture="quiet" FM_BUSY_REGEX set -> idle (want idle)

harness=cursor  capture="Esc to interrupt / ctrl+c to stop"      -> busy (want busy)
harness=cursor  capture="ready when you are"                     -> idle (want idle)
harness=codex   capture="Generating...  ctrl+c to stop"           -> idle (want idle: no cross-harness leak)
harness=codex   capture="MY-CUSTOM-BUSY" FM_BUSY_REGEX set        -> busy (want busy: global override honored)
harness=codex   capture="quiet"          FM_BUSY_REGEX set        -> idle (want idle)
Evidence: Manual verification script used for the fm-watch busy checks
#!/usr/bin/env bash
# Manual verification of bin/fm-watch.sh window_is_busy after 61d408b moved the
# watcher onto fm_busy_lines_match (bin/fm-tmux-lib.sh) and dropped its local
# BUSY_REGEX copy. Checks: (1) harness-scoped Cursor busy hint, (2) no cross-harness
# leak, (3) the documented FM_BUSY_REGEX global override still wins.
set -u
ROOT=$1
TMP=$(mktemp -d); STATE="$TMP/state"; mkdir -p "$STATE"
export FM_HOME="$TMP/home" FM_STATE_OVERRIDE="$STATE"
printf 'window=fake\nharness=cursor\n' > "$STATE/c-watch.meta"
. "$ROOT/bin/fm-watch.sh"
fm_backend_busy_state() { printf 'unknown'; }
r() { if window_is_busy fake "$1"; then printf 'busy'; else printf 'idle'; fi; }

printf 'harness=cursor  capture="Esc to interrupt / ctrl+c to stop"      -> %s (want busy)\n' "$(r 'Generating...  ctrl+c to stop')"
printf 'harness=cursor  capture="ready when you are"                     -> %s (want idle)\n' "$(r 'ready when you are')"
printf 'window=fake\nharness=codex\n' > "$STATE/c-watch.meta"
printf 'harness=codex   capture="Generating...  ctrl+c to stop"           -> %s (want idle: no cross-harness leak)\n' "$(r 'Generating...  ctrl+c to stop')"
printf 'harness=codex   capture="MY-CUSTOM-BUSY" FM_BUSY_REGEX set        -> %s (want busy: global override honored)\n' "$(FM_BUSY_REGEX='MY-CUSTOM-BUSY' r 'MY-CUSTOM-BUSY')"
printf 'harness=codex   capture="quiet"          FM_BUSY_REGEX set        -> %s (want idle)\n' "$(FM_BUSY_REGEX='MY-CUSTOM-BUSY' r 'quiet')"
rm -rf "$TMP"
Evidence: Targeted behavior-test run over merged fork+upstream surfaces
FM_TEST_END 2026-07-29T14:42:53Z tests/fm-watch-triage.test.sh exit=0 duration_ms=128239 gate_skip=false
FM_TEST_END 2026-07-29T14:42:58Z tests/fm-grok-harness.test.sh exit=0 duration_ms=5331 gate_skip=false
FM_TEST_END 2026-07-29T14:43:03Z tests/fm-composer-ghost.test.sh exit=0 duration_ms=4955 gate_skip=false
FM_TEST_END 2026-07-29T14:43:27Z tests/fm-backend.test.sh exit=0 duration_ms=23826 gate_skip=false
FM_TEST_END 2026-07-29T14:43:28Z tests/fm-documentation-audiences.test.sh exit=0 duration_ms=794 gate_skip=false
FM_TEST_END 2026-07-29T14:43:47Z tests/fm-pi-watch-extension.test.sh exit=0 duration_ms=18868 gate_skip=false
FM_TEST_END 2026-07-29T14:45:52Z tests/fm-secondmate-harness.test.sh exit=0 duration_ms=125558 gate_skip=false
FM_TEST_END 2026-07-29T14:46:11Z tests/fm-kimi-harness.test.sh exit=0 duration_ms=18397 gate_skip=false
FM_TEST_SUMMARY total=8 failed=0 skipped_gate=0 duration_ms=326268
FM_TEST_SUMMARY_FAMILY family=backend-dispatch count=1 duration_ms=23826 failed=0
FM_TEST_SUMMARY_FAMILY family=pure-contract-unit count=4 duration_ms=29477 failed=0
FM_TEST_SUMMARY_FAMILY family=secondmate count=1 duration_ms=125558 failed=0
FM_TEST_SUMMARY_FAMILY family=watcher-wake-lock count=2 duration_ms=147107 failed=0

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

⏭️ **Rebase** - skipped

Step was skipped.

🔧 **Review** - 4 issues found → auto-fixed ✅
  • ⚠️ AGENTS.md:161 - The conflict resolution kept the fork's phrase "verified primary harnesses" but adopted upstream's list, which includes kimi. Kimi is explicitly NOT a primary harness: docs/configuration.md:180 (upstream side of the same merge) says the list is "empirically verified for crewmate and secondmate launches" and defers the primary set to README, and README:61 lists only Claude Code, Grok, Pi, pi-signed, Codex, OpenCode. The harness-adapters skill likewise states "Kimi is outside the primary turn-end guard scope." AGENTS.md is the always-loaded operating contract, so this line can authorize firstmate to run its primary session on a harness with no verified turn-end guard or watcher integration. Suggested fix: restore upstream's "The verified harnesses are ..." wording while keeping the appended cursor clause.
  • ⚠️ docs/cursor-agent-harness.md:66 - This fork-only doc was not touched by the merge and now contradicts it. Line 66 says "tmux uses the shared busy regex and cursor-row composer classifier" — tmux now selects a harness-scoped signature via fm_busy_lines_match (bin/fm-tmux-lib.sh:98) and reads the composer through the structural box scan fm_tmux_find_composer_box, with the cursor-row read only as a fallback. Line 67 points at a "shared tmux/Pi generic-interpreter gap" in verification/runtime-backends.md, but the merge deliberately narrowed that claim to Cursor alone (runtime-backends.md:35, docs/tmux-backend.md) because upstream now attributes Pi via the exact pi-launcher foreground command. A reader following the link gets the opposite statement from the file it cites.
  • ℹ️ docs/cursor-agent-harness.md:78 - "The existing five primary harness integrations" is stale after the merge: the primary turn-end guard set is now six (claude, codex, opencode, pi, pi-signed, grok) per .agents/skills/harness-adapters/SKILL.md, with Kimi tracked separately. The surrounding claim (Cursor is refused for secondmate launches, primary integrations unchanged) still holds; only the count is wrong.
  • ℹ️ bin/fm-watch.sh:118 - BUSY_REGEX is now dead except as an alias for FM_BUSY_REGEX: window_is_busy (bin/fm-watch.sh:184-188) uses it only inside the [ -n &#34;${FM_BUSY_REGEX:-}&#34; ] branch, so the :-$FM_COMPOSER_BUSY_REGEX_DEFAULT default is unreachable, and fm_busy_lines_match already honors FM_BUSY_REGEX first with identical semantics. The whole if/else can collapse to printf &#39;%s&#39; &#34;$lines&#34; | fm_busy_lines_match &#34;$harness&#34; and the BUSY_REGEX assignment dropped. No behavior change; removes a second, drifting copy of the override rule.

🔧 Fix: fix AGENTS harness wording, cursor docs, watcher busy regex
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • git log -1 --format=&#39;%H %P&#39; d9d779b — confirmed two parents (real merge, not squash/rebase)
  • git merge-base --is-ancestor 0dc2f03 HEAD and first-parent walk — confirmed no rewrite of published fork main
  • git rev-list --count 0dc2f03..d9d779b^2 → 12, with git log --oneline 0dc2f03..d9d779b^2 listing each upstream commit
  • git diff --stat b6e351d HEAD plus per-file git log b6e351d..HEAD -- &lt;file&gt; — every divergence from upstream tip is a fork-authored file
  • Manual CLI transcript: bin/fm-harness.sh crew / secondmate under FM_CONFIG_OVERRIDE for crew-harness=cursor|kimi|pi-signed|grok
  • Manual verification script exercising sourced bin/fm-watch.sh window_is_busy for cursor busy hint, codex non-leak, and FM_BUSY_REGEX override (/var/folders/.../watch-busy-check.sh)
  • bin/fm-test-run.sh tests/fm-spawn-dispatch-profile.test.sh tests/fm-secondmate-harness.test.sh tests/fm-composer-lib.test.sh tests/fm-tmux-submit-busy.test.sh tests/fm-kimi-harness.test.sh tests/fm-quota-array-dispatch.test.sh
  • bin/fm-test-run.sh tests/fm-watch-triage.test.sh tests/fm-grok-harness.test.sh tests/fm-composer-ghost.test.sh tests/fm-backend.test.sh tests/fm-documentation-audiences.test.sh tests/fm-pi-watch-extension.test.sh tests/fm-secondmate-harness.test.sh tests/fm-kimi-harness.test.sh (clean env + python3.11 shim) — 8/8 pass
  • git status --porcelain — worktree clean, no transient artifacts left behind
⚠️ **Document** - 1 info
  • ℹ️ README.md:76 - Judgment call left unresolved: README's "Recommended harnesses" names Cursor Agent as a crewmate/scout-only runtime but never mentions Kimi, which the merge added and which docs/configuration.md records as verified for crewmate and secondmate launches. Nothing in README is factually false (its Requirements list is scoped to primary harnesses, which correctly excludes Kimi), so a reader can still wrongly infer the crewmate set is the primary set plus Cursor. I did not edit it because upstream deliberately left Kimi out of README across both Kimi commits, and adding a fork-only sentence would widen divergence with no fork-specific reason. Worth deciding whether to raise upstream instead.
✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

kunchenguid and others added 15 commits July 25, 2026 18:12
…1049)

* fix(tmux): scope Claude busy detection by harness

* no-mistakes(review): Separate verified and fallback busy signatures

* no-mistakes(test): Scope busy signatures to supplied harnesses

* no-mistakes(document): Document harness-scoped busy detection
* Add verified Kimi crewmate harness adapter

* no-mistakes(review): Scope Kimi moon detection to spinner lines

* no-mistakes(review): Match only complete Kimi spinner rows

* no-mistakes(review): Resolve Kimi binary portably before pane creation

* no-mistakes(document): Align Kimi adapter documentation

* no-mistakes(lint): Suppress false-positive ShellCheck warning for sourced watcher override

* Fix Kimi busy spinner detection

* no-mistakes(review): Recognize Kimi session-lock ancestry and holders

* no-mistakes(review): Scope pending-reply Kimi busy detection by harness

* no-mistakes(document): Correct Kimi spinner capture documentation

* no-mistakes(document): Clarify optional Kimi spinner whitespace

* no-mistakes(lint): Silence intentional pending-reply test stub warnings

* test: align rebased Kimi busy fixtures

* no-mistakes: apply CI fixes

* Reconcile Kimi busy detection after per-harness scoping

* no-mistakes(review): Clarify observed Kimi spinner whitespace contract

* no-mistakes(document): Clarify Kimi harness documentation
* fix kimi pointer submission and spinner conformance

* no-mistakes(review): Preserve Kimi submit target ownership guard
* Add guarded Kimi turn-end hook

* no-mistakes(review): Require jq before installing Kimi turn-end hook

* no-mistakes(review): Expose jq inside isolated Kimi test fixtures

* no-mistakes(review): Preserve Kimi config boundaries during hook removal

* no-mistakes(review): Document Kimi removal newline safeguard

* no-mistakes(document): Document Kimi shared-home preservation
* Fix structural tmux composer reading

* Verify Calm compatibility with Pi 0.82

* no-mistakes(review): Harden structural composer classification boundaries

* no-mistakes(review): Refresh composer and Kimi regression fixtures

* no-mistakes(review): Fail closed on unbounded composer edges

* no-mistakes(review): Enforce aligned composer geometry safely

* no-mistakes(review): Make composer ambiguity locale-safe

* no-mistakes(review): Preserve ambiguity through composer submission

* no-mistakes(review): Carry composer proof through retries

* no-mistakes(document): Document structural tmux composer delivery guarantees

* no-mistakes: apply CI fixes
* feat: add verified pi-signed adapter

* no-mistakes(review): Correct pi-signed maintainer verification date

* no-mistakes(review): Correct remaining pi-signed verification dates

* no-mistakes(review): Preserve authoritative pi-signed runtime identity

* no-mistakes(document): Document pi-signed shared adapter semantics

* no-mistakes: apply CI fixes
* fix(pi): rearm watcher across same-process session transitions

Pi emits session_shutdown for ordinary /new, /resume, and /fork replacement
as well as terminal quit. The primary watcher extension latched a module-level
stopping flag on every shutdown, so a replacement session in the same process
could not arm monitoring until Pi restarted.

Own arm authority per session generation so only the active live generation
may start, stop, or rearm the child. Replacement sessions can arm again without
restarting Pi, stale prior-generation callbacks cannot mutate the active cycle,
and real quit still blocks late rearm.

* no-mistakes(review): Preserve Pi generation isolation and exit cleanup

* no-mistakes(document): Correct Pi watcher transition documentation
* Consume quota-axi pace signals in dispatch profile array selection.

Add quota-array-dispatch as the single owner of the pace-aware candidate
choice, keep AGENTS.md to the intake boundary and load trigger, and cover
the acceptance cases with sanitized schemaVersion 3 fixtures.

* no-mistakes(review): Stop and report genuine quota dispatch ties

* no-mistakes(document): Document quota pace freshness and uncertainty
* fix(grok): adapt Stop continuation to runtime capability

* no-mistakes(review): Reject ambiguous Grok Stop payloads

* no-mistakes(review): Reject duplicate Grok fields and accept spaced tmux sessions

* no-mistakes(review): Enforce exact tmux cleanup selectors

* no-mistakes(test): Fix historical tmux fixture and validate Grok Stop

* no-mistakes: apply CI fixes
* fix(brief): make DOD scaffolding parse-safe on stock macOS Bash 3.2

fm-brief.sh built each Definition-of-done block and the not-enabled
Herdr declaration with `VAR=$(cat <<EOF ... EOF)`. On Bash 3.2 (macOS
/bin/bash) the lexer scans for the command substitution's closing `)`
textually and tracks quote state through the heredoc body, so a single
apostrophe, unbalanced quote, or unbalanced paren in that prose breaks
parsing of the whole script. Every ship-brief scaffold (no-mistakes,
direct-PR, local-only) failed with `unexpected EOF while looking for
matching )`. Bash 4+ parses it fine, so the breakage stayed invisible
everywhere except stock macOS.

Replace all four command-substitution heredocs with
`IFS= read -r -d '' VAR <<EOF || true`. That removes the `$(...)`
wrapper and the entire defect class regardless of future prose, and
preserves the variable expansion the direct-PR and local-only bodies
need. `read` keeps the heredoc's trailing newline that `$(...)` used to
strip, so trim one newline to keep every generated brief byte-identical
to prior output.

Guard the structure, not one historical phrase: a new test rejects any
heredoc nested in a command substitution anywhere in fm-brief.sh, where
the old assertion pinned a single apostrophe phrase and so missed the
reintroduction. Extend the stock-macOS Bash CI job from parsing one
script to the whole maintained shell surface (bin/*.sh,
bin/backends/*.sh, tests/*.sh), matching bin/fm-lint.sh's canonical file
set so parse scope and lint scope cannot drift apart.

* no-mistakes(review): Captain: harden Bash structure and inventory guards

* no-mistakes(document): Align stock macOS Bash contributor checks

* no-mistakes(lint): Suppress deliberate SC2016 literal fixture warnings
* fix(test): pin teardown tmux baseline to historical kill selectors

merge-base HEAD main collapses to HEAD after the exact-selector change
lands on the default branch, so the old teardown fixture was accidentally
exercising current exact targets. Resolve a content-historical permissive
tmux adapter from first-parent history and force that post-squash topology
inside the conformance case so main and feature branches keep the same
old-vs-new contract.

* no-mistakes(lint): Suppress intentional literal-pattern ShellCheck warnings
Cut the runtime skill to the compact pace-aware selection procedure plus
minimum owner pointers. Keep every distinct decision rule and move expanded
acceptance scenarios to deterministic fixture ownership assertions.

Size: 170/1374/10187 -> 63/544/4068 (about 63%/60%/60% reduction).
Brings in upstream's 12 commits (quota-window crew dispatch #1172, pi-signed
adapter #1145, Kimi adapter #1047/#1058/#1059, tmux composer and busy-detection
rework #1049/#1066, Grok Stop continuation #1171, Bash 3.2 brief scaffolding
#1093, docs/tests #1197/#1209) alongside this fork's Cursor crewmate adapter.

Fifteen files conflicted. Every resolution keeps both sides' behavior:

- Harness lists across AGENTS.md, fm-harness.sh, fm-spawn.sh, fm-bootstrap.sh
  and the skills now carry pi-signed and kimi as verified primary harnesses plus
  cursor as the crewmate/scout-only adapter.
- fm-tmux-lib.sh takes upstream's harness-scoped busy signatures and structural
  composer box scan, and adds FM_TMUX_CURSOR_BUSY_REGEX_DEFAULT with its
  fm_busy_lines_match case. Without that case cursor would fall through to the
  unregistered-harness branch and never be classified busy. The unscoped
  fallback and the idle set stay aliases of the shared owner in
  fm-composer-lib.sh, so the fleet-wide signature still has one place.
- fm-watch.sh keeps upstream's harness-scoped selection while sourcing its
  unscoped fallback from that same shared owner.
- fm-spawn.sh keeps both launch templates and both pre-launch refusals: the
  crewmate-only cursor secondmate refusal and the pi-signed PATH check.
- The primary turn-end guard section takes upstream's enumerated hook list,
  because kimi is a verified primary harness deliberately outside that scope, so
  the fork's "every verified primary harness" phrasing would no longer be true.
- docs/tmux-backend.md and docs/verification/runtime-backends.md take upstream's
  newer Pi Launcher evidence, which supersedes the fork's claim that Pi is an
  unattributable generic node process. The same claim still holds for Cursor and
  is kept, scoped to Cursor alone.

harness-adapters now also tells a new-adapter verifier to register the scoped
tmux signature, not just the shared one, since the scoped set is a second place
a missing signature silently disables busy detection.
@davidx-secco davidx-secco changed the title Sync with upstream firstmate: merge upstream/main, preserving the Cursor adapter feat(bin): merge upstream firstmate while preserving the Cursor adapter Jul 29, 2026
@davidx-secco
davidx-secco merged commit 747cf89 into main Jul 29, 2026
10 of 11 checks passed
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.

3 participants