Prune stale rules
Rules go stale: a library gets replaced, a folder moves, a rule nobody needs stays in every prompt. Prune finds those rules in .ingot/rules and removes the ones you pick. It always starts as a dry run.
What counts as stale
| Finding | Meaning | Suggested action |
|---|---|---|
| unused | no agent used the rule in the last N days (default 90) | delete |
| dead globs | its globs match no file in the project | delete when every glob is dead, otherwise remove the dead globs |
| deleted paths | it mentions files or folders in backticks that no longer exist | review |
| removed deps | it names packages the project no longer depends on | delete when every package is gone, otherwise review |
Packages come from a rule's deps: (or requires:) frontmatter list, from imports in its code samples and from backticked @scope/name mentions. Ingot checks them against package.json, requirements.txt, pyproject.toml, go.mod and composer.json.
Review findings are only listed; Ingot never changes those rules for you.
How "unused" is measured
Each agent turn records which .ingot/rules were in its context, in .ingot/.state/rule-hits.json. That folder ignores itself in git, so usage stays on your machine. Prune reports unused only when it has at least N days of usage data, and never for a rule committed less than N days ago. Until then the dialog says how long it has been tracking.
Prune in the IDE
Open the Rules & MCP page, pick the Rules tab and click Prune, or run Prune Stale Rules… from Find Action.
- Set Unused for … days.
- Read the findings for each rule. Rules with a delete or remove-globs action are checked.
- Uncheck anything you want to keep, then click Apply.
Deleted rules are removed from .ingot/rules. When only some globs are dead, the rule stays and its globs keep the live ones. Undo with git checkout -- .ingot/rules.
From the terminal
npx @ingotide/cli rules prune # dry run
npx @ingotide/cli rules prune --days 30 # a shorter window
npx @ingotide/cli rules prune --apply # delete stale rules and drop dead globs
npx @ingotide/cli rules prune --apply --only legacy-api,old-style
| Option | Meaning |
|---|---|
--days <n> | the window for unused (default 90) |
--apply | change files; without it nothing is written |
--only <list> | apply to these rules only (names or paths) |
--json | the findings as JSON |