Skip to content

docs(agents): CLAUDE.md keeps only what no check catches - #2062

Open
oddharsh wants to merge 2 commits into
mainfrom
claude/audit-agent-text-pruning-50086a
Open

oddharsh wants to merge 2 commits into
mainfrom
claude/audit-agent-text-pruning-50086a

Conversation

@oddharsh

@oddharsh oddharsh commented Dec 4, 2026 •

Copy link
Copy Markdown
Owner

What changed

CLAUDE.md drops from 12,236 B to 1,399 B. It keeps the identity line, the gate, and 5 judgment calls no check holds (multi-agent tree hygiene, the Luna look, canary pins on purpose, agent surfaces for readers who show up, the owner's calls). Layout, Commands, Release path, Invariants, Observability and the reading list are gone: each either restated the tree or package.json, or named a rule a contract test, lint or hook already enforces.

Two checks read CLAUDE.md as data. The prerequisite census (tools/check-tools.ts) and the Workers issue routine test now read docs/MAINTENANCE.md, which gains the one sentence naming exif-sooc and cjpeg. A new contract test holds CLAUDE.md to 2,048 B and pins the AGENTS.md symlink.

One rule that was only prose is now a check. bun run photos would encode and upload a file from anywhere on disk; local ingest now refuses any photo (companion JPEGs included) outside the source folder, through photoInputs in tools/photos/photo-inputs.ts. Remote ingest re-renders from a download folder and stays exempt. The folder path lives in one constant that three probes now import.

Why

Every agent session loads CLAUDE.md whole, and it had crept from 9,570 B (early October, after the gotchas moved out) back to 12,236 B. I ran a blinded ablation on 2026-12-04 to see what the text bought.

Two reverted fixes, #2002 (SSRF floor refusing fdic.gov) and #2006 (MCP tools defaulting to read-only), each ran 3 times per condition with Opus on history-free snapshots that differed only in one commit of text: A, the full file plus the conflict-triage skill; B, a 5.3 KB domain-only cut; C, a 301 B stub. Summed medians were 18, 18 and 19 of 20. The pre-registered rule needed a larger set to win by 2, so neither extra layer stayed.

The longer text did change behavior, just not the score. On #2006, 6 of 6 A and B runs appended a gotcha and 3 of 3 A runs added a control, which the merged fix did neither of. 0 of those 6 made a missing readOnlyHint a compile error; 2 of 3 C runs did.

Understanding check

  • Intended model: CLAUDE.md holds what no check can hold. Anything mechanical is a test, lint or hook whose failure message says what to do.
  • Prediction: Agents keep passing the same gates; growing CLAUDE.md past 2,048 B fails validate until the budget is raised in the same diff.
  • Likely misconception or failure mode: Reading the budget as a quality check. It measures size only, so a same-length swap of a judgment line for a restated rule stays green.
  • Evidence: The budget test fails on the old file (12,236 B) and passes on the new one. The fixture test in contract-photo-pipeline-failures failed until its tool list moved to MAINTENANCE.md, so the census now reads the runbook. The source-folder tests fail with the guard removed (2 tests), and a control in tools/lib/controls/photo-source-check-reads-a-prefix.ts plants a startsWith prefix check, which lets a sibling source-old folder through; bun run controls reports it CAUGHT.
  • Remaining uncertainty: Both eval tasks were Worker bug fixes, and t1 sat at ceiling (8 of 8 automated points in all 9 runs). Release, photos, design and conflict text were never exercised, which is why those lines survive as one-liners. The judge (Sonnet 5.5) agreed with itself on 5 of 9 t1 diffs, so the probe results carry the t2 finding, not the judge.

Validation

bun run check:fast passes on the branch head (2,065 tests, 0 fail). pages:check and derive:check are clean. The pre-registration, transcripts, diffs, scores and judge output stay outside the repo; happy to fold the harness in as a bun run command in a separate PR.

Ablation scores, 18 runs: A 18, B 18, C 19 (summed medians of 20)
t1 runs t1 median t2 runs t2 median sum
A, full (21 KB) 9, 10, 9 9 9, 9, 9 9 18
B, domain only (5.3 KB) 9, 10, 9 9 9, 9, 8 9 18
C, stub (0.3 KB) 10, 10, 10 10 10, 9, 9 9 19

Each run scored out of 10: the merged PR's hidden test (3), stress probes (2), typecheck, lint, format and the suite against the same condition's baseline (2), a red-green check on the run's own test (1), and a blinded judge (2). Grader controls: an unchanged base scores 2.5 and 4.5 of the 8 automated points, the merged fixes 8 of 8. No run touched git history past the base, gh or the web. The skill was invoked in 0 of 18 runs, since neither task makes a merge conflict.

CLAUDE.md had grown from 9,570 B in early October to 12,236 B, and every
agent session loads it whole. Most of it restated package.json, the tree,
or rules a contract test, lint or hook already enforces.

A blinded ablation on 2026-12-04 ran 3 Opus sessions per condition on two
reverted fixes (#2002, #2006), on history-free snapshots that differed
only in the text: the full file plus the conflict-triage skill, a 5.3 KB
domain-only cut, and a 301 B stub. Summed medians were 18, 18 and 19 of
20, so under the pre-registered rule (a larger set must win by 2) neither
extra layer earned its place. On #2006, 6 of 6 runs with the longer text
appended a gotcha, and none made a missing readOnlyHint a compile error;
2 of 3 stub runs did.

What stays is the judgment no check holds, one line each. The two checks
that read CLAUDE.md as data (the prerequisite census and the Workers
issue routine) now read docs/MAINTENANCE.md, the runbook they meant.
A byte budget keeps the file from regrowing: it fails on the old 12,236 B
file and passes on the new 1,490 B one.
@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Wire-size diff vs merge base

566440f3d9966e73279ecd78ad21d3f041305eb5 → ce2374911438bbe94a0b7d4cf0d50348c905be45

Brotli q11, the quality the edge serves. Every number here is deterministic:
an unchanged file produces no row. Advisory — this check fails on nothing.

Client assets

No change. 42 files, 203.00 KiB Brotli total.

Pages

No change. 74 files, 902.00 KiB Brotli total.

Worker bundle

No change. 318.71 KiB gzip.

Dictionary transport

Family dictionary acquisition: no change, 16.24 KiB q11.

pd/: no change. 889 deltas, 990.84 KiB total.

Head tags vs merge base

No change. 74 documents, every title, description, canonical, robots, og:*, twitter:*, alternate, JSON-LD type and oracle status identical.

@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

First paint, layout shift and first byte vs merge base

No page serves a different document, so no changed page was read.
0 page(s) serve a different document.

Pages that serve the same document

3 sampled page(s) with identical bytes on both sides read flat, alone and pooled.

page FCP base FCP HEAD change CLS base CLS HEAD change TTFB base TTFB HEAD change
/garage/av2 248 ms 244 ms +4 ms 0.000 0.000 +0.000 10 ms 12 ms +2 ms
/around 244 ms 232 ms -8 ms 0.000 0.000 +0.000 12 ms 10 ms -2 ms
/lwe/dac 248 ms 248 ms -8 ms 0.000 0.000 +0.000 14 ms 13 ms -1 ms
all 3, pooled 248 ms 240 ms +0 ms 0.000 0.000 +0.000 12 ms 12 ms +0 ms
How a change is called moved, and the controls (230 s)

Each change is the median of HEAD minus base over the 9 pairs. It is moved when a sign test puts the split under p 0.05 and the median is at least 16 ms of FCP, 0.005 of CLS or 5 ms of TTFB (tools/lib/paint-diff.ts). TTFB is how long the Worker takes to send a document's headers, timed from Node before each load, since Chrome's emulated latency hides anything under it. Advisory: nothing here fails the PR.

The same-document pages are a slice of the unchanged ones, turned by the HEAD commit so each push reads different ones. Identical bytes make them a placebo: a move there is the runner or the serving path, never the document.

Controls on /__paint-control, HEAD against itself. A planted control must move its own metric; only the unplanted one judges both:

  • nothing planted: FCP -12 ms, CLS +0.000, TTFB -1 ms
  • every stylesheet held 150 ms: FCP +148 ms (moved), CLS +0.000, TTFB +2 ms
  • a 300px block pushed in above the content and each document held 60 ms: FCP +0 ms, CLS +0.026 (moved), TTFB +57 ms (moved)

CLAUDE.md said new photos come from ~/Downloads/to post (from ssd)/ and
nowhere else, and nothing checked it: `bun run photos` would encode and
upload a file from anywhere on disk.

photoInputs takes a sourceRoot and refuses any resolved file, companion
JPEGs included, whose path relative to it climbs out. It compares with
path.relative because a prefix test lets a sibling like source-old pass,
and a control plants that prefix test. Remote ingest re-renders what R2
already holds from a download folder, so only local ingest is held to it.
PHOTO_SOURCE_DIR overrides the folder for the fixtures, the way their
other tool paths are injected.

The folder's path now lives in one constant; three probes that spelled it
out import it. The CLAUDE.md line goes, since the check holds the rule.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
aadhar-sh 185aef3 Commit Preview URL

Branch Preview URL
Dec 04 2026, 10:39 PM

This branch has not been deployed

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

1 participant