LinuxDo 新帖推送
179 subscribers
249K photos
310K links
Download Telegram
标题: 号外!claude code 可以养宠物了
作者: #yk
板块: #搞七捻三
编号: 1871166
帖子: https://linux.do/t/topic/1871166
时间: 2026-04-01 09:56:44
摘要:
标题: Any支持最新版的cc吗
作者: #m99
板块: #搞七捻三
编号: 1871183
帖子: https://linux.do/t/topic/1871183
时间: 2026-04-01 09:59:06
摘要:
目前停在.77版本不敢升,想试试宠物系统
标题: 还有几个小时美区就1号了,gpt的双倍活动还有么?
作者: #heidi
板块: #开发调优
编号: 1871184
帖子: https://linux.do/t/topic/1871184
时间: 2026-04-01 09:59:06
摘要:
如果取消了两个plus都不够用吧,国外用户能受得了?
标题: 看看你的电子桌宠吧~
作者: #rollbin
板块: #搞七捻三
编号: 1871191
帖子: https://linux.do/t/topic/1871191
时间: 2026-04-01 09:59:50
摘要:
卡皮巴拉~卡皮巴拉卡皮巴拉~卡皮巴拉~
标题: copilot额度
作者: #lijh
板块: #开发调优
编号: 1871197
帖子: https://linux.do/t/topic/1871197
时间: 2026-04-01 10:00:45
摘要:
问一下现在vscode里面的copilot是不是没有限制额度了?
标题: 移动端无法消除小蓝点如何解决
作者: #星渊清梦
板块: #搞七捻三
编号: 1871201
帖子: https://linux.do/t/topic/1871201
时间: 2026-04-01 10:01:23
摘要:
在旅游,用fluxdo和web网页端都无法消除小蓝点,也就是貌似并没有算阅读量,有点难受,是代理问题吗
标题: 我只是想问一下dmca是什么, gemini突然在结尾来这么一句?
作者: #hideonmiddle
板块: #搞七捻三
编号: 1871205
帖子: https://linux.do/t/topic/1871205
时间: 2026-04-01 10:01:44
摘要:
ps: 看了一下我的上下文也没有问什么跟L站相关的东西呀
标题: 樱开北岸,春满金陵(楼下的樱花开了,赏心悦目)
作者: #Andy Kong
板块: #搞七捻三
编号: 1871206
帖子: https://linux.do/t/topic/1871206
时间: 2026-04-01 10:02:01
摘要:
标题: 腾讯的朱雀ai检测怎么感觉有点不靠谱?
作者: #小白
板块: #开发调优
编号: 1871210
帖子: https://linux.do/t/topic/1871210
时间: 2026-04-01 10:02:24
摘要:
怎么是百分百人工
标题: 深入浅出 Claude Code(一):从源码理解 CLAUDE.md,重写你的配置
作者: #Khalil Gao
板块: #开发调优
编号: 1871216
帖子: https://linux.do/t/topic/1871216
时间: 2026-04-01 10:03:59
摘要:
大多数人写 CLAUDE.md 的方式是:随便写几条规则,感觉效果不明显,然后放弃。
你不知道这些文字在 Claude 眼里长什么样、被放在哪里、和其他指令的优先级关系是什么。
今天我来带各位佬友们剖析一下 claudecode 的底层逻辑

1. CLAUDE.md 不在 System Prompt 里
这是最大的认知误区。
大多数人以为 CLAUDE.md 的内容被拼接到 system prompt 中。不是的。
源码中,CLAUDE.md 通过 prependUserContext() 函数注入(utils/api.ts:449-474):
export function prependUserContext(messages, context): Message[] {
return [
createUserMessage({
content: `<system-reminder>
As you answer the user's questions, you can use the following context:
# claudeMd
${claudeMdContent}

IMPORTANT: this context may or may not be relevant to your tasks.
You should not respond to this context unless it is highly relevant to your task.
</system-reminder>`,
isMeta: true,
}),
...messages,
]
}

你的 CLAUDE.md 被包装在 <system-reminder> 标签里,作为第一条 user message 插入到对话开头。不是 system prompt,是 user message。
这样会导致几个直接后果:


CLAUDE.md 的优先级低于 system prompt。System prompt 是模型的"宪法",user message 是"法律"。当两者冲突时,system prompt 通常胜出。


模型被告知这些内容"可能不相关"——注意那句 IMPORTANT: this context may or may not be relevant to your tasks。这是一个显式的降权信号。


但是——CLAUDE.md 的开头有一句强指令(utils/claudemd.ts:89):


Codebase and user instructions are shown below. Be sure to adhere to these
instructions. IMPORTANT: These instructions OVERRIDE any default behavior
and you MUST follow them exactly as written.

“OVERRIDE any default behavior” + “MUST follow them exactly” —— 这是在用强语气对抗降权信号。效果取决于指令的具体性:越具体的指令越容易被遵守,越模糊的越容易被忽略。
所以别在 CLAUDE.md 里写"尽量简洁"这种模糊指令。写"回答不超过 3 句话"或"不要添加注释到未修改的代码"这种可验证的具体指令。

