# Claude Code Ignoring CLAUDE.md? See What's in Its Context

> Source: <https://dev.to/reporails/claude-code-ignoring-claudemd-see-whats-in-its-context-3j8m>
> Published: 2026-11-05 17:44:23+00:00

When Claude Code ignores a rule, the usual move is to reword it. Start with the verb, use backticks for literals, bold segments that you want to maintain elevated focus over the surrounding prose, and so on. Before doing any of that, there is a cheaper, and apparently a widespread, question to answer: was the rule in the agent's context at all?

Those are two different failures. A rule that loaded and was still not followed is a wording or enforcement problem. A rule that never loaded is a plumbing problem, and no amount of rewording fixes it. Often it is the first kind: the file loads, the agent can quote it back, and it still drifts. Telling the two apart decides which fix you need.

So I opened an old project in Claude Code and looked at what actually reached the agent.

[SageCompass](https://github.com/cleverhoods/sagecompass) is my LangGraph project from last winter. I wrote its instruction files by hand, before Reporails existed, and the last commit is from January 21, 2026. Nobody tuned it for this.

Here is what it carries, outside the Drupal core folder:

| What | Count | How it reaches the agent | 
|---|---|---|
| `CLAUDE.md` files | 25 | The ones in and above the start folder load at launch; a nested one loads when the agent works in its folder | 
| `AGENTS.md` files | 11 | Read by Codex, Copilot and Cursor; Claude Code skips all 11 because a `CLAUDE.md` sits at the root (`ails expected-loads` ) | 
| Rule files in `langgraph/.shared/rules/` | 17, plus `INDEX.md` | Nothing loads them automatically; `CLAUDE.md` lines point at them | 

Every folder under `langgraph/app/` has its own `CLAUDE.md`. The one in `app/graphs/` opens like this:

```
# Local scope: app/graphs

This file is the **primary** instruction surface when editing `app/graphs/**`.
```

Yesterday I opened Claude Code 2.1.311 in `sagecompass/langgraph` for the first time in ten months and asked it to look around: "let's take a look around in the project, we haven't opened it for 10 months". It read the system map, walked the graph code, ran the quality gates and the tests, and reported that everything still passes. Then I asked about an error I kept seeing at the end of each turn, and it fixed that too.

18 shell commands over two prompts. Then I opened the session:

```
npx @reporails/cli xray
```

`ails xray` serves a page on `127.0.0.1` and reads the session transcript Claude Code already keeps under `~/.claude/projects/`. The Graph tab puts the agent on a timeline, with every instruction file, rule, skill, memory file and MCP server on the left at the moment it first loaded.

Two instruction files loaded, both at launch: the root `CLAUDE.md` and `langgraph/CLAUDE.md`. No other instruction file entered the agent's context for the rest of the session. Peak context was 65k tokens. The two files were about 2.3k of it (~771 for the root file, ~1.5k for `langgraph/CLAUDE.md`); tool calls and results were ~22k, tool definitions ~14k.

The Sources list shows what the session could have loaded and what happened to each item: loaded, listed but never loaded, on disk but never loaded, or not recorded in this session.

For this session the Sources list counts 11 instruction files a session in `langgraph/` can load. Two loaded. The other nine, one for each folder under `app/` plus `tests/`, read `not loaded`.

One of the nine is `app/graphs/CLAUDE.md`, the self-declared primary instructions for the folder whose code the agent read. At 0:13 it ran `sed -n 1,200p app/graphs/graph.py`. Every read in the session went through the shell, and `app/graphs/CLAUDE.md` never loaded.

Had the agent gone on to edit `graph.py` the same way, it would have worked without the file that says how graph modules should be written. That file needed a loading fix before any wording fix.

Click that call in the Tool calls tab and the page shows what the agent had at that moment: 40k tokens of context, and two instruction files, the root `CLAUDE.md` and `langgraph/CLAUDE.md`.

`CLAUDE.md` depends on how the agent reaches that folder; in this session it never loaded. A rule that has to hold on every change belongs in a file that loads at launch, or behind a hook that checks it.`langgraph/CLAUDE.md` line 128 says `See .shared/rules/testing.md`. That file was split into five `testing-*.md` files months ago, and the pointer kept the old name. A broken pointer fails quietly; the agent's only signal is a failed read.
The x-ray reads Claude Code sessions. SageCompass's 11 `AGENTS.md` files are read by Codex, Copilot and Cursor; the x-ray does not show those agents' sessions. On a Team or Enterprise machine it reads the settings your organization sets in the claude.ai admin console, so it shows the context that policy produced.

It runs locally. The page serves on `127.0.0.1` and reads session files already on your machine. The Check and Fix buttons are the only part that reaches the Reporails server.

Run it in the folder you started Claude Code in:

```
npx @reporails/cli xray
```

*With the Reporails plugin installed, ask the agent for `/reporails:ails xray` and it opens the session you are in. The [Reporails CLI](https://github.com/reporails/cli) shows what your agent actually had in context, and `ails check` scores the instruction files that put it there.*
