fatcheck
Agent instruction files (CLAUDE.md, AGENTS.md, and the rest) only grow. Adding a rule is cheap. Deleting one without knowing why it was there feels unsafe. fatcheck is a weigh-in: count the rules, record the why in a sidecar the agent never loads, and prune only after you pick the cuts.
pip install fatcheck
fatcheck scan
Demo (messy-repo)
Before, on the bundled fixture:
fatcheck scan
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━┓
┃ file ┃ kind ┃ instr ┃ lines ┃ bytes ┃ ~tok ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━┩
│ .cursor/rules/ts.mdc │ cursor │ 1 │ 7 │ 121 │ 30 │
│ .github/copilot-instructions.md│ copilot│ 1 │ 1 │ 47 │ 11 │
│ AGENTS.md │ codex │ 4 │ 6 │ 168 │ 42 │
│ CLAUDE.md │ claude │ 2 │ 15 │ 171 │ 42 │
│ frontend/AGENTS.md │ codex │ 1 │ 1 │ 38 │ 9 │
│ shim/CLAUDE.md [shim] │ claude │ 0 │ 1 │ 11 │ 2 │
└────────────────────────────────┴────────┴───────┴───────┴───────┴──────┘
total instructions: 9
~136 tokens (bytes/4, estimate)
lint flags uncommented rules and a TypeScript line copied into both CLAUDE.md and AGENTS.md. After notes plus prune --apply:
AGENTS.md — falsified on-call rule gone; TypeScript kept (canonical file):
# Agents
- Use TypeScript for all new application code.
- Run tests before every pull request.
- Prefer small pull requests.
CLAUDE.md — duplicate TypeScript line gone; secrets rule kept:
# Team
Never commit API keys or secrets.
Notes live in .fatcheck.yml, not in the prompt.
Install
Python 3.11+.
pip install fatcheck
# or: pipx install fatcheck
# or: uvx fatcheck scan
From a clone, for development:
pip install -e ".[dev]"
Day-one flow
First lint is a wall of missing. Freeze that, then CI only fails on new uncommented rules.
fatcheck scan
fatcheck init --baseline
fatcheck lint # new missing / copies (size is a scan warning)
fatcheck lint --strict # all missing, ignore baseline
fatcheck lint --off missing
fatcheck annotate # numbered why (writes .fatcheck.yml only)
fatcheck prune # numbered diffs, nothing written
fatcheck prune --apply # pick 1,3 or all, then y/N (writes *.bak)
fatcheck prune --apply --only all --yes # scripts; --yes alone will not apply everything
--json and --path work on scan, lint, and prune. lint --sarif fatcheck.sarif writes SARIF 2.1 for GitHub code scanning. Exit 0 when clean, 1 when there are findings. lint never writes .fatcheck.yml (hash rematch is applied by init / annotate).
Hooks (write-time, fail open)
Copy-paste, not a plugin per vendor. If an agent instruction file changed, remind the maintainer to record why.
| Agent | Drop-in |
|---|---|
| Cursor | examples/cursor/hooks.json + after-agent-file.sh / after-agent-file.py → .cursor/hooks.json and .cursor/hooks/ |
| Claude Code | examples/claude/settings.hooks.json + post-tool-use.py → .claude/settings.json hooks + .claude/hooks/ |
| Codex / Copilot / Gemini | examples/AGENTS.fragment.md |
Other repos can pin this project as a pre-commit hook:
- repo: https://github.com/shunvel/fatcheck
rev: v0.2.1
hooks:
- id: fatcheck # copies / noise; does not fail on uncommented rules
- id: fatcheck-new # new missing vs .fatcheck-baseline.yml (run init --baseline first)
Optional .fatcheck.toml in the repo root:
canonical = "agents" # agents | claude | longest
ignore_local = true # skip CLAUDE.local.md
How to read the output
- ~tok —
bytes/4, a rough prompt-size estimate, not a tokenizer. - missing — no note in
.fatcheck.yml(grandfathered per file if listed in.fatcheck-baseline.yml). - noise — a note that is too vague.
- copied_file — two whole files look like copies. Keep the canonical one (
agentsby default). - duplicate — the same rule in two files that are otherwise different.
- size_claude / size_codex — over the published soft limits (200 lines / 32 KB). Shown by
scan, not alintfailure.
prune proposes prune_falsified (your note says the rule did not help; if recurrence >= 1, it says “failed N times”) and prune_duplicate. Safety-marked rules are left alone. Deletes match the current instruction text, so a moved line still gets found.
Files it finds
No config required. Among others: CLAUDE.md, AGENTS.md, .github/copilot-instructions.md, .cursor/rules/, GEMINI.md. It skips README.md, .git, node_modules, vendor, site-packages, .venv, generated, third_party, and paths deeper than 8 directories. CLAUDE.local.md is skipped unless ignore_local = false.
Consumer SARIF workflow: examples/github/sarif.yml. Later versions: bump the version, tag v*, and .github/workflows/publish.yml uploads to PyPI.
Where this idea comes from
Kushal Chakrabarti, Why Does CLAUDE.md Keep Growing? Catastrophic Remembering in Agentic Coding (arXiv:2608.11095). Public GitHub agent files more than tripled over their life; net adds piled up; old rules almost never came out except in a wipe. The paper’s advice is to write what failed, what you tried, and whether it helped. fatcheck is an independent tool. It is not affiliated with the paper’s author.
Today’s coding tools put the whole instruction file into the prompt. fatcheck keeps notes in .fatcheck.yml so the agent never sees them.
Honest limits
fatcheck cannot recover why a two-year-old rule exists. It does not invent a why. It only deletes lines after prune --apply and a pick you confirm. Leave prune off CI.
Tests
pytest
ruff check src tests
Checklist: tests/TEST_MATRIX.md. Fixture: fixtures/messy-repo.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fatcheck-0.2.1.tar.gz.
File metadata
- Download URL: fatcheck-0.2.1.tar.gz
- Upload date:
- Size: 26.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32b39ac006de798877109c2d31ac9f610b6b40f13cdf6d61ba17728a94b1b5ec
|
|
| MD5 |
d95247fd537ec8a331a5af301b3bd584
|
|
| BLAKE2b-256 |
70fcfbec701cc3e77bb7e77cf50beb2c349002c96d881009fe83fb9185380559
|
Provenance
The following attestation bundles were made for fatcheck-0.2.1.tar.gz:
Publisher:
publish.yml on shunvel/fatcheck
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fatcheck-0.2.1.tar.gz -
Subject digest:
32b39ac006de798877109c2d31ac9f610b6b40f13cdf6d61ba17728a94b1b5ec - Sigstore transparency entry: 2475088635
- Sigstore integration time:
-
Permalink:
shunvel/fatcheck@efa48d600076d4490acb0321e56ad915716c6588 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/shunvel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@efa48d600076d4490acb0321e56ad915716c6588 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fatcheck-0.2.1-py3-none-any.whl.
File metadata
- Download URL: fatcheck-0.2.1-py3-none-any.whl
- Upload date:
- Size: 21.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d2d832714847fc724b0579b355ba15123bd7a7492cc1307cc1899d67c6f9191
|
|
| MD5 |
755e9fe7ee39c52b1aed66c5a5d2a1e6
|
|
| BLAKE2b-256 |
cbfc8fe99a1a394efce2bba99953548028104d673abdb800da82259d620d02b2
|
Provenance
The following attestation bundles were made for fatcheck-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on shunvel/fatcheck
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fatcheck-0.2.1-py3-none-any.whl -
Subject digest:
9d2d832714847fc724b0579b355ba15123bd7a7492cc1307cc1899d67c6f9191 - Sigstore transparency entry: 2475088637
- Sigstore integration time:
-
Permalink:
shunvel/fatcheck@efa48d600076d4490acb0321e56ad915716c6588 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/shunvel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@efa48d600076d4490acb0321e56ad915716c6588 -
Trigger Event:
push
-
Statement type: