/cost 命令提供当前会话的详细 Token 使用统计:/cost⎿ Total duration (API): 9m 35.6sTotal duration (wall): 22m 14.9sTotal code changes: 0 lines added, 0 lines removedUsage by model:claude-sonnet-4: 875.5k input, 11.7k output, 714.3k cache read, 0 cache write
/context 命令可以分析当前上下文的占用情况,查看不同类型上下文的大小分布:> /context⎿ Context Usage⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ glm-4.7 · 38.1k/200.0k tokens (19.1%)⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁⛁ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ System prompt: 2.1k tokens (1.1%)⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ System tools: 16.4k tokens (8.2%)⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ Memory files: 3.7k tokens (1.9%)⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ Messages: 15.9k tokens (7.9%)⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ Free space: 145.9k (72.9%)⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛝ Autocompact buffer: 16.0k tokens (8.0%)⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶⛶ ⛶ ⛶ ⛶ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝Memory files · /memory└ /Users/yangsubo/.codebuddy/CODEBUDDY.md (User): 18 tokens└ /Users/yangsubo/CODEBUDDY.md (Project): 15 tokens└ /Users/yangsubo/workspace/genie/CODEBUDDY.md (Project): 1.2k tokens└ /Users/yangsubo/workspace/genie/packages/agent-cli/CODEBUDDY.md (Project): 2.5k tokensSkills and slash commands · /skillsProject└ release: 1.1k tokens└ gen-drawio: 846 tokens└ task-manager: 815 tokens└ task-add: 730 tokens└ task-done: 525 tokens└ mr: 519 tokens└ task-start: 493 tokens└ my-task: 238 tokens└ task-list: 233 tokens└ security-review: 30 tokens
/context 可以快速识别哪些内容占用了大量上下文空间,从而有针对性地优化。场景类型 | 说明 | 典型用例 |
default | 默认模型,平衡性能与成本 | 一般编程任务、代码编写 |
lite | 轻量快速模型,低成本高速度 | 文件搜索、简单查询、快速操作 |
reasoning | 推理增强模型,强大分析能力 | 复杂分析、架构决策、多步骤推理 |
Explore 的内置声明是 lite,可以把代码搜索交给更快、更经济的模型;规划类任务则可使用 reasoning。/model:lite 和 /model:reasoning 将 lite 和 reasoning 映射到具体模型;如需单独配置某个内置子代理,可通过 /agents 选择具体模型或场景变体。项目设置只覆盖同名子代理或场景键,不会删除其他全局映射。model 参数指定场景类型:default:继续使用由按子代理设置、内置声明和主模型组成的默认编排lite:快速且低成本,适用于简单搜索、快速文件操作reasoning:增强推理能力,适用于复杂分析、架构决策/cost 检查当前 Token 使用情况。/clear 重新开始。过时的上下文会在后续每条消息中浪费 Token。清理前使用 /rename 以便之后通过 /resume 返回。/compact Focus on code samples and API usage 告诉 CodeBuddy Code 在压缩时保留什么内容。# Compact instructionsWhen you are using compact, please focus on test output and code changes.
/model 切换主模型,或使用 /model:lite / /model:reasoning 配置 lite / reasoning;使用 /agents 为特定内置子代理选择场景变体或具体模型。lite:文件搜索、快速查询、代码格式化reasoning:架构设计、性能优化、复杂调试default:日常编码、功能实现/mcp 查看已配置的服务器。gh、aws、gcloud 等工具比 MCP 服务器更节省上下文,因为它们不会添加持久的工具定义。CodeBuddy Code 可以直接运行 CLI 命令,无需额外开销。/mcp 查看并禁用未使用的服务器。/rewind 或双击 Escape 将对话和代码恢复到之前的检查点。--resume 功能摘要之前的对话文档反馈