🌳 CoTangent 使用说明 / User GuideCoTangent = Collaboration + Tangent(切线/分支)。名字里的意思是:你和 AI 协作着,把一段对话长成一棵可以随时分叉、随时长出新枝的树,而不是被困在一条单一、线性的聊天记录里。 CoTangent = Collaboration + Tangent (a branch/offshoot). The name captures what it does: you and the AI collaborate to grow a conversation into a tree that can branch off at any point, instead of being stuck in one single, linear chat log. CoTangent 是一个树形对话 VS Code 扩展。普通对话可以沿当前分支持续进行,也可以从历史回复创建新分支、合并多个节点,或让小模型把一条完整回复拆成可继续追问的语义要点。后端可在 Claude Code 与 Codex 之间自由切换。 CoTangent is a tree-based conversation VS Code extension. A regular conversation can keep going along its current branch, or you can create a new branch from a past reply, merge multiple nodes, or have a small model split a complete reply into semantic points you can keep asking about. The backend can be switched freely between Claude Code and Codex. 1. 启动 CoTangent / Launching CoTangent已安装扩展(通过
|
| 设置 / Setting | 作用 / Effect |
|---|---|
cotangent.modelRouting |
auto 使用本地规则自动选择;也可固定为 large、medium 或 small / auto picks automatically via local rules; can also be fixed to large, medium, or small |
cotangent.models.large |
Claude 大模型映射,可设为 auto 或完整模型 ID / Claude large-model mapping; set to auto or a full model ID |
cotangent.models.medium |
Claude 中模型映射,可设为 auto 或完整模型 ID / Claude medium-model mapping; set to auto or a full model ID |
cotangent.models.small |
Claude 小模型映射,可设为 auto 或完整模型 ID;AI 拆分固定使用此映射 / Claude small-model mapping; set to auto or a full model ID; AI splitting always uses this mapping |
cotangent.models.codex.large |
Codex 大模型映射,可设为 auto 或完整模型 ID / Codex large-model mapping; set to auto or a full model ID |
cotangent.models.codex.medium |
Codex 中模型映射,可设为 auto 或完整模型 ID / Codex medium-model mapping; set to auto or a full model ID |
cotangent.models.codex.small |
Codex 小模型映射,可设为 auto 或完整模型 ID;AI 拆分固定使用此映射 / Codex small-model mapping; set to auto or a full model ID; AI splitting always uses this mapping |
自动路由在本地根据任务长度、代码量、是否合并节点以及架构/重构/翻译等关键词判断,不会为路由额外调用一次模型。 Automatic routing decides locally based on task length, amount of code, whether nodes are being merged, and keywords like architecture/refactor/translate — it never makes an extra model call just to route.
权限模式 / Permission modes
Claude 和 Codex 两种引擎下均可选择,且两者行为语义一致 / Available for both the Claude and Codex engines, with consistent semantics across both:
| 模式 / Mode | 行为 / Behavior |
|---|---|
| 全部放行 / Full access | 工具操作无需逐次确认,权限最高 / No per-action confirmation for tool operations — highest privilege |
| 自动批准编辑 / Auto-approve edits | 自动允许编辑类操作 / Automatically allows edit-type operations |
| 每次询问 / Ask every time | 工具使用前显示允许/拒绝卡片 / Shows an allow/deny card before each tool use |
| 只读(plan) / Read-only (plan) | 只进行分析和规划,不执行修改 / Analysis and planning only, no modifications executed |
在输入区域按 Shift+Tab 可以循环切换权限模式。
Press Shift+Tab in the input area to cycle through permission modes.
Codex 侧的说明:Codex 后端走 codex app-server 长连接,"每次询问"模式下会像 Claude 一样对命令执行、文件改动逐个弹出真实的审批卡片(Allow/Deny)。点击 Deny 只会拒绝这一步操作,模型会继续对话并可能换一种方式完成任务,不会打断整个回合。具体沙箱/审批策略对应关系:
A note on Codex: the Codex backend runs over a codex app-server long-lived connection; in "Ask every time" mode it pops real approval cards (Allow/Deny) for each command execution or file change, just like Claude. Clicking Deny only rejects that one step — the model continues the conversation and may try a different way to accomplish the task, without aborting the whole turn. The exact sandbox/approval-policy mapping:
| 权限模式 / Permission mode | Codex 沙箱 / Codex sandbox | Codex 审批策略 / Codex approval policy | 实际行为 / Actual behavior |
|---|---|---|---|
| 只读(plan) / Read-only (plan) | 只读 / Read-only | 不问 / Never | 只读,不写,不问 / Read-only, no writes, no prompts |
| 每次询问 / Ask every time | 工作区可写 / Workspace-writable | 按需询问 / On request | 命令/文件改动会弹审批卡片 / Commands/file changes pop an approval card |
| 自动批准编辑 / Auto-approve edits | 工作区可写 / Workspace-writable | 不问 / Never | 工作区内自动写入 / Auto-writes within the workspace |
| 全部放行 / Full access | 完全访问 / Full access | 不问 / Never | 完全访问,不问 / Full access, no prompts |
使用 全部放行 时,AI 可能直接运行命令或修改工作区文件,请只在可信项目和明确任务中使用。 With Full access, the AI may directly run commands or modify workspace files — use it only on trusted projects with clearly scoped tasks.
图片附件 / Image attachments
Claude 与 Codex 都能接收粘贴/拖入输入框的图片。Claude 走 SDK 原生的图片输入;Codex 会把图片写入一个临时文件传给模型,回合结束后立即清理,不会残留在磁盘上。 Both Claude and Codex can receive images pasted or dropped into the input box. Claude uses the SDK's native image input; Codex writes the image to a temp file and passes it to the model, cleaning up immediately after the turn ends, leaving nothing on disk.
@ 文件附加 / @ file attachments
在输入框任意位置输入 @(前面是空格或在行首),会弹出工作区文件搜索菜单 / Typing @ anywhere in the input box (preceded by a space or at the start of the line) opens a workspace file search menu:
- 继续输入可按文件名/路径过滤;/ Keep typing to filter by filename/path;
- 方向键选择,
Enter或Tab确认,鼠标点击也可以;/ Use the arrow keys to navigate,EnterorTabto confirm, or click with the mouse; - 按
Esc关闭菜单。/ PressEscto close the menu.
选中文件后,输入框里会插入 @相对路径,同时插件会立即读取该文件内容,成功后在输入框上方出现一个文件小标签(chip)。发送后模型会看到这个文件的完整内容(超出约 50000 字符会截断),Claude 与 Codex 都支持。
Once you pick a file, @relativePath is inserted into the input box, and the extension immediately reads that file's content — once successful, a small file chip appears above the input box. When you send, the model sees the file's full content (content beyond roughly 50,000 characters is truncated); both Claude and Codex support this.
- 只支持单个文本文件,不支持文件夹或二进制文件(图片等);/ Only a single text file is supported — not folders or binary files (like images);
- 一轮最多附加 10 个文件;/ Up to 10 files can be attached per turn;
- 手动删掉输入框里的
@相对路径文字,或者点击小标签上的 ✕,都会取消这个附件;/ Manually deleting the@relativePathtext in the input box, or clicking the ✕ on the chip, both remove that attachment; - 文件内容只在当前这一轮生效,不会像图片附件一样残留到后续追问里,不会让上下文用量随对话变长而不断增加。
- File content only applies to the current turn — unlike image attachments it's never carried forward into later follow-ups, so context usage doesn't keep growing as the conversation gets longer.
11. Slash 命令 / Slash commands
在输入框中输入 / 会显示当前引擎或网关支持的命令 / Typing / in the input box shows the commands supported by the current engine or gateway:
- 使用方向键选择;/ Use the arrow keys to select;
- 按
Enter或Tab填入命令;/ PressEnterorTabto fill in the command; - 按
Esc关闭菜单。/ PressEscto close the menu.
命令列表来自当前引擎能力查询。Claude 的命令来自 Claude Code 自身的命令发现机制;Codex 没有等价的实时查询接口,改为扫描本机 ~/.codex/prompts/*.md:文件名(去掉 .md)作为命令名,文件首行作为描述。这是 OpenAI 官方已标记为 deprecated 的旧机制,仅作为过渡期的最低限度支持,字段解析不保证完全准确。
The command list comes from querying the current engine's capabilities. Claude's commands come from Claude Code's own command-discovery mechanism; Codex has no equivalent real-time query interface, so it instead scans ~/.codex/prompts/*.md locally: the filename (minus .md) becomes the command name, and the file's first line becomes the description. This is an officially deprecated mechanism from OpenAI, supported here only as a minimal stopgap, and field parsing isn't guaranteed to be fully accurate.
12. SDK 管理 / SDK management
CoTangent 的 Claude Agent SDK 和 Codex SDK 都是运行时按需下载的,不随插件安装包打包。除了首次运行时的自动下载(见前文"首次运行:自动下载 SDK"),还支持后续自动更新和离线手动放置两种方式。 Both CoTangent's Claude Agent SDK and Codex SDK are downloaded on demand at runtime — neither ships inside the extension's install package. Besides the automatic download on first run (see "First run: automatic SDK download" above), both automatic updates afterward and manual offline placement are supported.
后续自动更新 / Automatic updates afterward
CoTangent 默认每 24 小时自动检查 Claude Agent SDK 和 Codex SDK 是否有新版本。发现新版本后会下载到 VS Code 的扩展全局存储并执行以下校验 / By default, CoTangent automatically checks for new versions of the Claude Agent SDK and Codex SDK every 24 hours. Once a new version is found, it's downloaded into VS Code's extension global storage, and the following checks run:
- npm 包完整性;/ npm package integrity;
- Claude SDK 的
query()与 Codex SDK 的Codex导出;/ the Claude SDK'squery()export and the Codex SDK'sCodexexport; - 当前操作系统和 CPU 对应的 Claude/Codex 原生运行时;/ the native Claude/Codex runtime matching the current OS and CPU;
- 两个内置 CLI 是否能够正常报告版本。/ whether both bundled CLIs can correctly report their version.
安装过程不会执行 npm 包的 lifecycle scripts。任一步失败都会继续使用当前正在用的版本,不影响现有对话。这类常规更新(区别于首次运行时的初始下载)不会在当前对话中途热切换;下载完成后重新加载窗口,或下次启动 VS Code 时生效。 The install process never runs npm package lifecycle scripts. If any step fails, the extension keeps using the version currently in use, without affecting existing conversations. This kind of routine update (unlike the initial download on first run) never hot-swaps mid-conversation — it takes effect after reloading the window once the download finishes, or the next time VS Code starts.
命令面板中可以运行 / From the Command Palette you can run:
- CoTangent: 立即检查 SDK 更新;/ CoTangent: Check for SDK Updates Now;
- CoTangent: 查看当前 SDK 版本。/ CoTangent: Show Current SDK Versions.
VS Code 设置中的 cotangent.sdkUpdates.mode 支持 / The cotangent.sdkUpdates.mode VS Code setting supports:
automatic:发现新版后自动下载(默认);/automatic: automatically downloads once a new version is found (default);notify:只提示,确认后下载;/notify: notifies only, downloading after confirmation;off:不在后台做常规检查,仍可手动检查。注意:这个设置只影响后台的例行更新检查,不影响首次运行时"完全没有 SDK 就必须下载"的那次初始下载——否则插件在全新安装且此设置为off时会永久无法运行任何引擎。off: disables routine background checks; manual checks remain available. Note: this setting only affects routine background update checks — it does not affect the initial download on first run, when there's no SDK at all and one must be downloaded; otherwise a fresh install with this setting atoffcould never run either engine at all.
cotangent.sdkUpdates.checkIntervalHours 可修改检查间隔,cotangent.sdkUpdates.registry 可在企业网络中改为可信 npm 镜像。下载会额外占用磁盘空间,因为下载目录需要包含两个 SDK 对应的当前平台原生运行时(通常数百 MB)。
cotangent.sdkUpdates.checkIntervalHours changes the check interval, and cotangent.sdkUpdates.registry can be set to a trusted npm mirror on an enterprise network. Downloading uses extra disk space, since the download directory needs to hold the current platform's native runtime for both SDKs (typically a few hundred MB).
离线环境:手动放置 SDK / Offline environments: placing the SDK manually
如果这台机器完全访问不到 npm registry(内网、无 VPN),可以在另一台能联网的同类机器上把 SDK 下载好,再手动拷贝过来,插件启动时会直接识别并使用,不发任何网络请求: If this machine can't reach the npm registry at all (internal network, no VPN), you can download the SDK on another machine of the same kind that does have network access, then copy it over by hand — the extension recognizes and uses it directly on startup, with no network requests at all:
在一台联网机器上(操作系统和 CPU 架构必须与运行 CoTangent 的机器一致,例如都是 macOS Apple Silicon,或都是 Windows x64),新建一个空目录并执行 / On a networked machine (the OS and CPU architecture must match the machine running CoTangent — e.g. both macOS Apple Silicon, or both Windows x64), create an empty directory and run:
mkdir sdk-offline-bundle && cd sdk-offline-bundle npm init -y npm install @anthropic-ai/claude-agent-sdk@0.3.215 @openai/codex-sdk@0.145.0版本号可以填任意你想要的版本(不填
@版本号则装最新版),两个包必须一起装,npm 会自动把对应平台的原生运行时一起拉下来。 The version numbers can be whatever you want (omit@versionto install latest); both packages must be installed together, and npm automatically pulls in the matching platform's native runtime.把生成的整个
node_modules/目录拷贝到运行 CoTangent 的机器上,放进 / Copy the entire resultingnode_modules/directory to the machine running CoTangent, into:- macOS / Linux:
~/.cotangent/sdk-runtime/offline/node_modules/(~是你的用户主目录) / macOS / Linux:~/.cotangent/sdk-runtime/offline/node_modules/(~is your home directory) - Windows:
C:\Users\<你的用户名>\.cotangent\sdk-runtime\offline\node_modules\/ Windows:C:\Users\<your username>\.cotangent\sdk-runtime\offline\node_modules\ - WSL:注意这个路径是 WSL 发行版内部的路径,跟 Windows 侧的用户目录是两个不同的地方。如果你在 Windows 侧下载好了 SDK,需要通过
\\wsl$\<发行版名>\home\<用户名>\.cotangent\...或wsl cp命令拷进 WSL 内部,而不是直接放进C:\Users\你\下面。 WSL: note that this path is inside your WSL distro, a different location from the Windows-side user directory. If you downloaded the SDK on the Windows side, copy it into WSL via\\wsl$\<distro name>\home\<username>\.cotangent\...or awsl cpcommand, rather than placing it directly underC:\Users\you\.
这个路径可以通过
cotangent.sdkUpdates.offlinePath改成别的位置,例如团队共享盘。命令面板执行 CoTangent: Open Offline SDK Folder 可以直接打开这个目录(如果目录不存在会自动创建)。 This path can be changed to somewhere else, such as a shared team drive, viacotangent.sdkUpdates.offlinePath. Run CoTangent: Open Offline SDK Folder from the Command Palette to open this directory directly (it's created automatically if missing).- macOS / Linux:
命令面板执行 CoTangent: Verify Offline SDK Folder,插件会真实加载两个 SDK 并调用一次原生 CLI 的
--version,确认拷贝无误(尤其是平台/架构是否匹配)。校验通过后按提示重新加载窗口即可生效。 Run CoTangent: Verify Offline SDK Folder from the Command Palette — the extension actually loads both SDKs and calls the native CLI's--versiononce, confirming the copy is intact (especially platform/architecture match). Once verification passes, reload the window as prompted to take effect.
几点说明 / A few notes:
- 手动放置的离线版本不会被自动更新覆盖或删除,插件从不写入这个目录。
- A manually placed offline version is never overwritten or deleted by automatic updates — the extension never writes to this directory.
- 优先级:如果同时存在"自动下载的版本"和"手动放置的离线版本",自动下载的版本优先(它本身就是联网校验过的);只有在没有自动下载版本时才使用离线目录;两者都没有时插件会持续尝试首次下载,或提示你手动放置。
- Priority: if both an "auto-downloaded version" and a "manually placed offline version" exist, the auto-downloaded one wins (it's already been verified online); the offline directory is only used when there's no auto-downloaded version; with neither present, the extension keeps retrying the first-run download, or prompts you to place one manually.
- 校验失败(比如平台不匹配、目录不完整)时会自动跳过离线目录,改走自动下载或提示重新放置,不会导致插件崩溃。
- On verification failure (e.g. platform mismatch, incomplete directory), the offline directory is automatically skipped in favor of an auto-download or a re-placement prompt — it never crashes the extension.
13. 数据保存 / Data storage
对话树会保存到当前 VS Code 工作区状态中。工作区设置只作为空白画布的默认值;每个真实对话节点会保存自己的引擎、供应商、模型映射、路由方式和权限模式。 The conversation tree is saved into the current VS Code workspace state. Workspace settings provide defaults for a blank canvas; every real conversation node saves its own engine, provider, model mappings, routing mode, and permission mode.
切换到另一个工作区时,会使用该工作区自己的树和配置。 Switching to a different workspace uses that workspace's own tree and configuration.
14. 常见问题 / Troubleshooting
打开面板后一直显示"正在下载所需的 SDK" / The panel keeps showing "Downloading required SDKs" after opening
首次运行需要真实从 npm 下载两个 SDK(各自带平台原生二进制,通常需要一两分钟)。如果长时间没有变化 / The first run genuinely needs to download two SDKs from npm (each with platform-native binaries, typically taking a minute or two). If nothing changes for a long time:
- 确认这台机器能访问
https://registry.npmjs.org(或你在设置里配置的cotangent.sdkUpdates.registry);/ Confirm this machine can reachhttps://registry.npmjs.org(or whatevercotangent.sdkUpdates.registryyou've configured in settings); - 如果网络受限,改用离线手动放置(见"12. SDK 管理 → 离线环境:手动放置 SDK"),下载失败的提示里也会带上同样的说明;/ If the network is restricted, switch to manual offline placement (see "12. SDK Management → Offline environments: placing the SDK manually") — a failed download's error message includes the same instructions;
- 命令面板运行 CoTangent: 立即检查 SDK 更新 手动重试。/ Run CoTangent: Check for SDK Updates Now from the Command Palette to retry manually.
打开面板就自动弹出了"管理供应商" / Opening the panel automatically pops up "Manage Providers"
说明本机没有检测到 ~/.claude/settings.json 或 ~/.codex/config.toml,也没有任何已保存的供应商预设——需要先配置一个才能开始对话。可以选择"跟随本机 CLI 配置"(先安装并登录 Claude Code 或 Codex CLI),或者直接在这个面板里填写第三方网关的 API Host/Key。这个提示每个面板只会自动弹一次,配置好之后可以随时通过顶部 ⚙ 管理供应商 按钮再次打开。
This means the local machine has neither ~/.claude/settings.json nor ~/.codex/config.toml detected, nor any saved provider preset — one needs to be configured before starting a conversation. You can choose "follow local CLI config" (install and log in to Claude Code or the Codex CLI first), or fill in a third-party gateway's API host/key directly in this panel. This prompt only auto-opens once per panel; once configured, you can reopen it anytime via the ⚙ Manage Providers button at the top.
修改代码后界面没有变化(仅开发模式) / The UI doesn't change after editing code (dev mode only)
- 运行
npm run build;/ Runnpm run build; - 在扩展开发宿主中运行 Developer: Reload Window;/ Run Developer: Reload Window in the Extension Development Host;
- 必要时关闭并重新按
F5启动。/ If needed, close and relaunch withF5.
模型列表为空或模型不可用 / The model list is empty or a model is unavailable
- 确认主对话能正常调用当前网关;/ Confirm the main conversation can call the current gateway normally;
- 检查 Claude Code 用户、项目和本地设置中的网关与认证配置;/ Check the gateway and authentication configuration in Claude Code's user, project, and local settings;
- 点击顶部
↻刷新;/ Click↻at the top to refresh; - 在"映射"中重新选择网关当前公开的模型。/ Re-select a model currently exposed by the gateway under "Mapping".
主对话和 AI 拆分共用同一套 Claude Code 网关与认证配置,只是拆分使用"小模型"映射。 The main conversation and AI splitting share the same Claude Code gateway and authentication configuration — splitting just uses the "small model" mapping.
拆分提示达到最大回合数 / The split prompt hits the maximum turn count
当前版本已为结构化拆分预留多个协议回合。请先重新构建并执行 Developer: Reload Window;如果仍然出现该错误,请确认运行的是最新 dist/extension.js。
The current version reserves multiple protocol turns for structured splitting. Rebuild first and run Developer: Reload Window; if the error still occurs, confirm you're running the latest dist/extension.js.
拆分失败但原要点还在 / A split failed but the original point is still there
这是正常的保护行为。CoTangent 只有在新拆分结果完整生成并通过校验后才会替换旧要点。 This is expected protective behavior. CoTangent only replaces old points once the new split result is fully generated and validated.
无法重新拆分 / Can't re-split
如果旧要点下面已经产生后续对话,系统会阻止替换。请先删除这些后续分支,再右键原始回复重新拆分。 If follow-up conversation already exists under the old points, the system blocks the replacement. Delete those follow-up branches first, then right-click the original reply to re-split.
Markdown 在生成时没有立即渲染 / Markdown isn't rendered immediately while generating
这是预期行为。流式阶段使用纯文本以避免界面反复跳动;回复完成后才统一渲染 Markdown、表格和代码块。 This is expected behavior. The streaming phase uses plain text to avoid the UI jumping around; Markdown, tables, and code blocks are all rendered together once the reply finishes.
Esc 没有效果 / Esc has no effect
请先确认 CoTangent 面板处于当前活动窗口。生成回复或拆分期间按一次 Esc 是中断任务;空闲时快速按两次 Esc 才是编辑上一轮。
First confirm the CoTangent panel is the currently active window. Pressing Esc once while a reply or split is generating interrupts the task; pressing Esc twice quickly while idle edits the last turn instead.
模型问问题时直接输出了文字或 JSON,没有出现卡片 / The model outputs plain text or JSON directly when asking a question, with no card appearing
模型没有一定要调用 AskUserQuestion(Claude)或 request_user_input(Codex)工具,这取决于它当次的判断。可以在提示里明确要求"请使用该工具向我提问"再试一次;如果模型坚持用文字提问,属于模型自身选择,不是插件的问题。
The model isn't required to call AskUserQuestion (Claude) or request_user_input (Codex) — whether it does depends on its own judgment each time. You can explicitly ask it to "please use that tool to ask me" in your prompt and try again; if the model still insists on asking in plain text, that's the model's own choice, not an issue with the extension.
输入 @ 没有弹出文件菜单,或选中文件后没有内容 / Typing @ doesn't open the file menu, or there's no content after picking a file
- 确认当前 VS Code 已经打开了一个工作区(文件夹),未打开工作区时
@搜索不到任何文件;/ Confirm VS Code currently has a workspace (folder) open —@search finds no files at all without one; - 确认
@前面是空格或在行首——user@host这种中间出现的@不会触发菜单,避免误伤邮箱、用户名等正常文本;/ Confirm the@is preceded by a space or at the start of the line — an@appearing mid-word, like inuser@host, never triggers the menu, to avoid misfiring on emails, usernames, and similar ordinary text; - 选中的文件如果是二进制文件(图片、编译产物等),会提示"看起来是二进制文件",改为手动描述内容或换成文本文件;/ If the picked file is a binary file (an image, a build artifact, etc.), you'll see a message that it "looks like a binary file" — describe its content manually instead, or switch to a text file;
- 手动删掉了输入框里的
@相对路径文字,等同于取消该附件,发送前请确认文字还在原处。/ Manually deleting the@relativePathtext in the input box is the same as cancelling that attachment — make sure the text is still there before sending.
15. 快捷操作速查 / Keyboard shortcuts
| 操作 / Action | 快捷方式 / Shortcut |
|---|---|
| 发送 / Send | Enter |
| 输入换行 / Insert a newline | Shift+Enter |
| 多选节点 / Multi-select nodes | Cmd/Ctrl + 单击 / Cmd/Ctrl + click |
| 中断生成/取消拆分 / Interrupt generation / cancel split | Esc |
| 编辑上一轮 / Edit the last turn | 空闲时快速按两次 Esc / Press Esc twice quickly while idle |
| 切换权限模式 / Cycle permission mode | Shift+Tab |
| 打开 Slash 命令菜单 / Open the Slash command menu | 输入 / / Type / |
| 打开 @ 文件菜单 / Open the @ file menu | 输入 @ / Type @ |
| 关闭命令/文件菜单 / Close the command/file menu | Esc |