Claude Code: 設定系統深入解析
# Claude Code 採用分層式設定系統。理解這個階層架構至關重要,因為較高層級會覆寫較低層級,而受管設定無法被您自己的設定檔覆寫。
Claude Code 採用分層式設定系統。理解這個階層架構至關重要,因為較高層級會覆寫較低層級,而受管設定無法被您自己的設定檔覆寫。
Claude Code 採用分層式設定系統。理解這個階層架構至關重要,因為較高層級會覆寫較低層級,而受管設定無法被您自己的設定檔覆寫。
本節涵蓋:設定階層、以 /config key=value 在提示列中設定組態、完整的 settings.json 參考、最常被搜尋旗標的設定速查表、各主題的官方文件位置,以及環境變數參考。
設定階層
| 層級 | 位置 | 範圍 | 可被覆寫 |
|---|---|---|---|
| 受管 | /etc/claude-code/managed-settings.json(Linux) |
所有使用者 | 否 |
/Library/Application Support/ClaudeCode/managed-settings.json(macOS) |
|||
C:\Program Files\ClaudeCode\managed-settings.json(Windows) |
|||
| 命令列 | 以 --settings <file-or-json> 傳入的 JSON |
目前工作階段 | 是 |
| 本機專案 | .claude/settings.local.json |
個人、目前專案 | 是 |
| 共用專案 | .claude/settings.json |
透過 git 共享給團隊 | 是 |
| 使用者 | ~/.claude/settings.json |
您的所有專案 | 是 |
| 狀態 | ~/.claude.json |
帳號資訊、MCP 伺服器設定、各專案的狀態(例如信任決定),以及 /config 寫入的全域設定鍵 |
不適用 |
受管層級不只是一個檔案:MDM 政策或來自 claude.ai console 的伺服器管理設定也會提供同一層級,而您自己的設定檔或 --settings 中的任何內容都無法覆寫受管的鍵。294 這五個層級對單一鍵而言是一個堆疊:設定了該鍵的最高層級優先。清單則不同:當同一個清單鍵(例如 permissions.allow)在多個檔案中設定時,Claude Code 會合併這些清單。命令列層級僅指 --settings JSON;其他旗標(例如 --model)各自只為該工作階段設定一項內容,不屬於這個堆疊。~/.claude.json 是 Claude Code 為自己寫入的第五個檔案。它不儲存您的登入資訊:憑證在 macOS 上位於鑰匙圈(Keychain),在 Linux 上位於 ~/.claude/.credentials.json(模式 0600),在 Windows 上則位於 %USERPROFILE%\.claude\.credentials.json。550
專家提示: 在共用專案中,請用 .claude/settings.local.json 存放個人偏好。Claude Code 建立此檔案時,會將 **/.claude/settings.local.json 加入您的全域 git 排除檔,使其不納入 git;只有在您手動建立此檔案時,才需要自行將其加入 .gitignore。389 團隊共用、需納入版本控制的設定,則放在 .claude/settings.json。
在提示列中設定組態:/config key=value(v2.1.181)
截至 v2.1.181,/config key=value 可直接在提示列中設定某項設定(例如 /config verbose=true),無需開啟互動式 /config 介面;互動式、-p 與 Remote Control 工作階段皆支援。它接受 /config --help(v2.1.183)所列出的鍵,但無法開啟需要您在面板中確認的設定(例如 autoContinueAtUsageLimit),不過可以將其關閉。468 在互動式 /config 介面中,Enter 與 Space 皆可切換所選設定,Esc 則會儲存並關閉(v2.1.183+)。171
完整的 settings.json 參考
以下是一份展示所有主要選項的完整設定:
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"model": "claude-sonnet-5-5",
"permissions": {
"allow": [
"Read",
"Glob",
"Grep",
"Bash(npm run:*)",
"Bash(git:*)",
"Bash(make:*)",
"Edit(src/**)",
"mcp__github"
],
"deny": [
"Read(.env*)",
"Read(secrets/**)",
"Bash(rm -rf:*)",
"Bash(sudo:*)",
"Edit(package-lock.json)",
"Edit(.git/**)"
],
"ask": [
"WebFetch",
"Bash(curl:*)",
"Bash(docker:*)"
],
"additionalDirectories": [
"../shared-lib",
"../docs"
],
"defaultMode": "acceptEdits"
},
"env": {
"NODE_ENV": "development",
"DEBUG": "app:*"
},
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": "jq -r '.tool_input.file_path' | xargs npx prettier --write"
}
]
}
]
},
"sandbox": {
"enabled": false,
"autoAllowBashIfSandboxed": true,
"excludedCommands": ["docker *"],
"enableWeakerNetworkIsolation": false
},
"statusLine": {
"type": "command",
"command": "~/.claude/statusline.sh"
},
"cleanupPeriodDays": 30,
"outputStyle": "Explanatory",
"language": "japanese",
"respectGitignore": true,
"showTurnDuration": true,
"plansDirectory": ".claude/plans",
"spinnerVerbs": { "mode": "append", "verbs": ["Pondering", "Crafting"] },
"spinnerTipsOverride": {
"label": "Team tips",
"tips": [
"Custom tip 1",
{"id": "tip-2", "text": "Custom tip 2", "cooldownSessions": 5, "priority": 1}
],
"tipsFile": "~/.claude/team-tips.json",
"excludeDefault": true
},
"skillOverrides": {
"legacy-skill": "off",
"manual-only-skill": "user-invocable-only",
"compact-skill": "name-only"
},
"includeGitInstructions": false,
"modelOverrides": {
"claude-opus-5-5": "arn:aws:bedrock:us-east-2:123456789012:application-inference-profile/opus-prod",
"claude-sonnet-5-5": "arn:aws:bedrock:us-east-2:123456789012:application-inference-profile/sonnet-prod"
},
"autoMemoryDirectory": "~/.claude/memory/my-project"
}
當團隊擁有大量 skills,卻希望在執行階段收緊曝光範圍時,skillOverrides 就很實用。使用 off 可將某個 skill 同時從模型與斜線選單中隱藏;user-invocable-only 保留以名稱呼叫的能力,但不讓模型自行選用;name-only 則只顯示 skill 名稱,不含完整描述。153
範例中有三個值必須符合特定形式:spinnerVerbs 是一個物件,包含 mode(append 會將您的動詞加入內建集合,replace 則只顯示您的動詞)與 verbs 陣列;language 接受語言名稱,例如 japanese;autoMemoryDirectory 則接受絕對路徑或以 ~/ 開頭的路徑。sandbox.enableWeakerNetworkIsolation 顯示的是其預設值 false:設為 true 會讓 macOS 上沙箱內的指令能存取系統的 TLS 信任服務,gh 等以 Go 撰寫的工具在使用自訂 CA 的 MITM 代理伺服器後方需要這項存取,但這也會開啟一條可能的資料外洩途徑。294 每個 sandbox.excludedCommands 項目都使用 Bash 權限規則語法,其中不含萬用字元的模式為完全比對:docker * 會比對帶或不帶引數的 docker,而單獨的 docker 只會比對不帶引數的 docker。390 範例中的 sandbox.autoAllowBashIfSandboxed 顯示為 true,但這已不再是其預設值:自 v2.1.325 起預設為 false,沙箱內的指令會經過一般的權限流程(請參閱沙箱模式)。530
範例中的 Glob 與 Grep 允許規則適用於 Windows,因為這兩個工具在 Windows 上屬於預設工具集。在 macOS、Linux 與 WSL 上,Claude Code 預設不包含這兩個工具,而是透過 Bash 工具以 find 與 grep 搜尋,設定檔中的允許規則也無法讓這兩個工具回來。386469
較新的設定(v2.1.174–176):
availableModels/enforceAvailableModels(任何設定檔皆可設定,若要對組織強制執行,請部署在受管設定中;enforceAvailableModels需要 v2.1.175+):availableModels允許清單限制工作階段可選擇的模型。自 v2.1.175 起,受管的availableModels清單會單獨生效(自行提供清單的主機平台除外):使用者、專案或本機設定中的項目無法擴充它。在非空的清單旁設定enforceAvailableModels: true後,允許清單也會約束 Default 模型:若 Default 會解析為清單以外的模型,則改為解析為清單中第一個可用的模型。一旦組織部署了任何受管設定,Claude Code 就只會從受管來源讀取enforceAvailableModels。470 配套修正(v2.1.176)堵住了一個漏洞:先前透過ANTHROPIC_DEFAULT_*_MODEL選取別名時,可能被導向遭封鎖的模型;此外/fast現在也會拒絕切換至允許清單以外的模型。169 截至 v2.1.187,組織可直接在/model選擇器、--model、/model與ANTHROPIC_MODEL上強制執行模型限制,選取受限模型時會顯示「restricted by your organization’s settings」訊息。173language(v2.1.176 精進): 除了設定回應語言之外,工作階段標題現在預設會以對話所用的語言產生;若要固定標題使用特定語言,請設定language。169footerLinksRegexes(v2.1.176): 在頁尾列顯示以正規表示式比對的連結徽章,可透過使用者或受管設定進行配置。169wheelScrollAccelerationEnabled(v2.1.174): 設為false可停用全螢幕模式下的滑鼠滾輪捲動加速。169
較新的設定(v2.1.207–v2.1.212):
vimInsertModeRemaps(v2.1.208): 為 vim 插入模式自訂按鍵重新對應,經典範例是把jj對應到 Escape(請參閱 Vim 模式)。183axScreenReader(v2.1.208): 持續啟用螢幕閱讀器模式(請參閱 螢幕閱讀器模式)。183processWrapper(v2.1.210;CLAUDE_CODE_PROCESS_WRAPPER變數於 v2.1.208 推出): 在 macOS 與 Linux 上,於 Claude Code 從自身二進位檔啟動的背景程序之前放置企業啟動器;僅限使用者或受管設定(請參閱企業部署)。183294autoMode來源限制(v2.1.207):autoMode設定不再從儲存庫的.claude/settings.local.json讀取,請改在~/.claude/settings.json中設定。這封堵了複製下來的儲存庫夾帶自動模式設定的途徑。182
較新的設定(v2.1.217):
emojiCompletionEnabled(v2.1.217): 在提示輸入框中自動完成表情符號簡碼,輸入:heart:會插入 ❤️,輸入:hea這類部分簡碼則會顯示建議。預設開啟;設為false可停用。191
較新的設定(v2.1.219):
sandbox.network.strictAllowlist(v2.1.219): 在所有權限模式下,為沙箱內的指令拒絕允許清單以外的任何主機。若未設定,在互動式終端機工作階段中由權限模式決定:Manual、acceptEdits與規劃模式會跳出提示;auto mode 會拒絕該主機,除非指令已列出該主機且分類器已核准該清單;dontAsk會拒絕;而bypassPermissions(或可使用略過權限的規劃模式)會不經提示就允許連線。Claude Code 會從使用者或受管設定與--settings讀取此鍵;儲存庫的設定檔無法設定它。請參閱沙箱模式。193391workflowSizeGuideline(v2.1.219): 可從任一設定檔(使用者、專案或受管)設定 Dynamic workflow 大小的建議準則,不再只能透過/config設定。可用的值為"small"(以少於 5 個 agents 為目標)、"medium"(少於 10 個;於 v2.1.271 從 15 調降)、"large"(少於 50 個)與"unrestricted"。預設值為medium,自 v2.1.271 起 Pro 方案則為small;當設定檔提供了這個值時,/config中的對應列會自動隱藏。這僅是建議值,並非強制上限。請參閱 Subagents。193294289
較新的設定(v2.1.242–243):
modelPicker(使用者或受管設定,v2.1.242+): 以一份有序、附標籤的模型清單自訂/model選擇器。其值為一個物件,包含options陣列(每列必須有model,可選擇加上label與description;model會原封不動地採用,因此別名、Anthropic ID,以及 Bedrock/Agent Platform/Foundry/閘道 ID 皆可使用),以及可選的replaceBuiltInOptions布林值(預設false,會將您的列附加在內建清單之後;true則只顯示您的列、Default,以及工作階段目前正在執行的模型)。Claude Code 會從受管設定、--settings與使用者設定讀取此鍵,但忽略專案與本機設定中的值,因此複製下來的儲存庫無法重新標示選擇器;最高層級的設定來源會提供整份清單。availableModels允許清單仍適用於每一列,而標籤只改變選擇器顯示的內容,並不改變實際執行的模型。247245promptCacheTtl/subagentPromptCacheTtl(任一檔案,v2.1.242+): 可針對各請求類別設定為"5m"或"1h",讓 API 金鑰與雲端供應商使用者能在主對話維持一小時快取,而 subagents 則維持五分鐘。請參閱 快取策略。247245modelPricing(受管設定;依設定參考文件為 v2.1.242 或更新版本,版本說明則將其列於 2.1.243 之下,且沒有 2.1.242 章節): 組織簽約的各模型費率與折扣乘數,供/usage、狀態列與遙測成本數據使用,取代牌價。請參閱檢視費用。247383
較新的設定(v2.1.247):
feedbackDrafts(v2.1.247): 控管新的SendFeedback工具:當工作階段中出了問題,Claude 可以草擬一份回饋報告,供您在/feedback中檢閱並送出;用這個設定即可關閉草擬功能。請參閱 斜線指令 中的/feedback列。242spinnerTipsOverride結構擴充(v2.1.247): 提示項目除了純字串,也可以是{id, text, cooldownSessions, priority}物件,而且該物件新增了tipsFile與label鍵,讓組織能把自家的提示與內建提示輪流顯示(上方範例即為擴充後的結構)。設定參考文件記載了這些鍵。242224
較新的設定(v2.1.248–251):
desktopSessionCleanupPeriodDays(v2.1.248): 限制桌面版寫入的工作階段可以免於逐字稿清理多久。清理程序會在cleanupPeriodDays(預設 30 天)之後移除其他工作階段,而 Claude Desktop 與 Cowork 的工作階段只要還在應用程式中就會保留,除非組織政策另行管理保留期限。203- 專案層級
env限制(v2.1.251): 專案層級.claude/settings.json的env區塊不再能設定CLAUDE_CONFIG_DIR、CLAUDE_CODE_TMPDIR或TMPDIR/TMP/TEMP,請改在 shell、使用者或受管設定中設定,這樣複製下來的儲存庫就無法改變 Claude Code 寫入設定檔與暫存檔的位置。203
較新的設定(v2.1.257-259):
timeFormat/timeZone(v2.1.257): 控制 Claude Code 如何呈現時間,包括回合結束時的完成時鐘與逐字稿的時間戳記。timeFormat可接受 12 小時制、24 小時制、24 小時制 UTC,或明確的 strftime 格式;timeZone則指定時區。208 設定參考文件記載了這兩個鍵。224permissions.blockReadsOutsideWorkingDirectories(v2.1.257): 讓 Claude 的檔案工具(Read、Grep、Glob與LSP)在所有權限模式下都拒絕讀取工作階段工作目錄之外的檔案。Claude Code 本身需要的檔案仍可讀取,例如您的 skills、plugins、規則,以及~/.claude/下的CLAUDE.md記憶檔;shell 指令則不會以同樣方式被拒絕。471 若未啟用,auto mode 現在會在工作階段第一次進行這類讀取前詢問一次(請參閱 Auto Mode)。208 v2.1.273 補上了兩個缺口:檢查器無法完整分析的 Bash 指令會改為提示,而不是跳過檢查;由儲存庫設定指定的記憶目錄在此設定下不會被載入、回想或索引。214permissions.blockWritesOutsideWorkingDirectories(v2.1.314): 讓 Write、Edit 與 NotebookEdit 在所有權限模式下(包括bypassPermissions)都拒絕工作階段工作目錄之外的路徑,但 Claude Code 自身的部分檔案除外(例如計畫檔、暫存區(scratchpad)、背景工作階段的tmp目錄,以及專案自動記憶中的.md檔案)。它不會限制 shell 指令、MCP 工具或 hooks 執行的程式(那是沙箱的工作),而且啟用期間 Claude Code 會移除EnterWorktree與ExitWorktree工具,或拒絕對它們的呼叫。任何設定檔都能開啟它,因此儲存庫可以封鎖自己,卻無法解除您設下的封鎖。雲端工作階段可能不會套用此鍵,因為其檔案工具在容器中執行,而容器本身就是邊界。281282471permissions.denyInsteadOfPrompting(v2.1.319): 原本會等待權限提示的工具呼叫會被拒絕,回合則繼續進行,因此無人值守的工作階段能持續運作。它適用於終端機工作階段、-p執行、VS Code、本機桌面工作階段、subagents 與 agent teams;僅限使用者或受管範圍與--settings,因此儲存庫無法設定它。經允許規則、權限模式或 auto mode 分類器核准的呼叫仍會執行,而PermissionRequesthook 可以允許大部分原本會跳出提示的呼叫;有些呼叫會在詢問任何 hook 之前就被拒絕,例如 auto mode 中沒有任何詢問規則涵蓋的關鍵路徑的刪除操作。此設定也會移除AskUserQuestion、EnterPlanMode與ExitPlanMode(agent team 中的隊友保留這兩個計畫工具),取消 MCP elicitation(除非有Elicitationhook 回應),並略過canUseTool與--permission-prompt-tool;工作區信任對話框與專案 MCP 伺服器的核准仍會等待,因此請在離開前先回應這兩者。若只是單次無人值守的-p執行,--permission-prompts none的效果相同。283284472managedMcpServers/managedSourcesBehavior: 受管範圍的鍵,於 企業部署 中說明:組織向所有使用者提供 MCP 伺服器(v2.1.259),以及跨受管來源的選擇性合併(v2.1.257 中精修)。208241
較新的設定(v2.1.261):
bashOutputMaxChars/taskOutputMaxChars(v2.1.261): 提高 Claude 在其餘內容存入檔案之前,能夠內嵌接收的指令輸出量(以及背景任務輸出量),上限為 128K 字元。bashOutputMaxChars(限制在 4,000 至 128,000 的範圍內;未設定時內嵌 30,000 字元)會同時決定內嵌上限與讀回視窗的大小,一旦設定,Claude Code 就會忽略BASH_MAX_OUTPUT_LENGTH環境變數;未設定時,該變數設定從指令工作輸出檔讀回的視窗大小(預設 30,000 字元,上限 150,000)。超過內嵌上限後,成功執行的指令輸出會存入一個 Claude 可以隨時讀取的檔案,而不是被截斷。211294295 截至 v2.1.265,持久化那一側也有了上限:存到磁碟的工具結果最多 1 GB,而且對話中的預覽會在存檔遭截斷時加以註明。212 任務那一半已於 v2.1.277 退場: 已棄用的 TaskOutput 工具被移除,Claude 改用 Read 讀取背景任務的輸出檔,而taskOutputMaxChars與TASK_MAX_OUTPUT_LENGTH也不再有任何效果。bashOutputMaxChars不受影響。216
較新的設定(v2.1.267-269):
maxEffortLevel(v2.1.267): 限制使用者可選擇的最高 effort 等級,可設在頂層或modelSettings下的個別模型,並適用於所有供應商,包括 Bedrock、Agent Platform 與 Foundry。使用者仍可選擇低於上限的等級;這是/effort在管理端的對應設定。213advisorModel:/advisor寫入使用者設定的已儲存顧問模型(fable、opus、sonnet或完整 ID);--advisor可在單一工作階段中覆寫它,而CLAUDE_CODE_DISABLE_ADVISOR_TOOL=1則會關閉此工具。請參閱 Advisor 工具。271sandbox.allowNestedUserNamespaces(v2.1.305): 允許 Linux 與 WSL2 上沙箱內的指令建立使用者命名空間,這是 Chromium 與 Electron 自身的沙箱、巢狀的 bubblewrap 以及unshare所需要的;這會讓它們得以繞過沙箱的檔案保護,因此只會從使用者或受管設定讀取。單靠此設定並不足以支援 rootless Podman 或 Buildah:文件指出,這兩者需要加入sandbox.excludedCommands模式,例如podman *。請參閱沙箱模式。275276473bashEditDiffEnabled(v2.1.269): 當 Bash 工具處理檔案編輯時,工具結果會附上指令所變更檔案的差異比對,讓對話中能看到sed式編輯實際做了什麼。213
較新的設定(v2.1.275):
syncClaudeAiSkills/syncClaudeAiPlugins(版本說明列為 v2.1.275;設定參考文件將 v2.1.273 列為syncClaudeAiPlugins的版本下限): 您 claude.ai 帳號上啟用的 skills 與 plugins,現在會同步到以該帳號登入的終端機工作階段。將任一鍵設為false,即可讓終端機工作階段只使用本機的 skills 與 plugins。請參閱 Skills 與 Plugin 系統。215392
較新的設定(v2.1.282-283):
maxProseWidth(v2.1.282): 限制 Claude 的文字在寬螢幕終端機中的顯示寬度。段落、標題、清單與引用區塊會在該欄數內換行,而表格與程式碼區塊則維持完整寬度。值為欄數的整數,最小為 40。222224deniedModels/availableModelsMatch(受管,v2.1.283):deniedModels會封鎖特定模型,即使availableModels允許它們。像"opus"這樣的系列別名會封鎖整個系列,而"claude-opus-5"也會連 Opus 5.5 一起封鎖(若只想封鎖 Opus 5,請寫"claude-opus-5-0")。預設情況下,availableModels中像"claude-opus-5"這樣的項目也會允許以它為基礎延伸的後續版本;availableModelsMatch: "exact"則讓每個項目只允許其所指名的版本,因此新版本在您列出之前都維持封鎖。Claude Code 只會從受管設定讀取這兩個鍵。223224allowClaudeInChromeWithManagedMcp(受管,v2.1.282): 讓claude --chrome能與獨佔式的managed-mcp.json並行運作;Chrome 被封鎖時顯示的錯誤訊息現在會指出這個鍵的名稱。222 依設定參考文件,這個鍵只會從裝置本身的受管設定讀取,而deniedMcpServers中針對claude-in-chrome的項目仍會封鎖該伺服器。230
較新的設定(v2.1.285):
allowedProviders(受管,v2.1.285): 限制一台機器可使用的 API 供應商:Anthropic API、自訂端點、Bedrock、Mantle、Agent Platform("vertex"項目)、Foundry、AWS 上的 Claude Platform,或 Cloud 閘道。226 設定參考文件已記載這個鍵;當伺服器受管設定也提供一份清單時,來自機器本身管理來源的清單仍持續適用,因此工作階段只能使用同時列於兩份清單的供應商。230
設定速查:最常被搜尋的旗標
如果您是循著某個特定設定的名稱來到這裡,這就是簡短索引。每個項目都標明它隨哪個版本推出,若有特定範圍擁有它,也會一併標明:
| 設定 | 作用 |
|---|---|
disableBundledSkills |
對模型隱藏內建的 skills 與斜線指令,讓自備這些功能的 harness 從零開始(v2.1.169+) |
modelPicker |
自訂 /model 選擇器:有序、帶標籤的列,可附加在內建陣容之後或取而代之;僅限使用者或受管範圍(v2.1.242+) |
promptCacheTtl / subagentPromptCacheTtl |
各請求類別的提示快取存留時間,"5m" 或 "1h"(v2.1.242+) |
maxEffortLevel |
限制使用者可選擇的最高 effort 等級,可設在頂層或 modelSettings 下的個別模型;適用於所有供應商,包括 Bedrock/Agent Platform/Foundry(v2.1.267+) |
sandbox.excludedCommands |
當一次呼叫中的每個指令都符合某個項目時,在沙箱之外執行的指令模式,例如 ["docker *"],適用於在隔離環境下會失效的工具。不含萬用字元的模式為完全比對,因此 docker 只會比對不帶引數的 docker。被排除的指令會以您的完整存取權限執行,而文件將排除稱為一種便利措施,而非安全邊界(請參閱沙箱模式)390 |
sandbox.network.strictAllowlist |
在所有權限模式下,為沙箱內的指令拒絕允許清單以外的任何主機。若未設定則由權限模式決定,而 bypassPermissions 會不經提示就允許這些主機。這是無人值守執行時的設定;僅限使用者或受管範圍(v2.1.219+)391 |
worktree.bgIsolation |
設為 "none" 可讓背景工作階段直接編輯工作副本,適用於不便使用 worktree 的儲存庫(v2.1.143+) |
allowAllClaudeAiMcps |
企業版:在 managed-mcp.json 之外,一併載入 claude.ai 雲端 MCP 連接器(v2.1.149+) |
allowClaudeInChromeWithManagedMcp |
受管設定:允許 claude --chrome 與獨佔模式的 managed-mcp.json 並行運作(v2.1.282+) |
deniedModels / availableModelsMatch |
受管設定:即使 availableModels 允許,仍可封鎖特定模型;"exact" 會將每個 availableModels 項目限制為其指定的版本(v2.1.283+) |
maxProseWidth |
在寬幅終端機中限制 Claude 文字輸出的寬度;表格與程式碼區塊仍維持完整寬度(v2.1.282+) |
allowedProviders |
受管設定:限制機器可使用的 API 供應商(v2.1.285+) |
wslInheritsWindowsSettings |
受管政策:WSL 工作階段會繼承 Windows 端的受管設定(v2.1.118+) |
各主題的官方文件在哪裡?
本指南是實戰手冊,而非權威參考文件。當您需要 Anthropic 針對某個子系統的正式頁面時,以下是官方位置(本指南各章節也會交叉連結至各自對應的頁面):
| 主題 | 官方文件 | 本指南對應章節 |
|---|---|---|
| Hooks 參考與指南 | code.claude.com/docs/en/hooks · hooks-guide | Hooks 如何運作? |
MCP(claude mcp add、伺服器) |
code.claude.com/docs/en/mcp | 什麼是 MCP? |
| Subagents | code.claude.com/docs/en/sub-agents | Subagents |
| 權限模式(含 auto 模式) | code.claude.com/docs/en/permission-modes | 權限模式 |
| 設定檔 | code.claude.com/docs/en/settings | 設定系統 |
| 模型設定 | code.claude.com/docs/en/model-config | 該選擇哪個模型? |
| CLAUDE.md / 記憶 | code.claude.com/docs/en/memory | 記憶如何運作? |
| Agent 團隊 | code.claude.com/docs/en/agent-teams | Agent Teams |
| 跨工作階段訊息傳遞 | code.claude.com/docs/en/cross-session-messaging | 跨工作階段訊息傳遞 |
| 版本更新日誌 | code.claude.com/docs/en/changelog | 變更紀錄 |
環境變數參考
驗證與 API:203
ANTHROPIC_API_KEY=sk-ant-... # Direct API authentication
ANTHROPIC_AUTH_TOKEN=token # Custom authorization header
ANTHROPIC_CUSTOM_HEADERS="X-Key: val" # Additional request headers; credential/org/routing/API-behavior headers set from managed or project settings require approval (v2.1.251)
模型設定:
ANTHROPIC_MODEL=claude-opus-5-5 # Override the model setting; exported in your shell it applies over the model key from any settings file
ANTHROPIC_DEFAULT_MODEL=claude-opus-5-5 # Model new sessions start on; a /model pick overrides + persists (v2.1.236)
ANTHROPIC_DEFAULT_OPUS_MODEL=claude-opus-5-5 # What the `opus` alias resolves to (Opus 5.5 since v2.1.280; Opus 5 v2.1.219-278)
ANTHROPIC_DEFAULT_SONNET_MODEL=claude-sonnet-5-5 # What the `sonnet` alias resolves to, and what opusplan uses outside plan mode
ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-4-5-20251001 # pin the haiku alias; on the Anthropic API it resolves to Haiku 5.5 (claude-haiku-5-5) as of v2.1.293
CLAUDE_CODE_SUBAGENT_MODEL=sonnet # Default model for subagents; an agent's model: field and per-spawn picks win (v2.1.251 demoted it from override to default)
CLAUDE_CODE_DISABLE_ADVISOR_TOOL=1 # Turn the advisor tool off: /advisor becomes unavailable, advisorModel is ignored, --advisor is accepted but does nothing
CLAUDE_CODE_SUBAGENT_MODEL_FORCE=1 # Force every subagent onto CLAUDE_CODE_SUBAGENT_MODEL (or the main model), ignoring agent-definition and per-spawn overrides -- the pre-v2.1.251 behavior, opt-in (v2.1.257)
CLAUDE_CODE_SUBAGENT_EFFORT=high # Default effort level for subagents and workflow agents (low, medium, high, xhigh, or max) when nothing else names one, instead of inheriting the session's; not applied to forks, forked skills, or teammates (the env-vars page says v2.1.315 or later, a version published without release notes; the notes list it under 2.1.316); a subagent on another model uses that model's saved effort or its default (v2.1.317+)
CLAUDE_CODE_DISABLE_ULTRATHINK=1 # Turn the ultrathink keyword off; since v2.1.311 it runs a terminal turn at xhigh effort on Opus 5.5, Sonnet 5.5, Haiku 5.5, Fable 5.2, and Fable 5.1 (the variable arrived in v2.1.316)
CLAUDE_CODE_DISABLE_WORKFLOWS=1 # Turn dynamic workflows off for one session; same effect as "disableWorkflows": true (see the note below)
MAX_THINKING_TOKENS=10000 # Fixed thinking budget on models without adaptive reasoning; on adaptive-reasoning models the number itself is ignored (see the note below)
CLAUDE_CODE_MAX_OUTPUT_TOKENS=32000 # Max output tokens for most requests; defaults and caps vary by model, and a higher value leaves less context before auto-compaction
CLAUDE_CODE_MAX_TURNS=10 # Cap agentic turns when no --max-turns is passed; the flag wins when both are set, and a value that is not a positive integer is rejected at startup
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 # Enable agent teams (v2.1.32+)
以上各項的來源:294290235236203271208281282285280547
CLAUDE_CODE_DISABLE_WORKFLOWS 與 disableWorkflows: 兩者中任何一個將工作流程關閉後,另一個都無法再將其開啟。工作流程預設開啟,但 Pro 方案除外;在 Pro 方案上,"enableWorkflows": true(由 /config 中的 Dynamic workflows(動態工作流程)列寫入)會將其開啟。474
MAX_THINKING_TOKENS 依模型而異: 固定預算適用於沒有自適應推理的舊模型,而在 Opus 4.6 與 Sonnet 4.6 上,只有搭配 CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING=1 時才適用。Fable 模型、Sonnet 5 及之後的版本、Haiku 5.5,以及 Opus 4.7 及之後的版本一律使用自適應推理,若為正值,Claude Code 會在這些模型上忽略該數值本身。0 會在 Anthropic API 上停用思考(Opus 5.5、Sonnet 5.5、Haiku 5.5 與 Fable 模型除外),並在第三方供應商上省略 thinking 參數。474
雲端供應商設定:
CLAUDE_CODE_USE_BEDROCK=1 # Use Amazon Bedrock
CLAUDE_CODE_USE_VERTEX=1 # Use Google Cloud's Agent Platform (formerly Vertex AI)
CLAUDE_CODE_USE_FOUNDRY=1 # Use Microsoft Foundry
CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD=1 # Use Claude Models on Google Cloud (Anthropic managed); set ANTHROPIC_GOOGLE_CLOUD_PROJECT and ANTHROPIC_GOOGLE_CLOUD_WORKSPACE_ID with it (the docs give v2.1.307 as the floor)
ANTHROPIC_BEDROCK_BASE_URL=https://... # Custom Bedrock endpoint
ANTHROPIC_BEDROCK_SERVICE_TIER=priority # Bedrock service tier (v2.1.122+): 'default', 'flex', or 'priority'; sent as X-Amzn-Bedrock-Service-Tier header
CLAUDE_CODE_SKIP_BEDROCK_AUTH=1 # Skip Bedrock auth (for gateways)
CLAUDE_CODE_SKIP_VERTEX_AUTH=1 # Skip Google authentication for Agent Platform (for gateways)
AWS_BEARER_TOKEN_BEDROCK=token # Bedrock bearer token
VERTEX_REGION_CLAUDE_5_5_OPUS=us-east5 # Agent Platform region override for one model, here Claude Opus 5.5 (v2.1.280+); there is one variable per model
VERTEX_REGION_CLAUDE_HAIKU_5_5=us-east5 # Agent Platform region for Claude Haiku 5.5 (v2.1.293+)
VERTEX_REGION_CLAUDE_FABLE_5_2=global # Agent Platform region for Claude Fable 5.2 (v2.1.321+); fast mode on Agent Platform (v2.1.322+) needs global, us, or eu
VERTEX_REGION_CLAUDE_5_5_SONNET=us-east5 # Agent Platform region for Claude Sonnet 5.5 (v2.1.284+); since v2.1.332 the sonnet alias and background requests read it, and with only the 4_5 variable set they go to CLOUD_ML_REGION or us-east5
CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1 # Opt in gateway /v1/models discovery for /model picker (v2.1.129+)
CLAUDE_CODE_GATEWAY_MODEL_DISCOVERY_TIMEOUT_MS=3000 # Extend the LLM gateway /v1/models discovery timeout (default 3s; v2.1.269+)
CLAUDE_CODE_GATEWAY_HINT_HEADERS=1 # Send the x-claude-code-* hint headers (request-class, agent-type, prev-tool-durations, compaction, context-compacted, and prompt-id from v2.1.283) through a gateway or third-party provider; a direct Anthropic API connection sends them by default, and =0 stops them everywhere (v2.1.273+)
CLAUDE_CODE_AUTO_MODE_SERVER=0 # Skip the server-side auto-mode checks and use Claude Code's own classifier requests (see the note below)
CLAUDE_CODE_AUTO_MODE_MODEL=claude-sonnet-4-6 # Full model ID for the client-side auto mode classifier; Opus 5, Sonnet 5.5, Opus 5.5, and models your organization's model policy excludes are ignored (the default classifier model reviews instead); no effect on server-side auto mode (v2.1.302+)
CLAUDE_CODE_MODEL_CATALOG=off # Stop Bedrock, Mantle, Agent Platform, and Foundry sessions loading model settings from the signed file on downloads.claude.ai (v2.1.311+)
CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT=0 # Keep the full system prompt; =1 uses the shorter one on any model. Since v2.1.312 Bedrock, Mantle, Agent Platform, and Foundry use the shorter prompt for model names Claude Code does not recognize, even when they front Sonnet or Haiku
CLAUDE_CODE_DISABLE_REFUSAL_FALLBACK=1 # Turn off the automatic model switch after a safety classifier flags a request (the switchModelsOnFlag setting); since v2.1.312 the switch also covers model names Claude Code does not recognize
以上各項的來源:151290237284153213214223224216220221222272281282393527535538547
CLAUDE_CODE_AUTO_MODE_SERVER: 伺服器端審查是預設行為(v2.1.278+),適用於 Enterprise 與 Claude API 帳號、AWS 上的 Claude Platform、Bedrock、Agent Platform 與 Foundry,以及透過閘道的連線,而伺服器端分類器不會針對分類器的額外負擔收費。設為 0 即可改用 Claude Code 自身的分類器請求。在直接連線 Anthropic API 時,此變數需要 v2.1.281 或更新版本,且在關閉遙測的情況下,伺服器端審查即為預設(v2.1.282+)。文件將此變數稱為暫時性的:它可能會在之後的版本中移除。475
行為控制:
DISABLE_AUTOUPDATER=1 # Prevent automatic background updates
DISABLE_UPDATES=1 # Block all update paths including manual `claude update` (v2.1.118+, stricter than DISABLE_AUTOUPDATER)
CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE=1 # Homebrew/WinGet installs run package-manager upgrade in background, then prompt restart (v2.1.129+)
DISABLE_TELEMETRY=1 # Opt out of usage telemetry
CLAUDE_CODE_DISABLE_FEATURE_FLAGS=1 # Stop feature-flag fetching without turning telemetry off: every flag uses its built-in default, and Remote Control and the other flag-gated features are unavailable (v2.1.319+; DISABLE_GROWTHBOOK is the older name and the only one v2.1.124-318 read)
CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 # Start sessions in Code Mode (experimental, v2.1.323+); 0 keeps it off, and 0 in managed settings blocks it for an organization; ignored in a project's settings files
CLAUDE_CODE_DISABLE_AGENT_PROGRESS_SUMMARIES=1 # Turn off subagent progress summaries and the requests that write them (documented in the v2.1.323 release notes, available since 2.1.318)
CLAUDE_CODE_DISABLE_DEFERRED_TOOL_RESUME=1 # Skip a tool call that a hook deferred when you resume or continue with -p; ignored in a settings env block (v2.1.328+)
CLAUDE_CODE_DISABLE_RESPONSE_COMPRESSION=1 # Ask for uncompressed model responses behind a proxy that cuts compressed ones off; not advised for self-hosted runners or Remote Control; ignored in project and local settings (v2.1.331+)
CLAUDE_CODE_RESUME_HINT_COMMAND=mytool # In a wrapper that starts Claude Code: the exit hint prints "mytool --resume <session-id>"; ignored in a settings env block (v2.1.323+)
CLAUDE_CODE_FULL_SIGN_IN_LINK=1 # Print the full sign-in link when the short one shows an error or a script reads values from it (v2.1.330+)
CLAUDE_CODE_DISABLE_SHIP=1 # Turn off /ship and /steward, for example from the env block of managed settings (v2.1.331+)
DISABLE_ERROR_REPORTING=1 # Opt out of error reporting; any non-empty value counts, 0 and false included
DISABLE_FEEDBACK_COMMAND=1 # Disable /feedback, /bug, /share and Claude-drafted feedback (the older name DISABLE_BUG_COMMAND is still accepted)
CLAUDE_CODE_DISABLE_WEB_FETCH=1 # Turn off the WebFetch tool; WebSearch stays available (v2.1.285+)
CLAUDE_CODE_DISABLE_ARTIFACT=1 # Turn the Artifact tool off for one session; while it is set, no settings file turns artifacts back on
CLAUDE_CODE_ARTIFACT_AUTO_OPEN=0 # Do not open the browser when a new artifact is published
CLAUDE_CODE_SKIP_PROMPT_HISTORY=1 # Write no prompt history or transcript; the session never appears in --resume, --continue, or up-arrow history (ephemeral scripted runs)
CLAUDE_CODE_TRANSCRIPT_LOCAL_GC=1 # In a long -p or Agent SDK session, drop the pre-compaction history from a transcript over 5 MB after each compaction; resume still restores the conversation; environment only (v2.1.287+)
CLAUDE_CODE_SYNC_SKILLS=1 # Make a -p run download the skills enabled for your claude.ai account and wait for the list before its first query; since v2.1.311 a session with feature-flag fetching off reuses a list up to 10 minutes old that another session on the machine fetched; in an interactive session the variable needs v2.1.323 or later
CLAUDE_CODE_DISABLE_NESTED_SESSION_ID=1 # On a self-hosted runner, let claude -p run inside a session share that session's ID and transcript (v2.1.317+)
CLAUDE_CODE_DISABLE_CFC_PROMPT=1 # Keep the Claude in Chrome tools but leave the Chrome section out of the system prompt; in VS Code (v2.1.314+) also out of a session's messages (v2.1.257+)
FORCE_HYPERLINK=0 # Render terminal hyperlinks as plain text; =1 forces OSC 8 links on where detection misses them. false, no, and off also turn links off since v2.1.314 (they turned them on before)
CLAUDE_CODE_DISABLE_LOOPED_CROSS_CERT_DROP=1 # Keep system cross-certificates that certify each other in a loop, for a private CA that needs one (v2.1.316+)
OTEL_EXPORTER_OTLP_TIMEOUT=25000 # OTel's standard export timeout (milliseconds by the OTel convention); since v2.1.323 an OTLP export behind a proxy has 25 seconds to reach the collector, which is also the most this variable can allow (v2.1.317 to v2.1.322: 10 seconds, or this value up to 30 seconds); release notes only, the env-vars page has no row for it
CLAUDE_CODE_NONSTREAMING_TIMEOUT_RETRIES=2 # Cap re-sends of a non-streaming fallback request that timed out (v2.1.285+)
CLAUDE_CODE_OVERLOADED_RETRY_BASE_DELAY_MS=5000 # Starting delay of the exponential backoff between retries of a 529 overloaded request, default 500; whole milliseconds from 500 to 32000; no effect with CLAUDE_CODE_RETRY_WATCHDOG=1 or in fast mode (v2.1.292+)
CLAUDE_CODE_OVERLOADED_RETRY_MAX_DELAY_MS=60000 # Ceiling of that backoff, default 32000 ms; whole milliseconds from 32000 to 300000, and values above 64000 need v2.1.323 (v2.1.296+)
CLAUDE_CODE_RETRY_WATCHDOG=1 # Unattended sessions: retry 429 and 529 capacity errors indefinitely, backing off up to 5 minutes or until the limit resets (v2.1.186+)
CLAUDE_CODE_RETRY_WATCHDOG_MAX_WAIT_MS=1800000 # Cap, per request, on how long the watchdog waits out 429 and 529 errors; unset means no limit (v2.1.295+)
CLAUDE_CODE_RETRY_WATCHDOG_MAX_USAGE_LIMIT_WAIT_MS=3600000 # Under the watchdog, end a request at a usage limit that resets further away than this instead of waiting it out (v2.1.301+)
CLAUDE_CODE_RETRY_WATCHDOG_USAGE_LIMIT_RECHECK_MS=60000 # Minimum interval between checks that a usage limit was lifted before its reset, while the watchdog waits on it (v2.1.305+)
CLAUDE_CODE_RESTRICTED=1 # Restricted mode: no command/code tools or WebFetch unless named in --tools; only managed settings and --settings load; ignored in a settings file's env block (v2.1.248+)
CLAUDE_CODE_DISABLE_DANGEROUS_RM_TIMEOUT=1 # Turn off the 2-minute limit and the denials on critical-path rm/rmdir; launch environment only, a copy in a settings env block is ignored (v2.1.281+; see the note below)
CLAUDE_CODE_DISABLE_SUBSTITUTION_RM_PROMPT=1 # Skip the prompt for a recursive rm whose target is only command-substitution output, such as rm -rf "$(pwd)" (v2.1.281+)
CLAUDE_CODE_STRICT_INLINE_SHELL_RM_PROMPT=1 # Flag more of the shell -c scripts Claude Code cannot check, including ones that name neither rm nor rmdir; set it in the launch environment, not a settings env block; no effect when CLAUDE_CODE_DISABLE_INLINE_SHELL_RM_PROMPT is 1 (v2.1.299+)
DISABLE_COST_WARNINGS=1 # Hide cost warnings
DISABLE_PROMPT_CACHING=1 # Disable prompt caching globally
DISABLE_PROMPT_CACHING_SONNET=1 # Disable for Sonnet only
DISABLE_PROMPT_CACHING_OPUS=1 # Disable for Opus only
ENABLE_PROMPT_CACHING_1H=1 # Opt into 1-hour prompt cache TTL (v2.1.108+; for API key, Bedrock, Agent Platform, Foundry, and Claude Platform on AWS users)
ENABLE_PROMPT_CACHING_1H_BEDROCK=1 # Deprecated alias for the above; v2.1.108+ still honors it on Bedrock but logs a deprecation notice
FORCE_PROMPT_CACHING_5M=1 # Force 5-minute cache TTL (v2.1.108+)
CLAUDE_CODE_PROMPT_CACHE_TTL=1h # Main-conversation cache TTL, 5m or 1h; beats the promptCacheTtl setting (v2.1.242+)
CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL=5m # TTL for subagents, workflows, forks, compaction, titles; beats subagentPromptCacheTtl (v2.1.242+)
ENABLE_TOOL_SEARCH=auto # MCP tool search: unset or true defers MCP tools (the default); auto defers once definitions reach 10% of the context window; auto:N sets the threshold; false loads every tool upfront (see the note below)
CLAUDE_CODE_HIDE_CWD=1 # Hide the working directory in the startup logo (v2.1.119+)
CLAUDE_CODE_FORK_SUBAGENT=0 # Turn fork subagents off; on by default in the terminal and, since v2.1.302, in claude -p, the Agent SDK, the desktop app, and VS Code (claude mcp serve never offers them)
CLAUDE_CODE_FORCE_SYNC_OUTPUT=1 # Force synchronized terminal output when auto-detection misses it, such as Emacs eat (v2.1.129+)
CLAUDE_CODE_SESSION_ID=... # Read-only: set in Bash and PowerShell tool subprocesses, hook commands, and stdio MCP server subprocesses; for Bash, PowerShell, and hooks it matches the session_id passed to hooks and updates on /clear (v2.1.132+)
CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1 # Skip the fullscreen alternate-screen renderer; keep the conversation in the terminal's native scrollback (v2.1.132+)
CLAUDE_EFFORT=... # Read-only: current effort level inside hooks and Bash tool subprocess (v2.1.133+)
CLAUDE_CODE_FORWARD_SUBAGENT_TEXT=1 # Include subagent text + thinking in stream-json output; pairs with --forward-subagent-text (v2.1.211+). Covers depth-2+ nested subagents as of v2.1.219
CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION=200 # Per-session WebSearch cap (default 200; v2.1.212+). Since v2.1.290 an interactive session's budget refills instead of ending at 200 (next line)
CLAUDE_CODE_WEB_SEARCH_REFILLS_PER_HOUR=100 # WebSearch budget refill rate: 100 calls/hour by default in an interactive session, 0 (off) in a non-interactive one (v2.1.290+)
CLAUDE_CODE_DISABLE_ATTACHMENTS=1 # Send @-mentions as plain text instead of expanding file content; a repo's .claude/settings.json or settings.local.json can no longer set it (v2.1.290)
CLAUDE_CODE_DISABLE_FILE_MENTIONS=1 # Hand Claude the path of an @ mention to read with its file tools, not the file's contents, so PreToolUse hooks see the read; ignored in project and local settings (v2.1.299+)
CLAUDE_CODE_WEBFETCH_CACHE_TTL_MS=900000 # WebFetch per-URL session cache TTL (default 15 min; v2.1.233+)
CLAUDE_CODE_WEBFETCH_DEADLINE_MS=300000 # WebFetch hard deadline: a server that never finishes its response fails the fetch after 300s by default; 0 disables (v2.1.268+)
CLAUDE_CODE_PROJECT_DIR_NAME=myproj # Short name for the per-project transcript directory, for hosts that give each session its own config dir (v2.1.234+)
CLAUDE_CODE_GOAL_CHECKIN_MINUTES=30 # How long background tasks may keep a /goal waiting before Claude checks in on them; 0 disables (v2.1.234+)
CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION=200 # No-op since v2.1.224, when the 200-spawn cap and this variable were removed; limit subagents with CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS (default 20) and CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH (default 3)
CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS=20 # Cap on concurrently running subagents (default 20; a positive whole number, so it can be adjusted but not turned off; v2.1.217+)
CLAUDE_CODE_WORKFLOW_PREFIX_STAGGER_MS=0 # Upper bound in milliseconds on how long a workflow agent waits for a same-prefix sibling's first response before sending its own first request, so siblings read the cached prompt prefix; default 5000, and 0 disables the wait (v2.1.229+)
CLAUDE_CODE_LOOP_KEEPALIVE=1 # Run one extra iteration of an interactive self-paced /loop when its second or later iteration ends with nothing scheduled (v2.1.319+)
CLAUDE_CODE_PLUGIN_DIR_WATCH=0 # Mod reload when a mod's files change: 0 turns it off in every session; 1 turns it on in non-interactive sessions for a mod loaded with --plugin-dir, where it is on by default in interactive sessions (the env-vars page gives v2.1.287 as the floor). Since v2.1.321 headless sessions also reload mods in .claude/skills, and 0 turns that off
CLAUDE_CODE_WORKFLOW_MAX_CONCURRENT_AGENTS=64 # Raise the Workflow tool's per-run concurrent agent limit, 1-256, for inference-bound fan-outs (v2.1.269+)
CLAUDE_CODE_WORKFLOW_SUBAGENT_MODEL=sonnet # Run every workflow agent on one model while other subagents keep theirs (v2.1.296; documented in the release notes only)
CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH=3 # Number of subagent layers allowed below the main conversation (default 3); set 1 to turn nesting off; a positive whole number, so it can be adjusted but not removed (v2.1.217+)
以上各項的來源:149153283284290226230280282281233237235269272275276203221268547245295156157185193186232234251213250198191254394395396481527532536538
CLAUDE_CODE_DISABLE_DANGEROUS_RM_TIMEOUT 並不是「一律詢問我」的開關。 預設情況下,auto mode 在終端機中會針對關鍵路徑的刪除操作(例如 rm -rf ~)詢問您,並附帶兩分鐘倒數,在其他所有環境中則會拒絕。將此變數設為 1 時,文件指出在終端機、VS Code 聊天面板、-p 執行與 Agent SDK 工作階段中,這些刪除操作在 auto mode 下改由分類器決定;bypassPermissions 則是會跳出不限時提示的模式。若要每次都被詢問,請新增一條比對該指令的詢問規則:文件指出,這樣 Claude Code 即使在 auto mode 中也會詢問您,且不設時間限制。394
ENABLE_TOOL_SEARCH 依模型與供應商而異: 工具搜尋預設開啟,對 Opus 4.5、Sonnet 4.5、Haiku 4.5 及之後的模型,在 Agent Platform 上也是如此。在早於 Opus 4 與 Sonnet 4 的模型、較早的 Agent Platform 模型,以及託管於 Azure 的 Microsoft Foundry 部署上,Claude Code 會預先載入 MCP 工具,而 true 無法覆寫此行為。476
工具設定:
BASH_DEFAULT_TIMEOUT_MS=300000 # Foreground Bash/PowerShell command timeout (default 120000, 2 minutes)
BASH_MAX_TIMEOUT_MS=600000 # Maximum timeout Claude can set for a foreground Bash/PowerShell command (default 600000, 10 minutes); a ceiling above 2 hours also becomes the background-command maximum in unattended sessions
BASH_MAX_OUTPUT_LENGTH=50000 # Read-back window from the Bash working output file (default 30,000 chars, hard ceiling 150,000); ignored once the bashOutputMaxChars setting is set
CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR=1 # Return to the original working directory after each Bash or PowerShell command in the main session
MCP_TIMEOUT=60000 # MCP server startup timeout (default 30000, 30 seconds)
MCP_TOOL_TIMEOUT=600000 # MCP tool execution timeout (default 100000000, about 28 hours); HTTP, SSE, and claude.ai connector requests also time out after 60 s unless this or the per-server timeout is above 60000
MAX_MCP_OUTPUT_TOKENS=25000 # MCP output limit
CLAUDE_CODE_MAX_MCP_DESCRIPTION_LENGTH=8192 # One number replaces both default limits, for every server in the session: 4,096 characters for server instructions and for the description of a tool that loads upfront, and 16,384 for the description of a tool Claude loads through tool search; 8192 raises the first and lowers the second (v2.1.280+; see the note below)
CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS=120000 # Threshold before a long MCP tool call moves to the background (default 2 min; v2.1.212+)
CLAUDE_CODE_DISABLE_MCP_TASK_BACKGROUND=1 # Wait for an MCP task inside its tool call instead of moving it to the background at once; the 2-minute auto-background still applies (added in the v2.1.319 release notes; the env-vars page says v2.1.304 or later)
CLAUDE_CODE_DISABLE_MCP_TASKS=1 # Turn MCP tasks off; since v2.1.319 they run in the terminal without feature-flag fetching (Bedrock, Agent Platform, Foundry, LLM gateways, DISABLE_TELEMETRY)
CLAUDE_CODE_MCP_STARTUP_WAIT_MS=10000 # Bound how long the first non-interactive turn waits for still-connecting MCP servers; 0 = don't wait (v2.1.274+)
CLAUDE_CODE_TOOL_MEMORY_LIMIT=4G # Opt-in memory cap (cgroup) on Linux and WSL, shared by all Bash, PowerShell and, from v2.1.246, Monitor commands in the session; a bare number is bytes, suffixes K/M/G/T; 0 or off disables. A command that cannot stay under the cap is killed by the kernel, and nothing in its result names the cap (v2.1.233+)
CLAUDE_CODE_ENABLE_TODO_TOOLS=1 # Offer the TodoWrite/TaskCreate-family tools on models outside v2.1.268's allowlist (Claude 3.x, Opus 4.0-4.7, Sonnet 4.0-4.6, Haiku 4.5); elsewhere they are off unless set (first turned off on newer models in v2.1.233)
SLASH_COMMAND_TOOL_CHAR_BUDGET=15000 # Character budget for skill metadata shown to the Skill tool (default 1% of the context window, fallback 8,000; legacy name)
以上各項的來源:290268217235186283284215251295213397478481
CLAUDE_CODE_MAX_MCP_DESCRIPTION_LENGTH 一次設定兩個上限。 預設情況下,Claude Code 會將伺服器指示以及預先載入之工具的描述截斷在 4,096 個字元,並將 Claude 透過工具搜尋載入之工具的描述截斷在 16,384 個字元。此變數會以您設定的數字同時取代這兩者,因此 8192 會提高前者並降低後者。此變數需要 v2.1.280 或更新版本。Anthropic 託管於 api.anthropic.com 的部分 MCP 伺服器,其描述與指示會完整傳給 Claude(v2.1.299),此變數不會截斷它們。477
無人值守工作階段中的背景指令時間限制(v2.1.288+): 在 -p、Agent SDK、CI 與雲端工作階段中,背景執行的 Bash 與 PowerShell 指令會在時間限制到期後停止,也就是以 run_in_background 執行時所設定的 timeout(預設 30 分鐘;若 claude -p 的提示是以文字傳入而非透過 --input-format stream-json,則為 10 分鐘;最長 2 小時);指令被停止時,Claude 會收到通知。226478 終端機、桌面應用程式與 VS Code 工作階段的背景指令則沒有時間限制。231234
HTTP_PROXY=http://proxy:8080 # HTTP proxy
HTTPS_PROXY=https://proxy:8080 # HTTPS proxy
CLAUDE_CODE_GZIP_REQUEST_BODIES=0 # Turn off gzip compression of large request bodies sent to api.anthropic.com, on even with telemetry off since v2.1.300
NO_PROXY=localhost,example.com # Bypass proxy for domains
CLAUDE_CODE_CLIENT_CERT=/path/to/cert # mTLS certificate
CLAUDE_CODE_CLIENT_KEY=/path/to/key # mTLS private key
CLAUDE_CODE_CLIENT_KEY_PASSPHRASE=pass # mTLS passphrase
UI 與終端機:
CLAUDE_CODE_DISABLE_TERMINAL_TITLE=1 # Don't update terminal title
CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL=1 # Skip IDE extension install
CLAUDE_CODE_SHELL=/bin/zsh # Shell for Bash tool commands: a bash or zsh path; other shells such as fish are not supported and the value is ignored
USE_BUILTIN_RIPGREP=1 # Use included ripgrep (default)
CLAUDE_CONFIG_DIR=~/.myconfig # Custom config directory; not settable from project-settings env (v2.1.251)
IS_DEMO=1 # Hide sensitive UI elements
CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1 # Remove run_in_background and Ctrl+B and stop automatic backgrounding; MCP tasks and the Monitor tool still run in the background
CLAUDE_CODE_TMPDIR=/path/to/tmp # Override temp directory; not settable from project-settings env, nor are TMPDIR/TMP/TEMP (v2.1.251)
CLAUDE_CODE_DISABLE_1M_CONTEXT=1 # Hold all native-1M models to 200K via auto-compaction (v2.1.223 widened scope); also the opt-out for the v2.1.287 1M default on Bedrock/Agent Platform/Foundry/Claude apps gateway
CLAUDE_CODE_AUTO_COMPACT_WINDOW=200k # Auto-compact window, 100000 to 1000000 tokens; k and M suffixes since v2.1.304 (200k had set a 100K window), out-of-range values warn
CLAUDE_CODE_DISABLE_ULTRAREVIEW_TRUST_CHECK=1 # Let claude ultrareview run in a folder you have not trusted where it cannot ask, such as CI; environment only, not a settings env block (v2.1.309+)
CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS=150000 # Context size at which idle compaction applies, default 200000; values below 100000 are raised to 100000 (see the note below)
CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT=1 # Let unrecognized model IDs exceed the assumed context window (v2.1.223); that assumed window is 1M since v2.1.323, 200K before
CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS=120000 # Plugin marketplace git timeout (default 120s, was 30s)
CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS=1 # Remove built-in commit/PR instructions
CLAUDE_CODE_DISABLE_CRON=1 # Stop scheduled cron jobs mid-session
CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS=30000 # SessionEnd hooks time budget (default 1.5 s, raised to the highest per-hook timeout in settings files, up to 60 s)
CLAUDE_CODE_USE_POWERSHELL_TOOL=1 # PowerShell tool switch: 1 enables it on Linux/macOS/WSL (needs pwsh on PATH) and in Bedrock, Agent Platform and Foundry sessions on Windows with Git Bash; 0 turns it off; on by default on Windows for claude.ai and Console accounts, and automatic on Windows without Git Bash (v2.1.111+)
CLAUDE_CODE_DISABLE_MOUSE_CLICKS=1 # Disable mouse click/drag/hover in fullscreen mode; wheel scroll still works (v2.1.195+)
CLAUDE_ENABLE_STREAM_WATCHDOG=0 # Disable the streaming idle watchdog (on by default for all providers since v2.1.196: aborts+retries after 5 min of silence)
CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP=1 # Turn off automatic memory-pressure reaping of idle background shell commands (v2.1.193+)
CLAUDE_CODE_ENABLE_AWAY_SUMMARY=1 # Session recap override: 1 forces recaps on when awaySummaryEnabled is false, 0 forces them off; beats the setting and the /config toggle (v2.1.108+)
CLAUDE_CODE_BG_TASKS_REPORT_RUNNING=0 # Restore pre-v2.1.269 behavior: remote/headless sessions may report "waiting for your input" while background agents still run
CLAUDE_AX_SCREEN_READER=1 # Enable screen reader mode; same as --ax-screen-reader or "axScreenReader": true; ignored in project and local settings (v2.1.208 in the release notes; the env-vars page says v2.1.181 or later)
CLAUDE_AX_PREPARK_MS=50 # Screen reader mode: pause before writing a changed line; default 0 (v2.1.287+)
OTEL_LOG_RAW_API_BODIES=1 # Emit full API request/response bodies as OTel log events (v2.1.111+)
TRACEPARENT=00-... # W3C Trace Context parent (v2.1.110+, SDK/headless)
TRACESTATE=vendor=value # W3C Trace Context state (v2.1.110+, SDK/headless)
以上各項的來源:2902032938429419722927527626826928196108112114144176178213183230388481527
閒置壓縮: 在 settings.json 中設定 "idleCompaction": false 即可關閉此功能。此變數與設定隨 v2.1.299 的版本說明推出,版本說明指出兩者都需要 v2.1.290 或更新版本。自 v2.1.314 起,閒置壓縮也會在 VS Code 與桌面應用程式的 Code 分頁中執行,關閉遙測的訂閱者也會執行閒置壓縮,並在開啟一小時提示快取後,於 Bedrock、Agent Platform、Foundry 與 LLM 閘道上執行。479
OpenTelemetry 匯出器與敏感欄位管控:265
OTEL_LOGS_EXPORTER=none # OTel logs exporter (supports 'none' for disable; v2.1.85 fixed crash)
OTEL_METRICS_EXPORTER=none # OTel metrics exporter (supports 'none'; v2.1.85 fixed crash)
OTEL_TRACES_EXPORTER=none # OTel traces exporter (supports 'none'; v2.1.85 fixed crash)
OTEL_LOG_TOOL_CONTENT=1 # Opt in to emitting tool content in OTel spans (v2.1.101+, sensitive by default)
OTEL_LOG_TOOL_DETAILS=1 # Opt in to tool_parameters in OTel tool_result events (v2.1.85+); as of v2.1.273 also puts real agent, skill, plugin, and MCP server names on cost and token metrics
OTEL_LOG_USER_PROMPTS=1 # Opt in to emitting user prompts in OTel traces (v2.1.101+, sensitive by default)
OTEL_LOG_ASSISTANT_RESPONSES=0 # Gate the claude_code.assistant_response log event holding the model's response text (v2.1.193+)
OTEL_METRICS_INCLUDE_REPOSITORY=true # Tag OTel metrics and events with vcs.* repository attributes; with OTEL_LOG_TOOL_DETAILS, commit events carry vcs.ref.head.* (v2.1.269+)
CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH=61440 # Maximum length of content-bearing OTel attributes, truncation marker included, in UTF-16 code units (default 61440, which is 60 KB; v2.1.214+)
OTEL_RESOURCE_INCLUDE_HOST=1 # Add host.name and host.id to OTel resource attributes, off by default; ignored in project and local settings (v2.1.326+)
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 # Disable nonessential traffic: auto-updates, telemetry, error reporting, /feedback, release notes, PR/MR badge checks, availability checks, and feature-flag fetching; any non-empty value counts, 0 and false included; v2.1.110 also stopped the auto-title Haiku request in headless/SDK when set; v2.1.290 also skips the startup connection warm-up
CLAUDE_CODE_ATTRIBUTION_HEADER=0 # Omit the system-prompt attribution block; behind a Claude apps gateway, set it in the env of the gateway's code or cli policy (v2.1.299+)
以上各項的來源:214213187232290268269538547
專案設定無法開啟遙測(v2.1.282): 專案與本機設定檔現在會忽略用來開啟匯出、設定端點或擷取內容的 OpenTelemetry 變數,例如 CLAUDE_CODE_ENABLE_TELEMETRY、OTEL_*_EXPORTER 選擇器以及 OTEL_LOG_*。用來關閉功能的值(匯出器選擇器的 none、內容旗標的 0)仍會從這些檔案生效。其餘設定請改放在 shell、使用者設定或受管設定中。當專案檔案設定了其中一項時,互動式工作階段會在啟動時顯示通知,/status 與 claude doctor 也會列出被忽略的名稱;-p 與 Agent SDK 工作階段不會顯示通知,因此升級後請確認您的收集器仍能收到資料。222224
v2.1.121+ 的 LLM 請求 span 屬性: stop_reason、gen_ai.response.finish_reasons 與 user_system_prompt 現在會在 LLM 請求 span 上發出。user_system_prompt 可能包含個人識別資訊(PII),因此需設定 OTEL_LOG_USER_PROMPTS=1 才會啟用。151
v2.1.122+ 的事件層級變更: api_request 與 api_error 記錄事件上的數值屬性以數字型別發出,這是採用嚴格型別結構描述的 OTel 收集器所需要的。claude_code.at_mention 記錄事件會在 Claude Code 解析 @ 提及時觸發。151
v2.1.300 的屬性: api_request 事件將快取寫入拆分為 cache_creation_5m_tokens 與 cache_creation_1h_tokens;追蹤 span 帶有 GenAI 語意慣例屬性(gen_ai.provider.name、gen_ai.conversation.id、gen_ai.tool.name、error.type);user_prompt 事件與互動 span 記錄的是經 mod 的 prompt.submit hook 改寫後的提示;在 reftable 儲存庫中執行 git commit -q 之後,tool_result 事件會帶有 git_commit_id。270
v2.1.301 與 v2.1.302 的屬性: tool_decision 事件帶有 classifier_verdict 與 permission_mode,讓自動模式分類器的判定能與權限規則區分開來;設定 OTEL_LOG_TOOL_DETAILS=1 後,還會帶有 classifier_category,指出分類器封鎖所符合的內建規則(v2.1.301);v2.1.302 為大多數分類器封鎖補上 classifier_category,並在 OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT 偏低時仍保留事件上的 tool_use_id、tool_source 與 tool_parameters。272273
v2.1.307 的事件: 每當權限規則、自動模式、安全檢查、hook 或沙箱攔下、提示或退回某次工具呼叫時,claude_code.safety_event 就會觸發;除了回合結束事件以外,該事件都帶有 tool_use_id。監控文件已列出此事件,以及 classifier_verdict、permission_mode 與 classifier_category。275276295 Claude Code 自 v2.1.312 起不再發送 claude_code.safety_event;上述屬性不受影響。281
v2.1.312 至 v2.1.317 的遙測: 指標、事件與 span 帶有 anthropic.plan、anthropic.seat_type、anthropic.provider 與 anthropic.custom_base_url(v2.1.317);對於官方 Anthropic 市集中的 plugin 所宣告的固定 URL 遠端 MCP 伺服器,mcp_server.name 會回報其真實名稱,而非 custom(v2.1.312);透過永不回應的代理伺服器向 https:// 端點匯出時,會在 25 秒後逾時,這也是 OTEL_EXPORTER_OTLP_TIMEOUT 所能允許的上限(v2.1.323+547)。這四個 anthropic.* 屬性僅見於版本說明。281282
v2.1.326 至 v2.1.332 的遙測: OTEL_RESOURCE_INCLUDE_HOST 會將 host.name 與 host.id 加入資源屬性,預設關閉(v2.1.326)。claude_code.llm_request 追蹤 span 帶有 gen_ai.usage.*、gen_ai.response.model 與 gen_ai.operation.name,且 gen_ai.usage.input_tokens 包含提示快取 token(v2.1.331)。開啟回應記錄時,Claude 透過 SendUserMessage 或 Cowork 的訊息工具傳送的文字會產生 assistant_response 事件,而除非設定 OTEL_LOG_ASSISTANT_RESPONSES=1,tool_input 只會顯示該文字的長度(v2.1.332)。桌面應用程式 Code 分頁的工作階段現在會將 service.name 回報為 claude-code-desktop:請更新以 claude-code 為鍵的篩選條件,或設定 OTEL_SERVICE_NAME 以保留舊名稱(v2.1.332)。當 OpenTelemetry 匯出器沒有端點、其資料很可能遺失時,/status 與 claude doctor 會加以提示(v2.1.328)。527
v2.1.193+ 的 claude_code.assistant_response 記錄事件: Claude Code 可以將模型的完整回應文字作為 OTel 記錄事件發出,由 OTEL_LOG_ASSISTANT_RESPONSES 控制。這個開關有一個值得留意的升級陷阱:當 OTEL_LOG_ASSISTANT_RESPONSES 未設定時,它會跟隨 OTEL_LOG_USER_PROMPTS,因此任何已在記錄提示內容的部署,升級後都會開始收到助理回應的內容。若要讓遙測僅限提示內容,請設定 OTEL_LOG_ASSISTANT_RESPONSES=0。176
v2.1.214 的遙測新增項目: OTel 記錄事件現在帶有 message.uuid、client_request_id 與 tool_source 屬性,用於訊息層級的關聯與工具來源追溯;subagentStatusLine 酬載加入了 subagent 的推理強度(v2.1.323 移除了 subagentStatusLine 設定:subagent 列一律使用預設外觀,而仍保有此鍵的設定檔會照常載入527);新的 CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH 環境變數則可設定 OTel 內容屬性的 60 KB 截斷上限。187
v2.1.265 的閘道遙測: 當閘道的受管設定在 OTEL_EXPORTER_OTLP_ENDPOINT 中指定了收集器時,Claude apps 閘道工作階段現在會將 OpenTelemetry 直接匯出到該收集器,而不再經由閘道的中繼;未指定收集器的工作階段則繼續使用中繼。同一版本也在 Claude Desktop 與 Cowork 透過 Claude apps 閘道傳送的遙測中加入 user.email 與 user.groups,與終端機工作階段一致。212
v2.1.280 的 hook 遙測: hook_execution_complete OTel 事件現在帶有 hook 輸出大小,以及因過大而存入檔案的輸出數量。217
v2.1.287 的 prompt_text: user_prompt 事件現在帶有 prompt_text,這是 prompt 的副本,供會將點號分隔鍵名巢狀化的後端使用。凡是您的管線會捨棄或遮罩 prompt 的地方,也請對 prompt_text 做同樣處理。229
API / 模型控制:265
CLAUDE_CODE_EXTRA_BODY='{...}' # Inject extra body fields into API calls; v2.1.113 fixed 400 errors with output_config.effort on Vertex/subagent calls
CLAUDE_CODE_MAX_CONTEXT_TOKENS=200000 # Context window size Claude Code assumes for the active model; for a model routed through ANTHROPIC_BASE_URL whose window differs from the built-in size for its name (v2.1.98 fixed it to honor DISABLE_COMPACT); since v2.1.325 it also sets the window of unrecognized model IDs that start with claude-, such as a gateway's claude-sonnet-latest
CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS=25000 # Override default token limit for file read operations (v2.1.0+); a Read call with allow_large can pass it when the context has room (v2.1.296+)
CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK=1 # Do not fall back to non-streaming API on streaming failures (v2.1.83+)
CLAUDE_CODE_DISABLE_STRUCTURED_OUTPUTS=1 # Stop sending structured outputs, for Mantle or gateways that reject them; session titles, memory recall, and prompt hooks failed there before (v2.1.288+)
ANTHROPIC_BETAS=beta1,beta2 # Enable beta API headers; v2.1.78 fixed silent ignore on Haiku models
ANTHROPIC_SMALL_FAST_MODEL=arn:... # Deprecated: set ANTHROPIC_DEFAULT_HAIKU_MODEL instead, which also sets the model for background functionality (Bedrock ARN supported)
Plugins / MCP:265215268233398527
CLAUDE_CODE_PLUGIN_CACHE_DIR=~/.claude/plugins # Plugins root directory (the default is shown): despite the name it sets the parent directory, and marketplaces and the plugin cache live in subdirectories under it (v2.1.72 fixed it creating literal '~' directories)
CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE=1 # Preserve plugin marketplace cache when git pull fails (offline-friendly; v2.1.90+)
CLAUDE_CODE_MCP_SERVER_NAME=server1 # Passed to MCP headersHelper scripts so one helper can serve multiple servers (v2.1.85+)
CLAUDE_CODE_MCP_SERVER_URL=https://... # Passed to MCP headersHelper scripts alongside the name (v2.1.85+)
MCP_SDK_GENERATION=v1 # Runs the v2 MCP client in a compatibility mode (earlier handshake, relaxed OAuth sign-in checks); the v1 client is removed (v2.1.323+), and v2 is the default everywhere
MCP_PROTOCOL_NEGOTIATION=legacy # Opt out of MCP 2026-07-28 protocol negotiation: with direct HTTP servers (default everywhere as of v2.1.274) and, since v2.1.292, with local (stdio) servers on every install, Bedrock, Agent Platform, and Foundry included and, since v2.1.299, with cloud session and Remote Control connectors
CLAUDE_CODE_SHELL_PREFIX=/path/to/logger.sh # Wrapper for the shell commands Claude Code spawns; it receives each command line as $1 and must run it, e.g. exec bash -c "$1" (v1.0.61+; see the note below)
CLAUDE_CODE_GIT_BASH_PATH='C:\Program Files\Git\bin\bash.exe' # Windows only: path to Git Bash's bash.exe when it is not on PATH; in a settings.json env block write "C:\\Program Files\\Git\\bin\\bash.exe"; since v2.1.219 an invalid path is ignored with a warning instead of stopping startup
CLAUDE_CODE_EXIT_AFTER_STOP_DELAY=60000 # SDK: exit after N ms idle (v2.0.35+)
CLAUDE_CODE_AUTO_CONNECT_IDE=false # Disable IDE auto-connection (v1.0.61+)
CLAUDE_CODE_SHELL_PREFIX 需要的是包裝指令碼。 此前綴會包住 Claude Code 啟動的 shell 指令:Bash 工具呼叫、hook 指令、狀態列指令,以及 stdio MCP 伺服器的啟動指令(PowerShell hooks 與 exec 形式的 hooks 不經過它)。設為 /path/to/logger.sh 時,每個指令都會以 /path/to/logger.sh '<command>' 的形式執行:包裝程式會在 $1 中收到指令列,形式為以 shell 引號包住的單一引數,並必須以 shell 重新評估它,例如 exec bash -c "$1"。文件警告,若將 $1 視為單純的執行檔路徑,傳入 npx -y <package> 等引數的 stdio MCP 伺服器將無法運作。同一個包裝程式也會位於您的 hook 指令之前,因此設定後請確認這些指令仍能執行。480
CLAUDE_CODE_PROXY_RESOLVES_HOSTS=1 # Opt into proxy-side DNS resolution (v2.0.55 moved this from default-on to opt-in)
CLAUDE_CODE_API_KEY_HELPER_TTL_MS=300000 # TTL for dynamically generated API keys via apiKeyHelper (apiKeyHelper refresh added v0.2.74 with 5-min default; env var added v0.2.117)
CLAUDE_CODE_PROCESS_WRAPPER=/path/to/wrapper # Launch the processes Claude Code starts from its own binary through a corporate launcher; same as the processWrapper setting (variable v2.1.208+, setting v2.1.210+). Set it in the env block of user or managed settings, not as a shell export; ignored on Windows
Skill 變數(v2.1.69+):108
${CLAUDE_SKILL_DIR} # Self-reference for skills to locate their own directory
SDK 呼叫者身分(v2.1.51+):
CLAUDE_CODE_ACCOUNT_UUID=uuid # Provide account UUID synchronously for SDK callers
CLAUDE_CODE_USER_EMAIL=user@example.com # Provide user email for SDK callers
CLAUDE_CODE_ORGANIZATION_UUID=uuid # Provide organization UUID for SDK callers
偵錯:399
DEBUG=1 # Enable debug mode, same as --debug (log at ~/.claude/debug/<session-id>.txt)
CLAUDE_CODE_DEBUG_LOG_LEVEL=verbose # Minimum level written to the debug log: verbose, debug (the default), info, warn, or error
參考資料
-
Claude Code CHANGELOG,2.1.0 章節,擷取於2026年11月11日:「Added automatic skill hot-reload」;「Added
languagesetting to configure Claude’s response language」;「AddedrespectGitignoresupport insettings.jsonfor per-project control over @-mention file picker behavior」;「AddedIS_DEMOenvironment variable to hide email and organization from the UI, useful for streaming or recording sessions」;「Changed Shift+Enter to work out of the box in iTerm2, WezTerm, Ghostty, and Kitty without modifying terminal configs」。 ↩ -
GitHub 發行版本。v2.1.4:新增 CLAUDE_CODE_DISABLE_BACKGROUND_TASKS 環境變數,修正「Help improve Claude」設定的 OAuth token 重新整理問題。2026年1月。 ↩
-
GitHub 發行版本。v2.1.5:用於覆寫暫存目錄的 CLAUDE_CODE_TMPDIR 環境變數。2026年1月。 ↩
-
Claude Code GitHub CHANGELOG。v2.1.49(2月19日):
--worktree(-w)旗標、subagents 的isolation: "worktree"、agent 定義的background: true、ConfigChangehook 事件、MCP OAuth 升級驗證(step-up auth)、SDK 的supportsEffort/supportedEffortLevels/supportsAdaptiveThinking欄位、CLAUDE_CODE_SIMPLE納入 Edit 工具、Sonnet 4.5 1M 版本移除並由 Sonnet 4.6 取代、WASM 記憶體修正、權限限制原因說明。v2.1.50(2月20日):WorktreeCreate/WorktreeRemovehooks、LSP 伺服器的startupTimeout、claude agentsCLI 指令、CLAUDE_CODE_DISABLE_1M_CONTEXT環境變數、Opus 4.6 快速模式支援完整 1M 上下文、CLAUDE_CODE_SIMPLE停用 MCP/hooks/CLAUDE.md、VSCode/extra-usage、agent teams 記憶體洩漏修正、LSP 診斷洩漏修正、Linux glibc < 2.30 修正,以及多項記憶體最佳化。 ↩ -
Claude Code v2.1.51 版本說明,GitHub,2026年2月24日,擷取於2026年11月11日:「Env var interpolation now requires an explicit
allowedEnvVarslist in the hook configuration.」;「HTTP hooks are now routed through the sandbox network proxy when sandboxing is enabled, enforcing the domain allowlist. HTTP hooks are not supported for SessionStart/Setup events.」Claude Code CHANGELOG,2.1.51 章節,同次擷取:「Addedclaude remote-controlsubcommand for external builds, enabling local environment serving for all users.」;「Added support for custom npm registries and specific version pinning when installing plugins from npm sources」;「Updated plugin marketplace default git timeout from 30s to 120s and addedCLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MSto configure.」;「Tool results larger than 50K characters are now persisted to disk (previously 100K).」;「BashTool now skips login shell (-lflag) by default when a shell snapshot is available, improving command execution performance.」;「Fixed a security issue wherestatusLineandfileSuggestionhook commands could execute without workspace trust acceptance in interactive mode.」;「The/modelpicker now shows human-readable labels」。協調多個 Claude Code 工作階段組成的團隊,Claude Code 文件,同次擷取,涵蓋隊友的計畫核准,以及「使用 hooks 強制執行品質關卡」一節中的TeammateIdle與TaskCompletedhooks。 ↩ -
GitHub Releases。v2.1.69:/claude-api skill、InstructionsLoaded hook 事件、hook 事件中的 agent_id/agent_type/worktree、${CLAUDE_SKILL_DIR}、/reload-plugins、sandbox.enableWeakerNetworkIsolation、includeGitInstructions 設定、remote-control 自訂名稱、Voice STT 新增 10 種語言(共 20 種)、effort 層級顯示、Ctrl+U 退出 bash、數字鍵盤支援、Sonnet 4.5→4.6 自動遷移。70 多項錯誤修正。2026年3月5日。 ↩↩
-
GitHub Releases。v2.1.72:搭配 ANTHROPIC_BASE_URL 的工具搜尋、/copy 中以 w 鍵寫入檔案、/plan 描述引數、ExitWorktree 工具、CLAUDE_CODE_DISABLE_CRON、擴充的 bash 允許清單(lsof/pgrep/tput/ss/fd/fdfind)、Agent 工具恢復 model 參數、簡化的 effort 符號(○/◐/●)、/config 導覽改善、bundle 大小減少 510KB、VSCode URI 處理器。2026年3月10日。 ↩
-
GitHub Releases。v2.1.74:
/context可採取行動的建議。autoMemoryDirectory設定。--plugin-dir覆寫行為變更。CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS可設定的逾時。受管理政策強制執行修正(ask 規則被使用者 allow 繞過)。記憶體洩漏修正(串流緩衝區)。RTL 文字算繪修正。MCP OAuth 修正。2026年3月12日。 ↩ -
Claude Code CHANGELOG。v2.1.105 至 v2.1.112 的主要來源。v2.1.105(PreCompact hooks 可以阻擋、
monitorsplugin 資訊清單、EnterWorktree路徑參數、/proactive別名、skill 描述上限提高至1536)。v2.1.107(思考提示時機)。v2.1.108(ENABLE_PROMPT_CACHING_1H、Session Recap//recap、模型可透過 Skill 工具呼叫內建斜線指令、/undo別名、/model對話中途切換警告)。v2.1.109(延伸思考指示器)。v2.1.110(/tui//tui fullscreen、Remote Control 的推播通知工具、/focus與Ctrl+O分離、autoScrollEnabled、--resume/--continue可復原排程任務、可從 Remote Control 用戶端使用/context//exit//reload-plugins、停用遙測的使用者也能使用 Session Recap、TRACEPARENT/TRACESTATE分散式追蹤、Write 工具會在使用者編輯了差異內容時告知模型、針對 PermissionRequest hooks 與在編輯器中開啟的安全性強化)。v2.1.111(Opus 4.7 上市支援、xhigh努力等級、/effort互動式滑桿、Max 方案無需旗標即可使用 Auto Mode、/less-permission-prompts、/ultrareview、「Auto (match terminal)」主題、透過CLAUDE_CODE_USE_POWERSHELL_TOOL啟用的 Windows PowerShell 工具、以 glob 模式減少唯讀 Bash 權限提示、/setup-vertex與/setup-bedrock改進、OTEL_LOG_RAW_API_BODIES)。v2.1.112(Auto Mode 下 Opus 4.7「暫時無法使用」的緊急修正)。另請參閱:GitHub 部落格:Opus 4.7 正式推出、Cyber Verification Program 表單。 ↩ -
Claude Code CHANGELOG,綜合參考 v2.1.116(2026年4月20日)、v2.1.117(2026年4月22日)、v2.1.118(2026年4月23日)與 v2.1.119(2026年4月23日)。v2.1.116:
/resume在 40MB 以上的工作階段快了 67%;多個 stdio 伺服器時 MCP 啟動更快(resources/templates/list延後至首次@提及時才載入);內嵌思考旋轉指示器(「still thinking」、「thinking more」、「almost done thinking」);/config搜尋現在也會比對選項值;/doctor可在回合進行中開啟;plugin 自動安裝缺少的相依套件;Bash 工具會顯示ghGitHub API 速率限制提示;設定的 Usage 分頁立即顯示,且在用量端點受速率限制時仍可運作;透過--agent以主執行緒 agent 執行時,agent frontmatter 的hooks:會觸發;安全性修正:沙箱自動允許不再繞過針對/、$HOME或其他關鍵根目錄的rm/rmdir危險路徑檢查。(v2.1.116 所還原的 4月16日系統提示冗長度限制,記載於 150 的事後檢討中,而非 v2.1.116 的版本說明。)v2.1.117:外部建置可用
CLAUDE_CODE_FORK_SUBAGENT=1啟用分叉 subagents;透過--agent的主執行緒 agent 工作階段會載入 agent frontmatter 的mcpServers;即使專案釘選了不同模型,/model的選擇仍會在重新啟動後保留,且啟動標頭會顯示釘選來源;/resume提供過期工作階段摘要;預設並行啟動 MCP(本機與 claude.ai);plugin 安裝/更新/重新整理/自動更新時強制執行blockedMarketplaces/strictKnownMarketplaces;Advisor Tool 實驗性功能,附有標籤、深入了解連結,以及啟用時的啟動通知;cleanupPeriodDays保留期清理涵蓋~/.claude/tasks/、~/.claude/shell-snapshots/、~/.claude/backups/;OTeluser_prompt事件包含command_name/command_source(自訂與 MCP 名稱預設遮蔽,除非設定OTEL_LOG_TOOL_DETAILS=1);cost.usage/token.usage/api_request/api_error包含effort屬性;原生 macOS/Linux 建置以內嵌的bfs/ugrep經由 Bash 工具取代Glob/Grep;Pro/Max 在 Sonnet 4.6 與 Opus 4.6 上的預設 effort 現為high(原為medium);修正:Opus 4.7 工作階段原本以 200K 視窗而非原生 1M 計算/context,導致過早自動壓縮。v2.1.118:vim 視覺模式(v)與視覺行模式(V),支援選取、運算子與視覺回饋;/cost與/stats合併為/usage(保留輸入捷徑);透過/theme或~/.claude/themes/*.json使用具名主題(plugins 可隨附themes/目錄);hooks 可透過type: "mcp_tool"直接呼叫 MCP 工具;DISABLE_UPDATES環境變數封鎖所有更新路徑,包括手動的claude update(比DISABLE_AUTOUPDATER更嚴格);WSL 透過wslInheritsWindowsSettings原則繼承 Windows 端的受管設定;autoMode.allow/soft_deny/environment中的$defaults哨兵值可在內建清單之外加入自訂規則;「不再詢問」的 auto mode 選擇加入;claude plugin tag建立發行 git 標籤並驗證版本。v2.1.119:
/config設定(主題、編輯器模式、詳細輸出)會保存至~/.claude/settings.json,並遵循專案/本機/原則的優先順序;prUrlTemplate設定可讓頁尾的 PR 標記指向自訂的程式碼審查 URL,而非 github.com;CLAUDE_CODE_HIDE_CWD在啟動標誌中隱藏工作目錄;--from-pr接受 GitLab MR、Bitbucket PR 與 GitHub Enterprise PR 的 URL;--print遵循 agent 的tools:/disallowedTools:frontmatter;--agent <name>對內建 agents 遵循permissionMode;PowerShell 工具命令在權限模式下自動核准(與 Bash 一致);PostToolUse/PostToolUseFailurehook 輸入包含duration_ms(工具執行時間,不含權限提示與 PreToolUse hooks);subagent 與 SDK 的 MCP 伺服器重新設定會並行連線伺服器;安全性:blockedMarketplaces正確強制執行hostPattern與pathPattern項目;OTeltool_result與tool_decision事件包含tool_use_id;tool_result包含tool_input_size_bytes;狀態列 stdin JSON 包含effort.level與thinking.enabled;Vertex AI 上預設停用工具搜尋(以ENABLE_TOOL_SEARCH選擇加入)。 ↩ -
近期Claude Code品質問題報告的最新說明。Anthropic工程事後檢討,2026年4月23日。涵蓋三項各自獨立的品質退化問題,均於4月20日(v2.1.116)解決,並於4月23日為所有訂閱者重設用量上限:(1)推理強度預設值:2026年3月4日由
high改為medium,以減少讓 UI 看似凍結的極長延遲;4月7日回復,因為使用者表示寧可預設使用較高的智慧,並在處理簡單任務時自行選擇較低的 effort。影響Sonnet 4.6與Opus 4.6。(2)Prompt cache 思考清除錯誤:一項原本旨在對閒置超過一小時的工作階段清除一次較舊思考內容的變更,卻變成在該工作階段其後的每一輪都清除,導致健忘、重複,以及用量上限消耗加快。影響期間為3月26日至4月10日,於v2.1.101修復。影響Sonnet 4.6與Opus 4.6。(3)系統提示詞的簡潔性限制:4月16日加入,用以處理 Opus 4.7 過於多話的問題;該文章指出「其中一項評估顯示 Opus 4.6 與 4.7 都下滑了 3%」以及「這影響了 Sonnet 4.6、Opus 4.6 與 Opus 4.7」;於4月20日在 v2.1.116 中回復。Anthropic 聲明的改善措施:讓更多內部員工使用與公開版完全相同的建置、改進其內部使用的 Code Review 工具、更嚴格管控系統提示的變更並為每項變更執行一套廣泛的逐模型評估,以及對任何可能犧牲智慧表現的變更採取「浸泡測試期、更廣泛的評估套件與漸進式推出」。擷取於2026年11月11日。 -
Claude Code版本說明,為v2.1.121(2026年4月28日,00:31 UTC)與v2.1.122(2026年4月28日,22:05 UTC)的綜合參考。v2.1.121:
alwaysLoadMCP伺服器設定選項(略過工具搜尋延遲載入);MCP啟動時自動重試3次;claude plugin prune與--prune連鎖清理;/skills支援輸入即篩選;PostToolUse的hookSpecificOutput.updatedToolOutput從僅限MCP擴展至所有工具;.claude/skills/、.claude/agents/、.claude/commands/不再觸發--dangerously-skip-permissions提示;Vertex AI以X.509憑證為基礎的Workload Identity Federation(mTLS ADC);SDKmcp_authenticateredirectUri;OTel在LLM請求span中新增stop_reason、gen_ai.response.finish_reasons與user_system_prompt(須透過OTEL_LOG_USER_PROMPTS啟用);/terminal-setup啟用iTerm2剪貼簿存取,讓/copy可在tmux中使用;分頁標題遵循language設定;CLAUDE_CODE_FORK_SUBAGENT=1擴展至非互動式的claude -p;升級後啟動更快(版本說明啟動畫面移除了Recent Activity面板);claude.ai連接器針對相同上游URL去除重複。v2.1.122:ANTHROPIC_BEDROCK_SERVICE_TIER環境變數(default/flex/priority)以X-Amzn-Bedrock-Service-Tier傳送;/resume可依PR URL搜尋,涵蓋GitHub、GHE、GitLab、Bitbucket;/mcp顯示隱藏的連接器並附上移除重複項的提示,同時釐清瀏覽器授權後的未授權訊息;OTel新增claude_code.at_mention記錄事件,用於@提及的解析;api_request/api_error的數值屬性以數字輸出(先前為字串)。兩個版本中的重要修正:/usage約2GB的記憶體洩漏、圖片密集工作階段的RSS成長達數GB、--resume略過損毀的逐字稿行並修正大型外部建置工作階段當機、CWD被刪除或移動時的Bash復原、Bedrock在application inference profile上的thinking修正、Vertex/Bedrock在結構化輸出時對output_config額外輸入的拒絕、ToolSearch遺漏工作階段開始後才連線的非阻塞MCP工具、較新模型的圖片縮放上限由2576改為2000 px、bash模式中的!exit/!quit不再終止CLI、tmux/GNOME/Windows Terminal/Konsole上的回捲重複,以及格式錯誤的hooks項目不再使整個settings.json失效。 ↩↩↩ -
2026年5月6日讀取的版本說明:Claude Code v2.1.126版本說明、Claude Code v2.1.128版本說明、Claude Code v2.1.129版本說明、Claude Code v2.1.131版本說明、Claude Code CHANGELOG,以及
@anthropic-ai/claude-code的 npm registry 紀錄,其time欄位將 2.1.131 的時間記為 2026-05-06T07:41:53Z。v2.1.126新增了/model的閘道模型探索、claude project purge、OAuth程式碼貼上的後備機制、skill啟用的OTel、Windows上PowerShell作為主要shell的行為,並變更了--dangerously-skip-permissions受保護路徑的提示方式。v2.1.128為--plugin-dir新增zip支援、MCP工具數量與零工具的可見性、主控台驗證的--channels,修正了EnterWorktree,並修復了plugin/快取/MCP/工作階段的問題。v2.1.129新增了--plugin-url、CLAUDE_CODE_FORCE_SYNC_OUTPUT、CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE、skillOverrides、透過CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1選擇啟用的閘道模型探索,以及plugin manifest的themes/monitors驗證警告。v2.1.131修正了Windows上VS Code擴充功能的啟用以及Mantle端點驗證;版本說明並未宣布其他命令或設定的新增項目。 ↩↩↩ -
Claude Code v2.1.132版本說明。2026年5月6日。為Bash工具子程序新增
CLAUDE_CODE_SESSION_ID環境變數(與傳給hooks的session_id一致)。新增CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1環境變數,可選擇退出全螢幕替代畫面轉譯器,讓對話保留在終端機原生的回捲區中。更新/tui fullscreen啟動橫幅,說明轉譯器的更多優點(較低的記憶體用量、滑鼠支援、選取時自動複製)。另有20多項修正,涵蓋終端機/輸入處理(SIGINT、SSH斷線、終端機模式、游標定位)、文字編輯與貼上(emoji與字位損毀、vim運算子、跳脫序列、以/開頭的貼上內容後文字被吞掉)、UI/轉譯(休眠後全螢幕空白、捲動速度、滾輪處理、自動完成彈出視窗)、工作階段管理(--resume失敗、emoji截斷、計畫模式的--permission-mode旗標)、命令工具(/usage、/terminal-setup、/effort、/status、/login、/upgrade)、MCP伺服器整合(工具擷取、授權顯示、非協定資料、stdio MCP伺服器無限制的記憶體成長、tools/list重試)、平台特定問題(Windows Terminal、JetBrains IDE、macOS鍵盤、X11 Linux),以及設定ENABLE_PROMPT_CACHING_1H時Bedrock與Vertex的400錯誤。 ↩ -
Claude Code v2.1.133 版本說明。2026年5月7日。新增
worktree.baseRef設定(fresh|head);依版本說明所述:「the defaultfreshchangesEnterWorktree’s base back toorigin/<default>(it has been localHEADsince 2.1.128)」,以及「setworktree.baseRef: "head"to keep unpushed commits in new worktrees.」Hooks 現在可透過effort.levelJSON 輸入欄位與$CLAUDE_EFFORT環境變數取得目前的 effort 等級;Bash 工具的指令也能讀取$CLAUDE_EFFORT。新增sandbox.bwrapPath與sandbox.socatPath受管設定(Linux/WSL),可自訂 bubblewrap 與 socat 二進位檔的位置。新增parentSettingsBehavior管理層級鍵('first-wins' | 'merge'),可將 SDKmanagedSettings(父層級)納入政策合併。修正 subagents 無法透過Skill工具找到專案、使用者或 plugin skills 的問題。其他修正:平行工作階段中重新整理權杖後出現 401 的競態條件、磁碟根目錄允許規則的範圍、MCP OAuth 代理與 mTLS 支援、Remote Control 的停止/中斷可完整執行取消、跨工作階段的/effort外洩,以及--help中列出--remote-control。 ↩ -
Claude Code v2.1.174 版本說明、Claude Code v2.1.175 版本說明、Claude Code v2.1.176 版本說明 與 Claude Code Changelog(正式版)。2026年6月12日。v2.1.174:
wheelScrollAccelerationEnabled設定(在全螢幕模式下停用滑鼠滾輪捲動加速);/model選擇器會將 Default 實際解析到的模型系列獨立顯示為一列(Max/Team Premium/Enterprise 與隨用隨付 API 為 Opus,Pro/Team 為 Sonnet);當ANTHROPIC_DEFAULT_SONNET_MODEL釘選了不同的 Sonnet 時,/model選擇器不再顯示寫死的 Sonnet 標籤;VSCode 的「Account & usage」對話框(/usage)新增歸因資訊,顯示快取未命中、長脈絡、subagents,以及過去 24 小時或 7 天內依 skill/agent/plugin/MCP 的細項;修正 Bedrock GovCloud(us-gov-*)推論設定檔前綴被推導為global而非us-gov、背景工作階段繼承其他工作階段的ANTHROPIC_*供應商環境變數、git commit 共同作者的模型名稱歸屬、/advisor預先選取被封鎖的 advisor 模型、skill 熱重載重新傳送整份清單,以及企業用量計費帳戶出現 Fable 5「consuming usage credits」橫幅等問題。v2.1.175:
enforceAvailableModels受管設定:啟用後,availableModels允許清單也會約束 Default 模型(若 Default 解析到不允許的模型,會改用第一個允許的模型),且使用者/專案設定再也無法擴大受管的availableModels清單。v2.1.176:工作階段標題會以您對話所用的語言產生(設定language可釘選特定語言);footerLinksRegexes設定可在頁尾列顯示以正規表示式比對的連結徽章(使用者或受管設定);來自awsCredentialExport的 Bedrock 憑證會快取至其Expiration為止,而非固定一小時;availableModels的強制執行已強化,別名選擇無法再透過ANTHROPIC_DEFAULT_*_MODEL轉向被封鎖的模型,且/fast會拒絕切換到允許清單之外的模型;對於沒有 Opus 4.8 的組織,auto 模式會從 Fable 5 退回到可用的最佳 Opus;針對 Read/Edit/Write 工具路徑的 hookif條件(Edit(src/**)、Read(~/.ssh/**)、Read(.env))現在可正確比對;修正 Linux 沙箱在設定檔為符號連結時的啟動問題;/copy與滑鼠選取複製可在透過 SSH 連線的 tmux 中送達系統剪貼簿;/cd與 worktree 切換不再回報前一個目錄的 git 分支;另有多項 Remote Control、claude agents與背景工作階段的修正。擷取於2026年6月15日。 ↩↩↩↩ -
Claude Code v2.1.181 版本說明 與 v2.1.183 版本說明,以及 Claude Code Changelog(正式版)。2026年6月17日至19日。v2.1.181:
/config key=value可直接在提示列設定任何設定值(例如/config thinking=false),互動模式、-p與 Remote Control 皆適用;sandbox.allowAppleEvents選擇加入設定讓沙箱內的指令可在 macOS 上傳送 Apple Events;CLAUDE_CLIENT_PRESENCE_FILE環境變數指向一個標記檔案,當您人在電腦前時可藉此抑制行動裝置推播通知;內建的 Bun 升級至 1.4;長段落改為逐行串流輸出;思考過程中 API 連線中斷會自動重試;subagent 面板閒置 30 秒後自動隱藏,且最多顯示 5 列。v2.1.183:auto 模式會在您未要求捨棄工作時封鎖具破壞性的 git 指令(git reset --hard、git checkout -- .、git clean -fd、git stash drop),也會封鎖對本工作階段中非由代理程式建立的 commit 執行git commit --amend,以及terraform destroy/pulumi destroy/cdk destroy,除非您明確指定該 stack;已棄用或自動升級模型的警告會在-p模式及 agent frontmatter 模型中顯示於 stderr;attribution.sessionUrl設定可將 claude.ai 工作階段連結從 commit 與 PR 中省略;/config --help列出簡寫鍵名;/configUI 可用 Enter/Space 切換,Esc 則儲存並關閉;移除了啟動時的「setup issues」提示行。(v2.1.180 與 v2.1.182 未發布。)擷取於2026年6月19日。 ↩ -
Claude Code v2.1.187 版本說明,以及 Claude Code Changelog(正式版)。2026年6月23日。v2.1.187:
sandbox.credentials設定可阻止沙箱內的指令讀取憑證檔案與機密環境變數;組織設定的模型限制適用於/model選擇器、--model、/model與ANTHROPIC_MODEL,選到受限模型時會顯示「restricted by your organization’s settings」訊息;全螢幕選單(權限提示、/model、/config)支援滑鼠點選;/install-github-app將 GitHub Actions 工作流程與 secret 的設定改為選用;/btw新增 ←/→ 瀏覽先前的回答;/plugin會列出近期未使用的 plugin 以便清理;claude --help現在列出--bg/--background旗標。修正項目:原始-p執行未產生任何模型回合時,--resume失敗並顯示「No conversation found」;--json-schema與 workflowagent({schema})的結構化輸出(成功後不再無限重複呼叫StructuredOutput;後續回合可穩定回傳結構化輸出);遠端 MCP 工具呼叫懸置 5 分鐘後現在會以錯誤中止;安裝 agent-proxy CA 信任後 Remote 工作階段啟動慢了約 2.7 秒;在以逐位元組擴充鍵事件傳遞貼上內容的終端機中,貼上韓文/CJK 文字出現亂碼;透過 Remote Control 執行/update時卡在啟動信任對話框;回合結束時沒有結構化輸出導致背景工作停留在「working」狀態;導覽至代理程式檢視 //bg//tui//update後 channel 中斷;代理程式停止通知的歸屬與措辭;resume/fork 時的 subagent 深度追蹤;清理外洩的代理程式 worktree 註冊;macOS 上 Ghostty 全螢幕的 Cmd+點選開啟 URL;/share上傳期間的 Esc/Ctrl-C/Ctrl-D;[VSCode] 延伸模組在恢復大型工作階段時無回應。擷取於2026年6月23日。 ↩ -
Claude Code Changelog(正式版),2026年6月25日至26日(v2.1.192 與 v2.1.194 未發布)。v2.1.193(6月25日): 新的
autoMode.classifyAllShell設定會將所有 Bash/PowerShell 指令交由自動模式分類器處理,而不再只處理任意程式碼執行的模式;自動模式的拒絕原因會加入逐字稿、拒絕通知以及/permissions的最近拒絕清單;新的claude_code.assistant_responseOpenTelemetry 記錄事件帶有模型的回應文字,除非設定OTEL_LOG_ASSISTANT_RESPONSES=1,否則會經過遮蔽處理。若未設定該變數,則沿用OTEL_LOG_USER_PROMPTS的設定,因此原本已記錄提示內容的部署在升級後會開始收到回應內容(設定OTEL_LOG_ASSISTANT_RESPONSES=0可維持只記錄提示);bash 模式(!)支援即時的檔案路徑自動完成;當 MCP 伺服器需要驗證時,啟動時會顯示通知並指向/mcp;閒置的背景 shell 指令會在記憶體壓力下自動回收(可用CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP=1停用);另修正了/login之後/model狀態過時、誤觸的背景化取消、幻影式的已恢復子代理程式生成,以及 MCPheadersHelper在 401/403 時重新驗證等問題。v2.1.195(6月26日): 新的CLAUDE_CODE_DISABLE_MOUSE_CLICKS環境變數可在全螢幕模式下停用滑鼠點擊/拖曳/懸停,同時保留滾輪捲動;含連字號識別碼的 hook 比對器(例如code-reviewer、mcp__brave-search)現在採用完全比對,而非子字串比對(若要比對含連字號 MCP 伺服器的所有工具,請使用mcp__brave-search__.*);另包含語音聽寫修正(macOS 裝置切換時的靜音問題;不以空格分詞的語言可自動送出)、外掛啟用/同意的修正,以及背景工作/代理程式常駐程序的可靠性修正。擷取於2026年6月30日。 ↩↩ -
Claude Code Changelog(正式版),2026年6月29日至7月2日。v2.1.196(6月29日): 組織預設模型;可讀性更佳的預設工作階段名稱;可點擊的檔案附件;
claude mcp list/get不再啟動由儲存庫自行核准的.mcp.json伺服器(不受信任的工作區會顯示待核准狀態);串流閒置看門狗預設開啟,可透過CLAUDE_ENABLE_STREAM_WATCHDOG=0停用;/code-review的搜尋器已合併(token 用量減少約25%);非 Anthropic 的ANTHROPIC_BASE_URL停用 Remote Control;背景工作階段的可靠性改進。v2.1.197(6月30日): Claude Sonnet 5 成為 Claude Code 的預設模型,原生支援100萬token上下文視窗,並於8月31日前享有每百萬token $2/$10 的推廣定價(公告)。v2.1.198(7月1日): subagents 預設在背景執行;Claude in Chrome 正式推出;背景代理在完成 worktree 程式碼工作後會提交、推送並開啟草稿 PR;Notificationhook 事件agent_needs_input/agent_completed;/datavizskill;Claude Platform on AWS 可作為閘道上游;Explore 代理繼承工作階段的模型(上限為 Opus);subagents 與壓縮作業繼承延伸思考設定;移除/agents精靈。v2.1.199(7月2日): 堆疊的斜線 skill 呼叫會載入所有前置 skills(最多5個);訂閱用戶遇到暫時性伺服器 429 時會自動重試;CLAUDE_CODE_RETRY_WATCHDOG將非容量因素的重試預設值提高至300,並解除CLAUDE_CODE_MAX_RETRIES的15次上限;大量針對背景代理、subagent 錯誤回報與 hook stderr 的修正。擷取於2026年7月3日。 ↩ -
Claude Code v2.1.207 版本說明。2026年7月。v2.1.207: Auto Mode 在 AWS Bedrock、Google Vertex AI 與 Microsoft Foundry 上不再需要
CLAUDE_CODE_ENABLE_AUTO_MODE選擇啟用,管理員可透過disableAutoMode受管設定將其停用;Bedrock、Vertex AI 與 Claude Platform on AWS 現在預設為 Claude Opus 4.8;autoMode設定不再從儲存庫的.claude/settings.local.json讀取(請改用~/.claude/settings.json);plugin 安全性:shell 形式的 plugin 命令會拒絕${user_config.*}插值(請改用 exec 形式或$CLAUDE_PLUGIN_OPTION_<KEY>環境變數),且pluginConfigs不再從專案層級的.claude/settings.json讀取。擷取於2026年7月17日。 ↩ -
Claude Code v2.1.208 版本說明、Claude Code 無障礙功能文件,以及 Claude Code 企業啟動器文件。2026年7月。v2.1.208: 螢幕閱讀器模式可透過
claude --ax-screen-reader、CLAUDE_AX_SCREEN_READER=1或"axScreenReader": true設定啟用,並記載於新的無障礙功能頁面;processWrapper設定/CLAUDE_CODE_PROCESS_WRAPPER環境變數會將 Claude Code 自行產生的所有程序導向一個包裝執行檔,以便與企業啟動器整合;vimInsertModeRemaps設定可定義 vim 插入模式的按鍵重新對應(例如jj→ Escape);命令替換($(...)、反引號、<(...))內的災難性刪除(如rm -rf ~)現在即使在--dangerously-skip-permissions與 auto 模式下也會提示確認。擷取於2026年7月17日。 ↩↩↩↩↩ -
Claude Code v2.1.211 版本說明。2026年7月。v2.1.211:
--forward-subagent-text旗標與CLAUDE_CODE_FORWARD_SUBAGENT_TEXT環境變數會將 subagent 的文字與思考輸出納入--output-format stream-json;「一律允許」的權限規則現在儲存在儲存庫根目錄,因此在某個 worktree 核准的權限會跨工作階段、跨該儲存庫所有 worktree 持續生效。擷取於2026年7月17日。 ↩ -
Claude Code v2.1.212 版本說明。2026年7月。v2.1.212:
/fork現在會將對話複製到一個新的背景工作階段,並在claude agents中擁有自己的一列,先前的工作階段內分支行為則改名為/subtask;新增claude auto-mode reset子命令,可搭配--yes略過確認;每個工作階段的預算:WebSearch 呼叫與 subagent 產生次數各預設為每個工作階段 200 次,分別透過CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION與CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION調整,/clear會重設 subagent 預算;執行超過 2 分鐘的 MCP 工具呼叫會自動移至背景,門檻可透過CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS設定;Task 工具的mode參數已棄用並被忽略,subagent 會繼承父工作階段的權限模式;企業版forceLoginMethod設定現在也對 VS Code 擴充功能、SDK、claude setup-token與/install-github-app強制生效(先前僅限終端機)。擷取於2026年7月17日。 ↩↩ -
Claude Code CHANGELOG,v2.1.214 條目。2026年7月。v2.1.214: 單一區段的
dir/**允許規則(例如Edit(src/**))現在只會比對<cwd>/dir,而非目錄樹中任何巢狀的dir/;deny/ask規則仍維持任意深度比對,hook 的if:條件也套用相同的 cwd 範圍限制(若要比對任意深度,請寫**/dir/**);權限的失敗即封閉(fail-closed)強化:修正 Windows PowerShell 5.1 的繞過問題、Bash 檔案描述元重新導向形式改為失敗即封閉、超過 10,000 個字元的命令一律提示確認、[[ ]]內的 zsh 下標/修飾符會提示確認、不安全的help/man變體不再自動核准、遠端工作階段的提示在本機確認前無法繼續、docker/Podman 的常駐程式重新導向旗標(--url、--connection、--identity、遠端模式)會提示確認,而file -m/--magic-file/-f/--files-from需要權限;新增 EndConversation 工具,可在遇到高度辱罵性輸入或越獄嘗試時結束工作階段;SessionStart hooks 對分支出來的工作階段回報來源為"fork"(先前為"resume");OTel 日誌事件新增message.uuid、client_request_id與tool_source屬性,CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH可設定 60 KB 的內容截斷上限,subagentStatusLine的酬載也包含推理強度。擷取於2026年7月21日。(v2.1.213 從未發布。) ↩↩ -
Claude Code CHANGELOG,v2.1.217 條目。2026年7月。v2.1.217: subagent 預設不再產生巢狀 subagent,可設定
CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH以允許更深的巢狀(推翻 v2.1.172 的遞迴產生預設值);新增同時執行中 subagent 的上限,預設為 20,可透過CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS覆寫;--max-budget-usd現在也會停止背景 subagent,一旦達到上限,新的產生請求會被拒絕,執行中的背景代理程式也會被中止;提示輸入支援 emoji 短碼自動完成(:heart:→ ❤️),可透過emojiCompletionEnabled設定停用。另有可靠性與隔離修正:符號連結的工作目錄會被正規化以確保背景工作階段隔離、受管理的OTEL_EXPORTER_OTLP_ENDPOINT統一管控所有訊號、轉錄寫入失敗的警告、MCP 截斷輸出的記憶體洩漏、Windows 自動更新的claude.exe還原、Bedrock Opus 4.8 自動壓縮、Claude Desktop 的企業 mTLS/TLS/OAuth/proxy 設定、--resume遇到格式錯誤附件的 TypeError、無法停止的背景 shell、大括號展開造成的 OOM、Remote Control 後加入者的提示、螢幕閱讀器修正、ssh/tmux 中可點擊的頁尾 PR 徽章(FORCE_HYPERLINK=0可停用)、登入到期警告從 5 天提前至 3 天,以及 frontend-design plugin 提示的顯示次數終身上限為 3 次。擷取於2026年7月22日。 ↩↩ -
Claude Code CHANGELOG,v2.1.219 與 v2.1.220 條目。2026年7月。v2.1.219(7月24日): 新增 Claude Opus 5(
claude-opus-5)作為新的預設 Opus 模型,具 1M 脈絡視窗,fast 模式定價為每 MTok $10/$50;新增sandbox.network.strictAllowlist設定,讓沙箱指令在不提示的情況下直接拒絕未列入允許清單的主機;新增DirectoryAddedhook,在/add-dir或 SDK 的register_repo_root控制請求於工作階段中途登錄新工作目錄後觸發;在 headless stream-json 的 init 事件中新增mcp_server_errors,列出因設定驗證而略過的--mcp-config項目(終端機執行時會印出啟動警告);新增workflowSizeGuideline設定鍵,讓建議性的 Dynamic workflow size 準則可由任一設定檔設定,設定後/config中對應的列會隱藏;stream-json 新增巢狀子代理程式轉送,設定--forward-subagent-text時,深度 2 以上產生的子代理程式也會出現,並以產生它們的 Agenttool_useid 作為鍵;動態工作流程改為預設採用中型規模準則(目標少於 15 個代理程式);將 Opus 4.7 自 fast 模式移除,/fast現在適用於 Opus 5 與 Opus 4.8;子代理程式現在預設可產生最深達第 3 層的巢狀子代理程式(原為 1);設定CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH=1可停用巢狀;更新claude-apiskill,預設改為 Claude Opus 5,並提供自 Opus 4.8 的遷移路徑;伺服器連線失敗時,claude mcp list與/mcp會顯示 HTTP 狀態與錯誤文字,並對含隱藏前導或尾端空白字元的 MCP 設定值提出警告;受管理的 MCP 允許清單/拒絕清單中的
${VAR}項目改由啟動環境與受管理設定的 env 解析,不再使用設定檔的 env;在執行中工作流程的狀態列加入目前的預設工作流程規模;修正下列問題:claude -p文字輸出在回合因串流中途的 API 錯誤而中止時遺失已產生的回答、Fable 列顯示過時的「Requires usage credits」標籤、/model選擇器將合併後的 Opus 列顯示為單純的「Opus」而非「Opus (1M context)」、新版本醒目標示範圍超出最新模型名稱、GNU screen 選取即複製時印出 base64、Remote Control 用戶端在模型切換/重新連線/組織檢查失敗後仍保留過時的 fast 模式狀態、Windows 上的CLAUDE_CODE_GIT_BASH_PATH在路徑並非 bash/sh 二進位檔時直接結束或被當作 bash 使用(現在會忽略並顯示警告)、Vim 模式在空白提示下按 ← 無法從 NORMAL 模式返回 agent 檢視,以及螢幕閱讀器模式在每次按鍵時重寫整行輸入;改善「Remote Control is only available via api.anthropic.com」錯誤訊息,使其指出造成此情況的設定,並讓claude --teleport在不符時顯示目前 checkout 指向的儲存庫。v2.1.220(7月25日): 僅有錯誤修正與可靠性改善,沒有面向使用者的功能、設定、指令或定價變更。擷取於2026年7月25日。 ↩↩↩ -
Claude Code v2.1.223 版本說明,2026年8月6日。新增
"owner/*"萬用字元項目至strictKnownMarketplaces與blockedMarketplaces;將/review設為/code-review的別名,並記住上次輸入的工作量等級(/code-review ultra進行深度雲端審查);擴大CLAUDE_CODE_DISABLE_1M_CONTEXT的範圍,讓所有原生 1M 模型透過自動壓縮維持在 200K 並於啟動時顯示警告,另新增CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT以處理無法辨識的模型 ID;安全修正涵蓋精心構造命令的 Bash 權限繞過、核准對話框中的不可見 Unicode 命令填充、workflow 指令碼動態import()的沙箱逃逸,以及 agent 定義的bypassPermissions忽略組織停用政策的問題。擷取於2026年8月6日。 ↩ -
Claude Code v2.1.224 版本說明,2026年8月7日。新增
claude self-hosted-runner(Team/Enterprise);macOS/Linux 上支援跨工作階段SendMessage,並可透過ListAgents探索,另有crossSessionInbound/dialogExpiry設定;archiveplugin 來源,可選擇以 SHA-256 鎖定;沙箱憑證遮罩選項extract/onExtractNoMatch、decode: "jwt"搭配maskClaims,以及awsPairs/sigv4(需要network.tlsTerminate;僅限 user/managed/--settings範圍);移除每個工作階段 200 個 subagent 的產生上限;修正長路徑的工作階段目錄跨越、結尾斜線的沙箱拒絕繞過,以及沙箱違規詳細資訊不可見的問題。擷取於2026年8月7日。 ↩ -
Claude Code CHANGELOG,2.1.248、2.1.250 與 2.1.251 各節,擷取於2026年8月30日。npm 於2026年8月27日 20:35 UTC 發布 2.1.248,同日 22:27 UTC 發布 2.1.250(其章節內容僅為逐字的「Bug fixes and reliability improvements」),並於2026年8月28日 15:34 UTC 發布 2.1.251(dist-tag latest:2.1.251);2.1.249 從未在 npm 上發布。2.1.248 原文:「Added
--restricted(orCLAUDE_CODE_RESTRICTED=1): removes the built-in tools that run commands or code andWebFetch(unless named in--tools), keeps file tools inside the working directory, refusesbypassPermissions, and ignores user, project and local settings files」;「Addedexperimental.cacheTtl("5m"or"1h") to agent frontmatter: a per-agent prompt cache TTL used when no subagent TTL setting is configured」;「Addedclaude self-hosted-runner --client-label <label>(orSELF_HOSTED_RUNNER_CLIENT_LABEL) to override the label the runner registers with (default: hostname)」;「Added server-managed settings diagnostics: a startup warning when the settings fail to load, and a/doctorand/statusline explaining a load failure or why they weren’t fetched (Bedrock/Vertex/third-party provider, customANTHROPIC_BASE_URL)」;「Added/usage-creditsfor Enterprise organizations billed through AWS Marketplace, self-serve Enterprise, and Enterprise trials, so members can request a higher usage limit from their admin」;「Added cross-session messaging (
SendMessage/ListAgents) between sessions on the same machine on Bedrock, Vertex, and Foundry, and when telemetry is disabled」;桌面版保留期修正:「the transcript cleanup now keeps desktop-written sessions while they are in the app (unless org policy manages retention); the newdesktopSessionCleanupPeriodDayssetting caps the exemption」;「Improved managed settings: client-side timeout, MCP startup-mode, and stream-watchdog env vars no longer trigger the settings-approval prompt」;「Changed/loop: self-paced dynamic mode and the no-prompt autonomous default are now always available, including on Bedrock/Vertex/Foundry」;「Improved the Workflow tool’s prompt footprint: its description is now about 1k tokens instead of 5.7k, with the script-writing reference moved into a bundledworkflow-authoringskill」;以及上傳修正:「Fixed/ultrareviewand locally seeded cloud sessions uploading uncommitted edits toprod.env-style and*.tfvarsfiles, or to editor swap, temp, and backup copies of credential files (e.g.key.pem.tmp,id_rsa.swo); they now stay on your machine」。2.1.251 原文:「Added
PreModelSwitchandPostModelSwitchhook events (block, confirm, or annotate a model switch);SessionStartresume hooks now receive session staleness and the estimated re-cache cost」;「Added live streaming of a foreground subagent’s tool calls and results to Remote Control clients (background subagents, the default, still show status only)」;「Added a Spend limit bar to/usageand arate_limits.spend_limitstatus line field for developers behind a Claude apps gateway with spend limits」;「Added a per-session prompt-cache line to/cost(hit ratio, misses, tokens re-cached, warm/cold) and a matchingprompt_cacheobject for status line scripts」;「Addedattach,logs,stop,respawn, andrmtoclaude --help; the--resumemessage for a running background session now names the exactclaude attach <id>command」;「Changed Claude in Chrome so browser actions always go through Claude Code’s permission checks, including in sessions with telemetry disabled, which previously used the Chrome extension’s own prompts」;「ChangedCLAUDE_CODE_SUBAGENT_MODELto set the default subagent model rather than override everything: an agent definition’smodel:and an explicit per-spawn model now take precedence over it」;「Changed the default model for seat-based Enterprise subscriptions to Opus 5, matching other premium plans」;「Changed/effortto save your default effort level per model, so each model keeps its own setting when you switch」;「Changed server-managed settings that terminate sandbox TLS, route sandbox traffic through your own proxy, inject credentials, or weaken sandbox isolation to require approval before they apply」;「Changed
ANTHROPIC_CUSTOM_HEADERSfrom managed or project settings to require approval when it sets a credential, org/tenant, routing, or API-behavior header (e.g.Authorization,Host)」;「Changed project-level.claude/settings.jsonenvto no longer setCLAUDE_CONFIG_DIR,CLAUDE_CODE_TMPDIR, orTMPDIR/TMP/TEMP; set them in your shell, user, or managed settings instead」;「Fixed/usage-creditsfor Team and Enterprise members whose admin set the org’s usage-credit limit to $0: it now offers to ask the admin instead of saying a cap was reached」;安全性修正原文:「Fixed file tools (Read, Write, Edit) following a symlink swapped inside the working directory after the permission check, which could read or write outside the approved location」;「Fixed plugin commands declared in a marketplace entry being able to point outside the plugin directory; such paths are now rejected with a path-traversal error」;「Fixed Bash permission checks auto-approving commands that assign an arithmetic expression to an integer shell variable (e.g.OPTIND=1/0,RANDOM=2+2); these now prompt for approval」;「Fixed Grep and Glob not applyingRead(...)deny rules to files reached through a symlinked search path」。 ↩↩↩↩↩↩ -
Claude Code 版本說明 v2.1.257 與 v2.1.258(皆為2026年9月1日)及 v2.1.259(2026年9月2日),以及2026年9月3日的正式 CHANGELOG。當日的 npm dist-tags:latest 與 next 皆為 2.1.259,stable 為 2.1.236;npm 已發佈的版本從 2.1.252 直接跳到 2.1.257——2.1.253 至 2.1.256 從未發佈,CHANGELOG 中也沒有對應章節(與 2.1.244/2.1.249 的模式相同)——因此 2.1.258 說明中的「2.1.255 引入的回歸」指的是未發佈的內部建置,而 v2.1.257 是第一個可安裝且支援 Fable 5.1 的版本。v2.1.257 各項目的來源:Fable 5.1 支援及閘道警語(在 Claude apps 閘道工作階段中,
fable與best別名目前仍解析為 Fable 5,因為尚未針對 Fable 5.1 設定的閘道會拒絕它——請改在/model中選取);timeFormat/timeZone;自動模式的「Containment Escape」規則(雲端中繼資料憑證擷取、出口規避與跨租戶存取不會自動核准,除非環境將其標記為預期行為);CLAUDE_CODE_SUBAGENT_MODEL_FORCE;第一次讀取工作目錄之外的檔案前的一次性提示,加上permissions.blockReadsOutsideWorkingDirectories;/effort s與以工作階段為範圍的--effort;專案/本機的defaultMode: "bypassPermissions"會被忽略;managedSourcesBehavior: "merge"的細部調整(sandbox.credentials.awsPairs與sandbox.ripgrep會整體從設定它們的最高層來源讀取);BashRead()/Edit()拒絕規則涵蓋< file輸入重新導向以及tac、egrep等讀取指令;以及--add-dir、/add-dir與additionalDirectories對網路路徑(UNC 共用、/net/<host>自動掛載)的拒絕。v2.1.258 修正的來源:未發佈的 2.1.255 所引入的 macOS 12 啟動回歸,以及遠端/排程工作階段在需要非空內容的請求上失敗。v2.1.259 各項目的來源:
managedMcpServers;allowedMcpServers的範圍改為僅限使用者新增的伺服器;--permission-prompts none(任何原本會提示的操作都會自動拒絕,而目前的權限模式仍持續做決定);無法解析的受管設定會拒絕啟動並指出來源;自訂指令與 skills 的 frontmattermodel:在互動式工作階段中會被採用,而自動模式會保留工作階段模型,不會在不支援的 frontmatter 模型上執行回合;claude plugin validate --json;以及 BashRead()拒絕涵蓋範圍延伸至選項值/運算元(--ignore-revs-file=.env、-f.env、@file引數、git diff/git grep運算元、cd DIR && cat FILE複合指令,以及對含有遭拒檔案的目錄執行grep -r/cp -r現在會詢問)。設定文件尚未記載timeFormat/timeZone或managedMcpServers,CLI 參考也尚未列出--permission-prompts;截至2026年9月3日,CHANGELOG 是這些項目的來源。 ↩↩↩↩ -
Claude Code v2.1.261 版本資訊,發布於2026年9月4日 19:58 UTC,以及同日的正式 CHANGELOG。當日的 npm dist-tags:latest 與 next 皆為 2.1.261,stable 為 2.1.236。按鍵綁定變更原文:”Changed the prompt’s word-editing keys to match Bash: Ctrl+W deletes back to whitespace, Alt+F and Alt+D stop at word end, punctuation separates words;
keybindingFlavorno longer has any effect.” 本註為下列內容的來源:/skill-doctor,可顯示哪些已載入的 skills 未被使用及其佔用的上下文成本,方便您加以精簡;bashOutputMaxChars與taskOutputMaxChars設定,可提高 Claude 在輸出儲存至檔案前以內嵌方式接收的命令輸出與背景任務輸出量,上限為 128K 字元(此機制與BASH_MAX_OUTPUT_LENGTH不同,後者依工具參考文件的定義,是從命令工作輸出檔案讀回的視窗,原文:它 “sets how many characters of output Claude Code reads back from the working file into a command’s result: 30,000 by default, up to a hard ceiling of 150,000”);auto 模式將把內容封裝進公開圖表渲染服務 URL 的連結(mermaid.live 類型,資料直接編碼於 URL 本身)視為上傳行為,除非您主動要求,否則不再自動核准;以及forceLoginMethod: "gateway"會清除殘留的憑證,因此釘選至 gateway 的機器會忽略殘留的 API 金鑰或 claude.ai 登入並要求/login,而 Bedrock、Vertex AI 與 Foundry 工作階段不受影響。 ↩ -
Claude Code v2.1.265 版本資訊,發布於2026年9月8日 20:37 UTC,以及同日的正式 CHANGELOG(發布內文與 CHANGELOG 章節完全相同)。當日的 npm dist-tags:latest 與 next 皆為 2.1.265,stable 為 2.1.236;npm 已發布版本從 2.1.261 跳至 2.1.263 再到 2.1.265 – 2.1.262 與 2.1.264 從未發布(與 2.1.244/2.1.249/2.1.253-256 相同的模式)– 而 2.1.263(9月6日發布)僅載明 “Bug fixes and reliability improvements”。本註為下列內容的來源:
--plugin-dir指向含多個 plugins 的資料夾(”each child folder with a manifest loads, and children added or removed while running are picked up”);兩項提示快取前綴修正,原文:”Fixed resuming a foreground-spawned subagent changing its tool list and system prompt prefix, which broke prompt-cache reuse for that agent” 以及 “Fixed agent teammates and resumed subagents moving SubagentStart hook context and preloaded skills out of the prompt prefix on later turns, which broke prompt-cache reuse”;非互動式工作階段(搭配 stream-json 輸入的-p、Agent SDK、雲端工作階段)不再於每則新使用者訊息時重設 shell 工作目錄,因此cd可跨回合保留;設定為
http但僅支援舊版 HTTP+SSE 傳輸的 MCP 伺服器,現在會依 MCP 規範所述回退至 SSE;儲存至磁碟的工具結果設有 1 GB 上限,且對話內預覽會註明已儲存的檔案是否遭截斷;受管理設定中含forceLoginGatewayUrl的機器自啟動起即為 Claude apps gateway 工作階段,如同forceLoginMethod: "gateway",殘留的 claude.ai 登入或 API 金鑰不會被使用;Claude apps gateway 工作階段會將 OpenTelemetry 直接匯出至 gateway 受管理設定在OTEL_EXPORTER_OTLP_ENDPOINT中指定的收集器,而非透過 gateway 的中繼(未指定收集器的工作階段仍使用中繼),且 Claude Desktop 與 Cowork 透過 Claude apps gateway 傳送的遙測資料新增了user.email與user.groups,與終端機工作階段一致;雙鍵鍵盤快捷鍵會等待第二個按鍵 3 秒,逾時則顯示通知,先前若第二個按鍵在超過一秒後才到達(如在 tmux 內的情況)會默默取消;以及在提示中途輸入的斜線命令會以清單顯示相符項目(非全螢幕時以 Tab 開啟),而非僅顯示單一建議,且 plugin skill 可用其簡短名稱找到。 ↩↩ -
Claude Code 版本說明 v2.1.266(2026年9月8日)、v2.1.267(9月9日)、v2.1.268(9月10日)、v2.1.269(9月11日)、v2.1.270(9月12日)、v2.1.271(9月14日)及 v2.1.272(npm 於9月14日發布,GitHub 版本於9月15日 00:42 UTC 發布),以及2026年9月15日的正式 CHANGELOG – 七個版本的說明內容與其 CHANGELOG 章節完全一致。9月15日(約 13:15 PT)的 npm dist-tags:latest 2.1.272、next 2.1.273、stable 2.1.236;2.1.273(9月15日 18:06 UTC 發布)沒有 GitHub 版本,也沒有 CHANGELOG 章節,因此其內容未收錄於此;2.1.263 仍只寫著「Bug fixes and reliability improvements」– 從未補上任何說明。以下內容的出處(引述處皆為原文):
/output-style的回歸(”Added/output-style [name]to list and switch output styles, including over Remote Control and in cloud and other headless sessions”,v2.1.269);claude plugin eval(”run a plugin’s eval suite against Claude Code and get scored, reproducible results (JSON + HTML report)”,v2.1.269);Claude Code Remote 工作階段中的 fast mode(”cloud and self-hosted runners: the host’s fast-mode setting or/fasttyped in the session applies where your organization allows it”,v2.1.271)以及/fast off的修正;maxEffortLevel設定(”top-level or per model undermodelSettings: caps the effort level on every provider, including Bedrock, Vertex and Foundry; users can still pick a lower level”,v2.1.267);--system-prompt-snapshot off(v2.1.267);v2.1.267 的 prompt-cache 穩定性修正批次(恢復工作階段時的工具清單、工具描述與 MCP 宣告文字的改寫;/model切換時重新傳送每一個工具定義,署名文字改為對話備註;--system-prompt/--append-system-prompt工作階段只記錄一次提示詞與工具定義;工作階段中途加入的 MCP 與 plugin 工具改為延遲載入的定義);固定預設 effort 模型(Opus 4.7、Opus 4.8、Fable 5;v2.1.267)上effort:frontmatter 的修正;marketplace 反斜線隔離修正(v2.1.267);任務追蹤工具的允許清單(「Changed the task-tracking tools (TaskCreate/Get/Update/List, TodoWrite) to be offered only on」Claude 3.x、Opus 4.0 至 4.7、Sonnet 4.0 至 4.6 與 Haiku 4.5,並附「setCLAUDE_CODE_ENABLE_TODO_TOOLS=1elsewhere」,v2.1.268);符號連結目錄與env -C/eval拒絕規則的修正(v2.1.268);WebFetch 與 Artifact 規則的拆分(”Changed plainWebFetchdeny and ask rules to no longer apply to Artifact tool reads and updates; use anArtifactrule (orWebFetch(domain:claude.ai)) to block or gate them”,v2.1.268);/plugin變更於選單關閉時生效(v2.1.268);WebFetch 的 300 秒期限與CLAUDE_CODE_WEBFETCH_DEADLINE_MS(v2.1.268);gatewayInternalNetworks、空白allow_cidrs的警告,以及 gatewaypricing:費率同步(v2.1.268),再加上multiplier可高於 1 並最高至 10(v2.1.271);${VAR}與 git URL 的機密防護修正(v2.1.268);claude auth status --json中的configDirectory(v2.1.268);第三方ANTHROPIC_BASE_URLHTTP 400 迴歸問題的修正(v2.1.268);bashEditDiffEnabled(v2.1.269);署名提醒的修正(”Fixed the attribution reminder overriding a CLAUDE.md or memory rule against commit and pull request attribution; lines set by managed settings still apply”,v2.1.269);環境變數OTEL_METRICS_INCLUDE_REPOSITORY、CLAUDE_CODE_WORKFLOW_MAX_CONCURRENT_AGENTS(1-256)、CLAUDE_CODE_GATEWAY_MODEL_DISCOVERY_TIMEOUT_MS(預設 3 秒)及CLAUDE_CODE_BG_TASKS_REPORT_RUNNING(v2.1.269);v2.1.247 鍵盤迴歸問題的修正,以及透過 SSH 的 kitty 查詢鍵盤支援(v2.1.269);Edit()/tee、Bash(tee:*)與開頭!的範圍判定修正(v2.1.269);啟用沙箱的 auto mode 下,Bash、PowerShell 與 Monitor 的逐命令allowed_domains(v2.1.271);omitClaudeMdagent frontmatter 與--agentsJSON(v2.1.271);auto mode 的行內!與 subagent 交還機制的變更(v2.1.271);claude plugin install/update的--accept-command <sha256>(v2.1.271);--resume在不同模型系列間保留[1m](v2.1.271);無法讀取的managed-mcp.json改為預設拒絕(v2.1.271);fmt/column、萬用字元展開、變數宣告旗標與blockReadsOutsideWorkingDirectories檢查器的修正(v2.1.271);以及 Markdown artifacts 改以具樣式的文件頁面呈現,artifact 監看數提高至 10(v2.1.271)。v2.1.266 只有一行(CLAUDE_CODE_USE_GATEWAY迴歸問題的修正),v2.1.270 只有一行(v2.1.269 git 提示迴歸問題的修正),而 v2.1.272 僅寫著「Bug fixes and reliability improvements」。 ↩↩↩↩↩↩↩ -
Claude Code v2.1.273 版本說明,發布於2026年9月15日 20:23 UTC,以及2026年9月16日的正式 CHANGELOG:版本說明內文與 CHANGELOG 章節完全相同,各為 64 行。9月16日(約太平洋時間 10:00)的 npm dist-tags:latest 為 2.1.273、next 為 2.1.273、stable 為 2.1.267,這是 stable 標籤首次離開 2.1.236。以下項目的來源,引用處皆為原文:deny 規則回退(”回退了 2.1.268 的一項變更,該變更會對權限檢查器無法分析的 Bash 指令行(
eval、env -C)檢查 Read 與 Edit 的 deny 規則;像time -p make build這類指令現在會再次提示,而不是被拒絕”);無法分析的指令與子 shell 修正(”修正了權限檢查器無法完整分析的 Bash 指令在permissions.blockReadsOutsideWorkingDirectories下跳過提示的問題,以及在 bypass 模式中子 shell 藏匿危險rm的問題”);記憶目錄修正(”修正了permissions.blockReadsOutsideWorkingDirectories:由儲存庫設定所選定的記憶目錄,不再被載入提示、召回、建立索引,或供記憶擷取使用”);閘道分類器預設值(”將 Bedrock、Vertex 與 Foundry 上的 auto 模式暫時改為預設使用本機分類器;設定CLAUDE_CODE_AUTO_MODE_SERVER=1即可改用平台的伺服器端分類器”);提示標頭(”為 LLM 閘道新增了x-claude-code-request-class、x-claude-code-agent-type、x-claude-code-prev-tool-durations、x-claude-code-compaction與x-claude-code-context-compacted請求標頭;以CLAUDE_CODE_GATEWAY_HINT_HEADERS=1選擇啟用”);受管設定優先順序修正(”修正了透過 MDM 或
managed-settings.json設定的allowManagedMcpServersOnly、deniedMcpServers與disableClaudeAiConnectors在同時存在伺服器管理設定時被忽略的問題”);context 計量修正(”修正了 context 計量與自動壓縮將 advisor 工具回合計為實際 context 大小約兩倍的問題,這導致自動壓縮在實際視窗約一半時就觸發”);提示快取修正(”修正了/login、/upgrade與/extra-usage捨棄對話中先前思考內容的問題,該問題會迫使下一次請求完整重寫提示快取”);遙測變更(”變更OTEL_LOG_TOOL_DETAILS=1,使其在成本與 token 指標上也包含實際的 agent、skill、plugin 與 MCP 伺服器名稱”);/bug//feedback資料最小化(”變更/bug與/feedback回報,使其僅包含最後一次 API 請求的模型行為參數(模型、系統提示、工具),省略請求中繼資料與CLAUDE_CODE_EXTRA_BODY欄位”);登入變更(”變更以 Claude 帳號登入的流程,使其同時請求存取您的 claude.ai plugins”);Remote Control 分支(”新增從 Claude 應用程式分支以claude --remote-control或/remote-control啟動的工作階段;分支會在您的電腦上以背景工作階段執行”);以及 stream-json 修正(”修正了 SDK 與--output-format stream-json輸出在 subagent 於執行中途被移至背景(例如透過CLAUDE_AUTO_BACKGROUND_TASKS)後,遺漏其剩餘訊息與最終報告的問題”)。 ↩↩↩ -
Claude Code 版本說明 v2.1.274(發布於 2026年9月17日 00:12 UTC,108 個項目)、v2.1.275(9月17日 22:33 UTC,96 個項目)與 v2.1.276(9月18日 02:12 UTC,一行),以及2026年9月17日的正式 CHANGELOG:三份版本說明內文與其 CHANGELOG 章節逐位元組相同。9月17日(約太平洋時間 22:08)的 npm dist-tags:latest 與 next 皆為 2.1.276,stable 為 2.1.267。以下項目的來源,引用處皆為原文:claude.ai 同步(”新增將您 claude.ai 帳號上啟用的 skills 與 plugins 同步至以該帳號登入的終端機工作階段;以
syncClaudeAiSkills: false或syncClaudeAiPlugins: false選擇停用”,v2.1.275);立即送出鍵(”新增立即送出鍵(ctrl+enter,或 ctrl+x ctrl+s),可中斷目前回合並一次送出所有排隊中的訊息;已送出與排隊中的訊息會以灰色顯示,直到模型接收為止”,v2.1.275);/plugin install <plugin> --marketplace <source>(”會在安裝 plugin 前主動提議加入該 marketplace”,v2.1.275);npm plugin 來源強化(”變更從 npm 來源安裝的 plugins,改以npm pack --ignore-scripts取得並驗證完整性,因此套件的安裝指令碼不再執行”,v2.1.275);同步帳號 skills 的 Write/Edit 結果(”現在會說明變更未儲存至您的帳號,以及如何儲存”,v2.1.275);分頁圖示變更(”變更 Artifact 工具,首次發布時改為要求一個單字的分頁圖示,而非 emoji favicon”,v2.1.275);CLAUDE_CODE_MCP_STARTUP_WAIT_MS(”用於限制第一個非互動式回合等待 MCP 伺服器連線的時間(0= 不等待)”,v2.1.274);MCP 用戶端預設值(”變更 Bedrock、Vertex、Foundry 與停用遙測的安裝,預設改用 v2 MCP 用戶端,並與直接 HTTP 伺服器採用 MCP 2026-07-28 協商,與其他安裝一致(選擇停用:MCP_SDK_GENERATION=v1或MCP_PROTOCOL_NEGOTIATION=legacy)”,v2.1.274);舊版 HTTP+SSE 4xx 修正(”修正了設定為http且僅支援舊版 HTTP+SSE 的 MCP 伺服器,在以 422 或其他 4xx 錯誤回應第一個請求時無法連線的問題”,v2.1.274);"type": "sdk"略過(”變更.mcp.json、設定、plugins 與 agent 檔案中的"type": "sdk"MCP 項目,改為略過並顯示警告:只有 SDK 宿主應用程式才能註冊行程內伺服器”,v2.1.274);命名變更(”變更/status的 GitHub 行文字為 "Cloud sessions",並將/web-setup、/ultrareview與 teleport 訊息改為顯示 "cloud session" 而非 "Claude Code on the web"“,v2.1.274);artifact 監看(”變更本機工作階段中的 artifact 監看:在其他地方發布的新版本不再啟動回合;Claude 會從之後的 Artifact 工具結果得知”,v2.1.274);以及 v2.1.276 的回歸修正(”修正了當ANTHROPIC_BASE_URL指向 proxy 或閘道時,每個請求都以400 … Input tag 'advisor_20260301'失敗的問題(2.1.275 回歸)”)。 ↩↩↩ -
Claude Code 版本說明 v2.1.277(npm 發布於 2026年9月18日 16:22 UTC;GitHub release 為 18:06 UTC)與 v2.1.278(npm 為 9月19日 01:48 UTC;GitHub release 為 03:10 UTC),以及2026年9月21日的正式 CHANGELOG。本指南中所有 v2.1.277 與 v2.1.278 項目的來源。關鍵引文:”新增 AGENTS.md 支援:在沒有 CLAUDE.md 的專案中,Claude Code 會改為讀取 AGENTS.md;可在
/config的 "Project instructions" 下變更(Bedrock、Vertex 或 Foundry 尚未支援)”;”變更 Claude API 與 Enterprise 使用者,以及 Bedrock、Vertex、Foundry 與閘道上的 auto 模式,預設改用伺服器端分類器,該分類器不收取分類器額外費用”;”在/status新增Auto mode server列,顯示此工作階段的 auto 模式分類器是否在伺服器上執行”。於 2026年9月21日取得的佐證文件:Memory,AGENTS.md 章節(載入矩陣、Project instructions 的值、agents-md@builtin的pluginConfigs位置、不會讀取的檔案)與 Auto 模式分類器請求費用(備援通知文字與送達方式、/status列的值、閘道直通,以及該變數的暫時性狀態)。 ↩↩ -
Claude Code v2.1.280 版本說明(npm 發布於 2026年9月22日 15:44 UTC;GitHub release 為 16:38 UTC),以及2026年9月22日與9月23日的正式 CHANGELOG。本指南中所有 v2.1.280 項目的來源。9月23日的 npm dist-tags:latest 與 next 為 2.1.280,stable 為 2.1.267;2.1.279 從未發布。關鍵引文:”新增 Claude Opus 5.5(
claude-opus-5-5),現為預設的 Opus 模型”,並具備 “1M context、每 Mtok $4/$20,快取讀取每 Mtok $0.20”;”將 Pro 與 Team Standard 方案的預設模型從 Sonnet 改為 Opus,與 Max、Team Premium 和 Enterprise 一致”;”修正了當安全檢查未給出答案時,auto 模式不停歇地反覆拒絕動作的問題;重試現在會退避,連續十次後回合會停止並顯示訊息”。 ↩↩ -
Claude Code 文件,擷取於2026年9月23日:模型設定、Fast mode、記憶、權限模式、Auto mode 分類器請求費用與MCP。以下內容的資料來源:依內容判定的備援機制(「biology-flagged requests re-run on Opus 5, and cybersecurity-flagged requests re-run on Opus 4.8」,適用於 Fable 5.1、Fable 5 與 Opus 5.5);effort 預設值(Opus 5.5 為
medium,頂層的effortLevel無法影響它);「You can’t turn thinking off on Opus 5.5 or the Fable models」;Opus 4.8 及之後版本在 Bedrock、Agent Platform 與 Foundry 上的 200K 視窗,以及 Foundry 的opus解析為 Opus 4.6;fast mode 的模型支援,以及自 v2.1.280 起 Opus 5.5 成為 fast mode 預設;AGENTS.md 差異表格、首次工作階段的注意事項,以及 v2.1.280 之前/memory與/context不會列出直接讀取的AGENTS.md這項說明;內建起始模式表格(Pro、Max 與 Team 為 auto;Enterprise、Console API 金鑰與第三方供應商為 Manual);伺服器端檢查清單,其中包含 Claude Platform on AWS;以及 Tool Search 在工作階段開始時僅載入工具名稱與伺服器指示。 ↩ -
Claude Code v2.1.281 版本說明(npm 於2026年9月23日 17:01 UTC 發布;GitHub 發布版本為 19:19 UTC;176 個條目,與正式 CHANGELOG 的 2.1.281 章節完全一致,擷取於2026年9月24日,該檔案從 2.1.280 連續涵蓋至 2.1.281,沒有缺漏)。本指南中每一項 v2.1.281 內容的資料來源。9月24日的 npm dist-tags:latest 與 next 為 2.1.281,stable 為 2.1.273。關鍵引文:「Changed send now (ctrl+enter or ctrl+x ctrl+s) to move running tools to the background instead of cancelling the turn」;「Changed
CLAUDE_CODE_AUTO_MODE_SERVERto also apply on a direct Anthropic API connection:0opts out of the server-side auto mode classifier (the local classifier then counts toward usage),1opts in」;「Changed the dangerousrmprompt in--dangerously-skip-permissionsand auto mode to wait 2 minutes for an answer, then deny the command with a rewrite hint」;「Added"attribution": falseinsettings.jsonto hide all commit and PR attribution」。移除/agents精靈一事出自同一份 CHANGELOG 的 2.1.198 章節:「Removed the/agentswizard; ask Claude to create or manage subagents, or edit.claude/agents/directly.」auto mode 分類器計費文件,擷取於2026年9月24日,當時仍寫著「The variable isn’t read on a direct connection to the Anthropic API」;到了9月26日,該頁面已改為「On a direct connection to the Anthropic API, the variable requires Claude Code v2.1.281 or later.」同日的設定參考記載了attribution物件,並將includeCoAuthoredBy標示為已棄用;到了9月26日也一併記載了false這個值。 ↩↩ -
Claude Code v2.1.282 版本說明(npm 於2026年9月24日 15:56 UTC 發布;GitHub 發布版本為 18:38 UTC;86 個條目,與正式 CHANGELOG 的 2.1.282 章節完全一致,擷取於2026年9月26日)。本指南中每一項 v2.1.282 內容的資料來源。關鍵引文:「Changed auto mode to use the server-side classifier by default on a direct Anthropic API connection when telemetry is off (
CLAUDE_CODE_AUTO_MODE_SERVER=0opts out)」;「Changed project and local settings to ignore OpenTelemetry variables that turn on export, set its endpoint, or capture content, likeCLAUDE_CODE_ENABLE_TELEMETRYandOTEL_LOG_*」;「Added amaxProseWidthsetting that caps the width of Claude’s prose in wide terminals」;「Added theallowClaudeInChromeWithManagedMcpmanaged setting to letclaude --chromerun alongside an exclusivemanaged-mcp.json」;「Changedsandbox.excludedCommandsto ignore project and local settings entries when managed settings or--settingssetallowUnsandboxedCommands: false, or managedallowManagedDomainsOnly: true」;「Changed skill folders, command files and workflow commands in theanthropic-skillsorclaude-ainamespace to no longer load」。 ↩↩↩↩ -
Claude Code v2.1.283 版本說明(npm 於 2026年9月25日 18:46 UTC 發布;GitHub 發行於 21:50 UTC;共 94 條項目,與正式 CHANGELOG 的 2.1.283 章節完全一致,2026年9月26日擷取,該紀錄從 2.1.281 到 2.1.283 連續無缺漏)。本指南中所有 v2.1.283 項目的來源。9月26日的 npm dist-tags:latest 與 next 為 2.1.283,stable 為 2.1.274。重點引文:”Changed interactive sessions on third-party providers or with telemetry off to start in auto mode when no permission mode is configured;
permissions.defaultModestill overrides it”;”AddeddeniedModelsmanaged setting to block specific models, even whenavailableModelsallows them”;”Added/doctor prompt-audit(also/checkup prompt-audit) to audit your CLAUDE.md files, skills, agents and commands for prompting patterns written for older models”;”Addedx-claude-code-prompt-idto the gateway hint headers”;”Changed the/modelpicker’s Opus row and the Default model’s name to drop ‘(1M context)’ where Opus already has a 1M context window”;”Reverted the 2.1.282 reservation of theclaude-ainame”。 ↩↩ -
Claude Code 文件,2026年9月26日擷取。權限模式:”With Claude Code v2.1.283 or later, auto mode is the built-in starting permission mode for interactive terminal and VS Code sessions on every plan and provider”;
claude -p與 Agent SDK 以default模式啟動;”From v2.1.282, a session that doesn’t fetch feature flags, for example because you turned telemetry off, asks the server by default in any kind of session.” 自動模式分類器計費:”On a direct connection to the Anthropic API, the variable requires Claude Code v2.1.281 or later.” 設定參考:attribution“orfalseto hide all attribution. Thefalsevalue requires Claude Code v2.1.281 or later”;maxProseWidth、deniedModels與availableModelsMatch條目;「Variables Claude Code ignores inenv」之下的 OpenTelemetry 群組。LLM 閘道協定:”Direct connection to the Anthropic API: sent by default”。Skills:保留的anthropic-skills名稱。設定參考現在也記載了spinnerTipsOverride的tipsFile與提示物件(”Tip objects,tipsFile,label, and the Scope line’s rule … require Claude Code v2.1.247 or later”),以及timeFormat與timeZone鍵。 ↩↩↩↩↩↩ -
Claude Code v2.1.285 版本說明(npm 於 2026年9月29日 17:32 UTC 發布;GitHub 發行於 19:27 UTC;共 136 條項目,與正式 CHANGELOG 的 2.1.285 章節完全一致,2026年9月29日擷取)。本指南中所有 v2.1.285 項目的來源。9月29日的 npm dist-tags:latest 與 next 為 2.1.285,stable 為 2.1.280。重點引文:”Changed
claude -pand Python Agent SDK sessions on third-party providers or with telemetry off to start in auto mode when no permission mode is configured, like interactive sessions;--permission-modestill overrides it”;”AddedallowedProvidersmanaged setting to limit which API providers a machine may use”;”Addedclaude --desktopto open the Claude desktop app on the current directory, or on a session with--continue/--resume <id>“;”AddedCLAUDE_CODE_DISABLE_WEB_FETCHenvironment variable to turn off the WebFetch tool”;”Changed background Bash and PowerShell commands to stop after a time limit (theirtimeoutwithrun_in_background, default 30 min, max 2 h)”;”Changed sessions behind a customANTHROPIC_BASE_URLto use the 1M context window of models that have one (Opus 4.7+, Sonnet 5+, Fable); run/autocompact 200kif your gateway stops at 200K”;”Changed sandbox settings so project settings cannot widen or turn off an admin-required sandbox”;”Changed/config chrome=trueto direct you to the /config panel instead of enabling Claude in Chrome by default”。 ↩↩↩ -
Claude Code v2.1.287 版本說明(npm 於 2026年10月1日 16:59 UTC 發布;GitHub 版本 18:00 UTC;共 106 個項目,與正式 CHANGELOG 的 2.1.287 章節完全一致,於 2026年10月1日擷取)。本指南中所有 v2.1.287 項目的來源。10月1日的 npm dist-tags:latest 與 next 為 2.1.287,stable 為 2.1.285。重點引述:「Changed Opus 4.7+ and Fable to use a 1M context window by default on Bedrock, Vertex, Foundry and the Claude apps gateway, with no
[1m]suffix (CLAUDE_CODE_DISABLE_1M_CONTEXT=1keeps 200K)」;「Added Claude Mods: plugins may now modify deeper behavior」;「Added You should know, a built-in mod where a side agent watches your back and flags things you or Claude might miss」;「Added URL prompts from MCP servers on the 2025-11-25 protocol」;「Changed MCP serveralwaysLoad: falseto defer all of that server’s tools behind tool search」;「setCLAUDE_AX_PREPARK_MS=50to restore the pause」;「Changed automatic model switches after a flagged message to keep your current effort level instead of the new model’s default」;「Changed whole-toolBashallow rules and allowing hooks to prompt for, not run, shell writes to files Claude Code’s file tools refuse outright」;「Addedprompt_textto the OpenTelemetryuser_promptevent」。 ↩↩ -
Claude Code 文件,於 2026年10月1日擷取。權限模式:對於
claude -p或 Agent SDK,「defaultin sessions that fetch feature flags. In sessions that don’t, such as on a third-party provider or with telemetry off,autowith Claude Code v2.1.285 or later」。Mods 概覽:「Mods 預設為開啟。在終端機中,請使用 Claude Code v2.1.287 或更新版本」;「Mods aren’t sandboxed」;自 v2.1.287 起CLAUDE_CODE_ENABLE_FUNCTION_HOOKS會被忽略;cc-plugin-you-should-know為「Disabled by default」。模型設定:發生回退後,Claude Code「會保留被標記的請求執行時所用的 effort 等級」;「Opus 4.6 and Sonnet 4.6 reach 1M only through their[1m]variant」;閘道 1M 段落與/autocompact 200k。Amazon Bedrock 與 Agent Platform:「To enable it for a manually pinned model instead, append[1m]to the model ID.」環境變數:CLAUDE_AX_PREPARK_MS「Default0… Before v2.1.287, the default was50」;CLAUDE_CODE_DISABLE_WEB_FETCH「The WebSearch tool stays available. Requires Claude Code v2.1.285 or later」。Headless:「Before v2.1.286, these limits held only partly」。Agent 檢視:n:<text>篩選器與「A reply that is exactly/stopstops the session at once.」設定參考:allowClaudeInChromeWithManagedMcp(「Requires Claude Code v2.1.282 or later」)與allowedProviders項目。MCP 頁面並未列出bareElicitationCapability。2026年11月25日重新讀取;措辭已有變動的引文,改以當日的措辭呈現。 ↩↩↩↩ -
Claude Code 正式 CHANGELOG 的 2.1.288 章節,於 2026年10月6日擷取,以及同日讀取的
@anthropic-ai/claude-codenpm 登錄檔中繼資料:2.1.288 於 2026年10月2日 18:30 UTC 發布,2.1.289 於 10月3日 20:12 UTC,2.1.290 於 10月5日 18:12 UTC,2.1.291 於 10月6日 03:32 UTC,2.1.292 於 10月6日 17:10 UTC;dist-tags 的 latest 與 next 為 2.1.292,stable 為 2.1.285。CHANGELOG 從 2.1.287 到 2.1.292 連續無缺漏。本指南中所有 v2.1.288 項目的來源。重點引述:「Changedclaude project purgetoclaude purge; the old name still works and prints a notice」;「Changed the background command time limit to apply only in unattended sessions (-p, Agent SDK, CI, cloud); terminal, desktop app and VS Code sessions have no limit」;「Added--max-findings <n>|allto /code-review」;「addedCLAUDE_CODE_DISABLE_STRUCTURED_OUTPUTSto turn structured outputs off」;「Changed the client-side auto mode classifier to ignore anANTHROPIC_DEFAULT_SONNET_MODELpin that names Claude Sonnet 5.5 or Opus 5.5 and use Claude Sonnet 5 instead」;「requests now time out after 60s (per-serverrequestTimeout)」。 ↩↩ -
Claude Code 正式 CHANGELOG 的 2.1.289、2.1.290 與 2.1.291 章節,於 2026年10月6日擷取。本指南中所有 v2.1.289、v2.1.290 與 v2.1.291 項目的來源。重點引述:「Fixed a regression in 2.1.290 where cloud sessions could drop answers to permission prompts」;「Fixed a regression in 2.1.288 where the last messages of a session could be lost when quitting」;「Changed the interactive session’s WebSearch budget to refill over time (100 calls/hour;
CLAUDE_CODE_WEB_SEARCH_REFILLS_PER_HOURsets the rate, 0 turns it off) instead of ending after 200 calls」;「Changed Claude in Chrome so that a project’s settings files can no longer turn it on; use--chrome,/chromeor your user settings」;「Changed the Bash tool to ask for permission before runningpyright, which is no longer treated as a read-only command」;「ChangedCLAUDE_CODE_DISABLE_ATTACHMENTSso a repository’s.claude/settings.jsonor.claude/settings.local.jsoncan no longer set it」;「Addedagent.spawnfor teammates, one agent id across plugin hook events, and idle and waiting states in$.agent.list()」。 ↩↩ -
Claude Code 正式 CHANGELOG 的 2.1.292 章節,於 2026年10月6日擷取。本指南中所有 v2.1.292 項目的來源。重點引述:「Added
CLAUDE_CODE_OVERLOADED_RETRY_BASE_DELAY_MSenvironment variable to set a longer base delay for the backoff when retrying an overloaded (529) request」;「Added aneffortparameter to the Agent tool」;「Added--marketplace <source>toclaude plugin install」;「Changed local (stdio) MCP server connections to negotiate protocol version 2026-07-28 by default on every install, including Bedrock, Vertex and Foundry;MCP_PROTOCOL_NEGOTIATION=legacyopts out」;「Security: Fixed PreToolUse hook approvals and auto mode bypassing the permission prompt for file reads from network (UNC) paths」;「Changed agent names to allow at most 256 characters」。 ↩↩ -
Claude Code 文件,擷取於2026年10月6日。環境變數:
CLAUDE_CODE_DISABLE_STRUCTURED_OUTPUTS「需要 Claude Code v2.1.288 或更新版本」;CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION仍為「(預設:200)」;沒有CLAUDE_CODE_OVERLOADED_RETRY_BASE_DELAY_MS或CLAUDE_CODE_WEB_SEARCH_REFILLS_PER_HOUR的條目。CLI 參考與 Agent 檢視:claude attach和claude logs的部分工作階段名稱需要 v2.1.290;列出了claude purge。Claude 目錄:「在 v2.1.288 之前,此命令為claude project purge。」工具參考:「在 v2.1.288 之前,它適用於每個工作階段」(背景命令的時間限制)。程式碼審查:--max-findings「需要 Claude Code v2.1.288 或更新版本」。快捷鍵:agents:find、agents:rename、agents:previousGroup、agents:nextGroup,v2.1.288。記憶:「當 Claude 對相符的檔案使用 Read、Write 或 Edit 工具時,就會載入以路徑限定範圍的規則」。MCP:stdio 協商仍描述為「對 Claude Code v2.1.285 或更新版本,在 Claude Code 擷取功能旗標的工作階段中」啟用。Plugin CLI 參考:--marketplace僅列於/plugin install;marketplace 資訊清單的驗證行為「需要 Claude Code v2.1.289 或更新版本」。Mods 參考:寫明「截至 v2.1.289」;列出了帶有e.isTeammate的agent.spawn以及$.ui的selection。Sub-agents:effort僅記載為 frontmatter 欄位;name是「最多 256 個字元的唯一識別碼」,名稱「超過 256 個字元」的檔案會被略過,並在除錯記錄中寫入錯誤(10月6日稍後再次擷取)。設定參考:claudeInChromeDefaultEnabled的範圍為「全域設定」。命令:/claude-api列出managed-agents-onboard。搭配 Chrome 使用 Claude Code:「在 CLI 工作階段中執行/chrome,並選擇預設開啟 Chrome 的選項」;該頁面未提及 v2.1.290 的專案設定變更。2026年11月25日重新讀取;措辭已有變動的引文,改以當日的措辭呈現。 ↩↩↩ -
Claude Code 正式 CHANGELOG,2.1.293 至 2.1.296 各節,擷取於2026年10月11日,以及同日讀取的
@anthropic-ai/claude-codenpm registry 中繼資料:2.1.293 發布於2026年10月7日 17:18 UTC,2.1.294 為10月8日 03:42 UTC,2.1.295 為10月8日 18:22 UTC,2.1.296 為10月9日 16:58 UTC;dist-tags 的 latest 與 next 為 2.1.296,stable 為 2.1.287。GitHub 的發行說明(發布於 18:10、05:03、19:48 與 19:28 UTC)分別含有 56、2、143 和 79 個條目,與 CHANGELOG 完全一致。本指南中所有 v2.1.293 至 v2.1.296 項目的來源。關鍵引文:「新增 Claude Haiku 5.5(
claude-haiku-5-5),現為 Anthropic API 上的預設 Haiku 模型」,具備「1M 上下文,每 Mtok $0.10/$0.50(超過 100K 的提示為 $0.50/$2.50)」;「為命令與 HTTP hooks 新增onFailure: "block":無法啟動、逾時或以非預期代碼結束的 hook 會阻擋該動作,而不是放行」;「將預先傳送的 MCP 工具描述與 MCP 伺服器指示的預設上限從 2,048 個字元改為 4,096 個字元」;「模型透過工具搜尋載入的 MCP 工具描述改為在 16,384 個字元處截斷,而非 2,048」;「將 subagents 改為最多從skills欄位預載 32 個 skills,每個僅載入一次」;「在 subagent frontmatter 與--agents定義中新增autoCompactWindow,讓 subagent 能比主對話的視窗更早自動壓縮」;「更新/cost、狀態列、--max-budget-usd與 SDK 的費用數字,將 Sonnet 5.5 的快取讀取定價為每百萬 token $0.10(原為 $0.20)」;「為 Read 工具新增allow_large選項」;「還原 2.1.281 的自動模式拒絕訊息變更」;「修正在受管理設定將forceLoginMethod設為gateway但未設定forceLoginGatewayUrl的機器上,已儲存的 Claude apps gateway 登入會被忽略的問題(2.1.295 的回歸)」。 ↩↩↩↩ -
Claude Haiku 5.5 模型總覽、模型總覽、定價頁面,以及 Claude Code 的模型設定頁面,擷取於2026年10月11日。模型頁面:「發布於2026年10月7日」;「上下文視窗:1M tokens · 最大輸出:128K tokens」;輸入「提示在 100,000 tokens 以內為 $0.10 / MTok;超過 100,000 tokens 為 $0.50 / MTok」,輸出在同一分界下為「$0.50 / MTok」與「$2.50 / MTok」,快取讀取為「$0.01 / MTok」與「$0.05 / MTok」;思考為「Adaptive」,預設 effort 為
medium,可靠截止與訓練截止皆為「2026年6月」,退役「不早於2027年10月7日」;「相同文字計入的 tokens 比 Claude Haiku 4.5 多出約 30%」;Bedrock ID 為anthropic.claude-haiku-5-5。定價頁面:「請求的提示長度計入其所有輸入 tokens,包括快取讀取與快取寫入。每個請求各自獨立計價」;「Claude Opus 5.5 與 Claude Sonnet 5.5 的快取命中與重新整理按基礎輸入價格的 0.05 倍計價」,「Claude Sonnet 5.5 | 0.05 倍 | $0.10 美元」。模型設定:別名表在 Anthropic API 上將haiku解析為 Haiku 5.5,而在 AWS 上的 Claude Platform、Amazon Bedrock、Google Cloud 的 Agent Platform 與 Microsoft Foundry 上則解析為 Haiku 4.5;「搭配 Haiku 5.5 請使用 v2.1.293 或更新版本」;「一旦haiku解析為 Haiku 5.5,在 Haiku 4.5 上儲存的工作階段會在 Haiku 5.5 上恢復」;「Haiku 模型始終可用且無法停用,因此每位成員至少保有一個可用的模型」。2026年11月25日重新讀取;措辭已有變動的引文,改以當日的措辭呈現。 ↩ -
Claude Code 文件,擷取於2026年10月11日。Hooks:
onFailure是「hook 失敗時,觸發該 hook 的動作是否繼續進行:"continue"或"block"……需要 Claude Code v2.1.295 或更新版本」;它所計入的失敗包括「無法啟動」、「結束代碼不是 0 或 2」、「HTTP 錯誤」、「逾時」與「無效輸出」;「設為"block"時,失敗的效果等同於該事件上的結束代碼 2,但在PermissionRequest上則會拒絕該請求」;「此欄位對」Stop、SubagentStop、TaskCompleted、TeammateIdle以及背景(async、asyncRewake)命令 hooks「沒有作用」。環境變數:CLAUDE_CODE_OVERLOADED_RETRY_BASE_DELAY_MS「當 API 以529過載錯誤拒絕請求時,重試之間退避的起始延遲毫秒數(預設:500)……請以純數字提供 500 至 32000 之間的整數毫秒……需要 Claude Code v2.1.292 或更新版本」;CLAUDE_CODE_RETRY_WATCHDOG_MAX_WAIT_MS「未設定時,等待沒有上限。需要 Claude Code v2.1.295 或更新版本」;CLAUDE_CODE_WEB_SEARCH_REFILLS_PER_HOUR「在互動式終端機工作階段中預設為100。在非互動式工作階段中預設為0,即關閉補充」;CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS「Claude 使用allow_large參數進行的讀取,在上下文視窗仍有空間時可以超過此上限」;VERTEX_REGION_CLAUDE_HAIKU_5_5「於 v2.1.293 新增」;沒有CLAUDE_CODE_OVERLOADED_RETRY_MAX_DELAY_MS或CLAUDE_CODE_WORKFLOW_SUBAGENT_MODEL的條目。2026年11月25日重新讀取;措辭已有變動的引文,改以當日的措辭呈現。Sub-agents:
skills欄位預載「清單中最前面的 32 個不同名稱」;每次呼叫的effort參數「會覆寫effort欄位,並在 subagent 恢復時持續生效……需要 Claude Code v2.1.292 或更新版本」;autoCompactWindow不在所列的 frontmatter 欄位之中。狀態列:agentType「需要 Claude Code v2.1.293 或更新版本」。MCP:「Claude Code 預設會向 stdio 伺服器要求該修訂版。若要讓 stdio 通道伺服器維持在較早的交握方式,請將MCP_PROTOCOL_NEGOTIATION設為legacy,這會讓每個伺服器都維持在該方式。」Plugin CLI 參考:claude plugin install接受--marketplace <source>,「需要 Claude Code v2.1.292 或更新版本」。Mods 參考:仍寫明「截至 v2.1.290」;沒有$.ui.notify或prompt.autocomplete的條目。 ↩↩↩ -
受管設定,擷取於2026年9月3日。
managedSourcesBehavior的來源:先到先贏仍是預設;設為「merge」會合併所有管理來源,大多數鍵由排名較高的來源勝出,清單型鍵則跨來源取聯集,sandbox 鎖定則採任一來源所設的最嚴格值;每個鍵只從設定了它且排名最高的來源讀取;而managedSourcesBehavior是控制鍵而非政策鍵,因此只設定它的來源不算提供了政策鍵。 ↩ -
Claude Code CHANGELOG,2.1.247 章節,擷取於2026年8月27日。npm 於2026年8月26日 18:02 UTC 發布 2.1.247(dist-tag latest:2.1.247;2.1.244 仍未發布),GitHub 發行版 v2.1.247 隨後於 23:06 UTC 發布,而正式文件變更日誌將此版本的日期標為2026年8月26日。原文照錄:「Added the
SendFeedbacktool: when something goes wrong in a session, Claude can draft a feedback report for you to review and send from/feedback(turn off with thefeedbackDraftssetting)」;「Added{id, text, cooldownSessions, priority}entries,tipsFile, andlabeltospinnerTipsOverride, so organizations can rotate their own tips alongside the built-in ones」;「Added a tip on Bash permission prompts pointing to auto mode, with a one-keystroke ‘Yes, and switch to auto mode’ option」;「Added/claude-api cost-optimizeto profile an existing project’s Claude API spend and work through cost levers (caching, token hygiene, batch, effort, model choice) one measured change at a time」;「Updated the/claude-apiskill with Admin API coverage (organization members, invites, workspaces, API keys, rate limit reports, workload identity federation, CMEK)」;「Changed Sonnet 5’s default auto-compact window to its full 1M context, so sessions on the 1M window now auto-compact at about 967K tokens instead of about 934K」;「Changed cross-session peer messages to collapse by default to a one-lineMessage from @<sender>: <first line>preview; Ctrl+O expands the full body」。設定參考尚未記載feedbackDrafts或新的spinnerTipsOverride鍵;截至2026年8月27日,CHANGELOG 是它們唯一的來源。 ↩↩ -
Claude Code 文件,擷取於2026年8月26日。受管設定,「Claude Code 使用哪個受管來源」:「Claude Code 會使用提供至少一個政策鍵的來源中排名最高者,並忽略其餘來源而非加以合併,『從每個管理來源讀取的鍵』中的鍵除外」;「Claude Code 對於被略過的來源不會顯示任何警告;
/status會列出它使用的來源以及它略過的來源」;順序,優先權由高至低:「1. 遠端設定,由 claude.ai 以伺服器管理設定的形式提供,或由 Claude apps gateway 提供……2. MDM 或作業系統層級的政策:macOS plist 或 HKLM 登錄機碼 3. 受管設定檔案,managed-settings.d/*.json與managed-settings.json合併在一起 4. HKCU 登錄,適用於 Windows,以及在 WSL 上當 HKLM 登錄或 Windows 受管設定檔案開啟wslInheritsWindowsSettings、且 HKCU 的值也設定了它時。」2026年11月25日重新讀取;措辭已有變動的引文,改以當日的措辭呈現。提示快取:「除非您自行選擇 TTL,否則 Claude Code 僅在 Claude 訂閱方案且位於方案內含用量範圍內時,才會要求一小時 TTL」;各儲存區的表格列出 Main conversation:一小時(訂閱方案,方案用量範圍內)/五分鐘(用量額度、API 金鑰或雲端供應商),以及 Everything else:「五分鐘,但由伺服器控制的輔助請求除外,其取得一小時」/五分鐘;「兩項設定與兩個環境變數皆需要 Claude Code v2.1.242 或更新版本」;優先順序:「1.
FORCE_PROMPT_CACHING_5M=1,強制兩個儲存區皆為五分鐘 2. 該儲存區的環境變數 3. 該儲存區的設定 4.ENABLE_PROMPT_CACHING_1H=1,為兩個儲存區要求一小時 5. 該請求所屬儲存區的預設值。」設定參考,
modelPicker:「範圍:使用者或受管。Claude Code 會從受管設定、--settings與使用者設定讀取此鍵值,並在專案與本機設定中忽略它,因此您複製的儲存庫無法重新標示選擇器」;「類型:物件,包含一個由列組成的options陣列,以及選用的replaceBuiltInOptions布林值」;「availableModels允許清單仍適用於這些列」;「標籤改變的是選擇器顯示的內容,而非 Claude Code 執行的模型」;「需要 Claude Code v2.1.242 或更新版本」(本指南的範例沿用該頁面自身的 Bedrock 列)。promptCacheTtl與subagentPromptCacheTtl:「範圍:任何檔案」;「類型:字串,為下列之一:"5m"……"1h"」;「需要 Claude Code v2.1.242 或更新版本。」設定範例中的供應商 ID 來自 Amazon Bedrock(「主要模型 | Opus 5,例如us-*區域中的us.anthropic.claude-opus-5」)、Google Cloud(「主要模型 |claude-opus-5」)與 Microsoft Foundry(export ANTHROPIC_DEFAULT_OPUS_MODEL='claude-opus-4-8',該頁面所列最新的 Opus ID)。 ↩↩↩ -
Claude Code CHANGELOG,2.1.243 章節,擷取於2026年8月26日。npm 於2026年8月24日 19:16 UTC 發布 2.1.242,並於 23:10 UTC 發布 2.1.243;2.1.242 沒有 CHANGELOG 章節,2.1.244 從未發布,而官方文件將
modelPicker、promptCacheTtl以及/usage的 Loops 列的最低版本訂為 v2.1.242。原文如下:”Added a Loops breakdown to/usage: per-loop run count, total tokens, tokens per run, and last run, so runaway or chatty/looptasks are easy to spot”;”AddedmodelPickersetting: curate the/modelpicker with an ordered, labeled list of models (any id spelling, including Vertex/Bedrock ids), appended to or replacing the built-in lineup”;”AddedpromptCacheTtlandsubagentPromptCacheTtlsettings so API-key and cloud-provider users can keep a 1-hour prompt cache on the main conversation while subagents stay at 5 minutes”;”AddedmodelPricingmanaged setting so an organization’s contracted per-model rates and discount multiplier are used for/cost, the status line, and telemetry cost figures instead of list price”;”Added a keyless sign-in under/login→ Anthropic Console: ‘Sign in with your Console account’ (recommended) alongside creating an API key, so organizations that don’t allow API keys can sign in”;“Added a
Skipped sourcesline to/statusthat lists managed settings sources (for examplemanaged-settings.json) present but not applied because a higher-precedence managed source is active”;”Added amanagedmarker in/mcpand/pluginson claude.ai connectors whose authentication is managed by your organization”;”Added a tip pointing claude.ai users who haven’t connected GitHub for Claude Code on the web to/web-setup“;”Added a/statusline showing whether GitHub is connected for Claude Code on the web (Pro/Max), pointing to/web-setupwhen it isn’t”;”Added the model (and effort level) each subagent ran on to/tasksand the agent detail dialogs”;”Improved/loop: consecutive wake-ups where Claude has nothing to do now fold into a single line in the terminal instead of printing each one”;”Fixed/web-setuprepeatedly asking you to log in when an older GitHub CLI (withoutgh auth token) was already authenticated”;”Improved native install and auto-update download size: the binary is now zstd-compressed (about 75 MB instead of 340 MB on Linux x64)”;”Changed the cross-session messaging inbox socket to close connections that send no complete line within 30 seconds; scripts posting to it should connect once their data is ready”。 ↩↩↩ -
Claude Code v2.1.234 版本資訊,2026年8月17日。新增:claude.ai 用量上限重設時自動延續工作階段(可透過
/config→ “Continue automatically at usage limit” 關閉)、CLAUDE_CODE_PROJECT_DIR_NAME、CLAUDE_CODE_GOAL_CHECKIN_MINUTES(預設 30;設為0則停用),且/goal遇到無法復原的錯誤時會自行清除;回合進行中可使用/permissions與/add-dir;GitLab MR 頁尾徽章;selection:clear;claude-apiskill 的脈絡從約 200k 縮減至約 25k;在預先核准的檔案存取中一律拒絕 NT 命名空間(\??\)路徑;以及 Remote Control 的帳號切換與 effort 同步修正。擷取於2026年8月17日。 ↩ -
Claude Code v2.1.233 版本資訊,2026年8月14日。新增:
--worktree/claude agents支援 GitLab MR(!N)、可選擇啟用的forward_user_identitygateway 設定、CLAUDE_CODE_TOOL_MEMORY_LIMIT(Bash 指令的 Linux cgroup)、CLAUDE_CODE_WEBFETCH_CACHE_TTL_MS;在 Opus 4.8、Sonnet 5、Fable 5、Mythos 5 及更新的模型上預設移除 todo/任務追蹤工具(CLAUDE_CODE_ENABLE_TODO_TOOLS=1可還原);修正 v2.1.232 在 Windows 上 auto 模式核准的回歸問題,並還原 v2.1.232 的 Cygwin 符號連結與輸入重新導向權限變更,待推出範圍更窄的版本;NTLM\??\路徑驗證修正、MCP v2 重新連線修正、Notification hook 與 Linux 閒置 CPU 修正、內建 skill 別名遮蔽修正。擷取於2026年8月15日。 ↩↩ -
Claude Code v2.1.229 版本說明,2026年8月12日。新增
claude remote-control --continue、供自架執行器使用的伺服器端提供 hooks、閘道串流的 SSE keepalive ping、具mode: "link"的 plugin 市集command來源、ListAgents的offline/cloud標籤、工作流程扇出前綴錯開(CLAUDE_CODE_WORKFLOW_PREFIX_STAGGER_MS=0可停用)、加括號 IPv6 位址的沙箱網域清單改為失敗即封閉、/commit-push-pr對危險旗標的提示、Windows 上的--base-dir必填要求、VSCode 工作階段群組,以及可調整大小的/btw。修正項目包括串流重複、窄終端機的 RangeError 當機、\\?\/UNC 路徑當機、自動模式歸屬標頭失效、閘道拒絕 1M/model、MCP OAuth 的127.0.0.1重新導向、GitHub Action 審查發布,以及 IDE 診斷停滯。擷取於2026年8月12日。 ↩ -
Claude Code CHANGELOG,23個環境變數的綜合參考(截至2026年4月)。OTel匯出器(
OTEL_LOGS_EXPORTER、OTEL_METRICS_EXPORTER、OTEL_TRACES_EXPORTER)自v2.1.85起支援以none停用。敏感欄位閘控:OTEL_LOG_TOOL_DETAILS(v2.1.85的tool_parameters)、OTEL_LOG_TOOL_CONTENT與OTEL_LOG_USER_PROMPTS(v2.1.101起需選擇加入,預設視為敏感)。CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC會停用版本說明的擷取(v2.0.17);設定後,v2.1.110也會在無頭/SDK模式下停止自動產生標題的Haiku請求。API/模型:CLAUDE_CODE_EXTRA_BODY(v2.1.113修正:在Vertex/subagent搭配output_config.effort時不再回傳400)、CLAUDE_CODE_MAX_CONTEXT_TOKENS(既有變數;v2.1.98修正了與DISABLE_COMPACT的互動問題)、CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS(v2.1.0)、CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK(v2.1.83)、ANTHROPIC_BETAS(v2.1.78針對Haiku的修正)、ANTHROPIC_SMALL_FAST_MODEL(v0.2.125起不再跳脫Bedrock ARN中的斜線)。Plugins/MCP:CLAUDE_CODE_PLUGIN_CACHE_DIR(v2.1.72修正了字面波浪號目錄的問題)、CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE(v2.1.90,離線友善)、CLAUDE_CODE_MCP_SERVER_NAME與CLAUDE_CODE_MCP_SERVER_URL(v2.1.85的headersHelper上下文)。Shell/IDE:CLAUDE_CODE_SHELL_PREFIX(v1.0.61)、CLAUDE_CODE_GIT_BASH_PATH(v2.1.98,Windows)、CLAUDE_CODE_EXIT_AFTER_STOP_DELAY(v2.0.35,SDK閒置)、CLAUDE_CODE_AUTO_CONNECT_IDE(v1.0.61)。企業版:CLAUDE_CODE_PROXY_RESOLVES_HOSTS(v2.0.55由預設開啟改為選擇加入)、CLAUDE_CODE_API_KEY_HELPER_TTL_MS(apiKeyHelper重新整理與5分鐘預設值於v0.2.74加入;用於覆寫TTL的環境變數於v0.2.117加入)。另外:ENABLE_PROMPT_CACHING_1H_BEDROCK,ENABLE_PROMPT_CACHING_1H的Bedrock專用別名;自v2.1.108起已棄用,但仍會生效並顯示棄用通知。 ↩↩↩↩↩ -
Claude Code的正式CHANGELOG,2.1.299章節,擷取於2026年10月14日,以及同日讀取的
@anthropic-ai/claude-code之npm registry中繼資料:2.1.299於2026年10月14日00:23 UTC發布,2.1.300於14:27 UTC發布;dist-tags為latest 2.1.299、next 2.1.300、stable 2.1.287;npm上沒有2.1.297或2.1.298,CHANGELOG也沒有這兩版或2.1.300的章節。GitHub發行版(02:49 UTC)包含190條項目,與CHANGELOG完全相同。本指南中所有v2.1.299項目的來源。重點引述:「終端機新增閒置壓縮:超過200K token的對話若閒置約54分鐘,會在其一小時提示快取過期前先行壓縮,讓您的下一則訊息不必重新處理全部內容」;「新增CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS以變更閒置壓縮的200K token下限;在settings.json中設定"idleCompaction": false可將其關閉。兩者皆需v2.1.290或更新版本」;「新增CLAUDE_CODE_DISABLE_FILE_MENTIONS環境變數:Claude只會取得@檔案提及的路徑,再以其檔案工具讀取,而非直接取得檔案內容」;「MCP允許規則現在只涵蓋其指名的伺服器:mcp__a不再允許名為a__b或a_的伺服器;請以伺服器完整的正規化名稱寫成mcp__<server>__*」;「agent的
tools:清單現在只納入指名MCP伺服器的工具;名稱含有__的伺服器請寫成mcp__<whole name>__*」;「來自Anthropic位於api.anthropic.com的第一方MCP伺服器之MCP工具描述與伺服器指示,現在會完整送達Claude,而不再於4,096個字元處截斷」;「雲端工作階段與Remote Control的MCP連接器,在未擷取任何旗標的安裝上,現在預設協商MCP協定版本2026-07-28;可透過MCP_PROTOCOL_NEGOTIATION=legacy選擇退出」;「UserPromptSubmithooks現在會在skill或自訂斜線命令展開之前執行,因此封鎖提示的hook現在也會一併阻止其內嵌的shell命令」;「turn.startmod hook現在也會收到subagents與隊友的回合,而不只是主迴圈的回合;可透過e.agentId區分(主迴圈上不存在此欄位)」;「修正了對不執行rm的shell-c指令碼仍跳出rm提示的問題。在Claude Code無法讀取的指令碼中於執行期組成的rm,不再觸發提示,除非設定CLAUDE_CODE_STRICT_INLINE_SHELL_RM_PROMPT=1」;「為
claude self-hosted-runner orchestrator新增--shutdown-drain-sec:收到SIGTERM時停止輪詢,並給予進行中的輪詢與執行中的spawn hooks至多該秒數的時間完成」;「為claude plugin eval新增--disallow-tools與disallowed_tools案例欄位,可將Agent等特定內建工具排除在eval執行之外」;「新增關閉Claude Desktop的Code分頁中署名區塊的支援:在Claude apps gateway的code政策之env中設定CLAUDE_CODE_ATTRIBUTION_HEADER=0」;「在agent檢視中新增/effort與/fast,用於設定新工作階段的起始值;在該處單獨輸入/model、/effort或/fast現在會開啟選擇器」;「當plugin hook無法接收動作或無法回傳其判定時,該hook可封鎖的動作現在會被拒絕而非放行;已執行的工具,其結果會被扣留」;「修正2.1.296的回歸問題:雲端與無頭工作階段在重新啟動後恢復時,若恰好有新訊息抵達,可能會將已核准的工具呼叫執行兩次」;「網路安全防護通知不再要求使用者申請Cyber Verification Program」。 ↩↩↩↩↩ -
Claude Code 文件,擷取於2026年10月14日。設定參考:
idleCompaction,「阻止 Claude Code 壓縮您已離開的冗長對話」;「符合條件的對話預設會啟用閒置壓縮。若要關閉,請將idleCompaction設為false。需要 Claude Code v2.1.290 或更新版本」。環境變數:CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS「對話套用閒置壓縮的脈絡大小,以 token 計(預設值:200000)」,低於100000的值會被提高至100000;CLAUDE_CODE_DISABLE_FILE_MENTIONS「需要 Claude Code v2.1.299 或更新版本」,在專案與本機設定中會被忽略;CLAUDE_CODE_ATTRIBUTION_HEADER「設為0可省略署名區塊」;CLAUDE_CODE_OVERLOADED_RETRY_MAX_DELAY_MS「當 API 以529過載錯誤拒絕請求時,該請求各次重試之間退避時間的上限,以毫秒計(預設值:32000)」;仍然沒有CLAUDE_CODE_WORKFLOW_SUBAGENT_MODEL或CLAUDE_CODE_STRICT_INLINE_SHELL_RM_PROMPT的條目。子代理:autoCompactWindow現已列為 frontmatter 欄位,「100000以上的 token 數」;tools與disallowedTools「也接受整個 MCP 伺服器的項目」。2026年11月25日重新讀取;措辭已有變動的引文,改以當日的措辭呈現。Mods 參考:仍然標示「截至 v2.1.290」;「在
skill.prompt上,e.source、e.pluginName、e.path、e.frontmatter與e.frontmatterProblem需要 Claude Code v2.1.299 或更新版本」;turn.start列於事件清單中;沒有$.prompt.media、$.session.identity、tabular或serverToolUses。Plugin evals:「在 v2.1.299 之前,這類執行是依其已產出的內容評分」;沒有--disallow-tools。MCP:限制清單仍寫著「伺服器指示,以及預先載入之工具的描述:4,096 個字元」,沒有第一方例外;在 v2 執行階段上,Claude Code「會詢問 HTTP、stdio 與 claude.ai 連接器伺服器是否支援較新的修訂版,並對支援的伺服器使用該版本」。權限:「允許規則只在字面的mcp__<server>__前綴之後才接受工具名稱 glob。伺服器區段不得含有 glob,如此規則才會指向您所設定的特定伺服器。」Hooks:有描述CLAUDE_CODE_DISABLE_FILE_MENTIONS(「您相符的 PreToolUse hooks 會執行」);沒有說明UserPromptSubmit會在 skill 或命令展開之前執行。 ↩↩↩ -
Claude Code 正式 CHANGELOG,2.1.300 章節,擷取於2026年10月14日(21:40 PT),以及同時讀取的
@anthropic-ai/claude-codenpm 註冊表中繼資料:2.1.300 於10月14日 14:27 UTC 發布;dist-tags 為 latest 2.1.300、next 2.1.300、stable 2.1.292(當天早上還是 2.1.287)。GitHub 發行版(18:24 UTC)包含 88 個條目,與 CHANGELOG 完全相同。本指南中每一項 v2.1.300 項目的來源。關鍵引述:「在 AWS 上的 Claude Platform 新增/advisor;在您透過/advisor、advisorModel或--advisor選定之前不會有任何 advisor 執行,而CLAUDE_CODE_DISABLE_ADVISOR_TOOL=1會將其關閉」;「為 mod 的提示裝飾新增virtualText:繪製在提示框中的文字,永遠不會進入草稿或送出的提示」;「為 mods 新增$.ui.view({ agentId }):在您要求時於主檢視中顯示某個代理的逐字稿,而$.ui.view({})會返回」;「新增prompt.changemod hook,在提示框文字未經鍵入編輯而變更時觸發:召回的歷史條目、清除、復原,或是 plugin 的填入」;「在 OpenTelemetryapi_request事件中新增cache_creation_5m_tokens與cache_creation_1h_tokens,依存留期區分快取寫入」;「在追蹤 span 中新增 OpenTelemetry GenAI 語意慣例屬性,例如
gen_ai.provider.name、gen_ai.conversation.id、gen_ai.tool.name與error.type」;「將傳送至 api.anthropic.com 的大型請求改為即使停用遙測也使用 gzip 壓縮;設定CLAUDE_CODE_GZIP_REQUEST_BODIES=0可將其關閉」;「變更 hooks:來自 PreToolUse 與 PermissionRequest hooks 的updatedInput現在會像 Claude 自身的輸入一樣進行驗證:未知的鍵會被捨棄,而被工具拒絕的輸入會使呼叫遭到拒絕」;「從claude remote-control移除原本沒有作用的--sandbox與--no-sandbox旗標;現在傳入任一旗標都會以錯誤結束。請在設定中設置sandbox.enabled以沙箱化工作階段」;「變更本機工作階段逐字稿,使其也記錄每個 API 請求的系統提示、工具與參數,讓您選擇分享的逐字稿能精確重現請求」;「變更結束行為:背景命令在被要求停止 1.5 秒後仍在執行時將被強制終止」;「修正在背景命令仍在執行時結束,SessionEnd hooks 有時不會執行的問題」;「修正claude daemon stop --any在卡住的背景服務仍在執行時仍印出「stopped」的問題:現在會等待、強制終止該服務,若服務仍在則以結束代碼 1 回報」。 ↩↩ -
Claude Code 文件,擷取於2026年10月14日。使用 advisor 工具升級困難決策:「advisor 工具屬於實驗性功能,需要 Anthropic API、AWS 上的 Claude Platform,或 Claude Models on Google Cloud (Anthropic managed)。在 AWS 上的 Claude Platform 或 Claude Models on Google Cloud (Anthropic managed) 上,需要 Claude Code v2.1.300 或更新版本。在 Amazon Bedrock、Google Cloud 的 Agent Platform 或 Microsoft Foundry 上無法使用」;「advisor 會收到完整的對話,包括每一次工具呼叫與結果,並回傳指引,由 Claude 在繼續之前套用」;「以伺服器工具的形式在 Anthropic 的基礎設施上於伺服器端執行,訂閱帳戶與以 API 計費的帳戶皆可使用」;「沒有任何設定可以限制或強制 advisor 呼叫」;三種啟用方式:「
/advisor命令」、「advisorModel設定」、「--advisor旗標」;/advisor的文字形式「需要 Claude Code v2.1.260 或更新版本」;「claude --help中並未列出--advisor」;配對列「Opus 4.7 或 Opus 4.8 | Fable、Opus 4.7 或更新版本、Sonnet 5.5」、「Sonnet 5.5 | Fable、Opus 5 或更新版本、Sonnet 5.5」、「Opus 5 或 Opus 5.5 | Fable、Opus 5 或更新版本」、「Fable 5.1 | Fable 5.2 或 Fable 5.1」;「Haiku 4.5 可以呼叫 advisor,但無法擔任 advisor」;「子代理會繼承設定好的 advisor,並依其自身的模型套用相同的配對檢查」;「若 API 拒絕 Claude Code 所附加之 advisor 的配對,Claude Code 會在不附加 advisor 的情況下重新傳送該請求。對話會在沒有 advisor 的狀態下繼續,因此您不會看到錯誤,也不會有任何 advisor 呼叫」;2026年11月25日重新讀取;措辭已有變動的引文,改以當日的措辭呈現。費用:「advisor token 依 advisor 模型的輸入與輸出費率計費」、「advisor 用量會計入您方案的用量上限,但 Fable advisor 會以用量點數計費」;「切換
/advisor會保留快取的前綴」;「advisor 模型自身讀取對話的部分不會被快取」;需求包括「功能旗標擷取」,因此若設定DISABLE_TELEMETRY,「advisor 會保持關閉」;CLAUDE_CODE_DISABLE_ADVISOR_TOOL=1:「/advisor命令將無法使用,任何已設定的advisorModel都會被忽略。--advisor旗標會被接受但沒有作用」;逐字稿狀態「Reviewed」、「Declined」、「Unavailable」。CLI 參考:--advisor <model>「為此工作階段啟用伺服器端 advisor 工具,可使用模型別名fable、opus或sonnet,或完整的模型 ID。在此工作階段中優先於advisorModel設定」。設定參考:advisorModel「選擇 Claude 詢問 advisor 工具時由哪個模型回答」。環境變數:CLAUDE_CODE_DISABLE_ADVISOR_TOOL,以及CLAUDE_CODE_GZIP_REQUEST_BODIES「設為0可關閉傳送至api.anthropic.com的 Claude API、遙測與成品發布請求本文的 gzip 壓縮」。Mods 參考:仍然標示「截至 v2.1.290」;沒有virtualText、$.ui.view或prompt.change的條目。2026年11月10日重新讀取:該頁面現在寫著「advisor 工具屬於實驗性功能,需要 Anthropic API 或 AWS 上的 Claude Platform。在 AWS 上的 Claude Platform 上,需要 Claude Code v2.1.300 或更新版本。在 Amazon Bedrock、Google Cloud 的 Agent Platform 或 Microsoft Foundry 上無法使用」,且配對表格新增了幾列(請參閱 284)。 ↩↩↩ -
Claude Code 正式 CHANGELOG,2.1.301 與 2.1.302 兩節,擷取於2026年10月17日(太平洋時間 15:40),以及同時讀取的
@anthropic-ai/claude-codenpm registry 中繼資料:2.1.301 於10月15日 14:34 UTC 發布,2.1.302 於10月16日 16:48 UTC 發布;dist-tags latest 為 2.1.302、next 為 2.1.302、stable 為 2.1.292。GitHub 發行版 v2.1.301(19:22 UTC,51 項)與 v2.1.302(20:53 UTC,63 項)與 CHANGELOG 完全一致。本指南中所有 v2.1.301 與 v2.1.302 項目的來源。重點引文,2.1.302:”Changedclaude -pand Agent SDK sessions with no permission mode to start indefaultmode on third-party providers, with telemetry off or on a fresh install;--permission-mode autokeeps auto”;”Changed fork subagents (subagent_type: "fork") to be on by default inclaude -p, the Agent SDK, the desktop app and VS Code, as they already are in the terminal;CLAUDE_CODE_FORK_SUBAGENT=0turns them off, andclaude mcp servenever offers them”;”Changed the desktop app and VS Code to always run the main conversation’s subagents in the background, as the terminal does, rather than let Claude choose; a subagent’s own Agent calls inclaude -p, the Agent SDK, the desktop app and VS Code now run in the foreground by default”;“Changed prompt and agent hooks so that at most 12 of one event run at a time; the rest wait their turn”;”Added
CLAUDE_CODE_AUTO_MODE_MODELto choose the model the client-side auto mode classifier uses; it does not change the model for server-side auto mode”;”Added anIdle compactionrow to/configfor turning idle compaction off or back on; the notices shown after an idle compaction now say how to turn it off”;”Added a notice to/design-syncand/design-loginthat standalone Claude Design (claude.ai/design) closes by December 14, 2026”;”Fixed the Read tool loading an image file of any size, or a pipe or device named like an image, entirely into memory; image sources over 128 MB are now refused”;”Improved auto mode with the server-side classifier: a conversation too long for the safety check is now compacted, instead of every checked tool call being denied”。2.1.301:”Added
CLAUDE_CODE_RETRY_WATCHDOG_MAX_USAGE_LIMIT_WAIT_MSso unattended retry mode (CLAUDE_CODE_RETRY_WATCHDOG) ends a request at a usage limit that resets too far away instead of waiting”;”Added the%motion to vim mode: jump to the matching bracket, alone or with d/c/y”;”Addedrowsto a mod’sInput: a text field of several lines in the terminal, where Enter submits and Shift+Enter or a backslash before Enter starts a new line”;”Addedclassifier_verdictandpermission_modeto OpenTelemetrytool_decisionevents, so auto mode classifier decisions can be told apart from permission rules”;”Addedclassifier_categoryto OpenTelemetrytool_decisionevents, naming the built-in rule a classifier block matched, whenOTEL_LOG_TOOL_DETAILS=1“;”Fixed thefable(andbest) model alias erroring on the Anthropic API when the newest Fable model is not available to your organization: Claude Code now retries once on the previous Fable model”;”Improved switching to a model with a smaller context window: a conversation too long for the new model is now summarized by the previous model first”;”Changed a mod hook’s.catchhandler to run only when the hook throws or times out; events raised beneath the hook’s own calls now skip that hook without asking its.catch“;”Changed a mod’s$.env.setto resolve with{}once the variable is set or unset, or with{ deny }saying why when the write is not made”。 ↩↩↩ -
Claude Code 文件,擷取於2026年10月17日。互動模式:”
%| Jump to the matching(),[], or{}bracket, starting from the next bracket on the current line when the cursor isn’t on a bracket. Requires Claude Code v2.1.301 or later” 以及 “d%/c%/y%| Delete, change, or yank from the cursor through the bracket that%jumps to”。VS Code 頁面列出了 LaTeX 數學式渲染。仍停留在 2.1.302 之前規則的頁面:權限模式表格(”claude -por the Agent SDK |defaultin sessions that fetch feature flags. In sessions that don’t, such as on a third-party provider or with telemetry off,autowith Claude Code v2.1.285 or later”);環境變數頁面(CLAUDE_CODE_FORK_SUBAGENT“is on by default in interactive sessions only. Set to1to turn it on inclaude -pand the Agent SDK as well, or0to turn it off in every kind of session”);以及 subagents 頁面(”Fork mode is off in non-interactive mode with-pand in the Agent SDK unless you turn it on”)。文件中完全未提及的項目:
CLAUDE_CODE_AUTO_MODE_MODEL、CLAUDE_CODE_RETRY_WATCHDOG_MAX_USAGE_LIMIT_WAIT_MS、tool_decision的classifier_verdict、permission_mode與classifier_category屬性(監控頁面一項都未列出)、/config的 Idle compaction 列、Claude Design 的關閉日期,以及 12 個 hooks 的上限(hooks:”All matching hooks run in parallel”)。mods 文件現已自成一節:概覽、參考(”Entries cover the Claude Code CLI and the Desktop app as of v2.1.290, and the VS Code extension as of v2.1.299”)、事件(.catch:”Whenguardthrows or times out on a Bash call, Claude Code calls the handler with the same event”,未納入 v2.1.301 的重入規則)、API,以及介面;這些新頁面皆未提及Input的rows、$.env.set、nothing-to-fork、virtualText、$.ui.view、prompt.change、$.prompt.media或$.session.identity。advisor 頁面仍寫著該工具 “is not available on Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, or Microsoft Foundry”。 ↩ -
Claude Code 正式 CHANGELOG,2.1.303 至 2.1.310 各節,擷取日期為2026年10月23日(太平洋時間17:20),以及同時讀取的
@anthropic-ai/claude-codenpm 登錄檔中繼資料:2.1.303 於10月18日 21:15 UTC 發布,2.1.304 於10月19日 19:47 UTC,2.1.305 於10月20日 19:29 UTC,2.1.306 於10月21日 02:28 UTC,2.1.307 於10月21日 20:47 UTC,2.1.308 於10月22日 04:19 UTC,2.1.309 於10月22日 20:34 UTC,2.1.310 於10月23日 21:20 UTC;dist-tags 為 latest 2.1.310、next 2.1.310、stable 2.1.308。GitHub 各版本分別包含 1、76、38、2、43、1、79 與 26 個條目,與 CHANGELOG 一致。本指南中所有 v2.1.303 至 v2.1.310 項目的來源。重要引文,2.1.304:「Added
/auto-mode-setup: a guided setup that reads your project and recent sessions to teach auto mode about your environment, now also available on Bedrock, Vertex, Foundry, Claude apps gateway and telemetry-disabled sessions」;「Addeddecider: "person"to a mod’stool.checkanswer: only the permission dialog or a host’s callback can approve the ask, and it is refused with the mod’s reason where nobody can be asked」;「Added a warning on Pro and Max plans when resuming an inactive conversation would use a noticeable share of your 5-hour usage limit」;「Changed tool search to be on by default behind a customANTHROPIC_BASE_URL; a 400 or 422 from the gateway is retried without it」;「Changed mods’settings.readhooks to receive each settings layer and rewrite the merged settings, so a managed mod can make an organization’s setting a ceiling」;「Changed skill hooks: the skills of one source (a repo, your own folder, or a plugin) can register at most 1,024 hooks and 16,384 matcher characters per session」。2.1.305:「Added
sandbox.allowNestedUserNamespacesso sandboxed commands on Linux can create user namespaces (Chromium, rootless podman); this lets them get around the sandbox’s file protections」;「AddedCLAUDE_CODE_RETRY_WATCHDOG_USAGE_LIMIT_RECHECK_MSso unattended retry mode (CLAUDE_CODE_RETRY_WATCHDOG) notices a usage limit that was lifted before its reset」;「Fixed every request failing on Vertex, Bedrock and other providers when the endpoint or a gateway rejects tool search, and behind gateways with ToolSearch disallowed or left out of--tools(a 2.1.304 regression): Claude Code now retries without it」;「Improved/usage: each warning is now a one-line fix that names its source, andfapplies the fixes; the same fixes appear in VS Code and/doctor」;「ChangedallowedMcpServersto stop filteringmanaged-mcp.jsonstdio servers that use${VAR}only inenv: one your allowlist left out now loads on upgrade; usedeniedMcpServersto keep it off」。2.1.307:「Added
/claude-api api-versionto move Claude API code to API version2026-10-21」;「Added theclaude_code.safety_eventOpenTelemetry event for each tool call a permission rule, auto mode, a safety check, a hook or the sandbox stopped, prompted or sent back」;「Improved fork subagents launched together: each is now told which launch is its own, so forks are much less likely to try to start each other’s work」;「[Code Review] Added@claude review stop(alsooffandpause) to Code Review, ending an@claude review alwayssubscription on a pull request without starting a new review」。2.1.309:「Fixed sandboxed Bash commands on macOS and Linux running the shell’s startup files outside the sandbox before each command」;「Changedsed -ito get the standard Bash prompt and run as written, not a simulated file-edit preview; like other Bash edits, it is no longer restored by/rewind」;「Changedclaude ultrareviewto require workspace trust: it asks on a terminal, else refuses; scripts pass--trust-workspace, which takes no value (put a PR number or base branch before it), or setCLAUDE_CODE_DISABLE_ULTRAREVIEW_TRUST_CHECK=1」;「Fixed sessions compacting repeatedly after reading files under a very large nested CLAUDE.md; a nested CLAUDE.md over the size limit now loads only its start」;「Changed worktree creation and reuse so git no longer fetches objects on demand, in ordinary clones and in partial clones with a Bash sandbox configured; such a partial clone fetches them first」。2.1.310:「Added the Monitor tool and plugin monitors on Bedrock, Vertex, and Foundry, and when telemetry or nonessential traffic is disabled; long foreground sleeps are now blocked there too」;「Fixed requests failing behind some gateways and compatible servers that reject the
effort-2025-11-24beta value or mid-conversation system messages; Claude Code now retries without them」;「Linux: Improved/sandboxand the sandbox startup warning to name Ubuntu’s AppArmor restriction on user namespaces, and how to lift it, when it keeps bubblewrap from starting the sandbox」。 ↩↩↩↩ -
Claude Code 文件,擷取於2026年10月23日。現已正式記載:環境變數列出
CLAUDE_CODE_RETRY_WATCHDOG_USAGE_LIMIT_RECHECK_MS、CLAUDE_CODE_DISABLE_ULTRAREVIEW_TRUST_CHECK(「請在啟動 Claude Code 的環境中設定,而非設定檔的env」)、CLAUDE_CODE_AUTO_COMPACT_WINDOW(「200k這類帶後綴的值需要 v2.1.304 或更新版本」)以及CLAUDE_CODE_AUTO_MODE_MODEL(「請使用完整的模型 ID」),並改稱CLAUDE_CODE_FORK_SUBAGENT「控制 fork 模式,該模式預設開啟」;設定參考列出sandbox.allowNestedUserNamespaces(「使用者或受管」);auto mode 設定頁面寫有「使用/auto-mode-setup產生環境項目」;費用頁面:「當/usage頁尾顯示f to fix 2 of 3這類提示時,按下f即可讓 Claude Code 執行它能處理的建議。f快捷鍵需要 Claude Code v2.1.305 或更新版本」;斜線指令列出/claude-api api-version(「v2.1.307 或更新版本」)與managed-agents-secure [<agent-id>];監控列出safety_event與classifier_verdict(「需要 Claude Code v2.1.301 或更新版本」);ultrareview頁面記載了
--trust-workspace(「不接受任何值:請將 PR 編號或基底分支放在它前面」)以及Error: Workspace not trusted的結束狀態;程式碼審查頁面列出 Quick、Standard 與 Deep 三個層級;hooks載有 1,024 個 hook 與 16,384 字元的上限;mods 參考將e.isReadOnly標註為「v2.1.304 或更新版本」;沙箱頁面載有 Ubuntu AppArmor 設定檔;而權限模式表格現在寫為「claude -p或 Agent SDK |default」,與 v2.1.302 一致。仍僅見於發行說明的有:decider: "person"、settings.read層級、@claude review stop、sed -i的變更、自訂 base URL 下的工具搜尋預設行為、Pro 與 Max 方案的工作階段恢復警告、--checkout-hook-timeout-min、multiagent_20261001、CLAUDE_CODE_RETRY_WATCHDOG_MAX_USAGE_LIMIT_WAIT_MS、Claude Design 的結束日期,以及 mod 新增的$.env.set、virtualText、$.ui.view與prompt.change;advisor頁面仍寫著該工具「無法在 Amazon Bedrock、AWS 上的 Claude Platform、Google Cloud 的 Agent Platform 或 Microsoft Foundry 使用」。 ↩↩↩↩ -
以 artifacts 形式分享工作階段輸出,Claude Code 文件,擷取於2026年10月26日:「範本目前為測試版。在 Pro、Max、Ultra 與 Team 方案上預設開啟」(2026年11月10日重新讀取;10月26日時為「Pro、Max 與 Team 方案」);「若您的組織已關閉 Slides 範本,
/slides就不會出現」;停用 artifacts 表格(/config、"enableArtifact": false、已棄用的"disableArtifact": true、CLAUDE_CODE_DISABLE_ARTIFACT=1、permissions.deny中的Artifact);「要在專案與本機設定中採用此鍵,需要 Claude Code v2.1.242 或更新版本」。環境變數,同次擷取:CLAUDE_CODE_ARTIFACT_AUTO_OPEN(「設為0可讓 Claude Code 在發布新 artifact 時不再自動開啟瀏覽器」)、CLAUDE_CODE_DISABLE_WORKFLOWS(「等同於disableWorkflows設定」)、CLAUDE_CODE_MAX_TURNS(「等同於傳入--max-turns,兩者同時設定時以後者為準。非正整數的值會在啟動時被拒絕」);該頁面不再列出CLAUDE_CODE_WORKFLOWS。設定參考,同次擷取:disableWorkflows(「兩者之中任一個將其關閉後,另一個都無法再將其開啟」)與enableWorkflows(「預設:未設定,因此除非您使用 Pro 方案(該方案預設關閉),否則工作流程皆為開啟」;「在/config中顯示為 Dynamic workflows」)。 ↩↩ -
Claude Code CHANGELOG,v2.1.311 至 v2.1.317(提交時間為 2026-10-26T21:51Z、10-27T20:23Z、10-30T01:06Z、10-31T01:01Z 與 11-03T01:25Z),以及對應的 GitHub 發行版本 v2.1.311(2026-10-26T21:51:23Z)、v2.1.312(10-27T20:24:20Z)、v2.1.314(10-30T01:06:26Z)、v2.1.316(10-31T01:01:35Z)與 v2.1.317(11-03T01:25:46Z),各版內容均與其 CHANGELOG 章節完全相同;npm 發布時間取自
npm view @anthropic-ai/claude-code time:2.1.311 為 2026-10-26T19:47:57Z、2.1.312 為 10-27T18:36:10Z、2.1.314 為 10-30T00:12:56Z、2.1.315 為 10-30T21:05:24Z(無 CHANGELOG 條目,亦無 GitHub 發行版本)、2.1.316 為 10-31T00:42:05Z、2.1.317 為 11-02T23:57:53Z;2026-11-02 當日的 dist-tags:latest與next為 2.1.317,stable為 2.1.311。原文摘錄,2.1.311:「將互動式終端機中的ultrathink改為透過 Anthropic 的 API,在 Opus 5.5、Sonnet 5.5、Haiku 5.5 與 Fable 5.1 上以 xhigh 強度等級執行該輪;若在 Claude 工作期間輸入,則提升該輪剩餘部分的強度」。2.1.316:「自2026年10月30日起棄用 Opus 4.8 的快速模式;將於2026年11月30日移除。移除後,Opus 4.8 上的快速模式請求會回傳錯誤,且不會回退至標準 Opus 4.8。請遷移至 Opus 5.5 以保留加速效果」。2.1.314:「新增permissions.blockWritesOutsideWorkingDirectories:在所有權限模式下,Write、Edit 與 NotebookEdit 均拒絕工作目錄以外的路徑」。2.1.312:「將 prompt 與 agent hooks 改為每個工作階段最多同時執行 24 個(含 subagents),其中等待時間超過其事件逾時的最多 12 個;timeout低於 1 秒者現在以 1 秒計」;「Claude Code 不再傳送claude_code.safety_eventOpenTelemetry 事件」。2.1.317:「在 OTel 指標、事件與 span 中新增anthropic.plan、anthropic.seat_type、anthropic.provider與anthropic.custom_base_url」。 ↩↩↩↩↩↩↩ -
Claude Code 文件,擷取於2026年11月2日:以快速模式加快回應(「Opus 4.8 的快速模式已於2026年10月30日棄用,並將於2026年11月30日移除。若在該日期之後仍以 Opus 4.8 為模型並開啟快速模式,API 會拒絕您的請求」);模型設定(「終端機提示:該字詞可以提升該回合時,會以彩虹色顯示。需要 Claude Code v2.1.311 或更新版本。」);所有設定中的
permissions.blockWritesOutsideWorkingDirectories(「讓Write、Edit與NotebookEdit工具在所有權限模式下(包括bypassPermissions)拒絕工作目錄以外的路徑」;「此鍵啟用後,Claude Code 也會移除EnterWorktree與ExitWorktree工具」)、idleCompaction(預設啟用於「互動式終端機工作階段、VS Code 擴充功能的聊天面板,或桌面應用程式 Code 分頁中於您的機器上或透過 SSH 執行的工作階段」)以及disableRemoteControl(「Claude Code 會拒絕claude remote-control、--remote-control旗標、自動啟動與工作階段內的切換」);2026年11月25日重新讀取;措辭已有變動的引文,改以當日的措辭呈現。環境變數中的
CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT、CLAUDE_CODE_DISABLE_REFUSAL_FALLBACK、CLAUDE_CODE_SYNC_SKILLS、CLAUDE_CODE_TRANSCRIPT_LOCAL_GC、CLAUDE_CODE_SKIP_PROMPT_HISTORY、CLAUDE_CODE_DISABLE_CFC_PROMPT與FORCE_HYPERLINK(「在 v2.1.314 之前,false、no與off反而會啟用超連結」);該頁面尚未列出CLAUDE_CODE_DISABLE_ULTRATHINK、CLAUDE_CODE_SUBAGENT_EFFORT、CLAUDE_CODE_MODEL_CATALOG、CLAUDE_CODE_DISABLE_LOOPED_CROSS_CERT_DROP、CLAUDE_CODE_DISABLE_NESTED_SESSION_ID或OTEL_EXPORTER_OTLP_TIMEOUT;建立自訂 subagents(「CLAUDE_CODE_EFFORT_LEVEL環境變數的優先順序高於兩者」);自架環境參考(--hold-idle-file、--max-hold-min:「需要 Claude Code v2.1.311 或更新版本」);自架環境(「於 Team 與 Enterprise 方案公開測試中,預設關閉」);設定伺服器管理的設定;Claude 應用程式閘道設定(「policy_mode需要閘道伺服器上的 Claude Code 為 v2.1.316 或更新版本」;identity_retention_days「預設90」);透過 Remote Control 從任何裝置接續本機工作階段。2026年10月26日至11月3日間,code.claude.com 共有 137 個頁面的 sitemaplastmod發生變動;Wayback CDX 索引顯示其中沒有任何頁面是在該期間首次發布。 ↩↩↩↩↩ -
Claude Code CHANGELOG,v2.1.318 至 v2.1.322(提交時間為 2026-11-04T00:00Z、11-06T17:03Z、11-09T19:22Z 與 11-10T02:29Z),以及對應的 GitHub 發行版本 v2.1.318(2026-11-04T00:01:03Z)、v2.1.319(11-06T17:04:01Z)、v2.1.321(11-09T19:22:30Z)與 v2.1.322(11-10T02:29:43Z),各版內容均與其 CHANGELOG 章節完全一致(分別為 84、146、118 與 1 條項目);v2.1.320 沒有任何標籤、發行版本或 CHANGELOG 章節。npm 發布時間取自
npm view @anthropic-ai/claude-code time:2.1.318 為 2026-11-03T21:55:17Z、2.1.319 為 2026-11-06T00:58:56Z、2.1.321 為 2026-11-09T19:02:47Z、2.1.322 為 2026-11-10T01:58:41Z;2026-11-10 時的dist-tags:latest為 2.1.322、next為 2.1.322、stable為 2.1.311。2.1.321 原文:「Added Claude Fable 5.2 (claude-fable-5-2), now the default Fable model」,並附「1M context, $8/$40 per Mtok with $0.20/Mtok cache reads」;「Changed saved Fable 5.1 model picks to move tofable: on Pro and Max plans at once, on Team and Enterprise plans once your organization allows it; use/model claude-fable-5-1to switch back」;「Added--settings <file>toclaude remote-control, which applies a settings file to every session it starts」;「Changed mods Claude writes to turn on without asking in auto and bypass modes … and not to load indontAskmode」;「Changed mods’ own tool calls ($.tool.call,$.mcp.call) to raise no permission prompt」。2.1.322:「Added fast mode on Vertex in the global, us and eu regions, falling back to standard speed if Vertex refuses it」。2.1.319:「Changed auto mode with telemetry or feature flags off, including behind LLM gateways: calls the server can’t check are asked about or denied, with no fallback to the built-in classifier; set
CLAUDE_CODE_AUTO_MODE_SERVER=0to keep using it (Bedrock, Vertex and Foundry are unchanged)」;「Added support for MCP tasks in the terminal」;「Addedpermissions.denyInsteadOfPromptingsetting: a tool call that would wait on a permission prompt is denied and the turn continues, in terminal sessions, subagents and teammates」;「Added theCLAUDE_CODE_DISABLE_FEATURE_FLAGSenvironment variable, which stops feature-flag fetching without turning off telemetry」;「Changed MCP tasks to work in the terminal without feature-flag fetching (Bedrock, Vertex, Foundry, LLM gateways,DISABLE_TELEMETRY); setCLAUDE_CODE_DISABLE_MCP_TASKS=1to turn them off」;「Changed self-paced/loopto end when a turn finishes without rescheduling … setCLAUDE_CODE_LOOP_KEEPALIVE=1to keep the old behavior」;「Removedshortcuts_listandshortcuts_execute… from Claude Code’s built-in Claude in Chrome tools」。2.1.318:「Added the date a stored claude.ai sign-in ends toclaude auth status(loginExpiresAt) and toclaude -pJSON results (credential_expires_at)」;「Changed Claude Code to no longer install or update the IDE extension when started in an IDE terminal」;「Changed background subagents to move a shell command to the background after 3 minutes on all providers」。 ↩↩↩ -
Anthropic 文件,擷取於2026年11月10日。Claude Fable 5.2 模型總覽:「2026年11月9日發布」;「上下文視窗:1M token · 最大輸出:128K token · 輸入定價:$8 / MTok · 輸出定價:$40 / MTok」;定價表格(5 分鐘快取寫入 $10、1 小時快取寫入 $16、快取讀取 $0.20);「預設 effort |
high」;「可靠知識截止日期 | 2026年6月」;「需要 30 天的資料保留,除非經 Anthropic 明確授權,否則無法在 Zero Data Retention 下使用」;Mythos 5.2「與 Claude Fable 5.2 共用相同的規格與定價」。定價:Fable 5.2 這一列($8 / $10 / $16 / $0.20 / $40)、Fable 5.1 這一列($10 / $12.50 / $20 / $0.25 / $50)、「Claude Fable 5.2、Claude Mythos 5.2、Claude Fable 5.1 與 Claude Mythos 5.1 的快取命中與重新整理按基礎輸入價格的 0.025 倍計價」、快速模式表格(「Claude Fable 5.2 | $16 USD / MTok | $80 USD / MTok」),以及「Claude Fable 5.2 的快速模式也可在 Claude Models on Google Cloud 上使用」。推出 Claude Fable 5.2 與 Claude Mythos 5.2。模型設定:「
best| 使用與opus相同的模型」(Wayback Machine 於11月2日、6日與9日對同一頁面的存檔寫的是「在可使用 Fable 的環境中,使用fable別名所解析的模型」);「fable別名在 Claude apps gateway 工作階段中解析為 Fable 5,在其他所有環境中解析為 Fable 5.2」;「在任何方案或供應商上,都沒有任何 Fable 模型是帳號類型的預設模型」;「在 Pro、Max、Ultra、Team 與 Enterprise 方案上,儲存在使用者設定中的claude-fable-5-1模型會改為fable別名」;「Fable 5.2 需要 Claude Code v2.1.321 或更新版本」;「Fable 5.2、Opus 5.5、Sonnet 5.5 與 Haiku 5.5 預設為medium,Opus 4.7 則預設為xhigh」。快速模式:「Claude Fable 5.2 與 Claude Opus 5.5 的快速模式已可使用。Claude Opus 5 與 Claude Opus 4.8 的快速模式處於研究預覽階段」;「Fable 5.2 為 $16/$80,Opus 5.5 為 $8/$40,Opus 5 與 Opus 4.8 為 $10/$50」;「Fable 5.2 上的快速模式需要 Claude Code v2.1.321 或更新版本」;「在 Fable 5.2 上,只有在您使用 Fable 5.2 時開啟的快速模式才會保留」;Agent Platform 章節(「需要 Claude Code v2.1.322 或更新版本」、「export VERTEX_REGION_CLAUDE_FABLE_5_2=global」、「Fast mode needs Vertex region global, us or eu」(快速模式需要 Vertex 區域為 global、us 或 eu)、「Using standard speed on Fable 5.2 · fast mode wasn’t available」(以標準速度使用 Fable 5.2 · 無法使用快速模式))。所有設定:「permissions.denyInsteadOfPrompting… 需要 Claude Code v2.1.319 或更新版本」;「範圍:使用者或受管,以及--settings。儲存庫無法替您設定此項」;「denyInsteadOfPrompting還會阻止哪些操作」清單。環境變數:
CLAUDE_CODE_DISABLE_FEATURE_FLAGS(「需要 Claude Code v2.1.319 或更新版本 … 舊名稱DISABLE_GROWTHBOOK仍可使用,而且 v2.1.124 至 v2.1.318 只會讀取這個名稱」)、CLAUDE_CODE_DISABLE_MCP_TASK_BACKGROUND(「需要 Claude Code v2.1.304 或更新版本」)。MCP:「MCP 任務在 Claude Code CLI 中處於公開測試階段,需要 Claude Code v2.1.304 或更新版本」;「呼叫要成為 MCP 任務需要什麼」清單;「單次的claude -p "<prompt>"執行不會取得 MCP 任務」。費用:「訂閱方案定價(Pro、Max、Ultra、Team、Enterprise)」;claude.com/pricing:「Free、Pro、Max、Ultra、Team 與 Enterprise 等方案層級」。使用 advisor 工具升級困難決策,依主模型列出可接受的 advisor:「Haiku 4.5 | Fable、Opus、Sonnet、Haiku 5.5」、「Sonnet 4.6 | Fable、Opus、Sonnet、Haiku 5.5」、「Opus 4.6 | Fable、Opus、Sonnet 5 或更新版本、Haiku 5.5」、「Sonnet 5 或 Haiku 5.5 | Fable、Opus 4.7 或更新版本、Sonnet 5 或更新版本、Haiku 5.5」、「Opus 4.7 或 Opus 4.8 | Fable、Opus 4.7 或更新版本、Sonnet 5.5」、「Sonnet 5.5 | Fable、Opus 5 或更新版本、Sonnet 5.5」、「Opus 5 或 Opus 5.5 | Fable、Opus 5 或更新版本」、「Fable 5 | Fable 5.2、Fable 5.1 或 Fable 5」、「Fable 5.1 | Fable 5.2 或 Fable 5.1」、「Fable 5.2 | Fable 5.2」;「Fable 5.2 需要 Claude Code v2.1.321 或更新版本,Fable 5.1 則需要 v2.1.257 或更新版本」。 ↩↩↩↩ -
Claude Code Docs。「模型設定」。擷取於2026年11月10日。依方案與供應商區分的預設模型:「Pro、Max、Ultra、Team、Enterprise 與 Anthropic API:預設為 Opus 5.5」;「AWS 上的 Claude Platform、Claude Models on Google Cloud (Anthropic managed)、Amazon Bedrock 與 Google Cloud 的 Agent Platform:預設為 Opus 5.5」;「Microsoft Foundry:預設為 Sonnet 4.5」。關於
ultrathink關鍵字:「在工作階段中執行/model,切換至 Opus 5.5、Sonnet 5.5、Haiku 5.5、Fable 5.2 或 Fable 5.1 模型。」2026年11月25日重新讀取;措辭已有變動的引文,改以當日的措辭呈現。 ↩ -
Claude Code CHANGELOG,擷取於2026年11月10日。v2.1.15:「Added deprecation notification for npm installations - run
claude installor see https://code.claude.com/docs/en/setup for more options」v2.1.113:「Changed the CLI to spawn a native Claude Code binary (via a per-platform optional dependency) instead of bundled JavaScript」v2.1.208:「AddedCLAUDE_CODE_PROCESS_WRAPPER: agent view and the background service now honor a corporate launcher by running every Claude Code self-spawn through a required wrapper executable」v2.1.224:「Removed the 200-subagent-per-session spawn cap; long-running sessions no longer refuse new agents (concurrency and depth limits still apply)」v2.1.271:「Changed the default dynamic workflow size to small on Pro plans and lowered the medium size guideline from 15 to 10 agents」Node 版本下限,取自2026年11月10日執行的npm view @anthropic-ai/claude-code@<version> engines:2.1.197 為"node": ">=18.0.0";2.1.198 與 2.1.322 為"node": ">=22.0.0"。 ↩ -
Claude Code Docs。「環境變數」。擷取於2026年11月10日。引用的各列:
CLAUDE_CODE_SHELL,「不支援fish等其他 shell。」;DISABLE_FEEDBACK_COMMAND,「也接受舊名稱DISABLE_BUG_COMMAND」;CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION,「已於 v2.1.224 移除,現已無作用。」;BASH_DEFAULT_TIMEOUT_MS,「(預設:120000,即 2 分鐘)」;MCP_TIMEOUT,「MCP 伺服器啟動的逾時時間,以毫秒為單位(預設:30000,即 30 秒)」;MCP_TOOL_TIMEOUT,「MCP 工具執行的逾時時間,以毫秒為單位(預設:100000000,約 28 小時)。」;BASH_MAX_OUTPUT_LENGTH,「若您設定了bashOutputMaxChars,Claude Code 會忽略此變數。」;CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS,「預設預算為 1.5 秒,並會自動提高至設定檔中所設定的單一 hook 最高timeout,最多 60 秒。」;ANTHROPIC_DEFAULT_SONNET_MODEL,「sonnet別名所解析的模型 ID,也是opusplan在規劃模式未啟用時使用的模型。」;ANTHROPIC_SMALL_FAST_MODEL,「[已棄用] 用於背景任務的 Haiku 級模型名稱」;CLAUDE_CODE_TOOL_MEMORY_LIMIT,「以純數字寫出大小:單獨的數字表示位元組數,或加上K、M、G或T後綴。」;VERTEX_REGION_CLAUDE_5_5_OPUS,「於 v2.1.280 新增」;VERTEX_REGION_CLAUDE_FABLE_5_2,「於 v2.1.321 新增」。同一頁面也載有MAX_THINKING_TOKENS、CLAUDE_CODE_MAX_OUTPUT_TOKENS、ENABLE_TOOL_SEARCH、SLASH_COMMAND_TOOL_CHAR_BUDGET、CLAUDE_CODE_GIT_BASH_PATH、CLAUDE_CODE_PROCESS_WRAPPER、CLAUDE_CODE_USE_POWERSHELL_TOOL、CLAUDE_CODE_ENABLE_AWAY_SUMMARY與CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC的列。 ↩↩↩↩↩↩↩↩↩ -
Claude Code Docs,「所有設定」,以及 Claude Code Docs,「設定檔與優先順序」。擷取於2026年11月10日。
model:「在單一工作階段中,--model優先於ANTHROPIC_MODEL,兩者又都優先於此鍵,包括優先於受管的model」processWrapper:「需要 Claude Code v2.1.210 或更新版本。」workflowSizeGuideline:「"small"要求少於 5 個 agents,"medium"少於 10 個,"large"少於 50 個。」,預設值為「"medium";若您以 Pro 方案登入且使用 Claude Code v2.1.271 或更新版本,則為"small"」bashOutputMaxChars:「Claude Code 會將此值限制在4000至128000的範圍內」以及「未設定,因此 Claude 最多可以內嵌方式收到 30,000 個字元」sandbox.enableWeakerNetworkIsolation:「讓gh、gcloud與terraform在 macOS 的沙箱內,於 MITM 代理伺服器後方驗證 TLS」spinnerVerbs、language與autoMemoryDirectory項目提供了範例所用的值格式。受管設定,取自設定頁面:「若您的組織管理 Claude Code,部分設定會替您決定,您在自己的檔案中放入的任何內容都不會改變它們。」 ↩↩↩↩↩↩ -
Claude Code Docs,擷取於2026年11月10日。工具參考,記憶體上限:「Claude Code 會將工作階段中所有 Bash、PowerShell 與 Monitor 指令合併計入同一個上限,而非逐一計算每個指令。」以及「當指令無法維持在上限以下時,核心會終止某個指令,而其結果中沒有任何內容會指出該上限。」透過 MCP 將 Claude Code 連接至工具,工具搜尋:「Claude Code 在 Claude Opus 4、Claude Sonnet 4、Claude Haiku 4.5 及之後的模型上使用工具搜尋;在 Google Cloud 的 Agent Platform 上,則是 Opus 4.5、Sonnet 4.5、Haiku 4.5 及之後的模型。」以及關於
auto:「達到 10% 或以上時,工具搜尋就會開啟」監控,tool_decision屬性:「classifier_verdict:auto mode 分類器對該呼叫的判定;若沒有判定,則為 Claude Code 拒絕該呼叫的原因。需要 Claude Code v2.1.301 或更新版本」以及「classifier_category(當OTEL_LOG_TOOL_DETAILS=1時)」 ↩↩↩↩ -
Claude Code Docs,「所有設定」;Claude Code Docs,「驗證」;Claude Code CHANGELOG;以及
@anthropic-ai/claude-code的 npm registry 紀錄。擷取於2026年11月11日。設定參考中的modelPricing項目:「Claude Code 不會從您的合約或 Claude Console 讀取它們。需要 Claude Code v2.1.242 或更新版本。」驗證頁面中關於不使用 API 金鑰登入的說明:「在/login提示中選擇 Anthropic Console 帳號後,Claude Code 會詢問您要以何種方式登入。需要 Claude Code v2.1.242 或更新版本。」CHANGELOG 有 2.1.243 章節與 2.1.241 章節,但沒有 2.1.242 章節;它在 2.1.243 之下列出「AddedmodelPricingmanaged setting so an organization’s contracted per-model rates and discount multiplier are used for/cost, the status line, and telemetry cost figures instead of list price」與「Added a keyless sign-in under/login→ Anthropic Console」。registry 的time欄位將 2.1.242 的時間記為 2026-08-24T19:16:14.767Z,2.1.243 記為 2026-08-24T23:10:45.498Z。 ↩ -
Claude Code Docs。「工具參考」。擷取於2026年11月11日。Glob 工具的行為:「在 Windows 上,它屬於預設工具組。在 macOS、Linux 與 WSL 上,Claude Code 會將 Glob 與 Grep 排除在預設工具組之外,Claude 改為透過 Bash 工具使用
find與grep搜尋。」工具表格對Glob與Grep都寫著:「在 macOS、Linux 與 WSL 上預設不提供。」 ↩ -
Claude Code Docs,擷取於2026年11月11日。搭配螢幕閱讀器使用 Claude Code:「若要套用到這台機器上的每個工作階段:請在使用者設定檔中加入
"axScreenReader": true。」以及「無論其值為何,Claude Code 都會忽略專案的.claude/settings.json與.claude/settings.local.json中的axScreenReader鍵,以及env之下的CLAUDE_AX_SCREEN_READER值。」所有設定的axScreenReader項目:「Claude Code 會忽略專案設定與本機設定中的此鍵,因此無論是儲存庫還是您自己的.claude/settings.local.json,都無法開啟或關閉螢幕閱讀器模式。」設定檔與優先順序將使用者設定檔列為~/.claude/settings.json。版本下限:CLI 參考中的--ax-screen-reader這一列與環境變數頁面中的CLAUDE_AX_SCREEN_READER這一列,結尾都寫著「需要 Claude Code v2.1.181 或更新版本」,而 Claude Code CHANGELOG 則將此功能列於 2.1.208 之下:「Added screen reader mode: opt-in plain-text rendering for screen reader users.」 ↩ -
Claude Code Docs。「設定檔與優先順序」。擷取於2026年11月11日。「除非是您手動建立的,否則不需要自行將它加入 gitignore。」以及「Claude Code 第一次在尚未忽略該檔案的 git 儲存庫中寫入它時,會將
**/.claude/settings.local.json加入您的全域 git 排除檔案,讓此檔案在每個儲存庫中都不會進入您的提交。」以及「若檔案是您手動建立的,且 Claude Code 尚未寫入過,請自行將它加入.gitignore。」 ↩ -
Claude Code Docs,「所有設定」,以及 Claude Code Docs,「設定沙箱化的 Bash 工具」。擷取於2026年11月11日。設定參考中的
sandbox.excludedCommands項目:「不含萬用字元的模式為完全比對,因此docker只會比對不帶引數的docker。」以及「只有當您的項目涵蓋某個 Bash 呼叫中的每一道指令時,才會將該呼叫移出沙箱」以及「排除是一種便利措施,而非安全邊界」;其範例值為["docker *"]。取自沙箱頁面:「docker *會比對帶或不帶引數的docker」以及「被排除的指令會以您的完整存取權限執行。」 ↩↩ -
Claude Code Docs,「設定沙箱化的 Bash 工具」,以及 Claude Code Docs,「所有設定」。擷取於2026年11月11日。取自沙箱頁面,關於允許網域以外的主機:「在互動式終端機工作階段中,決定取決於您的權限模式」,表格各列為「
bypassPermissions模式,以及可使用略過權限的規劃模式」(「不經提示即允許」)、「Manual 模式、acceptEdits模式,以及其他情況下的規劃模式」(「會出現提示」)、auto mode(「拒絕,除非指令已列出該主機且分類器已核准該清單」)以及dontAsk模式(「拒絕」)。嚴格允許清單:「內建的沙箱代理伺服器會在每種權限模式下拒絕連線。在bypassPermissions模式下,允許網域以外的主機會被允許,除非其中一項已開啟。」可設定的位置:「在使用者、受管或 CLI--settings設定中設為true」以及「在儲存庫的.claude/settings.json或.claude/settings.local.json中設定沒有作用。需要 Claude Code v2.1.219 或更新版本。」設定參考中的sandbox.network.strictAllowlist項目將範圍列為「使用者或受管」,並補充「儲存庫無法將其開啟或關閉。」 ↩↩ -
Claude Code Docs,「所有設定」,以及 Claude Code CHANGELOG。擷取於2026年11月11日。設定參考中的
syncClaudeAiPlugins項目:「設為false可停止該下載,並停止載入它已同步的 plugins。」以及「需要 Claude Code v2.1.273 或更新版本。」;syncClaudeAiSkills項目未註明版本。CHANGELOG 將這兩個鍵都列於 2.1.275 之下:「Added syncing of the skills and plugins enabled on your claude.ai account to terminal sessions signed in with it; opt out withsyncClaudeAiSkills: falseorsyncClaudeAiPlugins: false」 ↩ -
Claude Code Docs,「選擇權限模式」,以及 Claude Code Docs,「環境變數」。擷取於2026年11月11日。選擇分類器模型:「設為完整的模型 ID,即可讓分類器在預設以外的模型上執行」以及「此
~/.claude/settings.json範例設定了 Claude Sonnet 4.6」;範例值為claude-sonnet-4-6。當您的模型不進行審查時:「您設定了 Claude Opus 5、Sonnet 5.5、Opus 5.5,或是模型政策所排除的模型」,結果為「由預設的分類器模型審查」,而在/status顯示 auto mode 伺服器已啟用的情況下,則為「由伺服器審查,不使用您的模型」環境變數頁面上的CLAUDE_CODE_AUTO_MODE_MODEL這一列:「請使用完整的模型 ID,例如claude-sonnet-4-6。」以及「需要 Claude Code v2.1.302 或更新版本」2026年11月25日重新讀取;措辭已有變動的引文,改以當日的措辭呈現。 ↩ -
Claude Code Docs,「選擇權限模式」,以及 Claude Code Docs,「環境變數」。擷取於2026年11月11日。取自權限模式頁面,
auto模式下的關鍵路徑刪除操作:「在終端機中請您核准,並設有時間限制。在其他地方則拒絕」倒數計時:「在auto與bypassPermissions模式下,關鍵路徑刪除操作的終端機提示會顯示兩分鐘的倒數計時」將CLAUDE_CODE_DISABLE_DANGEROUS_RM_TIMEOUT設為1時,bypassPermissions項目寫的是「終端機提示沒有時間限制,VS Code 聊天面板則會詢問您」,auto項目寫的是「由分類器決定,適用於終端機、VS Code 聊天面板、-p執行與 Agent SDK 工作階段」設定位置:「請在啟動 Claude Code 的環境中設定,例如您的 shell 或 SDK 的env選項,而非 Claude Code 設定檔。」詢問規則:「Claude Code 會改為詢問您,即使在auto模式下也是如此,且沒有時間限制」涵蓋的路徑:「可辨識的rm與rmdir關鍵路徑刪除操作,例如rm -rf /或rm -rf ~」取自環境變數頁面上此變數的這一列:「此後,這些刪除操作在auto模式下會交由分類器處理;在bypassPermissions模式下,只要 Claude Code 能夠顯示提示,就會出現沒有時間限制的提示。請在啟動 Claude Code 的環境中設定,因為 Claude Code 會忽略透過設定的env區塊傳入的副本。需要 Claude Code v2.1.281 或更新版本」 ↩↩ -
Claude Code Docs,「CLI 參考」,以及 Claude Code Docs,「環境變數」。擷取於2026年11月11日。
--restricted這一列:「只載入受管設定與--settings」CLAUDE_CODE_RESTRICTED這一列:「Claude Code 會忽略設定檔env區塊中的此變數。需要 Claude Code v2.1.248 或更新版本」 ↩ -
Claude Code Docs,「環境變數」,以及 Claude Code CHANGELOG。擷取於2026年11月11日。
CLAUDE_CODE_PLUGIN_DIR_WATCH這一列:「控制 mod 在其檔案變更時是否重新載入。預設情況下,skills 目錄中的 mods 會在任何接收一個以上提示的工作階段中重新載入,包括非互動式工作階段。--plugin-dir目錄中的 mods 只會在互動式終端機工作階段中重新載入。設為1可讓它們像 skills 目錄中的 mods 一樣重新載入,設為0則會在所有地方關閉重新載入。需要 Claude Code v2.1.287 或更新版本」CHANGELOG 2.1.321:「Changed headless sessions to reload mods in.claude/skillswhen their files change; setCLAUDE_CODE_PLUGIN_DIR_WATCH=0to turn this off」2026年11月25日重新讀取;措辭已有變動的引文,改以當日的措辭呈現。 ↩ -
Claude Code Docs,「環境變數」,以及 Claude Code CHANGELOG。擷取於2026年11月11日。這兩個來源對
CLAUDE_CODE_DISABLE_MCP_TASK_BACKGROUND所給的版本不同。環境變數頁面的這一列:「自動移至背景的功能開啟時,預設仍會在兩分鐘後將呼叫移至背景。需要 Claude Code v2.1.304 或更新版本」CHANGELOG 將此變數列於 2.1.319 之下:「Added theCLAUDE_CODE_DISABLE_MCP_TASK_BACKGROUNDenvironment variable to make Claude Code wait for an MCP task inside its tool call instead of moving it to the background right away」 ↩ -
Claude Code Docs,「環境變數」;Claude Code Docs,「進階安裝設定」;以及 Claude Code CHANGELOG。擷取於2026年11月11日。
CLAUDE_CODE_MAX_CONTEXT_TOKENS:「覆寫 Claude Code 為目前使用中的模型所假定的上下文視窗大小。」以及「當您透過ANTHROPIC_BASE_URL將請求路由至某個模型,而其上下文視窗與該名稱的內建大小不符時,請使用此變數」;CHANGELOG 2.1.98:「FixedCLAUDE_CODE_MAX_CONTEXT_TOKENSto honorDISABLE_COMPACTwhen it is set.」CLAUDE_CODE_PLUGIN_CACHE_DIR:「覆寫 plugins 根目錄。儘管名稱如此,此變數設定的是上層目錄,而非快取本身:市集與 plugin 快取位於此路徑下的子目錄中。預設為~/.claude/plugins」;CHANGELOG 2.1.72 在其 plugin 修正中列出「CLAUDE_CODE_PLUGIN_CACHE_DIRcreating literal~directories」。CLAUDE_CODE_GIT_BASH_PATH:「僅限 Windows:Git Bash 執行檔(bash.exe)的路徑。在已安裝 Git Bash 但它不在您的 PATH 中時使用。」;安裝頁面將 settings.json 中的值寫為"C:\\Program Files\\Git\\bin\\bash.exe"。CLAUDE_CODE_USE_VERTEX:「使用 Google Cloud 的 Agent Platform」 ↩↩↩ -
Claude Code Docs。「環境變數」。擷取於2026年11月11日。
DEBUG:「除錯日誌會寫入~/.claude/debug/<session-id>.txt,或寫入CLAUDE_CODE_DEBUG_LOGS_DIR所設定的路徑。只有1、true、yes與on這些真值才會啟用除錯模式」該列開頭指出1會啟用除錯模式,等同於以--debug啟動。CLAUDE_CODE_DEBUG_LOG_LEVEL:「寫入除錯日誌檔的最低日誌等級。值:verbose、debug(預設)、info、warn、error。」 ↩ -
Claude Code Docs,「指令」。擷取於2026年11月11日。
/config [key=value ...]這一列:「傳入key=value配對即可直接設定某項設定,例如/config verbose=true、/config theme=dark或/config model=sonnet。」以及「它無法開啟需要您在面板中確認的設定,例如autoContinueAtUsageLimit。執行/config --help可列出它接受的鍵。」2026年11月25日重新讀取;措辭已有變動的引文,改以當日的措辭呈現。 ↩ -
Claude Code Docs,「工具參考」。擷取於2026年11月11日。Glob 工具行為:「在 macOS、Linux 與 WSL 上,您在以下情況下會重新取得 Glob 與 Grep 工具」,其中第一種是在
--tools或--allowedTools中指名它們:「使用--tools時,您會取得所列出的工具;在--allowedTools中指名任一個工具,兩者都會恢復。設定檔中的允許規則沒有這種效果。」 ↩ -
Claude Code Docs,「模型設定」,以及 Claude Code Docs,「所有設定」。擷取於2026年11月11日。模型設定頁面:「Claude Code 套用的受管設定定義了
availableModels時,只有該清單適用(提供自有清單的主機平台除外):使用者、專案或本機設定中的項目無法擴充它」以及「在 Claude Code v2.1.175 之前,較低優先順序範圍中的項目會併入受管清單,而不是被它取代。」設定參考將availableModels的範圍列為Any file,並補充「請將其部署在受管設定中,以對組織強制執行。」其enforceAvailableModels項目:「當 Default 會解析為availableModels以外的模型時,Claude Code 會將其解析為清單中第一個可用的模型」;「您的組織部署了任何受管設定時,Claude Code 只會從受管來源讀取此鍵,並忽略您其他檔案中的此鍵。」;「availableModels未設定或為空時,此鍵沒有作用。」;「需要 Claude Code v2.1.175 或更新版本。」 ↩ -
Claude Code Docs,「所有設定」。擷取於2026年11月11日。
permissions.blockReadsOutsideWorkingDirectories:「讓 Claude 的檔案工具在每種權限模式下(包括bypassPermissions)都拒絕讀取工作目錄以外的內容。」;「Claude Code 會拒絕對這些路徑的Read、Grep、Glob與LSP呼叫」;「Claude Code 本身需要的檔案仍可讀取,例如您的 skills、plugins、規則、agents、指令,以及~/.claude/下的CLAUDE.md記憶檔。」;「Claude Code 不會以同樣的方式拒絕 shell 指令」。permissions.blockWritesOutsideWorkingDirectories:「在每種權限模式下(包括bypassPermissions),但 Claude Code 自身的部分檔案除外」;「Claude Code 自身的部分檔案仍可寫入,例如計畫檔、scratchpad、背景工作階段的tmp目錄,以及此專案自動記憶中的.md檔案。」;「Claude Code 也會移除EnterWorktree與ExitWorktree工具,或拒絕對它們的呼叫」;「在雲端工作階段中,Claude Code 可能不會套用此鍵,因為檔案工具是在本身即為邊界的容器中執行。」 ↩↩ -
Claude Code Docs,「所有設定」。擷取於2026年11月11日。
permissions.denyInsteadOfPrompting:「若要允許大多數原本會跳出提示的呼叫,請從PermissionRequesthook 回應。」;「有些呼叫會在詢問任何 hook 之前就被拒絕,例如在auto模式下、沒有任何詢問規則涵蓋的關鍵路徑的刪除操作。」;「agent team 中的隊友會保有EnterPlanMode與ExitPlanMode」。 ↩ -
Claude Code Docs,「設定沙箱化的 Bash 工具」,以及 Claude Code Docs,「所有設定」。擷取於2026年11月11日。沙箱機制頁面:「若要保留 Chromium 或 Electron 自己的沙箱,或執行巢狀的 bubblewrap 或
unshare,請在~/.claude/settings.json(而非專案的.claude/settings.json)中將sandbox.allowNestedUserNamespaces設為true。」;「對於 rootless Podman 或 Buildah,光靠此設定並不足夠,沙箱也會以其他方式阻止它們。」;「對於 rootless Podman、Buildah,或會執行瀏覽器或unshare的指令碼或測試指令,請在sandbox.excludedCommands中加入模式,例如podman *。」設定參考:「讓 Linux 與 WSL2 上沙箱內的指令能建立使用者命名空間,這是 Chromium 與 Electron 自己的沙箱、巢狀 bubblewrap 以及unshare所需要的。」 ↩ -
Claude Code Docs,「環境變數」,以及 Claude Code Docs,「所有設定」。擷取於2026年11月11日。
CLAUDE_CODE_DISABLE_WORKFLOWS:「等同於disableWorkflows設定」。disableWorkflows項目:「CLAUDE_CODE_DISABLE_WORKFLOWS會在單一工作階段中關閉工作流程;兩者之中任一個將其關閉後,另一個都無法再將其開啟」。enableWorkflows項目:「在/config中顯示為 Dynamic workflows,會將此鍵寫入您的使用者設定」以及「未設定,因此除非您使用 Pro 方案(該方案預設關閉),否則工作流程皆為開啟」。MAX_THINKING_TOKENS:「未設定且已啟用思考時,具備自適應推理的模型會自行選擇思考深度,其他模型則使用該上限。」;「設為0可在 Anthropic API 上停用思考,但 Opus 5.5、Sonnet 5.5、Haiku 5.5 與 Fable 模型除外,這些模型無法關閉思考。在第三方供應商上,0則會改為省略thinking參數。」;「若為正值,在採用自適應推理的模型上,Claude Code 會忽略該數值本身,除非CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING關閉了自適應推理」。CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING:「設為1可在 Opus 4.6 與 Sonnet 4.6 上停用自適應推理,並退回由MAX_THINKING_TOKENS控制的固定思考預算。對 Fable 模型、Sonnet 5 及之後的版本、Haiku 5.5,或 Opus 4.7 及之後的版本沒有作用,這些模型一律使用自適應推理」。 ↩↩ -
Claude Code Docs,「選擇權限模式」;Claude Code Docs,「Auto mode 分類器請求費用」;以及 Claude Code CHANGELOG。擷取於2026年11月11日。權限模式頁面:「若要略過詢問伺服器、一律使用 Claude Code 自己的分類器請求,請設定
CLAUDE_CODE_AUTO_MODE_SERVER=0。」以及關於雲端供應商與閘道:「在 AWS 上的 Claude Platform、Amazon Bedrock、Google Cloud 的 Agent Platform 與 Microsoft Foundry 上,以及每當您將ANTHROPIC_BASE_URL指向 LLM 閘道或代理伺服器時,不論您的方案為何。預設詢問需要 Claude Code v2.1.278 或更新版本。」費用頁面:「CLAUDE_CODE_AUTO_MODE_SERVER是暫時性設定,可能會在之後的版本中移除。」CHANGELOG 2.1.273:「Changed auto mode on Bedrock, Vertex and Foundry to use the local classifier by default for now; setCLAUDE_CODE_AUTO_MODE_SERVER=1to use the platform’s server-side classifier」。2.1.278:「Changed auto mode for Claude API and Enterprise users, and on Bedrock, Vertex, Foundry and gateways, to default to the server-side classifier, which does not charge for classifier overhead」。2.1.281:「ChangedCLAUDE_CODE_AUTO_MODE_SERVERto also apply on a direct Anthropic API connection」。2.1.282:「Changed auto mode to use the server-side classifier by default on a direct Anthropic API connection when telemetry is off」。 ↩ -
Claude Code Docs,「透過 MCP 將 Claude Code 連接至工具」。擷取於2026年11月11日。設定工具搜尋:「工具搜尋預設啟用:MCP 工具會延遲載入,並按需探索。」;未設定這一列:「所有 MCP 工具皆延遲載入並按需載入。在早於 Opus 4 與 Sonnet 4 的模型、較早的 Agent Platform 模型,以及託管於 Azure 的 Microsoft Foundry 部署上則預先載入」;
true這一列:「MCP 工具延遲載入,備援情況與(未設定)相同」;以及關於 Agent Platform:「Claude Opus 4.5、Sonnet 4.5、Haiku 4.5 及之後的模型:工具搜尋預設開啟,與 Anthropic API 上相同。」以及「較早的 Agent Platform 模型:Claude Code 會預先載入所有 MCP 工具,因為其服務堆疊會拒絕所需的 beta 標頭。ENABLE_TOOL_SEARCH=true無法覆寫此行為。」 ↩ -
Claude Code Docs,「透過 MCP 將 Claude Code 連接至工具」;Claude Code Docs,「環境變數」;以及 Claude Code CHANGELOG。擷取於2026年11月11日。MCP 頁面:「伺服器指示,以及預先載入之工具的描述:4,096 個字元」;「Claude 透過工具搜尋載入之工具的描述:16,384 個字元」;「在 v2.1.296 之前,較短的上限為 2,048 個字元;而在 v2.1.295 之前,它適用於每一則工具描述,包括透過工具搜尋載入的描述。」;「Claude Code 會將該數字同時用於兩個上限。例如設為
8192,就會提高伺服器指示與預先載入之工具描述的 4,096 字元上限,並降低透過工具搜尋載入之工具描述的 16,384 字元上限。此變數需要 Claude Code v2.1.280 或更新版本。」;「Anthropic 在api.anthropic.com託管的部分 MCP 伺服器,其描述與指示會完整送達 Claude,設定此變數也不會將其截斷。」環境變數頁面的CLAUDE_CODE_MAX_MCP_DESCRIPTION_LENGTH這一列:「您設定的值會取代兩個預設上限:4096,以及 Claude 透過工具搜尋載入之工具描述的 16384。」CHANGELOG 2.1.299:「Changed MCP tool descriptions and server instructions from Anthropic’s first-party MCP servers atapi.anthropic.comto reach Claude in full instead of being cut at 4,096 characters」。 ↩ -
Claude Code Docs,「工具參考」;Claude Code Docs,「環境變數」;以及 Claude Code CHANGELOG。擷取於2026年11月11日。背景指令的時間限制:「Claude 在背景啟動的指令有 30 分鐘,或 Claude 搭配
run_in_background傳入的timeout,最長 2 小時」以及「在使用-p旗標、且提示以文字傳入而非透過--input-format stream-json傳入的執行中,兩個預設值都是 10 分鐘,而不是 30 分鐘。」CHANGELOG 2.1.321:「Fixedclaude -psometimes telling Claude that background commands get 30 minutes when they are stopped after 10」。BASH_MAX_TIMEOUT_MS這一列:「模型可為前景 Bash 或 PowerShell 工具指令設定的最大逾時(毫秒;預設:600000,即 10 分鐘)。實際上限為此值與BASH_DEFAULT_TIMEOUT_MS兩者中較大者。實際上限超過 2 小時時,也會成為無人值守工作階段中背景指令的最長時間限制。」2026年11月25日重新讀取;措辭已有變動的引文,改以當日的措辭呈現。 ↩↩ -
Claude Code Docs,「環境變數」,以及 Claude Code CHANGELOG。擷取於2026年11月11日。
CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS這一列:「低於100000的值會提高至最低門檻100000。符合條件的對話預設會啟用閒置壓縮。若要關閉,請將idleCompaction設為false。需要 Claude Code v2.1.290 或更新版本」。CHANGELOG 2.1.299:「AddedCLAUDE_CODE_IDLE_COMPACT_MIN_TOKENSto change idle compaction’s 200K-token minimum」以及「Both need v2.1.290 or later」。2.1.314:「Added idle compaction to VS Code and Claude Desktop’s Code tab」以及「Changed idle compaction to also run for subscribers with telemetry turned off, and on Bedrock, Vertex, Foundry and LLM gateways once the one-hour prompt cache is on」。 ↩ -
Claude Code Docs,「環境變數」,以及 Claude Code CHANGELOG。擷取於2026年11月11日。
CLAUDE_CODE_SHELL_PREFIX這一列:「包裝 Claude Code 所啟動之 shell 指令的指令前綴:Bash 工具呼叫、hook 指令、狀態列指令,以及 stdio MCP 伺服器的啟動指令。PowerShell hooks 與 exec 形式的 hooks 會在不加前綴的情況下執行。適用於記錄或稽核。設定/path/to/logger.sh這類單純的執行檔路徑時,每道指令都會以/path/to/logger.sh '<command>'的形式執行。包裝程式會在$1中以單一、經過 shell 引號處理的引數接收命令列,因此包裝程式必須以 shell 重新評估$1」(該列的範例為exec bash -c "$1"),以及「將$1視為單純的執行檔路徑,會使傳入npx -y <package>這類引數的 stdio MCP 伺服器失效。」CHANGELOG 1.0.61:「AddedCLAUDE_CODE_SHELL_PREFIXfor wrapping Claude and user-provided shell commands run by Claude Code」。 ↩ -
Claude Code Docs,「環境變數」。擷取於2026年11月11日。引用的各列:
DISABLE_ERROR_REPORTING,「設為任何非空值(例如1)即可選擇退出錯誤回報。設為0或false仍然會選擇退出」;CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR,「在主工作階段中,每道 Bash 或 PowerShell 指令執行後回到原本的工作目錄」;CLAUDE_CODE_DISABLE_BACKGROUND_TASKS,「設為1可從 Bash、PowerShell 與 subagent 工具中移除run_in_background參數,並關閉 Ctrl+B 快捷鍵」、「Claude Code 隨後也會停止自動將 subagents、長時間的 MCP 工具呼叫與逾時的 shell 指令移至背景。MCP 任務與 Monitor 工具仍會在背景執行。」 ↩↩↩ -
Claude Code CHANGELOG,v2.1.323 至 v2.1.332,擷取於2026年11月25日(2.1.323、2.1.325、2.1.326、2.1.327、2.1.328、2.1.329、2.1.330、2.1.331 與 2.1.332 分別有 294、139、367、173、144、130、142、135 與 150 條最上層項目;沒有 2.1.324 章節),以及 GitHub 發行版本 v2.1.323(2026-11-12T22:12:13Z)、v2.1.325(11-13T20:40:01Z)、v2.1.326(11-16T22:11:05Z)、v2.1.327(11-17T23:17:45Z)、v2.1.328(11-19T01:14:04Z)、v2.1.329(11-19T22:14:41Z)、v2.1.330(11-20T22:32:56Z)、v2.1.331(11-23T21:34:41Z)與 v2.1.332(11-25T01:32:14Z);不存在 v2.1.324 發行版本。npm 發布時間取自
npm view @anthropic-ai/claude-code time:2.1.323 為 2026-11-12T20:29:28Z、2.1.324 為 11-13T18:42:36Z、2.1.325 為 11-13T20:07:25Z、2.1.326 為 11-16T18:43:39Z、2.1.327 為 11-17T20:33:19Z、2.1.328 為 11-18T23:09:39Z、2.1.329 為 11-19T18:40:25Z、2.1.330 為 11-20T19:16:01Z、2.1.331 為 11-23T18:36:26Z、2.1.332 為 11-24T22:06:38Z;2026-11-25 當日的dist-tags:latest2.1.332、next2.1.332、stable2.1.326。2.1.332 原文:「Changed the default model on Microsoft Foundry to Sonnet 5.5: deployclaude-sonnet-5-5, or setANTHROPIC_DEFAULT_SONNET_MODELto a model you have deployed」;「Changed thesonnetmodel alias on Google Cloud’s Agent Platform and Microsoft Foundry to Sonnet 5.5, and Foundry’sopusalias to Opus 5.5;sonneton Amazon Bedrock stays at Sonnet 4.5」;「Added aPreSkillShellCommandhook event that can refuse a skill or command’s inline shell commands as it loads; on 2.1.331 and older, a settings file naming it opens a dialog at start」;「Added skills from MCP servers (beta). They show asserver:skillin the/menu; other skills keep their names」;「Changed/schedule, permission prompts and/loop’s cloud offer to say “cloud scheduled task” instead of “routine” or “cloud schedule”;/routinesstill works」。2.1.330:「Changed recurring scheduled tasks and/loopto run up to 30 days instead of 7 while their session keeps running, and say when they end; tasks made before this release still end at 7 days」。2.1.328:「Added auto mode for Claude Opus 4.6 and Sonnet 4.6 on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry and Claude apps gateway; interactive sessions with no permission mode start in it」。2.1.325:「Changed sandboxed Bash commands to follow the normal permission flow by default; setsandbox.autoAllowBashIfSandboxed: trueto keep running them without prompts」。2.1.323:「Added Code Mode, an experimental opt-in in which Claude writes JavaScript to call its tools」;「Removed thesubagentStatusLinesetting: subagent rows always use the default look, and settings files that still hold the key load as before」;「Changed the context window assumed for a model ID that Claude Code doesn’t recognize from 200K to 1M; use/autocompactto compact earlier, orCLAUDE_CODE_DISABLE_1M_CONTEXT=1to keep 200K」;「ChangedMCP_SDK_GENERATION=v1to run the v2 MCP client in a compatibility mode (earlier handshake, relaxed OAuth sign-in checks), because the v1 MCP client is removed」。 ↩↩↩↩↩↩↩ -
所有設定(設定參考)與設定沙箱化的 Bash 工具,Claude Code 文件,擷取於2026年11月25日。
sandbox.autoAllowBashIfSandboxed:「false:沙箱內的指令會經過一般的權限流程,因此由您的允許規則與權限模式決定。/sandbox的 Mode 分頁將此稱為 regular permissions mode」(一般權限模式);「預設:false。在 v2.1.324 之前,預設值為true」;「若要在受管設定中將其設為true,請將其加入您最高排名的受管來源的sandbox區塊」。沙箱機制頁面,沙箱模式:「在兩種模式下,沙箱都會強制執行相同的檔案系統與網路限制;差別只在於沙箱內的指令是自動核准,還是需要明確的權限。」設定參考已不再有subagentStatusLine項目。 ↩ -
使用 Code Mode 從程式碼執行工具呼叫,Claude Code 文件,擷取於2026年11月25日:「Code Mode 屬於實驗性功能,預設關閉。它可能在任何版本中變更或移除。」;「使用 Code Mode 時,Claude 會撰寫一段進行工具呼叫的 JavaScript,再由 Claude Code 在您的工作階段中執行該程式碼。」;需求:「Claude Code v2.1.323 或更新版本」;「搭配雲端供應商時,需要 v2.1.331 或更新版本。您無法透過閘道或搭配 Claude for Government 使用 Code Mode。」;「Claude Opus 5.5、Sonnet 5.5、Haiku 5.5 或 Fable 5.2」;「Code Mode 無法搭配 VS Code 面板、桌面應用程式或雲端工作階段使用」;agent teams 為 v2.1.326,mods 為 v2.1.327,關閉功能旗標擷取或開啟 OpenTelemetry 事件與指標則為 v2.1.329。「在受管設定中加入值為
0的CLAUDE_CODE_EXPERIMENTAL_CODE_MODE,讓組織中的任何人都無法使用 Code Mode」;「您無法從受管設定為使用者開啟 Code Mode。」 ↩ -
搭配 Claude Models on Google Cloud (Anthropic managed) 使用 Claude Code,Claude Code 文件,擷取於2026年11月25日(sitemap
lastmod為 2026-11-14;首次 Wayback Machine 存檔為 2026-11-15):「由 Anthropic 營運、透過您的 Google Cloud 專案存取的 Claude API」;「安裝 Claude Code v2.1.307 或更新版本」;含有CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD、ANTHROPIC_GOOGLE_CLOUD_PROJECT與ANTHROPIC_GOOGLE_CLOUD_WORKSPACE_ID的env區塊;「API provider這一行包含on Google Cloud」。推出日期取自 Claude Platform 版本說明,2026年10月22日:「We’ve launched Claude Models on Google Cloud (Anthropic managed), the Claude API operated by Anthropic and reached through your Google Cloud project. Google Cloud IAM controls access. Google Cloud Marketplace handles billing.」Claude Code CHANGELOG 未提及此供應商或其變數。 ↩ -
使用 /ship 與 /steward 讓 pull request 準備就緒 與 Claude Ship,Claude Code 文件,擷取於2026年11月25日(兩個頁面的首次 Wayback Machine 存檔均為 2026-11-23)。「
/ship是一個 Claude Code 指令,若您的分支尚無 pull request,它會為您的變更開啟一個 GitHub pull request。Claude 會審查您的變更,並處理意見回饋與失敗的檢查,協助它準備好合併。」;「請在儲存庫的本機 clone 中,從終端機裡的 Claude Code CLI 執行這兩個指令。雲端工作階段沒有這兩個指令。」;「pull request 準備就緒後,請自行合併」;先決條件:「Claude Code v2.1.330 或更新版本」與「GitHub CLI 2.63 或更新版本」;「在bypassPermissions模式下,不會啟動看顧。」;「您也可以將CLAUDE_CODE_DISABLE_SHIP設為1,例如設在受管設定的env之下。需要 Claude Code v2.1.331 或更新版本。」Claude Ship:「一組協助您團隊的 GitHub pull requests 準備好合併的 agents」(Code Review、PR Steward、Claude Approvals);「Claude Ship 適用於 Team 與 Enterprise 方案的組織。」;「Code Review 已正式推出。PR Steward 與 Claude Approvals 為公開測試版。」Claude Code CHANGELOG 未提及/ship或/steward。 ↩ -
Claude Code 文件,擷取於2026年11月25日。環境變數:
CLAUDE_CODE_RESUME_HINT_COMMAND(「需要 Claude Code v2.1.323 或更新版本」)、CLAUDE_CODE_FULL_SIGN_IN_LINK(v2.1.330)、CLAUDE_CODE_DISABLE_RESPONSE_COMPRESSION(v2.1.331;「在專案與本機設定中會被忽略」)、CLAUDE_CODE_DISABLE_DEFERRED_TOOL_RESUME(v2.1.328)、OTEL_RESOURCE_INCLUDE_HOST(v2.1.326)、CLAUDE_CODE_DISABLE_SHIP(v2.1.331)、VERTEX_REGION_CLAUDE_5_5_SONNET(「於 v2.1.284 新增」),以及CLAUDE_CODE_OVERLOADED_RETRY_MAX_DELAY_MS(「從 32000 到 300000 的整數毫秒」;「高於 64000 的值需要 v2.1.323 或更新版本」)。Plugin 資訊清單參考,engines:「plugin 可運作的 Claude Code 版本,以claude-code鍵下的 semver 範圍表示」;「需要 Claude Code v2.1.323 或更新版本。若要讓 plugin 在 v2.0.15 至 v2.1.75 上繼續運作,請省略engines。」選擇權限模式:「若您的組織已套用 HIPAA 設定,Claude Code v2.1.326 或更新版本上的終端機與 VS Code 工作階段預設以 auto mode 啟動。在 v2.1.285 至 v2.1.325 上,符合條件的工作階段預設以 Manual 模式啟動。」指令,/tui:「default,或在 v2.1.327 或更新版本上的classic,會選取經典渲染器」。Plugin 資訊清單參考未列出optionalDependencies,環境變數頁面也未列出CLAUDE_CODE_DISABLE_AGENT_PROGRESS_SUMMARIES;兩者都僅見於版本說明。 ↩↩↩ -
環境變數,Claude Code 文件,擷取於2026年11月25日,並與本指南的環境變數參考章節逐列比對。
CLAUDE_CODE_SUBAGENT_EFFORT:「它不適用於 forks、fork 出來的 skills 或隊友。需要 Claude Code v2.1.315 或更新版本」。CLAUDE_CODE_SYNC_SKILLS:「在互動式工作階段中,此變數需要 v2.1.323 或更新版本」。CLAUDE_CODE_STRICT_INLINE_SHELL_RM_PROMPT:「當CLAUDE_CODE_DISABLE_INLINE_SHELL_RM_PROMPT為1時沒有作用。需要 Claude Code v2.1.299 或更新版本」。CLAUDE_CODE_SESSION_ID:「在 Bash 與 PowerShell 工具的子程序中,會自動設為目前的工作階段 ID」。CLAUDE_CODE_WORKFLOW_PREFIX_STAGGER_MS:「預設值為5000。設為0可停用等待。」CLAUDE_CODE_LOOP_KEEPALIVE:「在其第二次或之後的迭代結束且沒有排定任何事項時」。CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH:「以 UTF-16 程式碼單元計算(預設值:61440,即 60 KB)」。該頁面沒有OTEL_EXPORTER_OTLP_TIMEOUT這一列;其上限來自 Claude Code CHANGELOG 的 2.1.323:「Fixed OpenTelemetry exports failing when a proxy took over 10 seconds to reach the collector; it now has 25 seconds, also the most thatOTEL_EXPORTER_OTLP_TIMEOUTcan allow (previously 30)」。 ↩↩↩↩↩ -
Claude Code 文件,擷取於2026年11月25日。設定檔與優先順序:「設定的優先順序,由高至低:受管設定、命令列、專案本機、共用專案、使用者。」;「其他旗標(例如
--model)會為該工作階段設定一項內容,不屬於這個堆疊」;「當您在多個檔案中設定同一個清單鍵(例如permissions.allow)時,Claude Code 會合併這些清單,而不是擇一採用」;「Claude Code 還會保留第五個檔案~/.claude.json,由它自行寫入;您不需要編輯它。其中存放您的帳號資訊、MCP 伺服器設定、各專案的狀態(例如信任決定),以及/config替您寫入的全域設定鍵。」驗證:「在 macOS 上,憑證儲存在加密的 macOS 鑰匙圈中。」;「在 Linux 上,憑證儲存在~/.claude/.credentials.json,檔案模式為0600。」;「在 Windows 上,憑證儲存在%USERPROFILE%\.claude\.credentials.json」。建立自訂 subagents,frontmatter 表格:background,「設為true可讓此 subagent 即使在 Claude 要求等待它時仍保持在背景。預設情況下,Claude 從主對話產生的自訂 subagents 已在背景啟動」;autoCompactWindow,「將此 subagent 的自動壓縮視窗調低至100000以上的 token 數。需要 Claude Code v2.1.296 或更新版本」;disallowedTools,「帶有指定條件的項目(例如Bash(git push *))仍會移除整個工具」;isolation,「預設情況下,副本會從您的預設分支建立分支,而不是從父工作階段的HEAD。」 ↩