# Kimi-Code Applications Explained: Architecture of the MoonshotAI Monorepo

> Explore the Kimi-Code monorepo architecture and understand the purpose of each application: CLI, web client, debug inspector, visual debugger, and VS Code extension, all powered by AI.

- Repository: [Moonshot AI/kimi-code](https://github.com/MoonshotAI/kimi-code)
- Tags: architecture
- Published: 2026-07-29

---

**The Kimi-Code monorepo contains five distinct applications under `apps/`—a CLI/TUI (kimi-code), web client (kimi-web), debug inspector (kimi-inspect), visual debugging suite (vis), and VS Code extension (vscode)—that share a common SDK and connect to a central server to deliver AI-powered coding assistance.**

The MoonshotAI/kimi-code repository organizes its functionality into independent applications that together create a full-stack AI coding environment. Each application in the `apps/` directory serves a specific user interface or tooling need, from terminal-based interaction to browser debugging. Understanding the purpose of each kimi-code application helps developers choose the right interface for their workflow and contribute effectively to the codebase.

## CLI and Terminal UI: apps/kimi-code

The **kimi-code** application serves as the primary command-line interface and terminal UI (TUI) that users invoke as the `kimi` command. It acts as the central orchestrator, starting the local server and rendering an interactive terminal interface for AI coding sessions.

### Architecture and Flow

The entry point at [`apps/kimi-code/src/main.ts`](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/src/main.ts) parses CLI flags from `src/cli/` and initializes the system. It loads the dev server via `apps/kimi-code/scripts/dev.mjs`, instantiates `KimiHarness` from `@moonshot-ai/kimi-code-sdk`, and builds the UI through [`src/tui/kimi-tui.ts`](https://github.com/MoonshotAI/kimi-code/blob/main/src/tui/kimi-tui.ts). This coordinator wires together state management, editors, and slash-command handlers across `src/tui/components/`, `src/tui/controllers/`, and `src/tui/theme/`.

**Key source files:**
- [`apps/kimi-code/src/main.ts`](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/src/main.ts) – CLI entry and flag parsing
- [`apps/kimi-code/src/tui/kimi-tui.ts`](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/src/tui/kimi-tui.ts) – UI coordinator and theme management  
- [`apps/kimi-code/AGENTS.md`](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/AGENTS.md) – Architecture documentation

### Running the CLI

```bash

# Development mode from repository root

pnpm -C apps/kimi-code run dev

# Or install globally

npm install -g @moonshot-ai/kimi-code
kimi  # Launches the interactive TUI

```

## Browser Interface: apps/kimi-web

The **kimi-web** application provides a Vue-based web client that mirrors the TUI experience in a browser environment. It communicates with the local Kimi-Code server via REST and WebSocket connections under `/api/v1`.

### Web Client Architecture

The application mounts from [`apps/kimi-web/src/main.ts`](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-web/src/main.ts) and proxies API requests through Vite's dev server configuration ([`vite.config.ts`](https://github.com/MoonshotAI/kimi-code/blob/main/vite.config.ts)). All network calls flow through `src/api/daemon/` adapters and the `useKimiWebClient` composable, which exposes computed view properties and action dispatchers to Vue components.

**Key source files:**
- [`apps/kimi-web/src/main.ts`](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-web/src/main.ts) – Vue app initialization
- [`apps/kimi-web/src/composables/useKimiWebClient.ts`](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-web/src/composables/useKimiWebClient.ts) – API client layer
- [`apps/kimi-web/vite.config.ts`](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-web/vite.config.ts) – Proxy configuration for `/api/v1`

### Launching the Web UI

Ensure the server is running first, then start the web client:

```bash

# Terminal 1: Start the server

pnpm -C apps/kimi-code run dev:server

# Terminal 2: Launch web UI with server URL

KIMI_SERVER_URL=http://127.0.0.1:58627 pnpm -C apps/kimi-web run dev

```

## Debug Inspector: apps/kimi-inspect

The **kimi-inspect** application is a specialized debugging interface for developers to explore active sessions, agent states, and transcript data. It runs as a separate Vite application and connects to debug RPC endpoints (`/api/v1/debug/*`).

### Inspector Functionality

The UI loads from [`apps/kimi-inspect/src/main.tsx`](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-inspect/src/main.tsx) and uses [`src/servers.ts`](https://github.com/MoonshotAI/kimi-code/blob/main/src/servers.ts) to auto-discover running Kimi-Code instances. It fetches transcript data and service definitions via [`src/transcript/api.ts`](https://github.com/MoonshotAI/kimi-code/blob/main/src/transcript/api.ts), presenting panels for state diff viewing and service inspection.

**Key source files:**
- [`apps/kimi-inspect/src/ui.tsx`](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-inspect/src/ui.tsx) – Top-level UI composition
- [`apps/kimi-inspect/src/transcript/api.ts`](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-inspect/src/transcript/api.ts) – Debug transcript API endpoints
- [`apps/kimi-inspect/src/servers.ts`](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-inspect/src/servers.ts) – Server discovery logic

### Starting the Inspector

```bash
pnpm -C apps/kimi-inspect run dev  # Opens http://localhost:5175

```

The inspector automatically discovers the running server and displays available debug endpoints.

## Visual Debugging Suite: apps/vis

The **vis** application provides specialized tools for visualizing session replays and agent interactions across `apps/vis/web` and `apps/vis/server`. These components are internal engineering tools rather than end-user features, designed to debug complex multi-agent workflows.

### Visualization Components

The web component provides a UI for uploading zip files and inspecting analysis results, while the server component ([`apps/vis/server/src/main.ts`](https://github.com/MoonshotAI/kimi-code/blob/main/apps/vis/server/src/main.ts)) exposes REST and WebSocket services consumed by the visualization frontend.

**Key source files:**
- [`apps/vis/web/src/main.ts`](https://github.com/MoonshotAI/kimi-code/blob/main/apps/vis/web/src/main.ts) – Web UI entry point
- [`apps/vis/server/src/main.ts`](https://github.com/MoonshotAI/kimi-code/blob/main/apps/vis/server/src/main.ts) – Server entry point

## VS Code Extension: apps/vscode

The **vscode** application packages Kimi-Code as a native VS Code extension, embedding the TUI inside a webview panel. It bridges the terminal interface with the editor's file system and workspace APIs.

### Extension Architecture

The extension manifest ([`package.json`](https://github.com/MoonshotAI/kimi-code/blob/main/package.json)) defines webview contributions, while [`src/runtime/session-runtime.ts`](https://github.com/MoonshotAI/kimi-code/blob/main/src/runtime/session-runtime.ts) adapts the core TUI code to the VS Code webview protocol. Utility functions in `src/utils/` expose commands like "run prompt" and "open workspace" through the VS Code command palette.

**Key source files:**
- [`apps/vscode/src/runtime/session-runtime.ts`](https://github.com/MoonshotAI/kimi-code/blob/main/apps/vscode/src/runtime/session-runtime.ts) – Webview UI entry adapter
- [`apps/vscode/package.json`](https://github.com/MoonshotAI/kimi-code/blob/main/apps/vscode/package.json) – Extension manifest and command definitions

### Running the Extension Locally

```bash
pnpm -C apps/vscode run dev

```

This builds the extension and launches a VS Code development instance with the extension loaded. Use the **Kimi: Open** command to display the embedded TUI panel.

## Summary

- **apps/kimi-code**: Core CLI and terminal UI that starts the server and manages interactive sessions via `KimiHarness` and [`kimi-tui.ts`](https://github.com/MoonshotAI/kimi-code/blob/main/kimi-tui.ts).
- **apps/kimi-web**: Vue-based browser client connecting via `useKimiWebClient` to expose the coding interface in browsers.
- **apps/kimi-inspect**: Debug tool for inspecting transcripts and agent states through `/api/v1/debug/*` endpoints.
- **apps/vis**: Internal visualization suite for replaying and analyzing multi-agent sessions.
- **apps/vscode**: Editor extension embedding the TUI in VS Code webviews with workspace integration.

## Frequently Asked Questions

### How do the kimi-code applications communicate with each other?

The applications communicate through the central Kimi-Code server started by `apps/kimi-code`. The web interface (`apps/kimi-web`) and inspector (`apps/kimi-inspect`) connect via REST and WebSocket endpoints under `/api/v1`, while the VS Code extension embeds the TUI directly using the same underlying SDK (`@moonshot-ai/kimi-code-sdk`) adapted for the webview environment.

### Can I run the web interface without the CLI?

No, `apps/kimi-web` requires a running Kimi-Code server instance. You must start the server first using `pnpm -C apps/kimi-code run dev:server` or have a global `kimi` process running, then point the web client to it via the `KIMI_SERVER_URL` environment variable.

### What is the difference between kimi-inspect and the vis debugging suite?

**kimi-inspect** (`apps/kimi-inspect`) connects to live running sessions for real-time debugging of agents and transcripts. **vis** (`apps/vis`) handles post-hoc analysis of exported session data and zip files, providing visualization tools for replaying completed multi-agent workflows rather than inspecting active state.

### Which application should I modify to change the core AI coding logic?

Core logic resides in the SDK (`@moonshot-ai/kimi-code-sdk`) consumed by `apps/kimi-code`. However, to modify how the interface renders or handles user input, you would edit [`apps/kimi-code/src/tui/kimi-tui.ts`](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/src/tui/kimi-tui.ts) for the CLI, [`apps/kimi-web/src/composables/useKimiWebClient.ts`](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-web/src/composables/useKimiWebClient.ts) for the web interface, or [`apps/vscode/src/runtime/session-runtime.ts`](https://github.com/MoonshotAI/kimi-code/blob/main/apps/vscode/src/runtime/session-runtime.ts) for the VS Code extension.