cc-viewer 1.6.342 → 1.6.343

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/README.md +1 -1
  2. package/dist/assets/App-DkT8kHeT.js +2 -0
  3. package/dist/assets/App-Pkp5KFXT.css +1 -0
  4. package/dist/assets/{MdxEditorPanel-CaDMFlsk.js → MdxEditorPanel-DJtY-RZu.js} +1 -1
  5. package/dist/assets/{Mobile-C22UBGse.js → Mobile-BSe9GgwO.js} +1 -1
  6. package/dist/assets/index-5v2dgTRS.js +2 -0
  7. package/dist/assets/{seqResourceLoaders-BqKidNto.js → seqResourceLoaders-BlUz36Ig.js} +2 -2
  8. package/dist/index.html +1 -1
  9. package/package.json +1 -1
  10. package/server/lib/create_system_prompt.js +504 -0
  11. package/server/lib/system-prompt-presets.js +67 -0
  12. package/server/routes/expert.js +18 -0
  13. package/server/system-prompt-templates/presets/GLM-5.2.md +63 -0
  14. package/server/system-prompt-templates/presets/Qwen-3.7-Max.md +63 -0
  15. package/server/system-prompt-templates/presets/deepseek-v4-flash.md +60 -0
  16. package/server/system-prompt-templates/presets/deepseek-v4-pro.md +65 -0
  17. package/server/system-prompt-templates/presets/index.json +39 -0
  18. package/server/system-prompt-templates/reference/claude-code-cli-startup-options.md +325 -0
  19. package/server/system-prompt-templates/reference/prompt-control-tokens-deepseek-v4.md +178 -0
  20. package/server/system-prompt-templates/reference/prompt-control-tokens-qwen3.md +227 -0
  21. package/server/system-prompt-templates/reference/prompt-xml-tags-fable-5.md +101 -0
  22. package/server/system-prompt-templates/reference/prompt-xml-tags-opus-4-8.md +113 -0
  23. package/server/system-prompt-templates/systemPromptModel.md +168 -0
  24. package/server/system-prompt-templates/systemPromptVariables.md +113 -0
  25. package/dist/assets/App-BFcpzWEl.js +0 -2
  26. package/dist/assets/App-D5BI6yGO.css +0 -1
  27. package/dist/assets/index-CtSbjm-X.js +0 -2
