Skip to main content

CLIs that delegate bulk reading, boilerplate generation, and chat-log extraction to Kimi K2.5 — saving tokens inside coding agents.

Project description

kimi-calls

Three CLIs that delegate the bulky parts of a coding-agent session to Kimi K2.5 via the Moonshot platform API. The reasoning stays in your main agent (Claude Code, Codex, Cursor, …); the bulk reading, boilerplate generation, and chat-log extraction get offloaded — saving tokens, latency, and money.

Tool Replaces Use when
ask-kimi reading 3+ files into context "what does this codebase do across these N files?"
kimi-write generating boilerplate from scratch tests, configs, docstrings, repetitive scaffolding
extract-chat parsing session JSONL by hand turn a Claude Code or Codex session into plain dialogue

Install

Requires Python 3.10+.

pip install kimi-calls
# or
uv tool install kimi-calls

Get a Moonshot API key

  1. Sign in at https://platform.moonshot.ai (the international platform — not moonshot.cn, which is China-only).
  2. Add credit under Billing (pay-as-you-go; a few dollars goes a long way).
  3. Create a key under API Keys → it'll start with sk-.

Make the key available to the CLIs

The tools read MOONSHOT_API_KEY from the environment. Pick one:

Persist for every shell (recommended). Append to ~/.zshrc (macOS default) or ~/.bashrc:

echo 'export MOONSHOT_API_KEY=sk-...' >> ~/.zshrc
source ~/.zshrc

Per-project via .env. If you use direnv or a similar loader:

echo 'MOONSHOT_API_KEY=sk-...' >> .env

One-off in the current shell:

export MOONSHOT_API_KEY=sk-...

Verify it's set:

echo $MOONSHOT_API_KEY    # should print sk-...

Optional: pin a model with KIMI_MODEL (default kimi-k2.5).

Usage

ask-kimi — bulk reading

ask-kimi --paths src/api.py src/db.py src/auth.py \
         --question "Where do we handle session expiry?"

Files are concatenated before the question, so repeat calls on the same --paths list hit Moonshot's prefix cache. Keep the order stable across calls.

kimi-write — boilerplate generation

kimi-write --spec  "pytest suite covering build_corpus" \
           --context src/kimi_calls/_client.py tests/test_extract.py \
           --target  tests/test_corpus.py

Then Edit only what needs fixing. Saves the round-trips you'd otherwise spend writing scaffolding token by token.

kimi-write refuses to overwrite an existing target unless you pass --force.

extract-chat — session text for documentation

extract-chat ~/.claude/projects/.../session.jsonl -o /tmp/chat.txt
# or for Codex:
extract-chat ~/.codex/sessions/.../rollout.jsonl -o /tmp/chat.txt

When writing to -o/--output, extract-chat refuses to overwrite an existing file unless you pass --force.

Strips tool calls, system prompts, and binary blocks. Auto-detects Claude Code ({"type": "user", "message": {...}}) vs Codex ({"role": "user", "content": ...}) format. Pipe the result into ask-kimi for documentation work:

extract-chat session.jsonl -o /tmp/chat.txt
ask-kimi --paths /tmp/chat.txt docs/architecture.md \
         --question "What architecture decisions from this session belong in the doc?"

Wire it into your agent

See examples/ for ready-to-drop snippets:

  • Claude Codeexamples/claude-code/settings.json (permission allowlist) and CLAUDE.md (delegation rules).
  • Codexexamples/codex/AGENTS.md.
  • Cursorexamples/cursor/.cursor/rules/kimi-delegation.mdc (always-on project rule).

The full delegation policy lives in docs/delegation-policy.md — agent-agnostic guidance on when to delegate and when not to.

Development

uv pip install -e ".[dev]"
pytest

Tests are pure parsing — no API calls, no key required.

License

MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kimi_calls-0.1.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kimi_calls-0.1.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file kimi_calls-0.1.0.tar.gz.

File metadata

  • Download URL: kimi_calls-0.1.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kimi_calls-0.1.0.tar.gz
Algorithm Hash digest
SHA256 58ac8e9812accd754cb5587a9cf04d1d3ea437269a05d45ab83bd43138df4a6c
MD5 306889d9b79af8722c29c7baca7e092f
BLAKE2b-256 7ce1426200d0138716b46d47ed4beb9119fe429e2fc6e66b2b9e13044c89912e

See more details on using hashes here.

Provenance

The following attestation bundles were made for kimi_calls-0.1.0.tar.gz:

Publisher: publish.yml on rejkpp/kimi-calls

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kimi_calls-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: kimi_calls-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kimi_calls-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8f2ee6f04ce86f65254e8428837a1c312cdc35b20f6b592e4a563d8022cd37be
MD5 68709a130d50186581110e5ac11433c2
BLAKE2b-256 09eb6fe01c9cc3fd344319008d06d3fa9753aa15aee91ecab826b16d317d1bbf

See more details on using hashes here.

Provenance

The following attestation bundles were made for kimi_calls-0.1.0-py3-none-any.whl:

Publisher: publish.yml on rejkpp/kimi-calls

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page