$ show MoonshotAI/kimi-cli
kimi-cli is MoonshotAI's Python AI coding assistant CLI, now explicitly archived and replaced by the TypeScript Kimi Code CLI. The pyproject.toml declares Development Status :: 7 - Inactive, the README states no further releases or security fixes will ship, and the final release (1.52.0) is a deprecation shim: every entry point short-circuits to a notice that downloads and installs the successor via a CDN script. Tests in the repo actively enforce that the legacy Typer CLI is unreachable. In its working life it was a full-featured terminal agent with interactive shell (prompt_toolkit/Rich), print mode, file editing tools, shell execution, web fetch/search, subagents, plan mode, approval workflows, background tasks, hooks, plugins, MCP server management, OAuth, and session persistence.
The LLM identified 6 files worth highlighting for reuse:
A mini-language for scripting deterministic chat provider responses. Lets tests simulate streaming text, tool calls, thinking parts, and errors without any network access. Directly extractable for any LLM application needing reproducible provider behavior in test suites; the companion ScriptedEchoChatProvider makes it a complete mocking harness.
JSON Schema utilities that inline local $refs (deref_json_schema) and infer explicit property types from enum/const/structure (ensure_property_types) to satisfy provider-specific tool-call schema requirements. Solves the recurring problem of normalizing tool schemas across OpenAI/Anthropic/Kimi-compatible APIs and is fully standalone.
Async approval runtime implementing a create_request -> wait_for_response -> resolve lifecycle with per-source cancellation, timeouts, shared-waiter deduplication, and wire-event publishing. A clean, well-tested pattern for any agent system needing human-in-the-loop gating of tool execution, with a ContextVar-based source tracker for nested agents.
Lifecycle hook engine (PreToolUse, PostToolUse, UserPromptSubmit, Stop) with regex matchers, deduplication, telemetry-failure isolation, and fire-and-forget execution using strong task references to defeat Python GC. Demonstrates a safe external-process hook pattern where PreToolUse can block tools and failures never break the main agent loop.
Append-only JSONL conversation context with checkpoint/revert/clear operations, atomic prepend via temp-file rename, rotation on revert, and defensive parsing of malformed lines. A robust persistence pattern for streaming conversation state that survives crashes and concurrent readers; the pending-token estimation built on it is a nice touch for compaction triggers.
KaosPath virtual filesystem abstraction providing identical async file/process operations over local and SSH backends, with MSYS/Cygwin/UNC path normalization. Extractable for any tool needing a uniform filesystem interface across local and remote execution; the protocol-based design keeps backends swappable.