From f3465178d187e23e185aaf83627137ae1cff10db Mon Sep 17 00:00:00 2001 From: dnth Date: Wed, 2 Dec 2026 15:24:45 +0800 Subject: [PATCH 01/15] feat: add verified agy crewmate and scout adapter Port the Antigravity CLI (agy) worker and scout adapter from upstream kunchenguid/firstmate#4200 and the swarm delegation stem from kunchenguid/firstmate#8838; upstream's primary and secondmate promotion (kunchenguid/firstmate#7941) stays out of this fork. Every ported fact was re-proven on the installed agy 1.5.21 in a named Herdr lab trial. Where 1.5.21 exposes a structural source the upstream agy 1.2.0 adapter lacked, the port uses it: - busy state comes from agy's own agent_state through a per-session --settings title command (bin/fm-agy-state.sh, source agy-title) instead of the upstream rendered-tail regex, and idle with a running background task stays busy because agy resumes the agent by itself; - worktree trust rides the same session-only settings file instead of writing the captain's ~/.gemini/antigravity-cli/settings.json; - the spawn gate waits for an agy-title record and stops the endpoint on failure so an unconfirmed brief never runs outside task control; - the tmux composer reader recognizes agy's rule-framed > prompt and the shared idle list carries its auto-mode placeholder. agy is crew-only: secondmate launches and dispatch from an agy primary are refused. Dispatch profiles, the control plane, detection, teardown, and the harness-adapters skill now cover it, with a portable regression and an opt-in live guard. --- .agents/skills/harness-adapters/SKILL.md | 42 +- .../skills/operational-home-layout/SKILL.md | 1 + AGENTS.md | 2 +- bin/backends/tmux.sh | 2 +- bin/fm-agy-state.sh | 103 +++++ bin/fm-bootstrap.sh | 4 +- bin/fm-busy-lib.sh | 3 + bin/fm-composer-lib.sh | 6 +- bin/fm-control-lib.sh | 40 +- bin/fm-dispatch-resolve.sh | 2 +- bin/fm-harness.sh | 17 +- bin/fm-spawn.sh | 163 +++++++- bin/fm-subagent-pretool-check.sh | 6 +- bin/fm-teardown.sh | 5 +- bin/fm-test-run.sh | 4 +- bin/fm-tmux-lib.sh | 45 ++- docs/configuration.md | 14 +- docs/scripts.md | 1 + docs/subagent-guard.md | 9 +- docs/verification/runtime-backends.md | 62 +++ tests/fm-agy-harness.test.sh | 378 ++++++++++++++++++ tests/fm-agy-live-e2e.test.sh | 144 +++++++ tests/fm-bootstrap.test.sh | 2 + tests/fm-subagent-pretool-check.test.sh | 2 +- 24 files changed, 988 insertions(+), 69 deletions(-) create mode 100755 bin/fm-agy-state.sh create mode 100755 tests/fm-agy-harness.test.sh create mode 100755 tests/fm-agy-live-e2e.test.sh diff --git a/.agents/skills/harness-adapters/SKILL.md b/.agents/skills/harness-adapters/SKILL.md index 56e72dd2276..45a7166dac6 100644 --- a/.agents/skills/harness-adapters/SKILL.md +++ b/.agents/skills/harness-adapters/SKILL.md @@ -1,6 +1,6 @@ --- name: harness-adapters -description: Agent-only reference for firstmate harness operations. Use before spawning or recovering a crewmate or secondmate, handling a trust dialog, sending a harness-specific skill invocation, interrupting or exiting an agent, resuming an exited agent, verifying a new harness adapter, or sending a captain-requested Cloud Devin /handoff to a live Devin CLI crew. Contains verified facts for claude, codex, opencode, pi, pi-signed, omp, grok, kimi, and the crew-only Hermes and Devin adapters. +description: Agent-only reference for firstmate harness operations. Use before spawning or recovering a crewmate or secondmate, handling a trust dialog, sending a harness-specific skill invocation, interrupting or exiting an agent, resuming an exited agent, verifying a new harness adapter, or sending a captain-requested Cloud Devin /handoff to a live Devin CLI crew. Contains verified facts for claude, codex, opencode, pi, pi-signed, omp, grok, kimi, and the crew-only Hermes, Devin, and agy adapters. user-invocable: false metadata: internal: true @@ -46,10 +46,10 @@ OMP primary detection and lock liveness follow the distinct launch-bound identit That probe stops at the innermost harness ancestor, so an agent of another harness started from OMP's bash tool keeps its own identity instead of inheriting the OMP primary's. Within the Pi family, only the exact launch-boundary marker `FM_PI_HARNESS=pi-signed` alongside `PI_CODING_AGENT=true` selects the signed identity; unmarked shared launcher ancestry remains `pi`. `bin/fm-harness.sh crew` resolves the effective crewmate harness from `config/crew-harness` (absent or `default` -> own). -The configured crew-only `hermes` and `devin` identities resolve through that same path, but neither is a verified primary or secondmate identity. +The configured crew-only `hermes`, `devin`, and `agy` identities resolve through that same path, but none is a verified primary or secondmate identity. `bin/fm-harness.sh secondmate` resolves the secondmate-launch harness through the chain `config/secondmate-harness` -> `config/crew-harness` -> own, so an unset `config/secondmate-harness` matches the crew harness. -The one exception is a crew-only harness: `config/crew-harness: hermes` or `devin` is filtered out of that implicit chain and resolution continues to own-harness detection, because no verified secondmate launch template serves it. -An explicit `config/secondmate-harness: hermes` or `devin` still resolves verbatim and is refused at the spawn kind boundary. +The one exception is a crew-only harness: `config/crew-harness: hermes`, `devin`, or `agy` is filtered out of that implicit chain and resolution continues to own-harness detection, because no verified secondmate launch template serves it. +An explicit `config/secondmate-harness: hermes`, `devin`, or `agy` still resolves verbatim and is refused at the spawn kind boundary. `bin/fm-spawn.sh` uses `crew` mode for a crewmate/scout launch and `secondmate` mode for a `--secondmate` launch, re-resolving on every spawn so the split is durable across respawns; an explicit per-spawn harness arg overrides either. On `unknown`, ask the captain instead of guessing. A captain override always beats detection. @@ -140,6 +140,7 @@ The supported launch-profile flags below are verified locally; each row records | opencode | `--model ` | none for firstmate's interactive launch | Verified on opencode 1.17.6. `opencode run` has `--variant`, but firstmate launches the interactive `opencode --prompt` path, which has no verified effort flag. | | kimi | `--model ` | none | Verified 2026-07-25 on Kimi Code CLI 0.29.1. | | hermes | `--model ` | `--reasoning ` plus session-scoped `/reasoning` | Verified 2026-08-25 on Hermes Agent v0.20.0; the TUI launcher drops the CLI value, so spawn applies the session command too. Hermes additionally accepts none/minimal/ultra, but those are outside Firstmate's shared effort vocabulary. | +| agy | `--model ` such as `gemini-4-neon` | `--effort ` | Verified 2026-12-02 on agy 1.5.21. `agy models` lists one suffixed id per supported level (`gemini-4-neon-low` through `-xhigh`; Claude and Carbon families stop at `high`; no family lists `max`). A family id plus `--effort` and a suffixed id alone both work; agy refuses an unsupported level (`has no "xhigh" effort`) or a suffix that conflicts with `--effort` at launch, so spawn passes the value through and the lifecycle gate fails the spawn by name. | The concrete `harness` field owns adapter identity independently of the model provider: `harness=pi` with `model=xai/grok-*` is Pi using xAI, not `harness=grok`, and does not require Grok CLI login; `harness=grok` remains the standalone Grok Build CLI adapter. Ordinary dispatch does not resolve that split in shell: establish which credential store a tuple reads from the discovery surfaces below plus `quota-axi auth --json`'s per-provider sources, and show that reasoning rather than inferring it from a harness, model, or source name. @@ -160,6 +161,7 @@ Use the discovery surface in the current authenticated environment because suppo | grok | Run `grok models`, which lists the models available to the current Grok installation and account. | | kimi | Run `kimi provider list --json`, which lists the current provider and model configuration. | | hermes | Run `hermes config get model` and `hermes status`; the former reports the active model/provider slugs and the latter confirms current authentication. | +| agy | Run `agy models`, a remote fetch that lists `\t