← RuleReceipt
guide

Check if Claude Code followed CLAUDE.md

You wrote rules in CLAUDE.md. The session ran, a lot happened, and now you’re not sure the agent actually followed them. Here’s how to check — by hand first, then with one command.

The problem

“It said it was done. Did it do what I told it to?”

A CLAUDE.md (or AGENTS.md) file is a set of standing instructions: don’t push to main without asking, always run the tests, update the changelog, never commit a secret. The agent reads them, but nothing automatically confirms afterwards that each one was honoured.

Most of the time you find out the slow way — a surprise commit on main, a “tests pass” that wasn’t true, a changelog that never got the entry. The transcript has the answer; it’s just buried in thousands of lines of JSON.

How to check by hand

Everything you need is in the session transcript on your own disk.

Claude Code writes every session to a JSON Lines file — one JSON object per line — here:

~/.claude/projects/<your-project-path>/<session-id>.jsonl

The project folder is your working directory with every / turned into -. The newest .jsonl in it is your last session. (Codex: ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl.)

To check a rule by hand, open that file and read it against what you wrote down. For “never push to main without asking,” for example:

  1. Find the tool calls: lines with "type":"tool_use" and "name":"Bash". Look at each command for git push.
  2. For any push to main, scroll back and read the user messages before it — did you actually approve it, or did the agent decide on its own?
  3. For “always run the tests,” search the same tool calls for your test command, and check it ran before any “tests pass” claim in the assistant text.

This works. It’s also slow, and it’s easy to miss the one line that matters in a long session — which is the whole reason the tool below exists.

How RuleReceipt does it

One command, rule by rule, with the quoted line as evidence.

RuleReceipt reads the same transcript and goes through your CLAUDE.md / AGENTS.md one rule at a time. It runs locally — the transcript never leaves your machine — and needs no setup:

$ npx rulereceipt@latest check

RuleReceipt · 51 rules checked
────────────────────────────────────────

Not followed (2)
✕ FAIL    Rule 1 — Never push to `main`
  evidence: a git command actually targeted the "main" branch: git push origin main
✕ FAIL    Rule 2 — Evidence or it didn't happen
  evidence: the session stated "All tests pass ✅" but the last test run
  before it, `npm test`, reported "1 failed"

Sample output. Each finding names the rule, the verdict, and the exact line from the session it’s based on.

What it does — and what it doesn’t

Every rule comes back as followed, not followed, didn’t apply, or can’t tell — each with the quoted evidence, so you can judge it yourself rather than trust a label.

Being honest about the ceiling: this is detection and reporting, after the session. It does not make the model obey, and it can’t un-run a command. There is one narrow exception — an optional guard hook that blocks a small, specific set of file and branch actions before they run. That’s a deliberately limited guard, not general enforcement.

If a verdict is wrong, rulereceipt wrong <rule> builds a pre-filled, secret-masked report so the check itself can be corrected.

RuleReceipt is a free, source-available CLI that checks Claude Code sessions. It also reads AGENTS.md, and the rules files used by Cursor, Copilot and Windsurf. Run it with npx rulereceipt@latest check — no account, no upload.

related