Lesson 22 of 38 · Core - 01:15-01:30

Standing instructions: AGENTS.md and CLAUDE.md

Build a persistent, layered instruction system. AGENTS.md for Codex, CLAUDE.md for Claude Code, so every session starts already knowing your build commands, conventions, and house rules. Master the load order and precedence of both tools, write rules concrete enough that the agent actually follows them, scope each rule to the right level, keep one source of truth so the two tools never drift, and know exactly where the line is between guidance (a file) and enforcement (a hook).

A task brief covers one job; standing instructions cover every job in a project. Every agent session starts with a blank context window, it has no memory of the last run, the correction you made yesterday, or the build command you typed ten times last week. Standing-instruction files are the fix: AGENTS.md (the cross-tool standard Codex reads) and CLAUDE.md (Claude Code's equivalent) are plain markdown the agent loads at the start of every run, carrying build commands, conventions, architecture notes, and 'always do X' rules across sessions. Write them once and every future task starts already informed, which is the difference between an agent that re-asks 'how do I run the tests here?' on turn one and one that just runs them correctly. This lesson is the WHY and the HOW: why a persistent file beats per-session reminders structurally, how each tool resolves and layers these files (the part most people get wrong), what belongs in them versus what belongs in a hook or a skill, and how to keep Codex and Claude reading a single shared source of truth so a rule change updates both at once.

Infographic

Agentic AI instructions, the hierarchy of persistence

A hierarchy map for persistent agent instructions, scoped rules, hooks, and memory.

Dark teal infographic: AGENTS.md and CLAUDE.md precedence, closer-file resolution, guidance versus enforcement, instruction scopes, path-scoped rules, and manual versus automated memory.
Open full-size infographic
Video

Persistent AI memory. AGENTS.md and CLAUDE.md

A branded walkthrough: the layered instruction hierarchy, closer-file precedence, concise rules to avoid truncation, and guidance versus hard enforcement via hooks.

What to understand

  • Standing instructions are the project's long-term memory; a task brief is its short-term memory. The brief from Lesson 5 is per-job and disposable. AGENTS.md / CLAUDE.md are durable: they encode the facts that are true for every task in this repo, how to build, how to test, where things live, what 'done' means here. Together they form a two-tier system: durable house rules in the file, job-specific detail in the brief. The file stops you re-typing the same context; the brief stays lean because it can assume the file.
  • AGENTS.md is now a cross-tool open standard, not a Codex-only file. The same AGENTS.md is read by Codex, and increasingly by other agents (Cursor, Jules, and others have converged on it). Claude Code is the deliberate exception: it reads CLAUDE.md, not AGENTS.md, but it can import AGENTS.md in one line, so you still keep a single source of truth. Treat AGENTS.md as the shared base and CLAUDE.md as a thin Claude-specific wrapper around it.
  • Codex resolves AGENTS.md by walking the tree and concatenating root-down. It reads global scope from ~/.codex first (AGENTS.override.md before AGENTS.md), then walks from the Git root down to your current directory, joining files with blank lines. At every level it checks AGENTS.override.md before AGENTS.md, and the override wins if both exist. Files closer to your current directory appear LAST in the combined prompt, so they override earlier guidance. Codex reads at most one file per directory, skips empty files, and stops once the combined size hits project_doc_max_bytes (32 KiB default), and crucially, if it truncates, you get no warning in the TUI, so an over-stuffed chain can silently drop your most specific rules.
  • Claude Code loads CLAUDE.md by walking UP the tree, then ordering content root-down. Files in the directory hierarchy above your working directory load in full at launch; within each directory CLAUDE.local.md is appended after CLAUDE.md (so your private notes are read last at that level), and across the tree content is ordered from the filesystem root down to where you launched, so the file closest to your launch point is read last and effectively wins. Subdirectory CLAUDE.md files are NOT loaded at launch; they load on demand when Claude reads a file in that subdirectory. This is the load-order detail people get wrong: 'closer = read later = higher precedence' for ancestors, and 'deeper = lazy-loaded' for descendants.
  • Claude Code has four scopes, ordered broad-to-specific. Managed policy (org-wide, e.g. C:\Program Files\ClaudeCode\CLAUDE.md on Windows, cannot be excluded by individual settings) → user (~/.claude/CLAUDE.md, your personal defaults across all projects) → project (./CLAUDE.md or ./.claude/CLAUDE.md, team-shared via source control) → local (./CLAUDE.local.md, gitignored, your private per-project notes). They load in that order, so project rules appear after user rules and take precedence on conflicts. Put each rule at the level whose audience matches it.
  • What goes in these files is exactly the stuff you'd otherwise re-explain: build/test/lint commands, coding standards, project layout ('API handlers live in src/api/handlers/'), naming conventions, and 'always do X' rules. The signal-to-noise rule from the official docs is brutal and correct: vague entries actively hurt. 'Use 2-space indentation' beats 'Format code properly'; 'Run npm test before committing' beats 'Test your changes'; 'API handlers live in src/api/handlers/' beats 'Keep files organized'. A rule the agent can't verify it followed is a rule it will quietly ignore.
  • Keep them short, length is a cost, not a feature. Claude Code targets under 200 lines per CLAUDE.md because longer files consume more context and measurably reduce adherence; Codex hard-caps at 32 KiB and truncates silently past it. For larger projects, split topics into .claude/rules/ files (one topic per file) that can be path-scoped with YAML frontmatter (paths: ["src/api/**/*.ts"]) so a rule only loads into context when Claude touches matching files, keeping the always-on root file lean while still having deep coverage where it's needed.
  • These files are context, not enforcement, know the line. Claude's docs are explicit: CLAUDE.md is delivered as a user message after the system prompt, so there is no guarantee of strict compliance, especially for vague or conflicting rules. For anything that MUST happen at a fixed point (run lint before every commit, block writes to a path), use a PreToolUse hook, it executes as a shell command regardless of what the model decides. The mental model: file = strong suggestion the agent reads every time; hook = hard gate the harness enforces.
  • Auto memory is the newer second layer, and it is separate from CLAUDE.md. Claude Code (v2.1.59+) now writes its own notes as it works, build commands, debugging insights, preferences it infers from your corrections, into ~/.claude/projects/<project>/memory/. The first 200 lines (or 25 KB) of that MEMORY.md load every session. The split that matters: CLAUDE.md is what YOU write (instructions); auto memory is what CLAUDE writes (learnings). The '#' quick-add shortcut in the REPL now saves to auto memory, not to CLAUDE.md, to change CLAUDE.md, edit it or tell Claude 'add this to CLAUDE.md'.

Deeper dive

Why persistent instructions beat per-session reminders (the core argument)

Every agent session is born amnesiac, a fresh context window with no recollection of prior runs. If your conventions live only in your head, you pay a tax on every single session: you re-type 'use pnpm not npm', re-explain the test command, re-correct the same import style, and you pay it forever because the agent learns nothing between runs. Worse, you pay it inconsistently, some sessions you forget to mention a rule, so the agent silently violates it, and you only notice in review. A standing-instruction file converts that recurring, error-prone tax into a one-time write. The file is read at turn zero of every session, deterministically, before the agent forms any plan, so the convention shapes the very first decision instead of being a correction bolted on afterward. There is also a compounding quality effect: corrections you make in chat are ephemeral (they vanish at session end, and survive /compact only if they were in the file), whereas a rule promoted into CLAUDE.md is permanent and shared. The discipline the docs recommend captures this exactly: the moment you type the same correction a second time, or a review catches something the agent 'should have known about this codebase', that is the signal to move it from conversation into the file. Per-session reminders scale linearly with the number of sessions; a file is O(1).

Precedence is layering, not overriding, and the order is counterintuitive

Both tools CONCATENATE rather than replace, which trips people up. Nothing 'overrides' in the sense of deleting an earlier rule; instead, later-loaded text sits further down the combined prompt, and when two rules conflict the model tends to follow the one it read most recently, so 'precedence' really means 'position in the assembled context'. The order is the part to internalise. Codex builds the chain root-down (global ~/.codex first, then Git root, then deeper directories), so the directory nearest your working dir is appended LAST and effectively wins; an AGENTS.override.md at any level jumps ahead of the plain AGENTS.md in that same directory. Claude Code is symmetric for ancestors: it walks up to collect files but orders them root-down, so the CLAUDE.md closest to where you launched is read last and wins, and within a directory CLAUDE.local.md is appended after CLAUDE.md. The practical consequences: (1) put the most specific, most authoritative rule deepest, because depth = recency = priority; (2) keep contradictory rules out of the chain entirely, if two files disagree the model 'may pick one arbitrarily', so periodic review to remove conflicts is real maintenance, not housekeeping theatre; (3) watch the size cap on Codex, because truncation is silent and happens at the byte limit, an over-long ancestor file can starve the deeper, more specific file you actually care about.

The file/hook/skill/auto-memory boundary, putting each rule where it can succeed

Four mechanisms now overlap, and choosing wrong is why rules 'don't work'. A standing-instruction file (AGENTS.md/CLAUDE.md) is always-on context the agent reads every session, perfect for durable, broadly-applicable facts and 'always prefer X' guidance, but it is a suggestion, not a guarantee, and it costs context tokens every run. A hook is a shell command the harness fires at a lifecycle event (PreToolUse, before a commit), use it for anything that MUST happen deterministically, because it runs regardless of what the model decides; the give-away phrase is 'must run before/after every…'. A skill is a packaged, on-demand workflow that loads only when invoked or when relevant, use it for multi-step procedures that don't need to sit in context all the time (the docs explicitly say to move multi-step procedures out of CLAUDE.md and into a skill). Auto memory is the agent's own running notebook, use it for things you want learned without writing them yourself. The decision rule: is it a durable fact true every session? → file. Must it happen at a fixed point, no exceptions? → hook. Is it a procedure only needed sometimes? → skill. Should the agent just learn it from your corrections? → auto memory. Cramming a must-happen step into CLAUDE.md and being surprised when it's skipped is the single most common failure, that's a hook's job, not a file's.

Visualisation

How CLAUDE.md scopes stack, broad to specific

Read top-to-bottom: each layer loads in this order, so the deepest/closest file is read LAST and wins on conflicts. Specificity beats breadth.

  1. Managed policy, org-wideC:\Program Files\ClaudeCode\CLAUDE.md. Loads first, cannot be excluded by individual settings; the floor every session sits on. (Cannot be excluded means always present, not always winning, on a direct conflict the later, more specific file is read last and tends to be followed.)
  2. User scope, ~/.claude/CLAUDE.mdYour personal defaults across every project. Loads after managed, so project rules can still override these on conflict.
  3. Project scope./CLAUDE.mdTeam-shared, committed to source control. Loads after user, so it wins over personal defaults, the durable house rules for this repo.
  4. Local scope./CLAUDE.local.mdGitignored private per-project notes (sandbox URLs, test data). Appended last at this level, so it sits lowest in the prompt and effectively wins.
  5. Deepest ancestor winsAcross the tree, files are ordered root-down; the CLAUDE.md closest to where you launched is read last, depth = recency = priority.
  6. File = suggestion, not enforcementAll of the above is context delivered as a user message. For a must-happen step, drop down to a PreToolUse hook, that's a hard gate, not a layer.

Step by step

1

Generate a starting CLAUDE.md with /init

Generate a starting CLAUDE.md with /init - product screen reference

In Claude Code, run /init in your project root. Claude explores the codebase with a subagent and drafts a CLAUDE.md with the build commands, test instructions, and conventions it discovers; if a CLAUDE.md already exists it suggests improvements rather than overwriting. If the repo already has an AGENTS.md (or .cursorrules / .windsurfrules), /init reads them and incorporates the relevant parts. Set CLAUDE_CODE_NEW_INIT=1 first if you want the newer interactive multi-phase flow that also offers to scaffold skills and hooks.

Hint/init gives you a ~70% draft from what's inferable. Your job is the 30% Claude can't discover, house rules, architectural invariants, and gotchas.

On this screen

  1. 1Generated build/test section. Auto-discovered commands, run each one yourself once to confirm it's correct before trusting it in every future session.
  2. 2Conventions section. A starting point; refine it into concrete, verifiable rules Claude could never infer from a cold read (money-as-cents, no-DB-from-routes).
2

Trim it to the essentials and make every rule verifiable

Trim it to the essentials and make every rule verifiable - product screen reference

Edit the generated file toward 200 lines or fewer. Delete anything Claude can rediscover cheaply; keep only durable facts: build/test/lint commands, naming conventions, project layout, and 'always do X' rules. Then rewrite every vague line into one the agent can check it followed, turn 'format properly' into '2-space indentation, no semicolons', and 'test your changes' into 'run pnpm test before reporting done'. Use markdown headers and bullets, never dense paragraphs. Done when the file is at or under ~200 lines and every remaining rule names something the agent could check it followed.

HintEvery line costs context tokens every session and dilutes adherence. If a rule only matters in one folder, it belongs in a path-scoped .claude/rules/ file, not the always-on root.

On this screen

  1. 1Headed, scannable structure. Keep the ## headers and bullets, the agent scans for the section it needs the way you scan a form; walls of prose get skimmed and lost.
  2. 2Specific rule example. Concrete and verifiable ('2-space indentation') reliably outperforms vague guidance ('format properly'), which the docs say is silently ignored.
3

Choose the right scope for each instruction

Choose the right scope for each instruction - product screen reference

Place each rule at the level whose audience matches it. Personal preferences that follow you everywhere go in ~/.claude/CLAUDE.md (all your projects). Team-shared standards go in the committed ./CLAUDE.md (or ./.claude/CLAUDE.md). Private per-project notes, sandbox URLs, your test data, go in ./CLAUDE.local.md, which you add to .gitignore (choosing the personal option in /init does this for you). Org-wide policy lives in the managed-policy CLAUDE.md and cannot be excluded by individual settings. Remember the order: managed → user → project → local, so project rules load after user rules and win on conflict. Done when each rule lives at exactly one scope and you can say in one line who its audience is.

HintIf a rule is just yours, keep it out of the committed file, your teammates don't need your sandbox URL, and it adds noise to their context.

On this screen

  1. 1Official memory docs. The page this step paraphrases. How Claude remembers your project. Keep it open while sorting rules; the scopes (managed, user, project, local) and their load order are documented here.
  2. 2CLAUDE.md vs auto memory table. The visible table splits what YOU write (instructions) from what CLAUDE writes (learnings), check it before placing a rule, so instructions go in CLAUDE.md and not in auto memory's lane.
4

Set up AGENTS.md for Codex (and every other AGENTS-aware tool)

Set up AGENTS.md for Codex (and every other AGENTS-aware tool) - product screen reference

In your repository root, create an AGENTS.md (use the production example above as a template) with sections for the stack, exact build/test/lint commands, project layout, conventions, an always/never block, and security rules. For a subservice with different rules, add a nested file like services/payments/AGENTS.md. Codex merges from the Git root down and the deeper file wins. Use services/payments/AGENTS.override.md when you need to supersede the base file in that directory, or ~/.codex/AGENTS.override.md for a temporary global override. Keep the whole chain well under 32 KiB. Verify it is read: start a fresh Codex session and ask what this repo's build commands are, a correct answer without searching means AGENTS.md loaded.

HintCodex reads at most one file per directory, skips empty ones, and truncates silently at 32 KiB, so put each service's rules in that service's folder and don't let an over-stuffed root starve the deeper files.

On this screen

  1. 1Discovery order. The visible How Codex discovers guidance section: global ~/.codex first, then Git root down to your directory, deeper files are appended later and win.
  2. 2Override behaviour. The page documents AGENTS.override.md: checked before AGENTS.md at every level, the mechanism for service-specific or temporary overrides.
5

Make one file the source of truth

To avoid maintaining two near-identical files, put all shared content in AGENTS.md and create a CLAUDE.md whose first line is @AGENTS.md, then add only Claude-specific notes below it (see the wrapper example above). The first time Claude encounters the import it shows a one-time approval dialog listing the file. On Windows, prefer this @-import over a symlink, since symlinks need Administrator or Developer Mode.

HintOne source of truth means a single rule change updates both Codex and Claude at once, no silent drift, which is the classic two-file failure.

6

Verify what actually loaded, then decide file vs hook

Verify what actually loaded, then decide file vs hook - product screen reference

In Claude Code, run /memory to list every CLAUDE.md, CLAUDE.local.md, and .claude/rules file loaded in the current session, and to toggle auto memory. If a file you expected isn't listed, Claude can't see it, check its location against the load order before assuming it was ignored. For deeper debugging, the InstructionsLoaded hook logs exactly which instruction files loaded, when, and why. Finally, audit your rules: any rule that MUST happen at a fixed point (lint before every commit, block writes to a path) should be moved out of CLAUDE.md and into a PreToolUse hook, because a file is guidance, not a guarantee.

HintWhen an instruction 'isn't working', first confirm it loaded at all, half the time the file is simply in the wrong place; the other half it's a must-happen rule that belongs in a hook.

On this screen

  1. 1Loaded files list. Shows exactly which memory files are active this session, your first debugging stop when a rule seems ignored.
  2. 2Auto memory toggle. Separate from CLAUDE.md; this controls the notes Claude writes for itself (build commands, learnings) across sessions.
Hands-on task

Run /init on a real project, trim the result under 200 lines and rewrite every vague rule into a verifiable one. Convert it to one source of truth: move the shared content into AGENTS.md and make CLAUDE.md a one-line @AGENTS.md import plus any Claude-only notes. Add one nested AGENTS.override.md (or a path-scoped .claude/rules/ file) for a subfolder with different conventions, and identify one must-happen rule you'll move into a hook instead. Confirm with /memory that everything loaded.

What you produce

A committed, source-of-truth AGENTS.md (with build/test/lint commands, layout, verifiable conventions, an always/never block, and security rules), a one-line CLAUDE.md that imports it plus Claude-specific notes, a personal user-scope file, at least one nested/path-scoped override, and a written note of which rule belongs in a hook rather than a file, all verified as loaded via /memory.

Production prompt examples

Production-grade AGENTS.md, the cross-tool source of truth (copy, then edit per repo)
# AGENTS.md

> Standing instructions for AI coding agents in this repository.
> Read at the start of every session. Keep under 200 lines. Concrete over vague.

## Project
- Name: payments-api. TypeScript service handling Stripe + ledger.
- Stack: Node 20, TypeScript (strict), Fastify, Prisma, PostgreSQL, Vitest.
- Package manager: pnpm. NEVER use npm or yarn in this repo.

## Build, test, lint (run these exact commands)
- Install: pnpm install
- Dev server: pnpm dev # http://localhost:3000
- Typecheck: pnpm typecheck
- Lint (must pass): pnpm lint
- Unit tests: pnpm test
- One test file: pnpm test src/ledger/posting.test.ts
- Before you say a task is done: pnpm lint && pnpm typecheck && pnpm test must all pass.

## Project layout (where things live)
- HTTP routes: src/routes/
- Business logic: src/services/
- DB access only in: src/repositories/ (never query the DB from a route)
- Shared types: src/types/
- Tests sit next to source as *.test.ts (co-located, not in a /tests dir).

## Conventions (verifiable, not vibes)
- 2-space indentation; no semicolons (Prettier config is the source of truth).
- Money is ALWAYS integer cents (bigint), never floats. No exceptions.
- Use the existing logger in src/lib/logger.ts, no console.log in committed code.
- New env vars: add to src/config/env.ts (zod schema) AND .env.example.
- Prefer immutable updates ({...obj}); do not mutate function arguments.

## Always do / never do
- ALWAYS read the file you're editing before proposing a diff.
- ALWAYS add or update a test when you change behaviour in src/services/ or src/ledger/.
- NEVER edit anything under prisma/migrations/ by hand, generate with `pnpm prisma migrate`.
- NEVER commit secrets; if you spot one, stop and flag it.
- If a task is ambiguous, ask ONE tight question instead of guessing.

## Security
- All external input is validated with zod at the route boundary before use.
- Ledger writes go through src/ledger/post.ts only, it enforces double-entry invariants.
  • A blockquote header states the file's job and the two governing constraints (under 200 lines, concrete) so a future maintainer, human or agent, keeps it disciplined.
  • The exact build/test/lint commands are the single highest-value section: they're what the agent re-asks for on a cold start, and 'must all pass before done' gives it a verifiable definition of finished.
  • Project layout with a hard rule ('never query the DB from a route') encodes architecture the agent can't infer from a cold read, preventing it from scattering DB calls.
  • Conventions are written so the agent can VERIFY it complied (integer cents, no console.log, 2-space), vague versions ('handle money carefully') would be silently ignored per the docs.
  • The Always/Never block front-loads the highest-leverage behaviours; 'ask ONE tight question instead of guessing' kills the expensive vague-retry loop from Lesson 3.
  • It's tool-agnostic AGENTS.md so Codex (and Cursor/Jules) read it directly; the next prompt shows the one-line CLAUDE.md that points Claude at this same file, one source of truth, zero drift.
CLAUDE.md as a thin wrapper, one source of truth, no drift
@AGENTS.md

## Claude Code specific

- Use plan mode for any change under src/billing/ or src/ledger/, show the plan and wait for approval before editing.
- When you finish a task, run /memory mentally: did you violate any rule above? If so, fix it before reporting done.
- For multi-step refactors, prefer creating a short checklist and working through it rather than one giant diff.

<!-- maintainer note: keep this wrapper tiny. All real rules live in AGENTS.md so Codex and Claude never diverge. This comment is stripped before it reaches Claude's context. -->
  • Line one is the entire trick: @AGENTS.md imports the shared file at session start, so Claude reads the exact same rules as Codex, change AGENTS.md once and both tools update, eliminating the silent two-file drift that is the classic standing-instructions failure.
  • Only genuinely Claude-specific behaviour lives below the import (plan mode for sensitive folders, the self-check), anything cross-tool would go in AGENTS.md instead.
  • Plan-mode-for-sensitive-paths is a good CLAUDE.md rule because it's guidance the model applies contextually; a hard 'block all writes to src/ledger' would instead be a PreToolUse hook, not a file rule.
  • The HTML comment is a maintainer note that Claude Code strips before injecting context, so it documents intent for humans without spending a single context token.
  • On Windows this @-import is preferred over `ln -s AGENTS.md CLAUDE.md`, because symlinks need Administrator or Developer Mode, the import works everywhere with no elevated permissions.

Common mistakes to avoid

  • Letting the file grow past a couple hundred lines (or past 32 KiB on Codex, where it truncates with no warning), both burn context and lower how reliably the agent follows any single rule.
  • Writing vague rules ('write clean code', 'handle money carefully') instead of concrete, verifiable ones ('integer cents only', 'run pnpm lint before finishing'), the docs say vague rules are silently ignored.
  • Expecting CLAUDE.md / AGENTS.md to enforce a must-happen step, it's guidance delivered as a user message, not a guarantee; use a PreToolUse hook for hard enforcement.
  • Maintaining separate AGENTS.md and CLAUDE.md by hand until they silently drift apart, instead of importing one from the other with @AGENTS.md.
  • Getting precedence backwards, assuming the root file wins when in fact the file closest to your working directory is read last and effectively overrides it.
  • Putting a multi-step procedure in CLAUDE.md when it should be a skill (loads on demand), or a personal sandbox URL in the committed project file when it should be in gitignored CLAUDE.local.md.
  • Assuming a rule is loaded without checking, when it 'isn't working', forgetting to run /memory first to confirm the file was even seen.

Source conflicts to review

  • Codex's AGENTS.md guide and third-party 2026 write-ups agree on the 32 KiB project_doc_max_bytes default and silent truncation, but community reports (e.g. openai/codex issue #7138) note the truncation gives no TUI warning, verify the current cap and any warning behaviour in your installed Codex version's config (config.toml).
  • Claude Code's '#' quick-add shortcut historically wrote to CLAUDE.md in older guidance; current official docs route it to AUTO MEMORY, not CLAUDE.md. Behaviour depends on version (auto memory needs v2.1.59+), confirm in /memory which store received your note.

Key terms

AGENTS.md
The cross-tool standing-instructions file (read by Codex and others), resolved from global ~/.codex down through the repo tree, joined root-down, with closer/deeper files winning.
AGENTS.override.md
A higher-priority sibling of AGENTS.md checked first in any directory (and in ~/.codex); if both exist at a level, the override wins, used for temporary or service-specific overrides.
CLAUDE.md
Claude Code's standing-instructions file, loaded at every session start across managed, user, project, and local scopes; reads CLAUDE.md (not AGENTS.md) but can import it.
project_doc_max_bytes
Codex's combined size cap for the AGENTS.md chain (32 KiB default); past it Codex truncates silently with no TUI warning.
Load order / precedence
How files are concatenated and positioned: later-read text sits lower in the prompt, so the file closest to your working directory effectively overrides earlier ones.
.claude/rules/
A directory of topic-specific Claude instruction files, optionally path-scoped via YAML 'paths' frontmatter so a rule only loads when Claude touches matching files.
Auto memory
Notes Claude writes itself across sessions (build commands, learnings) in ~/.claude/projects/<project>/memory/, distinct from CLAUDE.md, which you write; the '#' REPL shortcut adds to auto memory.
/init
Claude Code command that analyses a codebase and generates a starting CLAUDE.md, incorporating any existing AGENTS.md or other tool configs.
/memory
Claude Code command listing all loaded instruction files and toggling auto memory; the first stop when a rule seems ignored.
Hook (vs file)
A shell command the harness runs at a lifecycle event (e.g. PreToolUse), used for must-happen enforcement, because unlike a file it runs regardless of what the model decides.
YAML frontmatter
A small metadata block at the top of a markdown file between --- lines. In .claude/rules/ files, a paths: frontmatter entry scopes the rule so it only loads when Claude touches matching files.
Subagent
A secondary agent the main session spawns for a bounded job, like /init's codebase exploration, so the main context stays clean.
Skill
A packaged, on-demand workflow that loads only when invoked or relevant, where multi-step procedures belong, instead of sitting in always-on CLAUDE.md context.

Resources

Checkpoint

Pick one instruction you re-type into the agent every session. Which scope does it belong in (managed, user, project, or local), is it a durable fact (so a file) or a must-happen step (so a hook), and how will you write it concretely enough that the agent can verify it followed?