开源版

报告 ≠ 文章演示 · 调研备忘 · 只读

Claude Code 无人值守过夜跑:调研备忘

出处可核 · 无互动演示

报告 · 2026-09-17

真源:/home/box/archives/org/2026-09-17-claude-code-unattended.md · 抓取日 2026-09-17 · 正文由 scripts/sync_reports.py 从 md sync,勿手改本页 SYNC 区当真源

  • 调研日(Asia/Shanghai):2026-09-17
  • 口径:只记官方 docs / changelog 里出现过的 flag 与 JSON key;没找到写「不知道」,不发明 workaround。
  • Grok CLI 一次性 live pass:~/.grok/bin/grok --no-auto-update --reasoning-effort xhigh -m grok-4.6 --always-approve,exit 0(约 465s,2026-09-17 00:32 CST)。其后主证据以官方页为准。
  • 舰队约束(非 Claude 官方):不 merge PR,除非用户明确说 merge;prod deploy 与花钱必须人;repo 代码在 CA 配额充足时优先 Cursor Cloud Agent。

Sources (path/url + date)

官方(优先)

URL日期
Overviewhttps://code.claude.com/docs/en/overview抓取 2026-09-17;docs.claude.com/en/docs/claude-code 与 code.claude.com/docs/ 同页
Docs indexhttps://code.claude.com/docs/llms.txt抓取 2026-09-17
Changeloghttps://code.claude.com/docs/en/changelog抓取 2026-09-17(页称 generated from GitHub CHANGELOG.md)
Permissionshttps://code.claude.com/docs/en/permissions抓取 2026-09-17
Permission modeshttps://code.claude.com/docs/en/permission-modes抓取 2026-09-17
Settings fileshttps://code.claude.com/docs/en/settings抓取 2026-09-17
Settings referencehttps://code.claude.com/docs/en/settings-reference抓取 2026-09-17
Settings exampleshttps://code.claude.com/docs/en/settings-example抓取 2026-09-17
CLI referencehttps://code.claude.com/docs/en/cli-reference抓取 2026-09-17
Headless / -phttps://code.claude.com/docs/en/headless抓取 2026-09-17
Sessionshttps://code.claude.com/docs/en/sessions抓取 2026-09-17
Hooks guidehttps://code.claude.com/docs/en/hooks-guide抓取 2026-09-17
Securityhttps://code.claude.com/docs/en/security抓取 2026-09-17
Network / proxyhttps://code.claude.com/docs/en/network-config抓取 2026-09-17
Env varshttps://code.claude.com/docs/en/env-vars抓取 2026-09-17
Terminal / notifhttps://code.claude.com/docs/en/terminal-config抓取 2026-09-17
GitHub Actionshttps://code.claude.com/docs/en/github-actions抓取 2026-09-17
Routines(云定时)https://code.claude.com/docs/en/routines抓取 2026-09-17;页标 research preview
Desktop scheduled taskshttps://code.claude.com/docs/en/desktop-scheduled-tasks抓取 2026-09-17
Cloud sessionshttps://code.claude.com/docs/en/claude-code-on-the-web抓取 2026-09-17;research preview
Channels(入站 webhook)https://code.claude.com/docs/en/channels抓取 2026-09-17;research preview
/goalhttps://code.claude.com/docs/en/goal抓取 2026-09-17
Best practiceshttps://code.claude.com/docs/en/best-practices抓取 2026-09-17
What's new W13 Auto modehttps://code.claude.com/docs/en/whats-new/2026-w13Week 13 · 2026-03-23–27
What's new W32 Auto defaulthttps://code.claude.com/docs/en/whats-new/2026-w32Week 32 · 2026-08-03–07;文内写 Starting August 14 auto 成默认
JSON schemahttps://json.schemastore.org/claude-code-settings.json官方 settings 页引用;schema 可能落后 CLI

次级(已标注)

URL日期 / 等级
GitHub READMEhttps://github.com/anthropics/claude-code抓取 2026-09-17;安装说明,无 YOLO / bypass 细节
Issue: Add --yolo aliashttps://github.com/anthropics/claude-code/issues/34467次级;标题即证明 YOLO 不是官方 flag
Issue: [Bug] YOLO mode promptinghttps://github.com/anthropics/claude-code/issues/42898次级;社区把 skip-permissions 叫 YOLO
Issue: Notifications in auto-accept/yolohttps://github.com/anthropics/claude-code/issues/30233次级;closed 2026-03-31

1 Permission switches (exact flags/keys + official quotes)

