Repository navigation
feat(bin): merge upstream firstmate while preserving the Cursor adapter - #2
Merged
Merged
Conversation
…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.
…er, and harness-count docs
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.
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
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 inbin/fm-tmux-lib.sh.docs/cursor-agent-harness.mdclaims about tmux busy matching, the narrowed generic-interpreter gap, and the primary harness count, and collapsed the now-redundantBUSY_REGEXalias inbin/fm-watch.shontofm_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 ...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; ..." >&2Evidence: No upstream content dropped: every divergence from upstream tip is a fork-touched file
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)Evidence: Manual verification script used for the fm-watch busy checks
Evidence: Targeted behavior-test run over merged fork+upstream surfaces
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 includeskimi. 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 viafm_busy_lines_match(bin/fm-tmux-lib.sh:98) and reads the composer through the structural box scanfm_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 exactpi-launcherforeground 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_REGEXis now dead except as an alias forFM_BUSY_REGEX:window_is_busy(bin/fm-watch.sh:184-188) uses it only inside the[ -n "${FM_BUSY_REGEX:-}" ]branch, so the:-$FM_COMPOSER_BUSY_REGEX_DEFAULTdefault is unreachable, andfm_busy_lines_matchalready honorsFM_BUSY_REGEXfirst with identical semantics. The whole if/else can collapse toprintf '%s' "$lines" | fm_busy_lines_match "$harness"and theBUSY_REGEXassignment 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='%H %P' d9d779b— confirmed two parents (real merge, not squash/rebase)git merge-base --is-ancestor 0dc2f03 HEADand first-parent walk — confirmed no rewrite of published fork maingit rev-list --count 0dc2f03..d9d779b^2→ 12, withgit log --oneline 0dc2f03..d9d779b^2listing each upstream commitgit diff --stat b6e351d HEADplus per-filegit log b6e351d..HEAD -- <file>— every divergence from upstream tip is a fork-authored fileManual CLI transcript:bin/fm-harness.sh crew/secondmateunder FM_CONFIG_OVERRIDE for crew-harness=cursor|kimi|pi-signed|grokManual verification script exercising sourcedbin/fm-watch.shwindow_is_busyfor 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.shbin/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 passgit status --porcelain— worktree clean, no transient artifacts left behindREADME.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.