Offline heuristic checks for stale repository instructions
pip install instruction-drift Copy PIP instructions
An offline, deterministic, stdlib-only Python CLI that checks concrete instruction claims against repository files. A finding means check this claim. It does not establish that an instruction is wrong. No daemon, LLM, network, or keys.
Requires Python 3.9+. Install a locally built wheel with pip install /path/to/instruction_drift-0.1.0-py3-none-any.whl.
instruction-drift audit . instruction-drift audit examples/sample-repo --json instruction-drift audit . --files AGENTS.md CONTRIBUTING.md --ignore 'docs/*' instruction-drift audit . --fail-on medium instruction-drift --version instruction-drift --help The repository defaults to the current directory. Default instruction files, in order, are root AGENTS.md, CLAUDE.md, MUSE.md, and CONTRIBUTING.md. Missing default files are skipped; an empty repository passes with a note. --files replaces that list with paths relative to the repository. Missing explicitly requested files, unreadable files, and invalid UTF-8 produce parse errors. --files and --ignore accept multiple arguments and can be repeated.
The report includes files read, file:line locations, kinds, claims, severities, details, totals by kind and severity, ignored count, parse-error count, and a PASS/WARN/FAIL verdict. --json exposes the same information as valid JSON. Claims matching --ignore glob patterns are excluded and counted before checking their validity. Findings are deduplicated by file, line, kind, and claim. At most 500 findings are retained in instruction-file and line order; additional findings set the truncation flag. Totals describe retained findings. Failure thresholds still apply to findings beyond the display cap.
The default threshold is HIGH; --fail-on medium also fails MEDIUM findings. For example, the synthetic sample repo cites a renamed script and moved test directory, and prohibits an identifier imported in src/app.py. Auditing it returns two HIGH findings, one MEDIUM finding, and exit code 2. Its illustrative import does not require an installed dependency because commands are never run.
This is pattern matching, not semantic judgement. Paraphrased claims are not checked. A MEDIUM contradiction needs human review. Commands are not executed; only path tokens and simple Makefile target names are checked. Dynamic imports, complex shell syntax, generated paths, multiline imports, Makefile includes and computed targets, and language-specific resolution are not interpreted. Lexical import patterns may match comments or strings and may miss real imports. Source files that cannot be decoded or read are skipped; this can hide import matches. Instruction-file read failures always produce parse errors. A truncated report is incomplete. Filesystem changes during a scan can affect its results.
PYTHONPATH=src python3 -m unittest discover -s tests -v python3 -m build Building requires setuptools, wheel, and the build frontend already installed for offline use. Runtime and tests use only the Python standard library.
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.