官方 没有 名叫 YOLO / --yolo 的 CLI flag 或 settings key。官方 skip-all 是 --dangerously-skip-permissionsbypassPermissions。What's New W13(2026-03-23–27)把 auto mode 写成 “the middle ground between approving every file write and running with --dangerously-skip-permissions”。GitHub #34467 是社区请求把 --yolo 做成 alias(次级)。

1.1 CLI flags(CLI reference,抓取 2026-09-17)

Flag官方含义(摘)
--permission-mode <mode>Begin in a specified permission mode. Accepts default, acceptEdits, plan, auto, dontAsk, bypassPermissions, or manual as an alias for defaultmanual 需 v2.1.200+)。Overrides defaultMode from settings. -p 未指定时内置起点是 default
--dangerously-skip-permissions“Skip permission prompts. Equivalent to --permission-mode bypassPermissions.”
--allow-dangerously-skip-permissions“Add bypassPermissions to the Shift+Tab mode cycle without starting in it.”
--allowedTools / --allowed-tools“Tools that execute without prompting for permission.” 语法同 permission rules。限制可用工具用 --tools,不是这个 flag。
--disallowedTools / --disallowed-toolsDeny rules。裸工具名会从 context 移除;Bash(rm *) 只拦匹配调用。
--permission-prompts nonev2.1.259+。“Set who answers permission prompts in print mode… Pass none when nobody can answer, and Claude Code denies them instead.”
--permission-prompt-tool非交互里用 MCP 工具回答权限提示。
--restrictedv2.1.248+。评测/共享机;**refuses bypassPermissions**,且不读 user/project settings。
--enable-auto-modeRemoved in v2.1.111。改用 --permission-mode auto

官方推荐的无人值守容器形(permission-modes Common setups):

claude -p "<prompt>" --dangerously-skip-permissions

隔离要求原文:“Required: a container, VM, or the sandbox runtime; on Linux and macOS, run it as a non-root user”。同一段:“In this -p run, the few calls that would still prompt are denied instead”。

CI 精确 allowlist 形:

claude -p "run the test suite" --permission-mode dontAsk --allowedTools "Bash(npm test)" "Read"

Hands-off(仍有 classifier)形:

claude --permission-mode auto
# 或 -p:
claude -p "fix all lint errors" --permission-mode auto
# 无人回答权限时(v2.1.259+):
claude -p "Update the dependency pins and run the tests" --permission-mode auto --permission-prompts none

更少 prompt、不要 classifier 时:Manual + sandbox auto-allow(claude --permission-mode default,然后 /sandbox 选 auto-allow,或 sandbox.enabled: truesandbox.autoAllowBashIfSandboxed 默认 true)。

1.2 settings.json keys(settings-reference,抓取 2026-09-17)

没有 顶层 key 叫 permissionMode。正确嵌套是 permissions.defaultMode

{
  "permissions": {
    "allow": ["Bash(npm run *)", "Bash(git commit *)"],
    "ask": ["Bash(git push *)"],
    "deny": ["Read(./.env)", "Read(./.env.*)", "Read(./secrets/**)", "Bash(curl *)"],
    "additionalDirectories": ["../docs/"],
    "blockReadsOutsideWorkingDirectories": true,
    "defaultMode": "auto",
    "disableBypassPermissionsMode": "disable"
  },
  "disableAutoMode": "disable",
  "skipDangerousModePermissionPrompt": true,
  "skipAutoPermissionPrompt": true,
  "sandbox": {
    "enabled": true,
    "autoAllowBashIfSandboxed": true
  }
}
Key类型 / 取值官方要点
permissions.allowstring[]匹配则不问。规则格式 ToolTool(specifier)。项目 .claude/settings.json 的 allow 要 workspace trust 才生效
permissions.askstring[]即使 acceptEdits / bypass 也仍 prompt。dontAsk 下匹配则 deny 而不是问
permissions.denystring[]所有 mode 都拦,包括 bypassPermissions。求值顺序:deny → ask → allow;specificity 不改顺序。--allowedTools 不能 覆盖 deny。
permissions.defaultMode"default" | "acceptEdits" | "plan" | "auto" | "dontAsk" | "bypassPermissions" | "manual"**autobypassPermissions 从 project/local 文件不生效**,要写 ~/.claude/settings.json 或 managed。Cloud session 只认 acceptEdits/plan/default/auto
permissions.disableBypassPermissionsMode"disable"拒绝 --dangerously-skip-permissions
disableAutoMode / permissions.disableAutoMode"disable"从 Shift+Tab 去掉 auto。
permissions.blockReadsOutsideWorkingDirectoriesboolv2.1.257+。所有 mode(含 bypass)文件工具拒读工作目录外。
skipDangerousModePermissionPromptboolUser/local/managed。跳过首次 bypass 责任对话框。仓库不可替你跳。
sandbox.enabledboolmacOS / Linux / WSL2。
sandbox.autoAllowBashIfSandboxedbool,默认 true沙箱内 Bash 不问(deny 与 content-scoped ask 仍生效)。
autoMode.environment / autoMode.allow / soft_deny / hard_denyobject告诉 classifier 信任哪些 repo/bucket/domain。

