Skip to content

feat: add Kimi Code CLI host - #2674

Draft
devalirzayev wants to merge 1 commit into
garrytan:mainfrom
devalirzayev:kimi
Draft

feat: add Kimi Code CLI host#2674
devalirzayev wants to merge 1 commit into
garrytan:mainfrom
devalirzayev:kimi

Conversation

@devalirzayev

Copy link
Copy Markdown

Why (in your own words)

Kimi Code CLI users can't install gstack today: kimi is not a registered host, so ./setup --host kimi exits with "Unknown --host value" and no skill render targets Kimi's skill directories. This adds Kimi Code CLI as gstack's 11th host. Kimi Code scans .kimi-code/skills/ (project) and ~/.kimi-code/skills/ (user) for Agent Skills natively (skills docs), so the generated skills are discovered with no wrapper or runtime adapter. A prior community attempt (#2298) was withdrawn by its author for lack of a user, not rejected — this is a fresh implementation, developed and tested by an actual Kimi Code user (the work was done inside a live Kimi Code CLI session).

Live evidence

Generation, leakage checks, validation, and tests — all real output:

$ bun run gen:skill-docs --host kimi
  .kimi-code/skills/gstack-open-gstack-browser   770 lines  ~  9122 tokens
  ...
  TOTAL                          67043 lines  ~922259 tokens
[gen-llms-txt] gstack/llms.txt: 55 skills, 76 browse commands

$ grep -r "\.claude/skills" .kimi-code/skills/ | head -5
(empty — no Claude path leakage)
$ grep -rl "CLAUDE.md" .kimi-code/skills/ | head -5
(empty — CLAUDE.md rewritten to AGENTS.md, which Kimi Code reads)
$ ls .kimi-code/skills/ | grep -i codex
(empty — codex skill excluded, per external-host default)

$ bun run scripts/host-config-export.ts validate
All 11 configs valid

$ bun run gen:skill-docs --host all --dry-run | grep -c STALE
0

$ bun test test/gen-skill-docs.test.ts test/host-config.test.ts
 495 pass
 0 fail

$ bun test test/routing-probe.test.ts   # covers the team-init probe-list addition
 7 pass
 0 fail

$ bun run test   # full free suite, 7 shards
exit 0 — all shards pass (7,000+ tests)

$ ./setup --host kimi
Kimi Code CLI reads gstack skills natively — no wrapper or runtime
adapter needed. Generation writes Kimi-format skills to
.kimi-code/skills/gstack-*/, which Kimi Code auto-discovers at project
level (user level: ~/.kimi-code/skills/).
...
exit: 0

Generated preamble resolves Kimi paths correctly ($HOME/.kimi-code/skills/gstack global fallback, $_ROOT/.kimi-code/skills/gstack project override):

$ sed -n 20,23p .kimi-code/skills/gstack-qa/SKILL.md
_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
GSTACK_ROOT="$HOME/.kimi-code/skills/gstack"
[ -n "$_ROOT" ] && [ -d "$_ROOT/.kimi-code/skills/gstack" ] && GSTACK_ROOT="$_ROOT/.kimi-code/skills/gstack"

Tool-name audit (why toolRewrites is empty): every tool name referenced anywhere in the generated output — Skill ×55, Read ×41, Agent ×32, Edit ×14, Write ×6, Grep ×5, Bash ×5, AskUserQuestion ×1 — exists in Kimi Code's built-in tools with an identical name (tools docs). The names that differ from Claude Code (TodoWriteTodoList, WebFetchFetchURL) appear nowhere in any template or resolver, so no rewrite is needed.

Key design decisions:

  • .kimi-code root, not .agents. Kimi Code also scans .agents/skills/, but the codex host already renders there — two hosts writing the same tree would overwrite each other and break --dry-run freshness.
  • setup gets a guidance block (hermes/openclaw/gbrain precedent), not a bespoke installer. Driving setup from host configs is documented as queued follow-up work (scripts/host-config-export.ts header).
  • bin/gstack-team-init probe lists gained $HOME/.kimi-code/skills/gstack — required by the Probe AGENTS.md for skill routing; resolve GSTACK_ROOT in team-init #2500 routing-probe invariant that every registered host's globalRoot is probed.

Scope

  • Changed: hosts/kimi.ts (new), hosts/index.ts (registry), .gitignore (.kimi-code/), setup (--host kimi guidance + usage strings), bin/gstack-team-init (two probe lists), README.md (host table + count), docs/ADDING_A_HOST.md (host lists), test/host-config.test.ts (host count 10→11). Generated .kimi-code/ output is gitignored like every host's.
  • Verified live by: generation output above, zero-leakage greps, config validation, --host all --dry-run freshness (0 STALE), host-config/gen-skill-docs/routing-probe test files, and the full free test suite (7 shards, exit 0).
  • Did NOT test: a full setup-tier global symlink install (out of scope — see design decisions); Kimi Code project-level auto-discovery of .kimi-code/skills/ is per the official docs, not re-verified on every Kimi release; no VERSION/CHANGELOG bump (left to the maintainer release flow).

Liveness proof (required)

⏳ Pending — will be attached by the PR author (a human) before marking ready for review. Opened as a draft for this reason.

Checklist

  • Liveness screenshot attached: GSTACK PR typed live into a real surface (not edited onto the image) — pending, see above
  • This is not a generated-file-only diff (I edited the source/template and regenerated)
  • No ETHOS.md edits, and no changes to voice / founder perspective / YC references
  • New public command / external service / host adapter has an accepted issue linked (or N/A) — feat: add Kimi Code host connector #2298 (closed by the previous author as withdrawn, not rejected; this PR is a fresh implementation)
  • Linked issue or reproduction: feat: add Kimi Code host connector #2298

Kimi Code CLI scans .kimi-code/skills/ (project) and ~/.kimi-code/skills/
(user) for Agent Skills, so generated skills are discovered natively with
no wrapper. Uses the .kimi-code root rather than .agents (also scanned by
Kimi) to avoid colliding with the codex host's render. No tool rewrites:
every tool name used in templates (Bash/Read/Write/Edit/Grep/Glob/Agent/
Skill/AskUserQuestion) exists in Kimi Code with an identical name.
CLAUDE.md references rewrite to AGENTS.md, which Kimi Code reads.

Refs garrytan#2298 (prior community attempt, withdrawn by author).
@trunk-io

trunk-io Bot commented Aug 22, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@devalirzayev

Copy link
Copy Markdown
Author

Closes this issue - #1072

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