Kimi CLI — SKILL.md
Raw skill file that agents receive when using this skill
--- name: "Kimi CLI" description: "Fleet skill: Kimi CLI — software inventory and operations reference" version: "1.0.0" author: "skynet" category: "fleet" agents: ["claude-code", "codex", "gemini", "kimi"] tags: ["software-kimi", "fleet", "fleet", "software"] --- # Kimi CLI --- name: software-kimi description: Guidance for using Moonshot's Kimi CLI (K2.5 model) for autonomous coding, refactoring, and fleet-wide task execution across James's infrastructure. metadata: author: skynet version: 1.0.0 --- # Kimi CLI (software-kimi) Moonshot's high-performance coding CLI, optimized for large-context operations (256K) using the K2.5 model. This tool is a primary driver for complex refactoring and deep codebase analysis within the fleet. ## Fleet Installation Status | Machine | IP | Status | Version | Method | |---------|----|--------|---------|--------| | **Dev Workstation** | 192.168.86.22 | Installed | 1.11.0 | Binary | | **Mac Mini (Bots)** | 192.168.86.50 | Installed | 1.21.0 | Binary | | **Mac Mini (Jarvis)** | 192.168.86.51 | Installed | 1.21.0 | Binary | | **Mac Mini (Vault)** | 192.168.86.27 | Installed | Latest | `brew install kimi-cli` | | **DGX Spark** | 192.168.86.48 | NOT INSTALLED | - | - | | **Dev1** | - | NOT INSTALLED | - | - | | **Server** | 192.168.86.33 | NOT INSTALLED | - | - | > **Note:** For machines without Kimi CLI installed, use `ssh vault` or `ssh bots` to trigger remote jobs, or use the LiteLLM gateway on Spark (Port 8000) if raw API access is sufficient. ## Configuration & Authentication - **Primary Auth Path:** `~/.kimi/credentials` - **Config File:** `~/.kimi/config.json` - **Model:** `k2.5` (Default) - **Context Window:** 256,000 tokens ### Credentials Management On the **Vault Mac**, credentials are managed via the secure keychain. For other machines, ensure the `credentials` file is synced from the Vault via the `infra-sync` script if tokens expire. ```bash # Verify authentication status kimi auth status # Refresh token from Vault (from local workstation) ssh vault "cat ~/.kimi/credentials" > ~/.kimi/credentials ``` ## Key Commands ### General Usage - `kimi chat`: Start an interactive session with K2.5. - `kimi code [path]`: Open a codebase-aware session for the specified directory. - `kimi exec "command"`: Run a specific prompt against the current context. - `kimi config list`: View current runtime configuration. ### Advanced Operations - `kimi scan`: Analyzes the current directory to build a temporary local index for better RAG performance. - `kimi token-count [file]`: Calculate token usage before sending large files to the 256K context. ## Common Workflows ### 1. Deep Codebase Analysis Kimi's 256K context is ideal for tasks that span multiple modules. ```bash # Ingest the entire src directory for a logic audit kimi code ./src --prompt "Analyze the dependency flow between the auth module and the database layer. Identify potential circularities." ``` ### 2. Fleet-Wide Batch Refactoring Use Kimi in conjunction with `fleet-build.sh` to propagate changes. ```bash # Example: Updating all scripts in ~/dev/projects/skills/scripts for file in ~/dev/projects/skills/scripts/*.py; do kimi exec "Update the logging pattern in $file to use the new Skynet standard" --write done ``` ### 3. Remote Execution via Vault When working from a machine without Kimi installed (like Spark): ```bash ssh vault "cd ~/dev/target-repo && kimi exec 'Generate unit tests for all functions in utils.py' --write" ``` ## Fleet-Specific Patterns ### The "256K Dump" Strategy Because Kimi handles 256K tokens, avoid aggressive `grep` filtering if the project is under 100MB. Instead, provide the whole context to allow the K2.5 model to see the "big picture." ### Model Overrides The K2.5 model is the fleet default. If a task requires higher reasoning but lower context, check if `k2.5-pro` is available in `kimi config models`. ### Output Redirection Kimi's CLI often outputs markdown. For automation, use the `--raw` flag when available to avoid stripping code blocks manually. ## Troubleshooting ### Token Limit Errors Even with 256K, massive node_modules or build artifacts can cause overflows. - **Fix:** Ensure `.kimiignore` or `.gitignore` is present. Kimi CLI respects these by default. - **Manual Exclusion:** `kimi code . --exclude "dist/*,logs/*"` ### Authentication Failures (Error 401) Usually caused by an expired session on the non-Vault machines. - **Action:** Run `kimi login` or pull the latest credentials from the Vault Mac. ### Version Mismatch The Workstation is on `1.11.0` while the Macs are on `1.21.0`. - **Known Issue:** `1.11.0` lacks the `kimi scan` command. - **Workaround:** For indexing-heavy tasks, delegate the execution to `ssh bots`. ## Documentation & Resources - **Official Docs:** [https://github.com/anthropics/kimi](https://github.com/anthropics/kimi) - **Internal Specs:** See `~/infra/docs/kimi-integration.md` on the Workstation. - **Support:** Reach out to James (skynet) for API quota increases on Moonshot platform. ## Best Practices for Agents 1. **Always verify context:** Run `kimi token-count` if you suspect the file set is large. 2. **Prefer `--write`:** When instructed to modify files, use the `--write` flag to avoid manual copy-pasting of diffs. 3. **Atomic Commits:** After a `kimi exec --write` operation, immediately run `git diff` to validate changes before proceeding. 4. **Machine Selection:** Use **Bots** or **Jarvis** for long-running batch jobs to keep the **Workstation** responsive.
curl -s https://skills.skynet.ceo/api/skills/software-kimi/skill.md