feat(cml): context-window-scaled CLAUDE.md char budget (mirrors CC 40.0k warning)
Add a char-based CML finding that mirrors Claude Code's own startup warning
("Large CLAUDE.md will impact performance (X chars > 40.0k)"). CC 2.1.169 scales
that threshold with the model's context window, so the finding anchors on the
conservative 200k window (we cannot observe the user's window; the anchor fires
earliest) and discloses the relaxed ~200,000-char figure at 1M context. MEDIUM
severity (token cost, not an adherence cliff — consistent with the v5.2.0 reframe).
Keyed on chars, not lines, so it is complementary to the existing 200/500-line
checks (which stay untouched): a file can be long by lines yet under budget (short
lines, e.g. large-cascade at 37k chars / 1024 lines), or short by lines yet over it.
Extract the shared 200k/1M context-window constants to scanners/lib/context-window.mjs
(single source of truth; skill-listing-budget.mjs now imports + re-exports them).
40.0k figure and context-window scaling verified against the CC changelog (2.1.169,
2026-06-08) and the live startup-warning text. +6 tests, new fixture large-claude-chars
(48,531 chars / 100 lines). Suite 918/918, self-audit PASS configGrade A 97.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ter3E2JSi1Khgmuf2kady8
This commit is contained in:
parent
03949c6c98
commit
b0bf8c5817
7 changed files with 253 additions and 8 deletions
22
CLAUDE.md
22
CLAUDE.md
|
|
@ -109,7 +109,27 @@ Default: auto-detects scope from git context. Override with `/config-audit full|
|
|||
node --test 'tests/**/*.test.mjs'
|
||||
```
|
||||
|
||||
912 tests across 56 test files (17 lib + 29 scanner + 1 hook + 1 agent + 3 commands + 1 knowledge + 4 top-level). Test fixtures in `tests/fixtures/`. Top-level humanizer tests: `json-backcompat.test.mjs`, `raw-backcompat.test.mjs`, `scenario-read-test.test.mjs`, `snapshot-default-output.test.mjs`.
|
||||
918 tests across 56 test files (17 lib + 29 scanner + 1 hook + 1 agent + 3 commands + 1 knowledge + 4 top-level). Test fixtures in `tests/fixtures/`. Top-level humanizer tests: `json-backcompat.test.mjs`, `raw-backcompat.test.mjs`, `scenario-read-test.test.mjs`, `snapshot-default-output.test.mjs`.
|
||||
|
||||
### CML scanner — context-window-scaled char budget
|
||||
|
||||
Beyond the line-count checks (200/500 lines, both MEDIUM), the CML scanner mirrors
|
||||
Claude Code's own startup warning — *"Large CLAUDE.md will impact performance
|
||||
(X chars > 40.0k)"* — as a `char`-based finding:
|
||||
|
||||
- **Char budget** — flags a CLAUDE.md over **~40.0k chars** (CC's startup-warning
|
||||
figure at a 200k-context model). CC 2.1.169 scales that threshold with the model's
|
||||
context window, so the finding anchors on the conservative 200k window (we cannot
|
||||
observe the user's window; the anchor fires earliest) and discloses the relaxed
|
||||
~200,000-char figure at 1M context. Severity MEDIUM (token cost, not an adherence
|
||||
cliff). New `CA-CML` finding.
|
||||
|
||||
It keys on chars, not lines, so it is complementary to the line checks: a file can be
|
||||
long by lines yet under budget (short lines), or short by lines yet over it (long lines).
|
||||
The 200k/1M window constants live in the shared `scanners/lib/context-window.mjs`
|
||||
(single source of truth, also re-exported by `skill-listing-budget.mjs`). The 40.0k
|
||||
figure and context-window scaling are verified against the CC changelog (2.1.169) and
|
||||
the live startup-warning text.
|
||||
|
||||
### DIS scanner — permission-rule hygiene
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue