Skip to content
This repository was archived by the owner on Nov 5, 2026. It is now read-only.

feat(bin): add Antigravity (agy) adapter and ancestry-first harness detection - #8

Merged
auss merged 13 commits into
mainfrom
fm/fm-upstream-rebase
Sep 14, 2026
Merged

auss merged 13 commits into
mainfrom
fm/fm-upstream-rebase

Conversation

@auss

@auss auss commented Sep 13, 2026 •

Copy link
Copy Markdown
Owner

What Changed

  • Added the Antigravity CLI (agy) as a verified crewmate/scout adapter: spawn-time worktree trust pre-registration via the new bin/fm-agy-trust.sh, agy models-backed model validation in the launch path, busy/composer detection with ghost-text stripping, and a longer typed-send submit budget for agy targets.
  • Reworked harness detection in bin/fm-harness.sh so verified structural ancestry outranks environment markers, preventing a retained marker (e.g. a stale CLAUDECODE=1 replayed by a terminal multiplexer) from misidentifying a markerless harness like Codex as claude and blocking turn ends; added ancestry/ancestry-descent evidence subcommands and fixed the session-lock walk inside PID namespaces.
  • Added a /quiet supervision mode (away/quiet mode line in state/.afk, read by fm_afk_mode() in bin/fm-wake-lib.sh) that keeps the sub-supervisor daemon running while the captain stays present and exits only on explicit /quiet off.
  • Shipped reliability fixes: fm-procevent-when.sh rebind-all (run by bin/fm-update.sh) re-hashes in-repo watch trust bindings after a self-update so armed watches keep firing, spawned Claude workers get the external CLAUDE.md import dialog pre-approved instead of wedging on it, and an acked watcher-down marker no longer reports a false gap on /afk return.

Risk Assessment

✅ Low: The delta since the last reviewed head is one verified, behaviorally-tested one-line fix that matches its prescription exactly; the remainder of the branch was fully reviewed in round 1 with every material concern fixed or explicitly dispositioned.

Testing

Drove live and passed, with artifacts: the complete --help output after the head commit's usage() fix (with the pre-fix mid-sentence truncation reproduced for contrast), a real condition->action live fire (arm -> reconcile -> effect -> captured terminal outcome document), the real agy CLI signals drift guard (busy render, prompt processing, Escape cancel, /quit exit), and the primary-resource handover end-to-end in the live Herdr lab. Every other targeted area of the range was covered only by bin/fm-test-run.sh unit suites, which the prior run reported as passing but which are not live evidence under this contract; those scenarios are therefore downgraded to untested. Establishing them requires a live drive of each: a real self-update rebind check, a real agy session exercising the composer-verdict/typed-send/spinner surfaces, a real quiet/away supervision launch and stop plus an AFK return, live primary-resource decision-logic and brief-scaffold runs, a live claude worker spawn with real session-lock checks, and a live session start observing the nudge.

  • Live validation: ⚠️ inconclusive - 4 of 12 scenarios driven live against the product
