# Cache Debt Cleanup Checklist

> Default paths and cleanup commands for Hugging Face, Ollama, PyTorch Hub, Docker, pip, npm, uv, Playwright, and Claude Code, each labeled read-only, safe, re-download, or destructive, plus methods for stale embeddings and prompts.

Canonical page: https://www.cacheddebt.com/checklist/

Measure, decide, then clean. Default paths and each tool's own commands come from its documentation. Measurement commands such as du and the SQL query are this site's.

## Measure first

The audit script measures every cache on this page in one pass. It only reads file sizes and dates. It never deletes, prunes, or opens file contents.

**Read-only: Download, read, then run (macOS or Linux)**

```sh
curl -fsSLO https://www.cacheddebt.com/cache-debt-audit.sh
less cache-debt-audit.sh
bash cache-debt-audit.sh
```

Add `--json` for scripts and AI agents, or `--tsv` for spreadsheets. Then score what it finds with the [Cache Debt Score](https://www.cacheddebt.com/score/).

**What each command label means:** **Read-only** changes nothing. **Safe** deletes only what the tool recreates on its own. **Re-download** deletes files a later step downloads again. **Destructive** deletes data nothing recreates: get explicit approval from the data's owner first.

## Hugging Face Hub

Type: Model cache. Main cost: Disk only.

Downloaded model and dataset files, including every older revision. Nothing is deleted automatically. [5](https://www.cacheddebt.com/sources/#hf-cache)

| System | Default location |
| --- | --- |
| Linux and macOS | `~/.cache/huggingface/hub` |
| Override | `HF_HOME` or `HF_HUB_CACHE` |

**Suggested threshold:** Review when the cache passes 20 GB or holds models no current project loads.

- [ ] Run hf cache ls and note the five largest repos.
- [ ] Match each large repo to a project that still loads it.
- [ ] Run hf cache prune, then remove repos with no current consumer.

**Read-only: List cached repos and sizes**

```sh
hf cache ls
```

**Safe, recreated automatically: Remove files no cached repo uses**

```sh
hf cache prune
```

**Re-download, confirm before running: Remove a whole repo**

```sh
hf cache rm <repo>
```

The next run that loads this model downloads the full weights again.

## Ollama

Type: Model cache. Main cost: Disk only.

Pulled model weights for local inference. [6](https://www.cacheddebt.com/sources/#ollama-faq)

| System | Default location |
| --- | --- |
| macOS | `~/.ollama/models` |
| Linux | `/usr/share/ollama/.ollama/models` |
| Windows | `C:\Users\%username%\.ollama\models` |
| Override | `OLLAMA_MODELS` |

**Suggested threshold:** Review models not run in the last 30 days.

- [ ] Run ollama ls and mark models no workflow uses.
- [ ] Remove unused models with ollama rm.

**Read-only: List models and sizes**

```sh
ollama ls
```

**Re-download, confirm before running: Remove one model**

```sh
ollama rm <model>
```

Pulling it again downloads the full weights.

## PyTorch Hub

Type: Model cache. Main cost: Disk only.

Repositories and checkpoints fetched through torch.hub. [12](https://www.cacheddebt.com/sources/#torch-hub)

| System | Default location |
| --- | --- |
| Linux and macOS | `~/.cache/torch/hub` |
| Override | `TORCH_HOME` |

**Suggested threshold:** PyTorch documents no cleanup command. Delete a checkpoint only after confirming no code loads it.

- [ ] List checkpoints by size.
- [ ] Search your code for each checkpoint name before deleting it.

**Read-only: Measure checkpoints**

```sh
du -sh ~/.cache/torch/hub/checkpoints/*
```

## Docker

Type: Container state. Main cost: Data loss.

Images, stopped containers, build cache, and volumes left by services that no longer run. [7](https://www.cacheddebt.com/sources/#docker-prune) [8](https://www.cacheddebt.com/sources/#docker-df)

| System | Default location |
| --- | --- |
| All | Managed by the Docker daemon |

**Suggested threshold:** Review any volume with no running container that uses it.

- [ ] Run docker system df -v and list volumes with zero links.
- [ ] Name an owner for each unlinked volume or mark it for removal.
- [ ] Prune build cache with docker builder prune. Leave stopped containers until their owner confirms.

**Read-only: Show disk use by type**

```sh
docker system df -v
```

**Safe, recreated automatically: Remove build cache**

```sh
docker builder prune
```

Later builds recreate the layers they need.

**DESTRUCTIVE, requires explicit human approval: Remove stopped containers, dangling images, unused networks, and build cache**

```sh
docker system prune
```

Keeps volumes, but deletes stopped containers along with any files written inside them.

**DESTRUCTIVE, requires explicit human approval: Also remove all unused images and anonymous volumes**

```sh
docker system prune -a --volumes
```

Volumes hold databases and model stores. Deleted volume data does not come back.

## pip

Type: Package cache. Main cost: Disk only.

Downloaded index pages and locally built wheels. [9](https://www.cacheddebt.com/sources/#pip-cache)

| System | Default location |
| --- | --- |
| Linux | `~/.cache/pip` |
| Any | Run pip cache dir to print it |

**Suggested threshold:** Disk cost only. Clear when space is tight.

- [ ] Run pip cache info and record the size.

**Read-only: Show size and location**

```sh
pip cache info
```

**Safe, recreated automatically: Remove everything**

```sh
pip cache purge
```

Packages download again on the next install.

## npm

Type: Package cache. Main cost: Disk only.

Content-addressed package tarballs shared across projects. [10](https://www.cacheddebt.com/sources/#npm-cache)

| System | Default location |
| --- | --- |
| macOS and Linux | `~/.npm/_cacache` |
| Windows | `%LocalAppData%\npm-cache` |

**Suggested threshold:** Disk cost only. npm states clearing the cache is never needed except to reclaim space.

- [ ] Measure the npm cache and record the size.

**Read-only: Measure the cache**

```sh
du -sh "$(npm config get cache)"
```

**Safe, recreated automatically: Verify and garbage collect**

```sh
npm cache verify
```

Removes only data npm no longer needs.

## uv

Type: Package cache. Main cost: Disk only.

Python package archives and built wheels, including entries from older uv versions. [11](https://www.cacheddebt.com/sources/#uv-cache)

| System | Default location |
| --- | --- |
| Linux and macOS | `~/.cache/uv` |

**Suggested threshold:** Run uv cache prune on a schedule.

- [ ] Measure the uv cache.
- [ ] Run uv cache prune.

**Read-only: Find and measure the cache**

```sh
du -sh "$(uv cache dir)"
```

**Safe, recreated automatically: Remove unused entries**

```sh
uv cache prune
```

Documented as safe to run periodically.

**Safe, recreated automatically: Remove all entries**

```sh
uv cache clean
```

Packages download again on the next install.

## Playwright browsers

Type: Test artifacts. Main cost: Disk only.

Browser builds for end-to-end tests. Playwright removes versions no installation needs, but only for browsers it installed. [13](https://www.cacheddebt.com/sources/#playwright-browsers)

| System | Default location |
| --- | --- |
| Linux | `~/.cache/ms-playwright` |
| macOS | `~/Library/Caches/ms-playwright` |
| Windows | `%USERPROFILE%\AppData\Local\ms-playwright` |
| Override | `PLAYWRIGHT_BROWSERS_PATH` |

**Suggested threshold:** Review any browser build the current Playwright version does not expect.

- [ ] Compare installed browser builds with the version your project pins.
- [ ] Remove builds no project expects.

**Read-only: List installed browser builds**

```sh
ls "${PLAYWRIGHT_BROWSERS_PATH:-$HOME/.cache/ms-playwright}"
```

**Re-download, confirm before running: Remove browsers for this installation**

```sh
npx playwright uninstall
```

Run npx playwright install before the next test run.

**Re-download, confirm before running: Remove browsers for every installation**

```sh
npx playwright uninstall --all
```

## Claude Code transcripts

Type: Agent state. Main cost: Security.

Full session transcripts in plaintext, including every tool result, plus auto memory files per project. [14](https://www.cacheddebt.com/sources/#claude-code-settings) [15](https://www.cacheddebt.com/sources/#claude-code-directory)

| System | Default location |
| --- | --- |
| All | `~/.claude/projects/<project>/` |

**Suggested threshold:** Set cleanupPeriodDays to match your retention policy. Auto memory files are not swept by it.

- [ ] Measure transcript size per project.
- [ ] Confirm cleanupPeriodDays matches your retention policy.
- [ ] Rotate any credential an agent read during a session.

**Read-only: Measure transcripts per project**

```sh
du -sh ~/.claude/projects/*
```

**Read-only: Preview what purging one project deletes**

```sh
claude purge <project-path> --dry-run
```

**DESTRUCTIVE, requires explicit human approval: Delete one project’s local state**

```sh
claude purge <project-path>
```

Deletes transcripts and auto memory for the project, after a confirmation prompt. They cannot be recovered. Omit the path to pick a project from a list.

## Vector indexes and embeddings

Type: Retrieval state. Main cost: Output quality.

A vector stays in the index after its source changes, and vectors from different embedding models are not comparable. [4](https://www.cacheddebt.com/sources/#voyage-embedding-migration) Neither problem shows up as an error. Retrieval quality drops without a signal.

Store four fields with every vector, then one query finds all three kinds of stale vector. Adapt the table and column names to your store.

**Read-only: Count stale, orphaned, and old-model vectors**

```sql
SELECT
  count(*) FILTER (WHERE s.id IS NULL)                    AS orphaned,
  count(*) FILTER (WHERE e.source_hash <> s.content_hash) AS stale,
  count(*) FILTER (WHERE e.model <> 'current-model-id')   AS old_model
FROM embeddings e
LEFT JOIN documents s ON s.id = e.source_id;
```

Store source_hash as a hash of the exact chunk text you embedded, so any edit to the source changes it.

- [ ] Store source ID, source content hash, embedding model, and embed date on every vector.
- [ ] Count vectors whose source hash no longer matches the current source.
- [ ] Count vectors whose source no longer exists.
- [ ] Count vectors from an embedding model other than the current one.
- [ ] Re-embed or delete each group, then compare retrieval results on a fixed query set.

## Prompts and saved context

Type: Instructions. Main cost: Output quality.

Longer inputs lower model performance, [2](https://www.cacheddebt.com/sources/#chroma-context-rot) and models use information in the middle of a long context less reliably than information at the start or end. [3](https://www.cacheddebt.com/sources/#liu-lost-in-the-middle) Old instructions carried forward cost tokens and compete with current ones.

- [ ] Give every production prompt a version ID stored with its output.
- [ ] List which services and agents load each version.
- [ ] Delete versions no consumer loads.
- [ ] Review saved memory and system prompts for instructions that contradict current behavior.

## Retention rules

Type: Policy.

Cleanup without an owner and a schedule grows back. Write the rule down where your team tracks operational work.

- [ ] Give every area above a named owner.
- [ ] Write a retention period for each area, or a reason it has none.
- [ ] Schedule the audit script monthly and keep its output.
- [ ] Score each area on the Cache Debt Score and act on the bands.
