CodeBuddy一站式AI编程工具
CodeBuddy是腾讯推出的AI时代智能编程助手,已实现IDE、插件(vscode 1.82、Visual Studio 2022、JetBrains、Xcode 14.0等)、CLI(CodeBuddy Code)三端全开发场景覆盖
提供覆盖编码、扩展与协作的全栈开发生态
类似的工具有微软的Github Copilot、Anysphere公司的Cursor等。 详见:GitHub Copilot 使用技巧 - 编程基础 Cursor:全面详解开箱即用的 AI 工具(附科学使用方式)

输入文字后,按Shift+回车来换行,按回车发送
全流程 AI 驱动开发
CodeBuddy 打通了从产品规划到上线部署的完整链路,让 AI 成为您的全能开发伙伴。
- 智能需求分析:仅需自然语言描述产品构思,AI 自动生成结构化需求文档(PRD)
- 设计稿智能生成:支持自然语言、手绘草图转高保真设计稿
- 设计稿一键转代码:内置 Figma 功能,直接将设计稿转化为可维护的前后端代码
- 智能编程助手:实时代码续写、多文件代码生成、行间对话解决问题
基础能力
CodeBuddy 覆盖了从创意萌芽到代码上线的全生命周期:
-
智能对话:即时技术咨询,支持多轮对话与复杂逻辑推导
-
代码补全:毫秒级代码预测,深度适配项目私有风格
-
Figma 转代码:一键将 UI 设计稿转化为可维护的高质量前端代码
-
组件库集成:预置企业级 UI 组件,支持自然语言调整样式与布局
-
智能诊断:自动发现潜在 Bug 与性能瓶颈,提供一键修复方案
基础交互
- 新建会话:点击顶部的
+图标 - 上下文引用:在输入框中输入
@即可引用文件、文件夹或当前代码片段 - 多模态输入:支持直接粘贴截图或导入 Figma 链接进行 UI 开发
广泛的语言和框架支持
理论上不限制代码语言,支持主流开发技术栈。
- 前端:HTML, JavaScript, CSS, Vue, React, Bootstrap 等
- 后端:Node.js, Python, Java, C#, Ruby, PHP 等
- 客户端:Java, Kotlin, Swift, Objective-C, C# 等
- 其他:C++, Go, Rust, TypeScript, Shell, PowerShell, R, MATLAB 等
智能工作流
CodeBuddy 预置了多种专业模式,并支持自定义扩展,以适配不同的开发需求:
1. 核心交互模式
-
Ask (对话模式):专注于技术问答与概念解释,不修改代码,不运行命令,不调用MCP。适合快速获取思路或查阅 API
-
Craft (Agent模式):专注于当前上下文的代码生成与局部修改。响应迅速,适合精准的函数编写或小范围重构
-
Plan (计划模式):最强自动化模式。适用于跨文件修改或复杂功能开发。AI 会先制定任务清单(Plan),经您确认后自主执行读取、修改及环境检查。了解更多 Plan 模式
2. 自定义 Agent
除了预置模式,您还可以点击 「+ 创建 Agent」,根据特定业务逻辑或工作习惯,定制专属的 AI 智能体,实现更高程度的流程自动化。了解更多 自定义 Agent
进阶特性
CodeBuddy 的强大之处在于其可配置与可扩展的“大脑”:
-
Memory (记忆偏好):自动记录您的偏好与项目关键背景,让 AI 随时间推移变得越来越精,更多参考Memory
-
Rules (规则):通过自定义
.codebuddy/rules,强制 AI 遵循特定的架构设计或编码规范,更多参考Rules -
Skills (技能库):通过用户/项目级配置
.codebuddy/skills/, 针对特定场景(如安全审计、性能压测)封装的专业指令集,更多参考Skills -
MCP (模型上下文协议):开放协议,支持接入第三方工具(如数据库、实时搜索)作为 AI 的辅助工具,更多参考MCP
-
自定义模型(API接入):支持自定义模型(API 接入),实现更丰富的 AI 能力,更多参考Models
-
自定义指令(个性化适配):支持个性化开发习惯,让代码补全贴合个人 / 团队习惯与专属业务场景,更多参考自定义指令
注1:Memory(记忆)功能是全局生效的,通过对话创建、由 AI 自动管理,不存在"项目级 Memory 文件"。如果想以项目级文件形式手动编写的持久化知识,对应的机制是规则(Rules) 或 CODEBUDDY.md
注2:把Rules(规则)改为 .codebuddy/rules/<xxx>/RULE.mdc(为MarkDown文件),确保能被 IDE 加载 如:.codebuddy/rules/openspec-chinese/RULE.mdc
快捷命令
| /init | 初始化工程,并创建CODEBUDDY.md文件 |
| /cr | Code Review |
| /tests | 生成单元测试 |
| /explain | 解释选中的代码的逻辑 |
| /fix | 修复选中代码的问题 |
| /rules | 生成规则 |
| /summarize | 概括对话历史 |
| /help | 查看CodeBuddy IDE帮助 |

