Trim derivable content from CLAUDE.md - #165
Open
rdotsch wants to merge 1 commit into
Open
Conversation
Two blocks a session can reconstruct for itself, found by /doctor. 20,855 -> 17,286 chars, about 890 fewer resident tokens in every session. - The devtools/roxygen2 command block (18 lines). roxygenise(), load_all(), test(), check(), install() are the standard R package workflow, inferable from DESCRIPTION plus R/ plus tests/testthat/. Replaced by one line saying the standard workflow applies, so the two non-standard notes that follow it still have a lead-in. - The per-function walkthrough of both pipeline halves and the ASCII data-flow diagram (29 lines). These do not merely duplicate the code, they duplicate README.md -- "How it works" and "Anatomy of the .Rdata file" cover the same pipeline, the same .Rdata contract and the same flow. Replaced by a pointer to those sections, since two copies drift. Every gotcha is kept, and two that lived inside the second block were relocated into "Notes on conventions" rather than deleted: - the generateCI.R scaling pointer, and - the ref_lookup tibble that looks like a cache and has been empty since 2018. That relocation is why the saving is ~890 tokens rather than the ~1,160 the cut regions measured. The ref_lookup note in particular is unrecoverable by reading code -- an empty lookup reads as a cold cache, not as one deliberately emptied when the erratum formula landed. Not migrated to a lazily-loaded skill, though "Releases and versioning" looked like a candidate: it carries traps that bite exactly once, at release time -- "never put a version number in a NEWS.md section heading" cost a real R CMD check NOTE on 2026-07-28 -- and a skill that fails to trigger pays that twice. The file sits at ~43% of the ~40,000-char warning threshold, so there is no pressure justifying the risk. CLAUDE.md is .Rbuildignore'd, so none of this can reach the tarball, and it is on the reproducibility gate's inert allowlist. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01M4j1pEStw2piD1FJXrBfEY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two blocks of
CLAUDE.mdwere content a fresh session can reconstruct on its own, so every session paid for them and got nothing back. 21,396 → 17,827 chars, ~892 est. tokens saved per session.Every gotcha, rationale and convention is kept. Two items that happened to live inside the cut region were relocated rather than deleted (below).
Cut A — the
devtoolscommand block (18 lines)These are the standard invocations for any R package, inferable from
DESCRIPTION+R/+tests/testthat/alone. Replaced by one line saying the usual workflow applies unchanged — which also fixes a lead-in sentence (Typical workflows…:) that would otherwise dangle.Kept: the
generateStimuli2IFC()parallel-worker gotcha (workerslibrary(rcicr)themselves, so the package must be installed, not justload_all()-loaded, or they fail with "there is no package called 'rcicr'") and theChangeLogconvention.Cut B — the architecture walkthrough (29 lines)
The two per-function subsections and the ASCII data-flow diagram. This is not merely derivable from the code — it duplicates
README.md, which covers the same pipeline, the same.Rdatacontract and the same flow in "How it works" (line 64) and "Anatomy of the.Rdatafile" (line 113). Two copies of the same explanation drift, and the copy a reader hits first is then the wrong one.Replaced by a pointer to those two README sections. Verified both headings exist, and that nothing anywhere in the repo cross-referenced the removed subsections or the diagram.
Kept: the section intro (the
.RData-is-the-only-link contract) and all of "Notes on conventions in this codebase".Two items relocated, not deleted
Both sat inside cut B's line range rather than in "Notes on conventions", so a straight deletion would have lost them. They are now bullets under "Notes on conventions":
generateCI.Rscaling pointer — thatnone/constant/matched/independentis a user-facing decision documented at length in the roxygen header, to be read before changing scaling logic.ref_lookuptrap — that it looks like a cache for avoiding resimulation and is not one, having been empty since 2018 because its rows were measured under the pre-erratum infoVal formula and were correctly commented out when01e547eadopted the Euclidean norm.That second one is the reason this PR saves ~892 est. tokens rather than the ~1,156 first estimated. Worth it: a "looks like a cache, isn't" note cannot be recovered by reading the code, which is the whole test for what belongs in this file.
Not proposed
Migrating "Releases and versioning" (38 lines) to a lazily-loaded skill. Its content is correctness traps that fire exactly once, at release time — "never put a version number in a
NEWS.mdsection heading" cost a realR CMD checkNOTE on 2026-07-28 — and a skill that fails to trigger pays that cost twice. At 44% of the ~40,000-char warning threshold there is no pressure justifying the risk.Checked
ref_lookup,pre_0.3.0/generator_version,R/zzz.Rglobals, theparallel-not-futureconvention, the scaling pointer and theChangeLogconvention all survive.0xC0000409Windows-flake note — was re-tested against the same derivability bar and kept. The flake note is a specific observed failure with its resolution; the context list is enumerable viagh apibut records intent, and its surrounding gotcha (the classic branches endpoint reports empty and misleads you) is the non-derivable part. One reservation for later: a list stamped "as of 2026-07-29" is a drift risk, and if it ever goes stale the fix is to keep the endpoint pointer and drop the enumeration rather than re-date it.CLAUDE.mdis.Rbuildignored, so nothing here can reach the built tarball, and the file is on the reproducibility gate's inert allowlist —compareshould post green without doing work.Generated by Claude Code