# Table of Contents
- [Kilo Code Docs](#kilo-code-docs)
- [Search the documentation](#search-the-documentation)
- [codebase_search | Kilo Code Docs](#codebase-search-kilo-code-docs)
- [Custom Instructions | Kilo Code Docs](#custom-instructions-kilo-code-docs)
- [Working with Large Projects | Kilo Code Docs](#working-with-large-projects-kilo-code-docs)
- [codebase_search | Kilo Code Docs](#codebase-search-kilo-code-docs)
- [Custom Rules | Kilo Code Docs](#custom-rules-kilo-code-docs)
- [Context Mentions | Kilo Code Docs](#context-mentions-kilo-code-docs)
- [Prompt Engineering Tips | Kilo Code Docs](#prompt-engineering-tips-kilo-code-docs)
- [Using Local Models | Kilo Code Docs](#using-local-models-kilo-code-docs)
- [Adding More Tokens | Kilo Code Docs](#adding-more-tokens-kilo-code-docs)
- [Using Modes | Kilo Code Docs](#using-modes-kilo-code-docs)
- [Chatting with Kilo Code | Kilo Code Docs](#chatting-with-kilo-code-kilo-code-docs)
- [How Tools Work | Kilo Code Docs](#how-tools-work-kilo-code-docs)
- [Rate Limits and Costs | Kilo Code Docs](#rate-limits-and-costs-kilo-code-docs)
- [Development Environment | Kilo Code Docs](#development-environment-kilo-code-docs)
- [Contributing to Kilo Code | Kilo Code Docs](#contributing-to-kilo-code-kilo-code-docs)
- [API Configuration Profiles | Kilo Code Docs](#api-configuration-profiles-kilo-code-docs)
- [Custom Modes | Kilo Code Docs](#custom-modes-kilo-code-docs)
- [Auto-Approving Actions | Kilo Code Docs](#auto-approving-actions-kilo-code-docs)
- [Experimental Features | Kilo Code Docs](#experimental-features-kilo-code-docs)
- [Checkpoints | Kilo Code Docs](#checkpoints-kilo-code-docs)
- [Import, Export, and Reset Settings | Kilo Code Docs](#import-export-and-reset-settings-kilo-code-docs)
- [Generate Commit Messages | Kilo Code Docs](#generate-commit-messages-kilo-code-docs)
- [Enhance Prompt | Kilo Code Docs](#enhance-prompt-kilo-code-docs)
- [Memory Bank | Kilo Code Docs](#memory-bank-kilo-code-docs)
- [Task Todo List | Kilo Code Docs](#task-todo-list-kilo-code-docs)
- [Installing Kilo Code | Kilo Code Docs](#installing-kilo-code-kilo-code-docs)
- [setting-up | Kilo Code Docs](#setting-up-kilo-code-docs)
- [Footgun Prompting: Override System Prompts | Kilo Code Docs](#footgun-prompting-override-system-prompts-kilo-code-docs)
- [Codebase Indexing | Kilo Code Docs](#codebase-indexing-kilo-code-docs)
- [Connecting Your First AI Provider | Kilo Code Docs](#connecting-your-first-ai-provider-kilo-code-docs)
- [Orchestrator Mode: Coordinate Complex Workflows | Kilo Code Docs](#orchestrator-mode-coordinate-complex-workflows-kilo-code-docs)
- [Starting Your First Task with Kilo Code | Kilo Code Docs](#starting-your-first-task-with-kilo-code-kilo-code-docs)
- [Browser Use | Kilo Code Docs](#browser-use-kilo-code-docs)
- [Suggested Responses | Kilo Code Docs](#suggested-responses-kilo-code-docs)
- [What is MCP? | Kilo Code Docs](#what-is-mcp-kilo-code-docs)
- [MCP vs API | Kilo Code Docs](#mcp-vs-api-kilo-code-docs)
- [MCP Overview | Kilo Code Docs](#mcp-overview-kilo-code-docs)
- [Code Actions | Kilo Code Docs](#code-actions-kilo-code-docs)
- [Additional Features | Kilo Code Docs](#additional-features-kilo-code-docs)
- [MCP Server Transports | Kilo Code Docs](#mcp-server-transports-kilo-code-docs)
- [Using MCP in Kilo Code | Kilo Code Docs](#using-mcp-in-kilo-code-kilo-code-docs)
- [Terminal Shell Integration | Kilo Code Docs](#terminal-shell-integration-kilo-code-docs)
- [Fast Edits | Kilo Code Docs](#fast-edits-kilo-code-docs)
- [Model Temperature | Kilo Code Docs](#model-temperature-kilo-code-docs)
- [Tips & Tricks | Kilo Code Docs](#tips-tricks-kilo-code-docs)
- [Workflows | Kilo Code Docs](#workflows-kilo-code-docs)
- [access_mcp_resource | Kilo Code Docs](#access-mcp-resource-kilo-code-docs)
- [ask_followup_question | Kilo Code Docs](#ask-followup-question-kilo-code-docs)
- [apply_diff | Kilo Code Docs](#apply-diff-kilo-code-docs)
- [browser_action | Kilo Code Docs](#browser-action-kilo-code-docs)
- [attempt_completion | Kilo Code Docs](#attempt-completion-kilo-code-docs)
- [faq | Kilo Code Docs](#faq-kilo-code-docs)
- [execute_command | Kilo Code Docs](#execute-command-kilo-code-docs)
- [list_code_definition_names | Kilo Code Docs](#list-code-definition-names-kilo-code-docs)
- [list_files | Kilo Code Docs](#list-files-kilo-code-docs)
- [new_task | Kilo Code Docs](#new-task-kilo-code-docs)
- [search_files | Kilo Code Docs](#search-files-kilo-code-docs)
- [switch_mode | Kilo Code Docs](#switch-mode-kilo-code-docs)
- [read_file | Kilo Code Docs](#read-file-kilo-code-docs)
- [update_todo_list | Kilo Code Docs](#update-todo-list-kilo-code-docs)
- [use_mcp_tool | Kilo Code Docs](#use-mcp-tool-kilo-code-docs)
- [write_to_file | Kilo Code Docs](#write-to-file-kilo-code-docs)
- [Tool Use Overview | Kilo Code Docs](#tool-use-overview-kilo-code-docs)
- [Using DeepSeek With Kilo Code | Kilo Code Docs](#using-deepseek-with-kilo-code-kilo-code-docs)
- [Using Anthropic With Kilo Code | Kilo Code Docs](#using-anthropic-with-kilo-code-kilo-code-docs)
- [Using Chutes AI With Kilo Code | Kilo Code Docs](#using-chutes-ai-with-kilo-code-kilo-code-docs)
- [Using LM Studio With Kilo Code | Kilo Code Docs](#using-lm-studio-with-kilo-code-kilo-code-docs)
- [Using Glama With Kilo Code | Kilo Code Docs](#using-glama-with-kilo-code-kilo-code-docs)
- [Human Relay Provider | Kilo Code Docs](#human-relay-provider-kilo-code-docs)
- [Using AWS Bedrock With Kilo Code | Kilo Code Docs](#using-aws-bedrock-with-kilo-code-kilo-code-docs)
- [Using Groq With Kilo Code | Kilo Code Docs](#using-groq-with-kilo-code-kilo-code-docs)
- [Using Google Gemini With Kilo Code | Kilo Code Docs](#using-google-gemini-with-kilo-code-kilo-code-docs)
- [Using Kilo Code's API Provider | Kilo Code Docs](#using-kilo-code-s-api-provider-kilo-code-docs)
- [Using Claude Code With Kilo Code | Kilo Code Docs](#using-claude-code-with-kilo-code-kilo-code-docs)
- [Using OpenRouter With Kilo Code | Kilo Code Docs](#using-openrouter-with-kilo-code-kilo-code-docs)
- [Using OpenAI With Kilo Code | Kilo Code Docs](#using-openai-with-kilo-code-kilo-code-docs)
- [Using v0 With Kilo Code | Kilo Code Docs](#using-v0-with-kilo-code-kilo-code-docs)
- [Using OpenAI Compatible Providers With Kilo Code | Kilo Code Docs](#using-openai-compatible-providers-with-kilo-code-kilo-code-docs)
- [Using Unbound With Kilo Code | Kilo Code Docs](#using-unbound-with-kilo-code-kilo-code-docs)
- [Using Requesty With Kilo Code | Kilo Code Docs](#using-requesty-with-kilo-code-kilo-code-docs)
- [Using Ollama With Kilo Code | Kilo Code Docs](#using-ollama-with-kilo-code-kilo-code-docs)
- [Using VS Code Language Model API With Kilo Code | Kilo Code Docs](#using-vs-code-language-model-api-with-kilo-code-kilo-code-docs)
- [Using GCP Vertex AI With Kilo Code | Kilo Code Docs](#using-gcp-vertex-ai-with-kilo-code-kilo-code-docs)
- [Using Mistral AI With Kilo Code | Kilo Code Docs](#using-mistral-ai-with-kilo-code-kilo-code-docs)
- [Using xAI (Grok) With Kilo Code | Kilo Code Docs](#using-xai-grok-with-kilo-code-kilo-code-docs)
- [Kilo Code 文档 | Kilo Code Docs](#kilo-code-kilo-code-docs)
- [搜索文档](#-)
- [自定义指令 | Kilo Code Docs](#-kilo-code-docs)
- [codebase_search | Kilo Code Docs](#codebase-search-kilo-code-docs)
- [处理大型项目 | Kilo Code Docs](#-kilo-code-docs)
- [自定义规则 | Kilo Code Docs](#-kilo-code-docs)
- [使用本地模型 | Kilo Code Docs](#-kilo-code-docs)
- [Prompt Engineering 技巧 | Kilo Code Docs](#prompt-engineering-kilo-code-docs)
- [Memory Bank | Kilo Code Docs](#memory-bank-kilo-code-docs)
- [速率限制与成本 | Kilo Code Docs](#-kilo-code-docs)
- [添加更多 Tokens | Kilo Code Docs](#-tokens-kilo-code-docs)
- [上下文提及 | Kilo Code Docs](#-kilo-code-docs)
- [Generate Commit Messages | Kilo Code Docs](#generate-commit-messages-kilo-code-docs)
- [Orchestrator Mode:协调复杂工作流 | Kilo Code Docs](#orchestrator-mode-kilo-code-docs)
- [使用模式 | Kilo Code Docs](#-kilo-code-docs)
- [Task Todo List | Kilo Code Docs](#task-todo-list-kilo-code-docs)
- [聊天界面 | Kilo Code Docs](#-kilo-code-docs)
- [工具工作原理 | Kilo Code Docs](#-kilo-code-docs)
- [为 Kilo Code 做贡献 | Kilo Code Docs](#-kilo-code-kilo-code-docs)
- [API 配置档案 | Kilo Code Docs](#api-kilo-code-docs)
- [开发环境 | Kilo Code Docs](#-kilo-code-docs)
- [自动批准操作 | Kilo Code Docs](#-kilo-code-docs)
- [实验性功能 | Kilo Code Docs](#-kilo-code-docs)
- [增强提示 | Kilo Code Docs](#-kilo-code-docs)
- [浏览器使用 | Kilo Code Docs](#-kilo-code-docs)
- [检查点 | Kilo Code Docs](#-kilo-code-docs)
- [Footgun Prompting:覆盖系统提示 | Kilo Code Docs](#footgun-prompting-kilo-code-docs)
- [codebase_search | Kilo Code Docs](#codebase-search-kilo-code-docs)
- [什么是 MCP? | Kilo Code Docs](#-mcp-kilo-code-docs)
- [Codebase Indexing | Kilo Code Docs](#codebase-indexing-kilo-code-docs)
- [MCP与API | Kilo Code Docs](#mcp-api-kilo-code-docs)
- [快速编辑 | Kilo Code Docs](#-kilo-code-docs)
- [MCP概览 | Kilo Code Docs](#mcp-kilo-code-docs)
- [自定义模式 | Kilo Code Docs](#-kilo-code-docs)
- [Unknown](#unknown)
- [导入、导出和重置设置 | Kilo Code Docs](#-kilo-code-docs)
- [faq | Kilo Code Docs](#faq-kilo-code-docs)
- [更多功能 | Kilo Code Docs](#-kilo-code-docs)
- [代码操作 | Kilo Code Docs](#-kilo-code-docs)
- [建议响应 | Kilo Code Docs](#-kilo-code-docs)
- [模型温度 | Kilo Code Docs](#-kilo-code-docs)
- [MCP服务器传输机制 | Kilo Code Docs](#mcp-kilo-code-docs)
- [连接您的第一个AI提供商 | Kilo Code Docs](#-ai-kilo-code-docs)
- [setting-up | Kilo Code Docs](#setting-up-kilo-code-docs)
- [安装Kilo Code | Kilo Code Docs](#-kilo-code-kilo-code-docs)
- [开始你的第一个Kilo Code任务 | Kilo Code Docs](#-kilo-code-kilo-code-docs)
- [终端 Shell 集成 | Kilo Code Docs](#-shell-kilo-code-docs)
- [在Kilo Code中使用MCP | Kilo Code Docs](#-kilo-code-mcp-kilo-code-docs)
- [Workflows | Kilo Code Docs](#workflows-kilo-code-docs)
- [access_mcp_resource | Kilo Code Docs](#access-mcp-resource-kilo-code-docs)
- [ask_followup_question | Kilo Code Docs](#ask-followup-question-kilo-code-docs)
- [apply_diff | Kilo Code Docs](#apply-diff-kilo-code-docs)
- [browser_action | Kilo Code Docs](#browser-action-kilo-code-docs)
- [attempt_completion | Kilo Code Docs](#attempt-completion-kilo-code-docs)
- [execute_command | Kilo Code Docs](#execute-command-kilo-code-docs)
- [技巧与窍门 | Kilo Code Docs](#-kilo-code-docs)
- [list_files | Kilo Code Docs](#list-files-kilo-code-docs)
- [search_files | Kilo Code Docs](#search-files-kilo-code-docs)
- [list_code_definition_names | Kilo Code Docs](#list-code-definition-names-kilo-code-docs)
- [new_task | Kilo Code Docs](#new-task-kilo-code-docs)
- [switch_mode | Kilo Code Docs](#switch-mode-kilo-code-docs)
- [read_file | Kilo Code Docs](#read-file-kilo-code-docs)
- [update_todo_list | Kilo Code Docs](#update-todo-list-kilo-code-docs)
- [use_mcp_tool | Kilo Code Docs](#use-mcp-tool-kilo-code-docs)
- [工具使用概述 | Kilo Code Docs](#-kilo-code-docs)
- [write_to_file | Kilo Code Docs](#write-to-file-kilo-code-docs)
- [在Kilo Code中使用DeepSeek | Kilo Code Docs](#-kilo-code-deepseek-kilo-code-docs)
- [在 Kilo Code 中使用 Anthropic | Kilo Code Docs](#-kilo-code-anthropic-kilo-code-docs)
- [在Kilo Code中使用Google Gemini | Kilo Code Docs](#-kilo-code-google-gemini-kilo-code-docs)
- [使用 LM Studio 的 API 提供商 | Kilo Code Docs](#-lm-studio-api-kilo-code-docs)
- [Using Chutes AI With Kilo Code | Kilo Code Docs](#using-chutes-ai-with-kilo-code-kilo-code-docs)
- [使用 Glama 与 Kilo Code | Kilo Code Docs](#-glama-kilo-code-kilo-code-docs)
- [使用 Kilo Code 的 API 提供商 | Kilo Code Docs](#-kilo-code-api-kilo-code-docs)
- [人工中继提供商 | Kilo Code Docs](#-kilo-code-docs)
- [在Kilo Code中使用AWS Bedrock | Kilo Code Docs](#-kilo-code-aws-bedrock-kilo-code-docs)
- [Using Claude Code With Kilo Code | Kilo Code Docs](#using-claude-code-with-kilo-code-kilo-code-docs)
- [在 Kilo Code 中使用 OpenAI | Kilo Code Docs](#-kilo-code-openai-kilo-code-docs)
- [Using v0 With Kilo Code | Kilo Code Docs](#using-v0-with-kilo-code-kilo-code-docs)
- [在Kilo Code中使用OpenRouter | Kilo Code Docs](#-kilo-code-openrouter-kilo-code-docs)
- [在 Kilo Code 中使用 Unbound | Kilo Code Docs](#-kilo-code-unbound-kilo-code-docs)
- [使用 OpenAI 兼容的提供商与 Kilo Code | Kilo Code Docs](#-openai-kilo-code-kilo-code-docs)
- [Using Groq With Kilo Code | Kilo Code Docs](#using-groq-with-kilo-code-kilo-code-docs)
- [在Kilo Code中使用Mistral AI | Kilo Code Docs](#-kilo-code-mistral-ai-kilo-code-docs)
- [在 Kilo Code 中使用 VS Code 语言模型 API | Kilo Code Docs](#-kilo-code-vs-code-api-kilo-code-docs)
- [在 Kilo Code 中使用 Requesty | Kilo Code Docs](#-kilo-code-requesty-kilo-code-docs)
- [在 Kilo Code 中使用 GCP Vertex AI | Kilo Code Docs](#-kilo-code-gcp-vertex-ai-kilo-code-docs)
- [在Kilo Code中使用Ollama | Kilo Code Docs](#-kilo-code-ollama-kilo-code-docs)
- [Using xAI (Grok) With Kilo Code | Kilo Code Docs](#using-xai-grok-with-kilo-code-kilo-code-docs)
- [Unknown](#unknown)
---
# Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/#__docusaurus_skipToContent_fallback)
On this page
Kilo Code is an open source AI agent VS Code extension. It helps you write code more efficiently by generating code, automating tasks, and providing suggestions.
What Can Kilo Code Do?[](https://kilocode.ai/docs/#what-can-kilo-code-do "Direct link to What Can Kilo Code Do?")
-------------------------------------------------------------------------------------------------------------------
* 🚀 **Generate Code** from natural language descriptions
* 🔧 **Refactor & Debug** existing code
* 📝 **Write & Update** documentation
* 🤔 **Answer Questions** about your codebase
* 🔄 **Automate** repetitive tasks
* 🏗️ **Create** new files and projects
Quick Start[](https://kilocode.ai/docs/#quick-start "Direct link to Quick Start")
-----------------------------------------------------------------------------------
1. [Install Kilo Code](https://kilocode.ai/docs/getting-started/installing)
2. [Set up Kilo Code](https://kilocode.ai/docs/getting-started/setting-up)
3. [Try Your First Task](https://kilocode.ai/docs/getting-started/your-first-task)
Features[](https://kilocode.ai/docs/#features "Direct link to Features")
--------------------------------------------------------------------------

### Basics[](https://kilocode.ai/docs/#basics "Direct link to Basics")
You interact with Kilo Code through [the chat interface](https://kilocode.ai/docs/basic-usage/the-chat-interface)
- just type what you want and Kilo Code will use the latest coding-optomized AI models to fulfill the request. You can change [modes](https://kilocode.ai/docs/basic-usage/using-modes)
to have Kilo Code act in different ways, control what [actions](https://kilocode.ai/docs/features/auto-approving-actions)
Kilo code can take, and interact with your code directly with [code actions](https://kilocode.ai/docs/features/code-actions)
.
### Using Kilo Code[](https://kilocode.ai/docs/#using-kilo-code "Direct link to Using Kilo Code")
#### Multiple Modes[](https://kilocode.ai/docs/#multiple-modes "Direct link to Multiple Modes")
Kilo Code adapts to your needs with specialized [modes](https://kilocode.ai/docs/basic-usage/using-modes)
:
* [**Code Mode:**](https://kilocode.ai/docs/basic-usage/using-modes#code-mode-default)
For general-purpose coding tasks
* [**Architect Mode:**](https://kilocode.ai/docs/basic-usage/using-modes#architect-mode)
For planning and technical leadership
* [**Ask Mode:**](https://kilocode.ai/docs/basic-usage/using-modes#ask-mode)
For answering questions and providing information
* [**Debug Mode:**](https://kilocode.ai/docs/basic-usage/using-modes#debug-mode)
For systematic problem diagnosis
* **[Custom Modes](https://kilocode.ai/docs/features/custom-modes)
:** Create unlimited specialized personas for security auditing, performance optimization, documentation, or any other task
#### Core Tools[](https://kilocode.ai/docs/#core-tools "Direct link to Core Tools")
Kilo Code comes with powerful [tools](https://kilocode.ai/docs/features/tools/tool-use-overview)
that can:
* [Read](https://kilocode.ai/docs/features/tools/read-file)
and [write](https://kilocode.ai/docs/features/tools/write-to-file)
files in your project
* [Execute commands](https://kilocode.ai/docs/features/tools/execute-command)
in your VS Code terminal
* [Control a web browser](https://kilocode.ai/docs/features/tools/browser-action)
* [Ask follow-up questions](https://kilocode.ai/docs/features/tools/ask-followup-question)
* [Search your codebase](https://kilocode.ai/docs/features/tools/search-files)
See the complete [Tools Reference](https://kilocode.ai/docs/features/tools/tool-use-overview)
for all available tools.
### Extending Kilo Code[](https://kilocode.ai/docs/#extending-kilo-code "Direct link to Extending Kilo Code")
* **[MCP (Model Context Protocol)](https://kilocode.ai/docs/features/mcp/overview)
:** Add unlimited custom tools, integrate with external APIs, connect to databases, or create specialized development tools
* **[Local Models](https://kilocode.ai/docs/advanced-usage/local-models)
:** Run Kilo Code with local AI models for offline use or enhanced privacy
### Customizing Kilo Code[](https://kilocode.ai/docs/#customizing-kilo-code "Direct link to Customizing Kilo Code")
Make Kilo Code work your way with:
* [Settings Management](https://kilocode.ai/docs/features/settings-management)
for configuring your experience
* [Custom Modes](https://kilocode.ai/docs/features/custom-modes)
for specialized tasks
* [Custom Rules](https://kilocode.ai/docs/advanced-usage/custom-rules)
for project-specific rules
* [Custom Instructions](https://kilocode.ai/docs/advanced-usage/custom-instructions)
for global plugin-wide instructions
* [API Configuration Profiles](https://kilocode.ai/docs/features/api-configuration-profiles)
for different model providers
* [Auto-Approval Settings](https://kilocode.ai/docs/features/auto-approving-actions)
for faster workflows
Resources[](https://kilocode.ai/docs/#resources "Direct link to Resources")
-----------------------------------------------------------------------------
### Documentation[](https://kilocode.ai/docs/#documentation "Direct link to Documentation")
* [Using Kilo Code](https://kilocode.ai/docs/basic-usage/the-chat-interface)
- Learn the basics
* [Core Concepts](https://kilocode.ai/docs/features/auto-approving-actions)
- Master key features
* [Advanced Usage](https://kilocode.ai/docs/advanced-usage/prompt-engineering)
- Take your skills further
* [Frequently Asked Questions](https://kilocode.ai/docs/faq)
- Get answers to common questions
### Community[](https://kilocode.ai/docs/#community "Direct link to Community")
* **Discord:** [Join our Discord server](https://kilocode.ai/discord)
for real-time help and discussions
* **Reddit:** [Visit our subreddit](https://www.reddit.com/r/kilocode/)
to share experiences and tips
* **YouTube:** [Check out our YouTube](https://www.youtube.com/@Kilo-Code)
to learn hands on skills when using Kilo Code
* **GitHub:** Report [issues](https://github.com/Kilo-Org/kilocode/issues)
or request [features](https://github.com/Kilo-Org/kilocode/discussions/categories/ideas)
Ready to get started? Click the **Next** button below to begin your journey with Kilo Code!
* [What Can Kilo Code Do?](https://kilocode.ai/docs/#what-can-kilo-code-do)
* [Quick Start](https://kilocode.ai/docs/#quick-start)
* [Features](https://kilocode.ai/docs/#features)
* [Basics](https://kilocode.ai/docs/#basics)
* [Using Kilo Code](https://kilocode.ai/docs/#using-kilo-code)
* [Extending Kilo Code](https://kilocode.ai/docs/#extending-kilo-code)
* [Customizing Kilo Code](https://kilocode.ai/docs/#customizing-kilo-code)
* [Resources](https://kilocode.ai/docs/#resources)
* [Documentation](https://kilocode.ai/docs/#documentation)
* [Community](https://kilocode.ai/docs/#community)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2F)
---
# Search the documentation
[Skip to main content](https://kilocode.ai/docs/search#__docusaurus_skipToContent_fallback)
Search the documentation
========================
---
# codebase_search | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#__docusaurus_skipToContent_fallback)
On this page
Experimental Feature
The `codebase_search` tool is that requires additional setup including an embedding provider and vector database.
The `codebase_search` tool performs semantic searches across your entire codebase using AI embeddings. Unlike traditional text-based search, it understands the meaning of your queries and finds relevant code even when exact keywords don't match.
Parameters[](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#parameters "Direct link to Parameters")
------------------------------------------------------------------------------------------------------------------------------
The tool accepts these parameters:
* `query` (required): Natural language search query describing what you're looking for
* `path` (optional): Directory path to limit search scope to a specific part of your codebase
What It Does[](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#what-it-does "Direct link to What It Does")
------------------------------------------------------------------------------------------------------------------------------------
This tool searches through your indexed codebase using semantic similarity rather than exact text matching. It finds code blocks that are conceptually related to your query, even if they don't contain the exact words you searched for. Results include relevant code snippets with file paths, line numbers, and similarity scores.
When is it used?[](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#when-is-it-used "Direct link to When is it used?")
-----------------------------------------------------------------------------------------------------------------------------------------------
* When Kilo Code needs to find code related to specific functionality across your project
* When looking for implementation patterns or similar code structures
* When searching for error handling, authentication, or other conceptual code patterns
* When exploring unfamiliar codebases to understand how features are implemented
* When finding related code that might be affected by changes or refactoring
Key Features[](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#key-features "Direct link to Key Features")
------------------------------------------------------------------------------------------------------------------------------------
* **Semantic Understanding**: Finds code by meaning rather than exact keyword matches
* **Cross-Project Search**: Searches across your entire indexed codebase, not just open files
* **Contextual Results**: Returns code snippets with file paths and line numbers for easy navigation
* **Similarity Scoring**: Results ranked by relevance with similarity scores (0-1 scale)
* **Scope Filtering**: Optional path parameter to limit searches to specific directories
* **Intelligent Ranking**: Results sorted by semantic relevance to your query
* **UI Integration**: Results displayed with syntax highlighting and navigation links
* **Performance Optimized**: Fast vector-based search with configurable result limits
Requirements[](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#requirements "Direct link to Requirements")
------------------------------------------------------------------------------------------------------------------------------------
This tool is only available when the experimental Codebase Indexing feature is properly configured:
* **Feature Enabled**: Codebase Indexing must be enabled in experimental settings
* **Embedding Provider**: OpenAI API key or Ollama configuration required
* **Vector Database**: Qdrant instance running and accessible
* **Index Status**: Codebase must be indexed (status: "Indexed" or "Indexing")
Limitations[](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#limitations "Direct link to Limitations")
---------------------------------------------------------------------------------------------------------------------------------
* **Experimental Feature**: Part of the experimental codebase indexing system
* **Requires Configuration**: Depends on external services (embedding provider + Qdrant)
* **Index Dependency**: Only searches through indexed code blocks
* **Result Limits**: Maximum of 50 results per search to maintain performance
* **Similarity Threshold**: Only returns results above 0.4 similarity score
* **File Size Limits**: Limited to files under 1MB that were successfully indexed
* **Language Support**: Effectiveness depends on Tree-sitter language support
How It Works[](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#how-it-works "Direct link to How It Works")
------------------------------------------------------------------------------------------------------------------------------------
When the `codebase_search` tool is invoked, it follows this process:
1. **Availability Validation**:
* Verifies that the CodeIndexManager is available and initialized
* Confirms codebase indexing is enabled in settings
* Checks that indexing is properly configured (API keys, Qdrant URL)
* Validates the current index state allows searching
2. **Query Processing**:
* Takes your natural language query and generates an embedding vector
* Uses the same embedding provider configured for indexing (OpenAI or Ollama)
* Converts the semantic meaning of your query into a mathematical representation
3. **Vector Search Execution**:
* Searches the Qdrant vector database for similar code embeddings
* Uses cosine similarity to find the most relevant code blocks
* Applies the minimum similarity threshold (0.4) to filter results
* Limits results to 50 matches for optimal performance
4. **Path Filtering** (if specified):
* Filters results to only include files within the specified directory path
* Uses normalized path comparison for accurate filtering
* Maintains relevance ranking within the filtered scope
5. **Result Processing and Formatting**:
* Converts absolute file paths to workspace-relative paths
* Structures results with file paths, line ranges, similarity scores, and code content
* Formats for both AI consumption and UI display with syntax highlighting
6. **Dual Output Format**:
* **AI Output**: Structured text format with query, file paths, scores, and code chunks
* **UI Output**: JSON format with syntax highlighting and navigation capabilities
Search Query Best Practices[](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#search-query-best-practices "Direct link to Search Query Best Practices")
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
### Effective Query Patterns[](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#effective-query-patterns "Direct link to Effective Query Patterns")
**Good: Conceptual and specific**
user authentication and password validation
**Good: Feature-focused**
database connection pool setup
**Good: Problem-oriented**
error handling for API requests
**Less effective: Too generic**
function
### Query Types That Work Well[](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#query-types-that-work-well "Direct link to Query Types That Work Well")
* **Functional Descriptions**: "file upload processing", "email validation logic"
* **Technical Patterns**: "singleton pattern implementation", "factory method usage"
* **Domain Concepts**: "user profile management", "payment processing workflow"
* **Architecture Components**: "middleware configuration", "database migration scripts"
Directory Scoping[](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#directory-scoping "Direct link to Directory Scoping")
---------------------------------------------------------------------------------------------------------------------------------------------------
Use the optional `path` parameter to focus searches on specific parts of your codebase:
**Search within API modules:**
endpoint validation middlewaresrc/api
**Search in test files:**
mock data setup patternstests
**Search specific feature directories:**
component state managementsrc/components/auth
Result Interpretation[](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#result-interpretation "Direct link to Result Interpretation")
---------------------------------------------------------------------------------------------------------------------------------------------------------------
### Similarity Scores[](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#similarity-scores "Direct link to Similarity Scores")
* **0.8-1.0**: Highly relevant matches, likely exactly what you're looking for
* **0.6-0.8**: Good matches with strong conceptual similarity
* **0.4-0.6**: Potentially relevant but may require review
* **Below 0.4**: Filtered out as too dissimilar
### Result Structure[](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#result-structure "Direct link to Result Structure")
Each search result includes:
* **File Path**: Workspace-relative path to the file containing the match
* **Score**: Similarity score indicating relevance (0.4-1.0)
* **Line Range**: Start and end line numbers for the code block
* **Code Chunk**: The actual code content that matched your query
Examples When Used[](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#examples-when-used "Direct link to Examples When Used")
------------------------------------------------------------------------------------------------------------------------------------------------------
* When implementing a new feature, Kilo Code searches for "authentication middleware" to understand existing patterns before writing new code.
* When debugging an issue, Kilo Code searches for "error handling in API calls" to find related error patterns across the codebase.
* When refactoring code, Kilo Code searches for "database transaction patterns" to ensure consistency across all database operations.
* When onboarding to a new codebase, Kilo Code searches for "configuration loading" to understand how the application bootstraps.
Usage Examples[](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#usage-examples "Direct link to Usage Examples")
------------------------------------------------------------------------------------------------------------------------------------------
Searching for authentication-related code across the entire project:
user login and authentication logic
Finding database-related code in a specific directory:
database connection and query executionsrc/data
Looking for error handling patterns in API code:
HTTP error responses and exception handlingsrc/api
Searching for testing utilities and mock setups:
test setup and mock data creationtests
Finding configuration and environment setup code:
environment variables and application configuration
* [Parameters](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#parameters)
* [What It Does](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#what-it-does)
* [When is it used?](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#when-is-it-used)
* [Key Features](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#key-features)
* [Requirements](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#requirements)
* [Limitations](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#limitations)
* [How It Works](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#how-it-works)
* [Search Query Best Practices](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#search-query-best-practices)
* [Effective Query Patterns](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#effective-query-patterns)
* [Query Types That Work Well](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#query-types-that-work-well)
* [Directory Scoping](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#directory-scoping)
* [Result Interpretation](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#result-interpretation)
* [Similarity Scores](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#similarity-scores)
* [Result Structure](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#result-structure)
* [Examples When Used](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#examples-when-used)
* [Usage Examples](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search#usage-examples)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fadvanced-usage%2Favailable-tools%2Fcodebase-search)
---
# Custom Instructions | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/advanced-usage/custom-instructions#__docusaurus_skipToContent_fallback)
On this page
Custom Instructions allow you to personalize how Kilo Code behaves, providing specific guidance that shapes responses, coding style, and decision-making processes.
What Are Custom Instructions?[](https://kilocode.ai/docs/advanced-usage/custom-instructions#what-are-custom-instructions "Direct link to What Are Custom Instructions?")
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Custom Instructions define specific Extension behaviors, preferences, and constraints beyond Kilo's basic role definition. Examples include coding style, documentation standards, testing requirements, and workflow guidelines.
Custom Instructions vs Rules
Custom Instructions are IDE-wide and are applied across all workspaces and maintain your preferences regardless of which project you're working on. Unlike Instructions, [Custom Rules](https://kilocode.ai/docs/advanced-usage/custom-rules)
are project specific and allow you to setup workspace-based ruleset.
Setting Custom Instructions[](https://kilocode.ai/docs/advanced-usage/custom-instructions#setting-custom-instructions "Direct link to Setting Custom Instructions")
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
**How to set them:**

1. **Open Modes Tab:** Click the icon in the Kilo Code top menu bar
2. **Find Section:** Find the "Custom Instructions for All Modes" section
3. **Enter Instructions:** Enter your instructions in the text area
4. **Save Changes:** Click "Done" to save your changes
#### Mode-Specific Instructions[](https://kilocode.ai/docs/advanced-usage/custom-instructions#mode-specific-instructions "Direct link to Mode-Specific Instructions")
Mode-specific instructions can be set using the Modes Tab

* **Open Tab:** Click the icon in the Kilo Code top menu bar
* **Select Mode:** Under the Modes heading, click the button for the mode you want to customize
* **Enter Instructions:** Enter your instructions in the text area under "Mode-specific Custom Instructions (optional)"
* **Save Changes:** Click "Done" to save your changes
Global Mode Rules
If the mode itself is global (not workspace-specific), any custom instructions you set for it will also apply globally for that mode across all workspaces.
Related Features[](https://kilocode.ai/docs/advanced-usage/custom-instructions#related-features "Direct link to Related Features")
------------------------------------------------------------------------------------------------------------------------------------
* [Custom Modes](https://kilocode.ai/docs/features/custom-modes)
* [Custom Rules](https://kilocode.ai/docs/advanced-usage/custom-rules)
* [Settings Management](https://kilocode.ai/docs/features/settings-management)
* [Auto-Approval Settings](https://kilocode.ai/docs/features/auto-approving-actions)
* [What Are Custom Instructions?](https://kilocode.ai/docs/advanced-usage/custom-instructions#what-are-custom-instructions)
* [Setting Custom Instructions](https://kilocode.ai/docs/advanced-usage/custom-instructions#setting-custom-instructions)
* [Related Features](https://kilocode.ai/docs/advanced-usage/custom-instructions#related-features)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fadvanced-usage%2Fcustom-instructions)
---
# Working with Large Projects | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/advanced-usage/large-projects#__docusaurus_skipToContent_fallback)
On this page
Kilo Code can be used with projects of any size, but large projects require some extra care to manage context effectively. Here are some tips for working with large codebases:
Understanding Context Limits[](https://kilocode.ai/docs/advanced-usage/large-projects#understanding-context-limits "Direct link to Understanding Context Limits")
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Kilo Code uses large language models (LLMs) that have a limited "context window." This is the maximum amount of text (measured in tokens) that the model can process at once. If the context is too large, the model may not be able to understand your request or generate accurate responses.
The context window includes:
* The system prompt (instructions for Kilo Code).
* The conversation history.
* The content of any files you mention using `@`.
* The output of any commands or tools Kilo Code uses.
Strategies for Managing Context[](https://kilocode.ai/docs/advanced-usage/large-projects#strategies-for-managing-context "Direct link to Strategies for Managing Context")
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1. **Be Specific:** When referring to files or code, use specific file paths and function names. Avoid vague references like "the main file."
2. **Use Context Mentions Effectively:** Use `@/path/to/file.ts` to include specific files. Use `@problems` to include current errors and warnings. Use `@` followed by a commit hash to reference specific Git commits.
3. **Break Down Tasks:** Divide large tasks into smaller, more manageable sub-tasks. This helps keep the context focused.
4. **Summarize:** If you need to refer to a large amount of code, consider summarizing the relevant parts in your prompt instead of including the entire code.
5. **Prioritize Recent History:** Kilo Code automatically truncates older messages in the conversation history to stay within the context window. Be mindful of this, and re-include important context if needed.
6. **Use Prompt Caching (if available):** Some API providers like Anthropic, OpenAI, OpenRouter and Requesty support "prompt caching". This caches your prompts for use in future tasks and helps reduce the cost and latency of requests.
Example: Refactoring a Large File[](https://kilocode.ai/docs/advanced-usage/large-projects#example-refactoring-a-large-file "Direct link to Example: Refactoring a Large File")
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Let's say you need to refactor a large TypeScript file (`src/components/MyComponent.tsx`). Here's a possible approach:
1. **Initial Overview:**
@/src/components/MyComponent.tsx List the functions and classes in this file.
2. **Target Specific Functions:**
@/src/components/MyComponent.tsx Refactor the `processData` function to use `async/await` instead of Promises.
3. **Iterative Changes:** Make small, incremental changes, reviewing and approving each step.
By breaking down the task and providing specific context, you can work effectively with large files even with a limited context window.
* [Understanding Context Limits](https://kilocode.ai/docs/advanced-usage/large-projects#understanding-context-limits)
* [Strategies for Managing Context](https://kilocode.ai/docs/advanced-usage/large-projects#strategies-for-managing-context)
* [Example: Refactoring a Large File](https://kilocode.ai/docs/advanced-usage/large-projects#example-refactoring-a-large-file)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fadvanced-usage%2Flarge-projects)
---
# codebase_search | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/tools/codebase-search#__docusaurus_skipToContent_fallback)
On this page
Setup Required
The `codebase_search` tool is part of the [Codebase Indexing](https://kilocode.ai/docs/features/codebase-indexing)
feature. It requires additional setup including an embedding provider and vector database.
The `codebase_search` tool performs semantic searches across your entire codebase using AI embeddings. Unlike traditional text-based search, it understands the meaning of your queries and finds relevant code even when exact keywords don't match.
* * *
Parameters[](https://kilocode.ai/docs/features/tools/codebase-search#parameters "Direct link to Parameters")
--------------------------------------------------------------------------------------------------------------
The tool accepts these parameters:
* `query` (required): Natural language search query describing what you're looking for
* `path` (optional): Directory path to limit search scope to a specific part of your codebase
* * *
What It Does[](https://kilocode.ai/docs/features/tools/codebase-search#what-it-does "Direct link to What It Does")
--------------------------------------------------------------------------------------------------------------------
This tool searches through your indexed codebase using semantic similarity rather than exact text matching. It finds code blocks that are conceptually related to your query, even if they don't contain the exact words you searched for. Results include relevant code snippets with file paths, line numbers, and similarity scores.
* * *
When is it used?[](https://kilocode.ai/docs/features/tools/codebase-search#when-is-it-used "Direct link to When is it used?")
-------------------------------------------------------------------------------------------------------------------------------
* When Kilo Code needs to find code related to specific functionality across your project
* When looking for implementation patterns or similar code structures
* When searching for error handling, authentication, or other conceptual code patterns
* When exploring unfamiliar codebases to understand how features are implemented
* When finding related code that might be affected by changes or refactoring
* * *
Key Features[](https://kilocode.ai/docs/features/tools/codebase-search#key-features "Direct link to Key Features")
--------------------------------------------------------------------------------------------------------------------
* **Semantic Understanding**: Finds code by meaning rather than exact keyword matches
* **Cross-Project Search**: Searches across your entire indexed codebase, not just open files
* **Contextual Results**: Returns code snippets with file paths and line numbers for easy navigation
* **Similarity Scoring**: Results ranked by relevance with similarity scores (0-1 scale)
* **Scope Filtering**: Optional path parameter to limit searches to specific directories
* **Intelligent Ranking**: Results sorted by semantic relevance to your query
* **UI Integration**: Results displayed with syntax highlighting and navigation links
* **Performance Optimized**: Fast vector-based search with configurable result limits
* * *
Requirements[](https://kilocode.ai/docs/features/tools/codebase-search#requirements "Direct link to Requirements")
--------------------------------------------------------------------------------------------------------------------
This tool is only available when the Codebase Indexing feature is properly configured:
* **Feature Configured**: Codebase Indexing must be configured in settings
* **Embedding Provider**: OpenAI API key or Ollama configuration required
* **Vector Database**: Qdrant instance running and accessible
* **Index Status**: Codebase must be indexed (status: "Indexed" or "Indexing")
* * *
Limitations[](https://kilocode.ai/docs/features/tools/codebase-search#limitations "Direct link to Limitations")
-----------------------------------------------------------------------------------------------------------------
* **Requires Configuration**: Depends on external services (embedding provider + Qdrant)
* **Index Dependency**: Only searches through indexed code blocks
* **Result Limits**: Maximum of 50 results per search to maintain performance
* **Similarity Threshold**: Only returns results above similarity threshold (default: 0.4, configurable)
* **File Size Limits**: Limited to files under 1MB that were successfully indexed
* **Language Support**: Effectiveness depends on Tree-sitter language support
* * *
How It Works[](https://kilocode.ai/docs/features/tools/codebase-search#how-it-works "Direct link to How It Works")
--------------------------------------------------------------------------------------------------------------------
When the `codebase_search` tool is invoked, it follows this process:
1. **Availability Validation**:
* Verifies that the CodeIndexManager is available and initialized
* Confirms codebase indexing is enabled in settings
* Checks that indexing is properly configured (API keys, Qdrant URL)
* Validates the current index state allows searching
2. **Query Processing**:
* Takes your natural language query and generates an embedding vector
* Uses the same embedding provider configured for indexing (OpenAI or Ollama)
* Converts the semantic meaning of your query into a mathematical representation
3. **Vector Search Execution**:
* Searches the Qdrant vector database for similar code embeddings
* Uses cosine similarity to find the most relevant code blocks
* Applies the minimum similarity threshold (default: 0.4, configurable) to filter results
* Limits results to 50 matches for optimal performance
4. **Path Filtering** (if specified):
* Filters results to only include files within the specified directory path
* Uses normalized path comparison for accurate filtering
* Maintains relevance ranking within the filtered scope
5. **Result Processing and Formatting**:
* Converts absolute file paths to workspace-relative paths
* Structures results with file paths, line ranges, similarity scores, and code content
* Formats for both AI consumption and UI display with syntax highlighting
6. **Dual Output Format**:
* **AI Output**: Structured text format with query, file paths, scores, and code chunks
* **UI Output**: JSON format with syntax highlighting and navigation capabilities
* * *
Search Query Best Practices[](https://kilocode.ai/docs/features/tools/codebase-search#search-query-best-practices "Direct link to Search Query Best Practices")
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
### Effective Query Patterns[](https://kilocode.ai/docs/features/tools/codebase-search#effective-query-patterns "Direct link to Effective Query Patterns")
**Good: Conceptual and specific**
user authentication and password validation
**Good: Feature-focused**
database connection pool setup
**Good: Problem-oriented**
error handling for API requests
**Less effective: Too generic**
function
### Query Types That Work Well[](https://kilocode.ai/docs/features/tools/codebase-search#query-types-that-work-well "Direct link to Query Types That Work Well")
* **Functional Descriptions**: "file upload processing", "email validation logic"
* **Technical Patterns**: "singleton pattern implementation", "factory method usage"
* **Domain Concepts**: "user profile management", "payment processing workflow"
* **Architecture Components**: "middleware configuration", "database migration scripts"
* * *
Directory Scoping[](https://kilocode.ai/docs/features/tools/codebase-search#directory-scoping "Direct link to Directory Scoping")
-----------------------------------------------------------------------------------------------------------------------------------
Use the optional `path` parameter to focus searches on specific parts of your codebase:
**Search within API modules:**
endpoint validation middlewaresrc/api
**Search in test files:**
mock data setup patternstests
**Search specific feature directories:**
component state managementsrc/components/auth
* * *
Result Interpretation[](https://kilocode.ai/docs/features/tools/codebase-search#result-interpretation "Direct link to Result Interpretation")
-----------------------------------------------------------------------------------------------------------------------------------------------
### Similarity Scores[](https://kilocode.ai/docs/features/tools/codebase-search#similarity-scores "Direct link to Similarity Scores")
* **0.8-1.0**: Highly relevant matches, likely exactly what you're looking for
* **0.6-0.8**: Good matches with strong conceptual similarity
* **0.4-0.6**: Potentially relevant but may require review
* **Below 0.4**: Filtered out as too dissimilar
### Result Structure[](https://kilocode.ai/docs/features/tools/codebase-search#result-structure "Direct link to Result Structure")
Each search result includes:
* **File Path**: Workspace-relative path to the file containing the match
* **Score**: Similarity score indicating relevance (0.4-1.0)
* **Line Range**: Start and end line numbers for the code block
* **Code Chunk**: The actual code content that matched your query
* * *
Examples When Used[](https://kilocode.ai/docs/features/tools/codebase-search#examples-when-used "Direct link to Examples When Used")
--------------------------------------------------------------------------------------------------------------------------------------
* When implementing a new feature, Kilo Code searches for "authentication middleware" to understand existing patterns before writing new code.
* When debugging an issue, Kilo Code searches for "error handling in API calls" to find related error patterns across the codebase.
* When refactoring code, Kilo Code searches for "database transaction patterns" to ensure consistency across all database operations.
* When onboarding to a new codebase, Kilo Code searches for "configuration loading" to understand how the application bootstraps.
* * *
Usage Examples[](https://kilocode.ai/docs/features/tools/codebase-search#usage-examples "Direct link to Usage Examples")
--------------------------------------------------------------------------------------------------------------------------
Searching for authentication-related code across the entire project:
user login and authentication logic
Finding database-related code in a specific directory:
database connection and query executionsrc/data
Looking for error handling patterns in API code:
HTTP error responses and exception handlingsrc/api
Searching for testing utilities and mock setups:
test setup and mock data creationtests
Finding configuration and environment setup code:
environment variables and application configuration
* [Parameters](https://kilocode.ai/docs/features/tools/codebase-search#parameters)
* [What It Does](https://kilocode.ai/docs/features/tools/codebase-search#what-it-does)
* [When is it used?](https://kilocode.ai/docs/features/tools/codebase-search#when-is-it-used)
* [Key Features](https://kilocode.ai/docs/features/tools/codebase-search#key-features)
* [Requirements](https://kilocode.ai/docs/features/tools/codebase-search#requirements)
* [Limitations](https://kilocode.ai/docs/features/tools/codebase-search#limitations)
* [How It Works](https://kilocode.ai/docs/features/tools/codebase-search#how-it-works)
* [Search Query Best Practices](https://kilocode.ai/docs/features/tools/codebase-search#search-query-best-practices)
* [Effective Query Patterns](https://kilocode.ai/docs/features/tools/codebase-search#effective-query-patterns)
* [Query Types That Work Well](https://kilocode.ai/docs/features/tools/codebase-search#query-types-that-work-well)
* [Directory Scoping](https://kilocode.ai/docs/features/tools/codebase-search#directory-scoping)
* [Result Interpretation](https://kilocode.ai/docs/features/tools/codebase-search#result-interpretation)
* [Similarity Scores](https://kilocode.ai/docs/features/tools/codebase-search#similarity-scores)
* [Result Structure](https://kilocode.ai/docs/features/tools/codebase-search#result-structure)
* [Examples When Used](https://kilocode.ai/docs/features/tools/codebase-search#examples-when-used)
* [Usage Examples](https://kilocode.ai/docs/features/tools/codebase-search#usage-examples)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Ftools%2Fcodebase-search)
---
# Custom Rules | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/advanced-usage/custom-rules#__docusaurus_skipToContent_fallback)
On this page
Custom rules provide a powerful way to define project-specific and global behaviors and constraints for the Kilo Code AI agent. With custom rules, you can ensure consistent formatting, restrict access to sensitive files, enforce coding standards, and customize the AI's behavior for your specific project needs or across all projects.
Overview[](https://kilocode.ai/docs/advanced-usage/custom-rules#overview "Direct link to Overview")
-----------------------------------------------------------------------------------------------------
Custom rules allow you to create text-based instructions that all AI models will follow when interacting with your project. These rules act as guardrails and conventions that are consistently respected across all interactions with your codebase. Rules can be managed through both the file system and the built-in UI interface.
Rule Format[](https://kilocode.ai/docs/advanced-usage/custom-rules#rule-format "Direct link to Rule Format")
--------------------------------------------------------------------------------------------------------------
Custom rules can be written in plain text, but Markdown format is recommended for better structure and comprehension by the AI models. The structured nature of Markdown helps the models parse and understand your rules more effectively.
* Use Markdown headers (`#`, `##`, etc.) to define rule categories
* Use lists (`-`, `*`) to enumerate specific items or constraints
* Use code blocks ( ) to include code examples when needed
Rule Types[](https://kilocode.ai/docs/advanced-usage/custom-rules#rule-types "Direct link to Rule Types")
-----------------------------------------------------------------------------------------------------------
Kilo Code supports two types of custom rules:
* **Project Rules**: Apply only to the current project workspace
* **Global Rules**: Apply across all projects and workspaces
UI Support
The built-in rules management UI is available for general rules only. Mode-specific rules must be managed through the file system.
Rule Location[](https://kilocode.ai/docs/advanced-usage/custom-rules#rule-location "Direct link to Rule Location")
--------------------------------------------------------------------------------------------------------------------
### Project Rules[](https://kilocode.ai/docs/advanced-usage/custom-rules#project-rules "Direct link to Project Rules")
Custom rules are primarily loaded from the **`.kilocode/rules/` directory**. This is the recommended approach for organizing your project-specific rules. Each rule is typically placed in its own Markdown file with a descriptive name:
project/├── .kilocode/│ ├── rules/│ │ ├── formatting.md│ │ ├── restricted_files.md│ │ └── naming_conventions.md├── src/└── ...
### Global Rules[](https://kilocode.ai/docs/advanced-usage/custom-rules#global-rules "Direct link to Global Rules")
Global rules are stored in your home directory and apply to all projects:
~/.kilocode/├── rules/│ ├── coding_standards.md│ ├── security_guidelines.md│ └── documentation_style.md
Managing Rules Through the UI[](https://kilocode.ai/docs/advanced-usage/custom-rules#managing-rules-through-the-ui "Direct link to Managing Rules Through the UI")
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Kilo Code provides a built-in interface for managing your custom rules without manually editing files in the `.kilocode/rules/` directories. To access the UI, click on the icon in the **bottom right corner** of the Kilo Code window.
You can access the rules management UI to:
* View all active rules (both project and global)
* Toggle rules on/off without deleting them
* Create and edit rules directly in the interface
* Organize rules by category and priority
Rule Loading Order[](https://kilocode.ai/docs/advanced-usage/custom-rules#rule-loading-order "Direct link to Rule Loading Order")
-----------------------------------------------------------------------------------------------------------------------------------
### General Rules (Any Mode)[](https://kilocode.ai/docs/advanced-usage/custom-rules#general-rules-any-mode "Direct link to General Rules (Any Mode)")
Rules are loaded in the following priority order:
1. **Global rules** from `~/.kilocode/rules/` directory
2. **Project rules** from `.kilocode/rules/` directory
3. **Legacy fallback files** (for backward compatibility):
* `.roorules`
* `.clinerules`
* `.kilocoderules` (deprecated)
When both global and project rules exist, they are combined with project rules taking precedence over global rules for conflicting directives.
note
We strongly recommend keeping your rules in the `.kilocode/rules/` folder as it provides better organization and is the preferred approach for future versions. The folder-based structure allows for more granular rule organization and clearer separation of concerns. The legacy file-based approach is maintained for backward compatibility but may be subject to change in future releases.
### Mode-Specific Rules[](https://kilocode.ai/docs/advanced-usage/custom-rules#mode-specific-rules "Direct link to Mode-Specific Rules")
Additionally, the system supports mode-specific rules, which are loaded separately and have their own priority order:
1. First, it checks for `.kilocode/rules-${mode}/` directory
2. If that doesn't exist or is empty, it falls back to `.kilocoderules-${mode}` file (deprecated)
Currently, mode-specific rules are only supported at the project level. When both generic rules and mode-specific rules exist, the mode-specific rules are given priority in the final output.
Creating Custom Rules[](https://kilocode.ai/docs/advanced-usage/custom-rules#creating-custom-rules "Direct link to Creating Custom Rules")
--------------------------------------------------------------------------------------------------------------------------------------------
### Using the UI Interface[](https://kilocode.ai/docs/advanced-usage/custom-rules#using-the-ui-interface "Direct link to Using the UI Interface")

The easiest way to create and manage rules is through the built-in UI:
1. Access the rules management interface from the Kilo Code panel
2. Choose between creating project-specific or global rules
3. Use the interface to create, edit, or toggle rules
4. Rules are automatically saved and applied immediately
### Using the File System[](https://kilocode.ai/docs/advanced-usage/custom-rules#using-the-file-system "Direct link to Using the File System")
To create rules manually:
**For Project Rules:**
1. Create the `.kilocode/rules/` directory if it doesn't already exist
2. Create a new Markdown file with a descriptive name in this directory
3. Write your rule using Markdown formatting
4. Save the file
**For Global Rules:**
1. Create the `~/.kilocode/rules/` directory if it doesn't already exist
2. Create a new Markdown file with a descriptive name in this directory
3. Write your rule using Markdown formatting
4. Save the file
Rules will be automatically applied to all future Kilo Code interactions. Any new changes will be applied immediately.
Example Rules[](https://kilocode.ai/docs/advanced-usage/custom-rules#example-rules "Direct link to Example Rules")
--------------------------------------------------------------------------------------------------------------------
### Example 1: Table Formatting[](https://kilocode.ai/docs/advanced-usage/custom-rules#example-1-table-formatting "Direct link to Example 1: Table Formatting")
# TablesWhen printing tables, always add an exclamation mark to each column header
This simple rule instructs the AI to add exclamation marks to all table column headers when generating tables in your project.
### Example 2: Restricted File Access[](https://kilocode.ai/docs/advanced-usage/custom-rules#example-2-restricted-file-access "Direct link to Example 2: Restricted File Access")
# Restricted filesFiles in the list contain sensitive data, they MUST NOT be read- supersecrets.txt- credentials.json- .env
This rule prevents the AI from reading or accessing sensitive files, even if explicitly requested to do so.

Use Cases[](https://kilocode.ai/docs/advanced-usage/custom-rules#use-cases "Direct link to Use Cases")
--------------------------------------------------------------------------------------------------------
Custom rules can be applied to a wide variety of scenarios:
* **Code Style**: Enforce consistent formatting, naming conventions, and documentation styles
* **Security Controls**: Prevent access to sensitive files or directories
* **Project Structure**: Define where different types of files should be created
* **Documentation Requirements**: Specify documentation formats and requirements
* **Testing Patterns**: Define how tests should be structured
* **API Usage**: Specify how APIs should be used and documented
* **Error Handling**: Define error handling conventions
Examples of Custom Rules[](https://kilocode.ai/docs/advanced-usage/custom-rules#examples-of-custom-rules "Direct link to Examples of Custom Rules")
-----------------------------------------------------------------------------------------------------------------------------------------------------
* "Strictly follow code style guide \[your project-specific code style guide\]"
* "Always use spaces for indentation, with a width of 4 spaces"
* "Use camelCase for variable names"
* "Write unit tests for all new functions"
* "Explain your reasoning before providing code"
* "Focus on code readability and maintainability"
* "Prioritize using the most common library in the community"
* "When adding new features to websites, ensure they are responsive and accessible"
Best Practices[](https://kilocode.ai/docs/advanced-usage/custom-rules#best-practices "Direct link to Best Practices")
-----------------------------------------------------------------------------------------------------------------------
* **Be Specific**: Clearly define the scope and intent of each rule
* **Use Categories**: Organize related rules under common headers
* **Separate Concerns**: Use different files for different types of rules
* **Use Examples**: Include examples to illustrate the expected behavior
* **Keep It Simple**: Rules should be concise and easy to understand
* **Update Regularly**: Review and update rules as project requirements change
Pro Tip: File-Based Team Standards
When working in team environments, placing `.kilocode/rules/codestyle.md` files under version control allows you to standardize Kilo's behavior across your entire development team. This ensures consistent code style, documentation practices, and development workflows for everyone on the project.
Limitations[](https://kilocode.ai/docs/advanced-usage/custom-rules#limitations "Direct link to Limitations")
--------------------------------------------------------------------------------------------------------------
* Rules are applied on a best-effort basis by the AI models
* Complex rules may require multiple examples for clear understanding
* Project rules apply only to the project in which they are defined
* Global rules apply across all projects
Troubleshooting[](https://kilocode.ai/docs/advanced-usage/custom-rules#troubleshooting "Direct link to Troubleshooting")
--------------------------------------------------------------------------------------------------------------------------
If your custom rules aren't being properly followed:
1. **Check rule status in the UI**: Use the rules management interface to verify that your rules are active and properly loaded
2. **Verify rule formatting**: Ensure that your rules are properly formatted with clear Markdown structure
3. **Check rule locations**: Ensure that your rules are located in supported locations:
* Global rules: `~/.kilocode/rules/` directory
* Project rules: `.kilocode/rules/` directory
* Legacy files: `.kilocoderules`, `.roorules`, or `.clinerules`
4. **Rule specificity**: Verify that the rules are specific and unambiguous
5. **Restart VS Code**: Restart VS Code to ensure the rules are properly loaded
Related Features[](https://kilocode.ai/docs/advanced-usage/custom-rules#related-features "Direct link to Related Features")
-----------------------------------------------------------------------------------------------------------------------------
* [Custom Modes](https://kilocode.ai/docs/features/custom-modes)
* [Custom Instructions](https://kilocode.ai/docs/advanced-usage/custom-instructions)
* [Settings Management](https://kilocode.ai/docs/features/settings-management)
* [Auto-Approval Settings](https://kilocode.ai/docs/features/auto-approving-actions)
* [Overview](https://kilocode.ai/docs/advanced-usage/custom-rules#overview)
* [Rule Format](https://kilocode.ai/docs/advanced-usage/custom-rules#rule-format)
* [Rule Types](https://kilocode.ai/docs/advanced-usage/custom-rules#rule-types)
* [Rule Location](https://kilocode.ai/docs/advanced-usage/custom-rules#rule-location)
* [Project Rules](https://kilocode.ai/docs/advanced-usage/custom-rules#project-rules)
* [Global Rules](https://kilocode.ai/docs/advanced-usage/custom-rules#global-rules)
* [Managing Rules Through the UI](https://kilocode.ai/docs/advanced-usage/custom-rules#managing-rules-through-the-ui)
* [Rule Loading Order](https://kilocode.ai/docs/advanced-usage/custom-rules#rule-loading-order)
* [General Rules (Any Mode)](https://kilocode.ai/docs/advanced-usage/custom-rules#general-rules-any-mode)
* [Mode-Specific Rules](https://kilocode.ai/docs/advanced-usage/custom-rules#mode-specific-rules)
* [Creating Custom Rules](https://kilocode.ai/docs/advanced-usage/custom-rules#creating-custom-rules)
* [Using the UI Interface](https://kilocode.ai/docs/advanced-usage/custom-rules#using-the-ui-interface)
* [Using the File System](https://kilocode.ai/docs/advanced-usage/custom-rules#using-the-file-system)
* [Example Rules](https://kilocode.ai/docs/advanced-usage/custom-rules#example-rules)
* [Example 1: Table Formatting](https://kilocode.ai/docs/advanced-usage/custom-rules#example-1-table-formatting)
* [Example 2: Restricted File Access](https://kilocode.ai/docs/advanced-usage/custom-rules#example-2-restricted-file-access)
* [Use Cases](https://kilocode.ai/docs/advanced-usage/custom-rules#use-cases)
* [Examples of Custom Rules](https://kilocode.ai/docs/advanced-usage/custom-rules#examples-of-custom-rules)
* [Best Practices](https://kilocode.ai/docs/advanced-usage/custom-rules#best-practices)
* [Limitations](https://kilocode.ai/docs/advanced-usage/custom-rules#limitations)
* [Troubleshooting](https://kilocode.ai/docs/advanced-usage/custom-rules#troubleshooting)
* [Related Features](https://kilocode.ai/docs/advanced-usage/custom-rules#related-features)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fadvanced-usage%2Fcustom-rules)
---
# Context Mentions | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/basic-usage/context-mentions#__docusaurus_skipToContent_fallback)
On this page
Context mentions are a powerful way to provide Kilo Code with specific information about your project, allowing it to perform tasks more accurately and efficiently. You can use mentions to refer to files, folders, problems, and Git commits. Context mentions start with the `@` symbol.

_Context mentions overview showing the @ symbol dropdown menu in the chat interface._
Types of Mentions[](https://kilocode.ai/docs/basic-usage/context-mentions#types-of-mentions "Direct link to Types of Mentions")
---------------------------------------------------------------------------------------------------------------------------------

_File mentions add actual code content into the conversation for direct reference and analysis._
| Mention Type | Format | Description | Example Usage |
| --- | --- | --- | --- |
| **File** | `@/path/to/file.ts` | Includes file contents in request context | "Explain the function in @/src/utils.ts" |
| **Folder** | `@/path/to/folder/` | Provides directory structure in tree format | "What files are in @/src/components/?" |
| **Problems** | `@problems` | Includes VS Code Problems panel diagnostics | "@problems Fix all errors in my code" |
| **Terminal** | `@terminal` | Includes recent terminal command and output | "Fix the errors shown in @terminal" |
| **Git Commit** | `@a1b2c3d` | References specific commit by hash | "What changed in commit @a1b2c3d?" |
| **Git Changes** | `@git-changes` | Shows uncommitted changes | "Suggest a message for @git-changes" |
| **URL** | `@https://example.com` | Imports website content | "Summarize @[https://docusaurus.io/](https://docusaurus.io/) " |
### File Mentions[](https://kilocode.ai/docs/basic-usage/context-mentions#file-mentions "Direct link to File Mentions")

_File mentions incorporate source code with line numbers for precise references._
| Capability | Details |
| --- | --- |
| **Format** | `@/path/to/file.ts` (always start with `/` from workspace root) |
| **Provides** | Complete file contents with line numbers |
| **Supports** | Text files, PDFs, and DOCX files (with text extraction) |
| **Works in** | Initial requests, feedback responses, and follow-up messages |
| **Limitations** | Very large files may be truncated; binary files not supported |
### Folder Mentions[](https://kilocode.ai/docs/basic-usage/context-mentions#folder-mentions "Direct link to Folder Mentions")

_Folder mentions display directory structure in a readable tree format._
| Capability | Details |
| --- | --- |
| **Format** | `@/path/to/folder/` (note trailing slash) |
| **Provides** | Hierarchical tree display with ├── and └── prefixes |
| **Includes** | Immediate child files and directories (not recursive) |
| **Best for** | Understanding project structure |
| **Tip** | Use with file mentions to check specific file contents |
### Problems Mention[](https://kilocode.ai/docs/basic-usage/context-mentions#problems-mention "Direct link to Problems Mention")

_Problems mentions import diagnostics directly from VS Code's problems panel._
| Capability | Details |
| --- | --- |
| **Format** | `@problems` |
| **Provides** | All errors and warnings from VS Code's problems panel |
| **Includes** | File paths, line numbers, and diagnostic messages |
| **Groups** | Problems organized by file for better clarity |
| **Best for** | Fixing errors without manual copying |
### Terminal Mention[](https://kilocode.ai/docs/basic-usage/context-mentions#terminal-mention "Direct link to Terminal Mention")

_Terminal mentions capture recent command output for debugging and analysis._
| Capability | Details |
| --- | --- |
| **Format** | `@terminal` |
| **Captures** | Last command and its complete output |
| **Preserves** | Terminal state (doesn't clear the terminal) |
| **Limitation** | Limited to visible terminal buffer content |
| **Best for** | Debugging build errors or analyzing command output |
### Git Mentions[](https://kilocode.ai/docs/basic-usage/context-mentions#git-mentions "Direct link to Git Mentions")

_Git mentions provide commit details and diffs for context-aware version analysis._
| Type | Format | Provides | Limitations |
| --- | --- | --- | --- |
| **Commit** | `@a1b2c3d` | Commit message, author, date, and complete diff | Only works in Git repositories |
| **Working Changes** | `@git-changes` | `git status` output and diff of uncommitted changes | Only works in Git repositories |
### URL Mentions[](https://kilocode.ai/docs/basic-usage/context-mentions#url-mentions "Direct link to URL Mentions")

_URL mentions import external web content and convert it to readable Markdown format._
| Capability | Details |
| --- | --- |
| **Format** | `@https://example.com` |
| **Processing** | Uses headless browser to fetch content |
| **Cleaning** | Removes scripts, styles, and navigation elements |
| **Output** | Converts content to Markdown for readability |
| **Limitation** | Complex pages may not convert perfectly |
How to Use Mentions[](https://kilocode.ai/docs/basic-usage/context-mentions#how-to-use-mentions "Direct link to How to Use Mentions")
---------------------------------------------------------------------------------------------------------------------------------------
1. Type `@` in the chat input to trigger the suggestions dropdown
2. Continue typing to filter suggestions or use arrow keys to navigate
3. Select with Enter key or mouse click
4. Combine multiple mentions in a request: "Fix @problems in @/src/component.ts"
The dropdown automatically suggests:
* Recently opened files
* Visible folders
* Recent git commits
* Special keywords (`problems`, `terminal`, `git-changes`)
Best Practices[](https://kilocode.ai/docs/basic-usage/context-mentions#best-practices "Direct link to Best Practices")
------------------------------------------------------------------------------------------------------------------------
| Practice | Description |
| --- | --- |
| **Use specific paths** | Reference exact files rather than describing them |
| **Use relative paths** | Always start from workspace root: `@/src/file.ts` not `@C:/Projects/src/file.ts` |
| **Verify references** | Ensure paths and commit hashes are correct |
| **Click mentions** | Click mentions in chat history to open files or view content |
| **Eliminate copy-pasting** | Use mentions instead of manually copying code or errors |
| **Combine mentions** | "Fix @problems in @/src/component.ts using the pattern from commit @a1b2c3d" |
* [Types of Mentions](https://kilocode.ai/docs/basic-usage/context-mentions#types-of-mentions)
* [File Mentions](https://kilocode.ai/docs/basic-usage/context-mentions#file-mentions)
* [Folder Mentions](https://kilocode.ai/docs/basic-usage/context-mentions#folder-mentions)
* [Problems Mention](https://kilocode.ai/docs/basic-usage/context-mentions#problems-mention)
* [Terminal Mention](https://kilocode.ai/docs/basic-usage/context-mentions#terminal-mention)
* [Git Mentions](https://kilocode.ai/docs/basic-usage/context-mentions#git-mentions)
* [URL Mentions](https://kilocode.ai/docs/basic-usage/context-mentions#url-mentions)
* [How to Use Mentions](https://kilocode.ai/docs/basic-usage/context-mentions#how-to-use-mentions)
* [Best Practices](https://kilocode.ai/docs/basic-usage/context-mentions#best-practices)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fbasic-usage%2Fcontext-mentions)
---
# Prompt Engineering Tips | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/advanced-usage/prompt-engineering#__docusaurus_skipToContent_fallback)
On this page
Prompt engineering is the art of crafting effective instructions for AI models like Kilo Code. Well-written prompts lead to better results, fewer errors, and a more efficient workflow.
General Principles[](https://kilocode.ai/docs/advanced-usage/prompt-engineering#general-principles "Direct link to General Principles")
-----------------------------------------------------------------------------------------------------------------------------------------
* **Be Clear and Specific:** Clearly state what you want Kilo Code to do. Avoid ambiguity.
* **Bad:** Fix the code.
* **Good:** Fix the bug in the `calculateTotal` function that causes it to return incorrect results.
* **Provide Context:** Use [Context Mentions](https://kilocode.ai/docs/basic-usage/context-mentions)
to refer to specific files, folders, or problems.
* **Good:** `@/src/utils.ts` Refactor the `calculateTotal` function to use async/await.
* **Break Down Tasks:** Divide complex tasks into smaller, well-defined steps.
* **Give Examples:** If you have a specific coding style or pattern in mind, provide examples.
* **Specify Output Format:** If you need the output in a particular format (e.g., JSON, Markdown), specify it in the prompt.
* **Iterate:** Don't be afraid to refine your prompt if the initial results aren't what you expect.
Thinking vs. Doing[](https://kilocode.ai/docs/advanced-usage/prompt-engineering#thinking-vs-doing "Direct link to Thinking vs. Doing")
----------------------------------------------------------------------------------------------------------------------------------------
It's often helpful to guide Kilo Code through a "think-then-do" process:
1. **Analyze:** Ask Kilo Code to analyze the current code, identify problems, or plan the approach.
2. **Plan:** Have Kilo Code outline the steps it will take to complete the task.
3. **Execute:** Instruct Kilo Code to implement the plan, one step at a time.
4. **Review:** Carefully review the results of each step before proceeding.
Using Custom Instructions[](https://kilocode.ai/docs/advanced-usage/prompt-engineering#using-custom-instructions "Direct link to Using Custom Instructions")
--------------------------------------------------------------------------------------------------------------------------------------------------------------
You can provide custom instructions to further tailor Kilo Code's behavior. There are two types of custom instructions:
* **Global Custom Instructions:** Apply to all modes.
* **Mode-Specific Custom Instructions:** Apply only to a specific mode (e.g., Code, Architect, Ask, Debug, or a custom mode).
Custom instructions are added to the system prompt, providing persistent guidance to the AI model. You can use these to:
* Enforce coding style guidelines.
* Specify preferred libraries or frameworks.
* Define project-specific conventions.
* Adjust Kilo Code's tone or personality.
See the [Custom Instructions](https://kilocode.ai/docs/advanced-usage/custom-instructions)
section for more details.
Handling Ambiguity[](https://kilocode.ai/docs/advanced-usage/prompt-engineering#handling-ambiguity "Direct link to Handling Ambiguity")
-----------------------------------------------------------------------------------------------------------------------------------------
If your request is ambiguous or lacks sufficient detail, Kilo Code might:
* **Make Assumptions:** It might proceed based on its best guess, which may not be what you intended.
* **Ask Follow-Up Questions:** It might use the `ask_followup_question` tool to clarify your request.
It's generally better to provide clear and specific instructions from the start to avoid unnecessary back-and-forth.
Providing Feedback[](https://kilocode.ai/docs/advanced-usage/prompt-engineering#providing-feedback "Direct link to Providing Feedback")
-----------------------------------------------------------------------------------------------------------------------------------------
If Kilo Code doesn't produce the desired results, you can provide feedback by:
* **Rejecting Actions:** Click the "Reject" button when Kilo Code proposes an action you don't want.
* **Providing Explanations:** When rejecting, explain _why_ you're rejecting the action. This helps Kilo Code learn from its mistakes.
* **Rewording Your Request:** Try rephrasing your initial task or providing more specific instructions.
* **Manually Correcting:** If there are a few small issues, you can also directly modify the code before accepting the changes.
Examples[](https://kilocode.ai/docs/advanced-usage/prompt-engineering#examples "Direct link to Examples")
-----------------------------------------------------------------------------------------------------------
**Good Prompt:**
> `@/src/components/Button.tsx` Refactor the `Button` component to use the `useState` hook instead of the `useReducer` hook.
**Bad Prompt:**
> Fix the button.
**Good Prompt:**
> Create a new file named `utils.py` and add a function called `calculate_average` that takes a list of numbers and returns their average.
**Bad Prompt:**
> Write some Python code.
**Good Prompt:**
> `@problems` Address all errors and warnings in the current file.
**Bad Prompt:**
> Fix everything.
By following these tips, you can write effective prompts that get the most out of Kilo Code's capabilities.
* [General Principles](https://kilocode.ai/docs/advanced-usage/prompt-engineering#general-principles)
* [Thinking vs. Doing](https://kilocode.ai/docs/advanced-usage/prompt-engineering#thinking-vs-doing)
* [Using Custom Instructions](https://kilocode.ai/docs/advanced-usage/prompt-engineering#using-custom-instructions)
* [Handling Ambiguity](https://kilocode.ai/docs/advanced-usage/prompt-engineering#handling-ambiguity)
* [Providing Feedback](https://kilocode.ai/docs/advanced-usage/prompt-engineering#providing-feedback)
* [Examples](https://kilocode.ai/docs/advanced-usage/prompt-engineering#examples)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fadvanced-usage%2Fprompt-engineering)
---
# Using Local Models | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/advanced-usage/local-models#__docusaurus_skipToContent_fallback)
On this page
Kilo Code supports running language models locally on your own machine using [Ollama](https://ollama.com/)
and [LM Studio](https://lmstudio.ai/)
. This offers several advantages:
* **Privacy:** Your code and data never leave your computer.
* **Offline Access:** You can use Kilo Code even without an internet connection.
* **Cost Savings:** Avoid API usage fees associated with cloud-based models.
* **Customization:** Experiment with different models and configurations.
**However, using local models also has some drawbacks:**
* **Resource Requirements:** Local models can be resource-intensive, requiring a powerful computer with a good CPU and, ideally, a dedicated GPU.
* **Setup Complexity:** Setting up local models can be more complex than using cloud-based APIs.
* **Model Performance:** The performance of local models can vary significantly. While some are excellent, they may not always match the capabilities of the largest, most advanced cloud models.
* **Limited Features**: Local models (and many online models) often do not support advanced features such as prompt caching, computer use, and others.
Supported Local Model Providers[](https://kilocode.ai/docs/advanced-usage/local-models#supported-local-model-providers "Direct link to Supported Local Model Providers")
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Kilo Code currently supports two main local model providers:
1. **Ollama:** A popular open-source tool for running large language models locally. It supports a wide range of models.
2. **LM Studio:** A user-friendly desktop application that simplifies the process of downloading, configuring, and running local models. It also provides a local server that emulates the OpenAI API.
Setting Up Local Models[](https://kilocode.ai/docs/advanced-usage/local-models#setting-up-local-models "Direct link to Setting Up Local Models")
--------------------------------------------------------------------------------------------------------------------------------------------------
For detailed setup instructions, see:
* [Setting up Ollama](https://kilocode.ai/docs/providers/ollama)
* [Setting up LM Studio](https://kilocode.ai/docs/providers/lmstudio)
Both providers offer similar capabilities but with different user interfaces and workflows. Ollama provides more control through its command-line interface, while LM Studio offers a more user-friendly graphical interface.
Troubleshooting[](https://kilocode.ai/docs/advanced-usage/local-models#troubleshooting "Direct link to Troubleshooting")
--------------------------------------------------------------------------------------------------------------------------
* **"No connection could be made because the target machine actively refused it":** This usually means that the Ollama or LM Studio server isn't running, or is running on a different port/address than Kilo Code is configured to use. Double-check the Base URL setting.
* **Slow Response Times:** Local models can be slower than cloud-based models, especially on less powerful hardware. If performance is an issue, try using a smaller model.
* **Model Not Found:** Ensure you have typed in the name of the model correctly. If you're using Ollama, use the same name that you provide in the `ollama run` command.
* [Supported Local Model Providers](https://kilocode.ai/docs/advanced-usage/local-models#supported-local-model-providers)
* [Setting Up Local Models](https://kilocode.ai/docs/advanced-usage/local-models#setting-up-local-models)
* [Troubleshooting](https://kilocode.ai/docs/advanced-usage/local-models#troubleshooting)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fadvanced-usage%2Flocal-models)
---
# Adding More Tokens | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/basic-usage/adding-tokens#__docusaurus_skipToContent_fallback)
On this page
Once you've used your initial free tokens, you can easily add more:
* Add a credit card to your account (all payments are securely processed through Stripe)
* We don't currently offer a subscription, so you only pay for the tokens you use, and only when you choose to top up your tokens!
* Leverage your own API provider by [connecting your own API provider](https://kilocode.ai/docs/getting-started/connecting-api-provider)
Transparent Pricing[](https://kilocode.ai/docs/basic-usage/adding-tokens#transparent-pricing "Direct link to Transparent Pricing")
------------------------------------------------------------------------------------------------------------------------------------
At Kilo Code, we believe in complete pricing transparency:
* Our pricing matches the model provider's API rates exactly
* We don't take any commission or markup, either per token or per top-up
* You only pay for what you use with no hidden fees
Future Plans[](https://kilocode.ai/docs/basic-usage/adding-tokens#future-plans "Direct link to Future Plans")
---------------------------------------------------------------------------------------------------------------
We're continuously working to improve Kilo Code and expand our offerings:
* Additional LLM providers will be added in the future
* More payment options and other plans are under development
Need Help?
If you have any questions about pricing or tokens, please reach out to our [support team](mailto:hi@kilocode.ai)
or ask in our [Discord community](https://kilocode.ai/discord)
.
* [Transparent Pricing](https://kilocode.ai/docs/basic-usage/adding-tokens#transparent-pricing)
* [Future Plans](https://kilocode.ai/docs/basic-usage/adding-tokens#future-plans)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fbasic-usage%2Fadding-tokens)
---
# Using Modes | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/basic-usage/using-modes#__docusaurus_skipToContent_fallback)
On this page
Modes in Kilo Code are specialized personas that tailor the assistant's behavior to your current task. Each mode offers different capabilities, expertise, and access levels to help you accomplish specific goals.
Why Use Different Modes?[](https://kilocode.ai/docs/basic-usage/using-modes#why-use-different-modes "Direct link to Why Use Different Modes?")
------------------------------------------------------------------------------------------------------------------------------------------------
* **Task specialization:** Get precisely the type of assistance you need for your current task
* **Safety controls:** Prevent unintended file modifications when focusing on planning or learning
* **Focused interactions:** Receive responses optimized for your current activity
* **Workflow optimization:** Seamlessly transition between planning, implementing, debugging, and learning
Explaining the different modes in Kilo Code
Switching Between Modes[](https://kilocode.ai/docs/basic-usage/using-modes#switching-between-modes "Direct link to Switching Between Modes")
----------------------------------------------------------------------------------------------------------------------------------------------
Four ways to switch modes:
1. **Dropdown menu:** Click the selector to the left of the chat input

2. **Slash command:** Type `/architect`, `/ask`, `/debug`, or `/code` in the chat input

3. **Toggle command/Keyboard shortcut:** Use the keyboard shortcut below, applicable to your operating system. Each press cycles through the available modes in sequence, wrapping back to the first mode after reaching the end.
| Operating System | Shortcut |
| --- | --- |
| macOS | ⌘ + . |
| Windows | Ctrl + . |
| Linux | Ctrl + . |
4. **Accept suggestions:** Click on mode switch suggestions that Kilo Code offers when appropriate

Built-in Modes[](https://kilocode.ai/docs/basic-usage/using-modes#built-in-modes "Direct link to Built-in Modes")
-------------------------------------------------------------------------------------------------------------------
### Code Mode (Default)[](https://kilocode.ai/docs/basic-usage/using-modes#code-mode-default "Direct link to Code Mode (Default)")
| Aspect | Details |
| --- | --- |
| **Description** | A skilled software engineer with expertise in programming languages, design patterns, and best practices |
| **Tool Access** | Full access to all tool groups: `read`, `edit`, `browser`, `command`, `mcp` |
| **Ideal For** | Writing code, implementing features, debugging, and general development |
| **Special Features** | No tool restrictions—full flexibility for all coding tasks |
### Ask Mode[](https://kilocode.ai/docs/basic-usage/using-modes#ask-mode "Direct link to Ask Mode")
| Aspect | Details |
| --- | --- |
| **Description** | A knowledgeable technical assistant focused on answering questions without changing your codebase |
| **Tool Access** | Limited access: `read`, `browser`, `mcp` only (cannot edit files or run commands) |
| **Ideal For** | Code explanation, concept exploration, and technical learning |
| **Special Features** | Optimized for informative responses without modifying your project |
### Architect Mode[](https://kilocode.ai/docs/basic-usage/using-modes#architect-mode "Direct link to Architect Mode")
| Aspect | Details |
| --- | --- |
| **Description** | An experienced technical leader and planner who helps design systems and create implementation plans |
| **Tool Access** | Access to `read`, `browser`, `mcp`, and restricted `edit` (markdown files only) |
| **Ideal For** | System design, high-level planning, and architecture discussions |
| **Special Features** | Follows a structured approach from information gathering to detailed planning |
### Debug Mode[](https://kilocode.ai/docs/basic-usage/using-modes#debug-mode "Direct link to Debug Mode")
| Aspect | Details |
| --- | --- |
| **Description** | An expert problem solver specializing in systematic troubleshooting and diagnostics |
| **Tool Access** | Full access to all tool groups: `read`, `edit`, `browser`, `command`, `mcp` |
| **Ideal For** | Tracking down bugs, diagnosing errors, and resolving complex issues |
| **Special Features** | Uses a methodical approach of analyzing, narrowing possibilities, and fixing issues |
### Orchestrator Mode[](https://kilocode.ai/docs/basic-usage/using-modes#orchestrator-mode "Direct link to Orchestrator Mode")
| Aspect | Details |
| --- | --- |
| **Description** | A strategic workflow orchestrator who coordinates complex tasks by delegating them to appropriate specialized modes |
| **Tool Access** | Limited access to create new tasks and coordinate workflows |
| **Ideal For** | Breaking down complex projects into manageable subtasks assigned to specialized modes |
| **Special Features** | Uses the new\_task tool to delegate work to other modes |
Custom Modes[](https://kilocode.ai/docs/basic-usage/using-modes#custom-modes "Direct link to Custom Modes")
-------------------------------------------------------------------------------------------------------------
Create your own specialized assistants by defining tool access, file permissions, and behavior instructions. Custom modes help enforce team standards or create purpose-specific assistants. See [Custom Modes documentation](https://kilocode.ai/docs/features/custom-modes)
for setup instructions.
* [Why Use Different Modes?](https://kilocode.ai/docs/basic-usage/using-modes#why-use-different-modes)
* [Switching Between Modes](https://kilocode.ai/docs/basic-usage/using-modes#switching-between-modes)
* [Built-in Modes](https://kilocode.ai/docs/basic-usage/using-modes#built-in-modes)
* [Code Mode (Default)](https://kilocode.ai/docs/basic-usage/using-modes#code-mode-default)
* [Ask Mode](https://kilocode.ai/docs/basic-usage/using-modes#ask-mode)
* [Architect Mode](https://kilocode.ai/docs/basic-usage/using-modes#architect-mode)
* [Debug Mode](https://kilocode.ai/docs/basic-usage/using-modes#debug-mode)
* [Orchestrator Mode](https://kilocode.ai/docs/basic-usage/using-modes#orchestrator-mode)
* [Custom Modes](https://kilocode.ai/docs/basic-usage/using-modes#custom-modes)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fbasic-usage%2Fusing-modes)
---
# Chatting with Kilo Code | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/basic-usage/the-chat-interface#__docusaurus_skipToContent_fallback)
On this page
tip
**Bottom line:** Kilo Code is an AI coding assistant that lives in VS Code. You chat with it in plain English, and it writes, edits, and explains code for you.
Quick Setup[](https://kilocode.ai/docs/basic-usage/the-chat-interface#quick-setup "Direct link to Quick Setup")
-----------------------------------------------------------------------------------------------------------------
Find the Kilo Code icon () in VS Code's Primary Side Bar. Click it to open the chat panel.
**Lost the panel?** Go to View > Open View... and search for "Kilo Code"
How to Talk to Kilo Code[](https://kilocode.ai/docs/basic-usage/the-chat-interface#how-to-talk-to-kilo-code "Direct link to How to Talk to Kilo Code")
--------------------------------------------------------------------------------------------------------------------------------------------------------
**The key insight:** Just type what you want in normal English. No special commands needed.

**Good requests:**
create a new file named utils.py and add a function called add that takes two numbers as arguments and returns their sum
in the file @src/components/Button.tsx, change the color of the button to blue
find all instances of the variable oldValue in @/src/App.js and replace them with newValue
**What makes requests work:**
* **Be specific** - "Fix the bug in `calculateTotal` that returns incorrect results" beats "Fix the code"
* **Use @ mentions** - Reference files and code directly with `@filename`
* **One task at a time** - Break complex work into manageable steps
* **Include examples** - Show the style or format you want
The Chat Interface[](https://kilocode.ai/docs/basic-usage/the-chat-interface#the-chat-interface "Direct link to The Chat Interface")
--------------------------------------------------------------------------------------------------------------------------------------

_Everything you need is right here_
**Essential controls:**
* **Chat history** - See your conversation and task history
* **Input field** - Type your requests here (press Enter to send)
* **Action buttons** - Approve or reject Kilo's proposed changes
* **Plus button** - Start a new task session
* **Mode selector** - Choose how Kilo should approach your task
Quick Interactions[](https://kilocode.ai/docs/basic-usage/the-chat-interface#quick-interactions "Direct link to Quick Interactions")
--------------------------------------------------------------------------------------------------------------------------------------
**Click to act:**
* File paths → Opens the file
* URLs → Opens in browser
* Messages → Expand/collapse details
* Code blocks → Copy button appears
**Status signals:**
* Spinning → Kilo is working
* Red → Error occurred
* Green → Success
Common Mistakes to Avoid[](https://kilocode.ai/docs/basic-usage/the-chat-interface#common-mistakes-to-avoid "Direct link to Common Mistakes to Avoid")
--------------------------------------------------------------------------------------------------------------------------------------------------------
| Instead of this... | Try this |
| --- | --- |
| "Fix the code" | "Fix the bug in `calculateTotal` that returns incorrect results" |
| Assuming Kilo knows context | Use `@` to reference specific files |
| Multiple unrelated tasks | Submit one focused request at a time |
| Technical jargon overload | Clear, straightforward language works best |
**Why it matters:** Kilo Code works best when you communicate like you're talking to a smart teammate who needs clear direction.
Ready to start coding? Open the chat panel and describe what you want to build!
* [Quick Setup](https://kilocode.ai/docs/basic-usage/the-chat-interface#quick-setup)
* [How to Talk to Kilo Code](https://kilocode.ai/docs/basic-usage/the-chat-interface#how-to-talk-to-kilo-code)
* [The Chat Interface](https://kilocode.ai/docs/basic-usage/the-chat-interface#the-chat-interface)
* [Quick Interactions](https://kilocode.ai/docs/basic-usage/the-chat-interface#quick-interactions)
* [Common Mistakes to Avoid](https://kilocode.ai/docs/basic-usage/the-chat-interface#common-mistakes-to-avoid)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fbasic-usage%2Fthe-chat-interface)
---
# How Tools Work | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/basic-usage/how-tools-work#__docusaurus_skipToContent_fallback)
On this page
Kilo Code uses tools to interact with your code and environment. These specialized helpers perform specific actions like reading files, making edits, running commands, or searching your codebase. Tools provide automation for common development tasks without requiring manual execution.
Tool Workflow[](https://kilocode.ai/docs/basic-usage/how-tools-work#tool-workflow "Direct link to Tool Workflow")
-------------------------------------------------------------------------------------------------------------------
Describe what you want to accomplish in natural language, and Kilo Code will:
1. Select the appropriate tool based on your request
2. Present the tool with its parameters for your review
3. Execute the approved tool and show you the results
4. Continue this process until your task is complete
Tool Categories[](https://kilocode.ai/docs/basic-usage/how-tools-work#tool-categories "Direct link to Tool Categories")
-------------------------------------------------------------------------------------------------------------------------
| Category | Purpose | Tool Names |
| --- | --- | --- |
| Read | Access file content and code structure | `read_file`, `search_files`, `list_files`, `list_code_definition_names` |
| Edit | Create or modify files and code | `write_to_file`, `apply_diff` |
| Execute | Run commands and perform system operations | `execute_command` |
| Browser | Interact with web content | `browser_action` |
| Workflow | Manage task flow and context | `ask_followup_question`, `attempt_completion`, `switch_mode`, `new_task` |
Example: Using Tools[](https://kilocode.ai/docs/basic-usage/how-tools-work#example-using-tools "Direct link to Example: Using Tools")
---------------------------------------------------------------------------------------------------------------------------------------
Here's how a typical tool interaction works:

_The tool approval interface shows Save/Reject buttons and Auto-approve options._
**User:** Create a file named `greeting.js` that logs a greeting message
**Kilo Code:** (Proposes the `write_to_file` tool as shown in the image above)
greeting.jsfunction greet(name) { console.log(`Hello, ${name}!`);}greet('World');5
**User:** (Clicks "Save" in the interface)
**Kilo Code:** (Confirms file creation)
Tool Safety and Approval[](https://kilocode.ai/docs/basic-usage/how-tools-work#tool-safety-and-approval "Direct link to Tool Safety and Approval")
----------------------------------------------------------------------------------------------------------------------------------------------------
Every tool use requires your explicit approval. When Kilo proposes a tool, you'll see:
* A "Save" button to approve and execute the tool
* A "Reject" button to decline the proposed tool
* An optional "Auto-approve" setting for trusted operations
This safety mechanism ensures you maintain control over which files are modified, what commands are executed, and how your codebase is changed. Always review tool proposals carefully before saving them.
Core Tools Reference[](https://kilocode.ai/docs/basic-usage/how-tools-work#core-tools-reference "Direct link to Core Tools Reference")
----------------------------------------------------------------------------------------------------------------------------------------
| Tool Name | Description | Category |
| --- | --- | --- |
| `read_file` | Reads the content of a file with line numbers | Read |
| `search_files` | Searches for text or regex patterns across files | Read |
| `list_files` | Lists files and directories in a specified location | Read |
| `list_code_definition_names` | Lists code definitions like classes and functions | Read |
| `write_to_file` | Creates new files or overwrites existing ones | Edit |
| `apply_diff` | Makes precise changes to specific parts of a file | Edit |
| `execute_command` | Runs commands in the VS Code terminal | Execute |
| `browser_action` | Performs actions in a headless browser | Browser |
| `ask_followup_question` | Asks you a clarifying question | Workflow |
| `attempt_completion` | Indicates the task is complete | Workflow |
| `switch_mode` | Changes to a different operational mode | Workflow |
| `new_task` | Creates a new subtask with a specific starting mode | Workflow |
Learn More About Tools[](https://kilocode.ai/docs/basic-usage/how-tools-work#learn-more-about-tools "Direct link to Learn More About Tools")
----------------------------------------------------------------------------------------------------------------------------------------------
For more detailed information about each tool, including complete parameter references and advanced usage patterns, see the [Tool Use Overview](https://kilocode.ai/docs/features/tools/tool-use-overview)
documentation.
* [Tool Workflow](https://kilocode.ai/docs/basic-usage/how-tools-work#tool-workflow)
* [Tool Categories](https://kilocode.ai/docs/basic-usage/how-tools-work#tool-categories)
* [Example: Using Tools](https://kilocode.ai/docs/basic-usage/how-tools-work#example-using-tools)
* [Tool Safety and Approval](https://kilocode.ai/docs/basic-usage/how-tools-work#tool-safety-and-approval)
* [Core Tools Reference](https://kilocode.ai/docs/basic-usage/how-tools-work#core-tools-reference)
* [Learn More About Tools](https://kilocode.ai/docs/basic-usage/how-tools-work#learn-more-about-tools)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fbasic-usage%2Fhow-tools-work)
---
# Rate Limits and Costs | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/advanced-usage/rate-limits-costs#__docusaurus_skipToContent_fallback)
On this page
Understanding and managing API usage is crucial for a smooth and cost-effective experience with Kilo Code. This section explains how to track your token usage, costs, and how to configure rate limits.
Token Usage[](https://kilocode.ai/docs/advanced-usage/rate-limits-costs#token-usage "Direct link to Token Usage")
-------------------------------------------------------------------------------------------------------------------
Kilo Code interacts with AI models using tokens. Tokens are essentially pieces of words. The number of tokens used in a request and response affects both the processing time and the cost.
* **Input Tokens:** These are the tokens in your prompt, including the system prompt, your instructions, and any context provided (e.g., file contents).
* **Output Tokens:** These are the tokens generated by the AI model in its response.
You can see the number of input and output tokens used for each interaction in the chat history.
Cost Calculation[](https://kilocode.ai/docs/advanced-usage/rate-limits-costs#cost-calculation "Direct link to Cost Calculation")
----------------------------------------------------------------------------------------------------------------------------------
Most AI providers charge based on the number of tokens used. Pricing varies depending on the provider and the specific model.
Kilo Code automatically calculates the estimated cost of each API request based on the configured model's pricing. This cost is displayed in the chat history, next to the token usage.
**Note:**
* The cost calculation is an _estimate_. The actual cost may vary slightly depending on the provider's billing practices.
* Some providers may offer free tiers or credits. Check your provider's documentation for details.
* Some providers offer prompt caching which greatly lowers cost.
Configuring Rate Limits[](https://kilocode.ai/docs/advanced-usage/rate-limits-costs#configuring-rate-limits "Direct link to Configuring Rate Limits")
-------------------------------------------------------------------------------------------------------------------------------------------------------
To prevent accidental overuse of the API and to help you manage costs, Kilo Code allows you to set a rate limit. The rate limit specifies the minimum time (in seconds) between API requests.
**How to configure:**
1. Open the Kilo Code settings ( icon in the top right corner).
2. Go to the "Advanced Settings" section.
3. Find the "Rate Limit (seconds)" setting.
4. Enter the desired delay in seconds. A value of 0 disables rate limiting.
**Example:**
If you set the rate limit to 10 seconds, Kilo Code will wait at least 10 seconds after one API request completes before sending the next one.
Tips for Optimizing Token Usage[](https://kilocode.ai/docs/advanced-usage/rate-limits-costs#tips-for-optimizing-token-usage "Direct link to Tips for Optimizing Token Usage")
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
* **Be Concise:** Use clear and concise language in your prompts. Avoid unnecessary words or details.
* **Provide Only Relevant Context:** Use context mentions (`@file.ts`, `@folder/`) selectively. Only include the files that are directly relevant to the task.
* **Break Down Tasks:** Divide large tasks into smaller, more focused sub-tasks.
* **Use Custom Instructions:** Provide custom instructions to guide Kilo Code's behavior and reduce the need for lengthy explanations in each prompt.
* **Choose the Right Model:** Some models are more cost-effective than others. Consider using a smaller, faster model for tasks that don't require the full power of a larger model.
* **Use Modes:** Different modes can access different tools, for example `Architect` can't modify code, which makes it a safe choice when analyzing a complex codebase, without worrying about accidentally allowing expensive operations.
* **Disable MCP If Not Used:** If you're not using MCP (Model Context Protocol) features, consider [disabling it in the MCP settings](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code)
to significantly reduce the size of the system prompt and save tokens.
By understanding and managing your API usage, you can use Kilo Code effectively and efficiently.
* [Token Usage](https://kilocode.ai/docs/advanced-usage/rate-limits-costs#token-usage)
* [Cost Calculation](https://kilocode.ai/docs/advanced-usage/rate-limits-costs#cost-calculation)
* [Configuring Rate Limits](https://kilocode.ai/docs/advanced-usage/rate-limits-costs#configuring-rate-limits)
* [Tips for Optimizing Token Usage](https://kilocode.ai/docs/advanced-usage/rate-limits-costs#tips-for-optimizing-token-usage)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fadvanced-usage%2Frate-limits-costs)
---
# Development Environment | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/extending/development-environment#__docusaurus_skipToContent_fallback)
On this page
This document will help you set up your development environment and understand how to work with the codebase. Whether you're fixing bugs, adding features, or just exploring the code, this guide will get you started.
Prerequisites[](https://kilocode.ai/docs/extending/development-environment#prerequisites "Direct link to Prerequisites")
--------------------------------------------------------------------------------------------------------------------------
Before you begin, make sure you have the following installed:
1. **Git** - For version control
2. **Node.js** (version [v20.18.1](https://github.com/Kilo-Org/kilocode/blob/main/.nvmrc)
or higher recommended) and npm
3. **Visual Studio Code** - Our recommended IDE for development
Getting Started[](https://kilocode.ai/docs/extending/development-environment#getting-started "Direct link to Getting Started")
--------------------------------------------------------------------------------------------------------------------------------
### Installation[](https://kilocode.ai/docs/extending/development-environment#installation "Direct link to Installation")
1. **Fork and Clone the Repository**:
* **Fork the Repository**:
* Visit the [Kilo Code GitHub repository](https://github.com/Kilo-Org/kilocode)
* Click the "Fork" button in the top-right corner to create your own copy.
* **Clone Your Fork**:
git clone https://github.com/[YOUR-USERNAME]/kilocode.gitcd kilocode
Replace `[YOUR-USERNAME]` with your actual GitHub username.
2. **Install dependencies**:
pnpm install
This command will install dependencies for the main extension, webview UI, and e2e tests.
3. **Install VSCode Extensions**:
* **Required**: [ESBuild Problem Matchers](https://marketplace.visualstudio.com/items?itemName=connor4312.esbuild-problem-matchers)
- Helps display build errors correctly.
While not strictly necessary for running the extension, these extensions are recommended for development:
* [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
- Integrates ESLint into VS Code.
* [Prettier - Code formatter](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
- Integrates Prettier into VS Code.
The full list of recommended extensions is [here](https://github.com/Kilo-Org/kilocode/blob/main/.vscode/extensions.json)
### Project Structure[](https://kilocode.ai/docs/extending/development-environment#project-structure "Direct link to Project Structure")
The project is organized into several key directories:
* **`src/`** - Core extension code
* **`core/`** - Core functionality and tools
* **`services/`** - Service implementations
* **`webview-ui/`** - Frontend UI code
* **`e2e/`** - End-to-end tests
* **`scripts/`** - Utility scripts
* **`assets/`** - Static assets like images and icons
Development Workflow[](https://kilocode.ai/docs/extending/development-environment#development-workflow "Direct link to Development Workflow")
-----------------------------------------------------------------------------------------------------------------------------------------------
### Building the Extension[](https://kilocode.ai/docs/extending/development-environment#building-the-extension "Direct link to Building the Extension")
To build the extension:
pnpm build
This will:
1. Build the webview UI
2. Compile TypeScript
3. Bundle the extension
4. Create a `.vsix` file in the `bin/` directory
### Running the Extension[](https://kilocode.ai/docs/extending/development-environment#running-the-extension "Direct link to Running the Extension")
To run the extension in development mode:
1. Press `F5` (or select **Run** → **Start Debugging**) in VSCode
2. This will open a new VSCode window with Kilo Code loaded
### Hot Reloading[](https://kilocode.ai/docs/extending/development-environment#hot-reloading "Direct link to Hot Reloading")
* **Webview UI changes**: Changes to the webview UI will appear immediately without restarting
* **Core extension changes**: Changes to the core extension code will automatically reload the ext host
In development mode (NODE\_ENV="development"), changing the core code will trigger a `workbench.action.reloadWindow` command, so it is no longer necessary to manually start/stop the debugger and tasks.
> **Important**: In production builds, when making changes to the core extension, you need to:
>
> 1. Stop the debugging process
> 2. Kill any npm tasks running in the background (see screenshot below)
> 3. Start debugging again

### Installing the Built Extension[](https://kilocode.ai/docs/extending/development-environment#installing-the-built-extension "Direct link to Installing the Built Extension")
To install your built extension:
code --install-extension "$(ls -1v bin/kilo-code-*.vsix | tail -n1)"
Replace `[version]` with the current version number.
Testing[](https://kilocode.ai/docs/extending/development-environment#testing "Direct link to Testing")
--------------------------------------------------------------------------------------------------------
Kilo Code uses several types of tests to ensure quality:
### Unit Tests[](https://kilocode.ai/docs/extending/development-environment#unit-tests "Direct link to Unit Tests")
Run unit tests with:
npm test
This runs both extension and webview tests.
To run specific test suites:
npm run test:extension # Run only extension testsnpm run test:webview # Run only webview tests
### End-to-End Tests[](https://kilocode.ai/docs/extending/development-environment#end-to-end-tests "Direct link to End-to-End Tests")
E2E tests verify the extension works correctly within VSCode:
1. Create a `.env.local` file in the root with required API keys:
OPENROUTER_API_KEY=sk-or-v1-...
2. Run the integration tests:
npm run test:integration
For more details on E2E tests, see [e2e/VSCODE\_INTEGRATION\_TESTS.md](https://github.com/Kilo-Org/kilocode/blob/main/e2e/VSCODE_INTEGRATION_TESTS.md)
.
Linting and Type Checking[](https://kilocode.ai/docs/extending/development-environment#linting-and-type-checking "Direct link to Linting and Type Checking")
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Ensure your code meets our quality standards:
npm run lint # Run ESLintnpm run check-types # Run TypeScript type checking
Git Hooks[](https://kilocode.ai/docs/extending/development-environment#git-hooks "Direct link to Git Hooks")
--------------------------------------------------------------------------------------------------------------
This project uses [Husky](https://typicode.github.io/husky/)
to manage Git hooks, which automate certain checks before commits and pushes. The hooks are located in the `.husky/` directory.
### Pre-commit Hook[](https://kilocode.ai/docs/extending/development-environment#pre-commit-hook "Direct link to Pre-commit Hook")
Before a commit is finalized, the `.husky/pre-commit` hook runs:
1. **Branch Check**: Prevents committing directly to the `main` branch.
2. **Type Generation**: Runs `npm run generate-types`.
3. **Type File Check**: Ensures that any changes made to `src/exports/roo-code.d.ts` by the type generation are staged.
4. **Linting**: Runs `lint-staged` to lint and format staged files.
### Pre-push Hook[](https://kilocode.ai/docs/extending/development-environment#pre-push-hook "Direct link to Pre-push Hook")
Before changes are pushed to the remote repository, the `.husky/pre-push` hook runs:
1. **Branch Check**: Prevents pushing directly to the `main` branch.
2. **Compilation**: Runs `npm run compile` to ensure the project builds successfully.
3. **Changeset Check**: Checks if a changeset file exists in `.changeset/` and reminds you to create one using `npm run changeset` if necessary.
These hooks help maintain code quality and consistency. If you encounter issues with commits or pushes, check the output from these hooks for error messages.
Troubleshooting[](https://kilocode.ai/docs/extending/development-environment#troubleshooting "Direct link to Troubleshooting")
--------------------------------------------------------------------------------------------------------------------------------
### Common Issues[](https://kilocode.ai/docs/extending/development-environment#common-issues "Direct link to Common Issues")
1. **Extension not loading**: Check the VSCode Developer Tools (Help > Toggle Developer Tools) for errors
2. **Webview not updating**: Try reloading the window (Developer: Reload Window)
3. **Build errors**: Make sure all dependencies are installed with `npm run install:all`
### Debugging Tips[](https://kilocode.ai/docs/extending/development-environment#debugging-tips "Direct link to Debugging Tips")
* Use `console.log()` statements in your code for debugging
* Check the Output panel in VSCode (View > Output) and select "Kilo Code" from the dropdown
* For webview issues, use the browser developer tools in the webview (right-click > "Inspect Element")
* [Prerequisites](https://kilocode.ai/docs/extending/development-environment#prerequisites)
* [Getting Started](https://kilocode.ai/docs/extending/development-environment#getting-started)
* [Installation](https://kilocode.ai/docs/extending/development-environment#installation)
* [Project Structure](https://kilocode.ai/docs/extending/development-environment#project-structure)
* [Development Workflow](https://kilocode.ai/docs/extending/development-environment#development-workflow)
* [Building the Extension](https://kilocode.ai/docs/extending/development-environment#building-the-extension)
* [Running the Extension](https://kilocode.ai/docs/extending/development-environment#running-the-extension)
* [Hot Reloading](https://kilocode.ai/docs/extending/development-environment#hot-reloading)
* [Installing the Built Extension](https://kilocode.ai/docs/extending/development-environment#installing-the-built-extension)
* [Testing](https://kilocode.ai/docs/extending/development-environment#testing)
* [Unit Tests](https://kilocode.ai/docs/extending/development-environment#unit-tests)
* [End-to-End Tests](https://kilocode.ai/docs/extending/development-environment#end-to-end-tests)
* [Linting and Type Checking](https://kilocode.ai/docs/extending/development-environment#linting-and-type-checking)
* [Git Hooks](https://kilocode.ai/docs/extending/development-environment#git-hooks)
* [Pre-commit Hook](https://kilocode.ai/docs/extending/development-environment#pre-commit-hook)
* [Pre-push Hook](https://kilocode.ai/docs/extending/development-environment#pre-push-hook)
* [Troubleshooting](https://kilocode.ai/docs/extending/development-environment#troubleshooting)
* [Common Issues](https://kilocode.ai/docs/extending/development-environment#common-issues)
* [Debugging Tips](https://kilocode.ai/docs/extending/development-environment#debugging-tips)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fextending%2Fdevelopment-environment)
---
# Contributing to Kilo Code | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/extending/contributing-to-kilo#__docusaurus_skipToContent_fallback)
On this page
Kilo Code is an open-source project that welcomes contributions from developers of all skill levels. This guide will help you get started with contributing to Kilo Code, whether you're fixing bugs, adding features, improving documentation, or sharing custom modes.
Ways to Contribute[](https://kilocode.ai/docs/extending/contributing-to-kilo#ways-to-contribute "Direct link to Ways to Contribute")
--------------------------------------------------------------------------------------------------------------------------------------
There are many ways to contribute to Kilo Code:
1. **Code Contributions**: Implement new features or fix bugs
2. **Documentation**: Improve existing docs or create new guides
3. **Custom Modes**: Create and share specialized modes
4. **Bug Reports**: Report issues you encounter
5. **Feature Requests**: Suggest new features or improvements
6. **Community Support**: Help other users in the community
Setting Up the Development Environment[](https://kilocode.ai/docs/extending/contributing-to-kilo#setting-up-the-development-environment "Direct link to Setting Up the Development Environment")
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Setting Up the Development Environment is described in details on [this page](https://kilocode.ai/docs/extending/development-environment)
Development Workflow[](https://kilocode.ai/docs/extending/contributing-to-kilo#development-workflow "Direct link to Development Workflow")
--------------------------------------------------------------------------------------------------------------------------------------------
### Branching Strategy[](https://kilocode.ai/docs/extending/contributing-to-kilo#branching-strategy "Direct link to Branching Strategy")
* Create a new branch for each feature or bugfix
* Use descriptive branch names (e.g., `feature/new-tool-support` or `fix/browser-action-bug`)
git checkout -b your-branch-name
### Coding Standards[](https://kilocode.ai/docs/extending/contributing-to-kilo#coding-standards "Direct link to Coding Standards")
* Follow the existing code style and patterns
* Use TypeScript for new code
* Include appropriate tests for new features
* Update documentation for any user-facing changes
### Commit Guidelines[](https://kilocode.ai/docs/extending/contributing-to-kilo#commit-guidelines "Direct link to Commit Guidelines")
* Write clear, concise commit messages
* Reference issue numbers when applicable
* Keep commits focused on a single change
### Testing Your Changes[](https://kilocode.ai/docs/extending/contributing-to-kilo#testing-your-changes "Direct link to Testing Your Changes")
* Run the test suite:
npm test
* Manually test your changes in the development extension
### Creating a Pull Request[](https://kilocode.ai/docs/extending/contributing-to-kilo#creating-a-pull-request "Direct link to Creating a Pull Request")
1. Push your changes to your fork:
git push origin your-branch-name
2. Go to the [Kilo Code repository](https://github.com/Kilo-Org/kilocode)
3. Click "New Pull Request" and select "compare across forks"
4. Select your fork and branch
5. Fill out the PR template with:
* A clear description of the changes
* Any related issues
* Testing steps
* Screenshots (if applicable)
Creating Custom Modes[](https://kilocode.ai/docs/extending/contributing-to-kilo#creating-custom-modes "Direct link to Creating Custom Modes")
-----------------------------------------------------------------------------------------------------------------------------------------------
Custom modes are a powerful way to extend Kilo Code's capabilities. To create and share a custom mode:
1. Follow the [Custom Modes documentation](https://kilocode.ai/docs/features/custom-modes)
to create your mode
2. Test your mode thoroughly
3. Share your mode with the community by submitting a [GitHub Discussion](https://github.com/Kilo-Org/kilocode/discussions)
Documentation Contributions[](https://kilocode.ai/docs/extending/contributing-to-kilo#documentation-contributions "Direct link to Documentation Contributions")
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Documentation improvements are highly valued contributions:
1. Follow the documentation style guide:
* Use clear, concise language
* Include examples where appropriate
* Use absolute paths starting from `/docs/` for internal links
* Don't include `.md` extensions in links
2. Test your documentation changes by running the docs site locally:
cd docsnpm installnpm start
3. Submit a PR with your documentation changes
Community Guidelines[](https://kilocode.ai/docs/extending/contributing-to-kilo#community-guidelines "Direct link to Community Guidelines")
--------------------------------------------------------------------------------------------------------------------------------------------
When participating in the Kilo Code community:
* Be respectful and inclusive
* Provide constructive feedback
* Help newcomers get started
* Follow the [Code of Conduct](https://github.com/Kilo-Org/kilocode/blob/main/CODE_OF_CONDUCT.md)
Getting Help[](https://kilocode.ai/docs/extending/contributing-to-kilo#getting-help "Direct link to Getting Help")
--------------------------------------------------------------------------------------------------------------------
If you need help with your contribution:
* Join our [Discord community](https://kilocode.ai/discord)
for real-time support
* Ask questions on [GitHub Discussions](https://github.com/Kilo-Org/kilocode/discussions)
* Visit our [Reddit community](https://www.reddit.com/r/KiloCode)
Recognition[](https://kilocode.ai/docs/extending/contributing-to-kilo#recognition "Direct link to Recognition")
-----------------------------------------------------------------------------------------------------------------
All contributors are valued members of the Kilo Code community. Contributors are recognized in:
* Release notes
* The project's README
* The contributors list on GitHub
Thank you for contributing to Kilo Code and helping make AI-powered coding assistance better for everyone!
* [Ways to Contribute](https://kilocode.ai/docs/extending/contributing-to-kilo#ways-to-contribute)
* [Setting Up the Development Environment](https://kilocode.ai/docs/extending/contributing-to-kilo#setting-up-the-development-environment)
* [Development Workflow](https://kilocode.ai/docs/extending/contributing-to-kilo#development-workflow)
* [Branching Strategy](https://kilocode.ai/docs/extending/contributing-to-kilo#branching-strategy)
* [Coding Standards](https://kilocode.ai/docs/extending/contributing-to-kilo#coding-standards)
* [Commit Guidelines](https://kilocode.ai/docs/extending/contributing-to-kilo#commit-guidelines)
* [Testing Your Changes](https://kilocode.ai/docs/extending/contributing-to-kilo#testing-your-changes)
* [Creating a Pull Request](https://kilocode.ai/docs/extending/contributing-to-kilo#creating-a-pull-request)
* [Creating Custom Modes](https://kilocode.ai/docs/extending/contributing-to-kilo#creating-custom-modes)
* [Documentation Contributions](https://kilocode.ai/docs/extending/contributing-to-kilo#documentation-contributions)
* [Community Guidelines](https://kilocode.ai/docs/extending/contributing-to-kilo#community-guidelines)
* [Getting Help](https://kilocode.ai/docs/extending/contributing-to-kilo#getting-help)
* [Recognition](https://kilocode.ai/docs/extending/contributing-to-kilo#recognition)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fextending%2Fcontributing-to-kilo)
---
# API Configuration Profiles | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/api-configuration-profiles#__docusaurus_skipToContent_fallback)
On this page
API Configuration Profiles allow you to create and switch between different sets of AI settings. Each profile can have different configurations for each mode, letting you optimize your experience based on the task at hand.
info
Having multiple configuration profiles lets you quickly switch between different AI providers, models, and settings without reconfiguring everything each time you want to change your setup.
How It Works[](https://kilocode.ai/docs/features/api-configuration-profiles#how-it-works "Direct link to How It Works")
-------------------------------------------------------------------------------------------------------------------------
Configuration profiles can have their own:
* API providers (OpenAI, Anthropic, OpenRouter, Glama, etc.)
* API keys and authentication details
* Model selections (o3-mini-high, Claude 3.7 Sonnet, DeepSeek R1, etc.)
* [Temperature settings](https://kilocode.ai/docs/features/model-temperature)
for controlling response randomness
* Thinking budgets
* Provider-specific settings
Note that available settings vary by provider and model. Each provider offers different configuration options, and even within the same provider, different models may support different parameter ranges or features.
Creating and Managing Profiles[](https://kilocode.ai/docs/features/api-configuration-profiles#creating-and-managing-profiles "Direct link to Creating and Managing Profiles")
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
### Creating a Profile[](https://kilocode.ai/docs/features/api-configuration-profiles#creating-a-profile "Direct link to Creating a Profile")
1. Open Settings by clicking the gear icon → Providers
2. Click the "+" button next to the profile selector

3. Enter a name for your new profile

4. Configure the profile settings:
* Select your API provider

* Enter API key

* Choose a model

* Adjust model parameters

### Switching Profiles[](https://kilocode.ai/docs/features/api-configuration-profiles#switching-profiles "Direct link to Switching Profiles")
Switch profiles in two ways:
1. From Settings panel: Select a different profile from the dropdown

2. During chat: Access the API Configuration dropdown in the chat interface

### Pinning and Sorting Profiles[](https://kilocode.ai/docs/features/api-configuration-profiles#pinning-and-sorting-profiles "Direct link to Pinning and Sorting Profiles")
The API configuration dropdown now supports pinning your favorite profiles for quicker access:
1. Hover over any profile in the dropdown to reveal the pin icon
2. Click the pin icon to add the profile to your pinned list
3. Pinned profiles appear at the top of the dropdown, sorted alphabetically
4. Unpinned profiles appear below a separator, also sorted alphabetically
5. You can unpin a profile by clicking the same icon again

This feature makes it easier to navigate between commonly used profiles, especially when you have many configurations.
### Editing and Deleting Profiles[](https://kilocode.ai/docs/features/api-configuration-profiles#editing-and-deleting-profiles "Direct link to Editing and Deleting Profiles")

* Select the profile in Settings to modify any settings
* Click the pencil icon to rename a profile
* Click the trash icon to delete a profile (you cannot delete the only remaining profile)
Linking Profiles to Modes[](https://kilocode.ai/docs/features/api-configuration-profiles#linking-profiles-to-modes "Direct link to Linking Profiles to Modes")
----------------------------------------------------------------------------------------------------------------------------------------------------------------
In the Prompts tab, you can explicitly associate a specific Configuration Profile with each Mode. The system also automatically remembers which profile you last used with each mode, making your workflow more efficient.

Security Note[](https://kilocode.ai/docs/features/api-configuration-profiles#security-note "Direct link to Security Note")
----------------------------------------------------------------------------------------------------------------------------
API keys are stored securely in VSCode's Secret Storage and are never exposed in plain text.
Related Features[](https://kilocode.ai/docs/features/api-configuration-profiles#related-features "Direct link to Related Features")
-------------------------------------------------------------------------------------------------------------------------------------
* Works with [custom modes](https://kilocode.ai/docs/features/custom-modes)
you create
* Integrates with [local models](https://kilocode.ai/docs/advanced-usage/local-models)
for offline work
* Supports [temperature settings](https://kilocode.ai/docs/features/model-temperature)
per mode
* Enhances cost management with [rate limits and usage tracking](https://kilocode.ai/docs/advanced-usage/rate-limits-costs)
* [How It Works](https://kilocode.ai/docs/features/api-configuration-profiles#how-it-works)
* [Creating and Managing Profiles](https://kilocode.ai/docs/features/api-configuration-profiles#creating-and-managing-profiles)
* [Creating a Profile](https://kilocode.ai/docs/features/api-configuration-profiles#creating-a-profile)
* [Switching Profiles](https://kilocode.ai/docs/features/api-configuration-profiles#switching-profiles)
* [Pinning and Sorting Profiles](https://kilocode.ai/docs/features/api-configuration-profiles#pinning-and-sorting-profiles)
* [Editing and Deleting Profiles](https://kilocode.ai/docs/features/api-configuration-profiles#editing-and-deleting-profiles)
* [Linking Profiles to Modes](https://kilocode.ai/docs/features/api-configuration-profiles#linking-profiles-to-modes)
* [Security Note](https://kilocode.ai/docs/features/api-configuration-profiles#security-note)
* [Related Features](https://kilocode.ai/docs/features/api-configuration-profiles#related-features)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Fapi-configuration-profiles)
---
# Custom Modes | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/custom-modes#__docusaurus_skipToContent_fallback)
On this page
Kilo Code allows you to create **custom modes** to tailor Kilo's behavior to specific tasks or workflows. Custom modes can be either **global** (available across all projects) or **project-specific** (defined within a single project).
Why Use Custom Modes?[](https://kilocode.ai/docs/features/custom-modes#why-use-custom-modes "Direct link to Why Use Custom Modes?")
-------------------------------------------------------------------------------------------------------------------------------------
* **Specialization:** Create modes optimized for specific tasks, like "Documentation Writer," "Test Engineer," or "Refactoring Expert"
* **Safety:** Restrict a mode's access to sensitive files or commands. For example, a "Review Mode" could be limited to read-only operations
* **Experimentation:** Safely experiment with different prompts and configurations without affecting other modes
* **Team Collaboration:** Share custom modes with your team to standardize workflows

_Kilo Code's interface for creating and managing custom modes._
What's Included in a Custom Mode?[](https://kilocode.ai/docs/features/custom-modes#whats-included-in-a-custom-mode "Direct link to What's Included in a Custom Mode?")
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Custom modes allow you to define:
* **A unique name and slug:** For easy identification
* **A role definition:** Placed at the beginning of the system prompt, this defines Kilo's core expertise and personality for the mode. This placement is crucial as it shapes Kilo's fundamental understanding and approach to tasks
* **Custom instructions:** Added at the end of the system prompt, these provide specific guidelines that modify or refine Kilo's behavior. Unlike `.clinerules` files (which only add rules at the end), this structured placement of role and instructions allows for more nuanced control over Kilo's responses
* **Allowed tools:** Which Kilo Code tools the mode can use (e.g., read files, write files, execute commands)
* **File restrictions:** (Optional) Limit file access to specific file types or patterns (e.g., only allow editing `.md` files)
Custom Mode Configuration (JSON Format)[](https://kilocode.ai/docs/features/custom-modes#custom-mode-configuration-json-format "Direct link to Custom Mode Configuration (JSON Format)")
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Both global and project-specific configurations use the same JSON format. Each configuration file contains a `customModes` array of mode definitions:
{ "customModes": [ { "slug": "mode-name", "name": "Mode Display Name", "roleDefinition": "Mode's role and capabilities", "groups": ["read", "edit"], "customInstructions": "Additional guidelines" } ]}
### Required Properties[](https://kilocode.ai/docs/features/custom-modes#required-properties "Direct link to Required Properties")
#### `slug`[](https://kilocode.ai/docs/features/custom-modes#slug "Direct link to slug")
* A unique identifier for the mode
* Use lowercase letters, numbers, and hyphens
* Keep it short and descriptive
* Example: `"docs-writer"`, `"test-engineer"`
#### `name`[](https://kilocode.ai/docs/features/custom-modes#name "Direct link to name")
* The display name shown in the UI
* Can include spaces and proper capitalization
* Example: `"Documentation Writer"`, `"Test Engineer"`
#### `roleDefinition`[](https://kilocode.ai/docs/features/custom-modes#roledefinition "Direct link to roledefinition")
* Detailed description of the mode's role and capabilities
* Defines Kilo's expertise and personality for this mode
* Example: `"You are a technical writer specializing in clear documentation"`
#### `groups`[](https://kilocode.ai/docs/features/custom-modes#groups "Direct link to groups")
* Array of allowed tool groups
* Available groups: `"read"`, `"edit"`, `"browser"`, `"command"`, `"mcp"`
* Can include file restrictions for the `"edit"` group
##### File Restrictions Format[](https://kilocode.ai/docs/features/custom-modes#file-restrictions-format "Direct link to File Restrictions Format")
["edit", { "fileRegex": "\\.md$", "description": "Markdown files only"}]
### Understanding File Restrictions[](https://kilocode.ai/docs/features/custom-modes#understanding-file-restrictions "Direct link to Understanding File Restrictions")
The `fileRegex` property uses regular expressions to control which files a mode can edit:
* `\\.md$` - Match files ending in ".md"
* `\\.(test|spec)\\.(js|ts)$` - Match test files (e.g., "component.test.js")
* `\\.(js|ts)$` - Match JavaScript and TypeScript files
Common regex patterns:
* `\\.` - Match a literal dot
* `(a|b)` - Match either "a" or "b"
* `$` - Match the end of the filename
[Learn more about regular expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions)
### Optional Properties[](https://kilocode.ai/docs/features/custom-modes#optional-properties "Direct link to Optional Properties")
#### `customInstructions`[](https://kilocode.ai/docs/features/custom-modes#custominstructions "Direct link to custominstructions")
* Additional behavioral guidelines for the mode
* Example: `"Focus on explaining concepts and providing examples"`
#### `apiConfiguration`[](https://kilocode.ai/docs/features/custom-modes#apiconfiguration "Direct link to apiconfiguration")
* Optional settings to customize the AI model and parameters for this mode
* Allows optimizing the model selection for specific tasks
* Example: `{"model": "gpt-4", "temperature": 0.2}`
### Mode-Specific Custom Instructions Files[](https://kilocode.ai/docs/features/custom-modes#mode-specific-custom-instructions-files "Direct link to Mode-Specific Custom Instructions Files")
In addition to the `customInstructions` property in JSON, you can use a dedicated file for mode-specific instructions:
1. Create a file named `.clinerules-{mode-slug}` in your workspace root
* Replace `{mode-slug}` with your mode's slug (e.g., `.clinerules-docs-writer`)
2. Add your custom instructions to this file
3. Kilo Code will automatically apply these instructions to the specified mode
This approach is particularly useful for:
* Keeping lengthy instructions separate from your mode configuration
* Managing instructions with version control
* Allowing non-technical team members to modify instructions without editing JSON
Note: If both `.clinerules-{mode-slug}` and the `customInstructions` property exist, they will be combined, with the file contents appended after the JSON property.
Configuration Precedence[](https://kilocode.ai/docs/features/custom-modes#configuration-precedence "Direct link to Configuration Precedence")
-----------------------------------------------------------------------------------------------------------------------------------------------
Mode configurations are applied in this order:
1. Project-level mode configurations (from `.kilocodemodes`)
2. Global mode configurations (from `custom_modes.yaml`)
3. Default mode configurations
This means that project-specific configurations will override global configurations, which in turn override default configurations.
Creating Custom Modes[](https://kilocode.ai/docs/features/custom-modes#creating-custom-modes "Direct link to Creating Custom Modes")
--------------------------------------------------------------------------------------------------------------------------------------
You have three options for creating custom modes:
### 1\. Ask Kilo! (Recommended)[](https://kilocode.ai/docs/features/custom-modes#1-ask-kilo-recommended "Direct link to 1. Ask Kilo! (Recommended)")
You can quickly create a basic custom mode by asking Kilo Code to do it for you. For example:
Create a new mode called "Documentation Writer". It should only be able to read files and write Markdown files.
Kilo Code will guide you through the process. However, for fine-tuning modes or making specific adjustments, you'll want to use the Prompts tab or manual configuration methods described below.
info
#### Custom Mode Creation Settings[](https://kilocode.ai/docs/features/custom-modes#custom-mode-creation-settings "Direct link to Custom Mode Creation Settings")
When enabled, Kilo allows you to create custom modes using prompts like 'Make me a custom mode that...'. Disabling this reduces your system prompt by about 700 tokens when this feature isn't needed. When disabled you can still manually create custom modes using the + button above or by editing the related config JSON.

You can find this setting within the prompt settings by clicking the icon in the Kilo Code top menu bar.
### 2\. Using the Prompts Tab[](https://kilocode.ai/docs/features/custom-modes#2-using-the-prompts-tab "Direct link to 2. Using the Prompts Tab")
1. **Open Prompts Tab:** Click the icon in the Kilo Code top menu bar
2. **Create New Mode:** Click the button to the right of the Modes heading
3. **Fill in Fields:**

_The custom mode creation interface showing fields for name, slug, save location, role definition, available tools, and custom instructions._
* **Name:** Enter a display name for the mode
* **Slug:** Enter a lowercase identifier (letters, numbers, and hyphens only)
* **Save Location:** Choose Global (via `custom_modes.yaml`, available across all workspaces) or Project-specific (via `.kilocodemodes` file in project root)
* **Role Definition:** Define Kilo's expertise and personality for this mode (appears at the start of the system prompt)
* **Available Tools:** Select which tools this mode can use
* **Custom Instructions:** (Optional) Add behavioral guidelines specific to this mode (appears at the end of the system prompt)
4. **Create Mode:** Click the "Create Mode" button to save your new mode
Note: File type restrictions can only be added through manual configuration.
### 3\. Manual Configuration[](https://kilocode.ai/docs/features/custom-modes#3-manual-configuration "Direct link to 3. Manual Configuration")
You can configure custom modes by editing JSON files through the Prompts tab:
Both global and project-specific configurations can be edited through the Prompts tab:
1. **Open Prompts Tab:** Click the icon in the Kilo Code top menu bar
2. **Access Settings Menu:** Click the button to the right of the Modes heading
3. **Choose Configuration:**
* Select "Edit Global Modes" to edit `custom_modes.yaml` (available across all workspaces)
* Select "Edit Project Modes" to edit `.kilocodemodes` file (in project root)
4. **Edit Configuration:** Modify the JSON file that opens
5. **Save Changes:** Kilo Code will automatically detect the changes
Example Configurations[](https://kilocode.ai/docs/features/custom-modes#example-configurations "Direct link to Example Configurations")
-----------------------------------------------------------------------------------------------------------------------------------------
Each example shows different aspects of mode configuration:
### Basic Documentation Writer[](https://kilocode.ai/docs/features/custom-modes#basic-documentation-writer "Direct link to Basic Documentation Writer")
{ "customModes": [{ "slug": "docs-writer", "name": "Documentation Writer", "roleDefinition": "You are a technical writer specializing in clear documentation", "groups": [ "read", ["edit", { "fileRegex": "\\.md$", "description": "Markdown files only" }] ], "customInstructions": "Focus on clear explanations and examples" }]}
### Test Engineer with File Restrictions[](https://kilocode.ai/docs/features/custom-modes#test-engineer-with-file-restrictions "Direct link to Test Engineer with File Restrictions")
{ "customModes": [{ "slug": "test-engineer", "name": "Test Engineer", "roleDefinition": "You are a test engineer focused on code quality", "groups": [ "read", ["edit", { "fileRegex": "\\.(test|spec)\\.(js|ts)$", "description": "Test files only" }] ] }]}
### Project-Specific Mode Override[](https://kilocode.ai/docs/features/custom-modes#project-specific-mode-override "Direct link to Project-Specific Mode Override")
{ "customModes": [{ "slug": "code", "name": "Code (Project-Specific)", "roleDefinition": "You are a software engineer with project-specific constraints", "groups": [ "read", ["edit", { "fileRegex": "\\.(js|ts)$", "description": "JS/TS files only" }] ], "customInstructions": "Focus on project-specific JS/TS development" }]}
By following these instructions, you can create and manage custom modes to enhance your workflow with Kilo Code.
Understanding Regex in Custom Modes[](https://kilocode.ai/docs/features/custom-modes#understanding-regex-in-custom-modes "Direct link to Understanding Regex in Custom Modes")
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Regex patterns in custom modes let you precisely control which files Kilo can edit:
### Basic Syntax[](https://kilocode.ai/docs/features/custom-modes#basic-syntax "Direct link to Basic Syntax")
When you specify `fileRegex` in a custom mode, you're creating a pattern that file paths must match:
["edit", { "fileRegex": "\\.md$", "description": "Markdown files only" }]
### Important Rules[](https://kilocode.ai/docs/features/custom-modes#important-rules "Direct link to Important Rules")
* **Double Backslashes:** In JSON, backslashes must be escaped with another backslash. So `\.md$` becomes `\\.md$`
* **Path Matching:** Patterns match against the full file path, not just the filename
* **Case Sensitivity:** Regex patterns are case-sensitive by default
### Common Pattern Examples[](https://kilocode.ai/docs/features/custom-modes#common-pattern-examples "Direct link to Common Pattern Examples")
| Pattern | Matches | Doesn't Match |
| --- | --- | --- |
| `\\.md$` | `readme.md`, `docs/guide.md` | `script.js`, `readme.md.bak` |
| `^src/.*` | `src/app.js`, `src/components/button.tsx` | `lib/utils.js`, `test/src/mock.js` |
| `\\.(css\|scss)$` | `styles.css`, `theme.scss` | `styles.less`, `styles.css.map` |
| `docs/.*\\.md$` | `docs/guide.md`, `docs/api/reference.md` | `guide.md`, `src/docs/notes.md` |
| `^(?!.*(test\|spec)).*\\.js$` | `app.js`, `utils.js` | `app.test.js`, `utils.spec.js` |
### Pattern Building Blocks[](https://kilocode.ai/docs/features/custom-modes#pattern-building-blocks "Direct link to Pattern Building Blocks")
* `\\.` - Match a literal dot (period)
* `$` - Match the end of the string
* `^` - Match the beginning of the string
* `.*` - Match any character (except newline) zero or more times
* `(a|b)` - Match either "a" or "b"
* `(?!...)` - Negative lookahead (exclude matches)
### Testing Your Patterns[](https://kilocode.ai/docs/features/custom-modes#testing-your-patterns "Direct link to Testing Your Patterns")
Before applying a regex pattern to a custom mode:
1. Test it on sample file paths to ensure it matches what you expect
2. Remember that in JSON, each backslash needs to be doubled (`\d` becomes `\\d`)
3. Start with simpler patterns and build complexity gradually
tip
### Let Kilo Build Your Regex Patterns[](https://kilocode.ai/docs/features/custom-modes#let-kilo-build-your-regex-patterns "Direct link to Let Kilo Build Your Regex Patterns")
Instead of writing complex regex patterns manually, you can ask Kilo to create them for you! Simply describe which files you want to include or exclude:
Create a regex pattern that matches JavaScript files but excludes test files
Kilo will generate the appropriate pattern with proper escaping for JSON configuration.
Community Gallery[](https://kilocode.ai/docs/features/custom-modes#community-gallery "Direct link to Community Gallery")
--------------------------------------------------------------------------------------------------------------------------
Ready to explore more? Check out the [Show and Tell](https://github.com/Kilo-Org/kilocode/discussions/categories/show-and-tell)
to discover and share custom modes created by the community!
* [Why Use Custom Modes?](https://kilocode.ai/docs/features/custom-modes#why-use-custom-modes)
* [What's Included in a Custom Mode?](https://kilocode.ai/docs/features/custom-modes#whats-included-in-a-custom-mode)
* [Custom Mode Configuration (JSON Format)](https://kilocode.ai/docs/features/custom-modes#custom-mode-configuration-json-format)
* [Required Properties](https://kilocode.ai/docs/features/custom-modes#required-properties)
* [Understanding File Restrictions](https://kilocode.ai/docs/features/custom-modes#understanding-file-restrictions)
* [Optional Properties](https://kilocode.ai/docs/features/custom-modes#optional-properties)
* [Mode-Specific Custom Instructions Files](https://kilocode.ai/docs/features/custom-modes#mode-specific-custom-instructions-files)
* [Configuration Precedence](https://kilocode.ai/docs/features/custom-modes#configuration-precedence)
* [Creating Custom Modes](https://kilocode.ai/docs/features/custom-modes#creating-custom-modes)
* [1\. Ask Kilo! (Recommended)](https://kilocode.ai/docs/features/custom-modes#1-ask-kilo-recommended)
* [2\. Using the Prompts Tab](https://kilocode.ai/docs/features/custom-modes#2-using-the-prompts-tab)
* [3\. Manual Configuration](https://kilocode.ai/docs/features/custom-modes#3-manual-configuration)
* [Example Configurations](https://kilocode.ai/docs/features/custom-modes#example-configurations)
* [Basic Documentation Writer](https://kilocode.ai/docs/features/custom-modes#basic-documentation-writer)
* [Test Engineer with File Restrictions](https://kilocode.ai/docs/features/custom-modes#test-engineer-with-file-restrictions)
* [Project-Specific Mode Override](https://kilocode.ai/docs/features/custom-modes#project-specific-mode-override)
* [Understanding Regex in Custom Modes](https://kilocode.ai/docs/features/custom-modes#understanding-regex-in-custom-modes)
* [Basic Syntax](https://kilocode.ai/docs/features/custom-modes#basic-syntax)
* [Important Rules](https://kilocode.ai/docs/features/custom-modes#important-rules)
* [Common Pattern Examples](https://kilocode.ai/docs/features/custom-modes#common-pattern-examples)
* [Pattern Building Blocks](https://kilocode.ai/docs/features/custom-modes#pattern-building-blocks)
* [Testing Your Patterns](https://kilocode.ai/docs/features/custom-modes#testing-your-patterns)
* [Let Kilo Build Your Regex Patterns](https://kilocode.ai/docs/features/custom-modes#let-kilo-build-your-regex-patterns)
* [Community Gallery](https://kilocode.ai/docs/features/custom-modes#community-gallery)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Fcustom-modes)
---
# Auto-Approving Actions | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/auto-approving-actions#__docusaurus_skipToContent_fallback)
On this page
> ⚠️ **SECURITY WARNING:** Auto-approve settings bypass confirmation prompts, giving Kilo Code direct access to your system. This can result in **data loss, file corruption, or worse**. Command line access is particularly dangerous, as it can potentially execute harmful operations that could damage your system or compromise security. Only enable auto-approval for actions you fully trust.
Auto-approve settings speed up your workflow by eliminating repetitive confirmation prompts, but they significantly increase security risks.
Quick Start Guide[](https://kilocode.ai/docs/features/auto-approving-actions#quick-start-guide "Direct link to Quick Start Guide")
------------------------------------------------------------------------------------------------------------------------------------
1. Click the Auto-Approve Toolbar above the chat input
2. Select which actions Kilo Code can perform without asking permission
3. Use the master toggle (leftmost checkbox) to quickly enable/disable all permissions
Auto-Approve Toolbar[](https://kilocode.ai/docs/features/auto-approving-actions#auto-approve-toolbar "Direct link to Auto-Approve Toolbar")
---------------------------------------------------------------------------------------------------------------------------------------------

_Prompt box and Auto-Approve Toolbar showing enabled permissions_
Click the toolbar to expand it and configure individual permissions:

_Prompt text box and Expanded toolbar with all options_
### Available Permissions[](https://kilocode.ai/docs/features/auto-approving-actions#available-permissions "Direct link to Available Permissions")
| Permission | What it does | Risk level |
| --- | --- | --- |
| **Read files and directories** | Lets Kilo Code access files without asking | Medium |
| **Edit files** | Lets Kilo Code modify files without asking | **High** |
| **Execute approved commands** | Runs whitelisted terminal commands automatically | **High** |
| **Use the browser** | Allows headless browser interaction | Medium |
| **Use MCP servers** | Lets Kilo Code use configured MCP services | Medium-High |
| **Switch modes** | Changes between Kilo Code modes automatically | Low |
| **Create & complete subtasks** | Manages subtasks without confirmation | Low |
| **Retry failed requests** | Automatically retries failed API requests | Low |
| **Answer follow-up questions** | Selects default answer for follow-up questions | Low |
| **Update todo list** | Automatically updates task progress | Low |
Master Toggle for Quick Control[](https://kilocode.ai/docs/features/auto-approving-actions#master-toggle-for-quick-control "Direct link to Master Toggle for Quick Control")
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The leftmost checkbox works as a master toggle:

_Master toggle (checkbox) controls all auto-approve permissions at once_
Use the master toggle when:
* Working in sensitive code (turn off)
* Doing rapid development (turn on)
* Switching between exploration and editing tasks
Advanced Settings Panel[](https://kilocode.ai/docs/features/auto-approving-actions#advanced-settings-panel "Direct link to Advanced Settings Panel")
------------------------------------------------------------------------------------------------------------------------------------------------------
The settings panel provides detailed control with important security context:
> **Allow Kilo Code to automatically perform operations without requiring approval. Enable these settings only if you fully trust the AI and understand the associated security risks.**
To access these settings:
1. Click in the top-right corner
2. Navigate to Auto-Approve Settings

_Complete settings panel view_
### Read Operations[](https://kilocode.ai/docs/features/auto-approving-actions#read-operations "Direct link to Read Operations")
Read Operations

**Setting:** "Always approve read-only operations"
**Description:** "When enabled, Kilo Code will automatically view directory contents and read files without requiring you to click the Approve button."
**Risk level:** Medium
While this setting only allows reading files (not modifying them), it could potentially expose sensitive data. Still recommended as a starting point for most users, but be mindful of what files Kilo Code can access.
### Write Operations[](https://kilocode.ai/docs/features/auto-approving-actions#write-operations "Direct link to Write Operations")
Write Operations

**Setting:** "Always approve write operations"
**Description:** "Automatically create and edit files without requiring approval"
**Delay slider:** "Delay after writes to allow diagnostics to detect potential problems" (Default: 1000ms)
**Risk level:** High
This setting allows Kilo Code to modify your files without confirmation. The delay timer is crucial:
* Higher values (2000ms+): Recommended for complex projects where diagnostics take longer
* Default (1000ms): Suitable for most projects
* Lower values: Use only when speed is critical and you're in a controlled environment
* Zero: No delay for diagnostics (not recommended for critical code)
#### Write Delay & Problems Pane Integration[](https://kilocode.ai/docs/features/auto-approving-actions#write-delay--problems-pane-integration "Direct link to Write Delay & Problems Pane Integration")

_VSCode Problems pane that Kilo Code checks during the write delay_
When you enable auto-approval for writing files, the delay timer works with VSCode's Problems pane:
1. Kilo Code makes a change to your file
2. VSCode's diagnostic tools analyze the change
3. The Problems pane updates with any errors or warnings
4. Kilo Code notices these issues before continuing
This works like a human developer pausing to check for errors after changing code. You can adjust the delay time based on:
* Project complexity
* Language server speed
* How important error detection is for your workflow
### Browser Actions[](https://kilocode.ai/docs/features/auto-approving-actions#browser-actions "Direct link to Browser Actions")
Browser Actions

**Setting:** "Always approve browser actions"
**Description:** "Automatically perform browser actions without requiring approval"
**Note:** "Only applies when the model supports computer use"
**Risk level:** Medium
Allows Kilo Code to control a headless browser without confirmation. This can include:
* Opening websites
* Navigating pages
* Interacting with web elements
Consider the security implications of allowing automated browser access.
### API Requests[](https://kilocode.ai/docs/features/auto-approving-actions#api-requests "Direct link to API Requests")
API Requests

**Setting:** "Always retry failed API requests"
**Description:** "Automatically retry failed API requests when server returns an error response"
**Delay slider:** "Delay before retrying the request" (Default: 5s)
**Risk level:** Low
This setting automatically retries API calls when they fail. The delay controls how long Kilo Code waits before trying again:
* Longer delays are gentler on API rate limits
* Shorter delays give faster recovery from transient errors
### MCP Tools[](https://kilocode.ai/docs/features/auto-approving-actions#mcp-tools "Direct link to MCP Tools")
MCP Tools

**Setting:** "Always approve MCP tools"
**Description:** "Enable auto-approval of individual MCP tools in the MCP Servers view (requires both this setting and the tool's individual 'Always allow' checkbox)"
**Risk level:** Medium-High (depends on configured MCP tools)
This setting works in conjunction with individual tool permissions in the MCP Servers view. Both this global setting and the tool-specific permission must be enabled for auto-approval.
### Mode Switching[](https://kilocode.ai/docs/features/auto-approving-actions#mode-switching "Direct link to Mode Switching")
Mode Switching

**Setting:** "Always approve mode switching"
**Description:** "Automatically switch between different modes without requiring approval"
**Risk level:** Low
Allows Kilo Code to change between different modes (Code, Architect, etc.) without asking for permission. This primarily affects the AI's behavior rather than system access.
### Subtasks[](https://kilocode.ai/docs/features/auto-approving-actions#subtasks "Direct link to Subtasks")
Subtasks

**Setting:** "Always approve creation & completion of subtasks"
**Description:** "Allow creation and completion of subtasks without requiring approval"
**Risk level:** Low
Enables Kilo Code to create and complete subtasks automatically. This relates to workflow organization rather than system access.
### Command Execution[](https://kilocode.ai/docs/features/auto-approving-actions#command-execution "Direct link to Command Execution")
Command Execution

**Setting:** "Always approve allowed execute operations"
**Description:** "Automatically execute allowed terminal commands without requiring approval"
**Command management:** "Command prefixes that can be auto-executed when 'Always approve execute operations' is enabled. Add \* to allow all commands (use with caution)."
**Risk level:** High
This setting allows terminal command execution with controls. While risky, the whitelist feature limits what commands can run. Important security features:
* Whitelist specific command prefixes (recommended)
* Never use \* wildcard in production or with sensitive data
* Consider security implications of each allowed command
* Always verify commands that interact with external systems
**Interface elements:**
* Text field to enter command prefixes (e.g., 'git')
* "Add" button to add new prefixes
* Clickable command buttons with X to remove them
### Follow-Up Questions[](https://kilocode.ai/docs/features/auto-approving-actions#follow-up-questions "Direct link to Follow-Up Questions")
Follow-Up Questions (Risk: Low)
**Setting:** `Always default answer for follow-up questions`
**Description:** Automatically selects the first AI-suggested answer for a follow-up question after a configurable timeout. This speeds up your workflow by letting Roo proceed without manual intervention.
**Visual countdown:** When enabled, a countdown timer appears on the first suggestion button, showing the remaining time before auto-selection. The timer is displayed as a circular progress indicator that depletes as time passes.
**Timeout slider:** Use the slider to set the wait time from 1 to 300 seconds (Default: 60s).
**Override options:** You can cancel the auto-selection at any time by:
* Clicking a different suggestion
* Editing any suggestion
* Typing your own response
* Clicking the timer to pause it
**Risk level:** Low
**Use cases:**
* Overnight runs where you want Roo to continue working
* Repetitive tasks where the default suggestions are usually correct
* Testing workflows where interaction isn't critical
### Update Todo List[](https://kilocode.ai/docs/features/auto-approving-actions#update-todo-list "Direct link to Update Todo List")
Update Todo List (Risk: Low)
**Setting:** "Always approve todo list updates"
**Description:** "Automatically update the to-do list without requiring approval"
**Risk level:** Low
This setting allows Roo to automatically update task progress and todo lists during work sessions. This includes:
* Marking tasks as completed
* Adding new discovered tasks
* Updating task status (pending, in progress, completed)
* Reorganizing task priorities
**Benefits:**
* Maintains real-time task progress visibility
* Reduces interruptions during multi-step workflows
* Keeps project status accurately reflected
* Helps track complex task dependencies
**Use cases:**
* Long-running development sessions
* Multi-step refactoring projects
* Complex debugging workflows
* Feature implementation with many subtasks
This is particularly useful when combined with the Subtasks permission, as it allows Roo to maintain a complete picture of project progress without constant approval requests.
* [Quick Start Guide](https://kilocode.ai/docs/features/auto-approving-actions#quick-start-guide)
* [Auto-Approve Toolbar](https://kilocode.ai/docs/features/auto-approving-actions#auto-approve-toolbar)
* [Available Permissions](https://kilocode.ai/docs/features/auto-approving-actions#available-permissions)
* [Master Toggle for Quick Control](https://kilocode.ai/docs/features/auto-approving-actions#master-toggle-for-quick-control)
* [Advanced Settings Panel](https://kilocode.ai/docs/features/auto-approving-actions#advanced-settings-panel)
* [Read Operations](https://kilocode.ai/docs/features/auto-approving-actions#read-operations)
* [Write Operations](https://kilocode.ai/docs/features/auto-approving-actions#write-operations)
* [Browser Actions](https://kilocode.ai/docs/features/auto-approving-actions#browser-actions)
* [API Requests](https://kilocode.ai/docs/features/auto-approving-actions#api-requests)
* [MCP Tools](https://kilocode.ai/docs/features/auto-approving-actions#mcp-tools)
* [Mode Switching](https://kilocode.ai/docs/features/auto-approving-actions#mode-switching)
* [Subtasks](https://kilocode.ai/docs/features/auto-approving-actions#subtasks)
* [Command Execution](https://kilocode.ai/docs/features/auto-approving-actions#command-execution)
* [Follow-Up Questions](https://kilocode.ai/docs/features/auto-approving-actions#follow-up-questions)
* [Update Todo List](https://kilocode.ai/docs/features/auto-approving-actions#update-todo-list)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Fauto-approving-actions)
---
# Experimental Features | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/experimental/experimental-features#__docusaurus_skipToContent_fallback)
On this page
Kilo Code includes experimental features that are still under development. These features may be unstable, change significantly, or be removed in future versions. Use them with caution and be aware that they may not work as expected.
**Warning:** Experimental features may have unexpected behavior, including potential data loss or security vulnerabilities. Enable them at your own risk.
Enabling Experimental Features[](https://kilocode.ai/docs/features/experimental/experimental-features#enabling-experimental-features "Direct link to Enabling Experimental Features")
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
To enable or disable experimental features:
1. Open the Kilo Code settings ( icon in the top right corner).
2. Go to the "Advanced Settings" section.
3. Find the "Experimental Features" section.
4. Check or uncheck the boxes for the features you want to enable or disable.
5. Click "Done" to save your changes.
Current Experimental Features[](https://kilocode.ai/docs/features/experimental/experimental-features#current-experimental-features "Direct link to Current Experimental Features")
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The following experimental features are currently available:
Autocomplete[](https://kilocode.ai/docs/features/experimental/experimental-features#autocomplete "Direct link to Autocomplete")
---------------------------------------------------------------------------------------------------------------------------------
When enabled, Kilo Code will provide inline code suggestions as you type. Currently this requires the Kilo Code API Provider in order to use it.
Concurrent file edits[](https://kilocode.ai/docs/features/experimental/experimental-features#concurrent-file-edits "Direct link to Concurrent file edits")
------------------------------------------------------------------------------------------------------------------------------------------------------------
When enabled, Kilo Code can edit multiple files in a single request. When disabled, Kilo Code must edit one file at a time. Disabling this can help when working with less capable models or when you want more control over file modifications.
### Power Steering[](https://kilocode.ai/docs/features/experimental/experimental-features#power-steering "Direct link to Power Steering")
When enabled, Kilo Code will remind the model about the details of its current mode definition more frequently. This will lead to stronger adherence to role definitions and custom instructions, but will use more tokens per message.
Providing Feedback[](https://kilocode.ai/docs/features/experimental/experimental-features#providing-feedback "Direct link to Providing Feedback")
---------------------------------------------------------------------------------------------------------------------------------------------------
If you encounter any issues with experimental features, or if you have suggestions for improvements, please report them on the [Kilo Code Code GitHub Issues page](https://github.com/Kilo-Org/kilocode)
or join our [Discord server](https://kilo.love/discord)
where we have channels dedciated to many experimental features.
Your feedback is valuable and helps us improve Kilo Code!
* [Enabling Experimental Features](https://kilocode.ai/docs/features/experimental/experimental-features#enabling-experimental-features)
* [Current Experimental Features](https://kilocode.ai/docs/features/experimental/experimental-features#current-experimental-features)
* [Autocomplete](https://kilocode.ai/docs/features/experimental/experimental-features#autocomplete)
* [Concurrent file edits](https://kilocode.ai/docs/features/experimental/experimental-features#concurrent-file-edits)
* [Power Steering](https://kilocode.ai/docs/features/experimental/experimental-features#power-steering)
* [Providing Feedback](https://kilocode.ai/docs/features/experimental/experimental-features#providing-feedback)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Fexperimental%2Fexperimental-features)
---
# Checkpoints | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/checkpoints#__docusaurus_skipToContent_fallback)
On this page
Checkpoints automatically version your workspace files during Kilo Code tasks, enabling non-destructive exploration of AI suggestions and easy recovery from unwanted changes.
Checkpoints let you:
* Safely experiment with AI-suggested changes
* Easily recover from undesired modifications
* Compare different implementation approaches
* Revert to previous project states without losing work
Important Notes
* **Checkpoints are enabled by default.**
* **Git must be installed** for checkpoints to function - [see installation instructions](https://kilocode.ai/docs/features/checkpoints#git-installation)
* No GitHub account or repository is required
* No Git personal information configuration is needed
* The shadow Git repository operates independently from your project's existing Git configuration
Configuration Options[](https://kilocode.ai/docs/features/checkpoints#configuration-options "Direct link to Configuration Options")
-------------------------------------------------------------------------------------------------------------------------------------
Access checkpoint settings in Kilo Code settings under the "Checkpoints" section:
1. Open Settings by clicking the gear icon → Checkpoints
2. Check or uncheck the "Enable automatic checkpoints" checkbox

How Checkpoints Work[](https://kilocode.ai/docs/features/checkpoints#how-checkpoints-work "Direct link to How Checkpoints Work")
----------------------------------------------------------------------------------------------------------------------------------
Kilo Code captures snapshots of your project's state using a shadow Git repository, separate from your main version control system. These snapshots, called checkpoints, automatically record changes throughout your AI-assisted workflow—whenever tasks begin, files change, or commands run.
Checkpoints are stored as Git commits in the shadow repository, capturing:
* File content changes
* New files added
* Deleted files
* Renamed files
* Binary file changes
Working with Checkpoints[](https://kilocode.ai/docs/features/checkpoints#working-with-checkpoints "Direct link to Working with Checkpoints")
----------------------------------------------------------------------------------------------------------------------------------------------
Checkpoints are integrated directly into your workflow through the chat interface.
Checkpoints appear directly in your chat history in two forms:
* **Initial checkpoint** marks your starting project state

* **Regular checkpoints** appear after file modifications or command execution

Each checkpoint provides two primary functions:
### Viewing Differences[](https://kilocode.ai/docs/features/checkpoints#viewing-differences "Direct link to Viewing Differences")
To compare your current workspace with a previous checkpoint:
1. Locate the checkpoint in your chat history
2. Click the checkpoint's `View Differences` button

3. Review the differences in the comparison view:
* Added lines are highlighted in green
* Removed lines are highlighted in red
* Modified files are listed with detailed changes
* Renamed and moved files are tracked with their path changes
* New or deleted files are clearly marked

### Restoring Checkpoints[](https://kilocode.ai/docs/features/checkpoints#restoring-checkpoints "Direct link to Restoring Checkpoints")
To restore a project to a previous checkpoint state:
1. Locate the checkpoint in your chat history
2. Click the checkpoint's `Restore Checkpoint` button

3. Choose one of these restoration options:

* **Restore Files Only** - Reverts only workspace files to checkpoint state without modifying conversation history. Ideal for comparing alternative implementations while maintaining chat context, allowing you to seamlessly switch between different project states. This option does not require confirmation and lets you quickly switch between different implementations.
* **Restore Files & Task** - Reverts both workspace files AND removes all subsequent conversation messages. Use when you want to completely reset both your code and conversation back to the checkpoint's point in time. This option requires confirmation in a dialog as it cannot be undone.

### Limitations and Considerations[](https://kilocode.ai/docs/features/checkpoints#limitations-and-considerations "Direct link to Limitations and Considerations")
* **Scope**: Checkpoints only capture changes made during active Kilo Code tasks
* **External changes**: Modifications made outside of tasks (manual edits, other tools) aren't included
* **Large files**: Very large binary files may impact performance
* **Unsaved work**: Restoration will overwrite any unsaved changes in your workspace
Technical Implementation[](https://kilocode.ai/docs/features/checkpoints#technical-implementation "Direct link to Technical Implementation")
----------------------------------------------------------------------------------------------------------------------------------------------
### Checkpoint Architecture[](https://kilocode.ai/docs/features/checkpoints#checkpoint-architecture "Direct link to Checkpoint Architecture")
The checkpoint system consists of:
1. **Shadow Git Repository**: A separate Git repository created specifically for checkpoint tracking that functions as the persistent storage mechanism for checkpoint state.
2. **Checkpoint Service**: Handles Git operations and state management through:
* Repository initialization
* Checkpoint creation and storage
* Diff computation
* State restoration
3. **UI Components**: Interface elements displayed in the chat that enable interaction with checkpoints.
### Restoration Process[](https://kilocode.ai/docs/features/checkpoints#restoration-process "Direct link to Restoration Process")
When restoration executes, Kilo Code:
* Performs a hard reset to the specified checkpoint commit
* Copies all files from the shadow repository to your workspace
* Updates internal checkpoint tracking state
### Storage Type[](https://kilocode.ai/docs/features/checkpoints#storage-type "Direct link to Storage Type")
Checkpoints are task-scoped, meaning they are specific to a single task.
### Diff Computation[](https://kilocode.ai/docs/features/checkpoints#diff-computation "Direct link to Diff Computation")
Checkpoint comparison uses Git's underlying diff capabilities to produce structured file differences:
* Modified files show line-by-line changes
* Binary files are properly detected and handled
* Renamed and moved files are tracked correctly
* File creation and deletion are clearly identified
### File Exclusion and Ignore Patterns[](https://kilocode.ai/docs/features/checkpoints#file-exclusion-and-ignore-patterns "Direct link to File Exclusion and Ignore Patterns")
The checkpoint system uses intelligent file exclusion to track only relevant files:
#### Built-in Exclusions[](https://kilocode.ai/docs/features/checkpoints#built-in-exclusions "Direct link to Built-in Exclusions")
The system has comprehensive built-in exclusion patterns that automatically ignore:
* Build artifacts and dependency directories (`node_modules/`, `dist/`, `build/`)
* Media files and binary assets (images, videos, audio)
* Cache and temporary files (`.cache/`, `.tmp/`, `.bak`)
* Configuration files with sensitive information (`.env`)
* Large data files (archives, executables, binaries)
* Database files and logs
These patterns are written to the shadow repository's `.git/info/exclude` file during initialization.
#### .gitignore Support[](https://kilocode.ai/docs/features/checkpoints#gitignore-support "Direct link to .gitignore Support")
The checkpoint system respects `.gitignore` patterns in your workspace:
* Files excluded by `.gitignore` won't trigger checkpoint creation
* Excluded files won't appear in checkpoint diffs
* Standard Git ignore rules apply when staging file changes
#### .kilocodeignore Behavior[](https://kilocode.ai/docs/features/checkpoints#kilocodeignore-behavior "Direct link to .kilocodeignore Behavior")
The `.kilocodeignore` file (which controls AI access to files) is separate from checkpoint tracking:
* Files excluded by `.kilocodeignore` but not by `.gitignore` will still be checkpointed
* Changes to AI-inaccessible files can still be restored through checkpoints
This separation is intentional, as `.kilocodeignore` limits which files the AI can access, not which files should be tracked for version history.
#### Nested Git Repositories[](https://kilocode.ai/docs/features/checkpoints#nested-git-repositories "Direct link to Nested Git Repositories")
The checkpoint system includes special handling for nested Git repositories:
* Temporarily renames nested `.git` directories to `.git_disabled` during operations
* Restores them after operations complete
* Allows proper tracking of files in nested repositories
* Ensures nested repositories remain functional and unaffected
### Concurrency Control[](https://kilocode.ai/docs/features/checkpoints#concurrency-control "Direct link to Concurrency Control")
Operations are queued to prevent concurrent Git operations that might corrupt repository state. This ensures that rapid checkpoint operations complete safely even when requested in quick succession.
Git Installation[](https://kilocode.ai/docs/features/checkpoints#git-installation "Direct link to Git Installation")
----------------------------------------------------------------------------------------------------------------------
Checkpoints require Git to be installed on your system. The implementation uses the `simple-git` library, which relies on Git command-line tools to create and manage shadow repositories.
### macOS[](https://kilocode.ai/docs/features/checkpoints#macos "Direct link to macOS")
1. **Install with Homebrew (recommended)**:
brew install git
2. **Alternative: Install with Xcode Command Line Tools**:
xcode-select --install
3. **Verify installation**:
* Open Terminal
* Type `git --version`
* You should see a version number like `git version 2.40.0`
### Windows[](https://kilocode.ai/docs/features/checkpoints#windows "Direct link to Windows")
1. **Download Git for Windows**:
* Visit [https://git-scm.com/download/win](https://git-scm.com/download/win)
* The download should start automatically
2. **Run the installer**:
* Accept the license agreement
* Choose installation location (default is recommended)
* Select components (default options are typically sufficient)
* Choose the default editor
* Choose how to use Git from the command line (recommended: Git from the command line and also from 3rd-party software)
* Configure line ending conversions (recommended: Checkout Windows-style, commit Unix-style)
* Complete the installation
3. **Verify installation**:
* Open Command Prompt or PowerShell
* Type `git --version`
* You should see a version number like `git version 2.40.0.windows.1`
### Linux[](https://kilocode.ai/docs/features/checkpoints#linux "Direct link to Linux")
**Debian/Ubuntu**:
sudo apt updatesudo apt install git
**Fedora**:
sudo dnf install git
**Arch Linux**:
sudo pacman -S git
**Verify installation**:
* Open Terminal
* Type `git --version`
* You should see a version number
* [Configuration Options](https://kilocode.ai/docs/features/checkpoints#configuration-options)
* [How Checkpoints Work](https://kilocode.ai/docs/features/checkpoints#how-checkpoints-work)
* [Working with Checkpoints](https://kilocode.ai/docs/features/checkpoints#working-with-checkpoints)
* [Viewing Differences](https://kilocode.ai/docs/features/checkpoints#viewing-differences)
* [Restoring Checkpoints](https://kilocode.ai/docs/features/checkpoints#restoring-checkpoints)
* [Limitations and Considerations](https://kilocode.ai/docs/features/checkpoints#limitations-and-considerations)
* [Technical Implementation](https://kilocode.ai/docs/features/checkpoints#technical-implementation)
* [Checkpoint Architecture](https://kilocode.ai/docs/features/checkpoints#checkpoint-architecture)
* [Restoration Process](https://kilocode.ai/docs/features/checkpoints#restoration-process)
* [Storage Type](https://kilocode.ai/docs/features/checkpoints#storage-type)
* [Diff Computation](https://kilocode.ai/docs/features/checkpoints#diff-computation)
* [File Exclusion and Ignore Patterns](https://kilocode.ai/docs/features/checkpoints#file-exclusion-and-ignore-patterns)
* [Concurrency Control](https://kilocode.ai/docs/features/checkpoints#concurrency-control)
* [Git Installation](https://kilocode.ai/docs/features/checkpoints#git-installation)
* [macOS](https://kilocode.ai/docs/features/checkpoints#macos)
* [Windows](https://kilocode.ai/docs/features/checkpoints#windows)
* [Linux](https://kilocode.ai/docs/features/checkpoints#linux)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Fcheckpoints)
---
# Import, Export, and Reset Settings | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/settings-management#__docusaurus_skipToContent_fallback)
On this page
Kilo Code allows you to manage your configuration settings effectively through export, import, and reset options. These features are useful for backing up your setup, sharing configurations with others, or restoring default settings if needed.
You can find these options at the bottom of the Kilo Code settings page, accessible via the gear icon () in the Kilo Code chat view.

_Image: Export, Import, and Reset buttons._
Export Settings[](https://kilocode.ai/docs/features/settings-management#export-settings "Direct link to Export Settings")
---------------------------------------------------------------------------------------------------------------------------
Clicking the **Export** button saves your current Kilo Code settings to a JSON file.
* **What's Exported:** The file includes your configured API Provider Profiles and Global Settings (UI preferences, mode configurations, context settings, etc.).
* **Security Warning:** The exported JSON file contains **all** your configured API Provider Profiles and Global Settings. Crucially, this includes **API keys in plaintext**. Treat this file as highly sensitive. Do not share it publicly or with untrusted individuals, as it grants access to your API accounts.
* **Process:**
1. Click **Export**.
2. A file save dialog appears, suggesting `kilo-code-settings.json` as the filename (usually in your `~/Documents` folder).
3. Choose a location and save the file.
This creates a backup of your configuration or a file you can share.
Import Settings[](https://kilocode.ai/docs/features/settings-management#import-settings "Direct link to Import Settings")
---------------------------------------------------------------------------------------------------------------------------
Clicking the **Import** button allows you to load settings from a previously exported JSON file.
* **Process:**
1. Click **Import**.
2. A file open dialog appears. Select the `kilo-code-settings.json` file (or similarly named file) you want to import.
3. Kilo Code reads the file, validates its contents against the expected schema, and applies the settings.
* **Merging:** Importing settings **merges** the configurations. It adds new API profiles and updates existing ones and global settings based on the file content. It does **not** delete configurations present in your current setup but missing from the imported file.
* **Validation:** Only valid settings matching the internal schema can be imported, preventing configuration errors. A success notification appears upon completion.
Reset Settings[](https://kilocode.ai/docs/features/settings-management#reset-settings "Direct link to Reset Settings")
------------------------------------------------------------------------------------------------------------------------
Clicking the **Reset** button completely clears all Kilo Code configuration data and returns the extension to its default state. This is a destructive action intended for troubleshooting or starting fresh.
* **Warning:** This action is **irreversible**. It permanently deletes all API configurations (including keys stored in secret storage), custom modes, global settings, and task history.
* **Process:**
1. Click the red **Reset** button.
2. A confirmation dialog appears, warning that the action cannot be undone.
3. Click "Yes" to confirm.
* **What is Reset:**
* **API Provider Profiles:** All configurations are deleted from settings and secret storage.
* **Global Settings:** All preferences (UI, modes, approvals, browser, etc.) are reset to defaults.
* **Custom Modes:** All user-defined modes are deleted.
* **Secret Storage:** All API keys and other secrets managed by Kilo Code are cleared.
* **Task History:** The current task stack is cleared.
* **Result:** Kilo Code returns to its initial state, as if freshly installed, with default settings and no user configurations.
Use this option only if you are certain you want to remove all Kilo Code data or if instructed during troubleshooting. Consider exporting your settings first if you might want to restore them later.
* [Export Settings](https://kilocode.ai/docs/features/settings-management#export-settings)
* [Import Settings](https://kilocode.ai/docs/features/settings-management#import-settings)
* [Reset Settings](https://kilocode.ai/docs/features/settings-management#reset-settings)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Fsettings-management)
---
# Generate Commit Messages | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/basic-usage/git-commit-generation#__docusaurus_skipToContent_fallback)
On this page
Generate descriptive commit messages automatically based on your staged git changes. Kilo Code analyzes your staged files and creates conventional commit messages that follow best practices.
info
This feature only analyzes **staged changes**. Make sure to stage your files using `git add` or via `VS Code` interface before generating commit messages.
How It Works[](https://kilocode.ai/docs/basic-usage/git-commit-generation#how-it-works "Direct link to How It Works")
-----------------------------------------------------------------------------------------------------------------------
The git commit message generator:
* Analyzes only your **staged changes** (not unstaged or untracked files)
* Uses AI to understand the context and purpose of your changes
* Creates descriptive commit messages that explain what was changed and why following the [Conventional Commits](https://www.conventionalcommits.org/)
(by default, customizable)
Using the Feature[](https://kilocode.ai/docs/basic-usage/git-commit-generation#using-the-feature "Direct link to Using the Feature")
--------------------------------------------------------------------------------------------------------------------------------------
### Generating a Commit Message[](https://kilocode.ai/docs/basic-usage/git-commit-generation#generating-a-commit-message "Direct link to Generating a Commit Message")
1. Stage your changes using `git add` or the VS Code git interface
2. In the VS Code Source Control panel, look for the `Kilo Code` logo next to the commit message field)
3. Click the logo to generate a commit message
The generated message will appear in the commit message field, ready for you to review and modify if needed.

### Conventional Commit Format[](https://kilocode.ai/docs/basic-usage/git-commit-generation#conventional-commit-format "Direct link to Conventional Commit Format")
By default, generated messages follow the Conventional Commits specification:
():
Common types include:
* `feat`: New features
* `fix`: Bug fixes
* `docs`: Documentation changes
* `style`: Code style changes (formatting, etc.)
* `refactor`: Code refactoring
* `test`: Adding or updating tests
* `chore`: Maintenance tasks
Configuration[](https://kilocode.ai/docs/basic-usage/git-commit-generation#configuration "Direct link to Configuration")
--------------------------------------------------------------------------------------------------------------------------
### Customizing the Commit Template[](https://kilocode.ai/docs/basic-usage/git-commit-generation#customizing-the-commit-template "Direct link to Customizing the Commit Template")
You can customize how commit messages are generated by modifying the prompt template:
1. Open Settings by clicking the gear icon → `Prompts`
2. Find the "Commit Message Generation" section
3. Edit the `Prompt` template to match your project's conventions

The default template creates conventional commit messages, but you can modify it to:
* Use different commit message formats
* Include specific information relevant to your project
* Follow your team's commit message conventions
* Add custom instructions for the AI
### API Configuration[](https://kilocode.ai/docs/basic-usage/git-commit-generation#api-configuration "Direct link to API Configuration")
You can configure which API profile to use for commit message generation:
1. In the `Prompts` settings, scroll to "API Configuration"
2. Select a specific profile or use the currently selected one
tip
Consider creating a dedicated [API configuration profile](https://kilocode.ai/docs/features/api-configuration-profiles)
with a faster, more cost-effective model specifically for commit message generation.
Best Practices[](https://kilocode.ai/docs/basic-usage/git-commit-generation#best-practices "Direct link to Best Practices")
-----------------------------------------------------------------------------------------------------------------------------
### Staging Strategy[](https://kilocode.ai/docs/basic-usage/git-commit-generation#staging-strategy "Direct link to Staging Strategy")
* Stage related changes together for more coherent commit messages
* Avoid staging unrelated changes in a single commit
* Use `git add -p` for partial file staging when needed
### Message Review[](https://kilocode.ai/docs/basic-usage/git-commit-generation#message-review "Direct link to Message Review")
* Always review generated messages before committing
* Edit messages to add context the AI might have missed
* Ensure the message accurately describes the changes
### Custom Templates[](https://kilocode.ai/docs/basic-usage/git-commit-generation#custom-templates "Direct link to Custom Templates")
* Tailor the prompt template to your project's needs
* Include project-specific terminology or conventions
* Add instructions for handling specific types of changes
Example Generated Messages[](https://kilocode.ai/docs/basic-usage/git-commit-generation#example-generated-messages "Direct link to Example Generated Messages")
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Here are examples of messages the feature might generate:
feat(auth): add OAuth2 integration with GoogleImplement Google OAuth2 authentication flow including:- OAuth2 client configuration- User profile retrieval- Token refresh mechanism
fix(api): resolve race condition in user data fetchingAdd proper error handling and retry logic to preventconcurrent requests from causing data inconsistency
docs(readme): update installation instructionsAdd missing dependency requirements and clarifysetup steps for new contributors
Troubleshooting[](https://kilocode.ai/docs/basic-usage/git-commit-generation#troubleshooting "Direct link to Troubleshooting")
--------------------------------------------------------------------------------------------------------------------------------
### No Staged Changes[](https://kilocode.ai/docs/basic-usage/git-commit-generation#no-staged-changes "Direct link to No Staged Changes")
If the button doesn't appear or generation fails, ensure you have staged changes:
git add # or stage all changesgit add .
### Poor Message Quality[](https://kilocode.ai/docs/basic-usage/git-commit-generation#poor-message-quality "Direct link to Poor Message Quality")
If generated messages aren't helpful:
* Review your staging strategy - don't stage unrelated changes together
* Customize the prompt template with more specific instructions
* Try a different AI model through API configuration
### Integration Issues[](https://kilocode.ai/docs/basic-usage/git-commit-generation#integration-issues "Direct link to Integration Issues")
The feature integrates with VS Code's built-in git functionality. If you encounter issues:
* Ensure your repository is properly initialized
* Check that VS Code can access your git repository
* Verify git is installed and accessible from VS Code
Related Features[](https://kilocode.ai/docs/basic-usage/git-commit-generation#related-features "Direct link to Related Features")
-----------------------------------------------------------------------------------------------------------------------------------
* [API Configuration Profiles](https://kilocode.ai/docs/features/api-configuration-profiles)
- Use different models for commit generation
* [Settings Management](https://kilocode.ai/docs/features/settings-management)
- Manage all your Kilo Code preferences
* [How It Works](https://kilocode.ai/docs/basic-usage/git-commit-generation#how-it-works)
* [Using the Feature](https://kilocode.ai/docs/basic-usage/git-commit-generation#using-the-feature)
* [Generating a Commit Message](https://kilocode.ai/docs/basic-usage/git-commit-generation#generating-a-commit-message)
* [Conventional Commit Format](https://kilocode.ai/docs/basic-usage/git-commit-generation#conventional-commit-format)
* [Configuration](https://kilocode.ai/docs/basic-usage/git-commit-generation#configuration)
* [Customizing the Commit Template](https://kilocode.ai/docs/basic-usage/git-commit-generation#customizing-the-commit-template)
* [API Configuration](https://kilocode.ai/docs/basic-usage/git-commit-generation#api-configuration)
* [Best Practices](https://kilocode.ai/docs/basic-usage/git-commit-generation#best-practices)
* [Staging Strategy](https://kilocode.ai/docs/basic-usage/git-commit-generation#staging-strategy)
* [Message Review](https://kilocode.ai/docs/basic-usage/git-commit-generation#message-review)
* [Custom Templates](https://kilocode.ai/docs/basic-usage/git-commit-generation#custom-templates)
* [Example Generated Messages](https://kilocode.ai/docs/basic-usage/git-commit-generation#example-generated-messages)
* [Troubleshooting](https://kilocode.ai/docs/basic-usage/git-commit-generation#troubleshooting)
* [No Staged Changes](https://kilocode.ai/docs/basic-usage/git-commit-generation#no-staged-changes)
* [Poor Message Quality](https://kilocode.ai/docs/basic-usage/git-commit-generation#poor-message-quality)
* [Integration Issues](https://kilocode.ai/docs/basic-usage/git-commit-generation#integration-issues)
* [Related Features](https://kilocode.ai/docs/basic-usage/git-commit-generation#related-features)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fbasic-usage%2Fgit-commit-generation)
---
# Enhance Prompt | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/enhance-prompt#__docusaurus_skipToContent_fallback)
On this page
The "Enhance Prompt" feature in Kilo Code helps you improve the quality and effectiveness of your prompts before sending them to the AI model. By clicking the icon in the chat input, you can automatically refine your initial request, making it clearer, more specific, and more likely to produce the desired results.
Why Use Enhance Prompt?[](https://kilocode.ai/docs/features/enhance-prompt#why-use-enhance-prompt "Direct link to Why Use Enhance Prompt?")
---------------------------------------------------------------------------------------------------------------------------------------------
* **Improved Clarity:** Kilo Code can rephrase your prompt to make it more understandable for the AI model.
* **Added Context:** The enhancement process can add relevant context to your prompt, such as the current file path or selected code.
* **Better Instructions:** Kilo Code can add instructions to guide the AI towards a more helpful response (e.g., requesting specific formatting or a particular level of detail).
* **Reduced Ambiguity:** Enhance Prompt helps to eliminate ambiguity and ensure that Kilo Code understands your intent.
* **Consistency**: Kilo will consistently format prompts the same way to the AI.
### Before and after[](https://kilocode.ai/docs/features/enhance-prompt#before-and-after "Direct link to Before and after")
 
How to Use Enhance Prompt[](https://kilocode.ai/docs/features/enhance-prompt#how-to-use-enhance-prompt "Direct link to How to Use Enhance Prompt")
----------------------------------------------------------------------------------------------------------------------------------------------------
1. **Type your initial prompt:** Enter your request in the Kilo Code chat input box as you normally would. This can be a simple question, a complex task description, or anything in between.
2. **Click the Icon:** Instead of pressing Enter, click the icon located in the bottom right of the chat input box.
3. **Review the Enhanced Prompt:** Kilo Code will replace your original prompt with an enhanced version. Review the enhanced prompt to make sure it accurately reflects your intent. You can further refine the enhanced prompt before sending.
4. **Send the Enhanced Prompt:** Press Enter or click the Send icon () to send the enhanced prompt to Kilo Code.
Customizing the Enhancement Process[](https://kilocode.ai/docs/features/enhance-prompt#customizing-the-enhancement-process "Direct link to Customizing the Enhancement Process")
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
### Customizing Template[](https://kilocode.ai/docs/features/enhance-prompt#customizing-template "Direct link to Customizing Template")
The "Enhance Prompt" feature uses a customizable prompt template. You can modify this template to tailor the enhancement process to your specific needs.
1. **Open the Prompts Tab:** Click the icon in the Kilo Code top menu bar.
2. **Select "ENHANCE" Tab:** You should see listed out support prompts, including "ENHANCE". Click on this tab.
3. **Edit the Prompt Template:** Modify the text in the "Prompt" field.
The default prompt template includes the placeholder `${userInput}`, which will be replaced with your original prompt. You can modify this to fit the model's prompt format, and instruct it how to enhance your request.
### Customizing Provider[](https://kilocode.ai/docs/features/enhance-prompt#customizing-provider "Direct link to Customizing Provider")
Speed up prompt enhancement by switching to a more lightweight LLM model provider (e.g. GPT 4.1 Nano). This delivers faster results at lower cost while maintaining quality.
Create a dedicated profile for Enhance Prompt by following the [API configuration profiles guide](https://kilocode.ai/docs/features/api-configuration-profiles)
.

For a detailed walkthrough: [https://youtu.be/R1nDnCK-xzw](https://youtu.be/R1nDnCK-xzw)
Limitations and Best Practices[](https://kilocode.ai/docs/features/enhance-prompt#limitations-and-best-practices "Direct link to Limitations and Best Practices")
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
* **Experimental Feature:** Prompt enhancement is an experimental feature. The quality of the enhanced prompt may vary depending on the complexity of your request and the capabilities of the underlying model.
* **Review Carefully:** Always review the enhanced prompt before sending it. Kilo Code may make changes that don't align with your intentions.
* **Iterative Process:** You can use the "Enhance Prompt" feature multiple times to iteratively refine your prompt.
* **Not a Replacement for Clear Instructions:** While "Enhance Prompt" can help, it's still important to write clear and specific prompts from the start.
By using the "Enhance Prompt" feature, you can improve the quality of your interactions with Kilo Code and get more accurate and helpful responses.
* [Why Use Enhance Prompt?](https://kilocode.ai/docs/features/enhance-prompt#why-use-enhance-prompt)
* [Before and after](https://kilocode.ai/docs/features/enhance-prompt#before-and-after)
* [How to Use Enhance Prompt](https://kilocode.ai/docs/features/enhance-prompt#how-to-use-enhance-prompt)
* [Customizing the Enhancement Process](https://kilocode.ai/docs/features/enhance-prompt#customizing-the-enhancement-process)
* [Customizing Template](https://kilocode.ai/docs/features/enhance-prompt#customizing-template)
* [Customizing Provider](https://kilocode.ai/docs/features/enhance-prompt#customizing-provider)
* [Limitations and Best Practices](https://kilocode.ai/docs/features/enhance-prompt#limitations-and-best-practices)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Fenhance-prompt)
---
# Memory Bank | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/advanced-usage/memory-bank#__docusaurus_skipToContent_fallback)
On this page
Overview[](https://kilocode.ai/docs/advanced-usage/memory-bank#overview "Direct link to Overview")
----------------------------------------------------------------------------------------------------

Kilo Code works more efficiently with Memory Bank enabled, instantly understanding project context and technologies.
### The Problem: AI Memory Loss[](https://kilocode.ai/docs/advanced-usage/memory-bank#the-problem-ai-memory-loss "Direct link to The Problem: AI Memory Loss")
AI assistants like Kilo Code face a fundamental limitation: they reset completely between sessions. This "memory loss" means that every time you start a new conversation, you need to re-explain your project's architecture, goals, technologies, and current status. This creates a critical efficiency dilemma: AI models either make edits without proper project understanding (leading to errors and misaligned solutions), or must spend significant time and resources analyzing your entire codebase in each session (which is prohibitively expensive and slow for larger projects)
Without a solution to this memory problem, AI assistants remain powerful but stateless tools that can't truly function as persistent development partners.
### The Solution: Memory Bank[](https://kilocode.ai/docs/advanced-usage/memory-bank#the-solution-memory-bank "Direct link to The Solution: Memory Bank")
Memory Bank is a system of structured documentation that enables Kilo Code to **better understand your project** and **maintain context across coding sessions**. It transforms your AI assistant from a stateless tool into a persistent development partner with perfect recall of your project details. Kilo Code automatically reads your Memory Bank files to rebuild its understanding of your project whenever you start a new session.
When Memory Bank is active, Kilo Code begins each task with `[Memory Bank: Active]` and a brief summary of your project context, ensuring consistent understanding without repetitive explanations.
Key Benefits[](https://kilocode.ai/docs/advanced-usage/memory-bank#key-benefits "Direct link to Key Benefits")
----------------------------------------------------------------------------------------------------------------
* **Language Agnostic**: Functions with any programming language or framework
* **Efficient Project Understanding**: Helps Kilo Code understand the purpose and tech stack of a project
* **Context Preservation**: Maintain project knowledge across sessions without needing to scan files in every new session
* **Faster Startup**: Kilo Code immediately comprehends your project context when you begin a new session
* **Self-Documenting Projects**: Create valuable documentation as a byproduct
How Memory Bank Works[](https://kilocode.ai/docs/advanced-usage/memory-bank#how-memory-bank-works "Direct link to How Memory Bank Works")
-------------------------------------------------------------------------------------------------------------------------------------------
Memory Bank is built on Kilo Code's [Custom Rules](https://kilocode.ai/docs/advanced-usage/custom-rules)
feature, providing a specialized framework for project documentation. Memory Bank files are standard markdown files stored in `.kilocode/rules/memory-bank` folder within your project repository. They're not hidden or proprietary - they're regular documentation files that both you and Kilo Code can access.
At the start of every task, Kilo Code reads all Memory Bank files to build a comprehensive understanding of your project. This happens automatically without requiring any action from you. Kilo Code then indicates successful Memory Bank activation with `[Memory Bank: Active]` at the beginning of its response, followed by a brief summary of its understanding of your project.
Files are organized in a hierarchical structure that builds a complete picture of your project:
Core Memory Bank Files[](https://kilocode.ai/docs/advanced-usage/memory-bank#core-memory-bank-files "Direct link to Core Memory Bank Files")
----------------------------------------------------------------------------------------------------------------------------------------------
### brief.md[](https://kilocode.ai/docs/advanced-usage/memory-bank#briefmd "Direct link to brief.md")
_This file is created and maintained manually by you_
* The foundation of your project
* High-level overview of what you're building
* Core requirements and goals
Example: _"Building a React web app for inventory management with barcode scanning. The system needs to support multiple warehouses and integrate with our existing ERP system."_
Note: Kilo Code will not edit this file directly but may suggest improvements if it identifies ways to enhance your project brief.
### product.md[](https://kilocode.ai/docs/advanced-usage/memory-bank#productmd "Direct link to product.md")
* Explains why the project exists
* Describes the problems being solved
* Outlines how the product should work
* User experience goals
Example: _"The inventory system needs to support multiple warehouses and real-time updates. It solves the problem of inventory discrepancies by providing barcode scanning for accurate stock counts."_
### context.md[](https://kilocode.ai/docs/advanced-usage/memory-bank#contextmd "Direct link to context.md")
* The most frequently updated file
* Contains current work focus and recent changes
* Tracks active decisions and considerations
* Next steps for development
Example: _"Currently implementing the barcode scanner component; last session completed the API integration. Next steps include adding error handling for network failures."_
### architecture.md[](https://kilocode.ai/docs/advanced-usage/memory-bank#architecturemd "Direct link to architecture.md")
* Documents the system architecture
* Records key technical decisions
* Lists design patterns in use
* Explains component relationships
* Critical implementation paths
Example: _"Using Redux for state management with a normalized store structure. The application follows a modular architecture with separate services for API communication, state management, and UI components."_
### tech.md[](https://kilocode.ai/docs/advanced-usage/memory-bank#techmd "Direct link to tech.md")
* Lists technologies and frameworks used
* Describes development setup
* Notes technical constraints
* Records dependencies and tool configurations
* Tool usage patterns
Example: _"React 18, TypeScript, Firebase, Jest for testing. Development requires Node.js 16+ and uses Vite as the build tool."_
Additional Context Files[](https://kilocode.ai/docs/advanced-usage/memory-bank#additional-context-files "Direct link to Additional Context Files")
----------------------------------------------------------------------------------------------------------------------------------------------------
Create additional files as needed to organize:
* Complex feature documentation
* Integration specifications
* API documentation
* Testing strategies
* Deployment procedures
These additional files help organize more detailed information that doesn't fit neatly into the core files.
### tasks.md[](https://kilocode.ai/docs/advanced-usage/memory-bank#tasksmd "Direct link to tasks.md")
_Optional file for documenting repetitive tasks_
* Stores workflows for tasks that follow similar patterns
* Documents which files need to be modified
* Captures step-by-step procedures
* Records important considerations and gotchas
Example: Adding support for new AI models, implementing API endpoints, or any task that requires doing similar jobs repeatedly.
Getting Started with Memory Bank[](https://kilocode.ai/docs/advanced-usage/memory-bank#getting-started-with-memory-bank "Direct link to Getting Started with Memory Bank")
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
### First-Time Setup[](https://kilocode.ai/docs/advanced-usage/memory-bank#first-time-setup "Direct link to First-Time Setup")
1. Create a `.kilocode/rules/memory-bank/` folder in your project
2. Write a basic project brief in `.kilocode/rules/memory-bank/brief.md`
3. Create a file `.kilocode/rules/memory-bank-instructions.md` and paste there [this document](https://kilocode.ai/docs/downloads/memory-bank.md)
4. Switch to `Architect` mode
5. Check if a best available AI model is selected, don't use "lightweight" models
6. Ask Kilo Code to "initialize memory bank"
7. Wait for Kilo Code to analyze your project and initialize the Memory Bank files
8. Verify the content of the files to see if the project is described correctly. Update the files if necessary.
### Project Brief Tips[](https://kilocode.ai/docs/advanced-usage/memory-bank#project-brief-tips "Direct link to Project Brief Tips")
* Start simple - it can be as detailed or high-level as you like
* Focus on what matters most to you
* Kilo Code will help fill in gaps and ask questions
* You can update it as your project evolves
Sample prompt that delivers a reasonably good brief:
Provide a concise and comprehensive description of this project, highlighting its main objectives, key features, used technologies and significance. Then, write this description into a text file named appropriately to reflect the project's content, ensuring clarity and professionalism in the writing. Stay brief and short.
Working with Memory Bank[](https://kilocode.ai/docs/advanced-usage/memory-bank#working-with-memory-bank "Direct link to Working with Memory Bank")
----------------------------------------------------------------------------------------------------------------------------------------------------
### Core Workflows[](https://kilocode.ai/docs/advanced-usage/memory-bank#core-workflows "Direct link to Core Workflows")
#### Memory Bank Initialization[](https://kilocode.ai/docs/advanced-usage/memory-bank#memory-bank-initialization "Direct link to Memory Bank Initialization")
The initialization step is critically important as it establishes the foundation for all future interactions with your project. When you request initialization with the command `initialize memory bank`, Kilo Code will:
1. Perform an exhaustive analysis of your project, including:
* All source code files and their relationships
* Configuration files and build system setup
* Project structure and organization patterns
* Documentation and comments
* Dependencies and external integrations
* Testing frameworks and patterns
2. Create comprehensive memory bank files in the `.kilocode/rules/memory-bank` folder
3. Provide a detailed summary of what it has understood about your project
4. Ask you to verify the accuracy of the generated files
Important
Take time to carefully review and correct the generated files after initialization. Any misunderstandings or missing information at this stage will affect all future interactions. A thorough initialization dramatically improves Kilo Code's effectiveness, while a rushed or incomplete initialization will permanently limit its ability to assist you effectively.
#### Memory Bank Updates[](https://kilocode.ai/docs/advanced-usage/memory-bank#memory-bank-updates "Direct link to Memory Bank Updates")
Memory Bank updates occur when:
1. Kilo Code discovers new project patterns
2. After implementing significant changes
3. When you explicitly request with `update memory bank`
4. When context needs clarification
To execute a Memory Bank update, Kilo Code will:
1. Review ALL project files
2. Document the current state
3. Document insights and patterns
4. Update all memory bank files as needed
You can direct Kilo Code to focus on specific information sources by using commands like `update memory bank using information from @/Makefile`.
#### Regular Task Execution[](https://kilocode.ai/docs/advanced-usage/memory-bank#regular-task-execution "Direct link to Regular Task Execution")
At the beginning of every task, Kilo Code:
1. Reads ALL memory bank files
2. Includes `[Memory Bank: Active]` at the beginning of its response
3. Provides a brief summary of its understanding of your project
4. Proceeds with the requested task
At the end of a task, Kilo Code may suggest updating the memory bank if significant changes were made, using the phrase: "Would you like me to update memory bank to reflect these changes?"
#### Add Task Workflow[](https://kilocode.ai/docs/advanced-usage/memory-bank#add-task-workflow "Direct link to Add Task Workflow")
When you complete a repetitive task that follows a similar pattern each time, you can document it for future reference. This is particularly useful for tasks like adding features that follow existing patterns
To document a task, use the command `add task` or `store this as a task`. Kilo Code will:
1. Create or update the `tasks.md` file in the memory bank folder
2. Document the task using current context:
* Task name and description
* List of files that need to be modified
* Step-by-step workflow
* Important considerations
* Example implementation
When starting a new task, Kilo Code will check if it matches any documented tasks and follow the established workflow to ensure no steps are missed.
### Key Commands[](https://kilocode.ai/docs/advanced-usage/memory-bank#key-commands "Direct link to Key Commands")
* `initialize memory bank` - Use when starting a new project
* `update memory bank` - Initiates a comprehensive re-analysis of the contextual documentation for the current task. **Caution:** This is resource-intensive and not recommended for "lightweight" models due to potentially reduced effectiveness. Can be used multiple times, well combinable with specific instructions, e.g. `update memory bank using information from @/Makefile`
* `add task` or `store this as a task` - Documents a repetitive task for future reference
### Status Indicators[](https://kilocode.ai/docs/advanced-usage/memory-bank#status-indicators "Direct link to Status Indicators")
Kilo Code uses status indicators to clearly communicate Memory Bank status:
* `[Memory Bank: Active]` - Indicates Memory Bank files were successfully read and are being used
* `[Memory Bank: Missing]` - Indicates Memory Bank files could not be found or are empty
These indicators appear at the beginning of Kilo Code's responses, providing immediate confirmation of Memory Bank status.
### Documentation Updates[](https://kilocode.ai/docs/advanced-usage/memory-bank#documentation-updates "Direct link to Documentation Updates")
Memory Bank updates should automatically occur when:
* You discover new patterns in your project
* After implementing significant changes
* When you explicitly request with `update memory bank`
* When you feel context needs clarification
Context Window Management[](https://kilocode.ai/docs/advanced-usage/memory-bank#context-window-management "Direct link to Context Window Management")
-------------------------------------------------------------------------------------------------------------------------------------------------------
As you work with Kilo Code, your context window will eventually fill up. When you notice responses slowing down or references becoming less accurate:
1. Ask Kilo Code to "update memory bank" to document the current state
2. Start a new conversation/task
3. Kilo Code will automatically access your Memory Bank in the new conversation
This process ensures continuity across multiple sessions without losing important context.
Handling Inconsistencies[](https://kilocode.ai/docs/advanced-usage/memory-bank#handling-inconsistencies "Direct link to Handling Inconsistencies")
----------------------------------------------------------------------------------------------------------------------------------------------------
If Kilo Code detects inconsistencies between memory bank files:
1. It will prioritize information from `brief.md` as the source of truth
2. Note any discrepancies to you
3. Continue working with the most reliable information available
This ensures that even with imperfect documentation, Kilo Code can still function effectively.
Frequently Asked Questions[](https://kilocode.ai/docs/advanced-usage/memory-bank#frequently-asked-questions "Direct link to Frequently Asked Questions")
----------------------------------------------------------------------------------------------------------------------------------------------------------
### Where are the memory bank files stored?[](https://kilocode.ai/docs/advanced-usage/memory-bank#where-are-the-memory-bank-files-stored "Direct link to Where are the memory bank files stored?")
The Memory Bank files are regular markdown files stored in your project repository, typically in a `.kilocode/rules/memory-bank/` folder. They're not hidden system files - they're designed to be part of your project documentation.
### How often should I update the memory bank?[](https://kilocode.ai/docs/advanced-usage/memory-bank#how-often-should-i-update-the-memory-bank "Direct link to How often should I update the memory bank?")
Update the Memory Bank after significant milestones or changes in direction. For active development, updates every few sessions can be helpful. Use the "update memory bank" command when you want to ensure all context is preserved.
### Can I edit memory bank files manually?[](https://kilocode.ai/docs/advanced-usage/memory-bank#can-i-edit-memory-bank-files-manually "Direct link to Can I edit memory bank files manually?")
Yes! While Kilo Code manages most of the files, you can edit any of them manually. The `brief.md` file is specifically designed to be maintained by you. Manual edits to other files will be respected by Kilo Code.
### What happens if memory bank files are missing?[](https://kilocode.ai/docs/advanced-usage/memory-bank#what-happens-if-memory-bank-files-are-missing "Direct link to What happens if memory bank files are missing?")
If memory bank files are missing, Kilo Code will indicate this with `[Memory Bank: Missing]` at the beginning of its response and suggest initializing the memory bank.
### Does Memory Bank work with all AI models?[](https://kilocode.ai/docs/advanced-usage/memory-bank#does-memory-bank-work-with-all-ai-models "Direct link to Does Memory Bank work with all AI models?")
Memory Bank works with all AI models, but more powerful models will create more comprehensive and accurate memory bank files. Lightweight models may struggle with the resource-intensive process of analyzing and updating memory bank files.
### Can I use Memory Bank with multiple projects?[](https://kilocode.ai/docs/advanced-usage/memory-bank#can-i-use-memory-bank-with-multiple-projects "Direct link to Can I use Memory Bank with multiple projects?")
Yes! Each project has its own Memory Bank in its `.kilocode/rules/memory-bank/` folder. Kilo Code will automatically use the correct Memory Bank for each project.
### Doesn't Memory Bank use up my context window?[](https://kilocode.ai/docs/advanced-usage/memory-bank#doesnt-memory-bank-use-up-my-context-window "Direct link to Doesn't Memory Bank use up my context window?")
Yes, Memory Bank does consume some of your context window at the beginning of each session as it loads all memory bank files. However, this is a strategic tradeoff that significantly improves overall efficiency. By front-loading project context:
* You eliminate repetitive explanations that would consume even more context over time
* You reach productive outcomes with fewer back-and-forth exchanges
* You maintain consistent understanding throughout your session
Testing shows that while Memory Bank uses more tokens initially, it dramatically reduces the total number of interactions needed to achieve results. This means less time explaining and more time building.
Best Practices[](https://kilocode.ai/docs/advanced-usage/memory-bank#best-practices "Direct link to Best Practices")
----------------------------------------------------------------------------------------------------------------------
### Getting Started[](https://kilocode.ai/docs/advanced-usage/memory-bank#getting-started "Direct link to Getting Started")
* Start with a basic project brief and let the structure evolve
* Let Kilo Code help create the initial structure
* Review and adjust files as needed to match your workflow
* Verify the accuracy of generated files after initialization
### Ongoing Work[](https://kilocode.ai/docs/advanced-usage/memory-bank#ongoing-work "Direct link to Ongoing Work")
* Let patterns emerge naturally as you work
* Don't force documentation updates - they should happen organically
* Trust the process - the value compounds over time
* Watch for context confirmation at the start of sessions
* Use the status indicators to confirm Memory Bank is active
### Documentation Flow[](https://kilocode.ai/docs/advanced-usage/memory-bank#documentation-flow "Direct link to Documentation Flow")
* `brief.md` is your foundation
* `context.md` changes most frequently
* All files collectively maintain project intelligence
* Update after significant milestones or changes in direction
### Optimizing Memory Bank Performance[](https://kilocode.ai/docs/advanced-usage/memory-bank#optimizing-memory-bank-performance "Direct link to Optimizing Memory Bank Performance")
* Keep memory bank files concise and focused
* Use additional files for detailed documentation
* Update regularly but not excessively
* Use specific update commands when focusing on particular aspects
Remember[](https://kilocode.ai/docs/advanced-usage/memory-bank#remember "Direct link to Remember")
----------------------------------------------------------------------------------------------------
The Memory Bank is Kilo Code's only link to previous work. Its effectiveness depends entirely on maintaining clear, accurate documentation and confirming context preservation in every interaction. When you see `[Memory Bank: Active]` at the beginning of a response, you can be confident that Kilo Code has a comprehensive understanding of your project.
* [Overview](https://kilocode.ai/docs/advanced-usage/memory-bank#overview)
* [The Problem: AI Memory Loss](https://kilocode.ai/docs/advanced-usage/memory-bank#the-problem-ai-memory-loss)
* [The Solution: Memory Bank](https://kilocode.ai/docs/advanced-usage/memory-bank#the-solution-memory-bank)
* [Key Benefits](https://kilocode.ai/docs/advanced-usage/memory-bank#key-benefits)
* [How Memory Bank Works](https://kilocode.ai/docs/advanced-usage/memory-bank#how-memory-bank-works)
* [Core Memory Bank Files](https://kilocode.ai/docs/advanced-usage/memory-bank#core-memory-bank-files)
* [brief.md](https://kilocode.ai/docs/advanced-usage/memory-bank#briefmd)
* [product.md](https://kilocode.ai/docs/advanced-usage/memory-bank#productmd)
* [context.md](https://kilocode.ai/docs/advanced-usage/memory-bank#contextmd)
* [architecture.md](https://kilocode.ai/docs/advanced-usage/memory-bank#architecturemd)
* [tech.md](https://kilocode.ai/docs/advanced-usage/memory-bank#techmd)
* [Additional Context Files](https://kilocode.ai/docs/advanced-usage/memory-bank#additional-context-files)
* [tasks.md](https://kilocode.ai/docs/advanced-usage/memory-bank#tasksmd)
* [Getting Started with Memory Bank](https://kilocode.ai/docs/advanced-usage/memory-bank#getting-started-with-memory-bank)
* [First-Time Setup](https://kilocode.ai/docs/advanced-usage/memory-bank#first-time-setup)
* [Project Brief Tips](https://kilocode.ai/docs/advanced-usage/memory-bank#project-brief-tips)
* [Working with Memory Bank](https://kilocode.ai/docs/advanced-usage/memory-bank#working-with-memory-bank)
* [Core Workflows](https://kilocode.ai/docs/advanced-usage/memory-bank#core-workflows)
* [Key Commands](https://kilocode.ai/docs/advanced-usage/memory-bank#key-commands)
* [Status Indicators](https://kilocode.ai/docs/advanced-usage/memory-bank#status-indicators)
* [Documentation Updates](https://kilocode.ai/docs/advanced-usage/memory-bank#documentation-updates)
* [Context Window Management](https://kilocode.ai/docs/advanced-usage/memory-bank#context-window-management)
* [Handling Inconsistencies](https://kilocode.ai/docs/advanced-usage/memory-bank#handling-inconsistencies)
* [Frequently Asked Questions](https://kilocode.ai/docs/advanced-usage/memory-bank#frequently-asked-questions)
* [Where are the memory bank files stored?](https://kilocode.ai/docs/advanced-usage/memory-bank#where-are-the-memory-bank-files-stored)
* [How often should I update the memory bank?](https://kilocode.ai/docs/advanced-usage/memory-bank#how-often-should-i-update-the-memory-bank)
* [Can I edit memory bank files manually?](https://kilocode.ai/docs/advanced-usage/memory-bank#can-i-edit-memory-bank-files-manually)
* [What happens if memory bank files are missing?](https://kilocode.ai/docs/advanced-usage/memory-bank#what-happens-if-memory-bank-files-are-missing)
* [Does Memory Bank work with all AI models?](https://kilocode.ai/docs/advanced-usage/memory-bank#does-memory-bank-work-with-all-ai-models)
* [Can I use Memory Bank with multiple projects?](https://kilocode.ai/docs/advanced-usage/memory-bank#can-i-use-memory-bank-with-multiple-projects)
* [Doesn't Memory Bank use up my context window?](https://kilocode.ai/docs/advanced-usage/memory-bank#doesnt-memory-bank-use-up-my-context-window)
* [Best Practices](https://kilocode.ai/docs/advanced-usage/memory-bank#best-practices)
* [Getting Started](https://kilocode.ai/docs/advanced-usage/memory-bank#getting-started)
* [Ongoing Work](https://kilocode.ai/docs/advanced-usage/memory-bank#ongoing-work)
* [Documentation Flow](https://kilocode.ai/docs/advanced-usage/memory-bank#documentation-flow)
* [Optimizing Memory Bank Performance](https://kilocode.ai/docs/advanced-usage/memory-bank#optimizing-memory-bank-performance)
* [Remember](https://kilocode.ai/docs/advanced-usage/memory-bank#remember)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fadvanced-usage%2Fmemory-bank)
---
# Task Todo List | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/basic-usage/task-todo-list#__docusaurus_skipToContent_fallback)
On this page
**The big picture**: Never lose track of complex development tasks again. Task Todo Lists create interactive, persistent checklists that live right in your chat interface.
**Why it matters**: Complex workflows have lots of moving parts. Without structure, it's easy to miss steps, duplicate work, or forget what comes next.

How to trigger todo lists[](https://kilocode.ai/docs/basic-usage/task-todo-list#how-to-trigger-todo-lists "Direct link to How to trigger todo lists")
-------------------------------------------------------------------------------------------------------------------------------------------------------
**Automatic triggers**:
* Complex tasks with multiple steps
* Working in Architect mode
* Multi-phase workflows with dependencies
**Manual triggers**:
* Ask Kilo to "use the [update\_todo\_list tool](https://kilocode.ai/docs/features/tools/update-todo-list)
"
* Say "create a todo list"
**The bottom line**: Kilo decides what goes in the list, but you can provide feedback during approval dialogs.
* * *
The old way vs. the new way[](https://kilocode.ai/docs/basic-usage/task-todo-list#the-old-way-vs-the-new-way "Direct link to The old way vs. the new way")
------------------------------------------------------------------------------------------------------------------------------------------------------------
**Before**: You juggled task steps in your head or scattered notes, constantly wondering "what's next?"
**Now**: Kilo creates structured checklists that update automatically as work progresses. You see exactly where you are and what's coming up.
* * *
Where todo lists appear[](https://kilocode.ai/docs/basic-usage/task-todo-list#where-todo-lists-appear "Direct link to Where todo lists appear")
-------------------------------------------------------------------------------------------------------------------------------------------------
**1\. Task Header Summary** Quick progress overview with your next important item

**2\. Interactive Tool Block** Full todo interface in chat where you can:
* See all items and their status
* Edit descriptions when Kilo asks for approval
* Stage changes using the "Edit" button
**3\. Environment Details** Background "REMINDERS" table that keeps Kilo informed about current progress
Task status decoded[](https://kilocode.ai/docs/basic-usage/task-todo-list#task-status-decoded "Direct link to Task status decoded")
-------------------------------------------------------------------------------------------------------------------------------------
**Pending** → Empty checkbox (not started)

* * *
**In Progress** → Yellow dot (currently working)

* * *
**Completed** → Green checkmark (finished)

* * *
Common questions[](https://kilocode.ai/docs/basic-usage/task-todo-list#common-questions "Direct link to Common questions")
----------------------------------------------------------------------------------------------------------------------------
**"Can I create my own todo lists?"** Yes, just ask Kilo to use the update\_todo\_list tool. But Kilo stays in control of the content and workflow.
**"What about simple tasks?"** Kilo typically skips todo lists for simple tasks. The overhead isn't worth it.
**"Why can't I directly edit the list?"** Design choice. Kilo maintains authority over task management to ensure consistent progress tracking. You provide input, Kilo executes.
* * *
tip
Pro tip: Auto-approval[](https://kilocode.ai/docs/basic-usage/task-todo-list#pro-tip-auto-approval "Direct link to Pro tip: Auto-approval")
---------------------------------------------------------------------------------------------------------------------------------------------
**What it does**: Automatically approves todo list updates without confirmation prompts.
**When to use it**: Long workflows where constant interruptions slow you down.
**How to enable it**: Check the [Update Todo List auto-approval settings](https://kilocode.ai/docs/features/auto-approving-actions#update-todo-list)
.
**The catch**: Less control, but faster execution.
* [How to trigger todo lists](https://kilocode.ai/docs/basic-usage/task-todo-list#how-to-trigger-todo-lists)
* [The old way vs. the new way](https://kilocode.ai/docs/basic-usage/task-todo-list#the-old-way-vs-the-new-way)
* [Where todo lists appear](https://kilocode.ai/docs/basic-usage/task-todo-list#where-todo-lists-appear)
* [Task status decoded](https://kilocode.ai/docs/basic-usage/task-todo-list#task-status-decoded)
* [Common questions](https://kilocode.ai/docs/basic-usage/task-todo-list#common-questions)
* [Pro tip: Auto-approval](https://kilocode.ai/docs/basic-usage/task-todo-list#pro-tip-auto-approval)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fbasic-usage%2Ftask-todo-list)
---
# Installing Kilo Code | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/getting-started/installing#__docusaurus_skipToContent_fallback)
On this page
Kilo Code is a VS Code extension that brings AI-powered coding assistance directly to your editor. Install using one of these methods:
* [**VS Code Marketplace (Recommended)**](https://kilocode.ai/docs/getting-started/installing#vs-code-marketplace)
- fastest method for standard VS Code users
* [**Cursor Marketplace**](https://kilocode.ai/docs/getting-started/installing#cursor-marketplace)
- recommended way for Cursor users
* [**Open VSX Registry**](https://kilocode.ai/docs/getting-started/installing#open-vsx-registry)
- for VS Code-compatible editors like VSCodium or Windsurf
* [**Manually install the .vsix file**](https://kilocode.ai/docs/getting-started/installing#manual-installation-from-vsix)
- direct installation from the GitHub Release
VS Code Marketplace[](https://kilocode.ai/docs/getting-started/installing#vs-code-marketplace "Direct link to VS Code Marketplace")
-------------------------------------------------------------------------------------------------------------------------------------
tip
If you already have VS Code installed: [Click here to install Kilo Code](vscode:extension/kilocode.Kilo-Code)
alternatively, you can:
1. Open VS Code
2. Access Extensions: Click the Extensions icon in the Side Bar or press `Ctrl+Shift+X` (Windows/Linux) or `Cmd+Shift+X` (macOS)
3. Search for "Kilo Code"
4. Select "Kilo Code" by Kilo Code and click **Install**
5. Reload VS Code if prompted
After installation, find the Kilo Code icon () in the Side Bar to open the Kilo Code panel.

_VS Code marketplace with Kilo Code extension ready to install_
Cursor Marketplace[](https://kilocode.ai/docs/getting-started/installing#cursor-marketplace "Direct link to Cursor Marketplace")
----------------------------------------------------------------------------------------------------------------------------------
tip
If you already have Cursor installed: [Click here to install Kilo Code](cursor:extension/kilocode.Kilo-Code)
alternatively, you can:
1. Open Cursor
2. Access Extensions: Click the Extensions icon in the Side Bar or press `Ctrl+Shift+X` (Windows/Linux) or `Cmd+Shift+X` (macOS)
3. Search for "Kilo Code"
4. Select "Kilo Code" by Kilo Code and click **Install**
5. Reload Cursor if prompted
After installation, find the Kilo Code icon () in the Side Bar to open the Kilo Code panel.
Open VSX Registry[](https://kilocode.ai/docs/getting-started/installing#open-vsx-registry "Direct link to Open VSX Registry")
-------------------------------------------------------------------------------------------------------------------------------
[Open VSX Registry](https://open-vsx.org/)
is an open-source alternative to the VS Code Marketplace for VS Code-compatible editors that cannot access the official marketplace due to licensing restrictions.
For VS Code-compatible editors like VSCodium, Gitpod, Eclipse Theia, and Windsurf, you can browse and install directly from the [Kilo Code page on Open VSX Registry](https://open-vsx.org/extension/kilocode/Kilo-Code)
.
1. Open your editor
2. Access the Extensions view (Side Bar icon or `Ctrl+Shift+X` / `Cmd+Shift+X`)
3. Your editor should be pre-configured to use Open VSX Registry
4. Search for "Kilo Code"
5. Select "Kilo Code" and click **Install**
6. Reload the editor if prompted
note
If your editor isn't automatically configured for Open VSX Registry, you may need to set it as your extension marketplace in settings. Consult your specific editor's documentation for instructions.
Manual Installation from VSIX[](https://kilocode.ai/docs/getting-started/installing#manual-installation-from-vsix "Direct link to Manual Installation from VSIX")
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
If you prefer to download and install the VSIX file directly:
1. **Download the VSIX file:**
* Find official releases on the [Kilo Code GitHub Releases page](https://github.com/Kilo-Org/kilocode/releases)
* Download the `.vsix` file from the [latest release](https://github.com/Kilo-Org/kilocode/releases/latest)
2. **Install in VS Code:**
* Open VS Code
* Access Extensions view
* Click the "..." menu in the Extensions view
* Select "Install from VSIX..."
* Browse to and select your downloaded `.vsix` file

_Installing Kilo Code using VS Code's "Install from VSIX" dialog_
Troubleshooting[](https://kilocode.ai/docs/getting-started/installing#troubleshooting "Direct link to Troubleshooting")
-------------------------------------------------------------------------------------------------------------------------
**Extension Not Visible**
* Restart VS Code
* Verify Kilo Code is listed and enabled in Extensions
* Try disabling and re-enabling the extension in Extensions
* Check Output panel for errors (View → Output, select "Kilo Code")
**Installation Problems**
* Ensure stable internet connection
* Verify VS Code version 1.84.0 or later
* If VS Code Marketplace is inaccessible, try the Open VSX Registry method
Getting Support[](https://kilocode.ai/docs/getting-started/installing#getting-support "Direct link to Getting Support")
-------------------------------------------------------------------------------------------------------------------------
If you encounter issues not covered here:
* Join our [Discord community](https://kilocode.ai/discord)
for real-time support
* Submit issues on [GitHub](https://github.com/Kilo-Org/kilocode/issues)
* Visit our [Reddit community](https://www.reddit.com/r/KiloCode)
* [VS Code Marketplace](https://kilocode.ai/docs/getting-started/installing#vs-code-marketplace)
* [Cursor Marketplace](https://kilocode.ai/docs/getting-started/installing#cursor-marketplace)
* [Open VSX Registry](https://kilocode.ai/docs/getting-started/installing#open-vsx-registry)
* [Manual Installation from VSIX](https://kilocode.ai/docs/getting-started/installing#manual-installation-from-vsix)
* [Troubleshooting](https://kilocode.ai/docs/getting-started/installing#troubleshooting)
* [Getting Support](https://kilocode.ai/docs/getting-started/installing#getting-support)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fgetting-started%2Finstalling)
---
# setting-up | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/getting-started/setting-up#__docusaurus_skipToContent_fallback)
On this page
When you sign up for Kilo Code, you'll receive **free credits** to help you get started. To claim your credits:
1. Complete the registration process - you'll receive an initial amount of free credits to use immediately
2. To unlock additional credits (up to $20 total):
* add a payment method for identity verification
* authorize Kilo Code to place a _temporary_ $10 hold on your card
3. As long as this payment method hasn't been used to claim free credits through a different Kilo Code account before, you can enjoy your free tokens and start coding right away!
About the temporary hold
To keep our service reliable and prevent misuse, we place a _temporary_ $10 hold on your credit card during verification. Here's what you need to know:
* **It's not a charge** - This is a temporary authorization that will not be charged to your account
* **Bank processing time** - Kilo Code releases the hold after 7 days. After release, it may take **several weeks** (5-10 business days on average) for the funds to return to your account. The exact timeline depends on your bank.
* **How it's displayed** - Some banks may show this as a regular transaction, but it remains a temporary hold
* **Tracking available** - After the hold is released (7 days), we can provide a STAN number to help you track the transaction with your bank if needed.
Registration process[](https://kilocode.ai/docs/getting-started/setting-up#registration-process "Direct link to Registration process")
----------------------------------------------------------------------------------------------------------------------------------------
Kilo Code provides a simple registration process that gives you access to the latest frontier coding models with your Kilo Code login.
1. Click on "Try Kilo Code for Free" in the extension
2. Sign in with your Google account to kilocode.ai
3. kilocode.ai will prompt you to open Visual Studio Code
* When using an IDE in a web browser, you will be asked to copy the API key manually instead
4. Once you allow it to Open VS Code, you must also allow VS Code to open the authorization URL

That's it - you're all set! Now you can start with [your first task](https://kilocode.ai/docs/getting-started/your-first-task)
Need Help?
If you have any questions about pricing or tokens, please reach out to our [support team](mailto:hi@kilocode.ai)
or ask in our [Discord community](https://kilocode.ai/discord)
.
* [Registration process](https://kilocode.ai/docs/getting-started/setting-up#registration-process)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fgetting-started%2Fsetting-up)
---
# Footgun Prompting: Override System Prompts | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/footgun-prompting#__docusaurus_skipToContent_fallback)
On this page
Footgun Prompting, AKA Overriding System Prompt, allows advanced users to completely replace the default system prompt for a specific Kilo Code mode. This provides granular control over the AI's behavior but bypasses built-in safeguards.
**footgun** _(noun)_
1. _(programming slang, humorous, derogatory)_ Any feature likely to lead to the programmer shooting themself in the foot.
> The System Prompt Override is considered a footgun because modifying the core instructions without a deep understanding can lead to unexpected or broken behavior, especially regarding tool usage and response consistency.
How It Works[](https://kilocode.ai/docs/features/footgun-prompting#how-it-works "Direct link to How It Works")
----------------------------------------------------------------------------------------------------------------
1. **Override File:** Create a file named `.kilo/system-prompt-{mode-slug}` in your workspace root (e.g., `.kilo/system-prompt-code` for the Code mode).
2. **Content:** The content of this file becomes the new system prompt for that specific mode.
3. **Activation:** Kilo Code automatically detects this file. When present, it replaces most of the standard system prompt sections.
4. **Preserved Sections:** Only the core `roleDefinition` and any `customInstructions` you've set for the mode are kept alongside your override content. Standard sections like tool descriptions, rules, and capabilities are bypassed.
5. **Construction:** The final prompt sent to the model looks like this:
${roleDefinition}${content_of_your_override_file}${customInstructions}
Accessing the Feature[](https://kilocode.ai/docs/features/footgun-prompting#accessing-the-feature "Direct link to Accessing the Feature")
-------------------------------------------------------------------------------------------------------------------------------------------
You can find the option and instructions within the Kilo Code UI:
1. Click the icon in the Kilo Code top menu bar.
2. Expand the **"Advanced: Override System Prompt"** section.
3. Clicking the file path link within the explanation will open or create the correct override file for the currently selected mode in VS Code.

Key Considerations & Warnings[](https://kilocode.ai/docs/features/footgun-prompting#key-considerations--warnings "Direct link to Key Considerations & Warnings")
------------------------------------------------------------------------------------------------------------------------------------------------------------------
* **Intended Audience:** Best suited for users deeply familiar with Kilo Code's prompting system and the implications of modifying core instructions.
* **Impact on Functionality:** Custom prompts override standard instructions, including those for tool usage and response consistency. This can cause unexpected behavior or errors if not managed carefully.
* **Mode-Specific:** Each override file applies only to the mode specified in its filename (`{mode-slug}`).
* **No File, No Override:** If the `.kilo/system-prompt-{mode-slug}` file doesn't exist, Kilo Code uses the standard system prompt generation process for that mode.
* **Directory Creation:** Kilo Code ensures the `.kilo` directory exists before attempting to read or create the override file.
Use this feature cautiously. While powerful for customization, incorrect implementation can significantly degrade Kilo Code's performance and reliability for the affected mode.
* [How It Works](https://kilocode.ai/docs/features/footgun-prompting#how-it-works)
* [Accessing the Feature](https://kilocode.ai/docs/features/footgun-prompting#accessing-the-feature)
* [Key Considerations & Warnings](https://kilocode.ai/docs/features/footgun-prompting#key-considerations--warnings)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Ffootgun-prompting)
---
# Codebase Indexing | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/codebase-indexing#__docusaurus_skipToContent_fallback)
On this page
Codebase Indexing enables semantic code search across your entire project using AI embeddings. Instead of searching for exact text matches, it understands the _meaning_ of your queries, helping Kilo Code find relevant code even when you don't know specific function names or file locations.

What It Does[](https://kilocode.ai/docs/features/codebase-indexing#what-it-does "Direct link to What It Does")
----------------------------------------------------------------------------------------------------------------
When enabled, the indexing system:
1. **Parses your code** using Tree-sitter to identify semantic blocks (functions, classes, methods)
2. **Creates embeddings** of each code block using AI models
3. **Stores vectors** in a Qdrant database for fast similarity search
4. **Provides the [`codebase_search`](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search)
tool** to Kilo Code for intelligent code discovery
This enables natural language queries like "user authentication logic" or "database connection handling" to find relevant code across your entire project.
Key Benefits[](https://kilocode.ai/docs/features/codebase-indexing#key-benefits "Direct link to Key Benefits")
----------------------------------------------------------------------------------------------------------------
* **Semantic Search**: Find code by meaning, not just keywords
* **Enhanced AI Understanding**: Kilo Code can better comprehend and work with your codebase
* **Cross-Project Discovery**: Search across all files, not just what's open
* **Pattern Recognition**: Locate similar implementations and code patterns
Setup Requirements[](https://kilocode.ai/docs/features/codebase-indexing#setup-requirements "Direct link to Setup Requirements")
----------------------------------------------------------------------------------------------------------------------------------
### Embedding Provider[](https://kilocode.ai/docs/features/codebase-indexing#embedding-provider "Direct link to Embedding Provider")
Choose one of these options for generating embeddings:
**OpenAI (Recommended)**
* Requires OpenAI API key
* Supports all OpenAI embedding models
* Default: `text-embedding-3-small`
* Processes up to 100,000 tokens per batch
**Gemini**
* Requires Google AI API key
* Supports Gemini embedding models including `gemini-embedding-001`
* Cost-effective alternative to OpenAI
* High-quality embeddings for code understanding
**Ollama (Local)**
* Requires local Ollama installation
* No API costs or internet dependency
* Supports any Ollama-compatible embedding model
* Requires Ollama base URL configuration
### Vector Database[](https://kilocode.ai/docs/features/codebase-indexing#vector-database "Direct link to Vector Database")
**Qdrant** is required for storing and searching embeddings:
* **Local**: `http://localhost:6333` (recommended for testing)
* **Cloud**: Qdrant Cloud or self-hosted instance
* **Authentication**: Optional API key for secured deployments
Setting Up Qdrant[](https://kilocode.ai/docs/features/codebase-indexing#setting-up-qdrant "Direct link to Setting Up Qdrant")
-------------------------------------------------------------------------------------------------------------------------------
### Quick Local Setup[](https://kilocode.ai/docs/features/codebase-indexing#quick-local-setup "Direct link to Quick Local Setup")
**Using Docker:**
docker run -p 6333:6333 qdrant/qdrant
**Using Docker Compose:**
version: '3.8'services: qdrant: image: qdrant/qdrant ports: - '6333:6333' volumes: - qdrant_storage:/qdrant/storagevolumes: qdrant_storage:
### Production Deployment[](https://kilocode.ai/docs/features/codebase-indexing#production-deployment "Direct link to Production Deployment")
For team or production use:
* [Qdrant Cloud](https://cloud.qdrant.io/)
- Managed service
* Self-hosted on AWS, GCP, or Azure
* Local server with network access for team sharing
Configuration[](https://kilocode.ai/docs/features/codebase-indexing#configuration "Direct link to Configuration")
-------------------------------------------------------------------------------------------------------------------
1. Open Kilo Code settings ( icon)
2. Navigate to **Codebase Indexing** section
3. Enable **"Enable Codebase Indexing"** using the toggle switch
4. Configure your embedding provider:
* **OpenAI**: Enter API key and select model
* **Gemini**: Enter Google AI API key and select embedding model
* **Ollama**: Enter base URL and select model
5. Set Qdrant URL and optional API key
6. Configure **Max Search Results** (default: 20, range: 1-100)
7. Click **Save** to start initial indexing
### Enable/Disable Toggle[](https://kilocode.ai/docs/features/codebase-indexing#enabledisable-toggle "Direct link to Enable/Disable Toggle")
The codebase indexing feature includes a convenient toggle switch that allows you to:
* **Enable**: Start indexing your codebase and make the search tool available
* **Disable**: Stop indexing, pause file watching, and disable the search functionality
* **Preserve Settings**: Your configuration remains saved when toggling off
This toggle is useful for temporarily disabling indexing during intensive development work or when working with sensitive codebases.
Understanding Index Status[](https://kilocode.ai/docs/features/codebase-indexing#understanding-index-status "Direct link to Understanding Index Status")
----------------------------------------------------------------------------------------------------------------------------------------------------------
The interface shows real-time status with color indicators:
* **Standby** (Gray): Not running, awaiting configuration
* **Indexing** (Yellow): Currently processing files
* **Indexed** (Green): Up-to-date and ready for searches
* **Error** (Red): Failed state requiring attention
How Files Are Processed[](https://kilocode.ai/docs/features/codebase-indexing#how-files-are-processed "Direct link to How Files Are Processed")
-------------------------------------------------------------------------------------------------------------------------------------------------
### Smart Code Parsing[](https://kilocode.ai/docs/features/codebase-indexing#smart-code-parsing "Direct link to Smart Code Parsing")
* **Tree-sitter Integration**: Uses AST parsing to identify semantic code blocks
* **Language Support**: All languages supported by Tree-sitter
* **Markdown Support**: Full support for markdown files and documentation
* **Fallback**: Line-based chunking for unsupported file types
* **Block Sizing**:
* Minimum: 100 characters
* Maximum: 1,000 characters
* Splits large functions intelligently
### Automatic File Filtering[](https://kilocode.ai/docs/features/codebase-indexing#automatic-file-filtering "Direct link to Automatic File Filtering")
The indexer automatically excludes:
* Binary files and images
* Large files (>1MB)
* Git repositories (`.git` folders)
* Dependencies (`node_modules`, `vendor`, etc.)
* Files matching `.gitignore` and `.kilocode` patterns
### Incremental Updates[](https://kilocode.ai/docs/features/codebase-indexing#incremental-updates "Direct link to Incremental Updates")
* **File Watching**: Monitors workspace for changes
* **Smart Updates**: Only reprocesses modified files
* **Hash-based Caching**: Avoids reprocessing unchanged content
* **Branch Switching**: Automatically handles Git branch changes
Best Practices[](https://kilocode.ai/docs/features/codebase-indexing#best-practices "Direct link to Best Practices")
----------------------------------------------------------------------------------------------------------------------
### Model Selection[](https://kilocode.ai/docs/features/codebase-indexing#model-selection "Direct link to Model Selection")
**For OpenAI:**
* **`text-embedding-3-small`**: Best balance of performance and cost
* **`text-embedding-3-large`**: Higher accuracy, 5x more expensive
* **`text-embedding-ada-002`**: Legacy model, lower cost
**For Ollama:**
* **`mxbai-embed-large`**: The largest and highest-quality embedding model.
* **`nomic-embed-text`**: Best balance of performance and embedding quality.
* **`all-minilm`**: Compact model with lower quality but faster performance.
### Security Considerations[](https://kilocode.ai/docs/features/codebase-indexing#security-considerations "Direct link to Security Considerations")
* **API Keys**: Stored securely in VS Code's encrypted storage
* **Code Privacy**: Only small code snippets sent for embedding (not full files)
* **Local Processing**: All parsing happens locally
* **Qdrant Security**: Use authentication for production deployments
Current Limitations[](https://kilocode.ai/docs/features/codebase-indexing#current-limitations "Direct link to Current Limitations")
-------------------------------------------------------------------------------------------------------------------------------------
* **File Size**: 1MB maximum per file
* **Single Workspace**: One workspace at a time
* **Dependencies**: Requires external services (embedding provider + Qdrant)
* **Language Coverage**: Limited to Tree-sitter supported languages for optimal parsing
Using the Search Feature[](https://kilocode.ai/docs/features/codebase-indexing#using-the-search-feature "Direct link to Using the Search Feature")
----------------------------------------------------------------------------------------------------------------------------------------------------
Once indexed, Kilo Code can use the [`codebase_search`](https://kilocode.ai/docs/advanced-usage/available-tools/codebase-search)
tool to find relevant code:
**Example Queries:**
* "How is user authentication handled?"
* "Database connection setup"
* "Error handling patterns"
* "API endpoint definitions"
The tool provides Kilo Code with:
* Relevant code snippets (up to your configured max results limit)
* File paths and line numbers
* Similarity scores
* Contextual information
### Search Results Configuration[](https://kilocode.ai/docs/features/codebase-indexing#search-results-configuration "Direct link to Search Results Configuration")
You can control the number of search results returned by adjusting the **Max Search Results** setting:
* **Default**: 20 results
* **Range**: 1-100 results
* **Performance**: Lower values improve response speed
* **Comprehensiveness**: Higher values provide more context but may slow responses
Privacy & Security[](https://kilocode.ai/docs/features/codebase-indexing#privacy--security "Direct link to Privacy & Security")
---------------------------------------------------------------------------------------------------------------------------------
* **Code stays local**: Only small code snippets sent for embedding
* **Embeddings are numeric**: Not human-readable representations
* **Secure storage**: API keys encrypted in VS Code storage
* **Local option**: Use Ollama for completely local processing
* **Access control**: Respects existing file permissions
Future Enhancements[](https://kilocode.ai/docs/features/codebase-indexing#future-enhancements "Direct link to Future Enhancements")
-------------------------------------------------------------------------------------------------------------------------------------
Planned improvements:
* Additional embedding providers
* Multi-workspace indexing
* Enhanced filtering and configuration options
* Team sharing capabilities
* Integration with VS Code's native search
* [What It Does](https://kilocode.ai/docs/features/codebase-indexing#what-it-does)
* [Key Benefits](https://kilocode.ai/docs/features/codebase-indexing#key-benefits)
* [Setup Requirements](https://kilocode.ai/docs/features/codebase-indexing#setup-requirements)
* [Embedding Provider](https://kilocode.ai/docs/features/codebase-indexing#embedding-provider)
* [Vector Database](https://kilocode.ai/docs/features/codebase-indexing#vector-database)
* [Setting Up Qdrant](https://kilocode.ai/docs/features/codebase-indexing#setting-up-qdrant)
* [Quick Local Setup](https://kilocode.ai/docs/features/codebase-indexing#quick-local-setup)
* [Production Deployment](https://kilocode.ai/docs/features/codebase-indexing#production-deployment)
* [Configuration](https://kilocode.ai/docs/features/codebase-indexing#configuration)
* [Enable/Disable Toggle](https://kilocode.ai/docs/features/codebase-indexing#enabledisable-toggle)
* [Understanding Index Status](https://kilocode.ai/docs/features/codebase-indexing#understanding-index-status)
* [How Files Are Processed](https://kilocode.ai/docs/features/codebase-indexing#how-files-are-processed)
* [Smart Code Parsing](https://kilocode.ai/docs/features/codebase-indexing#smart-code-parsing)
* [Automatic File Filtering](https://kilocode.ai/docs/features/codebase-indexing#automatic-file-filtering)
* [Incremental Updates](https://kilocode.ai/docs/features/codebase-indexing#incremental-updates)
* [Best Practices](https://kilocode.ai/docs/features/codebase-indexing#best-practices)
* [Model Selection](https://kilocode.ai/docs/features/codebase-indexing#model-selection)
* [Security Considerations](https://kilocode.ai/docs/features/codebase-indexing#security-considerations)
* [Current Limitations](https://kilocode.ai/docs/features/codebase-indexing#current-limitations)
* [Using the Search Feature](https://kilocode.ai/docs/features/codebase-indexing#using-the-search-feature)
* [Search Results Configuration](https://kilocode.ai/docs/features/codebase-indexing#search-results-configuration)
* [Privacy & Security](https://kilocode.ai/docs/features/codebase-indexing#privacy--security)
* [Future Enhancements](https://kilocode.ai/docs/features/codebase-indexing#future-enhancements)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Fcodebase-indexing)
---
# Connecting Your First AI Provider | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/getting-started/connecting-api-provider#__docusaurus_skipToContent_fallback)
On this page
Kilo Code requires an API key from an AI model provider to function. We recommend these options for accessing the powerful **Claude 3.7 Sonnet** model:
* **OpenRouter (Recommended):** Provides access to multiple AI models through a single API key. Ideal for getting started quickly with minimal setup. [View pricing](https://openrouter.ai/models?order=pricing-low-to-high)
.
* **Anthropic:** Direct access to Claude models. Requires API access approval and may have [rate limits depending on your tier](https://docs.anthropic.com/en/api/rate-limits#requirements-to-advance-tier)
. See [Anthropic's pricing page](https://www.anthropic.com/pricing#anthropic-api)
for details.
Getting Your API Key[](https://kilocode.ai/docs/getting-started/connecting-api-provider#getting-your-api-key "Direct link to Getting Your API Key")
-----------------------------------------------------------------------------------------------------------------------------------------------------
### Option 1: LLM Routers[](https://kilocode.ai/docs/getting-started/connecting-api-provider#option-1-llm-routers "Direct link to Option 1: LLM Routers")
LLM routers let you access multiple AI models with one API key, simplifying cost management and switching between models. They often offer [competitive pricing](https://openrouter.ai/models?order=pricing-low-to-high)
compared to direct providers.
#### OpenRouter[](https://kilocode.ai/docs/getting-started/connecting-api-provider#openrouter "Direct link to OpenRouter")
1. Go to [openrouter.ai](https://openrouter.ai/)
2. Sign in with your Google or GitHub account
3. Navigate to the [API keys page](https://openrouter.ai/keys)
and create a new key
4. Copy your API key - you'll need this for Kilo Code setup

_OpenRouter dashboard with "Create key" button. Name your key and copy it after creation._
#### Requesty[](https://kilocode.ai/docs/getting-started/connecting-api-provider#requesty "Direct link to Requesty")
1. Go to [requesty.ai](https://requesty.ai/)
2. Sign in with your Google account or email
3. Navigate to the [API management page](https://app.requesty.ai/manage-api)
and create a new key
4. **Important:** Copy your API key immediately as it won't be displayed again

_Requesty API management page with "Create API Key" button. Copy your key immediately - it's shown only once._
### Option 2: Direct Providers[](https://kilocode.ai/docs/getting-started/connecting-api-provider#option-2-direct-providers "Direct link to Option 2: Direct Providers")
For direct access to specific models from their original providers, with full access to their features and capabilities:
#### Anthropic[](https://kilocode.ai/docs/getting-started/connecting-api-provider#anthropic "Direct link to Anthropic")
1. Go to [console.anthropic.com](https://console.anthropic.com/)
2. Sign up for an account or log in
3. Navigate to the [API keys section](https://console.anthropic.com/settings/keys)
and create a new key
4. **Important:** Copy your API key immediately as it won't be displayed again

_Anthropic console API Keys section with "Create key" button. Name your key, set expiration, and copy it immediately._
#### OpenAI[](https://kilocode.ai/docs/getting-started/connecting-api-provider#openai "Direct link to OpenAI")
1. Go to [platform.openai.com](https://platform.openai.com/)
2. Sign up for an account or log in
3. Navigate to the [API keys section](https://platform.openai.com/api-keys)
and create a new key
4. **Important:** Copy your API key immediately as it won't be displayed again

_OpenAI platform with "Create new secret key" button. Name your key and copy it immediately after creation._
Configuring Kilo Code in VS Code[](https://kilocode.ai/docs/getting-started/connecting-api-provider#configuring-kilo-code-in-vs-code "Direct link to Configuring Kilo Code in VS Code")
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Once you have your API key:
1. Open the Kilo Code sidebar by clicking the Kilo Code icon () in the VS Code Side Bar
2. In the welcome screen, select your API provider from the dropdown
3. Paste your API key into the appropriate field
4. Select your model:
* For **OpenRouter**: select `anthropic/claude-3.7-sonnet` ([model details](https://openrouter.ai/anthropic/claude-3.7-sonnet)
)
* For **Anthropic**: select `claude-3-7-sonnet-20250219` ([model details](https://www.anthropic.com/pricing#anthropic-api)
)
5. Click "Let's go!" to save your settings and start using Kilo Code
* [Getting Your API Key](https://kilocode.ai/docs/getting-started/connecting-api-provider#getting-your-api-key)
* [Option 1: LLM Routers](https://kilocode.ai/docs/getting-started/connecting-api-provider#option-1-llm-routers)
* [Option 2: Direct Providers](https://kilocode.ai/docs/getting-started/connecting-api-provider#option-2-direct-providers)
* [Configuring Kilo Code in VS Code](https://kilocode.ai/docs/getting-started/connecting-api-provider#configuring-kilo-code-in-vs-code)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fgetting-started%2Fconnecting-api-provider)
---
# Orchestrator Mode: Coordinate Complex Workflows | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/basic-usage/orchestrator-mode#__docusaurus_skipToContent_fallback)
On this page
Orchestrator Mode (formerly known as Boomerang Tasks) allows you to break down complex projects into smaller, manageable pieces. Think of it like delegating parts of your work to specialized assistants. Each subtask runs in its own context, often using a different Kilo Code mode tailored for that specific job (like [`code`](https://kilocode.ai/docs/basic-usage/using-modes#code-mode-default)
, [`architect`](https://kilocode.ai/docs/basic-usage/using-modes#architect-mode)
, or [`debug`](https://kilocode.ai/docs/basic-usage/using-modes#debug-mode)
).
Orchestrator Mode explained and demonstrated
Why Use Orchestrator Mode?[](https://kilocode.ai/docs/basic-usage/orchestrator-mode#why-use-orchestrator-mode "Direct link to Why Use Orchestrator Mode?")
------------------------------------------------------------------------------------------------------------------------------------------------------------
* **Tackle Complexity:** Break large, multi-step projects (e.g., building a full feature) into focused subtasks (e.g., design, implementation, documentation).
* **Use Specialized Modes:** Automatically delegate subtasks to the mode best suited for that specific piece of work, leveraging specialized capabilities for optimal results.
* **Maintain Focus & Efficiency:** Each subtask operates in its own isolated context with a separate conversation history. This prevents the parent (orchestrator) task from becoming cluttered with the detailed execution steps (like code diffs or file analysis results), allowing it to focus efficiently on the high-level workflow and manage the overall process based on concise summaries from completed subtasks.
* **Streamline Workflows:** Results from one subtask can be automatically passed to the next, creating a smooth flow (e.g., architectural decisions feeding into the coding task).
How It Works[](https://kilocode.ai/docs/basic-usage/orchestrator-mode#how-it-works "Direct link to How It Works")
-------------------------------------------------------------------------------------------------------------------
1. Using Orchestrator Mode, Kilo can analyze a complex task and suggest breaking it down into a subtask[1](https://kilocode.ai/docs/basic-usage/orchestrator-mode#user-content-fn-1)
.
2. The parent task pauses, and the new subtask begins in a different mode[2](https://kilocode.ai/docs/basic-usage/orchestrator-mode#user-content-fn-2)
.
3. When the subtask's goal is achieved, Kilo signals completion.
4. The parent task resumes with only the summary[3](https://kilocode.ai/docs/basic-usage/orchestrator-mode#user-content-fn-3)
of the subtask. The parent uses this summary to continue the main workflow.
Key Considerations[](https://kilocode.ai/docs/basic-usage/orchestrator-mode#key-considerations "Direct link to Key Considerations")
-------------------------------------------------------------------------------------------------------------------------------------
* **Approval Required:** By default, you must approve the creation and completion of each subtask. This can be automated via the [Auto-Approving Actions](https://kilocode.ai/docs/features/auto-approving-actions#subtasks)
settings if desired.
* **Context Isolation and Transfer:** Each subtask operates in complete isolation with its own conversation history. It does not automatically inherit the parent's context. Information must be explicitly passed:
* **Down:** Via the initial instructions provided when the subtask is created.
* **Up:** Via the final summary provided when the subtask finishes. Be mindful that only this summary returns to the parent.
* **Navigation:** Kilo's interface helps you see the hierarchy of tasks (which task is the parent, which are children). You can typically navigate between active and paused tasks.
Orchestrator Mode provides a powerful way to manage complex development workflows directly within Kilo Code, leveraging specialized modes for maximum efficiency.
Keep Tasks Focused
Use subtasks to maintain clarity. If a request significantly shifts focus or requires a different expertise (mode), consider creating a subtask rather than overloading the current one.
Footnotes[](https://kilocode.ai/docs/basic-usage/orchestrator-mode#footnote-label "Direct link to Footnotes")
---------------------------------------------------------------------------------------------------------------
1. This context is passed via the `message` parameter of the [`new_task`](https://kilocode.ai/docs/features/tools/new-task)
tool. [↩](https://kilocode.ai/docs/basic-usage/orchestrator-mode#user-content-fnref-1)
2. The mode for the subtask is specified via the `mode` parameter of the [`new_task`](https://kilocode.ai/docs/features/tools/new-task)
tool during initiation. [↩](https://kilocode.ai/docs/basic-usage/orchestrator-mode#user-content-fnref-2)
3. This summary is passed via the `result` parameter of the [`attempt_completion`](https://kilocode.ai/docs/features/tools/attempt-completion)
tool when the subtask finishes. [↩](https://kilocode.ai/docs/basic-usage/orchestrator-mode#user-content-fnref-3)
* [Why Use Orchestrator Mode?](https://kilocode.ai/docs/basic-usage/orchestrator-mode#why-use-orchestrator-mode)
* [How It Works](https://kilocode.ai/docs/basic-usage/orchestrator-mode#how-it-works)
* [Key Considerations](https://kilocode.ai/docs/basic-usage/orchestrator-mode#key-considerations)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fbasic-usage%2Forchestrator-mode)
---
# Starting Your First Task with Kilo Code | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/getting-started/your-first-task#__docusaurus_skipToContent_fallback)
On this page
Now that you've [set up Kilo Code](https://kilocode.ai/docs/getting-started/setting-up)
, you're ready to start using Kilo Code! This guide walks you through your first interaction.
Step 1: Open the Kilo Code Panel[](https://kilocode.ai/docs/getting-started/your-first-task#step-1-open-the-kilo-code-panel "Direct link to Step 1: Open the Kilo Code Panel")
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Click the Kilo Code icon () in the VS Code Primary Side Bar (vertical bar on the side of the window) to open the chat interface. If you don't see the icon, verify the extension is [installed](https://kilocode.ai/docs/getting-started/installing)
and enabled.

_The Kilo Code icon in the Primary Side Bar opens the chat interface._
Step 2: Type Your Task[](https://kilocode.ai/docs/getting-started/your-first-task#step-2-type-your-task "Direct link to Step 2: Type Your Task")
--------------------------------------------------------------------------------------------------------------------------------------------------
Type a clear, concise description of what you want Kilo Code to do in the chat box at the bottom of the panel. Examples of effective tasks:
* "Create a file named `hello.txt` containing 'Hello, world!'."
* "Write a Python function that adds two numbers."
* "Create an HTML file for a simple website with the title 'Kilo test'"
No special commands or syntax needed—just use plain English.

_Enter your task in natural language - no special syntax required._
Step 3: Send Your Task[](https://kilocode.ai/docs/getting-started/your-first-task#step-3-send-your-task "Direct link to Step 3: Send Your Task")
--------------------------------------------------------------------------------------------------------------------------------------------------
Press Enter or click the Send icon () to the right of the input box.
Step 4: Review and Approve Actions[](https://kilocode.ai/docs/getting-started/your-first-task#step-4-review-and-approve-actions "Direct link to Step 4: Review and Approve Actions")
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Kilo Code analyzes your request and proposes specific actions. These may include:
* **Reading files:** Shows file contents it needs to access
* **Writing to files:** Displays a diff with proposed changes (added lines in green, removed in red)
* **Executing commands:** Shows the exact command to run in your terminal
* **Using the Browser:** Outlines browser actions (click, type, etc.)
* **Asking questions:** Requests clarification when needed to proceed

_Kilo Code shows exactly what action it wants to perform and waits for your approval._
* In **Code** mode, many capabilities required to write code are enabled by default.
* In **Architect** and **Ask** modes, the agent will not write any code.
tip
The level of autonomy is configurable, allowing you to make the agent more or less autonomous.
You can learn more about [using modes](https://kilocode.ai/docs/basic-usage/using-modes)
and [auto-approving actions](https://kilocode.ai/docs/features/auto-approving-actions)
.
Step 5: Iterate[](https://kilocode.ai/docs/getting-started/your-first-task#step-5-iterate "Direct link to Step 5: Iterate")
-----------------------------------------------------------------------------------------------------------------------------
Kilo Code works iteratively. After each action, it waits for your feedback before proposing the next step. Continue this review-approve cycle until your task is complete.

_After completing the task, Kilo Code shows the final result and awaits your next instruction._
Conclusion[](https://kilocode.ai/docs/getting-started/your-first-task#conclusion "Direct link to Conclusion")
---------------------------------------------------------------------------------------------------------------
You've now completed your first task with Kilo Code! Through this process, you've learned:
* How to interact with Kilo Code using natural language
* The approval-based workflow that keeps you in control
* The iterative approach Kilo Code uses to solve problems step-by-step
This iterative, approval-based workflow is at the core of how Kilo Code works—letting AI handle the tedious parts of coding while you maintain complete oversight. Now that you understand the basics, you're ready to tackle more complex tasks, explore different [modes](https://kilocode.ai/docs/basic-usage/using-modes)
for specialized workflows, or try the [auto-approval feature](https://kilocode.ai/docs/features/auto-approving-actions)
to speed up repetitive tasks.
* [Step 1: Open the Kilo Code Panel](https://kilocode.ai/docs/getting-started/your-first-task#step-1-open-the-kilo-code-panel)
* [Step 2: Type Your Task](https://kilocode.ai/docs/getting-started/your-first-task#step-2-type-your-task)
* [Step 3: Send Your Task](https://kilocode.ai/docs/getting-started/your-first-task#step-3-send-your-task)
* [Step 4: Review and Approve Actions](https://kilocode.ai/docs/getting-started/your-first-task#step-4-review-and-approve-actions)
* [Step 5: Iterate](https://kilocode.ai/docs/getting-started/your-first-task#step-5-iterate)
* [Conclusion](https://kilocode.ai/docs/getting-started/your-first-task#conclusion)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fgetting-started%2Fyour-first-task)
---
# Browser Use | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/browser-use#__docusaurus_skipToContent_fallback)
On this page
Kilo Code provides sophisticated browser automation capabilities that let you interact with websites directly from VS Code. This feature enables testing web applications, automating browser tasks, and capturing screenshots without leaving your development environment.
Model Support Required
Browser Use within Kilo Code requires the use and advanced agentic model, and has only been tested with Claude Sonnet 3.5, 3.7, and 4
How Browser Use Works[](https://kilocode.ai/docs/features/browser-use#how-browser-use-works "Direct link to How Browser Use Works")
-------------------------------------------------------------------------------------------------------------------------------------
By default, Kilo Code uses a built-in browser that:
* Launches automatically when you ask Kilo to visit a website
* Captures screenshots of web pages
* Allows Kilo to interact with web elements
* Runs invisibly in the background
All of this happens directly within VS Code, with no setup required.
Using Browser Use[](https://kilocode.ai/docs/features/browser-use#using-browser-use "Direct link to Using Browser Use")
-------------------------------------------------------------------------------------------------------------------------
A typical browser interaction follows this pattern:
1. Ask Kilo to visit a website
2. Kilo launches the browser and shows you a screenshot
3. Request additional actions (clicking, typing, scrolling)
4. Kilo closes the browser when finished
For example:
Open the browser and view our site.
Can you check if my website at https://kilocode.ai is displaying correctly?
Browse http://localhost:3000, scroll down to the bottom of the page and check if the footer information is displaying correctly.

How Browser Actions Work[](https://kilocode.ai/docs/features/browser-use#how-browser-actions-work "Direct link to How Browser Actions Work")
----------------------------------------------------------------------------------------------------------------------------------------------
The browser\_action tool controls a browser instance that returns screenshots and console logs after each action, allowing you to see the results of interactions.
Key characteristics:
* Each browser session must start with `launch` and end with `close`
* Only one browser action can be used per message
* While the browser is active, no other tools can be used
* You must wait for the response (screenshot and logs) before performing the next action
### Available Browser Actions[](https://kilocode.ai/docs/features/browser-use#available-browser-actions "Direct link to Available Browser Actions")
| Action | Description | When to Use |
| --- | --- | --- |
| `launch` | Opens a browser at a URL | Starting a new browser session |
| `click` | Clicks at specific coordinates | Interacting with buttons, links, etc. |
| `type` | Types text into active element | Filling forms, search boxes |
| `scroll_down` | Scrolls down by one page | Viewing content below the fold |
| `scroll_up` | Scrolls up by one page | Returning to previous content |
| `close` | Closes the browser | Ending a browser session |
Browser Use Configuration/Settings[](https://kilocode.ai/docs/features/browser-use#browser-use-configurationsettings "Direct link to Browser Use Configuration/Settings")
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Default Browser Settings
* **Enable browser tool**: Enabled
* **Viewport size**: Small Desktop (900x600)
* **Screenshot quality**: 75%
* **Use remote browser connection**: Disabled
### Accessing Settings[](https://kilocode.ai/docs/features/browser-use#accessing-settings "Direct link to Accessing Settings")
To change Browser / Computer Use settings in Kilo:
1. Open Settings by clicking the gear icon → Browser / Computer Use

### Enable/Disable Browser Use[](https://kilocode.ai/docs/features/browser-use#enabledisable-browser-use "Direct link to Enable/Disable Browser Use")
**Purpose**: Master toggle that enables Kilo to interact with websites using a Puppeteer-controlled browser.
To change this setting:
1. Check or uncheck the "Enable browser tool" checkbox within your Browser / Computer Use settings

### Viewport Size[](https://kilocode.ai/docs/features/browser-use#viewport-size "Direct link to Viewport Size")
**Purpose**: Determines the resolution of the browser session Kilo Code uses.
**Tradeoff**: Higher values provide a larger viewport but increase token usage.
To change this setting:
1. Click the dropdown menu under "Viewport size" within your Browser / Computer Use settings
2. Select one of the available options:
* Large Desktop (1280x800)
* Small Desktop (900x600) - Default
* Tablet (768x1024)
* Mobile (360x640)
3. Select your desired resolution.

### Screenshot Quality[](https://kilocode.ai/docs/features/browser-use#screenshot-quality "Direct link to Screenshot Quality")
**Purpose**: Controls the WebP compression quality of browser screenshots.
**Tradeoff**: Higher values provide clearer screenshots but increase token usage.
To change this setting:
1. Adjust the slider under "Screenshot quality" within your Browser / Computer Use settings
2. Set a value between 1-100% (default is 75%)
3. Higher values provide clearer screenshots but increase token usage:
* 40-50%: Good for basic text-based websites
* 60-70%: Balanced for most general browsing
* 80%+: Use when fine visual details are critical

### Remote Browser Connection[](https://kilocode.ai/docs/features/browser-use#remote-browser-connection "Direct link to Remote Browser Connection")
**Purpose**: Connect Kilo to an existing Chrome browser instead of using the built-in browser.
**Benefits**:
* Works in containerized environments and remote development workflows
* Maintains authenticated sessions between browser uses
* Eliminates repetitive login steps
* Allows use of custom browser profiles with specific extensions
**Requirements**: Chrome must be running with remote debugging enabled.
To enable this feature:
1. Check the "Use remote browser connection" box in Browser / Computer Use settings
2. Click "Test Connection" to verify

#### Common Use Cases[](https://kilocode.ai/docs/features/browser-use#common-use-cases "Direct link to Common Use Cases")
* **DevContainers**: Connect from containerized VS Code to host Chrome browser
* **Remote Development**: Use local Chrome with remote VS Code server
* **Custom Chrome Profiles**: Use profiles with specific extensions and settings
#### Connecting to a Visible Chrome Window[](https://kilocode.ai/docs/features/browser-use#connecting-to-a-visible-chrome-window "Direct link to Connecting to a Visible Chrome Window")
Connect to a visible Chrome window to observe Kilo's interactions in real-time:
**macOS**
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug --no-first-run
**Windows**
"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 --user-data-dir=C:\chrome-debug --no-first-run
**Linux**
google-chrome --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug --no-first-run
* [How Browser Use Works](https://kilocode.ai/docs/features/browser-use#how-browser-use-works)
* [Using Browser Use](https://kilocode.ai/docs/features/browser-use#using-browser-use)
* [How Browser Actions Work](https://kilocode.ai/docs/features/browser-use#how-browser-actions-work)
* [Available Browser Actions](https://kilocode.ai/docs/features/browser-use#available-browser-actions)
* [Browser Use Configuration/Settings](https://kilocode.ai/docs/features/browser-use#browser-use-configurationsettings)
* [Accessing Settings](https://kilocode.ai/docs/features/browser-use#accessing-settings)
* [Enable/Disable Browser Use](https://kilocode.ai/docs/features/browser-use#enabledisable-browser-use)
* [Viewport Size](https://kilocode.ai/docs/features/browser-use#viewport-size)
* [Screenshot Quality](https://kilocode.ai/docs/features/browser-use#screenshot-quality)
* [Remote Browser Connection](https://kilocode.ai/docs/features/browser-use#remote-browser-connection)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Fbrowser-use)
---
# Suggested Responses | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/suggested-responses#__docusaurus_skipToContent_fallback)
On this page
When Kilo Code needs more information to complete a task, it uses the [`ask_followup_question` tool](https://kilocode.ai/docs/features/tools/ask-followup-question)
. To make responding easier and faster, Kilo Code often provides suggested answers alongside the question.
Overview[](https://kilocode.ai/docs/features/suggested-responses#overview "Direct link to Overview")
------------------------------------------------------------------------------------------------------
Suggested Responses appear as clickable buttons directly below Kilo Code's question in the chat interface. They offer pre-formulated answers relevant to the question, helping you provide input quickly.

How It Works[](https://kilocode.ai/docs/features/suggested-responses#how-it-works "Direct link to How It Works")
------------------------------------------------------------------------------------------------------------------
1. **Question Appears**: Kilo Code asks a question using the `ask_followup_question` tool.
2. **Suggestions Displayed**: If suggestions are provided by Kilo Code, they appear as buttons below the question.
3. **Interaction**: You can interact with these suggestions in two ways.
Interacting with Suggestions[](https://kilocode.ai/docs/features/suggested-responses#interacting-with-suggestions "Direct link to Interacting with Suggestions")
------------------------------------------------------------------------------------------------------------------------------------------------------------------
You have two options for using suggested responses:
1. **Direct Selection**:
* **Action**: Simply click the button containing the answer you want to provide.
* **Result**: The selected answer is immediately sent back to Kilo Code as your response. This is the quickest way to reply if one of the suggestions perfectly matches your intent.
2. **Edit Before Sending**:
* **Action**:
* Hold down `Shift` and click the suggestion button.
* _Alternatively_, hover over the suggestion button and click the pencil icon () that appears.
* **Result**: The text of the suggestion is copied into the chat input box. You can then modify the text as needed before pressing Enter to send your customized response. This is useful when a suggestion is close but needs minor adjustments.

Benefits[](https://kilocode.ai/docs/features/suggested-responses#benefits "Direct link to Benefits")
------------------------------------------------------------------------------------------------------
* **Speed**: Quickly respond without typing full answers.
* **Clarity**: Suggestions often clarify the type of information Kilo Code needs.
* **Flexibility**: Edit suggestions to provide precise, customized answers when needed.
This feature streamlines the interaction when Kilo Code requires clarification, allowing you to guide the task effectively with minimal effort.
* [Overview](https://kilocode.ai/docs/features/suggested-responses#overview)
* [How It Works](https://kilocode.ai/docs/features/suggested-responses#how-it-works)
* [Interacting with Suggestions](https://kilocode.ai/docs/features/suggested-responses#interacting-with-suggestions)
* [Benefits](https://kilocode.ai/docs/features/suggested-responses#benefits)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Fsuggested-responses)
---
# What is MCP? | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/mcp/what-is-mcp#__docusaurus_skipToContent_fallback)
On this page
MCP (Model Context Protocol) is a standardized communication protocol for LLM systems to interact with external tools and services. It functions as a universal adapter between AI assistants and various data sources or applications.
How It Works[](https://kilocode.ai/docs/features/mcp/what-is-mcp#how-it-works "Direct link to How It Works")
--------------------------------------------------------------------------------------------------------------
MCP uses a client-server architecture:
1. The AI assistant (client) connects to MCP servers
2. Each server provides specific capabilities (file access, database queries, API integrations)
3. The AI uses these capabilities through a standardized interface
4. Communication occurs via JSON-RPC 2.0 messages
Think of MCP as similar to a USB-C port in the sense that any compatible LLM can connect to any MCP server to access its functionality. This standardization eliminates the need to build custom integrations for each tool and service.
For example, an AI using MCP can perform tasks like "search our company database and generate a report" without requiring specialized code for each database system.
Common Questions[](https://kilocode.ai/docs/features/mcp/what-is-mcp#common-questions "Direct link to Common Questions")
--------------------------------------------------------------------------------------------------------------------------
* **Is MCP a cloud service?** MCP servers can run locally on your computer or remotely as cloud services, depending on the use case and security requirements.
* **Does MCP replace other integration methods?** No. MCP complements existing tools like API plugins and retrieval-augmented generation. It provides a standardized protocol for tool interaction but doesn't replace specialized integration approaches.
* **How is security handled?** Users control which MCP servers they connect to and what permissions those servers have. As with any tool that accesses data or services, use trusted sources and configure appropriate access controls.
MCP in Kilo Code[](https://kilocode.ai/docs/features/mcp/what-is-mcp#mcp-in-kilo-code "Direct link to MCP in Kilo Code")
--------------------------------------------------------------------------------------------------------------------------
Kilo Code implements the Model Context Protocol to:
* Connect to both local and remote MCP servers
* Provide a consistent interface for accessing tools
* Extend functionality without core modifications
* Enable specialized capabilities on demand
MCP provides a standardized way for AI systems to interact with external tools and services, making complex integrations more accessible and consistent.
Learn More About MCP[](https://kilocode.ai/docs/features/mcp/what-is-mcp#learn-more-about-mcp "Direct link to Learn More About MCP")
--------------------------------------------------------------------------------------------------------------------------------------
Ready to dig deeper? Check out these guides:
* [MCP Overview](https://kilocode.ai/docs/features/mcp/overview)
- A quick glance at the MCP documentation structure
* [Using MCP in Kilo Code](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code)
- Get started with MCP in Kilo Code, including creating simple servers
* [MCP vs API](https://kilocode.ai/docs/features/mcp/mcp-vs-api)
- Technical advantages compared to traditional APIs
* [STDIO & SSE Transports](https://kilocode.ai/docs/features/mcp/server-transports)
- Local vs. hosted deployment models
* [How It Works](https://kilocode.ai/docs/features/mcp/what-is-mcp#how-it-works)
* [Common Questions](https://kilocode.ai/docs/features/mcp/what-is-mcp#common-questions)
* [MCP in Kilo Code](https://kilocode.ai/docs/features/mcp/what-is-mcp#mcp-in-kilo-code)
* [Learn More About MCP](https://kilocode.ai/docs/features/mcp/what-is-mcp#learn-more-about-mcp)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Fmcp%2Fwhat-is-mcp)
---
# MCP vs API | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/mcp/mcp-vs-api#__docusaurus_skipToContent_fallback)
On this page
Comparing REST APIs to the Model Context Protocol (MCP) is a category error. They operate at different layers of abstraction and serve fundamentally different purposes in AI systems.
Architectural Differences[](https://kilocode.ai/docs/features/mcp/mcp-vs-api#architectural-differences "Direct link to Architectural Differences")
----------------------------------------------------------------------------------------------------------------------------------------------------
| Feature | MCP | REST APIs |
| --- | --- | --- |
| State Management | **Stateful** - maintains context across interactions | **Stateless** - each request is independent |
| Connection Type | Persistent, bidirectional connections | One-way request/response |
| Communication Style | JSON-RPC based with ongoing sessions | HTTP-based with discrete requests |
| Context Handling | Context is intrinsic to the protocol | Context must be manually managed |
| Tool Discovery | Runtime discovery of available tools | Design-time integration requiring prior knowledge |
| Integration Approach | Runtime integration with dynamic capabilities | Design-time integration requiring code changes |
Different Layers, Different Purposes[](https://kilocode.ai/docs/features/mcp/mcp-vs-api#different-layers-different-purposes "Direct link to Different Layers, Different Purposes")
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
REST APIs and MCP serve different tiers in the technology stack:
1. **REST**: Low-level web communication pattern that exposes operations on resources
2. **MCP**: High-level AI protocol that orchestrates tool usage and maintains context
MCP often uses REST APIs internally, but abstracts them away for the AI. Think of MCP as middleware that turns discrete web services into a cohesive environment the AI can operate within.
Context Preservation: Critical for AI Workflows[](https://kilocode.ai/docs/features/mcp/mcp-vs-api#context-preservation-critical-for-ai-workflows "Direct link to Context Preservation: Critical for AI Workflows")
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
MCP's stateful design solves a key limitation of REST in AI applications:
* **REST Approach**: Each call is isolated, requiring manual context passing between steps
* **MCP Approach**: One conversation context persists across multiple tool uses
For example, an AI debugging a codebase can open a file, run tests, and identify errors without losing context between steps. The MCP session maintains awareness of previous actions and results.
Dynamic Tool Discovery[](https://kilocode.ai/docs/features/mcp/mcp-vs-api#dynamic-tool-discovery "Direct link to Dynamic Tool Discovery")
-------------------------------------------------------------------------------------------------------------------------------------------
MCP enables an AI to discover and use tools at runtime:
// AI discovers available tools{ "tools": [ { "name": "readFile", "description": "Reads content from a file", "parameters": { "path": { "type": "string", "description": "File path" } } }, { "name": "createTicket", "description": "Creates a ticket in issue tracker", "parameters": { "title": { "type": "string" }, "description": { "type": "string" } } } ]}
This "plug-and-play" capability allows new tools to be added without redeploying or modifying the AI itself.
Real-World Example: Multi-Tool Workflow[](https://kilocode.ai/docs/features/mcp/mcp-vs-api#real-world-example-multi-tool-workflow "Direct link to Real-World Example: Multi-Tool Workflow")
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Consider a task requiring multiple services: "Check recent commits, create a JIRA ticket for the bug fix, and post to Slack."
**REST-based approach**:
* Requires separate integrations for Git, JIRA, and Slack APIs
* Needs custom code to manage context between calls
* Breaks if any service changes its API
**MCP-based approach**:
* One unified protocol for all tools
* Maintains context across the entire workflow
* New tools can be swapped in without code changes
Why Kilo Code Uses MCP[](https://kilocode.ai/docs/features/mcp/mcp-vs-api#why-kilo-code-uses-mcp "Direct link to Why Kilo Code Uses MCP")
-------------------------------------------------------------------------------------------------------------------------------------------
Kilo Code leverages MCP to provide:
1. **Extensibility**: Add unlimited custom tools without waiting for official integration
2. **Contextual awareness**: Tools can access conversation history and project context
3. **Simplified integration**: One standard protocol rather than numerous API patterns
4. **Runtime flexibility**: Discover and use new capabilities on-the-fly
MCP creates a universal connector between Kilo Code and external services, with REST APIs often powering those services behind the scenes.
Conclusion: Complementary, Not Competing Technologies[](https://kilocode.ai/docs/features/mcp/mcp-vs-api#conclusion-complementary-not-competing-technologies "Direct link to Conclusion: Complementary, Not Competing Technologies")
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
MCP doesn't replace REST APIs - it builds upon them. REST excels at providing discrete services, while MCP excels at orchestrating those services for AI agents.
The critical distinction is that MCP is AI-native: it treats the model as a first-class user, providing the contextual, stateful interaction layer that AI agents need to function effectively in complex environments.
* [Architectural Differences](https://kilocode.ai/docs/features/mcp/mcp-vs-api#architectural-differences)
* [Different Layers, Different Purposes](https://kilocode.ai/docs/features/mcp/mcp-vs-api#different-layers-different-purposes)
* [Context Preservation: Critical for AI Workflows](https://kilocode.ai/docs/features/mcp/mcp-vs-api#context-preservation-critical-for-ai-workflows)
* [Dynamic Tool Discovery](https://kilocode.ai/docs/features/mcp/mcp-vs-api#dynamic-tool-discovery)
* [Real-World Example: Multi-Tool Workflow](https://kilocode.ai/docs/features/mcp/mcp-vs-api#real-world-example-multi-tool-workflow)
* [Why Kilo Code Uses MCP](https://kilocode.ai/docs/features/mcp/mcp-vs-api#why-kilo-code-uses-mcp)
* [Conclusion: Complementary, Not Competing Technologies](https://kilocode.ai/docs/features/mcp/mcp-vs-api#conclusion-complementary-not-competing-technologies)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Fmcp%2Fmcp-vs-api)
---
# MCP Overview | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/mcp/overview#__docusaurus_skipToContent_fallback)
On this page
The Model Context Protocol (MCP) is a standard for extending Kilo Code's capabilities by connecting to external tools and services. MCP servers provide additional tools and resources that help Kilo Code accomplish tasks beyond its built-in capabilities, such as accessing databases, custom APIs, and specialized functionality.
MCP Documentation[](https://kilocode.ai/docs/features/mcp/overview#mcp-documentation "Direct link to MCP Documentation")
--------------------------------------------------------------------------------------------------------------------------
This documentation is organized into several sections:
* [**Using MCP in Kilo Code**](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code)
- Comprehensive guide to configuring, enabling, and managing MCP servers with Kilo Code. Includes server settings, tool approval, and troubleshooting.
* [**What is MCP?**](https://kilocode.ai/docs/features/mcp/what-is-mcp)
- Clear explanation of the Model Context Protocol, its client-server architecture, and how it enables AI systems to interact with external tools.
* [**STDIO & SSE Transports**](https://kilocode.ai/docs/features/mcp/server-transports)
- Detailed comparison of local (STDIO) and remote (SSE) transport mechanisms with deployment considerations for each approach.
* [**MCP vs API**](https://kilocode.ai/docs/features/mcp/mcp-vs-api)
- Analysis of the fundamental distinction between MCP and REST APIs, explaining how they operate at different layers of abstraction for AI systems.
* [MCP Documentation](https://kilocode.ai/docs/features/mcp/overview#mcp-documentation)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Fmcp%2Foverview)
---
# Code Actions | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/code-actions#__docusaurus_skipToContent_fallback)
On this page
Code Actions are a powerful feature of VS Code that provide quick fixes, refactorings, and other code-related suggestions directly within the editor. Kilo Code integrates with this system to offer AI-powered assistance for common coding tasks.
What are Code Actions?[](https://kilocode.ai/docs/features/code-actions#what-are-code-actions "Direct link to What are Code Actions?")
----------------------------------------------------------------------------------------------------------------------------------------
Code Actions appear as a lightbulb icon (💡) in the editor gutter (the area to the left of the line numbers). They can also be accessed via the right-click context menu, or via keyboard shortcut. They are triggered when:
* You select a range of code.
* Your cursor is on a line with a problem (error, warning, or hint).
* You invoke them via command.
Clicking the lightbulb, right-clicking and selecting "Kilo Code", or using the keyboard shortcut (`Ctrl+.` or `Cmd+.` on macOS, by default), displays a menu of available actions.

Kilo Code's Code Actions[](https://kilocode.ai/docs/features/code-actions#kilo-codes-code-actions "Direct link to Kilo Code's Code Actions")
----------------------------------------------------------------------------------------------------------------------------------------------
Kilo Code provides the following Code Actions:
* **Add to Context:** Quickly adds the selected code to your chat with Kilo, including line numbers so Kilo knows exactly where the code is from. It's listed first in the menu for easy access. (More details below).
* **Explain Code:** Asks Kilo Code to explain the selected code.
* **Fix Code:** Asks Kilo Code to fix problems in the selected code (available when diagnostics are present).
* **Improve Code:** Asks Kilo Code to suggest improvements to the selected code.
### Add to Context Deep Dive[](https://kilocode.ai/docs/features/code-actions#add-to-context-deep-dive "Direct link to Add to Context Deep Dive")
The **Add to Context** action is listed first in the Code Actions menu so you can quickly add code snippets to your conversation. When you use it, Kilo Code includes the filename and line numbers along with the code.
This helps Kilo understand the exact context of your code within the project, allowing it to provide more relevant and accurate assistance.

**Example Chat Input:**
Can you explain this function?@myFile.js:15:25
_(Where `@myFile.js:15:25` represents the code added via "Add to Context")_
Each of these actions can be performed "in a new task" or "in the current task."
Using Code Actions[](https://kilocode.ai/docs/features/code-actions#using-code-actions "Direct link to Using Code Actions")
-----------------------------------------------------------------------------------------------------------------------------
There are three main ways to use Kilo Code's Code Actions:
### 1\. From the Lightbulb (💡)[](https://kilocode.ai/docs/features/code-actions#1-from-the-lightbulb- "Direct link to 1. From the Lightbulb (💡)")
1. **Select Code:** Select the code you want to work with. You can select a single line, multiple lines, or an entire block of code.
2. **Look for the Lightbulb:** A lightbulb icon will appear in the gutter next to the selected code (or the line with the error/warning).
3. **Click the Lightbulb:** Click the lightbulb icon to open the Code Actions menu.
4. **Choose an Action:** Select the desired Kilo Code action from the menu.
5. **Review and Approve:** Kilo Code will propose a solution in the chat panel. Review the proposed changes and approve or reject them.
### 2\. From the Right-Click Context Menu[](https://kilocode.ai/docs/features/code-actions#2-from-the-right-click-context-menu "Direct link to 2. From the Right-Click Context Menu")
1. **Select Code:** Select the code you want to work with.
2. **Right-Click:** Right-click on the selected code to open the context menu.
3. **Choose "Kilo Code":** Select the "Kilo Code" option from the context menu. A submenu will appear with the available Kilo Code actions.
4. **Choose an Action:** Select the desired action from the submenu.
5. **Review and Approve:** Kilo Code will propose a solution in the chat panel. Review the proposed changes and approve or reject them.
### 3\. From the Command Palette[](https://kilocode.ai/docs/features/code-actions#3-from-the-command-palette "Direct link to 3. From the Command Palette")
1. **Select Code:** Select the code you want to work with.
2. **Open the Command Palette:** Press `Ctrl+Shift+P` (Windows/Linux) or `Cmd+Shift+P` (macOS).
3. **Type a Command:** Type "Kilo Code" to filter the commands, then choose the relevant code action (e.g., "Kilo Code: Explain Code"). You can also type the start of the command, like "Kilo Code: Explain", and select from the filtered list.
4. **Review and Approve:** Kilo Code will propose a solution in the chat panel. Review the proposed changes and approve or reject them.
Code Actions and Current Task[](https://kilocode.ai/docs/features/code-actions#code-actions-and-current-task "Direct link to Code Actions and Current Task")
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Each code action gives you two options:
* **in New Task:** Select this to begin a conversation with Kilo centered around this code action.
* **in Current Task:** If a conversation has already begun, this option will add the code action as an additional message.
Customizing Code Action Prompts[](https://kilocode.ai/docs/features/code-actions#customizing-code-action-prompts "Direct link to Customizing Code Action Prompts")
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
You can customize the prompts used for each Code Action by modifying the "Support Prompts" in the **Prompts** tab. This allows you to fine-tune the instructions given to the AI model and tailor the responses to your specific needs.
1. **Open the Prompts Tab:** Click the icon in the Kilo Code top menu bar.
2. **Find "Support Prompts":** You will see the support prompts, including "Enhance Prompt", "Explain Code", "Fix Code", and "Improve Code".
3. **Edit the Prompts:** Modify the text in the text area for the prompt you want to customize. You can use placeholders like `${filePath}` and `${selectedText}` to include information about the current file and selection.
4. **Click "Done":** Save your changes.
By using Kilo Code's Code Actions, you can quickly get AI-powered assistance directly within your coding workflow. This can save you time and help you write better code.
* [What are Code Actions?](https://kilocode.ai/docs/features/code-actions#what-are-code-actions)
* [Kilo Code's Code Actions](https://kilocode.ai/docs/features/code-actions#kilo-codes-code-actions)
* [Add to Context Deep Dive](https://kilocode.ai/docs/features/code-actions#add-to-context-deep-dive)
* [Using Code Actions](https://kilocode.ai/docs/features/code-actions#using-code-actions)
* [1\. From the Lightbulb (💡)](https://kilocode.ai/docs/features/code-actions#1-from-the-lightbulb-)
* [2\. From the Right-Click Context Menu](https://kilocode.ai/docs/features/code-actions#2-from-the-right-click-context-menu)
* [3\. From the Command Palette](https://kilocode.ai/docs/features/code-actions#3-from-the-command-palette)
* [Code Actions and Current Task](https://kilocode.ai/docs/features/code-actions#code-actions-and-current-task)
* [Customizing Code Action Prompts](https://kilocode.ai/docs/features/code-actions#customizing-code-action-prompts)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Fcode-actions)
---
# Additional Features | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/more-features#__docusaurus_skipToContent_fallback)
On this page
This page describes additional features in Kilo Code that enhance your development workflow.
Suggested Responses[](https://kilocode.ai/docs/features/more-features#suggested-responses "Direct link to Suggested Responses")
---------------------------------------------------------------------------------------------------------------------------------
Kilo Code provides suggested responses to questions, saving you time typing. These suggestions appear as buttons below the chat input box after you ask a question. Click a suggestion to quickly use it as your next prompt.
This feature aims to streamline your workflow by anticipating your potential follow-up questions and providing one-click access to relevant prompts.
Text to Speech[](https://kilocode.ai/docs/features/more-features#text-to-speech "Direct link to Text to Speech")
------------------------------------------------------------------------------------------------------------------
Kilo Code includes a Text-to-Speech (TTS) feature that reads out the AI responses, allowing you to listen to the information instead of reading it. This can be helpful for accessibility, learning, or simply for a change of pace.
To use Text-to-Speech, simply enable it in the Kilo Code settings. Once enabled, a speaker icon will appear next to each AI response in the chat. Click the icon to start listening.
Global Language Support[](https://kilocode.ai/docs/features/more-features#global-language-support "Direct link to Global Language Support")
---------------------------------------------------------------------------------------------------------------------------------------------
Kilo Code supports 14 languages, making it accessible to a wider range of users globally. You can now use Kilo Code in:
* Simplified Chinese
* Traditional Chinese
* Spanish
* Hindi
* French
* Portuguese
* German
* Japanese
* Korean
* Italian
* Turkish
* Vietnamese
* Polish
* Catalan
To change your language, go to **Advanced Settings > Language** in the Kilo Code settings panel.
This global update ensures a smoother and more inclusive coding experience for users around the world.
* [Suggested Responses](https://kilocode.ai/docs/features/more-features#suggested-responses)
* [Text to Speech](https://kilocode.ai/docs/features/more-features#text-to-speech)
* [Global Language Support](https://kilocode.ai/docs/features/more-features#global-language-support)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Fmore-features)
---
# MCP Server Transports | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/mcp/server-transports#__docusaurus_skipToContent_fallback)
On this page
Model Context Protocol (MCP) supports two primary transport mechanisms for communication between Kilo Code and MCP servers: Standard Input/Output (STDIO) and Server-Sent Events (SSE). Each has distinct characteristics, advantages, and use cases.
STDIO Transport[](https://kilocode.ai/docs/features/mcp/server-transports#stdio-transport "Direct link to STDIO Transport")
-----------------------------------------------------------------------------------------------------------------------------
STDIO transport runs locally on your machine and communicates via standard input/output streams.
### How STDIO Transport Works[](https://kilocode.ai/docs/features/mcp/server-transports#how-stdio-transport-works "Direct link to How STDIO Transport Works")
1. The client (Kilo Code) spawns an MCP server as a child process
2. Communication happens through process streams: client writes to server's STDIN, server responds to STDOUT
3. Each message is delimited by a newline character
4. Messages are formatted as JSON-RPC 2.0
Client Server | | |---- JSON message ------>| (via STDIN) | | (processes request) |<---- JSON message ------| (via STDOUT) | |
### STDIO Characteristics[](https://kilocode.ai/docs/features/mcp/server-transports#stdio-characteristics "Direct link to STDIO Characteristics")
* **Locality**: Runs on the same machine as Kilo Code
* **Performance**: Very low latency and overhead (no network stack involved)
* **Simplicity**: Direct process communication without network configuration
* **Relationship**: One-to-one relationship between client and server
* **Security**: Inherently more secure as no network exposure
### When to Use STDIO[](https://kilocode.ai/docs/features/mcp/server-transports#when-to-use-stdio "Direct link to When to Use STDIO")
STDIO transport is ideal for:
* Local integrations and tools running on the same machine
* Security-sensitive operations
* Low-latency requirements
* Single-client scenarios (one Kilo Code instance per server)
* Command-line tools or IDE extensions
### STDIO Implementation Example[](https://kilocode.ai/docs/features/mcp/server-transports#stdio-implementation-example "Direct link to STDIO Implementation Example")
import { Server } from '@modelcontextprotocol/sdk/server/index.js';import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';const server = new Server({name: 'local-server', version: '1.0.0'});// Register tools...// Use STDIO transportconst transport = new StdioServerTransport(server);transport.listen();
SSE Transport[](https://kilocode.ai/docs/features/mcp/server-transports#sse-transport "Direct link to SSE Transport")
-----------------------------------------------------------------------------------------------------------------------
Server-Sent Events (SSE) transport runs on a remote server and communicates over HTTP/HTTPS.
### How SSE Transport Works[](https://kilocode.ai/docs/features/mcp/server-transports#how-sse-transport-works "Direct link to How SSE Transport Works")
1. The client (Kilo Code) connects to the server's SSE endpoint via HTTP GET request
2. This establishes a persistent connection where the server can push events to the client
3. For client-to-server communication, the client makes HTTP POST requests to a separate endpoint
4. Communication happens over two channels:
* Event Stream (GET): Server-to-client updates
* Message Endpoint (POST): Client-to-server requests
Client Server | | |---- HTTP GET /events ----------->| (establish SSE connection) |<---- SSE event stream -----------| (persistent connection) | | |---- HTTP POST /message --------->| (client request) |<---- SSE event with response ----| (server response) | |
### SSE Characteristics[](https://kilocode.ai/docs/features/mcp/server-transports#sse-characteristics "Direct link to SSE Characteristics")
* **Remote Access**: Can be hosted on a different machine from Kilo Code
* **Scalability**: Can handle multiple client connections concurrently
* **Protocol**: Works over standard HTTP (no special protocols needed)
* **Persistence**: Maintains a persistent connection for server-to-client messages
* **Authentication**: Can use standard HTTP authentication mechanisms
### When to Use SSE[](https://kilocode.ai/docs/features/mcp/server-transports#when-to-use-sse "Direct link to When to Use SSE")
SSE transport is better for:
* Remote access across networks
* Multi-client scenarios
* Public services
* Centralized tools that many users need to access
* Integration with web services
### SSE Implementation Example[](https://kilocode.ai/docs/features/mcp/server-transports#sse-implementation-example "Direct link to SSE Implementation Example")
import { Server } from '@modelcontextprotocol/sdk/server/index.js';import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';import express from 'express';const app = express();const server = new Server({name: 'remote-server', version: '1.0.0'});// Register tools...// Use SSE transportconst transport = new SSEServerTransport(server);app.use('/mcp', transport.requestHandler());app.listen(3000, () => { console.log('MCP server listening on port 3000');});
Local vs. Hosted: Deployment Aspects[](https://kilocode.ai/docs/features/mcp/server-transports#local-vs-hosted-deployment-aspects "Direct link to Local vs. Hosted: Deployment Aspects")
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The choice between STDIO and SSE transports directly impacts how you'll deploy and manage your MCP servers.
### STDIO: Local Deployment Model[](https://kilocode.ai/docs/features/mcp/server-transports#stdio-local-deployment-model "Direct link to STDIO: Local Deployment Model")
STDIO servers run locally on the same machine as Kilo Code, which has several important implications:
* **Installation**: The server executable must be installed on each user's machine
* **Distribution**: You need to provide installation packages for different operating systems
* **Updates**: Each instance must be updated separately
* **Resources**: Uses the local machine's CPU, memory, and disk
* **Access Control**: Relies on the local machine's filesystem permissions
* **Integration**: Easy integration with local system resources (files, processes)
* **Execution**: Starts and stops with Kilo Code (child process lifecycle)
* **Dependencies**: Any dependencies must be installed on the user's machine
#### Practical Example[](https://kilocode.ai/docs/features/mcp/server-transports#practical-example "Direct link to Practical Example")
A local file search tool using STDIO would:
* Run on the user's machine
* Have direct access to the local filesystem
* Start when needed by Kilo Code
* Not require network configuration
* Need to be installed alongside Kilo Code or via a package manager
### SSE: Hosted Deployment Model[](https://kilocode.ai/docs/features/mcp/server-transports#sse-hosted-deployment-model "Direct link to SSE: Hosted Deployment Model")
SSE servers can be deployed to remote servers and accessed over the network:
* **Installation**: Installed once on a server, accessed by many users
* **Distribution**: Single deployment serves multiple clients
* **Updates**: Centralized updates affect all users immediately
* **Resources**: Uses server resources, not local machine resources
* **Access Control**: Managed through authentication and authorization systems
* **Integration**: More complex integration with user-specific resources
* **Execution**: Runs as an independent service (often continuously)
* **Dependencies**: Managed on the server, not on user machines
#### Practical Example[](https://kilocode.ai/docs/features/mcp/server-transports#practical-example-1 "Direct link to Practical Example")
A database query tool using SSE would:
* Run on a central server
* Connect to databases with server-side credentials
* Be continuously available for multiple users
* Require proper network security configuration
* Be deployed using container or cloud technologies
### Hybrid Approaches[](https://kilocode.ai/docs/features/mcp/server-transports#hybrid-approaches "Direct link to Hybrid Approaches")
Some scenarios benefit from a hybrid approach:
1. **STDIO with Network Access**: A local STDIO server that acts as a proxy to remote services
2. **SSE with Local Commands**: A remote SSE server that can trigger operations on the client machine through callbacks
3. **Gateway Pattern**: STDIO servers for local operations that connect to SSE servers for specialized functions
Choosing Between STDIO and SSE[](https://kilocode.ai/docs/features/mcp/server-transports#choosing-between-stdio-and-sse "Direct link to Choosing Between STDIO and SSE")
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| Consideration | STDIO | SSE |
| --- | --- | --- |
| **Location** | Local machine only | Local or remote |
| **Clients** | Single client | Multiple clients |
| **Performance** | Lower latency | Higher latency (network overhead) |
| **Setup Complexity** | Simpler | More complex (requires HTTP server) |
| **Security** | Inherently secure | Requires explicit security measures |
| **Network Access** | Not needed | Required |
| **Scalability** | Limited to local machine | Can distribute across network |
| **Deployment** | Per-user installation | Centralized installation |
| **Updates** | Distributed updates | Centralized updates |
| **Resource Usage** | Uses client resources | Uses server resources |
| **Dependencies** | Client-side dependencies | Server-side dependencies |
Configuring Transports in Kilo Code[](https://kilocode.ai/docs/features/mcp/server-transports#configuring-transports-in-kilo-code "Direct link to Configuring Transports in Kilo Code")
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
For detailed information on configuring STDIO and SSE transports in Kilo Code, including example configurations, see the [Understanding Transport Types](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#understanding-transport-types)
section in the Using MCP in Kilo Code guide.
* [STDIO Transport](https://kilocode.ai/docs/features/mcp/server-transports#stdio-transport)
* [How STDIO Transport Works](https://kilocode.ai/docs/features/mcp/server-transports#how-stdio-transport-works)
* [STDIO Characteristics](https://kilocode.ai/docs/features/mcp/server-transports#stdio-characteristics)
* [When to Use STDIO](https://kilocode.ai/docs/features/mcp/server-transports#when-to-use-stdio)
* [STDIO Implementation Example](https://kilocode.ai/docs/features/mcp/server-transports#stdio-implementation-example)
* [SSE Transport](https://kilocode.ai/docs/features/mcp/server-transports#sse-transport)
* [How SSE Transport Works](https://kilocode.ai/docs/features/mcp/server-transports#how-sse-transport-works)
* [SSE Characteristics](https://kilocode.ai/docs/features/mcp/server-transports#sse-characteristics)
* [When to Use SSE](https://kilocode.ai/docs/features/mcp/server-transports#when-to-use-sse)
* [SSE Implementation Example](https://kilocode.ai/docs/features/mcp/server-transports#sse-implementation-example)
* [Local vs. Hosted: Deployment Aspects](https://kilocode.ai/docs/features/mcp/server-transports#local-vs-hosted-deployment-aspects)
* [STDIO: Local Deployment Model](https://kilocode.ai/docs/features/mcp/server-transports#stdio-local-deployment-model)
* [SSE: Hosted Deployment Model](https://kilocode.ai/docs/features/mcp/server-transports#sse-hosted-deployment-model)
* [Hybrid Approaches](https://kilocode.ai/docs/features/mcp/server-transports#hybrid-approaches)
* [Choosing Between STDIO and SSE](https://kilocode.ai/docs/features/mcp/server-transports#choosing-between-stdio-and-sse)
* [Configuring Transports in Kilo Code](https://kilocode.ai/docs/features/mcp/server-transports#configuring-transports-in-kilo-code)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Fmcp%2Fserver-transports)
---
# Using MCP in Kilo Code | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#__docusaurus_skipToContent_fallback)
On this page
Model Context Protocol (MCP) extends Kilo Code's capabilities by connecting to external tools and services. This guide covers everything you need to know about using MCP with Kilo Code.
Demostrating MCP installation in Kilo Code
Configuring MCP Servers[](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#configuring-mcp-servers "Direct link to Configuring MCP Servers")
----------------------------------------------------------------------------------------------------------------------------------------------------------
MCP server configurations can be managed at two levels:
1. **Global Configuration**: Stored in the `mcp_settings.json` file, accessible via VS Code settings (see below). These settings apply across all your workspaces unless overridden by a project-level configuration.
2. **Project-level Configuration**: Defined in a `.kilocode/mcp.json` file within your project's root directory. This allows you to set up project-specific servers and share configurations with your team by committing the file to version control. Kilo Code automatically detects and loads this file if it exists.
**Precedence**: If a server name exists in both global and project configurations, the **project-level configuration takes precedence**.
### Editing MCP Settings Files[](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#editing-mcp-settings-files "Direct link to Editing MCP Settings Files")
You can edit both global and project-level MCP configuration files directly from the Kilo Code MCP settings view.
1. Click the icon in the top navigation of the Kilo Code pane to open `Settings`.
2. Click the `MCP Servers` tab on the left side
3. Choose the `Installed` servers
4. Click the appropriate button:
* **`Edit Global MCP`**: Opens the global `mcp_settings.json` file.
* **`Edit Project MCP`**: Opens the project-specific `.kilocode/mcp.json` file. If this file doesn't exist, Kilo Code will create it for you.

Both files use a JSON format with a `mcpServers` object containing named server configurations:
{ "mcpServers": { "server1": { "command": "python", "args": ["/path/to/server.py"], "env": { "API_KEY": "your_api_key" }, "alwaysAllow": ["tool1", "tool2"], "disabled": false } }}
_Example of MCP Server config in Kilo Code (STDIO Transport)_
### Understanding Transport Types[](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#understanding-transport-types "Direct link to Understanding Transport Types")
MCP supports two transport types for server communication:
#### STDIO Transport[](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#stdio-transport "Direct link to STDIO Transport")
Used for local servers running on your machine:
* Communicates via standard input/output streams
* Lower latency (no network overhead)
* Better security (no network exposure)
* Simpler setup (no HTTP server needed)
* Runs as a child process on your machine
For more in-depth information about how STDIO transport works, see [STDIO Transport](https://kilocode.ai/docs/features/mcp/server-transports#stdio-transport)
.
STDIO configuration example:
{ "mcpServers": { "local-server": { "command": "node", "args": ["/path/to/server.js"], "env": { "API_KEY": "your_api_key" }, "alwaysAllow": ["tool1", "tool2"], "disabled": false } }}
#### SSE Transport[](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#sse-transport "Direct link to SSE Transport")
Used for remote servers accessed over HTTP/HTTPS:
* Communicates via Server-Sent Events protocol
* Can be hosted on a different machine
* Supports multiple client connections
* Requires network access
* Allows centralized deployment and management
For more in-depth information about how SSE transport works, see [SSE Transport](https://kilocode.ai/docs/features/mcp/server-transports#sse-transport)
.
SSE configuration example:
{ "mcpServers": { "remote-server": { "url": "https://your-server-url.com/mcp", "headers": { "Authorization": "Bearer your-token" }, "alwaysAllow": ["tool3"], "disabled": false } }}
### Deleting a Server[](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#deleting-a-server "Direct link to Deleting a Server")
1. Press the next to the MCP server you would like to delete
2. Press the `Delete` button on the confirmation box

### Restarting a Server[](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#restarting-a-server "Direct link to Restarting a Server")
1. Press the button next to the MCP server you would like to restart
### Enabling or Disabling a Server[](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#enabling-or-disabling-a-server "Direct link to Enabling or Disabling a Server")
1. Press the toggle switch next to the MCP server to enable/disable it
### Network Timeout[](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#network-timeout "Direct link to Network Timeout")
To set the maximum time to wait for a response after a tool call to the MCP server:
1. Click the `Network Timeout` pulldown at the bottom of the individual MCP server's config box and change the time. Default is 1 minute but it can be set between 30 seconds and 5 minutes.

### Auto Approve Tools[](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#auto-approve-tools "Direct link to Auto Approve Tools")
MCP tool auto-approval works on a per-tool basis and is disabled by default. To configure auto-approval:
1. First enable the global "Use MCP servers" auto-approval option in [auto-approving-actions](https://kilocode.ai/docs/features/auto-approving-actions)
2. In the MCP server settings, locate the specific tool you want to auto-approve
3. Check the `Always allow` checkbox next to the tool name

When enabled, Kilo Code will automatically approve this specific tool without prompting. Note that the global "Use MCP servers" setting takes precedence - if it's disabled, no MCP tools will be auto-approved.
Finding and Installing MCP Servers[](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#finding-and-installing-mcp-servers "Direct link to Finding and Installing MCP Servers")
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Kilo Code does not come with any pre-installed MCP servers. You'll need to find and install them separately.
* **Community Repositories:** Check for community-maintained lists of MCP servers on GitHub
* **Ask Kilo Code:** You can ask Kilo Code to help you find or even create MCP servers
* **Build Your Own:** Create custom MCP servers using the SDK to extend Kilo Code with your own tools
For full SDK documentation, visit the [MCP GitHub repository](https://github.com/modelcontextprotocol/)
.
Using MCP Tools in Your Workflow[](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#using-mcp-tools-in-your-workflow "Direct link to Using MCP Tools in Your Workflow")
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
After configuring an MCP server, Kilo Code will automatically detect available tools and resources. To use them:
1. Type your request in the Kilo Code chat interface
2. Kilo Code will identify when an MCP tool can help with your task
3. Approve the tool use when prompted (or use auto-approval)
Example: "Analyze the performance of my API" might use an MCP tool that tests API endpoints.
Troubleshooting MCP Servers[](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#troubleshooting-mcp-servers "Direct link to Troubleshooting MCP Servers")
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Common issues and solutions:
* **Server Not Responding:** Check if the server process is running and verify network connectivity
* **Permission Errors:** Ensure proper API keys and credentials are configured in your `mcp_settings.json` (for global settings) or `.kilocode/mcp.json` (for project settings).
* **Tool Not Available:** Confirm the server is properly implementing the tool and it's not disabled in settings
* **Slow Performance:** Try adjusting the network timeout value for the specific MCP server
Platform-Specific MCP Configuration Examples[](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#platform-specific-mcp-configuration-examples "Direct link to Platform-Specific MCP Configuration Examples")
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
### Windows Configuration Example[](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#windows-configuration-example "Direct link to Windows Configuration Example")
When setting up MCP servers on Windows, you'll need to use the Windows Command Prompt (`cmd`) to execute commands. Here's an example of configuring a Puppeteer MCP server on Windows:
{ "mcpServers": { "puppeteer": { "command": "cmd", "args": [ "/c", "npx", "-y", "@modelcontextprotocol/server-puppeteer" ] } }}
This Windows-specific configuration:
* Uses the `cmd` command to access the Windows Command Prompt
* Uses `/c` to tell cmd to execute the command and then terminate
* Uses `npx` to run the package without installing it permanently
* The `-y` flag automatically answers "yes" to any prompts during installation
* Runs the `@modelcontextprotocol/server-puppeteer` package which provides browser automation capabilities
note
For macOS or Linux, you would use a different configuration:
{ "mcpServers": { "puppeteer": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-puppeteer" ] } }}
The same approach can be used for other MCP servers on Windows, adjusting the package name as needed for different server types.
* [Configuring MCP Servers](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#configuring-mcp-servers)
* [Editing MCP Settings Files](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#editing-mcp-settings-files)
* [Understanding Transport Types](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#understanding-transport-types)
* [Deleting a Server](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#deleting-a-server)
* [Restarting a Server](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#restarting-a-server)
* [Enabling or Disabling a Server](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#enabling-or-disabling-a-server)
* [Network Timeout](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#network-timeout)
* [Auto Approve Tools](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#auto-approve-tools)
* [Finding and Installing MCP Servers](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#finding-and-installing-mcp-servers)
* [Using MCP Tools in Your Workflow](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#using-mcp-tools-in-your-workflow)
* [Troubleshooting MCP Servers](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#troubleshooting-mcp-servers)
* [Platform-Specific MCP Configuration Examples](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#platform-specific-mcp-configuration-examples)
* [Windows Configuration Example](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code#windows-configuration-example)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Fmcp%2Fusing-mcp-in-kilo-code)
---
# Terminal Shell Integration | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/shell-integration#__docusaurus_skipToContent_fallback)
On this page
Terminal Shell Integration is a key feature that enables Kilo Code to execute commands in your terminal and intelligently process their output. This bidirectional communication between the AI and your development environment unlocks powerful automation capabilities.
What is Shell Integration?[](https://kilocode.ai/docs/features/shell-integration#what-is-shell-integration "Direct link to What is Shell Integration?")
---------------------------------------------------------------------------------------------------------------------------------------------------------
Shell integration is automatically enabled in Kilo Code and connects directly to your terminal's command execution lifecycle without requiring any setup from you. This built-in feature allows Kilo Code to:
* Execute commands on your behalf through the [`execute_command`](https://kilocode.ai/docs/features/tools/execute-command)
tool
* Read command output in real-time without manual copy-pasting
* Automatically detect and fix errors in running applications
* Observe command exit codes to determine success or failure
* Track working directory changes as you navigate your project
* React intelligently to terminal output without user intervention
When Kilo Code needs to perform tasks like installing dependencies, starting a development server, or analyzing build errors, shell integration works behind the scenes to make these interactions smooth and effective.
Getting Started with Shell Integration[](https://kilocode.ai/docs/features/shell-integration#getting-started-with-shell-integration "Direct link to Getting Started with Shell Integration")
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Shell integration is built into Kilo Code and works automatically in most cases. If you see "Shell Integration Unavailable" messages or experience issues with command execution, try these solutions:
1. **Update VSCode/Cursor** to the latest version (VSCode 1.93+ required)
2. **Ensure a compatible shell is selected**: Command Palette (`Ctrl+Shift+P` or `Cmd+Shift+P`) → "Terminal: Select Default Profile" → Choose bash, zsh, PowerShell, or fish
3. **Windows PowerShell users**: Run `Set-ExecutionPolicy RemoteSigned -Scope CurrentUser` then restart VSCode
4. **WSL users**: Add `. "$(code --locate-shell-integration-path bash)"` to your `~/.bashrc`
Terminal Integration Settings[](https://kilocode.ai/docs/features/shell-integration#terminal-integration-settings "Direct link to Terminal Integration Settings")
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Kilo Code provides several settings to fine-tune shell integration. Access these in the Kilo Code sidebar under Settings → Terminal.
### Basic Settings[](https://kilocode.ai/docs/features/shell-integration#basic-settings "Direct link to Basic Settings")
#### Terminal Output Limit[](https://kilocode.ai/docs/features/shell-integration#terminal-output-limit "Direct link to Terminal Output Limit")

Controls the maximum number of lines captured from terminal output. When exceeded, it keeps 20% of the beginning and 80% of the end with a truncation message in between. This prevents excessive token usage while maintaining context. Default: 500 lines. Controls the maximum number of lines captured from terminal output. When exceeded, lines are removed from the middle to save tokens. Default: 500 lines.
#### Terminal Shell Integration Timeout[](https://kilocode.ai/docs/features/shell-integration#terminal-shell-integration-timeout "Direct link to Terminal Shell Integration Timeout")

Maximum time to wait for shell integration to initialize before executing commands. Increase this value if you experience "Shell Integration Unavailable" errors. Default: 15 seconds.
#### Terminal Command Delay[](https://kilocode.ai/docs/features/shell-integration#terminal-command-delay "Direct link to Terminal Command Delay")

Adds a small pause after running commands to help Kilo Code capture all output correctly. This setting can significantly impact shell integration reliability due to VSCode's implementation of terminal integration across different operating systems and shell configurations:
* **Default**: 0ms
* **Common Values**:
* 0ms: Works best for some users with newer VSCode versions
* 50ms: Historical default, still effective for many users
* 150ms: Recommended for PowerShell users
* **Note**: Different values may work better depending on your:
* VSCode version
* Shell customizations (oh-my-zsh, powerlevel10k, etc.)
* Operating system and environment
### Advanced Settings[](https://kilocode.ai/docs/features/shell-integration#advanced-settings "Direct link to Advanced Settings")
Important
**Terminal restart required for these settings**
Changes to advanced terminal settings only take effect after restarting your terminals. To restart a terminal:
1. Click the trash icon in the terminal panel to close the current terminal
2. Open a new terminal with Terminal → New Terminal or Ctrl+\` (backtick)
Always restart all open terminals after changing any of these settings.
#### PowerShell Counter Workaround[](https://kilocode.ai/docs/features/shell-integration#powershell-counter-workaround "Direct link to PowerShell Counter Workaround")

Helps PowerShell run the same command multiple times in a row. Enable this if you notice Kilo Code can't run identical commands consecutively in PowerShell.
#### Clear ZSH EOL Mark[](https://kilocode.ai/docs/features/shell-integration#clear-zsh-eol-mark "Direct link to Clear ZSH EOL Mark")

Prevents ZSH from adding special characters at the end of output lines that can confuse Kilo Code when reading terminal results.
#### Oh My Zsh Integration[](https://kilocode.ai/docs/features/shell-integration#oh-my-zsh-integration "Direct link to Oh My Zsh Integration")

Makes Kilo Code work better with the popular [Oh My Zsh](https://ohmyz.sh/)
shell customization framework. Turn this on if you use Oh My Zsh and experience terminal issues.
#### Powerlevel10k Integration[](https://kilocode.ai/docs/features/shell-integration#powerlevel10k-integration "Direct link to Powerlevel10k Integration")

Improves compatibility if you use the Powerlevel10k theme for ZSH. Turn this on if your fancy terminal prompt causes issues with Kilo Code.
#### ZDOTDIR Handling[](https://kilocode.ai/docs/features/shell-integration#zdotdir-handling "Direct link to ZDOTDIR Handling")

Helps Kilo Code work with custom ZSH configurations without interfering with your personal shell settings and customizations.
Troubleshooting Shell Integration[](https://kilocode.ai/docs/features/shell-integration#troubleshooting-shell-integration "Direct link to Troubleshooting Shell Integration")
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
### PowerShell Execution Policy (Windows)[](https://kilocode.ai/docs/features/shell-integration#powershell-execution-policy-windows "Direct link to PowerShell Execution Policy (Windows)")
PowerShell restricts script execution by default. To configure:
1. Open PowerShell as Administrator
2. Check current policy: `Get-ExecutionPolicy`
3. Set appropriate policy: `Set-ExecutionPolicy RemoteSigned -Scope CurrentUser`
Common policies:
* `Restricted`: No scripts allowed (default)
* `RemoteSigned`: Local scripts can run; downloaded scripts need signing
* `Unrestricted`: All scripts run with warnings
* `AllSigned`: All scripts must be signed
### Manual Shell Integration Installation[](https://kilocode.ai/docs/features/shell-integration#manual-shell-integration-installation "Direct link to Manual Shell Integration Installation")
If automatic integration fails, add the appropriate line to your shell configuration:
**Bash** (`~/.bashrc`):
[[ "$TERM_PROGRAM" == "vscode" ]] && . "$(code --locate-shell-integration-path bash)"
**Zsh** (`~/.zshrc`):
[[ "$TERM_PROGRAM" == "vscode" ]] && . "$(code --locate-shell-integration-path zsh)"
**PowerShell** (`$Profile`):
if ($env:TERM_PROGRAM -eq "vscode") { . "$(code --locate-shell-integration-path pwsh)" }
**Fish** (`~/.config/fish/config.fish`):
string match -q "$TERM_PROGRAM" "vscode"; and . (code --locate-shell-integration-path fish)
### Terminal Customization Issues[](https://kilocode.ai/docs/features/shell-integration#terminal-customization-issues "Direct link to Terminal Customization Issues")
If you use terminal customization tools:
**Powerlevel10k**:
# Add before sourcing powerlevel10k in ~/.zshrctypeset -g POWERLEVEL9K_TERM_SHELL_INTEGRATION=true
**Alternative**: Enable the Powerlevel10k Integration setting in Kilo Code.
### Verifying Shell Integration Status[](https://kilocode.ai/docs/features/shell-integration#verifying-shell-integration-status "Direct link to Verifying Shell Integration Status")
Confirm shell integration is active with these commands:
**Bash**:
set | grep -i '[16]33;'echo "$PROMPT_COMMAND" | grep vsctrap -p DEBUG | grep vsc
**Zsh**:
functions | grep -i vsctypeset -p precmd_functions preexec_functions
**PowerShell**:
Get-Command -Name "*VSC*" -CommandType FunctionGet-Content Function:\Prompt | Select-String "VSCode"
**Fish**:
functions | grep -i vscfunctions fish_prompt | grep -i vsc
Visual indicators of active shell integration:
1. Shell integration indicator in terminal title bar
2. Command detection highlighting
3. Working directory updates in terminal title
4. Command duration and exit code reporting
WSL Terminal Integration Methods[](https://kilocode.ai/docs/features/shell-integration#wsl-terminal-integration-methods "Direct link to WSL Terminal Integration Methods")
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
When using Windows Subsystem for Linux (WSL), there are two distinct ways to use VSCode with WSL, each with different implications for shell integration:
### Method 1: VSCode Windows with WSL Terminal[](https://kilocode.ai/docs/features/shell-integration#method-1-vscode-windows-with-wsl-terminal "Direct link to Method 1: VSCode Windows with WSL Terminal")
In this setup:
* VSCode runs natively in Windows
* You use the WSL terminal integration feature in VSCode
* Shell commands are executed through the WSL bridge
* May experience additional latency due to Windows-WSL communication
* Shell integration markers may be affected by the WSL-Windows boundary: you must make sure that `source "$(code --locate-shell-integration-path )"` is loaded for your shell within the WSL environment because it may not get automatically loaded; see above.
### Method 2: VSCode Running Within WSL[](https://kilocode.ai/docs/features/shell-integration#method-2-vscode-running-within-wsl "Direct link to Method 2: VSCode Running Within WSL")
In this setup:
* You launch VSCode directly from within WSL using `code .`
* VSCode server runs natively in the Linux environment
* Direct access to Linux filesystem and tools
* Better performance and reliability for shell integration
* Shell integration is loaded automatically since VSCode runs natively in the Linux environment
* Recommended approach for WSL development
For optimal shell integration with WSL, we recommend:
1. Open your WSL distribution
2. Navigate to your project directory
3. Launch VSCode using `code .`
4. Use the integrated terminal within VSCode
Known Issues and Workarounds[](https://kilocode.ai/docs/features/shell-integration#known-issues-and-workarounds "Direct link to Known Issues and Workarounds")
----------------------------------------------------------------------------------------------------------------------------------------------------------------
### VS Code Shell Integration for Fish + Cygwin on Windows[](https://kilocode.ai/docs/features/shell-integration#vs-code-shell-integration-for-fish--cygwin-on-windows "Direct link to VS Code Shell Integration for Fish + Cygwin on Windows")
For fellow Windows users running Fish terminal within a Cygwin environment, here's how VS Code's shell integration works:
1. **(Optional) Locate the Shell Integration Script:** Open your Fish terminal _within VS Code_ and run the following command:
code --locate-shell-integration-path fish
This will output the path to the `shellIntegration.fish` script. Note down this path.
2. **Update Your Fish Configuration:** Edit your `config.fish` file (usually located at `~/.config/fish/config.fish` within your Cygwin home directory). Add the following line, preferably within an `if status is-interactive` block or at the very end of the file:
# Example config.fish structureif status is-interactive # Your other interactive shell configurations... # automatic locate integration script: string match -q "$TERM_PROGRAM" "vscode"; and . (code --locate-shell-integration-path fish) # Or if the above fails for you: # Source the VS Code shell integration script # IMPORTANT: Replace the example path below with the actual path you found in Step 1. # Make sure the path is in a format Cygwin can understand (e.g., using /cygdrive/c/...). # source "/cygdrive/c/Users/YourUser/.vscode/extensions/..../shellIntegration.fish"end
_Remember to replace the example path with the actual path from Step 1, correctly formatted for Cygwin._
3. **Configure VS Code Terminal Profile:** Open your VS Code `settings.json` file (Ctrl+Shift+P -> "Preferences: Open User Settings (JSON)"). Update or add the Fish profile under `terminal.integrated.profiles.windows` like this:
{ // ... other settings ... "terminal.integrated.profiles.windows": { // ... other profiles ... // Recommended: Use bash.exe to launch fish as a login shell "fish": { "path": "C:\\cygwin64\\bin\\bash.exe", // Or your Cygwin bash path "args": [ "--login", // Ensures login scripts run (important for Cygwin environment) "-i", // Ensures bash runs interactively "-c", "exec fish" // Replace bash process with fish ], "icon": "terminal-bash" // Optional: Use a recognizable icon } // Alternative (if the above fails): Launch fish directly "fish-direct": { "path": "C:\\cygwin64\\bin\\fish.exe", // Ensure this is in your Windows PATH or provide full path // Use 'options' here instead of 'args'; otherwise, you might encounter the error "terminal process terminated exit code 1". "options": ["-l", "-c"], // Example: login and interactive flags. "icon": "terminal-fish" // Optional: Use a fish icon } }, // Optional: Set fish as your default if desired // "terminal.integrated.defaultProfile.windows": "fish", // or "fish-direct" depending what you use. // ... other settings ...}
_Note: Using `bash.exe --login -i -c "exec fish"` is often more reliable in Cygwin environments for ensuring the correct environment setup before `fish` starts. However, if that approach doesn't work, try the `fish-direct` profile configuration._
4. **Restart VS Code:** Close and reopen Visual Studio Code completely to apply the changes.
5. **Verify:** Open a new Fish terminal in VS Code. The shell integration features (like command decorations, better command history navigation, etc.) should now be active. You can test basic functionality by running simple commands like `echo "Hello from integrated Fish!"`. 
This setup works reliably on Windows systems using Cygwin, Fish, and the Starship prompt, and should assist users with similar configurations.
### Shell Integration Failures After VSCode 1.98[](https://kilocode.ai/docs/features/shell-integration#shell-integration-failures-after-vscode-198 "Direct link to Shell Integration Failures After VSCode 1.98")
**Issue**: After VSCode updates beyond version 1.98, shell integration may fail with the error "VSCE output start escape sequence (\]633;C or \]133;C) not received".
**Solutions**:
1. **Set Terminal Command Delay**:
* Set the Terminal Command Delay to 50ms in Kilo Code settings
* Restart all terminals after changing this setting
* This matches older default behavior and may resolve the issue, however some users have reported that a value of 0ms works better. This is a workaround for upstream VSCode problems.
2. **Roll Back VSCode Version**:
* Download VSCode v1.98 from [VSCode Updates](https://code.visualstudio.com/updates/v1_98)
* Replace your current VSCode installation
* No backup of Kilo settings needed
3. **WSL-Specific Workaround**:
* If using WSL, ensure you launch VSCode from within WSL using `code .`
4. **ZSH Users**:
* Try enabling some or all ZSH-related workarounds in Kilo Code settings
* These settings can help regardless of your operating system
Known Issues and Workarounds[](https://kilocode.ai/docs/features/shell-integration#known-issues-and-workarounds-1 "Direct link to Known Issues and Workarounds")
------------------------------------------------------------------------------------------------------------------------------------------------------------------
### Ctrl+C Behavior[](https://kilocode.ai/docs/features/shell-integration#ctrlc-behavior "Direct link to Ctrl+C Behavior")
**Issue**: If text is already typed in the terminal when Kilo Code tries to run a command, Kilo Code will press Ctrl+C first to clear the line, which can interrupt running processes.
**Workaround**: Make sure your terminal prompt is empty (no partial commands typed) before asking Kilo Code to execute terminal commands.
### Multi-line Command Issues[](https://kilocode.ai/docs/features/shell-integration#multi-line-command-issues "Direct link to Multi-line Command Issues")
**Issue**: Commands that span multiple lines can confuse Kilo Code and may show output from previous commands mixed in with current output.
**Workaround**: Instead of multi-line commands, use command chaining with `&&` to keep everything on one line (e.g., `echo a && echo b` instead of typing each command on a separate line).
### PowerShell-Specific Issues[](https://kilocode.ai/docs/features/shell-integration#powershell-specific-issues "Direct link to PowerShell-Specific Issues")
1. **Premature Completion**: PowerShell sometimes tells Kilo Code a command is finished before all the output has been shown.
2. **Repeated Commands**: PowerShell may refuse to run the same command twice in a row.
**Workaround**: Enable the "PowerShell counter workaround" setting and set a terminal command delay of 150ms in the settings to give commands more time to complete.
### Incomplete Terminal Output[](https://kilocode.ai/docs/features/shell-integration#incomplete-terminal-output "Direct link to Incomplete Terminal Output")
**Issue**: Sometimes VS Code doesn't show or capture all the output from a command.
**Workaround**: If you notice missing output, try closing and reopening the terminal tab, then run the command again. This refreshes the terminal connection.
Troubleshooting Resources[](https://kilocode.ai/docs/features/shell-integration#troubleshooting-resources "Direct link to Troubleshooting Resources")
-------------------------------------------------------------------------------------------------------------------------------------------------------
### Checking Debug Logs[](https://kilocode.ai/docs/features/shell-integration#checking-debug-logs "Direct link to Checking Debug Logs")
When shell integration issues occur, check the debug logs:
1. Open Help → Toggle Developer Tools → Console
2. Set "Show All Levels" to see all log messages
3. Look for messages containing `[Terminal Process]`
4. Check `preOutput` content in error messages:
* Empty preOutput (`''`) means VSCode sent no data
* This indicates a potential VSCode shell integration issue, or an upstream bug that is out of our control
* The absence of shell integration markers may require adjusting settings to work around possible upstream bugs or local workstation configuration issues related to shell initialization and VSCode's loading of special shell integration hooks
### Using the VSCode Terminal Integration Test Extension[](https://kilocode.ai/docs/features/shell-integration#using-the-vscode-terminal-integration-test-extension "Direct link to Using the VSCode Terminal Integration Test Extension")
The [VSCode Terminal Integration Test Extension](https://github.com/KJ7LNW/vsce-test-terminal-integration)
helps diagnose shell integration issues by testing different settings combinations:
1. **When Commands Stall**:
* If you see "command already running" warnings, click "Reset Stats" to reset the terminal state
* These warnings indicate shell integration is not working
* Try different settings combinations until you find one that works
* If it really gets stuck, restart the extension by closing the window and pressing F5
2. **Testing Settings**:
* Systematically try different combinations of:
* Terminal Command Delay
* Shell Integration settings
* Document which combinations succeed or fail
* This helps identify patterns in shell integration issues
3. **Reporting Issues**:
* Once you find a problematic configuration
* Document the exact settings combination
* Note your environment (OS, VSCode version, shell, and any shell prompt customization)
* Open an issue with these details to help improve shell integration
Support[](https://kilocode.ai/docs/features/shell-integration#support "Direct link to Support")
-------------------------------------------------------------------------------------------------
If you've followed these steps and are still experiencing problems, please:
1. Check the [Kilo Code GitHub Issues](https://github.com/Kilo-Org/kilocode/issues)
to see if others have reported similar problems
2. If not, create a new issue with details about your operating system, VSCode/Cursor version, and the steps you've tried
For additional help, join our [Discord](https://kilocode.ai/discord)
.
* [What is Shell Integration?](https://kilocode.ai/docs/features/shell-integration#what-is-shell-integration)
* [Getting Started with Shell Integration](https://kilocode.ai/docs/features/shell-integration#getting-started-with-shell-integration)
* [Terminal Integration Settings](https://kilocode.ai/docs/features/shell-integration#terminal-integration-settings)
* [Basic Settings](https://kilocode.ai/docs/features/shell-integration#basic-settings)
* [Advanced Settings](https://kilocode.ai/docs/features/shell-integration#advanced-settings)
* [Troubleshooting Shell Integration](https://kilocode.ai/docs/features/shell-integration#troubleshooting-shell-integration)
* [PowerShell Execution Policy (Windows)](https://kilocode.ai/docs/features/shell-integration#powershell-execution-policy-windows)
* [Manual Shell Integration Installation](https://kilocode.ai/docs/features/shell-integration#manual-shell-integration-installation)
* [Terminal Customization Issues](https://kilocode.ai/docs/features/shell-integration#terminal-customization-issues)
* [Verifying Shell Integration Status](https://kilocode.ai/docs/features/shell-integration#verifying-shell-integration-status)
* [WSL Terminal Integration Methods](https://kilocode.ai/docs/features/shell-integration#wsl-terminal-integration-methods)
* [Method 1: VSCode Windows with WSL Terminal](https://kilocode.ai/docs/features/shell-integration#method-1-vscode-windows-with-wsl-terminal)
* [Method 2: VSCode Running Within WSL](https://kilocode.ai/docs/features/shell-integration#method-2-vscode-running-within-wsl)
* [Known Issues and Workarounds](https://kilocode.ai/docs/features/shell-integration#known-issues-and-workarounds)
* [VS Code Shell Integration for Fish + Cygwin on Windows](https://kilocode.ai/docs/features/shell-integration#vs-code-shell-integration-for-fish--cygwin-on-windows)
* [Shell Integration Failures After VSCode 1.98](https://kilocode.ai/docs/features/shell-integration#shell-integration-failures-after-vscode-198)
* [Known Issues and Workarounds](https://kilocode.ai/docs/features/shell-integration#known-issues-and-workarounds-1)
* [Ctrl+C Behavior](https://kilocode.ai/docs/features/shell-integration#ctrlc-behavior)
* [Multi-line Command Issues](https://kilocode.ai/docs/features/shell-integration#multi-line-command-issues)
* [PowerShell-Specific Issues](https://kilocode.ai/docs/features/shell-integration#powershell-specific-issues)
* [Incomplete Terminal Output](https://kilocode.ai/docs/features/shell-integration#incomplete-terminal-output)
* [Troubleshooting Resources](https://kilocode.ai/docs/features/shell-integration#troubleshooting-resources)
* [Checking Debug Logs](https://kilocode.ai/docs/features/shell-integration#checking-debug-logs)
* [Using the VSCode Terminal Integration Test Extension](https://kilocode.ai/docs/features/shell-integration#using-the-vscode-terminal-integration-test-extension)
* [Support](https://kilocode.ai/docs/features/shell-integration#support)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Fshell-integration)
---
# Fast Edits | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/fast-edits#__docusaurus_skipToContent_fallback)
On this page
Default Setting
Fast Edits (using the "Enable editing through diffs" setting) is enabled by default in Kilo Code. You typically don't need to change these settings unless you encounter specific issues or want to experiment with different diff strategies.
Kilo Code offers an advanced setting to change how it edits files, using diffs (differences) instead of rewriting entire files. Enabling this feature provides significant benefits.
Enable Editing Through Diffs[](https://kilocode.ai/docs/features/fast-edits#enable-editing-through-diffs "Direct link to Enable Editing Through Diffs")
---------------------------------------------------------------------------------------------------------------------------------------------------------
Open Settings by clicking the gear icon → Advanced
When **Enable editing through diffs** is checked:

1. **Faster File Editing**: Kilo modifies files more quickly by applying only the necessary changes.
2. **Prevents Truncated Writes**: The system automatically detects and rejects attempts by the AI to write incomplete file content, which can happen with large files or complex instructions. This helps prevent corrupted files.
Disabling Fast Edits
If you uncheck **Enable editing through diffs**, Kilo will revert to writing the entire file content for every edit using the [`write_to_file`](https://kilocode.ai/docs/features/tools/write-to-file)
tool, instead of applying targeted changes with [`apply_diff`](https://kilocode.ai/docs/features/tools/apply-diff)
. This full-write approach is generally slower for modifying existing files and leads to higher token usage.
Match Precision[](https://kilocode.ai/docs/features/fast-edits#match-precision "Direct link to Match Precision")
------------------------------------------------------------------------------------------------------------------
This slider controls how closely the code sections identified by the AI must match the actual code in your file before a change is applied.

* **100% (Default)**: Requires an exact match. This is the safest option, minimizing the risk of incorrect changes.
* **Lower Values (80%-99%)**: Allows for "fuzzy" matching. Kilo can apply changes even if the code section has minor differences from what the AI expected. This can be useful if the file has been slightly modified, but **increases the risk** of applying changes in the wrong place.
**Use values below 100% with extreme caution.** Lower precision might be necessary occasionally, but always review the proposed changes carefully.
Internally, this setting adjusts a `fuzzyMatchThreshold` used with algorithms like Levenshtein distance to compare code similarity.
* [Enable Editing Through Diffs](https://kilocode.ai/docs/features/fast-edits#enable-editing-through-diffs)
* [Match Precision](https://kilocode.ai/docs/features/fast-edits#match-precision)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Ffast-edits)
---
# Model Temperature | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/model-temperature#__docusaurus_skipToContent_fallback)
On this page
Temperature controls the randomness of AI model outputs. Adjusting this setting optimizes results for different tasks - from precise code generation to creative brainstorming. Temperature is one of the most powerful parameters for controlling AI behavior. A well-tuned temperature setting can dramatically improve the quality and appropriateness of responses for specific tasks.

What is Temperature?[](https://kilocode.ai/docs/features/model-temperature#what-is-temperature "Direct link to What is Temperature?")
---------------------------------------------------------------------------------------------------------------------------------------
Temperature is a setting (usually between 0.0 and 2.0) that controls how random or predictable the AI's output is. Finding the right balance is key: lower values make the output more focused and consistent, while higher values encourage more creativity and variation. For many coding tasks, a moderate temperature (around 0.3 to 0.7) often works well, but the best setting depends on what you're trying to achieve.
Temperature and Code: Common Misconceptions
Temperature controls output randomness, not code quality or accuracy directly. Key points:
* **Low Temperature (near 0.0):** Produces predictable, consistent code. Good for simple tasks, but can be repetitive and lack creativity. It doesn't guarantee _better_ code.
* **High Temperature:** Increases randomness, potentially leading to creative solutions but also more errors or nonsensical code. It doesn't guarantee _higher-quality_ code.
* **Accuracy:** Code accuracy depends on the model's training and prompt clarity, not temperature.
* **Temperature 0.0:** Useful for consistency, but limits exploration needed for complex problems.
Default Values in Kilo Code[](https://kilocode.ai/docs/features/model-temperature#default-values-in-kilo-code "Direct link to Default Values in Kilo Code")
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Kilo Code uses a default temperature of 0.0 for most models, optimizing for maximum determinism and precision in code generation. This applies to OpenAI models, Anthropic models (non-thinking variants), LM Studio models, and most other providers.
Some models use higher default temperatures - DeepSeek R1 models and certain reasoning-focused models default to 0.6, providing a balance between determinism and creative exploration.
Models with thinking capabilities (where the AI shows its reasoning process) require a fixed temperature of 1.0 which cannot be changed, as this setting ensures optimal performance of the thinking mechanism. This applies to any model with the ":thinking" flag enabled.
Some specialized models don't support temperature adjustments at all, in which case Kilo Code respects these limitations automatically.
When to Adjust Temperature[](https://kilocode.ai/docs/features/model-temperature#when-to-adjust-temperature "Direct link to When to Adjust Temperature")
----------------------------------------------------------------------------------------------------------------------------------------------------------
Here are some examples of temperature settings that might work well for different tasks:
* **Code Mode (0.0-0.3):** For writing precise, correct code with consistent, deterministic results
* **Architect Mode (0.4-0.7):** For brainstorming architecture or design solutions with balanced creativity and structure
* **Ask Mode (0.7-1.0):** For explanations or open-ended questions requiring diverse and insightful responses
* **Debug Mode (0.0-0.3):** For troubleshooting bugs with consistent precision
These are starting points – it's important to [experiment with different settings](https://kilocode.ai/docs/features/model-temperature#experimentation)
to find what works best for your specific needs and preferences.
How to Adjust Temperature[](https://kilocode.ai/docs/features/model-temperature#how-to-adjust-temperature "Direct link to How to Adjust Temperature")
-------------------------------------------------------------------------------------------------------------------------------------------------------
1. **Open the Kilo Code Panel:** Click the Kilo Code icon () in the VS Code Side Bar
2. **Open Settings:** Click the icon in the top right corner
3. **Find Temperature Control:** Navigate to the Providers section
4. **Enable Custom Temperature:** Check the "Use custom temperature" box
5. **Set Your Value:** Adjust the slider to your preferred value

_Temperature slider in Kilo Code settings panel_
Using API Configuration Profiles for Temperature[](https://kilocode.ai/docs/features/model-temperature#using-api-configuration-profiles-for-temperature "Direct link to Using API Configuration Profiles for Temperature")
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Create multiple [API configuration profiles](https://kilocode.ai/docs/features/api-configuration-profiles)
with different temperature settings:
**How to set up task-specific temperature profiles:**
1. Create specialized profiles like "Code - Low Temp" (0.1) and "Ask - High Temp" (0.8)
2. Configure each profile with appropriate temperature settings
3. Switch between profiles using the dropdown in settings or chat interface
4. Set different profiles as defaults for each mode for automatic switching when changing modes
This approach optimizes model behavior for specific tasks without manual adjustments.
Technical Implementation[](https://kilocode.ai/docs/features/model-temperature#technical-implementation "Direct link to Technical Implementation")
----------------------------------------------------------------------------------------------------------------------------------------------------
Kilo Code implements temperature handling with these considerations:
* User-defined settings take priority over defaults
* Provider-specific behaviors are respected
* Model-specific limitations are enforced:
* Thinking-enabled models require a fixed temperature of 1.0
* Some models don't support temperature adjustments
Experimentation[](https://kilocode.ai/docs/features/model-temperature#experimentation "Direct link to Experimentation")
-------------------------------------------------------------------------------------------------------------------------
Experimenting with different temperature settings is the most effective way to discover what works best for your specific needs:
### Effective Temperature Testing[](https://kilocode.ai/docs/features/model-temperature#effective-temperature-testing "Direct link to Effective Temperature Testing")
1. **Start with defaults** - Begin with Kilo Code's preset values (0.0 for most tasks) as your baseline
2. **Make incremental adjustments** - Change values in small steps (±0.1) to observe subtle differences
3. **Test consistently** - Use the same prompt across different temperature settings for valid comparisons
4. **Document results** - Note which values produce the best outcomes for specific types of tasks
5. **Create profiles** - Save effective settings as [API configuration profiles](https://kilocode.ai/docs/features/api-configuration-profiles)
for quick access
Remember that different models may respond differently to the same temperature values, and thinking-enabled models always use a fixed temperature of 1.0 regardless of your settings.
Related Features[](https://kilocode.ai/docs/features/model-temperature#related-features "Direct link to Related Features")
----------------------------------------------------------------------------------------------------------------------------
* Works with all [API providers](https://kilocode.ai/docs/providers/openai)
supported by Kilo Code
* Complements [custom instructions](https://kilocode.ai/docs/advanced-usage/custom-instructions)
for fine-tuning responses
* Works alongside [custom modes](https://kilocode.ai/docs/features/custom-modes)
you create
* [What is Temperature?](https://kilocode.ai/docs/features/model-temperature#what-is-temperature)
* [Default Values in Kilo Code](https://kilocode.ai/docs/features/model-temperature#default-values-in-kilo-code)
* [When to Adjust Temperature](https://kilocode.ai/docs/features/model-temperature#when-to-adjust-temperature)
* [How to Adjust Temperature](https://kilocode.ai/docs/features/model-temperature#how-to-adjust-temperature)
* [Using API Configuration Profiles for Temperature](https://kilocode.ai/docs/features/model-temperature#using-api-configuration-profiles-for-temperature)
* [Technical Implementation](https://kilocode.ai/docs/features/model-temperature#technical-implementation)
* [Experimentation](https://kilocode.ai/docs/features/model-temperature#experimentation)
* [Effective Temperature Testing](https://kilocode.ai/docs/features/model-temperature#effective-temperature-testing)
* [Related Features](https://kilocode.ai/docs/features/model-temperature#related-features)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Fmodel-temperature)
---
# Tips & Tricks | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/tips-and-tricks#__docusaurus_skipToContent_fallback)
A collection of quick tips to help you get the most out of Kilo Code.
* Drag Kilo Code to the [Secondary Sidebar](https://code.visualstudio.com/api/ux-guidelines/sidebars#secondary-sidebar)
so you can see the Explorer, Search, Source Control, etc.
* Once you have Kilo Code in a separate sidebar from the file explorer, you can drag files from the explorer into the chat window (and even multiple at once). Just make sure to hold down the shift key after you start dragging the files.
* If you're not using [MCP](https://kilocode.ai/docs/features/mcp/overview)
, turn it off in the Prompts tab to significantly cut down the size of the system prompt.
* To keep your [custom modes](https://kilocode.ai/docs/features/custom-modes)
on track, limit the types of files that they're allowed to edit.
* If you hit the dreaded `input length and max tokens exceed context limit` error, you can recover by deleting a message, rolling back to a previous checkpoint, or switching over to a model with a long context window like Gemini for a message.
* In general, be thoughtful about your `Max Tokens` setting for thinking models. Every token you allocate to that takes away from space available to store conversation history. Consider only using high `Max Tokens` / `Max Thinking Tokens` settings with modes like Architect and Debug, and keeping Code mode at 16k max tokens or less.
* If there's a real world job posting for something you want a custom mode to do, try asking Code mode to `Create a custom mode based on the job posting at @[url]`
* If you want to really accelerate, check out multiple copies of your repository and run Kilo Code on all of them in parallel (using git to resolve any conflicts, same as with human devs).
* When using Debug mode, ask Kilo to "start a new task in Debug mode with all of the necessary context needed to figure out X" so that the debugging process uses its own context window and doesn't pollute the main task
* Add your own tips by clicking "Edit this page" below!
* To manage large files and reduce context/resource usage, adjust the `File read auto-truncate threshold` setting. This setting controls the number of lines read from a file in one batch. Lower values can improve performance when working with very large files, but may require more read operations. You can find this setting in the Kilo Code settings under 'Advanced Settings'.
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ftips-and-tricks)
---
# Workflows | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/slash-commands/workflows#__docusaurus_skipToContent_fallback)
On this page
Workflows automate repetitive tasks by defining step-by-step instructions for Kilo Code to execute. Invoke any workflow by typing `/[workflow-name.md]` in the chat.

Creating Workflows[](https://kilocode.ai/docs/features/slash-commands/workflows#creating-workflows "Direct link to Creating Workflows")
-----------------------------------------------------------------------------------------------------------------------------------------
Workflows are markdown files stored in `.kilocode/workflows/`:
* **Global workflows**: `~/.kilocode/workflows/` (available in all projects)
* **Project workflows**: `[project]/.kilocode/workflows/` (project-specific)
### Basic Setup[](https://kilocode.ai/docs/features/slash-commands/workflows#basic-setup "Direct link to Basic Setup")
1. Create a `.md` file with step-by-step instructions
2. Save it in your workflows directory
3. Type `/filename.md` to execute
### Workflow Capabilities[](https://kilocode.ai/docs/features/slash-commands/workflows#workflow-capabilities "Direct link to Workflow Capabilities")
Workflows can leverage:
* [Built-in tools](https://kilocode.ai/docs/features/tools/tool-use-overview)
: [`read_file()`](https://kilocode.ai/docs/features/tools/read-file)
, [`search_files()`](https://kilocode.ai/docs/features/tools/search-files)
, [`execute_command()`](https://kilocode.ai/docs/features/tools/execute-command)
* CLI tools: `gh`, `docker`, `npm`, custom scripts
* [MCP integrations](https://kilocode.ai/docs/features/mcp/overview)
: Slack, databases, APIs
* [Mode switching](https://kilocode.ai/docs/basic-usage/using-modes)
: [`new_task()`](https://kilocode.ai/docs/features/tools/new-task)
for specialized contexts
Common Workflow Patterns[](https://kilocode.ai/docs/features/slash-commands/workflows#common-workflow-patterns "Direct link to Common Workflow Patterns")
-----------------------------------------------------------------------------------------------------------------------------------------------------------
**Release Management**
1. Gather merged PRs since last release2. Generate changelog from commit messages3. Update version numbers4. Create release branch and tag5. Deploy to staging environment
**Project Setup**
1. Clone repository template2. Install dependencies (`npm install`, `pip install -r requirements.txt`)3. Configure environment files4. Initialize database/services5. Run initial tests
**Code Review Preparation**
1. Search for TODO comments and debug statements2. Run linting and formatting3. Execute test suite4. Generate PR description from recent commits
Example: PR Submission Workflow[](https://kilocode.ai/docs/features/slash-commands/workflows#example-pr-submission-workflow "Direct link to Example: PR Submission Workflow")
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Let's walk through creating a workflow for submitting a pull request. This workflow handles the entire process from code review to deployment notification.
Create a file called `submit-pr.md` in your `.kilocode/workflows` directory:
# Submit PR WorkflowYou are helping submit a pull request. Follow these steps:1. First, use `search_files` to check for any TODO comments or console.log statements that shouldn't be committed2. Run tests using `execute_command` with `npm test` or the appropriate test command3. If tests pass, stage and commit changes with a descriptive commit message4. Push the branch and create a pull request using `gh pr create`5. Use `ask_followup_question` to get the PR title and description from the userParameters needed (ask if not provided):- Branch name- Reviewers to assign
Now you can trigger this workflow by typing `/submit-pr.md` in the chat. Kilo Code will:
* Scan your code for common issues before committing
* Run your test suite to catch problems early
* Handle the Git operations and PR creation
* Notify your team automatically
* Set up follow-up tasks for deployment
This saves you from manually running the same 7-step process every time you want to submit code for review.
* [Creating Workflows](https://kilocode.ai/docs/features/slash-commands/workflows#creating-workflows)
* [Basic Setup](https://kilocode.ai/docs/features/slash-commands/workflows#basic-setup)
* [Workflow Capabilities](https://kilocode.ai/docs/features/slash-commands/workflows#workflow-capabilities)
* [Common Workflow Patterns](https://kilocode.ai/docs/features/slash-commands/workflows#common-workflow-patterns)
* [Example: PR Submission Workflow](https://kilocode.ai/docs/features/slash-commands/workflows#example-pr-submission-workflow)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Fslash-commands%2Fworkflows)
---
# access_mcp_resource | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/tools/access-mcp-resource#__docusaurus_skipToContent_fallback)
On this page
The `access_mcp_resource` tool retrieves data from resources exposed by connected Model Context Protocol (MCP) servers. It allows Kilo Code to access files, API responses, documentation, or system information that provides additional context for tasks.
Parameters[](https://kilocode.ai/docs/features/tools/access-mcp-resource#parameters "Direct link to Parameters")
------------------------------------------------------------------------------------------------------------------
The tool accepts these parameters:
* `server_name` (required): The name of the MCP server providing the resource
* `uri` (required): The URI identifying the specific resource to access
What It Does[](https://kilocode.ai/docs/features/tools/access-mcp-resource#what-it-does "Direct link to What It Does")
------------------------------------------------------------------------------------------------------------------------
This tool connects to MCP servers and fetches data from their exposed resources. Unlike `use_mcp_tool` which executes actions, this tool specifically retrieves information that serves as context for tasks.
When is it used?[](https://kilocode.ai/docs/features/tools/access-mcp-resource#when-is-it-used "Direct link to When is it used?")
-----------------------------------------------------------------------------------------------------------------------------------
* When Kilo Code needs additional context from external systems
* When Kilo Code needs to access domain-specific data from specialized MCP servers
* When Kilo Code needs to retrieve reference documentation hosted by MCP servers
* When Kilo Code needs to integrate real-time data from external APIs via MCP
Key Features[](https://kilocode.ai/docs/features/tools/access-mcp-resource#key-features "Direct link to Key Features")
------------------------------------------------------------------------------------------------------------------------
* Retrieves both text and image data from MCP resources
* Requires user approval before executing resource access
* Uses URI-based addressing to precisely identify resources
* Integrates with the Model Context Protocol SDK
* Displays resource content appropriately based on content type
* Supports timeouts for reliable network operations
* Handles server connection states (connected, connecting, disconnected)
* Discovers available resources from connected servers
* Processes structured response data with metadata
* Handles image content special rendering
Limitations[](https://kilocode.ai/docs/features/tools/access-mcp-resource#limitations "Direct link to Limitations")
---------------------------------------------------------------------------------------------------------------------
* Depends on external MCP servers being available and connected
* Limited to the resources provided by connected servers
* Cannot access resources from disabled servers
* Network issues can affect reliability and performance
* Resource access subject to configured timeouts
* URI formats are determined by the specific MCP server implementation
* No offline or cached resource access capabilities
How It Works[](https://kilocode.ai/docs/features/tools/access-mcp-resource#how-it-works "Direct link to How It Works")
------------------------------------------------------------------------------------------------------------------------
When the `access_mcp_resource` tool is invoked, it follows this process:
1. **Connection Validation**:
* Verifies that an MCP hub is available and initialized
* Confirms the specified server exists in the connection list
* Checks if the server is disabled (returns an error if it is)
2. **User Approval**:
* Presents the resource access request to the user for approval
* Provides server name and resource URI for user verification
* Proceeds only if the user approves the resource access
3. **Resource Request**:
* Uses the Model Context Protocol SDK to communicate with servers
* Makes a `resources/read` request to the server through the MCP hub
* Applies configured timeouts to prevent hanging on unresponsive servers
4. **Response Processing**:
* Receives a structured response with metadata and content arrays
* Processes text content for display to the user
* Handles image data specially for appropriate display
* Returns the processed resource data to Kilo Code for use in the current task
Resource Types[](https://kilocode.ai/docs/features/tools/access-mcp-resource#resource-types "Direct link to Resource Types")
------------------------------------------------------------------------------------------------------------------------------
MCP servers can provide two main types of resources:
1. **Standard Resources**:
* Fixed resources with specific URIs
* Defined name, description, and MIME type
* Direct access without parameters
* Typically represent static data or real-time information
2. **Resource Templates**:
* Parameterized resources with placeholder values in URIs
* Allow dynamic resource generation based on provided parameters
* Can represent queries or filtered views of data
* More flexible but require additional URI formatting
Examples When Used[](https://kilocode.ai/docs/features/tools/access-mcp-resource#examples-when-used "Direct link to Examples When Used")
------------------------------------------------------------------------------------------------------------------------------------------
* When helping with API development, Kilo Code retrieves endpoint specifications from MCP resources to ensure correct implementation.
* When assisting with data visualization, Kilo Code accesses current data samples from connected MCP servers.
* When working in specialized domains, Kilo Code retrieves technical documentation to provide accurate guidance.
* When generating industry-specific code, Kilo Code references compliance requirements from documentation resources.
Usage Examples[](https://kilocode.ai/docs/features/tools/access-mcp-resource#usage-examples "Direct link to Usage Examples")
------------------------------------------------------------------------------------------------------------------------------
Accessing current weather data:
weather-serverweather://san-francisco/current
Retrieving API documentation:
api-docsdocs://payment-service/endpoints
Accessing domain-specific knowledge:
knowledge-basekb://medical/terminology/common
Fetching system configuration:
infra-monitorconfig://production/database
* [Parameters](https://kilocode.ai/docs/features/tools/access-mcp-resource#parameters)
* [What It Does](https://kilocode.ai/docs/features/tools/access-mcp-resource#what-it-does)
* [When is it used?](https://kilocode.ai/docs/features/tools/access-mcp-resource#when-is-it-used)
* [Key Features](https://kilocode.ai/docs/features/tools/access-mcp-resource#key-features)
* [Limitations](https://kilocode.ai/docs/features/tools/access-mcp-resource#limitations)
* [How It Works](https://kilocode.ai/docs/features/tools/access-mcp-resource#how-it-works)
* [Resource Types](https://kilocode.ai/docs/features/tools/access-mcp-resource#resource-types)
* [Examples When Used](https://kilocode.ai/docs/features/tools/access-mcp-resource#examples-when-used)
* [Usage Examples](https://kilocode.ai/docs/features/tools/access-mcp-resource#usage-examples)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Ftools%2Faccess-mcp-resource)
---
# ask_followup_question | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/tools/ask-followup-question#__docusaurus_skipToContent_fallback)
On this page
The `ask_followup_question` tool enables interactive communication by asking specific questions to gather additional information needed to complete tasks effectively.
Parameters[](https://kilocode.ai/docs/features/tools/ask-followup-question#parameters "Direct link to Parameters")
--------------------------------------------------------------------------------------------------------------------
The tool accepts these parameters:
* `question` (required): The specific question to ask the user
* `follow_up` (optional): A list of 2-4 suggested answers that help guide user responses, each within `` tags
What It Does[](https://kilocode.ai/docs/features/tools/ask-followup-question#what-it-does "Direct link to What It Does")
--------------------------------------------------------------------------------------------------------------------------
This tool creates a conversational interface between Kilo Code and the user, allowing for gathering clarification, additional details, or user preferences when facing ambiguities or decision points. Each question can include suggested responses to streamline the interaction.
When is it used?[](https://kilocode.ai/docs/features/tools/ask-followup-question#when-is-it-used "Direct link to When is it used?")
-------------------------------------------------------------------------------------------------------------------------------------
* When critical information is missing from the original request
* When Kilo Code needs to choose between multiple valid implementation approaches
* When technical details or preferences are required to proceed
* When Kilo Code encounters ambiguities that need resolution
* When additional context would significantly improve the solution quality
Key Features[](https://kilocode.ai/docs/features/tools/ask-followup-question#key-features "Direct link to Key Features")
--------------------------------------------------------------------------------------------------------------------------
* Provides a structured way to gather specific information without breaking workflow
* Includes suggested answers to reduce user typing and guide responses
* Maintains conversation history and context across interactions
* Supports responses containing images and code snippets
* Available in all modes as part of the "always available" tool set
* Enables direct user guidance on implementation decisions
* Formats responses with `` tags to distinguish them from regular conversation
* Resets consecutive error counter when used successfully
Limitations[](https://kilocode.ai/docs/features/tools/ask-followup-question#limitations "Direct link to Limitations")
-----------------------------------------------------------------------------------------------------------------------
* Limited to asking one specific question per tool use
* Presents suggestions as selectable options in the UI
* Cannot force structured responses – users can still respond freely
* Excessive use can slow down task completion and create a fragmented experience
* Suggested answers must be complete, with no placeholders requiring user edits
* No built-in validation for user responses
* Contains no mechanism to enforce specific answer formats
How It Works[](https://kilocode.ai/docs/features/tools/ask-followup-question#how-it-works "Direct link to How It Works")
--------------------------------------------------------------------------------------------------------------------------
When the `ask_followup_question` tool is invoked, it follows this process:
1. **Parameter Validation**: Validates the required `question` parameter and checks for optional suggestions
* Ensures question text is provided
* Parses any suggested answers from the `follow_up` parameter using the `fast-xml-parser` library
* Normalizes suggestions into an array format even if there's only one suggestion
2. **JSON Transformation**: Converts the XML structure into a standardized JSON format for UI display
{ question: "User's question here", suggest: [ { answer: "Suggestion 1" }, { answer: "Suggestion 2" } ]}
3. **UI Integration**:
* Passes the JSON structure to the UI layer via the `ask("followup", ...)` method
* Displays selectable suggestion buttons to the user in the interface
* Creates an interactive experience for selecting or typing a response
4. **Response Collection and Processing**:
* Captures user text input and any images included in the response
* Wraps user responses in `` tags when returning to the assistant
* Preserves any images included in the user's response
* Maintains the conversational context by adding the response to the history
* Resets the consecutive error counter when the tool is used successfully
5. **Error Handling**:
* Tracks consecutive mistakes using a counter
* Resets the counter when the tool is used successfully
* Provides specific error messages:
* For missing parameters: "Missing required parameter 'question'"
* For XML parsing: "Failed to parse operations: \[error message\]"
* For invalid format: "Invalid operations xml format"
* Contains safeguards to prevent tool execution when required parameters are missing
* Increments consecutive mistake count when errors occur
Workflow Sequence[](https://kilocode.ai/docs/features/tools/ask-followup-question#workflow-sequence "Direct link to Workflow Sequence")
-----------------------------------------------------------------------------------------------------------------------------------------
The question-answer cycle follows this sequence:
1. **Information Gap Recognition**: Kilo Code identifies missing information needed to proceed
2. **Specific Question Creation**: Kilo Code formulates a clear, targeted question
3. **Suggestion Development**: Kilo Code creates relevant suggested answers (optional but recommended)
4. **Tool Invocation**: Assistant invokes the tool with question and optional suggestions
5. **UI Presentation**: Question and suggestions are displayed to the user as interactive elements
6. **User Response**: The user selects a suggestion or provides a custom answer
7. **Message Handling**: System handles both partial and complete messages
* For streaming responses, processes chunks as they arrive
* For complete messages, processes the entire response at once
* Maintains state consistency regardless of message chunking
8. **Response Processing**: System wraps the response in `` tags and preserves images
9. **Context Integration**: Response is added to the conversation history
10. **Task Continuation**: Kilo Code proceeds with the task using the new information
Examples When Used[](https://kilocode.ai/docs/features/tools/ask-followup-question#examples-when-used "Direct link to Examples When Used")
--------------------------------------------------------------------------------------------------------------------------------------------
* When developing a web application, Kilo Code might ask about preferred styling frameworks (Bootstrap, Tailwind, custom CSS)
* When creating an API, Kilo Code might ask about authentication methods (JWT, OAuth, API keys)
* When refactoring code, Kilo Code might ask about prioritizing performance vs. readability
* When setting up a database, Kilo Code might ask about specific schema design preferences
* When creating a custom feature, Kilo Code might ask about specific behavior expectations
* When troubleshooting errors, Kilo Code might ask about specific environment details
Response Format[](https://kilocode.ai/docs/features/tools/ask-followup-question#response-format "Direct link to Response Format")
-----------------------------------------------------------------------------------------------------------------------------------
When a user responds to a question, the response is formatted with `` tags for clarity and consistency. This format helps clearly separate the user's answer from other conversation elements.
Example response format:
Use Tailwind CSS for utility-first styling with maximum flexibility
Key characteristics of the response format:
* Surrounded by `` tags
* Preserves formatting of the original response
* Maintains images if included in the response
* Returns the complete text, even for long responses
Usage Examples[](https://kilocode.ai/docs/features/tools/ask-followup-question#usage-examples "Direct link to Usage Examples")
--------------------------------------------------------------------------------------------------------------------------------
Asking about implementation preferences:
Which styling approach would you prefer for this web application?Use Bootstrap for rapid development with consistent componentsUse Tailwind CSS for utility-first styling with maximum flexibilityUse vanilla CSS with custom styling for complete control and minimal dependencies
Requesting technical clarification:
What database should this application use for storing user data?MongoDB for flexible schema and document-based storagePostgreSQL for relational data with strong consistency guaranteesFirebase for real-time updates and simplified backend managementSQLite for lightweight local storage without external dependencies
Addressing ambiguity in requirements:
How should the application handle user authentication?Implement email/password authentication with account verificationUse social login providers (Google, GitHub, etc.) for quick signupImplement both email/password and social login options
* [Parameters](https://kilocode.ai/docs/features/tools/ask-followup-question#parameters)
* [What It Does](https://kilocode.ai/docs/features/tools/ask-followup-question#what-it-does)
* [When is it used?](https://kilocode.ai/docs/features/tools/ask-followup-question#when-is-it-used)
* [Key Features](https://kilocode.ai/docs/features/tools/ask-followup-question#key-features)
* [Limitations](https://kilocode.ai/docs/features/tools/ask-followup-question#limitations)
* [How It Works](https://kilocode.ai/docs/features/tools/ask-followup-question#how-it-works)
* [Workflow Sequence](https://kilocode.ai/docs/features/tools/ask-followup-question#workflow-sequence)
* [Examples When Used](https://kilocode.ai/docs/features/tools/ask-followup-question#examples-when-used)
* [Response Format](https://kilocode.ai/docs/features/tools/ask-followup-question#response-format)
* [Usage Examples](https://kilocode.ai/docs/features/tools/ask-followup-question#usage-examples)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Ftools%2Fask-followup-question)
---
# apply_diff | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/tools/apply-diff#__docusaurus_skipToContent_fallback)
On this page
The `apply_diff` tool makes precise, surgical changes to files by specifying exactly what content to replace. It uses multiple sophisticated strategies for finding and applying changes while maintaining proper code formatting and structure.
Parameters[](https://kilocode.ai/docs/features/tools/apply-diff#parameters "Direct link to Parameters")
---------------------------------------------------------------------------------------------------------
The tool accepts these parameters:
* `path` (required): The path of the file to modify relative to the current working directory.
* `diff` (required): The search/replace block defining the changes. **Line numbers are mandatory within the diff content format** for all currently implemented strategies.
**Note**: While the system is designed to be extensible with different diff strategies, all currently implemented strategies require line numbers to be specified within the diff content itself using the `:start_line:` marker.
What It Does[](https://kilocode.ai/docs/features/tools/apply-diff#what-it-does "Direct link to What It Does")
---------------------------------------------------------------------------------------------------------------
This tool applies targeted changes to existing files using sophisticated strategies to locate and replace content precisely. Unlike simple search and replace, it uses intelligent matching algorithms (including fuzzy matching) that adapt to different content types and file sizes, with fallback mechanisms for complex edits.
When is it used?[](https://kilocode.ai/docs/features/tools/apply-diff#when-is-it-used "Direct link to When is it used?")
--------------------------------------------------------------------------------------------------------------------------
* When Kilo Code needs to make precise changes to existing code without rewriting entire files.
* When refactoring specific sections of code while maintaining surrounding context.
* When fixing bugs in existing code with surgical precision.
* When implementing feature enhancements that modify only certain parts of a file.
Key Features[](https://kilocode.ai/docs/features/tools/apply-diff#key-features "Direct link to Key Features")
---------------------------------------------------------------------------------------------------------------
* Uses intelligent fuzzy matching with configurable confidence thresholds (typically 0.8-1.0).
* Provides context around matches using `BUFFER_LINES` (default 40).
* Employs an overlapping window approach for searching large files.
* Preserves code formatting and indentation automatically.
* Combines overlapping matches for improved confidence scoring.
* Shows changes in a diff view for user review and editing before applying.
* Tracks consecutive errors per file (`consecutiveMistakeCountForApplyDiff`) to prevent repeated failures.
* Validates file access against `.kilocodeignore` rules.
* Handles multi-line edits effectively.
Limitations[](https://kilocode.ai/docs/features/tools/apply-diff#limitations "Direct link to Limitations")
------------------------------------------------------------------------------------------------------------
* Works best with unique, distinctive code sections for reliable identification.
* Performance can vary with very large files or highly repetitive code patterns.
* Fuzzy matching might occasionally select incorrect locations if content is ambiguous.
* Each diff strategy has specific format requirements.
* Complex edits might require careful strategy selection or manual review.
How It Works[](https://kilocode.ai/docs/features/tools/apply-diff#how-it-works "Direct link to How It Works")
---------------------------------------------------------------------------------------------------------------
When the `apply_diff` tool is invoked, it follows this process:
1. **Parameter Validation**: Validates required `path` and `diff` parameters.
2. **KiloCodeIgnore Check**: Validates if the target file path is allowed by `.kilocodeignore` rules.
3. **File Analysis**: Loads the target file content.
4. **Match Finding**: Uses the selected strategy's algorithms (exact, fuzzy, overlapping windows) to locate the target content, considering confidence thresholds and context (`BUFFER_LINES`).
5. **Change Preparation**: Generates the proposed changes, preserving indentation.
6. **User Interaction**:
* Displays the changes in a diff view.
* Allows the user to review and potentially edit the proposed changes.
* Waits for user approval or rejection.
7. **Change Application**: If approved, applies the changes (potentially including user edits) to the file.
8. **Error Handling**: If errors occur (e.g., match failure, partial application), increments the `consecutiveMistakeCountForApplyDiff` for the file and reports the failure type.
9. **Feedback**: Returns the result, including any user feedback or error details.
Diff Strategy[](https://kilocode.ai/docs/features/tools/apply-diff#diff-strategy "Direct link to Diff Strategy")
------------------------------------------------------------------------------------------------------------------
Kilo Code uses this strategy for applying diffs:
### MultiSearchReplaceDiffStrategy[](https://kilocode.ai/docs/features/tools/apply-diff#multisearchreplacediffstrategy "Direct link to MultiSearchReplaceDiffStrategy")
An enhanced search/replace format supporting multiple changes in one request. **Line numbers are mandatory for each search block.**
* **Best for**: Multiple, distinct changes where line numbers are known or can be estimated.
* **Requires**: Exact match for the `SEARCH` block content, including whitespace and indentation. The `:start_line:` marker is **required** within each SEARCH block. Markers within content must be escaped (`\`).
Example format for the `` block:
<<<<<<< SEARCH:start_line:10:end_line:12------- // Old calculation logic const result = value * 0.9; return result;======= // Updated calculation logic with logging console.log(`Calculating for value: ${value}`); const result = value * 0.95; // Adjusted factor return result;>>>>>>> REPLACE<<<<<<< SEARCH:start_line:25:end_line:25------- const defaultTimeout = 5000;======= const defaultTimeout = 10000; // Increased timeout>>>>>>> REPLACE
* [Parameters](https://kilocode.ai/docs/features/tools/apply-diff#parameters)
* [What It Does](https://kilocode.ai/docs/features/tools/apply-diff#what-it-does)
* [When is it used?](https://kilocode.ai/docs/features/tools/apply-diff#when-is-it-used)
* [Key Features](https://kilocode.ai/docs/features/tools/apply-diff#key-features)
* [Limitations](https://kilocode.ai/docs/features/tools/apply-diff#limitations)
* [How It Works](https://kilocode.ai/docs/features/tools/apply-diff#how-it-works)
* [Diff Strategy](https://kilocode.ai/docs/features/tools/apply-diff#diff-strategy)
* [MultiSearchReplaceDiffStrategy](https://kilocode.ai/docs/features/tools/apply-diff#multisearchreplacediffstrategy)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Ftools%2Fapply-diff)
---
# browser_action | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/tools/browser-action#__docusaurus_skipToContent_fallback)
On this page
The `browser_action` tool enables web automation and interaction via a Puppeteer-controlled browser. It allows Kilo Code to launch browsers, navigate to websites, click elements, type text, and scroll pages with visual feedback through screenshots.
Parameters[](https://kilocode.ai/docs/features/tools/browser-action#parameters "Direct link to Parameters")
-------------------------------------------------------------------------------------------------------------
The tool accepts these parameters:
* `action` (required): The action to perform:
* `launch`: Start a new browser session at a URL
* `click`: Click at specific x,y coordinates
* `type`: Type text via the keyboard
* `scroll_down`: Scroll down one page height
* `scroll_up`: Scroll up one page height
* `close`: End the browser session
* `url` (optional): The URL to navigate to when using the `launch` action
* `coordinate` (optional): The x,y coordinates for the `click` action (e.g., "450,300")
* `text` (optional): The text to type when using the `type` action
What It Does[](https://kilocode.ai/docs/features/tools/browser-action#what-it-does "Direct link to What It Does")
-------------------------------------------------------------------------------------------------------------------
This tool creates an automated browser session that Kilo Code can control to navigate websites, interact with elements, and perform tasks that require browser automation. Each action provides a screenshot of the current state, enabling visual verification of the process.
When is it used?[](https://kilocode.ai/docs/features/tools/browser-action#when-is-it-used "Direct link to When is it used?")
------------------------------------------------------------------------------------------------------------------------------
* When Kilo Code needs to interact with web applications or websites
* When testing user interfaces or web functionality
* When capturing screenshots of web pages
* When demonstrating web workflows visually
Key Features[](https://kilocode.ai/docs/features/tools/browser-action#key-features "Direct link to Key Features")
-------------------------------------------------------------------------------------------------------------------
* Provides visual feedback with screenshots after each action and captures console logs
* Supports complete workflows from launching to page interaction to closing
* Enables precise interactions via coordinates, keyboard input, and scrolling
* Maintains consistent browser sessions with intelligent page loading detection
* Operates in two modes: local (isolated Puppeteer instance) or remote (connects to existing Chrome)
* Handles errors gracefully with automatic session cleanup and detailed messages
* Optimizes visual output with support for various formats and quality settings
* Tracks interaction state with position indicators and action history
Browser Modes[](https://kilocode.ai/docs/features/tools/browser-action#browser-modes "Direct link to Browser Modes")
----------------------------------------------------------------------------------------------------------------------
The tool operates in two distinct modes:
### Local Browser Mode (Default)[](https://kilocode.ai/docs/features/tools/browser-action#local-browser-mode-default "Direct link to Local Browser Mode (Default)")
* Downloads and manages a local Chromium instance through Puppeteer
* Creates a fresh browser environment with each launch
* No access to existing user profiles, cookies, or extensions
* Consistent, predictable behavior in a sandboxed environment
* Completely closes the browser when the session ends
### Remote Browser Mode[](https://kilocode.ai/docs/features/tools/browser-action#remote-browser-mode "Direct link to Remote Browser Mode")
* Connects to an existing Chrome/Chromium instance running with remote debugging enabled
* Can access existing browser state, cookies, and potentially extensions
* Faster startup as it reuses an existing browser process
* Supports connecting to browsers in Docker containers or on remote machines
* Only disconnects (doesn't close) from the browser when session ends
* Requires Chrome to be running with remote debugging port open (typically port 9222)
Limitations[](https://kilocode.ai/docs/features/tools/browser-action#limitations "Direct link to Limitations")
----------------------------------------------------------------------------------------------------------------
* While the browser is active, only `browser_action` tool can be used
* Browser coordinates are viewport-relative, not page-relative
* Click actions must target visible elements within the viewport
* Browser sessions must be explicitly closed before using other tools
* Browser window has configurable dimensions (default 900x600)
* Cannot directly interact with browser DevTools
* Browser sessions are temporary and not persistent across Kilo Code restarts
* Works only with Chrome/Chromium browsers, not Firefox or Safari
* Local mode has no access to existing cookies; remote mode requires Chrome with debugging enabled
How It Works[](https://kilocode.ai/docs/features/tools/browser-action#how-it-works "Direct link to How It Works")
-------------------------------------------------------------------------------------------------------------------
When the `browser_action` tool is invoked, it follows this process:
1. **Action Validation and Browser Management**:
* Validates the required parameters for the requested action
* For `launch`: Initializes a browser session (either local Puppeteer instance or remote Chrome)
* For interaction actions: Uses the existing browser session
* For `close`: Terminates or disconnects from the browser appropriately
2. **Page Interaction and Stability**:
* Ensures pages are fully loaded using DOM stability detection via `waitTillHTMLStable` algorithm
* Executes requested actions (navigation, clicking, typing, scrolling) with proper timing
* Monitors network activity after clicks and waits for navigation when necessary
3. **Visual Feedback**:
* Captures optimized screenshots using WebP format (with PNG fallback)
* Records browser console logs for debugging purposes
* Tracks mouse position and maintains paginated history of actions
4. **Session Management**:
* Maintains browser state across multiple actions
* Handles errors and automatically cleans up resources
* Enforces proper workflow sequence (launch → interactions → close)
Workflow Sequence[](https://kilocode.ai/docs/features/tools/browser-action#workflow-sequence "Direct link to Workflow Sequence")
----------------------------------------------------------------------------------------------------------------------------------
Browser interactions must follow this specific sequence:
1. **Session Initialization**: All browser workflows must start with a `launch` action
2. **Interaction Phase**: Multiple `click`, `type`, and scroll actions can be performed
3. **Session Termination**: All browser workflows must end with a `close` action
4. **Tool Switching**: After closing the browser, other tools can be used
Examples When Used[](https://kilocode.ai/docs/features/tools/browser-action#examples-when-used "Direct link to Examples When Used")
-------------------------------------------------------------------------------------------------------------------------------------
* When creating a web form submission process, Kilo Code launches a browser, navigates to the form, fills out fields with the `type` action, and clicks submit.
* When testing a responsive website, Kilo Code navigates to the site and uses scroll actions to examine different sections.
* When capturing screenshots of a web application, Kilo Code navigates through different pages and takes screenshots at each step.
* When demonstrating an e-commerce checkout flow, Kilo Code simulates the entire process from product selection to payment confirmation.
Usage Examples[](https://kilocode.ai/docs/features/tools/browser-action#usage-examples "Direct link to Usage Examples")
-------------------------------------------------------------------------------------------------------------------------
Launching a browser and navigating to a website:
launchhttps://example.com
Clicking at specific coordinates (e.g., a button):
click450,300
Typing text into a focused input field:
typeHello, World!
Scrolling down to see more content:
scroll_down
Closing the browser session:
close
* [Parameters](https://kilocode.ai/docs/features/tools/browser-action#parameters)
* [What It Does](https://kilocode.ai/docs/features/tools/browser-action#what-it-does)
* [When is it used?](https://kilocode.ai/docs/features/tools/browser-action#when-is-it-used)
* [Key Features](https://kilocode.ai/docs/features/tools/browser-action#key-features)
* [Browser Modes](https://kilocode.ai/docs/features/tools/browser-action#browser-modes)
* [Local Browser Mode (Default)](https://kilocode.ai/docs/features/tools/browser-action#local-browser-mode-default)
* [Remote Browser Mode](https://kilocode.ai/docs/features/tools/browser-action#remote-browser-mode)
* [Limitations](https://kilocode.ai/docs/features/tools/browser-action#limitations)
* [How It Works](https://kilocode.ai/docs/features/tools/browser-action#how-it-works)
* [Workflow Sequence](https://kilocode.ai/docs/features/tools/browser-action#workflow-sequence)
* [Examples When Used](https://kilocode.ai/docs/features/tools/browser-action#examples-when-used)
* [Usage Examples](https://kilocode.ai/docs/features/tools/browser-action#usage-examples)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Ftools%2Fbrowser-action)
---
# attempt_completion | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/tools/attempt-completion#__docusaurus_skipToContent_fallback)
On this page
The `attempt_completion` tool signals that Kilo Code believes a task is complete and presents results to the user. It provides a summary of what was accomplished, optionally includes a command to demonstrate the result, and supports continued refinement through user feedback.
Parameters[](https://kilocode.ai/docs/features/tools/attempt-completion#parameters "Direct link to Parameters")
-----------------------------------------------------------------------------------------------------------------
The tool accepts these parameters:
* `result` (required): The final result description summarizing what was accomplished
* `command` (optional): A CLI command to execute to demonstrate the result
What It Does[](https://kilocode.ai/docs/features/tools/attempt-completion#what-it-does "Direct link to What It Does")
-----------------------------------------------------------------------------------------------------------------------
This tool marks the end of a task by presenting a final summary of what was accomplished. It signals to both the user and the system that the current task is complete. When a command is provided, it can also demonstrate the result through a live execution.
When is it used?[](https://kilocode.ai/docs/features/tools/attempt-completion#when-is-it-used "Direct link to When is it used?")
----------------------------------------------------------------------------------------------------------------------------------
* When Kilo Code believes the user's task has been completed
* When summarizing what changes or improvements were made
* When demonstrating the current result with a command execution
* When providing a checkpoint for user feedback on the solution
* When transitioning from one phase of work to potential refinements
Key Features[](https://kilocode.ai/docs/features/tools/attempt-completion#key-features "Direct link to Key Features")
-----------------------------------------------------------------------------------------------------------------------
* Provides a clear signal that Kilo Code believes the task is complete
* Summarizes accomplishments in a concise message
* Optionally demonstrates results through command execution
* Enables user feedback for further refinements
* Displays results in a special UI format distinct from regular messages
* Captures task completion telemetry for system analytics
* Maintains a structured conversation flow by providing checkpoints
* Supports subtask completion within larger workflows
* Ensures users receive a clear summary of what was done
* Available in all modes as part of the "always available" tool group
Limitations[](https://kilocode.ai/docs/features/tools/attempt-completion#limitations "Direct link to Limitations")
--------------------------------------------------------------------------------------------------------------------
* Should not be used until previous tool uses are confirmed successful (guideline, not enforced)
* Limited to a single command for result demonstration
* Cannot present multiple command options
* Commands require user approval before execution
* Limited to demonstrating results that can be shown via CLI commands
* Cannot be used for partial task completion or progress updates
* Result formatting strips XML closing tags through internal processing
How It Works[](https://kilocode.ai/docs/features/tools/attempt-completion#how-it-works "Direct link to How It Works")
-----------------------------------------------------------------------------------------------------------------------
When the `attempt_completion` tool is invoked, it follows this process:
1. **Safety Consideration** (guideline, not enforced):
* The AI is instructed to confirm previous tool uses were successful
* This is a best practice rather than a programmatically enforced mechanism
2. **Result Presentation**:
* Displays the completion message to the user in a special "completion\_result" UI format
* Removes XML closing tags from the result text using the `removeClosingTag` function
* Presents the result differently than regular messages for visual distinction
3. **Command Execution** (if provided):
* Requests user approval before executing the command
* Only executes if the user approves
* Executes the command using the system's command execution functionality
* Shows the result of the command to the user
4. **Feedback Collection**:
* Waits for user feedback on the completion result
* Processes this feedback and returns it to the AI
* Enables continued refinement based on user input
5. **Task Completion and Continuation**:
* Signals the task as completed in the system
* Captures telemetry data for the completed task
* For subtasks, offers to finish the subtask and resume the parent task
* Supports continued conversation through the feedback mechanism
6. **Implementation Integration**:
* Tool results are parsed through the system's parsing mechanism in `parse-assistant-message.ts`
* The tool is part of the "ALWAYS\_AVAILABLE\_TOOLS" constant, making it available in all modes
Result Formatting Guidelines[](https://kilocode.ai/docs/features/tools/attempt-completion#result-formatting-guidelines "Direct link to Result Formatting Guidelines")
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
The result message should follow these guidelines:
* Clearly communicate what was accomplished
* Be concise but complete
* Focus on the value delivered to the user
* Avoid unnecessary pleasantries or filler text
* Maintain a professional, straightforward tone
* Present information in a way that's easy to scan and understand
* Acknowledge that the user may provide feedback for further refinements
Note: The system automatically strips XML closing tags from the result text through the `removeClosingTag` function.
Command Selection Guidelines[](https://kilocode.ai/docs/features/tools/attempt-completion#command-selection-guidelines "Direct link to Command Selection Guidelines")
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
When including a command, follow these guidelines:
* Choose commands that visually demonstrate the result
* Prefer commands that show the user what was created or modified
* Examples include:
* `open index.html` to display a created website
* `npm start` to launch a development server
* `python app.py` to run a created application
* Avoid commands that merely print text (like `echo` or `cat`)
* Remember that commands require user approval before execution
* Ensure the command is valid for the user's operating system
Feedback and UI Representation[](https://kilocode.ai/docs/features/tools/attempt-completion#feedback-and-ui-representation "Direct link to Feedback and UI Representation")
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The `attempt_completion` tool has a unique feedback mechanism:
* Results appear in a special "completion\_result" UI format distinct from regular messages
* The system waits for user feedback after presenting the result
* Feedback is processed and returned to Kilo Code for further refinements
* This creates an iterative improvement cycle rather than ending the conversation
* The UI includes special elements for providing feedback
* Results serve as clear checkpoints in the conversation flow
When used within subtasks:
* The system offers to finish the subtask and resume the parent task
* If approved, the subtask is completed with a summary
* The parent task resumes with context from the completed subtask
* This enables complex, nested workflows while maintaining context
Examples When Used[](https://kilocode.ai/docs/features/tools/attempt-completion#examples-when-used "Direct link to Examples When Used")
-----------------------------------------------------------------------------------------------------------------------------------------
* When creating a website, Kilo Code presents the solution and uses `open index.html` to show the result. The user provides feedback, and Kilo Code refines the design.
* When implementing a feature, Kilo Code summarizes the changes and their impact. The user requests additional test coverage, and Kilo Code continues the task.
* When fixing bugs, Kilo Code explains what was fixed and how the solution addresses the Kilo Codet cause. The user confirms the fix works.
* When setting up a development environment, Kilo Code confirms all components are installed. The user requests additional configuration, and Kilo Code continues.
* When creating a data processing script, Kilo Code summarizes the functionality. The user suggests performance improvements, and Kilo Code optimizes the code.
Usage Examples[](https://kilocode.ai/docs/features/tools/attempt-completion#usage-examples "Direct link to Usage Examples")
-----------------------------------------------------------------------------------------------------------------------------
Completing a task with just a result summary:
I've updated the CSS for the navigation bar to match the design mockup. The changes include:1. Updated color scheme to use the new brand colors2. Added responsive behavior for mobile devices3. Fixed the alignment issues in the dropdown menus
Completing a task with a result and demonstration command:
I've created a simple React application with the following features:1. A responsive landing page with the requested hero section2. A working contact form with validation3. Navigation between all three requested pages4. Styling that matches the provided design mockupnpm start
Completing a Python script task with execution:
I've created a data processing script that:1. Reads the CSV files from the data directory2. Cleans and normalizes the data as requested3. Generates the summary statistics in JSON format4. Outputs the processed data to the output directorypython process_data.py
* [Parameters](https://kilocode.ai/docs/features/tools/attempt-completion#parameters)
* [What It Does](https://kilocode.ai/docs/features/tools/attempt-completion#what-it-does)
* [When is it used?](https://kilocode.ai/docs/features/tools/attempt-completion#when-is-it-used)
* [Key Features](https://kilocode.ai/docs/features/tools/attempt-completion#key-features)
* [Limitations](https://kilocode.ai/docs/features/tools/attempt-completion#limitations)
* [How It Works](https://kilocode.ai/docs/features/tools/attempt-completion#how-it-works)
* [Result Formatting Guidelines](https://kilocode.ai/docs/features/tools/attempt-completion#result-formatting-guidelines)
* [Command Selection Guidelines](https://kilocode.ai/docs/features/tools/attempt-completion#command-selection-guidelines)
* [Feedback and UI Representation](https://kilocode.ai/docs/features/tools/attempt-completion#feedback-and-ui-representation)
* [Examples When Used](https://kilocode.ai/docs/features/tools/attempt-completion#examples-when-used)
* [Usage Examples](https://kilocode.ai/docs/features/tools/attempt-completion#usage-examples)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Ftools%2Fattempt-completion)
---
# faq | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/faq#__docusaurus_skipToContent_fallback)
On this page
This page answers some common questions about Kilo Code.
General[](https://kilocode.ai/docs/faq#general "Direct link to General")
--------------------------------------------------------------------------
### What is Kilo Code?[](https://kilocode.ai/docs/faq#what-is-kilo-code "Direct link to What is Kilo Code?")
Kilo Code is an open-source AI agent extension for Visual Studio Code. It helps you write code more efficiently by generating code, automating tasks, and providing suggestions.
### How does Kilo Code work?[](https://kilocode.ai/docs/faq#how-does-kilo-code-work "Direct link to How does Kilo Code work?")
Kilo Code uses large language models (LLMs) to understand your requests and translate them into actions. It can:
* Read and write files in your project.
* Execute commands in your VS Code terminal.
* Perform web browsing (if enabled).
* Use external tools via the Model Context Protocol (MCP).
You interact with Kilo Code through a chat interface, where you provide instructions and review/approve its proposed actions.
### What can Kilo Code do?[](https://kilocode.ai/docs/faq#what-can-kilo-code-do "Direct link to What can Kilo Code do?")
Kilo Code can help with a variety of coding tasks, including:
* Generating code from natural language descriptions.
* Refactoring existing code.
* Fixing bugs.
* Writing documentation.
* Explaining code.
* Answering questions about your codebase.
* Automating repetitive tasks.
* Creating new files and projects.
### Is Kilo Code free to use?[](https://kilocode.ai/docs/faq#is-kilo-code-free-to-use "Direct link to Is Kilo Code free to use?")
The Kilo Code extension itself is free and open-source. In addition, Kilo Code has a free tier with $20 worth of Claude 3.7 Sonnet tokens. We'll give out more free tokens if you leave useful feedback.
After that, you can add a credit card to buy more tokens (securely processed through Stripe. Our pricing matches Anthropic's API rates exactly. We don't take any cut, either per token or per top-up. In the future we'll add more LLM providers.
Alternatively, you can "Bring Your Own API" (like [Anthropic](https://kilocode.ai/docs/providers/anthropic)
, [OpenAI](https://kilocode.ai/docs/providers/openai)
, [OpenRouter](https://kilocode.ai/docs/providers/openrouter)
, [Requesty](https://kilocode.ai/docs/providers/requesty)
, etc.) for its AI capabilities. These providers typically charge for API usage based on the number of tokens processed. You will need to create an account and obtain an API key from your chosen provider. See [Setting Up Your First AI Provider](https://kilocode.ai/docs/getting-started/connecting-api-provider)
for details.
### What are the risks of using Kilo Code?[](https://kilocode.ai/docs/faq#what-are-the-risks-of-using-kilo-code "Direct link to What are the risks of using Kilo Code?")
Kilo Code is a powerful tool, and it's important to use it responsibly. Here are some things to keep in mind:
* **Kilo Code can make mistakes.** Always review Kilo Code's proposed changes carefully before approving them.
* **Kilo Code can execute commands.** Be very cautious about allowing Kilo Code to run commands, especially if you're using auto-approval.
* **Kilo Code can access the internet.** If you're using a provider that supports web browsing, be aware that Kilo Code could potentially access sensitive information.
Setup & Installation[](https://kilocode.ai/docs/faq#setup--installation "Direct link to Setup & Installation")
----------------------------------------------------------------------------------------------------------------
### How do I install Kilo Code?[](https://kilocode.ai/docs/faq#how-do-i-install-kilo-code "Direct link to How do I install Kilo Code?")
See the [Installation Guide](https://kilocode.ai/docs/getting-started/installing)
for detailed instructions.
### Which API providers are supported?[](https://kilocode.ai/docs/faq#which-api-providers-are-supported "Direct link to Which API providers are supported?")
Kilo Code supports a wide range of API providers, including:
* [Anthropic (Claude)](https://kilocode.ai/docs/providers/kilocode)
* [Anthropic (Claude)](https://kilocode.ai/docs/providers/anthropic)
* [OpenAI](https://kilocode.ai/docs/providers/openai)
* [OpenRouter](https://kilocode.ai/docs/providers/openrouter)
* [Google Gemini](https://kilocode.ai/docs/providers/gemini)
* [Glama](https://kilocode.ai/docs/providers/glama)
* [AWS Bedrock](https://kilocode.ai/docs/providers/bedrock)
* [GCP Vertex AI](https://kilocode.ai/docs/providers/vertex)
* [Ollama](https://kilocode.ai/docs/providers/ollama)
* [LM Studio](https://kilocode.ai/docs/providers/lmstudio)
* [DeepSeek](https://kilocode.ai/docs/providers/deepseek)
* [Mistral](https://kilocode.ai/docs/providers/mistral)
* [Unbound](https://kilocode.ai/docs/providers/unbound)
* [Requesty](https://kilocode.ai/docs/providers/requesty)
* [VS Code Language Model API](https://kilocode.ai/docs/providers/vscode-lm)
### How do I get an API key?[](https://kilocode.ai/docs/faq#how-do-i-get-an-api-key "Direct link to How do I get an API key?")
Each API provider has its own process for obtaining an API key. See the [Setting Up Your First AI Provider](https://kilocode.ai/docs/getting-started/connecting-api-provider)
for links to the relevant documentation for each provider.
### Can I use Kilo Code with local models?[](https://kilocode.ai/docs/faq#can-i-use-kilo-code-with-local-models "Direct link to Can I use Kilo Code with local models?")
Yes, Kilo Code supports running models locally using [Ollama](https://kilocode.ai/docs/providers/ollama)
and [LM Studio](https://kilocode.ai/docs/providers/lmstudio)
. See [Using Local Models](https://kilocode.ai/docs/advanced-usage/local-models)
for instructions.
Usage[](https://kilocode.ai/docs/faq#usage "Direct link to Usage")
--------------------------------------------------------------------
### How do I start a new task?[](https://kilocode.ai/docs/faq#how-do-i-start-a-new-task "Direct link to How do I start a new task?")
Open the Kilo Code panel () and type your task in the chat box. Be clear and specific about what you want Kilo Code to do. See [The Chat Interface](https://kilocode.ai/docs/basic-usage/the-chat-interface)
for best practices.
### What are modes in Kilo Code?[](https://kilocode.ai/docs/faq#what-are-modes-in-kilo-code "Direct link to What are modes in Kilo Code?")
[Modes](https://kilocode.ai/docs/basic-usage/using-modes)
are different personas that Kilo Code can adopt, each with a specific focus and set of capabilities. The built-in modes are:
* **Code:** For general-purpose coding tasks.
* **Architect:** For planning and technical leadership.
* **Ask:** For answering questions and providing information.
* **Debug:** For systematic problem diagnosis. You can also create [Custom Modes](https://kilocode.ai/docs/features/custom-modes)
.
### How do I switch between modes?[](https://kilocode.ai/docs/faq#how-do-i-switch-between-modes "Direct link to How do I switch between modes?")
Use the dropdown menu in the chat input area to select a different mode, or use the `/` command to switch to a specific mode.
### What are tools and how do I use them?[](https://kilocode.ai/docs/faq#what-are-tools-and-how-do-i-use-them "Direct link to What are tools and how do I use them?")
[Tools](https://kilocode.ai/docs/basic-usage/how-tools-work)
are how Kilo Code interacts with your system. Kilo Code automatically selects and uses the appropriate tools to complete your tasks. You don't need to call tools directly. You will be prompted to approve or reject each tool use.
### What are context mentions?[](https://kilocode.ai/docs/faq#what-are-context-mentions "Direct link to What are context mentions?")
[Context mentions](https://kilocode.ai/docs/basic-usage/context-mentions)
are a way to provide Kilo Code with specific information about your project, such as files, folders, or problems. Use the "@" symbol followed by the item you want to mention (e.g., `@/src/file.ts`, `@problems`).
### Can Kilo Code access the internet?[](https://kilocode.ai/docs/faq#can-kilo-code-access-the-internet "Direct link to Can Kilo Code access the internet?")
Yes, if you are using a provider with a model that support web browsing. Be mindful of the security implications of allowing this.
### Can Kilo Code run commands in my terminal?[](https://kilocode.ai/docs/faq#can-kilo-code-run-commands-in-my-terminal "Direct link to Can Kilo Code run commands in my terminal?")
Yes, Kilo Code can execute commands in your VS Code terminal. You will be prompted to approve each command before it's executed, unless you've enabled auto-approval for commands. Be extremely cautious about auto-approving commands. If you're experiencing issues with terminal commands, see the [Shell Integration Guide](https://kilocode.ai/docs/features/shell-integration)
for troubleshooting.
### How do I provide feedback to Kilo Code?[](https://kilocode.ai/docs/faq#how-do-i-provide-feedback-to-kilo-code "Direct link to How do I provide feedback to Kilo Code?")
You can provide feedback by approving or rejecting Kilo Code's proposed actions. You can provide additional feedback by using the feedback field.
### Can I customize Kilo Code's behavior?[](https://kilocode.ai/docs/faq#can-i-customize-kilo-codes-behavior "Direct link to Can I customize Kilo Code's behavior?")
Yes, you can customize Kilo Code in several ways:
* **Custom Instructions:** Provide general instructions that apply to all modes, or mode-specific instructions.
* **Custom Modes:** Create your own modes with tailored prompts and tool permissions.
* **`.clinerules` Files:** Create `.clinerules` files in your project to provide additional guidelines.
* **Settings:** Adjust various settings, such as auto-approval, diff editing, and more.
### Does Kilo Code have any auto approval settings?[](https://kilocode.ai/docs/faq#does-kilo-code-have-any-auto-approval-settings "Direct link to Does Kilo Code have any auto approval settings?")
Yes, Kilo Code has a few settings that when enabled will automatically approve actions. Find out more [here](https://kilocode.ai/docs/features/auto-approving-actions)
.
Advanced Features[](https://kilocode.ai/docs/faq#advanced-features "Direct link to Advanced Features")
--------------------------------------------------------------------------------------------------------
### Can I use Kilo Code offline?[](https://kilocode.ai/docs/faq#can-i-use-kilo-code-offline "Direct link to Can I use Kilo Code offline?")
Yes, if you use a [local model](https://kilocode.ai/docs/advanced-usage/local-models)
.
### What is MCP (Model Context Protocol)?[](https://kilocode.ai/docs/faq#what-is-mcp-model-context-protocol "Direct link to What is MCP (Model Context Protocol)?")
[MCP](https://kilocode.ai/docs/features/mcp/overview)
is a protocol that allows Kilo Code to communicate with external servers, extending its capabilities with custom tools and resources.
### Can I create my own MCP servers?[](https://kilocode.ai/docs/faq#can-i-create-my-own-mcp-servers "Direct link to Can I create my own MCP servers?")
Yes, you can create your own MCP servers to add custom functionality to Kilo Code. See the [MCP documentation](https://github.com/modelcontextprotocol)
for details. Yes, you can create your own MCP servers to add custom functionality to Kilo Code. See the [MCP documentation](https://github.com/modelcontextprotocol)
for details.
Troubleshooting[](https://kilocode.ai/docs/faq#troubleshooting "Direct link to Troubleshooting")
--------------------------------------------------------------------------------------------------
### Kilo Code isn't responding. What should I do?[](https://kilocode.ai/docs/faq#kilo-code-isnt-responding-what-should-i-do "Direct link to Kilo Code isn't responding. What should I do?")
* Make sure your API key is correct and hasn't expired.
* Check your internet connection.
* Check the status of your chosen API provider.
* Try restarting VS Code.
* If the problem persists, report the issue on [GitHub](https://github.com/Kilo-Org/kilocode/issues)
or [Discord](https://kilocode.ai/discord)
.
### I'm seeing an error message. What does it mean?[](https://kilocode.ai/docs/faq#im-seeing-an-error-message-what-does-it-mean "Direct link to I'm seeing an error message. What does it mean?")
The error message should provide some information about the problem. If you're unsure how to resolve it, seek help in the community forums.
### Kilo Code made changes I didn't want. How do I undo them?[](https://kilocode.ai/docs/faq#kilo-code-made-changes-i-didnt-want-how-do-i-undo-them "Direct link to Kilo Code made changes I didn't want. How do I undo them?")
Kilo Code uses VS Code's built-in file editing capabilities. You can use the standard "Undo" command (Ctrl/Cmd + Z) to revert changes. Also, if experimental checkpoints are enabled, Kilo can revert changes made to a file.
### How do I report a bug or suggest a feature?[](https://kilocode.ai/docs/faq#how-do-i-report-a-bug-or-suggest-a-feature "Direct link to How do I report a bug or suggest a feature?")
Please report bugs or suggest features on the Kilo Code [Issues page](https://github.com/Kilo-Org/kilocode/issues)
and [Feature Requests page](https://github.com/Kilo-Org/kilocode/discussions/categories/ideas)
.
* [General](https://kilocode.ai/docs/faq#general)
* [What is Kilo Code?](https://kilocode.ai/docs/faq#what-is-kilo-code)
* [How does Kilo Code work?](https://kilocode.ai/docs/faq#how-does-kilo-code-work)
* [What can Kilo Code do?](https://kilocode.ai/docs/faq#what-can-kilo-code-do)
* [Is Kilo Code free to use?](https://kilocode.ai/docs/faq#is-kilo-code-free-to-use)
* [What are the risks of using Kilo Code?](https://kilocode.ai/docs/faq#what-are-the-risks-of-using-kilo-code)
* [Setup & Installation](https://kilocode.ai/docs/faq#setup--installation)
* [How do I install Kilo Code?](https://kilocode.ai/docs/faq#how-do-i-install-kilo-code)
* [Which API providers are supported?](https://kilocode.ai/docs/faq#which-api-providers-are-supported)
* [How do I get an API key?](https://kilocode.ai/docs/faq#how-do-i-get-an-api-key)
* [Can I use Kilo Code with local models?](https://kilocode.ai/docs/faq#can-i-use-kilo-code-with-local-models)
* [Usage](https://kilocode.ai/docs/faq#usage)
* [How do I start a new task?](https://kilocode.ai/docs/faq#how-do-i-start-a-new-task)
* [What are modes in Kilo Code?](https://kilocode.ai/docs/faq#what-are-modes-in-kilo-code)
* [How do I switch between modes?](https://kilocode.ai/docs/faq#how-do-i-switch-between-modes)
* [What are tools and how do I use them?](https://kilocode.ai/docs/faq#what-are-tools-and-how-do-i-use-them)
* [What are context mentions?](https://kilocode.ai/docs/faq#what-are-context-mentions)
* [Can Kilo Code access the internet?](https://kilocode.ai/docs/faq#can-kilo-code-access-the-internet)
* [Can Kilo Code run commands in my terminal?](https://kilocode.ai/docs/faq#can-kilo-code-run-commands-in-my-terminal)
* [How do I provide feedback to Kilo Code?](https://kilocode.ai/docs/faq#how-do-i-provide-feedback-to-kilo-code)
* [Can I customize Kilo Code's behavior?](https://kilocode.ai/docs/faq#can-i-customize-kilo-codes-behavior)
* [Does Kilo Code have any auto approval settings?](https://kilocode.ai/docs/faq#does-kilo-code-have-any-auto-approval-settings)
* [Advanced Features](https://kilocode.ai/docs/faq#advanced-features)
* [Can I use Kilo Code offline?](https://kilocode.ai/docs/faq#can-i-use-kilo-code-offline)
* [What is MCP (Model Context Protocol)?](https://kilocode.ai/docs/faq#what-is-mcp-model-context-protocol)
* [Can I create my own MCP servers?](https://kilocode.ai/docs/faq#can-i-create-my-own-mcp-servers)
* [Troubleshooting](https://kilocode.ai/docs/faq#troubleshooting)
* [Kilo Code isn't responding. What should I do?](https://kilocode.ai/docs/faq#kilo-code-isnt-responding-what-should-i-do)
* [I'm seeing an error message. What does it mean?](https://kilocode.ai/docs/faq#im-seeing-an-error-message-what-does-it-mean)
* [Kilo Code made changes I didn't want. How do I undo them?](https://kilocode.ai/docs/faq#kilo-code-made-changes-i-didnt-want-how-do-i-undo-them)
* [How do I report a bug or suggest a feature?](https://kilocode.ai/docs/faq#how-do-i-report-a-bug-or-suggest-a-feature)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffaq)
---
# execute_command | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/tools/execute-command#__docusaurus_skipToContent_fallback)
On this page
The `execute_command` tool runs CLI commands on the user's system. It allows Kilo Code to perform system operations, install dependencies, build projects, start servers, and execute other terminal-based tasks needed to accomplish user objectives.
Parameters[](https://kilocode.ai/docs/features/tools/execute-command#parameters "Direct link to Parameters")
--------------------------------------------------------------------------------------------------------------
The tool accepts these parameters:
* `command` (required): The CLI command to execute. Must be valid for the user's operating system.
* `cwd` (optional): The working directory to execute the command in. If not provided, the current working directory is used.
What It Does[](https://kilocode.ai/docs/features/tools/execute-command#what-it-does "Direct link to What It Does")
--------------------------------------------------------------------------------------------------------------------
This tool executes terminal commands directly on the user's system, enabling a wide range of operations from file manipulations to running development servers. Commands run in managed terminal instances with real-time output capture, integrated with VS Code's terminal system for optimal performance and security.
When is it used?[](https://kilocode.ai/docs/features/tools/execute-command#when-is-it-used "Direct link to When is it used?")
-------------------------------------------------------------------------------------------------------------------------------
* When installing project dependencies (npm install, pip install, etc.)
* When building or compiling code (make, npm run build, etc.)
* When starting development servers or running applications
* When initializing new projects (git init, npm init, etc.)
* When performing file operations beyond what other tools provide
* When running tests or linting operations
* When needing to execute specialized commands for specific technologies
Key Features[](https://kilocode.ai/docs/features/tools/execute-command#key-features "Direct link to Key Features")
--------------------------------------------------------------------------------------------------------------------
* Integrates with VS Code shell API for reliable terminal execution
* Reuses terminal instances when possible through a registry system
* Captures command output line by line with real-time feedback
* Supports long-running commands that continue in the background
* Allows specification of custom working directories
* Maintains terminal history and state across command executions
* Handles complex command chains appropriate for the user's shell
* Provides detailed command completion status and exit code interpretation
* Supports interactive terminal applications with user feedback loop
* Shows terminals during execution for transparency
* Validates commands for security using shell-quote parsing
* Blocks potentially dangerous subshell execution patterns
* Integrates with KiloCodeIgnore system for file access control
* Handles terminal escape sequences for clean output
Limitations[](https://kilocode.ai/docs/features/tools/execute-command#limitations "Direct link to Limitations")
-----------------------------------------------------------------------------------------------------------------
* Command access may be restricted by KiloCodeIgnore rules and security validations
* Commands with elevated permission requirements may need user configuration
* Behavior may vary across operating systems for certain commands
* Very long-running commands may require specific handling
* File paths should be properly escaped according to the OS shell rules
* Not all terminal features may work with remote development scenarios
How It Works[](https://kilocode.ai/docs/features/tools/execute-command#how-it-works "Direct link to How It Works")
--------------------------------------------------------------------------------------------------------------------
When the `execute_command` tool is invoked, it follows this process:
1. **Command Validation and Security Checks**:
* Parses the command using shell-quote to identify components
* Validates against security restrictions (subshell usage, restricted files)
* Checks against KiloCodeIgnore rules for file access permissions
* Ensures the command meets system security requirements
2. **Terminal Management**:
* Gets or creates a terminal through TerminalRegistry
* Sets up the working directory context
* Prepares event listeners for output capture
* Shows the terminal for user visibility
3. **Command Execution and Monitoring**:
* Executes via VS Code's shellIntegration API
* Captures output with escape sequence processing
* Throttles output handling (100ms intervals)
* Monitors for command completion or errors
* Detects "hot" processes like compilers for special handling
4. **Result Processing**:
* Strips ANSI/VS Code escape sequences for clean output
* Interprets exit codes with detailed signal information
* Updates working directory tracking if changed by command
* Provides command status with appropriate context
Terminal Implementation Details[](https://kilocode.ai/docs/features/tools/execute-command#terminal-implementation-details "Direct link to Terminal Implementation Details")
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The tool uses a sophisticated terminal management system:
1. **First Priority: Terminal Reuse**
* The TerminalRegistry tries to reuse existing terminals when possible
* This reduces proliferation of terminal instances and improves performance
* Terminal state (working directory, history) is preserved across commands
2. **Second Priority: Security Validation**
* Commands are parsed using shell-quote for component analysis
* Dangerous patterns like `$(...)` and backticks are blocked
* Commands are checked against KiloCodeIgnore rules for file access control
* A prefix-based allowlist system validates command patterns
3. **Performance Optimizations**
* Output is processed in 100ms throttled intervals to prevent UI overload
* Zero-copy buffer management uses index-based tracking for efficiency
* Special handling for compilation and "hot" processes
* Platform-specific optimizations for Windows PowerShell
4. **Error and Signal Handling**
* Exit codes are mapped to detailed signal information (SIGTERM, SIGKILL, etc.)
* Core dump detection for critical failures
* Working directory changes are tracked and handled automatically
* Clean recovery from terminal disconnection scenarios
Examples When Used[](https://kilocode.ai/docs/features/tools/execute-command#examples-when-used "Direct link to Examples When Used")
--------------------------------------------------------------------------------------------------------------------------------------
* When setting up a new project, Kilo Code runs initialization commands like `npm init -y` followed by installing dependencies.
* When building a web application, Kilo Code executes build commands like `npm run build` to compile assets.
* When deploying code, Kilo Code runs git commands to commit and push changes to a repository.
* When troubleshooting, Kilo Code executes diagnostic commands to gather system information.
* When starting a development server, Kilo Code launches the appropriate server command (e.g., `npm start`).
* When running tests, Kilo Code executes the test runner command for the project's testing framework.
Usage Examples[](https://kilocode.ai/docs/features/tools/execute-command#usage-examples "Direct link to Usage Examples")
--------------------------------------------------------------------------------------------------------------------------
Running a simple command in the current directory:
npm run dev
Installing dependencies for a project:
npm install express mongodb mongoose dotenv
Running multiple commands in sequence:
mkdir -p src/components && touch src/components/App.js
Executing a command in a specific directory:
git status./my-project
Building and then starting a project:
npm run build && npm start
* [Parameters](https://kilocode.ai/docs/features/tools/execute-command#parameters)
* [What It Does](https://kilocode.ai/docs/features/tools/execute-command#what-it-does)
* [When is it used?](https://kilocode.ai/docs/features/tools/execute-command#when-is-it-used)
* [Key Features](https://kilocode.ai/docs/features/tools/execute-command#key-features)
* [Limitations](https://kilocode.ai/docs/features/tools/execute-command#limitations)
* [How It Works](https://kilocode.ai/docs/features/tools/execute-command#how-it-works)
* [Terminal Implementation Details](https://kilocode.ai/docs/features/tools/execute-command#terminal-implementation-details)
* [Examples When Used](https://kilocode.ai/docs/features/tools/execute-command#examples-when-used)
* [Usage Examples](https://kilocode.ai/docs/features/tools/execute-command#usage-examples)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Ftools%2Fexecute-command)
---
# list_code_definition_names | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/tools/list-code-definition-names#__docusaurus_skipToContent_fallback)
On this page
The `list_code_definition_names` tool provides a structural overview of your codebase by listing code definitions from source files at the top level of a specified directory. It helps Kilo Code understand code architecture by displaying line numbers and definition snippets.
Parameters[](https://kilocode.ai/docs/features/tools/list-code-definition-names#parameters "Direct link to Parameters")
-------------------------------------------------------------------------------------------------------------------------
The tool accepts these parameters:
* `path` (required): The path of the directory to list top level source code definitions for, relative to the current working directory
What It Does[](https://kilocode.ai/docs/features/tools/list-code-definition-names#what-it-does "Direct link to What It Does")
-------------------------------------------------------------------------------------------------------------------------------
This tool scans source code files at the top level of a specified directory and extracts code definitions like classes, functions, and interfaces. It displays the line numbers and actual code for each definition, providing a quick way to map the important components of your codebase.
When is it used?[](https://kilocode.ai/docs/features/tools/list-code-definition-names#when-is-it-used "Direct link to When is it used?")
------------------------------------------------------------------------------------------------------------------------------------------
* When Kilo Code needs to understand your codebase architecture quickly
* When Kilo Code needs to locate important code constructs across multiple files
* When planning refactoring or extensions to existing code
* Before diving into implementation details with other tools
* When identifying relationships between different parts of your codebase
Key Features[](https://kilocode.ai/docs/features/tools/list-code-definition-names#key-features "Direct link to Key Features")
-------------------------------------------------------------------------------------------------------------------------------
* Extracts classes, functions, methods, interfaces, and other definitions from source files
* Displays line numbers and actual source code for each definition
* Supports multiple programming languages including JavaScript, TypeScript, Python, Rust, Go, C++, C, C#, Ruby, Java, PHP, Swift, and Kotlin
* Processes only files at the top level of the specified directory (not subdirectories)
* Limits processing to a maximum of 50 files for performance
* Focuses on top-level definitions to avoid overwhelming detail
* Helps identify code organization patterns across the project
* Creates a mental map of your codebase's architecture
* Works in conjunction with other tools like `read_file` for deeper analysis
Limitations[](https://kilocode.ai/docs/features/tools/list-code-definition-names#limitations "Direct link to Limitations")
----------------------------------------------------------------------------------------------------------------------------
* Only identifies top-level definitions, not nested ones
* Only processes files at the top level of the specified directory, not subdirectories
* Limited to processing a maximum of 50 files per request
* Dependent on language-specific parsers, with varying detection quality
* May not recognize all definitions in languages with complex syntax
* Not a substitute for reading code to understand implementation details
* Cannot detect runtime patterns or dynamic code relationships
* Does not provide information about how definitions are used
* May have reduced accuracy with highly dynamic or metaprogrammed code
* Limited to specific languages supported by the implemented Tree-sitter parsers
How It Works[](https://kilocode.ai/docs/features/tools/list-code-definition-names#how-it-works "Direct link to How It Works")
-------------------------------------------------------------------------------------------------------------------------------
When the `list_code_definition_names` tool is invoked, it follows this process:
1. **Parameter Validation**: Validates the required `path` parameter
2. **Path Resolution**: Resolves the relative path to an absolute path
3. **Directory Scanning**: Scans only the top level of the specified directory for source code files (not recursive)
4. **File Filtering**: Limits processing to a maximum of 50 files
5. **Language Detection**: Identifies file types based on extensions (.js, .jsx, .ts, .tsx, .py, .rs, .go, .cpp, .hpp, .c, .h, .cs, .rb, .java, .php, .swift, .kt, .kts)
6. **Code Parsing**: Uses Tree-sitter to parse code and extract definitions through these steps:
* Parsing file content into an Abstract Syntax Tree (AST)
* Creating a query using a language-specific query string
* Sorting the captures by their position in the file
7. **Result Formatting**: Outputs definitions with line numbers and actual source code
Output Format[](https://kilocode.ai/docs/features/tools/list-code-definition-names#output-format "Direct link to Output Format")
----------------------------------------------------------------------------------------------------------------------------------
The output shows file paths followed by line numbers and the actual source code of each definition. For example:
src/utils.js:0--0 | export class HttpClient {5--5 | formatDate() {10--10 | function parseConfig(data) {src/models/User.js:0--0 | interface UserProfile {10--10 | export class User {20--20 | function createUser(data) {
Each line displays:
* The start and end line numbers of the definition
* The pipe symbol (|) as a separator
* The actual source code of the definition
This output format helps you quickly see both where definitions are located in the file and their implementation details.
Examples When Used[](https://kilocode.ai/docs/features/tools/list-code-definition-names#examples-when-used "Direct link to Examples When Used")
-------------------------------------------------------------------------------------------------------------------------------------------------
* When starting a new task, Kilo Code first lists key code definitions to understand the overall structure of your project.
* When planning refactoring work, Kilo Code uses this tool to identify classes and functions that might be affected.
* When exploring unfamiliar codebases, Kilo Code maps the important code constructs before diving into implementation details.
* When adding new features, Kilo Code identifies existing patterns and relevant code definitions to maintain consistency.
* When troubleshooting bugs, Kilo Code maps the codebase structure to locate potential sources of the issue.
* When planning architecture changes, Kilo Code identifies all affected components across files.
Usage Examples[](https://kilocode.ai/docs/features/tools/list-code-definition-names#usage-examples "Direct link to Usage Examples")
-------------------------------------------------------------------------------------------------------------------------------------
Listing code definitions in the current directory:
.
Examining a specific module's structure:
src/components
Exploring a utility library:
lib/utils
* [Parameters](https://kilocode.ai/docs/features/tools/list-code-definition-names#parameters)
* [What It Does](https://kilocode.ai/docs/features/tools/list-code-definition-names#what-it-does)
* [When is it used?](https://kilocode.ai/docs/features/tools/list-code-definition-names#when-is-it-used)
* [Key Features](https://kilocode.ai/docs/features/tools/list-code-definition-names#key-features)
* [Limitations](https://kilocode.ai/docs/features/tools/list-code-definition-names#limitations)
* [How It Works](https://kilocode.ai/docs/features/tools/list-code-definition-names#how-it-works)
* [Output Format](https://kilocode.ai/docs/features/tools/list-code-definition-names#output-format)
* [Examples When Used](https://kilocode.ai/docs/features/tools/list-code-definition-names#examples-when-used)
* [Usage Examples](https://kilocode.ai/docs/features/tools/list-code-definition-names#usage-examples)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Ftools%2Flist-code-definition-names)
---
# list_files | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/tools/list-files#__docusaurus_skipToContent_fallback)
On this page
The `list_files` tool displays the files and directories within a specified location. It helps Kilo Code understand your project structure and navigate your codebase effectively.
Parameters[](https://kilocode.ai/docs/features/tools/list-files#parameters "Direct link to Parameters")
---------------------------------------------------------------------------------------------------------
The tool accepts these parameters:
* `path` (required): The path of the directory to list contents for, relative to the current working directory
* `recursive` (optional): Whether to list files recursively. Use `true` for recursive listing, `false` or omit for top-level only.
What It Does[](https://kilocode.ai/docs/features/tools/list-files#what-it-does "Direct link to What It Does")
---------------------------------------------------------------------------------------------------------------
This tool lists all files and directories in a specified location, providing a clear overview of your project structure. It can either show just the top-level contents or recursively explore subdirectories.
When is it used?[](https://kilocode.ai/docs/features/tools/list-files#when-is-it-used "Direct link to When is it used?")
--------------------------------------------------------------------------------------------------------------------------
* When Kilo Code needs to understand your project structure
* When Kilo Code explores what files are available before reading specific ones
* When Kilo Code maps a codebase to better understand its organization
* Before using more targeted tools like `read_file` or `search_files`
* When Kilo Code needs to check for specific file types (like configuration files) across a project
Key Features[](https://kilocode.ai/docs/features/tools/list-files#key-features "Direct link to Key Features")
---------------------------------------------------------------------------------------------------------------
* Lists both files and directories with directories clearly marked
* Offers both recursive and non-recursive listing modes
* Intelligently ignores common large directories like `node_modules` and `.git` in recursive mode
* Respects `.gitignore` rules when in recursive mode
* Marks files ignored by `.kilocodeignore` with a lock symbol (🔒) when `showKiloCodeIgnoredFiles` is enabled
* Optimizes performance with level-by-level directory traversal
* Sorts results to show directories before their contents, maintaining a logical hierarchy
* Presents results in a clean, organized format
* Automatically creates a mental map of your project structure
Limitations[](https://kilocode.ai/docs/features/tools/list-files#limitations "Direct link to Limitations")
------------------------------------------------------------------------------------------------------------
* File listing is capped at about 200 files by default to prevent performance issues
* Has a 10-second timeout for directory traversal to prevent hanging on complex directory structures
* When the file limit is hit, it adds a note suggesting to use `list_files` on specific subdirectories
* Not designed for confirming the existence of files you've just created
* May have reduced performance in very large directory structures
* Cannot list files in root or home directories for security reasons
How It Works[](https://kilocode.ai/docs/features/tools/list-files#how-it-works "Direct link to How It Works")
---------------------------------------------------------------------------------------------------------------
When the `list_files` tool is invoked, it follows this process:
1. **Parameter Validation**: Validates the required `path` parameter and optional `recursive` parameter
2. **Path Resolution**: Resolves the relative path to an absolute path
3. **Security Checks**: Prevents listing files in sensitive locations like root or home directories
4. **Directory Scanning**:
* For non-recursive mode: Lists only the top-level contents
* For recursive mode: Traverses the directory structure level by level with a 10-second timeout
* If timeout occurs, returns partial results collected up to that point
5. **Result Filtering**:
* In recursive mode, skips common large directories like `node_modules`, `.git`, etc.
* Respects `.gitignore` rules when in recursive mode
* Handles `.kilocodeignore` patterns, either hiding files or marking them with a lock symbol
6. **Formatting**:
* Marks directories with a trailing slash (`/`)
* Sorts results to show directories before their contents for logical hierarchy
* Marks ignored files with a lock symbol (🔒) when `showKiloCodeIgnored` is enabled
* Caps results at 200 files by default with a note about using subdirectories
* Organizes results for readability
File Listing Format[](https://kilocode.ai/docs/features/tools/list-files#file-listing-format "Direct link to File Listing Format")
------------------------------------------------------------------------------------------------------------------------------------
The file listing results include:
* Each file path is displayed on its own line
* Directories are marked with a trailing slash (`/`)
* Files ignored by `.kilocodeignore` are marked with a lock symbol (🔒) when `showKiloCodeIgnored` is enabled
* Results are sorted logically with directories appearing before their contents
* When the file limit is reached, a message appears suggesting to use `list_files` on specific subdirectories
Example output format:
src/src/components/src/components/Button.tsxsrc/components/Header.tsxsrc/utils/src/utils/helpers.tssrc/index.ts...File listing truncated (showing 200 of 543 files). Use list_files on specific subdirectories for more details.
When `.kilocodeignore` files are used and `showKiloCodeIgnored` is enabled:
src/src/components/src/components/Button.tsxsrc/components/Header.tsx🔒 src/secrets.jsonsrc/utils/src/utils/helpers.tssrc/index.ts
Examples When Used[](https://kilocode.ai/docs/features/tools/list-files#examples-when-used "Direct link to Examples When Used")
---------------------------------------------------------------------------------------------------------------------------------
* When starting a new task, Kilo Code may list the project files to understand its structure before diving into specific code.
* When asked to find specific types of files (like all JavaScript files), Kilo Code first lists directories to know where to look.
* When providing recommendations for code organization, Kilo Code examines the current project structure first.
* When setting up a new feature, Kilo Code lists related directories to understand the project conventions.
Usage Examples[](https://kilocode.ai/docs/features/tools/list-files#usage-examples "Direct link to Usage Examples")
---------------------------------------------------------------------------------------------------------------------
Listing top-level files in the current directory:
.
Recursively listing all files in a source directory:
srctrue
Examining a specific project subdirectory:
src/componentsfalse
* [Parameters](https://kilocode.ai/docs/features/tools/list-files#parameters)
* [What It Does](https://kilocode.ai/docs/features/tools/list-files#what-it-does)
* [When is it used?](https://kilocode.ai/docs/features/tools/list-files#when-is-it-used)
* [Key Features](https://kilocode.ai/docs/features/tools/list-files#key-features)
* [Limitations](https://kilocode.ai/docs/features/tools/list-files#limitations)
* [How It Works](https://kilocode.ai/docs/features/tools/list-files#how-it-works)
* [File Listing Format](https://kilocode.ai/docs/features/tools/list-files#file-listing-format)
* [Examples When Used](https://kilocode.ai/docs/features/tools/list-files#examples-when-used)
* [Usage Examples](https://kilocode.ai/docs/features/tools/list-files#usage-examples)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Ftools%2Flist-files)
---
# new_task | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/tools/new-task#__docusaurus_skipToContent_fallback)
On this page
The `new_task` tool creates subtasks with specialized modes while maintaining a parent-child relationship. It breaks down complex projects into manageable pieces, each operating in the mode best suited for specific work.
Parameters[](https://kilocode.ai/docs/features/tools/new-task#parameters "Direct link to Parameters")
-------------------------------------------------------------------------------------------------------
The tool accepts these parameters:
* `mode` (required): The slug of the mode to start the new task in (e.g., "code", "ask", "architect")
* `message` (required): The initial user message or instructions for this new task
What It Does[](https://kilocode.ai/docs/features/tools/new-task#what-it-does "Direct link to What It Does")
-------------------------------------------------------------------------------------------------------------
This tool creates a new task instance with a specified starting mode and initial message. It allows complex workflows to be divided into subtasks with their own conversation history. Parent tasks are paused during subtask execution and resumed when the subtask completes, with results transferred back to the parent.
When is it used?[](https://kilocode.ai/docs/features/tools/new-task#when-is-it-used "Direct link to When is it used?")
------------------------------------------------------------------------------------------------------------------------
* When breaking down complex projects into separate, focused subtasks
* When different aspects of a task require different specialized modes
* When different phases of work benefit from context separation
* When organizing multi-phase development workflows
Key Features[](https://kilocode.ai/docs/features/tools/new-task#key-features "Direct link to Key Features")
-------------------------------------------------------------------------------------------------------------
* Creates subtasks with their own conversation history and specialized mode
* Pauses parent tasks for later resumption
* Maintains hierarchical task relationships for navigation
* Transfers results back to parent tasks upon completion
* Supports workflow segregation for complex projects
* Allows different parts of a project to use modes optimized for specific work
* Requires explicit user approval for task creation
* Provides clear task transition in the UI
Limitations[](https://kilocode.ai/docs/features/tools/new-task#limitations "Direct link to Limitations")
----------------------------------------------------------------------------------------------------------
* Cannot create tasks with modes that don't exist
* Requires user approval before creating each new task
* Task interface may become complex with deeply nested subtasks
* Subtasks inherit certain workspace and extension configurations from parents
* May require re-establishing context when switching between deeply nested tasks
* Task completion needs explicit signaling to properly return to parent tasks
How It Works[](https://kilocode.ai/docs/features/tools/new-task#how-it-works "Direct link to How It Works")
-------------------------------------------------------------------------------------------------------------
When the `new_task` tool is invoked, it follows this process:
1. **Parameter Validation**:
* Validates the required `mode` and `message` parameters
* Verifies that the requested mode exists in the system
2. **Task Stack Management**:
* Maintains a task stack that tracks all active and paused tasks
* Preserves the current mode for later resumption
* Sets the parent task to paused state
3. **Task Context Management**:
* Creates a new task context with the provided message
* Assigns unique taskId and instanceId identifiers for state management
* Captures telemetry data on tool usage and task lifecycles
4. **Mode Switching and Integration**:
* Switches to the specified mode with appropriate role and capabilities
* Initializes the new task with the provided message
* Integrates with VS Code's command palette and code actions
5. **Task Completion and Result Transfer**:
* When subtask completes, result is passed back to parent task via `finishSubTask()`
* Parent task resumes in its original mode
* Task history and token usage metrics are updated
* The `taskCompleted` event is emitted with performance data
Examples When Used[](https://kilocode.ai/docs/features/tools/new-task#examples-when-used "Direct link to Examples When Used")
-------------------------------------------------------------------------------------------------------------------------------
* When a front-end developer needs to architect a new feature, implement the code, and document it, they can create separate tasks for each phase with results flowing from one phase to the next.
* When debugging an issue before implementing a fix, the debugging task can document findings that are passed to the implementation task.
* When developing a full-stack application, database schema designs from an architect-mode task inform implementation details in a subsequent code-mode task.
* When documenting a system after implementation, the documentation task can reference the completed implementation while using documentation-specific features.
Usage Examples[](https://kilocode.ai/docs/features/tools/new-task#usage-examples "Direct link to Usage Examples")
-------------------------------------------------------------------------------------------------------------------
Creating a new task in code mode:
codeImplement a user authentication service with login, registration, and password reset functionality.
Creating a documentation task after completing implementation:
docsCreate comprehensive API documentation for the authentication service we just built.
Breaking down a complex feature into architectural planning and implementation:
architectDesign the database schema and system architecture for our new e-commerce platform.
* [Parameters](https://kilocode.ai/docs/features/tools/new-task#parameters)
* [What It Does](https://kilocode.ai/docs/features/tools/new-task#what-it-does)
* [When is it used?](https://kilocode.ai/docs/features/tools/new-task#when-is-it-used)
* [Key Features](https://kilocode.ai/docs/features/tools/new-task#key-features)
* [Limitations](https://kilocode.ai/docs/features/tools/new-task#limitations)
* [How It Works](https://kilocode.ai/docs/features/tools/new-task#how-it-works)
* [Examples When Used](https://kilocode.ai/docs/features/tools/new-task#examples-when-used)
* [Usage Examples](https://kilocode.ai/docs/features/tools/new-task#usage-examples)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Ftools%2Fnew-task)
---
# search_files | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/tools/search-files#__docusaurus_skipToContent_fallback)
On this page
The `search_files` tool performs regex searches across multiple files in your project. It helps Kilo Code locate specific code patterns, text, or other content throughout your codebase with contextual results.
Parameters[](https://kilocode.ai/docs/features/tools/search-files#parameters "Direct link to Parameters")
-----------------------------------------------------------------------------------------------------------
The tool accepts these parameters:
* `path` (required): The path of the directory to search in, relative to the current working directory
* `regex` (required): The regular expression pattern to search for (uses Rust regex syntax)
* `file_pattern` (optional): Glob pattern to filter files (e.g., '\*.ts' for TypeScript files)
What It Does[](https://kilocode.ai/docs/features/tools/search-files#what-it-does "Direct link to What It Does")
-----------------------------------------------------------------------------------------------------------------
This tool searches across files in a specified directory using regular expressions, showing each match with surrounding context. It's like having a powerful "Find in Files" feature that works across the entire project structure.
When is it used?[](https://kilocode.ai/docs/features/tools/search-files#when-is-it-used "Direct link to When is it used?")
----------------------------------------------------------------------------------------------------------------------------
* When Kilo Code needs to find where specific functions or variables are used
* When Kilo Code helps with refactoring and needs to understand usage patterns
* When Kilo Code needs to locate all instances of a particular code pattern
* When Kilo Code searches for text across multiple files with filtering capabilities
Key Features[](https://kilocode.ai/docs/features/tools/search-files#key-features "Direct link to Key Features")
-----------------------------------------------------------------------------------------------------------------
* Searches across multiple files in a single operation using high-performance Ripgrep
* Shows context around each match (1 line before and after)
* Filters files by type using glob patterns (e.g., only TypeScript files)
* Provides line numbers for easy reference
* Uses powerful regex patterns for precise searches
* Automatically limits output to 300 results with notification
* Truncates lines longer than 500 characters with "\[truncated...\]" marker
* Intelligently combines nearby matches into single blocks for readability
Limitations[](https://kilocode.ai/docs/features/tools/search-files#limitations "Direct link to Limitations")
--------------------------------------------------------------------------------------------------------------
* Works best with text-based files (not effective for binary files like images)
* Performance may slow with extremely large codebases
* Uses Rust regex syntax, which may differ slightly from other regex implementations
* Cannot search within compressed files or archives
* Default context size is fixed (1 line before and after)
* May display varying context sizes when matches are close together due to result grouping
How It Works[](https://kilocode.ai/docs/features/tools/search-files#how-it-works "Direct link to How It Works")
-----------------------------------------------------------------------------------------------------------------
When the `search_files` tool is invoked, it follows this process:
1. **Parameter Validation**: Validates the required `path` and `regex` parameters
2. **Path Resolution**: Resolves the relative path to an absolute path
3. **Search Execution**:
* Uses Ripgrep (rg) for high-performance text searching
* Applies file pattern filtering if specified
* Collects matches with surrounding context
4. **Result Formatting**:
* Formats results with file paths, line numbers, and context
* Displays 1 line of context before and after each match
* Structures output for easy readability
* Limits results to a maximum of 300 matches with notification
* Truncates lines longer than 500 characters
* Merges nearby matches into contiguous blocks
Search Results Format[](https://kilocode.ai/docs/features/tools/search-files#search-results-format "Direct link to Search Results Format")
--------------------------------------------------------------------------------------------------------------------------------------------
The search results include:
* Relative file paths for each matching file (prefixed with #)
* Context lines before and after each match (1 line by default)
* Line numbers padded to 3 spaces followed by `|` and the line content
* A separator line (----) after each match group
Example output format:
# rel/path/to/app.ts 11 | // Some processing logic here 12 | // TODO: Implement error handling 13 | return processedData;----# Showing first 300 of 300+ results. Use a more specific search if necessary.
When matches occur close to each other, they're merged into a single block rather than shown as separate results:
# rel/path/to/auth.ts 13 | // Some code here 14 | // TODO: Add proper validation 15 | function validateUser(credentials) { 16 | // TODO: Implement rate limiting 17 | return checkDatabase(credentials);----
Examples When Used[](https://kilocode.ai/docs/features/tools/search-files#examples-when-used "Direct link to Examples When Used")
-----------------------------------------------------------------------------------------------------------------------------------
* When asked to refactor a function, Kilo Code first searches for all places the function is used to ensure comprehensive changes.
* When investigating bugs, Kilo Code searches for similar patterns to identify related issues across the codebase.
* When addressing technical debt, Kilo Code locates all TODO comments across the project.
* When analyzing dependencies, Kilo Code finds all imports of a particular module.
Usage Examples[](https://kilocode.ai/docs/features/tools/search-files#usage-examples "Direct link to Usage Examples")
-----------------------------------------------------------------------------------------------------------------------
Searching for TODO comments in all JavaScript files:
srcTODO|FIXME*.js
Finding all usages of a specific function:
.function\s+calculateTotal*.{js,ts}
Searching for a specific import pattern across the entire project:
.import\s+.*\s+from\s+['"]@components/
* [Parameters](https://kilocode.ai/docs/features/tools/search-files#parameters)
* [What It Does](https://kilocode.ai/docs/features/tools/search-files#what-it-does)
* [When is it used?](https://kilocode.ai/docs/features/tools/search-files#when-is-it-used)
* [Key Features](https://kilocode.ai/docs/features/tools/search-files#key-features)
* [Limitations](https://kilocode.ai/docs/features/tools/search-files#limitations)
* [How It Works](https://kilocode.ai/docs/features/tools/search-files#how-it-works)
* [Search Results Format](https://kilocode.ai/docs/features/tools/search-files#search-results-format)
* [Examples When Used](https://kilocode.ai/docs/features/tools/search-files#examples-when-used)
* [Usage Examples](https://kilocode.ai/docs/features/tools/search-files#usage-examples)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Ftools%2Fsearch-files)
---
# switch_mode | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/tools/switch-mode#__docusaurus_skipToContent_fallback)
On this page
The `switch_mode` tool enables Kilo Code to change between different operational modes, each with specialized capabilities for specific types of tasks. This allows seamless transitions between modes like Code, Architect, Ask, or Debug when the current task requires different expertise.
Parameters[](https://kilocode.ai/docs/features/tools/switch-mode#parameters "Direct link to Parameters")
----------------------------------------------------------------------------------------------------------
The tool accepts these parameters:
* `mode_slug` (required): The slug of the mode to switch to (e.g., "code", "ask", "architect")
* `reason` (optional): The reason for switching modes, providing context for the user
What It Does[](https://kilocode.ai/docs/features/tools/switch-mode#what-it-does "Direct link to What It Does")
----------------------------------------------------------------------------------------------------------------
This tool requests a mode change when the current task would be better handled by another mode's capabilities. It maintains context while shifting Kilo Code's focus and available toolsets to match the requirements of the new task phase.
When is it used?[](https://kilocode.ai/docs/features/tools/switch-mode#when-is-it-used "Direct link to When is it used?")
---------------------------------------------------------------------------------------------------------------------------
* When transitioning from information gathering to code implementation
* When shifting from coding to architecture or design
* When the current task requires capabilities only available in a different mode
* When specialized expertise is needed for a particular phase of a complex project
Key Features[](https://kilocode.ai/docs/features/tools/switch-mode#key-features "Direct link to Key Features")
----------------------------------------------------------------------------------------------------------------
* Maintains context continuity across mode transitions
* Provides clear reasoning for mode switch recommendations
* Requires user approval for all mode changes
* Enforces tool group restrictions specific to each mode
* Seamlessly adapts tool availability based on the selected mode
* Works with both standard and custom modes
* Displays the mode switch and reasoning in the UI
* Uses XML-style formatting for parameter specification
* Handles file type restrictions specific to certain modes
Limitations[](https://kilocode.ai/docs/features/tools/switch-mode#limitations "Direct link to Limitations")
-------------------------------------------------------------------------------------------------------------
* Cannot switch to modes that don't exist in the system
* Requires explicit user approval for each mode transition
* Cannot use tools specific to a mode until the switch is complete
* Applies a 500ms delay after mode switching to allow the change to take effect
* Some modes have file type restrictions (e.g., Architect mode can only edit markdown files)
* Mode preservation for resumption applies only to the `new_task` functionality, not general mode switching
How It Works[](https://kilocode.ai/docs/features/tools/switch-mode#how-it-works "Direct link to How It Works")
----------------------------------------------------------------------------------------------------------------
When the `switch_mode` tool is invoked, it follows this process:
1. **Request Validation**:
* Validates that the requested mode exists in the system
* Checks that the `mode_slug` parameter is provided and valid
* Verifies the user isn't already in the requested mode
* Ensures the `reason` parameter (if provided) is properly formatted
2. **Mode Transition Preparation**:
* Packages the mode change request with the provided reason
* Presents the change request to the user for approval
3. **Mode Activation (Upon User Approval)**:
* Updates the UI to reflect the new mode
* Adjusts available tools based on the mode's tool group configuration
* Applies the mode-specific prompt and behavior
* Applies a 500ms delay to allow the change to take effect before executing next tool
* Enforces any file restrictions specific to the mode
4. **Continuation**:
* Proceeds with the task using the capabilities of the new mode
* Retains relevant context from the previous interaction
Tool Group Association[](https://kilocode.ai/docs/features/tools/switch-mode#tool-group-association "Direct link to Tool Group Association")
----------------------------------------------------------------------------------------------------------------------------------------------
The `switch_mode` tool belongs to the "modes" tool group but is also included in the "always available" tools list. This means:
* It can be used in any mode regardless of the mode's configured tool groups
* It's available alongside other core tools like `ask_followup_question` and `attempt_completion`
* It allows mode transitions at any point in a workflow when task requirements change
Mode Structure[](https://kilocode.ai/docs/features/tools/switch-mode#mode-structure "Direct link to Mode Structure")
----------------------------------------------------------------------------------------------------------------------
Each mode in the system has a specific structure:
* `slug`: Unique identifier for the mode (e.g., "code", "ask")
* `name`: Display name for the mode (e.g., "Code", "Ask")
* `roleDefinition`: The specialized role and capabilities of the mode
* `customInstructions`: Optional mode-specific instructions that guide behavior
* `groups`: Tool groups available to the mode with optional restrictions
Mode Capabilities[](https://kilocode.ai/docs/features/tools/switch-mode#mode-capabilities "Direct link to Mode Capabilities")
-------------------------------------------------------------------------------------------------------------------------------
The core modes provide these specialized capabilities:
* **Code Mode**: Focused on coding tasks with full access to code editing tools
* **Architect Mode**: Specialized for system design and architecture planning, limited to editing markdown files only
* **Ask Mode**: Optimized for answering questions and providing information
* **Debug Mode**: Equipped for systematic problem diagnosis and resolution
Custom Modes[](https://kilocode.ai/docs/features/tools/switch-mode#custom-modes "Direct link to Custom Modes")
----------------------------------------------------------------------------------------------------------------
Beyond the core modes, the system supports custom project-specific modes:
* Custom modes can be defined with specific tool groups enabled
* They can specify custom role definitions and instructions
* The system checks custom modes first before falling back to core modes
* Custom mode definitions take precedence over core modes with the same slug
File Restrictions[](https://kilocode.ai/docs/features/tools/switch-mode#file-restrictions "Direct link to File Restrictions")
-------------------------------------------------------------------------------------------------------------------------------
Different modes may have specific file type restrictions:
* **Architect Mode**: Can only edit files matching the `.md` extension
* Attempting to edit restricted file types results in a `FileRestrictionError`
* These restrictions help enforce proper separation of concerns between modes
Examples When Used[](https://kilocode.ai/docs/features/tools/switch-mode#examples-when-used "Direct link to Examples When Used")
----------------------------------------------------------------------------------------------------------------------------------
* When discussing a new feature, Kilo Code switches from Ask mode to Architect mode to help design the system structure.
* After completing architecture planning in Architect mode, Kilo Code switches to Code mode to implement the designed features.
* When encountering bugs during development, Kilo Code switches from Code mode to Debug mode for systematic troubleshooting.
Usage Examples[](https://kilocode.ai/docs/features/tools/switch-mode#usage-examples "Direct link to Usage Examples")
----------------------------------------------------------------------------------------------------------------------
Switching to Code mode for implementation:
codeNeed to implement the login functionality based on the architecture we've discussed
Switching to Architect mode for design:
architectNeed to design the system architecture before implementation
Switching to Debug mode for troubleshooting:
debugNeed to systematically diagnose the authentication error
Switching to Ask mode for information:
askNeed to answer questions about the implemented feature
* [Parameters](https://kilocode.ai/docs/features/tools/switch-mode#parameters)
* [What It Does](https://kilocode.ai/docs/features/tools/switch-mode#what-it-does)
* [When is it used?](https://kilocode.ai/docs/features/tools/switch-mode#when-is-it-used)
* [Key Features](https://kilocode.ai/docs/features/tools/switch-mode#key-features)
* [Limitations](https://kilocode.ai/docs/features/tools/switch-mode#limitations)
* [How It Works](https://kilocode.ai/docs/features/tools/switch-mode#how-it-works)
* [Tool Group Association](https://kilocode.ai/docs/features/tools/switch-mode#tool-group-association)
* [Mode Structure](https://kilocode.ai/docs/features/tools/switch-mode#mode-structure)
* [Mode Capabilities](https://kilocode.ai/docs/features/tools/switch-mode#mode-capabilities)
* [Custom Modes](https://kilocode.ai/docs/features/tools/switch-mode#custom-modes)
* [File Restrictions](https://kilocode.ai/docs/features/tools/switch-mode#file-restrictions)
* [Examples When Used](https://kilocode.ai/docs/features/tools/switch-mode#examples-when-used)
* [Usage Examples](https://kilocode.ai/docs/features/tools/switch-mode#usage-examples)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Ftools%2Fswitch-mode)
---
# read_file | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/tools/read-file#__docusaurus_skipToContent_fallback)
On this page
The `read_file` tool examines the contents of files in a project. It allows Kilo Code to understand code, configuration files, and documentation to provide better assistance.
Parameters[](https://kilocode.ai/docs/features/tools/read-file#parameters "Direct link to Parameters")
--------------------------------------------------------------------------------------------------------
The tool accepts these parameters:
* `path` (required): The path of the file to read relative to the current working directory
* `start_line` (optional): The starting line number to read from (1-based indexing)
* `end_line` (optional): The ending line number to read to (1-based, inclusive)
* `auto_truncate` (optional): Whether to automatically truncate large files when line range isn't specified (true/false)
What It Does[](https://kilocode.ai/docs/features/tools/read-file#what-it-does "Direct link to What It Does")
--------------------------------------------------------------------------------------------------------------
This tool reads the content of a specified file and returns it with line numbers for easy reference. It can read entire files or specific sections, and even extract text from PDFs and Word documents.
When is it used?[](https://kilocode.ai/docs/features/tools/read-file#when-is-it-used "Direct link to When is it used?")
-------------------------------------------------------------------------------------------------------------------------
* When Kilo Code needs to understand existing code structure
* When Kilo Code needs to analyze configuration files
* When Kilo Code needs to extract information from text files
* When Kilo Code needs to see code before suggesting changes
* When specific line numbers need to be referenced in discussions
Key Features[](https://kilocode.ai/docs/features/tools/read-file#key-features "Direct link to Key Features")
--------------------------------------------------------------------------------------------------------------
* Displays file content with line numbers for easy reference
* Can read specific portions of files by specifying line ranges
* Extracts readable text from PDF and DOCX files
* Intelligently truncates large files to focus on the most relevant sections
* Provides method summaries with line ranges for large code files
* Efficiently streams only requested line ranges for better performance
* Makes it easy to discuss specific parts of code with line numbering
Limitations[](https://kilocode.ai/docs/features/tools/read-file#limitations "Direct link to Limitations")
-----------------------------------------------------------------------------------------------------------
* May not handle extremely large files efficiently without using line range parameters
* For binary files (except PDF and DOCX), may return content that isn't human-readable
How It Works[](https://kilocode.ai/docs/features/tools/read-file#how-it-works "Direct link to How It Works")
--------------------------------------------------------------------------------------------------------------
When the `read_file` tool is invoked, it follows this process:
1. **Parameter Validation**: Validates the required `path` parameter and optional parameters
2. **Path Resolution**: Resolves the relative path to an absolute path
3. **Reading Strategy Selection**:
* The tool uses a strict priority hierarchy (explained in detail below)
* It chooses between range reading, auto-truncation, or full file reading
4. **Content Processing**:
* Adds line numbers to the content (e.g., "1 | const x = 13") where `1 |` is the line number.
* For truncated files, adds truncation notice and method definitions
* For special formats (PDF, DOCX, IPYNB), extracts readable text
Reading Strategy Priority[](https://kilocode.ai/docs/features/tools/read-file#reading-strategy-priority "Direct link to Reading Strategy Priority")
-----------------------------------------------------------------------------------------------------------------------------------------------------
The tool uses a clear decision hierarchy to determine how to read a file:
1. **First Priority: Explicit Line Range**
* If either `start_line` or `end_line` is provided, the tool always performs a range read
* The implementation efficiently streams only the requested lines, making it suitable for processing large files
* This takes precedence over all other options
2. **Second Priority: Auto-Truncation for Large Files**
* This only applies when ALL of these conditions are met:
* Neither `start_line` nor `end_line` is specified
* The `auto_truncate` parameter is set to `true`
* The file is not a binary file
* The file exceeds the configured line threshold (typically 500-1000 lines)
* When auto-truncation activates, the tool:
* Reads only the first portion of the file (determined by the maxReadFileLine setting)
* Adds a truncation notice showing the number of lines displayed vs. total
* Provides a summary of method definitions with their line ranges
3. **Default Behavior: Read Entire File**
* If neither of the above conditions are met, it reads the entire file content
* For special formats like PDF, DOCX, and IPYNB, it uses specialized extractors
Examples When Used[](https://kilocode.ai/docs/features/tools/read-file#examples-when-used "Direct link to Examples When Used")
--------------------------------------------------------------------------------------------------------------------------------
* When asked to explain or improve code, Kilo Code first reads the relevant files to understand the current implementation.
* When troubleshooting configuration issues, Kilo Code reads config files to identify potential problems.
* When working with documentation, Kilo Code reads existing docs to understand the current content before suggesting improvements.
Usage Examples[](https://kilocode.ai/docs/features/tools/read-file#usage-examples "Direct link to Usage Examples")
--------------------------------------------------------------------------------------------------------------------
Here are several scenarios demonstrating how the `read_file` tool is used and the typical output you might receive.
### Reading an Entire File[](https://kilocode.ai/docs/features/tools/read-file#reading-an-entire-file "Direct link to Reading an Entire File")
To read the complete content of a file:
**Input:**
src/app.js
**Simulated Output (for a small file like `example_small.txt`):**
1 | This is the first line.2 | This is the second line.3 | This is the third line.
_(Output will vary based on the actual file content)_
### Reading Specific Lines[](https://kilocode.ai/docs/features/tools/read-file#reading-specific-lines "Direct link to Reading Specific Lines")
To read only a specific range of lines (e.g., 46-68):
**Input:**
src/app.js4668
**Simulated Output (for lines 2-3 of `example_five_lines.txt`):**
2 | Content of line two.3 | Content of line three.
_(Output shows only the requested lines with their original line numbers)_
### Reading a Large File (Auto-Truncation)[](https://kilocode.ai/docs/features/tools/read-file#reading-a-large-file-auto-truncation "Direct link to Reading a Large File (Auto-Truncation)")
When reading a large file without specifying lines and `auto_truncate` is enabled (or defaults to true based on settings):
**Input:**
src/large-module.jstrue
**Simulated Output (for `large_file.log` with 1500 lines, limit 1000):**
1 | Log entry 1...2 | Log entry 2......1000 | Log entry 1000...[... truncated 500 lines ...]
_(Output is limited to the configured maximum lines, with a truncation notice)_
### Attempting to Read a Non-Existent File[](https://kilocode.ai/docs/features/tools/read-file#attempting-to-read-a-non-existent-file "Direct link to Attempting to Read a Non-Existent File")
If the specified file does not exist:
**Input:**
non_existent_file.txt
**Simulated Output (Error):**
Error: File not found at path 'non_existent_file.txt'.
### Attempting to Read a Blocked File[](https://kilocode.ai/docs/features/tools/read-file#attempting-to-read-a-blocked-file "Direct link to Attempting to Read a Blocked File")
If the file is excluded by rules in a `.kilocodeignore` file:
**Input:**
.env
**Simulated Output (Error):**
Error: Access denied to file '.env' due to .kilocodeignore rules.
* [Parameters](https://kilocode.ai/docs/features/tools/read-file#parameters)
* [What It Does](https://kilocode.ai/docs/features/tools/read-file#what-it-does)
* [When is it used?](https://kilocode.ai/docs/features/tools/read-file#when-is-it-used)
* [Key Features](https://kilocode.ai/docs/features/tools/read-file#key-features)
* [Limitations](https://kilocode.ai/docs/features/tools/read-file#limitations)
* [How It Works](https://kilocode.ai/docs/features/tools/read-file#how-it-works)
* [Reading Strategy Priority](https://kilocode.ai/docs/features/tools/read-file#reading-strategy-priority)
* [Examples When Used](https://kilocode.ai/docs/features/tools/read-file#examples-when-used)
* [Usage Examples](https://kilocode.ai/docs/features/tools/read-file#usage-examples)
* [Reading an Entire File](https://kilocode.ai/docs/features/tools/read-file#reading-an-entire-file)
* [Reading Specific Lines](https://kilocode.ai/docs/features/tools/read-file#reading-specific-lines)
* [Reading a Large File (Auto-Truncation)](https://kilocode.ai/docs/features/tools/read-file#reading-a-large-file-auto-truncation)
* [Attempting to Read a Non-Existent File](https://kilocode.ai/docs/features/tools/read-file#attempting-to-read-a-non-existent-file)
* [Attempting to Read a Blocked File](https://kilocode.ai/docs/features/tools/read-file#attempting-to-read-a-blocked-file)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Ftools%2Fread-file)
---
# update_todo_list | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/tools/update-todo-list#__docusaurus_skipToContent_fallback)
On this page
The `update_todo_list` tool replaces the entire TODO list with an updated checklist reflecting the current state. It provides step-by-step task tracking, allowing confirmation of completion before updating and dynamic addition of new todos discovered during complex tasks.
Parameters[](https://kilocode.ai/docs/features/tools/update-todo-list#parameters "Direct link to Parameters")
---------------------------------------------------------------------------------------------------------------
The tool accepts these parameters:
* `todos` (required): A markdown checklist with task descriptions and status indicators
What It Does[](https://kilocode.ai/docs/features/tools/update-todo-list#what-it-does "Direct link to What It Does")
---------------------------------------------------------------------------------------------------------------------
This tool manages a comprehensive TODO list that tracks task progress through different status states. It replaces the entire list with each update, ensuring the current state accurately reflects all pending, in-progress, and completed tasks. The system displays the TODO list as reminders in subsequent messages.
When is it used?[](https://kilocode.ai/docs/features/tools/update-todo-list#when-is-it-used "Direct link to When is it used?")
--------------------------------------------------------------------------------------------------------------------------------
* When tasks involve multiple steps requiring systematic tracking
* When new actionable items are discovered during task execution
* When updating the status of several todos simultaneously
* When complex projects benefit from clear, stepwise progress tracking
* When organizing multi-phase workflows with dependencies
Key Features[](https://kilocode.ai/docs/features/tools/update-todo-list#key-features "Direct link to Key Features")
---------------------------------------------------------------------------------------------------------------------
* Maintains a single-level markdown checklist with three status states
* Updates multiple task statuses in a single operation
* Dynamically adds new todos as they're discovered during execution
* Provides visual progress tracking through status indicators
* Integrates with the reminder system for persistent task visibility
* Supports task reordering based on execution priority
* Preserves all unfinished tasks unless explicitly removed
* Enables efficient batch status updates
Limitations[](https://kilocode.ai/docs/features/tools/update-todo-list#limitations "Direct link to Limitations")
------------------------------------------------------------------------------------------------------------------
* Limited to single-level checklists (no nesting or subtasks)
* Cannot remove tasks unless they're completed or no longer relevant
* Requires complete list replacement rather than incremental updates
* Status changes must be explicitly managed through tool calls
* No built-in task dependency tracking
* Cannot schedule tasks for future execution
* Limited to three status states (pending, in-progress, completed)
Status Indicators[](https://kilocode.ai/docs/features/tools/update-todo-list#status-indicators "Direct link to Status Indicators")
------------------------------------------------------------------------------------------------------------------------------------
The tool uses three distinct status indicators:
* `[ ]` **Pending**: Task not yet started
* `[-]` **In Progress**: Task currently being worked on
* `[x]` **Completed**: Task fully finished with no unresolved issues
How It Works[](https://kilocode.ai/docs/features/tools/update-todo-list#how-it-works "Direct link to How It Works")
---------------------------------------------------------------------------------------------------------------------
When the `update_todo_list` tool is invoked, it follows this process:
1. **Status Validation**:
* Parses the markdown checklist format
* Validates status indicators are properly formatted
* Ensures task descriptions are clear and actionable
2. **List Replacement**:
* Completely replaces the existing TODO list
* Preserves task order as specified in the update
* Maintains task descriptions and status states
3. **Reminder Integration**:
* Integrates updated list with the reminder system
* Displays current tasks in subsequent message headers
* Provides persistent visibility of task progress
4. **Progress Tracking**:
* Tracks completion status across multiple updates
* Maintains task history for reference
* Supports workflow continuation across sessions
Best Practices[](https://kilocode.ai/docs/features/tools/update-todo-list#best-practices "Direct link to Best Practices")
---------------------------------------------------------------------------------------------------------------------------
### Task Management Guidelines[](https://kilocode.ai/docs/features/tools/update-todo-list#task-management-guidelines "Direct link to Task Management Guidelines")
* Mark tasks as completed immediately after all work is finished
* Start the next task by marking it as in-progress
* Add new todos as soon as they are identified during execution
* Use clear, descriptive task names that indicate specific actions
* Order tasks by logical execution sequence or priority
### Status Update Patterns[](https://kilocode.ai/docs/features/tools/update-todo-list#status-update-patterns "Direct link to Status Update Patterns")
* Update multiple statuses simultaneously when transitioning between tasks
* Confirm task completion before marking as finished
* Keep in-progress tasks focused on current work
* Add blocking tasks when dependencies are discovered
### When to Use[](https://kilocode.ai/docs/features/tools/update-todo-list#when-to-use "Direct link to When to Use")
Use this tool when:
* The task involves multiple steps or requires ongoing tracking
* New actionable items are discovered during task execution
* Multiple todos need status updates simultaneously
* Complex tasks benefit from clear progress visualization
Avoid using when:
* There is only a single, trivial task
* The task can be completed in one or two simple steps
* The request is purely conversational or informational
Examples When Used[](https://kilocode.ai/docs/features/tools/update-todo-list#examples-when-used "Direct link to Examples When Used")
---------------------------------------------------------------------------------------------------------------------------------------
* When implementing a multi-component feature requiring frontend, backend, and database changes
* When debugging issues that reveal multiple related problems requiring fixes
* When setting up development environments with multiple configuration steps
* When documenting systems that require research, writing, and review phases
* When refactoring code that affects multiple files and requires testing
Usage Examples[](https://kilocode.ai/docs/features/tools/update-todo-list#usage-examples "Direct link to Usage Examples")
---------------------------------------------------------------------------------------------------------------------------
Initial task breakdown:
[-] Analyze requirements and create technical specification[ ] Design database schema and API endpoints[ ] Implement backend authentication service[ ] Create frontend login components[ ] Write comprehensive tests[ ] Update documentation
Updating progress and adding discovered tasks:
[x] Analyze requirements and create technical specification[x] Design database schema and API endpoints[-] Implement backend authentication service[ ] Create frontend login components[ ] Write comprehensive tests[ ] Update documentation[ ] Add password reset functionality[ ] Implement rate limiting for login attempts
Completing multiple tasks and transitioning focus:
[x] Analyze requirements and create technical specification[x] Design database schema and API endpoints[x] Implement backend authentication service[x] Create frontend login components[-] Write comprehensive tests[ ] Update documentation[ ] Add password reset functionality[ ] Implement rate limiting for login attempts
* [Parameters](https://kilocode.ai/docs/features/tools/update-todo-list#parameters)
* [What It Does](https://kilocode.ai/docs/features/tools/update-todo-list#what-it-does)
* [When is it used?](https://kilocode.ai/docs/features/tools/update-todo-list#when-is-it-used)
* [Key Features](https://kilocode.ai/docs/features/tools/update-todo-list#key-features)
* [Limitations](https://kilocode.ai/docs/features/tools/update-todo-list#limitations)
* [Status Indicators](https://kilocode.ai/docs/features/tools/update-todo-list#status-indicators)
* [How It Works](https://kilocode.ai/docs/features/tools/update-todo-list#how-it-works)
* [Best Practices](https://kilocode.ai/docs/features/tools/update-todo-list#best-practices)
* [Task Management Guidelines](https://kilocode.ai/docs/features/tools/update-todo-list#task-management-guidelines)
* [Status Update Patterns](https://kilocode.ai/docs/features/tools/update-todo-list#status-update-patterns)
* [When to Use](https://kilocode.ai/docs/features/tools/update-todo-list#when-to-use)
* [Examples When Used](https://kilocode.ai/docs/features/tools/update-todo-list#examples-when-used)
* [Usage Examples](https://kilocode.ai/docs/features/tools/update-todo-list#usage-examples)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Ftools%2Fupdate-todo-list)
---
# use_mcp_tool | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/tools/use-mcp-tool#__docusaurus_skipToContent_fallback)
On this page
The `use_mcp_tool` tool enables interaction with external tools provided by connected Model Context Protocol (MCP) servers. It extends Kilo Code's capabilities with domain-specific functionality through a standardized protocol.
Parameters[](https://kilocode.ai/docs/features/tools/use-mcp-tool#parameters "Direct link to Parameters")
-----------------------------------------------------------------------------------------------------------
The tool accepts these parameters:
* `server_name` (required): The name of the MCP server providing the tool
* `tool_name` (required): The name of the tool to execute
* `arguments` (required/optional): A JSON object containing the tool's input parameters, following the tool's input schema. May be optional for tools that require no input.
What It Does[](https://kilocode.ai/docs/features/tools/use-mcp-tool#what-it-does "Direct link to What It Does")
-----------------------------------------------------------------------------------------------------------------
This tool allows Kilo Code to access specialized functionality provided by external MCP servers. Each MCP server can offer multiple tools with unique capabilities, extending Kilo Code beyond its built-in functionality. The system validates arguments against schemas, manages server connections, and processes responses of various content types (text, image, resource).
When is it used?[](https://kilocode.ai/docs/features/tools/use-mcp-tool#when-is-it-used "Direct link to When is it used?")
----------------------------------------------------------------------------------------------------------------------------
* When specialized functionality not available in core tools is needed
* When domain-specific operations are required
* When integration with external systems or services is needed
* When working with data that requires specific processing or analysis
* When accessing proprietary tools through a standardized interface
Key Features[](https://kilocode.ai/docs/features/tools/use-mcp-tool#key-features "Direct link to Key Features")
-----------------------------------------------------------------------------------------------------------------
* Uses the standardized MCP protocol via the `@modelcontextprotocol/sdk` library
* Supports multiple transport mechanisms (StdioClientTransport and SSEClientTransport)
* Validates arguments using Zod schema validation on both client and server sides
* Processes multiple response content types: text, image, and resource references
* Manages server lifecycle with automatic restarts when server code changes
* Provides an "always allow" mechanism to bypass approval for trusted tools
* Works with the companion `access_mcp_resource` tool for resource retrieval
* Maintains proper error tracking and handling for failed operations
* Supports configurable timeouts (1-3600 seconds, default: 60 seconds)
* Allows file watchers to automatically detect and reload server changes
Limitations[](https://kilocode.ai/docs/features/tools/use-mcp-tool#limitations "Direct link to Limitations")
--------------------------------------------------------------------------------------------------------------
* Depends on external MCP servers being available and connected
* Limited to the tools provided by connected servers
* Tool capabilities vary between different MCP servers
* Network issues can affect reliability and performance
* Requires user approval before execution (unless in the "always allow" list)
* Cannot execute multiple MCP tool operations simultaneously
Server Configuration[](https://kilocode.ai/docs/features/tools/use-mcp-tool#server-configuration "Direct link to Server Configuration")
-----------------------------------------------------------------------------------------------------------------------------------------
MCP servers can be configured globally or at the project level:
* **Global Configuration**: Managed through the Kilo Code extension settings in VS Code. These apply across all projects unless overridden.
* **Project-level Configuration**: Defined in a `.kilocode/mcp.json` file within your project's root directory.
* This allows project-specific server setups.
* Project-level servers take precedence over global servers if they share the same name.
* Since `.kilocode/mcp.json` can be committed to version control, it simplifies sharing configurations with your team.
How It Works[](https://kilocode.ai/docs/features/tools/use-mcp-tool#how-it-works "Direct link to How It Works")
-----------------------------------------------------------------------------------------------------------------
When the `use_mcp_tool` tool is invoked, it follows this process:
1. **Initialization and Validation**:
* The system verifies that the MCP hub is available
* Confirms the specified server exists and is connected
* Validates the requested tool exists on the server
* Arguments are validated against the tool's schema definition
* Timeout settings are extracted from server configuration (default: 60 seconds)
2. **Execution and Communication**:
* The system selects the appropriate transport mechanism:
* `StdioClientTransport`: For communicating with local processes via standard I/O
* `SSEClientTransport`: For communicating with HTTP servers via Server-Sent Events
* A request is sent with validated server name, tool name, and arguments
* Communication uses the `@modelcontextprotocol/sdk` library for standardized interactions
* Request execution is tracked with timeout handling to prevent hanging operations
3. **Response Processing**:
* Responses can include multiple content types:
* Text content: Plain text responses
* Image content: Binary image data with MIME type information
* Resource references: URIs to access server resources (works with `access_mcp_resource`)
* The system checks the `isError` flag to determine if error handling is needed
* Results are formatted for display in the Kilo Code interface
4. **Resource and Error Handling**:
* The system uses WeakRef patterns to prevent memory leaks
* A consecutive mistake counter tracks and manages errors
* File watchers monitor for server code changes and trigger automatic restarts
* The security model requires approval for tool execution unless in the "always allow" list
Security and Permissions[](https://kilocode.ai/docs/features/tools/use-mcp-tool#security-and-permissions "Direct link to Security and Permissions")
-----------------------------------------------------------------------------------------------------------------------------------------------------
The MCP architecture provides several security features:
* Users must approve tool usage before execution (by default)
* Specific tools can be marked for automatic approval in the "always allow" list
* Server configurations are validated with Zod schemas for integrity
* Configurable timeouts prevent hanging operations (1-3600 seconds)
* Server connections can be enabled or disabled through the UI
Examples When Used[](https://kilocode.ai/docs/features/tools/use-mcp-tool#examples-when-used "Direct link to Examples When Used")
-----------------------------------------------------------------------------------------------------------------------------------
* Analyzing specialized data formats using server-side processing tools
* Generating images or other media through AI models hosted on external servers
* Executing complex domain-specific calculations without local implementation
* Accessing proprietary APIs or services through a controlled interface
* Retrieving data from specialized databases or data sources
Usage Examples[](https://kilocode.ai/docs/features/tools/use-mcp-tool#usage-examples "Direct link to Usage Examples")
-----------------------------------------------------------------------------------------------------------------------
Requesting weather forecast data with text response:
weather-serverget_forecast{ "city": "San Francisco", "days": 5, "format": "text"}
Analyzing source code with a specialized tool that returns JSON:
code-analysiscomplexity_metrics{ "language": "typescript", "file_path": "src/app.ts", "include_functions": true, "metrics": ["cyclomatic", "cognitive"]}
Generating an image with specific parameters:
image-generationcreate_image{ "prompt": "A futuristic city with flying cars", "style": "photorealistic", "dimensions": { "width": 1024, "height": 768 }, "format": "webp"}
Accessing a resource through a tool that returns a resource reference:
database-connectorquery_and_store{ "database": "users", "type": "select", "fields": ["name", "email", "last_login"], "where": { "status": "active" }, "store_as": "active_users"}
Tool with no required arguments:
system-monitorget_current_status{}
* [Parameters](https://kilocode.ai/docs/features/tools/use-mcp-tool#parameters)
* [What It Does](https://kilocode.ai/docs/features/tools/use-mcp-tool#what-it-does)
* [When is it used?](https://kilocode.ai/docs/features/tools/use-mcp-tool#when-is-it-used)
* [Key Features](https://kilocode.ai/docs/features/tools/use-mcp-tool#key-features)
* [Limitations](https://kilocode.ai/docs/features/tools/use-mcp-tool#limitations)
* [Server Configuration](https://kilocode.ai/docs/features/tools/use-mcp-tool#server-configuration)
* [How It Works](https://kilocode.ai/docs/features/tools/use-mcp-tool#how-it-works)
* [Security and Permissions](https://kilocode.ai/docs/features/tools/use-mcp-tool#security-and-permissions)
* [Examples When Used](https://kilocode.ai/docs/features/tools/use-mcp-tool#examples-when-used)
* [Usage Examples](https://kilocode.ai/docs/features/tools/use-mcp-tool#usage-examples)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Ftools%2Fuse-mcp-tool)
---
# write_to_file | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/tools/write-to-file#__docusaurus_skipToContent_fallback)
On this page
The `write_to_file` tool creates new files or completely replaces existing file content with an interactive approval process. It provides a diff view for reviewing changes before they're applied.
Parameters[](https://kilocode.ai/docs/features/tools/write-to-file#parameters "Direct link to Parameters")
------------------------------------------------------------------------------------------------------------
The tool accepts these parameters:
* `path` (required): The path of the file to write to, relative to the current working directory
* `content` (required): The complete content to write to the file
* `line_count` (required): The number of lines in the file, including empty lines
What It Does[](https://kilocode.ai/docs/features/tools/write-to-file#what-it-does "Direct link to What It Does")
------------------------------------------------------------------------------------------------------------------
This tool writes content to a specified file, either creating a new file if it doesn't exist or completely overwriting an existing file. All changes require explicit user approval through a diff view interface, where users can review and even edit the proposed changes before they're applied.
When is it used?[](https://kilocode.ai/docs/features/tools/write-to-file#when-is-it-used "Direct link to When is it used?")
-----------------------------------------------------------------------------------------------------------------------------
* When Kilo Code needs to create a new file from scratch
* When Kilo Code needs to completely rewrite an existing file
* When creating multiple files for a new project
* When generating configuration files, documentation, or source code
* When you need to review changes before they're applied
Key Features[](https://kilocode.ai/docs/features/tools/write-to-file#key-features "Direct link to Key Features")
------------------------------------------------------------------------------------------------------------------
* Interactive Approval: Shows changes in a diff view requiring explicit approval before applying
* User Edit Support: Allows editing the proposed content before final approval
* Safety Measures: Detects code omission, validates paths, and prevents truncated content
* Editor Integration: Opens a diff view that scrolls to the first difference automatically
* Content Preprocessing: Handles artifacts from different AI models to ensure clean content
* Access Control: Validates against `.kilocodeignore` restrictions before making changes
* Parent Directories: May handle directory creation through system dependencies
* Complete Replacement: Provides a fully transformed file in a single operation
Limitations[](https://kilocode.ai/docs/features/tools/write-to-file#limitations "Direct link to Limitations")
---------------------------------------------------------------------------------------------------------------
* Not suitable for existing files: Much slower and less efficient than `apply_diff` for modifying existing files
* Performance with large files: Operation becomes significantly slower with larger files
* Complete overwrite: Replaces entire file content, cannot preserve original content
* Line count required: Needs accurate line count to detect potential content truncation
* Review overhead: The approval process adds extra steps compared to direct edits
* Interactive only: Cannot be used in automated workflows that require non-interactive execution
How It Works[](https://kilocode.ai/docs/features/tools/write-to-file#how-it-works "Direct link to How It Works")
------------------------------------------------------------------------------------------------------------------
When the `write_to_file` tool is invoked, it follows this process:
1. **Parameter Validation**: Validates the required parameters and permissions
* Checks that `path`, `content`, and `line_count` are provided
* Validates the file is allowed (not restricted by `.kilocodeignore`)
* Ensures the path is within the workspace boundaries
* Tracks consecutive mistake counts for missing parameters
* Shows specific error messages for each validation failure
2. **Content Preprocessing**:
* Removes code block markers that might be added by AI models
* Handles escaped HTML entities (specifically for non-Claude models)
* Strips line numbers if accidentally included in content
* Performs model-specific processing for different AI providers
3. **Diff View Generation**:
* Opens a diff view in the editor showing the proposed changes
* Adds a 300ms delay to ensure UI responsiveness
* Scrolls automatically to the first difference
* Highlights changes for easy review
4. **User Approval Process**:
* Waits for explicit user approval to proceed
* Allows users to edit the content in the diff view
* Captures any user edits for the final content
* Provides option to reject changes entirely
* Detects and incorporates user modifications into the final result
5. **Safety Validation**:
* Detects potential content truncation by comparing with provided line count
* Shows warnings if content appears incomplete
* Validates file path and access permissions
* Specifically checks if files are outside the workspace with `isOutsideWorkspace` flag
6. **File Writing**:
* Writes the approved content (with any user edits) to the file
* Provides confirmation of successful write
* Resets the consecutive mistakes counter on success
Examples When Used[](https://kilocode.ai/docs/features/tools/write-to-file#examples-when-used "Direct link to Examples When Used")
------------------------------------------------------------------------------------------------------------------------------------
* When creating a new project, Kilo Code generates multiple files but lets you review each before committing changes.
* When setting up configuration files, Kilo Code shows the proposed configuration in a diff view for approval.
* When generating documentation, Kilo Code creates markdown files but lets you make final adjustments in the diff view.
* When developing a prototype, Kilo Code shows complete source files in a diff view where you can fine-tune before saving.
Usage Examples[](https://kilocode.ai/docs/features/tools/write-to-file#usage-examples "Direct link to Usage Examples")
------------------------------------------------------------------------------------------------------------------------
Creating a new JSON configuration file:
config/settings.json{ "apiEndpoint": "https://api.example.com", "theme": { "primaryColor": "#007bff", "secondaryColor": "#6c757d", "fontFamily": "Arial, sans-serif" }, "features": { "darkMode": true, "notifications": true, "analytics": false }, "version": "1.0.0"}14
Creating a simple HTML file:
src/index.htmlMy Application13
Creating a JavaScript module:
src/utils/helpers.js/** * Utility functions for the application */export function formatDate(date) { return new Date(date).toLocaleDateString();}export function calculateTotal(items) { return items.reduce((sum, item) => sum + item.price, 0);}export function debounce(func, delay) { let timeout; return function(...args) { clearTimeout(timeout); timeout = setTimeout(() => func.apply(this, args), delay); };}18
* [Parameters](https://kilocode.ai/docs/features/tools/write-to-file#parameters)
* [What It Does](https://kilocode.ai/docs/features/tools/write-to-file#what-it-does)
* [When is it used?](https://kilocode.ai/docs/features/tools/write-to-file#when-is-it-used)
* [Key Features](https://kilocode.ai/docs/features/tools/write-to-file#key-features)
* [Limitations](https://kilocode.ai/docs/features/tools/write-to-file#limitations)
* [How It Works](https://kilocode.ai/docs/features/tools/write-to-file#how-it-works)
* [Examples When Used](https://kilocode.ai/docs/features/tools/write-to-file#examples-when-used)
* [Usage Examples](https://kilocode.ai/docs/features/tools/write-to-file#usage-examples)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Ftools%2Fwrite-to-file)
---
# Tool Use Overview | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/features/tools/tool-use-overview#__docusaurus_skipToContent_fallback)
On this page
Kilo Code implements a sophisticated tool system that allows AI models to interact with your development environment in a controlled and secure manner. This document explains how tools work, when they're called, and how they're managed.
Core Concepts[](https://kilocode.ai/docs/features/tools/tool-use-overview#core-concepts "Direct link to Core Concepts")
-------------------------------------------------------------------------------------------------------------------------
### Tool Groups[](https://kilocode.ai/docs/features/tools/tool-use-overview#tool-groups "Direct link to Tool Groups")
Tools are organized into logical groups based on their functionality:
| Category | Purpose | Tools | Common Use |
| --- | --- | --- | --- |
| **Read Group** | File system reading and searching | [read\_file](https://kilocode.ai/docs/features/tools/read-file) , [search\_files](https://kilocode.ai/docs/features/tools/search-files) , [list\_files](https://kilocode.ai/docs/features/tools/list-files) , [list\_code\_definition\_names](https://kilocode.ai/docs/features/tools/list-code-definition-names) | Code exploration and analysis |
| **Edit Group** | File system modifications | [apply\_diff](https://kilocode.ai/docs/features/tools/apply-diff) , [write\_to\_file](https://kilocode.ai/docs/features/tools/write-to-file) | Code changes and file manipulation |
| **Browser Group** | Web automation | [browser\_action](https://kilocode.ai/docs/features/tools/browser-action) | Web testing and interaction |
| **Command Group** | System command execution | [execute\_command](https://kilocode.ai/docs/features/tools/execute-command) | Running scripts, building projects |
| **MCP Group** | External tool integration | [use\_mcp\_tool](https://kilocode.ai/docs/features/tools/use-mcp-tool) , [access\_mcp\_resource](https://kilocode.ai/docs/features/tools/access-mcp-resource) | Specialized functionality through external servers |
| **Workflow Group** | Mode and task management | [switch\_mode](https://kilocode.ai/docs/features/tools/switch-mode) , [new\_task](https://kilocode.ai/docs/features/tools/new-task) , [ask\_followup\_question](https://kilocode.ai/docs/features/tools/ask-followup-question) , [attempt\_completion](https://kilocode.ai/docs/features/tools/attempt-completion) , [update\_todo\_list](https://kilocode.ai/docs/features/tools/update-todo-list) | Context switching and task organization |
### Always Available Tools[](https://kilocode.ai/docs/features/tools/tool-use-overview#always-available-tools "Direct link to Always Available Tools")
Certain tools are accessible regardless of the current mode:
* [ask\_followup\_question](https://kilocode.ai/docs/features/tools/ask-followup-question)
: Gather additional information from users
* [attempt\_completion](https://kilocode.ai/docs/features/tools/attempt-completion)
: Signal task completion
* [switch\_mode](https://kilocode.ai/docs/features/tools/switch-mode)
: Change operational modes
* [new\_task](https://kilocode.ai/docs/features/tools/new-task)
: Create subtasks
* [update\_todo\_list](https://kilocode.ai/docs/features/tools/update-todo-list)
: Manage step-by-step task tracking
Available Tools[](https://kilocode.ai/docs/features/tools/tool-use-overview#available-tools "Direct link to Available Tools")
-------------------------------------------------------------------------------------------------------------------------------
### Read Tools[](https://kilocode.ai/docs/features/tools/tool-use-overview#read-tools "Direct link to Read Tools")
These tools help Kilo Code understand your code and project:
* [read\_file](https://kilocode.ai/docs/features/tools/read-file)
- Examines the contents of files
* [search\_files](https://kilocode.ai/docs/features/tools/search-files)
- Finds patterns across multiple files
* [list\_files](https://kilocode.ai/docs/features/tools/list-files)
- Maps your project's file structure
* [list\_code\_definition\_names](https://kilocode.ai/docs/features/tools/list-code-definition-names)
- Creates a structural map of your code
### Edit Tools[](https://kilocode.ai/docs/features/tools/tool-use-overview#edit-tools "Direct link to Edit Tools")
These tools help Kilo Code make changes to your code:
* [apply\_diff](https://kilocode.ai/docs/features/tools/apply-diff)
- Makes precise, surgical changes to your code
* [write\_to\_file](https://kilocode.ai/docs/features/tools/write-to-file)
- Creates new files or completely rewrites existing ones
### Browser Tools[](https://kilocode.ai/docs/features/tools/tool-use-overview#browser-tools "Direct link to Browser Tools")
These tools help Kilo Code interact with web applications:
* [browser\_action](https://kilocode.ai/docs/features/tools/browser-action)
- Automates browser interactions
### Command Tools[](https://kilocode.ai/docs/features/tools/tool-use-overview#command-tools "Direct link to Command Tools")
These tools help Kilo Code execute commands:
* [execute\_command](https://kilocode.ai/docs/features/tools/execute-command)
- Runs system commands and programs
### MCP Tools[](https://kilocode.ai/docs/features/tools/tool-use-overview#mcp-tools "Direct link to MCP Tools")
These tools help Kilo Code connect with external services:
* [use\_mcp\_tool](https://kilocode.ai/docs/features/tools/use-mcp-tool)
- Uses specialized external tools
* [access\_mcp\_resource](https://kilocode.ai/docs/features/tools/access-mcp-resource)
- Accesses external data sources
### Workflow Tools[](https://kilocode.ai/docs/features/tools/tool-use-overview#workflow-tools "Direct link to Workflow Tools")
These tools help manage the conversation and task flow:
* [ask\_followup\_question](https://kilocode.ai/docs/features/tools/ask-followup-question)
- Gets additional information from you
* [attempt\_completion](https://kilocode.ai/docs/features/tools/attempt-completion)
- Presents final results
* [switch\_mode](https://kilocode.ai/docs/features/tools/switch-mode)
- Changes to a different mode for specialized tasks
* [new\_task](https://kilocode.ai/docs/features/tools/new-task)
- Creates a new subtask
* [update\_todo\_list](https://kilocode.ai/docs/features/tools/update-todo-list)
- Tracks task progress with step-by-step checklists
Tool Calling Mechanism[](https://kilocode.ai/docs/features/tools/tool-use-overview#tool-calling-mechanism "Direct link to Tool Calling Mechanism")
----------------------------------------------------------------------------------------------------------------------------------------------------
### When Tools Are Called[](https://kilocode.ai/docs/features/tools/tool-use-overview#when-tools-are-called "Direct link to When Tools Are Called")
Tools are invoked under specific conditions:
1. **Direct Task Requirements**
* When specific actions are needed to complete a task as decided by the LLM
* In response to user requests
* During automated workflows
2. **Mode-Based Availability**
* Different modes enable different tool sets
* Mode switches can trigger tool availability changes
* Some tools are restricted to specific modes
3. **Context-Dependent Calls**
* Based on the current state of the workspace
* In response to system events
* During error handling and recovery
### Decision Process[](https://kilocode.ai/docs/features/tools/tool-use-overview#decision-process "Direct link to Decision Process")
The system uses a multi-step process to determine tool availability:
1. **Mode Validation**
isToolAllowedForMode( tool: string, modeSlug: string, customModes: ModeConfig[], toolRequirements?: Record, toolParams?: Record)
2. **Requirement Checking**
* System capability verification
* Resource availability
* Permission validation
3. **Parameter Validation**
* Required parameter presence
* Parameter type checking
* Value validation
Technical Implementation[](https://kilocode.ai/docs/features/tools/tool-use-overview#technical-implementation "Direct link to Technical Implementation")
----------------------------------------------------------------------------------------------------------------------------------------------------------
### Tool Call Processing[](https://kilocode.ai/docs/features/tools/tool-use-overview#tool-call-processing "Direct link to Tool Call Processing")
1. **Initialization**
* Tool name and parameters are validated
* Mode compatibility is checked
* Requirements are verified
2. **Execution**
const toolCall = { type: "tool_call", name: chunk.name, arguments: chunk.input, callId: chunk.callId}
3. **Result Handling**
* Success/failure determination
* Result formatting
* Error handling
### Security and Permissions[](https://kilocode.ai/docs/features/tools/tool-use-overview#security-and-permissions "Direct link to Security and Permissions")
1. **Access Control**
* File system restrictions
* Command execution limitations
* Network access controls
2. **Validation Layers**
* Tool-specific validation
* Mode-based restrictions
* System-level checks
Mode Integration[](https://kilocode.ai/docs/features/tools/tool-use-overview#mode-integration "Direct link to Mode Integration")
----------------------------------------------------------------------------------------------------------------------------------
### Mode-Based Tool Access[](https://kilocode.ai/docs/features/tools/tool-use-overview#mode-based-tool-access "Direct link to Mode-Based Tool Access")
Tools are made available based on the current mode:
* **Code Mode**: Full access to file system tools, code editing capabilities, command execution
* **Ask Mode**: Limited to reading tools, information gathering capabilities, no file system modifications
* **Architect Mode**: Design-focused tools, documentation capabilities, limited execution rights
* **Custom Modes**: Can be configured with specific tool access for specialized workflows
### Mode Switching[](https://kilocode.ai/docs/features/tools/tool-use-overview#mode-switching "Direct link to Mode Switching")
1. **Process**
* Current mode state preservation
* Tool availability updates
* Context switching
2. **Impact on Tools**
* Tool set changes
* Permission adjustments
* Context preservation
Best Practices[](https://kilocode.ai/docs/features/tools/tool-use-overview#best-practices "Direct link to Best Practices")
----------------------------------------------------------------------------------------------------------------------------
### Tool Usage Guidelines[](https://kilocode.ai/docs/features/tools/tool-use-overview#tool-usage-guidelines "Direct link to Tool Usage Guidelines")
1. **Efficiency**
* Use the most specific tool for the task
* Avoid redundant tool calls
* Batch operations when possible
2. **Security**
* Validate inputs before tool calls
* Use minimum required permissions
* Follow security best practices
3. **Error Handling**
* Implement proper error checking
* Provide meaningful error messages
* Handle failures gracefully
### Common Patterns[](https://kilocode.ai/docs/features/tools/tool-use-overview#common-patterns "Direct link to Common Patterns")
1. **Information Gathering**
[ask_followup_question](/features/tools/ask-followup-question) → [read_file](/features/tools/read-file) → [search_files](/features/tools/search-files)
2. **Code Modification**
[read_file](/features/tools/read-file) → [apply_diff](/features/tools/apply-diff) → [attempt_completion](/features/tools/attempt-completion)
3. **Task Management**
[new_task](/features/tools/new-task) → [switch_mode](/features/tools/switch-mode) → [execute_command](/features/tools/execute-command)
4. **Progress Tracking**
[update_todo_list](/features/tools/update-todo-list) → [execute_command](/features/tools/execute-command) → [update_todo_list](/features/tools/update-todo-list)
Error Handling and Recovery[](https://kilocode.ai/docs/features/tools/tool-use-overview#error-handling-and-recovery "Direct link to Error Handling and Recovery")
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
### Error Types[](https://kilocode.ai/docs/features/tools/tool-use-overview#error-types "Direct link to Error Types")
1. **Tool-Specific Errors**
* Parameter validation failures
* Execution errors
* Resource access issues
2. **System Errors**
* Permission denied
* Resource unavailable
* Network failures
3. **Context Errors**
* Invalid mode for tool
* Missing requirements
* State inconsistencies
### Recovery Strategies[](https://kilocode.ai/docs/features/tools/tool-use-overview#recovery-strategies "Direct link to Recovery Strategies")
1. **Automatic Recovery**
* Retry mechanisms
* Fallback options
* State restoration
2. **User Intervention**
* Error notifications
* Recovery suggestions
* Manual intervention options
* [Core Concepts](https://kilocode.ai/docs/features/tools/tool-use-overview#core-concepts)
* [Tool Groups](https://kilocode.ai/docs/features/tools/tool-use-overview#tool-groups)
* [Always Available Tools](https://kilocode.ai/docs/features/tools/tool-use-overview#always-available-tools)
* [Available Tools](https://kilocode.ai/docs/features/tools/tool-use-overview#available-tools)
* [Read Tools](https://kilocode.ai/docs/features/tools/tool-use-overview#read-tools)
* [Edit Tools](https://kilocode.ai/docs/features/tools/tool-use-overview#edit-tools)
* [Browser Tools](https://kilocode.ai/docs/features/tools/tool-use-overview#browser-tools)
* [Command Tools](https://kilocode.ai/docs/features/tools/tool-use-overview#command-tools)
* [MCP Tools](https://kilocode.ai/docs/features/tools/tool-use-overview#mcp-tools)
* [Workflow Tools](https://kilocode.ai/docs/features/tools/tool-use-overview#workflow-tools)
* [Tool Calling Mechanism](https://kilocode.ai/docs/features/tools/tool-use-overview#tool-calling-mechanism)
* [When Tools Are Called](https://kilocode.ai/docs/features/tools/tool-use-overview#when-tools-are-called)
* [Decision Process](https://kilocode.ai/docs/features/tools/tool-use-overview#decision-process)
* [Technical Implementation](https://kilocode.ai/docs/features/tools/tool-use-overview#technical-implementation)
* [Tool Call Processing](https://kilocode.ai/docs/features/tools/tool-use-overview#tool-call-processing)
* [Security and Permissions](https://kilocode.ai/docs/features/tools/tool-use-overview#security-and-permissions)
* [Mode Integration](https://kilocode.ai/docs/features/tools/tool-use-overview#mode-integration)
* [Mode-Based Tool Access](https://kilocode.ai/docs/features/tools/tool-use-overview#mode-based-tool-access)
* [Mode Switching](https://kilocode.ai/docs/features/tools/tool-use-overview#mode-switching)
* [Best Practices](https://kilocode.ai/docs/features/tools/tool-use-overview#best-practices)
* [Tool Usage Guidelines](https://kilocode.ai/docs/features/tools/tool-use-overview#tool-usage-guidelines)
* [Common Patterns](https://kilocode.ai/docs/features/tools/tool-use-overview#common-patterns)
* [Error Handling and Recovery](https://kilocode.ai/docs/features/tools/tool-use-overview#error-handling-and-recovery)
* [Error Types](https://kilocode.ai/docs/features/tools/tool-use-overview#error-types)
* [Recovery Strategies](https://kilocode.ai/docs/features/tools/tool-use-overview#recovery-strategies)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Ffeatures%2Ftools%2Ftool-use-overview)
---
# Using DeepSeek With Kilo Code | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/providers/deepseek#__docusaurus_skipToContent_fallback)
On this page
Kilo Code supports accessing models through the DeepSeek API, including `deepseek-chat` and `deepseek-reasoner`.
**Website:** [https://platform.deepseek.com/](https://platform.deepseek.com/)
Getting an API Key[](https://kilocode.ai/docs/providers/deepseek#getting-an-api-key "Direct link to Getting an API Key")
--------------------------------------------------------------------------------------------------------------------------
1. **Sign Up/Sign In:** Go to the [DeepSeek Platform](https://platform.deepseek.com/)
. Create an account or sign in.
2. **Navigate to API Keys:** Find your API keys in the [API keys](https://platform.deepseek.com/api_keys)
section of the platform.
3. **Create a Key:** Click "Create new API key". Give your key a descriptive name (e.g., "Kilo Code").
4. **Copy the Key:** **Important:** Copy the API key _immediately_. You will not be able to see it again. Store it securely.
Supported Models[](https://kilocode.ai/docs/providers/deepseek#supported-models "Direct link to Supported Models")
--------------------------------------------------------------------------------------------------------------------
Kilo Code supports the following DeepSeek models:
* `deepseek-chat` (Recommended for coding tasks)
* `deepseek-reasoner` (Recommended for reasoning tasks)
Configuration in Kilo Code[](https://kilocode.ai/docs/providers/deepseek#configuration-in-kilo-code "Direct link to Configuration in Kilo Code")
--------------------------------------------------------------------------------------------------------------------------------------------------
1. **Open Kilo Code Settings:** Click the gear icon () in the Kilo Code panel.
2. **Select Provider:** Choose "DeepSeek" from the "API Provider" dropdown.
3. **Enter API Key:** Paste your DeepSeek API key into the "DeepSeek API Key" field.
4. **Select Model:** Choose your desired model from the "Model" dropdown.
Tips and Notes[](https://kilocode.ai/docs/providers/deepseek#tips-and-notes "Direct link to Tips and Notes")
--------------------------------------------------------------------------------------------------------------
* **Pricing:** Refer to the [DeepSeek Pricing](https://api-docs.deepseek.com/quick_start/pricing/)
page for details on model costs.
* [Getting an API Key](https://kilocode.ai/docs/providers/deepseek#getting-an-api-key)
* [Supported Models](https://kilocode.ai/docs/providers/deepseek#supported-models)
* [Configuration in Kilo Code](https://kilocode.ai/docs/providers/deepseek#configuration-in-kilo-code)
* [Tips and Notes](https://kilocode.ai/docs/providers/deepseek#tips-and-notes)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fproviders%2Fdeepseek)
---
# Using Anthropic With Kilo Code | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/providers/anthropic#__docusaurus_skipToContent_fallback)
On this page
Anthropic is an AI safety and research company that builds reliable, interpretable, and steerable AI systems. Their Claude models are known for their strong reasoning abilities, helpfulness, and honesty.
**Website:** [https://www.anthropic.com/](https://www.anthropic.com/)
Getting an API Key[](https://kilocode.ai/docs/providers/anthropic#getting-an-api-key "Direct link to Getting an API Key")
---------------------------------------------------------------------------------------------------------------------------
1. **Sign Up/Sign In:** Go to the [Anthropic Console](https://console.anthropic.com/)
. Create an account or sign in.
2. **Navigate to API Keys:** Go to the [API keys](https://console.anthropic.com/settings/keys)
section.
3. **Create a Key:** Click "Create Key". Give your key a descriptive name (e.g., "Kilo Code").
4. **Copy the Key:** **Important:** Copy the API key _immediately_. You will not be able to see it again. Store it securely.
Supported Models[](https://kilocode.ai/docs/providers/anthropic#supported-models "Direct link to Supported Models")
---------------------------------------------------------------------------------------------------------------------
Kilo Code supports the following Anthropic Claude models:
* `claude-3-7-sonnet-20250219` (Recommended)
* `claude-3-7-sonnet-20250219:thinking` (Extended Thinking variant)
* `claude-3-5-sonnet-20241022`
* `claude-3-5-haiku-20241022`
* `claude-3-opus-20240229`
* `claude-3-haiku-20240307`
See [Anthropic's Model Documentation](https://docs.anthropic.com/en/docs/about-claude/models)
for more details on each model's capabilities.
Configuration in Kilo Code[](https://kilocode.ai/docs/providers/anthropic#configuration-in-kilo-code "Direct link to Configuration in Kilo Code")
---------------------------------------------------------------------------------------------------------------------------------------------------
1. **Open Kilo Code Settings:** Click the gear icon () in the Kilo Code panel.
2. **Select Provider:** Choose "Anthropic" from the "API Provider" dropdown.
3. **Enter API Key:** Paste your Anthropic API key into the "Anthropic API Key" field.
4. **Select Model:** Choose your desired Claude model from the "Model" dropdown.
5. **(Optional) Custom Base URL:** If you need to use a custom base URL for the Anthropic API, check "Use custom base URL" and enter the URL. Most people won't need to adjust this.
Tips and Notes[](https://kilocode.ai/docs/providers/anthropic#tips-and-notes "Direct link to Tips and Notes")
---------------------------------------------------------------------------------------------------------------
* **Prompt Caching:** Claude 3 models support [prompt caching](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching)
, which can significantly reduce costs and latency for repeated prompts.
* **Context Window:** Claude models have large context windows (200,000 tokens), allowing you to include a significant amount of code and context in your prompts.
* **Pricing:** Refer to the [Anthropic Pricing](https://www.anthropic.com/pricing)
page for the latest pricing information.
* **Rate Limits:** Anthropic has strict rate limits based on [usage tiers](https://docs.anthropic.com/en/api/rate-limits#requirements-to-advance-tier)
. If you're repeatedly hitting rate limits, consider contacting Anthropic sales or accessing Claude through a different provider like [OpenRouter](https://kilocode.ai/docs/providers/openrouter)
or [Requesty](https://kilocode.ai/docs/providers/requesty)
.
* [Getting an API Key](https://kilocode.ai/docs/providers/anthropic#getting-an-api-key)
* [Supported Models](https://kilocode.ai/docs/providers/anthropic#supported-models)
* [Configuration in Kilo Code](https://kilocode.ai/docs/providers/anthropic#configuration-in-kilo-code)
* [Tips and Notes](https://kilocode.ai/docs/providers/anthropic#tips-and-notes)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fproviders%2Fanthropic)
---
# Using Chutes AI With Kilo Code | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/providers/chutes-ai#__docusaurus_skipToContent_fallback)
On this page
Chutes.ai offers free API access to several large language models (LLMs), allowing developers to integrate and experiment with these models without immediate financial commitment. They provide access to a curated set of open-source and proprietary language models, often with a focus on specific capabilities or regional language support.
**Website:** [https://chutes.ai/](https://chutes.ai/)
Getting an API Key[](https://kilocode.ai/docs/providers/chutes-ai#getting-an-api-key "Direct link to Getting an API Key")
---------------------------------------------------------------------------------------------------------------------------
To use Chutes AI with Kilo Code, obtain an API key from the [Chutes AI platform](https://chutes.ai/)
. After signing up or logging in, you should find an option to generate or retrieve your API key within your account dashboard or settings.
Supported Models[](https://kilocode.ai/docs/providers/chutes-ai#supported-models "Direct link to Supported Models")
---------------------------------------------------------------------------------------------------------------------
Kilo Code will attempt to fetch the list of available models from the Chutes AI API. The specific models available will depend on Chutes AI's current offerings.
Always refer to the official Chutes AI documentation or your dashboard for the most up-to-date list of supported models.
Configuration in Kilo Code[](https://kilocode.ai/docs/providers/chutes-ai#configuration-in-kilo-code "Direct link to Configuration in Kilo Code")
---------------------------------------------------------------------------------------------------------------------------------------------------
1. **Open Kilo Code Settings:** Click the gear icon () in the Kilo Code panel.
2. **Select Provider:** Choose "Chutes AI" from the "API Provider" dropdown.
3. **Enter API Key:** Paste your Chutes AI API key into the "Chutes AI API Key" field.
4. **Select Model:** Choose your desired model from the "Model" dropdown.
Tips and Notes[](https://kilocode.ai/docs/providers/chutes-ai#tips-and-notes "Direct link to Tips and Notes")
---------------------------------------------------------------------------------------------------------------
* **Free Access:** Chutes AI provides free API access, making it an excellent option for experimentation and development without immediate costs.
* **Model Variety:** The platform offers access to both open-source and proprietary models, giving you flexibility in choosing the right model for your needs.
* **Rate Limits:** As with any free service, be aware of potential rate limits or usage restrictions that may apply to your API key.
* [Getting an API Key](https://kilocode.ai/docs/providers/chutes-ai#getting-an-api-key)
* [Supported Models](https://kilocode.ai/docs/providers/chutes-ai#supported-models)
* [Configuration in Kilo Code](https://kilocode.ai/docs/providers/chutes-ai#configuration-in-kilo-code)
* [Tips and Notes](https://kilocode.ai/docs/providers/chutes-ai#tips-and-notes)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fproviders%2Fchutes-ai)
---
# Using LM Studio With Kilo Code | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/providers/lmstudio#__docusaurus_skipToContent_fallback)
On this page
Kilo Code supports running models locally using LM Studio. LM Studio provides a user-friendly interface for downloading, configuring, and running local language models. It also includes a built-in local inference server that emulates the OpenAI API, making it easy to integrate with Kilo Code.
**Website:** [https://lmstudio.ai/](https://lmstudio.ai/)
Setting Up LM Studio[](https://kilocode.ai/docs/providers/lmstudio#setting-up-lm-studio "Direct link to Setting Up LM Studio")
--------------------------------------------------------------------------------------------------------------------------------
1. **Download and Install LM Studio:** Download LM Studio from the [LM Studio website](https://lmstudio.ai/)
.
2. **Download a Model:** Use the LM Studio interface to search for and download a model. Some recommended models include:
* CodeLlama models (e.g., `codellama:7b-code`, `codellama:13b-code`, `codellama:34b-code`)
* Mistral models (e.g., `mistralai/Mistral-7B-Instruct-v0.1`)
* DeepSeek Coder models (e.g., `deepseek-coder:6.7b-base`)
* Any other model that is supported by Kilo Code, or for which you can set the context window.
Look for models in the GGUF format. LM Studio provides a search interface to find and download models.
3. **Start the Local Server:**
* Open LM Studio.
* Click the **"Local Server"** tab (the icon looks like `<->`).
* Select the model you downloaded.
* Click **"Start Server"**.
Configuration in Kilo Code[](https://kilocode.ai/docs/providers/lmstudio#configuration-in-kilo-code "Direct link to Configuration in Kilo Code")
--------------------------------------------------------------------------------------------------------------------------------------------------
1. **Open Kilo Code Settings:** Click the gear icon () in the Kilo Code panel.
2. **Select Provider:** Choose "LM Studio" from the "API Provider" dropdown.
3. **Enter Model ID:** Enter the _file name_ of the model you loaded in LM Studio (e.g., `codellama-7b.Q4_0.gguf`). You can find this in the LM Studio "Local Server" tab.
4. **(Optional) Base URL:** By default, Kilo Code will connect to LM Studio at `http://localhost:1234`. If you've configured LM Studio to use a different address or port, enter the full URL here.
Tips and Notes[](https://kilocode.ai/docs/providers/lmstudio#tips-and-notes "Direct link to Tips and Notes")
--------------------------------------------------------------------------------------------------------------
* **Resource Requirements:** Running large language models locally can be resource-intensive. Make sure your computer meets the minimum requirements for the model you choose.
* **Model Selection:** LM Studio provides a wide range of models. Experiment to find the one that best suits your needs.
* **Local Server:** The LM Studio local server must be running for Kilo Code to connect to it.
* **LM Studio Documentation:** Refer to the [LM Studio documentation](https://lmstudio.ai/docs)
for more information.
* **Troubleshooting:** If you see a "Please check the LM Studio developer logs to debug what went wrong" error, you may need to adjust the context length settings in LM Studio.
* [Setting Up LM Studio](https://kilocode.ai/docs/providers/lmstudio#setting-up-lm-studio)
* [Configuration in Kilo Code](https://kilocode.ai/docs/providers/lmstudio#configuration-in-kilo-code)
* [Tips and Notes](https://kilocode.ai/docs/providers/lmstudio#tips-and-notes)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fproviders%2Flmstudio)
---
# Using Glama With Kilo Code | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/providers/glama#__docusaurus_skipToContent_fallback)
On this page
Glama provides access to a variety of language models through a unified API, including models from Anthropic, OpenAI, and others. It offers features like prompt caching and cost tracking.
**Website:** [https://glama.ai/](https://glama.ai/)
Getting an API Key[](https://kilocode.ai/docs/providers/glama#getting-an-api-key "Direct link to Getting an API Key")
-----------------------------------------------------------------------------------------------------------------------
1. **Sign Up/Sign In:** Go to the [Glama sign-up page](https://glama.ai/sign-up)
. Sign up using your Google account or name/email/password.
2. **Get API Key:** After signing up, navigate to the [API Keys](https://glama.ai/settings/gateway/api-keys)
page to get an API key.
3. **Copy the Key:** Copy the displayed API key.
Supported Models[](https://kilocode.ai/docs/providers/glama#supported-models "Direct link to Supported Models")
-----------------------------------------------------------------------------------------------------------------
Kilo Code will automatically try to fetch a list of available models from the Glama API. Some models that are commonly available through Glama include:
* **Anthropic Claude models:** (e.g., `anthropic/claude-3-5-sonnet`) These are generally recommended for best performance with Kilo Code.
* **OpenAI models:** (e.g., `openai/o3-mini-high`)
* **Other providers and open-source models**
Refer to the [Glama documentation](https://glama.ai/models)
for the most up-to-date list of supported models.
Configuration in Kilo Code[](https://kilocode.ai/docs/providers/glama#configuration-in-kilo-code "Direct link to Configuration in Kilo Code")
-----------------------------------------------------------------------------------------------------------------------------------------------
1. **Open Kilo Code Settings:** Click the gear icon () in the Kilo Code panel.
2. **Select Provider:** Choose "Glama" from the "API Provider" dropdown.
3. **Enter API Key:** Paste your Glama API key into the "Glama API Key" field.
4. **Select Model:** Choose your desired model from the "Model" dropdown.
Tips and Notes[](https://kilocode.ai/docs/providers/glama#tips-and-notes "Direct link to Tips and Notes")
-----------------------------------------------------------------------------------------------------------
* **Pricing:** Glama operates on a pay-per-use basis. Pricing varies depending on the model you choose.
* **Prompt Caching:** Glama supports prompt caching, which can significantly reduce costs and improve performance for repeated prompts.
* [Getting an API Key](https://kilocode.ai/docs/providers/glama#getting-an-api-key)
* [Supported Models](https://kilocode.ai/docs/providers/glama#supported-models)
* [Configuration in Kilo Code](https://kilocode.ai/docs/providers/glama#configuration-in-kilo-code)
* [Tips and Notes](https://kilocode.ai/docs/providers/glama#tips-and-notes)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fproviders%2Fglama)
---
# Human Relay Provider | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/providers/human-relay#__docusaurus_skipToContent_fallback)
On this page
The Human Relay provider allows you to use Kilo Code with web-based AI models like ChatGPT or Claude without needing an API key. Instead, it relies on you to manually relay messages between Kilo Code and the AI's web interface.
How it Works[](https://kilocode.ai/docs/providers/human-relay#how-it-works "Direct link to How it Works")
-----------------------------------------------------------------------------------------------------------
1. **Select Human Relay**: Choose "Human Relay" as your API provider in Kilo Code's settings. No API key is required.
2. **Initiate a Request**: Start a chat or task with Kilo Code as usual.
3. **Dialog Prompt**: A dialog box will appear in VS Code. Your message to the AI is automatically copied to your clipboard.
4. **Paste to Web AI**: Go to the web interface of your chosen AI (e.g., chat.openai.com, claude.ai) and paste the message from your clipboard into the chat input.
5. **Copy AI Response**: Once the AI responds, copy its complete response text.
6. **Paste Back to Kilo Code**: Return to the dialog box in VS Code, paste the AI's response into the designated field, and click "Confirm".
7. **Continue**: Kilo Code will process the response as if it came directly from an API.
Use Cases[](https://kilocode.ai/docs/providers/human-relay#use-cases "Direct link to Use Cases")
--------------------------------------------------------------------------------------------------
This provider is useful if:
* You want to use models that don't offer direct API access.
* You prefer not to manage API keys.
* You need to leverage the specific capabilities or context available only in the web UI of certain AI models.
Limitations[](https://kilocode.ai/docs/providers/human-relay#limitations "Direct link to Limitations")
--------------------------------------------------------------------------------------------------------
* **Manual Effort**: Requires constant copy-pasting between VS Code and your browser.
* **Slower Interaction**: The back-and-forth process is significantly slower than direct API integration.
* **Potential for Errors**: Manual copying and pasting can introduce errors or omissions.
Choose this provider when the benefits of using a specific web AI outweigh the inconvenience of the manual relay process.
* [How it Works](https://kilocode.ai/docs/providers/human-relay#how-it-works)
* [Use Cases](https://kilocode.ai/docs/providers/human-relay#use-cases)
* [Limitations](https://kilocode.ai/docs/providers/human-relay#limitations)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fproviders%2Fhuman-relay)
---
# Using AWS Bedrock With Kilo Code | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/providers/bedrock#__docusaurus_skipToContent_fallback)
On this page
Kilo Code supports accessing models through Amazon Bedrock, a fully managed service that makes a selection of high-performing foundation models (FMs) from leading AI companies available via a single API.
**Website:** [https://aws.amazon.com/bedrock/](https://aws.amazon.com/bedrock/)
Prerequisites[](https://kilocode.ai/docs/providers/bedrock#prerequisites "Direct link to Prerequisites")
----------------------------------------------------------------------------------------------------------
* **AWS Account:** You need an active AWS account.
* **Bedrock Access:** You must request and be granted access to Amazon Bedrock. See the [AWS Bedrock documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/getting-started.html)
for details on requesting access.
* **Model Access:** Within Bedrock, you need to request access to the specific models you want to use (e.g., Anthropic Claude).
* **Install AWS CLI:** Use AWS CLI to configure your account for authentication
aws configure
Getting Credentials[](https://kilocode.ai/docs/providers/bedrock#getting-credentials "Direct link to Getting Credentials")
----------------------------------------------------------------------------------------------------------------------------
You have two main options for configuring AWS credentials:
1. **AWS Access Keys (Recommended for Development):**
* Create an IAM user with the necessary permissions (at least `bedrock:InvokeModel`).
* Generate an access key ID and secret access key for that user.
* _(Optional)_ Create a session token if required by your IAM configuration.
2. **AWS Profile:**
* Configure an AWS profile using the AWS CLI or by manually editing your AWS credentials file. See the [AWS CLI documentation](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html)
for details.
Supported Models[](https://kilocode.ai/docs/providers/bedrock#supported-models "Direct link to Supported Models")
-------------------------------------------------------------------------------------------------------------------
Kilo Code supports the following models through Bedrock (based on source code):
* **Amazon:**
* `amazon.nova-pro-v1:0`
* `amazon.nova-pro-latency-optimized-v1:0`
* `amazon.nova-lite-v1:0`
* `amazon.nova-micro-v1:0`
* `amazon.titan-text-lite-v1:0`
* `amazon.titan-text-express-v1:0`
* `amazon.titan-text-embeddings-v1:0`
* `amazon.titan-text-embeddings-v2:0`
* **Anthropic:**
* `anthropic.claude-3-7-sonnet-20250219-v1:0`
* `anthropic.claude-3-5-sonnet-20241022-v2:0`
* `anthropic.claude-3-5-haiku-20241022-v1:0`
* `anthropic.claude-3-5-sonnet-20240620-v1:0`
* `anthropic.claude-3-opus-20240229-v1:0`
* `anthropic.claude-3-sonnet-20240229-v1:0`
* `anthropic.claude-3-haiku-20240307-v1:0`
* `anthropic.claude-2-1-v1:0`
* `anthropic.claude-2-0-v1:0`
* `anthropic.claude-instant-v1:0`
* **DeepSeek:**
* `deepseek.r1-v1:0`
* **Meta:**
* `meta.llama3-3-70b-instruct-v1:0`
* `meta.llama3-2-90b-instruct-v1:0`
* `meta.llama3-2-11b-instruct-v1:0`
* `meta.llama3-2-3b-instruct-v1:0`
* `meta.llama3-2-1b-instruct-v1:0`
* `meta.llama3-1-405b-instruct-v1:0`
* `meta.llama3-1-70b-instruct-v1:0`
* `meta.llama3-1-70b-instruct-latency-optimized-v1:0`
* `meta.llama3-1-8b-instruct-v1:0`
* `meta.llama3-70b-instruct-v1:0`
* `meta.llama3-8b-instruct-v1:0`
Refer to the [Amazon Bedrock documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/models-supported.html)
for the most up-to-date list of available models and their IDs. Make sure to use the _model ID_ when configuring Kilo Code, not the model name.
Configuration in Kilo Code[](https://kilocode.ai/docs/providers/bedrock#configuration-in-kilo-code "Direct link to Configuration in Kilo Code")
-------------------------------------------------------------------------------------------------------------------------------------------------
1. **Open Kilo Code Settings:** Click the gear icon () in the Kilo Code panel.
2. **Select Provider:** Choose "Bedrock" from the "API Provider" dropdown.
3. **Select Authentication Method:**
* **AWS Credentials:**
* Enter your "AWS Access Key" and "AWS Secret Key."
* (Optional) Enter your "AWS Session Token" if you're using temporary credentials.
* **AWS Profile:**
* Enter your "AWS Profile" name (e.g., "default").
4. **Select Region:** Choose the AWS region where your Bedrock service is available (e.g., "us-east-1").
5. **(Optional) Cross-Region Inference:** Check "Use cross-region inference" if you want to access models in a region different from your configured AWS region.
6. **Select Model:** Choose your desired model from the "Model" dropdown.
Tips and Notes[](https://kilocode.ai/docs/providers/bedrock#tips-and-notes "Direct link to Tips and Notes")
-------------------------------------------------------------------------------------------------------------
* **Permissions:** Ensure your IAM user or role has the necessary permissions to invoke Bedrock models. The `bedrock:InvokeModel` permission is required.
* **Pricing:** Refer to the [Amazon Bedrock pricing](https://aws.amazon.com/bedrock/pricing/)
page for details on model costs.
* **Cross-Region Inference:** Using cross-region inference may result in higher latency.
* [Prerequisites](https://kilocode.ai/docs/providers/bedrock#prerequisites)
* [Getting Credentials](https://kilocode.ai/docs/providers/bedrock#getting-credentials)
* [Supported Models](https://kilocode.ai/docs/providers/bedrock#supported-models)
* [Configuration in Kilo Code](https://kilocode.ai/docs/providers/bedrock#configuration-in-kilo-code)
* [Tips and Notes](https://kilocode.ai/docs/providers/bedrock#tips-and-notes)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fproviders%2Fbedrock)
---
# Using Groq With Kilo Code | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/providers/groq#__docusaurus_skipToContent_fallback)
On this page
Groq provides ultra-fast inference for various AI models through their high-performance infrastructure. Kilo Code supports accessing models through the Groq API.
**Website:** [https://groq.com/](https://groq.com/)
Getting an API Key[](https://kilocode.ai/docs/providers/groq#getting-an-api-key "Direct link to Getting an API Key")
----------------------------------------------------------------------------------------------------------------------
To use Groq with Kilo Code, you'll need an API key from the [GroqCloud Console](https://console.groq.com/)
. After signing up or logging in, navigate to the API Keys section of your dashboard to create and copy your key.
Supported Models[](https://kilocode.ai/docs/providers/groq#supported-models "Direct link to Supported Models")
----------------------------------------------------------------------------------------------------------------
Kilo Code will attempt to fetch the list of available models from the Groq API. Common models available via Groq include:
* `llama3-8b-8192`
* `llama3-70b-8192`
* `mixtral-8x7b-32768`
* `gemma-7b-it`
* `moonshotai/kimi-k2-instruct` (Kimi K2 model)
**Note:** Model availability and specifications may change. Refer to the [Groq Documentation](https://console.groq.com/docs/models)
for the most up-to-date list of supported models and their capabilities.
Configuration in Kilo Code[](https://kilocode.ai/docs/providers/groq#configuration-in-kilo-code "Direct link to Configuration in Kilo Code")
----------------------------------------------------------------------------------------------------------------------------------------------
1. **Open Kilo Code Settings:** Click the gear icon () in the Kilo Code panel.
2. **Select Provider:** Choose "Groq" from the "API Provider" dropdown.
3. **Enter API Key:** Paste your Groq API key into the "Groq API Key" field.
4. **Select Model:** Choose your desired model from the "Model" dropdown.
Tips and Notes[](https://kilocode.ai/docs/providers/groq#tips-and-notes "Direct link to Tips and Notes")
----------------------------------------------------------------------------------------------------------
* **High-Speed Inference:** Groq's LPUs provide exceptionally fast response times, making it ideal for interactive development workflows.
* **Token Limits:** Some models have specific `max_tokens` limits that are automatically handled by Kilo Code (e.g., the `moonshotai/kimi-k2-instruct` model).
* **Cost Efficiency:** Groq often provides competitive pricing for high-speed inference compared to other providers.
* **Model Selection:** Choose models based on your specific needs - larger models like `llama3-70b-8192` for complex reasoning tasks, or smaller models like `llama3-8b-8192` for faster, simpler operations.
Supported Models[](https://kilocode.ai/docs/providers/groq#supported-models-1 "Direct link to Supported Models")
------------------------------------------------------------------------------------------------------------------
Kilo Code supports the following models through Groq:
| Model ID | Provider | Context Window | Notes |
| --- | --- | --- | --- |
| `moonshotai/kimi-k2-instruct` | Moonshot AI | 128K tokens | Optimized max\_tokens limit configured |
| `llama-3.3-70b-versatile` | Meta | 128K tokens | High-performance Llama model |
| `llama-3.1-70b-versatile` | Meta | 128K tokens | Versatile reasoning capabilities |
| `llama-3.1-8b-instant` | Meta | 128K tokens | Fast inference for quick tasks |
| `mixtral-8x7b-32768` | Mistral AI | 32K tokens | Mixture of experts architecture |
**Note:** Model availability may change. Refer to the [Groq documentation](https://console.groq.com/docs/models)
for the latest model list and specifications.
Configuration in Kilo Code[](https://kilocode.ai/docs/providers/groq#configuration-in-kilo-code-1 "Direct link to Configuration in Kilo Code")
------------------------------------------------------------------------------------------------------------------------------------------------
1. **Open Kilo Code Settings:** Click the gear icon () in the Kilo Code panel.
2. **Select Provider:** Choose "Groq" from the "API Provider" dropdown.
3. **Enter API Key:** Paste your Groq API key into the "Groq API Key" field.
4. **Select Model:** Choose your desired model from the "Model" dropdown.
Model-Specific Features[](https://kilocode.ai/docs/providers/groq#model-specific-features "Direct link to Model-Specific Features")
-------------------------------------------------------------------------------------------------------------------------------------
### Kimi K2 Model[](https://kilocode.ai/docs/providers/groq#kimi-k2-model "Direct link to Kimi K2 Model")
The `moonshotai/kimi-k2-instruct` model includes optimized configuration:
* **Max Tokens Limit:** Automatically configured with appropriate limits for optimal performance
* **Context Understanding:** Excellent for complex reasoning and long-context tasks
* **Multilingual Support:** Strong performance across multiple languages
Tips and Notes[](https://kilocode.ai/docs/providers/groq#tips-and-notes-1 "Direct link to Tips and Notes")
------------------------------------------------------------------------------------------------------------
* **Ultra-Fast Inference:** Groq's hardware acceleration provides exceptionally fast response times
* **Cost-Effective:** Competitive pricing for high-performance inference
* **Rate Limits:** Be aware of API rate limits based on your Groq plan
* **Model Selection:** Choose models based on your specific use case:
* **Kimi K2**: Best for complex reasoning and multilingual tasks
* **Llama 3.3 70B**: Excellent general-purpose performance
* **Llama 3.1 8B Instant**: Fastest responses for simple tasks
* **Mixtral**: Good balance of performance and efficiency
Troubleshooting[](https://kilocode.ai/docs/providers/groq#troubleshooting "Direct link to Troubleshooting")
-------------------------------------------------------------------------------------------------------------
* **"Invalid API Key":** Verify your API key is correct and active in the Groq Console
* **"Model Not Available":** Check if the selected model is available in your region
* **Rate Limit Errors:** Monitor your usage in the Groq Console and consider upgrading your plan
* **Connection Issues:** Ensure you have a stable internet connection and Groq services are operational
Pricing[](https://kilocode.ai/docs/providers/groq#pricing "Direct link to Pricing")
-------------------------------------------------------------------------------------
Groq offers competitive pricing based on input and output tokens. Visit the [Groq pricing page](https://groq.com/pricing/)
for current rates and plan options.
* [Getting an API Key](https://kilocode.ai/docs/providers/groq#getting-an-api-key)
* [Supported Models](https://kilocode.ai/docs/providers/groq#supported-models)
* [Configuration in Kilo Code](https://kilocode.ai/docs/providers/groq#configuration-in-kilo-code)
* [Tips and Notes](https://kilocode.ai/docs/providers/groq#tips-and-notes)
* [Supported Models](https://kilocode.ai/docs/providers/groq#supported-models-1)
* [Configuration in Kilo Code](https://kilocode.ai/docs/providers/groq#configuration-in-kilo-code-1)
* [Model-Specific Features](https://kilocode.ai/docs/providers/groq#model-specific-features)
* [Kimi K2 Model](https://kilocode.ai/docs/providers/groq#kimi-k2-model)
* [Tips and Notes](https://kilocode.ai/docs/providers/groq#tips-and-notes-1)
* [Troubleshooting](https://kilocode.ai/docs/providers/groq#troubleshooting)
* [Pricing](https://kilocode.ai/docs/providers/groq#pricing)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fproviders%2Fgroq)
---
# Using Google Gemini With Kilo Code | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/providers/gemini#__docusaurus_skipToContent_fallback)
On this page
Kilo Code supports Google's Gemini family of models through the Google AI Gemini API.
**Website:** [https://ai.google.dev/](https://ai.google.dev/)
Getting an API Key[](https://kilocode.ai/docs/providers/gemini#getting-an-api-key "Direct link to Getting an API Key")
------------------------------------------------------------------------------------------------------------------------
1. **Go to Google AI Studio:** Navigate to [https://ai.google.dev/](https://ai.google.dev/)
.
2. **Sign In:** Sign in with your Google account.
3. **Create API Key:** Click on "Create API key" in the left-hand menu.
4. **Copy API Key:** Copy the generated API key.
Supported Models[](https://kilocode.ai/docs/providers/gemini#supported-models "Direct link to Supported Models")
------------------------------------------------------------------------------------------------------------------
Kilo Code supports the following Gemini models:
### Chat Models[](https://kilocode.ai/docs/providers/gemini#chat-models "Direct link to Chat Models")
* `gemini-2.5-pro-exp-03-25`
* `gemini-2.0-flash-001`
* `gemini-2.0-flash-lite-preview-02-05`
* `gemini-2.0-pro-exp-02-05`
* `gemini-2.0-flash-thinking-exp-01-21`
* `gemini-2.0-flash-thinking-exp-1219`
* `gemini-2.0-flash-exp`
* `gemini-1.5-flash-002`
* `gemini-1.5-flash-exp-0827`
* `gemini-1.5-flash-8b-exp-0827`
* `gemini-1.5-pro-002`
* `gemini-1.5-pro-exp-0827`
* `gemini-exp-1206`
### Embedding Models[](https://kilocode.ai/docs/providers/gemini#embedding-models "Direct link to Embedding Models")
* `gemini-embedding-001` - Optimized for codebase indexing and semantic search
Refer to the [Gemini documentation](https://ai.google.dev/models/gemini)
for more details on each model.
Configuration in Kilo Code[](https://kilocode.ai/docs/providers/gemini#configuration-in-kilo-code "Direct link to Configuration in Kilo Code")
------------------------------------------------------------------------------------------------------------------------------------------------
1. **Open Kilo Code Settings:** Click the gear icon () in the Kilo Code panel.
2. **Select Provider:** Choose "Google Gemini" from the "API Provider" dropdown.
3. **Enter API Key:** Paste your Gemini API key into the "Gemini API Key" field.
4. **Select Model:** Choose your desired Gemini model from the "Model" dropdown.
Tips and Notes[](https://kilocode.ai/docs/providers/gemini#tips-and-notes "Direct link to Tips and Notes")
------------------------------------------------------------------------------------------------------------
* **Pricing:** Gemini API usage is priced based on input and output tokens. Refer to the [Gemini pricing page](https://ai.google.dev/pricing)
for detailed information.
* **Codebase Indexing:** The `gemini-embedding-001` model is specifically supported for [codebase indexing](https://kilocode.ai/docs/features/codebase-indexing)
, providing high-quality embeddings for semantic code search.
* [Getting an API Key](https://kilocode.ai/docs/providers/gemini#getting-an-api-key)
* [Supported Models](https://kilocode.ai/docs/providers/gemini#supported-models)
* [Chat Models](https://kilocode.ai/docs/providers/gemini#chat-models)
* [Embedding Models](https://kilocode.ai/docs/providers/gemini#embedding-models)
* [Configuration in Kilo Code](https://kilocode.ai/docs/providers/gemini#configuration-in-kilo-code)
* [Tips and Notes](https://kilocode.ai/docs/providers/gemini#tips-and-notes)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fproviders%2Fgemini)
---
# Using Kilo Code's API Provider | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/providers/kilocode#__docusaurus_skipToContent_fallback)
On this page
warning
This documentation is currently aimed at only Anthropic and Claude Sonnet 3.7 and doesn't reflect the simplicity of using Kilo Code as a provider - it simply a place holder
Anthropic is an AI safety and research company that builds reliable, interpretable, and steerable AI systems. Their Claude models are known for their strong reasoning abilities, helpfulness, and honesty.
**Website:** [https://www.anthropic.com/](https://www.anthropic.com/)
Getting an API Key[](https://kilocode.ai/docs/providers/kilocode#getting-an-api-key "Direct link to Getting an API Key")
--------------------------------------------------------------------------------------------------------------------------
1. **Sign Up/Sign In:** Go to the [Anthropic Console](https://console.anthropic.com/)
. Create an account or sign in.
2. **Navigate to API Keys:** Go to the [API keys](https://console.anthropic.com/settings/keys)
section.
3. **Create a Key:** Click "Create Key". Give your key a descriptive name (e.g., "Kilo Code").
4. **Copy the Key:** **Important:** Copy the API key _immediately_. You will not be able to see it again. Store it securely.
Supported Models[](https://kilocode.ai/docs/providers/kilocode#supported-models "Direct link to Supported Models")
--------------------------------------------------------------------------------------------------------------------
Kilo Code supports the following Anthropic Claude models:
* `claude-3-7-sonnet-20250219`
See [Anthropic's Model Documentation](https://docs.anthropic.com/en/docs/about-claude/models)
for more details on each model's capabilities.
Configuration in Kilo Code[](https://kilocode.ai/docs/providers/kilocode#configuration-in-kilo-code "Direct link to Configuration in Kilo Code")
--------------------------------------------------------------------------------------------------------------------------------------------------
1. **Open Kilo Code Settings:** Click the gear icon () in the Kilo Code panel.
2. **Select Provider:** Choose "Anthropic" from the "API Provider" dropdown.
3. **Enter API Key:** Paste your Anthropic API key into the "Anthropic API Key" field.
4. **Select Model:** Choose your desired Claude model from the "Model" dropdown.
5. **(Optional) Custom Base URL:** If you need to use a custom base URL for the Anthropic API, check "Use custom base URL" and enter the URL. Most people won't need to adjust this.
Tips and Notes[](https://kilocode.ai/docs/providers/kilocode#tips-and-notes "Direct link to Tips and Notes")
--------------------------------------------------------------------------------------------------------------
* **Prompt Caching:** Claude 3 models support [prompt caching](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching)
, which can significantly reduce costs and latency for repeated prompts.
* **Context Window:** Claude models have large context windows (200,000 tokens), allowing you to include a significant amount of code and context in your prompts.
* **Pricing:** Refer to the [Anthropic Pricing](https://www.anthropic.com/pricing)
page for the latest pricing information.
* **Rate Limits:** Anthropic has strict rate limits based on [usage tiers](https://docs.anthropic.com/en/api/rate-limits#requirements-to-advance-tier)
. If you're repeatedly hitting rate limits, consider contacting Anthropic sales or accessing Claude through a different provider like [OpenRouter](https://kilocode.ai/docs/providers/openrouter)
or [Requesty](https://kilocode.ai/docs/providers/requesty)
.
* [Getting an API Key](https://kilocode.ai/docs/providers/kilocode#getting-an-api-key)
* [Supported Models](https://kilocode.ai/docs/providers/kilocode#supported-models)
* [Configuration in Kilo Code](https://kilocode.ai/docs/providers/kilocode#configuration-in-kilo-code)
* [Tips and Notes](https://kilocode.ai/docs/providers/kilocode#tips-and-notes)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fproviders%2Fkilocode)
---
# Using Claude Code With Kilo Code | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/providers/claude-code#__docusaurus_skipToContent_fallback)
On this page
Claude Code is Anthropic's official CLI that provides direct access to Claude models from your terminal. Using Claude Code with Kilo Code lets you leverage your existing CLI setup without needing separate API keys.
**Website:** [https://docs.anthropic.com/en/docs/claude-code/setup](https://docs.anthropic.com/en/docs/claude-code/setup)
Installing and Setting Up Claude Code[](https://kilocode.ai/docs/providers/claude-code#installing-and-setting-up-claude-code "Direct link to Installing and Setting Up Claude Code")
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1. **Install Claude Code:** Follow the installation instructions at [Anthropic's Claude Code documentation](https://docs.anthropic.com/en/docs/claude-code/setup)
.
2. **Authenticate:** Run `claude` in your terminal. Claude Code offers multiple authentication options including the Anthropic Console (default), Claude App with Pro/Max plans, and enterprise platforms like Amazon Bedrock or Google Vertex AI. See [Anthropic's authentication documentation](https://docs.anthropic.com/en/docs/claude-code/setup)
for complete details.
3. **Verify Installation:** Test that everything works by running `claude --version` in your terminal.
Supported Models[](https://kilocode.ai/docs/providers/claude-code#supported-models "Direct link to Supported Models")
-----------------------------------------------------------------------------------------------------------------------
Kilo Code supports the following Claude models through Claude Code:
* `claude-sonnet-4` (Recommended)
* `claude-4-opus`
The specific models available depend on your Claude subscription and plan. See [Anthropic's Model Documentation](https://docs.anthropic.com/en/docs/about-claude/models)
for more details on each model's capabilities.
Configuration in Kilo Code[](https://kilocode.ai/docs/providers/claude-code#configuration-in-kilo-code "Direct link to Configuration in Kilo Code")
-----------------------------------------------------------------------------------------------------------------------------------------------------
1. **Open Kilo Code Settings:** Click the gear icon () in the Kilo Code panel.
2. **Select Provider:** Choose "Claude Code" from the "API Provider" dropdown.
3. **Select Model:** Choose your desired Claude model from the "Model" dropdown.
4. **(Optional) Custom CLI Path:** If you installed Claude Code to a location other than the default `claude` command, enter the full path to your Claude executable in the "Claude Code Path" field. Most users won't need to change this.
Tips and Notes[](https://kilocode.ai/docs/providers/claude-code#tips-and-notes "Direct link to Tips and Notes")
-----------------------------------------------------------------------------------------------------------------
* **No API Keys Required:** Claude Code uses your existing CLI authentication, so you don't need to manage separate API keys.
* **Cost Transparency:** Usage costs are reported directly by the Claude CLI, giving you clear visibility into your spending.
* **Advanced Reasoning:** Full support for Claude's thinking modes and reasoning capabilities when available.
* **Context Windows:** Claude models have large context windows, allowing you to include significant amounts of code and context in your prompts.
* **Enhance Prompt Feature:** Full compatibility with Kilo Code's Enhance Prompt feature, allowing you to automatically improve and refine your prompts before sending them to Claude.
* **Custom Paths:** If you installed Claude Code in a non-standard location, you can specify the full path in the settings. Examples:
* Windows: `C:\tools\claude\claude.exe`
* macOS/Linux: `/usr/local/bin/claude` or `~/bin/claude`
Troubleshooting[](https://kilocode.ai/docs/providers/claude-code#troubleshooting "Direct link to Troubleshooting")
--------------------------------------------------------------------------------------------------------------------
* **"Claude Code process exited with error":** Verify Claude Code is installed (`claude --version`) and authenticated (`claude auth login`). Make sure your subscription includes the selected model.
* **Custom path not working:** Use the full absolute path to the Claude executable and verify the file exists and is executable. On Windows, include the `.exe` extension.
* [Installing and Setting Up Claude Code](https://kilocode.ai/docs/providers/claude-code#installing-and-setting-up-claude-code)
* [Supported Models](https://kilocode.ai/docs/providers/claude-code#supported-models)
* [Configuration in Kilo Code](https://kilocode.ai/docs/providers/claude-code#configuration-in-kilo-code)
* [Tips and Notes](https://kilocode.ai/docs/providers/claude-code#tips-and-notes)
* [Troubleshooting](https://kilocode.ai/docs/providers/claude-code#troubleshooting)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fproviders%2Fclaude-code)
---
# Using OpenRouter With Kilo Code | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/providers/openrouter#__docusaurus_skipToContent_fallback)
On this page
OpenRouter is an AI platform that provides access to a wide variety of language models from different providers, all through a single API. This can simplify setup and allow you to easily experiment with different models.
**Website:** [https://openrouter.ai/](https://openrouter.ai/)
Getting an API Key[](https://kilocode.ai/docs/providers/openrouter#getting-an-api-key "Direct link to Getting an API Key")
----------------------------------------------------------------------------------------------------------------------------
1. **Sign Up/Sign In:** Go to the [OpenRouter website](https://openrouter.ai/)
. Sign in with your Google or GitHub account.
2. **Get an API Key:** Go to the [keys page](https://openrouter.ai/keys)
. You should see an API key listed. If not, create a new key.
3. **Copy the Key:** Copy the API key.
Supported Models[](https://kilocode.ai/docs/providers/openrouter#supported-models "Direct link to Supported Models")
----------------------------------------------------------------------------------------------------------------------
OpenRouter supports a large and growing number of models. Kilo Code automatically fetches the list of available models. Refer to the [OpenRouter Models page](https://openrouter.ai/models)
for the complete and up-to-date list.
Configuration in Kilo Code[](https://kilocode.ai/docs/providers/openrouter#configuration-in-kilo-code "Direct link to Configuration in Kilo Code")
----------------------------------------------------------------------------------------------------------------------------------------------------
1. **Open Kilo Code Settings:** Click the gear icon () in the Kilo Code panel.
2. **Select Provider:** Choose "OpenRouter" from the "API Provider" dropdown.
3. **Enter API Key:** Paste your OpenRouter API key into the "OpenRouter API Key" field.
4. **Select Model:** Choose your desired model from the "Model" dropdown.
5. **(Optional) Custom Base URL:** If you need to use a custom base URL for the OpenRouter API, check "Use custom base URL" and enter the URL. Leave this blank for most users.
Supported Transforms[](https://kilocode.ai/docs/providers/openrouter#supported-transforms "Direct link to Supported Transforms")
----------------------------------------------------------------------------------------------------------------------------------
OpenRouter provides an [optional "middle-out" message transform](https://openrouter.ai/docs/features/message-transforms)
to help with prompts that exceed the maximum context size of a model. You can enable it by checking the "Compress prompts and message chains to the context size" box.
Tips and Notes[](https://kilocode.ai/docs/providers/openrouter#tips-and-notes "Direct link to Tips and Notes")
----------------------------------------------------------------------------------------------------------------
* **Model Selection:** OpenRouter offers a wide range of models. Experiment to find the best one for your needs.
* **Pricing:** OpenRouter charges based on the underlying model's pricing. See the [OpenRouter Models page](https://openrouter.ai/models)
for details.
* **Prompt Caching:** Some providers support prompt caching. See the OpenRouter documentation for supported models.
* [Getting an API Key](https://kilocode.ai/docs/providers/openrouter#getting-an-api-key)
* [Supported Models](https://kilocode.ai/docs/providers/openrouter#supported-models)
* [Configuration in Kilo Code](https://kilocode.ai/docs/providers/openrouter#configuration-in-kilo-code)
* [Supported Transforms](https://kilocode.ai/docs/providers/openrouter#supported-transforms)
* [Tips and Notes](https://kilocode.ai/docs/providers/openrouter#tips-and-notes)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fproviders%2Fopenrouter)
---
# Using OpenAI With Kilo Code | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/providers/openai#__docusaurus_skipToContent_fallback)
On this page
Kilo Code supports accessing models directly through the official OpenAI API.
**Website:** [https://openai.com/](https://openai.com/)
Getting an API Key[](https://kilocode.ai/docs/providers/openai#getting-an-api-key "Direct link to Getting an API Key")
------------------------------------------------------------------------------------------------------------------------
1. **Sign Up/Sign In:** Go to the [OpenAI Platform](https://platform.openai.com/)
. Create an account or sign in.
2. **Navigate to API Keys:** Go to the [API keys](https://platform.openai.com/api-keys)
page.
3. **Create a Key:** Click "Create new secret key". Give your key a descriptive name (e.g., "Kilo Code").
4. **Copy the Key:** **Important:** Copy the API key _immediately_. You will not be able to see it again. Store it securely.
Supported Models[](https://kilocode.ai/docs/providers/openai#supported-models "Direct link to Supported Models")
------------------------------------------------------------------------------------------------------------------
Kilo Code supports a variety of OpenAI models, including:
* `o3-mini` (medium reasoning effort)
* `o3-mini-high` (high reasoning effort)
* `o3-mini-low` (low reasoning effort)
* `o1`
* `o1-preview`
* `o1-mini`
* `gpt-4.5-preview`
* `gpt-4o`
* `gpt-4o-mini`
Refer to the [OpenAI Models documentation](https://platform.openai.com/docs/models)
for the most up-to-date list of models and capabilities.
Configuration in Kilo Code[](https://kilocode.ai/docs/providers/openai#configuration-in-kilo-code "Direct link to Configuration in Kilo Code")
------------------------------------------------------------------------------------------------------------------------------------------------
1. **Open Kilo Code Settings:** Click the gear icon () in the Kilo Code panel.
2. **Select Provider:** Choose "OpenAI" from the "API Provider" dropdown.
3. **Enter API Key:** Paste your OpenAI API key into the "OpenAI API Key" field.
4. **Select Model:** Choose your desired model from the "Model" dropdown.
Tips and Notes[](https://kilocode.ai/docs/providers/openai#tips-and-notes "Direct link to Tips and Notes")
------------------------------------------------------------------------------------------------------------
* **Pricing:** Refer to the [OpenAI Pricing](https://openai.com/pricing)
page for details on model costs.
* **Azure OpenAI Service:** If you'd like to use the Azure OpenAI service, please see our section on [OpenAI-compatible](https://kilocode.ai/docs/providers/openai-compatible)
providers.
* [Getting an API Key](https://kilocode.ai/docs/providers/openai#getting-an-api-key)
* [Supported Models](https://kilocode.ai/docs/providers/openai#supported-models)
* [Configuration in Kilo Code](https://kilocode.ai/docs/providers/openai#configuration-in-kilo-code)
* [Tips and Notes](https://kilocode.ai/docs/providers/openai#tips-and-notes)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fproviders%2Fopenai)
---
# Using v0 With Kilo Code | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/providers/v0#__docusaurus_skipToContent_fallback)
On this page
Kilo Code supports v0, Vercel's AI model provider that offers an OpenAI-compatible API. This allows you to use v0's models with Kilo Code through the familiar OpenAI API interface.
Prerequisites[](https://kilocode.ai/docs/providers/v0#prerequisites "Direct link to Prerequisites")
-----------------------------------------------------------------------------------------------------
To use v0 with Kilo Code, you'll need:
* A team account with Vercel v0
* A v0 API key
Configuration[](https://kilocode.ai/docs/providers/v0#configuration "Direct link to Configuration")
-----------------------------------------------------------------------------------------------------
Setting up v0 in Kilo Code is straightforward:
1. In Kilo Code settings (click the icon):
* Under **API Provider**, select: **OpenAI Compatible**
* Set the **Base URL**: `https://api.v0.dev/v1`
* Paste in your v0 API key
* Set the **Model ID**: `v0-1.0-md`
* Click **Verify** to confirm the connection

Supported Models[](https://kilocode.ai/docs/providers/v0#supported-models "Direct link to Supported Models")
--------------------------------------------------------------------------------------------------------------
Currently, v0 offers the following model:
* `v0-1.0-md` - v0's multimodal model that supports both text and image inputs
* `v0-1.5-lg` - composite model ([learn more](https://vercel.com/blog/v0-composite-model-family)
)
* `v0-1.5.md` - composite model ([learn more](https://vercel.com/blog/v0-composite-model-family)
)
Troubleshooting[](https://kilocode.ai/docs/providers/v0#troubleshooting "Direct link to Troubleshooting")
-----------------------------------------------------------------------------------------------------------
* **"Invalid API Key":** Double-check that you've entered the API key correctly.
* **"Model Not Found":** Make sure you're using the correct model ID (`v0-1.0-md`).
* **Connection Errors:** Verify the Base URL is correct (`https://api.v0.dev/v1`).
* **Access Issues:** Confirm that your Vercel v0 team account is active and properly set up.
Additional Resources[](https://kilocode.ai/docs/providers/v0#additional-resources "Direct link to Additional Resources")
--------------------------------------------------------------------------------------------------------------------------
* [v0 Official Documentation](https://v0.dev/)
* [Vercel AI Documentation](https://vercel.com/docs/ai)
* [Prerequisites](https://kilocode.ai/docs/providers/v0#prerequisites)
* [Configuration](https://kilocode.ai/docs/providers/v0#configuration)
* [Supported Models](https://kilocode.ai/docs/providers/v0#supported-models)
* [Troubleshooting](https://kilocode.ai/docs/providers/v0#troubleshooting)
* [Additional Resources](https://kilocode.ai/docs/providers/v0#additional-resources)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fproviders%2Fv0)
---
# Using OpenAI Compatible Providers With Kilo Code | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/providers/openai-compatible#__docusaurus_skipToContent_fallback)
On this page
Kilo Code supports a wide range of AI model providers that offer APIs compatible with the OpenAI API standard. This means you can use models from providers _other than_ OpenAI, while still using a familiar API interface. This includes providers like:
* **Local models** running through tools like Ollama and LM Studio (covered in separate sections).
* **Cloud providers** like Perplexity, Together AI, Anyscale, and others.
* **Any other provider** offering an OpenAI-compatible API endpoint.
This document focuses on setting up providers _other than_ the official OpenAI API (which has its own [dedicated configuration page](https://kilocode.ai/docs/providers/openai)
).
General Configuration[](https://kilocode.ai/docs/providers/openai-compatible#general-configuration "Direct link to General Configuration")
--------------------------------------------------------------------------------------------------------------------------------------------
The key to using an OpenAI-compatible provider is to configure two main settings:
1. **Base URL:** This is the API endpoint for the provider. It will _not_ be `https://api.openai.com/v1` (that's for the official OpenAI API).
2. **API Key:** This is the secret key you obtain from the provider.
3. **Model ID:** This is the model name of the specific model.
You'll find these settings in the Kilo Code settings panel (click the icon):
* **API Provider:** Select "OpenAI Compatible".
* **Base URL:** Enter the base URL provided by your chosen provider. **This is crucial.**
* **API Key:** Enter your API key.
* **Model:** Choose a model.
* **Model Configuration:** This lets you customize advanced configuration for the model
* Max Output Tokens
* Context Window
* Image Support
* Computer Use
* Input Price
* Output Price
### Full Endpoint URL Support[](https://kilocode.ai/docs/providers/openai-compatible#full-endpoint-url-support "Direct link to Full Endpoint URL Support")
Kilo Code supports full endpoint URLs in the Base URL field, providing greater flexibility for provider configuration:
**Standard Base URL Format:**
https://api.provider.com/v1
**Full Endpoint URL Format:**
https://api.provider.com/v1/chat/completionshttps://custom-endpoint.provider.com/api/v2/models/chat
This enhancement allows you to:
* Connect to providers with non-standard endpoint structures
* Use custom API gateways or proxy services
* Work with providers that require specific endpoint paths
* Integrate with enterprise or self-hosted API deployments
**Note:** When using full endpoint URLs, ensure the URL points to the correct chat completions endpoint for your provider.
Supported Models (for OpenAI Native Endpoint)[](https://kilocode.ai/docs/providers/openai-compatible#supported-models-for-openai-native-endpoint "Direct link to Supported Models (for OpenAI Native Endpoint)")
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
While this provider type allows connecting to various endpoints, if you are connecting directly to the official OpenAI API (or an endpoint mirroring it exactly), Kilo Code recognizes the following model IDs based on the `openAiNativeModels` definition in its source code:
* `o3-mini`
* `o3-mini-high`
* `o3-mini-low`
* `o1`
* `o1-preview`
* `o1-mini`
* `gpt-4.5-preview`
* `gpt-4o`
* `gpt-4o-mini`
**Note:** If you are using a different OpenAI-compatible provider (like Together AI, Anyscale, etc.), the available model IDs will vary. Always refer to your specific provider's documentation for their supported model names.
Troubleshooting[](https://kilocode.ai/docs/providers/openai-compatible#troubleshooting "Direct link to Troubleshooting")
--------------------------------------------------------------------------------------------------------------------------
* **"Invalid API Key":** Double-check that you've entered the API key correctly.
* **"Model Not Found":** Make sure you're using a valid model ID for your chosen provider.
* **Connection Errors:** Verify the Base URL is correct and that your provider's API is accessible.
* **Unexpected Results:** If you're getting unexpected results, try a different model.
By using an OpenAI-compatible provider, you can leverage the flexibility of Kilo Code with a wider range of AI models. Remember to always consult your provider's documentation for the most accurate and up-to-date information.
* [General Configuration](https://kilocode.ai/docs/providers/openai-compatible#general-configuration)
* [Full Endpoint URL Support](https://kilocode.ai/docs/providers/openai-compatible#full-endpoint-url-support)
* [Supported Models (for OpenAI Native Endpoint)](https://kilocode.ai/docs/providers/openai-compatible#supported-models-for-openai-native-endpoint)
* [Troubleshooting](https://kilocode.ai/docs/providers/openai-compatible#troubleshooting)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fproviders%2Fopenai-compatible)
---
# Using Unbound With Kilo Code | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/providers/unbound#__docusaurus_skipToContent_fallback)
On this page
Kilo Code supports accessing models through [Unbound](https://getunbound.ai/)
, a platform that focuses on providing secure and reliable access to a variety of large language models (LLMs). Unbound acts as a gateway, allowing you to use models from providers like Anthropic and OpenAI without needing to manage multiple API keys and configurations directly. They emphasize security and compliance features for enterprise use.
**Website:** [https://getunbound.ai/](https://getunbound.ai/)
Creating an Account[](https://kilocode.ai/docs/providers/unbound#creating-an-account "Direct link to Creating an Account")
----------------------------------------------------------------------------------------------------------------------------
1. **Sign Up/Sign In:** Go to the [Unbound gateway](https://gateway.getunbound.ai/)
. Create an account or sign in.
2. **Create an Application:** Go to the [Applications](https://gateway.getunbound.ai/ai-gateway-applications)
page and hit the "Create Application" button.
3. **Copy the API Key:** Copy the API key to your clipboard.
Supported Models[](https://kilocode.ai/docs/providers/unbound#supported-models "Direct link to Supported Models")
-------------------------------------------------------------------------------------------------------------------
Unbound allows you configure a list of supported models in your application, and Kilo Code will automatically fetch the list of available models from the Unbound API.
Configuration in Kilo Code[](https://kilocode.ai/docs/providers/unbound#configuration-in-kilo-code "Direct link to Configuration in Kilo Code")
-------------------------------------------------------------------------------------------------------------------------------------------------
1. **Open Kilo Code Settings:** Click the gear icon () in the Kilo Code panel.
2. **Select Provider:** Choose "Unbound" from the "API Provider" dropdown.
3. **Enter API Key:** Paste your Unbound API key into the "Unbound API Key" field.
4. **Select Model:** Choose your desired model from the "Model" dropdown.
Tips and Notes[](https://kilocode.ai/docs/providers/unbound#tips-and-notes "Direct link to Tips and Notes")
-------------------------------------------------------------------------------------------------------------
* **Security Focus:** Unbound emphasizes security features for enterprise use. If your organization has strict security requirements for AI usage, Unbound might be a good option.
* [Creating an Account](https://kilocode.ai/docs/providers/unbound#creating-an-account)
* [Supported Models](https://kilocode.ai/docs/providers/unbound#supported-models)
* [Configuration in Kilo Code](https://kilocode.ai/docs/providers/unbound#configuration-in-kilo-code)
* [Tips and Notes](https://kilocode.ai/docs/providers/unbound#tips-and-notes)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fproviders%2Funbound)
---
# Using Requesty With Kilo Code | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/providers/requesty#__docusaurus_skipToContent_fallback)
On this page
Kilo Code supports accessing models through the [Requesty](https://www.requesty.ai/)
AI platform. Requesty provides an easy and optimized API for interacting with 150+ large language models (LLMs).
**Website:** [https://www.requesty.ai/](https://www.requesty.ai/)
Getting an API Key[](https://kilocode.ai/docs/providers/requesty#getting-an-api-key "Direct link to Getting an API Key")
--------------------------------------------------------------------------------------------------------------------------
1. **Sign Up/Sign In:** Go to the [Requesty website](https://www.requesty.ai/)
and create an account or sign in.
2. **Get API Key:** You can get an API key from the [API Management](https://app.requesty.ai/manage-api)
section of your Requesty dashboard.
Supported Models[](https://kilocode.ai/docs/providers/requesty#supported-models "Direct link to Supported Models")
--------------------------------------------------------------------------------------------------------------------
Requesty provides access to a wide range of models. Kilo Code will automatically fetch the latest list of available models. You can see the full list of available models on the [Model List](https://app.requesty.ai/router/list)
page.
Configuration in Kilo Code[](https://kilocode.ai/docs/providers/requesty#configuration-in-kilo-code "Direct link to Configuration in Kilo Code")
--------------------------------------------------------------------------------------------------------------------------------------------------
1. **Open Kilo Code Settings:** Click the gear icon () in the Kilo Code panel.
2. **Select Provider:** Choose "Requesty" from the "API Provider" dropdown.
3. **Enter API Key:** Paste your Requesty API key into the "Requesty API Key" field.
4. **Select Model:** Choose your desired model from the "Model" dropdown.
Tips and Notes[](https://kilocode.ai/docs/providers/requesty#tips-and-notes "Direct link to Tips and Notes")
--------------------------------------------------------------------------------------------------------------
* **Optimizations**: Requesty offers range of in-flight cost optimizations to lower your costs.
* **Unified and simplified billing**: Unrestricted access to all providers and models, automatic balance top ups and more via a single [API key](https://app.requesty.ai/manage-api)
.
* **Cost tracking**: Track cost per model, coding language, changed file, and more via the [Cost dashboard](https://app.requesty.ai/cost-management)
or the [Requesty VS.code extension](https://marketplace.visualstudio.com/items?itemName=Requesty.requesty)
.
* **Stats and logs**: See your [coding stats dashboard](https://app.requesty.ai/usage-stats)
or go through your [LLM interaction logs](https://app.requesty.ai/logs)
.
* **Fallback policies**: Keep your LLM working for you with fallback policies when providers are down.
* **Prompt Caching:** Some providers support prompt caching. [Search models with caching](https://app.requesty.ai/router/list)
.
Relevant resources[](https://kilocode.ai/docs/providers/requesty#relevant-resources "Direct link to Relevant resources")
--------------------------------------------------------------------------------------------------------------------------
* [Requesty Youtube channel](https://www.youtube.com/@requestyAI)
:
* [Requesty Discord](https://requesty.ai/discord)
* [Getting an API Key](https://kilocode.ai/docs/providers/requesty#getting-an-api-key)
* [Supported Models](https://kilocode.ai/docs/providers/requesty#supported-models)
* [Configuration in Kilo Code](https://kilocode.ai/docs/providers/requesty#configuration-in-kilo-code)
* [Tips and Notes](https://kilocode.ai/docs/providers/requesty#tips-and-notes)
* [Relevant resources](https://kilocode.ai/docs/providers/requesty#relevant-resources)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fproviders%2Frequesty)
---
# Using Ollama With Kilo Code | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/providers/ollama#__docusaurus_skipToContent_fallback)
On this page
Kilo Code supports running models locally using Ollama. This provides privacy, offline access, and potentially lower costs, but requires more setup and a powerful computer.
**Website:** [https://ollama.com/](https://ollama.com/)

_Vibe coding a Snake game using devstral_
Managing Expectations[](https://kilocode.ai/docs/providers/ollama#managing-expectations "Direct link to Managing Expectations")
---------------------------------------------------------------------------------------------------------------------------------
Local LLMs are much smaller than premium cloud-hosted LLMs such as Claude and Gemini and the results will be much less impressive. They are much more likely to get stuck in loops, fail to use tools properly or produce syntax errors in code. More trial and error will be required to find the right prompt. Local LLMs are usually also not very fast. Using simple prompts, keeping conversations short and disabling MCP tools can result in a speed-up.
Hardware Requirements[](https://kilocode.ai/docs/providers/ollama#hardware-requirements "Direct link to Hardware Requirements")
---------------------------------------------------------------------------------------------------------------------------------
You will need a large amount of RAM (32GB or more) and a powerful CPU (e.g. Ryzen 9000 series) to run the models listed below. GPUs can run LLMs much faster, but a large amount of VRAM is required (24GB, if not more), which is not very common on consumer GPUs. Smaller models will run on more modest GPUs, but do not provide good results. MacBooks with a sufficient amount of unified memory can use GPU-acceleration, but do not outperform high-end desktop CPUs in our testing.
Selecting a Model[](https://kilocode.ai/docs/providers/ollama#selecting-a-model "Direct link to Selecting a Model")
---------------------------------------------------------------------------------------------------------------------
Ollama supports many different models. You can find a list of available models on the [Ollama website](https://ollama.com/library)
. Selecting a model that suits your use case, runs on your hardware configuration and achieves the desired speed requires some trial and error. The following rules and heuristics can be used to find a model:
* Must have at least a 32k context window (this is a requirement for Kilo Code).
* Listed as supporting tools.
* Number of parameters in the 7b to 24b range.
* Prefer popular models.
* Prefer newer models.
### Recommendations for Kilo Code[](https://kilocode.ai/docs/providers/ollama#recommendations-for-kilo-code "Direct link to Recommendations for Kilo Code")
We tested a few models with the following prompt:
Create a simple web page with a button that greets the user when clicked.
A model is considered to pass if it produces a working result within a few tries. The models we found to work correctly are:
| Model name | Completion time |
| --- | --- |
| qwen2.5-coder:7b | 1x (baseline) |
| devstral:24b | 2x |
| gemma3:12b | 4x |
| qwen3-8b | 12x |
Our recommendation is to use **devstral:24b** if your hardware can handle it, because it makes fewer mistakes than qwen2.5-coder:7b. qwen2.5-coder:7b is worth considering because of its speed, if you can put up with its mistakes. The table also shows speed can be hard to predict, since the special-purpose devstral:24b outperforms the smaller general-purpose models gemma3:12b and qwen3-8b here. The gemma3:12b result is remarkable, because it can use tools correctly (at least sometimes), while not being listed as suitable for tool use on the Ollama website.
The result produced by devstral:24b is included below:
Greet User Button
The following models look like reasonable choices, but were found to **not** work properly with Kilo Code in its default configuration:
| Model name | Fail reason |
| --- | --- |
| deepseek-r1:7b | fails to use tools properly |
| deepseek-r1:8b | gets stuck in a reasoning loop |
Setting up Ollama[](https://kilocode.ai/docs/providers/ollama#setting-up-ollama "Direct link to Setting up Ollama")
---------------------------------------------------------------------------------------------------------------------
1. **Download and Install Ollama:** Download the Ollama installer for your operating system from the [Ollama website](https://ollama.com/)
. Follow the installation instructions and _set the `OLLAMA_CONTEXT_LENGTH` environment variable_ to prevent Ollama from truncating prompts. Make sure Ollama is running:
OLLAMA_CONTEXT_LENGTH=131072 ollama serve
2. **Download a Model:** Once you've downloaded a model, you can use Kilo Code offline with that model. To download a model, open your terminal and run:
ollama pull
For example:
ollama pull devstral:24b
3. **Configure Kilo Code:**
* Open the Kilo Code sidebar ( icon).
* Click the settings gear icon ().
* Select "ollama" as the API Provider.
* Enter the Model name.
* (Optional) You can configure the base URL if you're running Ollama on a different machine. The default is `http://localhost:11434`.
Further Reading[](https://kilocode.ai/docs/providers/ollama#further-reading "Direct link to Further Reading")
---------------------------------------------------------------------------------------------------------------
Refer to the [Ollama documentation](https://ollama.com/docs)
for more information on installing, configuring and using Ollama.
* [Managing Expectations](https://kilocode.ai/docs/providers/ollama#managing-expectations)
* [Hardware Requirements](https://kilocode.ai/docs/providers/ollama#hardware-requirements)
* [Selecting a Model](https://kilocode.ai/docs/providers/ollama#selecting-a-model)
* [Recommendations for Kilo Code](https://kilocode.ai/docs/providers/ollama#recommendations-for-kilo-code)
* [Setting up Ollama](https://kilocode.ai/docs/providers/ollama#setting-up-ollama)
* [Further Reading](https://kilocode.ai/docs/providers/ollama#further-reading)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fproviders%2Follama)
---
# Using VS Code Language Model API With Kilo Code | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/providers/vscode-lm#__docusaurus_skipToContent_fallback)
On this page
Kilo Code includes _experimental_ support for the [VS Code Language Model API](https://code.visualstudio.com/api/language-extensions/language-model-access)
. This API allows extensions to provide access to language models directly within VS Code. This means you can potentially use models from:
* **GitHub Copilot:** If you have a Copilot subscription and the extension installed.
* **Other VS Code Extensions:** Any extension that implements the Language Model API.
**Important:** This integration is highly experimental and may not work as expected. It is dependent on other extensions correctly implementing the VS Code Language Model API.
Prerequisites[](https://kilocode.ai/docs/providers/vscode-lm#prerequisites "Direct link to Prerequisites")
------------------------------------------------------------------------------------------------------------
* **VS Code:** The Language Model API is available through VS Code (and is not currently supported by Cursor).
* **A Language Model Provider Extension:** You need an extension that provides a language model. Examples include:
* **GitHub Copilot:** If you have a Copilot subscription, the GitHub Copilot and GitHub Copilot Chat extensions can provide models.
* **Other Extensions:** Search the VS Code Marketplace for extensions that mention "Language Model API" or "lm". There may be other experimental extensions available.
Configuration[](https://kilocode.ai/docs/providers/vscode-lm#configuration "Direct link to Configuration")
------------------------------------------------------------------------------------------------------------
1. **Open Kilo Code Settings:** Click the gear icon () in the Kilo Code panel.
2. **Select Provider:** Choose "VS Code LM API" from the "API Provider" dropdown.
3. **Select Model:** The "Language Model" dropdown will (eventually) list available models. The format is `vendor/family`. For example, if you have Copilot, you might see options like:
* `copilot - claude-3.5-sonnet`
* `copilot - o3-mini`
* `copilot - o1-ga`
* `copilot - gemini-2.0-flash`
Limitations[](https://kilocode.ai/docs/providers/vscode-lm#limitations "Direct link to Limitations")
------------------------------------------------------------------------------------------------------
* **Experimental API:** The VS Code Language Model API is still under development. Expect changes and potential instability.
* **Extension Dependent:** This feature relies entirely on other extensions providing models. Kilo Code cannot directly control which models are available.
* **Limited Functionality:** The VS Code Language Model API may not support all the features of other API providers (e.g., image input, streaming, detailed usage information).
* **No Direct Cost Control:** You are subject to the pricing and terms of the extension providing the model. Kilo Code cannot directly track or limit costs.
* **GitHub Copilot Rate Limits:** When using the VS Code LM API with GitHub Copilot, be aware that GitHub may impose rate limits on Copilot usage. These limits are controlled by GitHub, not Kilo Code.
Troubleshooting[](https://kilocode.ai/docs/providers/vscode-lm#troubleshooting "Direct link to Troubleshooting")
------------------------------------------------------------------------------------------------------------------
* **No Models Appear:**
* Ensure you have VS Code installed.
* Ensure you have a language model provider extension installed and enabled (e.g., GitHub Copilot, GitHub Copilot Chat).
* If using Copilot, make sure that you have sent a Copilot Chat message using the model you would like to use.
* **Unexpected Behavior:** If you encounter unexpected behavior, it's likely an issue with the underlying Language Model API or the provider extension. Consider reporting the issue to the provider extension's developers.
* [Prerequisites](https://kilocode.ai/docs/providers/vscode-lm#prerequisites)
* [Configuration](https://kilocode.ai/docs/providers/vscode-lm#configuration)
* [Limitations](https://kilocode.ai/docs/providers/vscode-lm#limitations)
* [Troubleshooting](https://kilocode.ai/docs/providers/vscode-lm#troubleshooting)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fproviders%2Fvscode-lm)
---
# Using GCP Vertex AI With Kilo Code | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/providers/vertex#__docusaurus_skipToContent_fallback)
On this page
Kilo Code supports accessing models through Google Cloud Platform's Vertex AI, a managed machine learning platform that provides access to various foundation models, including Anthropic's Claude family.
**Website:** [https://cloud.google.com/vertex-ai](https://cloud.google.com/vertex-ai)
Prerequisites[](https://kilocode.ai/docs/providers/vertex#prerequisites "Direct link to Prerequisites")
---------------------------------------------------------------------------------------------------------
* **Google Cloud Account:** You need an active Google Cloud Platform (GCP) account.
* **Project:** You need a GCP project with the Vertex AI API enabled.
* **Model Access:** You must request and be granted access to the specific Claude models on Vertex AI you want to use. See the [Google Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-claude#before_you_begin)
for instructions.
* **Application Default Credentials (ADC):** Kilo Code uses Application Default Credentials to authenticate with Vertex AI. The easiest way to set this up is to:
1. Install the Google Cloud CLI: [https://cloud.google.com/sdk/docs/install](https://cloud.google.com/sdk/docs/install)
2. Authenticate using: `gcloud auth application-default login`
* **Service Account Key (Alternative):** Alternatively, you can authenticate using a Google Cloud Service Account key file. You'll need to generate this key in your GCP project. See the [Google Cloud documentation on creating service account keys](https://cloud.google.com/iam/docs/creating-managing-service-account-keys)
.
Supported Models[](https://kilocode.ai/docs/providers/vertex#supported-models "Direct link to Supported Models")
------------------------------------------------------------------------------------------------------------------
Kilo Code supports the following models through Vertex AI (based on source code):
* **Google Gemini Models:**
* `gemini-2.5-flash-preview-05-20`
* `gemini-2.0-flash-001`
* `gemini-2.5-pro-exp-03-25`
* `gemini-2.0-pro-exp-02-05`
* `gemini-2.0-flash-lite-001`
* `gemini-2.0-flash-thinking-exp-01-21`
* `gemini-1.5-flash-002`
* `gemini-1.5-pro-002`
* **Anthropic Claude Models:**
* `claude-opus-4@20250514:thinking`
* `claude-opus-4@20250514`
* `claude-sonnet-4@20250514:thinking`
* `claude-sonnet-4@20250514`
* `claude-3-7-sonnet@20250219:thinking`
* `claude-3-7-sonnet@20250219`
* `claude-3-5-sonnet-v2@20241022`
* `claude-3-5-sonnet@20240620`
* `claude-3-5-haiku@20241022`
* `claude-3-opus@20240229`
* `claude-3-haiku@20240307`
Refer to the [Google Cloud documentation on Vertex AI Models](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models)
for the most up-to-date list of available models and their IDs.
Configuration in Kilo Code[](https://kilocode.ai/docs/providers/vertex#configuration-in-kilo-code "Direct link to Configuration in Kilo Code")
------------------------------------------------------------------------------------------------------------------------------------------------
1. **Open Kilo Code Settings:** Click the gear icon () in the Kilo Code panel.
2. **Select Provider:** Choose "GCP Vertex AI" from the "API Provider" dropdown.
3. **Configure Authentication:**
* **If using Application Default Credentials (ADC):** No further action is needed here. ADC will be used automatically if configured correctly (see Prerequisites).
* **If _not_ using ADC (Service Account Key):**
* **Option A: Paste JSON Content:** Paste the entire content of your Service Account JSON key file into the **Google Cloud Credentials** field.
* **Option B: Provide File Path:** Enter the absolute path to your downloaded Service Account JSON key file in the **Google Cloud Key File Path** field.
4. **Enter Project ID:** Enter your Google Cloud Project ID.
5. **Select Region:** Choose the region where your Vertex AI resources are located (e.g., `us-east5`).
6. **Select Model:** Choose your desired model from the "Model" dropdown.
Tips and Notes[](https://kilocode.ai/docs/providers/vertex#tips-and-notes "Direct link to Tips and Notes")
------------------------------------------------------------------------------------------------------------
* **Permissions:** Ensure your Google Cloud account has the necessary permissions to access Vertex AI and the specific models you want to use.
* **Pricing:** Refer to the [Vertex AI pricing](https://cloud.google.com/vertex-ai/pricing)
page for details.
* [Prerequisites](https://kilocode.ai/docs/providers/vertex#prerequisites)
* [Supported Models](https://kilocode.ai/docs/providers/vertex#supported-models)
* [Configuration in Kilo Code](https://kilocode.ai/docs/providers/vertex#configuration-in-kilo-code)
* [Tips and Notes](https://kilocode.ai/docs/providers/vertex#tips-and-notes)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fproviders%2Fvertex)
---
# Using Mistral AI With Kilo Code | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/providers/mistral#__docusaurus_skipToContent_fallback)
On this page
Kilo Code supports accessing models through the Mistral AI API, including both standard Mistral models and the code-specialized Codestral model.
**Website:** [https://mistral.ai/](https://mistral.ai/)
Getting an API Key[](https://kilocode.ai/docs/providers/mistral#getting-an-api-key "Direct link to Getting an API Key")
-------------------------------------------------------------------------------------------------------------------------
1. **Sign Up/Sign In:** Go to the [Mistral Platform](https://console.mistral.ai/)
. Create an account or sign in. You may need to go through a verification process.
2. **Create an API Key:**
* [La Plateforme API Key](https://console.mistral.ai/api-keys/)
and/or
* [Codestral API Key](https://console.mistral.ai/codestral)
Supported Models[](https://kilocode.ai/docs/providers/mistral#supported-models "Direct link to Supported Models")
-------------------------------------------------------------------------------------------------------------------
Kilo Code supports the following Mistral models:
| Model ID | Model Default Temperature | Function Calling | Vision / Image support |
| --- | --- | --- | --- |
| codestral-latest | 0.3 | ✅ | ❌ |
| devstral | 0.3 | ✅ | ❌ |
| mistral-large-latest | 0.7 | ✅ | ❌ |
| ministral-8b-latest | 0.3 | ✅ | ❌ |
| ministral-3b-latest | 0.3 | ✅ | ❌ |
| mistral-small-latest | 0.3 | ✅ | ❌ |
| pixtral-large-latest | 0.7 | ✅ | ✅ |
| The default model temperature in Kilo Code is 0.0, so you should consider experimenting with [temperature adjustments](https://kilocode.ai/docs/features/model-temperature) ! | | | |
**Note:** Model availability and specifications may change. Refer to the [Mistral AI documentation](https://docs.mistral.ai/api/)
and [Mistral Model Overview](https://docs.mistral.ai/getting-started/models/models_overview/)
for the latest information.
Configuration in Kilo Code[](https://kilocode.ai/docs/providers/mistral#configuration-in-kilo-code "Direct link to Configuration in Kilo Code")
-------------------------------------------------------------------------------------------------------------------------------------------------
1. **Open Kilo Code Settings:** Click the gear icon () in the Kilo Code panel.
2. **Select Provider:** Choose "Mistral" from the "API Provider" dropdown.
3. **Enter API Key:** Paste your Mistral API key into the "Mistral API Key" field if you're using a `mistral` model. If you intend to use `codestral-latest`, see the "Codestral" section below.
4. **Select Model:** Choose your desired model from the "Model" dropdown.
Using Codestral[](https://kilocode.ai/docs/providers/mistral#using-codestral "Direct link to Using Codestral")
----------------------------------------------------------------------------------------------------------------
[Codestral](https://docs.mistral.ai/capabilities/code_generation/)
is a model specifically designed for code generation and interaction. Only for Codestral you could use different endpoints (Default: codestral.mistral.ai). For the La Platforme API Key change the **Codestral Base Url** to: [https://api.mistral.ai](https://api.mistral.ai/)
To use Codestral:
1. **Select "Mistral" as the API Provider.**
2. **Select a Codestral Model**
3. **Enter your Codestral (codestral.mistral.ai) or La Plateforme (api.mistral.ai) API Key.**
* [Getting an API Key](https://kilocode.ai/docs/providers/mistral#getting-an-api-key)
* [Supported Models](https://kilocode.ai/docs/providers/mistral#supported-models)
* [Configuration in Kilo Code](https://kilocode.ai/docs/providers/mistral#configuration-in-kilo-code)
* [Using Codestral](https://kilocode.ai/docs/providers/mistral#using-codestral)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fproviders%2Fmistral)
---
# Using xAI (Grok) With Kilo Code | Kilo Code Docs
[Skip to main content](https://kilocode.ai/docs/providers/xai#__docusaurus_skipToContent_fallback)
On this page
xAI is the company behind Grok, a large language model known for its conversational abilities and large context window. Grok models are designed to provide helpful, informative, and contextually relevant responses.
**Website:** [https://x.ai/](https://x.ai/)
Getting an API Key[](https://kilocode.ai/docs/providers/xai#getting-an-api-key "Direct link to Getting an API Key")
---------------------------------------------------------------------------------------------------------------------
1. **Sign Up/Sign In:** Go to the [xAI Console](https://console.x.ai/)
. Create an account or sign in.
2. **Navigate to API Keys:** Go to the API keys section in your dashboard.
3. **Create a Key:** Click to create a new API key. Give your key a descriptive name (e.g., "Kilo Code").
4. **Copy the Key:** **Important:** Copy the API key _immediately_. You will not be able to see it again. Store it securely.
Supported Models[](https://kilocode.ai/docs/providers/xai#supported-models "Direct link to Supported Models")
---------------------------------------------------------------------------------------------------------------
Kilo Code supports the following xAI Grok models:
### Grok-3 Models[](https://kilocode.ai/docs/providers/xai#grok-3-models "Direct link to Grok-3 Models")
* `grok-3-beta` (Default) - xAI's Grok-3 beta model with 131K context window
* `grok-3-fast-beta` - xAI's Grok-3 fast beta model with 131K context window
* `grok-3-mini-beta` - xAI's Grok-3 mini beta model with 131K context window
* `grok-3-mini-fast-beta` - xAI's Grok-3 mini fast beta model with 131K context window
### Grok-2 Models[](https://kilocode.ai/docs/providers/xai#grok-2-models "Direct link to Grok-2 Models")
* `grok-2-latest` - xAI's Grok-2 model - latest version with 131K context window
* `grok-2` - xAI's Grok-2 model with 131K context window
* `grok-2-1212` - xAI's Grok-2 model (version 1212) with 131K context window
### Grok Vision Models[](https://kilocode.ai/docs/providers/xai#grok-vision-models "Direct link to Grok Vision Models")
* `grok-2-vision-latest` - xAI's Grok-2 Vision model - latest version with image support and 32K context window
* `grok-2-vision` - xAI's Grok-2 Vision model with image support and 32K context window
* `grok-2-vision-1212` - xAI's Grok-2 Vision model (version 1212) with image support and 32K context window
* `grok-vision-beta` - xAI's Grok Vision Beta model with image support and 8K context window
### Legacy Models[](https://kilocode.ai/docs/providers/xai#legacy-models "Direct link to Legacy Models")
* `grok-beta` - xAI's Grok Beta model (legacy) with 131K context window
Configuration in Kilo Code[](https://kilocode.ai/docs/providers/xai#configuration-in-kilo-code "Direct link to Configuration in Kilo Code")
---------------------------------------------------------------------------------------------------------------------------------------------
1. **Open Kilo Code Settings:** Click the gear icon () in the Kilo Code panel.
2. **Select Provider:** Choose "xAI" from the "API Provider" dropdown.
3. **Enter API Key:** Paste your xAI API key into the "xAI API Key" field.
4. **Select Model:** Choose your desired Grok model from the "Model" dropdown.
Reasoning Capabilities[](https://kilocode.ai/docs/providers/xai#reasoning-capabilities "Direct link to Reasoning Capabilities")
---------------------------------------------------------------------------------------------------------------------------------
Grok 3 Mini models feature specialized reasoning capabilities, allowing them to "think before responding" - particularly useful for complex problem-solving tasks.
### Reasoning-Enabled Models[](https://kilocode.ai/docs/providers/xai#reasoning-enabled-models "Direct link to Reasoning-Enabled Models")
Reasoning is only supported by:
* `grok-3-mini-beta`
* `grok-3-mini-fast-beta`
The Grok 3 models `grok-3-beta` and `grok-3-fast-beta` do not support reasoning.
### Controlling Reasoning Effort[](https://kilocode.ai/docs/providers/xai#controlling-reasoning-effort "Direct link to Controlling Reasoning Effort")
When using reasoning-enabled models, you can control how hard the model thinks with the `reasoning_effort` parameter:
* `low`: Minimal thinking time, using fewer tokens for quick responses
* `high`: Maximum thinking time, leveraging more tokens for complex problems
Choose `low` for simple queries that should complete quickly, and `high` for harder problems where response latency is less important.
### Key Features[](https://kilocode.ai/docs/providers/xai#key-features "Direct link to Key Features")
* **Step-by-Step Problem Solving**: The model thinks through problems methodically before delivering an answer
* **Math & Quantitative Strength**: Excels at numerical challenges and logic puzzles
* **Reasoning Trace Access**: The model's thinking process is available via the `reasoning_content` field in the response completion object
Tips and Notes[](https://kilocode.ai/docs/providers/xai#tips-and-notes "Direct link to Tips and Notes")
---------------------------------------------------------------------------------------------------------
* **Context Window:** Most Grok models feature large context windows (up to 131K tokens), allowing you to include substantial amounts of code and context in your prompts.
* **Vision Capabilities:** Select vision-enabled models (`grok-2-vision-latest`, `grok-2-vision`, etc.) when you need to process or analyze images.
* **Pricing:** Pricing varies by model, with input costs ranging from $0.3 to $5.0 per million tokens and output costs from $0.5 to $25.0 per million tokens. Refer to the xAI documentation for the most current pricing information.
* **Performance Tradeoffs:** "Fast" variants typically offer quicker response times but may have higher costs, while "mini" variants are more economical but may have reduced capabilities.
* [Getting an API Key](https://kilocode.ai/docs/providers/xai#getting-an-api-key)
* [Supported Models](https://kilocode.ai/docs/providers/xai#supported-models)
* [Grok-3 Models](https://kilocode.ai/docs/providers/xai#grok-3-models)
* [Grok-2 Models](https://kilocode.ai/docs/providers/xai#grok-2-models)
* [Grok Vision Models](https://kilocode.ai/docs/providers/xai#grok-vision-models)
* [Legacy Models](https://kilocode.ai/docs/providers/xai#legacy-models)
* [Configuration in Kilo Code](https://kilocode.ai/docs/providers/xai#configuration-in-kilo-code)
* [Reasoning Capabilities](https://kilocode.ai/docs/providers/xai#reasoning-capabilities)
* [Reasoning-Enabled Models](https://kilocode.ai/docs/providers/xai#reasoning-enabled-models)
* [Controlling Reasoning Effort](https://kilocode.ai/docs/providers/xai#controlling-reasoning-effort)
* [Key Features](https://kilocode.ai/docs/providers/xai#key-features)
* [Tips and Notes](https://kilocode.ai/docs/providers/xai#tips-and-notes)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fproviders%2Fxai)
---
# Kilo Code 文档 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/#__docusaurus_skipToContent_fallback)
本页总览
Kilo Code 是一个开源的 AI 助手 VS Code 扩展。它通过生成代码、自动化任务和提供建议来帮助你更高效地编写代码。
Kilo Code 能做什么?[](https://kilocode.ai/docs/zh-CN/#kilo-code-%E8%83%BD%E5%81%9A%E4%BB%80%E4%B9%88 "Kilo Code 能做什么?的直接链接")
--------------------------------------------------------------------------------------------------------------------------
* 🚀 **生成代码**:根据自然语言描述生成代码
* 🔧 **重构与调试**:优化现有代码并修复问题
* 📝 **编写与更新**:创建和更新文档
* 🤔 **回答问题**:解答关于代码库的疑问
* 🔄 **自动化**:自动化重复性任务
* 🏗️ **创建**:新建文件和项目
快速开始[](https://kilocode.ai/docs/zh-CN/#%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B "快速开始的直接链接")
------------------------------------------------------------------------------------------
1. [安装 Kilo Code](https://kilocode.ai/docs/zh-CN/getting-started/installing)
2. [设置 Kilo Code](https://kilocode.ai/docs/zh-CN/getting-started/setting-up)
3. [尝试你的首个任务](https://kilocode.ai/docs/zh-CN/getting-started/your-first-task)
功能[](https://kilocode.ai/docs/zh-CN/#%E5%8A%9F%E8%83%BD "功能的直接链接")
--------------------------------------------------------------------

### 基础功能[](https://kilocode.ai/docs/zh-CN/#%E5%9F%BA%E7%A1%80%E5%8A%9F%E8%83%BD "基础功能的直接链接")
你通过[聊天界面](https://kilocode.ai/docs/zh-CN/basic-usage/the-chat-interface)
与 Kilo Code 交互 - 只需输入你的需求,Kilo Code 将使用最新的编码优化 AI 模型来满足你的请求。你可以切换[模式](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes)
以让 Kilo Code 以不同的方式工作,控制 Kilo Code 可以执行的操作,并通过[代码操作](https://kilocode.ai/docs/zh-CN/features/code-actions)
直接与你的代码交互。
### 使用 Kilo Code[](https://kilocode.ai/docs/zh-CN/#%E4%BD%BF%E7%94%A8-kilo-code "使用 Kilo Code的直接链接")
#### 多种模式[](https://kilocode.ai/docs/zh-CN/#%E5%A4%9A%E7%A7%8D%E6%A8%A1%E5%BC%8F "多种模式的直接链接")
Kilo Code 通过专门的[模式](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes)
适应你的需求:
* [**Code 模式:**](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes#code-mode-default)
用于通用编码任务
* [**Architect 模式:**](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes#architect-mode)
用于规划和技术领导
* [**Ask 模式:**](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes#ask-mode)
用于回答问题并提供信息
* [**Debug 模式:**](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes#debug-mode)
用于系统化问题诊断
* **[自定义模式](https://kilocode.ai/docs/zh-CN/features/custom-modes)
:** 创建无限数量的专门角色,用于安全审计、性能优化、文档编写或任何其他任务
#### 核心工具[](https://kilocode.ai/docs/zh-CN/#%E6%A0%B8%E5%BF%83%E5%B7%A5%E5%85%B7 "核心工具的直接链接")
Kilo Code 配备了强大的[工具](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview)
,可以:
* [读取](https://kilocode.ai/docs/zh-CN/features/tools/read-file)
和[写入](https://kilocode.ai/docs/zh-CN/features/tools/write-to-file)
项目中的文件
* 在你的 VS Code 终端中[执行命令](https://kilocode.ai/docs/zh-CN/features/tools/execute-command)
* [控制网页浏览器](https://kilocode.ai/docs/zh-CN/features/tools/browser-action)
* [提问跟进问题](https://kilocode.ai/docs/zh-CN/features/tools/ask-followup-question)
* [搜索你的代码库](https://kilocode.ai/docs/zh-CN/features/tools/search-files)
查看完整的[工具参考](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview)
以了解所有可用工具。
### 扩展 Kilo Code[](https://kilocode.ai/docs/zh-CN/#%E6%89%A9%E5%B1%95-kilo-code "扩展 Kilo Code的直接链接")
* **[MCP(模型上下文协议)](https://kilocode.ai/docs/zh-CN/features/mcp/overview)
:** 添加无限自定义工具,集成外部 API,连接数据库,或创建专门的开发工具
* **[本地模型](https://kilocode.ai/docs/zh-CN/advanced-usage/local-models)
:** 使用本地 AI 模型运行 Kilo Code,以实现离线使用或增强隐私
### 自定义 Kilo Code[](https://kilocode.ai/docs/zh-CN/#%E8%87%AA%E5%AE%9A%E4%B9%89-kilo-code "自定义 Kilo Code的直接链接")
通过以下方式让 Kilo Code 按照你的方式工作:
* [设置管理](https://kilocode.ai/docs/zh-CN/features/settings-management)
来配置你的体验
* [自定义模式](https://kilocode.ai/docs/zh-CN/features/custom-modes)
用于专门任务
* [自定义规则](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules)
用于项目特定规则
* [自定义指令](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-instructions)
用于全局插件范围内的指令
* [API 配置配置文件](https://kilocode.ai/docs/zh-CN/features/api-configuration-profiles)
用于不同的模型提供商
* [自动批准设置](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions)
用于更快的工作流程
资源[](https://kilocode.ai/docs/zh-CN/#%E8%B5%84%E6%BA%90 "资源的直接链接")
--------------------------------------------------------------------
### 文档[](https://kilocode.ai/docs/zh-CN/#%E6%96%87%E6%A1%A3 "文档的直接链接")
* [使用 Kilo Code](https://kilocode.ai/docs/zh-CN/basic-usage/the-chat-interface)
- 学习基础知识
* [核心概念](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions)
- 掌握关键功能
* [高级用法](https://kilocode.ai/docs/zh-CN/advanced-usage/prompt-engineering)
- 进一步提升你的技能
* [常见问题解答](https://kilocode.ai/docs/zh-CN/faq)
- 获取常见问题的答案
### 社区[](https://kilocode.ai/docs/zh-CN/#%E7%A4%BE%E5%8C%BA "社区的直接链接")
* **Discord:** [加入我们的 Discord 服务器](https://kilocode.ai/discord)
以获取实时帮助和讨论
* **Reddit:** [访问我们的 subreddit](https://www.reddit.com/r/kilocode/)
以分享经验和技巧
* **YouTube:** [查看我们的 YouTube](https://www.youtube.com/@Kilo-Code)
以学习使用 Kilo Code 的实践技能
* **GitHub:** 在[问题页面](https://github.com/Kilo-Org/kilocode/issues)
报告问题或在[功能请求页面](https://github.com/Kilo-Org/kilocode/discussions/categories/ideas)
提出建议
准备好开始了吗?点击下方的**下一步**按钮,开启你的 Kilo Code 之旅!
* [Kilo Code 能做什么?](https://kilocode.ai/docs/zh-CN/#kilo-code-%E8%83%BD%E5%81%9A%E4%BB%80%E4%B9%88)
* [快速开始](https://kilocode.ai/docs/zh-CN/#%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B)
* [功能](https://kilocode.ai/docs/zh-CN/#%E5%8A%9F%E8%83%BD)
* [基础功能](https://kilocode.ai/docs/zh-CN/#%E5%9F%BA%E7%A1%80%E5%8A%9F%E8%83%BD)
* [使用 Kilo Code](https://kilocode.ai/docs/zh-CN/#%E4%BD%BF%E7%94%A8-kilo-code)
* [扩展 Kilo Code](https://kilocode.ai/docs/zh-CN/#%E6%89%A9%E5%B1%95-kilo-code)
* [自定义 Kilo Code](https://kilocode.ai/docs/zh-CN/#%E8%87%AA%E5%AE%9A%E4%B9%89-kilo-code)
* [资源](https://kilocode.ai/docs/zh-CN/#%E8%B5%84%E6%BA%90)
* [文档](https://kilocode.ai/docs/zh-CN/#%E6%96%87%E6%A1%A3)
* [社区](https://kilocode.ai/docs/zh-CN/#%E7%A4%BE%E5%8C%BA)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2F)
---
# 搜索文档
[跳到主要内容](https://kilocode.ai/docs/zh-CN/search#__docusaurus_skipToContent_fallback)
搜索文档
====
---
# 自定义指令 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-instructions#__docusaurus_skipToContent_fallback)
本页总览
自定义指令允许你个性化 Kilo Code 的行为,提供特定的指导来塑造响应、编码风格和决策过程。
什么是自定义指令?[](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-instructions#%E4%BB%80%E4%B9%88%E6%98%AF%E8%87%AA%E5%AE%9A%E4%B9%89%E6%8C%87%E4%BB%A4 "什么是自定义指令?的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
自定义指令定义了扩展的特定行为、偏好和约束,超出了 Kilo 的基本角色定义。示例包括编码风格、文档标准、测试要求和工作流指南。
自定义指令 vs 规则
自定义指令是 IDE 范围的,适用于所有工作区,无论你在处理哪个项目,都会保持你的偏好。与指令不同,[自定义规则](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules)
是项目特定的,允许你设置基于工作区的规则集。
设置自定义指令[](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-instructions#%E8%AE%BE%E7%BD%AE%E8%87%AA%E5%AE%9A%E4%B9%89%E6%8C%87%E4%BB%A4 "设置自定义指令的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------------------------------
**如何设置:**

1. **打开提示标签:** 点击 Kilo Code 顶部菜单栏中的 图标
2. **找到部分:** 找到 "所有模式的自定义指令" 部分
3. **输入指令:** 在文本区域输入你的指令
4. **保存更改:** 点击 "完成" 保存你的更改
#### 模式特定指令[](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-instructions#%E6%A8%A1%E5%BC%8F%E7%89%B9%E5%AE%9A%E6%8C%87%E4%BB%A4 "模式特定指令的直接链接")
模式特定指令可以使用提示标签设置

* **打开标签:** 点击 Kilo Code 顶部菜单栏中的 图标
* **选择模式:** 在模式标题下,点击你想要自定义的模式按钮
* **输入指令:** 在 "模式特定自定义指令(可选)" 下的文本区域输入你的指令
* **保存更改:** 点击 "完成" 保存你的更改
全局模式规则
如果模式本身是全局的(非工作区特定),你为其设置的任何自定义指令也将全局适用于所有工作区的该模式。
相关功能[](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-instructions#%E7%9B%B8%E5%85%B3%E5%8A%9F%E8%83%BD "相关功能的直接链接")
----------------------------------------------------------------------------------------------------------------------------
* [自定义模式](https://kilocode.ai/docs/zh-CN/features/custom-modes)
* [自定义规则](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules)
* [设置管理](https://kilocode.ai/docs/zh-CN/features/settings-management)
* [自动批准设置](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions)
* [什么是自定义指令?](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-instructions#%E4%BB%80%E4%B9%88%E6%98%AF%E8%87%AA%E5%AE%9A%E4%B9%89%E6%8C%87%E4%BB%A4)
* [设置自定义指令](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-instructions#%E8%AE%BE%E7%BD%AE%E8%87%AA%E5%AE%9A%E4%B9%89%E6%8C%87%E4%BB%A4)
* [相关功能](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-instructions#%E7%9B%B8%E5%85%B3%E5%8A%9F%E8%83%BD)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fadvanced-usage%2Fcustom-instructions)
---
# codebase_search | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#__docusaurus_skipToContent_fallback)
本页总览
实验性功能
`codebase_search` 工具是实验性功能 [代码库索引](https://kilocode.ai/docs/zh-CN/features/codebase-indexing)
的一部分。该功能正在积极开发中,可能在未来的版本中有重大变化。它需要额外的设置,包括嵌入提供程序和向量数据库。
`codebase_search` 工具使用 AI 嵌入在整个代码库中执行语义搜索。与传统的基于文本的搜索不同,它能理解查询的含义,即使没有完全匹配的关键字,也能找到相关的代码。
参数[](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E5%8F%82%E6%95%B0 "参数的直接链接")
------------------------------------------------------------------------------------------------------------------
该工具接受以下参数:
* `query`(必填):自然语言搜索查询,描述你要查找的内容
* `path`(可选):目录路径,用于将搜索范围限制在代码库的特定部分
功能[](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E5%8A%9F%E8%83%BD "功能的直接链接")
------------------------------------------------------------------------------------------------------------------
该工具通过语义相似性而非精确文本匹配来搜索你的索引代码库。它能找到与你的查询在概念上相关的代码块,即使它们不包含你搜索的确切单词。结果包括相关代码片段、文件路径、行号和相似度分数。
使用场景[](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF "使用场景的直接链接")
----------------------------------------------------------------------------------------------------------------------------------------
* 当 Kilo Code 需要在项目中查找与特定功能相关的代码时
* 当查找实现模式或相似代码结构时
* 当搜索错误处理、身份验证或其他概念性代码模式时
* 当探索不熟悉的代码库以了解功能实现时
* 当查找可能受更改或重构影响的代码时
主要特性[](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E4%B8%BB%E8%A6%81%E7%89%B9%E6%80%A7 "主要特性的直接链接")
----------------------------------------------------------------------------------------------------------------------------------------
* **语义理解**:通过含义而非精确关键字匹配查找代码
* **跨项目搜索**:搜索整个索引代码库,而不仅仅是打开的文件
* **上下文结果**:返回包含文件路径和行号的代码片段,便于导航
* **相似度评分**:结果按相关性排序,带有相似度分数(0-1 范围)
* **范围过滤**:可选路径参数,用于将搜索限制在特定目录
* **智能排序**:结果按与查询的语义相关性排序
* **UI 集成**:结果显示语法高亮和导航链接
* **性能优化**:快速向量搜索,具有可配置的结果限制
要求[](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E8%A6%81%E6%B1%82 "要求的直接链接")
------------------------------------------------------------------------------------------------------------------
该工具仅在实验性代码库索引功能正确配置时可用:
* **功能启用**:必须在实验设置中启用代码库索引
* **嵌入提供程序**:需要 OpenAI API 密钥或 Ollama 配置
* **向量数据库**:需要运行并访问 Qdrant 实例
* **索引状态**:代码库必须已索引(状态:"已索引" 或 "正在索引")
限制[](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E9%99%90%E5%88%B6 "限制的直接链接")
------------------------------------------------------------------------------------------------------------------
* **实验性功能**:属于实验性代码库索引系统的一部分
* **需要配置**:依赖外部服务(嵌入提供程序 + Qdrant)
* **索引依赖**:仅搜索已索引的代码块
* **结果限制**:每次搜索最多返回 50 个结果以保持性能
* **相似度阈值**:仅返回相似度分数高于 0.4 的结果
* **文件大小限制**:仅限于成功索引的小于 1MB 的文件
* **语言支持**:效果取决于 Tree-sitter 语言支持
工作原理[](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86 "工作原理的直接链接")
----------------------------------------------------------------------------------------------------------------------------------------
当调用 `codebase_search` 工具时,它会遵循以下过程:
1. **可用性验证**:
* 验证 CodeIndexManager 是否可用并已初始化
* 确认设置中已启用代码库索引
* 检查索引是否正确配置(API 密钥、Qdrant URL)
* 验证当前索引状态是否允许搜索
2. **查询处理**:
* 获取你的自然语言查询并生成嵌入向量
* 使用为索引配置的相同嵌入提供程序(OpenAI 或 Ollama)
* 将查询的语义转换为数学表示
3. **向量搜索执行**:
* 在 Qdrant 向量数据库中搜索相似的代码嵌入
* 使用余弦相似度查找最相关的代码块
* 应用最小相似度阈值(0.4)以过滤结果
* 将结果限制为 50 个匹配项以优化性能
4. **路径过滤**(如果指定):
* 过滤结果,仅包括指定目录路径中的文件
* 使用标准化路径比较以进行准确过滤
* 在过滤范围内保持相关性排序
5. **结果处理和格式化**:
* 将绝对文件路径转换为工作区相对路径
* 使用文件路径、行范围、相似度分数和代码内容构建结果
* 格式化为 AI 使用和 UI 显示,并带有语法高亮
6. **双重输出格式**:
* **AI 输出**:结构化文本格式,包含查询、文件路径、分数和代码块
* **UI 输出**:JSON 格式,带有语法高亮和导航功能
搜索查询最佳实践[](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E6%90%9C%E7%B4%A2%E6%9F%A5%E8%AF%A2%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5 "搜索查询最佳实践的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
### 有效查询模式[](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E6%9C%89%E6%95%88%E6%9F%A5%E8%AF%A2%E6%A8%A1%E5%BC%8F "有效查询模式的直接链接")
**良好:概念性和具体性**
用户身份验证和密码验证
**良好:功能导向**
数据库连接池设置
**良好:问题导向**
API 请求的错误处理
**效果较差:过于通用**
函数
### 适用查询类型[](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E9%80%82%E7%94%A8%E6%9F%A5%E8%AF%A2%E7%B1%BB%E5%9E%8B "适用查询类型的直接链接")
* **功能描述**:"文件上传处理","电子邮件验证逻辑"
* **技术模式**:"单例模式实现","工厂方法使用"
* **领域概念**:"用户档案管理","支付处理流程"
* **架构组件**:"中间件配置","数据库迁移脚本"
目录范围限定[](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E7%9B%AE%E5%BD%95%E8%8C%83%E5%9B%B4%E9%99%90%E5%AE%9A "目录范围限定的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------------------------------
使用可选的 `path` 参数将搜索范围限定在代码库的特定部分:
**在 API 模块中搜索:**
端点验证中间件src/api
**在测试文件中搜索:**
模拟数据设置模式tests
**在特定功能目录中搜索:**
组件状态管理src/components/auth
结果解释[](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E7%BB%93%E6%9E%9C%E8%A7%A3%E9%87%8A "结果解释的直接链接")
----------------------------------------------------------------------------------------------------------------------------------------
### 相似度分数[](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E7%9B%B8%E4%BC%BC%E5%BA%A6%E5%88%86%E6%95%B0 "相似度分数的直接链接")
* **0.8-1.0**:高度相关匹配,很可能是你要找的内容
* **0.6-0.8**:良好匹配,具有强概念相似性
* **0.4-0.6**:可能相关,但可能需要审查
* **低于 0.4**:作为太不相关而被过滤掉
### 结果结构[](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E7%BB%93%E6%9E%9C%E7%BB%93%E6%9E%84 "结果结构的直接链接")
每个搜索结果包括:
* **文件路径**:包含匹配项的文件的工作区相对路径
* **分数**:表示相关性的相似度分数(0.4-1.0)
* **行范围**:代码块的起始和结束行号
* **代码块**:与查询匹配的实际代码内容
使用示例[](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B "使用示例的直接链接")
----------------------------------------------------------------------------------------------------------------------------------------
当 Kilo Code 实现新功能时,搜索 "身份验证中间件" 以在编写新代码之前了解现有模式。 当调试问题时,Kilo Code 搜索 "API 调用中的错误处理" 以查找代码库中相关的错误模式。 当重构代码时,Kilo Code 搜索 "数据库事务模式" 以确保所有数据库操作的一致性。 当加入新代码库时,Kilo Code 搜索 "配置加载" 以了解应用程序如何引导。
使用示例[](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B-1 "使用示例的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------
在整个项目中搜索与身份验证相关的代码:
用户登录和身份验证逻辑
在特定目录中查找与数据库相关的代码:
数据库连接和查询执行src/data
在 API 代码中查找错误处理模式:
HTTP 错误响应和异常处理src/api
搜索测试工具和模拟设置:
测试设置和模拟数据创建tests
查找配置和环境设置代码:
环境变量和应用程序配置
* [参数](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E5%8F%82%E6%95%B0)
* [功能](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E5%8A%9F%E8%83%BD)
* [使用场景](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF)
* [主要特性](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E4%B8%BB%E8%A6%81%E7%89%B9%E6%80%A7)
* [要求](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E8%A6%81%E6%B1%82)
* [限制](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E9%99%90%E5%88%B6)
* [工作原理](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86)
* [搜索查询最佳实践](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E6%90%9C%E7%B4%A2%E6%9F%A5%E8%AF%A2%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5)
* [有效查询模式](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E6%9C%89%E6%95%88%E6%9F%A5%E8%AF%A2%E6%A8%A1%E5%BC%8F)
* [适用查询类型](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E9%80%82%E7%94%A8%E6%9F%A5%E8%AF%A2%E7%B1%BB%E5%9E%8B)
* [目录范围限定](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E7%9B%AE%E5%BD%95%E8%8C%83%E5%9B%B4%E9%99%90%E5%AE%9A)
* [结果解释](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E7%BB%93%E6%9E%9C%E8%A7%A3%E9%87%8A)
* [相似度分数](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E7%9B%B8%E4%BC%BC%E5%BA%A6%E5%88%86%E6%95%B0)
* [结果结构](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E7%BB%93%E6%9E%9C%E7%BB%93%E6%9E%84)
* [使用示例](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B)
* [使用示例](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B-1)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fadvanced-usage%2Favailable-tools%2Fcodebase-search)
---
# 处理大型项目 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/advanced-usage/large-projects#__docusaurus_skipToContent_fallback)
本页总览
Kilo Code 可以用于任何规模的项目,但处理大型项目时需要特别注意上下文管理。以下是一些处理大型代码库的技巧:
理解上下文限制[](https://kilocode.ai/docs/zh-CN/advanced-usage/large-projects#%E7%90%86%E8%A7%A3%E4%B8%8A%E4%B8%8B%E6%96%87%E9%99%90%E5%88%B6 "理解上下文限制的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------------------------
Kilo Code 使用的大语言模型 (LLMs) 有一个有限的 "上下文窗口"。这是模型一次可以处理的文本的最大量(以 token 为单位)。如果上下文过大,模型可能无法理解你的请求或生成准确的响应。
上下文窗口包括:
* 系统提示(Kilo Code 的指令)。
* 对话历史记录。
* 你使用 `@` 提到的任何文件内容。
* Kilo Code 使用的任何命令或工具的输出。
管理上下文的策略[](https://kilocode.ai/docs/zh-CN/advanced-usage/large-projects#%E7%AE%A1%E7%90%86%E4%B8%8A%E4%B8%8B%E6%96%87%E7%9A%84%E7%AD%96%E7%95%A5 "管理上下文的策略的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
1. **具体化:** 当引用文件或代码时,使用具体的文件路径和函数名称。避免使用模糊的引用,如 "主文件"。
2. **有效使用上下文提及:** 使用 `@/path/to/file.ts` 来包含特定文件。使用 `@problems` 来包含当前错误和警告。使用 `@` 后跟提交哈希来引用特定的 Git 提交。
3. **分解任务:** 将大型任务分解为更小、更易管理的子任务。这有助于保持上下文的聚焦。
4. **总结:** 如果需要引用大量代码,考虑在提示中总结相关部分,而不是包含整个代码。
5. **优先处理最近的历史记录:** Kilo Code 会自动截断对话历史记录中的旧消息,以保持在上下文窗口内。请注意这一点,并在需要时重新包含重要上下文。
6. **使用提示缓存(如果可用):** 一些 API 提供商如 Anthropic、OpenAI、OpenRouter 和 Requesty 支持 "提示缓存"。这将缓存你的提示以供未来任务使用,有助于降低请求的成本和延迟。
示例:重构大型文件[](https://kilocode.ai/docs/zh-CN/advanced-usage/large-projects#%E7%A4%BA%E4%BE%8B%E9%87%8D%E6%9E%84%E5%A4%A7%E5%9E%8B%E6%96%87%E4%BB%B6 "示例:重构大型文件的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
假设你需要重构一个大型 TypeScript 文件 (`src/components/MyComponent.tsx`)。以下是一个可能的方法:
1. **初始概览:**
@/src/components/MyComponent.tsx 列出此文件中的函数和类。
2. **定位特定函数:**
@/src/components/MyComponent.tsx 将 `processData` 函数重构为使用 `async/await` 而不是 Promises。
3. **迭代更改:** 进行小的、增量的更改,审查并批准每一步。
通过分解任务并提供具体的上下文,即使在上下文窗口有限的情况下,你也可以有效地处理大型文件。
* [理解上下文限制](https://kilocode.ai/docs/zh-CN/advanced-usage/large-projects#%E7%90%86%E8%A7%A3%E4%B8%8A%E4%B8%8B%E6%96%87%E9%99%90%E5%88%B6)
* [管理上下文的策略](https://kilocode.ai/docs/zh-CN/advanced-usage/large-projects#%E7%AE%A1%E7%90%86%E4%B8%8A%E4%B8%8B%E6%96%87%E7%9A%84%E7%AD%96%E7%95%A5)
* [示例:重构大型文件](https://kilocode.ai/docs/zh-CN/advanced-usage/large-projects#%E7%A4%BA%E4%BE%8B%E9%87%8D%E6%9E%84%E5%A4%A7%E5%9E%8B%E6%96%87%E4%BB%B6)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fadvanced-usage%2Flarge-projects)
---
# 自定义规则 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#__docusaurus_skipToContent_fallback)
本页总览
自定义规则提供了一种强大的方式来定义项目特定的行为和约束,以确保 Kilo Code AI 代理的一致性。通过自定义规则,你可以确保格式一致、限制对敏感文件的访问、强制执行编码标准,并根据你的项目需求自定义 AI 的行为。
概述[](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E6%A6%82%E8%BF%B0 "概述的直接链接")
-----------------------------------------------------------------------------------------------
自定义规则允许你创建基于文本的指令,所有 AI 模型在与你的项目交互时都会遵循这些规则。这些规则充当护栏和约定,确保与代码库的所有交互都保持一致。
自定义规则与指令的区别
自定义规则是项目特定的,允许你设置基于工作区的规则集。对于 IDE 范围的配置,[自定义指令](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-instructions)
将是更好的选择,因为它们会保持你的偏好,无论你正在处理哪个项目。
规则格式[](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E8%A7%84%E5%88%99%E6%A0%BC%E5%BC%8F "规则格式的直接链接")
---------------------------------------------------------------------------------------------------------------------
自定义规则可以用纯文本编写,但建议使用 Markdown 格式,以便更好地组织和让 AI 模型理解。Markdown 的结构化特性有助于模型更有效地解析和理解你的规则。
* 使用 Markdown 标题(`#`, `##` 等)定义规则类别
* 使用列表(`-`, `*`)枚举特定项目或约束
* 使用代码块( )在需要时包含代码示例
规则位置[](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E8%A7%84%E5%88%99%E4%BD%8D%E7%BD%AE "规则位置的直接链接")
---------------------------------------------------------------------------------------------------------------------
自定义规则主要从 **`.kilocode/rules/` 目录** 加载。这是组织项目特定规则的推荐方法。每个规则通常放置在具有描述性名称的 Markdown 文件中:
project/├── .kilocode/│ ├── rules/│ │ ├── formatting.md│ │ ├── restricted_files.md│ │ └── naming_conventions.md├── src/└── ...
规则加载顺序[](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E8%A7%84%E5%88%99%E5%8A%A0%E8%BD%BD%E9%A1%BA%E5%BA%8F "规则加载顺序的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------------
### 通用规则(所有模式)[](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E9%80%9A%E7%94%A8%E8%A7%84%E5%88%99%E6%89%80%E6%9C%89%E6%A8%A1%E5%BC%8F "通用规则(所有模式)的直接链接")
为了向后兼容,如果没有找到规则文件夹,代理将检查其他位置。
加载顺序如下:
1. 首先尝试从 `.kilocode/rules/` 目录加载
2. 如果该目录不存在或为空,则回退检查以下文件:
* `.roorules`
* `.clinerules`
* `.kilocoderules`(已弃用)
代理使用找到的第一个包含内容的来源。例如,如果找到了包含内容的 `.roorules`,则不会读取 `.clinerules`。
备注
我们强烈建议将规则保留在 `.kilocode/rules/` 文件夹中,因为它提供了更好的组织,并且是未来版本的首选方法。基于文件夹的结构允许更细粒度的规则组织和更清晰的关注点分离。基于文件的旧方法为了向后兼容而保留,但可能会在未来的版本中发生变化。
### 模式特定规则[](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E6%A8%A1%E5%BC%8F%E7%89%B9%E5%AE%9A%E8%A7%84%E5%88%99 "模式特定规则的直接链接")
此外,系统支持模式特定的规则,这些规则会单独加载,并有自己的优先级顺序:
1. 首先检查 `.kilocode/rules-${mode}/` 目录
2. 如果该目录不存在或为空,则回退到 `.kilocoderules-${mode}` 文件(已弃用)
当通用规则和模式特定规则同时存在时,模式特定规则在最终输出中具有优先权。
创建自定义规则[](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E5%88%9B%E5%BB%BA%E8%87%AA%E5%AE%9A%E4%B9%89%E8%A7%84%E5%88%99 "创建自定义规则的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------------------
要创建自定义规则:
1. 如果不存在,请创建 `.kilocode/rules/` 目录
2. 在此目录中创建一个具有描述性名称的新 Markdown 文件
3. 使用 Markdown 格式编写你的规则
4. 保存文件
该规则将自动应用于你项目中所有未来的 Kilo Code 交互。任何新更改都会立即生效。
规则示例[](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E8%A7%84%E5%88%99%E7%A4%BA%E4%BE%8B "规则示例的直接链接")
---------------------------------------------------------------------------------------------------------------------
### 示例 1:表格格式化[](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E7%A4%BA%E4%BE%8B-1%E8%A1%A8%E6%A0%BC%E6%A0%BC%E5%BC%8F%E5%8C%96 "示例 1:表格格式化的直接链接")
# 表格打印表格时,始终在每列标题中添加感叹号
这个简单的规则指示 AI 在生成表格时在所有列标题中添加感叹号。
### 示例 2:限制文件访问[](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E7%A4%BA%E4%BE%8B-2%E9%99%90%E5%88%B6%E6%96%87%E4%BB%B6%E8%AE%BF%E9%97%AE "示例 2:限制文件访问的直接链接")
# 受限文件列表中包含敏感数据的文件,禁止读取- supersecrets.txt- credentials.json- .env
此规则防止 AI 读取或访问敏感文件,即使明确要求这样做。

使用场景[](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF "使用场景的直接链接")
---------------------------------------------------------------------------------------------------------------------
自定义规则可以应用于各种场景:
* **代码风格**:强制执行一致的格式、命名约定和文档风格
* **安全控制**:防止访问敏感文件或目录
* **项目结构**:定义不同类型文件的创建位置
* **文档要求**:指定文档格式和要求
* **测试模式**:定义测试的结构方式
* **API 使用**:指定 API 的使用和文档方式
* **错误处理**:定义错误处理约定
自定义规则示例[](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E8%87%AA%E5%AE%9A%E4%B9%89%E8%A7%84%E5%88%99%E7%A4%BA%E4%BE%8B "自定义规则示例的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------------------
* "严格遵守代码风格指南 \[你的项目特定代码风格指南\]"
* "始终使用空格缩进,宽度为 4 个空格"
* "使用 camelCase 命名变量"
* "为所有新函数编写单元测试"
* "在提供代码之前解释你的推理"
* "专注于代码的可读性和可维护性"
* "优先使用社区中最常见的库"
* "当为网站添加新功能时,确保它们是响应式且可访问的"
最佳实践[](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5 "最佳实践的直接链接")
---------------------------------------------------------------------------------------------------------------------
* **具体明确**:明确定义每个规则的范围和意图
* **使用类别**:将相关规则组织在共同的标题下
* **分离关注点**:为不同类型的规则使用不同的文件
* **使用示例**:包含示例以说明预期行为
* **保持简单**:规则应简洁易懂
* **定期更新**:随着项目需求的变化,定期审查和更新规则
专业提示:基于文件的团队标准
在团队环境中工作时,将 `.kilocode/rules/codestyle.md` 文件置于版本控制之下,可以让你在整个开发团队中标准化 Kilo 的行为。这确保了项目中的每个人都有一致的代码风格、文档实践和开发工作流程。
限制[](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E9%99%90%E5%88%B6 "限制的直接链接")
-----------------------------------------------------------------------------------------------
* 规则由 AI 模型尽力而为地应用
* 复杂规则可能需要多个示例才能清晰理解
* 规则仅适用于定义它们的项目
故障排除[](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E6%95%85%E9%9A%9C%E6%8E%92%E9%99%A4 "故障排除的直接链接")
---------------------------------------------------------------------------------------------------------------------
如果你的自定义规则未被正确遵循:
1. 检查你的规则是否使用清晰的 Markdown 结构正确格式化
2. 确保你的规则位于以下支持的位置之一:
* 推荐的 `.kilocode/rules/` 目录
* 根级规则文件(`.kilocoderules`, `.roorules`, 或 `.clinerules`)
3. 验证规则是否具体且明确
4. 重启 VS Code 以确保规则正确加载
相关功能[](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E7%9B%B8%E5%85%B3%E5%8A%9F%E8%83%BD "相关功能的直接链接")
---------------------------------------------------------------------------------------------------------------------
* [自定义模式](https://kilocode.ai/docs/zh-CN/features/custom-modes)
* [自定义指令](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-instructions)
* [设置管理](https://kilocode.ai/docs/zh-CN/features/settings-management)
* [自动批准设置](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions)
* [概述](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E6%A6%82%E8%BF%B0)
* [规则格式](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E8%A7%84%E5%88%99%E6%A0%BC%E5%BC%8F)
* [规则位置](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E8%A7%84%E5%88%99%E4%BD%8D%E7%BD%AE)
* [规则加载顺序](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E8%A7%84%E5%88%99%E5%8A%A0%E8%BD%BD%E9%A1%BA%E5%BA%8F)
* [通用规则(所有模式)](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E9%80%9A%E7%94%A8%E8%A7%84%E5%88%99%E6%89%80%E6%9C%89%E6%A8%A1%E5%BC%8F)
* [模式特定规则](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E6%A8%A1%E5%BC%8F%E7%89%B9%E5%AE%9A%E8%A7%84%E5%88%99)
* [创建自定义规则](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E5%88%9B%E5%BB%BA%E8%87%AA%E5%AE%9A%E4%B9%89%E8%A7%84%E5%88%99)
* [规则示例](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E8%A7%84%E5%88%99%E7%A4%BA%E4%BE%8B)
* [示例 1:表格格式化](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E7%A4%BA%E4%BE%8B-1%E8%A1%A8%E6%A0%BC%E6%A0%BC%E5%BC%8F%E5%8C%96)
* [示例 2:限制文件访问](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E7%A4%BA%E4%BE%8B-2%E9%99%90%E5%88%B6%E6%96%87%E4%BB%B6%E8%AE%BF%E9%97%AE)
* [使用场景](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF)
* [自定义规则示例](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E8%87%AA%E5%AE%9A%E4%B9%89%E8%A7%84%E5%88%99%E7%A4%BA%E4%BE%8B)
* [最佳实践](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5)
* [限制](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E9%99%90%E5%88%B6)
* [故障排除](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E6%95%85%E9%9A%9C%E6%8E%92%E9%99%A4)
* [相关功能](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules#%E7%9B%B8%E5%85%B3%E5%8A%9F%E8%83%BD)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fadvanced-usage%2Fcustom-rules)
---
# 使用本地模型 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/advanced-usage/local-models#__docusaurus_skipToContent_fallback)
本页总览
Kilo Code 支持使用 [Ollama](https://ollama.com/)
和 [LM Studio](https://lmstudio.ai/)
在本地计算机上运行语言模型。这提供了以下优势:
* **隐私性**:你的代码和数据永远不会离开你的计算机。
* **离线访问**:即使没有互联网连接,你也可以使用 Kilo Code。
* **成本节约**:避免与云端模型相关的 API 使用费用。
* **定制性**:可以尝试不同的模型和配置。
**然而,使用本地模型也有一些缺点:**
* **资源需求**:本地模型可能对资源要求较高,需要一台性能强大的计算机,最好配备专用 GPU。
* **设置复杂性**:设置本地模型可能比使用云端 API 更复杂。
* **模型性能**:本地模型的性能可能差异较大。虽然有些模型表现优秀,但可能无法与最大、最先进的云端模型相媲美。
* **功能限制**:本地模型(以及许多在线模型)通常不支持高级功能,例如提示缓存、计算机使用等。
支持的本地模型提供商[](https://kilocode.ai/docs/zh-CN/advanced-usage/local-models#%E6%94%AF%E6%8C%81%E7%9A%84%E6%9C%AC%E5%9C%B0%E6%A8%A1%E5%9E%8B%E6%8F%90%E4%BE%9B%E5%95%86 "支持的本地模型提供商的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Kilo Code 目前支持两个主要的本地模型提供商:
1. **Ollama**:一个流行的开源工具,用于在本地运行大型语言模型。它支持多种模型。
2. **LM Studio**:一个用户友好的桌面应用程序,简化了下载、配置和运行本地模型的过程。它还提供了一个模拟 OpenAI API 的本地服务器。
设置本地模型[](https://kilocode.ai/docs/zh-CN/advanced-usage/local-models#%E8%AE%BE%E7%BD%AE%E6%9C%AC%E5%9C%B0%E6%A8%A1%E5%9E%8B "设置本地模型的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------------
有关详细设置说明,请参阅:
* [设置 Ollama](https://kilocode.ai/docs/zh-CN/providers/ollama)
* [设置 LM Studio](https://kilocode.ai/docs/zh-CN/providers/lmstudio)
这两个提供商提供类似的功能,但用户界面和工作流程不同。Ollama 通过命令行界面提供更多控制,而 LM Studio 提供了一个更友好的图形界面。
故障排除[](https://kilocode.ai/docs/zh-CN/advanced-usage/local-models#%E6%95%85%E9%9A%9C%E6%8E%92%E9%99%A4 "故障排除的直接链接")
---------------------------------------------------------------------------------------------------------------------
* **“由于目标计算机主动拒绝,无法建立连接”**:这通常意味着 Ollama 或 LM Studio 服务器未运行,或者 Kilo Code 配置的端口/地址与服务器不一致。请仔细检查 Base URL 设置。
* **响应时间慢**:本地模型可能比云端模型慢,尤其是在硬件性能较低的情况下。如果遇到性能问题,请尝试使用较小的模型。
* **找不到模型**:请确保你正确输入了模型名称。如果使用 Ollama,请使用与 `ollama run` 命令中相同的名称。
* [支持的本地模型提供商](https://kilocode.ai/docs/zh-CN/advanced-usage/local-models#%E6%94%AF%E6%8C%81%E7%9A%84%E6%9C%AC%E5%9C%B0%E6%A8%A1%E5%9E%8B%E6%8F%90%E4%BE%9B%E5%95%86)
* [设置本地模型](https://kilocode.ai/docs/zh-CN/advanced-usage/local-models#%E8%AE%BE%E7%BD%AE%E6%9C%AC%E5%9C%B0%E6%A8%A1%E5%9E%8B)
* [故障排除](https://kilocode.ai/docs/zh-CN/advanced-usage/local-models#%E6%95%85%E9%9A%9C%E6%8E%92%E9%99%A4)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fadvanced-usage%2Flocal-models)
---
# Prompt Engineering 技巧 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/advanced-usage/prompt-engineering#__docusaurus_skipToContent_fallback)
本页总览
Prompt engineering 是为 AI 模型(如 Kilo Code)编写有效指令的艺术。精心编写的提示可以带来更好的结果、更少的错误和更高的工作效率。
通用原则[](https://kilocode.ai/docs/zh-CN/advanced-usage/prompt-engineering#%E9%80%9A%E7%94%A8%E5%8E%9F%E5%88%99 "通用原则的直接链接")
---------------------------------------------------------------------------------------------------------------------------
* **清晰且具体:** 清楚地说明你希望 Kilo Code 做什么。避免歧义。
* **不好:** 修复代码。
* **好:** 修复 `calculateTotal` 函数中导致返回错误结果的 bug。
* **提供上下文:** 使用 [上下文提及](https://kilocode.ai/docs/zh-CN/basic-usage/context-mentions)
来引用特定文件、文件夹或问题。
* **好:** `@/src/utils.ts` 重构 `calculateTotal` 函数以使用 async/await。
* **分解任务:** 将复杂的任务分解为更小、定义明确的步骤。
* **提供示例:** 如果你有特定的编码风格或模式,请提供示例。
* **指定输出格式:** 如果你需要特定格式的输出(例如 JSON、Markdown),请在提示中指定。
* **迭代:** 如果初始结果不符合预期,不要害怕优化你的提示。
思考与执行[](https://kilocode.ai/docs/zh-CN/advanced-usage/prompt-engineering#%E6%80%9D%E8%80%83%E4%B8%8E%E6%89%A7%E8%A1%8C "思考与执行的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------
引导 Kilo Code 通过“先思考后执行”的过程通常很有帮助:
1. **分析:** 让 Kilo Code 分析当前代码,识别问题或规划方法。
2. **计划:** 让 Kilo Code 概述完成任务的步骤。
3. **执行:** 指示 Kilo Code 一步一步地执行计划。
4. **审查:** 在继续之前仔细审查每一步的结果。
使用自定义指令[](https://kilocode.ai/docs/zh-CN/advanced-usage/prompt-engineering#%E4%BD%BF%E7%94%A8%E8%87%AA%E5%AE%9A%E4%B9%89%E6%8C%87%E4%BB%A4 "使用自定义指令的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------------------------
你可以提供自定义指令来进一步调整 Kilo Code 的行为。有两种类型的自定义指令:
* **全局自定义指令:** 适用于所有模式。
* **模式特定自定义指令:** 仅适用于特定模式(例如 Code、Architect、Ask、Debug 或自定义模式)。
自定义指令会添加到系统提示中,为 AI 模型提供持续的指导。你可以使用这些指令来:
* 强制执行编码风格指南。
* 指定首选的库或框架。
* 定义项目特定的约定。
* 调整 Kilo Code 的语气或个性。
有关更多详细信息,请参阅 [自定义指令](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-instructions)
部分。
处理歧义[](https://kilocode.ai/docs/zh-CN/advanced-usage/prompt-engineering#%E5%A4%84%E7%90%86%E6%AD%A7%E4%B9%89 "处理歧义的直接链接")
---------------------------------------------------------------------------------------------------------------------------
如果你的请求含糊不清或缺乏足够的细节,Kilo Code 可能会:
* **做出假设:** 它可能会根据最佳猜测继续,这可能不是你想要的。
* **询问后续问题:** 它可能会使用 `ask_followup_question` 工具来澄清你的请求。
最好从一开始就提供清晰且具体的指令,以避免不必要的来回沟通。
提供反馈[](https://kilocode.ai/docs/zh-CN/advanced-usage/prompt-engineering#%E6%8F%90%E4%BE%9B%E5%8F%8D%E9%A6%88 "提供反馈的直接链接")
---------------------------------------------------------------------------------------------------------------------------
如果 Kilo Code 没有产生预期的结果,你可以通过以下方式提供反馈:
* **拒绝操作:** 当 Kilo Code 提出你不想要的操作时,点击“拒绝”按钮。
* **提供解释:** 拒绝时,解释_为什么_要拒绝该操作。这有助于 Kilo Code 从错误中学习。
* **重新措辞你的请求:** 尝试重新表述你的初始任务或提供更具体的指令。
* **手动更正:** 如果有几个小问题,你也可以在接受更改之前直接修改代码。
示例[](https://kilocode.ai/docs/zh-CN/advanced-usage/prompt-engineering#%E7%A4%BA%E4%BE%8B "示例的直接链接")
-----------------------------------------------------------------------------------------------------
**好提示:**
> `@/src/components/Button.tsx` 重构 `Button` 组件以使用 `useState` 钩子而不是 `useReducer` 钩子。
**不好提示:**
> 修复按钮。
**好提示:**
> 创建一个名为 `utils.py` 的新文件,并添加一个名为 `calculate_average` 的函数,该函数接受一个数字列表并返回它们的平均值。
**不好提示:**
> 写一些 Python 代码。
**好提示:**
> `@problems` 解决当前文件中的所有错误和警告。
**不好提示:**
> 修复所有问题。
通过遵循这些技巧,你可以编写有效的提示,充分利用 Kilo Code 的能力。
* [通用原则](https://kilocode.ai/docs/zh-CN/advanced-usage/prompt-engineering#%E9%80%9A%E7%94%A8%E5%8E%9F%E5%88%99)
* [思考与执行](https://kilocode.ai/docs/zh-CN/advanced-usage/prompt-engineering#%E6%80%9D%E8%80%83%E4%B8%8E%E6%89%A7%E8%A1%8C)
* [使用自定义指令](https://kilocode.ai/docs/zh-CN/advanced-usage/prompt-engineering#%E4%BD%BF%E7%94%A8%E8%87%AA%E5%AE%9A%E4%B9%89%E6%8C%87%E4%BB%A4)
* [处理歧义](https://kilocode.ai/docs/zh-CN/advanced-usage/prompt-engineering#%E5%A4%84%E7%90%86%E6%AD%A7%E4%B9%89)
* [提供反馈](https://kilocode.ai/docs/zh-CN/advanced-usage/prompt-engineering#%E6%8F%90%E4%BE%9B%E5%8F%8D%E9%A6%88)
* [示例](https://kilocode.ai/docs/zh-CN/advanced-usage/prompt-engineering#%E7%A4%BA%E4%BE%8B)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fadvanced-usage%2Fprompt-engineering)
---
# Memory Bank | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#__docusaurus_skipToContent_fallback)
本页总览
概述[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E6%A6%82%E8%BF%B0 "概述的直接链接")
----------------------------------------------------------------------------------------------

启用 Memory Bank 后,Kilo Code 可以更高效地工作,立即理解项目上下文和技术栈。
### 问题:AI 记忆丢失[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E9%97%AE%E9%A2%98ai-%E8%AE%B0%E5%BF%86%E4%B8%A2%E5%A4%B1 "问题:AI 记忆丢失的直接链接")
像 Kilo Code 这样的 AI 助手面临一个根本性的限制:它们会在会话之间完全重置。这种“记忆丢失”意味着每次开始新的对话时,都需要重新解释项目的架构、目标、技术和当前状态。这造成了一个关键效率困境:AI 模型要么在没有正确理解项目的情况下进行编辑(导致错误和解决方案不一致),要么必须在每个会话中花费大量时间和资源分析整个代码库(对于大型项目来说,这既昂贵又缓慢)。
如果没有解决这个记忆问题,AI 助手仍然是强大但无状态的工具,无法真正作为持续的开发伙伴。
### 解决方案:Memory Bank[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88memory-bank "解决方案:Memory Bank的直接链接")
Memory Bank 是一个结构化文档系统,使 Kilo Code 能够**更好地理解你的项目**并**在编码会话之间保持上下文**。它将你的 AI 助手从无状态工具转变为具有完美项目记忆的持续开发伙伴。Kilo Code 会在每次开始新会话时自动读取你的 Memory Bank 文件,以重建对项目的理解。
当 Memory Bank 处于活动状态时,Kilo Code 会在每个任务的开始处显示 `[Memory Bank: Active]`,并简要总结你的项目上下文,确保在不重复解释的情况下保持一致性。
主要优点[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E4%B8%BB%E8%A6%81%E4%BC%98%E7%82%B9 "主要优点的直接链接")
--------------------------------------------------------------------------------------------------------------------
* **语言无关**:适用于任何编程语言或框架
* **高效的项目理解**:帮助 Kilo Code 理解项目的用途和技术栈
* **上下文保留**:在会话之间维护项目知识,而无需在每个新会话中扫描文件
* **更快的启动**:Kilo Code 在开始新会话时立即理解你的项目上下文
* **自我记录项目**:作为副产品创建有价值的文档
Memory Bank 的工作原理[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#memory-bank-%E7%9A%84%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86 "Memory Bank 的工作原理的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Memory Bank 基于 Kilo Code 的 [自定义规则](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-rules)
功能构建,为项目文档提供了一个专门的框架。Memory Bank 文件是存储在项目仓库 `.kilocode/rules/memory-bank` 文件夹中的标准 Markdown 文件。它们不是隐藏或专有的——它们是你和 Kilo Code 都可以访问的常规文档文件。
在每个任务开始时,Kilo Code 会读取所有 Memory Bank 文件,以构建对项目的全面理解。这是自动进行的,不需要你采取任何操作。Kilo Code 然后会在其响应的开头显示 `[Memory Bank: Active]`,表示 Memory Bank 已成功激活,并简要总结其对项目的理解。
文件按层次结构组织,构建项目的完整视图:
核心 Memory Bank 文件[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E6%A0%B8%E5%BF%83-memory-bank-%E6%96%87%E4%BB%B6 "核心 Memory Bank 文件的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------------------------------
### brief.md[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#briefmd "brief.md的直接链接")
_此文件由你手动创建和维护_
* 项目的基础
* 项目的高级概述
* 核心需求和目标
示例:_"构建一个带有条形码扫描功能的 React 库存管理系统。该系统需要支持多个仓库并与我们现有的 ERP 系统集成。"_
注意:Kilo Code 不会直接编辑此文件,但如果发现可以改进项目摘要的方式,可能会提出建议。
### product.md[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#productmd "product.md的直接链接")
* 解释项目存在的原因
* 描述正在解决的问题
* 概述产品应如何工作
* 用户体验目标
示例:_"库存系统需要支持多个仓库和实时更新。它通过提供条形码扫描来解决库存差异问题,确保准确的库存计数。"_
### context.md[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#contextmd "context.md的直接链接")
* 更新最频繁的文件
* 包含当前工作重点和最近的变化
* 跟踪活动决策和考虑事项
* 开发的下一步
示例:_"当前正在实施条形码扫描组件;上次会话完成了 API 集成。下一步包括为网络故障添加错误处理。"_
### architecture.md[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#architecturemd "architecture.md的直接链接")
* 记录系统架构
* 记录关键技术决策
* 列出正在使用的设计模式
* 解释组件关系
* 关键实现路径
示例:_"使用 Redux 进行状态管理,采用规范化的存储结构。应用程序遵循模块化架构,API 通信、状态管理和 UI 组件分别位于不同的服务中。"_
### tech.md[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#techmd "tech.md的直接链接")
* 列出使用的技术和框架
* 描述开发设置
* 记录技术约束
* 记录依赖项和工具配置
* 工具使用模式
示例:_"React 18、TypeScript、Firebase、Jest 用于测试。开发需要 Node.js 16+ 并使用 Vite 作为构建工具。"_
其他上下文文件[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E5%85%B6%E4%BB%96%E4%B8%8A%E4%B8%8B%E6%96%87%E6%96%87%E4%BB%B6 "其他上下文文件的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------------------------
根据需要创建其他文件以组织:
* 复杂功能文档
* 集成规范
* API 文档
* 测试策略
* 部署程序
这些附加文件有助于组织不适合核心文件的更详细信息。
### tasks.md[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#tasksmd "tasks.md的直接链接")
_用于记录重复任务的可选文件_
* 存储遵循类似模式的任务的工作流程
* 记录需要修改的文件
* 记录分步程序
* 记录重要的注意事项和陷阱
示例:添加对新 AI 模型的支持、实现 API 端点或任何需要重复执行类似工作的任务。
开始使用 Memory Bank[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E5%BC%80%E5%A7%8B%E4%BD%BF%E7%94%A8-memory-bank "开始使用 Memory Bank的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------------------------
### 首次设置[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E9%A6%96%E6%AC%A1%E8%AE%BE%E7%BD%AE "首次设置的直接链接")
1. 在项目中创建 `.kilocode/rules/memory-bank/` 文件夹
2. 在 `.kilocode/rules/memory-bank/brief.md` 中编写基本的项目摘要
3. 创建文件 `.kilocode/rules/memory-bank-instructions.md` 并将 [此文档](https://kilocode.ai/docs/zh-CN/downloads/memory-bank.md)
粘贴到其中
4. 切换到 `Architect` 模式
5. 检查是否选择了最佳可用的 AI 模型,不要使用“轻量级”模型
6. 要求 Kilo Code “initialize memory bank”
7. 等待 Kilo Code 分析你的项目并初始化 Memory Bank 文件
8. 验证文件内容,确保项目描述正确。如有必要,更新文件。
### 项目摘要提示[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E9%A1%B9%E7%9B%AE%E6%91%98%E8%A6%81%E6%8F%90%E7%A4%BA "项目摘要提示的直接链接")
* 从简单开始——它可以是你喜欢的任何详细程度或高级程度
* 专注于对你最重要的事情
* Kilo Code 将帮助填补空白并提出问题
* 你可以随着项目的发展更新它
提供合理摘要的示例提示:
提供此项目的简明而全面的描述,突出其主要目标、关键功能、使用的技术和重要性。然后,将此描述写入适当命名的文本文件中,以反映项目内容,确保写作的清晰性和专业性。保持简洁。
使用 Memory Bank[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E4%BD%BF%E7%94%A8-memory-bank "使用 Memory Bank的直接链接")
----------------------------------------------------------------------------------------------------------------------------------
### 核心工作流程[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E6%A0%B8%E5%BF%83%E5%B7%A5%E4%BD%9C%E6%B5%81%E7%A8%8B "核心工作流程的直接链接")
#### Memory Bank 初始化[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#memory-bank-%E5%88%9D%E5%A7%8B%E5%8C%96 "Memory Bank 初始化的直接链接")
初始化步骤至关重要,因为它为所有未来的项目交互奠定了基础。当你使用命令 `initialize memory bank` 请求初始化时,Kilo Code 将:
1. 对你的项目进行详尽的分析,包括:
* 所有源代码文件及其关系
* 配置文件和构建系统设置
* 项目结构和组织模式
* 文档和注释
* 依赖项和外部集成
* 测试框架和模式
2. 在 `.kilocode/rules/memory-bank` 文件夹中创建全面的 Memory Bank 文件
3. 提供对其对项目的理解的详细摘要
4. 要求你验证生成文件的准确性
重要
初始化后,请花时间仔细审查并更正生成的文件。此阶段的任何误解或缺失信息都会影响所有未来的交互。彻底的初始化将显著提高 Kilo Code 的有效性,而仓促或不完整的初始化将永久限制其有效协助你的能力。
#### Memory Bank 更新[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#memory-bank-%E6%9B%B4%E6%96%B0 "Memory Bank 更新的直接链接")
Memory Bank 更新发生在以下情况:
1. 发现新的项目模式
2. 实施重大更改后
3. 当你明确请求 `update memory bank` 时
4. 当上下文需要澄清时
要执行 Memory Bank 更新,Kilo Code 将:
1. 审查所有项目文件
2. 记录当前状态
3. 记录见解和模式
4. 根据需要更新所有 Memory Bank 文件
你可以使用类似 `update memory bank using information from @/Makefile` 的命令来指导 Kilo Code 专注于特定的信息源。
#### 常规任务执行[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E5%B8%B8%E8%A7%84%E4%BB%BB%E5%8A%A1%E6%89%A7%E8%A1%8C "常规任务执行的直接链接")
在每个任务开始时,Kilo Code:
1. 读取所有 Memory Bank 文件
2. 在其响应的开头包含 `[Memory Bank: Active]`
3. 提供其对项目理解的简要摘要
4. 继续执行请求的任务
在任务结束时,如果进行了重大更改,Kilo Code 可能会建议更新 Memory Bank,使用短语:“Would you like me to update memory bank to reflect these changes?”
#### 添加任务工作流程[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E6%B7%BB%E5%8A%A0%E4%BB%BB%E5%8A%A1%E5%B7%A5%E4%BD%9C%E6%B5%81%E7%A8%8B "添加任务工作流程的直接链接")
当你完成一个重复的任务时,你可以将其记录下来以备将来参考。这对于遵循现有模式添加功能等任务特别有用。
要记录任务,请使用命令 `add task` 或 `store this as a task`。Kilo Code 将:
1. 创建或更新 Memory Bank 文件夹中的 `tasks.md` 文件
2. 使用当前上下文记录任务:
* 任务名称和描述
* 需要修改的文件列表
* 分步工作流程
* 重要的注意事项
* 示例实现
当开始新任务时,Kilo Code 会检查它是否与任何记录的任务匹配,并遵循已建立的工作流程,以确保不会遗漏任何步骤。
### 关键命令[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E5%85%B3%E9%94%AE%E5%91%BD%E4%BB%A4 "关键命令的直接链接")
* `initialize memory bank` - 在开始新项目时使用
* `update memory bank` - 启动对当前任务的上下文文档的全面重新分析。\*\*注意:\*\*此操作资源密集,由于可能降低有效性,不建议用于“轻量级”模型。可以多次使用,可与特定指令很好地结合,例如 `update memory bank using information from @/Makefile`
* `add task` 或 `store this as a task` - 记录重复任务以备将来参考
### 状态指示器[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E7%8A%B6%E6%80%81%E6%8C%87%E7%A4%BA%E5%99%A8 "状态指示器的直接链接")
Kilo Code 使用状态指示器来清楚地传达 Memory Bank 状态:
* `[Memory Bank: Active]` - 表示 Memory Bank 文件已成功读取并正在使用
* `[Memory Bank: Missing]` - 表示找不到 Memory Bank 文件或文件为空
这些指示器出现在 Kilo Code 响应的开头,提供 Memory Bank 状态的即时确认。
### 文档更新[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E6%96%87%E6%A1%A3%E6%9B%B4%E6%96%B0 "文档更新的直接链接")
Memory Bank 更新应自动发生在以下情况:
* 发现新的项目模式
* 实施重大更改后
* 当你明确请求 `update memory bank` 时
* 当上下文需要澄清时
上下文窗口管理[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E4%B8%8A%E4%B8%8B%E6%96%87%E7%AA%97%E5%8F%A3%E7%AE%A1%E7%90%86 "上下文窗口管理的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------------------------
当你与 Kilo Code 一起工作时,你的上下文窗口最终会填满。当你注意到响应速度变慢或引用变得不那么准确时:
1. 要求 Kilo Code “update memory bank” 以记录当前状态
2. 开始新的对话/任务
3. Kilo Code 将在新对话中自动访问你的 Memory Bank
此过程确保在多个会话之间保持连续性,而不会丢失重要上下文。
处理不一致[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E5%A4%84%E7%90%86%E4%B8%8D%E4%B8%80%E8%87%B4 "处理不一致的直接链接")
-------------------------------------------------------------------------------------------------------------------------------
如果 Kilo Code 检测到 Memory Bank 文件之间的不一致:
1. 它将优先考虑 `brief.md` 中的信息作为真相来源
2. 向你指出任何不一致之处
3. 继续使用最可靠的信息
这确保即使文档不完美,Kilo Code 仍然可以有效地工作。
常见问题解答[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98%E8%A7%A3%E7%AD%94 "常见问题解答的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------
### Memory Bank 文件存储在哪里?[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#memory-bank-%E6%96%87%E4%BB%B6%E5%AD%98%E5%82%A8%E5%9C%A8%E5%93%AA%E9%87%8C "Memory Bank 文件存储在哪里?的直接链接")
Memory Bank 文件是存储在项目仓库中的常规 Markdown 文件,通常在 `.kilocode/rules/memory-bank/` 文件夹中。它们不是隐藏的系统文件——它们旨在成为项目文档的一部分。
### 我应该多久更新一次 Memory Bank?[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E6%88%91%E5%BA%94%E8%AF%A5%E5%A4%9A%E4%B9%85%E6%9B%B4%E6%96%B0%E4%B8%80%E6%AC%A1-memory-bank "我应该多久更新一次 Memory Bank?的直接链接")
在重大里程碑或方向变化后更新 Memory Bank。对于活跃的开发,每隔几次会话更新一次会很有帮助。当你希望确保所有上下文都得到保留时,请使用“update memory bank”命令。
### 我可以手动编辑 Memory Bank 文件吗?[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E6%88%91%E5%8F%AF%E4%BB%A5%E6%89%8B%E5%8A%A8%E7%BC%96%E8%BE%91-memory-bank-%E6%96%87%E4%BB%B6%E5%90%97 "我可以手动编辑 Memory Bank 文件吗?的直接链接")
是的!虽然 Kilo Code 管理大多数文件,但你可以手动编辑其中任何文件。`brief.md` 文件专门设计为由你维护。Kilo Code 会尊重对其他文件的手动编辑。
### 如果 Memory Bank 文件丢失会发生什么?[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E5%A6%82%E6%9E%9C-memory-bank-%E6%96%87%E4%BB%B6%E4%B8%A2%E5%A4%B1%E4%BC%9A%E5%8F%91%E7%94%9F%E4%BB%80%E4%B9%88 "如果 Memory Bank 文件丢失会发生什么?的直接链接")
如果 Memory Bank 文件丢失,Kilo Code 会在其响应的开头显示 `[Memory Bank: Missing]`,并建议初始化 Memory Bank。
### Memory Bank 是否适用于所有 AI 模型?[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#memory-bank-%E6%98%AF%E5%90%A6%E9%80%82%E7%94%A8%E4%BA%8E%E6%89%80%E6%9C%89-ai-%E6%A8%A1%E5%9E%8B "Memory Bank 是否适用于所有 AI 模型?的直接链接")
Memory Bank 适用于所有 AI 模型,但更强大的模型将创建更全面和准确的 Memory Bank 文件。轻量级模型可能难以处理分析和更新 Memory Bank 文件的资源密集型过程。
### 我可以在多个项目中使用 Memory Bank 吗?[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E6%88%91%E5%8F%AF%E4%BB%A5%E5%9C%A8%E5%A4%9A%E4%B8%AA%E9%A1%B9%E7%9B%AE%E4%B8%AD%E4%BD%BF%E7%94%A8-memory-bank-%E5%90%97 "我可以在多个项目中使用 Memory Bank 吗?的直接链接")
是的!每个项目都有自己的 Memory Bank,位于其 `.kilocode/rules/memory-bank/` 文件夹中。Kilo Code 会自动为每个项目使用正确的 Memory Bank。
### Memory Bank 是否会占用我的上下文窗口?[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#memory-bank-%E6%98%AF%E5%90%A6%E4%BC%9A%E5%8D%A0%E7%94%A8%E6%88%91%E7%9A%84%E4%B8%8A%E4%B8%8B%E6%96%87%E7%AA%97%E5%8F%A3 "Memory Bank 是否会占用我的上下文窗口?的直接链接")
是的,Memory Bank 在每个会话开始时确实会占用一些上下文窗口,因为它会加载所有 Memory Bank 文件。然而,这是一个战略性的权衡,可以显著提高整体效率。通过预先加载项目上下文:
* 你消除了重复解释,这些解释会随着时间的推移消耗更多的上下文
* 你可以通过更少的来回交流达到富有成效的结果
* 你在整个会话中保持一致性理解
测试表明,虽然 Memory Bank 最初使用了更多的 token,但它显著减少了实现结果所需的总交互次数。这意味着更少的时间解释和更多的时间构建。
最佳实践[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5 "最佳实践的直接链接")
--------------------------------------------------------------------------------------------------------------------
### 开始使用[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E5%BC%80%E5%A7%8B%E4%BD%BF%E7%94%A8 "开始使用的直接链接")
* 从基本项目摘要开始,让结构逐步发展
* 让 Kilo Code 帮助创建初始结构
* 根据需要审查和调整文件以匹配你的工作流程
* 初始化后验证生成文件的准确性
### 持续工作[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E6%8C%81%E7%BB%AD%E5%B7%A5%E4%BD%9C "持续工作的直接链接")
* 让模式随着工作自然出现
* 不要强制文档更新——它们应该有机地发生
* 信任过程——价值会随着时间的推移而复合
* 在会话开始时注意上下文确认
* 使用状态指示器确认 Memory Bank 处于活动状态
### 文档流程[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E6%96%87%E6%A1%A3%E6%B5%81%E7%A8%8B "文档流程的直接链接")
* `brief.md` 是你的基础
* `context.md` 变化最频繁
* 所有文件共同维护项目智能
* 在重大里程碑或方向变化后更新
### 优化 Memory Bank 性能[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E4%BC%98%E5%8C%96-memory-bank-%E6%80%A7%E8%83%BD "优化 Memory Bank 性能的直接链接")
* 保持 Memory Bank 文件简洁且重点突出
* 使用附加文件进行详细文档记录
* 定期更新但不要过度
* 专注于特定方面时使用特定的更新命令
记住[](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E8%AE%B0%E4%BD%8F "记住的直接链接")
----------------------------------------------------------------------------------------------
Memory Bank 是 Kilo Code 与之前工作的唯一链接。其有效性完全依赖于在每个交互中维护清晰、准确的文档并确认上下文保留。当你在响应开头看到 `[Memory Bank: Active]` 时,你可以确信 Kilo Code 对你的项目有全面的理解。
* [概述](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E6%A6%82%E8%BF%B0)
* [问题:AI 记忆丢失](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E9%97%AE%E9%A2%98ai-%E8%AE%B0%E5%BF%86%E4%B8%A2%E5%A4%B1)
* [解决方案:Memory Bank](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88memory-bank)
* [主要优点](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E4%B8%BB%E8%A6%81%E4%BC%98%E7%82%B9)
* [Memory Bank 的工作原理](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#memory-bank-%E7%9A%84%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86)
* [核心 Memory Bank 文件](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E6%A0%B8%E5%BF%83-memory-bank-%E6%96%87%E4%BB%B6)
* [brief.md](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#briefmd)
* [product.md](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#productmd)
* [context.md](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#contextmd)
* [architecture.md](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#architecturemd)
* [tech.md](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#techmd)
* [其他上下文文件](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E5%85%B6%E4%BB%96%E4%B8%8A%E4%B8%8B%E6%96%87%E6%96%87%E4%BB%B6)
* [tasks.md](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#tasksmd)
* [开始使用 Memory Bank](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E5%BC%80%E5%A7%8B%E4%BD%BF%E7%94%A8-memory-bank)
* [首次设置](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E9%A6%96%E6%AC%A1%E8%AE%BE%E7%BD%AE)
* [项目摘要提示](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E9%A1%B9%E7%9B%AE%E6%91%98%E8%A6%81%E6%8F%90%E7%A4%BA)
* [使用 Memory Bank](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E4%BD%BF%E7%94%A8-memory-bank)
* [核心工作流程](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E6%A0%B8%E5%BF%83%E5%B7%A5%E4%BD%9C%E6%B5%81%E7%A8%8B)
* [关键命令](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E5%85%B3%E9%94%AE%E5%91%BD%E4%BB%A4)
* [状态指示器](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E7%8A%B6%E6%80%81%E6%8C%87%E7%A4%BA%E5%99%A8)
* [文档更新](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E6%96%87%E6%A1%A3%E6%9B%B4%E6%96%B0)
* [上下文窗口管理](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E4%B8%8A%E4%B8%8B%E6%96%87%E7%AA%97%E5%8F%A3%E7%AE%A1%E7%90%86)
* [处理不一致](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E5%A4%84%E7%90%86%E4%B8%8D%E4%B8%80%E8%87%B4)
* [常见问题解答](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98%E8%A7%A3%E7%AD%94)
* [Memory Bank 文件存储在哪里?](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#memory-bank-%E6%96%87%E4%BB%B6%E5%AD%98%E5%82%A8%E5%9C%A8%E5%93%AA%E9%87%8C)
* [我应该多久更新一次 Memory Bank?](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E6%88%91%E5%BA%94%E8%AF%A5%E5%A4%9A%E4%B9%85%E6%9B%B4%E6%96%B0%E4%B8%80%E6%AC%A1-memory-bank)
* [我可以手动编辑 Memory Bank 文件吗?](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E6%88%91%E5%8F%AF%E4%BB%A5%E6%89%8B%E5%8A%A8%E7%BC%96%E8%BE%91-memory-bank-%E6%96%87%E4%BB%B6%E5%90%97)
* [如果 Memory Bank 文件丢失会发生什么?](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E5%A6%82%E6%9E%9C-memory-bank-%E6%96%87%E4%BB%B6%E4%B8%A2%E5%A4%B1%E4%BC%9A%E5%8F%91%E7%94%9F%E4%BB%80%E4%B9%88)
* [Memory Bank 是否适用于所有 AI 模型?](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#memory-bank-%E6%98%AF%E5%90%A6%E9%80%82%E7%94%A8%E4%BA%8E%E6%89%80%E6%9C%89-ai-%E6%A8%A1%E5%9E%8B)
* [我可以在多个项目中使用 Memory Bank 吗?](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E6%88%91%E5%8F%AF%E4%BB%A5%E5%9C%A8%E5%A4%9A%E4%B8%AA%E9%A1%B9%E7%9B%AE%E4%B8%AD%E4%BD%BF%E7%94%A8-memory-bank-%E5%90%97)
* [Memory Bank 是否会占用我的上下文窗口?](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#memory-bank-%E6%98%AF%E5%90%A6%E4%BC%9A%E5%8D%A0%E7%94%A8%E6%88%91%E7%9A%84%E4%B8%8A%E4%B8%8B%E6%96%87%E7%AA%97%E5%8F%A3)
* [最佳实践](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5)
* [开始使用](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E5%BC%80%E5%A7%8B%E4%BD%BF%E7%94%A8)
* [持续工作](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E6%8C%81%E7%BB%AD%E5%B7%A5%E4%BD%9C)
* [文档流程](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E6%96%87%E6%A1%A3%E6%B5%81%E7%A8%8B)
* [优化 Memory Bank 性能](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E4%BC%98%E5%8C%96-memory-bank-%E6%80%A7%E8%83%BD)
* [记住](https://kilocode.ai/docs/zh-CN/advanced-usage/memory-bank#%E8%AE%B0%E4%BD%8F)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fadvanced-usage%2Fmemory-bank)
---
# 速率限制与成本 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/advanced-usage/rate-limits-costs#__docusaurus_skipToContent_fallback)
本页总览
了解和管理 API 使用情况对于在 Kilo Code 中获得流畅且经济高效的体验至关重要。本节将解释如何跟踪你的 token 使用情况、成本以及如何配置速率限制。
Token 使用[](https://kilocode.ai/docs/zh-CN/advanced-usage/rate-limits-costs#token-%E4%BD%BF%E7%94%A8 "Token 使用的直接链接")
----------------------------------------------------------------------------------------------------------------------
Kilo Code 使用 token 与 AI 模型进行交互。Token 本质上是词语的组成部分。请求和响应中使用的 token 数量会影响处理时间和成本。
* \*\*输入 Token:\*\*这些是你的提示中的 token,包括系统提示、你的指令以及提供的任何上下文(例如文件内容)。
* \*\*输出 Token:\*\*这些是 AI 模型在响应中生成的 token。
你可以在聊天记录中查看每次交互的输入和输出 token 数量。
成本计算[](https://kilocode.ai/docs/zh-CN/advanced-usage/rate-limits-costs#%E6%88%90%E6%9C%AC%E8%AE%A1%E7%AE%97 "成本计算的直接链接")
--------------------------------------------------------------------------------------------------------------------------
大多数 AI 提供商根据使用的 token 数量收费。价格因提供商和具体模型而异。
Kilo Code 会根据配置的模型定价自动计算每次 API 请求的预估成本。该成本显示在聊天记录中,紧邻 token 使用情况。
**注意:**
* 成本计算是_预估_值。实际成本可能因提供商的计费方式而略有不同。
* 一些提供商可能提供免费层级或信用额度。请查看提供商的文档以获取详细信息。
* 一些提供商提供提示缓存,可以显著降低成本。
配置速率限制[](https://kilocode.ai/docs/zh-CN/advanced-usage/rate-limits-costs#%E9%85%8D%E7%BD%AE%E9%80%9F%E7%8E%87%E9%99%90%E5%88%B6 "配置速率限制的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------------
为了防止意外过度使用 API 并帮助你管理成本,Kilo Code 允许你设置速率限制。速率限制定义了 API 请求之间的最短时间(以秒为单位)。
**如何配置:**
1. 打开 Kilo Code 设置(右上角的 图标)。
2. 转到“高级设置”部分。
3. 找到“速率限制(秒)”设置。
4. 输入所需的延迟时间(以秒为单位)。值为 0 表示禁用速率限制。
**示例:**
如果你将速率限制设置为 10 秒,Kilo Code 会在一个 API 请求完成后至少等待 10 秒再发送下一个请求。
优化 Token 使用的技巧[](https://kilocode.ai/docs/zh-CN/advanced-usage/rate-limits-costs#%E4%BC%98%E5%8C%96-token-%E4%BD%BF%E7%94%A8%E7%9A%84%E6%8A%80%E5%B7%A7 "优化 Token 使用的技巧的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
* \*\*简洁明了:\*\*在提示中使用清晰简洁的语言。避免不必要的词语或细节。
* \*\*仅提供相关上下文:\*\*选择性使用上下文提及(`@file.ts`,`@folder/`)。仅包括与任务直接相关的文件。
* \*\*分解任务:\*\*将大型任务分解为更小、更专注的子任务。
* \*\*使用自定义指令:\*\*提供自定义指令以指导 Kilo Code 的行为,减少每次提示中冗长的解释。
* \*\*选择合适的模型:\*\*某些模型比其他模型更具成本效益。对于不需要较大模型全部功能的任务,可以考虑使用更小、更快的模型。
* \*\*使用模式:\*\*不同的模式可以访问不同的工具,例如 `Architect` 无法修改代码,这使其成为分析复杂代码库时的安全选择,而无需担心意外允许昂贵的操作。
* \*\*如果未使用 MCP 则禁用它:\*\*如果你未使用 MCP(模型上下文协议)功能,请考虑[在 MCP 设置中禁用它](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#enabling-or-disabling-mcp-server-creation)
,以显著减少系统提示的大小并节省 token。
通过了解和管理你的 API 使用情况,你可以高效且经济地使用 Kilo Code。
* [Token 使用](https://kilocode.ai/docs/zh-CN/advanced-usage/rate-limits-costs#token-%E4%BD%BF%E7%94%A8)
* [成本计算](https://kilocode.ai/docs/zh-CN/advanced-usage/rate-limits-costs#%E6%88%90%E6%9C%AC%E8%AE%A1%E7%AE%97)
* [配置速率限制](https://kilocode.ai/docs/zh-CN/advanced-usage/rate-limits-costs#%E9%85%8D%E7%BD%AE%E9%80%9F%E7%8E%87%E9%99%90%E5%88%B6)
* [优化 Token 使用的技巧](https://kilocode.ai/docs/zh-CN/advanced-usage/rate-limits-costs#%E4%BC%98%E5%8C%96-token-%E4%BD%BF%E7%94%A8%E7%9A%84%E6%8A%80%E5%B7%A7)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fadvanced-usage%2Frate-limits-costs)
---
# 添加更多 Tokens | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/basic-usage/adding-tokens#__docusaurus_skipToContent_fallback)
本页总览
当你用完初始的免费 tokens 后,你可以轻松添加更多:
* 为你的账户添加信用卡(所有支付均通过 Stripe 安全处理)
* 我们目前不提供订阅服务,因此你只需为使用的 tokens 付费,并且仅在你选择充值 tokens 时付费!
* 通过[连接你自己的 API 提供商](https://kilocode.ai/docs/zh-CN/getting-started/connecting-api-provider)
来利用你自己的 API 提供商
透明的定价[](https://kilocode.ai/docs/zh-CN/basic-usage/adding-tokens#%E9%80%8F%E6%98%8E%E7%9A%84%E5%AE%9A%E4%BB%B7 "透明的定价的直接链接")
------------------------------------------------------------------------------------------------------------------------------
在 Kilo Code,我们相信完全透明的定价:
* 我们的定价与模型提供商的 API 费率完全一致
* 我们不收取任何佣金或加价,无论是按 token 还是按充值
* 你只需为使用的 tokens 付费,没有任何隐藏费用
未来计划[](https://kilocode.ai/docs/zh-CN/basic-usage/adding-tokens#%E6%9C%AA%E6%9D%A5%E8%AE%A1%E5%88%92 "未来计划的直接链接")
-------------------------------------------------------------------------------------------------------------------
我们正在不断改进 Kilo Code 并扩展我们的服务:
* 未来将添加更多 LLM 提供商
* 更多支付选项和其他计划正在开发中
需要帮助?
如果你对定价或 tokens 有任何疑问,请联系我们的[支持团队](mailto:hi@kilocode.ai)
或在我们的 [Discord 社区](https://kilocode.ai/discord)
中提问。
* [透明的定价](https://kilocode.ai/docs/zh-CN/basic-usage/adding-tokens#%E9%80%8F%E6%98%8E%E7%9A%84%E5%AE%9A%E4%BB%B7)
* [未来计划](https://kilocode.ai/docs/zh-CN/basic-usage/adding-tokens#%E6%9C%AA%E6%9D%A5%E8%AE%A1%E5%88%92)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fbasic-usage%2Fadding-tokens)
---
# 上下文提及 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/basic-usage/context-mentions#__docusaurus_skipToContent_fallback)
本页总览
上下文提及是一种强大的方式,可以为 Kilo Code 提供项目的具体信息,使其能够更准确高效地执行任务。你可以使用提及来引用文件、文件夹、问题和 Git 提交。上下文提及以 `@` 符号开头。

_上下文提及概览,显示聊天界面中的 @ 符号下拉菜单。_
提及类型[](https://kilocode.ai/docs/zh-CN/basic-usage/context-mentions#%E6%8F%90%E5%8F%8A%E7%B1%BB%E5%9E%8B "提及类型的直接链接")
----------------------------------------------------------------------------------------------------------------------

_文件提及将实际代码内容添加到对话中,以便直接引用和分析。_
| 提及类型 | 格式 | 描述 | 示例用法 |
| --- | --- | --- | --- |
| **文件** | `@/path/to/file.ts` | 将文件内容包含在请求上下文中 | "解释 @/src/utils.ts 中的函数" |
| **文件夹** | `@/path/to/folder/` | 以树状格式提供目录结构 | "@/src/components/ 中有哪些文件?" |
| **问题** | `@problems` | 包含 VS Code 问题面板的诊断信息 | "@problems 修复我代码中的所有错误" |
| **终端** | `@terminal` | 包含最近的终端命令和输出 | "修复 @terminal 中显示的错误" |
| **Git 提交** | `@a1b2c3d` | 通过哈希引用特定提交 | "提交 @a1b2c3d 中有什么变化?" |
| **Git 更改** | `@git-changes` | 显示未提交的更改 | "为 @git-changes 建议一条提交消息" |
| **URL** | `@https://example.com` | 导入网站内容 | "总结 @[https://docusaurus.io/](https://docusaurus.io/) " |
### 文件提及[](https://kilocode.ai/docs/zh-CN/basic-usage/context-mentions#%E6%96%87%E4%BB%B6%E6%8F%90%E5%8F%8A "文件提及的直接链接")

_文件提及结合行号引用源代码,以便精确定位。_
| 能力 | 详情 |
| --- | --- |
| **格式** | `@/path/to/file.ts`(始终从工作区根目录开始使用 `/`) |
| **提供** | 包含行号的完整文件内容 |
| **支持** | 文本文件、PDF 和 DOCX 文件(带文本提取) |
| **适用场景** | 初始请求、反馈响应和后续消息 |
| **限制** | 非常大的文件可能会被截断;不支持二进制文件 |
### 文件夹提及[](https://kilocode.ai/docs/zh-CN/basic-usage/context-mentions#%E6%96%87%E4%BB%B6%E5%A4%B9%E6%8F%90%E5%8F%8A "文件夹提及的直接链接")

_文件夹提及以可读的树状格式显示目录结构。_
| 能力 | 详情 |
| --- | --- |
| **格式** | `@/path/to/folder/`(注意尾部的斜杠) |
| **提供** | 使用 ├── 和 └── 前缀的分层树状显示 |
| **包含** | 直接子文件和目录(非递归) |
| **最佳用途** | 了解项目结构 |
| **提示** | 结合文件提及检查特定文件内容 |
### 问题提及[](https://kilocode.ai/docs/zh-CN/basic-usage/context-mentions#%E9%97%AE%E9%A2%98%E6%8F%90%E5%8F%8A "问题提及的直接链接")

_问题提及直接从 VS Code 的问题面板导入诊断信息。_
| 能力 | 详情 |
| --- | --- |
| **格式** | `@problems` |
| **提供** | VS Code 问题面板中的所有错误和警告 |
| **包含** | 文件路径、行号和诊断信息 |
| **分组** | 问题按文件组织以提高清晰度 |
| **最佳用途** | 修复错误而无需手动复制 |
### 终端提及[](https://kilocode.ai/docs/zh-CN/basic-usage/context-mentions#%E7%BB%88%E7%AB%AF%E6%8F%90%E5%8F%8A "终端提及的直接链接")

_终端提及捕获最近的命令输出以便调试和分析。_
| 能力 | 详情 |
| --- | --- |
| **格式** | `@terminal` |
| **捕获** | 最后一条命令及其完整输出 |
| **保留** | 终端状态(不会清除终端) |
| **限制** | 仅限于可见的终端缓冲区内容 |
| **最佳用途** | 调试构建错误或分析命令输出 |
### Git 提及[](https://kilocode.ai/docs/zh-CN/basic-usage/context-mentions#git-%E6%8F%90%E5%8F%8A "Git 提及的直接链接")

_Git 提及提供提交详情和差异,以便进行上下文感知的版本分析。_
| 类型 | 格式 | 提供 | 限制 |
| --- | --- | --- | --- |
| **提交** | `@a1b2c3d` | 提交消息、作者、日期和完整差异 | 仅适用于 Git 仓库 |
| **工作区更改** | `@git-changes` | `git status` 输出和未提交更改的差异 | 仅适用于 Git 仓库 |
### URL 提及[](https://kilocode.ai/docs/zh-CN/basic-usage/context-mentions#url-%E6%8F%90%E5%8F%8A "URL 提及的直接链接")

_URL 提及导入外部网页内容并将其转换为可读的 Markdown 格式。_
| 能力 | 详情 |
| --- | --- |
| **格式** | `@https://example.com` |
| **处理** | 使用无头浏览器获取内容 |
| **清理** | 移除脚本、样式和导航元素 |
| **输出** | 将内容转换为 Markdown 以提高可读性 |
| **限制** | 复杂页面可能无法完美转换 |
如何使用提及[](https://kilocode.ai/docs/zh-CN/basic-usage/context-mentions#%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%E6%8F%90%E5%8F%8A "如何使用提及的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------------
1. 在聊天输入框中输入 `@` 以触发建议下拉菜单
2. 继续输入以过滤建议,或使用箭头键导航
3. 按回车键或鼠标点击选择
4. 在请求中组合多个提及:"修复 @/src/component.ts 中的 @problems"
下拉菜单会自动建议:
* 最近打开的文件
* 可见的文件夹
* 最近的 Git 提交
* 特殊关键字(`problems`、`terminal`、`git-changes`)
最佳实践[](https://kilocode.ai/docs/zh-CN/basic-usage/context-mentions#%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5 "最佳实践的直接链接")
----------------------------------------------------------------------------------------------------------------------
| 实践 | 描述 |
| --- | --- |
| **使用具体路径** | 引用确切文件而非描述它们 |
| **使用相对路径** | 始终从工作区根目录开始:`@/src/file.ts` 而非 `@C:/Projects/src/file.ts` |
| **验证引用** | 确保路径和提交哈希正确 |
| **点击提及** | 点击聊天历史中的提及以打开文件或查看内容 |
| **避免复制粘贴** | 使用提及而非手动复制代码或错误信息 |
| **组合提及** | "使用提交 @a1b2c3d 中的模式修复 @/src/component.ts 中的 @problems" |
* [提及类型](https://kilocode.ai/docs/zh-CN/basic-usage/context-mentions#%E6%8F%90%E5%8F%8A%E7%B1%BB%E5%9E%8B)
* [文件提及](https://kilocode.ai/docs/zh-CN/basic-usage/context-mentions#%E6%96%87%E4%BB%B6%E6%8F%90%E5%8F%8A)
* [文件夹提及](https://kilocode.ai/docs/zh-CN/basic-usage/context-mentions#%E6%96%87%E4%BB%B6%E5%A4%B9%E6%8F%90%E5%8F%8A)
* [问题提及](https://kilocode.ai/docs/zh-CN/basic-usage/context-mentions#%E9%97%AE%E9%A2%98%E6%8F%90%E5%8F%8A)
* [终端提及](https://kilocode.ai/docs/zh-CN/basic-usage/context-mentions#%E7%BB%88%E7%AB%AF%E6%8F%90%E5%8F%8A)
* [Git 提及](https://kilocode.ai/docs/zh-CN/basic-usage/context-mentions#git-%E6%8F%90%E5%8F%8A)
* [URL 提及](https://kilocode.ai/docs/zh-CN/basic-usage/context-mentions#url-%E6%8F%90%E5%8F%8A)
* [如何使用提及](https://kilocode.ai/docs/zh-CN/basic-usage/context-mentions#%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%E6%8F%90%E5%8F%8A)
* [最佳实践](https://kilocode.ai/docs/zh-CN/basic-usage/context-mentions#%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fbasic-usage%2Fcontext-mentions)
---
# Generate Commit Messages | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#__docusaurus_skipToContent_fallback)
本页总览
Generate descriptive commit messages automatically based on your staged git changes. Kilo Code analyzes your staged files and creates conventional commit messages that follow best practices.
信息
This feature only analyzes **staged changes**. Make sure to stage your files using `git add` or via `VS Code` interface before generating commit messages.
How It Works[](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#how-it-works "How It Works的直接链接")
-------------------------------------------------------------------------------------------------------------------
The git commit message generator:
* Analyzes only your **staged changes** (not unstaged or untracked files)
* Uses AI to understand the context and purpose of your changes
* Creates descriptive commit messages that explain what was changed and why following the [Conventional Commits](https://www.conventionalcommits.org/)
(by default, customizable)
Using the Feature[](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#using-the-feature "Using the Feature的直接链接")
----------------------------------------------------------------------------------------------------------------------------------
### Generating a Commit Message[](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#generating-a-commit-message "Generating a Commit Message的直接链接")
1. Stage your changes using `git add` or the VS Code git interface
2. In the VS Code Source Control panel, look for the `Kilo Code` logo next to the commit message field)
3. Click the logo to generate a commit message
The generated message will appear in the commit message field, ready for you to review and modify if needed.

### Conventional Commit Format[](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#conventional-commit-format "Conventional Commit Format的直接链接")
By default, generated messages follow the Conventional Commits specification:
():
Common types include:
* `feat`: New features
* `fix`: Bug fixes
* `docs`: Documentation changes
* `style`: Code style changes (formatting, etc.)
* `refactor`: Code refactoring
* `test`: Adding or updating tests
* `chore`: Maintenance tasks
Configuration[](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#configuration "Configuration的直接链接")
----------------------------------------------------------------------------------------------------------------------
### Customizing the Commit Template[](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#customizing-the-commit-template "Customizing the Commit Template的直接链接")
You can customize how commit messages are generated by modifying the prompt template:
1. Open Settings by clicking the gear icon → `Prompts`
2. Find the "Commit Message Generation" section
3. Edit the `Prompt` template to match your project's conventions

The default template creates conventional commit messages, but you can modify it to:
* Use different commit message formats
* Include specific information relevant to your project
* Follow your team's commit message conventions
* Add custom instructions for the AI
### API Configuration[](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#api-configuration "API Configuration的直接链接")
You can configure which API profile to use for commit message generation:
1. In the `Prompts` settings, scroll to "API Configuration"
2. Select a specific profile or use the currently selected one
提示
Consider creating a dedicated [API configuration profile](https://kilocode.ai/docs/zh-CN/features/api-configuration-profiles)
with a faster, more cost-effective model specifically for commit message generation.
Best Practices[](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#best-practices "Best Practices的直接链接")
-------------------------------------------------------------------------------------------------------------------------
### Staging Strategy[](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#staging-strategy "Staging Strategy的直接链接")
* Stage related changes together for more coherent commit messages
* Avoid staging unrelated changes in a single commit
* Use `git add -p` for partial file staging when needed
### Message Review[](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#message-review "Message Review的直接链接")
* Always review generated messages before committing
* Edit messages to add context the AI might have missed
* Ensure the message accurately describes the changes
### Custom Templates[](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#custom-templates "Custom Templates的直接链接")
* Tailor the prompt template to your project's needs
* Include project-specific terminology or conventions
* Add instructions for handling specific types of changes
Example Generated Messages[](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#example-generated-messages "Example Generated Messages的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Here are examples of messages the feature might generate:
feat(auth): add OAuth2 integration with GoogleImplement Google OAuth2 authentication flow including:- OAuth2 client configuration- User profile retrieval- Token refresh mechanism
fix(api): resolve race condition in user data fetchingAdd proper error handling and retry logic to preventconcurrent requests from causing data inconsistency
docs(readme): update installation instructionsAdd missing dependency requirements and clarifysetup steps for new contributors
Troubleshooting[](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#troubleshooting "Troubleshooting的直接链接")
----------------------------------------------------------------------------------------------------------------------------
### No Staged Changes[](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#no-staged-changes "No Staged Changes的直接链接")
If the button doesn't appear or generation fails, ensure you have staged changes:
git add # or stage all changesgit add .
### Poor Message Quality[](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#poor-message-quality "Poor Message Quality的直接链接")
If generated messages aren't helpful:
* Review your staging strategy - don't stage unrelated changes together
* Customize the prompt template with more specific instructions
* Try a different AI model through API configuration
### Integration Issues[](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#integration-issues "Integration Issues的直接链接")
The feature integrates with VS Code's built-in git functionality. If you encounter issues:
* Ensure your repository is properly initialized
* Check that VS Code can access your git repository
* Verify git is installed and accessible from VS Code
Related Features[](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#related-features "Related Features的直接链接")
-------------------------------------------------------------------------------------------------------------------------------
* [API Configuration Profiles](https://kilocode.ai/docs/zh-CN/features/api-configuration-profiles)
- Use different models for commit generation
* [Settings Management](https://kilocode.ai/docs/zh-CN/features/settings-management)
- Manage all your Kilo Code preferences
* [How It Works](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#how-it-works)
* [Using the Feature](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#using-the-feature)
* [Generating a Commit Message](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#generating-a-commit-message)
* [Conventional Commit Format](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#conventional-commit-format)
* [Configuration](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#configuration)
* [Customizing the Commit Template](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#customizing-the-commit-template)
* [API Configuration](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#api-configuration)
* [Best Practices](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#best-practices)
* [Staging Strategy](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#staging-strategy)
* [Message Review](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#message-review)
* [Custom Templates](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#custom-templates)
* [Example Generated Messages](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#example-generated-messages)
* [Troubleshooting](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#troubleshooting)
* [No Staged Changes](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#no-staged-changes)
* [Poor Message Quality](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#poor-message-quality)
* [Integration Issues](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#integration-issues)
* [Related Features](https://kilocode.ai/docs/zh-CN/basic-usage/git-commit-generation#related-features)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fbasic-usage%2Fgit-commit-generation)
---
# Orchestrator Mode:协调复杂工作流 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/basic-usage/orchestrator-mode#__docusaurus_skipToContent_fallback)
本页总览
Orchestrator Mode(原称为 Boomerang Tasks)允许你将复杂项目分解为更小、更易管理的部分。你可以将其理解为将工作的各个部分委派给专门的助手。每个子任务都在自己的上下文中运行,通常使用为特定工作定制的不同 Kilo Code 模式(如 [`code`](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes#code-mode-default)
、[`architect`](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes#architect-mode)
或 [`debug`](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes#debug-mode)
)。
Orchestrator Mode 的说明与演示
为什么使用 Orchestrator Mode?[](https://kilocode.ai/docs/zh-CN/basic-usage/orchestrator-mode#%E4%B8%BA%E4%BB%80%E4%B9%88%E4%BD%BF%E7%94%A8-orchestrator-mode "为什么使用 Orchestrator Mode?的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
* **处理复杂性**:将大型、多步骤项目(如构建完整功能)分解为专注的子任务(如设计、实现、文档)。
* **使用专门模式**:自动将子任务委派给最适合该工作的模式,利用其专门能力以获得最佳结果。
* **保持专注与效率**:每个子任务都在其独立的上下文中运行,具有单独的对话历史。这可以防止父任务(orchestrator)被详细的执行步骤(如代码差异或文件分析结果)所干扰,使其能够专注于高层次的工作流,并根据已完成子任务的简洁摘要高效管理整体流程。
* **简化工作流**:一个子任务的结果可以自动传递给下一个子任务,从而创建顺畅的工作流(例如,架构决策直接传递给编码任务)。
工作原理[](https://kilocode.ai/docs/zh-CN/basic-usage/orchestrator-mode#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86 "工作原理的直接链接")
-----------------------------------------------------------------------------------------------------------------------
1. 使用 Orchestrator Mode,Kilo 可以分析复杂任务并建议将其分解为子任务[1](https://kilocode.ai/docs/zh-CN/basic-usage/orchestrator-mode#user-content-fn-1)
。
2. 父任务暂停,新的子任务以不同模式开始[2](https://kilocode.ai/docs/zh-CN/basic-usage/orchestrator-mode#user-content-fn-2)
。
3. 当子任务的目标达成时,Kilo 会发出完成信号。
4. 父任务恢复,并仅接收子任务的摘要[3](https://kilocode.ai/docs/zh-CN/basic-usage/orchestrator-mode#user-content-fn-3)
。父任务使用该摘要继续主工作流。
关键注意事项[](https://kilocode.ai/docs/zh-CN/basic-usage/orchestrator-mode#%E5%85%B3%E9%94%AE%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9 "关键注意事项的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------
* **需要批准**:默认情况下,每个子任务的创建和完成都需要你的批准。如果需要,可以通过 [Auto-Approving Actions](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#subtasks)
设置自动完成此操作。
* **上下文隔离与传递**:每个子任务都在完全隔离的上下文中运行,具有自己的对话历史。它不会自动继承父任务的上下文。信息必须显式传递:
* **向下**:在子任务创建时通过初始指令传递。
* **向上**:在子任务完成时通过最终摘要传递。注意,只有该摘要会返回给父任务。
* **导航**:Kilo 的界面帮助你查看任务的层次结构(哪个任务是父任务,哪些是子任务)。你通常可以在活动和暂停的任务之间导航。
Orchestrator Mode 提供了一种强大的方式来管理复杂的开发工作流,直接在 Kilo Code 中利用专门模式以实现最大效率。
保持任务专注
使用子任务来保持清晰度。如果请求显著改变了焦点或需要不同的专业知识(模式),请考虑创建子任务,而不是让当前任务过载。
Footnotes[](https://kilocode.ai/docs/zh-CN/basic-usage/orchestrator-mode#footnote-label "Footnotes的直接链接")
-----------------------------------------------------------------------------------------------------------
1. 此上下文通过 [`new_task`](https://kilocode.ai/docs/zh-CN/features/tools/new-task)
工具的 `message` 参数传递。 [↩](https://kilocode.ai/docs/zh-CN/basic-usage/orchestrator-mode#user-content-fnref-1)
2. 子任务的模式通过 [`new_task`](https://kilocode.ai/docs/zh-CN/features/tools/new-task)
工具的 `mode` 参数在启动时指定。 [↩](https://kilocode.ai/docs/zh-CN/basic-usage/orchestrator-mode#user-content-fnref-2)
3. 此摘要通过 [`attempt_completion`](https://kilocode.ai/docs/zh-CN/features/tools/attempt-completion)
工具的 `result` 参数在子任务完成时传递。 [↩](https://kilocode.ai/docs/zh-CN/basic-usage/orchestrator-mode#user-content-fnref-3)
* [为什么使用 Orchestrator Mode?](https://kilocode.ai/docs/zh-CN/basic-usage/orchestrator-mode#%E4%B8%BA%E4%BB%80%E4%B9%88%E4%BD%BF%E7%94%A8-orchestrator-mode)
* [工作原理](https://kilocode.ai/docs/zh-CN/basic-usage/orchestrator-mode#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86)
* [关键注意事项](https://kilocode.ai/docs/zh-CN/basic-usage/orchestrator-mode#%E5%85%B3%E9%94%AE%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fbasic-usage%2Forchestrator-mode)
---
# 使用模式 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes#__docusaurus_skipToContent_fallback)
本页总览
Kilo Code 中的模式是专门设计的角色,可以根据当前任务调整助手的行为。每种模式都提供不同的能力、专业知识和访问权限,帮助你完成特定目标。
为什么使用不同的模式?[](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes#%E4%B8%BA%E4%BB%80%E4%B9%88%E4%BD%BF%E7%94%A8%E4%B8%8D%E5%90%8C%E7%9A%84%E6%A8%A1%E5%BC%8F "为什么使用不同的模式?的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
* **任务专业化**:获得针对当前任务所需的精确帮助
* **安全控制**:在专注于规划或学习时,防止意外的文件修改
* **专注交互**:接收针对当前活动优化的响应
* **工作流优化**:在规划、实施、调试和学习之间无缝切换
解释 Kilo Code 中的不同模式
切换模式[](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes#%E5%88%87%E6%8D%A2%E6%A8%A1%E5%BC%8F "切换模式的直接链接")
-----------------------------------------------------------------------------------------------------------------
四种切换模式的方式:
1. **下拉菜单**:点击聊天输入框左侧的选择器

2. **斜杠命令**:在聊天输入框中输入 `/architect`、`/ask`、`/debug` 或 `/code`

3. **切换命令/键盘快捷键**:使用适用于你操作系统的键盘快捷键。每次按下都会按顺序循环切换可用模式,到达末尾后返回第一个模式。
| 操作系统 | 快捷键 |
| --- | --- |
| macOS | ⌘ + . |
| Windows | Ctrl + . |
| Linux | Ctrl + . |
4. **接受建议**:在适当时点击 Kilo Code 提供的模式切换建议

内置模式[](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes#%E5%86%85%E7%BD%AE%E6%A8%A1%E5%BC%8F "内置模式的直接链接")
-----------------------------------------------------------------------------------------------------------------
### 代码模式(默认)[](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes#%E4%BB%A3%E7%A0%81%E6%A8%A1%E5%BC%8F%E9%BB%98%E8%AE%A4 "代码模式(默认)的直接链接")
| 方面 | 详细信息 |
| --- | --- |
| **描述** | 一位熟练的软件工程师,精通编程语言、设计模式和最佳实践 |
| **工具访问** | 完全访问所有工具组:`read`、`edit`、`browser`、`command`、`mcp` |
| **适合场景** | 编写代码、实现功能、调试和一般开发 |
| **特殊功能** | 无工具限制——所有编码任务完全灵活 |
### 问答模式[](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes#%E9%97%AE%E7%AD%94%E6%A8%A1%E5%BC%8F "问答模式的直接链接")
| 方面 | 详细信息 |
| --- | --- |
| **描述** | 一位知识渊博的技术助手,专注于回答问题而不修改代码库 |
| **工具访问** | 有限访问:仅 `read`、`browser`、`mcp`(无法编辑文件或运行命令) |
| **适合场景** | 代码解释、概念探索和技术学习 |
| **特殊功能** | 优化为在不修改项目的情况下提供信息丰富的响应 |
### 架构师模式[](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes#%E6%9E%B6%E6%9E%84%E5%B8%88%E6%A8%A1%E5%BC%8F "架构师模式的直接链接")
| 方面 | 详细信息 |
| --- | --- |
| **描述** | 一位经验丰富的技术领导和规划者,帮助设计系统并创建实施计划 |
| **工具访问** | 访问 `read`、`browser`、`mcp` 和受限的 `edit`(仅限 markdown 文件) |
| **适合场景** | 系统设计、高层规划和架构讨论 |
| **特殊功能** | 遵循从信息收集到详细规划的结构化方法 |
### 调试模式[](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes#%E8%B0%83%E8%AF%95%E6%A8%A1%E5%BC%8F "调试模式的直接链接")
| 方面 | 详细信息 |
| --- | --- |
| **描述** | 一位擅长系统化故障排除和诊断的专家问题解决者 |
| **工具访问** | 完全访问所有工具组:`read`、`edit`、`browser`、`command`、`mcp` |
| **适合场景** | 追踪错误、诊断问题并解决复杂问题 |
| **特殊功能** | 使用分析、缩小可能性和修复问题的系统化方法 |
### 协调者模式[](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes#%E5%8D%8F%E8%B0%83%E8%80%85%E6%A8%A1%E5%BC%8F "协调者模式的直接链接")
| 方面 | 详细信息 |
| --- | --- |
| **描述** | 一位战略工作流协调者,通过将复杂任务委派给适当的专业模式来协调工作 |
| **工具访问** | 有限的访问权限,用于创建新任务和协调工作流 |
| **适合场景** | 将复杂项目分解为可管理的子任务,并分配给专业模式 |
| **特殊功能** | 使用 new\_task 工具将工作委派给其他模式 |
自定义模式[](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes#%E8%87%AA%E5%AE%9A%E4%B9%89%E6%A8%A1%E5%BC%8F "自定义模式的直接链接")
----------------------------------------------------------------------------------------------------------------------------
通过定义工具访问权限、文件权限和行为指令,创建你自己的专业助手。自定义模式有助于执行团队标准或创建特定用途的助手。有关设置说明,请参阅 [自定义模式文档](https://kilocode.ai/docs/zh-CN/features/custom-modes)
。
* [为什么使用不同的模式?](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes#%E4%B8%BA%E4%BB%80%E4%B9%88%E4%BD%BF%E7%94%A8%E4%B8%8D%E5%90%8C%E7%9A%84%E6%A8%A1%E5%BC%8F)
* [切换模式](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes#%E5%88%87%E6%8D%A2%E6%A8%A1%E5%BC%8F)
* [内置模式](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes#%E5%86%85%E7%BD%AE%E6%A8%A1%E5%BC%8F)
* [代码模式(默认)](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes#%E4%BB%A3%E7%A0%81%E6%A8%A1%E5%BC%8F%E9%BB%98%E8%AE%A4)
* [问答模式](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes#%E9%97%AE%E7%AD%94%E6%A8%A1%E5%BC%8F)
* [架构师模式](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes#%E6%9E%B6%E6%9E%84%E5%B8%88%E6%A8%A1%E5%BC%8F)
* [调试模式](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes#%E8%B0%83%E8%AF%95%E6%A8%A1%E5%BC%8F)
* [协调者模式](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes#%E5%8D%8F%E8%B0%83%E8%80%85%E6%A8%A1%E5%BC%8F)
* [自定义模式](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes#%E8%87%AA%E5%AE%9A%E4%B9%89%E6%A8%A1%E5%BC%8F)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fbasic-usage%2Fusing-modes)
---
# Task Todo List | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/basic-usage/task-todo-list#__docusaurus_skipToContent_fallback)
本页总览
**The big picture**: Never lose track of complex development tasks again. Task Todo Lists create interactive, persistent checklists that live right in your chat interface.
**Why it matters**: Complex workflows have lots of moving parts. Without structure, it's easy to miss steps, duplicate work, or forget what comes next.

How to trigger todo lists[](https://kilocode.ai/docs/zh-CN/basic-usage/task-todo-list#how-to-trigger-todo-lists "How to trigger todo lists的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------------
**Automatic triggers**:
* Complex tasks with multiple steps
* Working in Architect mode
* Multi-phase workflows with dependencies
**Manual triggers**:
* Ask Kilo to "use the [update\_todo\_list tool](https://kilocode.ai/docs/zh-CN/features/tools/update-todo-list)
"
* Say "create a todo list"
**The bottom line**: Kilo decides what goes in the list, but you can provide feedback during approval dialogs.
* * *
The old way vs. the new way[](https://kilocode.ai/docs/zh-CN/basic-usage/task-todo-list#the-old-way-vs-the-new-way "The old way vs. the new way的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------------------------
**Before**: You juggled task steps in your head or scattered notes, constantly wondering "what's next?"
**Now**: Kilo creates structured checklists that update automatically as work progresses. You see exactly where you are and what's coming up.
* * *
Where todo lists appear[](https://kilocode.ai/docs/zh-CN/basic-usage/task-todo-list#where-todo-lists-appear "Where todo lists appear的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------
**1\. Task Header Summary** Quick progress overview with your next important item

**2\. Interactive Tool Block** Full todo interface in chat where you can:
* See all items and their status
* Edit descriptions when Kilo asks for approval
* Stage changes using the "Edit" button
**3\. Environment Details** Background "REMINDERS" table that keeps Kilo informed about current progress
Task status decoded[](https://kilocode.ai/docs/zh-CN/basic-usage/task-todo-list#task-status-decoded "Task status decoded的直接链接")
---------------------------------------------------------------------------------------------------------------------------------
**Pending** → Empty checkbox (not started)

* * *
**In Progress** → Yellow dot (currently working)

* * *
**Completed** → Green checkmark (finished)

* * *
Common questions[](https://kilocode.ai/docs/zh-CN/basic-usage/task-todo-list#common-questions "Common questions的直接链接")
------------------------------------------------------------------------------------------------------------------------
**"Can I create my own todo lists?"** Yes, just ask Kilo to use the update\_todo\_list tool. But Kilo stays in control of the content and workflow.
**"What about simple tasks?"** Kilo typically skips todo lists for simple tasks. The overhead isn't worth it.
**"Why can't I directly edit the list?"** Design choice. Kilo maintains authority over task management to ensure consistent progress tracking. You provide input, Kilo executes.
* * *
提示
Pro tip: Auto-approval[](https://kilocode.ai/docs/zh-CN/basic-usage/task-todo-list#pro-tip-auto-approval "Pro tip: Auto-approval的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------------
**What it does**: Automatically approves todo list updates without confirmation prompts.
**When to use it**: Long workflows where constant interruptions slow you down.
**How to enable it**: Check the [Update Todo List auto-approval settings](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#update-todo-list)
.
**The catch**: Less control, but faster execution.
* [How to trigger todo lists](https://kilocode.ai/docs/zh-CN/basic-usage/task-todo-list#how-to-trigger-todo-lists)
* [The old way vs. the new way](https://kilocode.ai/docs/zh-CN/basic-usage/task-todo-list#the-old-way-vs-the-new-way)
* [Where todo lists appear](https://kilocode.ai/docs/zh-CN/basic-usage/task-todo-list#where-todo-lists-appear)
* [Task status decoded](https://kilocode.ai/docs/zh-CN/basic-usage/task-todo-list#task-status-decoded)
* [Common questions](https://kilocode.ai/docs/zh-CN/basic-usage/task-todo-list#common-questions)
* [Pro tip: Auto-approval](https://kilocode.ai/docs/zh-CN/basic-usage/task-todo-list#pro-tip-auto-approval)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fbasic-usage%2Ftask-todo-list)
---
# 聊天界面 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/basic-usage/the-chat-interface#__docusaurus_skipToContent_fallback)
本页总览
Kilo Code 的聊天界面是你与其交互的主要方式。它位于 Kilo Code 面板中,你可以通过点击 VS Code 主侧边栏中的 Kilo Code 图标()来打开它。
Kilo Code 面板也可以移动到 VS Code 的次侧边栏。如果你不小心关闭了 Kilo Code 面板,可以通过 视图 > 打开视图... 并搜索 "Kilo Code" 来重新打开它。
聊天界面的组成部分[](https://kilocode.ai/docs/zh-CN/basic-usage/the-chat-interface#%E8%81%8A%E5%A4%A9%E7%95%8C%E9%9D%A2%E7%9A%84%E7%BB%84%E6%88%90%E9%83%A8%E5%88%86 "聊天界面的组成部分的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
聊天界面由以下主要元素组成:
1. **聊天/任务历史记录:** 该区域显示你与 Kilo Code 之间的对话历史记录,或者如果你没有当前任务,则显示你创建的所有任务的历史记录。它显示你的请求、Kilo Code 的响应以及任何已执行的操作(如文件编辑或命令执行)。
2. **输入框:** 这是你输入任务和问题的地方。你可以使用 [纯英文](https://kilocode.ai/docs/zh-CN/)
来传达你希望 Kilo Code 执行的操作。
3. **操作按钮:** 这些按钮出现在输入框下方,允许你批准或拒绝 Kilo Code 提出的操作。根据上下文和你的 [自动批准设置](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions)
,可用的按钮会有所不同。
4. **发送按钮:** 这是一个小飞机图标,位于输入框的最右侧。在你输入消息后,点击此按钮即可发送消息。或者,你可以直接按 `Enter` 键。
5. **加号按钮:** 加号按钮位于顶部的标题栏中,用于启动一个新的任务会话。
6. **设置按钮:** 设置按钮是一个齿轮图标,用于打开设置以自定义功能或行为。
7. **模式选择器:** 模式选择器是一个下拉菜单,位于聊天输入框的左侧。它用于选择 Kilo Code 执行任务时使用的模式。

_Kilo Code 聊天界面的关键组件_
与消息交互[](https://kilocode.ai/docs/zh-CN/basic-usage/the-chat-interface#%E4%B8%8E%E6%B6%88%E6%81%AF%E4%BA%A4%E4%BA%92 "与消息交互的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------
* **可点击的链接:** 聊天历史记录中的文件路径、URL 和其他提及内容是可点击的。点击文件路径将在编辑器中打开该文件。点击 URL 将在默认浏览器中打开它。
* **复制文本:** 你可以通过选择文本并使用标准复制命令(`Ctrl/Cmd + C`)来复制聊天历史记录中的文本。某些元素(如代码块)具有专用的“复制”按钮。
* **展开和折叠:** 点击消息以展开或折叠它。
状态指示器[](https://kilocode.ai/docs/zh-CN/basic-usage/the-chat-interface#%E7%8A%B6%E6%80%81%E6%8C%87%E7%A4%BA%E5%99%A8 "状态指示器的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------
* **加载旋转器:** 当 Kilo Code 正在处理请求时,你会看到一个加载旋转器。
* **错误消息:** 如果发生错误,将显示一条红色错误消息。
* **成功消息:** 绿色消息表示操作已成功完成。
* [聊天界面的组成部分](https://kilocode.ai/docs/zh-CN/basic-usage/the-chat-interface#%E8%81%8A%E5%A4%A9%E7%95%8C%E9%9D%A2%E7%9A%84%E7%BB%84%E6%88%90%E9%83%A8%E5%88%86)
* [与消息交互](https://kilocode.ai/docs/zh-CN/basic-usage/the-chat-interface#%E4%B8%8E%E6%B6%88%E6%81%AF%E4%BA%A4%E4%BA%92)
* [状态指示器](https://kilocode.ai/docs/zh-CN/basic-usage/the-chat-interface#%E7%8A%B6%E6%80%81%E6%8C%87%E7%A4%BA%E5%99%A8)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fbasic-usage%2Fthe-chat-interface)
---
# 工具工作原理 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/basic-usage/how-tools-work#__docusaurus_skipToContent_fallback)
本页总览
Kilo Code 通过工具与你的代码和环境进行交互。这些专业助手可以执行特定操作,如读取文件、编辑内容、运行命令或搜索代码库。工具为常见开发任务提供自动化能力,无需手动执行。
工具工作流程[](https://kilocode.ai/docs/zh-CN/basic-usage/how-tools-work#%E5%B7%A5%E5%85%B7%E5%B7%A5%E4%BD%9C%E6%B5%81%E7%A8%8B "工具工作流程的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------
用自然语言描述你想完成的任务,Kilo Code 将会:
1. 根据你的请求选择合适的工具
2. 展示工具及其参数供你审核
3. 执行已批准的工具并显示结果
4. 重复此过程直至任务完成
工具分类[](https://kilocode.ai/docs/zh-CN/basic-usage/how-tools-work#%E5%B7%A5%E5%85%B7%E5%88%86%E7%B1%BB "工具分类的直接链接")
--------------------------------------------------------------------------------------------------------------------
| 类别 | 用途 | 工具名称 |
| --- | --- | --- |
| 读取 | 访问文件内容和代码结构 | `read_file`, `search_files`, `list_files`, `list_code_definition_names` |
| 编辑 | 创建或修改文件和代码 | `write_to_file`, `apply_diff` |
| 执行 | 运行命令和系统操作 | `execute_command` |
| 浏览器 | 与网页内容交互 | `browser_action` |
| 工作流 | 管理任务流程和上下文 | `ask_followup_question`, `attempt_completion`, `switch_mode`, `new_task` |
示例:工具使用[](https://kilocode.ai/docs/zh-CN/basic-usage/how-tools-work#%E7%A4%BA%E4%BE%8B%E5%B7%A5%E5%85%B7%E4%BD%BF%E7%94%A8 "示例:工具使用的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------------
以下是典型的工具交互过程:

_工具审批界面显示保存/拒绝按钮和自动批准选项。_
**用户:** 创建一个名为 `greeting.js` 的文件,用于输出问候消息
**Kilo Code:** (建议使用 `write_to_file` 工具,如上图所示)
greeting.jsfunction greet(name) { console.log(`Hello, ${name}!`);}greet('World');5
**用户:** (点击界面中的"保存"按钮)
**Kilo Code:** (确认文件创建成功)
工具安全与审批[](https://kilocode.ai/docs/zh-CN/basic-usage/how-tools-work#%E5%B7%A5%E5%85%B7%E5%AE%89%E5%85%A8%E4%B8%8E%E5%AE%A1%E6%89%B9 "工具安全与审批的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------------------------
每次使用工具都需要你的明确批准。当 Kilo 建议使用工具时,你会看到:
* "保存"按钮 - 批准并执行工具
* "拒绝"按钮 - 拒绝建议的工具
* 可选的"自动批准"设置 - 用于信任的操作
此安全机制确保你能完全控制哪些文件被修改、执行哪些命令以及如何更改代码库。执行前请务必仔细审查工具建议。
核心工具参考[](https://kilocode.ai/docs/zh-CN/basic-usage/how-tools-work#%E6%A0%B8%E5%BF%83%E5%B7%A5%E5%85%B7%E5%8F%82%E8%80%83 "核心工具参考的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------
| 工具名称 | 描述 | 类别 |
| --- | --- | --- |
| `read_file` | 读取带行号的文件内容 | 读取 |
| `search_files` | 跨文件搜索文本或正则表达式 | 读取 |
| `list_files` | 列出指定位置的文件和目录 | 读取 |
| `list_code_definition_names` | 列出类/函数等代码定义 | 读取 |
| `write_to_file` | 创建新文件或覆盖现有文件 | 编辑 |
| `apply_diff` | 对文件特定部分进行精确修改 | 编辑 |
| `execute_command` | 在 VS Code 终端中运行命令 | 执行 |
| `browser_action` | 在无头浏览器中执行操作 | 浏览器 |
| `ask_followup_question` | 向你提出澄清问题 | 工作流 |
| `attempt_completion` | 标记任务已完成 | 工作流 |
| `switch_mode` | 切换到不同操作模式 | 工作流 |
| `new_task` | 创建具有特定启动模式的子任务 | 工作流 |
了解更多工具信息[](https://kilocode.ai/docs/zh-CN/basic-usage/how-tools-work#%E4%BA%86%E8%A7%A3%E6%9B%B4%E5%A4%9A%E5%B7%A5%E5%85%B7%E4%BF%A1%E6%81%AF "了解更多工具信息的直接链接")
----------------------------------------------------------------------------------------------------------------------------------------------------------------
有关每个工具的完整参数参考和高级用法,请参阅[工具使用概述](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview)
文档。
* [工具工作流程](https://kilocode.ai/docs/zh-CN/basic-usage/how-tools-work#%E5%B7%A5%E5%85%B7%E5%B7%A5%E4%BD%9C%E6%B5%81%E7%A8%8B)
* [工具分类](https://kilocode.ai/docs/zh-CN/basic-usage/how-tools-work#%E5%B7%A5%E5%85%B7%E5%88%86%E7%B1%BB)
* [示例:工具使用](https://kilocode.ai/docs/zh-CN/basic-usage/how-tools-work#%E7%A4%BA%E4%BE%8B%E5%B7%A5%E5%85%B7%E4%BD%BF%E7%94%A8)
* [工具安全与审批](https://kilocode.ai/docs/zh-CN/basic-usage/how-tools-work#%E5%B7%A5%E5%85%B7%E5%AE%89%E5%85%A8%E4%B8%8E%E5%AE%A1%E6%89%B9)
* [核心工具参考](https://kilocode.ai/docs/zh-CN/basic-usage/how-tools-work#%E6%A0%B8%E5%BF%83%E5%B7%A5%E5%85%B7%E5%8F%82%E8%80%83)
* [了解更多工具信息](https://kilocode.ai/docs/zh-CN/basic-usage/how-tools-work#%E4%BA%86%E8%A7%A3%E6%9B%B4%E5%A4%9A%E5%B7%A5%E5%85%B7%E4%BF%A1%E6%81%AF)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fbasic-usage%2Fhow-tools-work)
---
# 为 Kilo Code 做贡献 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/extending/contributing-to-kilo#__docusaurus_skipToContent_fallback)
本页总览
Kilo Code 是一个开源项目,欢迎所有技能水平的开发者贡献代码。本指南将帮助你开始为 Kilo Code 做出贡献,无论是修复错误、添加功能、改进文档还是分享自定义模式。
贡献方式[](https://kilocode.ai/docs/zh-CN/extending/contributing-to-kilo#%E8%B4%A1%E7%8C%AE%E6%96%B9%E5%BC%8F "贡献方式的直接链接")
------------------------------------------------------------------------------------------------------------------------
有多种方式可以为 Kilo Code 做出贡献:
1. **代码贡献**:实现新功能或修复错误
2. **文档**:改进现有文档或创建新指南
3. **自定义模式**:创建并分享专用模式
4. **错误报告**:报告你遇到的问题
5. **功能请求**:建议新功能或改进
6. **社区支持**:在社区中帮助其他用户
设置开发环境[](https://kilocode.ai/docs/zh-CN/extending/contributing-to-kilo#%E8%AE%BE%E7%BD%AE%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83 "设置开发环境的直接链接")
----------------------------------------------------------------------------------------------------------------------------------------------
设置开发环境的详细说明请参阅[此页面](https://kilocode.ai/docs/zh-CN/extending/development-environment)
开发工作流[](https://kilocode.ai/docs/zh-CN/extending/contributing-to-kilo#%E5%BC%80%E5%8F%91%E5%B7%A5%E4%BD%9C%E6%B5%81 "开发工作流的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------
### 分支策略[](https://kilocode.ai/docs/zh-CN/extending/contributing-to-kilo#%E5%88%86%E6%94%AF%E7%AD%96%E7%95%A5 "分支策略的直接链接")
* 为每个功能或错误修复创建一个新分支
* 使用描述性的分支名称(例如 `feature/new-tool-support` 或 `fix/browser-action-bug`)
git checkout -b your-branch-name
### 编码标准[](https://kilocode.ai/docs/zh-CN/extending/contributing-to-kilo#%E7%BC%96%E7%A0%81%E6%A0%87%E5%87%86 "编码标准的直接链接")
* 遵循现有的代码风格和模式
* 新代码使用 TypeScript
* 为新功能包含适当的测试
* 更新文档以反映任何面向用户的更改
### 提交指南[](https://kilocode.ai/docs/zh-CN/extending/contributing-to-kilo#%E6%8F%90%E4%BA%A4%E6%8C%87%E5%8D%97 "提交指南的直接链接")
* 编写清晰、简洁的提交信息
* 在适用时引用问题编号
* 保持每次提交专注于单一更改
### 测试你的更改[](https://kilocode.ai/docs/zh-CN/extending/contributing-to-kilo#%E6%B5%8B%E8%AF%95%E4%BD%A0%E7%9A%84%E6%9B%B4%E6%94%B9 "测试你的更改的直接链接")
* 运行测试套件:
npm test
* 在开发扩展中手动测试你的更改
### 创建拉取请求[](https://kilocode.ai/docs/zh-CN/extending/contributing-to-kilo#%E5%88%9B%E5%BB%BA%E6%8B%89%E5%8F%96%E8%AF%B7%E6%B1%82 "创建拉取请求的直接链接")
1. 将你的更改推送到你的 fork:
git push origin your-branch-name
2. 前往 [Kilo Code 仓库](https://github.com/Kilo-Org/kilocode)
3. 点击 "New Pull Request" 并选择 "compare across forks"
4. 选择你的 fork 和分支
5. 填写 PR 模板,包括:
* 更改的清晰描述
* 任何相关问题
* 测试步骤
* 截图(如适用)
创建自定义模式[](https://kilocode.ai/docs/zh-CN/extending/contributing-to-kilo#%E5%88%9B%E5%BB%BA%E8%87%AA%E5%AE%9A%E4%B9%89%E6%A8%A1%E5%BC%8F "创建自定义模式的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------------------
自定义模式是扩展 Kilo Code 功能的强大方式。要创建并分享自定义模式:
1. 按照 [自定义模式文档](https://kilocode.ai/docs/zh-CN/features/custom-modes)
创建你的模式
2. 彻底测试你的模式
3. 通过提交 [GitHub Discussion](https://github.com/Kilo-Org/kilocode/discussions)
与社区分享你的模式
文档贡献[](https://kilocode.ai/docs/zh-CN/extending/contributing-to-kilo#%E6%96%87%E6%A1%A3%E8%B4%A1%E7%8C%AE "文档贡献的直接链接")
------------------------------------------------------------------------------------------------------------------------
文档改进是非常有价值的贡献:
1. 遵循文档风格指南:
* 使用清晰、简洁的语言
* 在适当时包含示例
* 使用以 `/docs/` 开头的绝对路径作为内部链接
* 不要在链接中包含 `.md` 扩展名
2. 通过本地运行文档站点测试你的文档更改:
cd docsnpm installnpm start
3. 提交包含文档更改的 PR
社区准则[](https://kilocode.ai/docs/zh-CN/extending/contributing-to-kilo#%E7%A4%BE%E5%8C%BA%E5%87%86%E5%88%99 "社区准则的直接链接")
------------------------------------------------------------------------------------------------------------------------
参与 Kilo Code 社区时:
* 保持尊重和包容
* 提供建设性的反馈
* 帮助新手入门
* 遵守 [行为准则](https://github.com/Kilo-Org/kilocode/blob/main/CODE_OF_CONDUCT.md)
获取帮助[](https://kilocode.ai/docs/zh-CN/extending/contributing-to-kilo#%E8%8E%B7%E5%8F%96%E5%B8%AE%E5%8A%A9 "获取帮助的直接链接")
------------------------------------------------------------------------------------------------------------------------
如果你需要帮助:
* 加入我们的 [Discord 社区](https://kilocode.ai/discord)
获取实时支持
* 在 [GitHub Discussions](https://github.com/Kilo-Org/kilocode/discussions)
上提问
* 访问我们的 [Reddit 社区](https://www.reddit.com/r/KiloCode)
致谢[](https://kilocode.ai/docs/zh-CN/extending/contributing-to-kilo#%E8%87%B4%E8%B0%A2 "致谢的直接链接")
--------------------------------------------------------------------------------------------------
所有贡献者都是 Kilo Code 社区的重要成员。贡献者将在以下地方获得认可:
* 发布说明
* 项目的 README
* GitHub 上的贡献者列表
感谢你为 Kilo Code 做出贡献,帮助让 AI 驱动的编码辅助对每个人更好!
* [贡献方式](https://kilocode.ai/docs/zh-CN/extending/contributing-to-kilo#%E8%B4%A1%E7%8C%AE%E6%96%B9%E5%BC%8F)
* [设置开发环境](https://kilocode.ai/docs/zh-CN/extending/contributing-to-kilo#%E8%AE%BE%E7%BD%AE%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83)
* [开发工作流](https://kilocode.ai/docs/zh-CN/extending/contributing-to-kilo#%E5%BC%80%E5%8F%91%E5%B7%A5%E4%BD%9C%E6%B5%81)
* [分支策略](https://kilocode.ai/docs/zh-CN/extending/contributing-to-kilo#%E5%88%86%E6%94%AF%E7%AD%96%E7%95%A5)
* [编码标准](https://kilocode.ai/docs/zh-CN/extending/contributing-to-kilo#%E7%BC%96%E7%A0%81%E6%A0%87%E5%87%86)
* [提交指南](https://kilocode.ai/docs/zh-CN/extending/contributing-to-kilo#%E6%8F%90%E4%BA%A4%E6%8C%87%E5%8D%97)
* [测试你的更改](https://kilocode.ai/docs/zh-CN/extending/contributing-to-kilo#%E6%B5%8B%E8%AF%95%E4%BD%A0%E7%9A%84%E6%9B%B4%E6%94%B9)
* [创建拉取请求](https://kilocode.ai/docs/zh-CN/extending/contributing-to-kilo#%E5%88%9B%E5%BB%BA%E6%8B%89%E5%8F%96%E8%AF%B7%E6%B1%82)
* [创建自定义模式](https://kilocode.ai/docs/zh-CN/extending/contributing-to-kilo#%E5%88%9B%E5%BB%BA%E8%87%AA%E5%AE%9A%E4%B9%89%E6%A8%A1%E5%BC%8F)
* [文档贡献](https://kilocode.ai/docs/zh-CN/extending/contributing-to-kilo#%E6%96%87%E6%A1%A3%E8%B4%A1%E7%8C%AE)
* [社区准则](https://kilocode.ai/docs/zh-CN/extending/contributing-to-kilo#%E7%A4%BE%E5%8C%BA%E5%87%86%E5%88%99)
* [获取帮助](https://kilocode.ai/docs/zh-CN/extending/contributing-to-kilo#%E8%8E%B7%E5%8F%96%E5%B8%AE%E5%8A%A9)
* [致谢](https://kilocode.ai/docs/zh-CN/extending/contributing-to-kilo#%E8%87%B4%E8%B0%A2)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fextending%2Fcontributing-to-kilo)
---
# API 配置档案 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/api-configuration-profiles#__docusaurus_skipToContent_fallback)
本页总览
API 配置档案允许你创建和切换不同的 AI 设置集合。每个档案可以为每个模式配置不同的设置,让你根据任务优化使用体验。
信息
拥有多个配置档案可以让你快速在不同 AI 提供商、模型和设置之间切换,而无需每次更改设置时重新配置所有内容。
工作原理[](https://kilocode.ai/docs/zh-CN/features/api-configuration-profiles#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86 "工作原理的直接链接")
-----------------------------------------------------------------------------------------------------------------------------
配置档案可以包含以下内容:
* API 提供商(OpenAI、Anthropic、OpenRouter、Glama 等)
* API 密钥和认证信息
* 模型选择(o3-mini-high、Claude 3.7 Sonnet、DeepSeek R1 等)
* [温度设置](https://kilocode.ai/docs/zh-CN/features/model-temperature)
,用于控制响应随机性
* 思考预算
* 提供商特定设置
请注意,可用设置因提供商和模型而异。每个提供商提供不同的配置选项,即使在同一提供商中,不同模型也可能支持不同的参数范围或功能。
创建和管理档案[](https://kilocode.ai/docs/zh-CN/features/api-configuration-profiles#%E5%88%9B%E5%BB%BA%E5%92%8C%E7%AE%A1%E7%90%86%E6%A1%A3%E6%A1%88 "创建和管理档案的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------------------------------
### 创建档案[](https://kilocode.ai/docs/zh-CN/features/api-configuration-profiles#%E5%88%9B%E5%BB%BA%E6%A1%A3%E6%A1%88 "创建档案的直接链接")
1. 打开设置,点击齿轮图标 → 提供商
2. 点击档案选择器旁边的 "+" 按钮

3. 输入新档案的名称

4. 配置档案设置:
* 选择你的 API 提供商

* 输入 API 密钥

* 选择模型

* 调整模型参数

### 切换档案[](https://kilocode.ai/docs/zh-CN/features/api-configuration-profiles#%E5%88%87%E6%8D%A2%E6%A1%A3%E6%A1%88 "切换档案的直接链接")
切换档案的两种方式:
1. 从设置面板:从下拉菜单中选择不同的档案

2. 在聊天过程中:访问聊天界面中的 API 配置下拉菜单

### 固定和排序档案[](https://kilocode.ai/docs/zh-CN/features/api-configuration-profiles#%E5%9B%BA%E5%AE%9A%E5%92%8C%E6%8E%92%E5%BA%8F%E6%A1%A3%E6%A1%88 "固定和排序档案的直接链接")
API 配置下拉菜单现在支持固定常用档案以便快速访问:
1. 将鼠标悬停在下拉菜单中的任何档案上以显示固定图标
2. 点击固定图标将档案添加到固定列表
3. 固定的档案将按字母顺序显示在下拉菜单的顶部
4. 未固定的档案将显示在分隔符下方,同样按字母顺序排序
5. 你可以再次点击该图标取消固定档案

此功能使你更容易在常用配置之间切换,特别是在你拥有许多配置时。
### 编辑和删除档案[](https://kilocode.ai/docs/zh-CN/features/api-configuration-profiles#%E7%BC%96%E8%BE%91%E5%92%8C%E5%88%A0%E9%99%A4%E6%A1%A3%E6%A1%88 "编辑和删除档案的直接链接")

* 在设置中选择档案以修改任何设置
* 点击铅笔图标重命名档案
* 点击垃圾桶图标删除档案(不能删除最后一个档案)
将档案与模式关联[](https://kilocode.ai/docs/zh-CN/features/api-configuration-profiles#%E5%B0%86%E6%A1%A3%E6%A1%88%E4%B8%8E%E6%A8%A1%E5%BC%8F%E5%85%B3%E8%81%94 "将档案与模式关联的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
在 提示标签中,你可以显式地将特定配置档案与每个模式关联。系统还会自动记住你上次与每个模式一起使用的档案,从而提高工作效率。

安全提示[](https://kilocode.ai/docs/zh-CN/features/api-configuration-profiles#%E5%AE%89%E5%85%A8%E6%8F%90%E7%A4%BA "安全提示的直接链接")
-----------------------------------------------------------------------------------------------------------------------------
API 密钥安全地存储在 VSCode 的 Secret Storage 中,永远不会以明文形式暴露。
相关功能[](https://kilocode.ai/docs/zh-CN/features/api-configuration-profiles#%E7%9B%B8%E5%85%B3%E5%8A%9F%E8%83%BD "相关功能的直接链接")
-----------------------------------------------------------------------------------------------------------------------------
* 与你创建的[自定义模式](https://kilocode.ai/docs/zh-CN/features/custom-modes)
配合使用
* 集成[本地模型](https://kilocode.ai/docs/zh-CN/advanced-usage/local-models)
以进行离线工作
* 支持每个模式的[温度设置](https://kilocode.ai/docs/zh-CN/features/model-temperature)
* 通过[速率限制和使用跟踪](https://kilocode.ai/docs/zh-CN/advanced-usage/rate-limits-costs)
增强成本管理
* [工作原理](https://kilocode.ai/docs/zh-CN/features/api-configuration-profiles#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86)
* [创建和管理档案](https://kilocode.ai/docs/zh-CN/features/api-configuration-profiles#%E5%88%9B%E5%BB%BA%E5%92%8C%E7%AE%A1%E7%90%86%E6%A1%A3%E6%A1%88)
* [创建档案](https://kilocode.ai/docs/zh-CN/features/api-configuration-profiles#%E5%88%9B%E5%BB%BA%E6%A1%A3%E6%A1%88)
* [切换档案](https://kilocode.ai/docs/zh-CN/features/api-configuration-profiles#%E5%88%87%E6%8D%A2%E6%A1%A3%E6%A1%88)
* [固定和排序档案](https://kilocode.ai/docs/zh-CN/features/api-configuration-profiles#%E5%9B%BA%E5%AE%9A%E5%92%8C%E6%8E%92%E5%BA%8F%E6%A1%A3%E6%A1%88)
* [编辑和删除档案](https://kilocode.ai/docs/zh-CN/features/api-configuration-profiles#%E7%BC%96%E8%BE%91%E5%92%8C%E5%88%A0%E9%99%A4%E6%A1%A3%E6%A1%88)
* [将档案与模式关联](https://kilocode.ai/docs/zh-CN/features/api-configuration-profiles#%E5%B0%86%E6%A1%A3%E6%A1%88%E4%B8%8E%E6%A8%A1%E5%BC%8F%E5%85%B3%E8%81%94)
* [安全提示](https://kilocode.ai/docs/zh-CN/features/api-configuration-profiles#%E5%AE%89%E5%85%A8%E6%8F%90%E7%A4%BA)
* [相关功能](https://kilocode.ai/docs/zh-CN/features/api-configuration-profiles#%E7%9B%B8%E5%85%B3%E5%8A%9F%E8%83%BD)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Fapi-configuration-profiles)
---
# 开发环境 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/extending/development-environment#__docusaurus_skipToContent_fallback)
本页总览
本文档将帮助你设置开发环境,并了解如何与代码库一起工作。无论你是修复错误、添加功能,还是仅仅探索代码,本指南都将帮助你入门。
先决条件[](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E5%85%88%E5%86%B3%E6%9D%A1%E4%BB%B6 "先决条件的直接链接")
---------------------------------------------------------------------------------------------------------------------------
在开始之前,请确保已安装以下内容:
1. **Git** - 用于版本控制
2. **Node.js**(建议使用 [v20.18.1](https://github.com/Kilo-Org/kilocode/blob/main/.nvmrc)
或更高版本)和 npm
3. **Visual Studio Code** - 我们推荐的开发 IDE
入门[](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E5%85%A5%E9%97%A8 "入门的直接链接")
-----------------------------------------------------------------------------------------------------
### 安装[](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E5%AE%89%E8%A3%85 "安装的直接链接")
1. **Fork 并克隆仓库**:
* **Fork 仓库**:
* 访问 [Kilo Code GitHub 仓库](https://github.com/Kilo-Org/kilocode)
* 点击右上角的 "Fork" 按钮,创建你自己的副本。
* **克隆你的 Fork**:
git clone https://github.com/[YOUR-USERNAME]/kilocode.gitcd kilocode
将 `[YOUR-USERNAME]` 替换为你的 GitHub 用户名。
2. **安装依赖项**:
npm run install:all
此命令将为主扩展、Webview UI 和 e2e 测试安装依赖项。
3. **安装 VSCode 扩展**:
* **必需**:[ESBuild Problem Matchers](https://marketplace.visualstudio.com/items?itemName=connor4312.esbuild-problem-matchers)
- 帮助正确显示构建错误。
虽然不是运行扩展所必需的,但以下扩展建议用于开发:
* [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
- 将 ESLint 集成到 VS Code 中。
* [Prettier - Code formatter](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
- 将 Prettier 集成到 VS Code 中。
推荐的扩展完整列表在[这里](https://github.com/Kilo-Org/kilocode/blob/main/.vscode/extensions.json)
### 项目结构[](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E9%A1%B9%E7%9B%AE%E7%BB%93%E6%9E%84 "项目结构的直接链接")
项目组织为以下几个关键目录:
* **`src/`** - 核心扩展代码
* **`core/`** - 核心功能和工具
* **`services/`** - 服务实现
* **`webview-ui/`** - 前端 UI 代码
* **`e2e/`** - 端到端测试
* **`scripts/`** - 实用脚本
* **`assets/`** - 静态资源,如图片和图标
开发工作流[](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E5%BC%80%E5%8F%91%E5%B7%A5%E4%BD%9C%E6%B5%81 "开发工作流的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------
### 构建扩展[](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E6%9E%84%E5%BB%BA%E6%89%A9%E5%B1%95 "构建扩展的直接链接")
要构建扩展:
npm run build
这将:
1. 构建 Webview UI
2. 编译 TypeScript
3. 打包扩展
4. 在 `bin/` 目录下创建 `.vsix` 文件
### 运行扩展[](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E8%BF%90%E8%A1%8C%E6%89%A9%E5%B1%95 "运行扩展的直接链接")
要在开发模式下运行扩展:
1. 在 VSCode 中按 `F5`(或选择 **Run** → **Start Debugging**)
2. 这将打开一个新的 VSCode 窗口,并加载 Kilo Code
### 热重载[](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E7%83%AD%E9%87%8D%E8%BD%BD "热重载的直接链接")
* **Webview UI 变更**:Webview UI 的变更会立即生效,无需重启
* **核心扩展变更**:核心扩展代码的变更会自动重新加载扩展主机
在开发模式下(NODE\_ENV="development"),更改核心代码将触发 `workbench.action.reloadWindow` 命令,因此不再需要手动启动/停止调试器和任务。
> **重要提示**:在生产构建中,更改核心扩展代码时,你需要:
>
> 1. 停止调试过程
> 2. 终止任何在后台运行的 npm 任务(见下图)
> 3. 重新开始调试

### 安装构建的扩展[](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E5%AE%89%E8%A3%85%E6%9E%84%E5%BB%BA%E7%9A%84%E6%89%A9%E5%B1%95 "安装构建的扩展的直接链接")
要安装你构建的扩展:
code --install-extension "$(ls -1v bin/kilo-code-*.vsix | tail -n1)"
将 `[version]` 替换为当前版本号。
测试[](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E6%B5%8B%E8%AF%95 "测试的直接链接")
-----------------------------------------------------------------------------------------------------
Kilo Code 使用多种测试来确保质量:
### 单元测试[](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E5%8D%95%E5%85%83%E6%B5%8B%E8%AF%95 "单元测试的直接链接")
运行单元测试:
npm test
这将运行扩展和 Webview 测试。
要运行特定测试套件:
npm run test:extension # 仅运行扩展测试npm run test:webview # 仅运行 Webview 测试
### 端到端测试[](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E7%AB%AF%E5%88%B0%E7%AB%AF%E6%B5%8B%E8%AF%95 "端到端测试的直接链接")
E2E 测试验证扩展在 VSCode 中是否正确工作:
1. 在根目录下创建 `.env.local` 文件,包含所需的 API 密钥:
OPENROUTER_API_KEY=sk-or-v1-...
2. 运行集成测试:
npm run test:integration
有关 E2E 测试的更多详细信息,请参阅 [e2e/VSCODE\_INTEGRATION\_TESTS.md](https://github.com/Kilo-Org/kilocode/blob/main/e2e/VSCODE_INTEGRATION_TESTS.md)
。
代码检查和类型检查[](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E4%BB%A3%E7%A0%81%E6%A3%80%E6%9F%A5%E5%92%8C%E7%B1%BB%E5%9E%8B%E6%A3%80%E6%9F%A5 "代码检查和类型检查的直接链接")
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
确保你的代码符合我们的质量标准:
npm run lint # 运行 ESLintnpm run check-types # 运行 TypeScript 类型检查
Git 钩子[](https://kilocode.ai/docs/zh-CN/extending/development-environment#git-%E9%92%A9%E5%AD%90 "Git 钩子的直接链接")
-----------------------------------------------------------------------------------------------------------------
该项目使用 [Husky](https://typicode.github.io/husky/)
来管理 Git 钩子,这些钩子会在提交和推送之前自动执行某些检查。钩子位于 `.husky/` 目录中。
### 预提交钩子[](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E9%A2%84%E6%8F%90%E4%BA%A4%E9%92%A9%E5%AD%90 "预提交钩子的直接链接")
在提交完成之前,`.husky/pre-commit` 钩子会运行:
1. **分支检查**:防止直接提交到 `main` 分支。
2. **类型生成**:运行 `npm run generate-types`。
3. **类型文件检查**:确保类型生成对 `src/exports/roo-code.d.ts` 的更改已暂存。
4. **代码检查**:运行 `lint-staged` 以检查和格式化暂存的文件。
### 预推送钩子[](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E9%A2%84%E6%8E%A8%E9%80%81%E9%92%A9%E5%AD%90 "预推送钩子的直接链接")
在将更改推送到远程仓库之前,`.husky/pre-push` 钩子会运行:
1. **分支检查**:防止直接推送到 `main` 分支。
2. **编译**:运行 `npm run compile` 以确保项目成功构建。
3. **变更集检查**:检查 `.changeset/` 中是否存在变更集文件,并提醒你使用 `npm run changeset` 创建一个。
这些钩子有助于保持代码质量和一致性。如果遇到提交或推送问题,请检查这些钩子的输出以获取错误信息。
故障排除[](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E6%95%85%E9%9A%9C%E6%8E%92%E9%99%A4 "故障排除的直接链接")
---------------------------------------------------------------------------------------------------------------------------
### 常见问题[](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98 "常见问题的直接链接")
1. **扩展未加载**:检查 VSCode 开发者工具(Help > Toggle Developer Tools)中的错误
2. **Webview 未更新**:尝试重新加载窗口(Developer: Reload Window)
3. **构建错误**:确保所有依赖项都已通过 `npm run install:all` 安装
### 调试技巧[](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E8%B0%83%E8%AF%95%E6%8A%80%E5%B7%A7 "调试技巧的直接链接")
* 在代码中使用 `console.log()` 语句进行调试
* 检查 VSCode 中的输出面板(View > Output)并从下拉菜单中选择 "Kilo Code"
* 对于 Webview 问题,请在 Webview 中使用浏览器开发者工具(右键点击 > "Inspect Element")
* [先决条件](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E5%85%88%E5%86%B3%E6%9D%A1%E4%BB%B6)
* [入门](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E5%85%A5%E9%97%A8)
* [安装](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E5%AE%89%E8%A3%85)
* [项目结构](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E9%A1%B9%E7%9B%AE%E7%BB%93%E6%9E%84)
* [开发工作流](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E5%BC%80%E5%8F%91%E5%B7%A5%E4%BD%9C%E6%B5%81)
* [构建扩展](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E6%9E%84%E5%BB%BA%E6%89%A9%E5%B1%95)
* [运行扩展](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E8%BF%90%E8%A1%8C%E6%89%A9%E5%B1%95)
* [热重载](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E7%83%AD%E9%87%8D%E8%BD%BD)
* [安装构建的扩展](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E5%AE%89%E8%A3%85%E6%9E%84%E5%BB%BA%E7%9A%84%E6%89%A9%E5%B1%95)
* [测试](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E6%B5%8B%E8%AF%95)
* [单元测试](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E5%8D%95%E5%85%83%E6%B5%8B%E8%AF%95)
* [端到端测试](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E7%AB%AF%E5%88%B0%E7%AB%AF%E6%B5%8B%E8%AF%95)
* [代码检查和类型检查](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E4%BB%A3%E7%A0%81%E6%A3%80%E6%9F%A5%E5%92%8C%E7%B1%BB%E5%9E%8B%E6%A3%80%E6%9F%A5)
* [Git 钩子](https://kilocode.ai/docs/zh-CN/extending/development-environment#git-%E9%92%A9%E5%AD%90)
* [预提交钩子](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E9%A2%84%E6%8F%90%E4%BA%A4%E9%92%A9%E5%AD%90)
* [预推送钩子](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E9%A2%84%E6%8E%A8%E9%80%81%E9%92%A9%E5%AD%90)
* [故障排除](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E6%95%85%E9%9A%9C%E6%8E%92%E9%99%A4)
* [常见问题](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98)
* [调试技巧](https://kilocode.ai/docs/zh-CN/extending/development-environment#%E8%B0%83%E8%AF%95%E6%8A%80%E5%B7%A7)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fextending%2Fdevelopment-environment)
---
# 自动批准操作 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#__docusaurus_skipToContent_fallback)
本页总览
> ⚠️ **安全警告:** 自动批准设置会绕过确认提示,使 Kilo Code 可以直接访问你的系统。这可能导致**数据丢失、文件损坏或其他更严重的后果**。命令行访问尤其危险,因为它可能执行有害操作,损害你的系统或危及安全性。仅对你完全信任的操作启用自动批准。
自动批准设置通过消除重复的确认提示来加快你的工作流程,但会显著增加安全风险。
快速入门指南[](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#%E5%BF%AB%E9%80%9F%E5%85%A5%E9%97%A8%E6%8C%87%E5%8D%97 "快速入门指南的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------------------
1. 点击聊天输入框上方的“自动批准工具栏”
2. 选择 Kilo Code 可以无需许可执行的操作
3. 使用主开关(最左侧的复选框)快速启用/禁用所有权限
自动批准工具栏[](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#%E8%87%AA%E5%8A%A8%E6%89%B9%E5%87%86%E5%B7%A5%E5%85%B7%E6%A0%8F "自动批准工具栏的直接链接")
----------------------------------------------------------------------------------------------------------------------------------------------------------

_提示框和自动批准工具栏,显示已启用的权限_
点击工具栏以展开并配置各个权限:

_提示文本框和展开的工具栏,显示所有选项_
### 可用权限[](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#%E5%8F%AF%E7%94%A8%E6%9D%83%E9%99%90 "可用权限的直接链接")
| 权限 | 功能 | 风险等级 |
| --- | --- | --- |
| **读取文件和目录** | 允许 Kilo Code 无需询问即可访问文件 | 中 |
| **编辑文件** | 允许 Kilo Code 无需询问即可修改文件 | **高** |
| **执行已批准的命令** | 自动运行白名单中的终端命令 | **高** |
| **使用浏览器** | 允许无头浏览器交互 | 中 |
| **使用 MCP 服务器** | 允许 Kilo Code 使用配置的 MCP 服务 | 中高 |
| **切换模式** | 自动在 Kilo Code 模式之间切换 | 低 |
| **创建和完成任务** | 无需确认即可管理子任务 | 低 |
| **重试失败的请求** | 自动重试失败的 API 请求 | 低 |
主开关快速控制[](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#%E4%B8%BB%E5%BC%80%E5%85%B3%E5%BF%AB%E9%80%9F%E6%8E%A7%E5%88%B6 "主开关快速控制的直接链接")
----------------------------------------------------------------------------------------------------------------------------------------------------------
最左侧的复选框作为主开关:

_主开关(复选框)可一次性控制所有自动批准权限_
在以下情况下使用主开关:
* 处理敏感代码时(关闭)
* 进行快速开发时(开启)
* 在探索和编辑任务之间切换时
高级设置面板[](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#%E9%AB%98%E7%BA%A7%E8%AE%BE%E7%BD%AE%E9%9D%A2%E6%9D%BF "高级设置面板的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------------------
设置面板提供了详细的控制和重要的安全上下文:
> **允许 Kilo Code 自动执行操作而无需批准。仅在你完全信任 AI 并了解相关安全风险时启用这些设置。**
要访问这些设置:
1. 点击右上角的
2. 导航到“自动批准设置”

_完整设置面板视图_
### 读取操作[](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#%E8%AF%BB%E5%8F%96%E6%93%8D%E4%BD%9C "读取操作的直接链接")
读取操作

**设置:**“始终批准只读操作”
**描述:**“启用后,Kilo Code 将自动查看目录内容并读取文件,而无需你点击批准按钮。”
\*\*风险等级:\*\*中
虽然此设置仅允许读取文件(不允许修改),但它可能会暴露敏感数据。对于大多数用户来说,仍建议作为起点,但要注意 Kilo Code 可以访问哪些文件。
### 写入操作[](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#%E5%86%99%E5%85%A5%E6%93%8D%E4%BD%9C "写入操作的直接链接")
写入操作

**设置:**“始终批准写入操作”
**描述:**“自动创建和编辑文件而无需批准”
**延迟滑块:**“写入后的延迟时间,以便诊断工具检测潜在问题”(默认:1000ms)
\*\*风险等级:\*\*高
此设置允许 Kilo Code 无需确认即可修改你的文件。延迟计时器至关重要:
* 较高的值(2000ms+):适用于诊断时间较长的复杂项目
* 默认值(1000ms):适用于大多数项目
* 较低的值:仅在速度至关重要且处于受控环境中时使用
* 零:无诊断延迟(不建议用于关键代码)
#### 写入延迟与问题面板集成[](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#%E5%86%99%E5%85%A5%E5%BB%B6%E8%BF%9F%E4%B8%8E%E9%97%AE%E9%A2%98%E9%9D%A2%E6%9D%BF%E9%9B%86%E6%88%90 "写入延迟与问题面板集成的直接链接")

_VSCode 问题面板,Kilo Code 在写入延迟期间检查该面板_
当你启用写文件的自动批准时,延迟计时器会与 VSCode 的问题面板配合使用:
1. Kilo Code 更改你的文件
2. VSCode 的诊断工具分析更改
3. 问题面板更新,显示任何错误或警告
4. Kilo Code 在继续之前注意到这些问题
这类似于开发人员在更改代码后暂停检查错误。你可以根据以下因素调整延迟时间:
* 项目复杂性
* 语言服务器速度
* 错误检测对你工作流程的重要性
### 浏览器操作[](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#%E6%B5%8F%E8%A7%88%E5%99%A8%E6%93%8D%E4%BD%9C "浏览器操作的直接链接")
浏览器操作

**设置:**“始终批准浏览器操作”
**描述:**“自动执行浏览器操作而无需批准”
**注意:**“仅当模型支持计算机使用时适用”
\*\*风险等级:\*\*中
允许 Kilo Code 无需确认即可控制无头浏览器。这包括:
* 打开网站
* 导航页面
* 与网页元素交互
考虑允许自动浏览器访问的安全影响。
### API 请求[](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#api-%E8%AF%B7%E6%B1%82 "API 请求的直接链接")
API 请求

**设置:**“始终重试失败的 API 请求”
**描述:**“当服务器返回错误响应时,自动重试失败的 API 请求”
**延迟滑块:**“重试请求前的延迟时间”(默认:5s)
\*\*风险等级:\*\*低
此设置在 API 调用失败时自动重试。延迟控制 Kilo Code 在重试前的等待时间:
* 较长的延迟对 API 速率限制更友好
* 较短的延迟可以更快地从临时错误中恢复
### MCP 工具[](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#mcp-%E5%B7%A5%E5%85%B7 "MCP 工具的直接链接")
MCP 工具

**设置:**“始终批准 MCP 工具”
**描述:**“在 MCP 服务器视图中启用各个 MCP 工具的自动批准(需同时启用此设置和工具的‘始终允许’复选框)”
\*\*风险等级:\*\*中高(取决于配置的 MCP 工具)
此设置与 MCP 服务器视图中的各个工具权限配合使用。必须同时启用此全局设置和工具特定权限才能实现自动批准。
### 模式切换[](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#%E6%A8%A1%E5%BC%8F%E5%88%87%E6%8D%A2 "模式切换的直接链接")
模式切换

**设置:**“始终批准模式切换”
**描述:**“自动在不同模式之间切换而无需批准”
\*\*风险等级:\*\*低
允许 Kilo Code 无需许可即可在不同模式(代码、架构师等)之间切换。这主要影响 AI 的行为,而不是系统访问。
### 子任务[](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#%E5%AD%90%E4%BB%BB%E5%8A%A1 "子任务的直接链接")
子任务

**设置:**“始终批准子任务的创建和完成”
**描述:**“允许创建和完成子任务而无需批准”
\*\*风险等级:\*\*低
允许 Kilo Code 自动创建和完成子任务。这涉及工作流程组织而非系统访问。
### 命令执行[](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#%E5%91%BD%E4%BB%A4%E6%89%A7%E8%A1%8C "命令执行的直接链接")
命令执行

**设置:**“始终批准允许的执行操作”
**描述:**“自动执行允许的终端命令而无需批准”
**命令管理:**“当启用‘始终批准执行操作’时,可以自动执行的命令前缀。添加 \* 以允许所有命令(请谨慎使用)。”
\*\*风险等级:\*\*高
此设置允许终端命令执行并带有控制。虽然风险较高,但白名单功能限制了可以运行的命令。重要的安全功能:
* 白名单特定的命令前缀(推荐)
* 切勿在生产环境或处理敏感数据时使用 \* 通配符
* 考虑每个允许命令的安全影响
* 始终验证与外部系统交互的命令
**界面元素:**
* 输入命令前缀的文本字段(例如 'git')
* 添加新前缀的“添加”按钮
* 带 X 的可点击命令按钮以删除它们
* [快速入门指南](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#%E5%BF%AB%E9%80%9F%E5%85%A5%E9%97%A8%E6%8C%87%E5%8D%97)
* [自动批准工具栏](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#%E8%87%AA%E5%8A%A8%E6%89%B9%E5%87%86%E5%B7%A5%E5%85%B7%E6%A0%8F)
* [可用权限](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#%E5%8F%AF%E7%94%A8%E6%9D%83%E9%99%90)
* [主开关快速控制](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#%E4%B8%BB%E5%BC%80%E5%85%B3%E5%BF%AB%E9%80%9F%E6%8E%A7%E5%88%B6)
* [高级设置面板](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#%E9%AB%98%E7%BA%A7%E8%AE%BE%E7%BD%AE%E9%9D%A2%E6%9D%BF)
* [读取操作](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#%E8%AF%BB%E5%8F%96%E6%93%8D%E4%BD%9C)
* [写入操作](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#%E5%86%99%E5%85%A5%E6%93%8D%E4%BD%9C)
* [浏览器操作](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#%E6%B5%8F%E8%A7%88%E5%99%A8%E6%93%8D%E4%BD%9C)
* [API 请求](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#api-%E8%AF%B7%E6%B1%82)
* [MCP 工具](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#mcp-%E5%B7%A5%E5%85%B7)
* [模式切换](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#%E6%A8%A1%E5%BC%8F%E5%88%87%E6%8D%A2)
* [子任务](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#%E5%AD%90%E4%BB%BB%E5%8A%A1)
* [命令执行](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions#%E5%91%BD%E4%BB%A4%E6%89%A7%E8%A1%8C)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Fauto-approving-actions)
---
# 实验性功能 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/experimental/experimental-features#__docusaurus_skipToContent_fallback)
本页总览
Kilo Code 包含一些仍在开发中的实验性功能。这些功能可能不稳定,会在未来版本中发生重大变化,甚至可能被移除。请谨慎使用,并注意它们可能无法按预期工作。
**警告:** 实验性功能可能存在意外行为,包括潜在的数据丢失或安全漏洞。启用这些功能需自行承担风险。
启用实验性功能[](https://kilocode.ai/docs/zh-CN/features/experimental/experimental-features#%E5%90%AF%E7%94%A8%E5%AE%9E%E9%AA%8C%E6%80%A7%E5%8A%9F%E8%83%BD "启用实验性功能的直接链接")
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
要启用或禁用实验性功能:
1. 打开 Kilo Code 设置(右上角的 图标)。
2. 进入“高级设置”部分。
3. 找到“实验性功能”部分。
4. 勾选或取消勾选要启用或禁用的功能。
5. 点击“完成”保存更改。
当前可用的实验性功能[](https://kilocode.ai/docs/zh-CN/features/experimental/experimental-features#%E5%BD%93%E5%89%8D%E5%8F%AF%E7%94%A8%E7%9A%84%E5%AE%9E%E9%AA%8C%E6%80%A7%E5%8A%9F%E8%83%BD "当前可用的实验性功能的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
以下实验性功能目前可用:
### 搜索和替换[](https://kilocode.ai/docs/zh-CN/features/experimental/experimental-features#%E6%90%9C%E7%B4%A2%E5%92%8C%E6%9B%BF%E6%8D%A2 "搜索和替换的直接链接")
添加了一个用于在文件中搜索和替换文本的新工具。
### 插入内容[](https://kilocode.ai/docs/zh-CN/features/experimental/experimental-features#%E6%8F%92%E5%85%A5%E5%86%85%E5%AE%B9 "插入内容的直接链接")
添加了一个用于在文件中任意位置插入内容的新工具。
### 强力转向[](https://kilocode.ai/docs/zh-CN/features/experimental/experimental-features#%E5%BC%BA%E5%8A%9B%E8%BD%AC%E5%90%91 "强力转向的直接链接")
启用后,Kilo Code 会更频繁地提醒模型当前的模式定义细节。这将导致更严格地遵守角色定义和自定义指令,但会消耗更多 token。
提供反馈[](https://kilocode.ai/docs/zh-CN/features/experimental/experimental-features#%E6%8F%90%E4%BE%9B%E5%8F%8D%E9%A6%88 "提供反馈的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------
如果你在使用实验性功能时遇到任何问题,或有改进建议,请在 [Kilo Code Code GitHub Issues 页面](https://github.com/Kilo-Org/kilocode)
上报告。
你的反馈对我们非常宝贵,将帮助我们改进 Kilo Code!
* [启用实验性功能](https://kilocode.ai/docs/zh-CN/features/experimental/experimental-features#%E5%90%AF%E7%94%A8%E5%AE%9E%E9%AA%8C%E6%80%A7%E5%8A%9F%E8%83%BD)
* [当前可用的实验性功能](https://kilocode.ai/docs/zh-CN/features/experimental/experimental-features#%E5%BD%93%E5%89%8D%E5%8F%AF%E7%94%A8%E7%9A%84%E5%AE%9E%E9%AA%8C%E6%80%A7%E5%8A%9F%E8%83%BD)
* [搜索和替换](https://kilocode.ai/docs/zh-CN/features/experimental/experimental-features#%E6%90%9C%E7%B4%A2%E5%92%8C%E6%9B%BF%E6%8D%A2)
* [插入内容](https://kilocode.ai/docs/zh-CN/features/experimental/experimental-features#%E6%8F%92%E5%85%A5%E5%86%85%E5%AE%B9)
* [强力转向](https://kilocode.ai/docs/zh-CN/features/experimental/experimental-features#%E5%BC%BA%E5%8A%9B%E8%BD%AC%E5%90%91)
* [提供反馈](https://kilocode.ai/docs/zh-CN/features/experimental/experimental-features#%E6%8F%90%E4%BE%9B%E5%8F%8D%E9%A6%88)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Fexperimental%2Fexperimental-features)
---
# 增强提示 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/enhance-prompt#__docusaurus_skipToContent_fallback)
本页总览
Kilo Code 中的“增强提示”功能可以帮助你在将提示发送给 AI 模型之前,提高提示的质量和有效性。通过点击聊天输入框中的 图标,你可以自动优化初始请求,使其更清晰、更具体,更有可能产生预期的结果。
为什么要使用增强提示?[](https://kilocode.ai/docs/zh-CN/features/enhance-prompt#%E4%B8%BA%E4%BB%80%E4%B9%88%E8%A6%81%E4%BD%BF%E7%94%A8%E5%A2%9E%E5%BC%BA%E6%8F%90%E7%A4%BA "为什么要使用增强提示?的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
* **提高清晰度:** Kilo Code 可以重新表述你的提示,使其对 AI 模型更易理解。
* **添加上下文:** 增强过程可以为你的提示添加相关上下文,例如当前文件路径或选中的代码。
* **更好的指令:** Kilo Code 可以添加指令,引导 AI 提供更有帮助的响应(例如,请求特定的格式或详细的说明)。
* **减少歧义:** 增强提示有助于消除歧义,确保 Kilo Code 理解你的意图。
* **一致性:** Kilo 会以相同的方式格式化提示,确保一致性。
### 使用前后对比[](https://kilocode.ai/docs/zh-CN/features/enhance-prompt#%E4%BD%BF%E7%94%A8%E5%89%8D%E5%90%8E%E5%AF%B9%E6%AF%94 "使用前后对比的直接链接")
 
如何使用增强提示[](https://kilocode.ai/docs/zh-CN/features/enhance-prompt#%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%E5%A2%9E%E5%BC%BA%E6%8F%90%E7%A4%BA "如何使用增强提示的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------------------------------
1. **输入初始提示:** 像往常一样在 Kilo Code 聊天输入框中输入你的请求。这可以是一个简单的问题、复杂的任务描述或介于两者之间的任何内容。
2. **点击 图标:** 不要按下 Enter 键,而是点击聊天输入框右下角的 图标。
3. **查看增强后的提示:** Kilo Code 会将你的原始提示替换为增强后的版本。查看增强后的提示,确保它准确反映了你的意图。你可以在发送前进一步优化增强后的提示。
4. **发送增强后的提示:** 按下 Enter 键或点击发送图标()将增强后的提示发送给 Kilo Code。
自定义增强过程[](https://kilocode.ai/docs/zh-CN/features/enhance-prompt#%E8%87%AA%E5%AE%9A%E4%B9%89%E5%A2%9E%E5%BC%BA%E8%BF%87%E7%A8%8B "自定义增强过程的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------------------
### 自定义模板[](https://kilocode.ai/docs/zh-CN/features/enhance-prompt#%E8%87%AA%E5%AE%9A%E4%B9%89%E6%A8%A1%E6%9D%BF "自定义模板的直接链接")
“增强提示”功能使用可自定义的提示模板。你可以修改此模板,以根据你的特定需求定制增强过程。
1. **打开提示标签页:** 点击 Kilo Code 顶部菜单栏中的 图标。
2. **选择“ENHANCE”标签:** 你应该会看到一个列出的支持提示列表,包括“ENHANCE”。点击此标签。
3. **编辑提示模板:** 修改“Prompt”字段中的文本。
默认的提示模板包含占位符 `${userInput}`,它将被替换为你的原始提示。你可以修改此模板以适应模型的提示格式,并指示它如何增强你的请求。
### 自定义提供者[](https://kilocode.ai/docs/zh-CN/features/enhance-prompt#%E8%87%AA%E5%AE%9A%E4%B9%89%E6%8F%90%E4%BE%9B%E8%80%85 "自定义提供者的直接链接")
通过切换到更轻量级的 LLM 模型提供者(例如 GPT 4.1 Nano),可以加快提示增强的速度。这可以在保持质量的同时以更低的成本提供更快的响应。
按照 [API 配置配置文件指南](https://kilocode.ai/docs/zh-CN/features/api-configuration-profiles)
为增强提示创建专用配置文件。

详细教程:[https://youtu.be/R1nDnCK-xzw](https://youtu.be/R1nDnCK-xzw)
限制和最佳实践[](https://kilocode.ai/docs/zh-CN/features/enhance-prompt#%E9%99%90%E5%88%B6%E5%92%8C%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5 "限制和最佳实践的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------------------
* **实验性功能:** 提示增强是一个实验性功能。增强提示的质量可能会根据请求的复杂性和底层模型的能力而有所不同。
* **仔细查看:** 在发送增强提示之前,请务必仔细查看。Kilo Code 可能会做出不符合你意图的更改。
* **迭代过程:** 你可以多次使用“增强提示”功能来迭代优化你的提示。
* **不能替代清晰的指令:** 虽然“增强提示”可以帮助你,但从一开始就编写清晰、具体的提示仍然很重要。
通过使用“增强提示”功能,你可以提高与 Kilo Code 的交互质量,并获得更准确、更有帮助的响应。
* [为什么要使用增强提示?](https://kilocode.ai/docs/zh-CN/features/enhance-prompt#%E4%B8%BA%E4%BB%80%E4%B9%88%E8%A6%81%E4%BD%BF%E7%94%A8%E5%A2%9E%E5%BC%BA%E6%8F%90%E7%A4%BA)
* [使用前后对比](https://kilocode.ai/docs/zh-CN/features/enhance-prompt#%E4%BD%BF%E7%94%A8%E5%89%8D%E5%90%8E%E5%AF%B9%E6%AF%94)
* [如何使用增强提示](https://kilocode.ai/docs/zh-CN/features/enhance-prompt#%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%E5%A2%9E%E5%BC%BA%E6%8F%90%E7%A4%BA)
* [自定义增强过程](https://kilocode.ai/docs/zh-CN/features/enhance-prompt#%E8%87%AA%E5%AE%9A%E4%B9%89%E5%A2%9E%E5%BC%BA%E8%BF%87%E7%A8%8B)
* [自定义模板](https://kilocode.ai/docs/zh-CN/features/enhance-prompt#%E8%87%AA%E5%AE%9A%E4%B9%89%E6%A8%A1%E6%9D%BF)
* [自定义提供者](https://kilocode.ai/docs/zh-CN/features/enhance-prompt#%E8%87%AA%E5%AE%9A%E4%B9%89%E6%8F%90%E4%BE%9B%E8%80%85)
* [限制和最佳实践](https://kilocode.ai/docs/zh-CN/features/enhance-prompt#%E9%99%90%E5%88%B6%E5%92%8C%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Fenhance-prompt)
---
# 浏览器使用 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/browser-use#__docusaurus_skipToContent_fallback)
本页总览
Kilo Code 提供了先进的浏览器自动化功能,让你可以直接在 VS Code 中与网站进行交互。该功能使你无需离开开发环境即可测试 Web 应用程序、自动化浏览器任务并捕获屏幕截图。
你的浏览器不支持视频标签。
模型支持要求
Kilo Code 中的浏览器功能需要使用 Claude Sonnet 3.5 或 3.7 模型
浏览器功能的工作原理[](https://kilocode.ai/docs/zh-CN/features/browser-use#%E6%B5%8F%E8%A7%88%E5%99%A8%E5%8A%9F%E8%83%BD%E7%9A%84%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86 "浏览器功能的工作原理的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
默认情况下,Kilo Code 使用内置浏览器,该浏览器:
* 当你要求 Kilo 访问网站时会自动启动
* 捕获网页截图
* 允许 Kilo 与网页元素交互
* 在后台隐形运行
所有这些操作都在 VS Code 中直接完成,无需任何设置。
使用浏览器功能[](https://kilocode.ai/docs/zh-CN/features/browser-use#%E4%BD%BF%E7%94%A8%E6%B5%8F%E8%A7%88%E5%99%A8%E5%8A%9F%E8%83%BD "使用浏览器功能的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------------------
典型的浏览器交互遵循以下模式:
1. 让 Kilo 访问一个网站
2. Kilo 启动浏览器并显示截图
3. 请求其他操作(点击、输入、滚动)
4. Kilo 在完成后关闭浏览器
例如:
打开浏览器并查看我们的网站。
你能检查一下我在 https://kilocode.ai 的网站是否显示正确吗?
浏览 http://localhost:3000,向下滚动到页面底部并检查页脚信息是否显示正确。

浏览器操作的工作原理[](https://kilocode.ai/docs/zh-CN/features/browser-use#%E6%B5%8F%E8%A7%88%E5%99%A8%E6%93%8D%E4%BD%9C%E7%9A%84%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86 "浏览器操作的工作原理的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
`browser_action` 工具控制一个浏览器实例,在每次操作后返回截图和控制台日志,让你可以看到交互结果。
关键特性:
* 每个浏览器会话必须以 `launch` 开始,以 `close` 结束
* 每条消息只能使用一个浏览器操作
* 当浏览器处于活动状态时,不能使用其他工具
* 在执行下一个操作之前,必须等待响应(截图和日志)
### 可用的浏览器操作[](https://kilocode.ai/docs/zh-CN/features/browser-use#%E5%8F%AF%E7%94%A8%E7%9A%84%E6%B5%8F%E8%A7%88%E5%99%A8%E6%93%8D%E4%BD%9C "可用的浏览器操作的直接链接")
| 操作 | 描述 | 使用场景 |
| --- | --- | --- |
| `launch` | 在 URL 处打开浏览器 | 开始新的浏览器会话 |
| `click` | 在特定坐标处点击 | 与按钮、链接等交互 |
| `type` | 在活动元素中输入文本 | 填写表单、搜索框 |
| `scroll_down` | 向下滚动一页 | 查看折叠内容 |
| `scroll_up` | 向上滚动一页 | 返回之前的内容 |
| `close` | 关闭浏览器 | 结束浏览器会话 |
浏览器功能配置/设置[](https://kilocode.ai/docs/zh-CN/features/browser-use#%E6%B5%8F%E8%A7%88%E5%99%A8%E5%8A%9F%E8%83%BD%E9%85%8D%E7%BD%AE%E8%AE%BE%E7%BD%AE "浏览器功能配置/设置的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
默认浏览器设置
* **启用浏览器工具**:已启用
* **视口大小**:小桌面 (900x600)
* **截图质量**:75%
* **使用远程浏览器连接**:已禁用
### 访问设置[](https://kilocode.ai/docs/zh-CN/features/browser-use#%E8%AE%BF%E9%97%AE%E8%AE%BE%E7%BD%AE "访问设置的直接链接")
要更改 Kilo 中的浏览器/电脑使用设置:
1. 点击齿轮图标 → 浏览器/电脑使用 打开设置

### 启用/禁用浏览器功能[](https://kilocode.ai/docs/zh-CN/features/browser-use#%E5%90%AF%E7%94%A8%E7%A6%81%E7%94%A8%E6%B5%8F%E8%A7%88%E5%99%A8%E5%8A%9F%E8%83%BD "启用/禁用浏览器功能的直接链接")
**用途**:主开关,启用 Kilo 使用 Puppeteer 控制的浏览器与网站交互。
要更改此设置:
1. 在浏览器/电脑使用设置中勾选或取消勾选 "启用浏览器工具" 复选框

### 视口大小[](https://kilocode.ai/docs/zh-CN/features/browser-use#%E8%A7%86%E5%8F%A3%E5%A4%A7%E5%B0%8F "视口大小的直接链接")
**用途**:确定 Kilo Code 使用的浏览器会话的分辨率。
**权衡**:更高的值提供更大的视口,但会增加 token 使用量。
要更改此设置:
1. 在浏览器/电脑使用设置中点击 "视口大小" 下的下拉菜单
2. 选择以下选项之一:
* 大桌面 (1280x800)
* 小桌面 (900x600) - 默认
* 平板 (768x1024)
* 手机 (360x640)
3. 选择所需分辨率。

### 截图质量[](https://kilocode.ai/docs/zh-CN/features/browser-use#%E6%88%AA%E5%9B%BE%E8%B4%A8%E9%87%8F "截图质量的直接链接")
**用途**:控制浏览器截图的 WebP 压缩质量。
**权衡**:更高的值提供更清晰的截图,但会增加 token 使用量。
要更改此设置:
1. 在浏览器/电脑使用设置中调整 "截图质量" 下的滑块
2. 设置 1-100% 之间的值(默认为 75%)
3. 更高的值提供更清晰的截图,但会增加 token 使用量:
* 40-50%:适用于基本文本网站
* 60-70%:适用于大多数一般浏览
* 80%+:当需要精细视觉细节时使用

### 远程浏览器连接[](https://kilocode.ai/docs/zh-CN/features/browser-use#%E8%BF%9C%E7%A8%8B%E6%B5%8F%E8%A7%88%E5%99%A8%E8%BF%9E%E6%8E%A5 "远程浏览器连接的直接链接")
**用途**:将 Kilo 连接到现有的 Chrome 浏览器,而不是使用内置浏览器。
**优点**:
* 适用于容器化环境和远程开发工作流
* 在浏览器使用之间保持认证会话
* 消除重复登录步骤
* 允许使用具有特定扩展的自定义浏览器配置文件
**要求**:Chrome 必须启用远程调试。
要启用此功能:
1. 在浏览器/电脑使用设置中勾选 "使用远程浏览器连接" 框
2. 点击 "测试连接" 进行验证

#### 常见用例[](https://kilocode.ai/docs/zh-CN/features/browser-use#%E5%B8%B8%E8%A7%81%E7%94%A8%E4%BE%8B "常见用例的直接链接")
* **DevContainers**:从容器化的 VS Code 连接到主机 Chrome 浏览器
* **远程开发**:使用本地 Chrome 与远程 VS Code 服务器
* **自定义 Chrome 配置文件**:使用具有特定扩展和设置的配置文件
#### 连接到可见的 Chrome 窗口[](https://kilocode.ai/docs/zh-CN/features/browser-use#%E8%BF%9E%E6%8E%A5%E5%88%B0%E5%8F%AF%E8%A7%81%E7%9A%84-chrome-%E7%AA%97%E5%8F%A3 "连接到可见的 Chrome 窗口的直接链接")
连接到可见的 Chrome 窗口以实时观察 Kilo 的交互:
**macOS**
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug --no-first-run
**Windows**
"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 --user-data-dir=C:\chrome-debug --no-first-run
**Linux**
google-chrome --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug --no-first-run
* [浏览器功能的工作原理](https://kilocode.ai/docs/zh-CN/features/browser-use#%E6%B5%8F%E8%A7%88%E5%99%A8%E5%8A%9F%E8%83%BD%E7%9A%84%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86)
* [使用浏览器功能](https://kilocode.ai/docs/zh-CN/features/browser-use#%E4%BD%BF%E7%94%A8%E6%B5%8F%E8%A7%88%E5%99%A8%E5%8A%9F%E8%83%BD)
* [浏览器操作的工作原理](https://kilocode.ai/docs/zh-CN/features/browser-use#%E6%B5%8F%E8%A7%88%E5%99%A8%E6%93%8D%E4%BD%9C%E7%9A%84%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86)
* [可用的浏览器操作](https://kilocode.ai/docs/zh-CN/features/browser-use#%E5%8F%AF%E7%94%A8%E7%9A%84%E6%B5%8F%E8%A7%88%E5%99%A8%E6%93%8D%E4%BD%9C)
* [浏览器功能配置/设置](https://kilocode.ai/docs/zh-CN/features/browser-use#%E6%B5%8F%E8%A7%88%E5%99%A8%E5%8A%9F%E8%83%BD%E9%85%8D%E7%BD%AE%E8%AE%BE%E7%BD%AE)
* [访问设置](https://kilocode.ai/docs/zh-CN/features/browser-use#%E8%AE%BF%E9%97%AE%E8%AE%BE%E7%BD%AE)
* [启用/禁用浏览器功能](https://kilocode.ai/docs/zh-CN/features/browser-use#%E5%90%AF%E7%94%A8%E7%A6%81%E7%94%A8%E6%B5%8F%E8%A7%88%E5%99%A8%E5%8A%9F%E8%83%BD)
* [视口大小](https://kilocode.ai/docs/zh-CN/features/browser-use#%E8%A7%86%E5%8F%A3%E5%A4%A7%E5%B0%8F)
* [截图质量](https://kilocode.ai/docs/zh-CN/features/browser-use#%E6%88%AA%E5%9B%BE%E8%B4%A8%E9%87%8F)
* [远程浏览器连接](https://kilocode.ai/docs/zh-CN/features/browser-use#%E8%BF%9C%E7%A8%8B%E6%B5%8F%E8%A7%88%E5%99%A8%E8%BF%9E%E6%8E%A5)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Fbrowser-use)
---
# 检查点 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/checkpoints#__docusaurus_skipToContent_fallback)
本页总览
检查点会在Kilo Code任务期间自动对你的工作区文件进行版本控制,使你能够安全地探索AI建议并轻松恢复不想要的更改。
检查点让你可以:
* 安全地尝试AI建议的更改
* 轻松恢复不想要的修改
* 比较不同的实现方法
* 恢复到之前的项目状态而不会丢失工作
重要提示
* **检查点默认启用。**
* **必须安装Git**才能使用检查点功能 - [查看安装说明](https://kilocode.ai/docs/zh-CN/features/checkpoints#git-installation)
* 不需要GitHub账号或仓库
* 不需要配置Git个人信息
* 影子Git仓库独立于你项目现有的Git配置
配置选项[](https://kilocode.ai/docs/zh-CN/features/checkpoints#%E9%85%8D%E7%BD%AE%E9%80%89%E9%A1%B9 "配置选项的直接链接")
--------------------------------------------------------------------------------------------------------------
在Kilo Code设置的"检查点"部分可以配置检查点:
1. 点击齿轮图标 → 检查点 打开设置
2. 勾选或取消勾选"启用自动检查点"选项

检查点工作原理[](https://kilocode.ai/docs/zh-CN/features/checkpoints#%E6%A3%80%E6%9F%A5%E7%82%B9%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86 "检查点工作原理的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------------------
Kilo Code使用一个独立于主版本控制系统的影子Git仓库来捕获项目状态的快照。这些快照称为检查点,会在AI辅助工作流中自动记录更改——无论是任务开始、文件更改还是命令运行时。
检查点作为提交存储在影子仓库中,记录:
* 文件内容更改
* 新增的文件
* 删除的文件
* 重命名的文件
* 二进制文件的更改
使用检查点[](https://kilocode.ai/docs/zh-CN/features/checkpoints#%E4%BD%BF%E7%94%A8%E6%A3%80%E6%9F%A5%E7%82%B9 "使用检查点的直接链接")
-------------------------------------------------------------------------------------------------------------------------
检查点通过聊天界面直接集成到你的工作流中。
检查点在聊天历史记录中以两种形式出现:
* **初始检查点**标记项目开始状态

* **常规检查点**在文件修改或命令执行后出现

每个检查点提供两个主要功能:
### 查看差异[](https://kilocode.ai/docs/zh-CN/features/checkpoints#%E6%9F%A5%E7%9C%8B%E5%B7%AE%E5%BC%82 "查看差异的直接链接")
要比较当前工作区与之前的检查点:
1. 在聊天历史记录中找到检查点
2. 点击检查点的`查看差异`按钮

3. 在比较视图中查看差异:
* 新增的行以绿色高亮显示
* 删除的行以红色高亮显示
* 修改的文件会列出详细更改
* 重命名和移动的文件会跟踪路径更改
* 新增或删除的文件会被明确标记

### 恢复检查点[](https://kilocode.ai/docs/zh-CN/features/checkpoints#%E6%81%A2%E5%A4%8D%E6%A3%80%E6%9F%A5%E7%82%B9 "恢复检查点的直接链接")
要将项目恢复到之前的检查点状态:
1. 在聊天历史记录中找到检查点
2. 点击检查点的`恢复检查点`按钮

3. 选择以下恢复选项之一:

* **仅恢复文件** - 仅将工作区文件恢复到检查点状态,不修改对话历史记录。适用于在保持聊天上下文的同时比较不同实现方案的理想选择。此选项不需要确认,可以快速在不同实现方案之间切换。
* **恢复文件和任务** - 恢复工作区文件并删除所有后续对话消息。当你想完全重置代码和对话到检查点的时间点时使用。此选项需要在对话框中确认,因为无法撤销。

### 限制和注意事项[](https://kilocode.ai/docs/zh-CN/features/checkpoints#%E9%99%90%E5%88%B6%E5%92%8C%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9 "限制和注意事项的直接链接")
* **范围**:检查点仅捕获Kilo Code任务期间所做的更改
* **外部更改**:在任务之外所做的修改(手动编辑、其他工具)不会被包含
* **大文件**:非常大的二进制文件可能会影响性能
* **未保存的工作**:恢复将覆盖工作区中任何未保存的更改
技术实现[](https://kilocode.ai/docs/zh-CN/features/checkpoints#%E6%8A%80%E6%9C%AF%E5%AE%9E%E7%8E%B0 "技术实现的直接链接")
--------------------------------------------------------------------------------------------------------------
### 检查点架构[](https://kilocode.ai/docs/zh-CN/features/checkpoints#%E6%A3%80%E6%9F%A5%E7%82%B9%E6%9E%B6%E6%9E%84 "检查点架构的直接链接")
检查点系统由以下部分组成:
1. **影子Git仓库**:专门为检查点跟踪创建的独立Git仓库,作为检查点状态的持久存储机制。
2. **检查点服务**:通过以下方式处理Git操作和状态管理:
* 仓库初始化
* 检查点创建和存储
* 差异计算
* 状态恢复
3. **UI组件**:显示在聊天界面中与检查点交互的界面元素。
### 恢复过程[](https://kilocode.ai/docs/zh-CN/features/checkpoints#%E6%81%A2%E5%A4%8D%E8%BF%87%E7%A8%8B "恢复过程的直接链接")
当执行恢复时,Kilo Code:
* 硬重置到指定的检查点提交
* 将影子仓库中的所有文件复制到工作区
* 更新内部检查点跟踪状态
### 存储类型[](https://kilocode.ai/docs/zh-CN/features/checkpoints#%E5%AD%98%E5%82%A8%E7%B1%BB%E5%9E%8B "存储类型的直接链接")
检查点是任务范围的,意味着它们只针对单个任务。
### 差异计算[](https://kilocode.ai/docs/zh-CN/features/checkpoints#%E5%B7%AE%E5%BC%82%E8%AE%A1%E7%AE%97 "差异计算的直接链接")
检查点比较使用Git的底层差异功能来生成结构化的文件差异:
* 修改的文件显示逐行更改
* 二进制文件被正确检测和处理
* 重命名和移动的文件被正确跟踪
* 文件的创建和删除被明确标识
### 文件排除和忽略模式[](https://kilocode.ai/docs/zh-CN/features/checkpoints#%E6%96%87%E4%BB%B6%E6%8E%92%E9%99%A4%E5%92%8C%E5%BF%BD%E7%95%A5%E6%A8%A1%E5%BC%8F "文件排除和忽略模式的直接链接")
检查点系统使用智能文件排除来跟踪相关文件:
#### 内置排除[](https://kilocode.ai/docs/zh-CN/features/checkpoints#%E5%86%85%E7%BD%AE%E6%8E%92%E9%99%A4 "内置排除的直接链接")
系统有全面的内置排除模式,自动忽略:
* 构建产物和依赖目录(`node_modules/`, `dist/`, `build/`)
* 媒体文件和二进制资源(图片、视频、音频)
* 缓存和临时文件(`.cache/`, `.tmp/`, `.bak`)
* 包含敏感信息的配置文件(`.env`)
* 大数据文件(归档文件、可执行文件、二进制文件)
* 数据库文件和日志
这些模式在初始化时被写入影子仓库的`.git/info/exclude`文件。
#### .gitignore支持[](https://kilocode.ai/docs/zh-CN/features/checkpoints#gitignore%E6%94%AF%E6%8C%81 ".gitignore支持的直接链接")
检查点系统尊重工作区中的`.gitignore`模式:
* 被`.gitignore`排除的文件不会触发检查点创建
* 排除的文件不会出现在检查点差异中
* 在暂存文件更改时应用标准Git忽略规则
#### .kilocodeignore行为[](https://kilocode.ai/docs/zh-CN/features/checkpoints#kilocodeignore%E8%A1%8C%E4%B8%BA ".kilocodeignore行为的直接链接")
`.kilocodeignore`文件(控制AI对文件的访问)与检查点跟踪是分开的:
* 被`.kilocodeignore`排除但未被`.gitignore`排除的文件仍会被检查点跟踪
* 对AI不可访问文件的更改仍可以通过检查点恢复
这种分离是故意的,因为`.kilocodeignore`限制的是AI可以访问的文件,而不是应该被跟踪进行版本历史记录的文件。
#### 嵌套Git仓库[](https://kilocode.ai/docs/zh-CN/features/checkpoints#%E5%B5%8C%E5%A5%97git%E4%BB%93%E5%BA%93 "嵌套Git仓库的直接链接")
检查点系统对嵌套Git仓库有特殊处理:
* 在操作期间将嵌套的`.git`目录临时重命名为`.git_disabled`
* 操作完成后恢复它们
* 允许正确跟踪嵌套仓库中的文件
* 确保嵌套仓库保持功能不受影响
### 并发控制[](https://kilocode.ai/docs/zh-CN/features/checkpoints#%E5%B9%B6%E5%8F%91%E6%8E%A7%E5%88%B6 "并发控制的直接链接")
操作被排队以防止可能破坏仓库状态的并发Git操作。这确保了即使快速连续请求检查点操作也能安全完成。
Git安装[](https://kilocode.ai/docs/zh-CN/features/checkpoints#git%E5%AE%89%E8%A3%85 "Git安装的直接链接")
-------------------------------------------------------------------------------------------------
检查点要求系统上安装Git。该实现使用`simple-git`库,它依赖Git命令行工具来创建和管理影子仓库。
### macOS[](https://kilocode.ai/docs/zh-CN/features/checkpoints#macos "macOS的直接链接")
1. **使用Homebrew安装(推荐)**:
brew install git
2. **替代方案:使用Xcode命令行工具安装**:
xcode-select --install
3. **验证安装**:
* 打开终端
* 输入`git --version`
* 你应该看到类似`git version 2.40.0`的版本号
### Windows[](https://kilocode.ai/docs/zh-CN/features/checkpoints#windows "Windows的直接链接")
1. **下载Git for Windows**:
* 访问 [https://git-scm.com/download/win](https://git-scm.com/download/win)
* 下载应该会自动开始
2. **运行安装程序**:
* 接受许可协议
* 选择安装位置(推荐默认)
* 选择组件(通常默认选项足够)
* 选择默认编辑器
* 选择如何使用Git命令行(推荐:Git from the command line and also from 3rd-party software)
* 配置行尾转换(推荐:Checkout Windows-style, commit Unix-style)
* 完成安装
3. **验证安装**:
* 打开命令提示符或PowerShell
* 输入`git --version`
* 你应该看到类似`git version 2.40.0.windows.1`的版本号
### Linux[](https://kilocode.ai/docs/zh-CN/features/checkpoints#linux "Linux的直接链接")
**Debian/Ubuntu**:
sudo apt updatesudo apt install git
**Fedora**:
sudo dnf install git
**Arch Linux**:
sudo pacman -S git
**验证安装**:
* 打开终端
* 输入`git --version`
* 你应该看到版本号
* [配置选项](https://kilocode.ai/docs/zh-CN/features/checkpoints#%E9%85%8D%E7%BD%AE%E9%80%89%E9%A1%B9)
* [检查点工作原理](https://kilocode.ai/docs/zh-CN/features/checkpoints#%E6%A3%80%E6%9F%A5%E7%82%B9%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86)
* [使用检查点](https://kilocode.ai/docs/zh-CN/features/checkpoints#%E4%BD%BF%E7%94%A8%E6%A3%80%E6%9F%A5%E7%82%B9)
* [查看差异](https://kilocode.ai/docs/zh-CN/features/checkpoints#%E6%9F%A5%E7%9C%8B%E5%B7%AE%E5%BC%82)
* [恢复检查点](https://kilocode.ai/docs/zh-CN/features/checkpoints#%E6%81%A2%E5%A4%8D%E6%A3%80%E6%9F%A5%E7%82%B9)
* [限制和注意事项](https://kilocode.ai/docs/zh-CN/features/checkpoints#%E9%99%90%E5%88%B6%E5%92%8C%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9)
* [技术实现](https://kilocode.ai/docs/zh-CN/features/checkpoints#%E6%8A%80%E6%9C%AF%E5%AE%9E%E7%8E%B0)
* [检查点架构](https://kilocode.ai/docs/zh-CN/features/checkpoints#%E6%A3%80%E6%9F%A5%E7%82%B9%E6%9E%B6%E6%9E%84)
* [恢复过程](https://kilocode.ai/docs/zh-CN/features/checkpoints#%E6%81%A2%E5%A4%8D%E8%BF%87%E7%A8%8B)
* [存储类型](https://kilocode.ai/docs/zh-CN/features/checkpoints#%E5%AD%98%E5%82%A8%E7%B1%BB%E5%9E%8B)
* [差异计算](https://kilocode.ai/docs/zh-CN/features/checkpoints#%E5%B7%AE%E5%BC%82%E8%AE%A1%E7%AE%97)
* [文件排除和忽略模式](https://kilocode.ai/docs/zh-CN/features/checkpoints#%E6%96%87%E4%BB%B6%E6%8E%92%E9%99%A4%E5%92%8C%E5%BF%BD%E7%95%A5%E6%A8%A1%E5%BC%8F)
* [并发控制](https://kilocode.ai/docs/zh-CN/features/checkpoints#%E5%B9%B6%E5%8F%91%E6%8E%A7%E5%88%B6)
* [Git安装](https://kilocode.ai/docs/zh-CN/features/checkpoints#git%E5%AE%89%E8%A3%85)
* [macOS](https://kilocode.ai/docs/zh-CN/features/checkpoints#macos)
* [Windows](https://kilocode.ai/docs/zh-CN/features/checkpoints#windows)
* [Linux](https://kilocode.ai/docs/zh-CN/features/checkpoints#linux)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Fcheckpoints)
---
# Footgun Prompting:覆盖系统提示 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/footgun-prompting#__docusaurus_skipToContent_fallback)
本页总览
Footgun Prompting,也称为覆盖系统提示,允许高级用户完全替换特定 Kilo Code 模式的默认系统提示。这提供了对 AI 行为的精细控制,但会绕过内置的安全机制。
**footgun** _(名词)_
1. _(编程俚语,幽默,贬义)_ 任何可能导致程序员搬起石头砸自己脚的功能。
> 系统提示覆盖被称为 "footgun",因为在不深入了解其核心指令的情况下修改它可能会导致意外或损坏的行为,特别是在工具使用和响应一致性方面。
工作原理[](https://kilocode.ai/docs/zh-CN/features/footgun-prompting#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86 "工作原理的直接链接")
--------------------------------------------------------------------------------------------------------------------
1. **覆盖文件:** 在项目根目录下创建一个名为 `.kilo/system-prompt-{mode-slug}` 的文件(例如,对于 Code 模式,文件名为 `.kilo/system-prompt-code`)。
2. **内容:** 该文件的内容将成为该特定模式的新系统提示。
3. **激活:** Kilo Code 会自动检测此文件。当文件存在时,它将替换大部分标准系统提示部分。
4. **保留部分:** 只有核心的 `roleDefinition` 和你为该模式设置的 `customInstructions` 会与覆盖内容一起保留。标准部分如工具描述、规则和功能将被绕过。
5. **构建:** 最终发送给模型的提示如下:
${roleDefinition}${content_of_your_override_file}${customInstructions}
访问该功能[](https://kilocode.ai/docs/zh-CN/features/footgun-prompting#%E8%AE%BF%E9%97%AE%E8%AF%A5%E5%8A%9F%E8%83%BD "访问该功能的直接链接")
-------------------------------------------------------------------------------------------------------------------------------
你可以在 Kilo Code UI 中找到该功能和说明:
1. 点击 Kilo Code 顶部菜单栏中的 图标。
2. 展开 **"高级:覆盖系统提示"** 部分。
3. 点击说明中的文件路径链接,将在 VS Code 中打开或创建当前所选模式的覆盖文件。

关键注意事项与警告[](https://kilocode.ai/docs/zh-CN/features/footgun-prompting#%E5%85%B3%E9%94%AE%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9%E4%B8%8E%E8%AD%A6%E5%91%8A "关键注意事项与警告的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
* **目标用户:** 最适合对 Kilo Code 提示系统和修改核心指令的影响有深入了解的用户。
* **对功能的影响:** 自定义提示会覆盖标准指令,包括工具使用和响应一致性的指令。如果不小心处理,可能会导致意外行为或错误。
* **模式特定:** 每个覆盖文件仅适用于文件名中指定的模式(`{mode-slug}`)。
* **无文件,无覆盖:** 如果 `.kilo/system-prompt-{mode-slug}` 文件不存在,Kilo Code 将使用该模式的标准系统提示生成过程。
* **目录创建:** Kilo Code 会在读取或创建覆盖文件之前确保 `.kilo` 目录存在。
请谨慎使用此功能。虽然它对于自定义非常强大,但错误的实现可能会显著降低 Kilo Code 在受影响模式下的性能和可靠性。
* [工作原理](https://kilocode.ai/docs/zh-CN/features/footgun-prompting#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86)
* [访问该功能](https://kilocode.ai/docs/zh-CN/features/footgun-prompting#%E8%AE%BF%E9%97%AE%E8%AF%A5%E5%8A%9F%E8%83%BD)
* [关键注意事项与警告](https://kilocode.ai/docs/zh-CN/features/footgun-prompting#%E5%85%B3%E9%94%AE%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9%E4%B8%8E%E8%AD%A6%E5%91%8A)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Ffootgun-prompting)
---
# codebase_search | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#__docusaurus_skipToContent_fallback)
本页总览
Setup Required
The `codebase_search` tool is part of the [Codebase Indexing](https://kilocode.ai/docs/zh-CN/features/codebase-indexing)
feature. It requires additional setup including an embedding provider and vector database.
The `codebase_search` tool performs semantic searches across your entire codebase using AI embeddings. Unlike traditional text-based search, it understands the meaning of your queries and finds relevant code even when exact keywords don't match.
* * *
Parameters[](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#parameters "Parameters的直接链接")
----------------------------------------------------------------------------------------------------------
The tool accepts these parameters:
* `query` (required): Natural language search query describing what you're looking for
* `path` (optional): Directory path to limit search scope to a specific part of your codebase
* * *
What It Does[](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#what-it-does "What It Does的直接链接")
----------------------------------------------------------------------------------------------------------------
This tool searches through your indexed codebase using semantic similarity rather than exact text matching. It finds code blocks that are conceptually related to your query, even if they don't contain the exact words you searched for. Results include relevant code snippets with file paths, line numbers, and similarity scores.
* * *
When is it used?[](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#when-is-it-used "When is it used?的直接链接")
---------------------------------------------------------------------------------------------------------------------------
* When Kilo Code needs to find code related to specific functionality across your project
* When looking for implementation patterns or similar code structures
* When searching for error handling, authentication, or other conceptual code patterns
* When exploring unfamiliar codebases to understand how features are implemented
* When finding related code that might be affected by changes or refactoring
* * *
Key Features[](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#key-features "Key Features的直接链接")
----------------------------------------------------------------------------------------------------------------
* **Semantic Understanding**: Finds code by meaning rather than exact keyword matches
* **Cross-Project Search**: Searches across your entire indexed codebase, not just open files
* **Contextual Results**: Returns code snippets with file paths and line numbers for easy navigation
* **Similarity Scoring**: Results ranked by relevance with similarity scores (0-1 scale)
* **Scope Filtering**: Optional path parameter to limit searches to specific directories
* **Intelligent Ranking**: Results sorted by semantic relevance to your query
* **UI Integration**: Results displayed with syntax highlighting and navigation links
* **Performance Optimized**: Fast vector-based search with configurable result limits
* * *
Requirements[](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#requirements "Requirements的直接链接")
----------------------------------------------------------------------------------------------------------------
This tool is only available when the Codebase Indexing feature is properly configured:
* **Feature Configured**: Codebase Indexing must be configured in settings
* **Embedding Provider**: OpenAI API key or Ollama configuration required
* **Vector Database**: Qdrant instance running and accessible
* **Index Status**: Codebase must be indexed (status: "Indexed" or "Indexing")
* * *
Limitations[](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#limitations "Limitations的直接链接")
-------------------------------------------------------------------------------------------------------------
* **Requires Configuration**: Depends on external services (embedding provider + Qdrant)
* **Index Dependency**: Only searches through indexed code blocks
* **Result Limits**: Maximum of 50 results per search to maintain performance
* **Similarity Threshold**: Only returns results above similarity threshold (default: 0.4, configurable)
* **File Size Limits**: Limited to files under 1MB that were successfully indexed
* **Language Support**: Effectiveness depends on Tree-sitter language support
* * *
How It Works[](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#how-it-works "How It Works的直接链接")
----------------------------------------------------------------------------------------------------------------
When the `codebase_search` tool is invoked, it follows this process:
1. **Availability Validation**:
* Verifies that the CodeIndexManager is available and initialized
* Confirms codebase indexing is enabled in settings
* Checks that indexing is properly configured (API keys, Qdrant URL)
* Validates the current index state allows searching
2. **Query Processing**:
* Takes your natural language query and generates an embedding vector
* Uses the same embedding provider configured for indexing (OpenAI or Ollama)
* Converts the semantic meaning of your query into a mathematical representation
3. **Vector Search Execution**:
* Searches the Qdrant vector database for similar code embeddings
* Uses cosine similarity to find the most relevant code blocks
* Applies the minimum similarity threshold (default: 0.4, configurable) to filter results
* Limits results to 50 matches for optimal performance
4. **Path Filtering** (if specified):
* Filters results to only include files within the specified directory path
* Uses normalized path comparison for accurate filtering
* Maintains relevance ranking within the filtered scope
5. **Result Processing and Formatting**:
* Converts absolute file paths to workspace-relative paths
* Structures results with file paths, line ranges, similarity scores, and code content
* Formats for both AI consumption and UI display with syntax highlighting
6. **Dual Output Format**:
* **AI Output**: Structured text format with query, file paths, scores, and code chunks
* **UI Output**: JSON format with syntax highlighting and navigation capabilities
* * *
Search Query Best Practices[](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#search-query-best-practices "Search Query Best Practices的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------------------------------
### Effective Query Patterns[](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#effective-query-patterns "Effective Query Patterns的直接链接")
**Good: Conceptual and specific**
user authentication and password validation
**Good: Feature-focused**
database connection pool setup
**Good: Problem-oriented**
error handling for API requests
**Less effective: Too generic**
function
### Query Types That Work Well[](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#query-types-that-work-well "Query Types That Work Well的直接链接")
* **Functional Descriptions**: "file upload processing", "email validation logic"
* **Technical Patterns**: "singleton pattern implementation", "factory method usage"
* **Domain Concepts**: "user profile management", "payment processing workflow"
* **Architecture Components**: "middleware configuration", "database migration scripts"
* * *
Directory Scoping[](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#directory-scoping "Directory Scoping的直接链接")
-------------------------------------------------------------------------------------------------------------------------------
Use the optional `path` parameter to focus searches on specific parts of your codebase:
**Search within API modules:**
endpoint validation middlewaresrc/api
**Search in test files:**
mock data setup patternstests
**Search specific feature directories:**
component state managementsrc/components/auth
* * *
Result Interpretation[](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#result-interpretation "Result Interpretation的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------------
### Similarity Scores[](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#similarity-scores "Similarity Scores的直接链接")
* **0.8-1.0**: Highly relevant matches, likely exactly what you're looking for
* **0.6-0.8**: Good matches with strong conceptual similarity
* **0.4-0.6**: Potentially relevant but may require review
* **Below 0.4**: Filtered out as too dissimilar
### Result Structure[](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#result-structure "Result Structure的直接链接")
Each search result includes:
* **File Path**: Workspace-relative path to the file containing the match
* **Score**: Similarity score indicating relevance (0.4-1.0)
* **Line Range**: Start and end line numbers for the code block
* **Code Chunk**: The actual code content that matched your query
* * *
Examples When Used[](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#examples-when-used "Examples When Used的直接链接")
----------------------------------------------------------------------------------------------------------------------------------
* When implementing a new feature, Kilo Code searches for "authentication middleware" to understand existing patterns before writing new code.
* When debugging an issue, Kilo Code searches for "error handling in API calls" to find related error patterns across the codebase.
* When refactoring code, Kilo Code searches for "database transaction patterns" to ensure consistency across all database operations.
* When onboarding to a new codebase, Kilo Code searches for "configuration loading" to understand how the application bootstraps.
* * *
Usage Examples[](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#usage-examples "Usage Examples的直接链接")
----------------------------------------------------------------------------------------------------------------------
Searching for authentication-related code across the entire project:
user login and authentication logic
Finding database-related code in a specific directory:
database connection and query executionsrc/data
Looking for error handling patterns in API code:
HTTP error responses and exception handlingsrc/api
Searching for testing utilities and mock setups:
test setup and mock data creationtests
Finding configuration and environment setup code:
environment variables and application configuration
* [Parameters](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#parameters)
* [What It Does](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#what-it-does)
* [When is it used?](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#when-is-it-used)
* [Key Features](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#key-features)
* [Requirements](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#requirements)
* [Limitations](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#limitations)
* [How It Works](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#how-it-works)
* [Search Query Best Practices](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#search-query-best-practices)
* [Effective Query Patterns](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#effective-query-patterns)
* [Query Types That Work Well](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#query-types-that-work-well)
* [Directory Scoping](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#directory-scoping)
* [Result Interpretation](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#result-interpretation)
* [Similarity Scores](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#similarity-scores)
* [Result Structure](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#result-structure)
* [Examples When Used](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#examples-when-used)
* [Usage Examples](https://kilocode.ai/docs/zh-CN/features/tools/codebase-search#usage-examples)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Ftools%2Fcodebase-search)
---
# 什么是 MCP? | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/mcp/what-is-mcp#__docusaurus_skipToContent_fallback)
本页总览
MCP(Model Context Protocol,模型上下文协议)是 LLM 系统与外部工具和服务交互的标准化通信协议。它充当 AI 助手与各类数据源或应用程序之间的通用适配器。
工作原理[](https://kilocode.ai/docs/zh-CN/features/mcp/what-is-mcp#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86 "工作原理的直接链接")
------------------------------------------------------------------------------------------------------------------
MCP 采用客户端-服务端架构:
1. AI 助手(客户端)连接至 MCP 服务器
2. 每个服务器提供特定能力(文件访问、数据库查询、API 集成等)
3. AI 通过标准化接口使用这些能力
4. 通信通过 JSON-RPC 2.0 消息进行
可以将 MCP 类比为 USB-C 接口——任何兼容的 LLM 都能连接任意 MCP 服务器来使用其功能。这种标准化消除了为每个工具和服务构建定制集成的需求。
例如,使用 MCP 的 AI 可以执行"搜索公司数据库并生成报告"这类任务,而无需为每个数据库系统编写专用代码。
常见问题[](https://kilocode.ai/docs/zh-CN/features/mcp/what-is-mcp#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98 "常见问题的直接链接")
------------------------------------------------------------------------------------------------------------------
* **MCP 是云服务吗?** MCP 服务器既可在本地运行,也可作为云服务远程部署,具体取决于使用场景和安全要求。
* **MCP 会取代其他集成方式吗?** 不会。MCP 是对 API 插件和检索增强生成等现有工具的补充。它提供了工具交互的标准化协议,但不会取代专业集成方案。
* **如何保障安全性?** 用户可自主控制连接哪些 MCP 服务器,以及授予这些服务器哪些权限。与任何访问数据或服务的工具一样,请使用可信来源并配置适当的访问控制。
Kilo Code 中的 MCP[](https://kilocode.ai/docs/zh-CN/features/mcp/what-is-mcp#kilo-code-%E4%B8%AD%E7%9A%84-mcp "Kilo Code 中的 MCP的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------
Kilo Code 通过实现模型上下文协议来:
* 同时连接本地和远程 MCP 服务器
* 提供访问工具的统一接口
* 无需修改核心即可扩展功能
* 按需启用专项能力
MCP 为 AI 系统与外部工具服务的交互提供了标准化方式,使复杂集成更易用且一致。
深入了解 MCP[](https://kilocode.ai/docs/zh-CN/features/mcp/what-is-mcp#%E6%B7%B1%E5%85%A5%E4%BA%86%E8%A7%A3-mcp "深入了解 MCP的直接链接")
------------------------------------------------------------------------------------------------------------------------------
准备好深入探索了吗?请查阅以下指南:
* [MCP 概述](https://kilocode.ai/docs/zh-CN/features/mcp/overview)
- 快速了解 MCP 文档结构
* [在 Kilo Code 中使用 MCP](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code)
- 包含创建简单服务器的入门指导
* [MCP vs 传统 API](https://kilocode.ai/docs/zh-CN/features/mcp/mcp-vs-api)
- 相比传统 API 的技术优势
* [STDIO 与 SSE 传输协议](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports)
- 本地与云端部署模式对比
* [工作原理](https://kilocode.ai/docs/zh-CN/features/mcp/what-is-mcp#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86)
* [常见问题](https://kilocode.ai/docs/zh-CN/features/mcp/what-is-mcp#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98)
* [Kilo Code 中的 MCP](https://kilocode.ai/docs/zh-CN/features/mcp/what-is-mcp#kilo-code-%E4%B8%AD%E7%9A%84-mcp)
* [深入了解 MCP](https://kilocode.ai/docs/zh-CN/features/mcp/what-is-mcp#%E6%B7%B1%E5%85%A5%E4%BA%86%E8%A7%A3-mcp)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Fmcp%2Fwhat-is-mcp)
---
# Codebase Indexing | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#__docusaurus_skipToContent_fallback)
本页总览
Codebase Indexing enables semantic code search across your entire project using AI embeddings. Instead of searching for exact text matches, it understands the _meaning_ of your queries, helping Kilo Code find relevant code even when you don't know specific function names or file locations.

What It Does[](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#what-it-does "What It Does的直接链接")
------------------------------------------------------------------------------------------------------------
When enabled, the indexing system:
1. **Parses your code** using Tree-sitter to identify semantic blocks (functions, classes, methods)
2. **Creates embeddings** of each code block using AI models
3. **Stores vectors** in a Qdrant database for fast similarity search
4. **Provides the [`codebase_search`](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search)
tool** to Kilo Code for intelligent code discovery
This enables natural language queries like "user authentication logic" or "database connection handling" to find relevant code across your entire project.
Key Benefits[](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#key-benefits "Key Benefits的直接链接")
------------------------------------------------------------------------------------------------------------
* **Semantic Search**: Find code by meaning, not just keywords
* **Enhanced AI Understanding**: Kilo Code can better comprehend and work with your codebase
* **Cross-Project Discovery**: Search across all files, not just what's open
* **Pattern Recognition**: Locate similar implementations and code patterns
Setup Requirements[](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#setup-requirements "Setup Requirements的直接链接")
------------------------------------------------------------------------------------------------------------------------------
### Embedding Provider[](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#embedding-provider "Embedding Provider的直接链接")
Choose one of these options for generating embeddings:
**OpenAI (Recommended)**
* Requires OpenAI API key
* Supports all OpenAI embedding models
* Default: `text-embedding-3-small`
* Processes up to 100,000 tokens per batch
**Gemini**
* Requires Google AI API key
* Supports Gemini embedding models including `gemini-embedding-001`
* Cost-effective alternative to OpenAI
* High-quality embeddings for code understanding
**Ollama (Local)**
* Requires local Ollama installation
* No API costs or internet dependency
* Supports any Ollama-compatible embedding model
* Requires Ollama base URL configuration
### Vector Database[](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#vector-database "Vector Database的直接链接")
**Qdrant** is required for storing and searching embeddings:
* **Local**: `http://localhost:6333` (recommended for testing)
* **Cloud**: Qdrant Cloud or self-hosted instance
* **Authentication**: Optional API key for secured deployments
Setting Up Qdrant[](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#setting-up-qdrant "Setting Up Qdrant的直接链接")
---------------------------------------------------------------------------------------------------------------------------
### Quick Local Setup[](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#quick-local-setup "Quick Local Setup的直接链接")
**Using Docker:**
docker run -p 6333:6333 qdrant/qdrant
**Using Docker Compose:**
version: '3.8'services: qdrant: image: qdrant/qdrant ports: - '6333:6333' volumes: - qdrant_storage:/qdrant/storagevolumes: qdrant_storage:
### Production Deployment[](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#production-deployment "Production Deployment的直接链接")
For team or production use:
* [Qdrant Cloud](https://cloud.qdrant.io/)
- Managed service
* Self-hosted on AWS, GCP, or Azure
* Local server with network access for team sharing
Configuration[](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#configuration "Configuration的直接链接")
---------------------------------------------------------------------------------------------------------------
1. Open Kilo Code settings ( icon)
2. Navigate to **Codebase Indexing** section
3. Enable **"Enable Codebase Indexing"** using the toggle switch
4. Configure your embedding provider:
* **OpenAI**: Enter API key and select model
* **Gemini**: Enter Google AI API key and select embedding model
* **Ollama**: Enter base URL and select model
5. Set Qdrant URL and optional API key
6. Configure **Max Search Results** (default: 20, range: 1-100)
7. Click **Save** to start initial indexing
### Enable/Disable Toggle[](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#enabledisable-toggle "Enable/Disable Toggle的直接链接")
The codebase indexing feature includes a convenient toggle switch that allows you to:
* **Enable**: Start indexing your codebase and make the search tool available
* **Disable**: Stop indexing, pause file watching, and disable the search functionality
* **Preserve Settings**: Your configuration remains saved when toggling off
This toggle is useful for temporarily disabling indexing during intensive development work or when working with sensitive codebases.
Understanding Index Status[](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#understanding-index-status "Understanding Index Status的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------------------
The interface shows real-time status with color indicators:
* **Standby** (Gray): Not running, awaiting configuration
* **Indexing** (Yellow): Currently processing files
* **Indexed** (Green): Up-to-date and ready for searches
* **Error** (Red): Failed state requiring attention
How Files Are Processed[](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#how-files-are-processed "How Files Are Processed的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------
### Smart Code Parsing[](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#smart-code-parsing "Smart Code Parsing的直接链接")
* **Tree-sitter Integration**: Uses AST parsing to identify semantic code blocks
* **Language Support**: All languages supported by Tree-sitter
* **Markdown Support**: Full support for markdown files and documentation
* **Fallback**: Line-based chunking for unsupported file types
* **Block Sizing**:
* Minimum: 100 characters
* Maximum: 1,000 characters
* Splits large functions intelligently
### Automatic File Filtering[](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#automatic-file-filtering "Automatic File Filtering的直接链接")
The indexer automatically excludes:
* Binary files and images
* Large files (>1MB)
* Git repositories (`.git` folders)
* Dependencies (`node_modules`, `vendor`, etc.)
* Files matching `.gitignore` and `.kilocode` patterns
### Incremental Updates[](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#incremental-updates "Incremental Updates的直接链接")
* **File Watching**: Monitors workspace for changes
* **Smart Updates**: Only reprocesses modified files
* **Hash-based Caching**: Avoids reprocessing unchanged content
* **Branch Switching**: Automatically handles Git branch changes
Best Practices[](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#best-practices "Best Practices的直接链接")
------------------------------------------------------------------------------------------------------------------
### Model Selection[](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#model-selection "Model Selection的直接链接")
**For OpenAI:**
* **`text-embedding-3-small`**: Best balance of performance and cost
* **`text-embedding-3-large`**: Higher accuracy, 5x more expensive
* **`text-embedding-ada-002`**: Legacy model, lower cost
**For Ollama:**
* **`mxbai-embed-large`**: The largest and highest-quality embedding model.
* **`nomic-embed-text`**: Best balance of performance and embedding quality.
* **`all-minilm`**: Compact model with lower quality but faster performance.
### Security Considerations[](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#security-considerations "Security Considerations的直接链接")
* **API Keys**: Stored securely in VS Code's encrypted storage
* **Code Privacy**: Only small code snippets sent for embedding (not full files)
* **Local Processing**: All parsing happens locally
* **Qdrant Security**: Use authentication for production deployments
Current Limitations[](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#current-limitations "Current Limitations的直接链接")
---------------------------------------------------------------------------------------------------------------------------------
* **File Size**: 1MB maximum per file
* **Single Workspace**: One workspace at a time
* **Dependencies**: Requires external services (embedding provider + Qdrant)
* **Language Coverage**: Limited to Tree-sitter supported languages for optimal parsing
Using the Search Feature[](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#using-the-search-feature "Using the Search Feature的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------------
Once indexed, Kilo Code can use the [`codebase_search`](https://kilocode.ai/docs/zh-CN/advanced-usage/available-tools/codebase-search)
tool to find relevant code:
**Example Queries:**
* "How is user authentication handled?"
* "Database connection setup"
* "Error handling patterns"
* "API endpoint definitions"
The tool provides Kilo Code with:
* Relevant code snippets (up to your configured max results limit)
* File paths and line numbers
* Similarity scores
* Contextual information
### Search Results Configuration[](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#search-results-configuration "Search Results Configuration的直接链接")
You can control the number of search results returned by adjusting the **Max Search Results** setting:
* **Default**: 20 results
* **Range**: 1-100 results
* **Performance**: Lower values improve response speed
* **Comprehensiveness**: Higher values provide more context but may slow responses
Privacy & Security[](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#privacy--security "Privacy & Security的直接链接")
-----------------------------------------------------------------------------------------------------------------------------
* **Code stays local**: Only small code snippets sent for embedding
* **Embeddings are numeric**: Not human-readable representations
* **Secure storage**: API keys encrypted in VS Code storage
* **Local option**: Use Ollama for completely local processing
* **Access control**: Respects existing file permissions
Future Enhancements[](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#future-enhancements "Future Enhancements的直接链接")
---------------------------------------------------------------------------------------------------------------------------------
Planned improvements:
* Additional embedding providers
* Multi-workspace indexing
* Enhanced filtering and configuration options
* Team sharing capabilities
* Integration with VS Code's native search
* [What It Does](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#what-it-does)
* [Key Benefits](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#key-benefits)
* [Setup Requirements](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#setup-requirements)
* [Embedding Provider](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#embedding-provider)
* [Vector Database](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#vector-database)
* [Setting Up Qdrant](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#setting-up-qdrant)
* [Quick Local Setup](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#quick-local-setup)
* [Production Deployment](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#production-deployment)
* [Configuration](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#configuration)
* [Enable/Disable Toggle](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#enabledisable-toggle)
* [Understanding Index Status](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#understanding-index-status)
* [How Files Are Processed](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#how-files-are-processed)
* [Smart Code Parsing](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#smart-code-parsing)
* [Automatic File Filtering](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#automatic-file-filtering)
* [Incremental Updates](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#incremental-updates)
* [Best Practices](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#best-practices)
* [Model Selection](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#model-selection)
* [Security Considerations](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#security-considerations)
* [Current Limitations](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#current-limitations)
* [Using the Search Feature](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#using-the-search-feature)
* [Search Results Configuration](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#search-results-configuration)
* [Privacy & Security](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#privacy--security)
* [Future Enhancements](https://kilocode.ai/docs/zh-CN/features/codebase-indexing#future-enhancements)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Fcodebase-indexing)
---
# MCP与API | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/mcp/mcp-vs-api#__docusaurus_skipToContent_fallback)
本页总览
将REST API与模型上下文协议(MCP)进行比较是一种类别错误。它们在抽象的不同层次上运行,为AI系统提供根本不同的功能。
架构差异[](https://kilocode.ai/docs/zh-CN/features/mcp/mcp-vs-api#%E6%9E%B6%E6%9E%84%E5%B7%AE%E5%BC%82 "架构差异的直接链接")
-----------------------------------------------------------------------------------------------------------------
| 特性 | MCP | REST API |
| --- | --- | --- |
| 状态管理 | **有状态** - 在交互中维护上下文 | **无状态** - 每个请求都是独立的 |
| 连接类型 | 持久、双向连接 | 单向请求/响应 |
| 通信风格 | 基于JSON-RPC的持续会话 | 基于HTTP的离散请求 |
| 上下文处理 | 上下文是协议的内在部分 | 上下文必须手动管理 |
| 工具发现 | 运行时发现可用工具 | 设计时集成,需要预先了解 |
| 集成方式 | 运行时集成,动态能力 | 设计时集成,需要代码修改 |
不同层次,不同目的[](https://kilocode.ai/docs/zh-CN/features/mcp/mcp-vs-api#%E4%B8%8D%E5%90%8C%E5%B1%82%E6%AC%A1%E4%B8%8D%E5%90%8C%E7%9B%AE%E7%9A%84 "不同层次,不同目的的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------------------------
REST API和MCP服务于技术栈的不同层次:
1. **REST**:暴露资源操作的低级Web通信模式
2. **MCP**:编排工具使用和维护上下文的高级AI协议
MCP通常在内部使用REST API,但为AI抽象了它们。可以将MCP视为将离散的Web服务转变为AI可以操作的统一环境的中间件。
上下文保存:AI工作流程的关键[](https://kilocode.ai/docs/zh-CN/features/mcp/mcp-vs-api#%E4%B8%8A%E4%B8%8B%E6%96%87%E4%BF%9D%E5%AD%98ai%E5%B7%A5%E4%BD%9C%E6%B5%81%E7%A8%8B%E7%9A%84%E5%85%B3%E9%94%AE "上下文保存:AI工作流程的关键的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
MCP的有状态设计解决了REST在AI应用中的关键限制:
* **REST方法**:每个调用都是独立的,需要在步骤间手动传递上下文
* **MCP方法**:一次对话上下文在多个工具使用中持续存在
例如,AI在调试代码库时可以打开文件、运行测试并识别错误,而不会在各步骤间丢失上下文。MCP会话会保持对先前操作和结果的感知。
动态工具发现[](https://kilocode.ai/docs/zh-CN/features/mcp/mcp-vs-api#%E5%8A%A8%E6%80%81%E5%B7%A5%E5%85%B7%E5%8F%91%E7%8E%B0 "动态工具发现的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------
MCP使AI能够在运行时发现和使用工具:
// AI发现可用工具{ "tools": [ { "name": "readFile", "description": "从文件中读取内容", "parameters": { "path": { "type": "string", "description": "文件路径" } } }, { "name": "createTicket", "description": "在问题跟踪器中创建工单", "parameters": { "title": { "type": "string" }, "description": { "type": "string" } } } ]}
这种"即插即用"能力允许添加新工具而无需重新部署或修改AI本身。
实际示例:多工具工作流程[](https://kilocode.ai/docs/zh-CN/features/mcp/mcp-vs-api#%E5%AE%9E%E9%99%85%E7%A4%BA%E4%BE%8B%E5%A4%9A%E5%B7%A5%E5%85%B7%E5%B7%A5%E4%BD%9C%E6%B5%81%E7%A8%8B "实际示例:多工具工作流程的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
考虑一个需要多个服务的任务:"检查最近的提交,为bug修复创建JIRA工单,并发布到Slack。"
**基于REST的方法**:
* 需要为Git、JIRA和Slack API分别集成
* 需要自定义代码来管理调用间的上下文
* 任何服务更改API都会中断
**基于MCP的方法**:
* 所有工具的统一协议
* 维护整个工作流程的上下文
* 新工具可以无缝替换,无需代码修改
为什么Kilo Code使用MCP[](https://kilocode.ai/docs/zh-CN/features/mcp/mcp-vs-api#%E4%B8%BA%E4%BB%80%E4%B9%88kilo-code%E4%BD%BF%E7%94%A8mcp "为什么Kilo Code使用MCP的直接链接")
----------------------------------------------------------------------------------------------------------------------------------------------------------------
Kilo Code利用MCP提供:
1. **可扩展性**:添加无限自定义工具,无需等待官方集成
2. **上下文感知**:工具可以访问对话历史和项目上下文
3. **简化集成**:一个标准协议,而非多种API模式
4. **运行时灵活性**:动态发现和使用新功能
MCP在Kilo Code和外部服务之间创建了通用连接器,REST API通常在这些服务背后提供支持。
结论:互补而非竞争的技术[](https://kilocode.ai/docs/zh-CN/features/mcp/mcp-vs-api#%E7%BB%93%E8%AE%BA%E4%BA%92%E8%A1%A5%E8%80%8C%E9%9D%9E%E7%AB%9E%E4%BA%89%E7%9A%84%E6%8A%80%E6%9C%AF "结论:互补而非竞争的技术的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
MCP并不取代REST API - 它建立在它们之上。REST擅长提供离散服务,而MCP擅长为AI代理编排这些服务。
关键区别在于MCP是AI原生的:它把模型视为一等用户,提供AI代理在复杂环境中有效运行所需的上下文、有状态交互层。
* [架构差异](https://kilocode.ai/docs/zh-CN/features/mcp/mcp-vs-api#%E6%9E%B6%E6%9E%84%E5%B7%AE%E5%BC%82)
* [不同层次,不同目的](https://kilocode.ai/docs/zh-CN/features/mcp/mcp-vs-api#%E4%B8%8D%E5%90%8C%E5%B1%82%E6%AC%A1%E4%B8%8D%E5%90%8C%E7%9B%AE%E7%9A%84)
* [上下文保存:AI工作流程的关键](https://kilocode.ai/docs/zh-CN/features/mcp/mcp-vs-api#%E4%B8%8A%E4%B8%8B%E6%96%87%E4%BF%9D%E5%AD%98ai%E5%B7%A5%E4%BD%9C%E6%B5%81%E7%A8%8B%E7%9A%84%E5%85%B3%E9%94%AE)
* [动态工具发现](https://kilocode.ai/docs/zh-CN/features/mcp/mcp-vs-api#%E5%8A%A8%E6%80%81%E5%B7%A5%E5%85%B7%E5%8F%91%E7%8E%B0)
* [实际示例:多工具工作流程](https://kilocode.ai/docs/zh-CN/features/mcp/mcp-vs-api#%E5%AE%9E%E9%99%85%E7%A4%BA%E4%BE%8B%E5%A4%9A%E5%B7%A5%E5%85%B7%E5%B7%A5%E4%BD%9C%E6%B5%81%E7%A8%8B)
* [为什么Kilo Code使用MCP](https://kilocode.ai/docs/zh-CN/features/mcp/mcp-vs-api#%E4%B8%BA%E4%BB%80%E4%B9%88kilo-code%E4%BD%BF%E7%94%A8mcp)
* [结论:互补而非竞争的技术](https://kilocode.ai/docs/zh-CN/features/mcp/mcp-vs-api#%E7%BB%93%E8%AE%BA%E4%BA%92%E8%A1%A5%E8%80%8C%E9%9D%9E%E7%AB%9E%E4%BA%89%E7%9A%84%E6%8A%80%E6%9C%AF)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Fmcp%2Fmcp-vs-api)
---
# 快速编辑 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/fast-edits#__docusaurus_skipToContent_fallback)
本页总览
默认设置
在 Kilo Code 中,快速编辑(使用"通过差异启用编辑"设置)默认是启用的。除非遇到特定问题或想要尝试不同的差异策略,否则通常不需要更改这些设置。
Kilo Code 提供了一个高级设置,可以更改它编辑文件的方式,使用差异(diff)而不是重写整个文件。启用此功能提供了显著的优势。
启用通过差异编辑[](https://kilocode.ai/docs/zh-CN/features/fast-edits#%E5%90%AF%E7%94%A8%E9%80%9A%E8%BF%87%E5%B7%AE%E5%BC%82%E7%BC%96%E8%BE%91 "启用通过差异编辑的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------------------
打开设置,点击齿轮图标 → 高级
当**启用通过差异编辑**被勾选时:

1. **更快的文件编辑**:Kilo 通过仅应用必要的更改来更快地修改文件。
2. **防止截断写入**:系统会自动检测并拒绝 AI 尝试写入不完整文件内容的情况,这可能发生在大型文件或复杂指令时。这有助于防止文件损坏。
禁用快速编辑
如果取消勾选**启用通过差异编辑**,Kilo 将恢复为每次编辑时使用 [`write_to_file`](https://kilocode.ai/docs/zh-CN/features/tools/write-to-file)
工具写入整个文件内容,而不是使用 [`apply_diff`](https://kilocode.ai/docs/zh-CN/features/tools/apply-diff)
应用目标更改。这种全量写入的方法在修改现有文件时通常较慢,并且会导致更高的 token 使用量。
匹配精度[](https://kilocode.ai/docs/zh-CN/features/fast-edits#%E5%8C%B9%E9%85%8D%E7%B2%BE%E5%BA%A6 "匹配精度的直接链接")
-------------------------------------------------------------------------------------------------------------
此滑块控制 AI 识别的代码部分在应用更改之前必须与实际文件中的代码匹配的紧密程度。

* **100%(默认)**:要求完全匹配。这是最安全的选项,最大限度地降低错误更改的风险。
* **较低值(80%-99%)**:允许"模糊"匹配。即使代码部分与 AI 预期的内容有轻微差异,Kilo 也可以应用更改。这在文件被轻微修改时可能有用,但**会增加**在错误位置应用更改的风险。
**使用低于 100% 的值时要格外小心。** 较低精度可能偶尔是必要的,但始终要仔细审查提议的更改。
在内部,此设置会调整一个 `fuzzyMatchThreshold`,使用 Levenshtein 距离等算法来比较代码相似性。
* [启用通过差异编辑](https://kilocode.ai/docs/zh-CN/features/fast-edits#%E5%90%AF%E7%94%A8%E9%80%9A%E8%BF%87%E5%B7%AE%E5%BC%82%E7%BC%96%E8%BE%91)
* [匹配精度](https://kilocode.ai/docs/zh-CN/features/fast-edits#%E5%8C%B9%E9%85%8D%E7%B2%BE%E5%BA%A6)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Ffast-edits)
---
# MCP概览 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/mcp/overview#__docusaurus_skipToContent_fallback)
本页总览
模型上下文协议(MCP)是扩展Kilo Code功能的标准化协议,通过连接外部工具和服务来实现。MCP服务器提供了额外的工具和资源,帮助Kilo Code完成超出其内置功能的任务,例如访问数据库、自定义API和特殊功能。
MCP文档结构[](https://kilocode.ai/docs/zh-CN/features/mcp/overview#mcp%E6%96%87%E6%A1%A3%E7%BB%93%E6%9E%84 "MCP文档结构的直接链接")
------------------------------------------------------------------------------------------------------------------------
本文档分为以下几个部分:
* [**在Kilo Code中使用MCP**](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code)
- 在Kilo Code中配置、启用和管理MCP服务器的综合指南。包括服务器设置、工具批准和故障排除。
* [**什么是MCP?**](https://kilocode.ai/docs/zh-CN/features/mcp/what-is-mcp)
- 解释模型上下文协议、其客户端-服务器架构以及如何使AI系统与外部工具交互。
* [**STDIO与SSE传输**](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports)
- 详细比较本地(STDIO)和远程(SSE)传输机制,以及每种方法的部署考虑。
* [**MCP与API**](https://kilocode.ai/docs/zh-CN/features/mcp/mcp-vs-api)
- 分析MCP与REST API的根本区别,解释它们如何在不同的抽象层为AI系统工作。
* [MCP文档结构](https://kilocode.ai/docs/zh-CN/features/mcp/overview#mcp%E6%96%87%E6%A1%A3%E7%BB%93%E6%9E%84)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Fmcp%2Foverview)
---
# 自定义模式 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/custom-modes#__docusaurus_skipToContent_fallback)
本页总览
Kilo Code允许你创建**自定义模式**来定制Kilo的行为以适应特定任务或工作流程。自定义模式可以是**全局的**(在所有项目中可用)或**项目特定的**(在单个项目中定义)。
为什么使用自定义模式?[](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E4%B8%BA%E4%BB%80%E4%B9%88%E4%BD%BF%E7%94%A8%E8%87%AA%E5%AE%9A%E4%B9%89%E6%A8%A1%E5%BC%8F "为什么使用自定义模式?的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
* **专业化**:创建针对特定任务优化的模式,如"文档编写者"、"测试工程师"或"重构专家"
* **安全性**:限制模式对敏感文件或命令的访问。例如,"审查模式"可以限制为只读操作
* **实验性**:安全地尝试不同的提示和配置,而不会影响其他模式
* **团队协作**:与团队共享自定义模式以标准化工作流程

_Kilo Code创建和管理自定义模式的界面_
自定义模式包含什么?[](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E8%87%AA%E5%AE%9A%E4%B9%89%E6%A8%A1%E5%BC%8F%E5%8C%85%E5%90%AB%E4%BB%80%E4%B9%88 "自定义模式包含什么?的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
自定义模式允许你定义:
* **唯一名称和slug**:便于识别
* **角色定义**:放置在系统提示的开头,定义Kilo在该模式下的核心专业知识和个性。这个位置至关重要,因为它塑造了Kilo对任务的基本理解和处理方法
* **自定义指令**:添加到系统提示末尾,提供修改或优化Kilo行为的特定指南。与`.clinerules`文件(仅在末尾添加规则)不同,这种角色和指令的结构化放置允许更精细地控制Kilo的响应
* **允许的工具**:该模式可以使用的Kilo Code工具(例如:读取文件、写入文件、执行命令)
* **文件限制**:(可选)将文件访问限制为特定文件类型或模式(例如:仅允许编辑`.md`文件)
自定义模式配置(JSON格式)[](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E8%87%AA%E5%AE%9A%E4%B9%89%E6%A8%A1%E5%BC%8F%E9%85%8D%E7%BD%AEjson%E6%A0%BC%E5%BC%8F "自定义模式配置(JSON格式)的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
全局和项目特定配置使用相同的JSON格式。每个配置文件包含一个模式定义的`customModes`数组:
{ "customModes": [ { "slug": "mode-name", "name": "模式显示名称", "roleDefinition": "模式的角色和能力", "groups": ["read", "edit"], "customInstructions": "附加指南" } ]}
### 必需属性[](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E5%BF%85%E9%9C%80%E5%B1%9E%E6%80%A7 "必需属性的直接链接")
#### `slug`[](https://kilocode.ai/docs/zh-CN/features/custom-modes#slug "slug的直接链接")
* 模式的唯一标识符
* 使用小写字母、数字和连字符
* 保持简短和描述性
* 示例:`"docs-writer"`, `"test-engineer"`
#### `name`[](https://kilocode.ai/docs/zh-CN/features/custom-modes#name "name的直接链接")
* 在UI中显示的名称
* 可以包含空格和适当的大小写
* 示例:`"文档编写者"`, `"测试工程师"`
#### `roleDefinition`[](https://kilocode.ai/docs/zh-CN/features/custom-modes#roledefinition "roledefinition的直接链接")
* 模式角色和能力的详细描述
* 定义Kilo在该模式下的专业知识和个性
* 示例:`"你是一位专注于编写清晰文档的技术写作者"`
#### `groups`[](https://kilocode.ai/docs/zh-CN/features/custom-modes#groups "groups的直接链接")
* 允许的工具组数组
* 可用组:`"read"`, `"edit"`, `"browser"`, `"command"`, `"mcp"`
* 可以为`"edit"`组包含文件限制
##### 文件限制格式[](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E6%96%87%E4%BB%B6%E9%99%90%E5%88%B6%E6%A0%BC%E5%BC%8F "文件限制格式的直接链接")
["edit", { "fileRegex": "\\.md$", "description": "仅限Markdown文件"}]
### 理解文件限制[](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E7%90%86%E8%A7%A3%E6%96%87%E4%BB%B6%E9%99%90%E5%88%B6 "理解文件限制的直接链接")
`fileRegex`属性使用正则表达式来控制模式可以编辑哪些文件:
* `\\.md$` - 匹配以".md"结尾的文件
* `\\.(test|spec)\\.(js|ts)$` - 匹配测试文件(例如"component.test.js")
* `\\.(js|ts)$` - 匹配JavaScript和TypeScript文件
常见正则表达式模式:
* `\\.` - 匹配字面量点
* `(a|b)` - 匹配"a"或"b"
* `$` - 匹配文件名结尾
[了解更多关于正则表达式的知识](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions)
### 可选属性[](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E5%8F%AF%E9%80%89%E5%B1%9E%E6%80%A7 "可选属性的直接链接")
#### `customInstructions`[](https://kilocode.ai/docs/zh-CN/features/custom-modes#custominstructions "custominstructions的直接链接")
* 模式的附加行为指南
* 示例:`"专注于解释概念和提供示例"`
#### `apiConfiguration`[](https://kilocode.ai/docs/zh-CN/features/custom-modes#apiconfiguration "apiconfiguration的直接链接")
* 自定义该模式的AI模型和参数的可选设置
* 允许针对特定任务优化模型选择
* 示例:`{"model": "gpt-4", "temperature": 0.2}`
### 模式特定的自定义指令文件[](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E6%A8%A1%E5%BC%8F%E7%89%B9%E5%AE%9A%E7%9A%84%E8%87%AA%E5%AE%9A%E4%B9%89%E6%8C%87%E4%BB%A4%E6%96%87%E4%BB%B6 "模式特定的自定义指令文件的直接链接")
除了JSON中的`customInstructions`属性外,你还可以使用专门的文件来存储模式特定的指令:
1. 在工作区根目录创建名为`.clinerules-{mode-slug}`的文件
* 将`{mode-slug}`替换为你的模式slug(例如`.clinerules-docs-writer`)
2. 将你的自定义指令添加到此文件
3. Kilo Code会自动将这些指令应用于指定模式
这种方法特别适用于:
* 保持冗长的指令与模式配置分离
* 使用版本控制管理指令
* 允许非技术团队成员修改指令而无需编辑JSON
注意:如果同时存在`.clinerules-{mode-slug}`和`customInstructions`属性,它们将被合并,文件内容会附加在JSON属性之后。
配置优先级[](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E9%85%8D%E7%BD%AE%E4%BC%98%E5%85%88%E7%BA%A7 "配置优先级的直接链接")
--------------------------------------------------------------------------------------------------------------------------
模式配置按以下顺序应用:
1. 项目级模式配置(来自`.kilocodemodes`)
2. 全局模式配置(来自`custom_modes.json`)
3. 默认模式配置
这意味着项目特定的配置将覆盖全局配置,而全局配置又将覆盖默认配置。
创建自定义模式[](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E5%88%9B%E5%BB%BA%E8%87%AA%E5%AE%9A%E4%B9%89%E6%A8%A1%E5%BC%8F "创建自定义模式的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------------
你有三种创建自定义模式的选项:
### 1\. 询问Kilo!(推荐)[](https://kilocode.ai/docs/zh-CN/features/custom-modes#1-%E8%AF%A2%E9%97%AEkilo%E6%8E%A8%E8%8D%90 "1. 询问Kilo!(推荐)的直接链接")
你可以通过要求Kilo Code快速创建一个基本自定义模式。例如:
创建一个名为"文档编写者"的新模式。它应该只能读取文件和编写Markdown文件。
Kilo Code将引导你完成整个过程。但是,对于微调模式或进行特定调整,你需要使用下面描述的"提示"标签页或手动配置方法。
信息
#### 自定义模式创建设置[](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E8%87%AA%E5%AE%9A%E4%B9%89%E6%A8%A1%E5%BC%8F%E5%88%9B%E5%BB%BA%E8%AE%BE%E7%BD%AE "自定义模式创建设置的直接链接")
启用后,Kilo允许你使用类似'Make me a custom mode that...'的提示创建自定义模式。禁用此功能可在不需要此功能时减少约700 tokens的系统提示。禁用时,你仍然可以使用上方的+按钮或编辑相关配置JSON手动创建自定义模式。

你可以通过点击Kilo Code顶部菜单栏中的图标在提示设置中找到此设置。
### 2\. 使用提示标签页[](https://kilocode.ai/docs/zh-CN/features/custom-modes#2-%E4%BD%BF%E7%94%A8%E6%8F%90%E7%A4%BA%E6%A0%87%E7%AD%BE%E9%A1%B5 "2. 使用提示标签页的直接链接")
1. **打开提示标签页**:点击Kilo Code顶部菜单栏中的图标
2. **创建新模式**:点击模式标题右侧的按钮
3. **填写字段**:

_显示名称、slug、保存位置、角色定义、可用工具和自定义指令字段的自定义模式创建界面_
* **名称**:输入模式的显示名称
* **Slug**:输入小写标识符(仅限字母、数字和连字符)
* **保存位置**:选择全局(通过`custom_modes.json`,在所有工作区可用)或项目特定(在项目根目录的`.kilocodemodes`文件中)
* **角色定义**:定义Kilo在该模式下的专业知识和个性(出现在系统提示的开头)
* **可用工具**:选择该模式可以使用的工具
* **自定义指令**:(可选)添加该模式特定的行为指南(出现在系统提示的末尾)
4. **创建模式**:点击"创建模式"按钮保存你的新模式
注意:文件类型限制只能通过手动配置添加。
### 3\. 手动配置[](https://kilocode.ai/docs/zh-CN/features/custom-modes#3-%E6%89%8B%E5%8A%A8%E9%85%8D%E7%BD%AE "3. 手动配置的直接链接")
你可以通过编辑提示标签页中的JSON文件来配置自定义模式:
全局和项目特定的配置都可以通过提示标签页编辑:
1. **打开提示标签页**:点击Kilo Code顶部菜单栏中的图标
2. **访问设置菜单**:点击模式标题右侧的按钮
3. **选择配置**:
* 选择"编辑全局模式"来编辑`custom_modes.json`(在所有工作区可用)
* 选择"编辑项目模式"来编辑项目根目录中的`.kilocodemodes`文件
4. **编辑配置**:修改打开的JSON文件
5. **保存更改**:Kilo Code会自动检测更改
配置示例[](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E9%85%8D%E7%BD%AE%E7%A4%BA%E4%BE%8B "配置示例的直接链接")
---------------------------------------------------------------------------------------------------------------
每个示例展示模式配置的不同方面:
### 基本文档编写者[](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E5%9F%BA%E6%9C%AC%E6%96%87%E6%A1%A3%E7%BC%96%E5%86%99%E8%80%85 "基本文档编写者的直接链接")
{ "customModes": [{ "slug": "docs-writer", "name": "文档编写者", "roleDefinition": "你是一位专注于编写清晰文档的技术写作者", "groups": [ "read", ["edit", { "fileRegex": "\\.md$", "description": "仅限Markdown文件" }] ], "customInstructions": "专注于清晰的解释和示例" }]}
### 具有文件限制的测试工程师[](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E5%85%B7%E6%9C%89%E6%96%87%E4%BB%B6%E9%99%90%E5%88%B6%E7%9A%84%E6%B5%8B%E8%AF%95%E5%B7%A5%E7%A8%8B%E5%B8%88 "具有文件限制的测试工程师的直接链接")
{ "customModes": [{ "slug": "test-engineer", "name": "测试工程师", "roleDefinition": "你是一位专注于代码质量的测试工程师", "groups": [ "read", ["edit", { "fileRegex": "\\.(test|spec)\\.(js|ts)$", "description": "仅限测试文件" }] ] }]}
### 项目特定的模式覆盖[](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E9%A1%B9%E7%9B%AE%E7%89%B9%E5%AE%9A%E7%9A%84%E6%A8%A1%E5%BC%8F%E8%A6%86%E7%9B%96 "项目特定的模式覆盖的直接链接")
{ "customModes": [{ "slug": "code", "name": "代码(项目特定)", "roleDefinition": "你是具有项目特定约束的软件工程师", "groups": [ "read", ["edit", { "fileRegex": "\\.(js|ts)$", "description": "仅限JS/TS文件" }] ], "customInstructions": "专注于项目特定的JS/TS开发" }]}
按照这些说明,你可以创建和管理自定义模式以增强与Kilo Code的工作流程。
理解自定义模式中的正则表达式[](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E7%90%86%E8%A7%A3%E8%87%AA%E5%AE%9A%E4%B9%89%E6%A8%A1%E5%BC%8F%E4%B8%AD%E7%9A%84%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F "理解自定义模式中的正则表达式的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
自定义模式中的正则表达式模式让你可以精确控制Kilo可以编辑哪些文件:
### 基本语法[](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95 "基本语法的直接链接")
当你在自定义模式中指定`fileRegex`时,你创建了一个文件路径必须匹配的模式:
["edit", { "fileRegex": "\\.md$", "description": "仅限Markdown文件" }]
### 重要规则[](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E9%87%8D%E8%A6%81%E8%A7%84%E5%88%99 "重要规则的直接链接")
* **双反斜杠**:在JSON中,反斜杠必须用另一个反斜杠转义。所以`\.md$`变成`\\.md$`
* **路径匹配**:模式匹配完整文件路径,而不仅仅是文件名
* **大小写敏感**:正则表达式模式默认区分大小写
### 常见模式示例[](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E5%B8%B8%E8%A7%81%E6%A8%A1%E5%BC%8F%E7%A4%BA%E4%BE%8B "常见模式示例的直接链接")
| 模式 | 匹配 | 不匹配 |
| --- | --- | --- |
| `\\.md$` | `readme.md`, `docs/guide.md` | `script.js`, `readme.md.bak` |
| `^src/.*` | `src/app.js`, `src/components/button.tsx` | `lib/utils.js`, `test/src/mock.js` |
| `\\.(css\|scss)$` | `styles.css`, `theme.scss` | `styles.less`, `styles.css.map` |
| `docs/.*\\.md$` | `docs/guide.md`, `docs/api/reference.md` | `guide.md`, `src/docs/notes.md` |
| `^(?!.*(test\|spec)).*\\.js$` | `app.js`, `utils.js` | `app.test.js`, `utils.spec.js` |
### 模式构建块[](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E6%A8%A1%E5%BC%8F%E6%9E%84%E5%BB%BA%E5%9D%97 "模式构建块的直接链接")
* `\\.` - 匹配字面量点(句号)
* `$` - 匹配字符串结尾
* `^` - 匹配字符串开头
* `.*` - 匹配任何字符(换行符除外)零次或多次
* `(a|b)` - 匹配"a"或"b"
* `(?!...)` - 否定前瞻(排除匹配)
### 测试你的模式[](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E6%B5%8B%E8%AF%95%E4%BD%A0%E7%9A%84%E6%A8%A1%E5%BC%8F "测试你的模式的直接链接")
在将正则表达式模式应用于自定义模式之前:
1. 在示例文件路径上测试它以确保它匹配你期望的内容
2. 记住在JSON中每个反斜杠都需要加倍(`\d`变成`\\d`)
3. 从更简单的模式开始,逐步增加复杂性
提示
### 让Kilo构建你的正则表达式模式[](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E8%AE%A9kilo%E6%9E%84%E5%BB%BA%E4%BD%A0%E7%9A%84%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F%E6%A8%A1%E5%BC%8F "让Kilo构建你的正则表达式模式的直接链接")
与其手动编写复杂的正则表达式模式,你可以要求Kilo为你创建它们!只需描述你想要包含或排除哪些文件:
创建一个匹配JavaScript文件但排除测试文件的正则表达式模式
Kilo将生成带有适当JSON转义的适当模式。
社区画廊[](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E7%A4%BE%E5%8C%BA%E7%94%BB%E5%BB%8A "社区画廊的直接链接")
---------------------------------------------------------------------------------------------------------------
准备好探索更多?查看[Show and Tell](https://github.com/Kilo-Org/kilocode/discussions/categories/show-and-tell)
来发现和分享社区创建的自定义模式!
* [为什么使用自定义模式?](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E4%B8%BA%E4%BB%80%E4%B9%88%E4%BD%BF%E7%94%A8%E8%87%AA%E5%AE%9A%E4%B9%89%E6%A8%A1%E5%BC%8F)
* [自定义模式包含什么?](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E8%87%AA%E5%AE%9A%E4%B9%89%E6%A8%A1%E5%BC%8F%E5%8C%85%E5%90%AB%E4%BB%80%E4%B9%88)
* [自定义模式配置(JSON格式)](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E8%87%AA%E5%AE%9A%E4%B9%89%E6%A8%A1%E5%BC%8F%E9%85%8D%E7%BD%AEjson%E6%A0%BC%E5%BC%8F)
* [必需属性](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E5%BF%85%E9%9C%80%E5%B1%9E%E6%80%A7)
* [理解文件限制](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E7%90%86%E8%A7%A3%E6%96%87%E4%BB%B6%E9%99%90%E5%88%B6)
* [可选属性](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E5%8F%AF%E9%80%89%E5%B1%9E%E6%80%A7)
* [模式特定的自定义指令文件](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E6%A8%A1%E5%BC%8F%E7%89%B9%E5%AE%9A%E7%9A%84%E8%87%AA%E5%AE%9A%E4%B9%89%E6%8C%87%E4%BB%A4%E6%96%87%E4%BB%B6)
* [配置优先级](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E9%85%8D%E7%BD%AE%E4%BC%98%E5%85%88%E7%BA%A7)
* [创建自定义模式](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E5%88%9B%E5%BB%BA%E8%87%AA%E5%AE%9A%E4%B9%89%E6%A8%A1%E5%BC%8F)
* [1\. 询问Kilo!(推荐)](https://kilocode.ai/docs/zh-CN/features/custom-modes#1-%E8%AF%A2%E9%97%AEkilo%E6%8E%A8%E8%8D%90)
* [2\. 使用提示标签页](https://kilocode.ai/docs/zh-CN/features/custom-modes#2-%E4%BD%BF%E7%94%A8%E6%8F%90%E7%A4%BA%E6%A0%87%E7%AD%BE%E9%A1%B5)
* [3\. 手动配置](https://kilocode.ai/docs/zh-CN/features/custom-modes#3-%E6%89%8B%E5%8A%A8%E9%85%8D%E7%BD%AE)
* [配置示例](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E9%85%8D%E7%BD%AE%E7%A4%BA%E4%BE%8B)
* [基本文档编写者](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E5%9F%BA%E6%9C%AC%E6%96%87%E6%A1%A3%E7%BC%96%E5%86%99%E8%80%85)
* [具有文件限制的测试工程师](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E5%85%B7%E6%9C%89%E6%96%87%E4%BB%B6%E9%99%90%E5%88%B6%E7%9A%84%E6%B5%8B%E8%AF%95%E5%B7%A5%E7%A8%8B%E5%B8%88)
* [项目特定的模式覆盖](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E9%A1%B9%E7%9B%AE%E7%89%B9%E5%AE%9A%E7%9A%84%E6%A8%A1%E5%BC%8F%E8%A6%86%E7%9B%96)
* [理解自定义模式中的正则表达式](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E7%90%86%E8%A7%A3%E8%87%AA%E5%AE%9A%E4%B9%89%E6%A8%A1%E5%BC%8F%E4%B8%AD%E7%9A%84%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F)
* [基本语法](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95)
* [重要规则](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E9%87%8D%E8%A6%81%E8%A7%84%E5%88%99)
* [常见模式示例](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E5%B8%B8%E8%A7%81%E6%A8%A1%E5%BC%8F%E7%A4%BA%E4%BE%8B)
* [模式构建块](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E6%A8%A1%E5%BC%8F%E6%9E%84%E5%BB%BA%E5%9D%97)
* [测试你的模式](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E6%B5%8B%E8%AF%95%E4%BD%A0%E7%9A%84%E6%A8%A1%E5%BC%8F)
* [让Kilo构建你的正则表达式模式](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E8%AE%A9kilo%E6%9E%84%E5%BB%BA%E4%BD%A0%E7%9A%84%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F%E6%A8%A1%E5%BC%8F)
* [社区画廊](https://kilocode.ai/docs/zh-CN/features/custom-modes#%E7%A4%BE%E5%8C%BA%E7%94%BB%E5%BB%8A)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Fcustom-modes)
---
# Unknown
\# Memory Bank I am an expert software engineer with a unique characteristic: my memory resets completely between sessions. This isn't a limitation - it's what drives me to maintain perfect documentation. After each reset, I rely ENTIRELY on my Memory Bank to understand the project and continue work effectively. I MUST read ALL memory bank files at the start of EVERY task - this is not optional. The memory bank files are located in \`.kilocode/rules/memory-bank\` folder. When I start a task, I will include \`\[Memory Bank: Active\]\` at the beginning of my response if I successfully read the memory bank files, or \`\[Memory Bank: Missing\]\` if the folder doesn't exist or is empty. If memory bank is missing, I will warn the user about potential issues and suggest initialization. ## Memory Bank Structure The Memory Bank consists of core files and optional context files, all in Markdown format. ### Core Files (Required) 1. \`brief.md\` This file is created and maintained manually by the developer. Don't edit this file directly but suggest to user to update it if it can be improved. - Foundation document that shapes all other files - Created at project start if it doesn't exist - Defines core requirements and goals - Source of truth for project scope 2. \`product.md\` - Why this project exists - Problems it solves - How it should work - User experience goals 3. \`context.md\` This file should be short and factual, not creative or speculative. - Current work focus - Recent changes - Next steps 4. \`architecture.md\` - System architecture - Source Code paths - Key technical decisions - Design patterns in use - Component relationships - Critical implementation paths 5. \`tech.md\` - Technologies used - Development setup - Technical constraints - Dependencies - Tool usage patterns ### Additional Files Create additional files/folders within memory-bank/ when they help organize: - \`tasks.md\` - Documentation of repetitive tasks and their workflows - Complex feature documentation - Integration specifications - API documentation - Testing strategies - Deployment procedures ## Core workflows ### Memory Bank Initialization The initialization step is CRITICALLY IMPORTANT and must be done with extreme thoroughness as it defines all future effectiveness of the Memory Bank. This is the foundation upon which all future interactions will be built. When user requests initialization of the memory bank (command \`initialize memory bank\`), I'll perform an exhaustive analysis of the project, including: - All source code files and their relationships - Configuration files and build system setup - Project structure and organization patterns - Documentation and comments - Dependencies and external integrations - Testing frameworks and patterns I must be extremely thorough during initialization, spending extra time and effort to build a comprehensive understanding of the project. A high-quality initialization will dramatically improve all future interactions, while a rushed or incomplete initialization will permanently limit my effectiveness. After initialization, I will ask the user to read through the memory bank files and verify product description, used technologies and other information. I should provide a summary of what I've understood about the project to help the user verify the accuracy of the memory bank files. I should encourage the user to correct any misunderstandings or add missing information, as this will significantly improve future interactions. ### Memory Bank Update Memory Bank updates occur when: 1. Discovering new project patterns 2. After implementing significant changes 3. When user explicitly requests with the phrase \*\*update memory bank\*\* (MUST review ALL files) 4. When context needs clarification If I notice significant changes that should be preserved but the user hasn't explicitly requested an update, I should suggest: "Would you like me to update the memory bank to reflect these changes?" To execute Memory Bank update, I will: 1. Review ALL project files 2. Document current state 3. Document Insights & Patterns 4. If requested with additional context (e.g., "update memory bank using information from @/Makefile"), focus special attention on that source Note: When triggered by \*\*update memory bank\*\*, I MUST review every memory bank file, even if some don't require updates. Focus particularly on context.md as it tracks current state. ### Add Task When user completes a repetitive task (like adding support for a new model version) and wants to document it for future reference, they can request: \*\*add task\*\* or \*\*store this as a task\*\*. This workflow is designed for repetitive tasks that follow similar patterns and require editing the same files. Examples include: - Adding support for new AI model versions - Implementing new API endpoints following established patterns - Adding new features that follow existing architecture Tasks are stored in the file \`tasks.md\` in the memory bank folder. The file is optional an can be empty. The file can store many tasks. To execute Add Task workflow: 1. Create or update \`tasks.md\` in the memory bank folder 2. Document the task with: - Task name and description - Files that need to be modified - Step-by-step workflow followed - Important considerations or gotchas - Example of the completed implementation 3. Include any context that was discovered during task execution but wasn't previously documented Example task entry: \`\`\`markdown ## Add New Model Support \*\*Last performed:\*\* \[date\] \*\*Files to modify:\*\* - \`/providers/gemini.md\` - Add model to documentation - \`/src/providers/gemini-config.ts\` - Add model configuration - \`/src/constants/models.ts\` - Add to model list - \`/tests/providers/gemini.test.ts\` - Add test cases \*\*Steps:\*\* 1. Add model configuration with proper token limits 2. Update documentation with model capabilities 3. Add to constants file for UI display 4. Write tests for new model configuration \*\*Important notes:\*\* - Check Google's documentation for exact token limits - Ensure backward compatibility with existing configurations - Test with actual API calls before committing \`\`\` ### Regular Task Execution In the beginning of EVERY task I MUST read ALL memory bank files - this is not optional. The memory bank files are located in \`.kilocode/rules/memory-bank\` folder. If the folder doesn't exist or is empty, I will warn user about potential issues with the memory bank. I will include \`\[Memory Bank: Active\]\` at the beginning of my response if I successfully read the memory bank files, or \`\[Memory Bank: Missing\]\` if the folder doesn't exist or is empty. If memory bank is missing, I will warn the user about potential issues and suggest initialization. I should briefly summarize my understanding of the project to confirm alignment with the user's expectations, like: "\[Memory Bank: Active\] I understand we're building a React inventory system with barcode scanning. Currently implementing the scanner component that needs to work with the backend API." When starting a task that matches a documented task in \`tasks.md\`, I should mention this and follow the documented workflow to ensure no steps are missed. If the task was repetitive and might be needed again, I should suggest: "Would you like me to add this task to the memory bank for future reference?" In the end of the task, when it seems to be completed, I will update \`context.md\` accordingly. If the change seems significant, I will suggest to the user: "Would you like me to update memory bank to reflect these changes?" I will not suggest updates for minor changes. ## Context Window Management When the context window fills up during an extended session: 1. I should suggest updating the memory bank to preserve the current state 2. Recommend starting a fresh conversation/task 3. In the new conversation, I will automatically load the memory bank files to maintain continuity ## Technical Implementation Memory Bank is built on Kilo Code's Custom Rules feature, with files stored as standard markdown documents that both the user and I can access. ## Important Notes REMEMBER: After every memory reset, I begin completely fresh. The Memory Bank is my only link to previous work. It must be maintained with precision and clarity, as my effectiveness depends entirely on its accuracy. If I detect inconsistencies between memory bank files, I should prioritize brief.md and note any discrepancies to the user. IMPORTANT: I MUST read ALL memory bank files at the start of EVERY task - this is not optional. The memory bank files are located in \`.kilocode/rules/memory-bank\` folder.
---
# 导入、导出和重置设置 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/settings-management#__docusaurus_skipToContent_fallback)
本页总览
Kilo Code 允许你通过导出、导入和重置选项有效地管理配置设置。这些功能可用于备份设置、与他人共享配置或在需要时恢复默认设置。
你可以在 Kilo Code 设置页面的底部找到这些选项,通过 Kilo Code 聊天视图中的齿轮图标()访问。

_图片:导出、导入和重置按钮。_
导出设置[](https://kilocode.ai/docs/zh-CN/features/settings-management#%E5%AF%BC%E5%87%BA%E8%AE%BE%E7%BD%AE "导出设置的直接链接")
----------------------------------------------------------------------------------------------------------------------
点击**导出**按钮将你当前的 Kilo Code 设置保存为 JSON 文件。
* **导出的内容:** 文件包括你配置的 API 提供者配置文件和全局设置(UI 偏好、模式配置、上下文设置等)。
* **安全警告:** 导出的 JSON 文件包含**所有**你配置的 API 提供者配置文件和全局设置。关键是,这包括**明文中的 API 密钥**。将此文件视为高度敏感。不要公开分享或与不受信任的个人分享,因为它授予访问你的 API 帐户的权限。
* **过程:**
1. 点击**导出**。
2. 出现文件保存对话框,建议文件名为 `kilo-code-settings.json`(通常在 `~/Documents` 文件夹中)。
3. 选择位置并保存文件。
这将创建配置的备份或可共享的文件。
导入设置[](https://kilocode.ai/docs/zh-CN/features/settings-management#%E5%AF%BC%E5%85%A5%E8%AE%BE%E7%BD%AE "导入设置的直接链接")
----------------------------------------------------------------------------------------------------------------------
点击**导入**按钮允许你从之前导出的 JSON 文件加载设置。
* **过程:**
1. 点击**导入**。
2. 出现文件打开对话框。选择要导入的 `kilo-code-settings.json` 文件(或类似命名的文件)。
3. Kilo Code 读取文件,根据预期模式验证其内容,并应用设置。
* **合并:** 导入设置**合并**配置。它根据文件内容添加新的 API 配置文件并更新现有配置和全局设置。它不会删除当前设置中存在但导入文件中缺少的配置。
* **验证:** 只有与内部模式匹配的有效设置才能被导入,防止配置错误。完成后会出现成功通知。
重置设置[](https://kilocode.ai/docs/zh-CN/features/settings-management#%E9%87%8D%E7%BD%AE%E8%AE%BE%E7%BD%AE "重置设置的直接链接")
----------------------------------------------------------------------------------------------------------------------
点击**重置**按钮将完全清除所有 Kilo Code 配置数据并将扩展恢复到默认状态。这是一个破坏性操作,旨在进行故障排除或重新开始。
* **警告:** 此操作是**不可逆的**。它永久删除所有 API 配置(包括存储在秘密存储中的密钥)、自定义模式、全局设置和任务历史记录。
* **过程:**
1. 点击红色的**重置**按钮。
2. 出现确认对话框,警告此操作无法撤销。
3. 点击“是”确认。
* **重置的内容:**
* **API 提供者配置文件:** 从设置和秘密存储中删除所有配置。
* **全局设置:** 所有偏好(UI、模式、批准、浏览器等)重置为默认值。
* **自定义模式:** 删除所有用户定义的模式。
* **秘密存储:** 清除 Kilo Code 管理的所有 API 密钥和其他秘密。
* **任务历史记录:** 清除当前任务堆栈。
* **结果:** Kilo Code 恢复到初始状态,就像刚安装一样,具有默认设置且没有用户配置。
仅在你确定要删除所有 Kilo Code 数据或在进行故障排除时被指示时使用此选项。如果以后可能需要恢复设置,请考虑先导出你的设置。
* [导出设置](https://kilocode.ai/docs/zh-CN/features/settings-management#%E5%AF%BC%E5%87%BA%E8%AE%BE%E7%BD%AE)
* [导入设置](https://kilocode.ai/docs/zh-CN/features/settings-management#%E5%AF%BC%E5%85%A5%E8%AE%BE%E7%BD%AE)
* [重置设置](https://kilocode.ai/docs/zh-CN/features/settings-management#%E9%87%8D%E7%BD%AE%E8%AE%BE%E7%BD%AE)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Fsettings-management)
---
# faq | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/faq#__docusaurus_skipToContent_fallback)
本页总览
本页面解答关于Kilo Code的一些常见问题。
一般问题[](https://kilocode.ai/docs/zh-CN/faq#%E4%B8%80%E8%88%AC%E9%97%AE%E9%A2%98 "一般问题的直接链接")
---------------------------------------------------------------------------------------------
### 什么是Kilo Code?[](https://kilocode.ai/docs/zh-CN/faq#%E4%BB%80%E4%B9%88%E6%98%AFkilo-code "什么是Kilo Code?的直接链接")
Kilo Code是一个开源的Visual Studio Code扩展,它通过生成代码、自动化任务和提供建议来帮助你更高效地编写代码。
### Kilo Code如何工作?[](https://kilocode.ai/docs/zh-CN/faq#kilo-code%E5%A6%82%E4%BD%95%E5%B7%A5%E4%BD%9C "Kilo Code如何工作?的直接链接")
Kilo Code使用大型语言模型(LLMs)来理解你的请求并将其转化为行动。它可以:
* 读取和写入项目中的文件
* 在VS Code终端中执行命令
* 进行网页浏览(如果启用)
* 通过模型上下文协议(MCP)使用外部工具
你通过聊天界面与Kilo Code交互,在其中提供指令并审查/批准其提出的操作。
### Kilo Code能做什么?[](https://kilocode.ai/docs/zh-CN/faq#kilo-code%E8%83%BD%E5%81%9A%E4%BB%80%E4%B9%88 "Kilo Code能做什么?的直接链接")
Kilo Code可以帮助完成各种编码任务,包括:
* 根据自然语言描述生成代码
* 重构现有代码
* 修复bug
* 编写文档
* 解释代码
* 回答有关代码库的问题
* 自动化重复性任务
* 创建新文件和项目
### Kilo Code是免费的吗?[](https://kilocode.ai/docs/zh-CN/faq#kilo-code%E6%98%AF%E5%85%8D%E8%B4%B9%E7%9A%84%E5%90%97 "Kilo Code是免费的吗?的直接链接")
Kilo Code扩展本身是免费开源的。此外,Kilo Code提供免费层级,包含$20的Claude 3.7 Sonnet tokens。如果你的反馈有用,我们还会赠送更多免费tokens。
之后,你可以添加信用卡购买更多tokens(通过Stripe安全处理)。我们的定价与Anthropic的API费率完全一致。我们不会从每个token或每次充值中抽取任何费用。未来我们将添加更多LLM提供商。
或者,你可以"自带API"(如[Anthropic](https://kilocode.ai/docs/zh-CN/providers/anthropic)
、[OpenAI](https://kilocode.ai/docs/zh-CN/providers/openai)
、[OpenRouter](https://kilocode.ai/docs/zh-CN/providers/openrouter)
、[Requesty](https://kilocode.ai/docs/zh-CN/providers/requesty)
等)来使用其AI功能。这些提供商通常根据处理的tokens数量收取API使用费用。你需要创建账户并从所选提供商处获取API密钥。详情请参见[设置首个AI提供商](https://kilocode.ai/docs/zh-CN/getting-started/connecting-api-provider)
。
### 使用Kilo Code有哪些风险?[](https://kilocode.ai/docs/zh-CN/faq#%E4%BD%BF%E7%94%A8kilo-code%E6%9C%89%E5%93%AA%E4%BA%9B%E9%A3%8E%E9%99%A9 "使用Kilo Code有哪些风险?的直接链接")
Kilo Code是一个强大的工具,使用时需要负责任。以下是一些需要注意的事项:
* **Kilo Code可能会出错。** 在批准Kilo Code的更改之前,请仔细审查。
* **Kilo Code可以执行命令。** 在允许Kilo Code运行命令时要非常谨慎,尤其是在使用自动批准时。
* **Kilo Code可以访问互联网。** 如果你使用的提供商支持网页浏览,请注意Kilo Code可能会访问敏感信息。
设置与安装[](https://kilocode.ai/docs/zh-CN/faq#%E8%AE%BE%E7%BD%AE%E4%B8%8E%E5%AE%89%E8%A3%85 "设置与安装的直接链接")
--------------------------------------------------------------------------------------------------------
### 如何安装Kilo Code?[](https://kilocode.ai/docs/zh-CN/faq#%E5%A6%82%E4%BD%95%E5%AE%89%E8%A3%85kilo-code "如何安装Kilo Code?的直接链接")
请参阅[安装指南](https://kilocode.ai/docs/zh-CN/getting-started/installing)
获取详细说明。
### 支持哪些API提供商?[](https://kilocode.ai/docs/zh-CN/faq#%E6%94%AF%E6%8C%81%E5%93%AA%E4%BA%9Bapi%E6%8F%90%E4%BE%9B%E5%95%86 "支持哪些API提供商?的直接链接")
Kilo Code支持多种API提供商,包括:
* [Anthropic (Claude)](https://kilocode.ai/docs/zh-CN/providers/kilocode)
* [Anthropic (Claude)](https://kilocode.ai/docs/zh-CN/providers/anthropic)
* [OpenAI](https://kilocode.ai/docs/zh-CN/providers/openai)
* [OpenRouter](https://kilocode.ai/docs/zh-CN/providers/openrouter)
* [Google Gemini](https://kilocode.ai/docs/zh-CN/providers/gemini)
* [Glama](https://kilocode.ai/docs/zh-CN/providers/glama)
* [AWS Bedrock](https://kilocode.ai/docs/zh-CN/providers/bedrock)
* [GCP Vertex AI](https://kilocode.ai/docs/zh-CN/providers/vertex)
* [Ollama](https://kilocode.ai/docs/zh-CN/providers/ollama)
* [LM Studio](https://kilocode.ai/docs/zh-CN/providers/lmstudio)
* [DeepSeek](https://kilocode.ai/docs/zh-CN/providers/deepseek)
* [Mistral](https://kilocode.ai/docs/zh-CN/providers/mistral)
* [Unbound](https://kilocode.ai/docs/zh-CN/providers/unbound)
* [Requesty](https://kilocode.ai/docs/zh-CN/providers/requesty)
* [VS Code Language Model API](https://kilocode.ai/docs/zh-CN/providers/vscode-lm)
### 如何获取API密钥?[](https://kilocode.ai/docs/zh-CN/faq#%E5%A6%82%E4%BD%95%E8%8E%B7%E5%8F%96api%E5%AF%86%E9%92%A5 "如何获取API密钥?的直接链接")
每个API提供商都有自己的API密钥获取流程。请参阅[设置首个AI提供商](https://kilocode.ai/docs/zh-CN/getting-started/connecting-api-provider)
获取各提供商的相关文档链接。
### 可以使用本地模型吗?[](https://kilocode.ai/docs/zh-CN/faq#%E5%8F%AF%E4%BB%A5%E4%BD%BF%E7%94%A8%E6%9C%AC%E5%9C%B0%E6%A8%A1%E5%9E%8B%E5%90%97 "可以使用本地模型吗?的直接链接")
是的,Kilo Code支持使用[Ollama](https://kilocode.ai/docs/zh-CN/providers/ollama)
和[LM Studio](https://kilocode.ai/docs/zh-CN/providers/lmstudio)
运行本地模型。请参阅[使用本地模型](https://kilocode.ai/docs/zh-CN/advanced-usage/local-models)
获取说明。
使用[](https://kilocode.ai/docs/zh-CN/faq#%E4%BD%BF%E7%94%A8 "使用的直接链接")
-----------------------------------------------------------------------
### 如何开始新任务?[](https://kilocode.ai/docs/zh-CN/faq#%E5%A6%82%E4%BD%95%E5%BC%80%E5%A7%8B%E6%96%B0%E4%BB%BB%E5%8A%A1 "如何开始新任务?的直接链接")
打开Kilo Code面板()并在聊天框中输入你的任务。请清晰具体地描述你希望Kilo Code完成的工作。请参阅[输入你的请求](https://kilocode.ai/docs/zh-CN/)
获取最佳实践。
### Kilo Code有哪些模式?[](https://kilocode.ai/docs/zh-CN/faq#kilo-code%E6%9C%89%E5%93%AA%E4%BA%9B%E6%A8%A1%E5%BC%8F "Kilo Code有哪些模式?的直接链接")
[模式](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes)
是Kilo Code可以采用的不同的角色,每个角色都有特定的关注点和能力。内置模式包括:
* **Code模式:** 用于通用编码任务
* **Architect模式:** 用于规划和技术领导
* **Ask模式:** 用于回答问题并提供信息
* **Debug模式:** 用于系统化问题诊断 你还可以创建[自定义模式](https://kilocode.ai/docs/zh-CN/features/custom-modes)
。
### 如何在模式之间切换?[](https://kilocode.ai/docs/zh-CN/faq#%E5%A6%82%E4%BD%95%E5%9C%A8%E6%A8%A1%E5%BC%8F%E4%B9%8B%E9%97%B4%E5%88%87%E6%8D%A2 "如何在模式之间切换?的直接链接")
使用聊天输入区域的下拉菜单选择不同的模式,或者使用`/`命令切换到特定模式。
### 什么是工具,如何使用它们?[](https://kilocode.ai/docs/zh-CN/faq#%E4%BB%80%E4%B9%88%E6%98%AF%E5%B7%A5%E5%85%B7%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%E5%AE%83%E4%BB%AC "什么是工具,如何使用它们?的直接链接")
[工具](https://kilocode.ai/docs/zh-CN/basic-usage/how-tools-work)
是Kilo Code与你的系统交互的方式。Kilo Code会自动选择并使用适当的工具来完成你的任务。你不需要直接调用工具。每次使用工具时,你都会被提示批准或拒绝。
### 什么是上下文提及?[](https://kilocode.ai/docs/zh-CN/faq#%E4%BB%80%E4%B9%88%E6%98%AF%E4%B8%8A%E4%B8%8B%E6%96%87%E6%8F%90%E5%8F%8A "什么是上下文提及?的直接链接")
[上下文提及](https://kilocode.ai/docs/zh-CN/basic-usage/context-mentions)
是一种为Kilo Code提供项目特定信息的方式,例如文件、文件夹或问题。使用"@"符号后跟你想要提及的项目(例如`@/src/file.ts`,`@problems`)。
### Kilo Code可以访问互联网吗?[](https://kilocode.ai/docs/zh-CN/faq#kilo-code%E5%8F%AF%E4%BB%A5%E8%AE%BF%E9%97%AE%E4%BA%92%E8%81%94%E7%BD%91%E5%90%97 "Kilo Code可以访问互联网吗?的直接链接")
是的,如果你使用的提供商支持模型进行网页浏览。请注意允许此功能的安全隐患。
### Kilo Code可以在我的终端中运行命令吗?[](https://kilocode.ai/docs/zh-CN/faq#kilo-code%E5%8F%AF%E4%BB%A5%E5%9C%A8%E6%88%91%E7%9A%84%E7%BB%88%E7%AB%AF%E4%B8%AD%E8%BF%90%E8%A1%8C%E5%91%BD%E4%BB%A4%E5%90%97 "Kilo Code可以在我的终端中运行命令吗?的直接链接")
是的,Kilo Code可以在你的VS Code终端中执行命令。除非你启用了命令的自动批准,否则在执行每个命令之前,你都会被提示批准。在自动批准命令时要格外小心。如果你在终端命令上遇到问题,请参阅[Shell集成指南](https://kilocode.ai/docs/zh-CN/features/shell-integration)
进行故障排除。
### 如何向Kilo Code提供反馈?[](https://kilocode.ai/docs/zh-CN/faq#%E5%A6%82%E4%BD%95%E5%90%91kilo-code%E6%8F%90%E4%BE%9B%E5%8F%8D%E9%A6%88 "如何向Kilo Code提供反馈?的直接链接")
你可以通过批准或拒绝Kilo Code的提议操作来提供反馈。你还可以使用反馈字段提供额外的反馈。
### 可以自定义Kilo Code的行为吗?[](https://kilocode.ai/docs/zh-CN/faq#%E5%8F%AF%E4%BB%A5%E8%87%AA%E5%AE%9A%E4%B9%89kilo-code%E7%9A%84%E8%A1%8C%E4%B8%BA%E5%90%97 "可以自定义Kilo Code的行为吗?的直接链接")
是的,你可以通过多种方式自定义Kilo Code:
* **自定义指令:** 提供适用于所有模式的通用指令,或特定模式的指令
* **自定义模式:** 创建具有定制提示和工具权限的自定义模式
* **`.clinerules`文件:** 在项目中创建`.clinerules`文件以提供额外的指导
* **设置:** 调整各种设置,如自动批准、差异编辑等
### Kilo Code有自动批准设置吗?[](https://kilocode.ai/docs/zh-CN/faq#kilo-code%E6%9C%89%E8%87%AA%E5%8A%A8%E6%89%B9%E5%87%86%E8%AE%BE%E7%BD%AE%E5%90%97 "Kilo Code有自动批准设置吗?的直接链接")
是的,Kilo Code有一些设置,启用后会自动批准操作。了解更多[这里](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions)
。
高级功能[](https://kilocode.ai/docs/zh-CN/faq#%E9%AB%98%E7%BA%A7%E5%8A%9F%E8%83%BD "高级功能的直接链接")
---------------------------------------------------------------------------------------------
### 可以离线使用Kilo Code吗?[](https://kilocode.ai/docs/zh-CN/faq#%E5%8F%AF%E4%BB%A5%E7%A6%BB%E7%BA%BF%E4%BD%BF%E7%94%A8kilo-code%E5%90%97 "可以离线使用Kilo Code吗?的直接链接")
是的,如果你使用[本地模型](https://kilocode.ai/docs/zh-CN/advanced-usage/local-models)
。
### 什么是MCP(模型上下文协议)?[](https://kilocode.ai/docs/zh-CN/faq#%E4%BB%80%E4%B9%88%E6%98%AFmcp%E6%A8%A1%E5%9E%8B%E4%B8%8A%E4%B8%8B%E6%96%87%E5%8D%8F%E8%AE%AE "什么是MCP(模型上下文协议)?的直接链接")
[MCP](https://kilocode.ai/docs/zh-CN/features/mcp/overview)
是一种协议,允许Kilo Code与外部服务器通信,通过自定义工具和资源扩展其能力。
### 可以创建自己的MCP服务器吗?[](https://kilocode.ai/docs/zh-CN/faq#%E5%8F%AF%E4%BB%A5%E5%88%9B%E5%BB%BA%E8%87%AA%E5%B7%B1%E7%9A%84mcp%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%90%97 "可以创建自己的MCP服务器吗?的直接链接")
是的,你可以创建自己的MCP服务器来为Kilo Code添加自定义功能。详情请参阅[MCP文档](https://github.com/modelcontextprotocol)
。
故障排除[](https://kilocode.ai/docs/zh-CN/faq#%E6%95%85%E9%9A%9C%E6%8E%92%E9%99%A4 "故障排除的直接链接")
---------------------------------------------------------------------------------------------
### Kilo Code没有响应。我该怎么办?[](https://kilocode.ai/docs/zh-CN/faq#kilo-code%E6%B2%A1%E6%9C%89%E5%93%8D%E5%BA%94%E6%88%91%E8%AF%A5%E6%80%8E%E4%B9%88%E5%8A%9E "Kilo Code没有响应。我该怎么办?的直接链接")
* 确保你的API密钥正确且未过期
* 检查你的互联网连接
* 检查你选择的API提供商的状态
* 尝试重启VS Code
* 如果问题仍然存在,请在[GitHub](https://github.com/Kilo-Org/kilocode/issues)
或[Discord](https://kilocode.ai/discord)
上报告问题
### 我看到错误消息。这是什么意思?[](https://kilocode.ai/docs/zh-CN/faq#%E6%88%91%E7%9C%8B%E5%88%B0%E9%94%99%E8%AF%AF%E6%B6%88%E6%81%AF%E8%BF%99%E6%98%AF%E4%BB%80%E4%B9%88%E6%84%8F%E6%80%9D "我看到错误消息。这是什么意思?的直接链接")
错误消息应该会提供一些关于问题的信息。如果你不确定如何解决,请在社区论坛中寻求帮助。
### Kilo Code做了我不想要的更改。如何撤销?[](https://kilocode.ai/docs/zh-CN/faq#kilo-code%E5%81%9A%E4%BA%86%E6%88%91%E4%B8%8D%E6%83%B3%E8%A6%81%E7%9A%84%E6%9B%B4%E6%94%B9%E5%A6%82%E4%BD%95%E6%92%A4%E9%94%80 "Kilo Code做了我不想要的更改。如何撤销?的直接链接")
Kilo Code使用VS Code内置的文件编辑功能。你可以使用标准的"撤销"命令(Ctrl/Cmd + Z)来还原更改。此外,如果启用了实验性检查点,Kilo可以还原对文件所做的更改。
### 如何报告bug或建议功能?[](https://kilocode.ai/docs/zh-CN/faq#%E5%A6%82%E4%BD%95%E6%8A%A5%E5%91%8Abug%E6%88%96%E5%BB%BA%E8%AE%AE%E5%8A%9F%E8%83%BD "如何报告bug或建议功能?的直接链接")
请在Kilo Code的[问题页面](https://github.com/Kilo-Org/kilocode/issues)
和[功能请求页面](https://github.com/Kilo-Org/kilocode/discussions/categories/ideas)
上报告bug或建议功能。
* [一般问题](https://kilocode.ai/docs/zh-CN/faq#%E4%B8%80%E8%88%AC%E9%97%AE%E9%A2%98)
* [什么是Kilo Code?](https://kilocode.ai/docs/zh-CN/faq#%E4%BB%80%E4%B9%88%E6%98%AFkilo-code)
* [Kilo Code如何工作?](https://kilocode.ai/docs/zh-CN/faq#kilo-code%E5%A6%82%E4%BD%95%E5%B7%A5%E4%BD%9C)
* [Kilo Code能做什么?](https://kilocode.ai/docs/zh-CN/faq#kilo-code%E8%83%BD%E5%81%9A%E4%BB%80%E4%B9%88)
* [Kilo Code是免费的吗?](https://kilocode.ai/docs/zh-CN/faq#kilo-code%E6%98%AF%E5%85%8D%E8%B4%B9%E7%9A%84%E5%90%97)
* [使用Kilo Code有哪些风险?](https://kilocode.ai/docs/zh-CN/faq#%E4%BD%BF%E7%94%A8kilo-code%E6%9C%89%E5%93%AA%E4%BA%9B%E9%A3%8E%E9%99%A9)
* [设置与安装](https://kilocode.ai/docs/zh-CN/faq#%E8%AE%BE%E7%BD%AE%E4%B8%8E%E5%AE%89%E8%A3%85)
* [如何安装Kilo Code?](https://kilocode.ai/docs/zh-CN/faq#%E5%A6%82%E4%BD%95%E5%AE%89%E8%A3%85kilo-code)
* [支持哪些API提供商?](https://kilocode.ai/docs/zh-CN/faq#%E6%94%AF%E6%8C%81%E5%93%AA%E4%BA%9Bapi%E6%8F%90%E4%BE%9B%E5%95%86)
* [如何获取API密钥?](https://kilocode.ai/docs/zh-CN/faq#%E5%A6%82%E4%BD%95%E8%8E%B7%E5%8F%96api%E5%AF%86%E9%92%A5)
* [可以使用本地模型吗?](https://kilocode.ai/docs/zh-CN/faq#%E5%8F%AF%E4%BB%A5%E4%BD%BF%E7%94%A8%E6%9C%AC%E5%9C%B0%E6%A8%A1%E5%9E%8B%E5%90%97)
* [使用](https://kilocode.ai/docs/zh-CN/faq#%E4%BD%BF%E7%94%A8)
* [如何开始新任务?](https://kilocode.ai/docs/zh-CN/faq#%E5%A6%82%E4%BD%95%E5%BC%80%E5%A7%8B%E6%96%B0%E4%BB%BB%E5%8A%A1)
* [Kilo Code有哪些模式?](https://kilocode.ai/docs/zh-CN/faq#kilo-code%E6%9C%89%E5%93%AA%E4%BA%9B%E6%A8%A1%E5%BC%8F)
* [如何在模式之间切换?](https://kilocode.ai/docs/zh-CN/faq#%E5%A6%82%E4%BD%95%E5%9C%A8%E6%A8%A1%E5%BC%8F%E4%B9%8B%E9%97%B4%E5%88%87%E6%8D%A2)
* [什么是工具,如何使用它们?](https://kilocode.ai/docs/zh-CN/faq#%E4%BB%80%E4%B9%88%E6%98%AF%E5%B7%A5%E5%85%B7%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%E5%AE%83%E4%BB%AC)
* [什么是上下文提及?](https://kilocode.ai/docs/zh-CN/faq#%E4%BB%80%E4%B9%88%E6%98%AF%E4%B8%8A%E4%B8%8B%E6%96%87%E6%8F%90%E5%8F%8A)
* [Kilo Code可以访问互联网吗?](https://kilocode.ai/docs/zh-CN/faq#kilo-code%E5%8F%AF%E4%BB%A5%E8%AE%BF%E9%97%AE%E4%BA%92%E8%81%94%E7%BD%91%E5%90%97)
* [Kilo Code可以在我的终端中运行命令吗?](https://kilocode.ai/docs/zh-CN/faq#kilo-code%E5%8F%AF%E4%BB%A5%E5%9C%A8%E6%88%91%E7%9A%84%E7%BB%88%E7%AB%AF%E4%B8%AD%E8%BF%90%E8%A1%8C%E5%91%BD%E4%BB%A4%E5%90%97)
* [如何向Kilo Code提供反馈?](https://kilocode.ai/docs/zh-CN/faq#%E5%A6%82%E4%BD%95%E5%90%91kilo-code%E6%8F%90%E4%BE%9B%E5%8F%8D%E9%A6%88)
* [可以自定义Kilo Code的行为吗?](https://kilocode.ai/docs/zh-CN/faq#%E5%8F%AF%E4%BB%A5%E8%87%AA%E5%AE%9A%E4%B9%89kilo-code%E7%9A%84%E8%A1%8C%E4%B8%BA%E5%90%97)
* [Kilo Code有自动批准设置吗?](https://kilocode.ai/docs/zh-CN/faq#kilo-code%E6%9C%89%E8%87%AA%E5%8A%A8%E6%89%B9%E5%87%86%E8%AE%BE%E7%BD%AE%E5%90%97)
* [高级功能](https://kilocode.ai/docs/zh-CN/faq#%E9%AB%98%E7%BA%A7%E5%8A%9F%E8%83%BD)
* [可以离线使用Kilo Code吗?](https://kilocode.ai/docs/zh-CN/faq#%E5%8F%AF%E4%BB%A5%E7%A6%BB%E7%BA%BF%E4%BD%BF%E7%94%A8kilo-code%E5%90%97)
* [什么是MCP(模型上下文协议)?](https://kilocode.ai/docs/zh-CN/faq#%E4%BB%80%E4%B9%88%E6%98%AFmcp%E6%A8%A1%E5%9E%8B%E4%B8%8A%E4%B8%8B%E6%96%87%E5%8D%8F%E8%AE%AE)
* [可以创建自己的MCP服务器吗?](https://kilocode.ai/docs/zh-CN/faq#%E5%8F%AF%E4%BB%A5%E5%88%9B%E5%BB%BA%E8%87%AA%E5%B7%B1%E7%9A%84mcp%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%90%97)
* [故障排除](https://kilocode.ai/docs/zh-CN/faq#%E6%95%85%E9%9A%9C%E6%8E%92%E9%99%A4)
* [Kilo Code没有响应。我该怎么办?](https://kilocode.ai/docs/zh-CN/faq#kilo-code%E6%B2%A1%E6%9C%89%E5%93%8D%E5%BA%94%E6%88%91%E8%AF%A5%E6%80%8E%E4%B9%88%E5%8A%9E)
* [我看到错误消息。这是什么意思?](https://kilocode.ai/docs/zh-CN/faq#%E6%88%91%E7%9C%8B%E5%88%B0%E9%94%99%E8%AF%AF%E6%B6%88%E6%81%AF%E8%BF%99%E6%98%AF%E4%BB%80%E4%B9%88%E6%84%8F%E6%80%9D)
* [Kilo Code做了我不想要的更改。如何撤销?](https://kilocode.ai/docs/zh-CN/faq#kilo-code%E5%81%9A%E4%BA%86%E6%88%91%E4%B8%8D%E6%83%B3%E8%A6%81%E7%9A%84%E6%9B%B4%E6%94%B9%E5%A6%82%E4%BD%95%E6%92%A4%E9%94%80)
* [如何报告bug或建议功能?](https://kilocode.ai/docs/zh-CN/faq#%E5%A6%82%E4%BD%95%E6%8A%A5%E5%91%8Abug%E6%88%96%E5%BB%BA%E8%AE%AE%E5%8A%9F%E8%83%BD)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffaq)
---
# 更多功能 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/more-features#__docusaurus_skipToContent_fallback)
本页总览
本页面描述了 Kilo Code 中增强开发工作流程的更多功能。
建议响应[](https://kilocode.ai/docs/zh-CN/features/more-features#%E5%BB%BA%E8%AE%AE%E5%93%8D%E5%BA%94 "建议响应的直接链接")
----------------------------------------------------------------------------------------------------------------
Kilo Code 提供问题的建议响应,节省你打字的时间。这些建议在提问后以按钮的形式出现在聊天输入框下方。点击建议即可快速将其用作你的下一个提示。
此功能旨在通过预测你可能的后续问题并提供一键访问相关提示来简化你的工作流程。
文本转语音[](https://kilocode.ai/docs/zh-CN/features/more-features#%E6%96%87%E6%9C%AC%E8%BD%AC%E8%AF%AD%E9%9F%B3 "文本转语音的直接链接")
---------------------------------------------------------------------------------------------------------------------------
Kilo Code 包含一个文本转语音(TTS)功能,可以朗读 AI 的响应,让你可以听取信息而不是阅读。这对于无障碍访问、学习或简单地改变节奏很有帮助。
要使用文本转语音功能,只需在 Kilo Code 设置中启用它。启用后,聊天中每个 AI 响应旁边都会出现一个扬声器图标。点击图标开始收听。
全球语言支持[](https://kilocode.ai/docs/zh-CN/features/more-features#%E5%85%A8%E7%90%83%E8%AF%AD%E8%A8%80%E6%94%AF%E6%8C%81 "全球语言支持的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------
Kilo Code 支持 14 种语言,使其对全球更广泛的用户群体更加易用。你现在可以使用以下语言的 Kilo Code:
* 简体中文
* 繁体中文
* 西班牙语
* 印地语
* 法语
* 葡萄牙语
* 德语
* 日语
* 韩语
* 意大利语
* 土耳其语
* 越南语
* 波兰语
* 加泰罗尼亚语
要更改你的语言,请前往 Kilo Code 设置面板中的**高级设置 > 语言**。
此次全球更新确保了全球用户更流畅、更包容的编码体验。
* [建议响应](https://kilocode.ai/docs/zh-CN/features/more-features#%E5%BB%BA%E8%AE%AE%E5%93%8D%E5%BA%94)
* [文本转语音](https://kilocode.ai/docs/zh-CN/features/more-features#%E6%96%87%E6%9C%AC%E8%BD%AC%E8%AF%AD%E9%9F%B3)
* [全球语言支持](https://kilocode.ai/docs/zh-CN/features/more-features#%E5%85%A8%E7%90%83%E8%AF%AD%E8%A8%80%E6%94%AF%E6%8C%81)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Fmore-features)
---
# 代码操作 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/code-actions#__docusaurus_skipToContent_fallback)
本页总览
代码操作是 VS Code 的一项强大功能,它可以直接在编辑器中提供快速修复、重构和其他代码相关建议。Kilo Code 与这一系统集成,为常见的编码任务提供 AI 驱动的辅助。
什么是代码操作?[](https://kilocode.ai/docs/zh-CN/features/code-actions#%E4%BB%80%E4%B9%88%E6%98%AF%E4%BB%A3%E7%A0%81%E6%93%8D%E4%BD%9C "什么是代码操作?的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------------------
代码操作以灯泡图标(💡)的形式出现在编辑器左侧的装订线(行号左侧的区域)中。它们也可以通过右键菜单或键盘快捷键访问。触发代码操作的情况包括:
* 你选择了一段代码。
* 你的光标位于有问题的行(错误、警告或提示)。
* 你通过命令调用它们。
点击灯泡、右键选择“Kilo Code”或使用键盘快捷键(默认情况下,Windows/Linux 为 `Ctrl+.`,macOS 为 `Cmd+.`),会显示可用操作的菜单。

Kilo Code 的代码操作[](https://kilocode.ai/docs/zh-CN/features/code-actions#kilo-code-%E7%9A%84%E4%BB%A3%E7%A0%81%E6%93%8D%E4%BD%9C "Kilo Code 的代码操作的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------------------------
Kilo Code 提供以下代码操作:
* **添加上下文:** 快速将选中的代码添加到与 Kilo 的聊天中,包括行号以便 Kilo 知道代码的确切位置。它位于菜单顶部以便快速访问。(详见下文)。
* **解释代码:** 让 Kilo Code 解释选中的代码。
* **修复代码:** 让 Kilo Code 修复选中代码中的问题(当存在诊断信息时可用)。
* **改进代码:** 让 Kilo Code 建议对选中代码的改进。
### 添加上下文深入解析[](https://kilocode.ai/docs/zh-CN/features/code-actions#%E6%B7%BB%E5%8A%A0%E4%B8%8A%E4%B8%8B%E6%96%87%E6%B7%B1%E5%85%A5%E8%A7%A3%E6%9E%90 "添加上下文深入解析的直接链接")
**添加上下文** 操作位于代码操作菜单的顶部,以便你可以快速将代码片段添加到对话中。当你使用它时,Kilo Code 会包含文件名和行号以及代码。
这有助于 Kilo 理解代码在项目中的确切上下文,从而提供更相关和准确的帮助。

**示例聊天输入:**
你能解释这个函数吗?@myFile.js:15:25
_(其中 `@myFile.js:15:25` 表示通过“添加上下文”添加的代码)_
每个操作都可以在“新任务”或“当前任务”中执行。
使用代码操作[](https://kilocode.ai/docs/zh-CN/features/code-actions#%E4%BD%BF%E7%94%A8%E4%BB%A3%E7%A0%81%E6%93%8D%E4%BD%9C "使用代码操作的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------
使用 Kilo Code 代码操作的主要方式有三种:
### 1\. 通过灯泡图标(💡)[](https://kilocode.ai/docs/zh-CN/features/code-actions#1-%E9%80%9A%E8%BF%87%E7%81%AF%E6%B3%A1%E5%9B%BE%E6%A0%87 "1. 通过灯泡图标(💡)的直接链接")
1. **选择代码:** 选择你要处理的代码。你可以选择单行、多行或整个代码块。
2. **寻找灯泡:** 灯泡图标会出现在选中代码(或有错误/警告的行)旁边的装订线中。
3. **点击灯泡:** 点击灯泡图标以打开代码操作菜单。
4. **选择一个操作:** 从菜单中选择所需的 Kilo Code 操作。
5. **审查并批准:** Kilo Code 会在聊天面板中提出解决方案。审查提出的更改并批准或拒绝它们。
### 2\. 通过右键菜单[](https://kilocode.ai/docs/zh-CN/features/code-actions#2-%E9%80%9A%E8%BF%87%E5%8F%B3%E9%94%AE%E8%8F%9C%E5%8D%95 "2. 通过右键菜单的直接链接")
1. **选择代码:** 选择你要处理的代码。
2. **右键点击:** 右键点击选中的代码以打开上下文菜单。
3. **选择“Kilo Code”:** 从上下文菜单中选择“Kilo Code”选项。将出现一个子菜单,显示可用的 Kilo Code 操作。
4. **选择一个操作:** 从子菜单中选择所需的操作。
5. **审查并批准:** Kilo Code 会在聊天面板中提出解决方案。审查提出的更改并批准或拒绝它们。
### 3\. 通过命令面板[](https://kilocode.ai/docs/zh-CN/features/code-actions#3-%E9%80%9A%E8%BF%87%E5%91%BD%E4%BB%A4%E9%9D%A2%E6%9D%BF "3. 通过命令面板的直接链接")
1. **选择代码:** 选择你要处理的代码。
2. **打开命令面板:** 按 `Ctrl+Shift+P`(Windows/Linux)或 `Cmd+Shift+P`(macOS)。
3. **输入命令:** 输入“Kilo Code”以过滤命令,然后选择相关的代码操作(例如,“Kilo Code: 解释代码”)。你也可以输入命令的开头,如“Kilo Code: 解释”,并从过滤列表中选择。
4. **审查并批准:** Kilo Code 会在聊天面板中提出解决方案。审查提出的更改并批准或拒绝它们。
代码操作与当前任务[](https://kilocode.ai/docs/zh-CN/features/code-actions#%E4%BB%A3%E7%A0%81%E6%93%8D%E4%BD%9C%E4%B8%8E%E5%BD%93%E5%89%8D%E4%BB%BB%E5%8A%A1 "代码操作与当前任务的直接链接")
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
每个代码操作都提供两个选项:
* **在新任务中:** 选择此项以开始一个围绕此代码操作的对话。
* **在当前任务中:** 如果对话已经开始,此选项将代码操作作为附加消息添加到当前对话中。
自定义代码操作提示[](https://kilocode.ai/docs/zh-CN/features/code-actions#%E8%87%AA%E5%AE%9A%E4%B9%89%E4%BB%A3%E7%A0%81%E6%93%8D%E4%BD%9C%E6%8F%90%E7%A4%BA "自定义代码操作提示的直接链接")
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
你可以通过修改**提示**选项卡中的“支持提示”来自定义每个代码操作的提示。这允许你微调给 AI 模型的指令,并根据你的具体需求定制响应。
1. **打开提示选项卡:** 点击 Kilo Code 顶部菜单栏中的 图标。
2. **找到“支持提示”:** 你会看到支持提示,包括“增强提示”、“解释代码”、“修复代码”和“改进代码”。
3. **编辑提示:** 修改你要自定义的提示的文本区域。你可以使用占位符,如 `${filePath}` 和 `${selectedText}` 来包含当前文件和选择的信息。
4. **点击“完成”:** 保存你的更改。
通过使用 Kilo Code 的代码操作,你可以直接在编码工作流程中快速获得 AI 驱动的辅助。这可以节省时间并帮助你编写更好的代码。
* [什么是代码操作?](https://kilocode.ai/docs/zh-CN/features/code-actions#%E4%BB%80%E4%B9%88%E6%98%AF%E4%BB%A3%E7%A0%81%E6%93%8D%E4%BD%9C)
* [Kilo Code 的代码操作](https://kilocode.ai/docs/zh-CN/features/code-actions#kilo-code-%E7%9A%84%E4%BB%A3%E7%A0%81%E6%93%8D%E4%BD%9C)
* [添加上下文深入解析](https://kilocode.ai/docs/zh-CN/features/code-actions#%E6%B7%BB%E5%8A%A0%E4%B8%8A%E4%B8%8B%E6%96%87%E6%B7%B1%E5%85%A5%E8%A7%A3%E6%9E%90)
* [使用代码操作](https://kilocode.ai/docs/zh-CN/features/code-actions#%E4%BD%BF%E7%94%A8%E4%BB%A3%E7%A0%81%E6%93%8D%E4%BD%9C)
* [1\. 通过灯泡图标(💡)](https://kilocode.ai/docs/zh-CN/features/code-actions#1-%E9%80%9A%E8%BF%87%E7%81%AF%E6%B3%A1%E5%9B%BE%E6%A0%87)
* [2\. 通过右键菜单](https://kilocode.ai/docs/zh-CN/features/code-actions#2-%E9%80%9A%E8%BF%87%E5%8F%B3%E9%94%AE%E8%8F%9C%E5%8D%95)
* [3\. 通过命令面板](https://kilocode.ai/docs/zh-CN/features/code-actions#3-%E9%80%9A%E8%BF%87%E5%91%BD%E4%BB%A4%E9%9D%A2%E6%9D%BF)
* [代码操作与当前任务](https://kilocode.ai/docs/zh-CN/features/code-actions#%E4%BB%A3%E7%A0%81%E6%93%8D%E4%BD%9C%E4%B8%8E%E5%BD%93%E5%89%8D%E4%BB%BB%E5%8A%A1)
* [自定义代码操作提示](https://kilocode.ai/docs/zh-CN/features/code-actions#%E8%87%AA%E5%AE%9A%E4%B9%89%E4%BB%A3%E7%A0%81%E6%93%8D%E4%BD%9C%E6%8F%90%E7%A4%BA)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Fcode-actions)
---
# 建议响应 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/suggested-responses#__docusaurus_skipToContent_fallback)
本页总览
当 Kilo Code 需要更多信息来完成任务时,它会使用 [`ask_followup_question` 工具](https://kilocode.ai/docs/zh-CN/features/tools/ask-followup-question)
。为了更轻松、更快速地响应,Kilo Code 通常会提供建议答案。
概述[](https://kilocode.ai/docs/zh-CN/features/suggested-responses#%E6%A6%82%E8%BF%B0 "概述的直接链接")
------------------------------------------------------------------------------------------------
建议响应以可点击按钮的形式出现在 Kilo Code 问题下方的聊天界面中。它们提供了与问题相关的预制答案,帮助你快速提供输入。

工作原理[](https://kilocode.ai/docs/zh-CN/features/suggested-responses#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86 "工作原理的直接链接")
----------------------------------------------------------------------------------------------------------------------
1. **问题出现**:Kilo Code 使用 `ask_followup_question` 工具提问。
2. **显示建议**:如果 Kilo Code 提供了建议,它们会以按钮的形式出现在问题下方。
3. **交互**:你可以通过两种方式与这些建议进行交互。
与建议交互[](https://kilocode.ai/docs/zh-CN/features/suggested-responses#%E4%B8%8E%E5%BB%BA%E8%AE%AE%E4%BA%A4%E4%BA%92 "与建议交互的直接链接")
---------------------------------------------------------------------------------------------------------------------------------
你有两种使用建议响应的选项:
1. **直接选择**:
* **操作**:只需点击包含你想要提供的答案的按钮。
* **结果**:选定的答案会立即作为你的响应发送回 Kilo Code。如果某个建议完全符合你的意图,这是最快的回复方式。
2. **发送前编辑**:
* **操作**:
* 按住 `Shift` 并点击建议按钮。
* _或者_,将鼠标悬停在建议按钮上,点击出现的铅笔图标()。
* **结果**:建议的文本会复制到聊天输入框中。然后你可以根据需要修改文本,然后按下 Enter 键发送自定义的响应。当建议接近但需要稍作调整时,这很有用。

优势[](https://kilocode.ai/docs/zh-CN/features/suggested-responses#%E4%BC%98%E5%8A%BF "优势的直接链接")
------------------------------------------------------------------------------------------------
* **速度**:无需输入完整答案即可快速响应。
* **清晰度**:建议通常阐明了 Kilo Code 所需的信息类型。
* **灵活性**:在需要时编辑建议以提供精确、自定义的答案。
此功能在 Kilo Code 需要澄清时简化了交互,让你能够以最少的努力有效地指导任务。
* [概述](https://kilocode.ai/docs/zh-CN/features/suggested-responses#%E6%A6%82%E8%BF%B0)
* [工作原理](https://kilocode.ai/docs/zh-CN/features/suggested-responses#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86)
* [与建议交互](https://kilocode.ai/docs/zh-CN/features/suggested-responses#%E4%B8%8E%E5%BB%BA%E8%AE%AE%E4%BA%A4%E4%BA%92)
* [优势](https://kilocode.ai/docs/zh-CN/features/suggested-responses#%E4%BC%98%E5%8A%BF)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Fsuggested-responses)
---
# 模型温度 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/model-temperature#__docusaurus_skipToContent_fallback)
本页总览
温度控制控制着 AI 模型输出的随机性。调整此设置可以优化不同任务的结果 - 从精确的代码生成到创意头脑风暴。温度是控制 AI 行为最强大的参数之一。经过良好调优的温度设置可以显著提高特定任务响应的质量和适用性。

什么是温度?[](https://kilocode.ai/docs/zh-CN/features/model-temperature#%E4%BB%80%E4%B9%88%E6%98%AF%E6%B8%A9%E5%BA%A6 "什么是温度?的直接链接")
---------------------------------------------------------------------------------------------------------------------------------
温度是一个设置(通常在 0.0 到 2.0 之间),用于控制 AI 输出的随机性或可预测性。找到合适的平衡点很关键:较低的值使输出更加集中和一致,而较高的值则鼓励更多的创造性和多样性。对于许多编码任务,适中的温度(大约 0.3 到 0.7)通常效果很好,但最佳设置取决于你想要实现的目标。
温度和代码:常见误解
温度控制输出随机性,而不是直接控制代码质量或准确性。关键点:
* **低温(接近 0.0):** 产生可预测、一致的代码。适用于简单任务,但可能重复且缺乏创造性。它不保证代码更好。
* **高温:** 增加随机性,可能导致创造性解决方案,但也可能产生更多错误或无意义的代码。它不保证代码质量更高。
* **准确性:** 代码准确性取决于模型的训练和提示的清晰度,而不是温度。
* **温度 0.0:** 对一致性很有用,但限制了解决复杂问题所需的探索。
Kilo Code 中的默认值[](https://kilocode.ai/docs/zh-CN/features/model-temperature#kilo-code-%E4%B8%AD%E7%9A%84%E9%BB%98%E8%AE%A4%E5%80%BC "Kilo Code 中的默认值的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Kilo Code 对大多数模型使用默认温度 0.0,优化代码生成的最大确定性和精确性。这适用于 OpenAI 模型、Anthropic 模型(非思考变体)、LM Studio 模型和大多数其他提供者。
一些模型使用更高的默认温度 - DeepSeek R1 模型和某些以推理为重点的模型默认温度为 0.6,在确定性和创造性探索之间提供了平衡。
具有思考能力的模型(AI 显示其推理过程)需要固定的温度 1.0,无法更改,因为此设置确保了思考机制的最佳性能。这适用于任何启用了 ":thinking" 标志的模型。
一些特殊模型根本不支持温度调整,在这种情况下,Kilo Code 会自动尊重这些限制。
何时调整温度[](https://kilocode.ai/docs/zh-CN/features/model-temperature#%E4%BD%95%E6%97%B6%E8%B0%83%E6%95%B4%E6%B8%A9%E5%BA%A6 "何时调整温度的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------
以下是一些适用于不同任务的温度设置示例:
* **代码模式(0.0-0.3):** 用于编写精确、正确的代码,具有一致的确定性结果
* **架构模式(0.4-0.7):** 用于头脑风暴架构或设计解决方案,平衡创造性和结构
* **问答模式(0.7-1.0):** 用于需要多样化和有洞察力的响应的解释或开放式问题
* **调试模式(0.0-0.3):** 用于以一致的精确性排除故障
这些都是起点 - 重要的是[尝试不同的设置](https://kilocode.ai/docs/zh-CN/features/model-temperature#experimentation)
以找到最适合你特定需求和偏好的设置。
如何调整温度[](https://kilocode.ai/docs/zh-CN/features/model-temperature#%E5%A6%82%E4%BD%95%E8%B0%83%E6%95%B4%E6%B8%A9%E5%BA%A6 "如何调整温度的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------
1. **打开 Kilo Code 面板:** 点击 VS Code 侧边栏中的 Kilo Code 图标()
2. **打开设置:** 点击右上角的 图标
3. **找到温度控制:** 导航到提供者部分
4. **启用自定义温度:** 勾选 "使用自定义温度" 复选框
5. **设置你的值:** 将滑块调整为你偏好的值

_Kilo Code 设置面板中的温度滑块_
使用 API 配置配置文件设置温度[](https://kilocode.ai/docs/zh-CN/features/model-temperature#%E4%BD%BF%E7%94%A8-api-%E9%85%8D%E7%BD%AE%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E8%AE%BE%E7%BD%AE%E6%B8%A9%E5%BA%A6 "使用 API 配置配置文件设置温度的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
创建多个具有不同温度设置的[API 配置配置文件](https://kilocode.ai/docs/zh-CN/features/api-configuration-profiles)
:
**如何设置特定任务的温度配置文件:**
1. 创建专门配置文件,如 "代码 - 低温"(0.1)和 "问答 - 高温"(0.8)
2. 为每个配置文件配置适当的温度设置
3. 使用设置或聊天界面中的下拉菜单在配置文件之间切换
4. 为每个模式设置不同的默认配置文件,以便在更改模式时自动切换
这种方法无需手动调整即可优化特定任务的模型行为。
技术实现[](https://kilocode.ai/docs/zh-CN/features/model-temperature#%E6%8A%80%E6%9C%AF%E5%AE%9E%E7%8E%B0 "技术实现的直接链接")
--------------------------------------------------------------------------------------------------------------------
Kilo Code 实现温度处理时考虑以下因素:
* 用户定义的设置优先于默认值
* 尊重提供者特定的行为
* 强制执行模型特定的限制:
* 启用思考的模型需要固定的温度 1.0
* 一些模型不支持温度调整
实验[](https://kilocode.ai/docs/zh-CN/features/model-temperature#%E5%AE%9E%E9%AA%8C "实验的直接链接")
----------------------------------------------------------------------------------------------
尝试不同的温度设置是发现最适合你特定需求的最有效方法:
### 有效的温度测试[](https://kilocode.ai/docs/zh-CN/features/model-temperature#%E6%9C%89%E6%95%88%E7%9A%84%E6%B8%A9%E5%BA%A6%E6%B5%8B%E8%AF%95 "有效的温度测试的直接链接")
1. **从默认值开始** - 以 Kilo Code 的预设值(大多数任务为 0.0)作为基线
2. **逐步调整** - 以小步长(±0.1)更改值以观察细微差异
3. **一致测试** - 在不同温度设置下使用相同的提示进行有效比较
4. **记录结果** - 记下哪些值对特定类型的任务产生最佳结果
5. **创建配置文件** - 将有效设置保存为[API 配置配置文件](https://kilocode.ai/docs/zh-CN/features/api-configuration-profiles)
以便快速访问
请记住,不同的模型可能对相同的温度值有不同的响应,而启用思考的模型无论你的设置如何,始终使用固定的温度 1.0。
相关功能[](https://kilocode.ai/docs/zh-CN/features/model-temperature#%E7%9B%B8%E5%85%B3%E5%8A%9F%E8%83%BD "相关功能的直接链接")
--------------------------------------------------------------------------------------------------------------------
* 与 Kilo Code 支持的所有[API 提供者](https://kilocode.ai/docs/zh-CN/providers/openai)
一起使用
* 与[自定义指令](https://kilocode.ai/docs/zh-CN/advanced-usage/custom-instructions)
相辅相成,用于微调响应
* 与你创建的[自定义模式](https://kilocode.ai/docs/zh-CN/features/custom-modes)
一起使用
* [什么是温度?](https://kilocode.ai/docs/zh-CN/features/model-temperature#%E4%BB%80%E4%B9%88%E6%98%AF%E6%B8%A9%E5%BA%A6)
* [Kilo Code 中的默认值](https://kilocode.ai/docs/zh-CN/features/model-temperature#kilo-code-%E4%B8%AD%E7%9A%84%E9%BB%98%E8%AE%A4%E5%80%BC)
* [何时调整温度](https://kilocode.ai/docs/zh-CN/features/model-temperature#%E4%BD%95%E6%97%B6%E8%B0%83%E6%95%B4%E6%B8%A9%E5%BA%A6)
* [如何调整温度](https://kilocode.ai/docs/zh-CN/features/model-temperature#%E5%A6%82%E4%BD%95%E8%B0%83%E6%95%B4%E6%B8%A9%E5%BA%A6)
* [使用 API 配置配置文件设置温度](https://kilocode.ai/docs/zh-CN/features/model-temperature#%E4%BD%BF%E7%94%A8-api-%E9%85%8D%E7%BD%AE%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E8%AE%BE%E7%BD%AE%E6%B8%A9%E5%BA%A6)
* [技术实现](https://kilocode.ai/docs/zh-CN/features/model-temperature#%E6%8A%80%E6%9C%AF%E5%AE%9E%E7%8E%B0)
* [实验](https://kilocode.ai/docs/zh-CN/features/model-temperature#%E5%AE%9E%E9%AA%8C)
* [有效的温度测试](https://kilocode.ai/docs/zh-CN/features/model-temperature#%E6%9C%89%E6%95%88%E7%9A%84%E6%B8%A9%E5%BA%A6%E6%B5%8B%E8%AF%95)
* [相关功能](https://kilocode.ai/docs/zh-CN/features/model-temperature#%E7%9B%B8%E5%85%B3%E5%8A%9F%E8%83%BD)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Fmodel-temperature)
---
# MCP服务器传输机制 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#__docusaurus_skipToContent_fallback)
本页总览
模型上下文协议(MCP)支持两种主要的传输机制用于Kilo Code与MCP服务器之间的通信:标准输入/输出(STDIO)和服务器发送事件(SSE)。每种机制都有其独特的特点、优势和适用场景。
STDIO传输[](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#stdio%E4%BC%A0%E8%BE%93 "STDIO传输的直接链接")
-----------------------------------------------------------------------------------------------------------------
STDIO传输在本地机器上运行,通过标准输入/输出流进行通信。
### STDIO传输工作原理[](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#stdio%E4%BC%A0%E8%BE%93%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86 "STDIO传输工作原理的直接链接")
1. 客户端(Kilo Code)将MCP服务器作为子进程启动
2. 通信通过进程流进行:客户端写入服务器的STDIN,服务器响应到STDOUT
3. 每个消息以换行符分隔
4. 消息格式为JSON-RPC 2.0
Client Server | | |---- JSON message ------>| (via STDIN) | | (processes request) |<---- JSON message ------| (via STDOUT) | |
### STDIO特点[](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#stdio%E7%89%B9%E7%82%B9 "STDIO特点的直接链接")
* **本地性**:与Kilo Code在同一台机器上运行
* **性能**:延迟和开销非常低(不涉及网络栈)
* **简单性**:直接进程通信,无需网络配置
* **关系**:客户端与服务器之间的一对一关系
* **安全性**:本质上更安全,因为不暴露网络
### 使用STDIO的场景[](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#%E4%BD%BF%E7%94%A8stdio%E7%9A%84%E5%9C%BA%E6%99%AF "使用STDIO的场景的直接链接")
STDIO传输适用于:
* 本地集成和工具
* 安全敏感操作
* 低延迟要求
* 单客户端场景(每个服务器一个Kilo Code实例)
* 命令行工具或IDE扩展
### STDIO实现示例[](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#stdio%E5%AE%9E%E7%8E%B0%E7%A4%BA%E4%BE%8B "STDIO实现示例的直接链接")
import { Server } from '@modelcontextprotocol/sdk/server/index.js';import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';const server = new Server({name: 'local-server', version: '1.0.0'});// 注册工具...// 使用STDIO传输const transport = new StdioServerTransport(server);transport.listen();
SSE传输[](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#sse%E4%BC%A0%E8%BE%93 "SSE传输的直接链接")
-----------------------------------------------------------------------------------------------------------
服务器发送事件(SSE)传输在远程服务器上运行,通过HTTP/HTTPS进行通信。
### SSE传输工作原理[](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#sse%E4%BC%A0%E8%BE%93%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86 "SSE传输工作原理的直接链接")
1. 客户端(Kilo Code)通过HTTP GET请求连接到服务器的SSE端点
2. 建立持久连接,服务器可以向客户端推送事件
3. 对于客户端到服务器的通信,客户端向单独的端点发送HTTP POST请求
4. 通信通过两个通道进行:
* 事件流(GET):服务器到客户端更新
* 消息端点(POST):客户端到服务器请求
Client Server | | |---- HTTP GET /events ----------->| (establish SSE connection) |<---- SSE event stream -----------| (persistent connection) | | |---- HTTP POST /message --------->| (client request) |<---- SSE event with response ----| (server response) | |
### SSE特点[](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#sse%E7%89%B9%E7%82%B9 "SSE特点的直接链接")
* **远程访问**:可以托管在与Kilo Code不同的机器上
* **可扩展性**:支持多个客户端并发连接
* **协议**:基于标准HTTP(无需特殊协议)
* **持久性**:维护服务器到客户端消息的持久连接
* **认证**:可以使用标准HTTP认证机制
### 使用SSE的场景[](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#%E4%BD%BF%E7%94%A8sse%E7%9A%84%E5%9C%BA%E6%99%AF "使用SSE的场景的直接链接")
SSE传输更适合:
* 跨网络远程访问
* 多客户端场景
* 公共服务
* 许多用户需要访问的集中式工具
* 与Web服务集成
### SSE实现示例[](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#sse%E5%AE%9E%E7%8E%B0%E7%A4%BA%E4%BE%8B "SSE实现示例的直接链接")
import { Server } from '@modelcontextprotocol/sdk/server/index.js';import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';import express from 'express';const app = express();const server = new Server({name: 'remote-server', version: '1.0.0'});// 注册工具...// 使用SSE传输const transport = new SSEServerTransport(server);app.use('/mcp', transport.requestHandler());app.listen(3000, () => { console.log('MCP server listening on port 3000');});
本地 vs. 托管:部署考虑[](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#%E6%9C%AC%E5%9C%B0-vs-%E6%89%98%E7%AE%A1%E9%83%A8%E7%BD%B2%E8%80%83%E8%99%91 "本地 vs. 托管:部署考虑的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
选择STDIO还是SSE传输将直接影响MCP服务器的部署和管理方式。
### STDIO:本地部署模式[](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#stdio%E6%9C%AC%E5%9C%B0%E9%83%A8%E7%BD%B2%E6%A8%A1%E5%BC%8F "STDIO:本地部署模式的直接链接")
STDIO服务器与Kilo Code在同一台机器上运行,这有几个重要影响:
* **安装**:必须在每个用户的机器上安装服务器可执行文件
* **分发**:需要为不同操作系统提供安装包
* **更新**:每个实例必须单独更新
* **资源**:使用本地机器的CPU、内存和磁盘
* **访问控制**:依赖于本地机器的文件系统权限
* **集成**:易于与本地系统资源(文件、进程)集成
* **执行**:随Kilo Code启动和停止(子进程生命周期)
* **依赖**:任何依赖项都必须安装在用户机器上
#### 实际示例[](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#%E5%AE%9E%E9%99%85%E7%A4%BA%E4%BE%8B "实际示例的直接链接")
一个本地文件搜索工具使用STDIO会:
* 在用户机器上运行
* 直接访问本地文件系统
* 在Kilo Code需要时启动
* 不需要网络配置
* 需要与Kilo Code一起安装或通过包管理器安装
### SSE:托管部署模式[](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#sse%E6%89%98%E7%AE%A1%E9%83%A8%E7%BD%B2%E6%A8%A1%E5%BC%8F "SSE:托管部署模式的直接链接")
SSE服务器可以部署到远程服务器并通过网络访问:
* **安装**:在服务器上安装一次,供多个用户访问
* **分发**:单一部署服务多个客户端
* **更新**:集中更新立即影响所有用户
* **资源**:使用服务器资源,而非本地机器资源
* **访问控制**:通过认证和授权系统管理
* **集成**:与用户特定资源的集成更复杂
* **执行**:作为独立服务运行(通常持续运行)
* **依赖**:在服务器上管理,而非用户机器
#### 实际示例[](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#%E5%AE%9E%E9%99%85%E7%A4%BA%E4%BE%8B-1 "实际示例的直接链接")
一个数据库查询工具使用SSE会:
* 在中央服务器上运行
* 使用服务器端凭据连接数据库
* 持续可用,供多个用户使用
* 需要正确的网络安全配置
* 使用容器或云技术部署
### 混合方法[](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#%E6%B7%B7%E5%90%88%E6%96%B9%E6%B3%95 "混合方法的直接链接")
某些场景受益于混合方法:
1. **带网络访问的STDIO**:本地STDIO服务器充当远程服务的代理
2. **带本地命令的SSE**:远程SSE服务器可以通过回调触发客户端机器上的操作
3. **网关模式**:本地操作的STDIO服务器连接到专用功能的SSE服务器
选择STDIO还是SSE[](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#%E9%80%89%E6%8B%A9stdio%E8%BF%98%E6%98%AFsse "选择STDIO还是SSE的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------------
| 考虑因素 | STDIO | SSE |
| --- | --- | --- |
| **位置** | 仅限本地机器 | 本地或远程 |
| **客户端** | 单客户端 | 多客户端 |
| **性能** | 延迟更低 | 延迟更高(网络开销) |
| **设置复杂性** | 更简单 | 更复杂(需要HTTP服务器) |
| **安全性** | 本质上更安全 | 需要明确的安全措施 |
| **网络访问** | 不需要 | 需要 |
| **可扩展性** | 限于本地机器 | 可以在网络上分布 |
| **部署** | 每用户安装 | 集中安装 |
| **更新** | 分布式更新 | 集中更新 |
| **资源使用** | 使用客户端资源 | 使用服务器资源 |
| **依赖** | 客户端依赖 | 服务器依赖 |
在Kilo Code中配置传输[](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#%E5%9C%A8kilo-code%E4%B8%AD%E9%85%8D%E7%BD%AE%E4%BC%A0%E8%BE%93 "在Kilo Code中配置传输的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
有关在Kilo Code中配置STDIO和SSE传输的详细信息,包括示例配置,请参见[理解传输类型](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#understanding-transport-types)
部分。
* [STDIO传输](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#stdio%E4%BC%A0%E8%BE%93)
* [STDIO传输工作原理](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#stdio%E4%BC%A0%E8%BE%93%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86)
* [STDIO特点](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#stdio%E7%89%B9%E7%82%B9)
* [使用STDIO的场景](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#%E4%BD%BF%E7%94%A8stdio%E7%9A%84%E5%9C%BA%E6%99%AF)
* [STDIO实现示例](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#stdio%E5%AE%9E%E7%8E%B0%E7%A4%BA%E4%BE%8B)
* [SSE传输](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#sse%E4%BC%A0%E8%BE%93)
* [SSE传输工作原理](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#sse%E4%BC%A0%E8%BE%93%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86)
* [SSE特点](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#sse%E7%89%B9%E7%82%B9)
* [使用SSE的场景](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#%E4%BD%BF%E7%94%A8sse%E7%9A%84%E5%9C%BA%E6%99%AF)
* [SSE实现示例](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#sse%E5%AE%9E%E7%8E%B0%E7%A4%BA%E4%BE%8B)
* [本地 vs. 托管:部署考虑](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#%E6%9C%AC%E5%9C%B0-vs-%E6%89%98%E7%AE%A1%E9%83%A8%E7%BD%B2%E8%80%83%E8%99%91)
* [STDIO:本地部署模式](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#stdio%E6%9C%AC%E5%9C%B0%E9%83%A8%E7%BD%B2%E6%A8%A1%E5%BC%8F)
* [SSE:托管部署模式](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#sse%E6%89%98%E7%AE%A1%E9%83%A8%E7%BD%B2%E6%A8%A1%E5%BC%8F)
* [混合方法](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#%E6%B7%B7%E5%90%88%E6%96%B9%E6%B3%95)
* [选择STDIO还是SSE](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#%E9%80%89%E6%8B%A9stdio%E8%BF%98%E6%98%AFsse)
* [在Kilo Code中配置传输](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#%E5%9C%A8kilo-code%E4%B8%AD%E9%85%8D%E7%BD%AE%E4%BC%A0%E8%BE%93)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Fmcp%2Fserver-transports)
---
# 连接您的第一个AI提供商 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/getting-started/connecting-api-provider#__docusaurus_skipToContent_fallback)
本页总览
Kilo Code需要一个AI模型提供商的API密钥才能运行。我们推荐以下选项来访问强大的**Claude 3.7 Sonnet**模型:
* \*\*OpenRouter(推荐):\*\*通过单个API密钥访问多个AI模型。适合快速入门,设置简单。[查看价格](https://openrouter.ai/models?order=pricing-low-to-high)
* \*\*Anthropic:\*\*直接访问Claude模型。需要API访问批准,可能会有[根据您的等级设置速率限制](https://docs.anthropic.com/en/api/rate-limits#requirements-to-advance-tier)
。查看[Anthropic的价格页面](https://www.anthropic.com/pricing#anthropic-api)
了解详情
获取您的API密钥[](https://kilocode.ai/docs/zh-CN/getting-started/connecting-api-provider#%E8%8E%B7%E5%8F%96%E6%82%A8%E7%9A%84api%E5%AF%86%E9%92%A5 "获取您的API密钥的直接链接")
----------------------------------------------------------------------------------------------------------------------------------------------------------------
### 选项1:LLM路由器[](https://kilocode.ai/docs/zh-CN/getting-started/connecting-api-provider#%E9%80%89%E9%A1%B91llm%E8%B7%AF%E7%94%B1%E5%99%A8 "选项1:LLM路由器的直接链接")
LLM路由器让您可以通过一个API密钥访问多个AI模型,简化了成本管理和模型切换。通常提供[更具竞争力的价格](https://openrouter.ai/models?order=pricing-low-to-high)
。
#### OpenRouter[](https://kilocode.ai/docs/zh-CN/getting-started/connecting-api-provider#openrouter "OpenRouter的直接链接")
1. 访问 [openrouter.ai](https://openrouter.ai/)
2. 使用Google或GitHub账号登录
3. 导航到[API密钥页面](https://openrouter.ai/keys)
并创建新密钥
4. 复制您的API密钥 - 您需要它来设置Kilo Code

_OpenRouter仪表板,带有"创建密钥"按钮。命名您的密钥并在创建后复制它。_
#### Requesty[](https://kilocode.ai/docs/zh-CN/getting-started/connecting-api-provider#requesty "Requesty的直接链接")
1. 访问 [requesty.ai](https://requesty.ai/)
2. 使用Google账号或电子邮件登录
3. 导航到[API管理页面](https://app.requesty.ai/manage-api)
并创建新密钥
4. **重要:** 立即复制您的API密钥,因为它不会再次显示

_Requesty API管理页面,带有"创建API密钥"按钮。立即复制您的密钥 - 它只会显示一次。_
### 选项2:直接提供商[](https://kilocode.ai/docs/zh-CN/getting-started/connecting-api-provider#%E9%80%89%E9%A1%B92%E7%9B%B4%E6%8E%A5%E6%8F%90%E4%BE%9B%E5%95%86 "选项2:直接提供商的直接链接")
直接访问特定模型的原提供商,完全使用其功能和特性:
#### Anthropic[](https://kilocode.ai/docs/zh-CN/getting-started/connecting-api-provider#anthropic "Anthropic的直接链接")
1. 访问 [console.anthropic.com](https://console.anthropic.com/)
2. 注册账号或登录
3. 导航到[API密钥部分](https://console.anthropic.com/settings/keys)
并创建新密钥
4. **重要:** 立即复制您的API密钥,因为它不会再次显示

_Anthropic控制台API密钥部分,带有"创建密钥"按钮。命名您的密钥,设置过期时间,并立即复制它。_
#### OpenAI[](https://kilocode.ai/docs/zh-CN/getting-started/connecting-api-provider#openai "OpenAI的直接链接")
1. 访问 [platform.openai.com](https://platform.openai.com/)
2. 注册账号或登录
3. 导航到[API密钥部分](https://platform.openai.com/api-keys)
并创建新密钥
4. **重要:** 立即复制您的API密钥,因为它不会再次显示

_OpenAI平台,带有"创建新密钥"按钮。命名您的密钥并在创建后立即复制它。_
在VS Code中配置Kilo Code[](https://kilocode.ai/docs/zh-CN/getting-started/connecting-api-provider#%E5%9C%A8vs-code%E4%B8%AD%E9%85%8D%E7%BD%AEkilo-code "在VS Code中配置Kilo Code的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
获取API密钥后:
1. 点击VS Code侧边栏中的Kilo Code图标()打开Kilo Code侧边栏
2. 在欢迎界面,从下拉菜单中选择您的API提供商
3. 将API密钥粘贴到相应字段中
4. 选择您的模型:
* 对于**OpenRouter**:选择`anthropic/claude-3.7-sonnet` ([模型详情](https://openrouter.ai/anthropic/claude-3.7-sonnet)
)
* 对于**Anthropic**:选择`claude-3-7-sonnet-20250219` ([模型详情](https://www.anthropic.com/pricing#anthropic-api)
)
5. 点击"Let's go!"保存设置并开始使用Kilo Code
* [获取您的API密钥](https://kilocode.ai/docs/zh-CN/getting-started/connecting-api-provider#%E8%8E%B7%E5%8F%96%E6%82%A8%E7%9A%84api%E5%AF%86%E9%92%A5)
* [选项1:LLM路由器](https://kilocode.ai/docs/zh-CN/getting-started/connecting-api-provider#%E9%80%89%E9%A1%B91llm%E8%B7%AF%E7%94%B1%E5%99%A8)
* [选项2:直接提供商](https://kilocode.ai/docs/zh-CN/getting-started/connecting-api-provider#%E9%80%89%E9%A1%B92%E7%9B%B4%E6%8E%A5%E6%8F%90%E4%BE%9B%E5%95%86)
* [在VS Code中配置Kilo Code](https://kilocode.ai/docs/zh-CN/getting-started/connecting-api-provider#%E5%9C%A8vs-code%E4%B8%AD%E9%85%8D%E7%BD%AEkilo-code)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fgetting-started%2Fconnecting-api-provider)
---
# setting-up | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/getting-started/setting-up#__docusaurus_skipToContent_fallback)
本页总览
注册Kilo Code时,你将获得**价值$20的免费token**作为启动资源。领取免费token的步骤:
1. 完成注册流程
2. 立即获得$5或$20的免费token
3. 要获取完整的$20额度,需要验证信用卡信息(仅用于身份验证)
关于临时预授权
为保护社区并确保服务质量,注册时会临时冻结信用卡$10额度。此预授权通常持续一周左右,**不会实际扣款**。此措施旨在防止免费资源滥用,同时确保正常用户获得最佳体验。我们正在努力在未来取消此限制。
注册流程[](https://kilocode.ai/docs/zh-CN/getting-started/setting-up#%E6%B3%A8%E5%86%8C%E6%B5%81%E7%A8%8B "注册流程的直接链接")
--------------------------------------------------------------------------------------------------------------------
Kilo Code提供简单的注册流程,通过你的账号即可使用前沿的编程模型:
1. 在扩展中点击"免费试用Kilo Code"
2. 使用Google账号登录kilocode.ai
3. kilocode.ai将提示打开Visual Studio Code
* 在网页版IDE中使用时,需要手动复制API密钥
4. 允许打开VS Code后,还需允许VS Code打开授权URL

完成!现在可以开始你的[第一个任务](https://kilocode.ai/docs/zh-CN/getting-started/your-first-task)
需要帮助?
如有任何定价或token相关问题,请联系[支持团队](mailto:hi@kilocode.ai)
或加入我们的[Discord社区](https://kilocode.ai/discord)
。
* [注册流程](https://kilocode.ai/docs/zh-CN/getting-started/setting-up#%E6%B3%A8%E5%86%8C%E6%B5%81%E7%A8%8B)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fgetting-started%2Fsetting-up)
---
# 安装Kilo Code | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/getting-started/installing#__docusaurus_skipToContent_fallback)
本页总览
Kilo Code是一款VS Code扩展,可将AI编程助手直接集成到编辑器中。可通过以下方式安装:
* [**VS Code应用商店(推荐)**](https://kilocode.ai/docs/zh-CN/getting-started/installing#vs-code-marketplace)
- VS Code用户最快捷的安装方式
* [**Cursor应用商店**](https://kilocode.ai/docs/zh-CN/getting-started/installing#cursor-marketplace)
- Cursor用户的推荐安装方式
* [**Open VSX注册表**](https://kilocode.ai/docs/zh-CN/getting-started/installing#open-vsx-registry)
- 适用于VSCodium/Windsurf等兼容VS Code的编辑器
* [**手动安装.vsix文件**](https://kilocode.ai/docs/zh-CN/getting-started/installing#manual-installation-from-vsix)
- 从GitHub Release直接安装
VS Code应用商店[](https://kilocode.ai/docs/zh-CN/getting-started/installing#vs-code%E5%BA%94%E7%94%A8%E5%95%86%E5%BA%97 "VS Code应用商店的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------------
提示
若已安装VS Code:[点击此处直接安装Kilo Code](vscode:extension/kilocode.Kilo-Code)
或按以下步骤操作:
1. 打开VS Code
2. 进入扩展面板:点击侧边栏扩展图标 或按 `Ctrl+Shift+X`(Windows/Linux) / `Cmd+Shift+X`(macOS)
3. 搜索 "Kilo Code"
4. 选择Kilo Code发布的扩展并点击**安装**
5. 根据提示重新加载VS Code
安装完成后,在侧边栏找到Kilo Code图标()即可打开面板。

_VS Code应用商店中的Kilo Code扩展安装界面_
Cursor应用商店[](https://kilocode.ai/docs/zh-CN/getting-started/installing#cursor%E5%BA%94%E7%94%A8%E5%95%86%E5%BA%97 "Cursor应用商店的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------
提示
若已安装Cursor:[点击此处直接安装Kilo Code](cursor:extension/kilocode.Kilo-Code)
或按以下步骤操作:
1. 打开Cursor
2. 进入扩展面板:点击侧边栏扩展图标 或按 `Ctrl+Shift+X`(Windows/Linux) / `Cmd+Shift+X`(macOS)
3. 搜索 "Kilo Code"
4. 选择Kilo Code发布的扩展并点击**安装**
5. 根据提示重新加载Cursor
安装完成后,在侧边栏找到Kilo Code图标()即可打开面板。
Open VSX注册表[](https://kilocode.ai/docs/zh-CN/getting-started/installing#open-vsx%E6%B3%A8%E5%86%8C%E8%A1%A8 "Open VSX注册表的直接链接")
---------------------------------------------------------------------------------------------------------------------------------
[Open VSX注册表](https://open-vsx.org/)
是VS Code应用商店的开源替代方案,适用于因许可证限制无法访问官方商店的编辑器。
在VSCodium、Gitpod、Eclipse Theia、Windsurf等兼容编辑器中,可通过[Open VSX上的Kilo Code页面](https://open-vsx.org/extension/kilocode/Kilo-Code)
直接安装。
1. 打开编辑器
2. 进入扩展视图(侧边栏图标或快捷键 `Ctrl+Shift-X` / `Cmd+Shift-X`)
3. 编辑器应已预配置Open VSX注册表
4. 搜索 "Kilo Code"
5. 选择扩展并点击**安装**
6. 根据提示重新加载编辑器
备注
若编辑器未自动配置Open VSX,需在设置中手动配置扩展市场。具体操作请参考编辑器文档。
手动安装VSIX文件[](https://kilocode.ai/docs/zh-CN/getting-started/installing#%E6%89%8B%E5%8A%A8%E5%AE%89%E8%A3%85vsix%E6%96%87%E4%BB%B6 "手动安装VSIX文件的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------------------
若需手动下载安装:
1. **下载VSIX文件:**
* 在[Kilo Code GitHub Releases页面](https://github.com/Kilo-Org/kilocode/releases)
查找正式版本
* 从[最新版本](https://github.com/Kilo-Org/kilocode/releases/latest)
下载`.vsix`文件
2. **在VS Code中安装:**
* 打开VS Code
* 进入扩展视图
* 点击扩展视图右上角的"..."菜单
* 选择"从VSIX安装..."
* 选择已下载的`.vsix`文件

_通过VS Code的"从VSIX安装"对话框进行安装_
故障排除[](https://kilocode.ai/docs/zh-CN/getting-started/installing#%E6%95%85%E9%9A%9C%E6%8E%92%E9%99%A4 "故障排除的直接链接")
--------------------------------------------------------------------------------------------------------------------
**扩展不可见**
* 重启VS Code
* 检查扩展列表确认Kilo Code已启用
* 尝试禁用后重新启用扩展
* 在输出面板查看错误日志(查看 → 输出,选择"Kilo Code")
**安装问题**
* 确保网络连接稳定
* 确认VS Code版本≥1.84.0
* 若无法访问VS Code应用商店,尝试Open VSX方式
获取支持[](https://kilocode.ai/docs/zh-CN/getting-started/installing#%E8%8E%B7%E5%8F%96%E6%94%AF%E6%8C%81 "获取支持的直接链接")
--------------------------------------------------------------------------------------------------------------------
若遇到其他问题:
* 加入[Discord社区](https://kilocode.ai/discord)
获取实时支持
* 在[GitHub](https://github.com/Kilo-Org/kilocode/issues)
提交问题报告
* 访问[Reddit社区](https://www.reddit.com/r/KiloCode)
* [VS Code应用商店](https://kilocode.ai/docs/zh-CN/getting-started/installing#vs-code%E5%BA%94%E7%94%A8%E5%95%86%E5%BA%97)
* [Cursor应用商店](https://kilocode.ai/docs/zh-CN/getting-started/installing#cursor%E5%BA%94%E7%94%A8%E5%95%86%E5%BA%97)
* [Open VSX注册表](https://kilocode.ai/docs/zh-CN/getting-started/installing#open-vsx%E6%B3%A8%E5%86%8C%E8%A1%A8)
* [手动安装VSIX文件](https://kilocode.ai/docs/zh-CN/getting-started/installing#%E6%89%8B%E5%8A%A8%E5%AE%89%E8%A3%85vsix%E6%96%87%E4%BB%B6)
* [故障排除](https://kilocode.ai/docs/zh-CN/getting-started/installing#%E6%95%85%E9%9A%9C%E6%8E%92%E9%99%A4)
* [获取支持](https://kilocode.ai/docs/zh-CN/getting-started/installing#%E8%8E%B7%E5%8F%96%E6%94%AF%E6%8C%81)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fgetting-started%2Finstalling)
---
# 开始你的第一个Kilo Code任务 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/getting-started/your-first-task#__docusaurus_skipToContent_fallback)
本页总览
完成[初始设置](https://kilocode.ai/docs/zh-CN/getting-started/setting-up)
后,即可开始使用Kilo Code!本指南将引导你完成第一次交互。
第一步:打开Kilo Code面板[](https://kilocode.ai/docs/zh-CN/getting-started/your-first-task#%E7%AC%AC%E4%B8%80%E6%AD%A5%E6%89%93%E5%BC%80kilo-code%E9%9D%A2%E6%9D%BF "第一步:打开Kilo Code面板的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
点击VS Code主侧边栏(窗口侧边的垂直栏)中的Kilo Code图标()打开聊天界面。如果看不到图标,请确认扩展已[安装](https://kilocode.ai/docs/zh-CN/getting-started/installing)
并启用。

_主侧边栏中的Kilo Code图标可打开聊天界面_
第二步:输入你的任务[](https://kilocode.ai/docs/zh-CN/getting-started/your-first-task#%E7%AC%AC%E4%BA%8C%E6%AD%A5%E8%BE%93%E5%85%A5%E4%BD%A0%E7%9A%84%E4%BB%BB%E5%8A%A1 "第二步:输入你的任务的直接链接")
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
在面板底部的聊天框中,清晰简洁地描述你希望Kilo Code完成的操作。有效任务的示例:
* "创建名为`hello.txt`的文件,内容为'Hello, world!'"
* "编写一个两数相加的Python函数"
* "创建一个标题为'Kilo测试'的简单网站HTML文件"
无需特殊命令或语法——使用普通英语即可。

_用自然语言输入任务 - 无需特殊语法_
第三步:发送任务[](https://kilocode.ai/docs/zh-CN/getting-started/your-first-task#%E7%AC%AC%E4%B8%89%E6%AD%A5%E5%8F%91%E9%80%81%E4%BB%BB%E5%8A%A1 "第三步:发送任务的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------------------------
按Enter键或点击输入框右侧的发送图标()。
第四步:审核并批准操作[](https://kilocode.ai/docs/zh-CN/getting-started/your-first-task#%E7%AC%AC%E5%9B%9B%E6%AD%A5%E5%AE%A1%E6%A0%B8%E5%B9%B6%E6%89%B9%E5%87%86%E6%93%8D%E4%BD%9C "第四步:审核并批准操作的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Kilo Code分析你的请求后会提出具体操作建议,可能包括:
* **读取文件**:显示需要访问的文件内容
* **写入文件**:展示变更差异(绿色为新增行,红色为删除行)
* **执行命令**:显示将在终端运行的精确命令
* **使用浏览器**:概述浏览器操作(点击、输入等)
* **提问澄清**:需要时请求更多信息以继续

_Kilo Code明确显示将要执行的操作并等待你的批准_
* 在**Code**模式下,默认启用许多代码编写功能
* 在**Architect**和**Ask**模式下,代理不会编写任何代码
提示
自主程度可配置,你可以让代理更自主或更受限。
了解更多关于[使用模式](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes)
和[自动批准操作](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions)
。
第五步:迭代操作[](https://kilocode.ai/docs/zh-CN/getting-started/your-first-task#%E7%AC%AC%E4%BA%94%E6%AD%A5%E8%BF%AD%E4%BB%A3%E6%93%8D%E4%BD%9C "第五步:迭代操作的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------------------------
Kilo Code以迭代方式工作。每个操作后都会等待你的反馈,然后再提出下一步建议。持续这个"审核-批准"循环直到任务完成。

_任务完成后,Kilo Code显示最终结果并等待下一条指令_
总结[](https://kilocode.ai/docs/zh-CN/getting-started/your-first-task#%E6%80%BB%E7%BB%93 "总结的直接链接")
---------------------------------------------------------------------------------------------------
你已完成第一个Kilo Code任务!通过这个过程,你已了解:
* 如何使用自然语言与Kilo Code交互
* 让你保持控制的基于批准的工作流
* Kilo Code用于逐步解决问题的迭代方法
这种迭代的、基于批准的工作流是Kilo Code的核心——让AI处理编码的繁琐部分,同时你保持完全监督。现在你已掌握基础知识,可以尝试更复杂的任务,探索不同的[模式](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes)
进行专门的工作流,或试用[自动批准功能](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions)
来加速重复性任务。
* [第一步:打开Kilo Code面板](https://kilocode.ai/docs/zh-CN/getting-started/your-first-task#%E7%AC%AC%E4%B8%80%E6%AD%A5%E6%89%93%E5%BC%80kilo-code%E9%9D%A2%E6%9D%BF)
* [第二步:输入你的任务](https://kilocode.ai/docs/zh-CN/getting-started/your-first-task#%E7%AC%AC%E4%BA%8C%E6%AD%A5%E8%BE%93%E5%85%A5%E4%BD%A0%E7%9A%84%E4%BB%BB%E5%8A%A1)
* [第三步:发送任务](https://kilocode.ai/docs/zh-CN/getting-started/your-first-task#%E7%AC%AC%E4%B8%89%E6%AD%A5%E5%8F%91%E9%80%81%E4%BB%BB%E5%8A%A1)
* [第四步:审核并批准操作](https://kilocode.ai/docs/zh-CN/getting-started/your-first-task#%E7%AC%AC%E5%9B%9B%E6%AD%A5%E5%AE%A1%E6%A0%B8%E5%B9%B6%E6%89%B9%E5%87%86%E6%93%8D%E4%BD%9C)
* [第五步:迭代操作](https://kilocode.ai/docs/zh-CN/getting-started/your-first-task#%E7%AC%AC%E4%BA%94%E6%AD%A5%E8%BF%AD%E4%BB%A3%E6%93%8D%E4%BD%9C)
* [总结](https://kilocode.ai/docs/zh-CN/getting-started/your-first-task#%E6%80%BB%E7%BB%93)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fgetting-started%2Fyour-first-task)
---
# 终端 Shell 集成 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/shell-integration#__docusaurus_skipToContent_fallback)
本页总览
终端 Shell 集成是 Kilo Code 的核心功能,使其能够在您的终端执行命令并智能处理输出。这种 AI 与开发环境的双向通信解锁了强大的自动化能力。
Shell 集成是什么?[](https://kilocode.ai/docs/zh-CN/features/shell-integration#shell-%E9%9B%86%E6%88%90%E6%98%AF%E4%BB%80%E4%B9%88 "Shell 集成是什么?的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------------
Shell 集成在 Kilo Code 中自动启用,无需任何设置即可直接连接至终端命令执行生命周期。该内置功能允许 Kilo Code:
* 通过 [`execute_command`](https://kilocode.ai/docs/zh-CN/features/tools/execute-command)
工具代您执行命令
* 实时读取命令输出,无需手动复制粘贴
* 自动检测并修复运行中的应用程序错误
* 通过退出代码判断命令执行成败
* 跟踪工作目录变化
* 智能响应终端输出而无需用户干预
当 Kilo Code 需要执行安装依赖、启动开发服务器或分析构建错误等任务时,Shell 集成会在后台确保交互流程顺畅高效。
开始使用 Shell 集成[](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E5%BC%80%E5%A7%8B%E4%BD%BF%E7%94%A8-shell-%E9%9B%86%E6%88%90 "开始使用 Shell 集成的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Shell 集成已内置在 Kilo Code 中,多数情况下自动工作。若出现"Shell 集成不可用"提示或命令执行问题,可尝试以下解决方案:
1. **更新 VSCode/Cursor** 至最新版本(要求 VSCode 1.93+)
2. **选择兼容的 Shell**:命令面板(`Ctrl+Shift+P` 或 `Cmd+Shift+P`)→ "Terminal: Select Default Profile" → 选择 bash、zsh、PowerShell 或 fish
3. **Windows PowerShell 用户**:运行 `Set-ExecutionPolicy RemoteSigned -Scope CurrentUser` 后重启 VSCode
4. **WSL 用户**:在 `~/.bashrc` 中添加 `. "$(code --locate-shell-integration-path bash)"`
终端集成设置[](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E7%BB%88%E7%AB%AF%E9%9B%86%E6%88%90%E8%AE%BE%E7%BD%AE "终端集成设置的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------
Kilo Code 提供多项设置来微调 Shell 集成。通过 Kilo Code 侧边栏的 Settings → Terminal 访问这些设置。
### 基础设置[](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E5%9F%BA%E7%A1%80%E8%AE%BE%E7%BD%AE "基础设置的直接链接")
#### 终端输出限制[](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E7%BB%88%E7%AB%AF%E8%BE%93%E5%87%BA%E9%99%90%E5%88%B6 "终端输出限制的直接链接")

控制从终端捕获的最大行数。超出限制时,保留开头20%和结尾80%的内容,中间显示截断提示。在保持上下文的同时避免过度消耗 token。默认值: 500 行。 控制从终端捕获的最大行数。超出限制时,系统会从内容中间删除部分行以节省 token。默认值:500 行。
#### Shell 集成超时[](https://kilocode.ai/docs/zh-CN/features/shell-integration#shell-%E9%9B%86%E6%88%90%E8%B6%85%E6%97%B6 "Shell 集成超时的直接链接")

等待 Shell 集成初始化的最长时间。若遇到"Shell 集成不可用"错误可增加此值。默认:15秒。
#### 终端命令延迟[](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E7%BB%88%E7%AB%AF%E5%91%BD%E4%BB%A4%E5%BB%B6%E8%BF%9F "终端命令延迟的直接链接")

在命令执行后添加短暂停顿,确保 Kilo Code 正确捕获所有输出。此设置对不同操作系统和 Shell 配置的可靠性影响显著:
* **默认值**:0毫秒
* **常用值**:
* 0毫秒:新版 VSCode 用户最佳选择
* 50毫秒:历史默认值,对多数用户仍有效
* 150毫秒:PowerShell 用户推荐值
* **注意**:最佳值可能取决于:
* VSCode 版本
* Shell 定制程度(如 oh-my-zsh、powerlevel10k 等)
* 操作系统和环境
### 高级设置[](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E9%AB%98%E7%BA%A7%E8%AE%BE%E7%BD%AE "高级设置的直接链接")
重要提示
**修改后需重启终端**
高级终端设置的变更仅在重启终端后生效。重启步骤:
1. 点击终端面板的垃圾桶图标关闭当前终端
2. 通过 Terminal → New Terminal 或 Ctrl+\` 新建终端
修改任何设置后请务必重启所有打开的终端。
#### PowerShell 计数器解决方案[](https://kilocode.ai/docs/zh-CN/features/shell-integration#powershell-%E8%AE%A1%E6%95%B0%E5%99%A8%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88 "PowerShell 计数器解决方案的直接链接")

解决 PowerShell 连续执行相同命令的问题。若发现 Kilo Code 无法在 PowerShell 中连续运行相同命令,请启用此选项。
#### 清除 ZSH EOL 标记[](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E6%B8%85%E9%99%A4-zsh-eol-%E6%A0%87%E8%AE%B0 "清除 ZSH EOL 标记的直接链接")

阻止 ZSH 在输出行尾添加可能干扰 Kilo Code 读取结果的特殊字符。
#### Oh My Zsh 集成[](https://kilocode.ai/docs/zh-CN/features/shell-integration#oh-my-zsh-%E9%9B%86%E6%88%90 "Oh My Zsh 集成的直接链接")

优化与流行 Shell 框架 [Oh My Zsh](https://ohmyz.sh/)
的兼容性。使用 Oh My Zsh 时若遇到终端问题请开启。
#### Powerlevel10k 集成[](https://kilocode.ai/docs/zh-CN/features/shell-integration#powerlevel10k-%E9%9B%86%E6%88%90 "Powerlevel10k 集成的直接链接")

提升与 ZSH 主题 Powerlevel10k 的兼容性。若花哨的终端提示符导致问题请启用。
#### ZDOTDIR 处理[](https://kilocode.ai/docs/zh-CN/features/shell-integration#zdotdir-%E5%A4%84%E7%90%86 "ZDOTDIR 处理的直接链接")

使 Kilo Code 能兼容自定义 ZSH 配置,同时不影响您的个人 Shell 设置。
故障排除[](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E6%95%85%E9%9A%9C%E6%8E%92%E9%99%A4 "故障排除的直接链接")
--------------------------------------------------------------------------------------------------------------------
### PowerShell 执行策略(Windows)[](https://kilocode.ai/docs/zh-CN/features/shell-integration#powershell-%E6%89%A7%E8%A1%8C%E7%AD%96%E7%95%A5windows "PowerShell 执行策略(Windows)的直接链接")
PowerShell 默认限制脚本执行。配置方法:
1. 以管理员身份打开 PowerShell
2. 查看当前策略:`Get-ExecutionPolicy`
3. 设置合适策略:`Set-ExecutionPolicy RemoteSigned -Scope CurrentUser`
常用策略:
* `Restricted`:禁止所有脚本(默认)
* `RemoteSigned`:本地脚本可运行,下载脚本需签名
* `Unrestricted`:所有脚本带警告运行
* `AllSigned`:所有脚本必须签名
### 手动安装 Shell 集成[](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E6%89%8B%E5%8A%A8%E5%AE%89%E8%A3%85-shell-%E9%9B%86%E6%88%90 "手动安装 Shell 集成的直接链接")
若自动集成失败,请将对应代码添加到 Shell 配置中:
**Bash**(`~/.bashrc`):
[[ "$TERM_PROGRAM" == "vscode" ]] && . "$(code --locate-shell-integration-path bash)"
**Zsh**(`~/.zshrc`):
[[ "$TERM_PROGRAM" == "vscode" ]] && . "$(code --locate-shell-integration-path zsh)"
**PowerShell**(`$Profile`):
if ($env:TERM_PROGRAM -eq "vscode") { . "$(code --locate-shell-integration-path pwsh)" }
**Fish**(`~/.config/fish/config.fish`):
string match -q "$TERM_PROGRAM" "vscode"; and . (code --locate-shell-integration-path fish)
终端定制问题[](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E7%BB%88%E7%AB%AF%E5%AE%9A%E5%88%B6%E9%97%AE%E9%A2%98 "终端定制问题的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------
若使用终端定制工具:
**Powerlevel10k**:
# 在 ~/.zshrc 中 sourcing powerlevel10k 之前添加typeset -g POWERLEVEL9K_TERM_SHELL_INTEGRATION=true
**替代方案**:在 Kilo Code 设置中启用 Powerlevel10k 集成选项
Shell 集成状态验证[](https://kilocode.ai/docs/zh-CN/features/shell-integration#shell-%E9%9B%86%E6%88%90%E7%8A%B6%E6%80%81%E9%AA%8C%E8%AF%81 "Shell 集成状态验证的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------------------------
使用以下命令确认集成是否激活:
**Bash**:
set | grep -i '[16]33;'echo "$PROMPT_COMMAND" | grep vsctrap -p DEBUG | grep vsc
**Zsh**:
functions | grep -i vsctypeset -p precmd_functions preexec_functions
**PowerShell**:
Get-Command -Name "*VSC*" -CommandType FunctionGet-Content Function:\Prompt | Select-String "VSCode"
**Fish**:
functions | grep -i vscfunctions fish_prompt | grep -i vsc
集成激活的视觉指示:
1. 终端标题栏中的集成标识
2. 命令检测高亮显示
3. 终端标题中的工作目录更新
4. 命令执行时间和退出码显示
WSL 终端集成方案[](https://kilocode.ai/docs/zh-CN/features/shell-integration#wsl-%E7%BB%88%E7%AB%AF%E9%9B%86%E6%88%90%E6%96%B9%E6%A1%88 "WSL 终端集成方案的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------------------
使用 Windows Subsystem for Linux (WSL) 时,有两种集成方式:
### 方案1:Windows版VSCode + WSL终端[](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E6%96%B9%E6%A1%881windows%E7%89%88vscode--wsl%E7%BB%88%E7%AB%AF "方案1:Windows版VSCode + WSL终端的直接链接")
特点:
* VSCode 运行于 Windows
* 使用 WSL 终端桥接
* 需手动确保 WSL 环境中加载了集成脚本:
source "$(code --locate-shell-integration-path )"
### 方法二:在WSL中运行VSCode[](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E6%96%B9%E6%B3%95%E4%BA%8C%E5%9C%A8wsl%E4%B8%AD%E8%BF%90%E8%A1%8Cvscode "方法二:在WSL中运行VSCode的直接链接")
在此设置中:
* 你可以使用 `code .` 命令直接从WSL中启动VSCode
* VSCode服务端在Linux环境中本地运行
* 可直接访问Linux文件系统和工具
* 为Shell集成提供更好的性能和可靠性
* 由于VSCode在Linux环境中本地运行,Shell集成会自动加载
* 这是WSL开发的推荐方式
要实现WSL的最佳Shell集成,我们建议:
1. 打开你的WSL发行版
2. 导航到项目目录
3. 使用 `code .` 启动VSCode
4. 使用VSCode内的集成终端
常见问题解决方案[](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88 "常见问题解决方案的直接链接")
----------------------------------------------------------------------------------------------------------------------------------------------------------------
### Windows 上 Fish + Cygwin 的 VS Code Shell 集成[](https://kilocode.ai/docs/zh-CN/features/shell-integration#windows-%E4%B8%8A-fish--cygwin-%E7%9A%84-vs-code-shell-%E9%9B%86%E6%88%90 "Windows 上 Fish + Cygwin 的 VS Code Shell 集成的直接链接")
对于在 Cygwin 环境中运行 Fish 终端的 Windows 用户,以下是配置 VS Code Shell 集成的方法:
1. **(可选)定位 Shell 集成脚本**
在 **VS Code 内**打开 Fish 终端并执行:
code --locate-shell-integration-path fish
该命令会输出 `shellIntegration.fish` 脚本的路径,请记录此路径。
2. **更新 Fish 配置**
编辑 `config.fish` 文件(通常位于 Cygwin 主目录下的 `~/.config/fish/config.fish`)。添加以下行,建议放在 `if status is-interactive` 块内或文件末尾:
# 示例 config.fish 结构if status is-interactive # 其他交互式 shell 配置... # 自动定位集成脚本: string match -q "$TERM_PROGRAM" "vscode"; and . (code --locate-shell-integration-path fish) # 若上述方法失败: # 手动引入 VS Code shell 集成脚本 # 重要:将下方示例路径替换为步骤 1 中获取的实际路径 # 确保路径格式符合 Cygwin 规范(例如 /cygdrive/c/...) # source "/cygdrive/c/Users/你的用户名/.vscode/extensions/..../shellIntegration.fish"end
_请将示例路径替换为步骤 1 中的实际路径,并确保格式符合 Cygwin 要求。_
3. **配置 VS Code 终端配置文件**
打开 VS Code 的 `settings.json` 文件(Ctrl+Shift+P → "Preferences: Open User Settings (JSON)")。在 `terminal.integrated.profiles.windows` 下更新或添加 Fish 配置文件:
{ // ... 其他设置 ... "terminal.integrated.profiles.windows": { // ... 其他配置文件 ... // 推荐:使用 bash.exe 以登录 shell 方式启动 fish "fish": { "path": "C:\\cygwin64\\bin\\bash.exe", // 或你的 Cygwin bash 路径 "args": [ "--login", // 确保执行登录脚本(对 Cygwin 环境很重要) "-i", // 确保 bash 以交互模式运行 "-c", "exec fish" // 用 fish 替换 bash 进程 ], "icon": "terminal-bash" // 可选:使用可识别的图标 }, // 备选方案(若上述方法失败):直接启动 fish "fish-direct": { "path": "C:\\cygwin64\\bin\\fish.exe", // 确保此路径在 Windows PATH 中或提供完整路径 // 此处使用 'options' 而非 'args',否则可能遇到 "终端进程终止,退出代码 1" 错误 "options": ["-l", "-c"], // 示例:登录和交互标志 "icon": "terminal-fish" // 可选:使用 fish 图标 } }, // 可选:如需将 fish 设置为默认终端 // "terminal.integrated.defaultProfile.windows": "fish", // 或 "fish-direct",取决于你使用的配置 // ... 其他设置 ...}
_注意:在 Cygwin 环境中,使用 `bash.exe --login -i -c "exec fish"` 通常能更可靠地确保在启动 `fish` 前正确设置环境。但若此方法无效,请尝试 `fish-direct` 配置文件。_
4. **重启 VS Code**
完全关闭并重新打开 Visual Studio Code 以应用更改。
5. **验证配置**
在 VS Code 中打开新的 Fish 终端。Shell 集成功能(如命令装饰、更便捷的命令历史导航等)应已激活。你可以通过运行简单命令(如 `echo "Hello from integrated Fish!"`)测试基本功能。

此配置在使用 Cygwin、Fish 和 Starship 提示符的 Windows 系统上运行稳定,适用于类似环境的用户。
### VSCode 1.98 之后 Shell 集成失败问题[](https://kilocode.ai/docs/zh-CN/features/shell-integration#vscode-198-%E4%B9%8B%E5%90%8E-shell-%E9%9B%86%E6%88%90%E5%A4%B1%E8%B4%A5%E9%97%AE%E9%A2%98 "VSCode 1.98 之后 Shell 集成失败问题的直接链接")
**问题描述**:在将 VSCode 更新到 1.98 版本之后,Shell 集成功能可能会失效,并显示错误信息 "VSCE output start escape sequence (\]633;C or \]133;C) not received"。
**解决方案**:
1. **设置终端命令延迟**
* 在 Kilo Code 设置中将终端命令延迟(Terminal Command Delay)设为 50ms
* 修改设置后重启所有终端
* 该设置模拟了旧版本的默认行为,可能会解决问题。不过部分用户反馈设为 0ms 效果更好。这是针对 VSCode 上游问题的临时解决方案
2. **回退 VSCode 版本**
* 从 [VSCode 更新页面](https://code.visualstudio.com/updates/v1_98)
下载 VSCode v1.98 版本
* 替换当前的 VSCode 安装
* 无需备份 Kilo 设置
3. **WSL 专用解决方案**
* 如果使用 WSL,请确保通过 `code .` 命令从 WSL 内部启动 VSCode
4. **ZSH 用户**
* 尝试在 Kilo Code 设置中启用部分或全部与 ZSH 相关的解决方案
* 无论使用何种操作系统,这些设置都可能有所帮助
已知问题与解决方法[](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E5%B7%B2%E7%9F%A5%E9%97%AE%E9%A2%98%E4%B8%8E%E8%A7%A3%E5%86%B3%E6%96%B9%E6%B3%95 "已知问题与解决方法的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
### Ctrl+C 行为问题[](https://kilocode.ai/docs/zh-CN/features/shell-integration#ctrlc-%E8%A1%8C%E4%B8%BA%E9%97%AE%E9%A2%98 "Ctrl+C 行为问题的直接链接")
**问题描述**:当 Kilo Code 尝试在终端中执行命令时,如果终端中已有输入的文本,Kilo Code 会先按下 Ctrl+C 清除当前行,这可能会中断正在运行的进程。
**解决方法**:在让 Kilo Code 执行终端命令之前,确保终端提示符为空(没有输入任何部分命令)。
### 多行命令问题[](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E5%A4%9A%E8%A1%8C%E5%91%BD%E4%BB%A4%E9%97%AE%E9%A2%98 "多行命令问题的直接链接")
**问题描述**:跨越多行的命令可能会让 Kilo Code 产生混淆,导致当前命令的输出中混入之前命令的输出。
**解决方法**:避免使用多行命令,而是使用 `&&` 进行命令链,将所有操作放在同一行(例如,使用 `echo a && echo b` 代替分行输入每个命令)。
### PowerShell 特定问题[](https://kilocode.ai/docs/zh-CN/features/shell-integration#powershell-%E7%89%B9%E5%AE%9A%E9%97%AE%E9%A2%98 "PowerShell 特定问题的直接链接")
1. **过早完成**:PowerShell 有时会在命令输出全部显示之前就告诉 Kilo Code 命令已完成。
2. **重复命令拒绝执行**:PowerShell 可能会拒绝连续两次执行相同的命令。
**解决方法**:启用 "PowerShell counter workaround" 设置,并在设置中将终端命令延迟(Terminal Command Delay)设为 150ms,以给命令更多的执行时间。
### 终端输出不完整[](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E7%BB%88%E7%AB%AF%E8%BE%93%E5%87%BA%E4%B8%8D%E5%AE%8C%E6%95%B4 "终端输出不完整的直接链接")
**问题描述**:有时 VS Code 不会显示或捕获命令的全部输出。
**解决方法**:如果发现输出缺失,尝试关闭并重新打开终端标签,然后再次运行命令。这会刷新终端连接。
故障排除资源[](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E6%95%85%E9%9A%9C%E6%8E%92%E9%99%A4%E8%B5%84%E6%BA%90 "故障排除资源的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------
### 查看调试日志[](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E6%9F%A5%E7%9C%8B%E8%B0%83%E8%AF%95%E6%97%A5%E5%BF%97 "查看调试日志的直接链接")
当发生 shell 集成问题时,检查调试日志:
1. 打开 "帮助" → "切换开发者工具" → "控制台"
2. 设置 "显示所有级别" 以查看所有日志消息
3. 查找包含 `[Terminal Process]` 的消息
4. 检查错误消息中的 `preOutput` 内容:
* 空的 preOutput (`''`) 表示 VSCode 没有发送任何数据
* 这可能表示存在 VSCode shell 集成问题,或无法控制的上游错误
* 缺少 shell 集成标记可能需要调整设置,以解决可能的上游错误或与 shell 初始化和 VSCode 加载特殊 shell 集成钩子相关的本地工作站配置问题
### 使用 VSCode 终端集成测试扩展[](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E4%BD%BF%E7%94%A8-vscode-%E7%BB%88%E7%AB%AF%E9%9B%86%E6%88%90%E6%B5%8B%E8%AF%95%E6%89%A9%E5%B1%95 "使用 VSCode 终端集成测试扩展的直接链接")
[VSCode 终端集成测试扩展](https://github.com/KJ7LNW/vsce-test-terminal-integration)
可以通过测试不同的设置组合来帮助诊断 shell 集成问题:
1. **命令停滞时**:
* 如果你看到 "command already running" 警告,点击 "Reset Stats" 重置终端状态
* 这些警告表明 shell 集成未正常工作
* 尝试不同的设置组合,直到找到有效的配置
* 如果终端确实卡住了,通过关闭窗口并按 F5 重启扩展
2. **测试设置**:
* 系统地尝试不同的组合:
* 终端命令延迟(Terminal Command Delay)
* Shell 集成设置
* 记录哪些组合成功或失败
* 这有助于识别 shell 集成问题的模式
3. **报告问题**:
* 一旦发现有问题的配置
* 记录确切的设置组合
* 记录你的环境信息(操作系统、VSCode 版本、shell 类型以及任何 shell 提示符自定义设置)
* 使用这些详细信息创建一个问题,以帮助改进 shell 集成
支持[](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E6%94%AF%E6%8C%81 "支持的直接链接")
----------------------------------------------------------------------------------------------
如果你已按照上述步骤操作但仍然遇到问题,请:
1. 查看 [Kilo Code GitHub 问题](https://github.com/Kilo-Org/kilocode/issues)
,看是否有其他用户报告过类似问题
2. 如果没有,请创建一个新问题,详细说明你的操作系统、VSCode/Cursor 版本以及你尝试过的步骤
如需更多帮助,请加入我们的 [Discord](https://kilocode.ai/discord)
。
* [Shell 集成是什么?](https://kilocode.ai/docs/zh-CN/features/shell-integration#shell-%E9%9B%86%E6%88%90%E6%98%AF%E4%BB%80%E4%B9%88)
* [开始使用 Shell 集成](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E5%BC%80%E5%A7%8B%E4%BD%BF%E7%94%A8-shell-%E9%9B%86%E6%88%90)
* [终端集成设置](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E7%BB%88%E7%AB%AF%E9%9B%86%E6%88%90%E8%AE%BE%E7%BD%AE)
* [基础设置](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E5%9F%BA%E7%A1%80%E8%AE%BE%E7%BD%AE)
* [高级设置](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E9%AB%98%E7%BA%A7%E8%AE%BE%E7%BD%AE)
* [故障排除](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E6%95%85%E9%9A%9C%E6%8E%92%E9%99%A4)
* [PowerShell 执行策略(Windows)](https://kilocode.ai/docs/zh-CN/features/shell-integration#powershell-%E6%89%A7%E8%A1%8C%E7%AD%96%E7%95%A5windows)
* [手动安装 Shell 集成](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E6%89%8B%E5%8A%A8%E5%AE%89%E8%A3%85-shell-%E9%9B%86%E6%88%90)
* [终端定制问题](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E7%BB%88%E7%AB%AF%E5%AE%9A%E5%88%B6%E9%97%AE%E9%A2%98)
* [Shell 集成状态验证](https://kilocode.ai/docs/zh-CN/features/shell-integration#shell-%E9%9B%86%E6%88%90%E7%8A%B6%E6%80%81%E9%AA%8C%E8%AF%81)
* [WSL 终端集成方案](https://kilocode.ai/docs/zh-CN/features/shell-integration#wsl-%E7%BB%88%E7%AB%AF%E9%9B%86%E6%88%90%E6%96%B9%E6%A1%88)
* [方案1:Windows版VSCode + WSL终端](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E6%96%B9%E6%A1%881windows%E7%89%88vscode--wsl%E7%BB%88%E7%AB%AF)
* [方法二:在WSL中运行VSCode](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E6%96%B9%E6%B3%95%E4%BA%8C%E5%9C%A8wsl%E4%B8%AD%E8%BF%90%E8%A1%8Cvscode)
* [常见问题解决方案](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88)
* [Windows 上 Fish + Cygwin 的 VS Code Shell 集成](https://kilocode.ai/docs/zh-CN/features/shell-integration#windows-%E4%B8%8A-fish--cygwin-%E7%9A%84-vs-code-shell-%E9%9B%86%E6%88%90)
* [VSCode 1.98 之后 Shell 集成失败问题](https://kilocode.ai/docs/zh-CN/features/shell-integration#vscode-198-%E4%B9%8B%E5%90%8E-shell-%E9%9B%86%E6%88%90%E5%A4%B1%E8%B4%A5%E9%97%AE%E9%A2%98)
* [已知问题与解决方法](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E5%B7%B2%E7%9F%A5%E9%97%AE%E9%A2%98%E4%B8%8E%E8%A7%A3%E5%86%B3%E6%96%B9%E6%B3%95)
* [Ctrl+C 行为问题](https://kilocode.ai/docs/zh-CN/features/shell-integration#ctrlc-%E8%A1%8C%E4%B8%BA%E9%97%AE%E9%A2%98)
* [多行命令问题](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E5%A4%9A%E8%A1%8C%E5%91%BD%E4%BB%A4%E9%97%AE%E9%A2%98)
* [PowerShell 特定问题](https://kilocode.ai/docs/zh-CN/features/shell-integration#powershell-%E7%89%B9%E5%AE%9A%E9%97%AE%E9%A2%98)
* [终端输出不完整](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E7%BB%88%E7%AB%AF%E8%BE%93%E5%87%BA%E4%B8%8D%E5%AE%8C%E6%95%B4)
* [故障排除资源](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E6%95%85%E9%9A%9C%E6%8E%92%E9%99%A4%E8%B5%84%E6%BA%90)
* [查看调试日志](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E6%9F%A5%E7%9C%8B%E8%B0%83%E8%AF%95%E6%97%A5%E5%BF%97)
* [使用 VSCode 终端集成测试扩展](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E4%BD%BF%E7%94%A8-vscode-%E7%BB%88%E7%AB%AF%E9%9B%86%E6%88%90%E6%B5%8B%E8%AF%95%E6%89%A9%E5%B1%95)
* [支持](https://kilocode.ai/docs/zh-CN/features/shell-integration#%E6%94%AF%E6%8C%81)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Fshell-integration)
---
# 在Kilo Code中使用MCP | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#__docusaurus_skipToContent_fallback)
本页总览
模型上下文协议(MCP)通过连接外部工具和服务扩展了Kilo Code的功能。本指南涵盖了在Kilo Code中使用MCP所需了解的所有内容。
演示Kilo Code中的MCP安装
配置MCP服务器[](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E9%85%8D%E7%BD%AEmcp%E6%9C%8D%E5%8A%A1%E5%99%A8 "配置MCP服务器的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------------------
MCP服务器配置可以在两个级别进行管理:
1. **全局配置**:存储在`mcp_settings.json`文件中,可通过VS Code设置访问(见下文)。这些设置适用于所有工作区,除非被项目级配置覆盖。
2. **项目级配置**:在项目根目录的`.kilocode/mcp.json`文件中定义。这允许你设置项目特定的服务器,并通过将文件提交到版本控制与团队共享配置。如果存在,Kilo Code会自动检测并加载此文件。
**优先级**:如果服务器名称同时存在于全局和项目配置中,则**项目级配置优先**。
### 编辑MCP设置文件[](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E7%BC%96%E8%BE%91mcp%E8%AE%BE%E7%BD%AE%E6%96%87%E4%BB%B6 "编辑MCP设置文件的直接链接")
你可以直接从Kilo Code MCP设置视图编辑全局和项目级MCP配置文件:
1. 点击Kilo Code窗格顶部导航中的图标。

2. 滚动到MCP设置视图的底部。
3. 点击适当的按钮:
* **`编辑全局MCP`**:打开全局`mcp_settings.json`文件。
* **`编辑项目MCP`**:打开项目特定的`.kilocode/mcp.json`文件。如果该文件不存在,Kilo Code将为你创建。

两个文件都使用JSON格式,其中包含一个`mcpServers`对象,包含命名的服务器配置:
{ "mcpServers": { "server1": { "command": "python", "args": ["/path/to/server.py"], "env": { "API_KEY": "your_api_key" }, "alwaysAllow": ["tool1", "tool2"], "disabled": false } }}
_Kilo Code中的MCP服务器配置示例(STDIO传输)_
### 理解传输类型[](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E7%90%86%E8%A7%A3%E4%BC%A0%E8%BE%93%E7%B1%BB%E5%9E%8B "理解传输类型的直接链接")
MCP支持两种服务器通信的传输类型:
#### STDIO传输[](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#stdio%E4%BC%A0%E8%BE%93 "STDIO传输的直接链接")
用于在本地机器上运行的服务器:
* 通过标准输入/输出流通信
* 延迟更低(无网络开销)
* 安全性更好(无网络暴露)
* 设置更简单(不需要HTTP服务器)
* 作为本地机器上的子进程运行
有关STDIO传输工作原理的深入信息,请参见[STDIO传输](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#stdio-transport)
。
STDIO配置示例:
{ "mcpServers": { "local-server": { "command": "node", "args": ["/path/to/server.js"], "env": { "API_KEY": "your_api_key" }, "alwaysAllow": ["tool1", "tool2"], "disabled": false } }}
#### SSE传输[](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#sse%E4%BC%A0%E8%BE%93 "SSE传输的直接链接")
用于通过HTTP/HTTPS访问的远程服务器:
* 通过服务器发送事件协议通信
* 可以托管在不同的机器上
* 支持多个客户端连接
* 需要网络访问
* 允许集中部署和管理
有关SSE传输工作原理的深入信息,请参见[SSE传输](https://kilocode.ai/docs/zh-CN/features/mcp/server-transports#sse-transport)
。
SSE配置示例:
{ "mcpServers": { "remote-server": { "url": "https://your-server-url.com/mcp", "headers": { "Authorization": "Bearer your-token" }, "alwaysAllow": ["tool3"], "disabled": false } }}
启用或禁用MCP服务器[](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E5%90%AF%E7%94%A8%E6%88%96%E7%A6%81%E7%94%A8mcp%E6%9C%8D%E5%8A%A1%E5%99%A8 "启用或禁用MCP服务器的直接链接")
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
在此处禁用MCP服务器将从系统提示中删除所有与MCP相关的逻辑和定义,减少token使用。这将阻止Kilo Code连接任何MCP服务器,并且`use_mcp_tool`和`access_mcp_resource`工具将不可用。如果你不打算使用MCP服务器,请取消勾选此选项。默认情况下为启用。
1. 点击Kilo Code窗格顶部导航中的图标
2. 勾选/取消勾选`启用MCP服务器`

启用或禁用MCP服务器创建[](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E5%90%AF%E7%94%A8%E6%88%96%E7%A6%81%E7%94%A8mcp%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%88%9B%E5%BB%BA "启用或禁用MCP服务器创建的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
在此处禁用MCP服务器创建将仅从系统提示中删除Kilo Code用于编写MCP服务器的指令,而不删除操作它们的上下文。这减少了token使用。默认情况下为启用。
1. 点击Kilo Code窗格顶部导航中的图标
2. 勾选/取消勾选`启用MCP服务器创建`

管理单个MCP服务器[](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E7%AE%A1%E7%90%86%E5%8D%95%E4%B8%AAmcp%E6%9C%8D%E5%8A%A1%E5%99%A8 "管理单个MCP服务器的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------

每个MCP服务器都有自己的配置面板,你可以在此修改设置、管理工具并控制其操作。要访问这些设置:
1. 点击Kilo Code窗格顶部导航中的图标
2. 在列表中定位要管理的MCP服务器 
### 删除服务器[](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E5%88%A0%E9%99%A4%E6%9C%8D%E5%8A%A1%E5%99%A8 "删除服务器的直接链接")
1. 点击要删除的MCP服务器旁边的
2. 在确认框中点击`删除`按钮

### 重启服务器[](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E9%87%8D%E5%90%AF%E6%9C%8D%E5%8A%A1%E5%99%A8 "重启服务器的直接链接")
1. 点击要重启的MCP服务器旁边的按钮
### 启用或禁用服务器[](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E5%90%AF%E7%94%A8%E6%88%96%E7%A6%81%E7%94%A8%E6%9C%8D%E5%8A%A1%E5%99%A8 "启用或禁用服务器的直接链接")
1. 点击MCP服务器旁边的切换开关以启用/禁用
### 网络超时[](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E7%BD%91%E7%BB%9C%E8%B6%85%E6%97%B6 "网络超时的直接链接")
设置调用MCP服务器工具后等待响应的最长时间:
1. 点击单个MCP服务器配置框底部的`网络超时`下拉菜单并更改时间。默认值为1分钟,但可以设置为30秒到5分钟之间。

### 自动批准工具[](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E8%87%AA%E5%8A%A8%E6%89%B9%E5%87%86%E5%B7%A5%E5%85%B7 "自动批准工具的直接链接")
MCP工具自动批准按工具进行,默认禁用。要配置自动批准:
1. 首先在[自动批准操作](https://kilocode.ai/docs/zh-CN/features/auto-approving-actions)
中启用全局"使用MCP服务器"自动批准选项
2. 在MCP服务器设置中,定位要自动批准的特定工具
3. 勾选工具名称旁边的`始终允许`复选框

启用后,Kilo Code将自动批准此特定工具而无需提示。请注意,全局"使用MCP服务器"设置优先 - 如果它被禁用,则不会自动批准任何MCP工具。
查找和安装MCP服务器[](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E6%9F%A5%E6%89%BE%E5%92%8C%E5%AE%89%E8%A3%85mcp%E6%9C%8D%E5%8A%A1%E5%99%A8 "查找和安装MCP服务器的直接链接")
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Kilo Code不附带任何预安装的MCP服务器。你需要单独查找并安装它们。
* **社区仓库**:在GitHub上查看社区维护的MCP服务器列表
* **询问Kilo Code**:你可以请Kilo Code帮助你查找甚至创建MCP服务器(当"[启用MCP服务器创建](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#enabling-or-disabling-mcp-server-creation)
"启用时)
* **自行构建**:使用SDK创建自定义MCP服务器,使用你自己的工具扩展Kilo Code
有关完整的SDK文档,请访问[MCP GitHub仓库](https://github.com/modelcontextprotocol/)
。
在工作流中使用MCP工具[](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E5%9C%A8%E5%B7%A5%E4%BD%9C%E6%B5%81%E4%B8%AD%E4%BD%BF%E7%94%A8mcp%E5%B7%A5%E5%85%B7 "在工作流中使用MCP工具的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
配置MCP服务器后,Kilo Code将自动检测可用的工具和资源。要使用它们:
1. 在Kilo Code聊天界面中输入你的请求
2. Kilo Code将识别何时MCP工具可以帮助完成任务
3. 在提示时批准工具使用(或使用自动批准)
示例:"分析我的API性能"可能会使用一个测试API端点的MCP工具。
故障排除MCP服务器[](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E6%95%85%E9%9A%9C%E6%8E%92%E9%99%A4mcp%E6%9C%8D%E5%8A%A1%E5%99%A8 "故障排除MCP服务器的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
常见问题及解决方案:
* **服务器无响应**:检查服务器进程是否正在运行并验证网络连接
* **权限错误**:确保在`mcp_settings.json`(用于全局设置)或`.kilocode/mcp.json`(用于项目设置)中配置了正确的API密钥和凭据。
* **工具不可用**:确认服务器是否正确实现了该工具且未在设置中禁用
* **性能缓慢**:尝试调整特定MCP服务器的网络超时值
平台特定的MCP配置示例[](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E5%B9%B3%E5%8F%B0%E7%89%B9%E5%AE%9A%E7%9A%84mcp%E9%85%8D%E7%BD%AE%E7%A4%BA%E4%BE%8B "平台特定的MCP配置示例的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
### Windows配置示例[](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#windows%E9%85%8D%E7%BD%AE%E7%A4%BA%E4%BE%8B "Windows配置示例的直接链接")
在Windows上设置MCP服务器时,你需要使用Windows命令提示符(`cmd`)来执行命令。以下是在Windows上配置Puppeteer MCP服务器的示例:
{ "mcpServers": { "puppeteer": { "command": "cmd", "args": [ "/c", "npx", "-y", "@modelcontextprotocol/server-puppeteer" ] } }}
此Windows特定配置:
* 使用`cmd`命令访问Windows命令提示符
* 使用`/c`告诉cmd执行命令然后终止
* 使用`npx`运行包而无需永久安装
* `-y`标志在安装期间自动回答"是"任何提示
* 运行提供浏览器自动化功能的`@modelcontextprotocol/server-puppeteer`包
备注
对于macOS或Linux,你将使用不同的配置:
{ "mcpServers": { "puppeteer": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-puppeteer" ] } }}
相同的方法可以用于Windows上的其他MCP服务器,根据需要调整包名称以匹配不同的服务器类型。
* [配置MCP服务器](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E9%85%8D%E7%BD%AEmcp%E6%9C%8D%E5%8A%A1%E5%99%A8)
* [编辑MCP设置文件](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E7%BC%96%E8%BE%91mcp%E8%AE%BE%E7%BD%AE%E6%96%87%E4%BB%B6)
* [理解传输类型](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E7%90%86%E8%A7%A3%E4%BC%A0%E8%BE%93%E7%B1%BB%E5%9E%8B)
* [启用或禁用MCP服务器](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E5%90%AF%E7%94%A8%E6%88%96%E7%A6%81%E7%94%A8mcp%E6%9C%8D%E5%8A%A1%E5%99%A8)
* [启用或禁用MCP服务器创建](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E5%90%AF%E7%94%A8%E6%88%96%E7%A6%81%E7%94%A8mcp%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%88%9B%E5%BB%BA)
* [管理单个MCP服务器](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E7%AE%A1%E7%90%86%E5%8D%95%E4%B8%AAmcp%E6%9C%8D%E5%8A%A1%E5%99%A8)
* [删除服务器](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E5%88%A0%E9%99%A4%E6%9C%8D%E5%8A%A1%E5%99%A8)
* [重启服务器](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E9%87%8D%E5%90%AF%E6%9C%8D%E5%8A%A1%E5%99%A8)
* [启用或禁用服务器](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E5%90%AF%E7%94%A8%E6%88%96%E7%A6%81%E7%94%A8%E6%9C%8D%E5%8A%A1%E5%99%A8)
* [网络超时](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E7%BD%91%E7%BB%9C%E8%B6%85%E6%97%B6)
* [自动批准工具](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E8%87%AA%E5%8A%A8%E6%89%B9%E5%87%86%E5%B7%A5%E5%85%B7)
* [查找和安装MCP服务器](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E6%9F%A5%E6%89%BE%E5%92%8C%E5%AE%89%E8%A3%85mcp%E6%9C%8D%E5%8A%A1%E5%99%A8)
* [在工作流中使用MCP工具](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E5%9C%A8%E5%B7%A5%E4%BD%9C%E6%B5%81%E4%B8%AD%E4%BD%BF%E7%94%A8mcp%E5%B7%A5%E5%85%B7)
* [故障排除MCP服务器](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E6%95%85%E9%9A%9C%E6%8E%92%E9%99%A4mcp%E6%9C%8D%E5%8A%A1%E5%99%A8)
* [平台特定的MCP配置示例](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#%E5%B9%B3%E5%8F%B0%E7%89%B9%E5%AE%9A%E7%9A%84mcp%E9%85%8D%E7%BD%AE%E7%A4%BA%E4%BE%8B)
* [Windows配置示例](https://kilocode.ai/docs/zh-CN/features/mcp/using-mcp-in-kilo-code#windows%E9%85%8D%E7%BD%AE%E7%A4%BA%E4%BE%8B)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Fmcp%2Fusing-mcp-in-kilo-code)
---
# Workflows | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/slash-commands/workflows#__docusaurus_skipToContent_fallback)
本页总览
Workflows automate repetitive tasks by defining step-by-step instructions for Kilo Code to execute. Invoke any workflow by typing `/[workflow-name.md]` in the chat.

Creating Workflows[](https://kilocode.ai/docs/zh-CN/features/slash-commands/workflows#creating-workflows "Creating Workflows的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------
Workflows are markdown files stored in `.kilocode/workflows/`:
* **Global workflows**: `~/.kilocode/workflows/` (available in all projects)
* **Project workflows**: `[project]/.kilocode/workflows/` (project-specific)
### Basic Setup[](https://kilocode.ai/docs/zh-CN/features/slash-commands/workflows#basic-setup "Basic Setup的直接链接")
1. Create a `.md` file with step-by-step instructions
2. Save it in your workflows directory
3. Type `/filename.md` to execute
### Workflow Capabilities[](https://kilocode.ai/docs/zh-CN/features/slash-commands/workflows#workflow-capabilities "Workflow Capabilities的直接链接")
Workflows can leverage:
* [Built-in tools](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview)
: [`read_file()`](https://kilocode.ai/docs/zh-CN/features/tools/read-file)
, [`search_files()`](https://kilocode.ai/docs/zh-CN/features/tools/search-files)
, [`execute_command()`](https://kilocode.ai/docs/zh-CN/features/tools/execute-command)
* CLI tools: `gh`, `docker`, `npm`, custom scripts
* [MCP integrations](https://kilocode.ai/docs/zh-CN/features/mcp/overview)
: Slack, databases, APIs
* [Mode switching](https://kilocode.ai/docs/zh-CN/basic-usage/using-modes)
: [`new_task()`](https://kilocode.ai/docs/zh-CN/features/tools/new-task)
for specialized contexts
Common Workflow Patterns[](https://kilocode.ai/docs/zh-CN/features/slash-commands/workflows#common-workflow-patterns "Common Workflow Patterns的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------------------------
**Release Management**
1. Gather merged PRs since last release2. Generate changelog from commit messages3. Update version numbers4. Create release branch and tag5. Deploy to staging environment
**Project Setup**
1. Clone repository template2. Install dependencies (`npm install`, `pip install -r requirements.txt`)3. Configure environment files4. Initialize database/services5. Run initial tests
**Code Review Preparation**
1. Search for TODO comments and debug statements2. Run linting and formatting3. Execute test suite4. Generate PR description from recent commits
Example: PR Submission Workflow[](https://kilocode.ai/docs/zh-CN/features/slash-commands/workflows#example-pr-submission-workflow "Example: PR Submission Workflow的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Let's walk through creating a workflow for submitting a pull request. This workflow handles the entire process from code review to deployment notification.
Create a file called `submit-pr.md` in your `.kilocode/workflows` directory:
# Submit PR WorkflowYou are helping submit a pull request. Follow these steps:1. First, use `search_files` to check for any TODO comments or console.log statements that shouldn't be committed2. Run tests using `execute_command` with `npm test` or the appropriate test command3. If tests pass, stage and commit changes with a descriptive commit message4. Push the branch and create a pull request using `gh pr create`5. Use `ask_followup_question` to get the PR title and description from the userParameters needed (ask if not provided):- Branch name- Reviewers to assign
Now you can trigger this workflow by typing `/submit-pr.md` in the chat. Kilo Code will:
* Scan your code for common issues before committing
* Run your test suite to catch problems early
* Handle the Git operations and PR creation
* Notify your team automatically
* Set up follow-up tasks for deployment
This saves you from manually running the same 7-step process every time you want to submit code for review.
* [Creating Workflows](https://kilocode.ai/docs/zh-CN/features/slash-commands/workflows#creating-workflows)
* [Basic Setup](https://kilocode.ai/docs/zh-CN/features/slash-commands/workflows#basic-setup)
* [Workflow Capabilities](https://kilocode.ai/docs/zh-CN/features/slash-commands/workflows#workflow-capabilities)
* [Common Workflow Patterns](https://kilocode.ai/docs/zh-CN/features/slash-commands/workflows#common-workflow-patterns)
* [Example: PR Submission Workflow](https://kilocode.ai/docs/zh-CN/features/slash-commands/workflows#example-pr-submission-workflow)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Fslash-commands%2Fworkflows)
---
# access_mcp_resource | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/tools/access-mcp-resource#__docusaurus_skipToContent_fallback)
本页总览
`access_mcp_resource` 工具用于从连接的 Model Context Protocol (MCP) 服务器中检索资源数据。它允许 Kilo Code 访问文件、API 响应、文档或系统信息,为任务提供额外的上下文。
参数[](https://kilocode.ai/docs/zh-CN/features/tools/access-mcp-resource#%E5%8F%82%E6%95%B0 "参数的直接链接")
------------------------------------------------------------------------------------------------------
该工具接受以下参数:
* `server_name` (必填): 提供资源的 MCP 服务器名称
* `uri` (必填): 标识要访问的特定资源的 URI
功能[](https://kilocode.ai/docs/zh-CN/features/tools/access-mcp-resource#%E5%8A%9F%E8%83%BD "功能的直接链接")
------------------------------------------------------------------------------------------------------
该工具连接到 MCP 服务器并从其暴露的资源中获取数据。与 `use_mcp_tool` 执行操作不同,该工具专门检索为任务提供上下文的信息。
使用场景[](https://kilocode.ai/docs/zh-CN/features/tools/access-mcp-resource#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF "使用场景的直接链接")
----------------------------------------------------------------------------------------------------------------------------
* 当 Kilo Code 需要从外部系统获取额外上下文时
* 当 Kilo Code 需要从专门的 MCP 服务器访问领域特定数据时
* 当 Kilo Code 需要检索由 MCP 服务器托管的参考文档时
* 当 Kilo Code 需要通过 MCP 从外部 API 集成实时数据时
主要特性[](https://kilocode.ai/docs/zh-CN/features/tools/access-mcp-resource#%E4%B8%BB%E8%A6%81%E7%89%B9%E6%80%A7 "主要特性的直接链接")
----------------------------------------------------------------------------------------------------------------------------
* 从 MCP 资源中检索文本和图像数据
* 在执行资源访问前需要用户批准
* 使用基于 URI 的寻址来精确定位资源
* 与 Model Context Protocol SDK 集成
* 根据内容类型适当显示资源内容
* 支持超时以确保网络操作的可靠性
* 处理服务器连接状态(已连接、连接中、断开连接)
* 发现来自连接服务器的可用资源
* 处理带有元数据的结构化响应数据
* 特殊处理图像内容的渲染
限制[](https://kilocode.ai/docs/zh-CN/features/tools/access-mcp-resource#%E9%99%90%E5%88%B6 "限制的直接链接")
------------------------------------------------------------------------------------------------------
* 依赖于外部 MCP 服务器的可用性和连接性
* 仅限于连接服务器提供的资源
* 无法访问已禁用服务器的资源
* 网络问题可能影响可靠性和性能
* 资源访问受配置的超时限制
* URI 格式由特定的 MCP 服务器实现决定
* 没有离线或缓存的资源访问能力
工作原理[](https://kilocode.ai/docs/zh-CN/features/tools/access-mcp-resource#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86 "工作原理的直接链接")
----------------------------------------------------------------------------------------------------------------------------
当调用 `access_mcp_resource` 工具时,它会遵循以下流程:
1. **连接验证**:
* 验证 MCP 中心是否可用且已初始化
* 确认指定的服务器存在于连接列表中
* 检查服务器是否被禁用(如果被禁用则返回错误)
2. **用户批准**:
* 向用户呈现资源访问请求以获取批准
* 提供服务器名称和资源 URI 以供用户验证
* 仅在用户批准资源访问后继续
3. **资源请求**:
* 使用 Model Context Protocol SDK 与服务器通信
* 通过 MCP 中心向服务器发出 `resources/read` 请求
* 应用配置的超时以防止服务器无响应时挂起
4. **响应处理**:
* 接收带有元数据和内容数组的结构化响应
* 处理文本内容以供用户显示
* 特殊处理图像数据以适当显示
* 将处理后的资源数据返回给 Kilo Code 以用于当前任务
资源类型[](https://kilocode.ai/docs/zh-CN/features/tools/access-mcp-resource#%E8%B5%84%E6%BA%90%E7%B1%BB%E5%9E%8B "资源类型的直接链接")
----------------------------------------------------------------------------------------------------------------------------
MCP 服务器可以提供两种主要类型的资源:
1. **标准资源**:
* 具有特定 URI 的固定资源
* 定义名称、描述和 MIME 类型
* 无需参数的直接访问
* 通常表示静态数据或实时信息
2. **资源模板**:
* 具有 URI 中占位符值的参数化资源
* 允许基于提供的参数动态生成资源
* 可以表示查询或数据过滤视图
* 更灵活但需要额外的 URI 格式化
使用示例[](https://kilocode.ai/docs/zh-CN/features/tools/access-mcp-resource#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B "使用示例的直接链接")
----------------------------------------------------------------------------------------------------------------------------
* 在帮助开发 API 时,Kilo Code 从 MCP 资源中检索端点规范以确保正确实现。
* 在协助数据可视化时,Kilo Code 从连接的 MCP 服务器访问当前数据样本。
* 在特定领域工作时,Kilo Code 检索技术文档以提供准确的指导。
* 在生成行业特定代码时,Kilo Code 参考文档中的合规要求。
使用示例[](https://kilocode.ai/docs/zh-CN/features/tools/access-mcp-resource#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B-1 "使用示例的直接链接")
------------------------------------------------------------------------------------------------------------------------------
访问当前的天气数据:
weather-serverweather://san-francisco/current
检索 API 文档:
api-docsdocs://payment-service/endpoints
访问领域特定知识:
knowledge-basekb://medical/terminology/common
获取系统配置:
infra-monitorconfig://production/database
* [参数](https://kilocode.ai/docs/zh-CN/features/tools/access-mcp-resource#%E5%8F%82%E6%95%B0)
* [功能](https://kilocode.ai/docs/zh-CN/features/tools/access-mcp-resource#%E5%8A%9F%E8%83%BD)
* [使用场景](https://kilocode.ai/docs/zh-CN/features/tools/access-mcp-resource#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF)
* [主要特性](https://kilocode.ai/docs/zh-CN/features/tools/access-mcp-resource#%E4%B8%BB%E8%A6%81%E7%89%B9%E6%80%A7)
* [限制](https://kilocode.ai/docs/zh-CN/features/tools/access-mcp-resource#%E9%99%90%E5%88%B6)
* [工作原理](https://kilocode.ai/docs/zh-CN/features/tools/access-mcp-resource#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86)
* [资源类型](https://kilocode.ai/docs/zh-CN/features/tools/access-mcp-resource#%E8%B5%84%E6%BA%90%E7%B1%BB%E5%9E%8B)
* [使用示例](https://kilocode.ai/docs/zh-CN/features/tools/access-mcp-resource#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B)
* [使用示例](https://kilocode.ai/docs/zh-CN/features/tools/access-mcp-resource#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B-1)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Ftools%2Faccess-mcp-resource)
---
# ask_followup_question | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/tools/ask-followup-question#__docusaurus_skipToContent_fallback)
本页总览
`ask_followup_question` 工具通过提出具体问题来收集完成任务所需的额外信息,从而实现交互式沟通。
参数[](https://kilocode.ai/docs/zh-CN/features/tools/ask-followup-question#%E5%8F%82%E6%95%B0 "参数的直接链接")
--------------------------------------------------------------------------------------------------------
该工具接受以下参数:
* `question` (必填): 向用户提出的具体问题
* `follow_up` (可选): 包含 2-4 个建议答案的列表,帮助引导用户回答,每个建议用 `` 标签包裹
功能[](https://kilocode.ai/docs/zh-CN/features/tools/ask-followup-question#%E5%8A%9F%E8%83%BD "功能的直接链接")
--------------------------------------------------------------------------------------------------------
该工具在 Kilo Code 和用户之间创建了一个对话界面,当遇到模糊不清或决策点时,可以用于收集澄清信息、额外细节或用户偏好。每个问题可以包含建议的响应,以简化交互。
使用场景[](https://kilocode.ai/docs/zh-CN/features/tools/ask-followup-question#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF "使用场景的直接链接")
------------------------------------------------------------------------------------------------------------------------------
* 当原始请求中缺少关键信息时
* 当 Kilo Code 需要在多个有效的实现方法之间做出选择时
* 当需要技术细节或偏好才能继续时
* 当 Kilo Code 遇到需要解决的模糊不清的情况时
* 当额外的上下文会显著提高解决方案质量时
主要特性[](https://kilocode.ai/docs/zh-CN/features/tools/ask-followup-question#%E4%B8%BB%E8%A6%81%E7%89%B9%E6%80%A7 "主要特性的直接链接")
------------------------------------------------------------------------------------------------------------------------------
* 提供结构化的方式来收集特定信息,而不会中断工作流程
* 包含建议答案以减少用户输入并引导响应
* 在交互过程中维护对话历史和上下文
* 支持包含图片和代码片段的响应
* 在所有模式下都可用,作为"始终可用"的工具集的一部分
* 支持用户直接指导实现决策
* 使用 `` 标签格式化响应,以区分常规对话
* 成功使用时重置连续错误计数器
限制[](https://kilocode.ai/docs/zh-CN/features/tools/ask-followup-question#%E9%99%90%E5%88%B6 "限制的直接链接")
--------------------------------------------------------------------------------------------------------
* 每次工具使用仅限于提出一个具体问题
* 在 UI 中将建议作为可选项呈现
* 不能强制结构化响应 - 用户仍然可以自由响应
* 过度使用可能会减慢任务完成速度并造成碎片化体验
* 建议答案必须完整,不能包含需要用户编辑的占位符
* 没有内置的用户响应验证机制
* 没有强制特定答案格式的机制
工作原理[](https://kilocode.ai/docs/zh-CN/features/tools/ask-followup-question#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86 "工作原理的直接链接")
------------------------------------------------------------------------------------------------------------------------------
当调用 `ask_followup_question` 工具时,它会遵循以下流程:
1. **参数验证**: 验证必需的 `question` 参数并检查可选建议
* 确保提供了问题文本
* 使用 `fast-xml-parser` 库从 `follow_up` 参数中解析任何建议答案
* 即使只有一个建议,也将建议规范化为数组格式
2. **JSON 转换**: 将 XML 结构转换为标准化的 JSON 格式以供 UI 显示
{ question: "用户的问题在这里", suggest: [ { answer: "建议 1" }, { answer: "建议 2" } ]}
3. **UI 集成**:
* 通过 `ask("followup", ...)` 方法将 JSON 结构传递给 UI 层
* 在界面中向用户显示可选的建议按钮
* 创建选择或输入响应的交互式体验
4. **响应收集与处理**:
* 捕获用户文本输入和响应中包含的任何图片
* 在返回给助手时用 `` 标签包裹用户响应
* 保留用户响应中包含的任何图片
* 通过将响应添加到历史记录中来维护对话上下文
* 在工具成功使用时重置连续错误计数器
5. **错误处理**:
* 使用计数器跟踪连续错误
* 在工具成功使用时重置计数器
* 提供特定的错误消息:
* 对于缺少参数:"缺少必需的参数 'question'"
* 对于 XML 解析:"无法解析操作:\[错误消息\]"
* 对于无效格式:"操作 xml 格式无效"
* 包含防止在缺少必需参数时执行工具的安全措施
* 发生错误时增加连续错误计数
工作流程[](https://kilocode.ai/docs/zh-CN/features/tools/ask-followup-question#%E5%B7%A5%E4%BD%9C%E6%B5%81%E7%A8%8B "工作流程的直接链接")
------------------------------------------------------------------------------------------------------------------------------
问题-回答周期遵循以下顺序:
1. **信息差距识别**: Kilo Code 识别出继续所需缺少的信息
2. **具体问题创建**: Kilo Code 形成一个明确的、有针对性的问题
3. **建议开发**: Kilo Code 创建相关的建议答案(可选但推荐)
4. **工具调用**: 助手使用问题和可选建议调用工具
5. **UI 呈现**: 问题和建议作为交互元素显示给用户
6. **用户响应**: 用户选择建议或提供自定义答案
7. **消息处理**: 系统处理部分和完整的消息
* 对于流式响应,在到达时处理每个块
* 对于完整消息,一次性处理整个响应
* 无论消息分块如何,都保持状态一致性
8. **响应处理**: 系统用 `` 标签包裹响应并保留图片
9. **上下文集成**: 响应被添加到对话历史中
10. **任务继续**: Kilo Code 使用新信息继续任务
使用示例[](https://kilocode.ai/docs/zh-CN/features/tools/ask-followup-question#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B "使用示例的直接链接")
------------------------------------------------------------------------------------------------------------------------------
* 在开发 Web 应用程序时,Kilo Code 可能会询问首选的样式框架(Bootstrap、Tailwind、自定义 CSS)
* 在创建 API 时,Kilo Code 可能会询问认证方法(JWT、OAuth、API 密钥)
* 在重构代码时,Kilo Code 可能会询问是优先考虑性能还是可读性
* 在设置数据库时,Kilo Code 可能会询问特定的模式设计偏好
* 在创建自定义功能时,Kilo Code 可能会询问特定的行为期望
* 在排查错误时,Kilo Code 可能会询问特定的环境细节
响应格式[](https://kilocode.ai/docs/zh-CN/features/tools/ask-followup-question#%E5%93%8D%E5%BA%94%E6%A0%BC%E5%BC%8F "响应格式的直接链接")
------------------------------------------------------------------------------------------------------------------------------
当用户回答问题时,响应会用 `` 标签进行格式化,以提高清晰度和一致性。这种格式有助于将用户的回答与其他对话元素明确区分开来。
示例响应格式:
使用 Tailwind CSS 进行实用优先的样式设计,具有最大的灵活性
响应格式的关键特征:
* 用 `` 标签包裹
* 保留原始响应的格式
* 如果响应中包含图片,则保留图片
* 返回完整文本,即使是长响应
使用示例[](https://kilocode.ai/docs/zh-CN/features/tools/ask-followup-question#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B-1 "使用示例的直接链接")
--------------------------------------------------------------------------------------------------------------------------------
询问实现偏好:
你希望这个 Web 应用程序采用哪种样式方法?使用 Bootstrap 进行快速开发,具有一致的组件使用 Tailwind CSS 进行实用优先的样式设计,具有最大的灵活性使用自定义样式的原生 CSS,以获得完全控制和最小依赖
请求技术澄清:
这个应用程序应该使用什么数据库来存储用户数据?MongoDB 用于灵活的模式和基于文档的存储PostgreSQL 用于具有强一致性保证的关系数据Firebase 用于实时更新和简化的后端管理SQLite 用于轻量级本地存储,无需外部依赖
解决需求中的模糊性:
应用程序应如何处理用户认证?实施带账户验证的电子邮件/密码认证使用社交登录提供商(Google、GitHub 等)快速注册同时实施电子邮件/密码和社交登录选项
* [参数](https://kilocode.ai/docs/zh-CN/features/tools/ask-followup-question#%E5%8F%82%E6%95%B0)
* [功能](https://kilocode.ai/docs/zh-CN/features/tools/ask-followup-question#%E5%8A%9F%E8%83%BD)
* [使用场景](https://kilocode.ai/docs/zh-CN/features/tools/ask-followup-question#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF)
* [主要特性](https://kilocode.ai/docs/zh-CN/features/tools/ask-followup-question#%E4%B8%BB%E8%A6%81%E7%89%B9%E6%80%A7)
* [限制](https://kilocode.ai/docs/zh-CN/features/tools/ask-followup-question#%E9%99%90%E5%88%B6)
* [工作原理](https://kilocode.ai/docs/zh-CN/features/tools/ask-followup-question#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86)
* [工作流程](https://kilocode.ai/docs/zh-CN/features/tools/ask-followup-question#%E5%B7%A5%E4%BD%9C%E6%B5%81%E7%A8%8B)
* [使用示例](https://kilocode.ai/docs/zh-CN/features/tools/ask-followup-question#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B)
* [响应格式](https://kilocode.ai/docs/zh-CN/features/tools/ask-followup-question#%E5%93%8D%E5%BA%94%E6%A0%BC%E5%BC%8F)
* [使用示例](https://kilocode.ai/docs/zh-CN/features/tools/ask-followup-question#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B-1)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Ftools%2Fask-followup-question)
---
# apply_diff | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/tools/apply-diff#__docusaurus_skipToContent_fallback)
本页总览
`apply_diff`工具通过指定要替换的确切内容,对文件进行精确的修改。它使用多种复杂策略来查找和应用更改,同时保持正确的代码格式和结构。
参数[](https://kilocode.ai/docs/zh-CN/features/tools/apply-diff#%E5%8F%82%E6%95%B0 "参数的直接链接")
---------------------------------------------------------------------------------------------
该工具接受以下参数:
* `path`(必填):要修改的文件路径,相对于当前工作目录。
* `diff`(必填):使用特定于活动diff策略的格式定义更改的搜索/替换块。
* `start_line`(可选):搜索内容开始的提示,某些策略会使用。
* `end_line`(可选):搜索内容结束的提示,某些策略会使用。
功能[](https://kilocode.ai/docs/zh-CN/features/tools/apply-diff#%E5%8A%9F%E8%83%BD "功能的直接链接")
---------------------------------------------------------------------------------------------
该工具使用复杂的策略对现有文件进行有针对性的更改,以精确定位和替换内容。与简单的搜索和替换不同,它使用智能匹配算法(包括模糊匹配),能够适应不同的内容类型和文件大小,并为复杂编辑提供回退机制。
使用场景[](https://kilocode.ai/docs/zh-CN/features/tools/apply-diff#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF "使用场景的直接链接")
-------------------------------------------------------------------------------------------------------------------
* 当Kilo Code需要对现有代码进行精确更改而不重写整个文件时。
* 在重构代码的特定部分同时保持周围上下文时。
* 以手术般的精度修复现有代码中的错误时。
* 实现仅修改文件某些部分的功能增强时。
主要特性[](https://kilocode.ai/docs/zh-CN/features/tools/apply-diff#%E4%B8%BB%E8%A6%81%E7%89%B9%E6%80%A7 "主要特性的直接链接")
-------------------------------------------------------------------------------------------------------------------
* 使用可配置置信度阈值(通常为0.8-1.0)的智能模糊匹配。
* 使用`BUFFER_LINES`(默认40)提供匹配的上下文。
* 采用重叠窗口方法搜索大文件。
* 自动保留代码格式和缩进。
* 组合重叠匹配以提高置信度评分。
* 在应用更改前,在diff视图中显示更改以供用户审查和编辑。
* 跟踪每个文件的连续错误(`consecutiveMistakeCountForApplyDiff`)以防止重复失败。
* 根据`.kilocodeignore`规则验证文件访问权限。
* 有效处理多行编辑。
限制[](https://kilocode.ai/docs/zh-CN/features/tools/apply-diff#%E9%99%90%E5%88%B6 "限制的直接链接")
---------------------------------------------------------------------------------------------
* 对于独特、独特的代码部分效果最佳,以便可靠识别。
* 对于非常大的文件或高度重复的代码模式,性能可能会有所不同。
* 如果内容不明确,模糊匹配可能会偶尔选择错误的位置。
* 每个diff策略都有特定的格式要求。
* 复杂的编辑可能需要仔细选择策略或手动审查。
工作原理[](https://kilocode.ai/docs/zh-CN/features/tools/apply-diff#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86 "工作原理的直接链接")
-------------------------------------------------------------------------------------------------------------------
当调用`apply_diff`工具时,它会遵循以下过程:
1. **参数验证**:验证必需的`path`和`diff`参数。
2. **KiloCodeIgnore检查**:验证目标文件路径是否被`.kilocodeignore`规则允许。
3. **文件分析**:加载目标文件内容。
4. **匹配查找**:使用所选策略的算法(精确、模糊、重叠窗口)定位目标内容,考虑置信度阈值和上下文(`BUFFER_LINES`)。
5. **更改准备**:生成建议的更改,保留缩进。
6. **用户交互**:
* 在diff视图中显示更改。
* 允许用户审查并可能编辑建议的更改。
* 等待用户批准或拒绝。
7. **更改应用**:如果获得批准,将更改(可能包括用户编辑)应用到文件。
8. **错误处理**:如果发生错误(例如,匹配失败、部分应用),则递增文件的`consecutiveMistakeCountForApplyDiff`并报告失败类型。
9. **反馈**:返回结果,包括任何用户反馈或错误详细信息。
Diff策略[](https://kilocode.ai/docs/zh-CN/features/tools/apply-diff#diff%E7%AD%96%E7%95%A5 "Diff策略的直接链接")
---------------------------------------------------------------------------------------------------------
Kilo Code使用以下策略来应用diff:
### MultiSearchReplaceDiffStrategy[](https://kilocode.ai/docs/zh-CN/features/tools/apply-diff#multisearchreplacediffstrategy "MultiSearchReplaceDiffStrategy的直接链接")
一种增强的搜索/替换格式,支持在一个请求中进行多次更改。需要每个搜索块的行号。
* **最佳使用场景**:已知或可以估计行号的多个不同更改。
* **要求**:`SEARCH`块内容的精确匹配,包括空格和缩进。行号(`:start_line:`,`:end_line:`)是必需的。内容中的标记必须转义(`\`)。
``块的示例格式:
<<<<<<< SEARCH:start_line:10:end_line:12------- // Old calculation logic const result = value * 0.9; return result;======= // Updated calculation logic with logging console.log(`Calculating for value: ${value}`); const result = value * 0.95; // Adjusted factor return result;>>>>>>> REPLACE<<<<<<< SEARCH:start_line:25:end_line:25------- const defaultTimeout = 5000;======= const defaultTimeout = 10000; // Increased timeout>>>>>>> REPLACE
* [参数](https://kilocode.ai/docs/zh-CN/features/tools/apply-diff#%E5%8F%82%E6%95%B0)
* [功能](https://kilocode.ai/docs/zh-CN/features/tools/apply-diff#%E5%8A%9F%E8%83%BD)
* [使用场景](https://kilocode.ai/docs/zh-CN/features/tools/apply-diff#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF)
* [主要特性](https://kilocode.ai/docs/zh-CN/features/tools/apply-diff#%E4%B8%BB%E8%A6%81%E7%89%B9%E6%80%A7)
* [限制](https://kilocode.ai/docs/zh-CN/features/tools/apply-diff#%E9%99%90%E5%88%B6)
* [工作原理](https://kilocode.ai/docs/zh-CN/features/tools/apply-diff#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86)
* [Diff策略](https://kilocode.ai/docs/zh-CN/features/tools/apply-diff#diff%E7%AD%96%E7%95%A5)
* [MultiSearchReplaceDiffStrategy](https://kilocode.ai/docs/zh-CN/features/tools/apply-diff#multisearchreplacediffstrategy)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Ftools%2Fapply-diff)
---
# browser_action | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/tools/browser-action#__docusaurus_skipToContent_fallback)
本页总览
`browser_action`工具通过Puppeteer控制的浏览器实现网页自动化交互。它允许Kilo Code启动浏览器、导航至网站、点击元素、输入文本、滚动页面,并通过截图提供可视化反馈。
> **⚠️ 安全警告**
> 使用此工具时请注意:
>
> * 确保访问的网站安全可靠
> * 避免在浏览器中执行未经验证的操作
> * 谨慎处理敏感信息
参数[](https://kilocode.ai/docs/zh-CN/features/tools/browser-action#%E5%8F%82%E6%95%B0 "参数的直接链接")
-------------------------------------------------------------------------------------------------
该工具接受以下参数:
* `action` (必填): 要执行的操作:
* `launch`: 在指定URL启动新浏览器会话
* `click`: 在特定x,y坐标处点击
* `type`: 通过键盘输入文本
* `scroll_down`: 向下滚动一页高度
* `scroll_up`: 向上滚动一页高度
* `close`: 结束浏览器会话
* `url` (可选): 使用`launch`操作时要导航的URL
* `coordinate` (可选): `click`操作的x,y坐标(例如"450,300")
* `text` (可选): 使用`type`操作时要输入的文本
功能[](https://kilocode.ai/docs/zh-CN/features/tools/browser-action#%E5%8A%9F%E8%83%BD "功能的直接链接")
-------------------------------------------------------------------------------------------------
该工具创建一个自动化浏览器会话,Kilo Code可以通过它来导航网站、与元素交互,并执行需要浏览器自动化的任务。每个操作都会提供当前状态的截图,以便进行可视化验证。
使用场景[](https://kilocode.ai/docs/zh-CN/features/tools/browser-action#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF "使用场景的直接链接")
-----------------------------------------------------------------------------------------------------------------------
* 当Kilo Code需要与Web应用程序或网站交互时
* 当测试用户界面或Web功能时
* 当捕获网页截图时
* 当演示Web工作流程时
主要特性[](https://kilocode.ai/docs/zh-CN/features/tools/browser-action#%E4%B8%BB%E8%A6%81%E7%89%B9%E6%80%A7 "主要特性的直接链接")
-----------------------------------------------------------------------------------------------------------------------
* 提供操作后的截图作为可视化反馈,并捕获控制台日志
* 支持从启动到页面交互再到关闭的完整工作流程
* 通过坐标、键盘输入和滚动实现精确交互
* 通过智能页面加载检测保持一致的浏览器会话
* 支持两种模式:本地(独立Puppeteer实例)或远程(连接现有Chrome)
* 通过自动会话清理和详细消息优雅处理错误
* 支持多种格式和质量设置的视觉输出优化
* 通过位置指示器和操作历史跟踪交互状态
浏览器模式[](https://kilocode.ai/docs/zh-CN/features/tools/browser-action#%E6%B5%8F%E8%A7%88%E5%99%A8%E6%A8%A1%E5%BC%8F "浏览器模式的直接链接")
----------------------------------------------------------------------------------------------------------------------------------
该工具支持两种模式:
### 本地浏览器模式(默认)[](https://kilocode.ai/docs/zh-CN/features/tools/browser-action#%E6%9C%AC%E5%9C%B0%E6%B5%8F%E8%A7%88%E5%99%A8%E6%A8%A1%E5%BC%8F%E9%BB%98%E8%AE%A4 "本地浏览器模式(默认)的直接链接")
* 通过Puppeteer下载并管理本地Chromium实例
* 每次启动时创建全新的浏览器环境
* 无法访问现有用户配置文件、cookies或扩展程序
* 在沙箱环境中保持行为一致且可预测
* 会话结束时完全关闭浏览器
### 远程浏览器模式[](https://kilocode.ai/docs/zh-CN/features/tools/browser-action#%E8%BF%9C%E7%A8%8B%E6%B5%8F%E8%A7%88%E5%99%A8%E6%A8%A1%E5%BC%8F "远程浏览器模式的直接链接")
* 连接到已启用远程调试的现有Chrome/Chromium实例
* 可以访问现有浏览器状态、cookies,可能还包括扩展程序
* 由于重用现有浏览器进程,启动速度更快
* 支持连接到Docker容器或远程机器上的浏览器
* 会话结束时仅断开连接(不关闭浏览器)
* 需要Chrome以远程调试端口运行(通常为9222端口)
限制[](https://kilocode.ai/docs/zh-CN/features/tools/browser-action#%E9%99%90%E5%88%B6 "限制的直接链接")
-------------------------------------------------------------------------------------------------
* 浏览器活动时,只能使用`browser_action`工具
* 浏览器坐标是相对于视口的,而不是页面
* 点击操作必须针对视口内的可见元素
* 在使用其他工具之前必须显式关闭浏览器会话
* 浏览器窗口有可配置的尺寸(默认900x600)
* 无法直接与浏览器DevTools交互
* 浏览器会话是临时的,在Kilo Code重启时不会保留
* 仅支持Chrome/Chromium浏览器,不支持Firefox或Safari
* 本地模式无法访问现有cookies;远程模式需要启用调试的Chrome
工作原理[](https://kilocode.ai/docs/zh-CN/features/tools/browser-action#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86 "工作原理的直接链接")
-----------------------------------------------------------------------------------------------------------------------
当调用`browser_action`工具时,它会遵循以下流程:
1. **操作验证和浏览器管理**:
* 验证请求操作所需的参数
* 对于`launch`:初始化浏览器会话(本地Puppeteer实例或远程Chrome)
* 对于交互操作:使用现有浏览器会话
* 对于`close`:适当地终止或断开浏览器连接
2. **页面交互和稳定性**:
* 使用`waitTillHTMLStable`算法通过DOM稳定性检测确保页面完全加载
* 以适当的时间执行请求的操作(导航、点击、输入、滚动)
* 监控点击后的网络活动,并在必要时等待导航
3. **可视化反馈**:
* 使用WebP格式(支持PNG回退)捕获优化截图
* 记录浏览器控制台日志以进行调试
* 跟踪鼠标位置并维护分页操作历史
4. **会话管理**:
* 跨多个操作维护浏览器状态
* 处理错误并自动清理资源
* 强制执行正确的工作流程顺序(启动→交互→关闭)
工作流程顺序[](https://kilocode.ai/docs/zh-CN/features/tools/browser-action#%E5%B7%A5%E4%BD%9C%E6%B5%81%E7%A8%8B%E9%A1%BA%E5%BA%8F "工作流程顺序的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------
浏览器交互必须遵循以下特定顺序:
1. **会话初始化**:所有浏览器工作流程必须以`launch`操作开始
2. **交互阶段**:可以执行多个`click`、`type`和滚动操作
3. **会话终止**:所有浏览器工作流程必须以`close`操作结束
4. **工具切换**:关闭浏览器后,可以使用其他工具
使用示例[](https://kilocode.ai/docs/zh-CN/features/tools/browser-action#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B "使用示例的直接链接")
-----------------------------------------------------------------------------------------------------------------------
* 当创建Web表单提交过程时,Kilo Code启动浏览器,导航到表单,使用`type`操作填写字段,并点击提交。
* 当测试响应式网站时,Kilo Code导航到网站并使用滚动操作检查不同部分。
* 当捕获Web应用程序的截图时,Kilo Code导航到不同页面并在每一步截图。
* 当演示电商结账流程时,Kilo Code模拟从产品选择到支付确认的整个过程。
使用示例[](https://kilocode.ai/docs/zh-CN/features/tools/browser-action#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B-1 "使用示例的直接链接")
-------------------------------------------------------------------------------------------------------------------------
启动浏览器并导航到网站:
launchhttps://example.com
在特定坐标处点击(例如按钮):
click450,300
在聚焦的输入字段中输入文本:
typeHello, World!
向下滚动以查看更多内容:
scroll_down
关闭浏览器会话:
close
* [参数](https://kilocode.ai/docs/zh-CN/features/tools/browser-action#%E5%8F%82%E6%95%B0)
* [功能](https://kilocode.ai/docs/zh-CN/features/tools/browser-action#%E5%8A%9F%E8%83%BD)
* [使用场景](https://kilocode.ai/docs/zh-CN/features/tools/browser-action#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF)
* [主要特性](https://kilocode.ai/docs/zh-CN/features/tools/browser-action#%E4%B8%BB%E8%A6%81%E7%89%B9%E6%80%A7)
* [浏览器模式](https://kilocode.ai/docs/zh-CN/features/tools/browser-action#%E6%B5%8F%E8%A7%88%E5%99%A8%E6%A8%A1%E5%BC%8F)
* [本地浏览器模式(默认)](https://kilocode.ai/docs/zh-CN/features/tools/browser-action#%E6%9C%AC%E5%9C%B0%E6%B5%8F%E8%A7%88%E5%99%A8%E6%A8%A1%E5%BC%8F%E9%BB%98%E8%AE%A4)
* [远程浏览器模式](https://kilocode.ai/docs/zh-CN/features/tools/browser-action#%E8%BF%9C%E7%A8%8B%E6%B5%8F%E8%A7%88%E5%99%A8%E6%A8%A1%E5%BC%8F)
* [限制](https://kilocode.ai/docs/zh-CN/features/tools/browser-action#%E9%99%90%E5%88%B6)
* [工作原理](https://kilocode.ai/docs/zh-CN/features/tools/browser-action#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86)
* [工作流程顺序](https://kilocode.ai/docs/zh-CN/features/tools/browser-action#%E5%B7%A5%E4%BD%9C%E6%B5%81%E7%A8%8B%E9%A1%BA%E5%BA%8F)
* [使用示例](https://kilocode.ai/docs/zh-CN/features/tools/browser-action#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B)
* [使用示例](https://kilocode.ai/docs/zh-CN/features/tools/browser-action#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B-1)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Ftools%2Fbrowser-action)
---
# attempt_completion | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/tools/attempt-completion#__docusaurus_skipToContent_fallback)
本页总览
`attempt_completion` 工具用于标记 Kilo Code 认为任务已完成并向用户展示结果。它提供了任务完成的摘要,可选地包括一个用于展示结果的命令,并支持通过用户反馈进行进一步优化。
参数[](https://kilocode.ai/docs/zh-CN/features/tools/attempt-completion#%E5%8F%82%E6%95%B0 "参数的直接链接")
-----------------------------------------------------------------------------------------------------
该工具接受以下参数:
* `result` (必填): 最终结果描述,总结已完成的工作
* `command` (可选): 用于展示结果的 CLI 命令
功能[](https://kilocode.ai/docs/zh-CN/features/tools/attempt-completion#%E5%8A%9F%E8%83%BD "功能的直接链接")
-----------------------------------------------------------------------------------------------------
该工具通过提供最终摘要来标记任务的结束。它向用户和系统发出信号,表明当前任务已完成。当提供命令时,它还可以通过实时执行来展示结果。
使用场景[](https://kilocode.ai/docs/zh-CN/features/tools/attempt-completion#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF "使用场景的直接链接")
---------------------------------------------------------------------------------------------------------------------------
* 当 Kilo Code 认为用户的任务已完成时
* 当总结所做更改或改进时
* 当使用命令执行展示当前结果时
* 当为用户反馈提供解决方案的检查点时
* 当从工作阶段过渡到可能的优化时
主要特性[](https://kilocode.ai/docs/zh-CN/features/tools/attempt-completion#%E4%B8%BB%E8%A6%81%E7%89%B9%E6%80%A7 "主要特性的直接链接")
---------------------------------------------------------------------------------------------------------------------------
* 提供明确的信号表明 Kilo Code 认为任务已完成
* 以简洁的消息总结完成的工作
* 可选地通过命令执行展示结果
* 支持用户反馈以进行进一步优化
* 以不同于常规消息的特殊 UI 格式显示结果
* 捕获任务完成遥测数据用于系统分析
* 通过提供检查点维护结构化的对话流程
* 支持在较大工作流中的子任务完成
* 确保用户收到关于已完成工作的清晰摘要
* 在所有模式下都可用,作为"始终可用"工具组的一部分
限制[](https://kilocode.ai/docs/zh-CN/features/tools/attempt-completion#%E9%99%90%E5%88%B6 "限制的直接链接")
-----------------------------------------------------------------------------------------------------
* 在确认之前的工具使用成功之前不应使用(指南,非强制)
* 仅限于单个命令来展示结果
* 无法提供多个命令选项
* 命令在执行前需要用户批准
* 仅限于通过 CLI 命令展示结果
* 不能用于部分任务完成或进度更新
* 结果格式会通过内部处理移除 XML 闭合标签
工作原理[](https://kilocode.ai/docs/zh-CN/features/tools/attempt-completion#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86 "工作原理的直接链接")
---------------------------------------------------------------------------------------------------------------------------
当调用 `attempt_completion` 工具时,它会遵循以下流程:
1. **安全考虑**(指南,非强制):
* AI 被指示确认之前的工具使用是否成功
* 这是一个最佳实践,而不是程序化强制机制
2. **结果展示**:
* 以特殊的 "completion\_result" UI 格式向用户显示完成消息
* 使用 `removeClosingTag` 函数从结果文本中移除 XML 闭合标签
* 以不同于常规消息的方式呈现结果,以实现视觉区分
3. **命令执行**(如果提供):
* 在执行前请求用户批准
* 仅在用户批准后执行
* 使用系统的命令执行功能执行命令
* 向用户展示命令结果
4. **反馈收集**:
* 等待用户对完成结果的反馈
* 处理此反馈并将其返回给 AI
* 支持基于用户输入的持续优化
5. **任务完成与继续**:
* 在系统中标记任务为已完成
* 捕获已完成任务的遥测数据
* 对于子任务,提供完成子任务并恢复父任务的选项
* 通过反馈机制支持继续对话
6. **实现集成**:
* 工具结果通过系统的解析机制在 `parse-assistant-message.ts` 中处理
* 该工具是 "ALWAYS\_AVAILABLE\_TOOLS" 常量的一部分,使其在所有模式下都可用
结果格式指南[](https://kilocode.ai/docs/zh-CN/features/tools/attempt-completion#%E7%BB%93%E6%9E%9C%E6%A0%BC%E5%BC%8F%E6%8C%87%E5%8D%97 "结果格式指南的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------------------
结果消息应遵循以下指南:
* 清晰地传达已完成的工作
* 简洁但完整
* 专注于为用户提供的价值
* 避免不必要的客套或填充文本
* 保持专业、直接的语气
* 以易于浏览和理解的方式呈现信息
* 确认用户可能会提供反馈以进行进一步优化
注意:系统会通过 `removeClosingTag` 函数自动从结果文本中移除 XML 闭合标签。
命令选择指南[](https://kilocode.ai/docs/zh-CN/features/tools/attempt-completion#%E5%91%BD%E4%BB%A4%E9%80%89%E6%8B%A9%E6%8C%87%E5%8D%97 "命令选择指南的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------------------
包含命令时,请遵循以下指南:
* 选择能直观展示结果的命令
* 优先选择能展示用户创建或修改内容的命令
* 示例包括:
* `open index.html` 展示创建的网站
* `npm start` 启动开发服务器
* `python app.py` 运行创建的应用程序
* 避免仅打印文本的命令(如 `echo` 或 `cat`)
* 记住命令在执行前需要用户批准
* 确保命令适用于用户的操作系统
反馈与 UI 表示[](https://kilocode.ai/docs/zh-CN/features/tools/attempt-completion#%E5%8F%8D%E9%A6%88%E4%B8%8E-ui-%E8%A1%A8%E7%A4%BA "反馈与 UI 表示的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------------------
`attempt_completion` 工具具有独特的反馈机制:
* 结果以特殊的 "completion\_result" UI 格式显示,不同于常规消息
* 系统在呈现结果后等待用户反馈
* 反馈被处理并返回给 Kilo Code 以进行进一步优化
* 这创建了一个迭代改进周期,而不是结束对话
* UI 包含用于提供反馈的特殊元素
* 结果作为对话流程中的明确检查点
用于子任务时:
* 系统提供完成子任务并恢复父任务的选项
* 如果批准,子任务将以摘要完成
* 父任务在完成子任务的上下文中恢复
* 这支持复杂、嵌套的工作流,同时保持上下文
使用示例[](https://kilocode.ai/docs/zh-CN/features/tools/attempt-completion#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B "使用示例的直接链接")
---------------------------------------------------------------------------------------------------------------------------
* 当创建网站时,Kilo Code 展示解决方案并使用 `open index.html` 展示结果。用户提供反馈,Kilo Code 优化设计。
* 当实现功能时,Kilo Code 总结更改及其影响。用户请求额外的测试覆盖,Kilo Code 继续任务。
* 当修复错误时,Kilo Code 解释修复内容以及解决方案如何解决根本原因。用户确认修复有效。
* 当设置开发环境时,Kilo Code 确认所有组件已安装。用户请求额外配置,Kilo Code 继续。
* 当创建数据处理脚本时,Kilo Code 总结功能。用户建议性能优化,Kilo Code 优化代码。
使用示例[](https://kilocode.ai/docs/zh-CN/features/tools/attempt-completion#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B-1 "使用示例的直接链接")
-----------------------------------------------------------------------------------------------------------------------------
仅使用结果摘要完成任务:
我已更新导航栏的 CSS 以匹配设计稿。更改包括:1. 更新配色方案以使用新的品牌颜色2. 为移动设备添加了响应式行为3. 修复了下拉菜单中的对齐问题
使用结果和演示命令完成任务:
我创建了一个简单的 React 应用程序,包含以下功能:1. 具有请求的英雄部分的响应式落地页2. 带有验证的工作联系表单3. 在请求的三个页面之间导航4. 匹配提供的设计稿的样式npm start
完成 Python 脚本任务并执行:
我创建了一个数据处理脚本,它:1. 从数据目录读取 CSV 文件2. 按要求清理和规范化数据3. 以 JSON 格式生成汇总统计4. 将处理后的数据输出到输出目录python process_data.py
* [参数](https://kilocode.ai/docs/zh-CN/features/tools/attempt-completion#%E5%8F%82%E6%95%B0)
* [功能](https://kilocode.ai/docs/zh-CN/features/tools/attempt-completion#%E5%8A%9F%E8%83%BD)
* [使用场景](https://kilocode.ai/docs/zh-CN/features/tools/attempt-completion#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF)
* [主要特性](https://kilocode.ai/docs/zh-CN/features/tools/attempt-completion#%E4%B8%BB%E8%A6%81%E7%89%B9%E6%80%A7)
* [限制](https://kilocode.ai/docs/zh-CN/features/tools/attempt-completion#%E9%99%90%E5%88%B6)
* [工作原理](https://kilocode.ai/docs/zh-CN/features/tools/attempt-completion#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86)
* [结果格式指南](https://kilocode.ai/docs/zh-CN/features/tools/attempt-completion#%E7%BB%93%E6%9E%9C%E6%A0%BC%E5%BC%8F%E6%8C%87%E5%8D%97)
* [命令选择指南](https://kilocode.ai/docs/zh-CN/features/tools/attempt-completion#%E5%91%BD%E4%BB%A4%E9%80%89%E6%8B%A9%E6%8C%87%E5%8D%97)
* [反馈与 UI 表示](https://kilocode.ai/docs/zh-CN/features/tools/attempt-completion#%E5%8F%8D%E9%A6%88%E4%B8%8E-ui-%E8%A1%A8%E7%A4%BA)
* [使用示例](https://kilocode.ai/docs/zh-CN/features/tools/attempt-completion#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B)
* [使用示例](https://kilocode.ai/docs/zh-CN/features/tools/attempt-completion#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B-1)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Ftools%2Fattempt-completion)
---
# execute_command | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/tools/execute-command#__docusaurus_skipToContent_fallback)
本页总览
`execute_command`工具用于在用户系统上执行CLI命令。它允许Kilo Code执行系统操作、安装依赖、构建项目、启动服务器以及执行其他基于终端的任务,以实现用户目标。
参数[](https://kilocode.ai/docs/zh-CN/features/tools/execute-command#%E5%8F%82%E6%95%B0 "参数的直接链接")
--------------------------------------------------------------------------------------------------
该工具接受以下参数:
* `command`(必填):要执行的CLI命令。必须对用户的操作系统有效。
* `cwd`(可选):执行命令的工作目录。如果未提供,则使用当前工作目录。
功能[](https://kilocode.ai/docs/zh-CN/features/tools/execute-command#%E5%8A%9F%E8%83%BD "功能的直接链接")
--------------------------------------------------------------------------------------------------
该工具直接在用户系统上执行终端命令,支持从文件操作到运行开发服务器等多种操作。命令在托管的终端实例中运行,并实时捕获输出,与VS Code的终端系统集成,以实现最佳性能和安全性。
使用场景[](https://kilocode.ai/docs/zh-CN/features/tools/execute-command#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF "使用场景的直接链接")
------------------------------------------------------------------------------------------------------------------------
* 安装项目依赖(npm install, pip install等)
* 构建或编译代码(make, npm run build等)
* 启动开发服务器或运行应用程序
* 初始化新项目(git init, npm init等)
* 执行超出其他工具功能的文件操作
* 运行测试或lint操作
* 需要为特定技术执行专用命令
关键特性[](https://kilocode.ai/docs/zh-CN/features/tools/execute-command#%E5%85%B3%E9%94%AE%E7%89%B9%E6%80%A7 "关键特性的直接链接")
------------------------------------------------------------------------------------------------------------------------
* 与VS Code shell API集成,实现可靠的终端执行
* 通过注册表系统尽可能重用终端实例
* 实时捕获命令输出
* 支持在后台持续运行的长时间命令
* 允许指定自定义工作目录
* 跨命令执行维护终端历史记录和状态
* 处理适合用户shell的复杂命令链
* 提供详细的命令完成状态和退出代码解释
* 支持需要用户反馈的交互式终端应用
* 执行期间显示终端以确保透明度
* 使用shell-quote解析验证命令安全性
* 阻止潜在危险的子shell执行模式
* 与KiloCodeIgnore系统集成,控制文件访问权限
* 处理终端转义序列以保持输出整洁
限制[](https://kilocode.ai/docs/zh-CN/features/tools/execute-command#%E9%99%90%E5%88%B6 "限制的直接链接")
--------------------------------------------------------------------------------------------------
* 命令访问可能受KiloCodeIgnore规则和安全验证限制
* 需要提升权限的命令可能需要用户配置
* 某些命令的行为可能因操作系统而异
* 长时间运行的命令可能需要特殊处理
* 文件路径应根据OS shell规则正确转义
* 在远程开发场景中,并非所有终端功能都可用
工作原理[](https://kilocode.ai/docs/zh-CN/features/tools/execute-command#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86 "工作原理的直接链接")
------------------------------------------------------------------------------------------------------------------------
当调用`execute_command`工具时,它遵循以下流程:
1. **命令验证和安全检查**:
* 使用shell-quote解析命令以识别组件
* 根据安全限制(子shell使用、受限文件)进行验证
* 检查KiloCodeIgnore规则以确定文件访问权限
* 确保命令符合系统安全要求
2. **终端管理**:
* 通过TerminalRegistry获取或创建终端
* 设置工作目录上下文
* 准备输出捕获的事件监听器
* 显示终端以便用户可见
3. **命令执行和监控**:
* 通过VS Code的shellIntegration API执行
* 捕获并处理转义序列的输出
* 限制输出处理间隔(100ms)
* 监控命令完成或错误
* 检测"热"进程(如编译器)以进行特殊处理
4. **结果处理**:
* 去除ANSI/VS Code转义序列以保持输出整洁
* 解释退出代码并提供详细的信号信息
* 如果命令改变了工作目录,则更新跟踪
* 提供带有适当上下文的命令状态
终端实现细节[](https://kilocode.ai/docs/zh-CN/features/tools/execute-command#%E7%BB%88%E7%AB%AF%E5%AE%9E%E7%8E%B0%E7%BB%86%E8%8A%82 "终端实现细节的直接链接")
----------------------------------------------------------------------------------------------------------------------------------------------
该工具使用复杂的终端管理系统:
1. **优先复用终端**:
* TerminalRegistry尽可能复用现有终端
* 减少终端实例数量并提高性能
* 跨命令执行保留终端状态(工作目录、历史记录)
2. **安全验证**:
* 使用shell-quote解析命令以进行组件分析
* 阻止`$(...)`和反引号等危险模式
* 根据KiloCodeIgnore规则检查命令的文件访问控制
* 使用前缀允许列表系统验证命令模式
3. **性能优化**:
* 以100ms节流间隔处理输出,防止UI过载
* 使用基于索引的零拷贝缓冲区管理以提高效率
* 对编译和"热"进程进行特殊处理
* 针对Windows PowerShell进行平台特定优化
4. **错误和信号处理**:
* 将退出代码映射到详细的信号信息(SIGTERM, SIGKILL等)
* 检测核心转储以识别关键故障
* 自动跟踪和处理工作目录变更
* 从终端断开连接场景中优雅恢复
使用示例[](https://kilocode.ai/docs/zh-CN/features/tools/execute-command#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B "使用示例的直接链接")
------------------------------------------------------------------------------------------------------------------------
* 设置新项目时,Kilo Code运行初始化命令,如`npm init -y`,然后安装依赖。
* 构建Web应用时,Kilo Code执行构建命令,如`npm run build`以编译资源。
* 部署代码时,Kilo Code运行git命令以提交和推送更改到仓库。
* 故障排除时,Kilo Code执行诊断命令以收集系统信息。
* 启动开发服务器时,Kilo Code运行适当的服务器命令(如`npm start`)。
* 运行测试时,Kilo Code执行项目测试框架的测试运行命令。
用法示例[](https://kilocode.ai/docs/zh-CN/features/tools/execute-command#%E7%94%A8%E6%B3%95%E7%A4%BA%E4%BE%8B "用法示例的直接链接")
------------------------------------------------------------------------------------------------------------------------
在当前目录中运行简单命令:
npm run dev
安装项目依赖:
npm install express mongodb mongoose dotenv
依次运行多个命令:
mkdir -p src/components && touch src/components/App.js
在特定目录中执行命令:
git status./my-project
构建并启动项目:
npm run build && npm start
* [参数](https://kilocode.ai/docs/zh-CN/features/tools/execute-command#%E5%8F%82%E6%95%B0)
* [功能](https://kilocode.ai/docs/zh-CN/features/tools/execute-command#%E5%8A%9F%E8%83%BD)
* [使用场景](https://kilocode.ai/docs/zh-CN/features/tools/execute-command#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF)
* [关键特性](https://kilocode.ai/docs/zh-CN/features/tools/execute-command#%E5%85%B3%E9%94%AE%E7%89%B9%E6%80%A7)
* [限制](https://kilocode.ai/docs/zh-CN/features/tools/execute-command#%E9%99%90%E5%88%B6)
* [工作原理](https://kilocode.ai/docs/zh-CN/features/tools/execute-command#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86)
* [终端实现细节](https://kilocode.ai/docs/zh-CN/features/tools/execute-command#%E7%BB%88%E7%AB%AF%E5%AE%9E%E7%8E%B0%E7%BB%86%E8%8A%82)
* [使用示例](https://kilocode.ai/docs/zh-CN/features/tools/execute-command#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B)
* [用法示例](https://kilocode.ai/docs/zh-CN/features/tools/execute-command#%E7%94%A8%E6%B3%95%E7%A4%BA%E4%BE%8B)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Ftools%2Fexecute-command)
---
# 技巧与窍门 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/tips-and-tricks#__docusaurus_skipToContent_fallback)
一些快速提示,帮助你充分利用 Kilo Code。
* 将 Kilo Code 拖到[侧边栏](https://code.visualstudio.com/api/ux-guidelines/sidebars#secondary-sidebar)
,以便同时查看资源管理器、搜索、源代码控制等。
* 当 Kilo Code 位于与文件资源管理器分开的侧边栏时,你可以将文件从资源管理器拖到聊天窗口中(甚至可以一次拖多个文件)。只需在开始拖动文件后按住 shift 键。
* 如果你不使用[MCP](https://kilocode.ai/docs/zh-CN/features/mcp/overview)
,请在 提示选项卡中关闭它,以显著减少系统提示的大小。
* 为了保持[自定义模式](https://kilocode.ai/docs/zh-CN/features/custom-modes)
的正轨,请限制它们可以编辑的文件类型。
* 如果你遇到`input length and max tokens exceed context limit`错误,可以通过删除消息、回滚到之前的检查点或切换到具有长上下文窗口的模型(如 Gemini)来恢复。
* 一般来说,对于思考模型的`Max Tokens`设置要深思熟虑。你分配的每个 token 都会占用存储对话历史的空间。考虑仅在 Architect 和 Debug 等模式中使用高`Max Tokens` / `Max Thinking Tokens`设置,并将 Code 模式保持在 16k max tokens 或更少。
* 如果有一个你希望自定义模式完成的任务的真实职位发布,可以尝试要求 Code 模式`根据@[url]的职位发布创建一个自定义模式`。
* 如果你想真正加速,可以检出多个代码库副本并在所有副本上并行运行 Kilo Code(使用 git 解决任何冲突,与人类开发人员相同)。
* 使用 Debug 模式时,要求 Kilo "在 Debug 模式下启动一个新任务,包含解决 X 所需的所有必要上下文",以便调试过程使用其自己的上下文窗口,而不会污染主任务。
* 点击下方的"编辑此页面"添加你自己的技巧!
* 为了管理大文件并减少上下文/资源使用,请调整`File read auto-truncate threshold`设置。此设置控制一次读取文件的行数。较低的值可以提高处理非常大文件时的性能,但可能需要更多的读取操作。你可以在 Kilo Code 设置的"高级设置"中找到此设置。
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ftips-and-tricks)
---
# list_files | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/tools/list-files#__docusaurus_skipToContent_fallback)
本页总览
`list_files` 工具显示指定位置中的文件和目录。它帮助 Kilo Code 理解您的项目结构并有效地导航代码库。
参数[](https://kilocode.ai/docs/zh-CN/features/tools/list-files#%E5%8F%82%E6%95%B0 "参数的直接链接")
---------------------------------------------------------------------------------------------
该工具接受以下参数:
* `path`(必填):要列出内容的目录路径,相对于当前工作目录
* `recursive`(可选):是否递归列出文件。使用 `true` 进行递归列出,`false` 或省略则仅列出顶层内容。
功能[](https://kilocode.ai/docs/zh-CN/features/tools/list-files#%E5%8A%9F%E8%83%BD "功能的直接链接")
---------------------------------------------------------------------------------------------
该工具列出指定位置中的所有文件和目录,提供项目结构的清晰概览。它可以仅显示顶层内容,也可以递归探索子目录。
使用场景[](https://kilocode.ai/docs/zh-CN/features/tools/list-files#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF "使用场景的直接链接")
-------------------------------------------------------------------------------------------------------------------
* 当 Kilo Code 需要理解您的项目结构时
* 当 Kilo Code 在读取特定文件之前探索可用文件时
* 当 Kilo Code 映射代码库以更好地理解其组织方式时
* 在使用更针对性的工具(如 `read_file` 或 `search_files`)之前
* 当 Kilo Code 需要检查项目中特定类型的文件(如配置文件)时
主要特性[](https://kilocode.ai/docs/zh-CN/features/tools/list-files#%E4%B8%BB%E8%A6%81%E7%89%B9%E6%80%A7 "主要特性的直接链接")
-------------------------------------------------------------------------------------------------------------------
* 列出文件和目录,并明确标记目录
* 提供递归和非递归两种列出模式
* 在递归模式下,智能忽略常见的大型目录(如 `node_modules` 和 `.git`)
* 在递归模式下,遵循 `.gitignore` 规则
* 当启用 `showKiloCodeIgnoredFiles` 时,用锁符号(🔒)标记被 `.kilocodeignore` 忽略的文件
* 通过逐级目录遍历优化性能
* 排序结果,先显示目录及其内容,保持逻辑层次结构
* 以干净、有组织的方式呈现结果
* 自动创建项目结构的思维导图
限制[](https://kilocode.ai/docs/zh-CN/features/tools/list-files#%E9%99%90%E5%88%B6 "限制的直接链接")
---------------------------------------------------------------------------------------------
* 默认情况下,文件列出上限约为 200 个,以防止性能问题
* 目录遍历有 10 秒的超时限制,以防止在复杂目录结构中挂起
* 当达到文件限制时,会添加注释建议对特定子目录使用 `list_files`
* 不能用于确认您刚刚创建的文件是否存在
* 在非常大的目录结构中,性能可能降低
* 出于安全原因,无法列出根目录或主目录中的文件
工作原理[](https://kilocode.ai/docs/zh-CN/features/tools/list-files#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86 "工作原理的直接链接")
-------------------------------------------------------------------------------------------------------------------
当调用 `list_files` 工具时,它会遵循以下流程:
1. **参数验证**:验证必填的 `path` 参数和可选的 `recursive` 参数
2. **路径解析**:将相对路径解析为绝对路径
3. **安全检查**:防止列出根目录或主目录等敏感位置中的文件
4. **目录扫描**:
* 对于非递归模式:仅列出顶层内容
* 对于递归模式:逐级遍历目录结构,超时时间为 10 秒
* 如果超时,则返回已收集的部分结果
5. **结果过滤**:
* 在递归模式下,跳过常见的大型目录,如 `node_modules`、`.git` 等
* 在递归模式下,遵循 `.gitignore` 规则
* 处理 `.kilocodeignore` 规则,要么隐藏文件,要么用锁符号标记
6. **格式化**:
* 用斜杠(`/`)标记目录
* 排序结果,先显示目录及其内容,保持逻辑层次结构
* 当启用 `showKiloCodeIgnored` 时,用锁符号(🔒)标记被忽略的文件
* 默认情况下,结果上限为 200 个文件,并提示使用子目录
* 组织结果以提高可读性
文件列出格式[](https://kilocode.ai/docs/zh-CN/features/tools/list-files#%E6%96%87%E4%BB%B6%E5%88%97%E5%87%BA%E6%A0%BC%E5%BC%8F "文件列出格式的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------------
文件列出结果包括:
* 每个文件路径显示在其自己的行上
* 目录用斜杠(`/`)标记
* 当启用 `showKiloCodeIgnored` 时,被 `.kilocodeignore` 忽略的文件用锁符号(🔒)标记
* 结果按逻辑排序,先显示目录及其内容
* 当达到文件限制时,会出现一条消息,建议对特定子目录使用 `list_files`
示例输出格式:
src/ src/components/ src/components/Button.tsx src/components/Header.tsx src/utils/ src/utils/helpers.ts src/index.ts ... 文件列出已截断(显示 200 个文件中的 543 个)。请对特定子目录使用 list_files 以获取更多详细信息。
当使用 `.kilocodeignore` 文件并启用 `showKiloCodeIgnored` 时:
src/ src/components/ src/components/Button.tsx src/components/Header.tsx 🔒 src/secrets.json src/utils/ src/utils/helpers.ts src/index.ts
使用示例[](https://kilocode.ai/docs/zh-CN/features/tools/list-files#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B "使用示例的直接链接")
-------------------------------------------------------------------------------------------------------------------
* 当开始新任务时,Kilo Code 可能会列出项目文件以了解其结构,然后再深入研究特定代码。
* 当被要求查找特定类型的文件(如所有 JavaScript 文件)时,Kilo Code 首先列出目录以知道在哪里查找。
* 当提供代码组织建议时,Kilo Code 首先检查当前项目结构。
* 当设置新功能时,Kilo Code 列出相关目录以了解项目约定。
用法示例[](https://kilocode.ai/docs/zh-CN/features/tools/list-files#%E7%94%A8%E6%B3%95%E7%A4%BA%E4%BE%8B "用法示例的直接链接")
-------------------------------------------------------------------------------------------------------------------
列出当前目录中的顶层文件:
.
递归列出源目录中的所有文件:
srctrue
检查特定项目的子目录:
src/componentsfalse
* [参数](https://kilocode.ai/docs/zh-CN/features/tools/list-files#%E5%8F%82%E6%95%B0)
* [功能](https://kilocode.ai/docs/zh-CN/features/tools/list-files#%E5%8A%9F%E8%83%BD)
* [使用场景](https://kilocode.ai/docs/zh-CN/features/tools/list-files#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF)
* [主要特性](https://kilocode.ai/docs/zh-CN/features/tools/list-files#%E4%B8%BB%E8%A6%81%E7%89%B9%E6%80%A7)
* [限制](https://kilocode.ai/docs/zh-CN/features/tools/list-files#%E9%99%90%E5%88%B6)
* [工作原理](https://kilocode.ai/docs/zh-CN/features/tools/list-files#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86)
* [文件列出格式](https://kilocode.ai/docs/zh-CN/features/tools/list-files#%E6%96%87%E4%BB%B6%E5%88%97%E5%87%BA%E6%A0%BC%E5%BC%8F)
* [使用示例](https://kilocode.ai/docs/zh-CN/features/tools/list-files#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B)
* [用法示例](https://kilocode.ai/docs/zh-CN/features/tools/list-files#%E7%94%A8%E6%B3%95%E7%A4%BA%E4%BE%8B)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Ftools%2Flist-files)
---
# search_files | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/tools/search-files#__docusaurus_skipToContent_fallback)
本页总览
`search_files` 工具可以在你的项目中跨多个文件执行正则表达式搜索。它帮助 Kilo Code 在代码库中定位特定的代码模式、文本或其他内容,并提供上下文的搜索结果。
参数[](https://kilocode.ai/docs/zh-CN/features/tools/search-files#%E5%8F%82%E6%95%B0 "参数的直接链接")
-----------------------------------------------------------------------------------------------
该工具接受以下参数:
* `path`(必填):要搜索的目录路径,相对于当前工作目录
* `regex`(必填):要搜索的正则表达式模式(使用 Rust 正则表达式语法)
* `file_pattern`(可选):用于过滤文件的 glob 模式(例如,'\*.ts' 表示仅搜索 TypeScript 文件)
功能[](https://kilocode.ai/docs/zh-CN/features/tools/search-files#%E5%8A%9F%E8%83%BD "功能的直接链接")
-----------------------------------------------------------------------------------------------
该工具使用正则表达式在指定目录中跨文件搜索,显示每个匹配项及其上下文。它就像一个强大的“在文件中查找”功能,适用于整个项目结构。
使用场景[](https://kilocode.ai/docs/zh-CN/features/tools/search-files#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF "使用场景的直接链接")
---------------------------------------------------------------------------------------------------------------------
* 当 Kilo Code 需要查找特定函数或变量的使用位置时
* 当 Kilo Code 协助重构并需要了解使用模式时
* 当 Kilo Code 需要定位特定代码模式的所有实例时
* 当 Kilo Code 需要在多个文件中搜索文本并具有过滤功能时
主要特性[](https://kilocode.ai/docs/zh-CN/features/tools/search-files#%E4%B8%BB%E8%A6%81%E7%89%B9%E6%80%A7 "主要特性的直接链接")
---------------------------------------------------------------------------------------------------------------------
* 使用高性能的 Ripgrep 在多个文件中进行搜索
* 显示每个匹配项的上下文(前后各 1 行)
* 使用 glob 模式按文件类型过滤(例如,仅 TypeScript 文件)
* 提供行号以便参考
* 使用强大的正则表达式模式进行精确搜索
* 自动限制输出为 300 个结果并通知
* 截断超过 500 个字符的行并标记为“\[truncated...\]”
* 智能地将附近的匹配项合并为单个块以提高可读性
限制[](https://kilocode.ai/docs/zh-CN/features/tools/search-files#%E9%99%90%E5%88%B6 "限制的直接链接")
-----------------------------------------------------------------------------------------------
* 最适合文本文件(对图像等二进制文件无效)
* 在非常大的代码库中性能可能会下降
* 使用 Rust 正则表达式语法,可能与其他正则表达式实现略有不同
* 无法在压缩文件或存档中搜索
* 默认上下文大小固定(前后各 1 行)
* 由于结果分组,当匹配项接近时可能会显示不同的上下文大小
工作原理[](https://kilocode.ai/docs/zh-CN/features/tools/search-files#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86 "工作原理的直接链接")
---------------------------------------------------------------------------------------------------------------------
当调用 `search_files` 工具时,它会遵循以下流程:
1. **参数验证**:验证必需的 `path` 和 `regex` 参数
2. **路径解析**:将相对路径解析为绝对路径
3. **搜索执行**:
* 使用 Ripgrep (rg) 进行高性能文本搜索
* 如果指定了文件模式,则应用过滤
* 收集匹配项及其上下文
4. **结果格式化**:
* 格式化结果,包括文件路径、行号和上下文
* 显示每个匹配项前后各 1 行的上下文
* 结构化输出以便于阅读
* 将结果限制为最多 300 个匹配项并通知
* 截断超过 500 个字符的行
* 将附近的匹配项合并为连续块
搜索结果格式[](https://kilocode.ai/docs/zh-CN/features/tools/search-files#%E6%90%9C%E7%B4%A2%E7%BB%93%E6%9E%9C%E6%A0%BC%E5%BC%8F "搜索结果格式的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------------
搜索结果包括:
* 每个匹配文件的相对路径(前缀为 #)
* 每个匹配项前后的上下文行(默认为 1 行)
* 行号填充为 3 个空格,后跟 `|` 和行内容
* 每个匹配组后跟分隔线(----)
示例输出格式:
# rel/path/to/app.ts 11 | // 一些处理逻辑 12 | // TODO: 实现错误处理 13 | return processedData;----# 显示 300 多个结果中的前 300 个。如有必要,请使用更具体的搜索。
当匹配项彼此接近时,它们会合并为单个块而不是显示为单独的结果:
# rel/path/to/auth.ts 13 | // 一些代码 14 | // TODO: 添加适当的验证 15 | function validateUser(credentials) { 16 | // TODO: 实现速率限制 17 | return checkDatabase(credentials);----
使用示例[](https://kilocode.ai/docs/zh-CN/features/tools/search-files#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B "使用示例的直接链接")
---------------------------------------------------------------------------------------------------------------------
搜索所有 JavaScript 文件中的 TODO 注释:
srcTODO|FIXME*.js
查找特定函数的所有使用位置:
.function\s+calculateTotal*.{js,ts}
在整个项目中搜索特定的导入模式:
.import\s+.*\s+from\s+['"]@components/
* [参数](https://kilocode.ai/docs/zh-CN/features/tools/search-files#%E5%8F%82%E6%95%B0)
* [功能](https://kilocode.ai/docs/zh-CN/features/tools/search-files#%E5%8A%9F%E8%83%BD)
* [使用场景](https://kilocode.ai/docs/zh-CN/features/tools/search-files#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF)
* [主要特性](https://kilocode.ai/docs/zh-CN/features/tools/search-files#%E4%B8%BB%E8%A6%81%E7%89%B9%E6%80%A7)
* [限制](https://kilocode.ai/docs/zh-CN/features/tools/search-files#%E9%99%90%E5%88%B6)
* [工作原理](https://kilocode.ai/docs/zh-CN/features/tools/search-files#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86)
* [搜索结果格式](https://kilocode.ai/docs/zh-CN/features/tools/search-files#%E6%90%9C%E7%B4%A2%E7%BB%93%E6%9E%9C%E6%A0%BC%E5%BC%8F)
* [使用示例](https://kilocode.ai/docs/zh-CN/features/tools/search-files#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Ftools%2Fsearch-files)
---
# list_code_definition_names | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/tools/list-code-definition-names#__docusaurus_skipToContent_fallback)
本页总览
`list_code_definition_names` 工具通过列出指定目录顶层源代码文件中的代码定义,为您的代码库提供结构化概览。它通过显示行号和定义片段,帮助 Kilo Code 理解代码架构。
参数[](https://kilocode.ai/docs/zh-CN/features/tools/list-code-definition-names#%E5%8F%82%E6%95%B0 "参数的直接链接")
-------------------------------------------------------------------------------------------------------------
该工具接受以下参数:
* `path`(必填):要列出顶层源代码定义的目录路径,相对于当前工作目录
功能[](https://kilocode.ai/docs/zh-CN/features/tools/list-code-definition-names#%E5%8A%9F%E8%83%BD "功能的直接链接")
-------------------------------------------------------------------------------------------------------------
该工具扫描指定目录顶层的源代码文件,并提取类、函数和接口等代码定义。它显示每个定义的行号和实际代码,以便快速映射代码库的重要组件。
使用场景[](https://kilocode.ai/docs/zh-CN/features/tools/list-code-definition-names#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF "使用场景的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------
* 当 Kilo Code 需要快速理解您的代码库架构时
* 当 Kilo Code 需要定位多个文件中的重要代码结构时
* 在计划重构或扩展现有代码时
* 在使用其他工具深入研究实现细节之前
* 在识别代码库不同部分之间的关系时
主要特性[](https://kilocode.ai/docs/zh-CN/features/tools/list-code-definition-names#%E4%B8%BB%E8%A6%81%E7%89%B9%E6%80%A7 "主要特性的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------
* 从源代码文件中提取类、函数、方法、接口等定义
* 显示每个定义的行号和实际源代码
* 支持多种编程语言,包括 JavaScript、TypeScript、Python、Rust、Go、C++、C、C#、Ruby、Java、PHP、Swift 和 Kotlin
* 仅处理指定目录顶层的文件(不包括子目录)
* 为提升性能,最多处理 50 个文件
* 专注于顶层定义,避免过多细节
* 帮助识别项目中的代码组织模式
* 创建代码库架构的思维导图
* 与其他工具(如 `read_file`)结合使用,进行更深入的分析
限制[](https://kilocode.ai/docs/zh-CN/features/tools/list-code-definition-names#%E9%99%90%E5%88%B6 "限制的直接链接")
-------------------------------------------------------------------------------------------------------------
* 仅识别顶层定义,不包括嵌套定义
* 仅处理指定目录顶层的文件,不包括子目录
* 每次请求最多处理 50 个文件
* 依赖于语言特定的解析器,检测质量可能有所不同
* 对于语法复杂的语言,可能无法识别所有定义
* 不能替代阅读代码以了解实现细节
* 无法检测运行时模式或动态代码关系
* 不提供有关定义使用情况的信息
* 对于高度动态或元编程的代码,准确性可能降低
* 仅限于 Tree-sitter 解析器支持的语言
工作原理[](https://kilocode.ai/docs/zh-CN/features/tools/list-code-definition-names#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86 "工作原理的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------
当调用 `list_code_definitions_names` 工具时,它会遵循以下流程:
1. **参数验证**:验证必填的 `path` 参数
2. **路径解析**:将相对路径解析为绝对路径
3. **目录扫描**:仅扫描指定目录顶层的源代码文件(非递归)
4. **文件过滤**:最多处理 50 个文件
5. **语言检测**:根据文件扩展名识别文件类型(.js、.jsx、.ts、.tsx、.py、.rs、.go、.cpp、.hpp、.c、.h、.cs、.rb、.java、.php、.swift、.kt、.kts)
6. **代码解析**:使用 Tree-sitter 解析代码并通过以下步骤提取定义:
* 将文件内容解析为抽象语法树 (AST)
* 使用语言特定的查询字符串创建查询
* 按文件中的位置对捕获进行排序
7. **结果格式化**:输出定义及其行号和实际源代码
输出格式[](https://kilocode.ai/docs/zh-CN/features/tools/list-code-definition-names#%E8%BE%93%E5%87%BA%E6%A0%BC%E5%BC%8F "输出格式的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------
输出显示文件路径,后跟定义的行号和实际源代码。例如:
src/utils.js: 0--0 | export class HttpClient { 5--5 | formatDate() { 10--10 | function parseConfig(data) { src/models/User.js: 0--0 | interface UserProfile { 10--10 | export class User { 20--20 | function createUser(data) {
每行显示:
* 定义的起始和结束行号
* 分隔符(|)
* 定义的实际源代码
这种输出格式帮助您快速查看定义在文件中的位置及其实现细节。
使用示例[](https://kilocode.ai/docs/zh-CN/features/tools/list-code-definition-names#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B "使用示例的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------
* 当开始新任务时,Kilo Code 首先列出关键代码定义以了解项目的整体结构。
* 当计划重构工作时,Kilo Code 使用此工具识别可能受影响的类和函数。
* 在探索不熟悉的代码库时,Kilo Code 在深入研究实现细节之前映射重要代码结构。
* 当添加新功能时,Kilo Code 识别现有模式和相关的代码定义以保持一致性。
* 当排查错误时,Kilo Code 映射代码库结构以定位问题的潜在来源。
* 当计划架构更改时,Kilo Code 识别所有受影响的组件。
用法示例[](https://kilocode.ai/docs/zh-CN/features/tools/list-code-definition-names#%E7%94%A8%E6%B3%95%E7%A4%BA%E4%BE%8B "用法示例的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------
列出当前目录中的代码定义:
.
检查特定模块的结构:
src/components
探索工具库:
lib/utils
* [参数](https://kilocode.ai/docs/zh-CN/features/tools/list-code-definition-names#%E5%8F%82%E6%95%B0)
* [功能](https://kilocode.ai/docs/zh-CN/features/tools/list-code-definition-names#%E5%8A%9F%E8%83%BD)
* [使用场景](https://kilocode.ai/docs/zh-CN/features/tools/list-code-definition-names#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF)
* [主要特性](https://kilocode.ai/docs/zh-CN/features/tools/list-code-definition-names#%E4%B8%BB%E8%A6%81%E7%89%B9%E6%80%A7)
* [限制](https://kilocode.ai/docs/zh-CN/features/tools/list-code-definition-names#%E9%99%90%E5%88%B6)
* [工作原理](https://kilocode.ai/docs/zh-CN/features/tools/list-code-definition-names#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86)
* [输出格式](https://kilocode.ai/docs/zh-CN/features/tools/list-code-definition-names#%E8%BE%93%E5%87%BA%E6%A0%BC%E5%BC%8F)
* [使用示例](https://kilocode.ai/docs/zh-CN/features/tools/list-code-definition-names#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B)
* [用法示例](https://kilocode.ai/docs/zh-CN/features/tools/list-code-definition-names#%E7%94%A8%E6%B3%95%E7%A4%BA%E4%BE%8B)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Ftools%2Flist-code-definition-names)
---
# new_task | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/tools/new-task#__docusaurus_skipToContent_fallback)
本页总览
`new_task` 工具创建具有专用模式的子任务,同时维护父子关系。它将复杂项目分解为可管理的部分,每个部分在最适合特定工作的模式下运行。
参数[](https://kilocode.ai/docs/zh-CN/features/tools/new-task#%E5%8F%82%E6%95%B0 "参数的直接链接")
-------------------------------------------------------------------------------------------
该工具接受以下参数:
* `mode`(必填):要启动新任务的模式的 slug(例如,"code"、"ask"、"architect")
* `message`(必填):此新任务的初始用户消息或指令
功能[](https://kilocode.ai/docs/zh-CN/features/tools/new-task#%E5%8A%9F%E8%83%BD "功能的直接链接")
-------------------------------------------------------------------------------------------
该工具创建一个具有指定启动模式和初始消息的新任务实例。它允许将复杂的工作流划分为具有自己对话历史的子任务。父任务在子任务执行期间暂停,并在子任务完成时恢复,结果传递回父任务。
使用场景[](https://kilocode.ai/docs/zh-CN/features/tools/new-task#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF "使用场景的直接链接")
-----------------------------------------------------------------------------------------------------------------
* 当将复杂项目分解为独立的、专注的子任务时
* 当任务的不同方面需要不同的专用模式时
* 当工作的不同阶段受益于上下文分离时
* 当组织多阶段开发工作流时
主要特性[](https://kilocode.ai/docs/zh-CN/features/tools/new-task#%E4%B8%BB%E8%A6%81%E7%89%B9%E6%80%A7 "主要特性的直接链接")
-----------------------------------------------------------------------------------------------------------------
* 创建具有自己对话历史和专用模式的子任务
* 暂停父任务以便稍后恢复
* 维护分层任务关系以便导航
* 在完成后将结果传递回父任务
* 支持复杂项目的工作流隔离
* 允许项目的不同部分使用针对特定工作优化的模式
* 需要用户明确批准任务创建
* 在 UI 中提供清晰的任务过渡
限制[](https://kilocode.ai/docs/zh-CN/features/tools/new-task#%E9%99%90%E5%88%B6 "限制的直接链接")
-------------------------------------------------------------------------------------------
* 无法创建不存在的模式的任务
* 创建每个新任务前需要用户批准
* 任务界面在深度嵌套子任务时可能变得复杂
* 子任务从父任务继承某些工作区和扩展配置
* 在切换深度嵌套任务时可能需要重新建立上下文
* 任务完成需要明确信号以正确返回到父任务
工作原理[](https://kilocode.ai/docs/zh-CN/features/tools/new-task#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86 "工作原理的直接链接")
-----------------------------------------------------------------------------------------------------------------
当调用 `new_task` 工具时,它会遵循以下流程:
1. **参数验证**:
* 验证必填的 `mode` 和 `message` 参数
* 确认请求的模式存在于系统中
2. **任务栈管理**:
* 维护一个任务栈以跟踪所有活动任务和暂停任务
* 保留当前模式以便稍后恢复
* 将父任务设置为暂停状态
3. **任务上下文管理**:
* 使用提供的消息创建新的任务上下文
* 分配唯一的 taskId 和 instanceId 标识符以进行状态管理
* 捕获有关工具使用和任务生命周期的遥测数据
4. **模式切换和集成**:
* 切换到指定模式,并应用相应的角色和能力
* 使用提供的消息初始化新任务
* 与 VS Code 的命令面板和代码操作集成
5. **任务完成和结果传递**:
* 当子任务完成时,结果通过 `finishSubTask()` 传递回父任务
* 父任务恢复其原始模式
* 更新任务历史和令牌使用指标
* 发出 `taskCompleted` 事件并附带性能数据
使用示例[](https://kilocode.ai/docs/zh-CN/features/tools/new-task#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B "使用示例的直接链接")
-----------------------------------------------------------------------------------------------------------------
* 当前端开发人员需要架构新功能、实现代码并编写文档时,他们可以为每个阶段创建单独的任务,结果从一个阶段传递到下一个阶段。
* 在调试问题并实施修复之前,调试任务可以记录发现的结果,并将其传递给实施任务。
* 在开发全栈应用程序时,来自架构模式任务的数据库模式设计会告知后续代码模式任务的实施细节。
* 在实施完成后编写系统文档时,文档任务可以参考已完成的实施,同时使用文档专用功能。
用法示例[](https://kilocode.ai/docs/zh-CN/features/tools/new-task#%E7%94%A8%E6%B3%95%E7%A4%BA%E4%BE%8B "用法示例的直接链接")
-----------------------------------------------------------------------------------------------------------------
在代码模式中创建新任务:
code实现具有登录、注册和密码重置功能的用户身份验证服务。
在完成实施后创建文档任务:
docs为我们刚刚构建的身份验证服务创建全面的 API 文档。
将复杂功能分解为架构规划和实施:
architect为我们新的电子商务平台设计数据库模式和系统架构。
* [参数](https://kilocode.ai/docs/zh-CN/features/tools/new-task#%E5%8F%82%E6%95%B0)
* [功能](https://kilocode.ai/docs/zh-CN/features/tools/new-task#%E5%8A%9F%E8%83%BD)
* [使用场景](https://kilocode.ai/docs/zh-CN/features/tools/new-task#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF)
* [主要特性](https://kilocode.ai/docs/zh-CN/features/tools/new-task#%E4%B8%BB%E8%A6%81%E7%89%B9%E6%80%A7)
* [限制](https://kilocode.ai/docs/zh-CN/features/tools/new-task#%E9%99%90%E5%88%B6)
* [工作原理](https://kilocode.ai/docs/zh-CN/features/tools/new-task#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86)
* [使用示例](https://kilocode.ai/docs/zh-CN/features/tools/new-task#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B)
* [用法示例](https://kilocode.ai/docs/zh-CN/features/tools/new-task#%E7%94%A8%E6%B3%95%E7%A4%BA%E4%BE%8B)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Ftools%2Fnew-task)
---
# switch_mode | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode#__docusaurus_skipToContent_fallback)
本页总览
`switch_mode` 工具使 Kilo Code 能够在不同操作模式之间切换,每种模式都具有针对特定任务类型的专业能力。当当前任务需要不同的专业知识时,可以无缝切换到 Code、Architect、Ask 或 Debug 模式。
参数[](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode#%E5%8F%82%E6%95%B0 "参数的直接链接")
----------------------------------------------------------------------------------------------
该工具接受以下参数:
* `mode_slug`(必填):要切换到的模式标识符(例如 "code"、"ask"、"architect")
* `reason`(可选):切换模式的原因,为用户提供上下文
功能[](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode#%E5%8A%9F%E8%83%BD "功能的直接链接")
----------------------------------------------------------------------------------------------
该工具在当当前任务更适合由其他模式处理时请求模式切换。它在切换过程中保持上下文,同时调整 Kilo Code 的焦点和可用工具集,以匹配新任务阶段的需求。
使用场景[](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF "使用场景的直接链接")
--------------------------------------------------------------------------------------------------------------------
* 从信息收集过渡到代码实现时
* 从编码切换到架构或设计时
* 当前任务需要仅在另一个模式中可用的功能时
* 复杂项目的特定阶段需要专业知识时
主要特性[](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode#%E4%B8%BB%E8%A6%81%E7%89%B9%E6%80%A7 "主要特性的直接链接")
--------------------------------------------------------------------------------------------------------------------
* 在模式切换过程中保持上下文连续性
* 为模式切换提供清晰的推理
* 需要用户批准所有模式更改
* 强制执行特定模式的工具组限制
* 根据所选模式无缝调整工具可用性
* 适用于标准和自定义模式
* 在 UI 中显示模式切换和原因
* 使用 XML 格式指定参数
* 强制执行某些模式的文件类型限制
限制[](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode#%E9%99%90%E5%88%B6 "限制的直接链接")
----------------------------------------------------------------------------------------------
* 无法切换到系统中不存在的模式
* 每次模式转换都需要用户明确批准
* 在切换完成前无法使用特定模式的工具
* 模式切换后应用 500ms 的延迟以确保更改生效
* 某些模式有文件类型限制(例如 Architect 模式只能编辑 markdown 文件)
* 模式保存仅适用于 `new_task` 功能,不适用于一般模式切换
工作原理[](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86 "工作原理的直接链接")
--------------------------------------------------------------------------------------------------------------------
当调用 `switch_mode` 工具时,它会遵循以下流程:
1. **请求验证**:
* 验证请求的模式是否存在于系统中
* 检查是否提供了 `mode_slug` 参数且有效
* 确认用户尚未处于请求的模式
* 确保 `reason` 参数(如果提供)格式正确
2. **模式切换准备**:
* 将模式更改请求与提供的原因打包
* 向用户展示更改请求以获取批准
3. **模式激活(用户批准后)**:
* 更新 UI 以反映新模式
* 根据模式的工具组配置调整可用工具
* 应用模式特定的提示和行为
* 应用 500ms 延迟以确保更改生效再执行下一个工具
* 强制执行模式特定的文件限制
4. **继续执行**:
* 使用新模式的功能继续任务
* 保留之前交互的相关上下文
工具组关联[](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode#%E5%B7%A5%E5%85%B7%E7%BB%84%E5%85%B3%E8%81%94 "工具组关联的直接链接")
-------------------------------------------------------------------------------------------------------------------------------
`switch_mode` 工具属于 "modes" 工具组,但也包含在 "always available" 工具列表中。这意味着:
* 它可以在任何模式下使用,不受模式配置的工具组限制
* 它与 `ask_followup_question` 和 `attempt_completion` 等核心工具一起可用
* 它允许在工作流的任何阶段进行模式切换,以适应任务需求的变化
模式结构[](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode#%E6%A8%A1%E5%BC%8F%E7%BB%93%E6%9E%84 "模式结构的直接链接")
--------------------------------------------------------------------------------------------------------------------
系统中的每个模式都有特定的结构:
* `slug`:模式的唯一标识符(例如 "code"、"ask")
* `name`:模式的显示名称(例如 "Code"、"Ask")
* `roleDefinition`:模式的专业角色和能力
* `customInstructions`:可选的模式特定指令,用于指导行为
* `groups`:模式可用的工具组,可设置限制
模式能力[](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode#%E6%A8%A1%E5%BC%8F%E8%83%BD%E5%8A%9B "模式能力的直接链接")
--------------------------------------------------------------------------------------------------------------------
核心模式提供以下专业能力:
* **Code 模式**:专注于编码任务,完全访问代码编辑工具
* **Architect 模式**:专用于系统设计和架构规划,仅限于编辑 markdown 文件
* **Ask 模式**:优化用于回答问题并提供信息
* **Debug 模式**:配备用于系统问题诊断和解决
自定义模式[](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode#%E8%87%AA%E5%AE%9A%E4%B9%89%E6%A8%A1%E5%BC%8F "自定义模式的直接链接")
-------------------------------------------------------------------------------------------------------------------------------
除了核心模式外,系统还支持特定项目的自定义模式:
* 可以定义具有特定工具组启用的自定义模式
* 可以指定自定义角色定义和指令
* 系统会先检查自定义模式,然后再回退到核心模式
* 自定义模式定义优先于具有相同标识符的核心模式
文件限制[](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode#%E6%96%87%E4%BB%B6%E9%99%90%E5%88%B6 "文件限制的直接链接")
--------------------------------------------------------------------------------------------------------------------
不同的模式可能有特定的文件类型限制:
* **Architect 模式**:只能编辑扩展名为 `.md` 的文件
* 尝试编辑受限制的文件类型会导致 `FileRestrictionError`
* 这些限制有助于在模式之间强制执行适当的关注点分离
使用示例[](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B "使用示例的直接链接")
--------------------------------------------------------------------------------------------------------------------
* 讨论新功能时,Kilo Code 从 Ask 模式切换到 Architect 模式以帮助设计系统结构。
* 在 Architect 模式中完成架构规划后,Kilo Code 切换到 Code 模式以实现设计的功能。
* 在开发过程中遇到错误时,Kilo Code 从 Code 模式切换到 Debug 模式进行系统问题排查。
使用示例[](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B-1 "使用示例的直接链接")
----------------------------------------------------------------------------------------------------------------------
切换到 Code 模式进行实现:
code需要基于我们讨论的架构实现登录功能
切换到 Architect 模式进行设计:
architect需要在实现前设计系统架构
切换到 Debug 模式进行问题排查:
debug需要系统诊断认证错误
切换到 Ask 模式获取信息:
ask需要回答关于已实现功能的问题
* [参数](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode#%E5%8F%82%E6%95%B0)
* [功能](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode#%E5%8A%9F%E8%83%BD)
* [使用场景](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF)
* [主要特性](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode#%E4%B8%BB%E8%A6%81%E7%89%B9%E6%80%A7)
* [限制](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode#%E9%99%90%E5%88%B6)
* [工作原理](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86)
* [工具组关联](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode#%E5%B7%A5%E5%85%B7%E7%BB%84%E5%85%B3%E8%81%94)
* [模式结构](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode#%E6%A8%A1%E5%BC%8F%E7%BB%93%E6%9E%84)
* [模式能力](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode#%E6%A8%A1%E5%BC%8F%E8%83%BD%E5%8A%9B)
* [自定义模式](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode#%E8%87%AA%E5%AE%9A%E4%B9%89%E6%A8%A1%E5%BC%8F)
* [文件限制](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode#%E6%96%87%E4%BB%B6%E9%99%90%E5%88%B6)
* [使用示例](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B)
* [使用示例](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B-1)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Ftools%2Fswitch-mode)
---
# read_file | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/tools/read-file#__docusaurus_skipToContent_fallback)
本页总览
`read_file`工具用于读取项目中的文件内容。它允许 Kilo Code 理解代码、配置文件和文档,以提供更好的协助。
参数[](https://kilocode.ai/docs/zh-CN/features/tools/read-file#%E5%8F%82%E6%95%B0 "参数的直接链接")
--------------------------------------------------------------------------------------------
该工具接受以下参数:
* `path`(必需):要读取的文件路径(相对于当前工作目录)
* `start_line`(可选):开始读取的行号(从1开始)
* `end_line`(可选):结束读取的行号(从1开始,包含该行)
* `auto_truncate`(可选):当未指定行范围时,是否自动截断大文件(true/false)
功能[](https://kilocode.ai/docs/zh-CN/features/tools/read-file#%E5%8A%9F%E8%83%BD "功能的直接链接")
--------------------------------------------------------------------------------------------
该工具读取指定文件的内容并返回带行号的结果,便于参考。它可以读取整个文件或特定部分,甚至能从PDF和Word文档中提取文本。
使用场景[](https://kilocode.ai/docs/zh-CN/features/tools/read-file#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF "使用场景的直接链接")
------------------------------------------------------------------------------------------------------------------
* 当 Kilo Code 需要理解现有代码结构时
* 当 Kilo Code 需要分析配置文件时
* 当 Kilo Code 需要从文本文件中提取信息时
* 当 Kilo Code 在建议更改前需要查看代码时
* 当需要在讨论中引用特定行号时
主要特性[](https://kilocode.ai/docs/zh-CN/features/tools/read-file#%E4%B8%BB%E8%A6%81%E7%89%B9%E6%80%A7 "主要特性的直接链接")
------------------------------------------------------------------------------------------------------------------
* 显示带行号的文件内容,便于参考
* 通过指定行范围读取文件的特定部分
* 从PDF和DOCX文件中提取可读文本
* 智能截断大文件以聚焦最相关部分
* 为大型代码文件提供带行范围的方法摘要
* 高效流式传输请求的行范围以获得更好性能
* 便于通过行号讨论代码的特定部分
限制[](https://kilocode.ai/docs/zh-CN/features/tools/read-file#%E9%99%90%E5%88%B6 "限制的直接链接")
--------------------------------------------------------------------------------------------
* 如果不使用行范围参数,可能无法高效处理极大的文件
* 对于二进制文件(除PDF和DOCX外),可能返回非人类可读的内容
工作原理[](https://kilocode.ai/docs/zh-CN/features/tools/read-file#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86 "工作原理的直接链接")
------------------------------------------------------------------------------------------------------------------
当调用`read_file`工具时,它遵循以下流程:
1. **参数验证**:验证必需的`path`参数和可选参数
2. **路径解析**:将相对路径解析为绝对路径
3. **读取策略选择**:
* 工具使用严格的优先级层次(下文详细说明)
* 在范围读取、自动截断或完整文件读取之间选择
4. **内容处理**:
* 为内容添加行号(例如"1 | const x = 13")
* 对于截断文件,添加截断通知和方法定义
* 对于特殊格式(PDF、DOCX、IPYNB),提取可读文本
读取策略优先级[](https://kilocode.ai/docs/zh-CN/features/tools/read-file#%E8%AF%BB%E5%8F%96%E7%AD%96%E7%95%A5%E4%BC%98%E5%85%88%E7%BA%A7 "读取策略优先级的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------------
工具使用明确的决策层次来确定如何读取文件:
1. **第一优先级:显式行范围**
* 如果提供了`start_line`或`end_line`,工具始终执行范围读取
* 实现高效流式传输仅请求的行,适合处理大文件
* 此选项优先于所有其他选项
2. **第二优先级:大文件自动截断**
* 仅在满足以下所有条件时应用:
* 未指定`start_line`或`end_line`
* `auto_truncate`参数设为`true`
* 文件不是二进制文件
* 文件超过配置的行阈值(通常500-1000行)
* 当自动截断激活时,工具:
* 仅读取文件开头部分(由maxReadFileLine设置决定)
* 添加截断通知显示已显示行数与总行数
* 提供带行范围的方法定义摘要
3. **默认行为:读取整个文件**
* 如果不符合上述条件,则读取整个文件内容
* 对于PDF、DOCX和IPYNB等特殊格式,使用专用提取器
使用示例[](https://kilocode.ai/docs/zh-CN/features/tools/read-file#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B "使用示例的直接链接")
------------------------------------------------------------------------------------------------------------------
* 当要求解释或改进代码时,Kilo Code 首先读取相关文件以理解当前实现
* 当排查配置问题时,Kilo Code 读取配置文件以识别潜在问题
* 当处理文档时,Kilo Code 读取现有文档以理解当前内容再建议改进
用法示例[](https://kilocode.ai/docs/zh-CN/features/tools/read-file#%E7%94%A8%E6%B3%95%E7%A4%BA%E4%BE%8B "用法示例的直接链接")
------------------------------------------------------------------------------------------------------------------
以下是几个展示`read_file`工具如何使用及可能收到的典型输出场景。
### 读取整个文件[](https://kilocode.ai/docs/zh-CN/features/tools/read-file#%E8%AF%BB%E5%8F%96%E6%95%B4%E4%B8%AA%E6%96%87%E4%BB%B6 "读取整个文件的直接链接")
读取文件的完整内容:
**输入:**
src/app.js
**模拟输出(小文件如`example_small.txt`):**
1 | This is the first line.2 | This is the second line.3 | This is the third line.
_(输出会根据实际文件内容而变化)_
### 读取特定行[](https://kilocode.ai/docs/zh-CN/features/tools/read-file#%E8%AF%BB%E5%8F%96%E7%89%B9%E5%AE%9A%E8%A1%8C "读取特定行的直接链接")
仅读取特定行范围(例如46-68行):
**输入:**
src/app.js4668
**模拟输出(`example_five_lines.txt`的2-3行):**
2 | Content of line two.3 | Content of line three.
_(输出仅显示请求的行及其原始行号)_
### 读取大文件(自动截断)[](https://kilocode.ai/docs/zh-CN/features/tools/read-file#%E8%AF%BB%E5%8F%96%E5%A4%A7%E6%96%87%E4%BB%B6%E8%87%AA%E5%8A%A8%E6%88%AA%E6%96%AD "读取大文件(自动截断)的直接链接")
当读取大文件且未指定行范围,且`auto_truncate`启用时(或根据设置默认为true):
**输入:**
src/large-module.jstrue
**模拟输出(`large_file.log`有1500行,限制1000行):**
1 | Log entry 1...2 | Log entry 2......1000 | Log entry 1000...[... truncated 500 lines ...]
_(输出限制为配置的最大行数,并带有截断通知)_
### 尝试读取不存在的文件[](https://kilocode.ai/docs/zh-CN/features/tools/read-file#%E5%B0%9D%E8%AF%95%E8%AF%BB%E5%8F%96%E4%B8%8D%E5%AD%98%E5%9C%A8%E7%9A%84%E6%96%87%E4%BB%B6 "尝试读取不存在的文件的直接链接")
如果指定文件不存在:
**输入:**
non_existent_file.txt
**模拟输出(错误):**
Error: File not found at path 'non_existent_file.txt'.
### 尝试读取被阻止的文件[](https://kilocode.ai/docs/zh-CN/features/tools/read-file#%E5%B0%9D%E8%AF%95%E8%AF%BB%E5%8F%96%E8%A2%AB%E9%98%BB%E6%AD%A2%E7%9A%84%E6%96%87%E4%BB%B6 "尝试读取被阻止的文件的直接链接")
如果文件被`.kilocodeignore`规则排除:
**输入:**
.env
**模拟输出(错误):**
Error: Access denied to file '.env' due to .kilocodeignore rules.
* [参数](https://kilocode.ai/docs/zh-CN/features/tools/read-file#%E5%8F%82%E6%95%B0)
* [功能](https://kilocode.ai/docs/zh-CN/features/tools/read-file#%E5%8A%9F%E8%83%BD)
* [使用场景](https://kilocode.ai/docs/zh-CN/features/tools/read-file#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF)
* [主要特性](https://kilocode.ai/docs/zh-CN/features/tools/read-file#%E4%B8%BB%E8%A6%81%E7%89%B9%E6%80%A7)
* [限制](https://kilocode.ai/docs/zh-CN/features/tools/read-file#%E9%99%90%E5%88%B6)
* [工作原理](https://kilocode.ai/docs/zh-CN/features/tools/read-file#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86)
* [读取策略优先级](https://kilocode.ai/docs/zh-CN/features/tools/read-file#%E8%AF%BB%E5%8F%96%E7%AD%96%E7%95%A5%E4%BC%98%E5%85%88%E7%BA%A7)
* [使用示例](https://kilocode.ai/docs/zh-CN/features/tools/read-file#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B)
* [用法示例](https://kilocode.ai/docs/zh-CN/features/tools/read-file#%E7%94%A8%E6%B3%95%E7%A4%BA%E4%BE%8B)
* [读取整个文件](https://kilocode.ai/docs/zh-CN/features/tools/read-file#%E8%AF%BB%E5%8F%96%E6%95%B4%E4%B8%AA%E6%96%87%E4%BB%B6)
* [读取特定行](https://kilocode.ai/docs/zh-CN/features/tools/read-file#%E8%AF%BB%E5%8F%96%E7%89%B9%E5%AE%9A%E8%A1%8C)
* [读取大文件(自动截断)](https://kilocode.ai/docs/zh-CN/features/tools/read-file#%E8%AF%BB%E5%8F%96%E5%A4%A7%E6%96%87%E4%BB%B6%E8%87%AA%E5%8A%A8%E6%88%AA%E6%96%AD)
* [尝试读取不存在的文件](https://kilocode.ai/docs/zh-CN/features/tools/read-file#%E5%B0%9D%E8%AF%95%E8%AF%BB%E5%8F%96%E4%B8%8D%E5%AD%98%E5%9C%A8%E7%9A%84%E6%96%87%E4%BB%B6)
* [尝试读取被阻止的文件](https://kilocode.ai/docs/zh-CN/features/tools/read-file#%E5%B0%9D%E8%AF%95%E8%AF%BB%E5%8F%96%E8%A2%AB%E9%98%BB%E6%AD%A2%E7%9A%84%E6%96%87%E4%BB%B6)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Ftools%2Fread-file)
---
# update_todo_list | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/tools/update-todo-list#__docusaurus_skipToContent_fallback)
本页总览
The `update_todo_list` tool replaces the entire TODO list with an updated checklist reflecting the current state. It provides step-by-step task tracking, allowing confirmation of completion before updating and dynamic addition of new todos discovered during complex tasks.
Parameters[](https://kilocode.ai/docs/zh-CN/features/tools/update-todo-list#parameters "Parameters的直接链接")
-----------------------------------------------------------------------------------------------------------
The tool accepts these parameters:
* `todos` (required): A markdown checklist with task descriptions and status indicators
What It Does[](https://kilocode.ai/docs/zh-CN/features/tools/update-todo-list#what-it-does "What It Does的直接链接")
-----------------------------------------------------------------------------------------------------------------
This tool manages a comprehensive TODO list that tracks task progress through different status states. It replaces the entire list with each update, ensuring the current state accurately reflects all pending, in-progress, and completed tasks. The system displays the TODO list as reminders in subsequent messages.
When is it used?[](https://kilocode.ai/docs/zh-CN/features/tools/update-todo-list#when-is-it-used "When is it used?的直接链接")
----------------------------------------------------------------------------------------------------------------------------
* When tasks involve multiple steps requiring systematic tracking
* When new actionable items are discovered during task execution
* When updating the status of several todos simultaneously
* When complex projects benefit from clear, stepwise progress tracking
* When organizing multi-phase workflows with dependencies
Key Features[](https://kilocode.ai/docs/zh-CN/features/tools/update-todo-list#key-features "Key Features的直接链接")
-----------------------------------------------------------------------------------------------------------------
* Maintains a single-level markdown checklist with three status states
* Updates multiple task statuses in a single operation
* Dynamically adds new todos as they're discovered during execution
* Provides visual progress tracking through status indicators
* Integrates with the reminder system for persistent task visibility
* Supports task reordering based on execution priority
* Preserves all unfinished tasks unless explicitly removed
* Enables efficient batch status updates
Limitations[](https://kilocode.ai/docs/zh-CN/features/tools/update-todo-list#limitations "Limitations的直接链接")
--------------------------------------------------------------------------------------------------------------
* Limited to single-level checklists (no nesting or subtasks)
* Cannot remove tasks unless they're completed or no longer relevant
* Requires complete list replacement rather than incremental updates
* Status changes must be explicitly managed through tool calls
* No built-in task dependency tracking
* Cannot schedule tasks for future execution
* Limited to three status states (pending, in-progress, completed)
Status Indicators[](https://kilocode.ai/docs/zh-CN/features/tools/update-todo-list#status-indicators "Status Indicators的直接链接")
--------------------------------------------------------------------------------------------------------------------------------
The tool uses three distinct status indicators:
* `[ ]` **Pending**: Task not yet started
* `[-]` **In Progress**: Task currently being worked on
* `[x]` **Completed**: Task fully finished with no unresolved issues
How It Works[](https://kilocode.ai/docs/zh-CN/features/tools/update-todo-list#how-it-works "How It Works的直接链接")
-----------------------------------------------------------------------------------------------------------------
When the `update_todo_list` tool is invoked, it follows this process:
1. **Status Validation**:
* Parses the markdown checklist format
* Validates status indicators are properly formatted
* Ensures task descriptions are clear and actionable
2. **List Replacement**:
* Completely replaces the existing TODO list
* Preserves task order as specified in the update
* Maintains task descriptions and status states
3. **Reminder Integration**:
* Integrates updated list with the reminder system
* Displays current tasks in subsequent message headers
* Provides persistent visibility of task progress
4. **Progress Tracking**:
* Tracks completion status across multiple updates
* Maintains task history for reference
* Supports workflow continuation across sessions
Best Practices[](https://kilocode.ai/docs/zh-CN/features/tools/update-todo-list#best-practices "Best Practices的直接链接")
-----------------------------------------------------------------------------------------------------------------------
### Task Management Guidelines[](https://kilocode.ai/docs/zh-CN/features/tools/update-todo-list#task-management-guidelines "Task Management Guidelines的直接链接")
* Mark tasks as completed immediately after all work is finished
* Start the next task by marking it as in-progress
* Add new todos as soon as they are identified during execution
* Use clear, descriptive task names that indicate specific actions
* Order tasks by logical execution sequence or priority
### Status Update Patterns[](https://kilocode.ai/docs/zh-CN/features/tools/update-todo-list#status-update-patterns "Status Update Patterns的直接链接")
* Update multiple statuses simultaneously when transitioning between tasks
* Confirm task completion before marking as finished
* Keep in-progress tasks focused on current work
* Add blocking tasks when dependencies are discovered
### When to Use[](https://kilocode.ai/docs/zh-CN/features/tools/update-todo-list#when-to-use "When to Use的直接链接")
Use this tool when:
* The task involves multiple steps or requires ongoing tracking
* New actionable items are discovered during task execution
* Multiple todos need status updates simultaneously
* Complex tasks benefit from clear progress visualization
Avoid using when:
* There is only a single, trivial task
* The task can be completed in one or two simple steps
* The request is purely conversational or informational
Examples When Used[](https://kilocode.ai/docs/zh-CN/features/tools/update-todo-list#examples-when-used "Examples When Used的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------
* When implementing a multi-component feature requiring frontend, backend, and database changes
* When debugging issues that reveal multiple related problems requiring fixes
* When setting up development environments with multiple configuration steps
* When documenting systems that require research, writing, and review phases
* When refactoring code that affects multiple files and requires testing
Usage Examples[](https://kilocode.ai/docs/zh-CN/features/tools/update-todo-list#usage-examples "Usage Examples的直接链接")
-----------------------------------------------------------------------------------------------------------------------
Initial task breakdown:
[-] Analyze requirements and create technical specification[ ] Design database schema and API endpoints[ ] Implement backend authentication service[ ] Create frontend login components[ ] Write comprehensive tests[ ] Update documentation
Updating progress and adding discovered tasks:
[x] Analyze requirements and create technical specification[x] Design database schema and API endpoints[-] Implement backend authentication service[ ] Create frontend login components[ ] Write comprehensive tests[ ] Update documentation[ ] Add password reset functionality[ ] Implement rate limiting for login attempts
Completing multiple tasks and transitioning focus:
[x] Analyze requirements and create technical specification[x] Design database schema and API endpoints[x] Implement backend authentication service[x] Create frontend login components[-] Write comprehensive tests[ ] Update documentation[ ] Add password reset functionality[ ] Implement rate limiting for login attempts
* [Parameters](https://kilocode.ai/docs/zh-CN/features/tools/update-todo-list#parameters)
* [What It Does](https://kilocode.ai/docs/zh-CN/features/tools/update-todo-list#what-it-does)
* [When is it used?](https://kilocode.ai/docs/zh-CN/features/tools/update-todo-list#when-is-it-used)
* [Key Features](https://kilocode.ai/docs/zh-CN/features/tools/update-todo-list#key-features)
* [Limitations](https://kilocode.ai/docs/zh-CN/features/tools/update-todo-list#limitations)
* [Status Indicators](https://kilocode.ai/docs/zh-CN/features/tools/update-todo-list#status-indicators)
* [How It Works](https://kilocode.ai/docs/zh-CN/features/tools/update-todo-list#how-it-works)
* [Best Practices](https://kilocode.ai/docs/zh-CN/features/tools/update-todo-list#best-practices)
* [Task Management Guidelines](https://kilocode.ai/docs/zh-CN/features/tools/update-todo-list#task-management-guidelines)
* [Status Update Patterns](https://kilocode.ai/docs/zh-CN/features/tools/update-todo-list#status-update-patterns)
* [When to Use](https://kilocode.ai/docs/zh-CN/features/tools/update-todo-list#when-to-use)
* [Examples When Used](https://kilocode.ai/docs/zh-CN/features/tools/update-todo-list#examples-when-used)
* [Usage Examples](https://kilocode.ai/docs/zh-CN/features/tools/update-todo-list#usage-examples)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Ftools%2Fupdate-todo-list)
---
# use_mcp_tool | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/tools/use-mcp-tool#__docusaurus_skipToContent_fallback)
本页总览
`use_mcp_tool` 工具使 Kilo Code 能够与连接的 Model Context Protocol (MCP) 服务器提供的外部工具进行交互。它通过标准化协议扩展了 Kilo Code 的功能,提供特定领域的专业能力。
参数[](https://kilocode.ai/docs/zh-CN/features/tools/use-mcp-tool#%E5%8F%82%E6%95%B0 "参数的直接链接")
-----------------------------------------------------------------------------------------------
该工具接受以下参数:
* `server_name`(必填):提供工具的 MCP 服务器名称
* `tool_name`(必填):要执行的工具名称
* `arguments`(必填/可选):包含工具输入参数的 JSON 对象,遵循工具的输入模式。对于不需要输入的工具,此参数可为可选。
功能[](https://kilocode.ai/docs/zh-CN/features/tools/use-mcp-tool#%E5%8A%9F%E8%83%BD "功能的直接链接")
-----------------------------------------------------------------------------------------------
该工具允许 Kilo Code 访问由外部 MCP 服务器提供的专业功能。每个 MCP 服务器可以提供多个具有独特功能的工具,从而扩展 Kilo Code 的内置功能。系统会根据模式验证参数,管理服务器连接,并处理各种内容类型的响应(文本、图像、资源)。
使用场景[](https://kilocode.ai/docs/zh-CN/features/tools/use-mcp-tool#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF "使用场景的直接链接")
---------------------------------------------------------------------------------------------------------------------
* 当需要核心工具无法提供的专业功能时
* 当需要特定领域的操作时
* 当需要与外部系统或服务集成时
* 当处理需要特定处理或分析的数据时
* 当通过标准化接口访问专有工具时
主要特性[](https://kilocode.ai/docs/zh-CN/features/tools/use-mcp-tool#%E4%B8%BB%E8%A6%81%E7%89%B9%E6%80%A7 "主要特性的直接链接")
---------------------------------------------------------------------------------------------------------------------
* 使用 `@modelcontextprotocol/sdk` 库的标准化 MCP 协议
* 支持多种通信机制(StdioClientTransport 和 SSEClientTransport)
* 在客户端和服务器端使用 Zod 模式验证参数
* 处理多种响应内容类型:文本、图像和资源引用
* 当服务器代码更改时自动重启,管理服务器生命周期
* 提供“始终允许”机制以绕过受信任工具的批准
* 与配套的 `access_mcp_resource` 工具协同工作以获取资源
* 维护适当的错误跟踪和处理机制
* 支持可配置的超时时间(1-3600 秒,默认:60 秒)
* 允许文件监视器自动检测和重新加载服务器更改
限制[](https://kilocode.ai/docs/zh-CN/features/tools/use-mcp-tool#%E9%99%90%E5%88%B6 "限制的直接链接")
-----------------------------------------------------------------------------------------------
* 依赖外部 MCP 服务器的可用性和连接性
* 仅限于连接服务器提供的工具
* 不同 MCP 服务器的工具能力各不相同
* 网络问题可能影响可靠性和性能
* 需要用户批准才能执行(除非在“始终允许”列表中)
* 无法同时执行多个 MCP 工具操作
服务器配置[](https://kilocode.ai/docs/zh-CN/features/tools/use-mcp-tool#%E6%9C%8D%E5%8A%A1%E5%99%A8%E9%85%8D%E7%BD%AE "服务器配置的直接链接")
--------------------------------------------------------------------------------------------------------------------------------
MCP 服务器可以在全局或项目级别进行配置:
* **全局配置**:通过 VS Code 中的 Kilo Code 扩展设置进行管理。这些设置适用于所有项目,除非被覆盖。
* **项目级配置**:在项目根目录下的 `.kilocode/mcp.json` 文件中定义。
* 这允许项目特定的服务器设置。
* 如果项目级服务器与全局服务器同名,则项目级服务器优先。
* 由于 `.kilocode/mcp.json` 可以提交到版本控制,因此简化了与团队共享配置的过程。
工作原理[](https://kilocode.ai/docs/zh-CN/features/tools/use-mcp-tool#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86 "工作原理的直接链接")
---------------------------------------------------------------------------------------------------------------------
当调用 `use_mcp_tool` 工具时,它会遵循以下流程:
1. **初始化和验证**:
* 系统验证 MCP hub 是否可用
* 确认指定的服务器存在并已连接
* 验证请求的工具存在于服务器上
* 根据工具的模式定义验证参数
* 从服务器配置中提取超时设置(默认:60 秒)
2. **执行和通信**:
* 系统选择适当的通信机制:
* `StdioClientTransport`:用于通过标准 I/O 与本地进程通信
* `SSEClientTransport`:用于通过 Server-Sent Events 与 HTTP 服务器通信
* 发送包含已验证的服务器名称、工具名称和参数的请求
* 使用 `@modelcontextprotocol/sdk` 库进行标准化交互
* 跟踪请求执行并处理超时,防止挂起操作
3. **响应处理**:
* 响应可以包含多种内容类型:
* 文本内容:纯文本响应
* 图像内容:带有 MIME 类型信息的二进制图像数据
* 资源引用:用于访问服务器资源的 URI(与 `access_mcp_resource` 协同工作)
* 系统检查 `isError` 标志以确定是否需要错误处理
* 结果会被格式化以在 Kilo Code 界面中显示
4. **资源和错误处理**:
* 系统使用 WeakRef 模式防止内存泄漏
* 连续错误计数器跟踪和管理错误
* 文件监视器监控服务器代码更改并触发自动重启
* 安全模型要求批准工具执行,除非在“始终允许”列表中
安全和权限[](https://kilocode.ai/docs/zh-CN/features/tools/use-mcp-tool#%E5%AE%89%E5%85%A8%E5%92%8C%E6%9D%83%E9%99%90 "安全和权限的直接链接")
--------------------------------------------------------------------------------------------------------------------------------
MCP 架构提供了多项安全功能:
* 默认情况下,用户必须在执行前批准工具使用
* 特定工具可以标记为“始终允许”列表中的自动批准
* 使用 Zod 模式验证服务器配置以确保完整性
* 可配置的超时时间防止挂起操作(1-3600 秒)
* 可以通过 UI 启用或禁用服务器连接
使用示例[](https://kilocode.ai/docs/zh-CN/features/tools/use-mcp-tool#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B "使用示例的直接链接")
---------------------------------------------------------------------------------------------------------------------
使用文本响应请求天气预报数据:
weather-serverget_forecast{ "city": "San Francisco", "days": 5, "format": "text"}
使用返回 JSON 的专用工具分析源代码:
code-analysiscomplexity_metrics{ "language": "typescript", "file_path": "src/app.ts", "include_functions": true, "metrics": ["cyclomatic", "cognitive"]}
使用特定参数生成图像:
image-generationcreate_image{ "prompt": "A futuristic city with flying cars", "style": "photorealistic", "dimensions": { "width": 1024, "height": 768 }, "format": "webp"}
通过返回资源引用的工具访问资源:
database-connectorquery_and_store{ "database": "users", "type": "select", "fields": ["name", "email", "last_login"], "where": { "status": "active" }, "store_as": "active_users"}
不需要参数的工具:
system-monitorget_current_status{}
* [参数](https://kilocode.ai/docs/zh-CN/features/tools/use-mcp-tool#%E5%8F%82%E6%95%B0)
* [功能](https://kilocode.ai/docs/zh-CN/features/tools/use-mcp-tool#%E5%8A%9F%E8%83%BD)
* [使用场景](https://kilocode.ai/docs/zh-CN/features/tools/use-mcp-tool#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF)
* [主要特性](https://kilocode.ai/docs/zh-CN/features/tools/use-mcp-tool#%E4%B8%BB%E8%A6%81%E7%89%B9%E6%80%A7)
* [限制](https://kilocode.ai/docs/zh-CN/features/tools/use-mcp-tool#%E9%99%90%E5%88%B6)
* [服务器配置](https://kilocode.ai/docs/zh-CN/features/tools/use-mcp-tool#%E6%9C%8D%E5%8A%A1%E5%99%A8%E9%85%8D%E7%BD%AE)
* [工作原理](https://kilocode.ai/docs/zh-CN/features/tools/use-mcp-tool#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86)
* [安全和权限](https://kilocode.ai/docs/zh-CN/features/tools/use-mcp-tool#%E5%AE%89%E5%85%A8%E5%92%8C%E6%9D%83%E9%99%90)
* [使用示例](https://kilocode.ai/docs/zh-CN/features/tools/use-mcp-tool#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Ftools%2Fuse-mcp-tool)
---
# 工具使用概述 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#__docusaurus_skipToContent_fallback)
本页总览
Kilo Code 实现了一个复杂的工具系统,允许 AI 模型以受控和安全的方式与你的开发环境交互。本文档解释了工具的工作原理、调用时机和管理方式。
核心概念[](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E6%A0%B8%E5%BF%83%E6%A6%82%E5%BF%B5 "核心概念的直接链接")
--------------------------------------------------------------------------------------------------------------------------
### 工具分组[](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E5%B7%A5%E5%85%B7%E5%88%86%E7%BB%84 "工具分组的直接链接")
工具根据功能分为逻辑组:
| 类别 | 用途 | 工具 | 常见用途 |
| --- | --- | --- | --- |
| **读取组** | 文件系统读取和搜索 | [read\_file](https://kilocode.ai/docs/zh-CN/features/tools/read-file) , [search\_files](https://kilocode.ai/docs/zh-CN/features/tools/search-files) , [list\_files](https://kilocode.ai/docs/zh-CN/features/tools/list-files) , [list\_code\_definition\_names](https://kilocode.ai/docs/zh-CN/features/tools/list-code-definition-names) | 代码探索和分析 |
| **编辑组** | 文件系统修改 | [apply\_diff](https://kilocode.ai/docs/zh-CN/features/tools/apply-diff) , [write\_to\_file](https://kilocode.ai/docs/zh-CN/features/tools/write-to-file) | 代码更改和文件操作 |
| **浏览器组** | 网页自动化 | [browser\_action](https://kilocode.ai/docs/zh-CN/features/tools/browser-action) | 网页测试和交互 |
| **命令组** | 系统命令执行 | [execute\_command](https://kilocode.ai/docs/zh-CN/features/tools/execute-command) | 运行脚本、构建项目 |
| **MCP组** | 外部工具集成 | [use\_mcp\_tool](https://kilocode.ai/docs/zh-CN/features/tools/use-mcp-tool) , [access\_mcp\_resource](https://kilocode.ai/docs/zh-CN/features/tools/access-mcp-resource) | 通过外部服务器实现专门功能 |
| **工作流组** | 模式和任务管理 | [switch\_mode](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode) , [new\_task](https://kilocode.ai/docs/zh-CN/features/tools/new-task) , [ask\_followup\_question](https://kilocode.ai/docs/zh-CN/features/tools/ask-followup-question) , [attempt\_completion](https://kilocode.ai/docs/zh-CN/features/tools/attempt-completion) | 上下文切换和任务组织 |
### 始终可用的工具[](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E5%A7%8B%E7%BB%88%E5%8F%AF%E7%94%A8%E7%9A%84%E5%B7%A5%E5%85%B7 "始终可用的工具的直接链接")
某些工具在任何模式下都可访问:
* [ask\_followup\_question](https://kilocode.ai/docs/zh-CN/features/tools/ask-followup-question)
:从用户处收集额外信息
* [attempt\_completion](https://kilocode.ai/docs/zh-CN/features/tools/attempt-completion)
:标记任务完成
* [switch\_mode](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode)
:更改操作模式
* [new\_task](https://kilocode.ai/docs/zh-CN/features/tools/new-task)
:创建子任务
可用工具[](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E5%8F%AF%E7%94%A8%E5%B7%A5%E5%85%B7 "可用工具的直接链接")
--------------------------------------------------------------------------------------------------------------------------
### 读取工具[](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E8%AF%BB%E5%8F%96%E5%B7%A5%E5%85%B7 "读取工具的直接链接")
这些工具帮助 Kilo Code 理解你的代码和项目:
* [read\_file](https://kilocode.ai/docs/zh-CN/features/tools/read-file)
- 检查文件内容
* [search\_files](https://kilocode.ai/docs/zh-CN/features/tools/search-files)
- 跨多个文件查找模式
* [list\_files](https://kilocode.ai/docs/zh-CN/features/tools/list-files)
- 映射项目文件结构
* [list\_code\_definition\_names](https://kilocode.ai/docs/zh-CN/features/tools/list-code-definition-names)
- 创建代码结构图
### 编辑工具[](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E7%BC%96%E8%BE%91%E5%B7%A5%E5%85%B7 "编辑工具的直接链接")
这些工具帮助 Kilo Code 修改你的代码:
* [apply\_diff](https://kilocode.ai/docs/zh-CN/features/tools/apply-diff)
- 对代码进行精确修改
* [write\_to\_file](https://kilocode.ai/docs/zh-CN/features/tools/write-to-file)
- 创建新文件或完全重写现有文件
### 浏览器工具[](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E6%B5%8F%E8%A7%88%E5%99%A8%E5%B7%A5%E5%85%B7 "浏览器工具的直接链接")
这些工具帮助 Kilo Code 与网页应用交互:
* [browser\_action](https://kilocode.ai/docs/zh-CN/features/tools/browser-action)
- 自动化浏览器交互
### 命令工具[](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E5%91%BD%E4%BB%A4%E5%B7%A5%E5%85%B7 "命令工具的直接链接")
这些工具帮助 Kilo Code 执行命令:
* [execute\_command](https://kilocode.ai/docs/zh-CN/features/tools/execute-command)
- 运行系统命令和程序
### MCP工具[](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#mcp%E5%B7%A5%E5%85%B7 "MCP工具的直接链接")
这些工具帮助 Kilo Code 连接外部服务:
* [use\_mcp\_tool](https://kilocode.ai/docs/zh-CN/features/tools/use-mcp-tool)
- 使用专门的外部工具
* [access\_mcp\_resource](https://kilocode.ai/docs/zh-CN/features/tools/access-mcp-resource)
- 访问外部数据源
### 工作流工具[](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E5%B7%A5%E4%BD%9C%E6%B5%81%E5%B7%A5%E5%85%B7 "工作流工具的直接链接")
这些工具帮助管理对话和任务流:
* [ask\_followup\_question](https://kilocode.ai/docs/zh-CN/features/tools/ask-followup-question)
- 从你那里获取额外信息
* [attempt\_completion](https://kilocode.ai/docs/zh-CN/features/tools/attempt-completion)
- 呈现最终结果
* [switch\_mode](https://kilocode.ai/docs/zh-CN/features/tools/switch-mode)
- 切换到不同模式以执行专门任务
* [new\_task](https://kilocode.ai/docs/zh-CN/features/tools/new-task)
- 创建新子任务
工具调用机制[](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E5%B7%A5%E5%85%B7%E8%B0%83%E7%94%A8%E6%9C%BA%E5%88%B6 "工具调用机制的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------------
### 工具调用时机[](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E5%B7%A5%E5%85%B7%E8%B0%83%E7%94%A8%E6%97%B6%E6%9C%BA "工具调用时机的直接链接")
工具在特定条件下被调用:
1. **直接任务需求**
* 当需要特定操作来完成 LLM 决定的任务时
* 响应用户请求
* 在自动化工作流中
2. **基于模式的可用性**
* 不同模式启用不同的工具集
* 模式切换可以触发工具可用性变化
* 某些工具仅限于特定模式
3. **上下文相关调用**
* 基于工作区的当前状态
* 响应系统事件
* 在错误处理和恢复期间
### 决策过程[](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E5%86%B3%E7%AD%96%E8%BF%87%E7%A8%8B "决策过程的直接链接")
系统使用多步骤流程确定工具可用性:
1. **模式验证**
isToolAllowedForMode( tool: string, modeSlug: string, customModes: ModeConfig[], toolRequirements?: Record, toolParams?: Record)
2. **需求检查**
* 系统能力验证
* 资源可用性
* 权限验证
3. **参数验证**
* 必需参数是否存在
* 参数类型检查
* 值验证
技术实现[](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E6%8A%80%E6%9C%AF%E5%AE%9E%E7%8E%B0 "技术实现的直接链接")
--------------------------------------------------------------------------------------------------------------------------
### 工具调用处理[](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E5%B7%A5%E5%85%B7%E8%B0%83%E7%94%A8%E5%A4%84%E7%90%86 "工具调用处理的直接链接")
1. **初始化**
* 验证工具名称和参数
* 检查模式兼容性
* 验证需求
2. **执行**
const toolCall = { type: "tool_call", name: chunk.name, arguments: chunk.input, callId: chunk.callId}
3. **结果处理**
* 确定成功/失败
* 格式化结果
* 错误处理
### 安全与权限[](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E5%AE%89%E5%85%A8%E4%B8%8E%E6%9D%83%E9%99%90 "安全与权限的直接链接")
1. **访问控制**
* 文件系统限制
* 命令执行限制
* 网络访问控制
2. **验证层**
* 工具特定验证
* 基于模式的限制
* 系统级检查
模式集成[](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E6%A8%A1%E5%BC%8F%E9%9B%86%E6%88%90 "模式集成的直接链接")
--------------------------------------------------------------------------------------------------------------------------
### 基于模式的工具访问[](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E5%9F%BA%E4%BA%8E%E6%A8%A1%E5%BC%8F%E7%9A%84%E5%B7%A5%E5%85%B7%E8%AE%BF%E9%97%AE "基于模式的工具访问的直接链接")
工具根据当前模式提供:
* **代码模式**:完全访问文件系统工具、代码编辑能力、命令执行
* **提问模式**:仅限于读取工具、信息收集能力,不能修改文件系统
* **架构模式**:设计导向工具、文档能力,有限的执行权限
* **自定义模式**:可配置特定工具访问以实现专门工作流
### 模式切换[](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E6%A8%A1%E5%BC%8F%E5%88%87%E6%8D%A2 "模式切换的直接链接")
1. **流程**
* 保存当前模式状态
* 更新工具可用性
* 上下文切换
2. **对工具的影响**
* 工具集变化
* 权限调整
* 上下文保存
最佳实践[](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5 "最佳实践的直接链接")
--------------------------------------------------------------------------------------------------------------------------
### 工具使用指南[](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E5%B7%A5%E5%85%B7%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97 "工具使用指南的直接链接")
1. **效率**
* 使用最适合任务的工具
* 避免冗余工具调用
* 尽可能批量操作
2. **安全**
* 调用工具前验证输入
* 使用最低必要权限
* 遵循安全最佳实践
3. **错误处理**
* 实施适当的错误检查
* 提供有意义的错误信息
* 优雅地处理失败
### 常见模式[](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E5%B8%B8%E8%A7%81%E6%A8%A1%E5%BC%8F "常见模式的直接链接")
1. **信息收集**
[ask_followup_question](/features/tools/ask-followup-question) → [read_file](/features/tools/read-file) → [search_files](/features/tools/search-files)
2. **代码修改**
[read_file](/features/tools/read-file) → [apply_diff](/features/tools/apply-diff) → [attempt_completion](/features/tools/attempt-completion)
3. **任务管理**
[new_task](/features/tools/new-task) → [switch_mode](/features/tools/switch-mode) → [execute_command](/features/tools/execute-command)
错误处理与恢复[](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E9%94%99%E8%AF%AF%E5%A4%84%E7%90%86%E4%B8%8E%E6%81%A2%E5%A4%8D "错误处理与恢复的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------------------------------
### 错误类型[](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E9%94%99%E8%AF%AF%E7%B1%BB%E5%9E%8B "错误类型的直接链接")
1. **工具特定错误**
* 参数验证失败
* 执行错误
* 资源访问问题
2. **系统错误**
* 权限被拒绝
* 资源不可用
* 网络故障
3. **上下文错误**
* 工具的模式无效
* 缺少需求
* 状态不一致
### 恢复策略[](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E6%81%A2%E5%A4%8D%E7%AD%96%E7%95%A5 "恢复策略的直接链接")
1. **自动恢复**
* 重试机制
* 回退选项
* 状态恢复
2. **用户干预**
* 错误通知
* 恢复建议
* 手动干预选项
* [核心概念](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E6%A0%B8%E5%BF%83%E6%A6%82%E5%BF%B5)
* [工具分组](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E5%B7%A5%E5%85%B7%E5%88%86%E7%BB%84)
* [始终可用的工具](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E5%A7%8B%E7%BB%88%E5%8F%AF%E7%94%A8%E7%9A%84%E5%B7%A5%E5%85%B7)
* [可用工具](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E5%8F%AF%E7%94%A8%E5%B7%A5%E5%85%B7)
* [读取工具](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E8%AF%BB%E5%8F%96%E5%B7%A5%E5%85%B7)
* [编辑工具](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E7%BC%96%E8%BE%91%E5%B7%A5%E5%85%B7)
* [浏览器工具](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E6%B5%8F%E8%A7%88%E5%99%A8%E5%B7%A5%E5%85%B7)
* [命令工具](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E5%91%BD%E4%BB%A4%E5%B7%A5%E5%85%B7)
* [MCP工具](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#mcp%E5%B7%A5%E5%85%B7)
* [工作流工具](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E5%B7%A5%E4%BD%9C%E6%B5%81%E5%B7%A5%E5%85%B7)
* [工具调用机制](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E5%B7%A5%E5%85%B7%E8%B0%83%E7%94%A8%E6%9C%BA%E5%88%B6)
* [工具调用时机](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E5%B7%A5%E5%85%B7%E8%B0%83%E7%94%A8%E6%97%B6%E6%9C%BA)
* [决策过程](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E5%86%B3%E7%AD%96%E8%BF%87%E7%A8%8B)
* [技术实现](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E6%8A%80%E6%9C%AF%E5%AE%9E%E7%8E%B0)
* [工具调用处理](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E5%B7%A5%E5%85%B7%E8%B0%83%E7%94%A8%E5%A4%84%E7%90%86)
* [安全与权限](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E5%AE%89%E5%85%A8%E4%B8%8E%E6%9D%83%E9%99%90)
* [模式集成](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E6%A8%A1%E5%BC%8F%E9%9B%86%E6%88%90)
* [基于模式的工具访问](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E5%9F%BA%E4%BA%8E%E6%A8%A1%E5%BC%8F%E7%9A%84%E5%B7%A5%E5%85%B7%E8%AE%BF%E9%97%AE)
* [模式切换](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E6%A8%A1%E5%BC%8F%E5%88%87%E6%8D%A2)
* [最佳实践](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5)
* [工具使用指南](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E5%B7%A5%E5%85%B7%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97)
* [常见模式](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E5%B8%B8%E8%A7%81%E6%A8%A1%E5%BC%8F)
* [错误处理与恢复](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E9%94%99%E8%AF%AF%E5%A4%84%E7%90%86%E4%B8%8E%E6%81%A2%E5%A4%8D)
* [错误类型](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E9%94%99%E8%AF%AF%E7%B1%BB%E5%9E%8B)
* [恢复策略](https://kilocode.ai/docs/zh-CN/features/tools/tool-use-overview#%E6%81%A2%E5%A4%8D%E7%AD%96%E7%95%A5)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Ftools%2Ftool-use-overview)
---
# write_to_file | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/features/tools/write-to-file#__docusaurus_skipToContent_fallback)
本页总览
`write_to_file` 工具用于创建新文件或完全替换现有文件内容,并通过交互式审批流程提供变更的差异视图。
参数[](https://kilocode.ai/docs/zh-CN/features/tools/write-to-file#%E5%8F%82%E6%95%B0 "参数的直接链接")
------------------------------------------------------------------------------------------------
该工具接受以下参数:
* `path`(必填):要写入的文件路径,相对于当前工作目录
* `content`(必填):要写入文件的完整内容
* `line_count`(必填):文件中的行数,包括空行
功能[](https://kilocode.ai/docs/zh-CN/features/tools/write-to-file#%E5%8A%9F%E8%83%BD "功能的直接链接")
------------------------------------------------------------------------------------------------
该工具将内容写入指定文件,如果文件不存在则创建新文件,如果文件存在则完全覆盖现有内容。所有变更都需要通过差异视图界面进行显式用户审批,用户可以在应用变更之前查看甚至编辑建议的内容。
使用场景[](https://kilocode.ai/docs/zh-CN/features/tools/write-to-file#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF "使用场景的直接链接")
----------------------------------------------------------------------------------------------------------------------
* 当 Kilo Code 需要从头创建新文件时
* 当 Kilo Code 需要完全重写现有文件时
* 当为新项目创建多个文件时
* 当生成配置文件、文档或源代码时
* 当需要在应用变更之前查看变更时
关键特性[](https://kilocode.ai/docs/zh-CN/features/tools/write-to-file#%E5%85%B3%E9%94%AE%E7%89%B9%E6%80%A7 "关键特性的直接链接")
----------------------------------------------------------------------------------------------------------------------
* 交互式审批:在差异视图中显示变更,需要显式批准才能应用
* 用户编辑支持:允许在最终批准之前编辑建议的内容
* 安全措施:检测代码遗漏、验证路径并防止内容截断
* 编辑器集成:打开差异视图并自动滚动到第一个差异
* 内容预处理:处理不同 AI 模型的输出,确保内容干净
* 访问控制:在更改之前验证 `.kilocodeignore` 限制
* 父目录:可能通过系统依赖处理目录创建
* 完全替换:在单个操作中提供完全转换的文件
限制[](https://kilocode.ai/docs/zh-CN/features/tools/write-to-file#%E9%99%90%E5%88%B6 "限制的直接链接")
------------------------------------------------------------------------------------------------
* 不适用于现有文件:对于修改现有文件,比 `apply_diff` 效率低得多
* 大文件性能:文件较大时操作速度显著变慢
* 完全覆盖:替换整个文件内容,无法保留原始内容
* 需要行数:需要准确的行数以检测潜在的内容截断
* 审批开销:审批流程比直接编辑增加了额外步骤
* 仅限交互式:无法在需要非交互式执行的自动化工作流中使用
工作原理[](https://kilocode.ai/docs/zh-CN/features/tools/write-to-file#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86 "工作原理的直接链接")
----------------------------------------------------------------------------------------------------------------------
当调用 `write_to_file` 工具时,它会遵循以下过程:
1. **参数验证**:验证必需的参数和权限
* 检查是否提供了 `path`、`content` 和 `line_count`
* 验证文件是否允许(不受 `.kilocodeignore` 限制)
* 确保路径在工作区范围内
* 跟踪缺失参数的连续错误计数
* 为每个验证失败显示具体的错误消息
2. **内容预处理**:
* 删除可能由 AI 模型添加的代码块标记
* 处理转义的 HTML 实体(特别是非 Claude 模型)
* 如果内容中意外包含行号,则去除行号
* 针对不同的 AI 提供者执行模型特定的处理
3. **差异视图生成**:
* 在编辑器中打开差异视图,显示建议的变更
* 添加 300 毫秒的延迟以确保 UI 响应能力
* 自动滚动到第一个差异
* 高亮显示变更以便于查看
4. **用户审批流程**:
* 等待用户显式批准以继续
* 允许用户在差异视图中编辑内容
* 捕获用户的任何编辑以用于最终内容
* 提供完全拒绝变更的选项
* 检测并合并用户修改到最终结果中
5. **安全验证**:
* 通过与提供的行数比较,检测潜在的内容截断
* 如果内容看起来不完整,则显示警告
* 验证文件路径和访问权限
* 特别检查文件是否在工作区外,使用 `isOutsideWorkspace` 标志
6. **文件写入**:
* 将批准的内容(包括用户的任何编辑)写入文件
* 提供成功写入的确认
* 成功时重置连续错误计数器
使用时的示例[](https://kilocode.ai/docs/zh-CN/features/tools/write-to-file#%E4%BD%BF%E7%94%A8%E6%97%B6%E7%9A%84%E7%A4%BA%E4%BE%8B "使用时的示例的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------------
* 创建新项目时,Kilo Code 会生成多个文件,但会让您在提交更改前查看每个文件。
* 设置配置文件时,Kilo Code 会在差异视图中显示建议的配置以供批准。
* 生成文档时,Kilo Code 会创建 Markdown 文件,但允许您在差异视图中进行最终调整。
* 开发原型时,Kilo Code 会在差异视图中显示完整的源文件,您可以在保存前进行微调。
使用示例[](https://kilocode.ai/docs/zh-CN/features/tools/write-to-file#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B "使用示例的直接链接")
----------------------------------------------------------------------------------------------------------------------
创建新的 JSON 配置文件:
config/settings.json { "apiEndpoint": "https://api.example.com", "theme": { "primaryColor": "#007bff", "secondaryColor": "#6c757d", "fontFamily": "Arial, sans-serif" }, "features": { "darkMode": true, "notifications": true, "analytics": false }, "version": "1.0.0" } 14
创建简单的 HTML 文件:
src/index.htmlMy Application13
创建 JavaScript 模块:
src/utils/helpers.js /** * 应用程序的实用工具函数 */ export function formatDate(date) { return new Date(date).toLocaleDateString(); } export function calculateTotal(items) { return items.reduce((sum, item) => sum + item.price, 0); } export function debounce(func, delay) { let timeout; return function(...args) { clearTimeout(timeout); timeout = setTimeout(() => func.apply(this, args), delay); }; } 18
* [参数](https://kilocode.ai/docs/zh-CN/features/tools/write-to-file#%E5%8F%82%E6%95%B0)
* [功能](https://kilocode.ai/docs/zh-CN/features/tools/write-to-file#%E5%8A%9F%E8%83%BD)
* [使用场景](https://kilocode.ai/docs/zh-CN/features/tools/write-to-file#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF)
* [关键特性](https://kilocode.ai/docs/zh-CN/features/tools/write-to-file#%E5%85%B3%E9%94%AE%E7%89%B9%E6%80%A7)
* [限制](https://kilocode.ai/docs/zh-CN/features/tools/write-to-file#%E9%99%90%E5%88%B6)
* [工作原理](https://kilocode.ai/docs/zh-CN/features/tools/write-to-file#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86)
* [使用时的示例](https://kilocode.ai/docs/zh-CN/features/tools/write-to-file#%E4%BD%BF%E7%94%A8%E6%97%B6%E7%9A%84%E7%A4%BA%E4%BE%8B)
* [使用示例](https://kilocode.ai/docs/zh-CN/features/tools/write-to-file#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Ffeatures%2Ftools%2Fwrite-to-file)
---
# 在Kilo Code中使用DeepSeek | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/providers/deepseek#__docusaurus_skipToContent_fallback)
本页总览
Kilo Code支持通过DeepSeek API访问模型,包括`deepseek-chat`和`deepseek-reasoner`。
**官方网站:** [https://platform.deepseek.com/](https://platform.deepseek.com/)
获取API Key[](https://kilocode.ai/docs/zh-CN/providers/deepseek#%E8%8E%B7%E5%8F%96api-key "获取API Key的直接链接")
-----------------------------------------------------------------------------------------------------------
1. **注册/登录:** 访问[DeepSeek平台](https://platform.deepseek.com/)
。创建账号或登录。
2. **导航到API密钥:** 在平台的[API密钥](https://platform.deepseek.com/api_keys)
部分找到你的API密钥。
3. **创建密钥:** 点击"Create new API key"。为密钥起一个描述性名称(例如"Kilo Code")。
4. **复制密钥:** **重要:** 立即复制API密钥,之后将无法再次查看。请安全存储。
支持的模型[](https://kilocode.ai/docs/zh-CN/providers/deepseek#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B "支持的模型的直接链接")
-----------------------------------------------------------------------------------------------------------------------
Kilo Code支持以下DeepSeek模型:
* `deepseek-chat` (推荐用于编码任务)
* `deepseek-reasoner` (推荐用于推理任务)
在Kilo Code中配置[](https://kilocode.ai/docs/zh-CN/providers/deepseek#%E5%9C%A8kilo-code%E4%B8%AD%E9%85%8D%E7%BD%AE "在Kilo Code中配置的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------
1. **打开Kilo Code设置:** 点击Kilo Code面板中的齿轮图标()
2. **选择提供商:** 从"API Provider"下拉菜单中选择"DeepSeek"
3. **输入API密钥:** 将DeepSeek API密钥粘贴到"DeepSeek API Key"字段
4. **选择模型:** 从"Model"下拉菜单中选择所需模型
提示和注意事项[](https://kilocode.ai/docs/zh-CN/providers/deepseek#%E6%8F%90%E7%A4%BA%E5%92%8C%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9 "提示和注意事项的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------
* **价格:** 参考[DeepSeek定价](https://api-docs.deepseek.com/quick_start/pricing/)
页面了解模型费用详情
* [获取API Key](https://kilocode.ai/docs/zh-CN/providers/deepseek#%E8%8E%B7%E5%8F%96api-key)
* [支持的模型](https://kilocode.ai/docs/zh-CN/providers/deepseek#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B)
* [在Kilo Code中配置](https://kilocode.ai/docs/zh-CN/providers/deepseek#%E5%9C%A8kilo-code%E4%B8%AD%E9%85%8D%E7%BD%AE)
* [提示和注意事项](https://kilocode.ai/docs/zh-CN/providers/deepseek#%E6%8F%90%E7%A4%BA%E5%92%8C%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fproviders%2Fdeepseek)
---
# 在 Kilo Code 中使用 Anthropic | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/providers/anthropic#__docusaurus_skipToContent_fallback)
本页总览
Anthropic 是一家专注于 AI 安全和研究的公司,致力于构建可靠、可解释且可控的 AI 系统。他们的 Claude 模型以强大的推理能力、实用性和诚实性著称。
**官网:** [https://www.anthropic.com/](https://www.anthropic.com/)
获取 API 密钥[](https://kilocode.ai/docs/zh-CN/providers/anthropic#%E8%8E%B7%E5%8F%96-api-%E5%AF%86%E9%92%A5 "获取 API 密钥的直接链接")
----------------------------------------------------------------------------------------------------------------------------
1. **注册/登录:** 访问 [Anthropic 控制台](https://console.anthropic.com/)
。创建账户或登录现有账户
2. **导航至 API 密钥:** 进入 [API keys](https://console.anthropic.com/settings/keys)
页面
3. **创建密钥:** 点击 "Create Key"。为密钥命名(如 "Kilo Code")
4. **复制密钥:** **重要:** 立即复制 API 密钥,之后将无法再次查看。请妥善保存
支持的模型[](https://kilocode.ai/docs/zh-CN/providers/anthropic#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B "支持的模型的直接链接")
------------------------------------------------------------------------------------------------------------------------
Kilo Code 支持以下 Anthropic Claude 模型:
* `claude-3-7-sonnet-20250219` (推荐)
* `claude-3-7-sonnet-20250219:thinking` (扩展思考版)
* `claude-3-5-sonnet-20241022`
* `claude-3-5-haiku-20241022`
* `claude-3-opus-20240229`
* `claude-3-haiku-20240307`
查看 [Anthropic 模型文档](https://docs.anthropic.com/en/docs/about-claude/models)
获取各模型能力的详细信息
在 Kilo Code 中配置[](https://kilocode.ai/docs/zh-CN/providers/anthropic#%E5%9C%A8-kilo-code-%E4%B8%AD%E9%85%8D%E7%BD%AE "在 Kilo Code 中配置的直接链接")
----------------------------------------------------------------------------------------------------------------------------------------------
1. **打开 Kilo Code 设置:** 点击 Kilo Code 面板中的齿轮图标 ()
2. **选择提供商:** 在 "API Provider" 下拉菜单中选择 "Anthropic"
3. **输入 API 密钥:** 将 Anthropic API 密钥粘贴到 "Anthropic API Key" 字段
4. **选择模型:** 从 "Model" 下拉列表中选择所需的 Claude 模型
5. **(可选) 自定义基础 URL:** 如需使用自定义 Anthropic API 基础 URL,勾选 "Use custom base URL" 并输入 URL。大多数用户无需修改此项
提示与注意事项[](https://kilocode.ai/docs/zh-CN/providers/anthropic#%E6%8F%90%E7%A4%BA%E4%B8%8E%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9 "提示与注意事项的直接链接")
----------------------------------------------------------------------------------------------------------------------------------------------
* **提示缓存:** Claude 3 模型支持 [提示缓存](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching)
,可显著降低重复提示的成本和延迟
* **上下文窗口:** Claude 模型具有大容量上下文窗口 (200,000 tokens),可在提示中包含大量代码和上下文
* **定价:** 参考 [Anthropic 定价](https://www.anthropic.com/pricing)
页面获取最新价格信息
* **速率限制:** Anthropic 根据 [使用层级](https://docs.anthropic.com/en/api/rate-limits#requirements-to-advance-tier)
设有严格速率限制。如频繁遇到限制,请联系 Anthropic 销售或通过 [OpenRouter](https://kilocode.ai/docs/zh-CN/providers/openrouter)
等其它提供商访问 Claude
* [获取 API 密钥](https://kilocode.ai/docs/zh-CN/providers/anthropic#%E8%8E%B7%E5%8F%96-api-%E5%AF%86%E9%92%A5)
* [支持的模型](https://kilocode.ai/docs/zh-CN/providers/anthropic#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B)
* [在 Kilo Code 中配置](https://kilocode.ai/docs/zh-CN/providers/anthropic#%E5%9C%A8-kilo-code-%E4%B8%AD%E9%85%8D%E7%BD%AE)
* [提示与注意事项](https://kilocode.ai/docs/zh-CN/providers/anthropic#%E6%8F%90%E7%A4%BA%E4%B8%8E%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fproviders%2Fanthropic)
---
# 在Kilo Code中使用Google Gemini | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/providers/gemini#__docusaurus_skipToContent_fallback)
本页总览
Kilo Code通过Google AI Gemini API支持Google的Gemini系列模型。
**官网:** [https://ai.google.dev/](https://ai.google.dev/)
获取API密钥[](https://kilocode.ai/docs/zh-CN/providers/gemini#%E8%8E%B7%E5%8F%96api%E5%AF%86%E9%92%A5 "获取API密钥的直接链接")
-------------------------------------------------------------------------------------------------------------------
1. **访问Google AI Studio:** 打开[https://ai.google.dev/](https://ai.google.dev/)
2. **登录:** 使用Google账号登录
3. **创建API密钥:** 点击左侧菜单中的"Create API key"
4. **复制API密钥:** 复制生成的API密钥
支持的模型[](https://kilocode.ai/docs/zh-CN/providers/gemini#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B "支持的模型的直接链接")
---------------------------------------------------------------------------------------------------------------------
Kilo Code支持以下Gemini模型:
* `gemini-2.5-pro-exp-03-25`
* `gemini-2.0-flash-001`
* `gemini-2.0-flash-lite-preview-02-05`
* `gemini-2.0-pro-exp-02-05`
* `gemini-2.0-flash-thinking-exp-01-21`
* `gemini-2.0-flash-thinking-exp-1219`
* `gemini-2.0-flash-exp`
* `gemini-1.5-flash-002`
* `gemini-1.5-flash-exp-0827`
* `gemini-1.5-flash-8b-exp-0827`
* `gemini-1.5-pro-002`
* `gemini-1.5-pro-exp-0827`
* `gemini-exp-1206`
参考[Gemini文档](https://ai.google.dev/models/gemini)
获取各模型详细信息。
在Kilo Code中的配置[](https://kilocode.ai/docs/zh-CN/providers/gemini#%E5%9C%A8kilo-code%E4%B8%AD%E7%9A%84%E9%85%8D%E7%BD%AE "在Kilo Code中的配置的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------------
1. **打开Kilo Code设置:** 点击Kilo Code面板中的齿轮图标()
2. **选择提供商:** 在"API Provider"下拉菜单中选择"Google Gemini"
3. **输入API密钥:** 将Gemini API密钥粘贴到"Gemini API Key"字段
4. **选择模型:** 从"Model"下拉菜单中选择所需的Gemini模型
提示与注意事项[](https://kilocode.ai/docs/zh-CN/providers/gemini#%E6%8F%90%E7%A4%BA%E4%B8%8E%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9 "提示与注意事项的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------------
* **定价:** Gemini API使用根据输入和输出的token计费。参考[Gemini定价页面](https://ai.google.dev/pricing)
获取详细信息。
* [获取API密钥](https://kilocode.ai/docs/zh-CN/providers/gemini#%E8%8E%B7%E5%8F%96api%E5%AF%86%E9%92%A5)
* [支持的模型](https://kilocode.ai/docs/zh-CN/providers/gemini#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B)
* [在Kilo Code中的配置](https://kilocode.ai/docs/zh-CN/providers/gemini#%E5%9C%A8kilo-code%E4%B8%AD%E7%9A%84%E9%85%8D%E7%BD%AE)
* [提示与注意事项](https://kilocode.ai/docs/zh-CN/providers/gemini#%E6%8F%90%E7%A4%BA%E4%B8%8E%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fproviders%2Fgemini)
---
# 使用 LM Studio 的 API 提供商 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/providers/lmstudio#__docusaurus_skipToContent_fallback)
本页总览
LM Studio 是一个本地运行的 AI 模型管理工具,允许您在本地计算机上运行各种开源 LLM 模型,并为其提供 API 访问。
**网站:** [https://lmstudio.ai/](https://lmstudio.ai/)
设置 LM Studio[](https://kilocode.ai/docs/zh-CN/providers/lmstudio#%E8%AE%BE%E7%BD%AE-lm-studio "设置 LM Studio的直接链接")
--------------------------------------------------------------------------------------------------------------------
1. **下载并安装:** 从 [LM Studio 网站](https://lmstudio.ai/)
下载并安装适用于您操作系统的版本。
2. **下载模型:** 在 LM Studio 中,从 Hugging Face 下载您想要使用的模型。建议使用经过测试的模型,如 Mistral 7B 或 Llama 2。
3. **启动服务器:** 在 LM Studio 中,点击“Server”选项卡,然后点击“Start Server”。默认情况下,服务器将在 `http://localhost:1234` 上运行。
支持的模型[](https://kilocode.ai/docs/zh-CN/providers/lmstudio#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B "支持的模型的直接链接")
-----------------------------------------------------------------------------------------------------------------------
Kilo Code 支持以下 LM Studio 模型:
* `mistral-7b-instruct-v0.1`
* `llama-2-7b-chat`
* `llama-2-13b-chat`
* `llama-2-70b-chat`
有关每个模型功能的更多详细信息,请参阅 [LM Studio 的文档](https://lmstudio.ai/docs)
。
在 Kilo Code 中配置[](https://kilocode.ai/docs/zh-CN/providers/lmstudio#%E5%9C%A8-kilo-code-%E4%B8%AD%E9%85%8D%E7%BD%AE "在 Kilo Code 中配置的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------
1. **打开 Kilo Code 设置:** 点击 Kilo Code 面板中的齿轮图标 ()。
2. **选择提供商:** 从 "API 提供商" 下拉菜单中选择 "LM Studio"。
3. **输入 API 密钥:** 将您的 LM Studio API 密钥粘贴到 "LM Studio API 密钥" 字段中。如果未设置 API 密钥,可以留空。
4. **选择模型:** 从 "模型" 下拉菜单中选择您想要的模型。
5. **(可选)自定义基础 URL:** 如果您需要为 LM Studio API 使用自定义基础 URL,请勾选“使用自定义基础 URL”并输入 URL。大多数人不需要调整此项。
提示和注意事项[](https://kilocode.ai/docs/zh-CN/providers/lmstudio#%E6%8F%90%E7%A4%BA%E5%92%8C%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9 "提示和注意事项的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------
* **本地运行:** LM Studio 允许您在本地运行模型,这对于隐私和安全性至关重要。
* **模型选择:** 选择适合您任务的模型大小。较大的模型需要更多的计算资源,但可能提供更好的结果。
* **硬件要求:** 确保您的计算机具有足够的 RAM 和 GPU 内存来运行您选择的模型。
* **速率限制:** LM Studio 没有严格的速率限制,但您的硬件可能会限制性能。
* [设置 LM Studio](https://kilocode.ai/docs/zh-CN/providers/lmstudio#%E8%AE%BE%E7%BD%AE-lm-studio)
* [支持的模型](https://kilocode.ai/docs/zh-CN/providers/lmstudio#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B)
* [在 Kilo Code 中配置](https://kilocode.ai/docs/zh-CN/providers/lmstudio#%E5%9C%A8-kilo-code-%E4%B8%AD%E9%85%8D%E7%BD%AE)
* [提示和注意事项](https://kilocode.ai/docs/zh-CN/providers/lmstudio#%E6%8F%90%E7%A4%BA%E5%92%8C%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fproviders%2Flmstudio)
---
# Using Chutes AI With Kilo Code | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/providers/chutes-ai#__docusaurus_skipToContent_fallback)
本页总览
Chutes.ai offers free API access to several large language models (LLMs), allowing developers to integrate and experiment with these models without immediate financial commitment. They provide access to a curated set of open-source and proprietary language models, often with a focus on specific capabilities or regional language support.
**Website:** [https://chutes.ai/](https://chutes.ai/)
Getting an API Key[](https://kilocode.ai/docs/zh-CN/providers/chutes-ai#getting-an-api-key "Getting an API Key的直接链接")
-----------------------------------------------------------------------------------------------------------------------
To use Chutes AI with Kilo Code, obtain an API key from the [Chutes AI platform](https://chutes.ai/)
. After signing up or logging in, you should find an option to generate or retrieve your API key within your account dashboard or settings.
Supported Models[](https://kilocode.ai/docs/zh-CN/providers/chutes-ai#supported-models "Supported Models的直接链接")
-----------------------------------------------------------------------------------------------------------------
Kilo Code will attempt to fetch the list of available models from the Chutes AI API. The specific models available will depend on Chutes AI's current offerings.
Always refer to the official Chutes AI documentation or your dashboard for the most up-to-date list of supported models.
Configuration in Kilo Code[](https://kilocode.ai/docs/zh-CN/providers/chutes-ai#configuration-in-kilo-code "Configuration in Kilo Code的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------------------
1. **Open Kilo Code Settings:** Click the gear icon () in the Kilo Code panel.
2. **Select Provider:** Choose "Chutes AI" from the "API Provider" dropdown.
3. **Enter API Key:** Paste your Chutes AI API key into the "Chutes AI API Key" field.
4. **Select Model:** Choose your desired model from the "Model" dropdown.
Tips and Notes[](https://kilocode.ai/docs/zh-CN/providers/chutes-ai#tips-and-notes "Tips and Notes的直接链接")
-----------------------------------------------------------------------------------------------------------
* **Free Access:** Chutes AI provides free API access, making it an excellent option for experimentation and development without immediate costs.
* **Model Variety:** The platform offers access to both open-source and proprietary models, giving you flexibility in choosing the right model for your needs.
* **Rate Limits:** As with any free service, be aware of potential rate limits or usage restrictions that may apply to your API key.
* [Getting an API Key](https://kilocode.ai/docs/zh-CN/providers/chutes-ai#getting-an-api-key)
* [Supported Models](https://kilocode.ai/docs/zh-CN/providers/chutes-ai#supported-models)
* [Configuration in Kilo Code](https://kilocode.ai/docs/zh-CN/providers/chutes-ai#configuration-in-kilo-code)
* [Tips and Notes](https://kilocode.ai/docs/zh-CN/providers/chutes-ai#tips-and-notes)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fproviders%2Fchutes-ai)
---
# 使用 Glama 与 Kilo Code | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/providers/glama#__docusaurus_skipToContent_fallback)
本页总览
Glama 通过统一的 API 提供了对多种语言模型的访问,包括来自 Anthropic、OpenAI 和其他提供商的模型。它提供了诸如提示缓存和成本跟踪等功能。
**网站:** [https://glama.ai/](https://glama.ai/)
获取 API 密钥[](https://kilocode.ai/docs/zh-CN/providers/glama#%E8%8E%B7%E5%8F%96-api-%E5%AF%86%E9%92%A5 "获取 API 密钥的直接链接")
------------------------------------------------------------------------------------------------------------------------
1. **注册/登录:** 前往 [Glama 注册页面](https://glama.ai/sign-up)
。使用您的 Google 账户或姓名/电子邮件/密码注册。
2. **获取 API 密钥:** 注册后,导航到 [API 密钥](https://glama.ai/settings/gateway/api-keys)
页面以获取 API 密钥。
3. **复制密钥:** 复制显示的 API 密钥。
支持的模型[](https://kilocode.ai/docs/zh-CN/providers/glama#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B "支持的模型的直接链接")
--------------------------------------------------------------------------------------------------------------------
Kilo Code 会自动尝试从 Glama API 获取可用模型的列表。通常通过 Glama 提供的一些模型包括:
* **Anthropic Claude 模型:** (例如,`anthropic/claude-3-5-sonnet`)这些通常推荐用于与 Kilo Code 的最佳性能。
* **OpenAI 模型:** (例如,`openai/o3-mini-high`)
* **其他提供商和开源模型**
请参阅 [Glama 文档](https://glama.ai/models)
获取最新支持的模型列表。
在 Kilo Code 中配置[](https://kilocode.ai/docs/zh-CN/providers/glama#%E5%9C%A8-kilo-code-%E4%B8%AD%E9%85%8D%E7%BD%AE "在 Kilo Code 中配置的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------
1. **打开 Kilo Code 设置:** 点击 Kilo Code 面板中的齿轮图标 ()。
2. **选择提供商:** 从 "API 提供商" 下拉菜单中选择 "Glama"。
3. **输入 API 密钥:** 将您的 Glama API 密钥粘贴到 "Glama API 密钥" 字段中。
4. **选择模型:** 从 "模型" 下拉菜单中选择您想要的模型。
提示和注意事项[](https://kilocode.ai/docs/zh-CN/providers/glama#%E6%8F%90%E7%A4%BA%E5%92%8C%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9 "提示和注意事项的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------
* **定价:** Glama 采用按使用量计费的模式。根据您选择的模型,定价会有所不同。
* **提示缓存:** Glama 支持提示缓存,这可以显著降低成本并提高重复提示的性能。
* [获取 API 密钥](https://kilocode.ai/docs/zh-CN/providers/glama#%E8%8E%B7%E5%8F%96-api-%E5%AF%86%E9%92%A5)
* [支持的模型](https://kilocode.ai/docs/zh-CN/providers/glama#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B)
* [在 Kilo Code 中配置](https://kilocode.ai/docs/zh-CN/providers/glama#%E5%9C%A8-kilo-code-%E4%B8%AD%E9%85%8D%E7%BD%AE)
* [提示和注意事项](https://kilocode.ai/docs/zh-CN/providers/glama#%E6%8F%90%E7%A4%BA%E5%92%8C%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fproviders%2Fglama)
---
# 使用 Kilo Code 的 API 提供商 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/providers/kilocode#__docusaurus_skipToContent_fallback)
本页总览
注意
此文档目前仅针对 Anthropic 和 Claude Sonnet 3.7,并不反映使用 Kilo Code 作为提供商的简单性 - 它只是一个占位符
Anthropic 是一家 AI 安全和研究公司,致力于构建可靠、可解释和可控制的 AI 系统。他们的 Claude 模型以其强大的推理能力、帮助性和诚实性而闻名。
**网站:** [https://www.anthropic.com/](https://www.anthropic.com/)
获取 API 密钥[](https://kilocode.ai/docs/zh-CN/providers/kilocode#%E8%8E%B7%E5%8F%96-api-%E5%AF%86%E9%92%A5 "获取 API 密钥的直接链接")
---------------------------------------------------------------------------------------------------------------------------
1. **注册/登录:** 前往 [Anthropic 控制台](https://console.anthropic.com/)
。创建账户或登录。
2. **导航到 API 密钥:** 前往 [API 密钥](https://console.anthropic.com/settings/keys)
部分。
3. **创建密钥:** 点击“创建密钥”。为您的密钥命名(例如,“Kilo Code”)。
4. **复制密钥:** **重要:** 立即复制 API 密钥。您将无法再次查看它。请妥善保存。
支持的模型[](https://kilocode.ai/docs/zh-CN/providers/kilocode#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B "支持的模型的直接链接")
-----------------------------------------------------------------------------------------------------------------------
Kilo Code 支持以下 Anthropic Claude 模型:
* `claude-3-7-sonnet-20250219`
有关每个模型功能的更多详细信息,请参阅 [Anthropic 的模型文档](https://docs.anthropic.com/en/docs/about-claude/models)
。
在 Kilo Code 中配置[](https://kilocode.ai/docs/zh-CN/providers/kilocode#%E5%9C%A8-kilo-code-%E4%B8%AD%E9%85%8D%E7%BD%AE "在 Kilo Code 中配置的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------
1. **打开 Kilo Code 设置:** 点击 Kilo Code 面板中的齿轮图标 ()。
2. **选择提供商:** 从 "API 提供商" 下拉菜单中选择 "Anthropic"。
3. **输入 API 密钥:** 将您的 Anthropic API 密钥粘贴到 "Anthropic API 密钥" 字段中。
4. **选择模型:** 从 "模型" 下拉菜单中选择您想要的 Claude 模型。
5. **(可选)自定义基础 URL:** 如果您需要为 Anthropic API 使用自定义基础 URL,请勾选“使用自定义基础 URL”并输入 URL。大多数人不需要调整此项。
提示和注意事项[](https://kilocode.ai/docs/zh-CN/providers/kilocode#%E6%8F%90%E7%A4%BA%E5%92%8C%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9 "提示和注意事项的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------
* **提示缓存:** Claude 3 模型支持 [提示缓存](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching)
,这可以显著降低重复提示的成本和延迟。
* **上下文窗口:** Claude 模型具有较大的上下文窗口(200,000 个 token),允许您在提示中包含大量代码和上下文。
* **定价:** 请参阅 [Anthropic 定价](https://www.anthropic.com/pricing)
页面获取最新定价信息。
* **速率限制:** Anthropic 根据 [使用层级](https://docs.anthropic.com/en/api/rate-limits#requirements-to-advance-tier)
设置了严格的速率限制。如果您反复遇到速率限制,请考虑联系 Anthropic 销售或通过 [OpenRouter](https://kilocode.ai/docs/zh-CN/providers/openrouter)
或 [Requesty](https://kilocode.ai/docs/zh-CN/providers/requesty)
等其他提供商访问 Claude。
* [获取 API 密钥](https://kilocode.ai/docs/zh-CN/providers/kilocode#%E8%8E%B7%E5%8F%96-api-%E5%AF%86%E9%92%A5)
* [支持的模型](https://kilocode.ai/docs/zh-CN/providers/kilocode#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B)
* [在 Kilo Code 中配置](https://kilocode.ai/docs/zh-CN/providers/kilocode#%E5%9C%A8-kilo-code-%E4%B8%AD%E9%85%8D%E7%BD%AE)
* [提示和注意事项](https://kilocode.ai/docs/zh-CN/providers/kilocode#%E6%8F%90%E7%A4%BA%E5%92%8C%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fproviders%2Fkilocode)
---
# 人工中继提供商 | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/providers/human-relay#__docusaurus_skipToContent_fallback)
本页总览
人工中继提供商允许您在不需要 API 密钥的情况下,使用基于 Web 的 AI 模型(如 ChatGPT 或 Claude)与 Kilo Code 配合使用。相反,它依赖于您在 Kilo Code 和 AI 的 Web 界面之间手动传递消息。
工作原理[](https://kilocode.ai/docs/zh-CN/providers/human-relay#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86 "工作原理的直接链接")
---------------------------------------------------------------------------------------------------------------
1. **选择人工中继:** 在 Kilo Code 的设置中选择 "人工中继" 作为您的 API 提供商。无需 API 密钥。
2. **发起请求:** 像往常一样开始与 Kilo Code 的聊天或任务。
3. **对话框提示:** 在 VS Code 中会弹出一个对话框。您发送给 AI 的消息会自动复制到剪贴板。
4. **粘贴到 Web AI:** 前往您选择的 AI 的 Web 界面(例如,chat.openai.com, claude.ai),并将剪贴板中的消息粘贴到聊天输入框中。
5. **复制 AI 的回复:** 当 AI 回复后,复制其完整的回复文本。
6. **粘贴回 Kilo Code:** 返回 VS Code 中的对话框,将 AI 的回复粘贴到指定字段中,然后点击“确认”。
7. **继续:** Kilo Code 会像处理直接来自 API 的响应一样处理该回复。
使用场景[](https://kilocode.ai/docs/zh-CN/providers/human-relay#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF "使用场景的直接链接")
---------------------------------------------------------------------------------------------------------------
此提供商在以下情况下有用:
* 您想使用不提供直接 API 访问的模型。
* 您不希望管理 API 密钥。
* 您需要利用某些 AI 模型的 Web UI 中提供的特定功能或上下文。
限制[](https://kilocode.ai/docs/zh-CN/providers/human-relay#%E9%99%90%E5%88%B6 "限制的直接链接")
-----------------------------------------------------------------------------------------
* **手动操作:** 需要在 VS Code 和浏览器之间不断进行复制粘贴。
* **交互速度较慢:** 来回传递的过程比直接 API 集成要慢得多。
* **可能出现错误:** 手动复制粘贴可能会引入错误或遗漏。
当使用特定 Web AI 的好处超过了手动中继过程的不便时,请选择此提供商。
* [工作原理](https://kilocode.ai/docs/zh-CN/providers/human-relay#%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86)
* [使用场景](https://kilocode.ai/docs/zh-CN/providers/human-relay#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF)
* [限制](https://kilocode.ai/docs/zh-CN/providers/human-relay#%E9%99%90%E5%88%B6)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fproviders%2Fhuman-relay)
---
# 在Kilo Code中使用AWS Bedrock | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/providers/bedrock#__docusaurus_skipToContent_fallback)
本页总览
Kilo Code支持通过Amazon Bedrock访问模型,这是一个完全托管的服务,通过单一API提供来自领先AI公司的高性能基础模型(FMs)。
**官网:** [https://aws.amazon.com/bedrock/](https://aws.amazon.com/bedrock/)
前提条件[](https://kilocode.ai/docs/zh-CN/providers/bedrock#%E5%89%8D%E6%8F%90%E6%9D%A1%E4%BB%B6 "前提条件的直接链接")
-----------------------------------------------------------------------------------------------------------
* **AWS账户:** 需要有效的AWS账户
* **Bedrock访问权限:** 必须申请并获得Amazon Bedrock的访问权限。详见[AWS Bedrock文档](https://docs.aws.amazon.com/bedrock/latest/userguide/getting-started.html)
* **模型访问权限:** 需要在Bedrock中申请使用特定模型(如Anthropic Claude)的权限
* **安装AWS CLI:** 使用AWS CLI配置账户认证
aws configure
获取凭证[](https://kilocode.ai/docs/zh-CN/providers/bedrock#%E8%8E%B7%E5%8F%96%E5%87%AD%E8%AF%81 "获取凭证的直接链接")
-----------------------------------------------------------------------------------------------------------
有两种主要配置方式:
1. **AWS访问密钥(推荐用于开发):**
* 创建具有必要权限的IAM用户(至少需要`bedrock:InvokeModel`)
* 生成该用户的访问密钥ID和秘密访问密钥
* (可选)根据IAM配置需要创建会话令牌
2. **AWS配置文件:**
* 使用AWS CLI或手动编辑AWS凭证文件配置配置文件。详见[AWS CLI文档](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html)
支持的模型[](https://kilocode.ai/docs/zh-CN/providers/bedrock#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B "支持的模型的直接链接")
----------------------------------------------------------------------------------------------------------------------
根据源代码,Kilo Code支持通过Bedrock访问以下模型:
* **Amazon:**
* `amazon.nova-pro-v1:0`
* `amazon.nova-pro-latency-optimized-v1:0`
* `amazon.nova-lite-v1:0`
* `amazon.nova-micro-v1:0`
* `amazon.titan-text-lite-v1:0`
* `amazon.titan-text-express-v1:0`
* `amazon.titan-text-embeddings-v1:0`
* `amazon.titan-text-embeddings-v2:0`
* **Anthropic:**
* `anthropic.claude-3-7-sonnet-20250219-v1:0`
* `anthropic.claude-3-5-sonnet-20241022-v2:0`
* `anthropic.claude-3-5-haiku-20241022-v1:0`
* `anthropic.claude-3-5-sonnet-20240620-v1:0`
* `anthropic.claude-3-opus-20240229-v1:0`
* `anthropic.claude-3-sonnet-20240229-v1:0`
* `anthropic.claude-3-haiku-20240307-v1:0`
* `anthropic.claude-2-1-v1:0`
* `anthropic.claude-2-0-v1:0`
* `anthropic.claude-instant-v1:0`
* **DeepSeek:**
* `deepseek.r1-v1:0`
* **Meta:**
* `meta.llama3-3-70b-instruct-v1:0`
* `meta.llama3-2-90b-instruct-v1:0`
* `meta.llama3-2-11b-instruct-v1:0`
* `meta.llama3-2-3b-instruct-v1:0`
* `meta.llama3-2-1b-instruct-v1:0`
* `meta.llama3-1-405b-instruct-v1:0`
* `meta.llama3-1-70b-instruct-v1:0`
* `meta.llama3-1-70b-instruct-latency-optimized-v1:0`
* `meta.llama3-1-8b-instruct-v1:0`
* `meta.llama3-70b-instruct-v1:0`
* `meta.llama3-8b-instruct-v1:0`
请参考[Amazon Bedrock文档](https://docs.aws.amazon.com/bedrock/latest/userguide/models-supported.html)
获取最新可用模型及其ID列表。配置Kilo Code时请使用_模型ID_而非模型名称。
在Kilo Code中配置[](https://kilocode.ai/docs/zh-CN/providers/bedrock#%E5%9C%A8kilo-code%E4%B8%AD%E9%85%8D%E7%BD%AE "在Kilo Code中配置的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------
1. **打开Kilo Code设置:** 点击Kilo Code面板中的齿轮图标()
2. **选择提供商:** 在"API Provider"下拉菜单中选择"Bedrock"
3. **选择认证方式:**
* **AWS凭证:**
* 输入"AWS Access Key"和"AWS Secret Key"
* (可选)如果使用临时凭证,输入"AWS Session Token"
* **AWS配置文件:**
* 输入AWS配置文件名称(如"default")
4. **选择区域:** 选择Bedrock服务可用的AWS区域(如"us-east-1")
5. **(可选)跨区域推理:** 如果要访问与配置的AWS区域不同的区域中的模型,请勾选"Use cross-region inference"
6. **选择模型:** 从"Model"下拉菜单中选择所需模型
提示与注意事项[](https://kilocode.ai/docs/zh-CN/providers/bedrock#%E6%8F%90%E7%A4%BA%E4%B8%8E%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9 "提示与注意事项的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------------
* **权限:** 确保IAM用户或角色具有调用Bedrock模型所需的权限,需要`bedrock:InvokeModel`权限
* **定价:** 参考[Amazon Bedrock定价](https://aws.amazon.com/bedrock/pricing/)
页面了解模型费用详情
* **跨区域推理:** 使用跨区域推理可能会导致延迟增加
* [前提条件](https://kilocode.ai/docs/zh-CN/providers/bedrock#%E5%89%8D%E6%8F%90%E6%9D%A1%E4%BB%B6)
* [获取凭证](https://kilocode.ai/docs/zh-CN/providers/bedrock#%E8%8E%B7%E5%8F%96%E5%87%AD%E8%AF%81)
* [支持的模型](https://kilocode.ai/docs/zh-CN/providers/bedrock#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B)
* [在Kilo Code中配置](https://kilocode.ai/docs/zh-CN/providers/bedrock#%E5%9C%A8kilo-code%E4%B8%AD%E9%85%8D%E7%BD%AE)
* [提示与注意事项](https://kilocode.ai/docs/zh-CN/providers/bedrock#%E6%8F%90%E7%A4%BA%E4%B8%8E%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fproviders%2Fbedrock)
---
# Using Claude Code With Kilo Code | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/providers/claude-code#__docusaurus_skipToContent_fallback)
本页总览
Claude Code is Anthropic's official CLI that provides direct access to Claude models from your terminal. Using Claude Code with Kilo Code lets you leverage your existing CLI setup without needing separate API keys.
**Website:** [https://docs.anthropic.com/en/docs/claude-code/setup](https://docs.anthropic.com/en/docs/claude-code/setup)
Installing and Setting Up Claude Code[](https://kilocode.ai/docs/zh-CN/providers/claude-code#installing-and-setting-up-claude-code "Installing and Setting Up Claude Code的直接链接")
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1. **Install Claude Code:** Follow the installation instructions at [Anthropic's Claude Code documentation](https://docs.anthropic.com/en/docs/claude-code/setup)
.
2. **Authenticate:** Run `claude` in your terminal. Claude Code offers multiple authentication options including the Anthropic Console (default), Claude App with Pro/Max plans, and enterprise platforms like Amazon Bedrock or Google Vertex AI. See [Anthropic's authentication documentation](https://docs.anthropic.com/en/docs/claude-code/setup)
for complete details.
3. **Verify Installation:** Test that everything works by running `claude --version` in your terminal.
Supported Models[](https://kilocode.ai/docs/zh-CN/providers/claude-code#supported-models "Supported Models的直接链接")
-------------------------------------------------------------------------------------------------------------------
Kilo Code supports the following Claude models through Claude Code:
* `claude-sonnet-4` (Recommended)
* `claude-4-opus`
The specific models available depend on your Claude subscription and plan. See [Anthropic's Model Documentation](https://docs.anthropic.com/en/docs/about-claude/models)
for more details on each model's capabilities.
Configuration in Kilo Code[](https://kilocode.ai/docs/zh-CN/providers/claude-code#configuration-in-kilo-code "Configuration in Kilo Code的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------------------
1. **Open Kilo Code Settings:** Click the gear icon () in the Kilo Code panel.
2. **Select Provider:** Choose "Claude Code" from the "API Provider" dropdown.
3. **Select Model:** Choose your desired Claude model from the "Model" dropdown.
4. **(Optional) Custom CLI Path:** If you installed Claude Code to a location other than the default `claude` command, enter the full path to your Claude executable in the "Claude Code Path" field. Most users won't need to change this.
Tips and Notes[](https://kilocode.ai/docs/zh-CN/providers/claude-code#tips-and-notes "Tips and Notes的直接链接")
-------------------------------------------------------------------------------------------------------------
* **No API Keys Required:** Claude Code uses your existing CLI authentication, so you don't need to manage separate API keys.
* **Cost Transparency:** Usage costs are reported directly by the Claude CLI, giving you clear visibility into your spending.
* **Advanced Reasoning:** Full support for Claude's thinking modes and reasoning capabilities when available.
* **Context Windows:** Claude models have large context windows, allowing you to include significant amounts of code and context in your prompts.
* **Enhance Prompt Feature:** Full compatibility with Kilo Code's Enhance Prompt feature, allowing you to automatically improve and refine your prompts before sending them to Claude.
* **Custom Paths:** If you installed Claude Code in a non-standard location, you can specify the full path in the settings. Examples:
* Windows: `C:\tools\claude\claude.exe`
* macOS/Linux: `/usr/local/bin/claude` or `~/bin/claude`
Troubleshooting[](https://kilocode.ai/docs/zh-CN/providers/claude-code#troubleshooting "Troubleshooting的直接链接")
----------------------------------------------------------------------------------------------------------------
* **"Claude Code process exited with error":** Verify Claude Code is installed (`claude --version`) and authenticated (`claude auth login`). Make sure your subscription includes the selected model.
* **Custom path not working:** Use the full absolute path to the Claude executable and verify the file exists and is executable. On Windows, include the `.exe` extension.
* [Installing and Setting Up Claude Code](https://kilocode.ai/docs/zh-CN/providers/claude-code#installing-and-setting-up-claude-code)
* [Supported Models](https://kilocode.ai/docs/zh-CN/providers/claude-code#supported-models)
* [Configuration in Kilo Code](https://kilocode.ai/docs/zh-CN/providers/claude-code#configuration-in-kilo-code)
* [Tips and Notes](https://kilocode.ai/docs/zh-CN/providers/claude-code#tips-and-notes)
* [Troubleshooting](https://kilocode.ai/docs/zh-CN/providers/claude-code#troubleshooting)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fproviders%2Fclaude-code)
---
# 在 Kilo Code 中使用 OpenAI | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/providers/openai#__docusaurus_skipToContent_fallback)
本页总览
Kilo Code 支持通过官方 OpenAI API 直接访问模型。
**官方网站:** [https://openai.com/](https://openai.com/)
获取 API 密钥[](https://kilocode.ai/docs/zh-CN/providers/openai#%E8%8E%B7%E5%8F%96-api-%E5%AF%86%E9%92%A5 "获取 API 密钥的直接链接")
-------------------------------------------------------------------------------------------------------------------------
1. **注册/登录:** 访问 [OpenAI 平台](https://platform.openai.com/)
。创建账户或登录
2. **导航到 API 密钥:** 前往 [API keys](https://platform.openai.com/api-keys)
页面
3. **创建密钥:** 点击 "Create new secret key"。为密钥起一个描述性名称(如 "Kilo Code")
4. **复制密钥:** **重要:** 立即复制 API 密钥。之后将无法再次查看。请安全存储
支持的模型[](https://kilocode.ai/docs/zh-CN/providers/openai#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B "支持的模型的直接链接")
---------------------------------------------------------------------------------------------------------------------
Kilo Code 支持多种 OpenAI 模型,包括:
* `o3-mini` (中等推理能力)
* `o3-mini-high` (高推理能力)
* `o3-mini-low` (低推理能力)
* `o1`
* `o1-preview`
* `o1-mini`
* `gpt-4.5-preview`
* `gpt-4o`
* `gpt-4o-mini`
请参考 [OpenAI 模型文档](https://platform.openai.com/docs/models)
获取最新的模型列表和能力说明。
在 Kilo Code 中配置[](https://kilocode.ai/docs/zh-CN/providers/openai#%E5%9C%A8-kilo-code-%E4%B8%AD%E9%85%8D%E7%BD%AE "在 Kilo Code 中配置的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------------
1. **打开 Kilo Code 设置:** 点击 Kilo Code 面板中的齿轮图标 ()
2. **选择提供商:** 从 "API Provider" 下拉菜单中选择 "OpenAI"
3. **输入 API 密钥:** 将你的 OpenAI API 密钥粘贴到 "OpenAI API Key" 字段
4. **选择模型:** 从 "Model" 下拉菜单中选择你需要的模型
提示和注意事项[](https://kilocode.ai/docs/zh-CN/providers/openai#%E6%8F%90%E7%A4%BA%E5%92%8C%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9 "提示和注意事项的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------------
* **定价:** 请参考 [OpenAI 定价](https://openai.com/pricing)
页面了解模型成本详情
* **Azure OpenAI 服务:** 如需使用 Azure OpenAI 服务,请参阅我们的 [OpenAI 兼容](https://kilocode.ai/docs/zh-CN/providers/openai-compatible)
提供商章节
* [获取 API 密钥](https://kilocode.ai/docs/zh-CN/providers/openai#%E8%8E%B7%E5%8F%96-api-%E5%AF%86%E9%92%A5)
* [支持的模型](https://kilocode.ai/docs/zh-CN/providers/openai#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B)
* [在 Kilo Code 中配置](https://kilocode.ai/docs/zh-CN/providers/openai#%E5%9C%A8-kilo-code-%E4%B8%AD%E9%85%8D%E7%BD%AE)
* [提示和注意事项](https://kilocode.ai/docs/zh-CN/providers/openai#%E6%8F%90%E7%A4%BA%E5%92%8C%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fproviders%2Fopenai)
---
# Using v0 With Kilo Code | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/providers/v0#__docusaurus_skipToContent_fallback)
本页总览
Kilo Code supports v0, Vercel's AI model provider that offers an OpenAI-compatible API. This allows you to use v0's models with Kilo Code through the familiar OpenAI API interface.
Prerequisites[](https://kilocode.ai/docs/zh-CN/providers/v0#prerequisites "Prerequisites的直接链接")
-------------------------------------------------------------------------------------------------
To use v0 with Kilo Code, you'll need:
* A team account with Vercel v0
* A v0 API key
Configuration[](https://kilocode.ai/docs/zh-CN/providers/v0#configuration "Configuration的直接链接")
-------------------------------------------------------------------------------------------------
Setting up v0 in Kilo Code is straightforward:
1. In Kilo Code settings (click the icon):
* Under **API Provider**, select: **OpenAI Compatible**
* Set the **Base URL**: `https://api.v0.dev/v1`
* Paste in your v0 API key
* Set the **Model ID**: `v0-1.0-md`
* Click **Verify** to confirm the connection

Supported Models[](https://kilocode.ai/docs/zh-CN/providers/v0#supported-models "Supported Models的直接链接")
----------------------------------------------------------------------------------------------------------
Currently, v0 offers the following model:
* `v0-1.0-md` - v0's multimodal model that supports both text and image inputs
* `v0-1.5-lg` - composite model ([learn more](https://vercel.com/blog/v0-composite-model-family)
)
* `v0-1.5.md` - composite model ([learn more](https://vercel.com/blog/v0-composite-model-family)
)
Troubleshooting[](https://kilocode.ai/docs/zh-CN/providers/v0#troubleshooting "Troubleshooting的直接链接")
-------------------------------------------------------------------------------------------------------
* **"Invalid API Key":** Double-check that you've entered the API key correctly.
* **"Model Not Found":** Make sure you're using the correct model ID (`v0-1.0-md`).
* **Connection Errors:** Verify the Base URL is correct (`https://api.v0.dev/v1`).
* **Access Issues:** Confirm that your Vercel v0 team account is active and properly set up.
Additional Resources[](https://kilocode.ai/docs/zh-CN/providers/v0#additional-resources "Additional Resources的直接链接")
----------------------------------------------------------------------------------------------------------------------
* [v0 Official Documentation](https://v0.dev/)
* [Vercel AI Documentation](https://vercel.com/docs/ai)
* [Prerequisites](https://kilocode.ai/docs/zh-CN/providers/v0#prerequisites)
* [Configuration](https://kilocode.ai/docs/zh-CN/providers/v0#configuration)
* [Supported Models](https://kilocode.ai/docs/zh-CN/providers/v0#supported-models)
* [Troubleshooting](https://kilocode.ai/docs/zh-CN/providers/v0#troubleshooting)
* [Additional Resources](https://kilocode.ai/docs/zh-CN/providers/v0#additional-resources)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fproviders%2Fv0)
---
# 在Kilo Code中使用OpenRouter | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/providers/openrouter#__docusaurus_skipToContent_fallback)
本页总览
OpenRouter是一个AI平台,提供来自不同供应商的各种语言模型访问,所有功能都通过单一API实现。这可以简化设置并让你轻松尝试不同模型。
**网站:** [https://openrouter.ai/](https://openrouter.ai/)
获取API密钥[](https://kilocode.ai/docs/zh-CN/providers/openrouter#%E8%8E%B7%E5%8F%96api%E5%AF%86%E9%92%A5 "获取API密钥的直接链接")
-----------------------------------------------------------------------------------------------------------------------
1. **注册/登录:** 访问[OpenRouter网站](https://openrouter.ai/)
。使用你的Google或GitHub账号登录。
2. **获取API密钥:** 进入[密钥页面](https://openrouter.ai/keys)
。你应该能看到列出的API密钥。如果没有,请创建新密钥。
3. **复制密钥:** 复制API密钥。
支持的模型[](https://kilocode.ai/docs/zh-CN/providers/openrouter#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B "支持的模型的直接链接")
-------------------------------------------------------------------------------------------------------------------------
OpenRouter支持大量且不断增长的模型。Kilo Code会自动获取可用模型列表。请参考[OpenRouter模型页面](https://openrouter.ai/models)
获取完整和最新的列表。
在Kilo Code中配置[](https://kilocode.ai/docs/zh-CN/providers/openrouter#%E5%9C%A8kilo-code%E4%B8%AD%E9%85%8D%E7%BD%AE "在Kilo Code中配置的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------------
1. **打开Kilo Code设置:** 点击Kilo Code面板中的齿轮图标()。
2. **选择供应商:** 从"API Provider"下拉菜单中选择"OpenRouter"。
3. **输入API密钥:** 将OpenRouter API密钥粘贴到"OpenRouter API Key"字段。
4. **选择模型:** 从"Model"下拉菜单中选择你需要的模型。
5. **(可选)自定义基础URL:** 如果需要为OpenRouter API使用自定义基础URL,请勾选"Use custom base URL"并输入URL。大多数用户应留空此项。
支持的转换[](https://kilocode.ai/docs/zh-CN/providers/openrouter#%E6%94%AF%E6%8C%81%E7%9A%84%E8%BD%AC%E6%8D%A2 "支持的转换的直接链接")
-------------------------------------------------------------------------------------------------------------------------
OpenRouter提供[可选的"middle-out"消息转换](https://openrouter.ai/docs/features/message-transforms)
功能,帮助处理超过模型最大上下文大小的提示。你可以通过勾选"Compress prompts and message chains to the context size"框来启用它。
提示和注意事项[](https://kilocode.ai/docs/zh-CN/providers/openrouter#%E6%8F%90%E7%A4%BA%E5%92%8C%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9 "提示和注意事项的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------------------
* **模型选择:** OpenRouter提供多种模型。尝试找到最适合你需求的模型。
* **定价:** OpenRouter根据基础模型的定价收费。详情请参阅[OpenRouter模型页面](https://openrouter.ai/models)
。
* **提示缓存:** 部分供应商支持提示缓存。请参阅OpenRouter文档了解支持的模型。
* [获取API密钥](https://kilocode.ai/docs/zh-CN/providers/openrouter#%E8%8E%B7%E5%8F%96api%E5%AF%86%E9%92%A5)
* [支持的模型](https://kilocode.ai/docs/zh-CN/providers/openrouter#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B)
* [在Kilo Code中配置](https://kilocode.ai/docs/zh-CN/providers/openrouter#%E5%9C%A8kilo-code%E4%B8%AD%E9%85%8D%E7%BD%AE)
* [支持的转换](https://kilocode.ai/docs/zh-CN/providers/openrouter#%E6%94%AF%E6%8C%81%E7%9A%84%E8%BD%AC%E6%8D%A2)
* [提示和注意事项](https://kilocode.ai/docs/zh-CN/providers/openrouter#%E6%8F%90%E7%A4%BA%E5%92%8C%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fproviders%2Fopenrouter)
---
# 在 Kilo Code 中使用 Unbound | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/providers/unbound#__docusaurus_skipToContent_fallback)
本页总览
Kilo Code 支持通过 [Unbound](https://getunbound.ai/)
访问模型,该平台专注于提供安全可靠的多种大型语言模型 (LLMs) 访问。Unbound 充当网关,允许您使用来自 Anthropic 和 OpenAI 等提供商的模型,而无需直接管理多个 API 密钥和配置。他们强调企业级的安全和合规功能。
**网站:** [https://getunbound.ai/](https://getunbound.ai/)
创建账户[](https://kilocode.ai/docs/zh-CN/providers/unbound#%E5%88%9B%E5%BB%BA%E8%B4%A6%E6%88%B7 "创建账户的直接链接")
-----------------------------------------------------------------------------------------------------------
1. **注册/登录:** 访问 [Unbound 网关](https://gateway.getunbound.ai/)
。创建账户或登录。
2. **创建应用程序:** 转到 [应用程序](https://gateway.getunbound.ai/ai-gateway-applications)
页面并点击 "创建应用程序" 按钮。
3. **复制 API 密钥:** 将 API 密钥复制到剪贴板。
支持的模型[](https://kilocode.ai/docs/zh-CN/providers/unbound#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B "支持的模型的直接链接")
----------------------------------------------------------------------------------------------------------------------
Unbound 允许您在应用程序中配置支持的模型列表,Kilo Code 会自动从 Unbound API 获取可用模型列表。
在 Kilo Code 中配置[](https://kilocode.ai/docs/zh-CN/providers/unbound#%E5%9C%A8-kilo-code-%E4%B8%AD%E9%85%8D%E7%BD%AE "在 Kilo Code 中配置的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------------
1. **打开 Kilo Code 设置:** 点击 Kilo Code 面板中的齿轮图标 ()。
2. **选择提供商:** 从 "API 提供商" 下拉菜单中选择 "Unbound"。
3. **输入 API 密钥:** 将您的 Unbound API 密钥粘贴到 "Unbound API 密钥" 字段中。
4. **选择模型:** 从 "模型" 下拉菜单中选择您想要的模型。
提示和注意事项[](https://kilocode.ai/docs/zh-CN/providers/unbound#%E6%8F%90%E7%A4%BA%E5%92%8C%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9 "提示和注意事项的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------------
* **安全重点:** Unbound 强调企业级的安全功能。如果您的组织对 AI 使用有严格的安全要求,Unbound 可能是一个不错的选择。
* [创建账户](https://kilocode.ai/docs/zh-CN/providers/unbound#%E5%88%9B%E5%BB%BA%E8%B4%A6%E6%88%B7)
* [支持的模型](https://kilocode.ai/docs/zh-CN/providers/unbound#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B)
* [在 Kilo Code 中配置](https://kilocode.ai/docs/zh-CN/providers/unbound#%E5%9C%A8-kilo-code-%E4%B8%AD%E9%85%8D%E7%BD%AE)
* [提示和注意事项](https://kilocode.ai/docs/zh-CN/providers/unbound#%E6%8F%90%E7%A4%BA%E5%92%8C%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fproviders%2Funbound)
---
# 使用 OpenAI 兼容的提供商与 Kilo Code | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/providers/openai-compatible#__docusaurus_skipToContent_fallback)
本页总览
Kilo Code 支持多种提供 OpenAI API 标准兼容的 AI 模型提供商。这意味着你可以使用 _除了_ OpenAI 之外的其他提供商的模型,同时仍然使用熟悉的 API 接口。这包括以下提供商:
* **本地模型** 通过 Ollama 和 LM Studio 等工具运行(在单独的部分中介绍)。
* **云提供商** 如 Perplexity、Together AI、Anyscale 等。
* **任何其他** 提供 OpenAI 兼容 API 端点的提供商。
本文档重点介绍 _除了_ 官方 OpenAI API 之外的提供商的设置(官方 OpenAI API 有[专门的配置页面](https://kilocode.ai/docs/zh-CN/providers/openai)
)。
通用配置[](https://kilocode.ai/docs/zh-CN/providers/openai-compatible#%E9%80%9A%E7%94%A8%E9%85%8D%E7%BD%AE "通用配置的直接链接")
---------------------------------------------------------------------------------------------------------------------
使用 OpenAI 兼容提供商的关键是配置两个主要设置:
1. **基础 URL:** 这是提供商的 API 端点。它 _不会_ 是 `https://api.openai.com/v1`(这是官方 OpenAI API 的地址)。
2. **API 密钥:** 这是你从提供商处获取的密钥。
3. **模型 ID:** 这是特定模型的名称。
你可以在 Kilo Code 设置面板中找到这些设置(点击 图标):
* **API 提供商:** 选择 "OpenAI 兼容"。
* **基础 URL:** 输入你选择的提供商提供的基础 URL。**这非常关键。**
* **API 密钥:** 输入你的 API 密钥。
* **模型:** 选择一个模型。
* **模型配置:** 这允许你为模型自定义高级配置
* 最大输出 tokens
* 上下文窗口
* 图像支持
* 计算机使用
* 输入价格
* 输出价格
支持的模型(适用于 OpenAI 原生端点)[](https://kilocode.ai/docs/zh-CN/providers/openai-compatible#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B%E9%80%82%E7%94%A8%E4%BA%8E-openai-%E5%8E%9F%E7%94%9F%E7%AB%AF%E7%82%B9 "支持的模型(适用于 OpenAI 原生端点)的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
虽然此提供商类型允许连接到各种端点,但如果你直接连接到官方 OpenAI API(或完全镜像它的端点),Kilo Code 会根据其源代码中的 `openAiNativeModels` 定义识别以下模型 ID:
* `o3-mini`
* `o3-mini-high`
* `o3-mini-low`
* `o1`
* `o1-preview`
* `o1-mini`
* `gpt-4.5-preview`
* `gpt-4o`
* `gpt-4o-mini`
**注意:** 如果你使用其他 OpenAI 兼容的提供商(如 Together AI、Anyscale 等),可用的模型 ID 会有所不同。请始终参考你特定提供商的文档以获取支持的模型名称。
故障排除[](https://kilocode.ai/docs/zh-CN/providers/openai-compatible#%E6%95%85%E9%9A%9C%E6%8E%92%E9%99%A4 "故障排除的直接链接")
---------------------------------------------------------------------------------------------------------------------
* **"无效的 API 密钥":** 请仔细检查你是否正确输入了 API 密钥。
* **"未找到模型":** 确保你使用的模型 ID 对你选择的提供商有效。
* **连接错误:** 验证基础 URL 是否正确,以及你的提供商 API 是否可访问。
* **意外结果:** 如果你得到意外的结果,请尝试使用不同的模型。
通过使用 OpenAI 兼容的提供商,你可以利用 Kilo Code 的灵活性与更广泛的 AI 模型。请始终参考你提供商的文档以获取最准确和最新的信息。
* [通用配置](https://kilocode.ai/docs/zh-CN/providers/openai-compatible#%E9%80%9A%E7%94%A8%E9%85%8D%E7%BD%AE)
* [支持的模型(适用于 OpenAI 原生端点)](https://kilocode.ai/docs/zh-CN/providers/openai-compatible#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B%E9%80%82%E7%94%A8%E4%BA%8E-openai-%E5%8E%9F%E7%94%9F%E7%AB%AF%E7%82%B9)
* [故障排除](https://kilocode.ai/docs/zh-CN/providers/openai-compatible#%E6%95%85%E9%9A%9C%E6%8E%92%E9%99%A4)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fproviders%2Fopenai-compatible)
---
# Using Groq With Kilo Code | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/providers/groq#__docusaurus_skipToContent_fallback)
本页总览
Groq provides ultra-fast inference for various AI models through their high-performance infrastructure. Kilo Code supports accessing models through the Groq API.
**Website:** [https://groq.com/](https://groq.com/)
Getting an API Key[](https://kilocode.ai/docs/zh-CN/providers/groq#getting-an-api-key "Getting an API Key的直接链接")
------------------------------------------------------------------------------------------------------------------
To use Groq with Kilo Code, you'll need an API key from the [GroqCloud Console](https://console.groq.com/)
. After signing up or logging in, navigate to the API Keys section of your dashboard to create and copy your key.
Supported Models[](https://kilocode.ai/docs/zh-CN/providers/groq#supported-models "Supported Models的直接链接")
------------------------------------------------------------------------------------------------------------
Kilo Code will attempt to fetch the list of available models from the Groq API. Common models available via Groq include:
* `llama3-8b-8192`
* `llama3-70b-8192`
* `mixtral-8x7b-32768`
* `gemma-7b-it`
* `moonshotai/kimi-k2-instruct` (Kimi K2 model)
**Note:** Model availability and specifications may change. Refer to the [Groq Documentation](https://console.groq.com/docs/models)
for the most up-to-date list of supported models and their capabilities.
Configuration in Kilo Code[](https://kilocode.ai/docs/zh-CN/providers/groq#configuration-in-kilo-code "Configuration in Kilo Code的直接链接")
------------------------------------------------------------------------------------------------------------------------------------------
1. **Open Kilo Code Settings:** Click the gear icon () in the Kilo Code panel.
2. **Select Provider:** Choose "Groq" from the "API Provider" dropdown.
3. **Enter API Key:** Paste your Groq API key into the "Groq API Key" field.
4. **Select Model:** Choose your desired model from the "Model" dropdown.
Tips and Notes[](https://kilocode.ai/docs/zh-CN/providers/groq#tips-and-notes "Tips and Notes的直接链接")
------------------------------------------------------------------------------------------------------
* **High-Speed Inference:** Groq's LPUs provide exceptionally fast response times, making it ideal for interactive development workflows.
* **Token Limits:** Some models have specific `max_tokens` limits that are automatically handled by Kilo Code (e.g., the `moonshotai/kimi-k2-instruct` model).
* **Cost Efficiency:** Groq often provides competitive pricing for high-speed inference compared to other providers.
* **Model Selection:** Choose models based on your specific needs - larger models like `llama3-70b-8192` for complex reasoning tasks, or smaller models like `llama3-8b-8192` for faster, simpler operations.
Supported Models[](https://kilocode.ai/docs/zh-CN/providers/groq#supported-models-1 "Supported Models的直接链接")
--------------------------------------------------------------------------------------------------------------
Kilo Code supports the following models through Groq:
| Model ID | Provider | Context Window | Notes |
| --- | --- | --- | --- |
| `moonshotai/kimi-k2-instruct` | Moonshot AI | 128K tokens | Optimized max\_tokens limit configured |
| `llama-3.3-70b-versatile` | Meta | 128K tokens | High-performance Llama model |
| `llama-3.1-70b-versatile` | Meta | 128K tokens | Versatile reasoning capabilities |
| `llama-3.1-8b-instant` | Meta | 128K tokens | Fast inference for quick tasks |
| `mixtral-8x7b-32768` | Mistral AI | 32K tokens | Mixture of experts architecture |
**Note:** Model availability may change. Refer to the [Groq documentation](https://console.groq.com/docs/models)
for the latest model list and specifications.
Configuration in Kilo Code[](https://kilocode.ai/docs/zh-CN/providers/groq#configuration-in-kilo-code-1 "Configuration in Kilo Code的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------------
1. **Open Kilo Code Settings:** Click the gear icon () in the Kilo Code panel.
2. **Select Provider:** Choose "Groq" from the "API Provider" dropdown.
3. **Enter API Key:** Paste your Groq API key into the "Groq API Key" field.
4. **Select Model:** Choose your desired model from the "Model" dropdown.
Model-Specific Features[](https://kilocode.ai/docs/zh-CN/providers/groq#model-specific-features "Model-Specific Features的直接链接")
---------------------------------------------------------------------------------------------------------------------------------
### Kimi K2 Model[](https://kilocode.ai/docs/zh-CN/providers/groq#kimi-k2-model "Kimi K2 Model的直接链接")
The `moonshotai/kimi-k2-instruct` model includes optimized configuration:
* **Max Tokens Limit:** Automatically configured with appropriate limits for optimal performance
* **Context Understanding:** Excellent for complex reasoning and long-context tasks
* **Multilingual Support:** Strong performance across multiple languages
Tips and Notes[](https://kilocode.ai/docs/zh-CN/providers/groq#tips-and-notes-1 "Tips and Notes的直接链接")
--------------------------------------------------------------------------------------------------------
* **Ultra-Fast Inference:** Groq's hardware acceleration provides exceptionally fast response times
* **Cost-Effective:** Competitive pricing for high-performance inference
* **Rate Limits:** Be aware of API rate limits based on your Groq plan
* **Model Selection:** Choose models based on your specific use case:
* **Kimi K2**: Best for complex reasoning and multilingual tasks
* **Llama 3.3 70B**: Excellent general-purpose performance
* **Llama 3.1 8B Instant**: Fastest responses for simple tasks
* **Mixtral**: Good balance of performance and efficiency
Troubleshooting[](https://kilocode.ai/docs/zh-CN/providers/groq#troubleshooting "Troubleshooting的直接链接")
---------------------------------------------------------------------------------------------------------
* **"Invalid API Key":** Verify your API key is correct and active in the Groq Console
* **"Model Not Available":** Check if the selected model is available in your region
* **Rate Limit Errors:** Monitor your usage in the Groq Console and consider upgrading your plan
* **Connection Issues:** Ensure you have a stable internet connection and Groq services are operational
Pricing[](https://kilocode.ai/docs/zh-CN/providers/groq#pricing "Pricing的直接链接")
---------------------------------------------------------------------------------
Groq offers competitive pricing based on input and output tokens. Visit the [Groq pricing page](https://groq.com/pricing/)
for current rates and plan options.
* [Getting an API Key](https://kilocode.ai/docs/zh-CN/providers/groq#getting-an-api-key)
* [Supported Models](https://kilocode.ai/docs/zh-CN/providers/groq#supported-models)
* [Configuration in Kilo Code](https://kilocode.ai/docs/zh-CN/providers/groq#configuration-in-kilo-code)
* [Tips and Notes](https://kilocode.ai/docs/zh-CN/providers/groq#tips-and-notes)
* [Supported Models](https://kilocode.ai/docs/zh-CN/providers/groq#supported-models-1)
* [Configuration in Kilo Code](https://kilocode.ai/docs/zh-CN/providers/groq#configuration-in-kilo-code-1)
* [Model-Specific Features](https://kilocode.ai/docs/zh-CN/providers/groq#model-specific-features)
* [Kimi K2 Model](https://kilocode.ai/docs/zh-CN/providers/groq#kimi-k2-model)
* [Tips and Notes](https://kilocode.ai/docs/zh-CN/providers/groq#tips-and-notes-1)
* [Troubleshooting](https://kilocode.ai/docs/zh-CN/providers/groq#troubleshooting)
* [Pricing](https://kilocode.ai/docs/zh-CN/providers/groq#pricing)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fproviders%2Fgroq)
---
# 在Kilo Code中使用Mistral AI | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/providers/mistral#__docusaurus_skipToContent_fallback)
本页总览
Kilo Code支持通过Mistral AI API访问模型,包括标准Mistral模型和专门用于代码的Codestral模型。
**官网:** [https://mistral.ai/](https://mistral.ai/)
获取API密钥[](https://kilocode.ai/docs/zh-CN/providers/mistral#%E8%8E%B7%E5%8F%96api%E5%AF%86%E9%92%A5 "获取API密钥的直接链接")
--------------------------------------------------------------------------------------------------------------------
1. **注册/登录:** 访问[Mistral控制台](https://console.mistral.ai/)
。创建账户或登录。您可能需要完成验证流程。
2. **创建API密钥:**
* [La Plateforme API密钥](https://console.mistral.ai/api-keys/)
和/或
* [Codestral API密钥](https://console.mistral.ai/codestral)
支持的模型[](https://kilocode.ai/docs/zh-CN/providers/mistral#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B "支持的模型的直接链接")
----------------------------------------------------------------------------------------------------------------------
Kilo Code支持以下Mistral模型:
| 模型ID | 默认温度 | 函数调用 | 视觉/图像支持 |
| --- | --- | --- | --- |
| codestral-latest | 0.3 | ✅ | ❌ |
| mistral-large-latest | 0.7 | ✅ | ❌ |
| ministral-8b-latest | 0.3 | ✅ | ❌ |
| ministral-3b-latest | 0.3 | ✅ | ❌ |
| mistral-small-latest | 0.3 | ✅ | ❌ |
| pixtral-large-latest | 0.7 | ✅ | ✅ |
Kilo Code中的默认模型温度为0.0,因此您应该考虑尝试[调整温度](https://kilocode.ai/docs/zh-CN/features/model-temperature)
!
**注意:** 模型的可用性和规格可能会发生变化。 请参考[Mistral AI文档](https://docs.mistral.ai/api/)
和[Mistral模型概述](https://docs.mistral.ai/getting-started/models/models_overview/)
获取最新信息。
在Kilo Code中配置[](https://kilocode.ai/docs/zh-CN/providers/mistral#%E5%9C%A8kilo-code%E4%B8%AD%E9%85%8D%E7%BD%AE "在Kilo Code中配置的直接链接")
--------------------------------------------------------------------------------------------------------------------------------------
1. **打开Kilo Code设置:** 点击Kilo Code面板中的齿轮图标()。
2. **选择提供商:** 从"API提供商"下拉菜单中选择"Mistral"。
3. **输入API密钥:** 如果您使用`mistral`模型,请将Mistral API密钥粘贴到"Mistral API密钥"字段中。如果您打算使用`codestral-latest`,请参阅下面的"Codestral"部分。
4. **选择模型:** 从"模型"下拉菜单中选择所需的模型。
使用Codestral[](https://kilocode.ai/docs/zh-CN/providers/mistral#%E4%BD%BF%E7%94%A8codestral "使用Codestral的直接链接")
----------------------------------------------------------------------------------------------------------------
[Codestral](https://docs.mistral.ai/capabilities/code_generation/)
是一个专门用于代码生成和交互的模型。 只有Codestral可以使用不同的端点(默认: codestral.mistral.ai)。 对于La Platforme API密钥,请将**Codestral基础URL**更改为: [https://api.mistral.ai](https://api.mistral.ai/)
要使用Codestral:
1. **选择"Mistral"作为API提供商。**
2. **选择Codestral模型**
3. **输入您的Codestral (codestral.mistral.ai)或La Plateforme (api.mistral.ai) API密钥。**
* [获取API密钥](https://kilocode.ai/docs/zh-CN/providers/mistral#%E8%8E%B7%E5%8F%96api%E5%AF%86%E9%92%A5)
* [支持的模型](https://kilocode.ai/docs/zh-CN/providers/mistral#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B)
* [在Kilo Code中配置](https://kilocode.ai/docs/zh-CN/providers/mistral#%E5%9C%A8kilo-code%E4%B8%AD%E9%85%8D%E7%BD%AE)
* [使用Codestral](https://kilocode.ai/docs/zh-CN/providers/mistral#%E4%BD%BF%E7%94%A8codestral)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fproviders%2Fmistral)
---
# 在 Kilo Code 中使用 VS Code 语言模型 API | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/providers/vscode-lm#__docusaurus_skipToContent_fallback)
本页总览
Kilo Code 包含对 [VS Code 语言模型 API](https://code.visualstudio.com/api/language-extensions/language-model-access)
的_实验性_支持。该 API 允许扩展直接在 VS Code 中提供对语言模型的访问。这意味着您可以潜在使用以下模型:
* **GitHub Copilot:** 如果您有 Copilot 订阅并安装了该扩展。
* **其他 VS Code 扩展:** 任何实现语言模型 API 的扩展。
**重要提示:** 此集成是高度实验性的,可能无法按预期工作。它依赖于其他扩展正确实现 VS Code 语言模型 API。
先决条件[](https://kilocode.ai/docs/zh-CN/providers/vscode-lm#%E5%85%88%E5%86%B3%E6%9D%A1%E4%BB%B6 "先决条件的直接链接")
-------------------------------------------------------------------------------------------------------------
* **VS Code:** 语言模型 API 通过 VS Code 提供(目前不支持 Cursor)。
* **语言模型提供者扩展:** 您需要一个提供语言模型的扩展。示例包括:
* **GitHub Copilot:** 如果您有 Copilot 订阅,GitHub Copilot 和 GitHub Copilot Chat 扩展可以提供模型。
* **其他扩展:** 在 VS Code 市场搜索提到 "Language Model API" 或 "lm" 的扩展。可能会有其他实验性扩展可用。
配置[](https://kilocode.ai/docs/zh-CN/providers/vscode-lm#%E9%85%8D%E7%BD%AE "配置的直接链接")
---------------------------------------------------------------------------------------
1. **打开 Kilo Code 设置:** 点击 Kilo Code 面板中的齿轮图标 ()。
2. **选择提供商:** 从 "API 提供商" 下拉菜单中选择 "VS Code LM API"。
3. **选择模型:** "语言模型" 下拉菜单将(最终)列出可用模型。格式为 `供应商/系列`。例如,如果您有 Copilot,您可能会看到以下选项:
* `copilot - claude-3.5-sonnet`
* `copilot - o3-mini`
* `copilot - o1-ga`
* `copilot - gemini-2.0-flash`
限制[](https://kilocode.ai/docs/zh-CN/providers/vscode-lm#%E9%99%90%E5%88%B6 "限制的直接链接")
---------------------------------------------------------------------------------------
* **实验性 API:** VS Code 语言模型 API 仍在开发中。预计会有变化和潜在的不稳定性。
* **依赖扩展:** 此功能完全依赖其他扩展提供模型。Kilo Code 无法直接控制哪些模型可用。
* **功能有限:** VS Code 语言模型 API 可能不支持其他 API 提供商的所有功能(例如,图像输入、流式传输、详细使用信息)。
* **无法直接控制成本:** 您将受提供模型的扩展的定价和条款约束。Kilo Code 无法直接跟踪或限制成本。
* **GitHub Copilot 速率限制:** 使用 VS Code LM API 与 GitHub Copilot 时,请注意 GitHub 可能会对 Copilot 使用施加速率限制。这些限制由 GitHub 控制,而非 Kilo Code。
故障排除[](https://kilocode.ai/docs/zh-CN/providers/vscode-lm#%E6%95%85%E9%9A%9C%E6%8E%92%E9%99%A4 "故障排除的直接链接")
-------------------------------------------------------------------------------------------------------------
* **没有模型出现:**
* 确保已安装 VS Code。
* 确保已安装并启用了语言模型提供者扩展(例如,GitHub Copilot, GitHub Copilot Chat)。
* 如果使用 Copilot,请确保您已使用您想要使用的模型发送了 Copilot Chat 消息。
* **意外行为:** 如果遇到意外行为,很可能是底层语言模型 API 或提供者扩展的问题。请考虑向提供者扩展的开发人员报告问题。
* [先决条件](https://kilocode.ai/docs/zh-CN/providers/vscode-lm#%E5%85%88%E5%86%B3%E6%9D%A1%E4%BB%B6)
* [配置](https://kilocode.ai/docs/zh-CN/providers/vscode-lm#%E9%85%8D%E7%BD%AE)
* [限制](https://kilocode.ai/docs/zh-CN/providers/vscode-lm#%E9%99%90%E5%88%B6)
* [故障排除](https://kilocode.ai/docs/zh-CN/providers/vscode-lm#%E6%95%85%E9%9A%9C%E6%8E%92%E9%99%A4)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fproviders%2Fvscode-lm)
---
# 在 Kilo Code 中使用 Requesty | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/providers/requesty#__docusaurus_skipToContent_fallback)
本页总览
Kilo Code 支持通过 [Requesty](https://www.requesty.ai/)
AI 平台访问模型。Requesty 提供了一个简单且优化的 API,用于与 150+ 大型语言模型 (LLMs) 进行交互。
**网站:** [https://www.requesty.ai/](https://www.requesty.ai/)
获取 API 密钥[](https://kilocode.ai/docs/zh-CN/providers/requesty#%E8%8E%B7%E5%8F%96-api-%E5%AF%86%E9%92%A5 "获取 API 密钥的直接链接")
---------------------------------------------------------------------------------------------------------------------------
1. **注册/登录:** 访问 [Requesty 网站](https://www.requesty.ai/)
并创建账户或登录。
2. **获取 API 密钥:** 您可以从 Requesty 仪表板的 [API 管理](https://app.requesty.ai/manage-api)
部分获取 API 密钥。
支持的模型[](https://kilocode.ai/docs/zh-CN/providers/requesty#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B "支持的模型的直接链接")
-----------------------------------------------------------------------------------------------------------------------
Requesty 提供了对多种模型的访问。Kilo Code 会自动获取最新的可用模型列表。您可以在 [模型列表](https://app.requesty.ai/router/list)
页面上查看所有可用模型的完整列表。
在 Kilo Code 中配置[](https://kilocode.ai/docs/zh-CN/providers/requesty#%E5%9C%A8-kilo-code-%E4%B8%AD%E9%85%8D%E7%BD%AE "在 Kilo Code 中配置的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------
1. **打开 Kilo Code 设置:** 点击 Kilo Code 面板中的齿轮图标 ()。
2. **选择提供商:** 从 "API 提供商" 下拉菜单中选择 "Requesty"。
3. **输入 API 密钥:** 将您的 Requesty API 密钥粘贴到 "Requesty API 密钥" 字段中。
4. **选择模型:** 从 "模型" 下拉菜单中选择您想要的模型。
提示和注意事项[](https://kilocode.ai/docs/zh-CN/providers/requesty#%E6%8F%90%E7%A4%BA%E5%92%8C%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9 "提示和注意事项的直接链接")
---------------------------------------------------------------------------------------------------------------------------------------------
* **优化:** Requesty 提供了多种实时成本优化功能,以降低您的成本。
* **统一且简化的计费:** 通过一个 [API 密钥](https://app.requesty.ai/manage-api)
无限制地访问所有提供商和模型,自动充值余额等。
* **成本跟踪:** 通过 [成本仪表板](https://app.requesty.ai/cost-management)
或 [Requesty VS.code 扩展](https://marketplace.visualstudio.com/items?itemName=Requesty.requesty)
跟踪每个模型、编程语言、更改文件等的成本。
* **统计和日志:** 查看您的 [编程统计仪表板](https://app.requesty.ai/usage-stats)
或查阅您的 [LLM 交互日志](https://app.requesty.ai/logs)
。
* **回退策略:** 当提供商出现故障时,通过回退策略保持您的 LLM 正常工作。
* **提示缓存:** 一些提供商支持提示缓存。[搜索支持缓存的模型](https://app.requesty.ai/router/list)
。
相关资源[](https://kilocode.ai/docs/zh-CN/providers/requesty#%E7%9B%B8%E5%85%B3%E8%B5%84%E6%BA%90 "相关资源的直接链接")
------------------------------------------------------------------------------------------------------------
* [Requesty Youtube 频道](https://www.youtube.com/@requestyAI)
:
* [Requesty Discord](https://requesty.ai/discord)
* [获取 API 密钥](https://kilocode.ai/docs/zh-CN/providers/requesty#%E8%8E%B7%E5%8F%96-api-%E5%AF%86%E9%92%A5)
* [支持的模型](https://kilocode.ai/docs/zh-CN/providers/requesty#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B)
* [在 Kilo Code 中配置](https://kilocode.ai/docs/zh-CN/providers/requesty#%E5%9C%A8-kilo-code-%E4%B8%AD%E9%85%8D%E7%BD%AE)
* [提示和注意事项](https://kilocode.ai/docs/zh-CN/providers/requesty#%E6%8F%90%E7%A4%BA%E5%92%8C%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9)
* [相关资源](https://kilocode.ai/docs/zh-CN/providers/requesty#%E7%9B%B8%E5%85%B3%E8%B5%84%E6%BA%90)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fproviders%2Frequesty)
---
# 在 Kilo Code 中使用 GCP Vertex AI | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/providers/vertex#__docusaurus_skipToContent_fallback)
本页总览
Kilo Code 支持通过 Google Cloud Platform 的 Vertex AI 访问模型,这是一个托管的机器学习平台,提供对多种基础模型的访问,包括 Anthropic 的 Claude 系列。
**网站:** [https://cloud.google.com/vertex-ai](https://cloud.google.com/vertex-ai)
先决条件[](https://kilocode.ai/docs/zh-CN/providers/vertex#%E5%85%88%E5%86%B3%E6%9D%A1%E4%BB%B6 "先决条件的直接链接")
----------------------------------------------------------------------------------------------------------
* **Google Cloud 账户:** 您需要一个活跃的 Google Cloud Platform (GCP) 账户。
* **项目:** 您需要一个启用了 Vertex AI API 的 GCP 项目。
* **模型访问权限:** 您必须请求并获准访问您想要使用的特定 Claude 模型。请参阅 [Google Cloud 文档](https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-claude#before_you_begin)
获取说明。
* **应用程序默认凭据 (ADC):** Kilo Code 使用应用程序默认凭据来与 Vertex AI 进行身份验证。最简单的设置方法是:
1. 安装 Google Cloud CLI: [https://cloud.google.com/sdk/docs/install](https://cloud.google.com/sdk/docs/install)
2. 使用以下命令进行身份验证:`gcloud auth application-default login`
支持的模型[](https://kilocode.ai/docs/zh-CN/providers/vertex#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B "支持的模型的直接链接")
---------------------------------------------------------------------------------------------------------------------
Kilo Code 通过 Vertex AI 支持以下模型(基于源代码):
* **Google Gemini 模型:**
* `gemini-2.0-flash-001`
* `gemini-2.5-pro-exp-03-25`
* `gemini-2.0-pro-exp-02-05`
* `gemini-2.0-flash-lite-001`
* `gemini-2.0-flash-thinking-exp-01-21`
* `gemini-1.5-flash-002`
* `gemini-1.5-pro-002`
* **Anthropic Claude 模型:**
* `claude-3-7-sonnet@20250219:thinking`
* `claude-极客3-7-sonnet@20250219`
* `claude-3-5-sonnet-v2@20241022`
* `claude-3-5-sonnet@20240620`
* `claude-3-5-haiku@20241022`
* `claude-3-opus@20240229`
* `claude-3-haiku@20240307`
请参阅 [Google Cloud 关于 Vertex AI 模型的文档](https://cloud.google.xn--com-ng0f173c/vertex-ai/generative-ai/docs/learn/models)
获取最新可用模型及其 ID 列表。
在 Kilo Code 中配置[](https://kilocode.ai/docs/zh-CN/providers/vertex#%E5%9C%A8-kilo-code-%E4%B8%AD%E9%85%8D%E7%BD%AE "在 Kilo Code 中配置的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------------
1. **打开 Kilo Code 设置:** 点击 Kilo Code 面板中的齿轮图标 ()。
2. **选择提供商:** 从 "API 提供商" 下拉菜单中选择 "GCP Vertex AI"。
3. **输入项目 ID:** 输入您的 Google Cloud 项目 ID。
4. **选择区域:** 选择您的 Vertex AI 资源所在的区域 (例如 `us-east5`)。
5. **选择模型:** 从 "模型" 下拉菜单中选择您想要的模型。
提示和注意事项[](https://kilocode.ai/docs/zh-CN/providers/vertex#%E6%8F%90%E7%A4%BA%E5%92%8C%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9 "提示和注意事项的直接链接")
-------------------------------------------------------------------------------------------------------------------------------------------
* **权限:** 确保您的 Google Cloud 账户具有访问 Vertex AI 和您想要使用的特定模型所需的权限。
* **定价:** 请参阅 [Vertex AI 定价](https://cloud.google.com/vertex-ai/pricing)
页面了解详情。
* [先决条件](https://kilocode.ai/docs/zh-CN/providers/vertex#%E5%85%88%E5%86%B3%E6%9D%A1%E4%BB%B6)
* [支持的模型](https://kilocode.ai/docs/zh-CN/providers/vertex#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B)
* [在 Kilo Code 中配置](https://kilocode.ai/docs/zh-CN/providers/vertex#%E5%9C%A8-kilo-code-%E4%B8%AD%E9%85%8D%E7%BD%AE)
* [提示和注意事项](https://kilocode.ai/docs/zh-CN/providers/vertex#%E6%8F%90%E7%A4%BA%E5%92%8C%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fproviders%2Fvertex)
---
# 在Kilo Code中使用Ollama | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/providers/ollama#__docusaurus_skipToContent_fallback)
本页总览
Kilo Code 支持通过 Ollama 在本地运行模型。这提供了隐私保护、离线访问能力,并可能降低成本,但需要更多设置且依赖高性能计算机。
**官方网站**:[https://ollama.com/](https://ollama.com/)
安装配置Ollama[](https://kilocode.ai/docs/zh-CN/providers/ollama#%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AEollama "安装配置Ollama的直接链接")
----------------------------------------------------------------------------------------------------------------------------
1. **下载并安装Ollama**:从[Ollama官网](https://ollama.com/)
下载对应操作系统的安装程序,按指引完成安装。确保Ollama已启动:
ollama serve
2. **下载模型**:Ollama 支持多种模型,可在[Ollama模型库](https://ollama.com/library)
查看可用列表。以下是推荐用于编码任务的模型:
* `codellama:7b-code`(入门首选,模型较小)
* `codellama:13b-code`(质量更佳,模型较大)
* `codellama:34b-code`(质量最优,模型极大)
* `qwen2.5-coder:32b`
* `mistralai/Mistral-7B-Instruct-v0.1`(通用型优质模型)
* `deepseek-coder:6.7b-base`(适合编码任务)
* `llama3:8b-instruct-q5_1`(适合常规任务)
在终端运行以下命令下载模型:
ollama pull <模型名称>
示例:
ollama pull qwen2.5-coder:32b
3. **配置模型**:默认情况下,Ollama 使用 2048 tokens的上下文窗口,这对 Kilo Code 的请求来说过小。建议至少设置为12k,理想情况下为32k。配置模型需设置参数并保存副本:
* 加载模型(以`qwen2.5-coder:32b`为例):
ollama run qwen2.5-coder:32b
* 修改上下文大小参数:
/set parameter num_ctx 32768
* 使用新名称保存模型:
/save 你的模型名称
4. **配置Kilo Code**:
* 打开Kilo Code侧边栏(图标)。
* 点击设置齿轮图标()。
* 选择“ollama”作为API提供商。
* 输入上一步设置的模型名称(如`你的模型名称`)。
* (可选)若Ollama运行在其他设备上,可配置基础URL(默认:`http://localhost:11434`)。
* (可选)在高级设置中配置模型上下文大小,以便Kilo Code管理滑动窗口。
注意事项[](https://kilocode.ai/docs/zh-CN/providers/ollama#%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9 "注意事项的直接链接")
----------------------------------------------------------------------------------------------------------
* **资源要求**:本地运行大型语言模型需要较高资源配置,请确保计算机满足所选模型的最低要求。
* **模型选择**:建议尝试不同模型,找到最符合需求的选项。
* **离线使用**:模型下载完成后,Kilo Code 可离线使用该模型。
* **Ollama文档**:更多关于安装、配置和使用Ollama的信息,请参考[Ollama官方文档](https://ollama.com/docs)
。
* [安装配置Ollama](https://kilocode.ai/docs/zh-CN/providers/ollama#%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AEollama)
* [注意事项](https://kilocode.ai/docs/zh-CN/providers/ollama#%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fproviders%2Follama)
---
# Using xAI (Grok) With Kilo Code | Kilo Code Docs
[跳到主要内容](https://kilocode.ai/docs/zh-CN/providers/xai#__docusaurus_skipToContent_fallback)
本页总览
xAI is the company behind Grok, a large language model known for its conversational abilities and large context window. Grok models are designed to provide helpful, informative, and contextually relevant responses.
**Website:** [https://x.ai/](https://x.ai/)
Getting an API Key[](https://kilocode.ai/docs/zh-CN/providers/xai#getting-an-api-key "Getting an API Key的直接链接")
-----------------------------------------------------------------------------------------------------------------
1. **Sign Up/Sign In:** Go to the [xAI Console](https://console.x.ai/)
. Create an account or sign in.
2. **Navigate to API Keys:** Go to the API keys section in your dashboard.
3. **Create a Key:** Click to create a new API key. Give your key a descriptive name (e.g., "Kilo Code").
4. **Copy the Key:** **Important:** Copy the API key _immediately_. You will not be able to see it again. Store it securely.
Supported Models[](https://kilocode.ai/docs/zh-CN/providers/xai#supported-models "Supported Models的直接链接")
-----------------------------------------------------------------------------------------------------------
Kilo Code supports the following xAI Grok models:
### Grok-3 Models[](https://kilocode.ai/docs/zh-CN/providers/xai#grok-3-models "Grok-3 Models的直接链接")
* `grok-3-beta` (Default) - xAI's Grok-3 beta model with 131K context window
* `grok-3-fast-beta` - xAI's Grok-3 fast beta model with 131K context window
* `grok-3-mini-beta` - xAI's Grok-3 mini beta model with 131K context window
* `grok-3-mini-fast-beta` - xAI's Grok-3 mini fast beta model with 131K context window
### Grok-2 Models[](https://kilocode.ai/docs/zh-CN/providers/xai#grok-2-models "Grok-2 Models的直接链接")
* `grok-2-latest` - xAI's Grok-2 model - latest version with 131K context window
* `grok-2` - xAI's Grok-2 model with 131K context window
* `grok-2-1212` - xAI's Grok-2 model (version 1212) with 131K context window
### Grok Vision Models[](https://kilocode.ai/docs/zh-CN/providers/xai#grok-vision-models "Grok Vision Models的直接链接")
* `grok-2-vision-latest` - xAI's Grok-2 Vision model - latest version with image support and 32K context window
* `grok-2-vision` - xAI's Grok-2 Vision model with image support and 32K context window
* `grok-2-vision-1212` - xAI's Grok-2 Vision model (version 1212) with image support and 32K context window
* `grok-vision-beta` - xAI's Grok Vision Beta model with image support and 8K context window
### Legacy Models[](https://kilocode.ai/docs/zh-CN/providers/xai#legacy-models "Legacy Models的直接链接")
* `grok-beta` - xAI's Grok Beta model (legacy) with 131K context window
Configuration in Kilo Code[](https://kilocode.ai/docs/zh-CN/providers/xai#configuration-in-kilo-code "Configuration in Kilo Code的直接链接")
-----------------------------------------------------------------------------------------------------------------------------------------
1. **Open Kilo Code Settings:** Click the gear icon () in the Kilo Code panel.
2. **Select Provider:** Choose "xAI" from the "API Provider" dropdown.
3. **Enter API Key:** Paste your xAI API key into the "xAI API Key" field.
4. **Select Model:** Choose your desired Grok model from the "Model" dropdown.
Reasoning Capabilities[](https://kilocode.ai/docs/zh-CN/providers/xai#reasoning-capabilities "Reasoning Capabilities的直接链接")
-----------------------------------------------------------------------------------------------------------------------------
Grok 3 Mini models feature specialized reasoning capabilities, allowing them to "think before responding" - particularly useful for complex problem-solving tasks.
### Reasoning-Enabled Models[](https://kilocode.ai/docs/zh-CN/providers/xai#reasoning-enabled-models "Reasoning-Enabled Models的直接链接")
Reasoning is only supported by:
* `grok-3-mini-beta`
* `grok-3-mini-fast-beta`
The Grok 3 models `grok-3-beta` and `grok-3-fast-beta` do not support reasoning.
### Controlling Reasoning Effort[](https://kilocode.ai/docs/zh-CN/providers/xai#controlling-reasoning-effort "Controlling Reasoning Effort的直接链接")
When using reasoning-enabled models, you can control how hard the model thinks with the `reasoning_effort` parameter:
* `low`: Minimal thinking time, using fewer tokens for quick responses
* `high`: Maximum thinking time, leveraging more tokens for complex problems
Choose `low` for simple queries that should complete quickly, and `high` for harder problems where response latency is less important.
### Key Features[](https://kilocode.ai/docs/zh-CN/providers/xai#key-features "Key Features的直接链接")
* **Step-by-Step Problem Solving**: The model thinks through problems methodically before delivering an answer
* **Math & Quantitative Strength**: Excels at numerical challenges and logic puzzles
* **Reasoning Trace Access**: The model's thinking process is available via the `reasoning_content` field in the response completion object
Tips and Notes[](https://kilocode.ai/docs/zh-CN/providers/xai#tips-and-notes "Tips and Notes的直接链接")
-----------------------------------------------------------------------------------------------------
* **Context Window:** Most Grok models feature large context windows (up to 131K tokens), allowing you to include substantial amounts of code and context in your prompts.
* **Vision Capabilities:** Select vision-enabled models (`grok-2-vision-latest`, `grok-2-vision`, etc.) when you need to process or analyze images.
* **Pricing:** Pricing varies by model, with input costs ranging from $0.3 to $5.0 per million tokens and output costs from $0.5 to $25.0 per million tokens. Refer to the xAI documentation for the most current pricing information.
* **Performance Tradeoffs:** "Fast" variants typically offer quicker response times but may have higher costs, while "mini" variants are more economical but may have reduced capabilities.
* [Getting an API Key](https://kilocode.ai/docs/zh-CN/providers/xai#getting-an-api-key)
* [Supported Models](https://kilocode.ai/docs/zh-CN/providers/xai#supported-models)
* [Grok-3 Models](https://kilocode.ai/docs/zh-CN/providers/xai#grok-3-models)
* [Grok-2 Models](https://kilocode.ai/docs/zh-CN/providers/xai#grok-2-models)
* [Grok Vision Models](https://kilocode.ai/docs/zh-CN/providers/xai#grok-vision-models)
* [Legacy Models](https://kilocode.ai/docs/zh-CN/providers/xai#legacy-models)
* [Configuration in Kilo Code](https://kilocode.ai/docs/zh-CN/providers/xai#configuration-in-kilo-code)
* [Reasoning Capabilities](https://kilocode.ai/docs/zh-CN/providers/xai#reasoning-capabilities)
* [Reasoning-Enabled Models](https://kilocode.ai/docs/zh-CN/providers/xai#reasoning-enabled-models)
* [Controlling Reasoning Effort](https://kilocode.ai/docs/zh-CN/providers/xai#controlling-reasoning-effort)
* [Key Features](https://kilocode.ai/docs/zh-CN/providers/xai#key-features)
* [Tips and Notes](https://kilocode.ai/docs/zh-CN/providers/xai#tips-and-notes)
* * *
Is this documentation incorrect or incomplete? [Report an issue on GitHub](https://github.com/Kilo-Org/docs/issues/new?title=Documentation%20Issue:%20%2Fdocs%2Fzh-CN%2Fproviders%2Fxai)
---
# Unknown
\# Memory Bank I am an expert software engineer with a unique characteristic: my memory resets completely between sessions. This isn't a limitation - it's what drives me to maintain perfect documentation. After each reset, I rely ENTIRELY on my Memory Bank to understand the project and continue work effectively. I MUST read ALL memory bank files at the start of EVERY task - this is not optional. The memory bank files are located in \`.kilocode/rules/memory-bank\` folder. When I start a task, I will include \`\[Memory Bank: Active\]\` at the beginning of my response if I successfully read the memory bank files, or \`\[Memory Bank: Missing\]\` if the folder doesn't exist or is empty. If memory bank is missing, I will warn the user about potential issues and suggest initialization. ## Memory Bank Structure The Memory Bank consists of core files and optional context files, all in Markdown format. ### Core Files (Required) 1. \`brief.md\` This file is created and maintained manually by the developer. Don't edit this file directly but suggest to user to update it if it can be improved. - Foundation document that shapes all other files - Created at project start if it doesn't exist - Defines core requirements and goals - Source of truth for project scope 2. \`product.md\` - Why this project exists - Problems it solves - How it should work - User experience goals 3. \`context.md\` This file should be short and factual, not creative or speculative. - Current work focus - Recent changes - Next steps 4. \`architecture.md\` - System architecture - Source Code paths - Key technical decisions - Design patterns in use - Component relationships - Critical implementation paths 5. \`tech.md\` - Technologies used - Development setup - Technical constraints - Dependencies - Tool usage patterns ### Additional Files Create additional files/folders within memory-bank/ when they help organize: - \`tasks.md\` - Documentation of repetitive tasks and their workflows - Complex feature documentation - Integration specifications - API documentation - Testing strategies - Deployment procedures ## Core workflows ### Memory Bank Initialization The initialization step is CRITICALLY IMPORTANT and must be done with extreme thoroughness as it defines all future effectiveness of the Memory Bank. This is the foundation upon which all future interactions will be built. When user requests initialization of the memory bank (command \`initialize memory bank\`), I'll perform an exhaustive analysis of the project, including: - All source code files and their relationships - Configuration files and build system setup - Project structure and organization patterns - Documentation and comments - Dependencies and external integrations - Testing frameworks and patterns I must be extremely thorough during initialization, spending extra time and effort to build a comprehensive understanding of the project. A high-quality initialization will dramatically improve all future interactions, while a rushed or incomplete initialization will permanently limit my effectiveness. After initialization, I will ask the user to read through the memory bank files and verify product description, used technologies and other information. I should provide a summary of what I've understood about the project to help the user verify the accuracy of the memory bank files. I should encourage the user to correct any misunderstandings or add missing information, as this will significantly improve future interactions. ### Memory Bank Update Memory Bank updates occur when: 1. Discovering new project patterns 2. After implementing significant changes 3. When user explicitly requests with the phrase \*\*update memory bank\*\* (MUST review ALL files) 4. When context needs clarification If I notice significant changes that should be preserved but the user hasn't explicitly requested an update, I should suggest: "Would you like me to update the memory bank to reflect these changes?" To execute Memory Bank update, I will: 1. Review ALL project files 2. Document current state 3. Document Insights & Patterns 4. If requested with additional context (e.g., "update memory bank using information from @/Makefile"), focus special attention on that source Note: When triggered by \*\*update memory bank\*\*, I MUST review every memory bank file, even if some don't require updates. Focus particularly on context.md as it tracks current state. ### Add Task When user completes a repetitive task (like adding support for a new model version) and wants to document it for future reference, they can request: \*\*add task\*\* or \*\*store this as a task\*\*. This workflow is designed for repetitive tasks that follow similar patterns and require editing the same files. Examples include: - Adding support for new AI model versions - Implementing new API endpoints following established patterns - Adding new features that follow existing architecture Tasks are stored in the file \`tasks.md\` in the memory bank folder. The file is optional an can be empty. The file can store many tasks. To execute Add Task workflow: 1. Create or update \`tasks.md\` in the memory bank folder 2. Document the task with: - Task name and description - Files that need to be modified - Step-by-step workflow followed - Important considerations or gotchas - Example of the completed implementation 3. Include any context that was discovered during task execution but wasn't previously documented Example task entry: \`\`\`markdown ## Add New Model Support \*\*Last performed:\*\* \[date\] \*\*Files to modify:\*\* - \`/providers/gemini.md\` - Add model to documentation - \`/src/providers/gemini-config.ts\` - Add model configuration - \`/src/constants/models.ts\` - Add to model list - \`/tests/providers/gemini.test.ts\` - Add test cases \*\*Steps:\*\* 1. Add model configuration with proper token limits 2. Update documentation with model capabilities 3. Add to constants file for UI display 4. Write tests for new model configuration \*\*Important notes:\*\* - Check Google's documentation for exact token limits - Ensure backward compatibility with existing configurations - Test with actual API calls before committing \`\`\` ### Regular Task Execution In the beginning of EVERY task I MUST read ALL memory bank files - this is not optional. The memory bank files are located in \`.kilocode/rules/memory-bank\` folder. If the folder doesn't exist or is empty, I will warn user about potential issues with the memory bank. I will include \`\[Memory Bank: Active\]\` at the beginning of my response if I successfully read the memory bank files, or \`\[Memory Bank: Missing\]\` if the folder doesn't exist or is empty. If memory bank is missing, I will warn the user about potential issues and suggest initialization. I should briefly summarize my understanding of the project to confirm alignment with the user's expectations, like: "\[Memory Bank: Active\] I understand we're building a React inventory system with barcode scanning. Currently implementing the scanner component that needs to work with the backend API." When starting a task that matches a documented task in \`tasks.md\`, I should mention this and follow the documented workflow to ensure no steps are missed. If the task was repetitive and might be needed again, I should suggest: "Would you like me to add this task to the memory bank for future reference?" In the end of the task, when it seems to be completed, I will update \`context.md\` accordingly. If the change seems significant, I will suggest to the user: "Would you like me to update memory bank to reflect these changes?" I will not suggest updates for minor changes. ## Context Window Management When the context window fills up during an extended session: 1. I should suggest updating the memory bank to preserve the current state 2. Recommend starting a fresh conversation/task 3. In the new conversation, I will automatically load the memory bank files to maintain continuity ## Technical Implementation Memory Bank is built on Kilo Code's Custom Rules feature, with files stored as standard markdown documents that both the user and I can access. ## Important Notes REMEMBER: After every memory reset, I begin completely fresh. The Memory Bank is my only link to previous work. It must be maintained with precision and clarity, as my effectiveness depends entirely on its accuracy. If I detect inconsistencies between memory bank files, I should prioritize brief.md and note any discrepancies to the user. IMPORTANT: I MUST read ALL memory bank files at the start of EVERY task - this is not optional. The memory bank files are located in \`.kilocode/rules/memory-bank\` folder.
---