Skip to content

Latest commit

 

History

History
51 lines (49 loc) · 10.3 KB

File metadata and controls

51 lines (49 loc) · 10.3 KB

The bin/ toolbelt

The first mate drives these; interactive entrypoints work by hand too, while *-lib.sh files are sourced helpers. Each file also starts with a short header comment.

Script Description
fm-session-start.sh The one command AGENTS.md sections 3 and 5 run at every session start: composes fm-lock.sh, fm-bootstrap.sh (its three mutating sweeps gated on holding the lock via FM_BOOTSTRAP_DETECT_ONLY), and fm-wake-drain.sh, then prints a full context digest (data/projects.md, data/secondmates.md, data/captain.md, data/learnings.md, each ABSENT-marked when missing) and fleet-state digest (data/backlog.md, every state/*.meta, a bounded state/*.status tail, state/.afk, and a cheap per-task endpoint-liveness read); prints a loud read-only banner and skips every mutating step when the lock is held elsewhere; never arms the watcher itself
fm-bootstrap.sh Detect required toolchain and version problems, dispatch profile JSON errors or active-rule blocks, default backlog-backend status, primary-checkout TANGLE: problems, and actionable clone refresh outcomes; refresh project clones best-effort; locally sync live secondmate homes and propagate declared inheritable config; set up opt-in X mode; install tools only after consent; FM_BOOTSTRAP_DETECT_ONLY=1 skips the three mutating sweeps and prints advisory-only TANGLE: wording without a checkout command
fm-fleet-sync.sh Fetch clones, fast-forward safe default-branch states, self-heal clean detached ancestor drift, report unsafe drift as STUCK:, and safely prune branches whose remote is gone
fm-update.sh Self-update the running firstmate repo and registered secondmate homes with fast-forward-only pulls from origin
fm-backlog-handoff.sh Move already-judged in-scope queued backlog items from the main home into a seeded secondmate home
fm-brief.sh Scaffold a ship brief with a worktree-isolation assertion, a report-only scout brief with --scout, or a secondmate charter with --secondmate
fm-ensure-agents-md.sh Ensure project AGENTS.md is the real memory file and CLAUDE.md symlinks to it
fm-guard.sh Warn when the primary checkout is tangled, when queued wakes are pending, or when a stale or missing watcher needs a prominent banner; FM_GUARD_READ_ONLY=1 keeps the alarms but suppresses drain, arm, and checkout repair commands
fm-home-seed.sh Lease/provision a secondmate home transactionally, clone projects, initialize gates, and maintain data/secondmates.md
fm-spawn.sh Spawn one task, several id=repo pairs, or a persistent secondmate with --secondmate; accepts concrete --harness, --model, --effort, and --backend axes; ship/scout spawns require an explicit resolved harness when dispatch profiles are active and an isolated treehouse worktree, install per-harness turn-end signaling, and secondmate spawns resolve the secondmate harness plus optional config/secondmate-harness model/effort tokens, locally sync the home, propagate declared inheritable config, and land herdr tabs in the target home's workspace before launch
fm-backend.sh Runtime session-provider backend selector with explicit/env/config/runtime auto-detection precedence, meta helper, selector resolver, and operation dispatcher; defaults absent backend= meta to tmux; fm_backend_target_exists is a cheap read-only alive/dead endpoint check that never starts a server or session
backends/tmux.sh Verified tmux session-provider adapter used by fm-backend.sh; owns create, send, capture, current-path, live-window, and kill primitives
backends/herdr.sh Experimental herdr session-provider adapter used by fm-backend.sh; owns version/tool gating, per-home workspace/tab creation, session-scoped CLI calls, send, capture, native busy-state, current-path, label-based live discovery, and kill primitives
fm-config-push.sh Config-only mid-session push of declared inheritable local config into live secondmate homes; reports each item as pushed, unchanged, skipped, or error without fast-forwarding tracked files or nudging agents
fm-project-mode.sh Resolve a project's delivery mode and +yolo flag from data/projects.md
fm-merge-local.sh Fast-forward a local-only project's local default branch after approval
fm-review-diff.sh Review a crewmate branch against the authoritative base, with optional --stat output
fm-marker-lib.sh Shared from-firstmate request marker and detector sourced by fm-send.sh, fm-brief.sh, and tests
fm-watch-arm.sh Verified per-home watcher re-arm; reports started, healthy, or FAILED; --restart relaunches only this home's watcher
fm-watch.sh Singleton-safe always-on watcher and default pull-based event source; uses backend-native busy state when available before the shared regex fallback, absorbs no-verb signal and stale wakes only when the crew is provably working, queues and exits for actionable wakes, and reverts to daemon-owned one-shot behavior while state/.afk exists
fm-supervise-daemon.sh Presence-gated sub-supervisor for walk-away (/afk) supervision: wraps fm-watch.sh, uses the shared wake classifier and backend-aware stale rechecks, self-handles routine wakes in bash, and escalates only captain-relevant events as one verified, batched, single-line digest prefixed with a sentinel marker
fm-crew-state.sh Print one stable current-state line for a crew by reconciling its matching no-mistakes run-step, even when the pane has closed, with backend-aware pane and status-log fallback
fm-tangle-lib.sh Shared default-branch resolution and primary-checkout tangle classification sourced by bootstrap and guard
fm-ff-lib.sh Shared guarded fast-forward helper for /updatefirstmate origin pulls and no-fetch local secondmate syncs
fm-config-inherit-lib.sh Shared primary->secondmate inheritable-config propagation (a declared, extensible item list - currently config/crew-dispatch.json, config/crew-harness, and config/backlog-backend) sourced by spawn, bootstrap, and config push
fm-tasks-axi-lib.sh Shared backlog-backend selector and tasks-axi compatibility probe sourced by bootstrap and teardown
fm-wake-drain.sh Atomically drain queued watcher wakes before handling supervision work, then run the watcher-liveness guard
fm-wake-lib.sh Shared durable wake queue and portable lock helpers sourced by the watcher, drain, arm, guard, and daemon
fm-classify-lib.sh Shared captain-relevant wake classifier sourced by the watcher and daemon, plus the watcher's provably-working predicate
fm-send.sh Send one verified literal line (or --key Escape) through the target's recorded runtime backend; exits non-zero on confirmed swallowed Enter; bare kind=secondmate targets are marked as from-firstmate; slash commands and codex $... skill invocations get popup-settle before Enter; text sends pause FM_SEND_SETTLE seconds after success
fm-tmux-lib.sh Shared tmux pane primitives for busy detection, dim-ghost-aware and border-aware composer detection, and verified submit retry
fm-peek.sh Print a bounded tail of a crewmate endpoint through the target's recorded runtime backend
fm-pr-check.sh Record pr= and GitHub's pr_head= when available for a PR-ready task, then arm the watcher's merge poll
fm-pr-merge.sh Require a full GitHub PR URL, record pr= and available pr_head= via fm-pr-check.sh, parse it into gh-axi pr merge <n> --repo <owner>/<repo>, default to --squash unless a merge method is forwarded, and reject malformed URLs or repo overrides
fm-promote.sh Promote a scout task in place so it becomes a protected ship task
fm-teardown.sh Return a clean, landed ship worktree or retire/release a secondmate home; requires scout reports, checks child work, removes firstmate-owned hook artifacts, and prints the backlog-backend reminder
fm-harness.sh Detect the running harness; resolve the effective crewmate (crew) or secondmate-launch (secondmate) harness; expose optional config/secondmate-harness model and effort tokens with secondmate-model and secondmate-effort
fm-lock.sh Per-home firstmate session lock
fm-x-lib.sh Shared X-mode .env, alternate env-file, relay, dry-run config, reply-thread splitting, outbound image payloads, and task-to-X-request meta-link helpers
fm-x-poll.sh Do one bounded X relay poll; without FMX_PAIRING_TOKEN it is silent, with a pending mention it stashes the full inbox JSON, including in_reply_to, and prints x-mention <request_id>
fm-x-reply.sh Post or dry-run preview a composed public-safe X answer or --followup, auto-splitting long text into {request_id,text,texts} threads and optionally attaching --image <path> to the opener; reads text from an argument, stdin, or --text-file
fm-x-dismiss.sh Dismiss or dry-run preview a skipped X mention without replying by sending {request_id} to the relay's connector/dismiss endpoint
fm-x-link.sh Link a spawned task to its originating X mention by recording x_request= and x_request_ts= in state/<id>.meta
fm-x-followup.sh Detect, post, and clear the single completion follow-up for an X-linked task, forwarding optional --image <path>, enforcing the local 24h window, and retrying only when the relay post fails