adr-reindex

Rebuilds ADR memory namespaces from disk to remove orphaned index rows.

70.1k|8.4k|Updated Jun 2, 2025
One-click install
npx skills add https://github.com/ruvnet/claude-flow --skill adr-reindex
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: adr-reindex
Source: https://github.com/ruvnet/claude-flow/tree/main/plugins/ruflo-adr/skills/adr-reindex
Command: npx skills add https://github.com/ruvnet/claude-flow --skill adr-reindex

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Deleting an Architecture Decision Record file leaves stale rows behind in the adr-patterns and adr-edges memory namespaces, because incremental indexing only adds or upserts rows and verification cannot detect orphans with no edges. This Skill reconciles the index by purging both namespaces and rebuilding them from the ADR files actually present on disk.

Core Features & Use Cases

  • Namespace purge and rebuild: Hard-deletes every row in adr-patterns and adr-edges via memory purge, then re-scans and re-stores all ADRs currently on disk.
  • Post-condition verification: Re-lists adr-patterns after the rebuild and asserts the count matches the number of scanned ADR files, exiting non-zero on mismatch.
  • Dry-run and JSON output: Supports REINDEX_DRY_RUN=1 to preview changes and REINDEX_FORMAT=json for machine-readable reports.
  • Use Case: After deleting docs/adr/0012-use-redis.md, run the reindex to drop its orphaned rows so adr-verify reports an ADR count that matches the files on disk.

Quick Start

Run the reindex script with node plugins/ruflo-adr/scripts/reindex.mjs to purge and rebuild the ADR memory namespaces from the current files on disk.

Frequently Asked Questions about adr-reindex

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I remove stale ADR entries from the memory index?

Run node plugins/ruflo-adr/scripts/reindex.mjs to purge the adr-patterns and adr-edges namespaces and rebuild them from ADR files currently on disk. This removes orphaned rows left behind when an ADR file is deleted.

Why does adr-index not remove deleted ADR files?

adr-index only adds or upserts rows and has no removal logic, so rows for deleted ADR files survive every future run. Orphan rows with no edges are also invisible to adr-verify checks, making a full namespace rebuild the only reliable fix.

Can I preview the ADR reindex before making changes?

Yes, set REINDEX_DRY_RUN=1 to report what would happen without purging or writing anything. You can also set REINDEX_FORMAT=json for machine-readable output instead of markdown.

Why not use memory delete instead of memory purge for ADR cleanup?

memory delete is a soft delete that keeps the row occupying its unique namespace-key slot, so a later non-upsert store for the same key still fails. Only memory purge performs a real namespace-scoped DELETE that returns the graph to a clean state.

What happens if the ADR reindex post-condition check fails?

The script exits non-zero when the recounted adr-patterns rows do not match the number of scanned ADR files, which can happen if a concurrent memory.db writer clobbered the purge. Re-run the skill to reconcile again.