Scenario Result Live Evidence
fm-procevent-when.sh --help prints the complete usage after the header grew: full run entry sentence and the entire Outcome-document block (the head commit ed01f60 fixes the truncation b405338 introdu… ✅ pass live Manual invocation of bin/fm-procevent-when.sh --help on target vs pre-fix 6c93849; artifact procevent-when-help-before-after.txt
A captain arms a condition->action watch and the generic runner fires the real action exactly once, capturing one terminal outcome document (status: fired, condition_polls, action_exit) with a durable… ✅ pass live Manual live drive with real condition/action scripts, no fixtures; artifact procevent-when-live-fire.txt
After a self-update rebinds trust bindings, an in-repo watch keeps firing while an out-of-repo action and mutated action bytes are still refused (rebind-all contract) ⏸️ untested no The prior payload recorded only bin/fm-test-run.sh runs of the unit suites tests/fm-procevent-when.test.sh and tests/fm-update.test.sh with live=false; a unit-suite run is not a live drive, so no live…
The agy adapter drives the real Antigravity CLI: busy footer matches the classifier in flight, launch prompt is processed, a single Escape cancels the turn, /quit stops the process ✅ pass live FM_AGY_SIGNALS_LIVE=1 bash tests/fm-agy-signals-live-e2e.test.sh against the real agy binary and real tmux; artifact agy-signals-live-e2e.txt
agy harness surface restored by 6c93849: composer-verdict subsystem, typed-send confirmation budgets, and the 1.2.2 spinner status-row signature behave as specified ⏸️ untested no The prior payload recorded only the unit suites tests/fm-agy-harness.test.sh and tests/fm-send-agy-confirm.test.sh with live=false; the separate live signals e2e drove the real CLI but not these surfa…
Quiet/away supervision: a pending proposal cannot bypass captain confirmation, the daemon runs in a separate non-visible workspace with one serialized terminal, and stop cleans record, flag, and termi… ⏸️ untested no The prior payload recorded only the ancestry-neutral run of the unit suite tests/fm-afk-launch.test.sh with live=false; even though that suite's e2e units invoke real herdr and tmux, the payload did n…
AFK return: an already-acked watcher-down marker is not re-reported as an open gap in the return brief ⏸️ untested no The prior payload recorded only the unit suite tests/fm-afk-return.test.sh with live=false; no live return-brief drive was recorded. Provide a live drive: ack a watcher-down marker in the real product…
Main-session handover: on the real Herdr CLI, check proposes the context handover, commit creates the helper's workspace pane, the occupant is proven, /exit is delivered, the successor launches, and t… ✅ pass live FM_PRIMARY_RESOURCE_HERDR_LAB_E2E=1 bash tests/fm-primary-resource-herdr-lab-e2e.test.sh; artifact primary-resource-herdr-lab-e2e.txt
Primary-resource decision logic: context/quota thresholds, precedence, immutable receipt reservation, and refuse-on-uncertain-reading behave as specified ⏸️ untested no The prior payload recorded only the unit suite tests/fm-primary-resource.test.sh with live=false for these decision behaviors; the live Herdr lab run covered the handover flow but was not recorded as…
Generated ship/scout briefs carry the poteto-mode section by default; config 'off' omits it and any other value refuses the scaffold ⏸️ untested no The prior payload recorded only the unit suite tests/fm-brief.test.sh with live=false; no live scaffold of a real ship/scout brief was recorded. Provide a live run of the scaffold command against the…
Spawned claude workers get the external CLAUDE.md import dialog pre-approved, and verified harness ancestry outranks retained identity markers for session-lock decisions ⏸️ untested no The prior payload recorded only the unit suites tests/fm-claude-trust.test.sh, tests/fm-harness-precedence.test.sh, and tests/fm-session-lock-ancestry.test.sh with live=false; no live spawn of a claud…
Session-start nudge behavior after the rebase ⏸️ untested no The prior payload recorded only the unit suite tests/fm-sessionstart-nudge.test.sh with live=false; no live session start against the real product was recorded. Provide a live session start and captur…
Evidence: procevent-when --help before/after the usage() range fix

Source: procevent-when --help before/after the usage() range fix

== bin/fm-procevent-when.sh --help : pre-fix (6c93849, range '2,72p') last lines ==
-- truncated mid-sentence in the run entry; Outcome-document block missing --
           a restart or re-poll can never fire the action twice, runs the
           action bounded, and emits exactly one outcome document on stdout
           for durable capture. Every failure path - mutated spec, condition

== target (ed01f60, range '2,88p') last lines ==
-- run entry complete; Outcome-document block complete --
           retrying silently, so firstmate is always woken with the evidence.

Outcome document (the captured result named by the wake):
  when: <source-id>
  status: fired|action-failed|condition-error|never-true|ambiguous|rejected
  detail: <one line>
  condition_polls: <n>
  action_exit: <code>        (fired and action-failed only)
  output:
  <bounded tail of the relevant command output>

Ownership, durable capture, publication, restart recovery, and the handled
acknowledgement all belong to bin/fm-procevent.sh; this adapter owns only the
condition->action semantics above.

line counts: pre-fix=75 target=87
Evidence: when-adapter manual live fire: arm -> reconcile -> effect -> captured outcome document -> classify/terminal

Source: when-adapter manual live fire: arm -> reconcile -> effect -> captured outcome document -> classify/terminal

== manual live drive: condition->action adapter, real processes, no fixtures ==
$ FM_HOME=livehome bin/fm-procevent-when.sh arm live-fire --interval 0.2 --stable 1 --deadline 30 --condition cond.sh --action act.sh
when-live-fire
$ bin/fm-procevent.sh reconcile -> started=1
$ cat effect (action side effect, fired exactly once):
effect at 2026-09-14T13:38:39Z
$ cat state/procevent-inbox/when-live-fire.1.result:
when: when-live-fire
status: fired
detail: the condition held and the action exited 0
condition_polls: 1
action_exit: 0
output:
$ classify -> fired
$ terminal -> rc0 (every when outcome is terminal)
$ durable fired marker:
when-live-fire.fired
Evidence: real agy CLI live drift guard (busy footer, prompt, Escape, /quit)

Source: real agy CLI live drift guard (busy footer, prompt, Escape, /quit)

ok - the real agy busy footer matches fm_busy_agy_tail_busy in flight
ok - the real agy worker processed its launch prompt
ok - a single Escape cancels the real agy turn
ok - /quit stops the real agy process
Evidence: primary-resource live Herdr lab handover end-to-end

Source: primary-resource live Herdr lab handover end-to-end

ok - live Herdr lab handover: check->commit->helper->successor, default untouched
- Outcome: ⚠️ 2 issues (1 warning, 1 info) across 1 run (24m56s)

Pipeline

Updates from git push no-mistakes

⏭️ **intent** - skipped

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 2 issues found → auto-fixed ✅
  • ⚠️ bin/fm-procevent-when.sh:110 - Commit b405338 added 16 header lines (the rebind-all block) above set -u but left usage()'s sed -n &#39;2,72p&#39; range untouched. fm-procevent-when.sh --help and every usage exit now truncate the run entry mid-sentence ("Every failure path - mutated spec, condition") and omit the entire Outcome-document block (when:/status:/detail:/condition_polls:/action_exit:/output:) that the base version printed and that docs/configuration.md explicitly says the adapter's --help owns. Verified by running --help on both base and target. Mechanical fix: extend the range to the header's new end (line 88), e.g. sed -n &#39;2,88p&#39;.
  • ℹ️ bin/fm-update.sh:166 - The self-update trust-binding rebind covers the primary home and local secondmate homes only, matching the header's stated scope. A remote secondmate's persistent home is advanced by fm-remote-secondmate-control.sh's update/sync path with no rebind, so a when-watch armed in a remote home whose action executable lives in that home's repo still desyncs after an update; its next fire emits a loud rejected outcome that wakes that home's agent to re-arm, so the residual failure is visible rather than silent. Acknowledging the deliberate, documented tradeoff — no action required for this change.

🔧 Fix applied.
✅ Re-checked - no issues remain.

⚠️ **Test** - 2 issues (1 warning, 1 info)
  • ℹ️ tests/fm-afk-launch.test.sh:119 - Running tests/fm-afk-launch.test.sh from inside a live pi harness session fails its daemon-entry and herdr/tmux e2e units: the ambient process tree makes bin/fm-harness.sh correctly detect 'pi', and bin/fm-afk-launch.sh correctly refuses the away daemon on pi ('the away daemon is no longer launched on pi'), so start-native never runs in units that do not override the harness. Pre-existing at base f4ca23b (identical test unit and identical pi refusal), not a regression from this change; the full suite passes once the ambient harness is neutralized (verified by running under >8 plain-bash ancestor hops with PI_* markers scrubbed). Informational for future gate agents that run under pi: run this suite ancestry-neutral or expect these units to fail for environmental reasons.
  • ⚠️ live validation verdict: inconclusive (4 of 12 scenarios were driven live against the product); untested: After a self-update rebinds trust bindings, an in-repo watch keeps firing while an out-of-repo action and mutated action bytes are still refused (rebind-all contract), agy harness surface restored by 6c93849: composer-verdict subsystem, typed-send confirmation budgets, and the 1.2.2 spinner status-row signature behave as specified, Quiet/away supervision: a pending proposal cannot bypass captain confirmation, the daemon runs in a separate non-visible workspace with one serialized terminal, and stop cleans record, flag, and terminal, AFK return: an already-acked watcher-down marker is not re-reported as an open gap in the return brief, Primary-resource decision logic: context/quota thresholds, precedence, immutable receipt reservation, and refuse-on-uncertain-reading behave as specified, Generated ship/scout briefs carry the poteto-mode section by default; config 'off' omits it and any other value refuses the scaffold, Spawned claude workers get the external CLAUDE.md import dialog pre-approved, and verified harness ancestry outranks retained identity markers for session-lock decisions, Session-start nudge behavior after the rebase
  • Live validation: ⚠️ inconclusive - 4 of 12 scenarios driven live against the product
Scenario Result Live Evidence
fm-procevent-when.sh --help prints the complete usage after the header grew: full run entry sentence and the entire Outcome-document block (the head commit ed01f60 fixes the truncation b405338 introdu… ✅ pass live Manual invocation of bin/fm-procevent-when.sh --help on target vs pre-fix 6c93849; artifact procevent-when-help-before-after.txt
A captain arms a condition->action watch and the generic runner fires the real action exactly once, capturing one terminal outcome document (status: fired, condition_polls, action_exit) with a durable… ✅ pass live Manual live drive with real condition/action scripts, no fixtures; artifact procevent-when-live-fire.txt
After a self-update rebinds trust bindings, an in-repo watch keeps firing while an out-of-repo action and mutated action bytes are still refused (rebind-all contract) ⏸️ untested no The prior payload recorded only bin/fm-test-run.sh runs of the unit suites tests/fm-procevent-when.test.sh and tests/fm-update.test.sh with live=false; a unit-suite run is not a live drive, so no live…
The agy adapter drives the real Antigravity CLI: busy footer matches the classifier in flight, launch prompt is processed, a single Escape cancels the turn, /quit stops the process ✅ pass live FM_AGY_SIGNALS_LIVE=1 bash tests/fm-agy-signals-live-e2e.test.sh against the real agy binary and real tmux; artifact agy-signals-live-e2e.txt
agy harness surface restored by 6c93849: composer-verdict subsystem, typed-send confirmation budgets, and the 1.2.2 spinner status-row signature behave as specified ⏸️ untested no The prior payload recorded only the unit suites tests/fm-agy-harness.test.sh and tests/fm-send-agy-confirm.test.sh with live=false; the separate live signals e2e drove the real CLI but not these surfa…
Quiet/away supervision: a pending proposal cannot bypass captain confirmation, the daemon runs in a separate non-visible workspace with one serialized terminal, and stop cleans record, flag, and termi… ⏸️ untested no The prior payload recorded only the ancestry-neutral run of the unit suite tests/fm-afk-launch.test.sh with live=false; even though that suite's e2e units invoke real herdr and tmux, the payload did n…
AFK return: an already-acked watcher-down marker is not re-reported as an open gap in the return brief ⏸️ untested no The prior payload recorded only the unit suite tests/fm-afk-return.test.sh with live=false; no live return-brief drive was recorded. Provide a live drive: ack a watcher-down marker in the real product…
Main-session handover: on the real Herdr CLI, check proposes the context handover, commit creates the helper's workspace pane, the occupant is proven, /exit is delivered, the successor launches, and t… ✅ pass live FM_PRIMARY_RESOURCE_HERDR_LAB_E2E=1 bash tests/fm-primary-resource-herdr-lab-e2e.test.sh; artifact primary-resource-herdr-lab-e2e.txt
Primary-resource decision logic: context/quota thresholds, precedence, immutable receipt reservation, and refuse-on-uncertain-reading behave as specified ⏸️ untested no The prior payload recorded only the unit suite tests/fm-primary-resource.test.sh with live=false for these decision behaviors; the live Herdr lab run covered the handover flow but was not recorded as…
Generated ship/scout briefs carry the poteto-mode section by default; config 'off' omits it and any other value refuses the scaffold ⏸️ untested no The prior payload recorded only the unit suite tests/fm-brief.test.sh with live=false; no live scaffold of a real ship/scout brief was recorded. Provide a live run of the scaffold command against the…
Spawned claude workers get the external CLAUDE.md import dialog pre-approved, and verified harness ancestry outranks retained identity markers for session-lock decisions ⏸️ untested no The prior payload recorded only the unit suites tests/fm-claude-trust.test.sh, tests/fm-harness-precedence.test.sh, and tests/fm-session-lock-ancestry.test.sh with live=false; no live spawn of a claud…
Session-start nudge behavior after the rebase ⏸️ untested no The prior payload recorded only the unit suite tests/fm-sessionstart-nudge.test.sh with live=false; no live session start against the real product was recorded. Provide a live session start and captur…
  • FM_HOME=/tmp/fmtest-help bin/fm-procevent-when.sh --help (before/after: git show 6c93849:bin/fm-procevent-when.sh vs target ed01f60)
  • manual live drive: FM_HOME=<isolated> bin/fm-procevent-when.sh arm live-fire ... + bin/fm-procevent.sh reconcile -> fired outcome document, classify/terminal, durable fired marker
  • bin/fm-test-run.sh tests/fm-procevent-when.test.sh tests/fm-update.test.sh
  • bin/fm-test-run.sh tests/fm-agy-harness.test.sh tests/fm-send-agy-confirm.test.sh
  • bin/fm-test-run.sh tests/fm-afk-launch.test.sh tests/fm-afk-return.test.sh (then fm-afk-launch re-run ancestry-neutral after diagnosing the ambient-pi artifact)
  • bin/fm-test-run.sh tests/fm-primary-resource.test.sh tests/fm-brief.test.sh
  • bin/fm-test-run.sh tests/fm-claude-trust.test.sh tests/fm-harness-precedence.test.sh tests/fm-session-lock-ancestry.test.sh tests/fm-sessionstart-nudge.test.sh
  • FM_AGY_SIGNALS_LIVE=1 bash tests/fm-agy-signals-live-e2e.test.sh (real agy CLI + real tmux)
  • FM_PRIMARY_RESOURCE_HERDR_LAB_E2E=1 bash tests/fm-primary-resource-herdr-lab-e2e.test.sh (real Herdr CLI lab)
⚠️ **Document** - 1 info
  • ℹ️ .agents/skills/harness-adapters/SKILL.md:57 - Judgment call, resolved: the agy replay dropped rovo from both router enumerations because upstream's sentences never carried it. I restored rovo to both, keeping upstream's deliberate refinement that agy establishes its primary boundary in its own reference (agy.md "Primary integration", mirroring kimi) while rovo follows the router's Non-negotiable safety sentence (the auss-main meaning; rovo.md also states its own boundary, so grouping rovo with kimi/agy instead is a defensible alternative if the author prefers).
✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

This report is out of date. Scroll down for Devin Review's latest report on this PR.

Devin Review found 2 potential issues.

2 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

Comment thread bin/fm-claude-trust.sh
Comment on lines +484 to +488
const carryImportConsent = approvedExternalImports(projects, project);
const targetFlags = carryImportConsent ? [trustFlag, ...importFlags] : [trustFlag];
const projectFlags = carryImportConsent ? [trustFlag, ...importFlags] : [trustFlag];
setFlags(projects, target, targetFlags);
setFlags(projects, project, projectFlags);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Fresh Claude workers stall before briefs

Without prior import consent, fm-claude-trust.sh records trust and lets the spawn continue. Claude then shows an unanswerable import dialog before reading the brief.

Learn more

Claude has separate workspace-trust and external-import dialogs. This helper suppresses the second dialog only when the canonical project entry already records explicit approval. With no approval, it still returns success after writing workspace trust, and the spawn path has no post-launch dialog check for Claude. The launched worker therefore remains blocked even though dispatch reported success.

Example: A newly registered project has no entry in .claude.json. The first Claude task gets hasTrustDialogAccepted=true, launches, and stops at “Allow external CLAUDE.md file imports?” instead of processing its instructions.

Recommended fix: Do not report successful preflight when the required import consent is absent. Add a supported attended consent workflow, remove the external import dependency from worker context, or refuse the spawn with an actionable diagnostic before launching.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread bin/fm-precompact-stow.sh
Comment on lines +219 to +224
# The same two eligibility owners the session-open wrappers use, so a gate
# agent and an unmarked task worktree never launch stow passes for a home they
# do not own.
fm_is_gate_agent "$FM_ROOT" && stand_down
fm_primary_scope_matches "$FM_ROOT" "$STATE" || stand_down
[ -d "$STATE" ] || stand_down

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Read-only compaction mutates the home

A lock-refused session passes fm_primary_scope_matches and launches the detached stow agent. That agent can rewrite records owned by the active session.

Learn more

A primary-scope match proves that the checkout belongs to the home, not that this process owns the home. The session contract requires every lock-refused session to remain read-only, but this hook never calls fm_session_lock_owned_by_self. It can therefore launch a headless /stow pass from a second Claude or Codex session using the same home.

Example: Session A owns state/.lock. Session B opens the same home, fails lock acquisition, then compacts. Its PreCompact hook starts an agent that updates startup memory and knowledge while Session A remains active.

Recommended fix: Source the session-lock owner and require verified self-ownership before checking cooldown or launching the detached agent. Stand down silently when the current hook process does not descend from the lock owner.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

AnPod and others added 9 commits September 14, 2026 01:18
…unchenguid#4200)

* feat(agy): verify Antigravity CLI as third worker/scout adapter

Detection by anchored ancestry in fm-harness.sh (no marker of its own);
bootstrap harness and effort validation; launch template with model and
effort mapping plus reachable-catalog model validation; rendered-tail
busy fallback in fm-busy-lib.sh with delivery footer in fm-composer-lib.sh;
control mechanics with crewmate/scout-only refusal; tmux liveness naming;
router entry with concise adapter reference; dated verification record;
portable regression plus opt-in live drift guard.

Verified live on agy 1.2.0: supervised spawn, durable steering,
same-copy relaunch, and exit, with Herdr-native busy agreement.

* no-mistakes(review): bound agy model probe, gate trust dialog, narrow busy signature

* no-mistakes(review): pre-register agy workspace trust, make readiness gate strict

* no-mistakes(review): Close Orca terminal on gate failure; isolate live-guard HOME; tighten agy matching

* no-mistakes(document): Document agy adapter in stale harness enumerations

* no-mistakes(review): Clamp non-positive FM_AGY_MODELS_TIMEOUT to the default bound

* no-mistakes(document): Fix stale test-shard snapshots after agy lane additions

* no-mistakes(ci): Fixed ci-3 (tests/fm-agy-harness.test.sh:519). Root cause: the agy spawn fixture's default base PATH (/usr/bin:/bin:/usr/sbin:/sbin) omits node's directory, but the spawn drives the real bin/fm-agy-trust.sh (which hard-requires node to record trust) and the fixture's fake tmux trust lookup (node -e) under that PATH. On the ubuntu-latest CI runner node lives in the toolcache (/usr/local/bin), so trust pre-registration failed on portable serial 2; on typical Arch hosts node is in /usr/bin, masking the defect. Fix (smallest, following the existing tests/fm-kimi-harness.test.sh precedent of carrying the interpreter's resolved directory): resolve node from the invoking environment (failing the test with 'test needs node' if absent, as kimi does for python3) and prepend its directory to the fixture's default base PATH; the FM_TEST_BASE_PATH override contract is untouched. Verified locally: (1) pre-fix reproduction with a CI-shaped base PATH (system bins minus node) produced exactly the reported failure — 'node is required to record workspace trust and was not found on PATH' plus the fake tmux 'node: command not found'; (2) post-fix, all 29 tests in the file pass both with node available only via a leading non-standard dir in the base PATH (CI's shape) and with the default base PATH on this host. bash -n clean; ShellCheck is not installed in this worktree (previously recorded as environmental)

