How to Report a Bug in Kimi-Code: A Complete Guide with Session Exports and Slash Commands
Report bugs in Kimi-Code using the /bug slash command inside the TUI or by manually running kimi export and attaching the ZIP to a GitHub issue.
Kimi-Code is a pnpm monorepo built by MoonshotAI that combines a terminal UI, server, public SDK, and internal engine packages. Understanding how its components interact helps you file precise, actionable bug reports that get resolved faster.
Kimi-Code Architecture Overview
Before reporting, identify which subsystem your bug affects:
| Component | Package Path | Key Documentation |
|---|---|---|
| CLI / TUI | apps/kimi-code |
[apps/kimi-code/README.md](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/README.md) |
| Server | packages/kap-server |
[packages/kap-server/AGENTS.md](https://github.com/MoonshotAI/kimi-code/blob/main/packages/kap-server/AGENTS.md) |
| Core Engine | packages/agent-core and packages/agent-core-v2 |
[packages/agent-core/AGENTS.md](https://github.com/MoonshotAI/kimi-code/blob/main/packages/agent-core/AGENTS.md) |
| Public SDK | packages/node-sdk |
[packages/node-sdk/README.md](https://github.com/MoonshotAI/kimi-code/blob/main/packages/node-sdk/README.md) |
| Debug Tools | apps/vis, apps/kimi-inspect |
[apps/kimi-inspect/README.md](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-inspect/README.md) |
This context determines whether you need server debug logs, a session export, or SDK reproduction steps.
Required Pre-Report Discussion
The [CONTRIBUTING.md](https://github.com/MoonshotAI/kimi-code/blob/main/CONTRIBUTING.md) explicitly requires discussion before submitting bug fixes for ambiguous issues, new features, large refactors, or API changes. Open a GitHub issue first to confirm the problem and proposed approach.
How to Report a Bug in Kimi-Code: Three Methods
Method 1: Use the /bug Slash Command (Fastest)
Inside the Kimi-Code TUI, type:
/bug
This alias for /feedback prompts for a description and automatically attaches the current session's debug ZIP. The slash command documentation in [docs/en/reference/slash-commands.md](https://github.com/MoonshotAI/kimi-code/blob/main/docs/en/reference/slash-commands.md) lists both commands with identical functionality.
Method 2: Manually Export and Attach to GitHub
For more control over what you share, use kimi export documented in [docs/en/reference/kimi-command.md](https://github.com/MoonshotAI/kimi-code/blob/main/docs/en/reference/kimi-command.md):
# Export specific session to timestamped ZIP
kimi export 01HZ...XYZ -o ./bug-report.zip
# Exclude global log for privacy
kimi export 01HZ...XYZ -o ./bug-report.zip --no-include-global-log
Upload bug-report.zip when creating your GitHub issue. The export packs session state with wire logs, giving maintainers the exact engine state during failure.
Method 3: Enable Server Debug Surface for Engine Bugs
For engine-level bugs like DI cycles or service crashes, start the server with debug endpoints:
pnpm dev:server --debug-endpoints
This exposes /api/v1/debug/* routes on loopback only, as described in [packages/kap-server/AGENTS.md](https://github.com/MoonshotAI/kimi-code/blob/main/packages/kap-server/AGENTS.md). Use these RPC surfaces to query internal services directly and capture additional diagnostic data.
Critical Bug Report Components
Every effective Kimi-Code bug report should include:
- Clear reproduction steps — exact commands or interactions that trigger the issue
- Component identification — which monorepo package is affected
- Debug export — session ZIP from
kimi exportor/bugcommand - Environment details — Node version, pnpm version, OS, and Kimi-Code commit hash
Engine-level diagnostics require understanding the service architecture in agent-core, while CLI/TUI bugs are reproduced via session replay using the exported wire logs.
Component-Specific Debugging Notes
| Bug Type | Required Export | Key File Reference |
|---|---|---|
| TUI rendering or interaction issues | Session ZIP via /bug or kimi export |
[apps/kimi-code/README.md](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/README.md) |
| Agent engine crashes or unexpected behavior | Session ZIP + server logs with --debug-endpoints |
[packages/agent-core/AGENTS.md](https://github.com/MoonshotAI/kimi-code/blob/main/packages/agent-core/AGENTS.md) |
| SDK type errors or API mismatches | Minimal reproduction repo using packages/node-sdk |
[packages/node-sdk/README.md](https://github.com/MoonshotAI/kimi-code/blob/main/packages/node-sdk/README.md) |
| Session replay or visualization failures | Export from apps/vis or apps/kimi-inspect |
[apps/kimi-inspect/README.md](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-inspect/README.md) |
Summary
- Kimi-Code is a pnpm monorepo with distinct CLI, server, engine, and SDK components
- Report bugs via
/bugslash command for automatic session attachment - Use
kimi exportfor manual control over what diagnostic data you share - Enable
--debug-endpointswhen diagnosing engine-level failures - Discuss before coding per [
CONTRIBUTING.md](https://github.com/MoonshotAI/kimi-code/blob/main/CONTRIBUTING.md) requirements - Attach session ZIPs to GitHub issues — they contain reproducible wire logs
Frequently Asked Questions
What information does a Kimi-Code bug report need most?
A clear description, exact reproduction steps, and the session export ZIP are essential. The ZIP contains wire logs and engine state that let maintainers replay your exact failure scenario without environment setup.
Can I report bugs without using the TUI?
Yes. Run kimi export <session-id> -o ./report.zip from any terminal with Kimi-Code installed, then attach the ZIP to a manually created GitHub issue. The /bug command is simply a convenience wrapper.
Why does the server need --debug-endpoints for some bugs?
Engine-level issues involve internal services, DI containers, and RPC surfaces that aren't exposed in production builds. The debug endpoints in packages/kap-server let you query these directly and capture diagnostic traces that session exports alone cannot provide.
How do I find my session ID for manual export?
Session IDs appear in the TUI status bar and in the filesystem under Kimi-Code's data directory. The kimi export command accepts any valid session identifier from your local history.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →