claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Projects: instructions counter shows 9,736 / 16,000, but the form says 563 over the limit (validator counts ~6,800 more)

Open igor-markin opened this issue 1 month ago • 3 comments

What happens

In Project settings → Instructions, the counter under the field shows 9,736 / 16,000, yet the form says the text is 563 characters over the limit, and the General section shows the banner "Project instructions exceed the 16,000 character limit".

Earlier, with a longer text, the counter showed 12,641 / 16,000 and the form said 3,506 over.

So the check counts about 6,800 more characters than the counter shows:

Counter Reported over Implied count Difference
12,641 3,506 19,506 +6,865
9,736 563 16,563 +6,827

The difference stays almost the same while the text got ~2,900 characters shorter, so it is not a per-character factor. The text is mostly Cyrillic, but it is not a byte count either: the 9,736-character text is 17,384 bytes in UTF-8, not 16,563. The counter matches the text's length in UTF-16 code units.

Other fields in the same project: Goal 387 / 8,000, topic about 330 characters. Neither adds up to the missing ~6,800.

The text is saved: the project coordinator wrote it through its settings tool without an error, and it reads back correctly. The error appears only in the settings form.

Expected

The counter and the limit check use the same measure. If something else counts toward the 16,000 limit, the counter includes it, or the form says what it is.

Questions

  1. What exactly does the 16,000 limit count, and where do the extra ~6,800 characters come from?
  2. While the form shows this error, do the coordinator and threads receive the full instructions, or are they cut?

Environment

Claude Code Projects on claude.ai, October 30, 2026. Screenshots available on request.

Related: #101398 (instructions cut at 8,192 bytes in threads run on the computer).


Generated by Claude Code

igor-markin avatar Oct 30 '26 08:10 igor-markin

Correction: the field is under Project settings → Memory → Project instructions, not "Project settings → Instructions" as written above.

Update: after shortening the text to 8,828 / 16,000, the error and the General banner are gone. This fits the same offset: 8,828 + ~6,830–6,865 ≈ 15,660–15,690, which is under 16,000. So the text now fits only because it was cut; the counter still does not show what the check measures.


Generated by Claude Code

igor-markin avatar Oct 30 '26 08:10 igor-markin

Update: found the cause, and it corrects my analysis above, where I wrote that it is "not a byte count either". This answers question 1.

The problem shows up because my instructions are in Russian. Besides the 16,000-character limit, the form checks the text against 16,384 bytes of UTF-8. When the byte limit is the one exceeded, the form still says "N characters over the 16,000 limit", and the banner still says "exceed the 16,000 character limit". N is the number of characters to cut from the end to get under 16,384 bytes. So the UI talks about characters, but for non-Latin text the real limit is bytes.

This fits all the numbers here:

  • 9,736 characters = 17,384 bytes, which is 1,000 bytes over 16,384. At ~1.78 bytes per character for this mostly Cyrillic text, that is the 563 characters the form asked me to cut.
  • After cutting to 8,828 characters, the text fit under 16,384 bytes and the error went away.
  • An English version of 10,179 characters (10,386 bytes) saves with no error.

Cyrillic letters take 2 bytes each in UTF-8, so a Russian text hits the limit at about 8,200 to 9,000 characters, while the counter shows a little over half of 16,000. Following the rule above, a minimal case should look like this (I have not re-run this exact case):

"a" x 16,000 -> 16,000 bytes -> accepted "я" x 8,192 -> 16,384 bytes -> accepted (counter: 8,192 / 16,000) "я" x 8,193 -> 16,386 bytes -> "1 character over the 16,000 limit"

Expected: the counter and the messages use the same unit as the check. Either show bytes and say "16,384 bytes", or raise the byte limit so that 16,000 characters fit in any script.

igor-markin avatar Nov 17 '26 10:11 igor-markin

This has been fixed, so we're closing this issue. If you disagree, let us know here and we can re-open it. Thanks for reporting!

bpasero-ant avatar Nov 29 '26 18:11 bpasero-ant