Skip to content

Trim derivable content from CLAUDE.md - #165

Open
rdotsch wants to merge 1 commit into
mainfrom
claude/current-status-pp11cy
Open

Trim derivable content from CLAUDE.md#165
rdotsch wants to merge 1 commit into
mainfrom
claude/current-status-pp11cy

Conversation

@rdotsch

@rdotsch rdotsch commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Two blocks of CLAUDE.md were 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 devtools command block (18 lines)

roxygen2::roxygenise()
devtools::load_all()
devtools::test()
devtools::check()
devtools::install()

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 (workers library(rcicr) themselves, so the package must be installed, not just load_all()-loaded, or they fail with "there is no package called 'rcicr'") and the ChangeLog convention.

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 .Rdata contract and the same flow in "How it works" (line 64) and "Anatomy of the .Rdata file" (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":

  • The generateCI.R scaling pointer — that none/constant/matched/independent is a user-facing decision documented at length in the roxygen header, to be read before changing scaling logic.
  • The ref_lookup trap — 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 when 01e547e adopted 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.md section heading" cost a real R CMD check NOTE 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

  • Every remaining section is gotchas, rationale or repo etiquette. Spot-verified after the rebase that the parallel-worker failure, ref_lookup, pre_0.3.0/generator_version, R/zzz.R globals, the parallel-not-future convention, the scaling pointer and the ChangeLog convention all survive.
  • The content Write down the code conventions, and log tidyverse style as a v2 item #156 added to this file — the five required-status-check contexts and the 0xC0000409 Windows-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 via gh api but 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.md is .Rbuildignored, so nothing here can reach the built tarball, and the file is on the reproducibility gate's inert allowlist — compare should post green without doing work.

Generated by Claude Code

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
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.

2 participants