What this thread does
Do first: run /context all to check loaded CLAUDE.md files before changing their wording. Memory guide
Short answer
Keep instructions concrete and concise. CLAUDE.md supplies context; a PreToolUse hook can block a matching tool call. Memory guide, Hooks guide In Cursor, rule inclusion depends on file format and activation metadata. Cursor rules
Choose / don't choose
- CLAUDE.md or AGENTS.md: choose for project guidance; don't assume both load by default when both exist. Memory guide
- Cursor project rules: choose for scoped instructions; don't put a plain
.mdfile in.cursor/rulesand expect rule activation. Cursor rules - PreToolUse: choose for a deterministic block before a tool runs; don't confuse an instruction with enforcement. Hooks guide
Settings that matter
| Setting or flag | Value / default | Applies to | Source |
|---|---|---|---|
| Project instructions | claude-md-or-agents-md by default; claude-md-and-agents-md loads both | Claude Code Project instructions setting | Memory guide |
@AGENTS.md | Import shared instructions from CLAUDE.md | Claude Code | Memory guide |
alwaysApply | true: always included, ignoring description and globs | Cursor .mdc rule | Cursor rules |
alwaysApply: false with globs | Attach when a matching file is in context | Cursor .mdc rule | Cursor rules |
| Hook exit status | 2 with reason on stderr blocks a PreToolUse call | Claude Code command hook | Hooks guide |
Order of operations
1. Write specific commands and conventions, group related rules, and remove contradictions; target under 200 lines per CLAUDE.md. Memory guide 2. Check the loaded files. If using shared AGENTS.md through CLAUDE.md, use an import rather than prose asking for a read. Memory guide 3. For Cursor, store project rules as .mdc files in .cursor/rules, then choose always, file-scoped, description-based or manual activation. Cursor rules 4. Register a PreToolUse command hook for the actions requiring a block. Read its JSON input from stdin and return the blocking outcome for matching calls. Hooks guide
Known failures and fixes
| Symptom | Cause | Fix | Source |
|---|---|---|---|
| Shared instructions missing | CLAUDE.md takes precedence under the default selection | Select both files or import AGENTS.md | Memory guide |
| Cursor rule ignored | Plain .md in the project-rules directory | Use .mdc, or plain AGENTS.md as the alternative | Cursor rules |
| Hook has no effect | Not registered or matcher does not match | Inspect /hooks and check case-sensitive tool matching | Hooks guide |
Missing
- How much will these instructions improve adherence in your repository? The sources give loading and enforcement behavior, not a project-specific adherence measurement.
- Which hook conditions cover every dangerous action in your project? The guide's examples do not establish that coverage.
Checked
2026-11-23: read Claude Code memory, Claude Code hooks, and Cursor rules.
Started from a post by @WhatWorks editors, packaged by the editor.