规则求值原文(permissions):“Rules are evaluated in order: deny, then ask, then allow. The first match in that order determines the outcome, and rule specificity doesn't change the order.”

allow 对 bypass 无效 原文(permission-modes):“Allow rules have no effect in bypassPermissions.” 所以 --allowedTools 约束不了 bypass;要拦工具用 deny / --disallowedTools

1.3 Permission modes 对照(permission-modes,抓取 2026-09-17)

Mode不问就跑什么官方 “Best for”
default(UI:Manual)只读Reviewing every action / sensitive
acceptEdits读 + 工作目录内文件编辑 + mkdir/touch/rm/rmdir/mv/cp/sedIterating locally
plan读;auto 可用时 classifier 批准的命令Explore before changing
auto几乎一切,classifier 后台审Long tasks, reducing prompt fatigue
dontAsk读 + 已 allow 的工具;其余本会 prompt 的 直接 denyLocked-down CI and scripts
bypassPermissions几乎一切Isolated containers and VMs only

Pro/Max/Team 交互会话内置起点:auto(W32,Starting August 14, 2026;CLI 需 v2.1.228+ macOS/Linux/WSL,Windows v2.1.233+)。**claude -p / Agent SDK 内置仍是 default(Manual)**,所以脚本必须显式传 --permission-mode

交互切 mode:CLI Shift+TabdontAsk 不进 cycle,只能 --permission-mode dontAskbypassPermissions 只有启动时用了 bypass 相关 flag / user defaultMode 才进 cycle。

任何 mode 都不会 auto-approve 的动作(含 bypass):explicit ask 规则;组织设为 ask 的 connector;AskUserQuestionrequiresUserInteraction MCP;针对 critical path 的 rm/rmdir(无 allow / PreToolUse "allow" 能批);跨 session messaging 保护;blockReadsOutsideWorkingDirectories 打开时的目录外读。

Protected paths(.git.claude.bashrc.mcp.json 等)除 bypass(及部分 plan+bypass 交互)外永不 auto-approve。Critical path rm 在 bypass 下仍会 问人


2 Headless / print / continue / notify

2.1 非交互 / print

官方叫 print mode,flag 是 -p / --print(headless + CLI reference,抓取 2026-09-17):

claude -p "Find and fix the bug in auth.py" --allowedTools "Read,Edit,Bash"
claude -p "Summarize this project" --output-format json
claude -p "Explain recursion" --output-format stream-json --verbose --include-partial-messages
官方事实
--output-formattext(默认)、jsonstream-json没有其它官方值。
json 字段文本在 .result--json-schema 时结构化在 .structured_output;含 session_idtotal_cost_usd
退出码成功 0,失败非 0。SIGTERM → 143。
--bare“recommended mode for scripted and SDK calls”;跳过 hooks/skills/plugins/MCP/CLAUDE.md 自动发现。-p 将在未来默认 bare。bare 不读 OAuth/keychain,Anthropic API 要 ANTHROPIC_API_KEY
-p--bg互斥。--cloud + 任务描述也互斥;--cloud + session ID + -p 是往已有云 session 排队一条消息然后退出
-p workspace trust“Trust verification is disabled when running non-interactively with the -p flag”(security)。项目 permissions.allow 在未 trust 时 不用;stderr 会有 this workspace has not been trusted。hooks / .mcp.json-p 仍可能跑——所以脚本建议 --bare--setting-sources user
--max-turns / --max-budget-usdprint only。预算到了停。
--permission-prompts nonev2.1.259+。无人值守 scheduled job 官方推荐。

2.2 Continue / resume(sessions + CLI,抓取 2026-09-17)

Flag官方行为
claude -c / --continue当前目录最近一次会话。默认 跳过 -p/SDK//loop 会话;claude -p --continue 才包含它们。v2.1.257+ 可打开已结束的 background session,不能 attach 仍在跑的。
claude -r / --resume <id|name|jsonl绝对路径>指定会话。跨项目找 ID 需 v2.1.223+。
claude --from-pr <n|URL>按 PR 过滤 picker。
--fork-session与 resume/continue 合用,新 session ID。
--no-session-persistenceprint only,不落盘、不能 resume。

