⚓ firstmate field guide
Reference

Harness integration

What each supported harness needs, which files wire it in, how it stays supervised, and which harnesses can serve as primary, crewmate, secondmate or scout.

firstmate is vendor-agnostic. .agents/skills/harness-adapters/ routes every harness-specific fact, with per-vendor references under references/harness/. It carries one non-negotiable rule: never dispatch on an unverified adapter. If detection returns unknown, the first mate asks you.

Support matrix#

Harness Primary Crewmate Secondmate Scout
Claude Code (claude) ✓ co-primary ✓ ✓ ✓
Grok (grok) ✓ co-primary ✓ ✓ ✓
Pi (pi, pi-signed) ✓ co-primary ✓ ✓ ✓
Oh My Pi (omp) ✓ ✓ ✓ ✓
Codex (codex) ✓ ✓ ✓ ✓
OpenCode (opencode) ✓ ✓ ✓ ✓
Cursor Agent CLI (cursor) ✓ ✓ ✓ ✓
Antigravity CLI (agy) ✓ ✓ ✓ ✓
Kimi (kimi) — ✓ ✓ ✓
Gemini, Muse, Rovo, Devin, Command Code (commandcode), Polytoken (polytoken), Cortex Code (cortex), Kiro CLI (kiro), Hermes Agent (hermes) — ✓ — ✓

The last row has no primary supervision protocol, so it can't host a secondmate. Kimi is refused on cmux and Orca. Command Code runs only on tmux and Herdr: Zellij, cmux and Orca supply no pane identity, so its idle placeholder never reads empty and the launch is refused. A Polytoken spawn needs a model that polytoken print models lists. Its first-start license dialog is never accepted automatically. Cortex Code runs only on tmux and Herdr; a launch on Zellij, cmux, Orca, Paseo, Rex or T3 Code is refused. Cortex loads Claude-compatible .claude/settings.json and settings.local.json hooks, with no switch to disable the import, so a worker in a project with Claude hooks runs them. Kiro CLI runs on its V2 engine only. Its busy and turn-end hooks live in a per-task state/<id>.kiro-home, reached by relocating KIRO_HOME. Hermes Agent runs as a TUI on tmux only. Its native profile selects the model and reasoning, and the profile's own gateway may run only if it is idle at dispatch. Source: docs/configuration.md "Harness support".

Claude Code#

  • Wiring: .claude/settings.json registers these hooks:
    • SessionStart → bin/fm-sessionstart-run.sh
    • PreToolUse seatbelts: fm-arm-pretool-check.sh, fm-cd-pretool-check.sh, fm-subagent-pretool-check.sh
    • UserPromptSubmit → fm-host-mirror.sh
    • Stop → fm-turnend-guard.sh --claude, then fm-claude-stop-autoarm.sh (asyncRewake: true, 28800s timeout)
    • StopFailure → fm-claude-stop-autoarm.sh again, without the turn-end guard. A turn that ends on an API error runs no Stop phase.
  • How it stays supervised: on every Stop and StopFailure, the autoarm checks that this is the primary checkout and that it holds state/.lock. It arms the watcher through a single-flight epoch ledger. On an actionable wake it exits 2 with a rewake banner, which Claude delivers as Stop-hook feedback. StopFailure continuations are paced to one per FM_CLAUDE_STOPFAILURE_REWAKE_COOLDOWN (default 300 seconds), never dropped.
  • Model instruction: drain wakes with bin/fm-wake-drain.sh and never re-arm by hand.
  • Workers: config/claude-permission-mode sets bypass (default) or auto. bin/fm-claude-trust.sh pre-registers workspace trust per worktree.
  • Managed-policy failover: if a managed policy defeats bypass (a Claude policy refusal, or a Codex approval prompt under bypass), the first mate asks you first. Only then does it run FM_HOME=<owning-home> bin/fm-approval-failover.sh apply <id>. That saves Claude's auto or Codex's approve-for-me in the absent mode file and relaunches the worker. Nothing detects this automatically.
  • /calm needs CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1.
  • Skill listing budget: Claude Code keeps skill descriptions only within 1% of the context window and drops the least-invoked skills' descriptions first. That hits firstmate's agent-only skills. /doctor shows the cost; skillListingBudgetFraction raises the budget. Set it in user settings or .claude/settings.local.json, never the tracked .claude/settings.json.
  • All Claude hooks no-op when GROK_AGENT or GROK_HOOK_EVENT shows that Grok is really driving.

