← ClaudeAtlas

adt-rag-driftlisted

Detect and fix stale chunks (files that changed or were deleted since last indexing)
LucasSantana-Dev/sharekit-profile · ★ 1 · AI & Automation · score 70
Install: claude install-skill LucasSantana-Dev/sharekit-profile
# RAG Drift **Drift** occurs when the index contains chunks from files that have been deleted or modified since indexing. The retrieval system silently returns outdated or orphaned content without error. Detect and fix drift before it degrades quality. ## What is drift? Two types of drift corrupt the index: see `references/drift-types.md` for details. Drift is **silent.** Retrieval still works, but returns wrong or outdated info. ## Detect drift **BLOCKED if External HD unmounted** — report.py embedder cache unreachable; query local sqlite instead. **Check stale count:** Read the drift summary to determine action: - <5 stale chunks: normal churn; can wait for next full rebuild - 5–20 chunks: fix incrementally today - >20 chunks: full rebuild recommended (faster than 20+ incremental ops) Run the report script: ```bash cd ~/.claude/rag-index venv/bin/python report.py ``` Read the drift summary: ```bash cat ~/.claude/rag-index/weekly.md | grep -A 30 "Stale chunks" ``` See `references/report-examples.md` for example output. **Done when:** report shows stale count and recommended action based on thresholds above. ## Fix missing chunks (deleted files) For files that no longer exist, delete their orphaned chunks: ```bash sqlite3 ~/.claude/rag-index/index.sqlite ``` In the sqlite prompt: ```sql -- View chunks from the deleted file SELECT COUNT(*), path FROM chunks WHERE path LIKE '%old-skill/SKILL.md%' GROUP BY path; -- Delete them DELETE FROM chunks WHERE path L