adr-index
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseADR Index
ADR索引
Build or rebuild the full ADR index and dependency graph in AgentDB from the directory.
docs/adr/从目录在AgentDB中构建或重建完整的ADR索引与依赖关系图。
docs/adr/When to use
使用场景
After importing ADRs from another project, when the AgentDB graph is out of sync, or when bootstrapping ADR tracking on an existing codebase that already has ADR files.
从其他项目导入ADR后、AgentDB图表不同步时,或是在已有ADR文件的现有代码库中启动ADR追踪时。
Steps
步骤
-
Scan directory --for
Globto find all ADR files. If no files found, report that no ADRs exist yet.docs/adr/ADR-*.md -
Parse each ADR --each file and extract:
Read- ID: from the filename (e.g., from
ADR-042)ADR-042-use-postgres.md - Title: from the heading
# ADR-NNN: <Title> - Status: from the line
**Status**: - Date: from the line
**Date**: - Tags: from the line
**Tags**: - Links: from the section (supersedes, amended-by, related)
## Links
- ID: from the filename (e.g.,
-
Store in AgentDB -- For each ADR, callwith:
mcp__claude-flow__agentdb_hierarchical-store- path:
adr/<adr-id> - value:
{ "id": "<id>", "title": "<title>", "status": "<status>", "date": "<date>", "tags": "<tags>", "file": "<filepath>" }
- path:
-
Build causal edges -- For each ADR with links:
- "Supersedes ADR-XXX" -> with
mcp__claude-flow__agentdb_causal-edge,from: ADR-XXX,to: <current>relation: supersedes - "Amended by ADR-YYY" -> with
mcp__claude-flow__agentdb_causal-edge,from: <current>,to: ADR-YYYrelation: amends - "Related: ADR-ZZZ" -> with
mcp__claude-flow__agentdb_causal-edge,from: <current>,to: ADR-ZZZrelation: related - "Depends on ADR-WWW" -> with
mcp__claude-flow__agentdb_causal-edge,from: <current>,to: ADR-WWWrelation: depends-on
- "Supersedes ADR-XXX" ->
-
Store in memory -- For each ADR, callwith:
mcp__claude-flow__memory_store- namespace:
adr-patterns - key:
<adr-id> - value: This enables semantic search across ADRs.
<title> — <first paragraph of Context section>
- namespace:
-
Verify graph -- Callto retrieve all edges and verify:
mcp__claude-flow__agentdb_causal-query- No dangling references (edges pointing to non-existent ADRs)
- No circular supersedes chains
- All superseded ADRs have status "superseded"
-
Report -- Output a summary:
## ADR Index Summary Total ADRs: N - Proposed: X - Accepted: Y - Deprecated: Z - Superseded: W Relationships: M edges - Supersedes: A - Amends: B - Depends-on: C - Related: D Issues found: (list any dangling refs or status mismatches)
-
扫描目录 -- 使用查找
Glob格式的所有ADR文件。如果未找到文件,报告当前尚无ADR存在。docs/adr/ADR-*.md -
解析每个ADR -- 读取每个文件并提取以下信息:
- ID:从文件名中提取(例如,从中提取
ADR-042-use-postgres.md)ADR-042 - 标题:从标题行提取
# ADR-NNN: <Title> - 状态:从行提取
**Status**: - 日期:从行提取
**Date**: - 标签:从行提取
**Tags**: - 链接:从部分提取(替代、修订、相关)
## Links
- ID:从文件名中提取(例如,从
-
存储至AgentDB -- 针对每个ADR,调用接口,参数如下:
mcp__claude-flow__agentdb_hierarchical-store- path:
adr/<adr-id> - value:
{ "id": "<id>", "title": "<title>", "status": "<status>", "date": "<date>", "tags": "<tags>", "file": "<filepath>" }
- path:
-
构建因果边 -- 针对每个包含链接的ADR:
- "Supersedes ADR-XXX" -> 调用接口,参数
mcp__claude-flow__agentdb_causal-edge,from: ADR-XXX,to: <current>relation: supersedes - "Amended by ADR-YYY" -> 调用接口,参数
mcp__claude-flow__agentdb_causal-edge,from: <current>,to: ADR-YYYrelation: amends - "Related: ADR-ZZZ" -> 调用接口,参数
mcp__claude-flow__agentdb_causal-edge,from: <current>,to: ADR-ZZZrelation: related - "Depends on ADR-WWW" -> 调用接口,参数
mcp__claude-flow__agentdb_causal-edge,from: <current>,to: ADR-WWWrelation: depends-on
- "Supersedes ADR-XXX" -> 调用
-
存储至内存 -- 针对每个ADR,调用接口,参数如下:
mcp__claude-flow__memory_store- namespace:
adr-patterns - key:
<adr-id> - value: 这一步支持对ADR进行语义搜索。
<title> — <first paragraph of Context section>
- namespace:
-
验证图表 -- 调用接口检索所有边并验证:
mcp__claude-flow__agentdb_causal-query- 无悬空引用(指向不存在的ADR的边)
- 无循环替代链
- 所有被替代的ADR状态均为"superseded"
-
生成报告 -- 输出总结信息:
## ADR索引总结 总ADR数量: N - 提议中: X - 已接受: Y - 已弃用: Z - 已被替代: W 关系数量: M条边 - 替代: A - 修订: B - 依赖于: C - 相关: D 发现的问题: (列出所有悬空引用或状态不匹配项)