Skip to content

Add Agent support: Kimi Code CLI #96

Description

@yujiezhang-ops

Request

Add install and configuration support for Kimi Code CLI, Moonshot AI's terminal coding agent.

Split out of the original three-Agent request. ZCode is a desktop application and is tracked separately; Trae is a uv install-from-source agent and is also tracked separately. See the linked issues.

What it is

MoonshotAI/kimi-code, MIT-licensed. Reads and edits code, runs shell commands, searches files, fetches web pages. Model-agnostic: the README states it works with Moonshot's models out of the box and can be configured for other compatible providers, which is the property OneAgent needs.

Confirmed facts

Config file is TOML at ~/.kimi-code/config.toml. Per the getting started guide, ~/.kimi-code/ holds config, session records, logs and update cache. This is the single most useful finding: we already have a TOML adapter (go-toml/v2, used by the codex reader and writer), so the config plumbing is a known shape rather than a new one.

KIMI_CODE_HOME relocates that directory. Config discovery must respect it rather than hardcoding ~/.kimi-code.

Custom providers are configured by editing that file. The docs say that to connect Anthropic, OpenAI, Google or other providers you edit ~/.kimi-code/config.toml directly. That is exactly the kind of write OneAgent does. First-party base URLs, for reference:

Platform Base URL
Kimi Code (OpenAI compatible) https://api.kimi.com/coding/v1
Kimi Code (Anthropic compatible) https://api.kimi.com/coding/
Kimi Open Platform https://api.moonshot.cn/v1

Note for whoever tests this: api.kimi.com and api.moonshot.cn are independent account systems and their keys are not interchangeable. An auth failure during development is likely this, not a bug in our writer.

Two install channels, and they disagree about Node.js.

The README documents an installer script and describes single-binary distribution needing no Node.js:

macOS/Linux:  curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash
Windows:      irm https://code.kimi.com/kimi-code/install.ps1 | iex

The getting-started guide instead says the CLI is written in TypeScript, distributed via npm, and needs Node.js 22.19.0 or later. Both are probably true — the script installs a bundled binary, npm installs the package — but the npm package name is not stated in either source. The page's code blocks render empty. The repo is referenced as MoonshotAI/kimi-cli, which hints at the name but does not confirm it.

Do not install @jacksontian/kimi or @jacksontian/kimi-cli. Those are unrelated third-party wrappers for the Kimi chat API, not this agent.

Recommended install path

Prefer npm once the package name is confirmed, not official-script. An npm package is pinnable to an exact version and auditable; a piped installer is neither, and internal/install/install.go already supports exact-version npm installs with registry selection and mirror support. official-script exists for hermes because Hermes has no published package — Kimi does, so it should not need the weaker contract.

Falling back to official-script is acceptable if the package name cannot be confirmed. That path is already implemented (internal/catalog/manifest.go:146,155, internal/app/install.go:339,612) with hermes as the working precedent. Note install.go:178 refuses an exact version request for official-script Agents, which is the tradeoff.

Remaining unknown

One item blocks a complete manifest entry: the npm package name. Resolve by checking the repo README's install section directly, or by running the installer in a scratch container and reading what it fetches.

Everything else needed for an auto entry is now known.

Implementation checklist

Per CLAUDE.md, the order is manifest metadata → config adapter → Go tests.

  1. Manifest entry in manifests/agents.lock.json: command: "kimi", config_path: ".kimi-code/config.toml", version_args: ["--version"], rank: 8, platforms: [macos, linux, windows], and a package block with the resolved manager.
  2. Windows prerequisites. Git for Windows is required — the CLI runs on bundled Git Bash. KIMI_SHELL_PATH overrides the bash.exe location when it is not in the default place. Both belong in windows_prerequisites and windows_note.
  3. Config discovery must honour KIMI_CODE_HOME. configPath() in internal/app/status.go derives paths from Home plus a manifest-declared relative path, so an env-var override needs handling similar to how ReadClaudeConfig takes envVars (internal/config/discovery.go:42).
  4. Reader in internal/config/discovery.go plus a case in readerFor. The TOML parse can follow ReadCodexConfig (:24-40), including its ManagedByOneAgent detection pattern — report managed only when the provider entry we write is actually present.
  5. Writer in internal/config/write.go plus a case in internal/app/agent.go. Must preserve unrelated sections and be a true no-op when nothing changes.
  6. Protocol mapping in internal/catalog/public.go:adapterProtocols. The two first-party base URLs suggest it can speak both OpenAI and Anthropic shapes; pick based on what the config schema actually selects, and remember docs/ policy is that /v1/models cannot stand in for a real protocol check.
  7. Golden fixtures for the config format, matching the existing internal/config test layout.
  8. internal/catalog/catalog_test.go:30 asserts the automatic Agent count is exactly 6. It will fail deliberately. Update the number as part of this change — that tripwire exists because a previous commit silently removed entries.
  9. Regenerate internal/app/testdata/status-empty-linux-arm64.json. Edit it surgically; decoding through a plain map reorders every key and produces a useless diff.
  10. Icon in frontend/src/components/icons/agents.tsx with rights recorded in asset-rights.json, and a NOTICE update. docs/distribution-compliance-policy.md makes this a release precondition, and the licence generator does not check NOTICE prose — it has drifted before.

agents.lock.json is vendored by MaimoryLab/OneAgent-site from release tags, so the public site will not list Kimi until a release ships.

Priority

P2. Actionable once the package name is confirmed; the config format being TOML means it reuses machinery we already have.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions