Find stale references in CLAUDE.md, AGENTS.md, .cursorrules and READMEs: file paths, npm/make/just/task scripts, python -m modules and env vars that no longer exist in the repo.
pip install amagi-staleref Copy PIP instructions
Find the lines in CLAUDE.md, AGENTS.md, .cursorrules and README files that point at files, scripts and commands your repo no longer has.
Instruction files rot without anyone noticing. A folder gets renamed or a make target gets dropped, the docs still say to use it, and your coding agent spends a turn running a command that fails. amagi-staleref reads those files and checks every reference in them against the repo:
Each stale reference comes out with its file, line number and, when it can find one, the likely new location. Run it by hand, as a pre-commit hook, or in CI. It reads files and nothing else: no network, no LLM calls, no API keys.
We ran it on shallow clones of 10 open-source repos that ship agent instruction files: codex, gemini-cli, langchain, litellm, openai-agents-python, opencode, playwright-mcp, pydantic-ai, the MCP Python SDK and ruff.
pipx install amagi-staleref Python 3.9 or newer. No dependencies on Python 3.11 and up; older versions pull in tomli to read pyproject.toml.
amagi-staleref [PATH ...] [--root DIR] [--format text|json|github] [--fail-on error|warning|info|never] [--no-readme] [--include GLOB] [--exclude GLOB] [--ignore IDS] [--select IDS] [--enable IDS] [--quiet] [--list-rules] With no PATH it scans the current folder. A PATH can be a repo folder, or one or more files; files are resolved against --root (default: the current folder).
It reads these files, wherever they sit in the repo:
This is the real output on the demo fixture in this repo (tests/fixtures/demo_repo):
$ amagi-staleref .cursorrules 1 error SR001 'src/components/' does not exist 1 warning SR003 glob 'src/**/*.tsx' matches no files AGENTS.md 3 warning SR012 yarn script 'typecheck' is not a script, built-in or installed package in package.json; scripts: build, dev, lint, test 8 warning SR050 cd 'frontend': no such folder CLAUDE.md 4 error SR004 @-import 'docs/runbook.md' does not exist 9 error SR010 npm script 'lint:fix' is not a script in package.json; did you mean 'lint'? 11 error SR020 make target 'migrate' is not defined in Makefile 12 error SR022 just recipe 'deploy' is not defined in justfile 13 error SR030 python -m app.worker: no src/app/worker.py or src/app/worker/ in the repo 17 error SR001 'scripts/backfill.py' does not exist 22 error SR001 'src/app/routes.py' does not exist; a file with that name is at src/app/api/routes.py 23 warning SR040 env var CACHE_URL is not mentioned anywhere else in the repo Checked 19 references in 3 files. 12 stale: 8 errors, 4 warnings. Options Option What it does --format text (default), json, or github for Actions annotations --fail-on Lowest severity that sets exit code 1: error, warning (default), info, never --no-readme Check agent instruction files only --include GLOB Also check files matching GLOB, e.g. --include 'docs/**/*.md' (repeatable) --exclude GLOB Skip files matching GLOB (repeatable) --ignore IDS Skip rules, e.g. --ignore SR040,SR003 --select IDS Run only these rules --enable IDS Turn on rules that are off by default (SR002) --root DIR Repo root for resolving references when you pass files --quiet Print nothing when nothing is stale --list-rules Print every rule and exit Exit codes: 0 nothing at or above --fail-on, 1 stale references found, 2 usage error or no instruction files found.
Some docs name a path that does not exist yet, such as a file the reader creates in step 2. End that line with a comment:
Create `config/local.yml` with your settings. A comment on a line of its own skips the next line. To turn rules off for a whole file, put anywhere in it.
[tool.amagi-staleref] exclude = ["tests/fixtures/**"] ignore = ["SR040"] fail-on = "error" Or use the same keys at the top level of .amagi-staleref.toml. Keys: include, exclude, ignore, select, enable, readme (true or false) and fail-on.
Instruction files are full of paths that are not meant to exist in your repo. It skips:
Path checks follow the folder a code block has cd'd into, and they resolve relative links from the file that contains them. Existence checks are case-exact, even on Windows and macOS, so makefile does not match Makefile. Env var checks count any other mention in the repo, including .env.example and other templates, and never read your real .env.
repos: - repo: https://github.com/amagilabs/amagi-staleref rev: v0.1.0 hooks: - id: amagi-staleref The hook scans the whole repo on every commit, because renaming a source file can break a doc you never touched.
GitHub Actions runners ship with pipx. --format github turns each finding into an annotation on the pull request:
- uses: actions/checkout@v4 - run: pipx install amagi-staleref - run: amagi-staleref --format github Lines look like this:
::error file=.cursorrules,line=1,title=SR001 path-missing::'src/components/' does not exist Use --fail-on error to let warnings through, or --format json for anything else that reads results.
The repo includes a SKILL.md. Copy it into your skills folder:
mkdir -p ~/.claude/skills/amagi-staleref cp SKILL.md ~/.claude/skills/amagi-staleref/SKILL.md Then ask Claude to check your CLAUDE.md for stale references, or to find the docs that still point at a file you just moved. It runs amagi-staleref and fixes what it finds.
If amagi-staleref caught a doc that was sending your agent the wrong way, star the repo so other people can find it.
Author: AmagiLabs (Amagisolutionsgroup, Inc.)
claude-code agents-md claude-md cursor codex linter documentation pre-commit cli
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
None of the files in this release were uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.