2. 从 CLAUDE 向上遍历到根目录
CLAUDE.md 不只是项目根目录的一个文件。Claude Code 从当前目录开始,逐级向上遍历到文件系统根目录,在每一级检查以下文件(utils/claudemd.ts:790-1075):
每一级目录检查:
├── CLAUDE.md → Project 类型(可版本控制)
├── .claude/CLAUDE.md → Project 类型(可版本控制)
├── .claude/rules/*.md → Project 类型(可版本控制,递归扫描子目录)
└── CLAUDE.local.md → Local 类型(不应提交到版本控制)

加上两个全局位置:
~/.claude/CLAUDE.md → User 类型(个人全局指令)
~/.claude/rules/*.md → User 类型(个人全局规则)
/etc/claude-code/CLAUDE.md → Managed 类型(企业管理员策略)
/etc/claude-code/.claude/rules/*.md → Managed 类型

加载顺序决定优先级。源码注释写得很清楚:
Files are loaded in reverse order of priority, i.e. the latest files
are highest priority with the model paying more attention to them.

“最后加载的优先级最高”——因为模型对靠近输入末尾的内容关注度更高(recency bias)。
完整的加载顺序(从先到后,优先级从低到高):
1. /etc/claude-code/CLAUDE.md (Managed - 企业策略)
2. /etc/claude-code/.claude/rules/*.md (Managed)
3. ~/.claude/CLAUDE.md (User - 个人全局)
4. ~/.claude/rules/*.md (User)
5. /repo-root/CLAUDE.md (Project - 仓库根)
6. /repo-root/.claude/CLAUDE.md (Project)
7. /repo-root/.claude/rules/*.md (Project)
8. /repo-root/src/CLAUDE.md (Project - 更近的目录)
9. /repo-root/src/.claude/rules/*.md (Project)
10. /repo-root/src/feature/CLAUDE.md (Project - 当前目录)
11. /repo-root/src/feature/CLAUDE.local.md (Local - 最高优先级)

规则放在仓库根目录的 .claude/rules/ 下。
个人偏好(语言、风格)放在 ~/.claude/CLAUDE.md
子目录特定规则(比如 frontend/CLAUDE.md 说"用 React 不用 Vue")放在对应目录
离当前工作目录越近的文件,优先级越高

3. @include 指令引入外部文件
CLAUDE.md 支持 @ 语法引入其他文件(utils/claudemd.ts:451-535):
# 我的项目规则

@./coding-standards.md
@~/global-rules.md
@/etc/team-rules/backend.md

解析逻辑:
@./path 或 @path — 相对于当前 CLAUDE.md 文件的路径
@~/path — 相对于 home 目录
@/path — 绝对路径
支持转义空格:@./my\ file.md
支持 #fragment 后缀(会被忽略):@./rules.md#section-1
安全限制:


扩展名白名单——只能引入文本文件。支持的扩展名包括 .md、.txt、.json、.yaml、.ts、.py、.go、.rs、.sql 等约 80 种(完整列表见 TEXT_FILE_EXTENSIONS)。二进制文件被静默忽略。


循环引用检测——processedPaths Set 追踪已处理的文件路径(规范化后比较)。最大递归深度 MAX_INCLUDE_DEPTH。


代码块免疫——@ 指令只在 Markdown 的文本节点(leaf text nodes)中生效。代码块和行内代码中的 @ 不会被解析:


// 这些不会被解析为 include:
if (element.type === 'code' || element.type === 'codespan') {
continue
}



外部文件需审批——引入工作目录以外的文件需要 claudeMdExternalIncludesApproved 配置项启用。User 类型的 CLAUDE.md 默认可以引入外部文件,Project 类型需要显式审批。


不存在的文件静默忽略——不会报错,不会中断加载。


可以用 @include 把 CLAUDE.md 拆成模块:
# 项目根目录 CLAUDE.md

@.claude/rules/code-style.
标题: 智谱的 lite 套餐太慢了,直接卡主,大家有遇到过的吗
作者: #蜗牛也是牛
板块: #开发调优
编号: 1871222
帖子: https://linux.do/t/topic/1871222
时间: 2026-04-01 10:04:34
摘要:
标题: 永远不知道你的邻居在干嘛
作者: #lazyrain
板块: #搞七捻三
编号: 1871223
帖子: https://linux.do/t/topic/1871223
时间: 2026-04-01 10:04:36
摘要:
最近LAX.AN4.Pro.WEE 69段的IP质量好差 L站也上不去 其他网站各种盾
标题: 我必须说一句,智谱真是🐎没了
作者: #Coca_Cola
板块: #搞七捻三
编号: 1871228
帖子: https://linux.do/t/topic/1871228
时间: 2026-04-01 10:05:20
摘要:
进都进不去了 9:58 就进不去了
标题: 笔吧评测室与极客湾正式合并!?
作者: #ina
板块: #前沿快讯
编号: 1871230
帖子: https://linux.do/t/topic/1871230
时间: 2026-04-01 10:05:33
摘要:
新婚快乐
节日快乐。。。
标题: 让老板开了 cursor team,发现不如开 pro?
作者: #从来
板块: #开发调优
编号: 1871234
帖子: https://linux.do/t/topic/1871234
时间: 2026-04-01 10:06:51
摘要:
昨天跟老板说,开了 40 刀 cursor team,怎么发现额度才 20 刀?跟个人的 pro额度 的一样啊?既然使用额度一样,为啥 team 贵了一倍的价钱。。