contextpruner
v0.3.0
Published
Lint your AI-context config files (AGENTS.md, CLAUDE.md, GEMINI.md, Cursor rules) against your repo — find missing, dead, drifting, and conflicting rules.
Maintainers
Readme
contextpruner
Lint your AI-context config files against your repo. contextpruner lint checks
your AGENTS.md / CLAUDE.md / GEMINI.md / Copilot / Cursor rules — plus the
enforced ignore artifacts (.cursorignore / .geminiignore / .codeiumignore
and the Claude Code deny rules in .claude/settings.json) — against the files
actually in your tree and reports:
- Missing — junk the config doesn't ignore yet (with what it's costing you),
- Dead — rules that match nothing,
- Drift — rules in one config but not another,
- Conflict — rules that contradict each other, including an enforced rule
that hard-blocks a file you pinned Keep or Skim, or a path you declared
keep:in.contextpruner.
It exits non-zero when it finds issues, so it drops straight into CI or a pre-commit hook.
Usage
export CONTEXTPRUNER_API_KEY=cp_live_... # from https://contextpruner.app/account
npx contextpruner lintOne subscription, one key: the same cp_live_ key authorizes both this CLI and
the ContextPruner config automation (the GitHub Action / pre-commit hook), so
reuse the one you already have.
contextpruner lint [--config <path>]... [--fix] [--json]--config <path>— a config to lint (repeatable). Defaults to auto-detecting the standard files at the repo root: the advisory markdown configs plus the four enforced artifacts. An explicit path's format is inferred from its basename (settings.json→ Claude settings, the*ignorefiles → gitignore syntax, anything else → markdown).--fix— rewrite each config's managed block in place to fix the issues. Your own content outside the block (and the "Exceptions" section) is left alone. Enforced ignore files regenerate only the# contextpruner:begin/endblock;.claude/settings.jsonis merged via its sentinel-delimited deny span and is skipped — never clobbered — when it has no recognized span or can't be merged safely.--json— emit the full report as JSON.
If the repo root has a committed .contextpruner file, its
keep: <path-or-glob> lines (enforcement exceptions — paths that must stay
readable by agents, even untracked ones like docs inside node_modules/)
drop any enforced rule covering them from the expected rule set, exactly as
the generate automation does — so lint, --fix, and generation always agree.
Unrecognized lines are reported as a warning and ignored.
Exit codes: 0 clean · 1 issues found · 2 usage/auth error.
In CI
Fail the build when a config drifts. Save this as
.github/workflows/contextpruner-lint.yml and add your key as the repo secret
CONTEXTPRUNER_API_KEY:
name: ContextPruner Lint
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npx --yes contextpruner lint
env:
CONTEXTPRUNER_API_KEY: ${{ secrets.CONTEXTPRUNER_API_KEY }}Privacy
The pruning engine runs entirely on your machine — your file tree never
leaves it. The only network call is to /api/license/verify, which sends just
your API key to confirm an active subscription.
Development
The CLI bundles the app's pure engine at build time:
npm install # in packages/cli
npm run build # → dist/index.jsThe published package name is contextpruner; the repository's root
package.json is a separate private app that happens to share the name.