* no-mistakes(test): Give agy typed sends a longer submit-confirm budget

* no-mistakes(document): Document agy send budget, trust gate, and control coverage

* no-mistakes(document): Document agy busy fallback inventory and send-timing evidence
…uid#4337)

* feat(afk): add quiet supervision mode for a present captain

Adds a first-class quiet supervision mode alongside /afk for
kunchenguid#2356: the same away-mode daemon, injection,
busy/composer guards, classification policy, and reliability
properties, but the captain staying present and chatting no longer
exits it - only an explicit /quiet off does.

state/.afk's first line now declares its mode (away, the default, or
quiet); fm_afk_mode() in bin/fm-wake-lib.sh is the single reader,
falling back to away for missing/empty/unreadable/unrecognized
content (including the legacy bare-epoch-timestamp format written
before mode existed) so nothing regresses. fm_afk_flag_write()
preserves the on-disk mode on a bare refresh (no explicit mode given)
rather than defaulting to away, which is what keeps the daemon's own
redundant terminal-side re-write from silently resetting a captain's
quiet mode back to away underneath them.

New .agents/skills/quiet/SKILL.md is a thin wrapper cross-referencing
/afk for every shared mechanism, per the one-owner rule. AGENTS.md
gains the state/.afk table entry and section 8's exit-trigger line.
bin/fm-supervision-instructions.sh, bin/fm-session-start.sh, and
bin/fm-guard.sh's stale-watcher banner all become mode-aware so a
quiet-mode captain is never misdirected to /afk in captain-facing
text.

