Skip to content

CLAUDE.md: keep core rules, move feature notes to docs/claude/ area files (#1903) - #1907

Merged
yeroo merged 5 commits into
mainfrom
issue-1903-claude-md-is-over-claude-code-s
Nov 5, 2026
Merged

yeroo merged 5 commits into
mainfrom
issue-1903-claude-md-is-over-claude-code-s

Conversation

@yeroo

@yeroo yeroo commented Nov 5, 2026

Copy link
Copy Markdown
Owner

CLAUDE.md was 178,494 characters, over Claude Code's 150,000-character limit for a memory file, so part of the project's instructions could miss the agents. It now keeps only what every session needs (14,838 characters), and the per-feature notes live in area files under docs/claude/.

Closes #1903

What changed

  • CLAUDE.md: the rule at the top (a feature's notes go into its area file, never a new section here; 40,000-character budget; CI check), then How work is done, an Area notes index (one bullet per area file: when to read it, the topics and issue numbers, so a grep for an issue number lands on the right file), a short Build and test (only commands from ci.yml), Cross-crate invariants (restated from the area notes, each naming its file), and the kept sections verbatim: DOCX Bidi Rendering, Text input (dead keys, IME), Build info, Dialogs and typed input (Tests: type into every editable input (all dialog fields, formula bar, Name Box, Find, ribbon combos, Backstage fields) with real keys; a catalogue so none is missed #1029).
  • docs/claude/: 21 area files holding the other 74 sections, moved verbatim by script in their original order: docx-editing, suite-document, pdf-export, html-import, clipboard, macos, suite-shell, suite-extensions, ribbon, help, ui-plugins, project-formats, project-text-styles, project-gantt, project-table, project-task-info, project-scheduling, sheet-ui, sheet-file, terminal-editors, mail. Each opens with a header saying what it covers, that it is not loaded automatically, and that paths are from the repository root.
  • scripts/check-claude-md.py (stdlib only) fails when CLAUDE.md exceeds 40,000 characters, an area file has no bullet of its own in the Area notes index, CLAUDE.md names an area file that does not exist, a ## heading appears twice across the files, or CLAUDE.md has a ## section not in its KEPT list. That last check stops a branch written against the old CLAUDE.md from adding a feature section back. --moved-from [REV] (default: the merge base with origin/main) proves the move.
  • CI: the test job runs the check right after checkout (Linux leg). The new unit tests run in the sweeps' existing unittest discover -s scripts step.

The one edit inside moved text: #1374's "(#1378, below)" is now "(#1378, above)" (it already was above in the old file). Other "below"/"under" references stay in the same file, in order.

Tests

  • python3 -m unittest discover -s scripts -p 'test_check_claude_md.py' -v: 22 tests OK (budget in characters, not bytes; padded file fails; unindexed, cross-pointer-only and missing area files; duplicate headings; fenced code; KEPT; --moved-from cases). The whole scripts set: 69 tests OK.
  • python3 scripts/check-claude-md.py → CLAUDE.md: 14838 / 40000 characters, 21 area files in docs/claude/; on the old CLAUDE.md it fails (budget, 74 unlisted sections, missing kept sections).
  • python3 scripts/check-claude-md.py --moved-from (merge base):
CLAUDE.md: 14838 / 40000 characters, 21 area files in docs/claude/
--moved-from 7e4e9a9590be9b3b49c27425b67b77621b97d2e0: 79 old sections
new       ## Area notes
new       ## Build and test
new       ## Cross-crate invariants
79 of 79 old sections found exactly once; 1 body diff(s)
--- CLAUDE.md (old): ## yppxy terminal prompt edits at a caret (#1374)
+++ docs/claude/terminal-editors.md: ## yppxy terminal prompt edits at a caret (#1374)
@@ -8,5 +8,5 @@
   commits the whole text wherever the caret is. The edits clamp the caret, as
   tests assign `buf` directly. The drawn `▏` sits at the caret and `field-read
   yppxy-prompt` reports it. Ctrl+A selects the buffer (#1376; typing and the
-  edit keys replace or collapse it). Copy/paste is there (#1378, below);
+  edit keys replace or collapse it). Copy/paste is there (#1378, above);
   click-to-place is not; Backstage Save As's name field is separate.

No Rust is touched.

Review

  • Plan agreed at v2 after one critique round (added the KEPT allowlist, Cross-crate invariants, kept the dialogs section, --moved-from against the merge base).
  • revmux round 1 (claude-only, 4 reviewers, none degraded): 2 Minor, both fixed: the sheet-file index bullet misdescribed suite: sheet notes do not move with row/column insert or delete #1335/Data Validation dialog: show Excel 2010 (x14) validations #1817 (every bullet was then re-checked against its file's sections, nine widened); the index check accepted an area file named anywhere in CLAUDE.md (now only its own Area notes bullet counts; 3 tests).
  • review stopped: round 1 had no Major; all findings fixed

🤖 Generated with Claude Code

yeroo added 5 commits November 5, 2026 13:16
CLAUDE.md was 178k characters, over Claude Code's 150k memory-file limit,
so part of the project's instructions never reached the agents. It now
holds only what every session needs: how work is done, an index of area
files, build and test commands from ci.yml, the cross-crate invariants
restated from the moved notes, and the cross-cutting DOCX Bidi, Text input,
Build info and Dialogs sections (verbatim). The other 74 sections moved
verbatim, by script, in their original order, into 21 area files under
docs/claude/. The one body edit is in #1374: "(#1378, below)" was already
wrong (that section came before it), now "above".
Fails when CLAUDE.md is over 40,000 characters, when an area file under
docs/claude/ is not in its index or the index names a missing one, when a
## heading lives in two places, or when CLAUDE.md has a section outside
KEPT, so a feature's new notes cannot go back into CLAUDE.md unnoticed.
--moved-from [REV] compares with CLAUDE.md at REV (default: the merge base
with origin/main): every old section found exactly once, body diffs shown.
The unit tests run in the sweeps' existing "Sweep runner unit tests" step.
Linux leg only, right after checkout, so a docs failure shows before the
Rust toolchain is installed.
The sheet-file bullet and intro read "load and save" of notes and x14
validation, but #1335 is notes following row/column insert and delete and
#1817 is the Data Validation dialog, so a session changing those would not
see the bullet applies. Reread every bullet against its file's sections and
named the other topics missed: Undo of a table step, the theme command, the
suite as a library, the formatting model, Marked/Highlight/changed cells,
zoom and its dialogs, Editor sort and filters, MSPDI/.mpp dates,
backstagecore's Save As name, settings.xml and the H&F topics.
Check 2 took any mention of docs/claude/<name>.md anywhere in CLAUDE.md, so
a file named under Cross-crate invariants or as a cross-pointer inside
another bullet passed with its own index entry deleted. It now counts only
bullets of the Area notes section that start with the path, and says so
when that section is missing. Check 3 still scans the whole file.
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@yeroo
yeroo merged commit 3ae1d20 into main Nov 5, 2026
14 checks passed
@yeroo
yeroo deleted the issue-1903-claude-md-is-over-claude-code-s branch November 5, 2026 10:09
@yeroo

yeroo commented Nov 5, 2026

Copy link
Copy Markdown
Owner Author

Merged automatically (auto-merge is on for this checkout): review stopped: round 1 had no Major; all findings fixed; merge rounds: none; whole suite green on 5d9560e (check-claude-md.py + 69 script unit tests; no Rust touched, CI 14/14 green); merge-check ok.

Follow-ups: none (no finding deferred).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLAUDE.md is over Claude Code's 150k-char limit: keep core rules there, move feature notes to docs/claude/ area files

2 participants