rag-coverage
Audit corpus distribution by source type and repo; identify coverage gaps and underindexed topics. Answers what's missing from RAG.
- License 许可
- MIT
- 最近更新
- 2026-11-11
- Stars
- ★ 1
- Forks
- 1
01 前言 Front Matter
- name
- rag-coverage
- triggers
- [ "rag coverage", "corpus audit", "rag gaps", "coverage audit", "what's missing from rag" ]
- description
- Audit corpus distribution by source type and repo; identify coverage gaps and underindexed topics. Answers what's missing from RAG.
02 资源文件 1
- 参考文档manifest.json919 B
03 SKILL.md 正文
RAG Coverage
Audit what's indexed and what's missing. Use coverage reports to plan curation and decide between incremental fixes and full rebuilds.
Coverage audit
Run the weekly report to see coverage distribution:
cd ~/.claude/rag-index
venv/bin/python report.py
Read the coverage summary:
cat ~/.claude/rag-index/weekly.md | grep -A 50 "Coverage by source type"
Example output:
Coverage by source type:
skills: 539 chunks (≥500 target: PASS)
handoffs: 259 chunks (≥200 target: PASS)
standards: 54 chunks (≥50 target: PASS)
code: 1847 chunks (scales with repo)
plans: 198 chunks
codex: 31 chunks (low)
repo-docs: 127 chunks
commit: 156 chunks
claude-mem: 203 chunks
spec: 89 chunks
changelog: 52 chunks
TOTAL: 14,355 chunks
Coverage by source type
Query the index directly to see distribution:
sqlite3 ~/.claude/rag-index/index.sqlite << 'EOF'
SELECT source_type, COUNT(*) as chunk_count,
ROUND(AVG(LENGTH(text)), 0) as avg_size,
MIN(LENGTH(text)) as min_size,
MAX(LENGTH(text)) as max_size
FROM chunks
GROUP BY source_type
ORDER BY COUNT(*) DESC;
EOF
Healthy coverage targets:
| Source Type | Min Chunks | Reason |
|---|---|---|
| skills | 500 | Comprehensive skill docs |
| handoffs | 200 | Context summaries, transition notes |
| code | 500+ | Scales with repo size and importance |
| standards | 50 | Style guides, conventions |
| plans | 100 | Roadmaps, architecture |
| codex | 50 | Templates, patterns, how-tos |
| claude-mem | 100 | Memory snapshots, context packs |
| repo-docs | 100 | READMEs, architecture docs |
| spec | 50 | Design specs, RFCs |
| commit | 100 | Recent commit messages for context |
| changelog | 30 | Release notes, version history |
Coverage by repository
Find which repos are well-indexed:
sqlite3 ~/.claude/rag-index/index.sqlite << 'EOF'
SELECT repo, COUNT(*) as chunk_count, COUNT(DISTINCT path) as file_count
FROM chunks
WHERE repo IS NOT NULL
GROUP BY repo
ORDER BY COUNT(*) DESC;
EOF
Repos with <50 chunks likely have gaps. Look for:
- Missing source globs in build.py
- Shallow documentation
- Newly added repos not yet in the index
Coverage by source type + repo combo
Find niche coverage gaps:
sqlite3 ~/.claude/rag-index/index.sqlite << 'EOF'
SELECT source_type, repo, COUNT(*) as chunk_count
FROM chunks
WHERE repo IS NOT NULL
GROUP BY source_type, repo
HAVING COUNT(*) < 20
ORDER BY source_type, COUNT(*) DESC;
EOF
Find zero-hit patterns
Queries that return no results indicate coverage gaps. Check weekly report:
cat ~/.claude/rag-index/weekly.md | grep -A 20 "Zero-hit queries"
Example:
Zero-hit queries (no chunks retrieved):
"authentication refresh token" — no auth docs indexed
"database migration strategy" — missing infra/db standards
"component prop validation" — missing React patterns in codex
"error handling middleware" — missing code examples in standards
For each zero-hit query:
- Identify the missing topic
- Write or curate missing docs (see
adt-rag-curate) - Add source globs if code is involved (see
adt-rag-curate) - Incremental reindex
- Re-run the query to verify
Gaps by topic
Manual audit for missing categories:
sqlite3 ~/.claude/rag-index/index.sqlite << 'EOF'
SELECT path, source_type, COUNT(*) as chunk_count
FROM chunks
WHERE source_type IN ('standards', 'codex', 'plans')
GROUP BY path
ORDER BY source_type, COUNT(*) DESC;
EOF
If you see topics with 1–2 chunks, they may be truncated or incomplete. Check with adt-rag-inspect.
Coverage decision tree
| Situation | Detection | Action | Time |
|---|---|---|---|
| Source type <50% of target | Weekly report | Write missing docs + curate | 30 min – 2 hrs |
| Repo has <50 chunks | rag-coverage query | Add source globs to build.py + reindex | 20 min |
| Zero-hit queries | Weekly report or user feedback | Identify missing topic, curate, reindex | 30 min |
| Many tiny chunks (<100 chars) | adt-rag-inspect | Rebuild with new chunk-size config | 1 hr |
| Stale/missing chunks | adt-rag-drift | Delete or reindex; see adt-rag-drift | 10 min |
| Widespread gaps (>100 chunks missing) | Weekly report | Full rebuild | 2–5 min |
Post-coverage audit workflow
- Run report:
cd ~/.claude/rag-index
venv/bin/python report.py
- Check targets:
cat ~/.claude/rag-index/weekly.md | grep -A 20 "Coverage by source type"
-
For each gap:
- If missing doc → write and incremental reindex (see
adt-rag-curate) - If undercovered repo → add source globs and reindex
- If zero-hit query → curate related content
- If missing doc → write and incremental reindex (see
-
Re-run report after curation:
venv/bin/python report.py
- Verify with test queries:
venv/bin/python query.py "previously zero-hit query" --top 5
Coverage maintenance cadence
- Weekly: Run
report.pyto track trends - After curation: Re-run
report.pyto verify improvement - Monthly: Audit zero-hit queries and plan curation sprints
- Quarterly: Review source type targets; adjust if project scope changes
- Post-major-changes: Full rebuild if repo structure or doc locations change
See also
adt-rag-curate— fill coverage gapsadt-rag-quality— audit retrieval quality (separate from coverage)adt-rag-inspect— examine chunks in detailadt-rag-drift— find stale or missing chunksadt-rag-index-rebuild— full rebuild if coverage strategy changes
04 同仓库更多 Skills
token-audit
Audit historical Claude Code token usage from JSONL session files — shows total spend, cache hit rates, top costly sessions, weekly trends, and where tokens are going. Run after heavy sessions or weekly to measure optimization impact. Answers how many tokens a session used, how expensive was that session, session cost, and token usage report.
smart-model-route
Auto-classify prompt complexity via Haiku (with heuristic fallback) and inject model routing hints for Agent tool calls. Wired as a UserPromptSubmit hook — fires on every prompt, routes low tasks to Haiku, standard to Sonnet, complex to Sonnet with thorough reasoning, and critical (security/arch/migrations) to Opus. Handles model selection, for example choose model by task complexity.
smart-commands
Decision guide for when to proactively use Claude Code slash commands — /think, /model, /compact, /clear. Use when choosing whether to invoke a command before or during a task, or when a complexity-classifier hook has flagged a task as high or critical. Pairs with the complexity-classifier UserPromptSubmit hook. Answers when to compact, should I switch models, and whether to use extended thinking. Use to pick the right /model command and switch model.
spec-ship
暂无简介
spec-new
Create a committed per-feature spec under `docs/specs/YYYY-MM-DD-<slug>/{spec,tasks}.md` with frontmatter (status, created, owner, pr, tags). Promotes an ephemeral `.claude/plans/<name>.md` into a persistent, searchable artifact. Use when starting a feature that's larger than a one-shot PR.
roadmap-refresh
Regenerate `docs/roadmap.md` for a repo from all specs under `docs/specs/` + their frontmatter (status, tags, pr). Produces Now/Next/Recently-shipped sections. Run after creating / shipping a spec, or at the start of a new session for orientation.