New to Claude Skills? Learn how to install them →

ruvnet on GitHub

ADR Reindex

Free

Rebuild ADR indices for accurate documentation management.

by ruvnet67.6k stars on ruvnet/ruflo
Updated Aug 10, 2026
Get this skill

Free · Opens the source repo

What ADR Reindex does

The ADR Reindex skill is designed to help developers manage their Architecture Decision Records (ADRs) effectively by purging stale entries and rebuilding the ADR index from the current state of the filesystem. When an ADR file is deleted or a relation line is removed, the existing entries in the adr-patterns and adr-edges can become outdated, leading to inconsistencies in the documentation. This skill addresses that issue by allowing users to completely remove these stale entries and regenerate the index based on the current ADR files available on disk.

To use the ADR Reindex skill, simply run the provided reindex.mjs script. This process involves two main steps: purging the existing entries in the ADR index and then scanning the filesystem to rebuild the index from scratch. The skill ensures that any orphaned entries that may have survived previous indexing runs are eliminated, thus maintaining the integrity of the documentation. The ability to run this skill periodically or after specific deletions ensures that your ADR index remains accurate and up-to-date.

This skill is particularly useful for teams that rely heavily on ADRs for documenting architectural decisions and want to avoid confusion caused by stale data. By keeping the ADR index clean and reflective of the actual files, teams can ensure that their documentation is reliable and that all team members are on the same page regarding architectural decisions. It is a valuable tool for any developer or architect looking to maintain high-quality documentation practices.

When to use it

Use this skill after deleting ADR files or periodically to reconcile the ADR index.

When not to use it

Avoid using this skill if you need to retain historical ADR data, as it performs irreversible purging of the index.

What you can build with it

Post-Deletion Cleanup

After deleting an ADR file, run the ADR Reindex skill to remove any residual entries from the index.

Scheduled Maintenance

Set up a periodic task to run the ADR Reindex skill to keep your ADR index clean and accurate.

Discrepancy Resolution

If you notice a mismatch in ADR counts, use this skill to reconcile the index and ensure it reflects the current state.

How to install ADR Reindex

View source

1. Install with the skills CLI

npx skills add ruvnet/ruflo/adr-reindex --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by ruvnet

ADR Reindex

adr-index only ever adds or upserts rows — it has no way to remove one. Delete an ADR file (or a single relation line from a surviving file) and the row adr-index wrote for it survives every future adr-index run, forever, with no dangling-ref or cycle ever pointing at it. adr-verify then certifies the resulting graph as healthy, because an orphan row with zero edges in or out is invisible to both its checks. See issue #2666.

This is a different failure mode from staleness (an ADR that changed but whose stored record didn't) — that's convergence, adr-index's job. This is reaping — the source of truth (the ADR file) is gone, so the derived cache row for it must be gone too. The only reliable way to reap is to drop both namespaces and rebuild from what's actually on disk right now.

When to use

  • After deleting an ADR file (or removing a relation line from one)
  • Periodically, as a scheduled reconcile (adr-verify can't catch what adr-reindex catches — see below)
  • If adr-verify's ADR count looks higher than find docs/adr -name '*.md' | wc -l

Steps

node plugins/ruflo-adr/scripts/reindex.mjs

Optional env:

  • REINDEX_FORMAT=json — JSON instead of markdown
  • REINDEX_DRY_RUN=1 — report what would happen, purge/write nothing
  • ADR_ROOT=/path — scan root and the root the underlying memory purge/memory store subprocesses run from (must match whatever root adr-index was last run with, or you'll reconcile the wrong repo's namespace)

What it does

  1. Purge — hard-deletes every row in adr-patterns and adr-edges via memory purge --namespace <ns> --force (the CLI's real DELETE FROM memory_entries, not memory delete's soft tombstone that still blocks a same-key re-store — see "Why not adr-index + memory delete" below).
  2. Rebuild — re-scans every ADR currently on disk (same dual-format parser adr-index uses) and stores it fresh.
  3. Post-condition — re-lists adr-patterns and asserts the count equals the number of ADR files just scanned. This is stronger than adr-index's "N stored, 0 errors" tally: if a concurrent memory.db writer clobbered the purge (see Caveats), the store loop would still report success on every call — only a fresh recount catches that.

Exits non-zero if the post-condition fails.

Why not adr-index + memory delete

memory delete is a soft delete (UPDATE ... SET status='deleted') — the row keeps occupying its UNIQUE(namespace, key) slot, so a later non-upsert memory store for that same key still fails. memory cleanup only reaps entries by age/TTL/quality, not by "does its source file still exist" — it has no orphan concept. Neither gets you back to a clean graph; only a real namespace-scoped DELETE FROM does, which is what memory purge (and this skill) uses.

Caveats

  • Irreversible. This purges the entire namespace, not a diff — always safe here because step 2 immediately rebuilds from the current on-disk truth, but don't call memory purge directly against adr-patterns/adr-edges outside this flow.
  • #2621 (unaddressed): the purge is lock-protected against a second concurrent purge/delete on the same memory.db, but not against every writer — a daemon or MCP server mid a read-modify-write cycle on the sql.js fallback path can still flush an older image afterward and resurrect what this just purged. The post-condition check exists specifically to surface this; re-run the skill if it fails.
  • Cross-repo related/depends-on edges pointing at an ADR that was never scanned in this root (a legitimate sibling-repo reference, not an orphan) are dropped by the rebuild the same as everything else in adr-edges — they only come back if the sibling repo's ADRs are indexed in the same run. This matches adr-verify's own documented "dangling ref, common cause: sibling repo" caveat; it isn't new drift introduced by this skill.

Cross-references

  • adr-index — convergence (add/upsert); this skill is reaping (remove what's gone)
  • adr-verify — read-back integrity check; run after reindex to confirm adrCount matches disk
  • scripts/reindex.mjs — implementation
  • ADR-0002 (docs/adrs/) — the decision record for this skill

Frequently asked questions about ADR Reindex

Similar skills