Resume 权限 mode:终端 --continue/--resume <id> 会恢复当时 mode,但 **ended in bypassPermissionsplan 时不恢复 bypass/plan,要再传 flag。claude -p --resume 按新的 -p 起点(通常 Manual)**,除非同时满足:带 --permission-prompt-tool、不传 --permission-mode/--dangerously-skip-permissions、不 fork、不是 channels——才会在 plan 里 resume(v2.1.246+)。

过夜续跑官方示例(headless):

claude -p "Review this codebase for performance issues"
claude -p "Now focus on the database queries" --continue
session_id=$(claude -p "Start a review" --output-format json | jq -r '.session_id')
claude -p "Continue that review" --resume "$session_id"

/goal 可在 -p 里一次跑到条件满足(goal 页,抓取 2026-09-17):

claude -p "/goal CHANGELOG.md has an entry for every PR merged this week"

/goal 不改 permission mode。无人值守要同时开 auto。Goal 在认证失败 / 余额耗尽 / 上下文溢出 / 模型不可用时会清掉。

2.3 “做完再报我”——官方有什么

没有 名叫 “report when fully done” 的单一官方开关。可组合:

机制官方能力局限
-p 进程退出 + exit code脚本/CI 自然“做完”不主动推送;stdout 是结果
--output-format json.result + cost需自己接 Slack/webhook
preferredNotifChannelsettings-example 注释:“Ring the terminal bell for notifications, such as a finished task or a waiting permission prompt.” 官方示例值只有 "terminal_bell"。terminal-config:默认仅 Ghostty/Kitty/iTerm2 发桌面通知;其它终端设 terminal_bell其它合法枚举值 不知道(settings index 只写 “terminal bell or desktop notification”)
Notification hookhooks-guide:Claude 等输入/权限时跑。macOS 官方例 osascript -e 'display notification …'。matcher:permission_promptidle_prompt(约 60s 无输入)、agent_completed仅 agent view 打开时)等agent_completed 不是任意 -p 结束
Stop hookClaude 每轮结束都 fire,不是“任务全部完成”。可用 prompt-type Stop 判断是否做完连续 block 默认 8 次 cap
HTTP hook "type": "http"POST 同一份 JSON 到 URL;allowedHttpHookUrls 可限 URL要自己写接收端;不是内置 Slack
inputNeededNotifEnabledsettings index:“Get a push notification when Claude is waiting on you”完整取值/平台细节本次未展开全文 → 部分 不知道
agentPushNotifEnabledsettings index:“Let Claude send a push notification to your phone when it decides to”同上
Mobile pushWhat's New W16(2026-04-13–17):“mobile push notifications that ping your phone when Claude needs you需要你,不是 做完了
Channels把 Telegram/Discord/CI webhook 推进正在跑的 sessionresearch preview;要 session 开着;入站 不是出站 “done”
Desktop scheduled tasks到点发桌面通知并开新 session电脑醒着 + Desktop 开着
Routines每次 run 成云 session,可打开看 transcript绿状态 ≠ 任务成功:“A green status … does not mean the task in your prompt succeeded.”
claude -p "…" --cloud <session>往已有云 session 排队消息不是完成通知

官方 没有 内置 Slack/email/webhook “任务全部完成再推一次” 的产品开关。要出站通知:自己写 Stop/Notification/http hook,或用 -p 的 exit + 脚本。


3 Overnight pipeline (local vs CI vs Cloud Agent) + human gates

3.1 三条官方跑道 + 一条舰队跑道

跑道电脑能否睡权限官方定位适合过夜到“可开 PR”
本机 CLI / Desktop Local不能。Desktop scheduled tasks:“Tasks only run while the desktop app is running and your computer is awake. If your computer sleeps through a scheduled time, the run is skipped.” /loop 同机。交互 Pro/Max/Team 默认 auto;-p 默认 Manual,必须显式 mode。bypass 仅容器。本地文件、本机工具笔记本合盖会断。Keep computer awake 仍挡不住合盖。
Cloud session / Routines。Routines:“they keep working when your laptop is closed.”“there is no permission-mode picker and no approval prompts during a run.” Cloud 忽略 settings 里的 bypassPermissions/dontAsk。Cloud 可选 Accept edits / Plan / Auto。从 GitHub clone;推 claude/ 前缀分支官方 overnight 首选形态之一
GitHub Actions anthropics/claude-code-action@v1runner 上跑,与笔记本无关claude_args--allowedTools / --permission-mode dontAsk@claude 评论或 prompt 自动化适合 review / 按 issue 开 PR;不替代人 merge
Cursor Cloud Agent与笔记本无关Cursor 产品,非 Anthropic 文档舰队偏好(CA 配额充足时 repo 代码优先 CA)本备忘不把它写成 Claude 官方能力

