caching-and-incrementallisted
Install: claude install-skill iktok90-design/ai-smart-contract-auditor
# Caching & incremental audit (meta-skill)
The first audit of a 50K-line codebase is slow. The second one shouldn't be. This skill governs cache reuse.
## Cache layout
`~/.cache/auditsentry/<repo-fingerprint>/`
```
findings/
<sha256(file-content)>.json # findings for that exact file content
<sha256>.skill-versions # skill names + versions used to produce findings
manifest.json # mapping file-path → current sha256
```
**Repo fingerprint** = sha256 of the absolute repo root path (so different checkouts don't collide).
## Procedure (per file F to audit)
### Step 1 — Compute current hash
`current_hash = sha256(read F)`
### Step 2 — Check manifest
- Look up `manifest[F]` → `cached_hash`.
- If `cached_hash == current_hash`:
- Load `findings/<current_hash>.json`.
- Verify `skill-versions` matches current skill set.
- If both match: **return cached findings**, mark file as cached in output.
- Otherwise → audit fresh and write to cache.
### Step 3 — Write fresh result
After audit completes:
- `write findings/<current_hash>.json`
- Update `manifest[F] = current_hash`
### Step 4 — Garbage collect
Periodically (e.g. weekly): drop `findings/*.json` not referenced from any current manifest.
## Invalidation triggers
Re-audit even if hash matches when:
- The list of active skills has changed since the cached result
- A new vulnerability skill was added that may apply
- User passes `--no-cache` or `--rerun`
- `.auditsentry.yml` config has ch