adr-reindex
できること
このスキルは、今あるファイルから、アーキテクチャの決定記録の保存された索引を再構築し、削除した記録が残らないようにします。決定のファイルを削除したり変えたりして、索引を正確に保ちたいチームのためのものです。
使う場面
- ✓アーキテクチャの決定のファイルを削除したとき。
- ✓決定のファイルからリンクの行を削除したとき。
- ✓索引の決定の数がファイルの数より多いとき。
スキルのリンク
https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-adr/skills/adr-reindex/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“決定のファイルを2つ削除しました。索引を整理して、今も存在する記録だけを一覧にしてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、保存された記録とリンクを消去し、今ディスク上にある決定のファイルから再構築します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
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-verifycan't catch whatadr-reindexcatches — see below) - If
adr-verify's ADR count looks higher thanfind docs/adr -name '*.md' | wc -l
Steps
node plugins/ruflo-adr/scripts/reindex.mjs
Optional env:
REINDEX_FORMAT=json— JSON instead of markdownREINDEX_DRY_RUN=1— report what would happen, purge/write nothingADR_ROOT=/path— scan root and the root the underlyingmemory purge/memory storesubprocesses run from (must match whatever rootadr-indexwas last run with, or you'll reconcile the wrong repo's namespace)
What it does
- Purge — hard-deletes every row in
adr-patternsandadr-edgesviamemory purge --namespace <ns> --force(the CLI's realDELETE FROM memory_entries, notmemory delete's soft tombstone that still blocks a same-key re-store — see "Why notadr-index+memory delete" below). - Rebuild — re-scans every ADR currently on disk (same dual-format parser
adr-indexuses) and stores it fresh. - Post-condition — re-lists
adr-patternsand asserts the count equals the number of ADR files just scanned. This is stronger thanadr-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 purgedirectly againstadr-patterns/adr-edgesoutside 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-onedges 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 inadr-edges— they only come back if the sibling repo's ADRs are indexed in the same run. This matchesadr-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 confirmadrCountmatches diskscripts/reindex.mjs— implementation- ADR-0002 (
docs/adrs/) — the decision record for this skill
よくある質問
通常の索引では足りないのはなぜですか?
通常の索引は項目を追加または更新するだけで、削除されたファイルの記録は取り除けないためです。
最初に変更を確認できますか?
はい。スキルには、何も書かずに何が変わるかを報告するドライランのオプションがあります。
定期的に実行すべきですか?
定期的な照合は良い方法だと、スキルは勧めています。
詳細
作者による元の説明
Reconcile the ADR index against a DELETED ADR file or relation line by dropping and rebuilding adr-patterns + adr-edges from scratch (scripts/reindex.mjs). Use when adr-index alone leaves stale rows behind.
repo: ruvnet/ruflo
人気
- GitHubのスター
- 81k
- ランキング
- #1553
- ライセンス
- MIT
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
agent-adaptive-coordinator
81k作業量の変化に合わせて、エージェントのグループを分割し、再配分する手助けをします。作業に合った配置を選びます。
agent-agent
81k大きな目標を順番に並んだ行動計画にし、状況が変わったときに計画を立て直す方法をエージェントに教えます。
agent-agentic-payments
81kAIの買い物のために、支出の上限、期間、販売店のルール、署名付きの承認を含む支出の委任を管理する手助けをします。
agent-analyze-code-quality
81kコードの品質を確認し、コードの臭い、技術的負債、リファクタリングの案を見つける手助けをします。ファイルは変更しません。
似ているスキル
technical-documentation
394k明確な技術ドキュメントやエージェントの指示ファイルを書いて確認し、人やAIツールが簡単に従えるようエージェントを支援します。
architecture-decision-records
280kエージェントがプロジェクト構成に関する重要な決定を記録できるようにします。選択の理由を把握しやすくし、変更履歴を明確に残すのに役立ちます。
code-tour
280kエージェントが正確なファイル名と行番号を示しながら、コードを段階的に解説できるようにします。紹介、説明、レビューに役立ちます。