Closes kunchenguid#2356

* no-mistakes(review): Fix AFK epoch parsing and quiet-mode digest wording for two-line flag

* no-mistakes(document): Fix turnend-guard.md daemon-ownership contract for quiet mode

---------

Co-authored-by: NewAiCoder <[email protected]>
Co-authored-by: NewAiCoder <[email protected]>
…kunchenguid#3578)

* fix(bin): let verified harness ancestry outrank retained markers (#3)

* fix(bin): let a structural harness ancestor outrank a retained marker

bin/fm-harness.sh treated a verified environment marker as unconditionally
authoritative, so a Codex session started from an environment that had retained
CLAUDECODE=1 detected as claude. Session start then emitted Claude's Stop-owned
supervision protocol to a Codex primary, and every turn end was blocked for
missing Claude recovery.

The defect is the precedence boundary, not any one harness. codex, opencode,
kimi, and muse publish no identity marker at all, so with markers winning
outright any retained CLAUDECODE renamed them; the Cursor-before-Claude ordering
was a point patch on the same class of problem, and the launch-time marker
clearing only ever covered sessions fm-spawn started.

Markers and ancestry are now separate evidence layers that detect_own arbitrates:

- no ancestry match, or no marker: the single available layer answers, unchanged;
- same harness family: the marker's finer verdict stands, so a launch-selected
  pi-signed is not flattened to pi by an ancestry walk that can only see the
  shared launcher name;
- different harness with a structural (command-name) ancestor: ancestry wins,
  because only ancestry proves who owns the process tree;
- different harness with only a bare-interpreter script-path match: the marker
  wins, since a harness-shaped path in some node process's arguments is weaker
  evidence than a harness publishing its own identity.

The correction is symmetric: a retained CURSOR_AGENT no longer renames a claude
worker nested under cursor either.

Adds fm-harness.sh ancestry [<pid>], ancestry evidence with no marker layer, so
a real harness process can be asked what the walk makes of it.

tests/fm-harness-precedence.test.sh is the portable regression, built from real
renamed processes with no harness installed. Every case drives the two layers
apart and asserts each alone as well as the combination, so no case can pass
vacuously; it also pins Codex's real two-process install topology, since the fix
depends on the native binary being what a tool subprocess meets first. The
opt-in drift guard gains the matching live half: each installed harness's real
running process must still be identified by the ancestry walk, and it fails
naming the harness and version when a release changes that name.

Documentation follows the corrected contract in the script header, the
harness-adapters detection section, the codex, opencode, kimi, and cursor
references, and a dated verification record.

* fix(tests): drop the unused argument pass-through in the shim-topology helper

bin/fm-lint.sh refused the branch: run_shim declared a `[ancestry]` argument and
forwarded "$@", but every call site that varies the environment or passes the
ancestry subcommand invokes the shim entry point directly, so the helper is only
ever called with no arguments (ShellCheck SC2120/SC2119).

Behavior is unchanged: with no arguments "$@" expanded to nothing.

* fix(bin): examine the top of the process chain instead of assuming init

harness_ancestry stopped as soon as the next pid was 1, on the assumption that
pid 1 is always init and can never be a harness.
Inside a PID namespace that assumption inverts: the harness itself is pid 1, so
the walk never examined the one process that proves who owns the tree, reported
no ancestry at all, and handed the verdict straight back to a retained marker.

A real Codex session under `codex sandbox`, holding CLAUDECODE=1 and
CLAUDE_CODE_ENTRYPOINT=cli, is exactly that shape: it resolved claude and
rendered Claude's Stop-owned supervision protocol even with the marker-vs-ancestry
precedence boundary in place.
The same probe now resolves codex and renders the Codex foreground checkpoint.

A host's real pid 1 (init, systemd, launchd) matches no harness name, so
examining it costs one ps call and can introduce no false positive; the walk
still stops once that top process has been read, and a non-numeric or zero ppid
still ends it.

tests/fm-harness-precedence.test.sh pins the namespace shape with a fake ps that
reports every process as bash with ppid 1 and pid 1 as the harness.
The case asserts the marker still answers alone when pid 1 is host-shaped, so it
cannot pass vacuously, and it fails against the previous stop condition.

* docs(verification): record the real-Codex retained-marker evidence

The existing record proved the precedence boundary with the portable regression
and recorded each installed harness's process name behind the ancestry walk, but
it had no evidence from a real Codex process actually holding a retained Claude
marker, which is the failure the boundary exists for.

Adds the dated before/after result from codex-cli 0.152.0 under `codex sandbox`,
with the exact command and the decisive verdict and rendered protocol on each
side, and records the second boundary that shape exposed: the walk must examine
the top of the process chain, because inside a PID namespace the harness is pid 1.
Refreshes the portable regression's observed output for the case it gained.

* no-mistakes(review): blind ancestry in marker-pinned harness tests

* no-mistakes(review): blind ancestry in the Pi guard-routing test

* no-mistakes(review): classify precedence suite, dedupe ps stub, soften claims

* no-mistakes(review): model the spawn-and-wait Codex shim topology

* no-mistakes(document): correct stale muse marker-clearing detection claims

* no-mistakes: apply CI fixes

* fix(bin): examine the top of the chain in the lock and nudge walks too

The pid-1 defect corrected in bin/fm-harness.sh survived unchanged in the two
other harness-ancestry walks, on the exact topology the branch verified against
a real Codex process.

bin/fm-session-lock-lib.sh's fm_harness_ancestry_pids stopped as soon as the next
pid was 1, so a firstmate whose harness is pid 1 of its own PID namespace could
not find that harness at all and did not recognize its own session lock.
bin/fm-sessionstart-nudge.sh carried the same stop plus a blanket rejection of a
lock pid of 1, so the same session was told to run session start again on every
turn.

Both walks now compare the top process before stopping, matching the shape used
in bin/fm-harness.sh.
For the lock walk this is safe because fm_harness_process_matches rejects a
host's real pid 1.
For the nudge, `kill -0` still gates the lock pid, and on a host an unprivileged
`kill -0 1` fails, so a lock file that wrongly names pid 1 leaves the hook silent
rather than acting on init.

Each walk gains one regression case. The lock case drives a deterministic process
table whose pid 1 is the harness and asserts a host-shaped pid 1 still finds
nothing, so it cannot pass vacuously. The nudge case needs a real PID namespace,
because the builtin `kill -0` gate cannot be reached through a fake ps, and it
first proves the same fixture nudges with no lock present; it skips explicitly
where unprivileged namespaces are unavailable.

* no-mistakes(review): assert comm-strength detection from subprocess vantage in drift guard

* fix(bin): verify the live harness guard at the strength the guarantee needs

The marker-versus-ancestry boundary this branch ships is a strength claim:
detect_own hands an args-strength verdict straight back to a retained foreign
marker, so a harness is only protected where the ancestry walk reaches it at
comm strength.

The installed-harness drift guard probed the pane process alone. Under an
interpreter shim the pane process IS the shim, whose own script path is args
strength, while the native binary that carries comm strength is its child. The
guard therefore observed args for Codex, passed, and would have kept passing if
a release stopped spawning that native child at all, while real sessions
silently regressed to the original bug.

fm-harness.sh gains `ancestry-subtree`, which asks the walk from the pane
process and every descendant of it, the vantage a tool subprocess actually
occupies. The guard now requires comm strength somewhere in that set and
requires every vantage to name the same harness.

This supersedes the preceding commit's in-guard leaf walk, which reached the
same vantage but left the logic inside the test file, where CI could not pin it
and nothing else could reuse it. A harness-dependent check needs both halves:
`tests/fm-harness-precedence.test.sh` now carries a portable case proving the
subtree probe reaches a strength the top-of-session probe cannot, mutation
checked twice, once against the pre-change script and once by disabling
descendant enumeration. The subtree walk also avoids depending on tty and
process-group semantics that differ between Linux and macOS.

Verified live: codex-cli 0.152.0 reports [args codex;comm codex] and Claude Code
2.1.257 reports [comm claude].

* no-mistakes(review): narrow drift guard to the upward vantage path

* no-mistakes(review): judge only comm-strength vantages in drift guard

* no-mistakes(document): drop duplicated rationale in detection precedence evidence

* no-mistakes(review): fix pid-1 nudge case vacuity and descent no-arg expansion

* no-mistakes(document): drop branch-relative phrasing in detection precedence evidence

* no-mistakes(review): guard remaining empty positional expansions in fm-harness

* no-mistakes(document): scope cursor marker-ordering claim to the marker layer

* no-mistakes(review): Prefer comm-strength leaves in equal-depth descent ties

* no-mistakes(document): Document comm-strength descent tie-break

---------

* no-mistakes(review): Blind ancestry in stale gemini/rovo marker-precedence tests

* no-mistakes(document): Add missing equal-depth-tie test line to precedence evidence transcript

* no-mistakes(review): Fix stale/vacuous agy precedence test, add agy to precedence suite and docs

* no-mistakes(document): Fix stale kimi.md marker doc missed by ancestry-precedence fix

---------

Co-authored-by: NewAiCoder <[email protected]>
…rkers (kunchenguid#3944)

Claude Code's external-imports check (hasClaudeMdExternalIncludesApproved)
reads only the canonical git-root project entry in ~/.claude.json, which its
own worktree-to-primary-checkout canonicalization means is never the task
worktree fm-claude-trust.sh registered. The trust dialog kept working
previously only because its check has an ancestor-walk fallback that happens
to reach the worktree entry; the external-imports check has no such
fallback.

Verified by disassembling the installed claude binary and reproducing in an
isolated three-way tmux launch: identical flags registered only at the
worktree key still showed the external-imports dialog, and registering them
at the primary checkout key suppressed both dialogs.

fm-claude-trust.sh now registers all three flags on both the worktree entry
and the primary-checkout entry in one atomic write, and refuses when the
<project> argument is not itself a primary checkout (its own write target
would then be wrong). Extends the harness-adapters Claude reference and the
trust test suite.

Co-authored-by: NewAiCoder <[email protected]>
…nguid#4355)

The marker lifecycle (fm-wake-lib.sh _fm_recovery_marker_ack) leaves
state/.watcher-down behind in an acked:* state after a downtime episode
is handled. health_snapshot's presence check reported that as an open
gap on every later return, so a handled episode kept surfacing as a
false GAP forever.
…kunchenguid#4361)

* fix(update): rebind fm-procevent-when watches after a self-update

A self-update fast-forwards bin/ in place, changing an armed watch's
action executable bytes with no tampering involved. The watch's trust
binding was hashed at arm time, so the very next fire was refused as
not matching the registered binding and the watch died silently.

Add fm-procevent-when.sh rebind-all: it re-hashes and republishes the
trust binding for every watch whose action executable lives under
FM_ROOT, using the same spec/trust validation as an ordinary fire, and
leaves any watch whose action lives outside FM_ROOT untouched. Wire it
into fm-update.sh right after a successful fast-forward, for both the
primary home and any local secondmate home that advances.

* no-mistakes(review): Canonicalize FM_ROOT for rebind-all's containment check

* no-mistakes(document): Document fm-update.sh's automatic watch rebind and its verification evidence

* no-mistakes(lint): fix(tests): double-quote printf scripts to satisfy shellcheck SC2016

* no-mistakes(review): Reload trust binding from disk before firing to reach live pollers

* no-mistakes(review): Lock the fire-time trust reload against rebind_one's publish race

* no-mistakes(document): Document rebind-all's self-update guarantee and its two review-round test rows

---------

Co-authored-by: NewAiCoder <[email protected]>
Ship and scout briefs now carry a Poteto mode section instructing the
worker to run the task under the poteto-mode skill. config/poteto-mode
gates it: absence or "on" enables, "off" omits, and any other value
refuses the scaffold so a typo cannot silently drop the requirement.
Secondmate charters never receive the section and never read the file.

The unguarded section authorizes exactly the skill's own lifecycle -
renaming the worker's own pane, one run tab, splits inside it, and role
and watchdog panes it started - and forbids touching another run's or
the fleet's panes, so the brief no longer tells a worker to perform and
avoid the same step. A --herdr-lab brief runs the playbook in-host
instead, because its lab contract governs every Herdr call. Where the
skill's playbook duplicates a review, validation, or shipping step the
delivery path already covers, the delivery path satisfies it, keeping
AGENTS.md section 7's prohibition on stacked reviews intact.

The setting is inherited into secondmate homes. B21's concurrent-push
wait now ends on the marker or the child's exit instead of a wall-clock
bound that failed under load.
…stion (#4)

* feat(bin): add main-session resource protection command and its handover skill

fm-primary-resource.sh owns observe/arm/check/decide/commit/helper for the
main Firstmate session: a reliable context reading at or above 175000 tokens
hands over to the same harness, and a provider quota window at or above 97
percent used hands over to an independent provider, with quota taking
precedence. An unavailable or uncertain reading alerts and never closes the
session, and one immutable receipt per incident is reserved before any
terminal action so a successor cannot repeat it.

The primary agent runs stow itself and passes a structured reset-safe
attestation bound to the incident and generation; commit revalidates the
binding, context, and quota under the resource lock before reserving. A
bounded helper in a backend-owned terminal proves the pane occupant is the
recorded session, sends the exit command once, and launches the successor
only into a proven shell. Herdr stays alert-only until a guarded live lab
proves that transaction end to end.

* feat: arm main-session resource protection and observe its context binding

Bootstrap arms the standing check in the locked main-home path only, never in
a secondmate home, and reports an arm failure as PRIMARY_RESOURCE: not armed
rather than silently continuing without the protection. The turn-end guard
passes its already-read payload to observe so the reading is bound to the
lock-owning session; it never changes the guard's exit status or output.

AGENTS.md records the new private state directory and the handover skill
trigger, bootstrap-diagnostics owns the new prefix, and the test inventory
maps the new suite to the watcher family.

* docs: classify the main-session handover skill as agent-runtime

The repository documentation audience check refuses an unclassified surface,
so the new skill left bin/fm-doc-audience-check.sh failing and with it
tests/fm-documentation-audiences.test.sh. Classify it beside the other
agent-loaded skills.

* no-mistakes(review): Fix primary resource review findings

* no-mistakes(review): Narrow resource handovers to verified adapters

* no-mistakes(review): Remove stale decide command documentation

* no-mistakes(review): Always refresh quota and reconcile successor generations

* no-mistakes(review): Validate incident IDs before resource state writes

* no-mistakes(review): Preserve spawned Codex bypass flag

* no-mistakes(review): Reject malformed destination quota ranges

* no-mistakes(review): Gate handovers on validated live prerequisites

* feat(bin): hand over the main session on Herdr, not just tmux

The captain's decision removes the tmux-only narrowing: a main session running
on Herdr must hand over, not merely alert. pr_launch_helper now creates the
bounded helper's own non-focused workspace pane through the session-scoped CLI
wrapper, the same shape bin/fm-afk-launch.sh uses, and reclaims that endpoint
if the helper command cannot start. The three sites that converted a valid
handover into an alert are gone.

Commit-time revalidation also recomputes the launch-reconstruction guard
instead of assuming it: a session whose launch command cannot be rebuilt is
refused at the moment of acting, not only during the periodic check, and the
refusal names that concrete cause rather than reporting a generic mismatch.

Verified live on herdr 0.9.0 inside isolated fm-lab-* sessions created by
bin/fm-herdr-lab.sh, with teardown installed before provisioning: the real
launch path built its own workspace distinct from the stand-in primary pane,
the exit command left that pane shell-only, and a successor ran there. The
default session was untouched and no lab session leaked. The pane-level
sequence is proven; a full-fidelity run with a Herdr-recognised agent in the
lab pane is not, and the accompanying report says so.

Three test corrections, none of which weaken the guard: a case asserted a
codex binding while running under another harness, which is impossible since
codex is detected by process ancestry rather than a marker; a wall-clock
budget was tuned to the removed quota cache; and the new Herdr case needed a
reconstructable launch argv for the probe to read.

* no-mistakes(review): Harden Herdr handover ownership and helper cleanup

* no-mistakes(review): Authority exit PID via immutable receipt; unconditional helper pane cleanup

* no-mistakes(review): Delete launch files before helper pane close; alert terminal failures once

* no-mistakes(document): Document seven bootstrap sweeps; complete resource schema header

* no-mistakes(review): Clear stale episodes per provider, lock outcome writes, fail malformed source windows closed, stage-specific stalled-successor bound, drop redundant force-owner guard

* no-mistakes(review): Quote arm shim paths with printf %q for bash 3.2

* no-mistakes(document): Fix stale sweep counts and quota schema docs

* no-mistakes(review): repair portable resource handover paths

* no-mistakes(review): fail argv capture closed to /proc, quota wins over argv guard, add live Herdr lab e2e

* no-mistakes(document): Correct stale test-seam facts in primary-resource header

* no-mistakes(document): Record primary-resource verification grades; narrow adapter claims

* no-mistakes(review): restructure lock-holder fixture, narrow MISSING assertion, fix serial hint
@auss
auss force-pushed the fm/fm-upstream-rebase branch from 834ad65 to 19529f7 Compare September 14, 2026 10:23
@auss auss changed the title feat(bin): add agy adapter, primary-resource handover, and quiet supervision mode feat(bin): rebase onto upstream main and add agy adapter, primary-resource handover, and quiet mode Sep 14, 2026

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 new potential issues.

4 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

Comment on lines +1639 to +1646
case "$dest_h" in
claude) bin=$(command -v claude) || { pr_lock_release; printf 'fm-primary-resource: claude binary missing\n' >&2; return 1; } ;;
codex) bin=$(command -v codex) || { pr_lock_release; printf 'fm-primary-resource: codex binary missing\n' >&2; return 1; } ;;
*) pr_lock_release; printf 'fm-primary-resource: destination harness not a verified template\n' >&2; return 1 ;;
esac
prompt="This is a fresh main Firstmate session replacing the session recorded in receipt $incident. Read AGENTS.md. Run bin/fm-session-start.sh exactly once unless its complete digest was already supplied. Verify lock ownership, read the stow receipt and outstanding work through their existing owners, then resume the emitted supervision protocol. Do not retry this incident; its immutable receipt consumes the automatic action. Do not resume the previous vendor conversation."
launch_cmd=$(printf '%q %q' "$bin" "$prompt")
printf '%s\n' "$launch_cmd" > "$PR_DIR/launch/$incident.cmd"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Quota handover strands the primary

