决策索引构建_adr-index
以下为本文档的中文说明
该技能用于构建或重建ADR索引及依赖关系图,通过运行scripts/import.mjs脚本来实现,只需一次Bash调用即可完成数百次MCP工具调用的工作。主要功能是将所有ADR持久化到adr-patterns命名空间,并将所有关系(替代/修正/关联/依赖)持久化到adr-edges中。使用场景包括:从其他项目导入ADR后需要重建索引;AgentDB图与磁盘上的ADR文件不同步时;在现有代码库上初始化ADR追踪。支持的ADR格式有两种:v3风格——使用# ADR-097:标题格式的标题行加Status: Proposed状态行;插件风格——使用YAML前置元数据(包含id: ADR-NNNN和status: Proposed)。实现方式是将逻辑集中在scripts/import.mjs中(一次Bash调用),而非对每个ADR进行大量的MCP工具调用。该技能的核心优势在于其高效性——同样的功能,处理速度快得多,且同时支持两种ADR格式,对Issue编号的误报具有抵抗能力。
ADR Index
Persists every ADR under */docs/adr/ or */docs/adrs/ to the adr-patterns namespace and every relationship (supersedes / amends / related / depends-on) to adr-edges. Handles both ADR formats found in the Ruflo monorepo:
- v3-style:
# ADR-097: Titleheading +**Status**: Proposedline - plugin-style: YAML frontmatter (
id: ADR-NNNN,status: Proposed)
Implementation is in scripts/import.mjs (one Bash call) rather than dozens of per-ADR MCP tool calls — same effective behavior, materially faster, dual-format-aware, and false-positive-resistant for issue numbers.
When to use
- After importing ADRs from another project
- When the AgentDB graph is out of sync with the on-disk ADR files
- Bootstrapping ADR tracking on an existing codebase
Steps
-
Run the importer:
node plugins/ruflo-adr/scripts/import.mjsOptional env:
IMPORT_FORMAT=json— emit JSON instead of markdownIMPORT_DRY_RUN=1— parse + summarize, skip persistenceADR_ROOT=/path— scan a different root (default: cwd)
-
Inspect the summary — total ADRs, stored count, by-status breakdown, edge counts, dangling refs, status mismatches.
-
Verify graph integrity (optional but recommended) via the sibling
adr-verifyskill, which runsscripts/verify.mjsand exits 1 on cycles. -
Search semantically via
mcp__claude-flow__memory_searchagainst the populated namespace:memory_search --query "federation budget" --namespace adr-patterns
Storage shape
adr-patterns namespace, key <ADR-id>::<basename>, value (text):
<title> — <first paragraph of Context>
file: <relative path>
status: <Proposed|Accepted|Superseded|...>
date: <ISO date>
tags: <comma-separated>
adr-edges namespace, key <relation>:<FROM>-><TO>:<timestamp-rand>, value:
{ "from": "ADR-097", "to": "ADR-086", "relation": "related", "capturedAt": "<ISO>" }
False-positive guard
#1697 / commit abc123 / PR 1234 references inside ADR bodies are stripped before regex extraction so they don’t get misread as ADR-1697 etc. See extractAdrRefs() in scripts/import.mjs.
Cross-references
adr-create— produces the ADR files this skill consumesadr-review— runs overadr-patternsfor compliance checksadr-verify(sibling skill) — runsscripts/verify.mjsfor graph-integrity gating
3f:[“","","","L49”,null,{“content”:“$4a”,“frontMatter”:{“name”:“adr-index”,“description”:“Build or rebuild the ADR index + dependency graph by running scripts/import.mjs (handles v3-style and plugin-style ADR formats; one Bash call vs hundreds of MCP round-trips)”,“argument-hint”:“”,“allowed-tools”:“Bash mcp__claude-flow__memory_list mcp__claude-flow__memory_search”}}]
更多推荐
所有评论(0)