Skip to content

Support Kimi Code CLI as a builder #1201

Open

Description

@mohidmakhdoomi

Summary

Add the Kimi Code CLI (kimi) as a supported builder harness, so .codev/config.json shell.builder: "kimi" / builderHarness: "kimi" produces a working builder. Scope is the builder MVI validated by spike task-Iptx; Kimi as an architect is explicitly out of scope (stage 2).

Spike findings (verdict: Feasible with Caveats, POC-validated end-to-end):
https://github.com/mohidmakhdoomi/codev/blob/builder/task-Iptx/codev/spikes/task-Iptx-kimi-code-cli-support.md
(reproducible probes: codev/spikes/task-Iptx-kimi-poc.sh on the same branch)

What breaks today

Validated approach (spike POC)

Seed-session bootstrap — solves role injection, initial-prompt delivery, and session identity in one pattern:

  1. Seed: kimi -p "<role + task briefing, ack-and-wait wrapper>" --output-format stream-json in the worktree; capture the session id from the machine-readable session.resume_hint meta line.
  2. Persist the id (.builder-kimi-session) and loop the TUI with kimi -S <id> --yolo — role/task context survives inner restarts.
  3. Readiness barrier (required): script prints a __CODEV_KIMI_SEED_DONE__ <id> sentinel before exec'ing the TUI; Tower gates delivery on sentinel + grace, then sends a single-line BEGIN kick with store-verified delivery (poll the session's state.json; re-send Enter on timeout; retry once; loud warning after).

Scope (builder MVI)

  • KIMI_HARNESS in harness.ts + detectHarnessFromCommand recognizing kimi
  • Provider-owned builder launch shape (seed + -S loop) branched in spawn-worktree.ts
  • Readiness barrier + store-verified BEGIN delivery (per spike addendum — required scope)
  • buildResume for afx spawn --resume (explicit-ID from the Kimi session store, state.json.workDir exact match; null → fresh-with-role fallback) + verifyOwnership
  • message-write.ts per-harness Enter-delay knob (Kimi: 80ms fails, 1s works — bisect and pin)
  • codev doctor: kimi presence/version, truthful auth heuristic (no billed probe) + kimi login guidance
  • Docs: arch.md harness section, .codev/config.json examples, skeleton mirror where framework files change
  • Tests per the spike's test matrix (incl. the Support codex as an architect #929-class regression: kimi + stale Claude jsonl must never yield --resume <claude-uuid> or --append-system-prompt)

Out of scope

  • Kimi as architect (needs async seedSession capability + async-buildable CrashLoopFallback per the spike addendum — stage 2, separate issue)
  • ACP / kimi server adapter
  • Write-guard parity (Kimi has no documented hook seam; must be documented as a caveat)

Caveats (carry into spec/plan)

References

Activity

  1. mohidmakhdoomi commented on Jul 18, 2026

    @mohidmakhdoomi
    CollaboratorAuthor

    On it! Working on this with the PIR protocol (plan + dev-approval gates before PR).

  2. added 13 commits that reference this issue on Jul 18, 2026
  3. added 7 commits that reference this issue on Jul 23, 2026
  4. added a commit that references this issue on Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area/towerArea: Tower server / agent farm CLI

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions