Skip to content

feat: Add Kiro CLI crewmate harness with V3 engine default - #8

Merged
davidtandoh merged 45 commits into
mainfrom
fm/kiro-v3-crew
Sep 27, 2026
Merged

davidtandoh merged 45 commits into
mainfrom
fm/kiro-v3-crew

Conversation

@davidtandoh

@davidtandoh davidtandoh commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

Intent

Add Kiro CLI as a Firstmate crewmate and scout harness on the owner's fork (davidtandoh/firstmate) so 'kiro' can appear in config/crew-dispatch.json as a quota-aware fallback after codex and agy. The owner runs Kiro with the V3 agent engine ('kiro-cli --v3'), a Claude Code captain, Codex crewmates and the Herdr backend. Decisions: build on upstream PR kunchenguid#4679 (John Marshall's Kiro adapter, merged in with --no-ff to keep his 42 commits and authorship) rather than a parallel adapter; add config/kiro-engine (v3 default, v2 kept byte-identical to kunchenguid#4679, any other value refuses the spawn before a pane exists; secondmates inherit it); engine-aware launch and --list-models pass --agent-engine ; V2 keeps --agent firstmate, V3 names no agent. Because Kiro 2.24.1's V3 engine resolves agents, hooks and ~/.kiro/tasks from the real HOME and ignores KIRO_HOME except for TUI settings/history (verified by reading the installed bundles and a guarded quota probe), the V3 busy/turn-end path installs a global hook pair ~/.kiro/hooks/firstmate-crew.json with dispatchers that stay silent unless the cwd holds a git-excluded .fm-kiro-hook token registered under ~/.kiro/hooks/fm-kiro.d/, so ordinary Kiro sessions are unaffected; relaunch and teardown retire the token. Tool trust keeps --trust-all-tools plus the seeded chat.disableTrustAllConfirmation, matching other unattended adapters, rejecting an explicit --trust-tools= list because unlisted tools would prompt with nobody to answer. Quota maps harness kiro to quota-axi provider kiro (never claude); the owner's quota-axi fork reads Kiro credits only while Kiro is idle, so dispatch sees Kiro quota as unknown while a Kiro crewmate runs, which quota-array-dispatch treats as eligible with disclosed uncertainty. Known race: a quota read starting within ~1s of a Kiro launch can clear that task's running status; accepted and documented. The branch then merged the synced fork main (2f9a106) with --no-ff (merge caab39c); the only textual conflict was bin/fm-test-run.sh's live-e2e family list (kept both). Kiro only runs as a crewmate, so it stays out of fm-session-lock-lib's FM_HARNESS_NAMES; it uses the fork's registration-independent Herdr liveness via the exact name kiro-cli. Adding kiro to tests/fm-herdr-agent-liveness-live-e2e.test.sh is deferred because it would start kiro-cli chat; the owner-approved live canary (spawn one Kiro scout, confirm busy/turn-end and liveness in Herdr, teardown) will prove the V3 lifecycle after merge. Four tests fail identically on clean origin/main on this Mac (fm-harness-precedence, fm-session-start, fm-procevent needs setsid, fm-backend under zsh) and are pre-existing. Existing PR #8 was opened directly with gh and must be published through no-mistakes.

What Changed

  • Adds kiro (Kiro CLI) as a crewmate and scout harness, built on upstream PR feat(bin): run crewmates and scouts on Kiro CLI kunchenguid/firstmate#4679's adapter. The branch merges that PR's commits with --no-ff. Changes span bin/fm-spawn.sh, fm-harness.sh, fm-control-lib.sh, fm-composer-lib.sh, fm-busy-lib.sh, fm-teardown.sh, fm-dispatch-resolve.sh and fm-agent-process-lib.sh:
    • A new config/kiro-engine file selects v3 (the default) or v2. Any other value refuses the spawn before a pane exists, and secondmates inherit the setting.
    • Launch and --list-models pass --agent-engine <engine>. V2 keeps --agent firstmate; V3 names no agent.
    • Each task gets its own KIRO_HOME with chat.disableTrustAllConfirmation seeded, so --trust-all-tools runs unattended.
  • Busy and turn-end signals on V3 come from a global hook pair, ~/.kiro/hooks/firstmate-crew.json. Its dispatchers do nothing unless the working directory holds a git-excluded .fm-kiro-hook token registered under ~/.kiro/hooks/fm-kiro.d/, so ordinary Kiro sessions are unaffected. Relaunch and teardown retire the token and remove the per-task Kiro home.
  • Quota maps harness kiro to quota-axi provider kiro. The branch also merges the synced fork main and keeps both sides of the bin/fm-test-run.sh live-e2e list conflict. It adds docs/verification/kiro.md and references/harness/kiro.md, updates configuration, architecture and skill docs, and adds tests/fm-kiro-harness.test.sh and tests/fm-kiro-signals-live-e2e.test.sh, plus Kiro cases in the busy-wiring, composer, dispatch, bootstrap and quota tests.

Risk Assessment

⚠️ Medium: The V3 path writes a firstmate-owned global hook pair into the owner's real ~/.kiro/hooks, and the dispatchers are cwd-token-gated and exit 0 in any other session; the V3 lifecycle has not yet been proven live (deferred to the owner-approved canary), so the change is safe to merge but carries unverified runtime behaviour.

Testing

Six focused test scripts passed, run one at a time through fm-test-run.sh. They were the Kiro harness fixture suite plus the busy-wiring, composer, quota-choose, dispatch-resolve and bootstrap tests, with timing JSON kept for each. Two checks ran live against the real kiro-cli 2.24.1 and the real fm-spawn.sh in a disposable lab home. The first confirmed that the engine-aware model listing works on v3 and v2 and that kiro-cli rejects any other engine value. The second confirmed that unknown engines and unlisted models are refused before any state or pane is created, and that ~/.kiro/hooks is untouched. A successful V3 spawn was deliberately not run. It would start a paid kiro-cli chat and write global hooks under the real ~/.kiro, and the intent reserves that for the owner's post-merge canary. The guard hook blocked removal of two small temp dirs in $TMPDIR, and they were left in place. The worktree is clean.

  • Live validation: ✅ go - 4 of 7 scenarios driven live against the product
Scenario Result Live Evidence
An unknown config/kiro-engine (v9) makes fm-spawn --harness kiro refuse, naming the accepted values, with no state or tmux session created ✅ pass live ~/.no-mistakes/evidence/01M3H0PD6R9RAC7675WHEQQA1S/kiro-spawn-guards-live.log (Scenario A: rc=1, empty state/, no lab tmux server)
The real kiro-cli 2.24.1 accepts the engine-aware listing on v3 and v2 and rejects other engines ✅ pass live ~/.no-mistakes/evidence/01M3H0PD6R9RAC7675WHEQQA1S/kiro-list-models-live.log (v3/v2 rc=0 JSON catalog; bogus rc=2)
With no engine file (v3 default) and with v2, an unlisted --model is refused against the real Kiro catalog before any pane exists ✅ pass live ~/.no-mistakes/evidence/01M3H0PD6R9RAC7675WHEQQA1S/kiro-spawn-guards-live.log (Scenarios B and C)
Refused spawns leave the global ~/.kiro/hooks untouched, so ordinary Kiro sessions are unaffected ✅ pass live kiro-spawn-guards-live.log final check: unchanged
V3 launch has --agent-engine v3 and no agent name, V2 keeps --agent firstmate, --trust-all-tools is used, and the guarded global hook pair and token are installed and then retired on teardown ⏸️ untested no The prior payload showed this only through fixture tests (tests/fm-kiro-harness.test.sh), not a live run. A real V3 spawn would start a paid kiro-cli chat and write ~/.kiro/hooks in the real HOME, and…
Kiro busy/turn-end hook records drive the busy state; composer/footer detection; quota maps kiro to the kiro provider; dispatch resolves kiro as a fallback ⏸️ untested no The prior payload showed this only through isolated fixture tests (busy-wiring, composer, quota, dispatch). Live hook firing needs a running Kiro V3 crewmate, which is the owner-approved post-merge ca…
Live V3 lifecycle in Herdr: spawn one Kiro scout, observe busy/turn-end and kiro-cli liveness, then tear down ⏸️ untested no The intent explicitly defers this to the owner-approved live canary after merge. It needs owner approval to write global ~/.kiro/hooks and spend Kiro credits, run through bin/fm-herdr-lab.sh with a --…
Evidence: Live fm-spawn kiro guard transcript (lab home)

Source: Live fm-spawn kiro guard transcript (lab home)

kiro-cli: kiro-cli 2.24.1
\### Scenario A: config/kiro-engine=v9 (unknown)
fm-gate-refuse: gate agent lifecycle permitted only against lab home /var/folders/wj/q35z6lgs5zx716wvy69ctcy80000gn/T//fm-lab.MxmFg1
error: config/kiro-engine holds 'v9'; accepted values are: v3 (the default when the file is absent), v2
rc=1
state after A:
lab tmux sessions:
error connecting to /private/var/folders/wj/q35z6lgs5zx716wvy69ctcy80000gn/T/fm-lab.MxmFg1/tmux/tmux-501/fm-lab (No such file or directory)

\### Scenario B: engine v3 (file absent), unlisted model checked against real kiro-cli V3 catalog
fm-gate-refuse: gate agent lifecycle permitted only against lab home /var/folders/wj/q35z6lgs5zx716wvy69ctcy80000gn/T//fm-lab.MxmFg1
error: kiro model 'not-a-real-model' is not listed by 'kiro-cli --list-models'; choose a listed model_id or omit --model
rc=1
state after B:
lab tmux sessions:
error connecting to /private/var/folders/wj/q35z6lgs5zx716wvy69ctcy80000gn/T/fm-lab.MxmFg1/tmux/tmux-501/fm-lab (No such file or directory)

\### Scenario C: engine v2, unlisted model checked against real kiro-cli V2 catalog
fm-gate-refuse: gate agent lifecycle permitted only against lab home /var/folders/wj/q35z6lgs5zx716wvy69ctcy80000gn/T//fm-lab.MxmFg1
error: kiro model 'not-a-real-model' is not listed by 'kiro-cli --list-models'; choose a listed model_id or omit --model
rc=1
state after C:

~/.kiro/hooks untouched:
unchanged
Evidence: Live kiro-cli --agent-engine --list-models per engine

Source: Live kiro-cli --agent-engine --list-models per engine

== engine=v3
{"models":[{"model_name":"auto","description":"Models chosen by task for optimal usage and consistent quality","model_id":"auto","context_window_tokens":1000000,"rate_multiplier":1.0,"rate_unit":"Credit"},{"model_name":"claude-opus-5.5","description":"Experimental preview of Claude Opus 5.5 model with 1M context window","model_id":"claude-opus-5.5","context_window_tokens":1000000,"rate_multiplier":2.0,"rate_unit":"Credit"},{"model_name":"claude-opus-5","description":"Claude Opus 5 model with 1M context window","model_id":"claude-opus-5","context_window_tokens":1000000,"rate_multiplier":2.2,"rate_unit":"Credit"},{"model_name":"claude-sonnet-5","description":"Claude Sonnet 5 model with 1M context window","model_id":"claude-sonnet-5","context_window_tokens":1000000,"rate_multiplier":1.3,"rate
rc=0
== engine=v2
{"models":[{"model_name":"auto","description":"Models chosen by task for optimal usage and consistent quality","model_id":"auto","context_window_tokens":1000000,"rate_multiplier":1.0,"rate_unit":"Credit"},{"model_name":"claude-opus-5.5","description":"Experimental preview of Claude Opus 5.5 model with 1M context window","model_id":"claude-opus-5.5","context_window_tokens":1000000,"rate_multiplier":2.0,"rate_unit":"Credit"},{"model_name":"claude-opus-5","description":"Claude Opus 5 model with 1M context window","model_id":"claude-opus-5","context_window_tokens":1000000,"rate_multiplier":2.2,"rate_unit":"Credit"},{"model_name":"claude-sonnet-5","description":"Claude Sonnet 5 model with 1M context window","model_id":"claude-sonnet-5","context_window_tokens":1000000,"rate_multiplier":1.3,"rate
rc=0
== engine=bogus
error: invalid value 'bogus' for '--agent-engine <ENGINE>'
  [possible values: v2, v1, v3]

For more information, try '--help'.

rc=2
Evidence: Kiro harness test output

Source: Kiro harness test output

FM_TEST_BEGIN 2026-09-27T08:47:59Z tests/fm-kiro-harness.test.sh family=pure-contract-unit expected_gate_skip=none
ok - fm-harness.sh: ancestry detects the kiro-cli command
ok - fm-harness.sh: ancestry rejects unrelated kiro mentions
ok - fm-harness.sh: kiro's ancestry outranks an inherited CLAUDECODE (markerless harness)
ok - fm-agent-process-lib: kiro-cli is an agent, unrelated names are not
ok - fm-control-lib: kiro control mechanics are Escape / single / /quit, crewmate-scout only
ok - fm-control-lib: kiro wiring paths are the out-of-tree hook config, its scripts, and the V3 pointer and token
ok - fm-quota-axi-lib: kiro reads the kiro quota provider, not claude
ok - fm-busy-lib: kiro-hook is kiro's trusted source and is scoped to kiro
ok - fm-busy-lib: the kiro-hook record is kiro's only state source; no record is unknown
ok - fm-composer-lib: kiro's › composer is empty and its real idle row is empty styled, unknown plain
ok - fm-composer-lib: the harness-less union sees kiro's busy footer in every mode and separator, not its idle row or prose naming the phrase, and harness=kiro is fail-closed
ok - fm-spawn: kiro launch carries brief, V2 engine, agent, model, effort with cleared markers
ok - fm-spawn: an absent config/kiro-engine launches V3 with no agent name, validating against the V3 catalog
ok - fm-spawn: a V3 kiro spawn installs the guarded global hook pair and a token pointer that teardown retires
ok - fm-spawn: an unknown config/kiro-engine refuses before any pane is created
ok - fm-spawn: kiro writes an out-of-tree per-task hook config and trust setting, never the worktree's .kiro/
ok - fm-spawn: kiro passes the full effort vocabulary including xhigh
ok - fm-spawn: an unlisted kiro model refuses before any pane is created
ok - fm-spawn: a kiro hook path containing whitespace refuses before any pane is created
ok - fm-spawn: a worktree agent config named firstmate refuses before any pane is created
ok - fm-spawn: a pretty-printed kiro listing validates listed models and refuses unlisted ones
ok - fm-spawn: a kiro listing with no readable model_id establishes nothing and launches
ok - fm-spawn: an unreachable kiro listing establishes nothing and launches
ok - fm-spawn: a hung kiro listing is cut off and launches unvalidated
ok - fm-spawn: a kiro secondmate launch is refused
ok - fm-teardown: kiro's per-task home is removed on teardown
FM_TEST_END 2026-09-27T08:48:42Z tests/fm-kiro-harness.test.sh exit=0 duration_ms=43308 gate_skip=false
FM_TEST_SUMMARY total=1 failed=0 skipped_gate=0 duration_ms=43370
FM_TEST_SUMMARY_FAMILY family=pure-contract-unit count=1 duration_ms=43308 failed=0
FM_TEST_SLOWEST rank=1 script=tests/fm-kiro-harness.test.sh duration_ms=43308
fm-test-run: wrote timing artifact: ~/.no-mistakes/evidence/01M3H0PD6R9RAC7675WHEQQA1S/kiro-harness-timing.json
FM_TEST_BUDGET max_wall_ms=400000 duration_ms=43370
Evidence: Kiro harness timing

Source: Kiro harness timing

{
  "families": [
    {
      "count": 1,
      "duration_ms": 43308,
      "failed": 0,
      "name": "pure-contract-unit"
    }
  ],
  "finished_at": "2026-09-27T08:48:42Z",
  "run_id": "fm-test-run-1790498879150-90686",
  "scripts": [
    {
      "duration_ms": 43308,
      "exit": 0,
      "expected_gate_skip": "none",
      "family": "pure-contract-unit",
      "gate_skip": false,
      "gate_skip_reason": "",
      "path": "tests/fm-kiro-harness.test.sh"
    }
  ],
  "selection": "scripts;jobs=1",
  "started_at": "2026-09-27T08:47:59Z",
  "summary": {
    "duration_ms": 43370,
    "failed": 0,
    "skipped_gate": 0,
    "total": 1
  }
}
Evidence: Busy adapter wiring test output

Source: Busy adapter wiring test output

FM_TEST_BEGIN 2026-09-27T08:48:45Z tests/fm-busy-adapter-wiring.test.sh family=standalone expected_gate_skip=none
ok - pi extension reports agent_start busy, settles idle only via ctx.isIdle(), and keeps turn_end a notification
ok - pi extension awaits agent_settled before the next agent_start without a test delay
ok - pi extension events from a superseded incarnation are rejected as stale
ok - kimi and grok install no unverified semantic wiring and classify through their own gates
ok - opencode plugin classifies from session.status, scoped to the latched worker session
ok - claude hooks open on UserPromptSubmit and close on Stop, StopFailure, and SessionEnd
ok - claude hook events from a superseded incarnation are rejected without breaking the hook
ok - gemini hooks open on BeforeAgent and close on AfterAgent and a repeated SessionEnd
ok - gemini hook events from a superseded incarnation are rejected without breaking the hook
ok - raw gemini launch remains unwired and classifies unknown
ok - gemini is refused as a secondmate because it has no primary supervision protocol
ok - kiro hooks open on userPromptSubmit and close on stop, keeping the turn-end touch
ok - kiro hook events from a superseded incarnation are rejected without breaking the hook
ok - kiro V3 global hooks open on UserPromptSubmit and close on Stop only from the task's worktree
ok - raw kiro launch remains unwired and classifies unknown
ok - codex classifies unknown until a semantic source is verified, never idle or footer-matched
all fm-busy-adapter-wiring tests passed
FM_TEST_END 2026-09-27T08:49:39Z tests/fm-busy-adapter-wiring.test.sh exit=0 duration_ms=53341 gate_skip=false
FM_TEST_SUMMARY total=1 failed=0 skipped_gate=0 duration_ms=53386
FM_TEST_SUMMARY_FAMILY family=standalone count=1 duration_ms=53341 failed=0
FM_TEST_SLOWEST rank=1 script=tests/fm-busy-adapter-wiring.test.sh duration_ms=53341
fm-test-run: wrote timing artifact: ~/.no-mistakes/evidence/01M3H0PD6R9RAC7675WHEQQA1S/fm-busy-adapter-wiring-timing.json
FM_TEST_BUDGET max_wall_ms=400000 duration_ms=53386

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 1 info
  • ℹ️ bin/fm-control-lib.sh:425 - The kiro arm of fm_control_harness_wiring_paths retires the V3 worktree pointer (.fm-kiro-hook) but not the state-side token file $state/$id.kiro-hook-token. The grok and kimi arms list their token files in the same place. Example: a V3 kiro task is relaunched onto another harness. clear_relaunch_harness_wiring deletes the registry entry and the pointer, but the stale token file stays until teardown. Teardown then reads it and runs rm -f on a registry path that no longer exists. This is harmless, but it breaks the grok/kimi retirement shape. Separately, the comment above this arm still says "nothing in the captain's real ~/.kiro is touched", which is no longer true now that V3 installs ~/.kiro/hooks/firstmate-crew.json and the fm-kiro.d registry. Fix: add printf '%s\n' "$state/$id.kiro-hook-token" to the kiro arm, extend the expected list in test_kiro_wiring_path_is_the_out_of_tree_hook_config, and update the comment.
✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 4 of 7 scenarios driven live against the product
Scenario Result Live Evidence
An unknown config/kiro-engine (v9) makes fm-spawn --harness kiro refuse, naming the accepted values, with no state or tmux session created ✅ pass live ~/.no-mistakes/evidence/01M3H0PD6R9RAC7675WHEQQA1S/kiro-spawn-guards-live.log (Scenario A: rc=1, empty state/, no lab tmux server)
The real kiro-cli 2.24.1 accepts the engine-aware listing on v3 and v2 and rejects other engines ✅ pass live ~/.no-mistakes/evidence/01M3H0PD6R9RAC7675WHEQQA1S/kiro-list-models-live.log (v3/v2 rc=0 JSON catalog; bogus rc=2)
With no engine file (v3 default) and with v2, an unlisted --model is refused against the real Kiro catalog before any pane exists ✅ pass live ~/.no-mistakes/evidence/01M3H0PD6R9RAC7675WHEQQA1S/kiro-spawn-guards-live.log (Scenarios B and C)
Refused spawns leave the global ~/.kiro/hooks untouched, so ordinary Kiro sessions are unaffected ✅ pass live kiro-spawn-guards-live.log final check: unchanged
V3 launch has --agent-engine v3 and no agent name, V2 keeps --agent firstmate, --trust-all-tools is used, and the guarded global hook pair and token are installed and then retired on teardown ⏸️ untested no The prior payload showed this only through fixture tests (tests/fm-kiro-harness.test.sh), not a live run. A real V3 spawn would start a paid kiro-cli chat and write ~/.kiro/hooks in the real HOME, and…
Kiro busy/turn-end hook records drive the busy state; composer/footer detection; quota maps kiro to the kiro provider; dispatch resolves kiro as a fallback ⏸️ untested no The prior payload showed this only through isolated fixture tests (busy-wiring, composer, quota, dispatch). Live hook firing needs a running Kiro V3 crewmate, which is the owner-approved post-merge ca…
Live V3 lifecycle in Herdr: spawn one Kiro scout, observe busy/turn-end and kiro-cli liveness, then tear down ⏸️ untested no The intent explicitly defers this to the owner-approved live canary after merge. It needs owner approval to write global ~/.kiro/hooks and spend Kiro credits, run through bin/fm-herdr-lab.sh with a --…
  • bin/fm-test-run.sh tests/fm-kiro-harness.test.sh --jobs 1 --per-script-timeout-secs 300 --max-wall-ms 400000 --json &lt;evidence&gt;/kiro-harness-timing.json (26 kiro cases ok)
  • bin/fm-test-run.sh tests/fm-busy-adapter-wiring.test.sh (rc=0)
  • bin/fm-test-run.sh tests/fm-composer-lib.test.sh (rc=0)
  • bin/fm-test-run.sh tests/fm-quota-choose.test.sh (rc=0)
  • bin/fm-test-run.sh tests/fm-dispatch-resolve.test.sh (rc=0)
  • bin/fm-test-run.sh tests/fm-bootstrap.test.sh (rc=0)
  • Live: KIRO_HOME=&lt;tmp&gt; kiro-cli chat --agent-engine {v3,v2,bogus} --list-models -f json against the real kiro-cli 2.24.1
  • Live: bin/fm-spawn.sh ... --harness kiro in a disposable fm-lab-home (lab tmux socket), with config/kiro-engine=v9, then absent (v3) + --model not-a-real-model, then v2 + --model not-a-real-model
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Claude-shaped kiro-cli adapter (V2 engine only; v3/KAS out of scope,
unsupported on Amazon Linux 2). Ancestry detection on the anchored
process name kiro-cli in fm-harness.sh and liveness naming in
fm-agent-process-lib.sh; launch template in fm-spawn.sh carries the
brief positionally on --agent-engine v2 with --agent, --trust-all-tools,
model, and full low|medium|high|xhigh|max effort, plus reachable-catalog
model validation.

Turn-end and busy hooks (userPromptSubmit opens, stop closes and keeps
the turn-ended touch) live in a firstmate-owned per-task agent config
written under state/<id>.kiro-home/agents/firstmate.json and reached by
relocating KIRO_HOME, never the worktree's own .kiro/ (--agent is
name-only, so a config path is rejected); the same per-task home seeds
chat.disableTrustAllConfirmation to suppress the --trust-all-tools modal,
while auth in the XDG data dir is untouched. Two independent busy signals:
the kiro-hook record (primary) and the rendered Kiro is working footer
(fm-busy-lib.sh / fm-composer-lib.sh). Control mechanics in
fm-control-lib.sh (Escape interrupt, /quit exit, crewmate/scout-only
refusal, out-of-tree wiring retirement); teardown removes the per-task
home. Router entry and references/harness/kiro.md, dated
docs/verification/kiro.md, portable regression plus opt-in live drift
guard.

Verified live on kiro-cli 2.21.4 (V2): per-turn userPromptSubmit and
stop hooks, busy footer, single-Escape cancel, and /quit exit with its
resume-id line.
…fail"

This reverts commit 7092df1681802c2357f697d3194bbb9a4875f2eb.

That round strengthened three live-guard assertions at once and each
strengthening carried its own defect: the leading-glyph predicate compared
one byte and so rejected kiro's real composer row outside a UTF-8 locale,
the foreground-name predicate was added but never called by the guard, a
portable negative ended in `|| true` and asserted nothing, the resume-line
hard fail could redden on a healthy tool because a full-screen TUI exit
leaves no captured output, and the union settled-pane negative ran at a
settle point no tool call precedes, where the row it looks for cannot
appear.

The weaknesses it aimed at are real and are recorded as unproven instead,
along with the traps any future attempt has to avoid. Strengthening the
guard is separate work from adding the adapter.
The guard's resume-line check passes whether or not the resume line
appears, it never asserts the composer glyph, and its settled-pane
negative runs against a signature with no production caller. Record all
three as unproven rather than leaving the guard's header implying
otherwise, and record the union stale-row hazard as an inference from the
token list and delivery path - not an observation, since no run has been
seen doing it.

Also record the four traps that make strengthening those assertions its
own piece of work: byte-wise glyph matching breaks outside UTF-8, an
inline assertion leaves the portable negatives proving an unused
predicate, a trailing `|| true` swallows both outcomes, and a resume-line
check after exit can redden on a healthy tool.
The guard waits on real model turns, so its runtime is unbounded and a
step-capped agent invocation cannot contain it - one attempt spent 64
minutes across two invocations and died on a 30-minute cap without
reporting a result. Say so in its header, and say where a reader meets it
that the portable regression is what CI enforces and does not cover the
vendor-rendered surface, so a green suite is not evidence these signals
still work.
A validation run driving the real kiro-cli reports that the real idle kiro
composer classifies as pending rather than proven-empty, so fm-send never
types a steer into a kiro worker. Ten of its eleven live scenarios passed
and this was the one failure. Recorded as that run's observation, not as an
established fact, because it is not independently reproduced.

Two candidate causes are ruled out by measurement: restoring the absent
kiro entry to the fleet-wide idle-placeholder set changes no verdict, and
the bare composer row classifies unknown rather than pending, so the
verdict comes from the surrounding screen. A worker that cannot be steered
does not satisfy the crewmate contract, so this blocks using the adapter.
My earlier record said the real idle kiro composer classifies as unknown at
both styled and unstyled capture. That was measured with no capability
argument and a row carrying no dim escape codes, which is not a styled
capture, so the verdict was an artifact of the input. With the capabilities
a styled capture actually carries the styled row classifies empty, matching
the portable fixture, and the inference that the pending verdict came from
the surrounding screen rested on the bad measurement and is withdrawn.

What stands: restoring the absent kiro idle-placeholder entry changes no
verdict, re-tested with correct inputs. The fixture's empty result is
reproducible on its own input but is not confirmed faithful to the real
pane, since the live run measured pending there. Say that at both sites,
and mark the reference page's composer row as an open defect so an agent
handed it at spawn does not read empty as established.
…read empty

A real idle kiro composer classified as pending, and the doorbell defers on an
exact pending, so every steer to a kiro worker was skipped and the watcher
re-rang forever. The cause is a colour threshold, not anything kiro-specific:
kiro draws its placeholder in truecolor near-gray at luminance 158, above the
128 ghost ceiling, so the strip left it in place and it read as typed text.
rovo has the same defect at 162.9 and recorded it as an open gap needing a
harness-scoped signal the shared classifier does not carry.

Chromaticity is that signal, and it is intrinsic to the run, so nothing had to
be threaded through the shared composer entry points. A near-achromatic
truecolor run now gets a higher ceiling (default 180 within a channel spread of
12); anything more saturated keeps 128. That separates every measured case:
kiro's ghost at spread 0 and rovo's at spread 3 strip, rovo's real typed text
is near-gray but separated by luminance at 207.0 and is kept, and muse's real
glyph at spread 165 is unreachable by any luminance ceiling. Non-truecolor runs
are unchanged.

Verified two ways: the four measured cases are pinned and fail on pre-fix code,
with rovo's real text and muse's glyph as explicit non-regression assertions;
and a capture of a live kiro pane classified with tmux's own descriptor returns
empty where it returned pending. Fixes the recorded rovo gap in the same change.
The 256-colour fix reached further than authorized: it also treated the 6x6x6
cube diagonal as grey, and pinned that with a test asserting a cube index must
strip. Only the 232-255 greyscale ramp was approved, because that range alone
has RGB fixed by definition rather than by a theme, so it needs no palette
guessing. Narrow the predicate to the ramp and turn that test around into a
scope guard: an index outside 232-255 must be untouched. That case is what
stops the next widening into indices where palette dependence is real.

Record why the gap existed at all. The carve-out saying a 38;5 index is never
luminance-tested was written down, which made it checkable, and driving a real
crewmate on a pane without COLORTERM turned it from a footnote into a defect:
the fix worked on every truecolor pane and left the original failure fully live
everywhere else. A limit stated plainly can be tested against reality.
Upstream's codex 0.154 starfield fixture used near-gray cells incidentally, so
its non-vacuousness guard broke once the near-gray ghost ceiling stripped them.
Correct that guard and its comment to the present truth - the ceiling clears
both starfield rows - and re-express its divergence as a colour one, since
redrawing those positions as letters in a kept colour is what now proves the
verdict comes from the ghost strip.

The braille-furniture rule keeps its coverage in test_braille_furniture_rule,
built on chromatic cells (38;2;120;190;255, luminance 176.5, channel spread
135) that survive the strip at any gray ceiling, so the rule is proven by shape
rather than by a colour accident. The same cells as letters stay pending.
… this PR adds two portable-serial test scripts (tests/fm-kiro-harness.test.sh, tests/fm-kiro-signals-live-e2e.test.sh) with no duration hint in bin/fm-test-run.sh, taking the unmeasured serial share from 25/173 (14.5%) to 27/175 (15.4%), over PORTABLE_SERIAL_MAX_UNHINTED_PERCENT (15). That fails "Test coverage guard" directly, and tests/fm-test-run.test.sh (in "Behavior portable parallel 1") fails on the same guard call — its CI log ends immediately after the guard output with exit=1. Fix (smallest correct, evidence-based): - bin/fm-test-run.sh: added two lines to portable_serial_weight_hints with the durations measured by the green serial shards of the PR's own run 35171933923 — tests/fm-kiro-harness.test.sh 24667, tests/fm-kiro-signals-live-e2e.test.sh 76 (the live guard is gate-skipped in CI, so its value matches the existing 20-76 ms convention for other CI-skipped live-e2e scripts). - docs/fm-test-portable-shards.md: recorded the provenance of those two hints (one sample each, from run 35171933923, first run to include them) and stated plainly that the 76 ms is the gate-skip cost, not a measurement of the live guard's work. Verified locally: bin/fm-test-run.sh --check-coverage now prints FM_TEST_COVERAGE ok total=215 parallel=24 parallel_unhinted=0 serial=175 serial_shards=5 serial_unhinted=25 herdr=16. Running tests/fm-test-run.test.sh, all shard/hint assertions pass: "portable shard union, disjointness, and coverage guard hold", "portable parallel lanes are fully hinted and packed within 5% of each other", "portable serial shards are a deterministic disjoint cover of the serial lane", "coverage guard reports and bounds the unmeasured portable serial share"; "portable serial shard lanes refuse mismatched, out-of-range, and countless names" passes when run in isolation. Local-environment caveat (not a code defect, no change made for it): a full run of tests/fm-test-run.test.sh on this machine aborts in an unrelated later test with "mktemp: mkdtemp failed ... No space left on device" — the host data volume has ~275 MB free. That is host disk exhaustion, not the PR; the same test passes standalone. No other code, test, or behavior was changed; no new guards or machinery added
The wholesale KIRO_HOME relocation is recorded as the forced choice it is, but
the additive alternative sat in that sentence as a bare contrast with gemini.
Name it as follow-up work so a reader does not read the empty per-task home as
a harness limitation.
Marsjohn-11 and others added 12 commits September 18, 2026 23:53
Bring in John Marshall's Kiro CLI crewmate/scout adapter from
kunchenguid#4679 (head 9637826) with its authorship intact,
so the fork can build a V3-engine launch on top of it.

The PR branched from 65a3bac, 122 commits behind upstream main. Main
has since added the devin adapter, the worker-account pin and staged
launch files, so the conflicts were mostly adapter lists. Resolution:

- Keep devin and add kiro in every adapter list, including the new
  interrupt arm, press-gap and hazard helpers in fm-control-lib.sh,
  the AFK test pin and the supervision-branch primary pin.
- Keep main's worker-account block and the PR's kiro model and hook
  path validation as separate steps.
- Union the delivery busy regex so both the devin rows and the kiro
  footer acknowledge a submit.
- Remove a secondmate child's kiro home in teardown as well.
- Teach the kiro test's fake tmux to read the staged launch file that
  main's kunchenguid#4994 now sources, so launch assertions see the real command.

Claude-Session: https://claude.ai/code/session_01B4Krq5gHjEPXbmzMaaeTHs
Kiro serves several vendors' models on Kiro credits, so quota-aware
dispatch must read quota-axi's own kiro provider row rather than the
claude row. Neither harness-to-provider table knew kiro, so the
resolver demanded an explicit provider on every kiro profile and the
legacy chooser refused kiro as an unknown harness.

Add kiro -> kiro to both tables in fm-quota-axi-lib.sh. quota-axi
reports kiro with unknown quota semantics, so the resolver keeps a
kiro profile eligible but unranked with the uncertainty disclosed, and
the legacy chooser, which dispatches only on positive evidence,
refuses it until a known row exists. The quota-choose suite pins both
outcomes.

Claude-Session: https://claude.ai/code/session_01B4Krq5gHjEPXbmzMaaeTHs
The kiro adapter from kunchenguid#4679 pins `--agent-engine v2` and wires its
busy and turn-end hooks through a per-task agent config reached by
relocating KIRO_HOME. The captain runs `kiro-cli --v3`, and reading the
kiro-cli 2.24.1 V3 agent service shows it resolves agents, standalone
hooks and its task store from the real $HOME/.kiro and never reads
KIRO_HOME. A V3 launch on that wiring would load no agent, fire no
hook, and leave the seeded busy record open forever.

Make the engine a setting and give V3 its own hook path:

- config/kiro-engine selects v3 (the default when absent) or v2, is
  validated before any pane exists, and is inherited by secondmates.
- The launch and the model check pass the selected engine. V2 keeps
  `--agent firstmate` and its agent config byte for byte; V3 names no
  agent.
- V3 installs one firstmate-owned hook file and two dispatchers under
  ~/.kiro/hooks. Each dispatcher is a silent exit-0 no-op unless the
  hook's cwd holds a git-excluded .fm-kiro-hook token that names a
  private registry entry, which names the task's kiro home. It then
  runs the same per-task scripts V2 uses, so one busy contract serves
  both engines. This is the grok global-hook shape.
- Relaunch and teardown retire the token, registry entry and pointer,
  and a secondmate child's teardown now removes its kiro home too.
- Both engines keep --trust-all-tools with the seeded confirmation
  setting, the unattended posture every other adapter uses.

The docs record what KIRO_HOME still isolates on V3 (TUI settings and
session history only), that the macOS login lives outside it, and
which V3 lifecycle checks remain unproven until a live canary.

Claude-Session: https://claude.ai/code/session_01B4Krq5gHjEPXbmzMaaeTHs
Bring fork main (2f9a106, the 2026-09-26 upstream sync plus fork
fixes #2-#6) into the Kiro V3 crew branch so PR #8 merges cleanly.
A merge, not a rebase, keeps the upstream PR kunchenguid#4679 merge and its
authorship intact.

Textual conflicts (1):

- bin/fm-test-run.sh, family_for_basename live-e2e list: this branch
  added fm-kiro-signals-live-e2e.test.sh on its own line; main added
  fm-herdr-agent-liveness-live-e2e.test.sh beside the version-floor
  test. Kept both entries, so both live tests stay classified in the
  live-harness-optin family.

Auto-merged files touched by both sides, checked by hand:

- bin/fm-spawn.sh: main's agy Opus --effort omission (fork fix #5)
  sits in the agy arm next to this branch's new kiro effort arm;
  effort_flag_for_harness keeps the (harness, effort, model)
  signature on both sides.
- agy.md, docs/configuration.md, docs/verification/runtime-backends.md:
  disjoint hunks.

Semantic review: the Kiro adapter adds no arm to bin/backends/herdr.sh
or fm_harness_pid_alive. Kiro reaches the fork's registration-
independent Herdr liveness (fork fix #3) through
fm_agent_process_classify_name, where kiro-cli classifies as agent.
It is worker-only, so it stays out of the primary session-lock
harness table.

Claude-Session: https://claude.ai/code/session_01B4Krq5gHjEPXbmzMaaeTHs
@davidtandoh davidtandoh changed the title feat: Run kiro crewmates on the V3 engine by default feat: Add Kiro CLI crewmate harness with V3 engine default Sep 27, 2026
… in tests/fm-remote-secondmate-lifecycle-e2e.test.sh, and I fixed it with a one-line change. Every test in the script passed on CI. The script then exited 1 because its cleanup step couldn't delete the fixture directory ("Directory not empty"). Cause: the "unreachable remote secondmate" watcher step starts `remote_env "$ROOT/bin/fm-watch.sh" &`. That backgrounds a subshell running the `remote_env` function, and fm-watch.sh runs as a child of that subshell. So `watch_pid=$!` held the subshell's pid, and `kill "$watch_pid"` stopped only the subshell. fm-watch.sh was left orphaned (parent pid 1) and kept writing heartbeat files (such as `.last-watcher-beat`) into `watch-liveness-unreachable/`. Those writes raced the cleanup's `rm -rf "$TMP_ROOT"`, which is why the failure came and went: the same code passed on caab39c, and the only later change is docs. Evidence: I added temporary logging to the cleanup step and ran the script locally. It captured an orphaned `bash .../bin/fm-watch.sh` (parent pid 1) still running at teardown, plus beat files written in the last minute under watch-liveness-unreachable/. Fix: the leg now runs `remote_env exec "$ROOT/bin/fm-watch.sh" ... &`, with a short comment explaining why. The subshell becomes fm-watch.sh itself, so `$!` is the watcher and killing it stops the real process. Nothing else in the test or the product code changed. Verification: `bash -n` passes. The full script exits 0 with "ALL TESTS PASSED". Checked with pgrep right after the script exited, no fm-watch.sh from this worktree was still running. One limit: I didn't recheck at the exact moment the cleanup ran; the before-fix check was done at that moment. The orphan from the earlier run had already exited by the time I looked afterwards
@davidtandoh
davidtandoh merged commit df8b146 into main Sep 27, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants