adr-index

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

ADR Index

ADR索引

Build or rebuild the full ADR index and dependency graph in AgentDB from the
docs/adr/
directory.
docs/adr/
目录在AgentDB中构建或重建完整的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

步骤

  1. Scan directory --
    Glob
    for
    docs/adr/ADR-*.md
    to find all ADR files. If no files found, report that no ADRs exist yet.
  2. Parse each ADR --
    Read
    each file and extract:
    • ID: from the filename (e.g.,
      ADR-042
      from
      ADR-042-use-postgres.md
      )
    • Title: from the
      # ADR-NNN: <Title>
      heading
    • Status: from the
      **Status**:
      line
    • Date: from the
      **Date**:
      line
    • Tags: from the
      **Tags**:
      line
    • Links: from the
      ## Links
      section (supersedes, amended-by, related)
  3. Store in AgentDB -- For each ADR, call
    mcp__claude-flow__agentdb_hierarchical-store
    with:
    • path:
      adr/<adr-id>
    • value:
      { "id": "<id>", "title": "<title>", "status": "<status>", "date": "<date>", "tags": "<tags>", "file": "<filepath>" }
  4. Build causal edges -- For each ADR with links:
    • "Supersedes ADR-XXX" ->
      mcp__claude-flow__agentdb_causal-edge
      with
      from: ADR-XXX
      ,
      to: <current>
      ,
      relation: supersedes
    • "Amended by ADR-YYY" ->
      mcp__claude-flow__agentdb_causal-edge
      with
      from: <current>
      ,
      to: ADR-YYY
      ,
      relation: amends
    • "Related: ADR-ZZZ" ->
      mcp__claude-flow__agentdb_causal-edge
      with
      from: <current>
      ,
      to: ADR-ZZZ
      ,
      relation: related
    • "Depends on ADR-WWW" ->
      mcp__claude-flow__agentdb_causal-edge
      with
      from: <current>
      ,
      to: ADR-WWW
      ,
      relation: depends-on
  5. Store in memory -- For each ADR, call
    mcp__claude-flow__memory_store
    with:
    • namespace:
      adr-patterns
    • key:
      <adr-id>
    • value:
      <title> — <first paragraph of Context section>
      This enables semantic search across ADRs.
  6. Verify graph -- Call
    mcp__claude-flow__agentdb_causal-query
    to retrieve all edges and verify:
    • No dangling references (edges pointing to non-existent ADRs)
    • No circular supersedes chains
    • All superseded ADRs have status "superseded"
  7. 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)
  1. 扫描目录 -- 使用
    Glob
    查找
    docs/adr/ADR-*.md
    格式的所有ADR文件。如果未找到文件,报告当前尚无ADR存在。
  2. 解析每个ADR -- 读取每个文件并提取以下信息:
    • ID:从文件名中提取(例如,从
      ADR-042-use-postgres.md
      中提取
      ADR-042
    • 标题:从
      # ADR-NNN: <Title>
      标题行提取
    • 状态:从
      **Status**:
      行提取
    • 日期:从
      **Date**:
      行提取
    • 标签:从
      **Tags**:
      行提取
    • 链接:从
      ## Links
      部分提取(替代、修订、相关)
  3. 存储至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>" }
  4. 构建因果边 -- 针对每个包含链接的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-YYY
      ,
      relation: amends
    • "Related: ADR-ZZZ" -> 调用
      mcp__claude-flow__agentdb_causal-edge
      接口,参数
      from: <current>
      ,
      to: ADR-ZZZ
      ,
      relation: related
    • "Depends on ADR-WWW" -> 调用
      mcp__claude-flow__agentdb_causal-edge
      接口,参数
      from: <current>
      ,
      to: ADR-WWW
      ,
      relation: depends-on
  5. 存储至内存 -- 针对每个ADR,调用
    mcp__claude-flow__memory_store
    接口,参数如下:
    • namespace:
      adr-patterns
    • key:
      <adr-id>
    • value:
      <title> — <first paragraph of Context section>
      这一步支持对ADR进行语义搜索。
  6. 验证图表 -- 调用
    mcp__claude-flow__agentdb_causal-query
    接口检索所有边并验证:
    • 无悬空引用(指向不存在的ADR的边)
    • 无循环替代链
    • 所有被替代的ADR状态均为"superseded"
  7. 生成报告 -- 输出总结信息:
    ## ADR索引总结
    
    总ADR数量: N
    - 提议中: X
    - 已接受: Y
    - 已弃用: Z
    - 已被替代: W
    
    关系数量: M条边
    - 替代: A
    - 修订: B
    - 依赖于: C
    - 相关: D
    
    发现的问题: (列出所有悬空引用或状态不匹配项)