liveBook · Manning

Instruction hierarchy

As explained in Designing AI Agents

A layered arrangement of instructions in which levels determine their priority and the context loaded for an agent session.

An instruction hierarchy organizes persistent agent instructions by scope and priority, shaping the context loaded for a session. It sits at the boundary between memory and perception: stored instructions influence what the agent sees in its current cycle. section 3.1.3

Priority describes position and intent; it is not enforcement. A lower-level rule can contradict a higher-level rule, and the model may see both. Controls that must be enforced need a separate mechanism. section 3.1.3

Table 3.2 Claude Code's five-level configured instruction hierarchy
Level
Source
Scope
Loading strategy
Enterprise
Enterprise CLAUDE.md
Organization-wide
Always loaded (P0)
User
~/.claude/CLAUDE.md
Personal
Always loaded
Project
./CLAUDE.md
Team-shared
Always loaded
Rules
.claude/rules/*.md
Modular
Loaded at launch, or on demand for path-scoped rules
Local
./CLAUDE.local.md
Individual, not committed
Loaded with project instructions

Compare the five configured Claude Code instruction levels by scope and loading strategy. Rules may load at launch or on demand when path-scoped. section 3.1.3

The hierarchy can implement context triage: enterprise instructions carry security rules, while user instructions carry personal preferences. Triage also covers information outside the configured hierarchy, including the current task, tool results, error traces, and on-demand files. section 3.2.3

Table 3.3 Claude Code's triage implementation
Triage tier
Claude Code implementation
Why this priority
P0
Enterprise CLAUDE.md + system prompt
Security policies: never optional
P0
User's current message + selected code
The task itself
P1
Project CLAUDE.md + active rules
Team conventions: the review is wrong without them
P1
Most recent tool results, error traces
Current state of the world
P2
Earlier conversation history
Background: useful but summarizable
P2
User CLAUDE.md (personal preferences)
Nice to have, not critical
P3
Repository files, documentation, web
Load on demand via Read, Grep, Glob

See how triage priorities distinguish essential policies and task information from summarizable history and on-demand content. section 3.2.3

Protect failure evidence while a decision is active if losing it could cause the agent to repeat a failed or unsafe action. The system designer defines that protected class and its release condition; the agent may promote additional evidence but should not silently demote it. section 3.2.3

Other loading mechanisms complement the hierarchy. An auto-memory index loads selected content at session start, with detailed files available on demand. Skills expose a listing first and load full instructions when used. Sub-agents normally receive project memory but not the parent’s conversation history or accumulated tool results; built-in Explore and Plan agents skip project memory for speed. section 3.1.3

How Designing AI Agents covers it

How deep it goes
Details five configured levels and loading strategies, while distinguishing instruction priority from separate enforcement.
Examples
Maps Claude Code instruction files and triage tiers to security policies, team conventions, and personal preferences.
What you can do after
Operate/configure a Claude Code instruction hierarchy by placing policies and preferences at appropriate scopes.
How it connects
Connects context triage, memory, progressive disclosure, and context isolation.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Designing AI Agents. The section links point to the parts of the book it draws on.