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.jsonregisters these hooks:SessionStart→bin/fm-sessionstart-run.shPreToolUseseatbelts:fm-arm-pretool-check.sh,fm-cd-pretool-check.sh,fm-subagent-pretool-check.shUserPromptSubmit→fm-host-mirror.shStop→fm-turnend-guard.sh --claude, thenfm-claude-stop-autoarm.sh(asyncRewake: true, 28800s timeout)StopFailure→fm-claude-stop-autoarm.shagain, 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 perFM_CLAUDE_STOPFAILURE_REWAKE_COOLDOWN(default 300 seconds), never dropped. - Model instruction: drain wakes with
bin/fm-wake-drain.shand never re-arm by hand. - Workers:
config/claude-permission-modesetsbypass(default) orauto.bin/fm-claude-trust.shpre-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'sautoor Codex'sapprove-for-mein the absent mode file and relaunches the worker. Nothing detects this automatically. /calmneedsCLAUDE_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.
/doctorshows the cost;skillListingBudgetFractionraises 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_AGENTorGROK_HOOK_EVENTshows 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/*.tsauto-load after you approve project trust once per clone:fm-primary-pi-watch.ts— watcher bridge; exposes thefm_watch_arm_pitoolfm-branch-supervision.ts— the in-process supervision branchfm-primary-turnend-guard.tsfm-calm.ts
- Seeded secondmates:
fm-spawn.shadds--approveto Pi and pi-signed secondmate launches in Firstmate-seeded homes when the installed pi's--helplists it. They skip "Trust project folder?". The approval lasts one session and never rewritestrust.json. Worker launches never get it. - Fallback if the extensions didn't load: restart
piwith 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-modelpins the branch to a cheaper model and effort.FM_PI_HARNESS=pi-signed pi-signedfor the signed wrapper.
omp (Oh My Pi)#
- Wiring:
.omp/extensions/holdsfm-primary-omp-watch.tsand the turn-end guard. No trust gate. Startompwith the checkout as cwd. Don't also pass-e, or they load twice. - Guard: a blocking
session_stophook compels a continuation, bounded to one per turn bystop_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-agentruns as a process namedbun. It is now detected as omp; before, it read asunknownand the session lock refused.
Grok#
- Wiring: there is no extension. The model arms the watcher itself through Grok's
run_terminal_commandwithbackground: true. Grok injects a synthetictask_completedmessage 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 --trustonce per clone, or run/hooks-trust. Headlessgrok -pis unsupported as primary. - Version trap: Grok 1.0.0 hook processes carry
GROK_HOOK_EVENT/GROK_SESSION_IDbut notGROK_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 toGROK_SESSION_ID, which leaks into child Claude sessions.
Cursor Agent CLI#
- Wiring:
.cursor/hooks.jsonstop→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_messageon an actionable wake. It is bounded by Cursor'sloop_limitand byFM_CURSOR_TURNEND_LOOP_CEILING(180). - Must launch with
--trust, or no project hooks load. Must be interactive:cursor-agent -phas no stop hook.
Antigravity CLI (agy)#
- Wiring: a tracked project-local
.agents/hooks.jsonregisters these hooks:SessionStart→bin/fm-sessionstart-agy.shPreToolUseseatbelts:fm-arm-pretool-check.sh --agy,fm-cd-pretool-check.sh --agy,fm-subagent-pretool-check.sh --agyStop→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.jsonother than a named hook spec (such as aversionfield) silently disables the whole file. bin/fm-spawn.shpre-registers a secondmate home in agy's workspace trust store throughbin/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.jslistens forsession.idle, spawnsfm-watch-arm.sh --restart, and delivers wakes withclient.session.promptAsync.fm-primary-pretool-check.jsis the seatbelt. - OpenCode 2: supported since 2026-10-23. Each primary plugin also exports a default
{ id, setup }. Fromsetup(ctx)it subscribes to the terminalsession.execution.*events withctx.event.subscribeand wakes throughctx.session.prompt. The 1.xserverexport is kept, so 1.x runs that one. Start a 2.x primary or secondmate home withopencode --standalone, so its plugins run with the home's ownFM_HOME. - TUI only.
opencode runis 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 canonicalcodex-cli major.minor.patchrelease 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 withcodex queue --thread. Every other session keeps the checkpoint loop, including a prerelease, malformed or below-minimum version, or a failed version probe. .codex/hooks.jsonholds the seatbelt and Stop guard.- Skills are invoked with
$instead of/:$afk,$bearings. - Codex Desktop threads are a companion workflow (
firstmate-codexappskill), 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