◉CLAUDE LABJP
●2.1.312 — Fixes Claude overwriting very large CLAUDE.md files and skills going missing after a Bash cd●2.1.307 — Fixes MCP failing to reconnect after sleep or a keychain lock (10/21). 2.1.306 also fixed the false claude -p login message●SONNET 4.5 — Retires on the Claude API on 11/30, 32 days left. Migrate to Sonnet 5.5●WINDOWS — Reports say hooks break silently only on Japanese-locale Windows; check the character encoding first●API — In API version 2026-10-21, passing temperature, top_p or top_k returns a 400 error●NEW — I Put a Ten-Line Promise File at the To…●2.1.312 — Fixes Claude overwriting very large CLAUDE.md files and skills going missing after a Bash cd●2.1.307 — Fixes MCP failing to reconnect after sleep or a keychain lock (10/21). 2.1.306 also fixed the false claude -p login message●SONNET 4.5 — Retires on the Claude API on 11/30, 32 days left. Migrate to Sonnet 5.5●WINDOWS — Reports say hooks break silently only on Japanese-locale Windows; check the character encoding first●API — In API version 2026-10-21, passing temperature, top_p or top_k returns a 400 error●NEW — I Put a Ten-Line Promise File at the To…
Articles/Cowork
◈ Cowork/2026-10-29Intermediate

When Only the Back Half of a Subfolder CLAUDE.md Is Ignored, Count Characters, Not Bytes

Since Claude Code 2.1.309, a subfolder CLAUDE.md and path-scoped rules have a character limit, and anything past it is not handed over. This note covers a counting trap I hit on my own files, a scan script, a pre-commit guard, and how to split a file into rules.

Claude Code277CLAUDE.md7rulesCharacter Countpre-commitCowork59Python27

✦ Premium Article

I wanted to know whether the CLAUDE.md where I keep my operating rules was being read to the end. The trigger was one line in the Claude Code 2.1.309 changelog: a subfolder CLAUDE.md over the size limit now loads only its start.

I ran ls -l first. It said 16,048. That is well under the 40,000 limit, but not by an enormous margin, and the number alone could not tell me whether I had room to spare.

Here is the conclusion up front. The limit is in characters, not bytes, and for files that are mostly Japanese the number ls gives you cannot be used as it is. Counting again gave 9,000 characters, which left plenty of room.

The limit applies to subfolder files and path-scoped rules

The memory page in the official docs has a troubleshooting section for "Claude ignores the end of my subdirectory CLAUDE.md". It makes three points.

First, which files are covered. A CLAUDE.md or CLAUDE.local.md in a subdirectory of where you started Claude Code, files they pull in with @path, rules in a subdirectory's .claude/rules/, and rules with paths: frontmatter. These are the files that load on demand.

Second, the numbers. With a 200K context window the limit is 40,000 characters. With a 1M window it is 200,000 characters on Opus 4.6 and Sonnet 4.6, and 150,000 on later models.

Third, what happens past the limit. Claude receives only the start of the file, followed by a note telling it to read the rest with the Read tool. Unless Claude chooses to go and read it, the later instructions are not in its context.

FileWhen it loadsThis limit
CLAUDE.md at the launch directoryAlways, at session startDoes not apply (a warning past 200 lines)
CLAUDE.md in a subfolderWhen you work with files thereApplies
Rules with paths:When a matching file is in playApplies
Rules without paths: (directly under .claude/rules/)Always, at session startDoes not apply

What surprised me is that the file most likely to be the longest, the top-level CLAUDE.md, is not covered by this limit at all. What gets cut is the subfolder file you added later. The docs also note that before 2.1.309 this limit was not applied to on-demand files.

Bytes and characters differ by 1.5 to 1.8 times in Japanese

ls -l and wc -c return bytes. In UTF-8, one Japanese character takes three bytes. Here is what I measured on my own files.

CommandCLAUDE.mdCLAUDE_REFERENCE.md
wc -c (bytes)16,04821,387
wc -m (UTF-8 locale)9,00014,183
LC_ALL=C wc -m16,04821,387

The third row is the point of this note. Under the C locale, wc -m returns bytes, not characters. The official procedure says to count with wc -m, but cron jobs and scheduled runs sometimes have LANG set to C. Counting there makes a Japanese file look 1.5 to 1.8 times larger than it is.

The mistake that hurts runs in that direction: you believe a file is over the limit and trim one that still had room.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦You can scan a project's CLAUDE.md and rules files with one command and find the ones whose back half may not be loaded, before you spend an afternoon hunting for why an instruction is ignored
✦You can avoid the trap where wc -m silently returns bytes under some locales, and compare Japanese or other multibyte files with the limit using real character counts
✦You can put a guard in front of commits that stops a file from growing past the limit, and decide how to split it using a procedure you can apply to your own setup
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

◈ Cowork2026-10-26
I Linted 36 Unattended-Run Prompts: All 7 'Use This Tool' Hits Turned Out to Be Bans
One permission dialog is enough to stall an unattended task, because nobody is there to click it. This note covers a lint script that counts prompt lines that tell the task to use such a tool, why a banned-word grep gave seven false alarms, and how matching on word stems fixed it.
◈ Cowork2026-10-25
The Build Stopped on 'Duplicate Resources' — 80+ Conflicted Copies Came From Build Output in a Synced Folder
An Android project inside Dropbox stopped building with a duplicate-resource error. This note covers a scan script that counts the conflicted copies, a pre-build guard that cleans only generated files, and how to exclude folders from sync.
◈ Cowork2026-10-22
Half My Scheduled-Task Logs Were Unreadable, So I Added One Mark Line Instead of Widening the Regex
Only about half of 1,076 daily log entries yielded a result. Widening the regex recovered 35 and raised false alarms, so I wrote a fixed one-line mark per run and a morning check script.