--add-dir | 添加额外的工作目录供 Claude 访问(验证每个路径是否存在为目录) | claude --add-dir ../apps ../lib |
--agent | 为当前会话指定代理(覆盖 agent 设置) | claude --agent my-custom-agent |
--agents | 通过 JSON 动态定义自定义 subagents(参见下面的格式) | claude --agents '{"reviewer":{"description":"Reviews code","prompt":"You are a code reviewer"}}' |
--allow-dangerously-skip-permissions | 启用权限绕过选项而不立即激活它。允许与 --permission-mode 组合(谨慎使用) | claude --permission-mode plan --allow-dangerously-skip-permissions |
--allowedTools | 无需提示权限即可执行的工具。请参阅 权限规则语法 了解模式匹配。要限制可用的工具,请改用 --tools | "Bash(git log *)" "Bash(git diff *)" "Read" |
--append-system-prompt | 将自定义文本附加到默认系统提示的末尾(在交互和打印模式中都有效) | claude --append-system-prompt "Always use TypeScript" |
--append-system-prompt-file | 从文件加载额外的系统提示文本并附加到默认提示(仅打印模式) | claude -p --append-system-prompt-file ./extra-rules.txt "query" |
--betas | 要包含在 API 请求中的 Beta 标头(仅限 API 密钥用户) | claude --betas interleaved-thinking |
--chrome | 启用 Chrome 浏览器集成 用于网络自动化和测试 | claude --chrome |
--continue, -c | 加载当前目录中最近的对话 | claude --continue |
--dangerously-skip-permissions | 跳过所有权限提示(谨慎使用) | claude --dangerously-skip-permissions |
--debug | 启用调试模式,可选类别过滤(例如,"api,hooks" 或 "!statsig,!file") | claude --debug "api,mcp" |
--disable-slash-commands | 为此会话禁用所有 skills 和 slash commands | claude --disable-slash-commands |
--disallowedTools | 从模型的上下文中删除的工具,无法使用 | "Bash(git log *)" "Bash(git diff *)" "Edit" |
--fallback-model | 当默认模型过载时启用自动回退到指定模型(仅打印模式) | claude -p --fallback-model sonnet "query" |
--fork-session | 恢复时创建新的会话 ID 而不是重用原始 ID(与 --resume 或 --continue 一起使用) | claude --resume abc123 --fork-session |
--from-pr | 恢复链接到特定 GitHub PR 的会话。接受 PR 号或 URL。通过 gh pr create 创建时会自动链接会话 | claude --from-pr 123 |
--ide | 如果恰好有一个有效的 IDE 可用,则在启动时自动连接到 IDE | claude --ide |
--init | 运行初始化 hooks 并启动交互模式 | claude --init |
--init-only | 运行初始化 hooks 并退出(无交互会话) | claude --init-only |
--include-partial-messages | 在输出中包含部分流事件(需要 --print 和 --output-format=stream-json) | claude -p --output-format stream-json --include-partial-messages "query" |
--input-format | 为打印模式指定输入格式(选项:text、stream-json) | claude -p --output-format json --input-format stream-json |
--json-schema | 在代理完成其工作流后获得与 JSON Schema 匹配的验证 JSON 输出(仅打印模式,请参阅 结构化输出) | claude -p --json-schema '{"type":"object","properties":{...}}' "query" |
--maintenance | 运行维护 hooks 并退出 | claude --maintenance |
--max-budget-usd | API 调用前停止的最大美元金额(仅打印模式) | claude -p --max-budget-usd 5.00 "query" |
--max-turns | 限制代理转数(仅打印模式)。达到限制时以错误退出。默认无限制 | claude -p --max-turns 3 "query" |
--mcp-config | 从 JSON 文件或字符串加载 MCP 服务器(以空格分隔) | claude --mcp-config ./mcp.json |
--model | 为当前会话设置模型,使用最新模型的别名(sonnet 或 opus)或模型的完整名称 | claude --model claude-sonnet-4-5-20250929 |
--no-chrome | 为此会话禁用 Chrome 浏览器集成 | claude --no-chrome |
--no-session-persistence | 禁用会话持久化,以便会话不会保存到磁盘且无法恢复(仅打印模式) | claude -p --no-session-persistence "query" |
--output-format | 为打印模式指定输出格式(选项:text、json、stream-json) | claude -p "query" --output-format json |
--permission-mode | 以指定的 权限模式 开始 | claude --permission-mode plan |
--permission-prompt-tool | 指定 MCP 工具以在非交互模式下处理权限提示 | claude -p --permission-prompt-tool mcp_auth_tool "query" |
--plugin-dir | 仅为此会话从目录加载插件(可重复) | claude --plugin-dir ./my-plugins |
--print, -p | 打印响应而不进入交互模式(请参阅 Agent SDK 文档 了解程序化使用详情) | claude -p "query" |
--remote | 在 claude.ai 上创建新的 网络会话,提供任务描述 | claude --remote "Fix the login bug" |
--resume, -r | 按 ID 或名称恢复特定会话,或显示交互式选择器以选择会话 | claude --resume auth-refactor |
--session-id | 为对话使用特定的会话 ID(必须是有效的 UUID) | claude --session-id "550e8400-e29b-41d4-a716-446655440000" |
--setting-sources | 逗号分隔的设置源列表以加载(user、project、local) | claude --setting-sources user,project |
--settings | 设置 JSON 文件的路径或 JSON 字符串以加载其他设置 | claude --settings ./settings.json |
--strict-mcp-config | 仅使用来自 --mcp-config 的 MCP 服务器,忽略所有其他 MCP 配置 | claude --strict-mcp-config --mcp-config ./mcp.json |
--system-prompt | 用自定义文本替换整个系统提示(在交互和打印模式中都有效) | claude --system-prompt "You are a Python expert" |
--system-prompt-file | 从文件加载系统提示,替换默认提示(仅打印模式) | claude -p --system-prompt-file ./custom-prompt.txt "query" |
--teleport | 在本地终端中恢复 网络会话 | claude --teleport |
--teammate-mode | 设置 代理团队 队友的显示方式:auto(默认)、in-process 或 tmux。请参阅 设置代理团队 | claude --teammate-mode in-process |
--tools | 限制 Claude 可以使用的内置工具(在交互和打印模式中都有效)。使用 "" 禁用所有,"default" 表示全部,或工具名称如 "Bash,Edit,Read" | claude --tools "Bash,Edit,Read" |
--verbose | 启用详细日志记录,显示完整的逐轮输出(有助于在打印和交互模式中调试) | claude --verbose |
--version, -v | 输出版本号 | claude -v |