ai-coding-agents
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAI Coding Agents Skill
AI编码代理技能指南
Expert knowledge for Codex CLI and Claude Code CLI — the two leading AI coding agents.
Note: This skill documents both tools for reference. VMark development primarily uses Claude Code CLI. The Codex CLI sections are retained for completeness and cross-tool workflows.
掌握Codex CLI和Claude Code CLI这两款领先AI编码代理的专业知识。
注意: 本技能文档同时记录了这两款工具以供参考。VMark开发主要使用Claude Code CLI。保留Codex CLI部分是为了内容完整以及支持跨工具工作流。
When to Use
适用场景
- Orchestrating complex coding tasks via CLI
- Configuring MCP servers for either tool
- Setting up automation pipelines (CI/CD)
- Troubleshooting authentication or sandbox issues
- Comparing capabilities between agents
- Custom agent/subagent configuration
- 通过CLI编排复杂编码任务
- 为任意一款工具配置MCP服务器
- 搭建自动化流水线(CI/CD)
- 排查认证或沙箱问题
- 对比两款代理的能力
- 自定义代理/子代理配置
Quick Reference
快速参考
Starting Sessions
启动会话
| Task | Codex CLI | Claude Code CLI |
|---|---|---|
| Interactive session | | |
| With prompt | | |
| Non-interactive | | |
| Resume last | | |
| Resume by ID | | |
| 任务 | Codex CLI | Claude Code CLI |
|---|---|---|
| 交互式会话 | | |
| 带初始提示 | | |
| 非交互式 | | |
| 恢复最近会话 | | |
| 通过ID恢复会话 | | |
Safety Modes
安全模式
| Mode | Codex CLI | Claude Code CLI |
|---|---|---|
| Read-only | | |
| Workspace write | | (default) |
| Full access | | |
| Auto mode | | |
| YOLO mode | | |
| 模式 | Codex CLI | Claude Code CLI |
|---|---|---|
| 只读 | | |
| 工作区可写 | | (默认) |
| 完全访问 | | |
| 自动模式 | | |
| YOLO模式 | | |
Model Selection
模型选择
| Task | Codex CLI | Claude Code CLI |
|---|---|---|
| Select model | | |
| Use local OSS | | N/A |
| Fallback model | N/A | |
| 任务 | Codex CLI | Claude Code CLI |
|---|---|---|
| 选择模型 | | |
| 使用本地OSS模型 | | N/A |
| 备用模型 | N/A | |
Codex CLI (OpenAI)
Codex CLI (OpenAI)
Installation
安装
bash
npm i -g @openai/codexbash
npm i -g @openai/codexor
or
brew install --cask codex
undefinedbrew install --cask codex
undefinedAuthentication
认证
bash
codex login # OAuth via ChatGPT
codex login --with-api-key # Read API key from stdin
codex login status # Check auth status
codex logout # Remove credentialsbash
codex login # 通过ChatGPT进行OAuth认证
codex login --with-api-key # 从标准输入读取API密钥
codex login status # 检查认证状态
codex logout # 删除凭证Core Commands
核心命令
codex
- Interactive Mode
codexcodex
- 交互模式
codexbash
codex # Start TUI
codex "fix all TypeScript errors" # With initial prompt
codex -i screenshot.png "explain" # With image
codex --full-auto "refactor" # Low-friction mode
codex --search "find docs" # Enable web searchbash
codex # 启动终端用户界面(TUI)
codex "fix all TypeScript errors" # 带初始提示启动
codex -i screenshot.png "explain" # 附带图片
codex --full-auto "refactor" # 低摩擦模式
codex --search "find docs" # 启用网页搜索codex exec
- Non-Interactive
codex execcodex exec
- 非交互模式
codex execbash
codex exec "write tests" # Run and exit
codex e "task" # Short alias
echo "task" | codex exec - # From stdin
codex exec --json "task" # JSONL output
codex exec -o result.txt "task" # Save to file
codex exec --output-schema schema.json "task" # Validate outputbash
codex exec "write tests" # 执行任务后退出
codex e "task" # 短别名
echo "task" | codex exec - # 从标准输入读取任务
codex exec --json "task" # 输出JSONL格式
codex exec -o result.txt "task" # 将结果保存到文件
codex exec --output-schema schema.json "task" # 验证输出格式codex resume
- Continue Sessions
codex resumecodex resume
- 恢复会话
codex resumebash
codex resume # Interactive picker
codex resume --last # Most recent
codex resume --all # Show all (any directory)
codex resume <session-id> # Specific session
codex resume <id> "continue with this" # With promptbash
codex resume # 交互式选择会话
codex resume --last # 恢复最近的会话
codex resume --all # 显示所有会话(任意目录)
codex resume <session-id> # 恢复指定会话
codex resume <id> "continue with this" # 带提示恢复会话codex review
- Code Review
codex reviewcodex review
- 代码评审
codex reviewbash
codex review # Review current branch vs main
codex review --uncommitted # Review uncommitted changes
codex review --base develop # Against specific branch
codex review --commit abc123 # Review specific commit
codex review "focus on security" # Custom instructionsbash
codex review # 评审当前分支与main分支的差异
codex review --uncommitted # 评审未提交的更改
codex review --base develop # 与指定分支对比评审
codex review --commit abc123 # 评审指定提交
codex review "focus on security" # 自定义评审指令codex apply
- Apply Cloud Task
codex applycodex apply
- 应用云端任务
codex applybash
codex apply <task-id> # Apply diff from cloud taskbash
codex apply <task-id> # 应用云端任务的差异codex cloud
- Cloud Tasks (Experimental)
codex cloudcodex cloud
- 云端任务(实验性)
codex cloudbash
codex cloud # Browse cloud tasks
codex cloud exec "task" --env <env-id> # Submit task
codex cloud status <task-id> # Check status
codex cloud diff <task-id> # Show diff
codex cloud apply <task-id> # Apply changesbash
codex cloud # 浏览云端任务
codex cloud exec "task" --env <env-id> # 提交任务
codex cloud status <task-id> # 检查任务状态
codex cloud diff <task-id> # 显示差异
codex cloud apply <task-id> # 应用更改codex mcp
- MCP Server Management
codex mcpcodex mcp
- MCP服务器管理
codex mcpbash
codex mcp list # List servers
codex mcp list --json # JSON output
codex mcp get <name> # Server details
codex mcp add <name> -- npx my-server # Add stdio server
codex mcp add <name> --url https://... # Add HTTP server
codex mcp add <name> --env API_KEY=xxx -- cmd # With env vars
codex mcp remove <name> # Remove server
codex mcp login <name> --scopes read,write # OAuth for HTTP
codex mcp logout <name> # Remove OAuthbash
codex mcp list # 列出服务器
codex mcp list --json # 以JSON格式输出
codex mcp get <name> # 查看服务器详情
codex mcp add <name> -- npx my-server # 添加标准输入输出服务器
codex mcp add <name> --url https://... # 添加HTTP服务器
codex mcp add <name> --env API_KEY=xxx -- cmd # 附带环境变量
codex mcp remove <name> # 删除服务器
codex mcp login <name> --scopes read,write # 为HTTP服务器进行OAuth认证
codex mcp logout <name> # 移除OAuth认证codex sandbox
- Run Sandboxed Commands
codex sandboxcodex sandbox
- 运行沙箱命令
codex sandboxbash
undefinedbash
undefinedmacOS
macOS
codex sandbox macos -- npm test
codex sandbox seatbelt --full-auto -- ./script.sh
codex sandbox macos -- npm test
codex sandbox seatbelt --full-auto -- ./script.sh
Linux
Linux
codex sandbox linux -- npm test
codex sandbox landlock -- ./script.sh
undefinedcodex sandbox linux -- npm test
codex sandbox landlock -- ./script.sh
undefinedcodex completion
- Shell Completions
codex completioncodex completion
- Shell补全
codex completionbash
codex completion bash >> ~/.bashrc
codex completion zsh >> ~/.zshrc
codex completion fish > ~/.config/fish/completions/codex.fishbash
codex completion bash >> ~/.bashrc
codex completion zsh >> ~/.zshrc
codex completion fish > ~/.config/fish/completions/codex.fishSlash Commands (Interactive)
斜杠命令(交互模式)
| Command | Purpose |
|---|---|
| Switch model (gpt-5-codex, gpt-5, etc.) |
| Change approval policy |
| Summarize conversation, free context |
| Show git diff |
| Analyze working tree |
| Show config and token usage |
| List available MCP tools |
| Attach files |
| Branch conversation |
| Reopen previous session |
| Fresh conversation |
| Create AGENTS.md scaffold |
| Submit logs/diagnostics |
| Exit CLI |
| 命令 | 用途 |
|---|---|
| 切换模型(gpt-5-codex、gpt-5等) |
| 更改审批策略 |
| 总结对话,释放上下文空间 |
| 显示Git差异 |
| 分析工作目录 |
| 显示配置和令牌使用情况 |
| 列出可用的MCP工具 |
| 附加文件 |
| 分支对话 |
| 重新打开之前的会话 |
| 开启新对话 |
| 创建AGENTS.md脚手架 |
| 提交日志/诊断信息 |
| 退出CLI |
Configuration (~/.codex/config.toml
)
~/.codex/config.toml配置文件 (~/.codex/config.toml
)
~/.codex/config.tomltoml
model = "gpt-5-codex"
approval_policy = "on-request"
[sandbox]
mode = "workspace-write"
[features]
web_search = true
[profiles.ci]
model = "gpt-4.1"
approval_policy = "never"toml
model = "gpt-5-codex"
approval_policy = "on-request"
[sandbox]
mode = "workspace-write"
[features]
web_search = true
[profiles.ci]
model = "gpt-4.1"
approval_policy = "never"Global Flags
全局标志
-m, --model <MODEL> Model selection
-s, --sandbox <MODE> read-only|workspace-write|danger-full-access
-a, --ask-for-approval <P> untrusted|on-failure|on-request|never
-c, --config <KEY=VALUE> Override config
-C, --cd <DIR> Working directory
-i, --image <FILE> Attach image(s)
-p, --profile <NAME> Config profile
--full-auto Low-friction mode
--yolo Bypass all safety (DANGEROUS)
--search Enable web search
--add-dir <DIR> Grant additional write access
--enable <FEATURE> Enable feature flag
--disable <FEATURE> Disable feature flag
--oss Use local OSS model-m, --model <MODEL> 选择模型
-s, --sandbox <MODE> 沙箱模式:read-only|workspace-write|danger-full-access
-a, --ask-for-approval <P> 审批策略:untrusted|on-failure|on-request|never
-c, --config <KEY=VALUE> 覆盖配置项
-C, --cd <DIR> 指定工作目录
-i, --image <FILE> 附加图片
-p, --profile <NAME> 使用配置文件
--full-auto 低摩擦模式
--yolo 绕过所有安全检查(危险)
--search 启用网页搜索
--add-dir <DIR> 授予额外的写入权限
--enable <FEATURE> 启用功能标志
--disable <FEATURE> 禁用功能标志
--oss 使用本地OSS模型Claude Code CLI (Anthropic)
Claude Code CLI (Anthropic)
Installation
安装
bash
npm install -g @anthropic-ai/claude-codebash
npm install -g @anthropic-ai/claude-codeAuthentication
认证
bash
claude # First run prompts login
claude setup-token # Set up long-lived tokenbash
claude # 首次运行时提示登录
claude setup-token # 设置长期令牌Requires Claude Pro/Max subscription OR API key
需要Claude Pro/Max订阅或API密钥
undefinedundefinedCore Commands
核心命令
claude
- Interactive Mode
claudeclaude
- 交互模式
claudebash
claude # Start REPL
claude "explain this project" # With prompt
claude -c # Continue last conversation
claude -r "session-name" # Resume by name/ID
claude --model opus # Select model
claude --chrome # Enable Chrome integration
claude --ide # Auto-connect to IDEbash
claude # 启动REPL环境
claude "explain this project" # 带初始提示启动
claude -c # 继续上一次对话
claude -r "session-name" # 通过名称/ID恢复会话
claude --model opus # 选择模型
claude --chrome # 启用Chrome集成
claude --ide # 自动连接到IDEclaude -p
- Print Mode (Non-Interactive)
claude -pclaude -p
- 打印模式(非交互)
claude -pbash
claude -p "explain this function" # Query and exit
cat file | claude -p "explain" # Process piped input
claude -p --output-format json "q" # JSON output
claude -p --output-format stream-json "q" # Streaming JSON
claude -p --max-turns 3 "task" # Limit agent turns
claude -p --max-budget-usd 5 "task" # Spending limit
claude -p --json-schema '{...}' "q" # Validate output schemabash
claude -p "explain this function" # 执行查询后退出
cat file | claude -p "explain" # 处理管道输入
claude -p --output-format json "q" # 输出JSON格式
claude -p --output-format stream-json "q" # 流式JSON输出
claude -p --max-turns 3 "task" # 限制代理交互轮次
claude -p --max-budget-usd 5 "task" # 设置支出限额
claude -p --json-schema '{...}' "q" # 验证输出JSON格式claude mcp
- MCP Server Management
claude mcpclaude mcp
- MCP服务器管理
claude mcpbash
claude mcp list # List servers
claude mcp get <name> # Server details
claude mcp add <name> <cmd> # Add stdio server
claude mcp add -t http <name> <url> # Add HTTP server
claude mcp add -e KEY=val <name> -- cmd # With env vars
claude mcp add -H "Auth: Bearer x" <name> <url> # With headers
claude mcp add -s project <name> <cmd> # Project scope
claude mcp remove <name> # Remove server
claude mcp serve # Run as MCP server
claude mcp add-from-claude-desktop # Import from desktop app
claude mcp reset-project-choices # Reset approvalsbash
claude mcp list # 列出服务器
claude mcp get <name> # 查看服务器详情
claude mcp add <name> <cmd> # 添加标准输入输出服务器
claude mcp add -t http <name> <url> # 添加HTTP服务器
claude mcp add -e KEY=val <name> -- cmd # 附带环境变量
claude mcp add -H "Auth: Bearer x" <name> <url> # 附带请求头
claude mcp add -s project <name> <cmd> # 项目范围
claude mcp remove <name> # 删除服务器
claude mcp serve # 作为MCP服务器运行
claude mcp add-from-claude-desktop # 从桌面应用导入
claude mcp reset-project-choices # 重置审批选项claude plugin
- Plugin Management
claude pluginclaude plugin
- 插件管理
claude pluginbash
claude plugin list # List plugins
claude plugin install <name> # Install plugin
claude plugin install <name>@marketplace # From specific marketplace
claude plugin uninstall <name> # Remove plugin
claude plugin enable <name> # Enable disabled plugin
claude plugin disable <name> # Disable plugin
claude plugin update <name> # Update plugin
claude plugin validate <path> # Validate manifest
claude plugin marketplace # Manage marketplacesbash
claude plugin list # 列出插件
claude plugin install <name> # 安装插件
claude plugin install <name>@marketplace # 从指定市场安装
claude plugin uninstall <name> # 卸载插件
claude plugin enable <name> # 启用已禁用的插件
claude plugin disable <name> # 禁用插件
claude plugin update <name> # 更新插件
claude plugin validate <path> # 验证插件清单
claude plugin marketplace # 管理插件市场claude update
- Self-Update
claude updateclaude update
- 自我更新
claude updatebash
claude update # Check and install updatesbash
claude update # 检查并安装更新claude doctor
- Diagnostics
claude doctorclaude doctor
- 诊断
claude doctorbash
claude doctor # Check health/issuesbash
claude doctor # 检查健康状态/问题claude install
- Native Build
claude installclaude install
- 原生构建安装
claude installbash
claude install # Install native build
claude install stable # Specific version
claude install latest # Latest versionbash
claude install # 安装原生构建版本
claude install stable # 安装稳定版本
claude install latest # 安装最新版本Slash Commands (Interactive)
斜杠命令(交互模式)
| Command | Purpose |
|---|---|
| Generate CLAUDE.md |
| Reset context |
| Summarize conversation |
| Report issues |
| Run diagnostics |
| Switch model |
| View/edit settings |
| Manage permissions |
| View/edit memory |
| Project-specific commands |
| User-specific commands |
| 命令 | 用途 |
|---|---|
| 生成CLAUDE.md文件 |
| 重置上下文 |
| 总结对话 |
| 报告问题 |
| 运行诊断 |
| 切换模型 |
| 查看/编辑设置 |
| 管理权限 |
| 查看/编辑记忆 |
| 项目特定命令 |
| 用户特定命令 |
Custom Commands
自定义命令
Create :
.claude/commands/fix-issue.mdmarkdown
Fix GitHub issue #$ARGUMENTS
1. Read the issue details
2. Identify the problem
3. Implement the fix
4. Write tests
5. Create a commitUsage:
/project:fix-issue 1234创建 :
.claude/commands/fix-issue.mdmarkdown
修复GitHub问题#$ARGUMENTS
1. 阅读问题详情
2. 定位问题
3. 实现修复
4. 编写测试
5. 创建提交使用方式:
/project:fix-issue 1234Configuration
配置
User settings ():
~/.claude/settings.jsonjson
{
"model": "claude-sonnet-4-5-20250929",
"verbose": false,
"theme": "dark"
}Project settings ():
.claude/settings.jsonjson
{
"allowedTools": ["Bash(git:*)", "Read", "Edit"],
"disallowedTools": ["Bash(rm:*)"]
}用户设置 ():
~/.claude/settings.jsonjson
{
"model": "claude-sonnet-4-5-20250929",
"verbose": false,
"theme": "dark"
}项目设置 ():
.claude/settings.jsonjson
{
"allowedTools": ["Bash(git:*)", "Read", "Edit"],
"disallowedTools": ["Bash(rm:*)"]
}CLI Flags
CLI标志
Core
核心
-p, --print Non-interactive mode
-c, --continue Continue last conversation
-r, --resume <ID> Resume specific session
-v, --version Show version-p, --print 非交互模式
-c, --continue 继续上一次对话
-r, --resume <ID> 恢复指定会话
-v, --version 显示版本号Model & Config
模型与配置
--model <MODEL> sonnet|opus|haiku or full name
--fallback-model <MODEL> Fallback when overloaded
--settings <FILE> Load settings JSON
--setting-sources <LIST> user,project,local
--session-id <UUID> Use specific session ID--model <MODEL> 模型选择:sonnet|opus|haiku或完整模型名称
--fallback-model <MODEL> 过载时使用的备用模型
--settings <FILE> 加载指定的JSON设置文件
--setting-sources <LIST> 设置来源:user,project,local
--session-id <UUID> 使用指定的会话IDSystem Prompt
系统提示
--system-prompt <TEXT> Replace default prompt
--append-system-prompt <T> Append to default
--system-prompt-file <F> Replace with file (print only)
--append-system-prompt-file Replace with file (print only)--system-prompt <TEXT> 替换默认系统提示
--append-system-prompt <T> 追加到默认系统提示
--system-prompt-file <F> 使用文件内容替换默认提示(仅打印模式)
--append-system-prompt-file 使用文件内容追加到默认提示(仅打印模式)Agent & Tools
代理与工具
--agent <NAME> Specify agent
--agents <JSON> Define custom subagents
--tools <LIST> Restrict built-in tools
--allowedTools <LIST> Auto-approve tools
--disallowedTools <LIST> Remove tools from context--agent <NAME> 指定代理
--agents <JSON> 定义自定义子代理
--tools <LIST> 限制内置工具
--allowedTools <LIST> 自动批准的工具
--disallowedTools <LIST> 从上下文中移除的工具Permissions
权限
--permission-mode <MODE> acceptEdits|bypassPermissions|default|delegate|dontAsk|plan
--dangerously-skip-permissions Skip all prompts (DANGEROUS)
--allow-dangerously-skip-permissions Enable bypass option--permission-mode <MODE> 权限模式:acceptEdits|bypassPermissions|default|delegate|dontAsk|plan
--dangerously-skip-permissions 跳过所有权限提示(危险)
--allow-dangerously-skip-permissions 启用绕过选项Output
输出
--output-format <FMT> text|json|stream-json
--input-format <FMT> text|stream-json
--include-partial-messages Include streaming chunks
--verbose Verbose logging
--debug [FILTER] Debug mode with filtering--output-format <FMT> 输出格式:text|json|stream-json
--input-format <FMT> 输入格式:text|stream-json
--include-partial-messages 包含流式输出的片段
--verbose 详细日志
--debug [FILTER] 调试模式,支持过滤Advanced
高级
--max-turns <N> Limit agent turns (print only)
--max-budget-usd <AMT> Spending limit (print only)
--json-schema <SCHEMA> Validate JSON output
--chrome / --no-chrome Chrome integration
--ide IDE auto-connect
--fork-session Create new session on resume
--no-session-persistence Don't save session
--add-dir <DIRS> Additional directories
--plugin-dir <DIRS> Load plugins
--disable-slash-commands Disable all skills
--mcp-config <FILES> MCP server configs
--strict-mcp-config Only use specified MCP
--betas <HEADERS> Beta API headers--max-turns <N> 限制代理交互轮次(仅打印模式)
--max-budget-usd <AMT> 支出限额(仅打印模式)
--json-schema <SCHEMA> 验证JSON输出
--chrome / --no-chrome 启用/禁用Chrome集成
--ide 自动连接IDE
--fork-session 恢复会话时创建新会话
--no-session-persistence 不保存会话
--add-dir <DIRS> 额外的目录
--plugin-dir <DIRS> 加载指定目录的插件
--disable-slash-commands 禁用所有斜杠命令
--mcp-config <FILES> MCP服务器配置文件
--strict-mcp-config 仅使用指定的MCP配置
--betas <HEADERS> Beta API请求头Custom Subagents
自定义子代理
bash
claude --agents '{
"reviewer": {
"description": "Code reviewer. Use after changes.",
"prompt": "You are a senior code reviewer...",
"tools": ["Read", "Grep", "Glob"],
"model": "sonnet"
}
}'bash
claude --agents '{
"reviewer": {
"description": "Code reviewer. Use after changes.",
"prompt": "You are a senior code reviewer...",
"tools": ["Read", "Grep", "Glob"],
"model": "sonnet"
}
}'Common Patterns & Edge Cases
常见模式与边缘情况
CI/CD Integration
CI/CD集成
Codex in GitHub Actions:
yaml
- name: Run Codex
run: |
echo "${{ secrets.OPENAI_API_KEY }}" | codex login --with-api-key
codex exec --json -o result.txt "fix linting errors"Claude in CI:
yaml
- name: Run Claude
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: |
claude -p --output-format json "review this PR" > review.jsonGitHub Actions中使用Codex:
yaml
- name: Run Codex
run: |
echo "${{ secrets.OPENAI_API_KEY }}" | codex login --with-api-key
codex exec --json -o result.txt "fix linting errors"CI中使用Claude:
yaml
- name: Run Claude
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: |
claude -p --output-format json "review this PR" > review.jsonHandling Rate Limits
处理速率限制
Codex: Automatic backoff built-in.
Claude: Use :
--fallback-modelbash
claude -p --fallback-model haiku "quick task"Codex: 内置自动退避机制。
Claude: 使用选项:
--fallback-modelbash
claude -p --fallback-model haiku "quick task"Working with Large Codebases
大型代码库处理
bash
undefinedbash
undefinedCodex: Use /compact to free context
Codex: 使用/compact命令释放上下文
In session: /compact
在会话中输入:/compact
Claude: Use /compact or start fresh
Claude: 使用/compact命令或开启新会话
claude --no-session-persistence -p "analyze src/"
undefinedclaude --no-session-persistence -p "analyze src/"
undefinedMulti-Directory Access
多目录访问
bash
undefinedbash
undefinedCodex
Codex
codex --add-dir ../shared-lib --add-dir ../config
codex --add-dir ../shared-lib --add-dir ../config
Claude
Claude
claude --add-dir ../shared-lib ../config
undefinedclaude --add-dir ../shared-lib ../config
undefinedStructured Output
结构化输出
Codex:
bash
codex exec --output-schema schema.json "generate API spec"Claude:
bash
claude -p --json-schema '{"type":"object","properties":{"name":{"type":"string"}}}' "extract data"Codex:
bash
codex exec --output-schema schema.json "generate API spec"Claude:
bash
claude -p --json-schema '{"type":"object","properties":{"name":{"type":"string"}}}' "extract data"Image Input
图片输入
Codex:
bash
codex -i screenshot.png "explain this UI"
codex -i img1.png -i img2.png "compare these"Claude:
bash
undefinedCodex:
bash
codex -i screenshot.png "explain this UI"
codex -i img1.png -i img2.png "compare these"Claude:
bash
undefinedVia file reference in prompt
在提示中引用文件路径
claude "analyze the image at ./screenshot.png"
undefinedclaude "analyze the image at ./screenshot.png"
undefinedSession Forking
会话分支
bash
undefinedbash
undefinedCodex: /fork in session
Codex: 在会话中使用/fork命令
Claude
Claude
claude -r "session-id" --fork-session "try alternative approach"
undefinedclaude -r "session-id" --fork-session "try alternative approach"
undefinedMCP Server Debugging
MCP服务器调试
Codex:
bash
codex mcp list --json | jq .Claude:
bash
claude --debug "mcp" --mcp-config ./mcp.jsonCodex:
bash
codex mcp list --json | jq .Claude:
bash
claude --debug "mcp" --mcp-config ./mcp.jsonTroubleshooting
故障排除
Authentication Issues
认证问题
| Problem | Codex | Claude |
|---|---|---|
| Not logged in | | |
| Token expired | | |
| API key issues | Check | Check |
| 问题 | Codex解决方案 | Claude解决方案 |
|---|---|---|
| 未登录 | | |
| 令牌过期 | | |
| API密钥问题 | 检查 | 检查 |
Sandbox Issues
沙箱问题
| Problem | Solution |
|---|---|
| Permission denied | Use |
| Can't run commands | Check sandbox mode, use |
| Network blocked | Sandbox may block network; use |
| 问题 | 解决方案 |
|---|---|
| 权限被拒绝 | 对特定目录使用 |
| 无法运行命令 | 检查沙箱模式,使用 |
| 网络被阻止 | 沙箱可能限制网络;谨慎使用 |
MCP Server Issues
MCP服务器问题
| Problem | Solution |
|---|---|
| Server not found | Check |
| Connection failed | Check server logs, verify URL/command |
| Auth required | Use |
| 问题 | 解决方案 |
|---|---|
| 服务器未找到 | 运行 |
| 连接失败 | 检查服务器日志,验证URL/命令是否正确 |
| 需要认证 | 使用 |
Performance Issues
性能问题
| Problem | Solution |
|---|---|
| Slow responses | Use lighter model (gpt-4.1-mini / haiku) |
| Context overflow | Use |
| High costs | Set |
| 问题 | 解决方案 |
|---|---|
| 响应缓慢 | 使用轻量模型(gpt-4.1-mini / haiku) |
| 上下文溢出 | 使用 |
| 成本过高 | 使用 |
Best Practices
最佳实践
- Start with read-only for exploration, escalate as needed
- Use sessions - resume work instead of starting fresh
- Create AGENTS.md/CLAUDE.md for project-specific instructions
- Leverage MCP servers for external integrations
- Use structured output in CI/CD for parsing
- Set spending limits with
--max-budget-usd - Review diffs before applying (,
/diff)codex cloud diff - Commit checkpoints before major changes
- 从只读模式开始 进行探索,根据需要提升权限
- 使用会话功能 - 恢复工作而非重新开始
- 创建AGENTS.md/CLAUDE.md 用于项目特定指令
- 利用MCP服务器 实现外部集成
- 在CI/CD中使用结构化输出 便于解析
- 使用设置支出限额
--max-budget-usd - 应用前先查看差异(使用、
/diff)codex cloud diff - 重大变更前提交检查点