Claude Code用户讨论如何落实强制规则
一则Reddit讨论援引Anthropic的说明称,CLAUDE.md和自动记忆会向Claude Code提供上下文,但并非强制配置。讨论还以OpenAI Codex团队被转述的做法为参照,询问用户哪些规则应移入钩子或测试,并以精简的AGENTS.md配合检查工具来保障关键约束。
这场讨论区分了Claude Code可读取的指导与能够阻止或验证操作的强制保障机制。
Anthropic's memory docs for Claude Code say CLAUDE.md and auto memory are both loaded at the start of every conversation, but Claude treats them as context, not enforced configuration. For anything that has to happen no matter what, the docs point to hooks (a PreToolUse hook can block an action).
That's easy to nod along to and still leave mandatory rules as polite sentences in a markdown file.
OpenAI's Codex team wrote something related in their Feb 2026 harness engineering post. Their "one big AGENTS.md" approach failed (context crowded out, rules went stale), so they cut it to a roughly 100-line map that points to deeper docs, and enforced the invariants that mattered with linters and tests instead of prose.
I'm curious how people here actually split it:
- What lives in CLAUDE.md (conventions, where things are, how to run stuff)?
- What did you move into a hook or a test because Claude kept missing it?
- What did you delete because it stopped being true?
Sources: Claude Code docs ("How Claude remembers your project"), OpenAI "Harness engineering: leveraging Codex in an agent-first world" (Feb 11, 2026).
submitted by /u/ombre-ai [link] [comments]