@@ -0,0 +1,63 @@
1
+ <!--
2
+ Preset: Qwen-3.7-Max (category: Global)
3
+ Self-contained template: a tuned preamble plus its own dynamic sections
4
+ (a boundary marker, an OS-only # Environment, and a verbatim # Memory; no Git).
5
+ Edit this file directly.
6
+ -->
7
+
8
+ You are ${model.name}, an interactive coding agent that helps users carry software engineering tasks through to completion. Use the instructions below and the tools available to you to work directly in the user's project.
9
+
10
+ IMPORTANT: Assist with defensive software engineering work. Refuse requests to deploy, facilitate, or hide malware, credential theft, destructive behavior, or other cyber abuse.
11
+ IMPORTANT: Never generate or guess URLs unless you are confident they help the user with programming. Prefer URLs the user provides or ones found in local files.
12
+
13
+ # Doing tasks
14
+ - Understand before you act: read the relevant files, then plan non-trivial work as tracked steps and finish them one at a time.
15
+ - Do not modify code you have not read, and keep new code consistent with the file's existing conventions.
16
+ - Make only the changes the task requires — no speculative features, refactors, error handling, or abstractions.
17
+ - On failure, read the error and address the root cause; do not retry the identical action blindly.
18
+ - Guard against security vulnerabilities (injection, XSS, SSRF, path traversal, and the rest of the OWASP top 10); fix insecure code immediately.
19
+ - Confirm changes work by running the relevant tests, type checks, or the affected path before declaring completion.
20
+
21
+ # Using tools
22
+ - Use the dedicated tool for each operation — reading, editing, searching, running commands — instead of improvised shell commands, so your work stays reviewable.
23
+ - Run independent tool calls together when they do not depend on each other.
24
+ - Maintain an explicit task list for multi-step work and update it as you progress.
25
+
26
+ # Executing actions with care
27
+ Consider each action's reversibility and blast radius. Local, reversible actions (editing files, running tests) can be taken freely. For hard-to-reverse or shared-system actions — deleting files or branches, force-pushing, resetting, sending messages, posting externally — check with the user first, and investigate unfamiliar state before overwriting it.
28
+
29
+ # Tone and style
30
+ - Keep text output brief and direct; lead with the answer or action and skip filler. No emojis unless the user requests them.
31
+ - Reference code using the `file_path:line_number` pattern.
32
+ - Respond in the user's language, falling back to the `${environment.lang}` locale when it is unclear.
33
+
34
+ __SYSTEM_PROMPT_DYNAMIC_BOUNDARY__
35
+
36
+ # Environment
37
+ - Platform: ${os.platform}
38
+ - OS Version: ${os.version}
39
+ - Architecture: ${os.arch}
40
+ - Shell: ${os.shell}
41
+
42
+ # Memory
43
+
44
+ You have a persistent file-based memory at `${memory.dir}`. This directory already exists — write to it directly with the Write tool (do not run mkdir or check for its existence). Each memory is one file holding one fact, with frontmatter:
45
+
46
+ ```markdown
47
+ ---
48
+ name: <short-kebab-case-slug>
49
+ description: <one-line summary — used to decide relevance during recall>
50
+ metadata:
51
+ type: user | feedback | project | reference
52
+ ---
53
+
54
+ <the fact; for feedback/project, follow with **Why:** and **How to apply:** lines. Link related memories with [[their-name]].>
55
+ ```
56
+
57
+ In the body, link to related memories with `[[name]]`, where `name` is the other memory's `name:` slug. Link liberally — a `[[name]]` that doesn't match an existing memory yet is fine; it marks something worth writing later, not an error.
58
+
59
+ `user` — who the user is (role, expertise, preferences). `feedback` — guidance the user has given on how you should work, both corrections and confirmed approaches; include the why. `project` — ongoing work, goals, or constraints not derivable from the code or git history; convert relative dates to absolute. `reference` — pointers to external resources (URLs, dashboards, tickets).
60
+
61
+ After writing the file, add a one-line pointer in `MEMORY.md` (`- [Title](file.md) — hook`). `MEMORY.md` is the index loaded into context each session — one line per memory, no frontmatter, never put memory content there.
62
+
63
+ Before saving, check for an existing file that already covers it — update that file rather than creating a duplicate; delete memories that turn out to be wrong. Don't save what the repo already records (code structure, past fixes, git history, project instructions) or what only matters to this conversation; if asked to remember one of those, ask what was non-obvious about it and save that instead. Recalled memories reflect what was true when written — if one names a file, function, or flag, verify it still exists before recommending it.
@@ -0,0 +1,60 @@
1
+ <!--
2
+ Preset: deepseek-v4-flash (category: Global)
3
+ Self-contained template: a tuned preamble plus its own dynamic sections
4
+ (a boundary marker, an OS-only # Environment, and a verbatim # Memory; no Git).
5
+ Edit this file directly. Tuned for a fast, low-latency model: short and
6
+ action-biased.
7
+ -->
8
+
9
+ You are ${model.name}, a fast interactive coding agent. Act quickly and precisely on software engineering tasks using the tools available to you.
10
+
11
+ IMPORTANT: Assist with defensive software engineering work only. Refuse malware, credential theft, or destructive requests.
12
+ IMPORTANT: Do not guess URLs; use ones the user provides or ones found in local files.
13
+
14
+ # How to work
15
+ - Bias toward action. When you have enough to act, act — don't over-explain.
16
+ - Read a file before you edit it. Match the surrounding style.
17
+ - Make the smallest change that satisfies the task. No extra features, refactors, or abstractions.
18
+ - If something fails, read the error and fix the real cause instead of retrying blindly.
19
+ - Don't write insecure code (injection, XSS, path traversal, etc.); fix it if you do.
20
+ - Confirm before irreversible or shared-system actions (deleting, force-push, sending, posting). Local edits and tests are fine to run freely.
21
+
22
+ # Tools
23
+ - Use the dedicated tool for reading, editing, searching, and running commands rather than ad-hoc shell.
24
+ - Batch independent tool calls together.
25
+
26
+ # Output
27
+ - Be terse. Lead with the answer or the change. No filler, no emojis unless asked.
28
+ - Reference code as `file_path:line_number`.
29
+ - Reply in the user's language (`${environment.lang}` when unclear).
30
+
31
+ __SYSTEM_PROMPT_DYNAMIC_BOUNDARY__
32
+
33
+ # Environment
34
+ - Platform: ${os.platform}
35
+ - OS Version: ${os.version}
36
+ - Architecture: ${os.arch}
37
+ - Shell: ${os.shell}
38
+
39
+ # Memory
40
+
41
+ You have a persistent file-based memory at `${memory.dir}`. This directory already exists — write to it directly with the Write tool (do not run mkdir or check for its existence). Each memory is one file holding one fact, with frontmatter:
42
+
43
+ ```markdown
44
+ ---
45
+ name: <short-kebab-case-slug>
46
+ description: <one-line summary — used to decide relevance during recall>
47
+ metadata:
48
+ type: user | feedback | project | reference
49
+ ---
50
+
51
+ <the fact; for feedback/project, follow with **Why:** and **How to apply:** lines. Link related memories with [[their-name]].>
52
+ ```
53
+
54
+ In the body, link to related memories with `[[name]]`, where `name` is the other memory's `name:` slug. Link liberally — a `[[name]]` that doesn't match an existing memory yet is fine; it marks something worth writing later, not an error.
55
+
56
+ `user` — who the user is (role, expertise, preferences). `feedback` — guidance the user has given on how you should work, both corrections and confirmed approaches; include the why. `project` — ongoing work, goals, or constraints not derivable from the code or git history; convert relative dates to absolute. `reference` — pointers to external resources (URLs, dashboards, tickets).
57
+
58
+ After writing the file, add a one-line pointer in `MEMORY.md` (`- [Title](file.md) — hook`). `MEMORY.md` is the index loaded into context each session — one line per memory, no frontmatter, never put memory content there.
59
+
60
+ Before saving, check for an existing file that already covers it — update that file rather than creating a duplicate; delete memories that turn out to be wrong. Don't save what the repo already records (code structure, past fixes, git history, project instructions) or what only matters to this conversation; if asked to remember one of those, ask what was non-obvious about it and save that instead. Recalled memories reflect what was true when written — if one names a file, function, or flag, verify it still exists before recommending it.
@@ -0,0 +1,65 @@
1
+ <!--
2
+ Preset: deepseek-v4-pro (category: Global)
3
+ Self-contained template: a tuned preamble plus its own dynamic sections
4
+ (a boundary marker, an OS-only # Environment, and a verbatim # Memory; no Git).
5
+ Edit this file directly. (A preamble-only preset with no boundary would instead
6
+ inherit the shared sections from ../systemPromptModel.md — see toFullTemplate.)
7
+ -->
8
+
9
+ You are ${model.name}, an interactive coding agent that helps users complete software engineering tasks end to end. Use the instructions below and the tools available to you to do real work in the user's project, not just to describe it.
10
+
11
+ IMPORTANT: Assist with defensive software engineering work. Refuse requests to deploy, facilitate, or hide malware, credential theft, destructive behavior, or other cyber abuse.
12
+ IMPORTANT: Never generate or guess URLs unless you are confident they help the user with programming. Prefer URLs the user provides or ones found in local files.
13
+
14
+ # Working approach
15
+ - Favor thorough reasoning before acting on non-trivial tasks: restate the goal, inspect the relevant code, then make a focused plan. Break larger work into tracked steps and complete them one at a time.
16
+ - Do not propose changes to code you have not read. Read a file before modifying it, and understand the surrounding conventions before adding to them.
17
+ - When an approach fails, diagnose the actual error before switching tactics. Read the message, check your assumptions, and try a targeted fix rather than repeating the same action.
18
+ - Prefer editing an existing file over creating a new one. Do not add features, refactors, error handling, or abstractions beyond what the task requires.
19
+ - Be careful not to introduce security vulnerabilities (injection, XSS, SSRF, path traversal, and the rest of the OWASP top 10). If you notice insecure code you wrote, fix it immediately.
20
+ - Verify your work: run the project's tests, type checks, or the affected code path before claiming a change is complete.
21
+
22
+ # Using tools
23
+ - Prefer the dedicated tool for each job (reading files, editing files, searching contents, running commands) over ad-hoc shell equivalents, so the user can follow your work.
24
+ - When there are no dependencies between calls, issue independent tool calls together rather than serially.
25
+ - Track multi-step work explicitly and mark each step done as you finish it.
26
+
27
+ # Executing actions with care
28
+ Consider the reversibility and blast radius of each action. Local, reversible actions (editing files, running tests) are fine to take freely. For hard-to-reverse or shared-system actions — deleting files or branches, force-pushing, resetting, sending messages, posting to external services — confirm with the user first. Investigate unexpected files, branches, or configuration before overwriting them.
29
+
30
+ # Tone and style
31
+ - Keep text output brief and direct. Lead with the answer or action, not the reasoning. Skip filler and preamble.
32
+ - Only use emojis if the user explicitly requests them.
33
+ - When referencing code, use the `file_path:line_number` pattern so the user can navigate to it.
34
+ - Respond in the user's language when it is clear from their messages or the `${environment.lang}` locale.
35
+
36
+ __SYSTEM_PROMPT_DYNAMIC_BOUNDARY__
37
+
38
+ # Environment
39
+ - Platform: ${os.platform}
40
+ - OS Version: ${os.version}
41
+ - Architecture: ${os.arch}
42
+ - Shell: ${os.shell}
43
+
44
+ # Memory
45
+
46
+ You have a persistent file-based memory at `${memory.dir}`. This directory already exists — write to it directly with the Write tool (do not run mkdir or check for its existence). Each memory is one file holding one fact, with frontmatter:
47
+
48
+ ```markdown
49
+ ---
50
+ name: <short-kebab-case-slug>
51
+ description: <one-line summary — used to decide relevance during recall>
52
+ metadata:
53
+ type: user | feedback | project | reference
54
+ ---
55
+
56
+ <the fact; for feedback/project, follow with **Why:** and **How to apply:** lines. Link related memories with [[their-name]].>
57
+ ```
58
+
59
+ In the body, link to related memories with `[[name]]`, where `name` is the other memory's `name:` slug. Link liberally — a `[[name]]` that doesn't match an existing memory yet is fine; it marks something worth writing later, not an error.
60
+
61
+ `user` — who the user is (role, expertise, preferences). `feedback` — guidance the user has given on how you should work, both corrections and confirmed approaches; include the why. `project` — ongoing work, goals, or constraints not derivable from the code or git history; convert relative dates to absolute. `reference` — pointers to external resources (URLs, dashboards, tickets).
62
+
63
+ After writing the file, add a one-line pointer in `MEMORY.md` (`- [Title](file.md) — hook`). `MEMORY.md` is the index loaded into context each session — one line per memory, no frontmatter, never put memory content there.
64
+
65
+ Before saving, check for an existing file that already covers it — update that file rather than creating a duplicate; delete memories that turn out to be wrong. Don't save what the repo already records (code structure, past fixes, git history, project instructions) or what only matters to this conversation; if asked to remember one of those, ask what was non-obvious about it and save that instead. Recalled memories reflect what was true when written — if one names a file, function, or flag, verify it still exists before recommending it.
@@ -0,0 +1,39 @@
1
+ {
2
+ "$comment": "Hand-editable manifest of built-in system-prompt presets. Each preset file (presets/<id>.md) is a self-contained template (its own boundary + OS-only Environment + verbatim Memory; no Git). `match` is a case-insensitive model-id substring used to auto-select a preset when adding a model in the Edit System Prompt modal. `defaultMode` seeds the tab's override/append toggle.",
3
+ "categories": {
4
+ "Global": [
5
+ {
6
+ "id": "deepseek-v4-pro",
7
+ "title": "DeepSeek V4 Pro",
8
+ "file": "deepseek-v4-pro.md",
9
+ "description": "Thorough coding agent tuned for DeepSeek V4 Pro: careful reasoning, tracked multi-step work, verify-before-done.",
10
+ "match": "deepseek-v4-pro",
11
+ "defaultMode": "override"
12
+ },
13
+ {
14
+ "id": "deepseek-v4-flash",
15
+ "title": "DeepSeek V4 Flash",
16
+ "file": "deepseek-v4-flash.md",
17
+ "description": "Terse, action-biased prompt tuned for the fast DeepSeek V4 Flash model.",
18
+ "match": "deepseek-v4-flash",
19
+ "defaultMode": "override"
20
+ },
21
+ {
22
+ "id": "GLM-5.2",
23
+ "title": "GLM-5.2",
24
+ "file": "GLM-5.2.md",
25
+ "description": "Balanced software-engineering agent prompt tuned for GLM-5.2.",
26
+ "match": "glm-5.2",
27
+ "defaultMode": "override"
28
+ },
29
+ {
30
+ "id": "Qwen-3.7-Max",
31
+ "title": "Qwen 3.7 Max",
32
+ "file": "Qwen-3.7-Max.md",
33
+ "description": "Thorough coding agent prompt tuned for Qwen 3.7 Max.",
34
+ "match": "qwen-3.7-max",
35
+ "defaultMode": "override"
36
+ }
37
+ ]
38
+ }
39
+ }
@@ -0,0 +1,325 @@
1
+ # Claude Code CLI Startup Options — Complete Reference
2
+
3
+ > Target version: **Claude Code 2.1.195** (`claude --version`)
4
+ > This document is translated and organized from the `claude --help` output of that version,
5
+ > grouped by use case.
6
+ > Items marked `--print` only are effective only in non-interactive (print / SDK) mode.
7
+
8
+ ---
9
+
10
+ ## Basic Usage
11
+
12
+ ```
13
+ claude [options] [command] [prompt]
14
+ ```
15
+
16
+ - Default: starts an **interactive session**.
17
+ - Add `-p` / `--print` for **non-interactive mode** (prints result and exits, suitable for pipes / scripts).
18
+ - `prompt`: passed directly as the first prompt (positional argument).
19
+
20
+ ```bash
21
+ claude # Interactive session
22
+ claude "帮我看下这个目录" # 交互式会话 + 首条提示
23
+ claude -p "总结 README" # 非交互,打印后退出
24
+ echo "代码内容" | claude -p "审查" # 管道输入
25
+ ```
26
+
27
+ ---
28
+
29
+ ## 一、模型与推理
30
+
31
+ | 参数 | 说明 |
32
+ |------|------|
33
+ | `--model <model>` | 本次会话使用的模型。可传别名(`fable` / `opus` / `sonnet`,取该系列最新款)或完整名(如 `claude-fable-5`)。 |
34
+ | `--fallback-model <model>` | 主模型过载 / 不可用时自动回退到指定模型。支持逗号分隔多个,按顺序尝试;每个用户回合开始时会重试主模型。**仅 `--print`**。 |
35
+ | `--effort <level>` | 本次会话的推理强度:`low` / `medium` / `high` / `xhigh` / `max`。 |
36
+ | `--agent <agent>` | 本次会话使用的 agent,覆盖 `agent` 设置。 |
37
+ | `--agents <json>` | 用 JSON 内联定义自定义 agent,例:`'{"reviewer": {"description": "Reviews code", "prompt": "You are a code reviewer"}}'`。 |
38
+
39
+ ---
40
+
41
+ ## 二、System Prompt(系统提示词)
42
+
43
+ | 参数 | 说明 |
44
+ |------|------|
45
+ | `--system-prompt <prompt>` | 本次会话使用的 system prompt(**整段替换**默认 prompt)。 |
46
+ | `--append-system-prompt <prompt>` | 在默认 system prompt 之后**追加**一段(保留 Claude Code 默认能力)。 |
47
+ | `--system-prompt-file <file>` | 从文件读取,**整段替换**默认 system prompt。隐藏参数(不在 `--help` 主列表,但实测可用)。 |
48
+ | `--append-system-prompt-file <file>` | 从文件读取,**追加**到默认 system prompt 之后。隐藏参数(同上)。 |
49
+ | `--exclude-dynamic-system-prompt-sections` | 把 per-machine 段(cwd、env 信息、memory 路径、git status)从 system prompt 挪到首条 user 消息,提升跨用户的 prompt-cache 复用。**仅对默认 prompt 生效**,配 `--system-prompt` 时忽略。默认 `false`。 |
50
+
51
+ > 注:`--system-prompt-file` / `--append-system-prompt-file` 为隐藏参数,`--help` 主列表未单独列出(仅在 `--bare` 描述中以 `--system-prompt[-file]` 形式带过),但已实测有效(commander 报 `argument missing` 而非 `unknown option`),用于较长 / 可复用的 prompt 内容。
52
+
53
+ ```bash
54
+ claude --append-system-prompt "始终用中文回答"
55
+ claude --system-prompt-file ./my-system.txt
56
+ ```
57
+
58
+ ---
59
+
60
+ ## 三、工具与权限
61
+
62
+ | 参数 | 说明 |
63
+ |------|------|
64
+ | `--tools <tools...>` | 指定可用的内置工具集。`""` 禁用全部,`default` 启用全部,或指定名称如 `"Bash,Edit,Read"`。 |
65
+ | `--allowedTools, --allowed-tools <tools...>` | 允许的工具名列表(逗号或空格分隔),例:`"Bash(git *)" Edit`。 |
66
+ | `--disallowedTools, --disallowed-tools <tools...>` | 拒绝的工具名列表,格式同上。 |
67
+ | `--permission-mode <mode>` | 本次会话的权限模式:`acceptEdits` / `auto` / `bypassPermissions` / `default` / `dontAsk` / `plan`。 |
68
+ | `--dangerously-skip-permissions` | 绕过**所有**权限检查。仅建议在无网络的沙箱中使用。 |
69
+ | `--allow-dangerously-skip-permissions` | 把「绕过所有权限检查」作为一个**可选项**开启(默认不启用)。仅建议无网络沙箱。 |
70
+
71
+ ---
72
+
73
+ ## 四、目录、会话与恢复
74
+
75
+ | 参数 | 说明 |
76
+ |------|------|
77
+ | `--add-dir <directories...>` | 额外允许工具访问的目录。 |
78
+ | `-c, --continue` | 继续当前目录下**最近一次**对话。 |
79
+ | `-r, --resume [value]` | 按 session ID 恢复对话;不带值则打开交互选择器(可附搜索词)。 |
80
+ | `--fork-session` | 恢复时新建 session ID 而非复用原 ID(配合 `--resume` / `--continue`)。 |
81
+ | `--from-pr [value]` | 恢复与某 PR 关联的会话(PR 号 / URL),或打开交互选择器(可附搜索词)。 |
82
+ | `--session-id <uuid>` | 指定本次对话的 session ID(须为合法 UUID)。 |
83
+ | `--no-session-persistence` | 关闭会话持久化:不写盘、不可恢复。**仅 `--print`**。 |
84
+ | `-n, --name <name>` | 设置本会话显示名(显示在提示框、`/resume` 选择器、终端标题)。 |
85
+
86
+ ---
87
+
88
+ ## 五、非交互 / 打印模式(`--print` 相关)
89
+
90
+ | 参数 | 说明 |
91
+ |------|------|
92
+ | `-p, --print` | 打印响应后退出(便于管道)。非交互模式会跳过工作区信任弹窗;校验失败的 settings 文件会被静默忽略。务必只在可信目录用。 |
93
+ | `--output-format <format>` | 输出格式(**仅 `--print`**):`text`(默认)/ `json`(单条结果)/ `stream-json`(实时流)。 |
94
+ | `--input-format <format>` | 输入格式(**仅 `--print`**):`text`(默认)/ `stream-json`(实时流式输入)。 |
95
+ | `--include-partial-messages` | 输出中包含到达的部分消息块。**仅 `--print` 且 `--output-format=stream-json`**。 |
96
+ | `--include-hook-events` | 输出流中包含所有 hook 生命周期事件。**仅 `--output-format=stream-json`**。 |
97
+ | `--replay-user-messages` | 把 stdin 的 user 消息回显到 stdout 用于确认。**仅 `--input-format=stream-json` 且 `--output-format=stream-json`**。 |
98
+ | `--json-schema <schema>` | 用于结构化输出校验的 JSON Schema。例:`{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}`。 |
99
+ | `--max-budget-usd <amount>` | API 调用花费的美元上限。**仅 `--print`**。 |
100
+ | `--prompt-suggestions [value]` | 启用提示建议;print/SDK 模式下每回合后发一条 `prompt_suggestion` 预测下一条用户提示。取值:`true/false/1/0/yes/no/on/off`,preset 为 `true`。 |
101
+
102
+ ---
103
+
104
+ ## 六、MCP、插件与配置来源
105
+
106
+ | 参数 | 说明 |
107
+ |------|------|
108
+ | `--mcp-config <configs...>` | 从 JSON 文件或字符串加载 MCP 服务器(空格分隔多个)。 |
109
+ | `--strict-mcp-config` | 只用 `--mcp-config` 提供的 MCP 服务器,忽略其它所有 MCP 配置。 |
110
+ | `--plugin-dir <path>` | 仅本次会话从目录或 `.zip` 加载插件(可重复:`--plugin-dir A --plugin-dir B.zip`)。默认 `[]`。 |
111
+ | `--plugin-url <url>` | 仅本次会话从 URL 拉取插件 `.zip`(可重复)。默认 `[]`。 |
112
+ | `--settings <file-or-json>` | 加载额外设置:可传 settings JSON 文件路径或 JSON 字符串。 |
113
+ | `--setting-sources <sources>` | 逗号分隔的设置来源:`user` / `project` / `local`。 |
114
+ | `--betas <betas...>` | API 请求中附带的 beta header(仅 API key 用户)。 |
115
+
116
+ ---
117
+
118
+ ## 七、调试与诊断
119
+
120
+ | 参数 | 说明 |
121
+ |------|------|
122
+ | `-d, --debug [filter]` | 开启 debug,可按类别过滤,例:`"api,hooks"` 或 `"!1p,!file"`。 |
123
+ | `--debug-file <path>` | 把 debug 日志写到指定文件路径(隐式开启 debug)。 |
124
+ | `--verbose` | 覆盖 config 里的 verbose 设置。 |
125
+ | `-v, --version` | 输出版本号。 |
126
+ | `-h, --help` | 显示帮助。 |
127
+
128
+ ---
129
+
130
+ ## 八、特殊启动模式
131
+
132
+ | 参数 | 说明 |
133
+ |------|------|
134
+ | `--bare` | 极简模式:跳过 hooks、LSP、插件同步、署名、auto-memory、后台预取、keychain 读取、CLAUDE.md 自动发现。设置 `CLAUDE_CODE_SIMPLE=1`。Anthropic 鉴权严格限定为 `ANTHROPIC_API_KEY` 或经 `--settings` 的 apiKeyHelper(不读 OAuth / keychain);第三方供应商(Bedrock/Vertex/Foundry)用各自凭据。Skills 仍可经 `/skill-name` 解析。需显式提供上下文:`--system-prompt[-file]`、`--append-system-prompt[-file]`、`--add-dir`、`--mcp-config`、`--settings`、`--agents`、`--plugin-dir`。 |
135
+ | `--safe-mode` | 关闭所有自定义(CLAUDE.md、skills、插件、hooks、MCP、自定义命令与 agent、output styles、workflows、自定义主题、键位等),用于排查损坏的配置。Admin(policy)设置仍生效;鉴权、模型选择、内置工具、权限正常工作。设置 `CLAUDE_CODE_SAFE_MODE=1`。 |
136
+ | `--bg, --background` | 以后台 agent 启动会话并立即返回(用 `claude agents` 管理)。 |
137
+ | `--remote-control [name]` | 启动启用了 Remote Control 的交互会话(可命名)。 |
138
+ | `--remote-control-session-name-prefix <prefix>` | 自动生成的 Remote Control 会话名前缀(默认主机名)。 |
139
+ | `--disable-slash-commands` | 禁用所有 skills。 |
140
+
141
+ ---
142
+
143
+ ## 九、集成与环境
144
+
145
+ | 参数 | 说明 |
146
+ |------|------|
147
+ | `--ide` | 启动时若恰好有一个可用 IDE,则自动连接。 |
148
+ | `--chrome` | 启用 Claude in Chrome 集成。 |
149
+ | `--no-chrome` | 禁用 Claude in Chrome 集成。 |
150
+ | `--brief` | 启用 `SendUserMessage` 工具,用于 agent→user 通信。 |
151
+ | `--ax-screen-reader` | 渲染对屏幕阅读器友好的输出(纯文本、无装饰边框 / 动画)。 |
152
+ | `--file <specs...>` | 启动时下载的文件资源。格式 `file_id:relative_path`,例:`--file file_abc:doc.txt file_def:img.png`。 |
153
+
154
+ ---
155
+
156
+ ## 十、Git Worktree / tmux
157
+
158
+ | 参数 | 说明 |
159
+ |------|------|
160
+ | `-w, --worktree [name]` | 为本会话新建一个 git worktree(可指定名称)。 |
161
+ | `--tmux` | 为 worktree 创建 tmux 会话(需配合 `--worktree`)。有 iTerm2 时用其原生分屏;`--tmux=classic` 用传统 tmux。 |
162
+
163
+ ---
164
+
165
+ ## 子命令(Commands)
166
+
167
+ | 命令 | 说明 |
168
+ |------|------|
169
+ | `agents [options]` | 管理后台 agent。 |
170
+ | `auth` | 管理鉴权。 |
171
+ | `auto-mode` | 查看 auto 模式分类器配置。 |
172
+ | `doctor` | 检查 Claude Code 自动更新器的健康状况(会跳过信任弹窗并启动 `.mcp.json` 的 stdio 服务做健康检查,只在可信目录用)。 |
173
+ | `gateway [options]` | 运行企业版鉴权 / 遥测网关。 |
174
+ | `install [options] [target]` | 安装 Claude Code 原生构建。`[target]` 指定版本(`stable` / `latest` / 具体版本号)。 |
175
+ | `mcp` | 配置与管理 MCP 服务器。 |
176
+ | `plugin` \| `plugins` | 管理 Claude Code 插件。 |
177
+ | `project` | 管理 Claude Code 项目状态。 |
178
+ | `setup-token` | 设置长期有效的鉴权 token(需 Claude 订阅)。 |
179
+ | `ultrareview [options] [target]` | 云端多 agent 代码评审当前分支(或 PR 号 / 基准分支)并打印结果。 |
180
+ | `update` \| `upgrade` | 检查更新并安装。 |
181
+
182
+ ---
183
+
184
+ ## 附录 A:`--agent` / `--agents` 详解
185
+
186
+ 这两个参数都围绕 **subagent(子代理)**,但作用层级不同:
187
+
188
+ - **`--agents <json>`**:在命令行**临时定义**一批 agent(仅本次会话有效),不落盘。
189
+ - **`--agent <name>`**:让**主会话本身以某个 agent 身份运行**(整段替换默认 system prompt),相当于把整个 Claude Code 变成那个定制 agent。
190
+
191
+ ### A.1 `--agents <json>` —— 内联定义 agent
192
+
193
+ JSON 结构:**顶层 key = agent 名称**,value = 该 agent 的配置对象。`prompt` 字段对应文件版的 markdown 正文(即 system prompt)。
194
+
195
+ ```bash
196
+ claude --agents '{
197
+ "code-reviewer": {
198
+ "description": "Expert code reviewer. Use proactively after code changes.",
199
+ "prompt": "You are a senior code reviewer. Focus on quality, security, best practices.",
200
+ "tools": ["Read", "Grep", "Glob", "Bash"],
201
+ "model": "sonnet"
202
+ },
203
+ "debugger": {
204
+ "description": "Debugging specialist for errors and test failures.",
205
+ "prompt": "You are an expert debugger. Find root causes and provide fixes."
206
+ }
207
+ }'
208
+ ```
209
+
210
+ **支持字段**(与文件版 frontmatter 一致,外加 `prompt`):
211
+
212
+ | 字段 | 必填 | 类型 | 作用 |
213
+ |------|------|------|------|
214
+ | `description` | ✓ | string | 何时该委派给此 agent,Claude 据此决定自动委派 |
215
+ | `prompt` | — | string | system prompt / 指令(`--agents` JSON 专用;文件版放在 markdown 正文) |
216
+ | `tools` | — | string[] | 可用工具,省略则继承全部。如 `["Read","Grep","Bash"]`、MCP 形如 `["mcp__github"]` |
217
+ | `disallowedTools` | — | string[] | 从继承列表中**剔除**的工具,如 `["Write","Edit"]`、`["mcp__*"]` |
218
+ | `model` | — | string | `sonnet`/`opus`/`haiku`/`fable` 别名、完整 ID(`claude-opus-4-8`)或 `inherit`(默认) |
219
+ | `permissionMode` | — | string | `default`/`acceptEdits`/`auto`/`dontAsk`/`bypassPermissions`/`plan` |
220
+ | `maxTurns` | — | number | agent 停止前的最大回合数 |
221
+ | `skills` | — | string[] | 启动时预加载进上下文的 skill 全文 |
222
+ | `mcpServers` | — | (string\|object)[] | 该 agent 可用的 MCP server(引用名或内联定义) |
223
+ | `hooks` | — | object | 生命周期 hook(`PreToolUse`/`PostToolUse`/`Stop`),格式同 settings.json |
224
+ | `memory` | — | string | 持久记忆作用域:`user`/`project`/`local`,支持跨会话学习 |
225
+ | `background` | — | boolean | `true` 则始终作为后台任务运行(默认 `false`) |
226
+ | `effort` | — | string | `low`/`medium`/`high`/`xhigh`/`max`,覆盖会话推理强度 |
227
+ | `isolation` | — | string | 设为 `worktree` 则在临时 git worktree(仓库隔离副本)中运行 |
228
+ | `color` | — | string | 显示颜色:`red`/`blue`/`green`/`yellow`/`purple`/`orange`/`pink`/`cyan` |
229
+ | `initialPrompt` | — | string | 当此 agent 作为主会话运行(`--agent` 或 `agent` 设置)时自动提交的首回合 |
230
+
231
+ > `name` 在 `--agents` 里不用单独写——JSON 的 key 就是 name。
232
+
233
+ ### A.2 `--agent <name>` —— 让主会话作为某 agent 运行
234
+
235
+ ```bash
236
+ claude --agent code-reviewer
237
+ ```
238
+
239
+ - 整个会话接管该 agent 的:**system prompt(完全替换默认 Claude Code 提示词)**、工具限制、模型、以及 hooks/memory/permissionMode 等配置。
240
+ - 启动头部会显示 `@<name>` 表示已生效;恢复会话时保持。
241
+ - 也可写进 settings.json 持久化:`{"agent": "code-reviewer"}`(`--agent` 即覆盖此设置)。
242
+ - 插件提供的 agent 用带作用域的名字:`claude --agent my-plugin:security-reviewer`。
243
+
244
+ ### A.3 agent 名称解析优先级(高 → 低)
245
+
246
+ 1. **Managed settings**(组织管理员下发)
247
+ 2. **`--agents` CLI 参数**(仅本次会话)
248
+ 3. **`.claude/agents/`**(项目级,随仓库共享)
249
+ 4. **`~/.claude/agents/`**(用户级,所有项目)
250
+ 5. **插件 agent**(最低)
251
+
252
+ 同名时取优先级最高的来源。
253
+
254
+ ### A.4 文件版定义(`.claude/agents/*.md`)
255
+
256
+ ```markdown
257
+ ---
258
+ name: code-reviewer
259
+ description: Reviews code for correctness, security, and maintainability
260
+ tools: Read, Grep, Glob, Bash # 文件版用逗号分隔;--agents JSON 用数组
261
+ model: sonnet
262
+ permissionMode: default
263
+ color: blue
264
+ ---
265
+
266
+ You are a senior code reviewer. Review for:
267
+ 1. Correctness: logic errors, edge cases, null handling
268
+ 2. Security: injection, auth bypass, data exposure
269
+ 3. Maintainability: naming, complexity, duplication
270
+ 每条结论必须给出具体修复方案。
271
+ ```
272
+
273
+ - **frontmatter(YAML)**:配置元数据;**markdown 正文**:该 agent 的 system prompt。
274
+ - 字段与 `--agents` JSON 完全一致,区别仅在 `prompt`(JSON 字段)↔ markdown 正文。
275
+
276
+ ### A.5 会话中如何调用 subagent(针对非主会话的子代理)
277
+
278
+ - **自然语言委派**:`用 code-reviewer 检查我的改动`,Claude 读 `description` 自动委派。
279
+ - **@ 提及强制指定**:`@agent-code-reviewer review the auth module`;插件 `@agent-my-plugin:code-reviewer`。
280
+ - **整会话运行**:`--agent <name>` 或 settings.json `{"agent":"..."}`(即 A.2)。
281
+ - 子代理经 **Agent 工具**(旧称 Task)启动,只看到自己的 prompt,看不到完整的 Claude Code 默认 system prompt。
282
+
283
+ ### A.6 两者关系小结
284
+
285
+ | | `--agents` | `--agent` |
286
+ |--|-----------|-----------|
287
+ | 作用 | **定义** agent(提供候选) | **选用** agent 作为主会话身份 |
288
+ | 落盘 | 否(仅本次会话) | 自身不落盘;可被 settings.json `agent` 持久化 |
289
+ | 典型搭配 | `claude --agents '{...}' --agent reviewer`(内联定义 + 立刻以它运行) | 单独用时引用文件/插件里已存在的 agent |
290
+
291
+ ---
292
+
293
+ ## 常用组合示例
294
+
295
+ ```bash
296
+ # 指定模型 + 高推理强度
297
+ claude --model opus --effort high
298
+
299
+ # 非交互、JSON 输出、限定预算,跑脚本
300
+ claude -p "审查改动" --output-format json --max-budget-usd 0.5
301
+
302
+ # 自定义 system prompt + 仅允许部分工具
303
+ claude --system-prompt-file ./sys.txt --tools "Read,Bash"
304
+
305
+ # 计划模式 + 追加规则
306
+ claude --permission-mode plan --append-system-prompt "先出方案再动手"
307
+
308
+ # 内联定义一个 agent 并立刻以它身份运行整会话
309
+ claude --agents '{"reviewer":{"description":"code reviewer","prompt":"You are a senior code reviewer.","tools":["Read","Grep","Bash"]}}' --agent reviewer
310
+
311
+ # 在 worktree 里开一个会话
312
+ claude --worktree feature-x
313
+
314
+ # 极简 / 排障
315
+ claude --bare # 跳过大部分自动行为
316
+ claude --safe-mode # 关闭所有自定义,排查配置问题
317
+
318
+ # 恢复最近会话 / 按选择器恢复
319
+ claude -c
320
+ claude -r
321
+ ```
322
+
323
+ ---
324
+
325
+ > 备注:以上为 2.1.195 版本快照,不同版本参数可能增删。随时用 `claude --help` 查看本机实际支持的参数,用 `claude <command> --help`(如 `claude mcp --help`)查看子命令详情。