为什么 /init 如此重要?
执行之后会生成CODEBUDDY.md文件
CODEBUDDY.md 是一个帮助 AI 快速了解当前项目的 Markdown 文件
与项目规则(Rules)不同,CODEBUDDY.md 是一个没有元数据或复杂配置的纯 Markdown 文件。对于只需要简单、易读指令,而不想引入结构化规则额外负担的项目来说,它是理想选择
CodeBuddy 支持位于项目根目录中的 CODEBUDDY.md,默认会将原文全文放入上下文
注:为保持向后兼容,当项目根目录存在 AGENTS.md 而不存在 CODEBUDDY.md 时,CodeBuddy 将自动加载 AGENTS.md 的完整内容到对话上下文中
📊 效果提升:
- ✅ 理解更准确:预先构建项目知识图谱,AI 能更准确理解代码结构和业务逻辑
- ✅ 响应更快速:避免重复扫描文件,后续对话响应速度显著提升
- ✅ 建议更精准:基于全局视图提供更符合项目架构的建议
- ✅ 减少误判:了解项目依赖关系,避免提出不兼容的修改方案
💰 成本优化:
- ✅ Token 消耗更少:一次性建立上下文,避免每次对话都重新分析
- ✅ 减少重复请求:预加载关键信息,减少 30-50% 的上下文 Token 开销
- ✅ 更高效的对话:每轮对话携带更少的冗余信息,整体成本更低
最佳实践:
# 第一次使用项目时
> /init
# 项目结构发生重大变化时(如添加新模块、重构等)
> /clear # 开启全新对话
> /init # 重新初始化
CodeBuddy CIL
使用node.js来安装
安装官方已经发布到npm源上的codebuddy版本,使用Node.js中不同的包管理器来安装 注:Node.js 要求18.20 或更高版本
npm install -g @tencent-ai/codebuddy-code // 卸载:npm uninstall -g @tencent-ai/codebuddy-code
pnpm add -g @tencent-ai/codebuddy-code // 卸载:pnpm remove -g @tencent-ai/codebuddy-code
yarn global add @tencent-ai/codebuddy-code // 卸载:yarn global remove @tencent-ai/codebuddy-code
bun install -g @tencent-ai/codebuddy-code // 卸载:bun remove -g @tencent-ai/codebuddy-code
注1:npm是node.js自带的包管理器,pnpm和yarn可通过npm来安装
npm install -g pnpm # 也可通过powershell命令iwr https://get.pnpm.io/install.ps1 -useb | iex来安装pnpm
npm install -g yarn
注2:bun不是Node的包管理器,它是个 JavaScript 运行时(用 Zig 写的),能跑脚本、跑测试、打包。它是独立的原生二进制。可通过执行如下powershell命令来安装
irm bun.sh/install.ps1 | iex
直接使用powershell脚本来安装
在windows的powershell中执行irm https://copilot.tencent.com/cli/install.ps1 | iex进行安装 注:irm 直接返回一段 PowerShell 脚本文本,通过管道把该文本给iex当作 PowerShell 代码执行
PS C:\Users\Administrator> irm https://copilot.tencent.com/cli/install.ps1 | iex → Downloading CodeBuddy Code 2.137.1 → Installing to C:\Users\Administrator\AppData\Local\codebuddy\bin ✓ CodeBuddy Code 2.137.1 installed successfully Location: C:\Users\Administrator\AppData\Local\codebuddy\bin\codebuddy.exe ! To apply PATH changes, restart your shell or run: $env:Path = [Environment]::GetEnvironmentVariable('Path', 'Machine') + ';' + [Environment]::GetEnvironmentVariable('Path', 'User') Run codebuddy --help to get started
安装完成后,重新开启一个新的powershell控制台,执行codebuddy --help来查看帮助
Usage: codebuddy|cbc [options] [command] [prompt] CodeBuddy Code - starts an interactive session by default, use -p/--print for non-interactive output Arguments: prompt Your prompt Options: -V, --version output the version number -d, --debug [filter] Enable debug mode with optional category filtering (e.g., "api,hooks" or "!statsig,!file") (default: false) --verbose Override verbose mode setting from config (default: false) -p, --print Print response and exit (useful for pipes) (default: false) --output-format <format> Output format (only works with --print): "text" (default), "json" (single result), or "stream-json" (realtime streaming) (default: "text") --input-format <format> Input format (only works with --print): "text" (default), or "stream-json" (realtime streaming input) (choices: "text", "stream-json") (default: "text") --json-schema <schema> JSON Schema for structured output validation. Example: {"type":"object","properties":{"name":{"type":"string"}},"required":["name"]} --include-partial-messages Output raw SSE incremental messages from model requests (only works with --output-format stream-json) (default: false) -y, --dangerously-skip-permissions Bypass all permission checks. Recommended only for sandboxes with no internet access. (default: false) --permission-mode <mode> Permission mode to use for the session (choices: "acceptEdits", "bypassPermissions", "default", "plan", "dontAsk", "auto") --permission-mode-before-plan <mode> Permission mode to restore when exiting plan mode --subagent-permission-mode <mode> Default permission mode for subagents/teammates (choices: "acceptEdits", "bypassPermissions", "default", "plan", "dontAsk", "auto"). Overrides inheritance from main session. --tools <value> Restrict which built-in tools CodeBuddy can use. Use "" to disable all, "default" for all, or comma-separated tool names like "Bash,Edit,Read". --allowedTools <tools...> Comma or space-separated list of tool names to allow (e.g. "Bash(git:*) Edit") --disallowedTools <tools...> Comma or space-separated list of tool names to deny (e.g. "Bash(git:*) Edit") --mcp-config <fileOrString> Load MCP servers from a JSON file or string --channels <value> Enable specific channels (comma-separated: plugin:name@marketplace or server:configName) --dangerously-load-development-channels <value> During research preview: bypass allowlist for specific channels (development only, requires confirmation) -c, --continue Continue the most recent conversation (default: false) -r, --resume [sessionId] Resume a conversation - provide a session ID or interactively select a conversation to resume (default: false) -w, --worktree [name] Create a git worktree and start the session in it (optionally specify a name, PR number like "#123", or PR URL) --worktree-branch <branch> Base branch for the worktree (defaults to remote default branch, requires --worktree) --tmux Create worktree in a new tmux session (requires --worktree) (default: false) --tmux-classic Use classic tmux mode instead of iTerm2 integration (requires --tmux) (default: false) --model <model> Model for the current session. Please provide the model ID. Currently supported: (default-model, gemini-3.1-pro, gemini-3.0-flash, gemini-3.5-flash, gemini-2.5-pro, gemini-2.5-flash, gemini-3.1-flash-lite, gpt-5.5, gpt-5.4, gpt-5.3-codex, gpt-5.1-codex, gpt-5.1-codex-mini, deepseek-v3-2-volc, glm-5.0, kimi-k2.5) --text-to-image-model <model> Model for text-to-image generation --image-to-image-model <model> Model for image-to-image editing --fallback-model <model> Enable automatic fallback to specified model when default model is overloaded (only works with --print) --add-dir <directories...> Additional directories to allow tool access to --ide Automatically connect to IDE on startup if exactly one valid IDE is available (default: false) -v, --version Output the version number (default: false) --strict-mcp-config Only use MCP servers from --mcp-config, ignoring all other MCP configurations (default: false) --session-id <uuid> Use a specific session ID for the conversation (supports letters, numbers, hyphens, underscores, and colons, but must start with a letter or number) --no-session-persistence Disable session persistence - sessions stay in memory and are not saved to disk -H, --header <headers...> Custom HTTP headers for model requests (format: "Header-Key: Header-Value") --serve Expose HTTP service for external access (Web UI, API) while keeping interactive mode (default: false) --open Open Web UI in browser after startup (default: false) --port <number> Port for HTTP server (default: auto-assign) --host <string> Host address to bind HTTP server (default: 127.0.0.1) (default: "127.0.0.1") --auth <mode> HTTP server authentication mode (only applies with --serve). Defaults to "password"; "none" disables auth and lets any local process execute commands and read/write files through the server (choices: "password", "none") --brief Enable SendUserMessage tool for agent-to-user communication (default: false) --acp Start in ACP (Agent Client Protocol) mode - enables communication via stdin/stdout using ndJsonStream (default: false) --acp-transport <transport> ACP transport (only works with --acp): "stdio" (default) or "streamable-http" (default: "stdio") --sandbox [url] Run CodeBuddy in sandbox: "container" for Docker/Podman, or E2B API URL (must be complete URL like https://api.e2b.dev) --sandbox-upload-dir Upload current working directory to sandbox (E2B only) (default: false) --sandbox-new Force create a new sandbox (ignore cached sandbox) (default: false) --sandbox-id <id> Connect to specific sandbox ID --sandbox-kill Kill sandbox on exit (default: keep alive for reuse) (default: false) --teleport <value> Teleport to existing sandbox (format: session_{cliSessionId}) --max-turns <number> Limit the number of agentic turns --effort <level> Reasoning effort level (minimal, low, medium, high, xhigh, max) --autocompact <auto|tokens> Auto-compact window size: "auto" follows the model window, or a token count (e.g. 400000, 400k, 1m; clamped to 100k-1M) --teleport <value> Teleport to existing sandbox (format: 0010${sandboxId}${randomNumber} for e2b, 0020${sandboxId}${randomNumber} for cvm) --system-prompt <prompt> Override the system prompt for this session --system-prompt-file <path> Load system prompt from a file --append-system-prompt <prompt> Append additional content to the system prompt --prompt-vars-file <path> Load prompt template variables from a JSON file --agent <agent> Agent for the current session. Overrides the 'agent' setting. --agents <json> JSON object defining custom agents (e.g. '{"reviewer": {"description": "Reviews code", "prompt": "You are a code reviewer"}}') --settings <file-or-json> Path to a settings JSON file or a JSON string to load additional settings from --setting-sources <sources> Comma-separated list of setting sources to load (user, project, local). Default: user,project,local --fork-session When resuming, create a new session ID instead of reusing the original (use with --resume or --continue) --replay-user-messages Re-emit user messages from stdin back on stdout for acknowledgment (only works with --input-format=stream-json and --output-format=stream-json) --remote-control [client] Connect to remote control service. Without args: AgentOS mode. With client type (e.g. wecom): auto-connect specified client --plugin-dir <dirs...> Load plugins from local directories (for development/testing). Can specify multiple paths. --bg Run the session in the background (detached) (default: false) --background Alias for --bg (default: false) --name <name> Name for background session (used with --bg) --exec <command> With --bg: run a shell command as a background job instead of a model session --swarm Enable swarm mode: teammates run as independent processes (tmux visualization if available, otherwise background with Web UI) (default: false) -h, --help display help for command Commands: config Manage configuration (eg. codebuddy config set -g theme dark) mcp Configure and manage MCP servers sandbox Manage sandboxes plugin Manage CodeBuddy Code plugins doctor Check the health of your CodeBuddy Code auto-updater update Check for updates and install if available install [target] Install CodeBuddy Code native build. Use [target] to specify version (latest, or specific version) daemon Manage the daemon supervisor process ps [options] List all active sessions (interactive, background, daemon) logs [options] <pidOrName> Show logs for a background session attach <pidOrName> Attach to a running background session kill <pidOrName> Terminate a background session stop <pidOrName> Stop a background session (alias for kill) rm <idOrName> Remove a background session from agent view (the transcript stays on your machine) respawn [options] [idOrName] Restart a background session with its conversation intact agents [options] Open agent view to dispatch and manage background sessions auto-mode Inspect auto mode classifier configuration agents [options] List configured agents grouped by source (user, project, managed, plugin, cli-arg, built-in); requires --json
windows版本可执行文件在%USERPROFILE%\AppData\Local\codebuddy\bin,配置在%USERPROFILE%\.codebuddy中,配置的目录结构如下
~/.codebuddy/
├── settings.json # 用户设置
├── .mcp.json # MCP 服务器配置
└── skills/ # 用户自定义 Skills
命令行模式
codebuddy update // 将codebuddy更新到最新
codebuddy -version // 2.137.1
codebuddy -p "今天星期几?" // 2026年8月23日,星期日。
codebuddy --continue // 继续最近的对话
codebuddy --resume // 从历史会话中选择
PS C:\Users\Administrator> codebuddy --resume Modified Created # Msg Summary > 1. 7s ago 16s ago 3 Calculate 1234x56 multiplication 2. 23m ago 23m ago 3 Query about current day of week
交互式模式
codebuddy // 进入交互式模式
/config 查看当前配置
> /config ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Settings Status Config (Tab/←→ to cycle) Configure CodeBuddy Code preferences ❯ Language auto Auto-compact true Co-authored by false Model claude-sonnet-5 Cleanup Period (Days) 30 Project all MCP Servers false Auto-updates true Always-thinking true Reasoning Effort auto Trust all Directory false Ignore .gitignore files during search false Show Tokens Counter false Notifications Auto Rewind code (checkpoints) true Terminal progress bar true Prompt suggestions true Output Style default Auto Memory true Typed Memory true Memory Relevance Selection false Memory Auto Extraction false Hook output collapsed false Enter to change · Esc to exit
/status 查看当前状态
> /status ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Settings Status Config (Tab/←→ to cycle) Version: 2.137.1 Session ID: 921861cb-cde9-4e0e-83d3-163c1f90bb59 cwd: d:\AI\objective-c2.0 Auth method: kekec@Xiaomi (login) Model: Claude-Opus-5 Lite model: Claude-Haiku-4.5 Reasoning model: Claude-Opus-5 Memory: User Setting sources: User settings, Shared project settings, Local, Command line arguments, Enterprise managed policies Esc to exit
/model 列出当前能使用的模型 注:按方向键上下来选择其他模型,按回车来确认
> /model ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Select Model Global Session (Tab/←→ to switch) Select a model for all future sessions. Claude-Sonnet-5 【claude-sonnet-5】 (x1.33 credits) Claude-Sonnet-5-1M 【claude-sonnet-5-1m】 (x1.33 credits) Claude-Sonnet-4.6 【claude-sonnet-4.6】 (x2.00 credits) Claude-Sonnet-4.6-1M 【claude-sonnet-4.6-1m】 (x2.00 credits) ❯ Claude-Opus-5 【claude-opus-5】 (x3.33 credits) ✔ Claude-Opus-4.8 【claude-opus-4.8】 (x3.33 credits) Claude-Opus-4.8-1M 【claude-opus-4.8-1m】 (x3.33 credits) Claude-Opus-4.7 【claude-opus-4.7】 (x3.33 credits) Claude-Opus-4.7-1M 【claude-opus-4.7-1m】 (x3.33 credits) Claude-Opus-4.6 【claude-opus-4.6】 (x3.33 credits) Claude-Opus-4.6-1M 【claude-opus-4.6-1m】 (x3.33 credits) Gemini-3.1-Pro 【gemini-3.1-pro】 (x1.32 credits) Gemini-3.5-Flash 【gemini-3.5-flash】 (x0.99 credits) GPT-5.6-Sol 【gpt-5.6-sol】 (x3.47 credits) GPT-5.6-Terra 【gpt-5.6-terra】 (x1.39 credits) GPT-5.6-Luna 【gpt-5.6-luna】 (x0.14 credits) GPT-5.5 【gpt-5.5】 (x3.31 credits) GPT-5.4 【gpt-5.4】 (x1.65 credits) GPT-5.3-Codex 【gpt-5.3-codex】 (x1.25 credits) GLM-5.3 【glm-5.3-ioa】 (x0.79 credits) GLM-5.2 【glm-5.2-ioa】 (x0.79 credits) GLM-5.2-自部署 【glm-5.2-internal-ioa】 (x0.79 credits) GLM-5v-Turbo 【glm-5v-turbo-ioa】 (x0.71 credits) MiniMax-M3 【minimax-m3-ioa】 (x0.25 credits) MiniMax-M2.7 【minimax-m2.7-ioa】 (x0.19 credits) Kimi-K3 【kimi-k3-ioa】 (x1.62 credits) Kimi-K2.7-Code 【kimi-k2.7-ioa】 (x0.65 credits) Kimi-K2.6 【kimi-k2.6-ioa】 (x0.52 credits) Hy3 【hy3-ioa】 (x0.00 credits) Echo 【echo】 (x0.00 credits) Deepseek-V4-Flash 【deepseek-v4-flash-ioa】 (x0.17 credits) Deepseek-V4-Pro 【deepseek-v4-pro-ioa】 (x0.51 credits) Enter to apply model · Tab to switch scope · Esc to exit
/model Claude-Sonnet-5 切换模型到Claude-Sonnet-5
> /model Claude-Sonnet-5 ⎿ Successfully switched model to Claude-Sonnet-5
/skills 查看当前安装的skill
> /skills ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Skills · 7 skills · enter/space to cycle, Esc to close Project skills (.codebuddy/skills, .codebuddy/commands) /security-review · ~18 description tokens /commit · ~5 description tokens /commit-push-pr · ~7 description tokens Bundled skills ❯ ✔ on loop · ~23 description tokens Plugin skills 🔒 on Browser Automation · ~104 description tokens · locked by plugin 🔒 on docx · ~205 description tokens · locked by plugin 🔒 on pdf · ~118 description tokens · locked by plugin 🔒 on playwright-cli · ~76 description tokens · locked by plugin 🔒 on pptx · ~181 description tokens · locked by plugin 🔒 on xlsx · ~244 description tokens · locked by plugin /agent-browser:install · ~26 description tokens Esc to go back
/cost 查看token的消耗
> /cost ⎿ Total duration (API): 1m 27.7s Total duration (wall): 26m 1.5s Total code changes: 0 lines added, 0 lines removed Usage by model: claude-sonnet-5: 4.5k input, 1.7k output, 236.1k cache read, 84.3k cache write
/clear 开启新对话
> /clear ⎿ (No content)
/compact 压缩上下文
> /compact
⎿ Compacted
浙公网安备 33010602011771号