# Rules

Each rule reads the sheets and returns findings. A finding's level says how strongly it asks for action: `cut` removes context that does nothing, `fix` keeps the item and changes it, and `info` changes nothing.

Change a threshold with `--rule <id>.<option>=<n>` or in the [config file](https://loadsheet.dev/docs/reference/config). Turn a rule off with `--rule <id>=off`.

| Rule                    | Level | Finds                                                                                                                                     | Options and defaults                   |
| ----------------------- | ----- | ----------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- |
| `dead-skill`            | cut   | A skill listed for weeks and never invoked, by the model or by you.                                                                       | `minSessions` 20, `minDays` 14         |
| `dead-pack`             | cut   | A pack none of whose skills is used. One finding covers all its skills.                                                                   | `minSkills` 5                          |
| `invisible-skill`       | fix   | A skill listed without its description in most sessions, so the model cannot tell when to use it.                                         | `minSessions` 5, `bareShare` 0.5       |
| `manual-only`           | fix   | A skill the model may invoke, but only you do. Hiding it from the model keeps `/name` and saves its listing.                              | `minUserUses` 3                        |
| `expensive-description` | fix   | A skill whose listing entry is longer than it needs to be.                                                                                | `maxChars` 300                         |
| `duplicate`             | fix   | The same skill installed twice on one machine, from two sources or with two contents.                                                     | none                                   |
| `harness-mismatch`      | fix   | A skill installed only for harnesses you do not use.                                                                                      | `minSessions` 1                        |
| `drift`                 | fix   | The same skill with different contents on two machines. Fleet reports only.                                                               | none                                   |
| `heavy-instructions`    | info  | An instruction file longer than it should be. Every session that loads it pays for all of it.                                             | `maxChars` 12000                       |
| `heavy-memory`          | fix   | A project's on-disk `MEMORY.md` index over its line or character limit. The rule does not verify session loads.                           | `maxLines` 30, `maxChars` 4000         |
| `stale-memory`          | cut   | Memories that name a pull request, a branch or a date and have not changed in 30 days. The fix archives them; it never deletes one.       | `minFiles` 1                           |
| `idle-mcp`              | info  | An MCP server listed and never called.                                                                                                    | `minSessions` 20                       |
| `short-history`         | info  | Too little history to judge use. It becomes a fix when Claude Code's `cleanupPeriodDays` deletes what the window needs: the fix sets 365. | `minDays` 30                           |
| `cache-ttl`             | fix   | Claude Code kept its prompt cache 5 minutes on the last 3 days with 1M cache writes, per entrypoint.                                      | none                                   |
| `cache-off`             | fix   | No request read the prompt cache, over at least 10 sessions and 1M tokens sent.                                                           | none                                   |
| `heavy-skill`           | info  | A skill whose body is long and loaded often. Every load puts the whole body in context.                                                   | `maxChars` 6000, `minLoads` 20         |
| `oversized-subagent`    | info  | A subagent type whose requests on one model send a large context on average.                                                              | `maxContext` 100000, `minRequests` 500 |
| `pull-waiting`          | info  | Threads that pull request updates woke many times each, turns that run while nobody asked.                                                | `maxWakes` 8, `minThreads` 10          |

`minSessions` counts the sessions that listed the item. `minDays` counts days of history. For `harness-mismatch`, a harness with fewer than `minSessions` sessions in the window counts as unused.

## Prompt cache

Claude Code writes prompts to a cache that lives 5 minutes or 1 hour. `cache-ttl` reads main conversations' cache writes per UTC day and judges the last 3 days with at least 1M of them. When 5-minute writes make up at least half on all three days, the finding estimates potential reuse from 5-minute writes following a 5-to-60-minute pause between requests to the same model. This does not prove a cache hit or cost savings. When there is a reuse opportunity, the rule can suggest setting `promptCacheTtl` to `"1h"` in the active Claude Code `settings.json`, provided the scanner can safely name it. When `FORCE_PROMPT_CACHING_5M` set the lifetime, the fix also turns it off in the file's `env`. If the settings already ask for 1 hour, there is nothing to set. See Claude Code's [cache lifetime](https://code.claude.com/docs/en/prompt-caching#cache-lifetime) docs.

`cache-off` fires when a machine has at least 10 main sessions and 1M input and cache-write tokens, and no request read the cache. When a `DISABLE_PROMPT_CACHING` variable turned caching off, the fix sets it to `"0"` in the settings' `env`. Otherwise a gateway or proxy may drop the cache, and there is no setting to change.

## Project memory

Claude Code keeps an auto memory per project in `~/.claude/projects/<project>/memory/`: a `MEMORY.md` index it can load at session start, up to its first 200 lines or 25KB, and topic files it reads on demand. Worktrees and subdirectories of a repository share an index by default. loadsheet counts files (`archive/` left out), index lines and bytes, and stale notes, without keeping their text or file names. It applies the user settings and environment and checks project settings for the current project, including when a project directory name is explicitly configured. `autoMemoryEnabled: false` or `CLAUDE_CODE_DISABLE_AUTO_MEMORY=1` disables memory; `CLAUDE_CODE_DISABLE_AUTO_MEMORY=0` overrides the toggle. Custom `autoMemoryDirectory` locations are not scanned. Other projects' indexes are on-disk inventory, not confirmed session loads. Local fixes resolve the exact scanned directory without revealing its home prefix; copied or unknown-home folders are inventory only.

`heavy-memory` asks you to shorten an index that holds memories instead of pointing to them. Indexes above the 1 MiB read cap are flagged by byte size alone; their lines and characters are not measured. `stale-memory` looks for notes unchanged for 30 days whose body names a pull request (`PR #12`, `pull/12`, `#123`), a branch by its prefix (`feat/…` and the like), or a date. If a note has frontmatter, it must use one top-level field per line and have either a simple `type: project` or no type. Frontmatter with indented values or misplaced keys, and durable types such as `feedback`, `user` and `reference`, are left alone. The command moves eligible notes into `archive/` without overwriting existing files and reports skipped collisions. Remove only links to notes it reports as archived from `MEMORY.md`. These rules read Claude Code memory only.

## Skills, subagents and pull requests

These three rules judge what [`loadsheet usage query`](https://loadsheet.dev/docs/reference#usage-query) measures, over the report's window.

`heavy-skill` counts a skill's recorded invocations, by the model and by you, and its body's characters after the frontmatter. A body over `maxChars` with at least `minLoads` recorded invocations is reported. The count can include failed attempts and does not confirm that the body loaded. In a fleet, only invocations on machines and harnesses with a qualifying body count. Findings rank by body characters × invocations, summed across those installs. What to cut is your call, so it has no fix.

`oversized-subagent` divides the input and cache tokens of a subagent type's requests on one model by their number, the mean context `subagent-cost` shows. A mean over `maxContext`, over at least `minRequests` requests, is reported once per type and model. The finding is informational: the history cannot establish which file or model setting produced the requests. Add `subagent:<type>` to `ignore` to leave a type out. The finding and subagent ignore entries stay out of share links because type labels can come from Claude Code and Codex transcripts.

`pull-waiting` counts the turns a pull request update started, as `wakes` does, and the threads they woke. More than `maxWakes` wakes per woken thread, over at least `minThreads` threads, is reported once per harness. Its evidence adds the tokens spent after a pull request's link, from the pull requests the store joined to a thread; a store names the thread of only some of them, so that number is never the threshold. Reports omit a harness's spend evidence when filtered by entrypoint or when the report window narrows a scan with pull spend for that harness. A thread's total can include runs from other entrypoints or from a different day than the pull opened.

## When a rule does not run

A rule needs signals from the transcripts, such as which skills a session listed or which ones the model invoked. When a harness does not log one, the rule skips that harness, and the report lists it under "Rules not run" with the missing signal. A rule also skips a harness with too few sessions to judge.

A [skill pack](https://loadsheet.dev/docs/guide/packs) has no sessions, so only `expensive-description`, `duplicate` and `heavy-instructions` run on it.

<!-- vitehub-docs:section-links -->
## In this section

- [Command line](https://loadsheet.dev/raw/docs/reference.md)
- [Rules](https://loadsheet.dev/raw/docs/reference/rules.md) (this page)
- [Config file](https://loadsheet.dev/raw/docs/reference/config.md)
- [Report and Scan](https://loadsheet.dev/raw/docs/reference/schemas.md)

Next: [Config file](https://loadsheet.dev/raw/docs/reference/config.md)

All pages: [llms.txt](https://loadsheet.dev/llms.txt)
