Claim Your Free Project
Instruction Hierarchy

Where AI Coding Agents Actually Read Their Instructions From

Broadest scope at the top, most specific at the bottom. Every layer that's loaded gets combined, not replaced, and nothing is silently dropped for being lower in the order. Miss that, and you'll write a rule in the wrong place and wonder why it never seems to apply consistently, in whichever tool you're using.

Blue Shark Tech Field Notes · 7 min read

The first mistake most teams make with an AI coding agent is treating "instructions" as one file. It isn't, in any tool we've put to real work. Claude Code and ChatGPT Codex both load instructions from several distinct places every time a session starts, and understanding which one to use for a given rule is the difference between a rule that reliably applies and one that only seems to, until the day it doesn't.

The layers, broadest to narrowest

Each layer below can be loaded at once. None of them override each other outright, the agent reads all of them and tries to reconcile what it's told. That has a real consequence: put a rule in the wrong layer and it either applies somewhere you didn't want it, or fails to apply somewhere you needed it. The exact number of layers and what they're called differs by tool, this is the shared shape underneath.

Broadest, organization-wide
Managed or enterprise policy
Deployed by IT to every machine in an organization. Applies to every user, every project, everywhere it's pushed, and can't be excluded by an individual project or user setting. Only relevant once a company has a central deployment process; most individual setups never touch this layer.
This user, every project
Global instructions
Rules that should apply no matter which project is open: writing style, security defaults, working preferences. Anything genuinely universal belongs here once, not copied into every project folder.
This project only
Project instructions
Rules that name this project's specific tools, systems, or data, and would make no sense anywhere else. Kept separate from the global layer so a project-specific detail never gets mistaken for a universal rule, or the reverse.
This project, personal
Local, machine-specific overrides
Sandbox URLs, personal test data, anything specific to one person's own setup inside a shared project, not meant to be shared with the rest of a team.
Auto memory
Learned corrections
Written by the agent itself as it learns preferences and project context, not typed by hand. A general principle accidentally captured at the project level stays invisible to every other project until it's reclassified and moved.
Skills or presets
On-demand procedures
Repeatable step-by-step processes, loaded only when invoked, not automatically read at the start of a session. A different risk profile than a rule: this kind of procedure isn't lost if it goes unused, it's simply never triggered if nothing prompts it.

The one fact that's easiest to miss

Every layer above, plus auto memory and on-demand procedures, is context the agent reads and tries to follow. None of it is a hard technical block. If two rules disagree, the agent may pick one arbitrarily, and if a rule is buried where the agent doesn't think to look, it can simply go unapplied. Only one category of control actually forces a specific action or blocks one outright, regardless of what the agent decides in the moment.

Advisory: read and interpreted

  • Every layer of instructions above
  • Auto memory
  • Skills or presets

Actually enforced: runs regardless

  • Hooks bound to specific events, before a tool runs, at session start
  • Technical permission settings: what's blocked outright, sandboxing

How this looks in the tools we actually use

The pattern above is shared. The file names, tier count, and precedence rules are not. Here's the concrete mapping for the two agentic coding tools we run in production.

Claude Code

Five layers, loaded and combined every session: an org-managed policy file (enterprise deployment only), a global CLAUDE.md at the user level, a project-level CLAUDE.md plus a .claude/rules/ folder, and a personal, project-local override file not shared with the team. Auto memory and on-demand skills load alongside these as a separate, non-hierarchical pair.

Why this matters in practice

We didn't learn this order from documentation, we learned it from a rule sitting in the wrong layer and quietly not applying to a second project until someone noticed the gap. If something must never happen no matter how it's phrased, it doesn't belong in the advisory layers at all, it belongs in a hook. That's the subject of the next piece in this series.

Try Us First. On Us.

Putting an AI coding agent into real production work?

We'll scope one focused problem, capped at two hours of real work, completely free. If it involves getting an AI agent's instructions actually right, this is exactly the kind of work we do.