feat(bin): add fm-orchestrator.sh and fm-relaunch.sh for crewmate session resume#896
Open
imemdev wants to merge 5 commits into
Open
feat(bin): add fm-orchestrator.sh and fm-relaunch.sh for crewmate session resume#896imemdev wants to merge 5 commits into
imemdev wants to merge 5 commits into
Conversation
…trigger Registers a launchd LaunchAgent with no RunAtLoad/StartInterval/ StartCalendarInterval/watch-path key, so the job can only fire via an explicit launchctl call, never on its own. install/status/uninstall/run manage the job; run kickstarts it, which opens claude in a terminal and drives the trust-dialog and first-message handshake needed to actually trigger session-start. Supersedes the ad hoc dev.firstmate.relaunch prototype on the captain's machine by reusing its label.
Second, distinct launchd job (allowed a real StartInterval, unlike fm-relaunch.sh's deliberately trigger-free one) that fires `fm-relaunch.sh run` only when no firstmate session already holds the lock AND real pending work exists (wake queue, a stalled task with a dead backend endpoint, or an unblocked queued backlog item), then self-throttles via a cooldown file so a fast-failing relaunch can't tight-loop. Closes the gap where a shared account spend/usage limit stalls the whole fleet overnight with no one awake to notice it clear.
…ls, propagate error
…estrator.sh in inventory
…d on failed fire too
imemdev
force-pushed
the
fm/fm-orchestrator-tool
branch
from
July 23, 2026 10:59
510e098 to
44fd6c2
Compare
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
Add bin/fm-orchestrator.sh, a firstmate helper script for orchestrating multiple crewmate sessions. Code already went through a local no-mistakes review/test/lint/document cycle by the original author; final commit updated docs/scripts inventory to list both fm-relaunch.sh and fm-orchestrator.sh. Re-validating now only to push through the required no-mistakes gate (this fork/PR channel skipped that step originally).
What Changed
bin/fm-relaunch.sh, an on-demand session-resume helper with no auto-trigger.bin/fm-orchestrator.sh, a recurring watchdog that resumes crewmate sessions and records a cooldown timestamp even when the underlyingfm-relaunch.shrun fails, propagating the error rather than swallowing it.tests/fm-orchestrator.test.shandtests/fm-relaunch.test.sh, plus docs (docs/orchestrator-tool.md,docs/relaunch-tool.md) and an updateddocs/scripts.mdinventory listing both new scripts.Risk Assessment
✅ Low: Self-contained macOS-only shell tool with two independent safety gates (session-liveness + pending-work), cooldown throttle, no billing/network side effects, matching docs and tests added, and final commit correctly lists both scripts in docs/scripts.md per user intent.
Testing
Ran both dedicated test suites: fm-orchestrator.test.sh 16/16 pass covering install/uninstall/status/check-trigger logic including cooldown and stall detection; fm-relaunch.test.sh 13/13 pass covering install/run/uninstall/no-auto-trigger guarantees. Confirmed docs/scripts.md and docs/orchestrator-tool.md reference fm-orchestrator.sh per the final commit intent. No code changes needed. No product-level visual artifact produced since this is a headless bash CLI tool with no UI surface; CLI test transcripts serve as evidence.
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
bash tests/fm-orchestrator.test.shbash tests/fm-relaunch.test.shgrep -rl fm-orchestrator docs/✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.