A quota handover builds launch_cmd without the destination's unattended flags or supervision wiring. The old primary exits before the replacement can operate reliably.

Learn more

Normal worker launches use adapter-specific templates. Claude receives the configured permission posture, while Codex receives bypass and notification options through launch_template. A quota handover instead closes the current primary and runs only <binary> <prompt>. The replacement can stop at an approval prompt, run under an unsuitable sandbox, or start without the expected supervision signal.

Example: A Claude primary reaches 97% quota. The helper exits Claude and launches codex '<prompt>'. Codex requests approval or cannot mutate the home, leaving no working primary after Claude has closed.

Recommended fix: Build quota replacements through one primary-launch template per destination. Preserve the configured Claude permission mode and all destination-specific supervision, environment, model, and startup flags before allowing the helper to exit the source session.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread bin/fm-precompact-stow.sh
Comment on lines +167 to +168
fm_run_timed "$run_secs" $FM_PRECOMPACT_STOW_AGENT "$prompt" \
</dev/null >>"$LOG_FILE" 2>&1

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟥 Stow override enables command injection

Unquoted FM_PRECOMPACT_STOW_AGENT is reparsed by Bash before execution. A crafted environment value runs arbitrary commands with the operator's permissions.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

…neage

Carry the captain-approved deltas from the upstream-based validation lineage
onto the auss:main-based rebase (e6dc1e0) so the branch descends from
auss/firstmate:main and PR #8 is a clean fast-forward: the restored agy
composer-verdict subsystem with its palette-8 ghost stripper and Herdr
separated-pair admission, the agy 1.2.2 spinner status-row signature fix,
their tests, and the rebase-doc verification updates.
@auss
auss force-pushed the fm/fm-upstream-rebase branch from 19529f7 to 6c93849 Compare September 14, 2026 12:45
@auss auss changed the title feat(bin): rebase onto upstream main and add agy adapter, primary-resource handover, and quiet mode feat(bin): add Antigravity (agy) adapter and ancestry-first harness detection Sep 14, 2026
…bin/fm-pending-reply-lib.sh lines 1081/1084: unquoted assignments token=pending-reply-missed and token=pending-reply-delivery-unknown, whose hyphenated bare values parse as arithmetic under full extended analysis (--external-sources). Fixed by quoting both values, matching the already-quoted recovery-delivery branch. Verified: reproduced both warnings locally with pinned ShellCheck 0.11.0 in the exact CI mode before the edit; after the fix shellcheck --norc --external-sources on the file exits 0 with no findings, and bin/fm-lint.sh bin/fm-pending-reply-lib.sh (full extended analysis plus backend-purity check) exits 0. These were the only findings in the CI Lint log (actionlint reported all 3 workflow files valid), so no other root is affected
@auss
auss merged commit c25d859 into main Sep 14, 2026
25 of 27 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants