Skip to content

Add the kimi CLI as a /kickoff worker agent - #51

Merged
gering merged 5 commits into
mainfrom
task/add-kimi-worker-support
Aug 5, 2026
Merged

Add the kimi CLI as a /kickoff worker agent#51
gering merged 5 commits into
mainfrom
task/add-kimi-worker-support

Conversation

@gering

@gering gering commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds the standalone kimi CLI (kimi-code) as a selectable /kickoff worker alongside claude/codex/grok: --kimikimi:kimi-code/k3-256k.
  • kimi is the first worker with no <cli> -m <model> <prompt> launch form, so it launches in two phases — every constraint behind that shape was probed live against kimi-code 0.31.1, not inferred from docs.
  • Readiness is model-aware (grok precedent), because an unconfigured -m id aborts kimi at startup — a stale model would otherwise hand the user a worker tab that dies on sight.
  • work-system 1.11.0 (new worker surface → minor).

Changes

Registry + launch argv (agent-registry.sh)

  • New entry --kimi | kimi | kimi-code/k3-256k | commit,pr. The model id must be the qualified alias; the bare name is rejected exactly like an unknown model.
  • Launch argv: sh -c 'kimi -m "$1" -p "$2"; exec kimi -c --auto' kimi-worker <model> <bootstrap>. Rationale: kimi has no positional launch prompt (kimi "text" → "unknown command"), no initial-prompt env var, and piped stdin only prefills the input box without submitting (and would steal the TUI's tty in a pane). -p is the only entry point but is mutually exclusive with both --auto and -y and exits after one answer. It does run tools unattended, and kimi -c inherits its full session history — so the seed works the task through once, then exec hands over to the interactive autonomous session. exec re-roots the herdr pane at kimi; ; (not &&) keeps phase 2 alive if the seed fails, leaving a usable tab.
  • Readiness: bounded kimi provider list --json for the model, plus an auth probe on credentials/kimi-code.jsonnot the same-named oauth/ file, which stays 0 bytes even when logged in. kimi doctor only validates config syntax and is not an auth check.
  • A listing without the models section is treated as format drift (trust auth); a well-formed listing offering nothing means unavailable. grok's "empty output = inconclusive" rule does not transfer to JSON, where {"models": {}} is non-empty but a real answer.

Tests (test_agent_registry.py)

  • Argument-order regression: -p consumes the next token, so a concatenated argv is one reordering away from silently eating a flag (kimi -p --auto "…" turns --auto into the prompt). The model and prompt therefore ride as "$1"/"$2" positionals, never spliced into the script text — asserted structurally, plus the exact word list.
  • The resolved argv is executed against a logging kimi stub, asserting what each phase actually received — string checks alone can't prove the shell binds values as intended.
  • Availability matrix: model listed / not listed / unauthed / unreachable / zero-models / schema drift.

Skills, lifecycle, docs

  • /continue: the reopen caveat now names kimi -c next to codex resume --last / grok -c (reopen still always sends claude -c; the worker isn't persisted per task).
  • /kickoff: --kimi in the flag list, kimi in the non-claude announce class, and the manual launch block documents the two-phase form — including that shell-quoting is load-bearing there, since one argv word is a script carrying ;, $ and quotes.
  • Lifecycle verified rather than assumed: agent_name comes from the registry's name= and agent_status from herdr's pane hooks, so nothing reads argv[0] and the sh -c wrapper leaves tab teardown and state detection unchanged.
  • Both READMEs, marketplace description, CHANGELOG, and the kickoff-agent-selection knowledge entry.

Readiness

  • ✅ Tests — test_agent_registry.py passes; check-structure.py 0 errors
  • ✅ Version — work-system 1.11.0, plugin.json + marketplace.json in sync
  • ✅ Changelog — 1.11.0 entry added
  • ✅ Knowledge — kickoff-agent-selection.md updated (launch-shape constraints + the JSON/empty-listing distinction)
  • ✅ READMEs — top-level + plugin worker lists and flag table
  • ➖ Lint / build — N/A (declarative markdown + shell plugin repo)

Test plan

  • bash plugins/work-system/scripts/agent-registry.sh list shows kimi:kimi-code/k3-256k as available
  • /kickoff <task> --kimi opens a worktree tab; phase 1 works the task, phase 2 lands in an interactive auto session carrying that history
  • /close on a kimi worker tab tears it down (Scenario A) — not yet exercised live; only the code paths were verified
  • agent-registry.sh resolve --kimi with a bogus model in the registry reports unavailable instead of launching

🤖 Generated with Claude Code

https://claude.ai/code/session_01SkXCG4uaXDEyf3ciKYKu2i

gering and others added 2 commits August 2, 2026 23:28
kimi-code has no positional launch prompt, no initial-prompt env var, and
piped stdin only prefills the input box without submitting (and would steal
the TUI's tty). `-p` is the only way in, but it is mutually exclusive with
both --auto and -y and exits after one answer.

It does run tools unattended though, and `kimi -c` inherits its full session
history — so the worker launches in two phases: `-p` seeds and works the task
one-shot, then `exec kimi -c --auto` takes over as the interactive autonomous
session with that history. All probed live against kimi-code 0.31.1.

- Registry: --kimi -> kimi:kimi-code/k3-256k (commit,pr). The model id must be
  the QUALIFIED alias; the bare name aborts at startup like an unknown model.
- Readiness is model-aware (grok precedent) via `kimi provider list --json`,
  bounded. Auth probes credentials/, not the same-named oauth/ dir — that file
  stays 0 bytes even when logged in. `kimi doctor` only validates config syntax.
- A well-formed listing offering no models means unavailable; a document
  without the `models` section is drift and falls back to trusting auth.
- Values ride as "$1"/"$2" positionals, never spliced into the script text:
  `-p` swallows the next token, so a concatenated argv is one reordering away
  from silently eating a flag.
- Tests assert the exact word list plus that structure, and execute the
  resolved argv against a logging stub to check what each phase received.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SkXCG4uaXDEyf3ciKYKu2i
Completes the kimi worker surface started in the registry commit.

- /continue: the reopen caveat now names `kimi -c` alongside
  `codex resume --last` / `grok -c`. Reopen still always sends `claude -c`
  (the worker isn't persisted per task), so the caveat stays inline.
- /kickoff: --kimi in the flag list, kimi in the non-claude announce class,
  and the manual launch block spells out the two-phase form. Called out that
  shell-quoting is load-bearing there: one argv word is a script carrying
  `;`, `$` and quotes, so an unquoted render would run the `;` in the user's
  own shell and expand $1/$2 there.
- Lifecycle verified rather than assumed: agent_name comes from the
  registry's `name=` and agent_status from herdr's pane hooks, so nothing
  reads argv[0] and the `sh -c` wrapper (which execs into kimi) leaves tab
  teardown and state detection unchanged.
- Docs: both READMEs, marketplace description, CHANGELOG, and the
  kickoff-agent-selection knowledge entry, which records the launch-shape
  constraints and why grok's "empty listing = inconclusive" rule had to be
  re-derived for JSON.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SkXCG4uaXDEyf3ciKYKu2i
@gering

gering commented Aug 5, 2026

Copy link
Copy Markdown
Owner Author

🐝 Swarm review (local ensemble) · reviewed at e534812

PR #51: Add the kimi CLI as a /kickoff worker agent

# Sev Location Finding Source V Note
1 🔴 plugins/work-system/scripts/agent-registry.sh:342 kimi -c resume nicht an Seed gebunden opus·grok ✓ -c ist cwd-scoped — lokal live widerlegt (s. Notes)
2 🟡 plugins/work-system/.claude-plugin/plugin.json:3 Description ohne kimi opus·gpt·grok ✓ marketplace.json gesynct, plugin.json vergessen
3 🟡 plugins/work-system/scripts/agent-registry.sh:309 grep über ganzes JSON-Dokument opus·gpt·grok ✓ 🟨 Präfix-Fall falsch (Quotes); Scoping-Härtung berechtigt
4 🟡 plugins/work-system/skills/kickoff/SKILL.md:5 Description + Selector-Tabelle ohne --kimi opus·grok ✓ Aktivierungsfläche, wird in jede Session geladen
5 🟡 plugins/work-system/skills/adopt/SKILL.md:18 /adopt kennt --kimi nicht opus·grok ✓ README behauptet Flag-Parität — echte Lücke
6 🟡 plugins/work-system/scripts/agent-registry.sh:295 Auth nur via credentials-Datei opus·grok ✓ 🟨 API-Key-Setup → false negative; Fix nicht trivial
7 🟡 plugins/work-system/scripts/agent-registry.sh:301 assumed-available schluckt {} und Error-Doks gpt·grok ✓ 🟨 {} ohne models-Sektion → fälschlich verfügbar
8 🟡 plugins/work-system/scripts/agent-registry.sh:34 Unbeaufsichtigt -p plus --auto auf TASK.md opus ✓ 🟨 War Task-Vorgabe; Trust-Annahme dokumentieren
9 plugins/work-system/scripts/agent-registry.sh:91 Kommentare sagen noch codex, grok opus ✓ Bootstrap-Prompt geht auch an kimi
10 .claude/knowledge/features/herdr-kickoff-automation.md:36 Knowledge ohne kimi-argv grok ✓ Verweist selbst auf emit_argv als SoT
11 plugins/work-system/skills/close/SKILL.md:274 Prosa nennt nur codex/grok grok ~ Routing ist CLI-agnostisch — reiner Doku-Nit
12 plugins/work-system/scripts/herdr-launch.sh:41 Selector-Liste ohne --kimi opus ✓ Zeilen 14/248 gesweept, 41 übersehen
13 CLAUDE.md:22 work-system noch als v1.10.x gelistet opus ✓ Vorheriger Minor-Bump pflegte diese Zeile
14 🟡 plugins/work-system/skills/kickoff/SKILL.md:265 [altitude] argv-Rezept dupliziert emit_argv opus·grok ✓ 🟨 Quoting-Warnung behalten, Rezept kürzen
15 plugins/work-system/scripts/agent-registry.sh:302 [simplification] -z-Guard ist toter Code opus ✓ grep scheitert bei leerem Input ohnehin
16 plugins/work-system/skills/kickoff/SKILL.md:131 [simplification] Prefix-Allowlist statt not-claude-Check grok ✓ Muss sonst pro neuem CLI gepflegt werden
17 .claude/knowledge/features/kickoff-agent-selection.md:27 [reuse] Alias-Inventar ohne --kimi grok ✓ Datei widerspricht sich selbst
Bilanz:  17 Findings (🔴1 🟡8 ⚪8 · 4 Design) · Konsens 8 · Solo 9 · REFUTED 3 · Verdict ✅11 🟨5 ❌1
Agents:  opus×3 18 · gpt×3 4 · grok-4.5×3 16
Lenses:  correctness, cross-file-trace, security, adversarial, reuse, simplification, efficiency, altitude  —  gated-out: removed-behavior, style, conventions

Finding 1 (das einzige critical) wurde in der Session live widerlegt: der Mechanismus lautete 'kimi -c continues the globally most-recent session', aber -c ist cwd-scoped (kimi --help: 'for the working directory'). Gegenprobe: in einem älteren Session-Verzeichnis resumierte -c dessen eigene Session, obwohl die global jüngste Session woanders lag. Zwei Worktrees = zwei cwds, das Parallel-Kickoff-Szenario existiert nicht. Berechtigter Restpunkt: kein Test deckt einen fehlschlagenden Seed ab.

3 weitere Findings wurden vom Verifier refuted, darunter die Behauptung, herdr sehe wegen des sh -c-Wrappers agent=sh — durch einen echten herdr-Probe-Pane widerlegt (agent=claude bereits während der Pre-exec-Phase).

Findings 2, 4, 5, 9, 12, 13, 17 sind dasselbe Versäumnis: Skill-Bodies wurden nachgezogen, die Aktivierungsflächen (Frontmatter-Descriptions, Argument-Tabellen) und /adopt nicht.

Lokaler Swarm-Review (Claude-Lenses + codex + grok), keine Backend-Fehler, keine Redactions.

Local mixture-of-agents review (Claude lenses + codex + grok) run from the author's machine — not a hosted bot. Verdicts (✅/🟨/❌) are the runner's own assessment.

gering and others added 3 commits August 5, 2026 10:26
Follow-up to the swarm review on PR #51: the first pass updated skill
bodies but missed the activation surfaces and /adopt entirely, while
README claimed /adopt takes the same worker flags.

- /kickoff: frontmatter description + flag table; /adopt: both selector
  enumerations + the manual-launch block, incl. the load-bearing `sh -c`
  quoting caution; /close: worker-degradation prose reads "non-claude"
- herdr-launch.sh usage header, plugin.json description, CLAUDE.md plugin
  line (v1.11.x), and the herdr-kickoff-automation knowledge entry, which
  documented only the codex/grok `-m` argv
- /kickoff's non-claude announce rule now tests "not `claude:`" rather than
  a codex:/grok:/kimi: allowlist that needs a hand-edit per new CLI
- Drop the dead `-z` arm in the kimi probe: empty output already fails the
  `"models"` grep and lands in the same branch

Not applied (kept in the review for the record): the `critical` finding
claimed `kimi -c` resumes the globally most-recent session. It does not —
`-c` is cwd-scoped (verified live: in an older session's directory `-c`
resumed that directory's session while the newest session lived
elsewhere), so two worktrees cannot cross-resume.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SkXCG4uaXDEyf3ciKYKu2i
Second swarm round on PR #51. Applied the agreed findings:

- A failed seed no longer passes unnoticed. `&&` would kill the pane and a
  bare `;` let the error scroll away behind the TUI's first repaint, leaving
  a tab that looked like a working worker but never read TASK.md. It now
  reports and waits for a keypress before handing over. Verified live that a
  failed seed in a fresh worktree opens a NEW empty session, never a foreign
  one — `kimi -c` is scoped to the working directory.
- `resolve` emits `argv_shell=`: the argv words POSIX-single-quoted by the
  registry. /kickoff and /adopt print it verbatim rather than re-deriving
  quoting from a prose rule — for kimi a mis-quote would run the `;` in the
  user's own interactive shell. Uses shell_quote, not `printf %q`, which on
  bash 3.2 emits per-character backslashes and `$'…'` for non-ASCII: correct
  but unreadable before pasting, and bash/zsh-only. The seed message is
  ASCII-only for the same reason.
- The model check matches the alias in KEY position, so it can't fire on the
  alias appearing as a value while `models` is empty. The real document is
  flat-qualified (verified live), which also refutes the nested-schema half
  of that finding.
- Tests: the previously untested failing-seed path, plus the argv_shell
  shape; the "prompt not spliced" check compares the whole prompt word now
  that the script text legitimately mentions TASK.md.
- Stale pointers/enumerations: adopt + kickoff cited "/kickoff step 12" for
  a launch form living in 13b; manager-worker-orchestration and the
  knowledge index still listed the pre-kimi worker set. The selector hint is
  derived from REGISTRY instead of restated.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SkXCG4uaXDEyf3ciKYKu2i
Outcome of the security finding both swarm rounds raised: kimi is the only
worker that acts without tool-approval prompts. Kept deliberately — the seed
cannot have approvals (`-p` refuses --auto/-y and is the only way to deliver
the task), and dropping --auto from phase 2 would leave the phase that does
the work just as unattended. Mitigation is visibility, matching the existing
announce-not-prompt precedent:

- /kickoff states the unattended start whenever the worker resolves to kimi,
  by flag, repo default or picker alike
- /adopt warns additionally: its TASK.md is summarized from another branch's
  commits, so it is the one path where an unattended worker acts on content
  the user did not write
- README says plainly what the autonomy costs; the knowledge entry records
  the decision and what a future revisit should change (a second registry
  entry, not the --auto flag)

Also sync the launch form in README/CHANGELOG/knowledge with the seed-failure
handler added last commit — the docs still showed the bare `;` variant, which
is the same doc drift the review flagged twice.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SkXCG4uaXDEyf3ciKYKu2i
@gering
gering merged commit cd01804 into main Aug 5, 2026
1 check passed
@gering
gering deleted the task/add-kimi-worker-support branch August 5, 2026 12:12
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.

1 participant