Repository navigation
feat(bin): add Kiro CLI (kiro) as a V2 crewmate/scout adapter - #6808
Marsjohn-11 wants to merge 6 commits into
Conversation
|
Speaking as Kun's firstmate: first look at head What needs fixing: CI run Contract-class: new-default. The kiro adapter only runs when a spawn asks for VISION.md, rule by rule
Supersedes #4679, which stays open for now. |
Adds kiro-cli as a verified crewmate/scout harness - not primary, not secondmate. V2 engine only; v3/KAS is out of scope and unsupported on Amazon Linux 2. Spans the harness resolver, spawn, busy-state, composer, control and teardown, plus the harness-adapters router entry, references/harness/kiro.md, dated docs/verification/kiro.md, a portable regression test and an opt-in live drift guard. Launch carries the brief positionally on --agent-engine v2 with --agent, --trust-all-tools, model and full low|medium|high|xhigh|max effort, and validates the model against the reachable catalog, failing open when that listing cannot be read. The per-turn hooks - userPromptSubmit opens a turn, stop closes it and keeps the turn-ended touch - live in a firstmate-owned agent config under state/<id>.kiro-home/agents/firstmate.json, reached by relocating KIRO_HOME rather than by a config path, because --agent is name-only. That per-task home also seeds chat.disableTrustAllConfirmation so the --trust-all-tools modal cannot block an unattended worker. Relocating the whole home costs a kiro worker the operator's globally configured MCP servers and skills; the only alternative writes config into a project checkout, which is a hard boundary. Spawn refuses a hook path containing whitespace, and teardown removes the per-task home. One change here alters an existing adapter's behaviour. bin/fm-composer-lib.sh now strips near-gray ghost text up to FM_COMPOSER_GHOST_GRAY_LUMA_MAX (180) and handles the 256-colour grey ramp (232-255). kiro's idle composer needs that to read empty, and it also moves rovo's verdict: rovo's inline placeholder chip (luminance 162.9) now strips, so composer-empty reads empty at rovo idle where it previously did not. The ceiling is raise-only. Control mechanics live in fm-control-lib.sh - Escape interrupt (kiro's stop hook does not fire on it, so the adapter-owned record is preserved), /quit exit, crewmate/scout-only refusal, and out-of-tree wiring retirement. Verified live on kiro-cli 2.21.4: both per-turn hooks, the busy footer, single-Escape cancel, and /quit exit with its resume-id line. Auth preconditions are verified on Amazon Linux 2 only and unestablished on macOS. The live guard is opt-in and stays out of the validation steps. Upstream's codex braille-starfield fixture used near-gray cells incidentally, so its non-vacuousness guard broke once those cells strip; the braille rule now has its own chromatic fixture and no longer depends on colour. Resubmitted on current main, which landed the Devin adapter and a staged launch file after this work was first written. Every adapter table, doc sentence, and audience entry now carries devin and kiro together rather than one replacing the other, the per-task kiro home is also removed by the secondmate-child teardown path, the dispatch-validator harness list keeps its typed-quota form, the near-gray ghost ceiling sits alongside the launch-prompt backstop note, and kiro's idle-placeholder rationale is stated in terms of the bare-row path rather than by dropping Devin's entry. The kiro spawn test's fake tmux now reads the staged launch file back, because a spawn types a short source line instead of the launch itself.
The near-gray ghost ceiling, the 232-255 palette-grey test, and the hinted idle row were on for every harness, so Claude's grey typed /exit read as a placeholder and the herdr payload proof judged it unsent. They now apply only when the caller names the target's recorded harness as kiro through FM_COMPOSER_HARNESS (fm-send, fm-control, and the watcher and process-event re-rings), and every other composer read is unchanged. The rovo, grok, afk, and codex/opencode test edits that assumed a fleet-wide widening are restored.
9e12286 to
6eb581a
Compare
…4 ("FM_COMPOSER_HARNESS appears unused") at tests/fm-kiro-harness.test.sh:218. The variable `local FM_COMPOSER_HARNESS=kiro` is read by the composer library the test sources, at call time, which ShellCheck cannot see. The rule that was broken: a variable read only by sourced code needs an explicit annotation. This was the only such site. Every other `FM_COMPOSER_HARNESS=` in the changed tests is a command-prefix assignment, which ShellCheck does not flag. The fix adds one line above the `local`, matching how the repo already handles this case (e.g. tests/fm-parent-channel-scan-exclusion.test.sh:284): `# shellcheck disable=SC2034 # read by the sourced composer lib at call time`. Nothing else changed. I could not re-run the linter: `shellcheck` is not installed here, so bin/fm-lint.sh can't run either. I did run tests/fm-kiro-harness.test.sh and it passed (rc=0, no `not ok` lines)
|
Speaking as Kun's firstmate (the triage agent for this repo, not Kun personally). Thanks @Marsjohn-11. The fix is what I asked for. Head CI: everything is green except Behavior portable serial 2, which was cancelled at its 30-minute limit ( Triage verdict (my own reading of the tip vs
Status: waiting-ci on the serial 2 re-run. Nothing is needed from you. If it comes back green and the PR is still mergeable, I expect to merge it as opt-in on a later pass. When this lands, #4679, which this supersedes, will be closed as the leftover. |
|
Thanks for this adapter. Since the branch has been conflicting for a few weeks, we are picking it up: rebasing onto current main, re-verifying live against kiro-cli 2.35.1, and re-raising it from kiatng/firstmate with your commits and credit kept. We will link the new PR here, and we are happy to fold it back into this one if you return to it first. |
|
Speaking as Kun's firstmate: thanks @kiatng for offering to carry this forward, and thanks again @Marsjohn-11 for the adapter. Where @kiatng, a re-raise through |
|
Picked up as #7956: rebased onto current main with your commits and credit kept, the Kiro busy marker anchored to its footer so other harnesses' reads stay unchanged, and live-verified on kiro-cli 2.35.1. |
|
Speaking as Kun's firstmate: closing this because the Kiro CLI adapter you started here has landed on main through #7979 (merged as 6d01da5), which carried @kiatng's continuation in #7956. You're credited as a co-author on the commit. Thank you @Marsjohn-11 — really appreciate you taking the time on this. |
Intent
Continue upstream PR #6808 (Kiro CLI harness, branch feat/kiro-cli-adapter-v2, head 9e122866) after the maintainer's feedback. The request and feedback, verbatim:
Restart the kiro-cli-adapter-resubmit lane on a fresh copy of feat/kiro-cli-adapter-v2 for PR #6808. The maintainer's feedback, from the PR comment on head 9e122866: CI run 37686874380 fails in Behavior portable parallel 1. tests/fm-backend-herdr.test.sh says 'a typed /exit drawn in Claude's grey slash-command colour must be proven and submitted, got unknown'. The cause is the wider gray ghost-text ceiling in bin/fm-composer-lib.sh, which now reads Claude's real grey /exit input as a placeholder. Also: the composer widening (FM_COMPOSER_GHOST_GRAY_LUMA_MAX default 180, the 232-255 grey ramp, and the hinted-idle row rule) is on by default for every harness, and the maintainer flags that as a fleet-wide default change. Fix: scope the ghost-text widening to the kiro harness only, so every existing harness's composer reads are unchanged, and keep the failing test passing. Load firstmate-coding-guidelines first. Then push a fresh no-mistakes raise to the same PR. Merge is the maintainer's; the captain cannot merge kunchenguid/firstmate PRs.
What Changed
Adds Kiro CLI (
kiro, V2 engine) as a crewmate/scout-only harness, refused as a secondmate.fm-harness.shdetects it by itskiro-cliprocess ancestry.fm-spawn.shwrites a per-task agent config understate/<id>.kiro-homeand pointsKIRO_HOMEat it, so the turn-end and busy hooks never touch the worktree's.kiro/. That config also seedschat.disableTrustAllConfirmation, which suppresses the--trust-all-toolsconfirmation modal. The spawn refuses to launch when the per-task home path contains whitespace. Busy, control, send, watch, procevent, teardown and bootstrap paths are wired for kiro.Widens composer ghost-text stripping in
bin/fm-composer-lib.shfor kiro panes only. A read gets the wider rules only when its caller setsFM_COMPOSER_HARNESS=kiro, whichfm-send.sh,fm-control.shand the watcher/procevent re-rings do. The wider rules are:FM_COMPOSER_GHOST_GRAY_LUMA_MAX, default 180, gated byFM_COMPOSER_GHOST_GRAY_SPREAD_MAX, default 12)Reads for every other harness, and reads with no harness named, are unchanged, so Claude's grey typed
/exitis still read as real input.Adds docs for the kiro harness:
references/harness/kiro.md,docs/verification/kiro.md, plus updates to configuration, architecture and backend docs and the skill indexes. Addstests/fm-kiro-harness.test.sh,tests/fm-kiro-signals-live-e2e.test.sh, and new composer-lib and busy-wiring cases that cover the kiro-only scoping.Risk Assessment
✅ Low: The near-gray ceiling, the 232-255 palette-grey test and the hinted idle row now apply only when FM_COMPOSER_HARNESS is exactly
kiro, so every other harness reads the composer exactly as before. The herdr Claude /exit proof runs with FM_COMPOSER_GHOST_LUMA_MAX=0 and no harness named, so its old behaviour is back. The kiro callers that need the scope (send, control, the watcher and process-event re-rings) all pass their recorded harness in-process.Testing
I ran the targeted herdr, composer-lib and kiro-harness test suites. The herdr CI regression fails at e938be0 (before the fix) and passes at HEAD in the fake-bin test, but it was not checked live. In a disposable tmux lab I drove real Claude and real kiro-cli panes through the composer reader and through
fm-send, and every live scenario passed. The live Herdr+Claude e2e could not run: the lab helper requires a running default Herdr session as its tripwire, and this host has none. The installed Claude 2.1.288 also draws/exitin a chromatic colour, not the 112 grey the CI fixture records. Evidence is text captures of TUI panes.Evidence: Herdr test pre-fix failure (e938be0)
Source: Herdr test pre-fix failure (e938be0)
Evidence: Composer-lib test at HEAD
Source: Composer-lib test at HEAD
Evidence: Kiro harness test at HEAD
Source: Kiro harness test at HEAD
Evidence: Live idle-pane composer verdicts (HEAD vs pre-fix, with and without kiro scope)
Source: Live idle-pane composer verdicts (HEAD vs pre-fix, with and without kiro scope)
HEAD: claude idle -> empty; kiro idle (no harness) -> pending; kiro idle (harness=kiro) -> empty pre-fix: kiro idle (no harness) -> empty (widening was fleet-wide)Evidence: Live typed-input composer verdicts
Source: Live typed-input composer verdicts
Evidence: fm-send live wiring: kiro meta rings, non-kiro meta defers
Source: fm-send live wiring: kiro meta rings, non-kiro meta defers
Evidence: Live Claude typed /exit ANSI capture (truecolor)
Source: Live Claude typed /exit ANSI capture (truecolor)
Evidence: Live herdr submit-confirm e2e attempt (tripwire refusal)
Source: Live herdr submit-confirm e2e attempt (tripwire refusal)
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-send.sh:447- Nothing tests the caller wiring that turns on the kiro scope. TheFM_COMPOSER_HARNESSassignments in fm-send.sh:447, fm-control.sh:372, fm-watch.sh:572 and 593, and fm-procevent.sh:867 are all untested. Every kiro test sets FM_COMPOSER_HARNESS=kiro by hand (tests/fm-kiro-harness.test.sh:218, tests/fm-composer-lib.test.sh). If one of these assignments were dropped, the shared rules would apply again to kiro: the idle placeholder readspendingand steers to that worker defer until the max-defer alarm fires, and the suite would still pass. A test that runs fm-send or the watcher ring against a recordedharness=kirometa with a fake idle pane would cover it.✅ **Test** - passed
✅ No issues found.
bash tests/fm-backend-herdr.test.shat HEAD (exit 0) and at e938be0 from a git archive (fails: 'a typed /exit drawn in Claude's grey slash-command colour must be proven and submitted, got unknown')bash tests/fm-composer-lib.test.shandbash tests/fm-kiro-harness.test.sh(targeted, exit 0)Disposable lab tmux server (tmux -L fm-lab, lab FM_HOME frombin/fm-lab-home.sh create) running realclaude2.1.288 (256-colour and truecolor) and realkiro-cli chat2.28.0 (256-colour and truecolor)fm_tmux_composer_stateon each live pane, with FM_COMPOSER_HARNESS unset and set to kiro, using both the HEAD bin/ and the pre-fix e938be0 bin/, while idle and after typing/exit/hello kiroFM_HOME=$LAB bin/fm-send.sh <id> <text>to an idle real kiro pane, once with a meta recording harness=kiro and once with harness=claudeFM_HERDR_SUBMIT_CONFIRM_LIVE=1 tests/fm-herdr-submit-confirm-live-e2e.test.sh(attempted; the lab helper's tripwire refused to provision)✅ **Document** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.