Subscription terms

Kun on running Claude Code under firstmate: "you are still just running the real claude code as-is. zero TOS implication" (2026-08-10 thread). He uses Claude Code for Claude models and Pi for everything else.

Pi / pi-signed#

  • Wiring: tracked .pi/extensions/*.ts auto-load after you approve project trust once per clone:
    • fm-primary-pi-watch.ts — watcher bridge; exposes the fm_watch_arm_pi tool
    • fm-branch-supervision.ts — the in-process supervision branch
    • fm-primary-turnend-guard.ts
    • fm-calm.ts
  • Seeded secondmates: fm-spawn.sh adds --approve to Pi and pi-signed secondmate launches in Firstmate-seeded homes when the installed pi's --help lists it. They skip "Trust project folder?". The approval lasts one session and never rewrites trust.json. Worker launches never get it.
  • Fallback if the extensions didn't load: restart pi with the extension paths passed via -e.
  • Supervision branch: a second AgentSession in the same process. It absorbs routine wakes and heartbeats and hands outcomes to main. It is on by default once the fleet lock is held. It is Pi-only; it does not run on omp.
  • /supervision-model pins the branch to a cheaper model and effort.
  • FM_PI_HARNESS=pi-signed pi-signed for the signed wrapper.

omp (Oh My Pi)#

  • Wiring: .omp/extensions/ holds fm-primary-omp-watch.ts and the turn-end guard. No trust gate. Start omp with the checkout as cwd. Don't also pass -e, or they load twice.
  • Guard: a blocking session_stop hook compels a continuation, bounded to one per turn by stop_hook_active. This is the strongest guard of any harness.
  • omp needs both extensions trusted; with only one, it fails loudly.
  • bun install: an omp installed with bun install -g @oh-my-pi/pi-coding-agent runs as a process named bun. It is now detected as omp; before, it read as unknown and the session lock refused.

Grok#

  • Wiring: there is no extension. The model arms the watcher itself through Grok's run_terminal_command with background: true. Grok injects a synthetic task_completed message when the arm finishes, and that is the wake.
  • A .grok/hooks/ Stop-hook backstop exists but is not the normal path.
  • Launch with grok --trust once per clone, or run /hooks-trust. Headless grok -p is unsupported as primary.
  • Version trap: Grok 1.0.0 hook processes carry GROK_HOOK_EVENT/GROK_SESSION_ID but not GROK_AGENT. A guard keyed only on the old marker let Claude's auto-arm run synchronously under Grok, and the turn never ended. The docs warn: do not widen the guard to GROK_SESSION_ID, which leaks into child Claude sessions.

Cursor Agent CLI#

  • Wiring: .cursor/hooks.json stop → bin/fm-turnend-guard-cursor.sh.
  • Cursor's stop hook is synchronous, and exit 2 is a silent no-op, so the hook parks: it runs one watcher cycle as its own child and returns a followup_message on an actionable wake. It is bounded by Cursor's loop_limit and by FM_CURSOR_TURNEND_LOOP_CEILING (180).
  • Must launch with --trust, or no project hooks load. Must be interactive: cursor-agent -p has no stop hook.

Antigravity CLI (agy)#

  • Wiring: a tracked project-local .agents/hooks.json registers these hooks:
    • SessionStart → bin/fm-sessionstart-agy.sh
    • PreToolUse seatbelts: fm-arm-pretool-check.sh --agy, fm-cd-pretool-check.sh --agy, fm-subagent-pretool-check.sh --agy
    • Stop → bin/fm-turnend-guard-agy.sh (28800s timeout)
  • The Stop hook parks on a watcher cycle between turns, like Cursor's, and delivers actionable wake output. FM_AGY_TURNEND_LOOP_CEILING (default 180) bounds hook-driven turns.
  • Any top-level key in .agents/hooks.json other than a named hook spec (such as a version field) silently disables the whole file.
  • bin/fm-spawn.sh pre-registers a secondmate home in agy's workspace trust store through bin/fm-agy-trust.sh.
  • Subscription caveat: Kun warns that a Google AI subscription expects every Antigravity prompt to come from the user, not an orchestrator: "they require all prompts to antigravity to come directly from the user, not an orchestrator or loop. many users got banned for using it in other ADEs and orchestrators" (2026-11-15).

OpenCode#

  • Wiring: .opencode/plugins/fm-primary-watch-arm.js listens for session.idle, spawns fm-watch-arm.sh --restart, and delivers wakes with client.session.promptAsync. fm-primary-pretool-check.js is the seatbelt.
  • OpenCode 2: supported since 2026-10-23. Each primary plugin also exports a default { id, setup }. From setup(ctx) it subscribes to the terminal session.execution.* events with ctx.event.subscribe and wakes through ctx.session.prompt. The 1.x server export is kept, so 1.x runs that one. Start a 2.x primary or secondmate home with opencode --standalone, so its plugins run with the home's own FM_HOME.
  • TUI only. opencode run is unsupported as primary.

Codex#

  • There is no background mechanism ("Codex cannot reason while a foreground tool call is running"). The model loops bin/fm-watch-checkpoint.sh --seconds ${FM_CODEX_WATCH_CHECKPOINT:-180}. It exits 124 when quiet.
  • Native Stop park (opt-in): with config/codex-stop-park, an interactive native Codex session on a canonical codex-cli major.minor.patch release at or above 0.163.0 that holds the home's session lock parks in an asynchronous Stop hook (bin/fm-codex-stop-park.sh) instead. It waits outside the model and delivers wakes with codex queue --thread. Every other session keeps the checkpoint loop, including a prerelease, malformed or below-minimum version, or a failed version probe.
  • .codex/hooks.json holds the seatbelt and Stop guard.
  • Skills are invoked with $ instead of /: $afk, $bearings.
  • Codex Desktop threads are a companion workflow (firstmate-codexapp skill), not a runtime backend. A thread counts as supervised only once its status-file write is verified.

Kimi#

Kimi has no project-level hooks. A captain-approved global config region in ~/.kimi-code/config.toml (bin/fm-kimi-turnend-hook.sh) gives crew wakes. It is not usable as a primary.

Supervision host (non-Pi primaries)#

The supervision host runs the supervision-branch contract on a headless engine beside your primary (bin/fm-supervision-host.sh). It is on by default for Claude, so no file is needed there. Cursor, OpenCode, omp, Grok, Codex and agy need config/supervision-host. A present config/supervision-host-off, whatever it holds, disables it on any harness, and secondmate homes inherit that opt-out from the primary. config/supervision-host only opts in and picks the engine; it no longer accepts off, and it is not inherited. Each harness's existing arm owner runs the host in place of the raw watcher.

Opt-in config/supervision-handoff-ack (an empty presence flag, Claude only, not inherited) makes the host's hand-back to main acknowledged. A detached owner keeps a watcher up and retries delivery every FM_SUPERVISION_HANDOFF_RETRY_SECONDS (default 300) until main acknowledges. Automatic retries need a verified tmux or herdr pane. On herdr the pane's agent must be claude, and it must read idle in both its native state and the rendered footer.

Away Attended
Claude, Cursor ✓ ✓ (via the fm-host-mirror.sh dialog mirror)
OpenCode, omp, Grok, Codex ✓ pass-through

Kun's harness split#

for video generation and real time info, i use grok build. image generation uses codex - this is because of harness capability. for claude models i use claude code - because their TOS does not allow any other harness. everything else is pi. — @kunchenguid, 2026-08-05 thread

Unofficial guide built 2026-09-26 from kunchenguid/firstmate, the AXI repos, and Kun Chen's public posts. The repo moves daily; when this guide and the repo disagree, the repo wins.