Claude Code 启动参数与环境变量

Claude Code 整理自 @bcherny(Claude Code 创始人,Anthropic)2025–2026 年在 X 上发布的帖子,以及官方文档。

主要来源:
– Jan 2, 2026 X 帖子(13 条使用技巧)
– Jan 31, 2026 X 帖子(10 条团队内部技巧,8.5M 浏览)
– Feb 11, 2026 X 帖子(12 条配置技巧,含 “37 settings, 84 env vars” 原话)
– 官方文档 code.claude.com/docs/en/cli-reference – 官方文档 code.claude.com/docs/en/env-vars


一、CLI 启动标志(Flags)

bcherny 亲自提到的标志

标志 用途 出处
–permission-mode plan 以 Plan 模式启动(只读探索,不写代码) Feb 11 帖子
–permission-mode dontAsk 无需审批权限提示运行 Jan 2 帖子 tip 12
–permission-mode bypassPermissions 等同于 –dangerously-skip-permissions 官方文档
–dangerously-skip-permissions 跳过所有权限提示(在沙箱中使用) Jan 2 帖子 tip 12
–allow-dangerously-skip-permissions 把 bypassPermissions 加入 Shift+Tab 循环,不立即进入该模式 官方文档
–worktree / -w 在独立 git worktree 中启动(如 claude -w feature-auth Jan 31 帖子 tip 1
–worktree –tmux worktree + 自动创建 tmux 会话 官方文档
–teleport 把本地会话切换到 web(claude.ai/code),或把 web 会话恢复到本地 Jan 2 帖子 tip 2
–remote “task” 在 claude.ai 创建新 web 会话 官方文档
–remote-control / –rc 启动支持 Remote Control 的交互会话(可从 claude.ai 或 Claude App 控制) 官方文档
–agent 为当前会话指定 agent(覆盖 agent 设置项) Feb 11 帖子 tip 4
–agents ‘ 用 JSON 动态定义 subagent 官方文档
–name / -n 为会话设置展示名称(可用 claude -r 恢复) 后续线程
–bare 极简模式:跳过 hooks/skills/plugins/MCP/auto-memory/CLAUDE.md 自动发现,只保留 Bash、文件读写工具 后续线程
–add-dir 添加额外工作目录(Claude 可读写该目录文件) 后续线程
–effort 设置当前会话的 effort 等级(low / medium / high / max Feb 11 帖子 tip 2
–model 指定模型(如 claude-opus–4–6,或别名 opus / sonnet Jan 2 帖子 tip 3
-p “query” 非交互(SDK)模式,执行后退出;用于 CI 或脚本 Jan 31 帖子 bonus
–continue / -c 加载当前目录最近的会话 官方文档
–resume / -r 按 ID 或名称恢复会话 官方文档
–fork-session 恢复时创建新会话 ID 而非复用原会话(与 –resume 配合) 官方文档
–chrome 启用 Chrome 浏览器集成(UI 验证、自动化测试) Jan 2 帖子 tip 13
–mcp-config 从 JSON 文件加载 MCP 服务器配置 官方文档
–strict-mcp-config 只使用 –mcp-config 指定的 MCP 服务器,忽略其他 MCP 配置 官方文档
–system-prompt 替换整个系统提示词 官方文档
–append-system-prompt 在默认系统提示词末尾追加内容 官方文档
–append-system-prompt-file 从文件追加系统提示词 官方文档
–tools “Bash,Edit,Read” 限制 Claude 可用的工具集 官方文档
–allowedTools 无需审批直接执行的工具列表(权限白名单) Jan 2 帖子 tip 10
–disallowedTools 从模型上下文中移除的工具(彻底禁用) 官方文档
–max-turns 限制 agentic 轮数(仅 print 模式) 官方文档
–max-budget-usd 限制 API 花费上限(仅 print 模式) 官方文档
–output-format 输出格式:text / json / stream-json(仅 print 模式) 官方文档
–json-schema ‘ 要求输出符合 JSON Schema(仅 print 模式) 官方文档
–fallback-model 主模型过载时自动 fallback 到该模型(仅 print 模式) 官方文档
–debug 启用调试模式,可指定过滤类别(如 “api,mcp” 官方文档
–debug-file 调试日志写入指定文件路径(隐式启用 debug 模式) 官方文档
–enable-auto-mode 解锁 auto 模式加入 Shift+Tab 循环(需 Team/Enterprise 计划) 官方文档
–verbose 详细日志,显示完整逐轮输出 官方文档
–init 运行初始化 hooks 并进入交互模式 官方文档
–plugin-dir 仅本次会话从指定目录加载插件 官方文档
–settings 从 JSON 文件或 JSON 字符串加载额外设置 官方文档
–version / -v 输出版本号 官方文档

常用命令(非标志)

claude # 启动交互会话
claude “query” # 带初始 prompt 启动
claude -p “query” # SDK/非交互模式
claude -c # 继续最近的会话
claude -r “session-name” # 恢复指定会话
claude update # 更新到最新版本
claude auth login # 登录账号
claude auth status # 查看认证状态
claude agents # 列出所有已配置 subagents
claude mcp # 配置 MCP 服务器
claude plugin install  # 安装插件
claude remote-control –name “My Project” # 启动 Remote Control 服务器

Continue reading “Claude Code 启动参数与环境变量”

GPT-3 aces tests of reasoning by analogy

更可能是大语言模型训练时已经见过这些题目,很可惜论文并没有对此进行分析。

The UCLA team, Taylor Webb, Keith Holyoak, and Hongjing Lu, relied on a large collection of ways that past research has tested humans’ ability to reason via analogy. The classic form of this is the completion of a comparison—think “cold is to ice as hot is to ____”—where you have to select the best completion from a set of options.

Related tests involve figuring out the rules behind transformations of a series of letters. So, for example, if the series a b c d is transformed to a b c e, then the rule is to replace the last letter of the series with its alphabetical successor. The participant’s understanding of the rule is tested by asking them to use the rule to transform a different set of letters. Similar tests with numbers can involve complex rules, such as “only even numbers in order, but can be ascending or descending.”

On all of these tests, GPT-3 consistently outperformed undergrads, although the margins varied depending on the specific test involved. The researchers also found that the software could develop rules based on a series of numbers, and then apply them to a different domain, such as descriptions of temperatures like “warm” and “chilly.” They conclude that “these results suggest that GPT-3 has developed an abstract notion of successorship that can be flexibly generalized between different domains.”

Source: GPT-3 aces tests of reasoning by analogy | Ars Technica

谷歌AI聊天机器人Bard支持更多种语言,以叫板ChatGPT

语言不是这次更新最激动人心的地方,Bard这次开放了多模态,可以上传图片了,效果还不错,毕竟不要钱。
https://g.co/bard/share/5a87850b30eb

Im 816148

谷歌押注其新款人工智能(AI)聊天机器人将把德语、葡萄牙语和法语的“你好”扩展到更多种语言,这是它在商业化生成式AI(ChatGPT背后的技术)的高赌注竞赛中不掉队努力的一部分。

Alphabet (GOOG)旗下的谷歌计划周四为其生成式AI聊天机器人Bard增加几项新功能,包括使用从阿拉伯语到越南语等43种新增语言进行对话的能力。该公司还将在欧洲大部分地区和巴西推出Bard,这些地区拥有数亿人口。

此次推出的Bard还包括欧盟监管机构上月要求的额外隐私功能,这导致Bard在该地区的发布被推迟。

谷歌表示,新发布的Bard是该聊天机器人在功能方面最大的一次扩展。这是该公司参与生成式AI竞争的最新努力,该领域部分建立在谷歌AI研究的基础上,但谷歌最初迟迟没有将其推向市场。

Source: 谷歌AI聊天机器人Bard支持更多种语言,以叫板ChatGPT – 华尔街日报

IPTV

这是一篇教程,目的是让读者能搭建出一个系统,可以在家中电脑、手机上或是其他位置,观看家中IPTV的直播节目,甚至可以手工选择录制节目。

0. 准备工作

你需要有下列硬件/软件以完成该教程。

  • 家里的宽带有IPTV订阅,本文以广州电信IPTV为例
  • 稍微高级一点的路由器,本文以Mikrotik的RB5009为例,但openwrt/LEDE之类的也可以
  • 家中有一台常开的主机,本文以HP Gen 8 microserver为例,但树莓派4也可以
  • Plex,需要有Pass订阅,emby和Jellyfin也可以
  • 一定的网络知识和动手能力

1. 这样有什么好处

普通机顶盒,只能接在光猫上,因此只能在固定地点(例如客厅)的电视上看直播节目,而我们需要突破这个限制。

也有一些基于互联网电视的方案,可以支持用客户端观看,但基于互联网的直播会受网络带宽影响,画质较差,甚至在高峰期出现打不开的情况。而我们基于组播的方案不会受到这个影响。

虽然机顶盒支持一定天数的回放,但我们支持录制直播,多少算是弥补了这个短板。

Continue reading “IPTV”

Researchers rewire the genetics of E. coli, make it virus-proof

也就是说,我们可以改造出一种生物,它不会受到现有疾病的影响,但离开特定的非自然氨基酸就不能正常生活?
Hmm,听起来像一种奴隶制度。

Many of the fundamental features of life don’t necessarily have to be the way they are. Chance plays a major role in evolution, and there are always alternate paths that were never explored, simply because whatever evolved previously happened to be good enough. One instance of this idea is the genetic code, which converts the information carried by our DNA into the specific sequence of amino acids that form proteins. There are scores of potential amino acids, many of which can form spontaneously, but most life uses a genetic code that relies on just 20 of them.

Over the past couple of decades, scientists have shown that it doesn’t have to be that way. If you supply bacteria with the right enzyme and an alternative amino acid, they can use it. But bacteria won’t use the enzyme and amino acid very efficiently, as all the existing genetic code slots are already in use.

In a new work, researchers have managed to edit bacteria’s genetic code to free up a few new slots. They then filled those slots with unnatural amino acids, allowing the bacteria to produce proteins that would never be found in nature. One side effect of the reprogramming? No viruses could replicate in the modified bacteria.

Source: Researchers rewire the genetics of E. coli, make it virus-proof | Ars Technica

修复财新网跨站 Cookie 问题

我最近用 Chrome 访问财新网会显示这个错误,导致所有的付费文章不能观看。
但换 Edge 浏览器则没有问题。等了一天,也不见财新网解决这个问题,于是问财新网的客服。

chrome://flags/#same-site-by-default-cookies
chrome://flags/#cookies-without-same-site-must-be-secure
两项设置为Disabled

财新客服

原来是跨站 Cookie 的问题。
按财新客服的设置确实可以解决这个问题,但 Chrome 限制跨站 Cookie 是有理由的,因为这些可以用来跨站跟踪。

那么有其他安全的解决方案吗?
有的,使用 HTTPS 。但是财新网的链接默认都不是 HTTPS 的,于是我改写了这段 js 来跳转。(原脚本地址: https://greasyfork.org/en/scripts/38930-force-http-to-https)

Chrome 用户可以安装 Tampermonkey 来使用以上脚本。
这样就不需要按财新客服的建议降低浏览器的安全设置。

财新网你什么时候默认启用 HTTPS 呢?