配置
VS Code 设置
在 VS Code 设置中配置 Cortex(搜索 “Cortex”)。设置位于 cortex.* 命名空间——不是项目的 config.json。
| 设置 | 默认值 | 说明 |
|---|---|---|
cortex.opencodeBinary | "opencode" | OpenCode CLI 二进制路径 |
cortex.opencodePort | 4096 | opencode serve 的本地端口 |
cortex.agent | "build" | 默认 OpenCode 主代理(如 build、plan) |
cortex.providerID | "opencode" | 首选 OpenCode 提供商 ID |
cortex.modelID | "big-pickle" | 该提供商内的首选模型 ID |
cortex.modelMode | "auto" | 模型选择:auto / turbo / manual |
cortex.routing.useAllConnectedProviders | false | 为 true 时,Auto/Turbo 可使用任何已连接的 OpenCode 提供商;为 false 时仅使用 cortex.providerID |
cortex.context.topK | 8 | 每个提示注入的本地上下文块数量 |
cortex.context.maxChars | 12000 | 每个提示检索上下文的最大字符数 |
cortex.context.embeddings | "hash" | 嵌入后端:hash(离线)或 minilm |
cortex.context.chunkMode | "symbols" | 索引拆分模式:symbols(LSP)或 lines |
cortex.locale | "en" | Cortex UI 语言(独立于 VS Code 显示语言) |
通过 OpenCode 的模型
Cortex 将 OpenCode 用作代理提供商。你从 OpenCode 订阅中可用的模型里选择。OpenCode 账单在 Cortex 之外管理,与 Cortex 许可无关。
- 连接 — 使用 Cortex: Connect Provider 或 Cortex: Manage Tokens / Logins 登录 OpenCode
- 模型选择器 — 在聊天 UI 中选择 OpenCode 账户中可用的任意模型
- 默认值 — 在 VS Code 设置中配置 cortex.providerID、cortex.modelID 和 cortex.modelMode
OpenCode 也可能使用自己的配置(例如 ~/.config/opencode/opencode.json)管理代理权限与默认值。那是 OpenCode 配置,与 Cortex 的 VS Code 设置分开。
上下文来源
Cortex 自动从以下来源收集上下文:
- 活动文件 — 你正在编辑的文件
- 选择 — 高亮文本
- 词法搜索 — 项目中的关键词匹配
- Embeddings — 默认使用 hash 嵌入;可选 MiniLM 用于相关代码
- Rules / memory — .cortex 下的 rules 与 memory 文件
- @ mentions — 聊天中的文件、文件夹、终端与代理