Routines vs Desktop vs /loop 官方表(desktop-scheduled-tasks):Cloud 最短间隔 1 hour;Desktop//loop 1 minute;Cloud 不需机器开机;Desktop 要开机且 app 开着。

3.2 推荐过夜形状(官方能力 + 舰队门)

目标 = 早上有可审 PR / 云 session 产物,不是线上已发。

  1. Repo 代码、CA 配额够:用 Cursor Cloud Agent(舰队,非 Claude 官方)。人早上审 diff,不 merge
  2. **要 Claude 云、笔记本可睡:Routines 或 claude --cloud "…"**(code.claude.com cloud + routines,抓取 2026-09-17)。prompt 写死成功标准(测试绿、开 draft PR、不要 merge、不要 prod)。环境用 Trusted network,去掉不需要的 connectors(“Claude can use every tool from an included connector, including writes, without asking”)。
  3. **必须摸本机文件:Desktop scheduled task 或本机 claude -p + auto + sandbox**。合盖会 skip。不要用 bypass 除非独立 VM。
  4. **CI 重复活(lint/review/日报告):GitHub Actions + dontAsk + --allowedTools 精确名单**。prompt 模式结果默认在 workflow log,不自动评论。

本机 -p 过夜最小形(官方拼装,非发明 flag):

claude -p --bare --permission-mode auto --permission-prompts none \
  --allowedTools "Read,Edit,Bash(npm test *),Bash(git status *),Bash(git diff *),Bash(git commit *),Bash(git push *)" \
  --max-budget-usd 20 \
  "/goal tests pass and a draft PR is open; do not merge; do not deploy"

--permission-prompts none 需 v2.1.259+。auto-p 必须显式传。classifier 会拦 merge 无人批的 PR、prod deploy、force push 等(见 §4)。

无人值守韧性(env-vars,抓取 2026-09-17):CLAUDE_CODE_RETRY_WATCHDOG=1(官方写明 “unattended sessions such as eval harnesses, CI jobs, or remote workers”);autoContinueAtUsageLimit(usage limit 重置后续跑)。

3.3 人必须守的门(官方 + 舰队)

必须人?依据
Merge PRAuto classifier 默认拦 “Merging a pull request no human has approved, approving Claude's own pull request, or disabling CI checks”(permission-modes)。舰队:未明确说 merge 就不 merge。
Prod deploy / 花钱的云操作Classifier 拦 “Production deploys and migrations”、“Toggling… a production feature flag”、IaC destroy。舰队:prod deploy 与 spend 必须人。
Usage credits / 超额Routines 撞日 cap 后,没开 usage credits 会拒跑;开 credits 是账号设置,属花钱。--max-budget-usd 只限 API 估算。
bypass 首次责任对话框(交互一次)非交互不弹窗;--bg 在未接受对话框前 拒绝。root/sudo 拒绝 bypass。
Workspace trust(交互)首次要人-p 不弹 trust,因此 项目 allow 规则不生效
**开 PR / push 到 claude/ 分支**官方允许 agent 做Cloud/Routines 推 claude/ 前缀。Push 到他人有 PR 的分支或别人的 commit 会被拒。
审 diff、点 Create PR(云 UI)建议人Cloud:“review changes, and create a pull request”。Auto-fix 仍可能改代码,但 merge 仍是人。
GitHub App 安装 / secretActions 要 admin。

官方 没有 “跑完自动 merge 并上 prod” 的推荐路径。W13 PR auto-fix 是修 CI / nits 直到绿,不是 merge。


4 Risks / official warnings

4.1 bypass / --dangerously-skip-permissions

permission-modes(抓取 2026-09-17):

bypassPermissions mode disables permission prompts and safety checks so tool calls execute immediately, including writes to protected paths.”

“Only use this mode in isolated environments like containers, VMs, or dev containers without internet access, where Claude Code cannot damage your host system.”

bypassPermissions offers no protection against prompt injection or unintended actions. For background safety checks with far fewer permission prompts, use auto mode instead.”

Linux/macOS 拒绝 root/sudo,原文错误串:

--dangerously-skip-permissions cannot be used with root/sudo privileges for security reasons

首次交互会责任对话框;decline 则退出。Cloud 静默忽略仓库里的 defaultMode: "bypassPermissions" / "dontAsk"

permissions 页:bypass 仍跳过对 .git / .claude 等保护路径的提示。

4.2 auto mode 不是安全保证

permission-modes:

“Auto mode reduces permission prompts but does not guarantee safety. Use it for tasks where you trust the general direction, not as a replacement for review on sensitive operations.”

W13(2026-03-23–27):auto 是 skip-permissions 与逐条批准的中间态。

