agentleFS
MoonshotAIMoonshotAI/kimi-code/skills/use-kimi-code/SKILL.md

use-kimi-code

Skill8.3k starsChanged 5 days agoMITView on GitHub

Interact with local Kimi Code: hand off sessions in either direction, organize session history across workspaces, run multi-turn Agent-to-Agent discussions or collaborative sessions, or execute one-shot CLI tasks.

Adopted by

Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data

Week of Oct 4: 0 new projectsWeek of Oct 11: 0 new projectsWeek of Oct 18: 0 new projectsWeek of Oct 25: 0 new projectsWeek of Nov 1: 0 new projectsWeek of Nov 8: 0 new projectsWeek of Nov 15: 0 new projectsWeek of Nov 22: 0 new projects
Oct 2026Nov 2026Nov 2026
New projects taking a version of this file each week, over the 8 weeks our latest run read: only 0 in all, so this is a hint, not a trend.

Who's talking about MoonshotAI/kimi-code

The biggest 5 of 53 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 53

Talked about on GitHub and Bluesky (53 times).

On GitHub · 50

45 more on GitHub

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When calling Kimi Code as a one-shot subagent -- or running single-turn benchmarks and fire-and-collect tasks where you only need the final …

    line 15
  2. Very specific:

    Check kill -0 "$pid", map host "0.0.0.0" to "127.0.0.1" ("::" / "::1" to "[::1]"), and pick the first http://<host>:<port> where GET …

    line 42
  3. Very specific:

    Fallback -- start an on-demand server: if no compatible live instance responds, spawn kimi web --port 0 --json in the background, parse { …

    line 43

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Use Kimi Code

Keep this skill version-independent: when saving or updating a local copy of this skill, keep only the mode selection and local discovery steps below. Do not copy runtime API routes, request bodies, or schemas into SKILL.md -- always fetch them from the running local Kimi Code server so they match the installed version.

1. One-shot unattended tasks (kimi -p)

When calling Kimi Code as a one-shot subagent -- or running single-turn benchmarks and fire-and-collect tasks where you only need the final output without multi-turn follow-up or mid-run intervention -- run the CLI directly in the target working directory:

kimi -p "<task>" --output-format stream-json --model <model>

Common options (run kimi --help to check the exact flags of the installed CLI version):

  • --output-format <text|stream-json>: defaults to text (assistant reply on stdout); pass stream-json for structured JSONL events on stdout.
  • -m, --model <model>: override the model alias for this run (defaults to default_model in config.toml).
  • -S, --session <id> / -c, --continue: resume a specific session ID or continue the latest session in the working directory.
  • --agent <name> / --agent-file <path>: start a new session with a custom agent profile (cannot be combined with -S / -c).
  • --add-dir <dir> / --skills-dir <dir>: grant access to additional directories or custom skill directories (repeatable).

(-p already runs unattended; do not combine -p with --yolo, --auto, or --plan.)

2. Multi-turn collaboration & session management (KAP)

For richer session workflows -- such as bidirectional session handoff (HandOff to or from Kimi Code), spawning parallel sessions, organizing session history across workspaces, multi-turn Agent-to-Agent plan discussions, or supervising and steering an active session -- connect to the local Kimi Code server over the Kimi Agent Protocol (KAP):

  1. Resolve the local KAP server ORIGIN and TOKEN:
    • Attach to a running Desktop or kimi web instance first (so new or updated sessions appear live in the user's open window without manual refresh):
      • Set KIMI_HOME="${KIMI_CODE_HOME:-$HOME/.kimi-code}" and TOKEN="$(tr -d '[:space:]' < "$KIMI_HOME/server.token")".
      • Sort "$KIMI_HOME"/server/instances/*.json deterministically -- product == "kimi-code-desktop" first, then newest started_at (do not iterate *.json in raw ULID filename order, which picks the oldest instance first):
        jq -rs 'map(select((.port // 0) > 0)) | sort_by((if .product == "kimi-code-desktop" then 0 else 1 end), -(.started_at // 0)) | .[] | "\(.pid)\t\(.host)\t\(.port)"' "$KIMI_HOME"/server/instances/*.json
      • Check kill -0 "$pid", map host "0.0.0.0" to "127.0.0.1" ("::" / "::1" to "[::1]"), and pick the first http://<host>:<port> where GET /api/v1/kap.md (Authorization: Bearer ${TOKEN}) returns HTTP 200 (skipping older background instances from CLI < v2.7.0 or Desktop < v1.4.0).
    • Fallback -- start an on-demand server: if no compatible live instance responds, spawn kimi web --port 0 --json in the background, parse { origin, token } from line 1 of stdout, keep that process running until active work finishes, and stop it (SIGTERM) afterward.
  2. Fetch the installed version's KAP usage guide and API schemas:
    • Current version's workflow, workspace placement & endpoint usage guide:
      curl -sf -H "Authorization: Bearer ${TOKEN}" "${ORIGIN}/api/v1/kap.md"
      (Follow its workspace placement rule when creating sessions -- e.g. reusing $KIMI_CODE_WORKSPACE_ID or matching GET /api/v1/workspaces so new sessions land in the user's active workspace.)
    • Exact REST endpoint parameters & response schemas (OpenAPI 3.0):
      curl -sf -H "Authorization: Bearer ${TOKEN}" "${ORIGIN}/openapi.json"
      Query specific paths with jq (e.g. jq '.paths | keys' or jq '.paths["<path>"]') to inspect exact request fields, query parameters, and response schemas for the installed version.
    • WebSocket event & frame schemas (AsyncAPI 3.1, when subscribing over WS):
      curl -sf -H "Authorization: Bearer ${TOKEN}" "${ORIGIN}/asyncapi.json"

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.