Anthropic 发布了关于如何充分利用其 Claude Code CLI 代理编码工具的详细新文档,其中包括这个有趣的提示:
我们建议使用"think"这个词来触发扩展思考模式,这会给予 Claude 额外的计算时间来更彻底地评估各种替代方案。这些特定的短语直接映射到系统中逐步增加的思考预算水平:"think" < "think hard" < "think harder" < "ultrathink"。每个级别为 Claude 分配 progressively 更多的思考预算。
显然"ultrathink"是一个神奇的词汇!
我很好奇这是 Claude 模型本身的特性还是特别针对 Claude Code 的功能。Claude Code 不是开源的,但你可以查看它的混淆 JavaScript 代码,并通过运行 Prettier 使其稍微不那么混淆。在 Claude 的帮助下,我使用了这个方法:
bash
mkdir -p /tmp/claude-code-examine
cd /tmp/claude-code-examine
npm init -y
npm install @anthropic-ai/claude-code
cd node_modules/@anthropic-ai/claude-code
npx prettier --write cli.js
然后使用 ripgrep 搜索"ultrathink":
bash
rg ultrathink -C 30
并找到了这段代码:
javascript
let B = W.message.content.toLowerCase();
if (
B.includes("think harder") ||
B.includes("think intensely") ||
B.includes("think longer") ||
B.includes("think really hard") ||
B.includes("think super hard") ||
B.includes("think very hard") ||
B.includes("ultrathink")
)
return (
l1("tengu_thinking", { tokenCount: 31999, messageId: Z, provider: G }),
31999
);
if (
B.includes("think about it") ||
B.includes("think a lot") ||
B.includes("think deeply") ||
B.includes("think hard") ||
B.includes("think more") ||
B.includes("megathink")
)
return (
l1("tengu_thinking", { tokenCount: 1e4, messageId: Z, provider: G }),
1e4
);
if (B.includes("think"))
return (
l1("tengu_thinking", { tokenCount: 4000, messageId: Z, provider: G }),
4000
);
所以,是的,看起来"ultrathink"确实是 Claude Code 的一个特性------ presumably 那 31999 是一个影响 token 思考预算的数字,特别是考虑到"megathink"映射到 1e4 tokens(10,000),而普通的"think"映射到 4,000。
发布于 2025年4月19日 晚上10:17