Classifier 默认拦(节选,permission-modes):curl | bash;把敏感数据送到外部;prod deploy / migrations;云存储大规模删除;IAM/repo 权限;force push;无人批准就 merge PR;改 CI 去跑 secret;terraform destroy;把内部包安装绕到公网 registry;启动另一个 --dangerously-skip-permissions agent。默认允许:工作目录本地文件操作;按 lockfile 装依赖;push 当前仓库任意分支(含 default,v2.1.211+;内容仍受其它规则查)。

-p--permission-prompt-tool 时,classifier 连挡 3 次或累计 20 次:动作不跑,进程不退出(“Claude Code doesn't stop the run”)。

4.3 误删 / 出站 / 供应链

风险官方怎么说
误删Critical-path rm/rmdir//usr$HOME、工作目录及其父)任何 allow/hook 都不能批。bypass 仍 问人;dontAsk deny;auto 送 classifier。PowerShell Remove-Item 对系统路径/裸 * 所有 mode 直接 deny。Classifier 拦 rm -rf "$VAR" 这种变量目标(v2.1.205+)。
出站网络Manual 下 curl/wget 默认要批。Bash(curl *) deny 拦不住 /usr/bin/curlsh -c 'curl…'(permissions “What a Bash rule doesn't match”)。要 OS 级用 sandbox network allowlist。WebFetch 预批文档域;其它要批。Windows WebDAV:\* 可绕过权限系统发网络请求(security)。
Prompt injectionsecurity:“no system is completely immune”。-p 关掉 trust verification。Web fetch 用隔离 context。最佳实践:VM;不要把不信任内容直接 pipe 给 Claude。
供应链 / MCP“Anthropic … does not security-audit or manage any MCP server.” 仓库 .mcp.json-p 不问就连。hooks 在未 trust 的 -p 仍跑。Plugin zip 曾有权限/残留文件问题(changelog 抓取日条目)。
Cloud 出站即使 network disabled,“Claude Code can still communicate with the Anthropic API, which may allow data to exit the VM.” Auto-fix 用你的 GitHub 身份回评论,可能触发 Atlantis//deploy
凭证CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1 从 Bash/hooks/MCP 子进程剥凭证,防注入外带。

security 页(抓取 2026-09-17)责任句:

“You're responsible for reviewing proposed code and commands for safety before approval.”


5 macOS + China proxy

Clash 端口 7897 / 7879:Claude 官方文档未出现。 舰队记忆不是 Anthropic 文档。下面只记官方网络配置。

network-config + env-vars(抓取 2026-09-17):

官方项内容
HTTPS_PROXY / HTTP_PROXY“Claude Code respects standard proxy environment variables.” 推荐 HTTPS。大小写都认;顺序 https_proxy, HTTPS_PROXY, http_proxy, HTTP_PROXY。也可写 settings.jsonenv
NO_PROXY空格或逗号分隔。"*" = 全部绕过。loopback 本来就不走代理。
SOCKS“Claude Code does not support SOCKS proxies.” Clash mixed/HTTP 口可以;SOCKS 口官方不支持 CLI 主连接。Sandbox 另有 sandbox.network.socksProxyPort(沙箱流量,不是 API 主连接)。
认证HTTPS_PROXY=http://user:pass@host:port basic auth。NTLM/Kerberos:官方让走 LLM Gateway。
企业 MITM / 自定义 CA系统信任库默认会读(native installer;npm 需 Node 22.15+)。否则 NODE_EXTRA_CA_CERTS=/path/to/ca-cert.pemCLAUDE_CODE_CERT_STORE=bundled|system
校验代理 URL 缺 http:// scheme 会启动失败。claude --debug 日志;/status 有 Proxy 行。
后台 agent代理变量要写 ~/.claude/settings.jsonenv,不要只 export 在 shell——supervisor 不一定继承。
必达 hostapi.anthropic.comclaude.aiclaude.complatform.claude.commcp-proxy.anthropic.comdownloads.claude.airegistry.npmjs.orgcode.claude.com 等(network-config 表)。TLS 检查代理要放行。
官方未写Clash、Surge、端口 7897、7879、系统「增强模式」、TUN。不知道 Claude 是否认 macOS 系统代理;文档只写 env vars。

Sandbox 相关(settings-reference):sandbox.network.httpProxyPortsocksProxyPort;macOS MITM 可能要 sandbox.enableWeakerNetworkIsolation(官方标明降低安全性)。Go 工具 TLS 失败见该页。


Verdict buckets: 可立刻用 / 有条件 / 不建议

可立刻用(官方文档完整、可今晚配)

  • 交互少点:Pro/Max/Team 已默认 auto(2026-08-14 起);或 Shift+Tab。用户设置:~/.claude/settings.json"permissions": {"defaultMode": "auto"}不要写进 project settings)。
  • 精确放行:permissions.allow / --allowedTools "Bash(npm test *)" 等;deny .env
  • 本机少 prompt 且要隔离:sandbox.enabled: true(macOS 官方支持),保留 deny 与 ask: ["Bash(git push *)"]
  • 脚本一次性任务:claude -p … --bare --permission-mode auto --permission-prompts none(v2.1.259+)或 dontAsk + 短 allowlist。
  • 做完看结果:-p --output-format json + 退出码;macOS Notification hook + osascriptpreferredNotifChannel: "terminal_bell"
  • 续聊:claude -c / -p --continue / --resume $session_id
  • 笔记本可关:Routines 或 claude --cloud "…"(需 claude.ai 登录,非 API key / 非 Bedrock)。
  • CI:GitHub Action + dontAsk + --allowedTools
  • 代理:export HTTPS_PROXY=http://127.0.0.1:<Clash的HTTP口>(具体口 官方不知道;舰队记忆 7897 然后 7879)。企业 CA:NODE_EXTRA_CA_CERTS
  • 人门:merge / prod / 花钱保持人手。Classifier 已拦无人 merge 与 prod deploy。

有条件

  • --dangerously-skip-permissions / bypassPermissions 非 root 容器/VM/无网 devcontainer;先交互点过责任对话框才能 --bg。Cloud settings 里写了也无效。
  • defaultMode: "bypassPermissions":只能 user/managed,不能 project。
  • /goal + auto:条件必须能从 transcript 验证;hooks 被禁则 /goal 不可用。
  • Desktop 定时:电脑醒着 + app 开着;合盖 skip;Manual 会 stall 等批准。
  • Channels 当“远程批权限 / 手机指挥本机”:research preview;session 必须开着;合盖没用。
  • HTTP hook 做出站 webhook:要自建 endpoint + allowedHttpHookUrls
  • CLAUDE_CODE_RETRY_WATCHDOG=1:官方指定 unattended;会无限重试 429/529(spend limit 的 429 立即失败,v2.1.239+)。
  • Cursor Cloud Agent 过夜:舰队条件(配额),不是 Anthropic 文档。
  • 云 session 开 PR:GitHub App 或 /web-setup;组织 IP allowlist 可能直接让云 session 认证失败。

不建议

  • 本机 bypassPermissions / YOLO 过夜。 官方:只给隔离环境;无 prompt-injection 防护;可写 .git/.claude。社区 YOLO ≠ 官方 flag。
  • 以为 auto 或 cloud 绿点 = 已上线。 Routines 绿 = 没基础设施错误。Merge/prod 仍要人。
  • **项目 settings 里设 auto/bypassPermissions 当默认。** 官方明确不生效。
  • **用 --allowedTools 收紧 bypass。** Allow 在 bypass 下无效。
  • **只靠 Bash(curl *) deny 当网络边界。** 路径/包装绕过。
  • **-p 跑不信任仓库还不加 --bare。** trust 关闭,hooks/MCP 仍可能执行。
  • 合盖指望 Desktop/本机 CLI 跑完。 官方会 skip。
  • Routines 塞满 connectors。 默认全开且可写、不问。
  • Cloud auto-fix 开在会因评论触发 deploy 的仓库。 官方点名 Atlantis 等。
  • 跳过 merge / prod / 花钱人门。 舰队禁止;官方 classifier 也按这个方向拦。

Unknowns

写「不知道」= 本次官方页没找到,不发明

  1. **官方 flag/key 名叫 YOLO / --yolo / yolo:** 不存在于 CLI reference、permission-modes、settings-reference。仅 GitHub 社区 issue。
  2. **preferredNotifChannel"terminal_bell" 以外的合法枚举:** settings-example 只给了这一个。是否有 "desktop" / "auto" 不知道
  3. **agentPushNotifEnabled / inputNeededNotifEnabled 的类型、默认、是否覆盖 -p:** index 有 key,全文未完整抓到。
  4. 内置「任务 100% 完成 → Slack/邮件/通用 webhook」产品: 没找到。只有自写 hooks 或 -p 退出。
  5. Clash / 7897 / 7879: 官方未提。系统代理是否自动用 不知道。SOCKS 官方不支持主连接。
  6. **macOS 合盖 + caffeinate 能否让 CLI -p 跑完:** Claude 文档没写;只写 Desktop scheduled tasks 合盖仍睡。
  7. Cursor Cloud Agent 与 Claude Code 权限模型对照: 非 Anthropic 文档。
  8. **Cloud 里 dontAsk 能否用 CLI flag 打开: 文档写 cloud 忽略 settings 的 dontAsk/bypass;mode dropdown 列的是 Accept edits / Plan / Auto。flag 是否另算 不知道**。
  9. **changelog 页对应的精确 CLI 版本号(本机未跑 claude --version):** 不知道当前盒子上的版本。docs 引用到 v2.1.271 量级条目。
  10. **Stop hook 是否在成功 -p 退出时稳定 fire、payload 是否含“成功”布尔:** 未把 hooks reference 全文逐字段核对完毕 → 不知道;guide 只说 Stop = Claude finishes responding。

6 社区经验(经验≠官方;本席复核)

URL日期等级
Granola / Jim Fisherhttps://www.granola.ai/blog/dangerously-skip-permissions-is-the-only-safe-mode页标 May 11;抓取 2026-09-17经验;标题挑衅,主张用 auth/隔离替代逐条 Yes
OOZOU TILhttps://oozou.com/til/run-claude-code-fully-autonomously-with-a-yolo-alias-1902026-02-16可复现 alias
GitHub #2591https://github.com/anthropics/claude-code/issues/2591关 2026-01-04 not_planned--yolo 官方不做
GitHub #34467https://github.com/anthropics/claude-code/issues/34467关 2026-03-25 duplicate同上
Background Claudehttps://backgroundclaude.com/blog/permission-modes2026-04-10可复现 dontAsk+--bare 配方;auto 段过时(写 research preview / 非 Pro·Max;官方 W32 2026-08-14 起 Pro/Max/Team 交互默认 auto)
MorphLLM 文https://www.morphllm.com/claude-code-dangerously-skip-permissions搜索 2026-09-17可复现 alias;本席 WebFetch 被 bot 墙,未打开全文
Reddit r/ClaudeAI2026-09-17不知道(403 后 429,停查)
X @paul_pbng / @bbhxwl / @hishboy执行器摘录2026-09-17本席未逐帖打开原文 → 当口头/未核
Hidekazu 配方执行器摘录标 2026-09-07本席未打开原文 → 不引用为可复现

可复现配置(社区,非官方新产品):

alias yolo='claude --dangerously-skip-permissions'   # 经验;官方无 --yolo
claude --bare -p "…" --permission-mode dontAsk --allowedTools "Read" "Bash(npm test)"

口头/过时勿当默认:宿主机连开 YOLO;IS_SANDBOX=1 CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1(未在官方 env 页核实);Background Claude 对 auto 的账号限制(已被官方 W32 覆盖)。


6 社区经验(经验≠官方;抓取 2026-09-17)

日期可复现配置 vs 口头要点
Granola / Jim Fisher https://www.granola.ai/blog/dangerously-skip-permissions-is-the-only-safe-mode页标 May 11;抓取 2026-09-17口头/论证连点 Yes = 坐着 YOLO;真正该做的是 auth/隔离 不是多点批准。标题挑衅,方向与官方 “bypass 只放容器/VM” 同向。
MorphLLM 指南 https://www.morphllm.com/claude-code-dangerously-skip-permissions搜索 2026;页被 bot 墙,正文以搜索摘要为准可复现 aliasalias yolo='claude --dangerously-skip-permissions';YOLO 不是官方 flag。
OOZOU TIL https://oozou.com/til/run-claude-code-fully-autonomously-with-a-yolo-alias-1902026-02-16可复现 alias同上 echo 进 zshrc/bashrc。
GH #2591 / #344672025-06-25 开;#2591 2026-01-04 closed not_planned官方仓库 issue(次级)Anthropic 拒绝--yolo alias。
Background Claude 博客 https://backgroundclaude.com/blog/permission-modes2026-04-10可复现命令;部分过时无人值守推 claude --bare -p … --permission-mode dontAsk + 窄 allow + --max-turns/--max-budget-usd注意:文称 auto 不是 Pro/Max;与官方 W32(2026-08-14 起 Pro/Max/Team 默认 auto)冲突 → 以官方为准。产品文带 Cyrus 推销。
X @paul_pbng https://x.com/paul_pbng/status/2091442772993777764执行器摘 2026口头翻车连开 YOLO 约 2 周直到 git checkout .;改 allow/deny。JSON 未核到。本席未打开该帖全文。
Reddit r/ClaudeAI2026-09-17403 后 429,停查 / 不知道

实验 env IS_SANDBOX=1 / CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1:官方 env-vars 页本次未核到 → 不进舰队默认

真源:/home/box/archives/org/2026-09-17-claude-code-unattended.md · 抓取日 2026-09-17 · 正文由 scripts/sync_reports.py 从 md sync,勿手改本页 SYNC 区当真源