consult
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseconsult
咨询
Cross-tool AI consultation: query another AI CLI tool and return the response.
跨工具AI咨询:调用其他AI CLI工具并返回响应。
When to Use
使用场景
Invoke this skill when:
- User wants a second opinion from a different AI tool
- User asks to consult, ask, or cross-check with gemini/codex/claude/opencode/copilot
- User needs to compare responses across AI tools
- User wants to validate a decision with an external AI
在以下场景调用此技能:
- 用户希望从不同AI工具获取第二意见
- 用户要求咨询、询问或用gemini/codex/claude/opencode/copilot进行交叉验证
- 用户需要对比不同AI工具的响应
- 用户希望通过外部AI验证决策
Arguments
参数
Parse from :
$ARGUMENTS| Flag | Values | Default | Description |
|---|---|---|---|
| gemini, codex, claude, opencode, copilot | (picker) | Target tool |
| low, medium, high, max | medium | Thinking effort level |
| any model name | (from effort) | Override model selection |
| diff, file=PATH, none | none | Auto-include context |
| (flag) or SESSION_ID | false | Resume previous session |
Question text is everything in except the flags above.
$ARGUMENTS从中解析:
$ARGUMENTS| 标志 | 取值 | 默认值 | 说明 |
|---|---|---|---|
| gemini, codex, claude, opencode, copilot | (选择器) | 目标工具 |
| low, medium, high, max | medium | 思考力度等级 |
| 任意模型名称 | (基于effort) | 覆盖模型选择 |
| diff, file=PATH, none | none | 自动包含上下文 |
| (标志) 或 SESSION_ID | false | 恢复之前的会话 |
问题文本为中除上述标志外的所有内容。
$ARGUMENTSProvider Configurations
提供商配置
Claude
Claude
Command: claude -p "QUESTION" --output-format json --model "MODEL" --max-turns TURNS --allowedTools "Read,Glob,Grep"
Session resume: --resume "SESSION_ID"Models: haiku, sonnet, opus
| Effort | Model | Max Turns |
|---|---|---|
| low | haiku | 1 |
| medium | sonnet | 3 |
| high | opus | 5 |
| max | opus | 10 |
Parse output:
Session ID:
Continuable: Yes
JSON.parse(stdout).resultJSON.parse(stdout).session_idCommand: claude -p "QUESTION" --output-format json --model "MODEL" --max-turns TURNS --allowedTools "Read,Glob,Grep"
Session resume: --resume "SESSION_ID"Models: haiku, sonnet, opus
| 力度 | 模型 | 最大轮次 |
|---|---|---|
| low | haiku | 1 |
| medium | sonnet | 3 |
| high | opus | 5 |
| max | opus | 10 |
解析输出:
会话ID:
可续会话: 是
JSON.parse(stdout).resultJSON.parse(stdout).session_idGemini
Gemini
Command: gemini -p "QUESTION" --output-format json -m "MODEL"
Session resume: --resume "SESSION_ID"Models: gemini-2.5-flash, gemini-2.5-pro, gemini-3-flash, gemini-3-pro
| Effort | Model |
|---|---|
| low | gemini-2.5-flash |
| medium | gemini-3-flash |
| high | gemini-3-pro |
| max | gemini-3-pro |
Parse output:
Session ID:
Continuable: Yes (via )
JSON.parse(stdout).responseJSON.parse(stdout).session_id--resumeCommand: gemini -p "QUESTION" --output-format json -m "MODEL"
Session resume: --resume "SESSION_ID"Models: gemini-2.5-flash, gemini-2.5-pro, gemini-3-flash, gemini-3-pro
| 力度 | 模型 |
|---|---|
| low | gemini-2.5-flash |
| medium | gemini-3-flash |
| high | gemini-3-pro |
| max | gemini-3-pro |
解析输出:
会话ID:
可续会话: 是(通过)
JSON.parse(stdout).responseJSON.parse(stdout).session_id--resumeCodex
Codex
Command: codex exec "QUESTION" --json -m "MODEL" -c model_reasoning_effort="LEVEL"
Session resume: codex exec resume SESSION_ID "QUESTION" --json
Session resume (latest): codex exec resume --last "QUESTION" --jsonNote: is the non-interactive/headless mode. There is no flag. The TUI mode is (no subcommand).
codex exec-qcodexModels: gpt-5.3-codex-spark, gpt-5-codex, gpt-5.1-codex, gpt-5.2-codex, gpt-5.3-codex, gpt-5.1-codex-max
| Effort | Model | Reasoning |
|---|---|---|
| low | gpt-5.3-codex-spark | low |
| medium | gpt-5.2-codex | medium |
| high | gpt-5.3-codex | high |
| max | gpt-5.3-codex | xhigh |
Parse output: or raw text
Session ID: Codex prints a resume hint at session end (e.g., ). Extract the session ID from stdout or from if available.
Continuable: Yes. Sessions are stored as JSONL rollout files at . Non-interactive resume uses . Use instead of a session ID to resume the most recent session.
JSON.parse(stdout).messagecodex resume SESSION_IDJSON.parse(stdout).session_id~/.codex/sessions/codex exec resume SESSION_ID "follow-up prompt" --json--lastCommand: codex exec "QUESTION" --json -m "MODEL" -c model_reasoning_effort="LEVEL"
Session resume: codex exec resume SESSION_ID "QUESTION" --json
Session resume (latest): codex exec resume --last "QUESTION" --json注意: 是非交互式/无头模式,没有标志。TUI模式为(无子命令)。
codex exec-qcodexModels: gpt-5.3-codex-spark, gpt-5-codex, gpt-5.1-codex, gpt-5.2-codex, gpt-5.3-codex, gpt-5.1-codex-max
| 力度 | 模型 | 推理等级 |
|---|---|---|
| low | gpt-5.3-codex-spark | low |
| medium | gpt-5.2-codex | medium |
| high | gpt-5.3-codex | high |
| max | gpt-5.3-codex | xhigh |
解析输出: 或原始文本
会话ID: Codex会在会话结束时打印恢复提示(例如)。从stdout或(如果可用)中提取会话ID。
可续会话: 是。会话以JSONL滚动文件存储在。非交互式恢复使用。使用代替会话ID恢复最近的会话。
JSON.parse(stdout).messagecodex resume SESSION_IDJSON.parse(stdout).session_id~/.codex/sessions/codex exec resume SESSION_ID "follow-up prompt" --json--lastOpenCode
OpenCode
Command: opencode run "QUESTION" --format json --model "MODEL" --variant "VARIANT"
Session resume: opencode run "QUESTION" --format json --model "MODEL" --variant "VARIANT" --continue (most recent) or --session "SESSION_ID"
With thinking: add --thinking flagModels: 75+ via providers (format: provider/model). Top picks: claude-sonnet-4-5, claude-opus-4-5, gpt-5.2, gpt-5.1-codex, gemini-3-pro, minimax-m2.1
| Effort | Model | Variant |
|---|---|---|
| low | (user-selected or default) | low |
| medium | (user-selected or default) | medium |
| high | (user-selected or default) | high |
| max | (user-selected or default) | high + --thinking |
Parse output: Parse JSON events from stdout, extract final text response
Session ID: Extract from JSON output if available, or use to auto-resume the most recent session.
Continuable: Yes (via or ). Sessions are stored in a SQLite database in the OpenCode data directory. Use for a specific session, or for the most recent.
--continue--continue--session--session SESSION_ID--continueCommand: opencode run "QUESTION" --format json --model "MODEL" --variant "VARIANT"
Session resume: opencode run "QUESTION" --format json --model "MODEL" --variant "VARIANT" --continue (最近会话) 或 --session "SESSION_ID"
With thinking: 添加 --thinking 标志Models: 75+ 来自提供商(格式: provider/model)。首选模型: claude-sonnet-4-5, claude-opus-4-5, gpt-5.2, gpt-5.1-codex, gemini-3-pro, minimax-m2.1
| 力度 | 模型 | 变体 |
|---|---|---|
| low | (用户选择或默认) | low |
| medium | (用户选择或默认) | medium |
| high | (用户选择或默认) | high |
| max | (用户选择或默认) | high + --thinking |
解析输出: 从stdout解析JSON事件,提取最终文本响应
会话ID: 从JSON输出中提取(如果可用),或使用自动恢复最近会话。
可续会话: 是(通过或)。会话存储在OpenCode数据目录的SQLite数据库中。使用指定会话,或恢复最近会话。
--continue--continue--session--session SESSION_ID--continueCopilot
Copilot
Command: copilot -p "QUESTION"Models: claude-sonnet-4-5 (default), claude-opus-4-6, claude-haiku-4-5, claude-sonnet-4, gpt-5
| Effort | Notes |
|---|---|
| all | No effort control available. Model selectable via --model flag. |
Parse output: Raw text from stdout
Continuable: No
Command: copilot -p "QUESTION"Models: claude-sonnet-4-5 (默认), claude-opus-4-6, claude-haiku-4-5, claude-sonnet-4, gpt-5
| 力度 | 说明 |
|---|---|
| 所有 | 无力度控制,可通过--model标志选择模型。 |
解析输出: stdout中的原始文本
可续会话: 否
Input Validation
输入验证
Before building commands, validate all user-provided arguments:
- --tool: MUST be one of: gemini, codex, claude, opencode, copilot. Reject all other values.
- --effort: MUST be one of: low, medium, high, max. Default to medium.
- --model: Allow any string, but quote it in the command.
- --context=file=PATH: MUST resolve within the project directory. Reject absolute paths outside cwd. Additional checks:
- Block UNC paths (Windows): Reject paths starting with or
\\(network shares)// - Resolve canonical path: Use the Read tool to read the file (do NOT use shell commands). Before reading, resolve the path: join , then normalize (collapse
cwd + PATH,., resolve symlinks).. - Verify containment: The resolved canonical path MUST start with the current working directory. If it escapes (via , symlinks, or junction points), reject with:
..[ERROR] Path escapes project directory: {PATH} - No shell access: Read file content using the Read tool only. Never pass user-provided paths to shell commands (prevents injection via path values)
- Block UNC paths (Windows): Reject paths starting with
构建命令前,验证所有用户提供的参数:
- --tool: 必须是以下之一: gemini, codex, claude, opencode, copilot。拒绝其他所有值。
- --effort: 必须是以下之一: low, medium, high, max。默认值为medium。
- --model: 允许任意字符串,但在命令中需加引号。
- --context=file=PATH: 必须在项目目录内解析。拒绝当前工作目录外的绝对路径。额外检查:
- 阻止UNC路径(Windows): 拒绝以或
\\开头的路径(网络共享)// - 解析规范路径: 使用Read工具读取文件(不要使用shell命令)。读取前解析路径:拼接,然后规范化(折叠
cwd + PATH,., 解析符号链接).. - 验证包含性: 解析后的规范路径必须以当前工作目录开头。如果通过, 符号链接或连接点跳出目录,返回错误:
..[ERROR] Path escapes project directory: {PATH} - 无Shell访问: 仅使用Read工具读取文件内容。绝不要将用户提供的路径传递给shell命令(防止路径注入)
- 阻止UNC路径(Windows): 拒绝以
Command Building
命令构建
Given the parsed arguments, build the complete CLI command. All user-provided values MUST be quoted in the shell command to prevent injection.
根据解析后的参数,构建完整的CLI命令。所有用户提供的值必须在shell命令中加引号以防止注入。
Step 1: Resolve Model
步骤1: 解析模型
If is specified, use it directly. Otherwise, use the effort-based model from the provider table above.
--model如果指定了,直接使用。否则,使用上述提供商表格中基于力度的模型。
--modelStep 2: Build Command String
步骤2: 构建命令字符串
Use the command template from the provider's configuration section. Substitute QUESTION, MODEL, TURNS, LEVEL, and VARIANT with resolved values.
If continuing a session:
- Claude or Gemini: append to the command.
--resume SESSION_ID - Codex: use instead of the standard command. Use
codex exec resume SESSION_ID "QUESTION" --jsoninstead of a session ID for the most recent session.--last - OpenCode: append to the command. If no session_id is saved, use
--session SESSION_IDinstead (resumes most recent session). If OpenCode at max effort: append--continue.--thinking
使用提供商配置部分的命令模板。将QUESTION, MODEL, TURNS, LEVEL, VARIANT替换为解析后的值。
如果恢复会话:
- Claude或Gemini: 在命令后追加。
--resume SESSION_ID - Codex: 使用代替标准命令。使用
codex exec resume SESSION_ID "QUESTION" --json代替会话ID恢复最近会话。--last - OpenCode: 在命令后追加。如果没有保存session_id,使用
--session SESSION_ID(恢复最近会话)。 如果OpenCode使用max力度: 追加--continue。--thinking
Step 3: Context Packaging
步骤3: 上下文打包
If : Run and prepend output to the question.
If : Read the file using the Read tool and prepend its content to the question.
--context=diffgit diff 2>/dev/null--context=file=PATH如果: 运行并将输出前置到问题中。
如果: 使用Read工具读取文件并将内容前置到问题中。
--context=diffgit diff 2>/dev/null--context=file=PATHStep 4: Safe Question Passing
步骤4: 安全传递问题
User-provided question text MUST NOT be interpolated into shell command strings. Shell escaping is insufficient -- , backticks, and other expansion sequences can execute arbitrary commands even inside double quotes.
$()Required approach -- pass question via stdin or temp file:
-
Write the question to a temporary file using the Write tool (e.g.,)
{AI_STATE_DIR}/consult/question.tmpPlatform state directory:- Claude Code:
.claude/ - OpenCode:
.opencode/ - Codex CLI:
.codex/
- Claude Code:
-
Build the command using the temp file as input instead of inline text:
| Provider | Safe command pattern |
|---|---|
| Claude | |
| Claude (resume) | |
| Gemini | |
| Gemini (resume) | |
| Codex | |
| Codex (resume) | |
| Codex (resume latest) | |
| OpenCode | |
| OpenCode (resume by ID) | |
| OpenCode (resume latest) | |
| Copilot | |
- Delete the temp file after the command completes (success or failure). Always clean up to prevent accumulation.
Model and session ID values are controlled strings (from pickers or saved state) and safe to quote directly in the command. Only the question contains arbitrary user text and requires the temp file approach. The temp file path () uses a platform-controlled directory and fixed filename -- no user input in the path.
{AI_STATE_DIR}/consult/question.tmp用户提供的问题文本绝不能直接插入到shell命令字符串中。Shell转义是不够的——, 反引号和其他扩展序列即使在双引号内也能执行任意命令。
$()必要方法 -- 通过stdin或临时文件传递问题:
-
将问题写入临时文件 使用Write工具(例如)
{AI_STATE_DIR}/consult/question.tmp平台状态目录:- Claude Code:
.claude/ - OpenCode:
.opencode/ - Codex CLI:
.codex/
- Claude Code:
-
构建命令 使用临时文件作为输入,而非内联文本:
| 提供商 | 安全命令模式 |
|---|---|
| Claude | |
| Claude (恢复会话) | |
| Gemini | |
| Gemini (恢复会话) | |
| Codex | |
| Codex (恢复会话) | |
| Codex (恢复最近会话) | |
| OpenCode | |
| OpenCode (按ID恢复会话) | |
| OpenCode (恢复最近会话) | |
| Copilot | |
- 删除临时文件 命令完成后(成功或失败)。始终清理以防止文件堆积。
模型和会话ID值是受控字符串(来自选择器或保存的状态),可以直接在命令中加引号。只有问题包含任意用户文本,需要使用临时文件方法。临时文件路径()使用平台控制的目录和固定文件名 -- 路径中无用户输入。
{AI_STATE_DIR}/consult/question.tmpProvider Detection
工具检测
Cross-platform tool detection:
- Windows: -- returns 0 if found
where.exe TOOL 2>nul - Unix: -- returns 0 if found
which TOOL 2>/dev/null
Check each tool (claude, gemini, codex, opencode, copilot) and return only the available ones.
跨平台工具检测:
- Windows: -- 找到则返回0
where.exe TOOL 2>nul - Unix: -- 找到则返回0
which TOOL 2>/dev/null
检查每个工具(claude, gemini, codex, opencode, copilot)并仅返回可用的工具。
Session Management
会话管理
Save Session
保存会话
After successful consultation, save to :
{AI_STATE_DIR}/consult/last-session.jsonjson
{
"tool": "claude",
"model": "opus",
"effort": "high",
"session_id": "abc-123-def-456",
"timestamp": "2026-02-10T12:00:00Z",
"question": "original question text",
"continuable": true
}AI_STATE_DIR- Claude Code:
.claude/ - OpenCode:
.opencode/ - Codex CLI:
.codex/
成功咨询后,保存到:
{AI_STATE_DIR}/consult/last-session.jsonjson
{
"tool": "claude",
"model": "opus",
"effort": "high",
"session_id": "abc-123-def-456",
"timestamp": "2026-02-10T12:00:00Z",
"question": "original question text",
"continuable": true
}AI_STATE_DIR- Claude Code:
.claude/ - OpenCode:
.opencode/ - Codex CLI:
.codex/
Load Session
加载会话
For , read the session file and restore:
--continue- tool (from saved state)
- session_id (for --resume flag)
- model (reuse same model)
If session file not found, warn and proceed as fresh consultation.
对于,读取会话文件并恢复:
--continue- tool (来自保存的状态)
- session_id (用于--resume标志)
- model (复用相同模型)
如果会话文件不存在,发出警告并作为新咨询继续。
Output Sanitization
输出清理
Before including any consulted tool's response in the output, scan the response text and redact matches for these patterns:
| Pattern | Description | Replacement |
|---|---|---|
| Anthropic API keys | |
| OpenAI project keys | |
| Anthropic API keys (ant prefix) | |
| Google API keys | |
| GitHub personal access tokens | |
| GitHub OAuth tokens | |
| GitHub fine-grained PATs | |
| Key assignment in env output | |
| Key assignment in env output | |
| Key assignment in env output | |
| Key assignment in env output | |
| AWS access keys | |
| AWS session tokens | |
| Authorization headers | |
Apply redaction to the full response text before inserting into the result JSON. If any redaction occurs, append a note:
[WARN] Sensitive tokens were redacted from the response.在将任何咨询工具的响应包含到输出前,扫描响应文本并编辑匹配以下模式的内容:
| 模式 | 描述 | 替换内容 |
|---|---|---|
| Anthropic API密钥 | |
| OpenAI项目密钥 | |
| Anthropic API密钥(ant前缀) | |
| Google API密钥 | |
| GitHub个人访问令牌 | |
| GitHub OAuth令牌 | |
| GitHub细粒度PAT | |
| 环境输出中的密钥赋值 | |
| 环境输出中的密钥赋值 | |
| 环境输出中的密钥赋值 | |
| 环境输出中的密钥赋值 | |
| AWS访问密钥 | |
| AWS会话令牌 | |
| 授权头 | |
在将响应插入结果JSON前,对完整响应文本应用编辑。如果进行了任何编辑,追加提示:
[WARN] Sensitive tokens were redacted from the response.Output Format
输出格式
Return a plain JSON object to stdout (no markers or wrappers):
json
{
"tool": "gemini",
"model": "gemini-3-pro",
"effort": "high",
"duration_ms": 12300,
"response": "The AI's response text here...",
"session_id": "abc-123",
"continuable": true
}向stdout返回纯JSON对象(无标记或包装器):
json
{
"tool": "gemini",
"model": "gemini-3-pro",
"effort": "high",
"duration_ms": 12300,
"response": "The AI's response text here...",
"session_id": "abc-123",
"continuable": true
}Install Instructions
安装说明
When a tool is not found, return these install commands:
| Tool | Install |
|---|---|
| Claude | |
| Gemini | See https://gemini.google.com/cli for install instructions |
| Codex | |
| OpenCode | |
| Copilot | |
当未找到工具时,返回以下安装命令:
| 工具 | 安装命令 |
|---|---|
| Claude | |
| Gemini | 查看 https://gemini.google.com/cli 获取安装说明 |
| Codex | |
| OpenCode | |
| Copilot | |
Error Handling
错误处理
| Error | Response |
|---|---|
| Tool not installed | Return install instructions from table above |
| Tool execution timeout | Return |
| JSON parse error | Return raw text as response |
| Empty output | Return |
| Session file missing | Proceed without session resume |
| API key missing | Return tool-specific env var instructions |
| 错误 | 响应 |
|---|---|
| 工具未安装 | 返回上表中的安装说明 |
| 工具执行超时 | 返回 |
| JSON解析错误 | 返回原始文本作为响应 |
| 空输出 | 返回 |
| 会话文件缺失 | 不恢复会话继续执行 |
| API密钥缺失 | 返回工具特定的环境变量说明 |
Integration
集成
This skill is invoked by:
- for
consult-agentcommand/consult - Direct invocation:
Skill('consult', '"question" --tool=gemini --effort=high')
Example:
Skill('consult', '"Is this approach correct?" --tool=gemini --effort=high --model=gemini-3-pro')此技能由以下方式调用:
- 用于
consult-agent命令/consult - 直接调用:
Skill('consult', '"question" --tool=gemini --effort=high')
示例:
Skill('consult', '"Is this approach correct?" --tool=gemini --effort=high --model=gemini-3-pro')