How to Set Up the Kimi Code VS Code Extension
The Kimi Code VS Code Extension brings the AI-powered coding assistant directly into Visual Studio Code through three steps: install from the Marketplace, open a workspace folder, and sign in to your Kimi account.
The Kimi Code VS Code Extension runs on the same Node SDK as the Kimi Code CLI, automatically reusing your KIMI_CODE_HOME configuration including config.toml, MCP settings, and login state. This guide walks you through complete Kimi Code VS Code Extension setup based on the official source code in the MoonshotAI/kimi-code repository.
Install the Kimi Code VS Code Extension
You need Visual Studio Code ≥ 1.100.0. Open the Extensions view and search for Kimi Code on the Marketplace, or install directly from https://marketplace.visualstudio.com/items?itemName=moonshot-ai.kimi-code.
The extension ships with a compiled binary at dist/extension.js and a webview UI built from apps/vscode in the monorepo. Once installed, the extension activates automatically when you open a folder workspace.
Open a Project Folder
The Kimi Code VS Code Extension requires an open folder, not a single file. Use File → Open Folder or the command palette (Ctrl+Shift+P / Cmd+Shift+P) to select your project directory.
The extension operates workspace-wide through src/extension.ts, which registers commands and provides the runtime with file-system access and editor context. Without a folder open, the extension cannot access your project files.
Sign In to Your Kimi Account
Click the Kimi icon in the Activity Bar, then select Sign In. You have two authentication options:
- kimi.com/code subscription — Log in directly with your Moonshot AI account
- Provider from
config.toml— Use an API provider already configured in your shared Kimi Code environment
Authentication creates a session that the Node SDK shares between the extension and CLI. This single source of truth keeps tokens and MCP credentials synchronized. The sign-in flow is documented in apps/vscode/README.md.
Configure the Shared Environment (Optional)
Both the extension and CLI read from KIMI_CODE_HOME to locate configuration files. To use a custom location:
export KIMI_CODE_HOME=$HOME/.kimi
Add this to your shell profile (.bashrc, .zshrc, etc.) so VS Code inherits the variable on launch. The extension reads this environment variable directly—no VS Code settings are required.
By default, both tools use the same home directory, ensuring shared configuration, MCP data, and login state across all Kimi Code interfaces.
Adjust Extension Settings (Optional)
Open Settings → Extensions → Kimi Code to fine-tune behavior. Key options defined in apps/vscode/package.json include:
| Setting | Description |
|---|---|
kimi.yoloMode |
Auto-approve regular tool calls without confirmation |
kimi.autosave |
Automatically save files before Kimi reads or writes them |
kimi.editorContext |
Control when active editor file and cursor position are shared: never, onConversationStart, or onFileChange |
These settings map through apps/vscode/src/config/vscode-settings.ts to runtime options in src/runtime/kimi-runtime.ts.
Start Your First Conversation
Click the Kimi icon in the Activity Bar, then type a prompt or use slash commands:
/init— Analyze the current project structure/compact— Manage and compress conversation context
The KimiWebviewProvider class (in apps/vscode/src/KimiWebviewProvider.ts) renders the chat interface and forwards commands to the runtime. Your conversation history, context, and tool outputs persist across sessions through the shared configuration.
Summary
- Install the Kimi Code extension from the Marketplace (VS Code ≥ 1.100.0 required)
- Open a folder workspace for the extension to access project files
- Sign in via the Activity Bar icon to establish a shared session with the CLI
- Optionally set
KIMI_CODE_HOMEfor custom configuration paths - Fine-tune automation through
kimi.yoloMode,kimi.autosave, andkimi.editorContextsettings
Frequently Asked Questions
What Does the Kimi Code VS Code Extension Share With the CLI?
Both use the Node SDK and read from the same KIMI_CODE_HOME directory. This means config.toml, MCP server configurations, and authentication tokens stay synchronized. You can start work in the CLI and continue in VS Code without re-authenticating.
Where Are the Extension Settings Defined?
All user-configurable settings are declared in apps/vscode/package.json under the configuration section. The vscode-settings.ts module maps these VS Code settings to internal runtime options consumed by kimi-runtime.ts.
Can I Use Kimi Code Without Opening a Folder?
No. The extension requires an open folder workspace to provide file-system access and editor context. Opening a single file will not activate the full functionality implemented in src/extension.ts.
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 →