---
title: "ruflo-adr"
url: "https://claudemods.dev/zh-cn/builds/ruflo-adr-41efff"
source: "https://github.com/ruvnet/ruflo/tree/main/plugins/ruflo-adr"
source_type: "github"
repo: "https://github.com/ruvnet/ruflo/tree/main/plugins/ruflo-adr"
author: "ruvnet"
author_handle: "ruvnet"
stars: 82516
category: "工作流与 CI"
categories: ["workflow"]
tags: ["adr", "agentdb", "architecture-decision-records", "claude-code-plugin", "compliance", "git-diff-scan", "guard", "hooks"]
permission_level: 2
scan_complete: true
install: "claude plugin marketplace add ruvnet/ruflo\nclaude plugin install ruflo-adr"
added: "2026-10-05T08:09:46.324Z"
updated: "2026-11-26T14:25:45Z"
locale: "zh-cn"
content_locale: "zh-cn"
---

# ruflo-adr

ADR 生命周期管理——创建、索引、协调、取代、检查合规性，并通过 AgentDB 层级存储和因果边（supersedes/amends/depends-on/related）将架构决策记录关联到代码

## Description

# ruflo-adr

## 概览

管理架构决策记录的完整生命周期（proposed、accepted、deprecated、superseded）。ADR 以 markdown 文件存储在 `docs/adr/` 中，并索引到 AgentDB；因果边会追踪 supersedes/amends/depends-on 关系。插件还会扫描 git diff 来检查合规性，并通过 `adr-reindex` 对从磁盘删除的 ADR（#2666）进行协调。

## 安装

```bash
claude --plugin-dir plugins/ruflo-adr
```

## Agents

| Agent | 模型 | 角色 |
|-------|------|------|
| `adr-architect` | sonnet | ADR 生命周期管理、通过 grep/blame 关联代码与 ADR、AgentDB 图存储 |

## Skills

| Skill | 用法 | 描述 |
|-------|------|------|
| `adr-create` | `/adr-create <title>` | 创建带有连续编号并注册到 AgentDB 的新 ADR |
| `adr-index` | `/adr-index` | 在 AgentDB 中构建或重建 ADR 索引和依赖图（只添加或更新——绝不移除） |
| `adr-review` | `/adr-review [--branch BRANCH]` | 根据已接受的 ADR 审查代码变更，检查合规性违规 |
| `adr-verify` | `/adr-verify` | 读回 adr-patterns + adr-edges 命名空间，显示悬空引用、取代循环和状态不一致；出现循环时退出码为 1 |
| `adr-reindex` | `/adr-reindex` | 协调一个**已删除**的 ADR 文件：根据当前磁盘内容删除并重建 adr-patterns + adr-edges |

## 命令（7 个子命令）

```bash
# 生命周期
adr create <title>
adr list
adr status <adr-id> <new-status>
adr supersede <old-id> <new-id>

# 合规性
adr check                    # 扫描最近的 git 变更，检查 ADR 违规
adr graph                    # 显示 ADR 依赖图
adr search <query>           # 在 ADR 中进行语义搜索
```

## ADR 生命周期

```
proposed --> accepted --> deprecated
                    \--> superseded by ADR-XXX
```

作为因果边追踪的关系：`supersedes`、`amends`、`depends-on`、`related`。

正文中的关系字段可以接受 `**Amends by scope**:` 或 `**Depends-on / confirms**:` 等限定词，`Relates` 是 `Related` 的别名。换行的列表可以继续写在只包含 ADR 引用（包括 Markdown 链接）和分隔符的行上。不会扫描叙述性续行；如需声明其他关系，请使用另一个加粗字段。

## 兼容性

- **CLI：** 固定使用 `@claude-flow/cli` v3.6 的 major+minor 版本。
- **验证：** `bash plugins/ruflo-adr/scripts/smoke.sh` 是契约。

## 命名空间协调

此插件拥有 `adr-patterns` AgentDB 命名空间。命名规则遵循 [ruflo-agentdb ADR-0001 `"命名空间约定"`](../ruflo-agentdb/docs/adrs/0001-agentdb-optimization.md)。保留命名空间（`pattern`、`claude-memories`、`default`）绝不能被覆盖。

`adr-patterns` 按照约定使用 kebab-case 的 `<plugin-stem>-<intent>` 形式。插件通过 `hooks_transfer`（位于 `ruflo-intelligence`）使用它进行 ADR 语义搜索和跨项目模式传输。

## 验证

```bash
bash plugins/ruflo-adr/scripts/smoke.sh
# 预期：“22 passed, 0 failed”
```

## 架构决策

- [`ADR-0001` —— ruflo-adr 插件契约（版本固定、命名空间协调、以 smoke 作为契约）](./docs/adrs/0001-adr-plugin-pattern.md)
- [`ADR-0002` —— 协调已删除的 ADR（硬删除原语 + 删除并重建 reindex）](./docs/adrs/0002-reconcile-deleted-adrs.md)

## 相关插件

- `ruflo-agentdb` —— 命名空间约定的所有者；ADR 图的后端存储
- `ruflo-ddd` —— 将领域决策记录为 ADR
- `ruflo-sparc` —— 架构阶段（Phase 3）产出 ADR
- `ruflo-migrations` —— 将架构变更决策记录为 ADR
- `ruflo-jujutsu` —— PR 上的 ADR 感知差异分析
- `ruflo-intelligence` —— `hooks_transfer` 将 ADR 模式传输到各个项目

## 许可证

MIT

## 作为 mod

ADR 还提供一个函数挂钩 mod（ADR-445 模式；挂钩位于 `hooks/`，随插件加载）。不使用网络、不生成进程，也不调用模型。

- **Guard（默认开启）：** 拒绝在 `adr*` 命名空间中写入（`agentdb_hierarchical-store`、`agentdb_causal-edge` 或 `memory_store`）且包含密钥、令牌或密码的 ADR。它只会收紧规则：绝不允许会话原本会拒绝的内容通过，并且拒绝时绝不会重复机密信息。使用 `guard` 选项关闭。
- **`/adr-mod`：** 在本地应答。`/adr-mod status`、`/adr-mod scan <text>`、`/adr-mod format`。
- **状态文件：** `.claude-flow/adr-mod/status.json`（`version`、`updatedMs`、计数器），在会话开始时以及每次拒绝调用时写入；主控台会读取它。
- **选项**（`userConfig`）：`guard`（默认开启）。

测试：`claude plugin validate plugins/ruflo-adr`、`claude plugin test plugins/ruflo-adr`，以及 `bash plugins/ruflo-adr/scripts/smoke.sh`。

## Install

```
claude plugin marketplace add ruvnet/ruflo
claude plugin install ruflo-adr
```

## Original README

# ruflo-adr

ADR lifecycle management -- create, index, reconcile, supersede, and link Architecture Decision Records to code.

## Overview

Manages Architecture Decision Records through their full lifecycle (proposed, accepted, deprecated, superseded). ADRs are stored as markdown files in `docs/adr/` and indexed in AgentDB with causal edges tracking supersedes/amends/depends-on relationships. Includes compliance checking that scans git diffs for ADR violations, and reconciliation (`adr-reindex`) for ADRs deleted from disk (#2666).

## Installation

```bash
claude --plugin-dir plugins/ruflo-adr
```

## Agents

| Agent | Model | Role |
|-------|-------|------|
| `adr-architect` | sonnet | ADR lifecycle management, code-ADR linking via grep/blame, AgentDB graph storage |

## Skills

| Skill | Usage | Description |
|-------|-------|-------------|
| `adr-create` | `/adr-create <title>` | Create a new ADR with sequential numbering and AgentDB registration |
| `adr-index` | `/adr-index` | Build or rebuild the ADR index and dependency graph in AgentDB (add/update only — never removes) |
| `adr-review` | `/adr-review [--branch BRANCH]` | Review code changes against accepted ADRs for compliance violations |
| `adr-verify` | `/adr-verify` | Read back adr-patterns + adr-edges namespaces, surface dangling refs / supersede cycles / status mismatches; exits 1 on cycles |
| `adr-reindex` | `/adr-reindex` | Reconcile a **deleted** ADR file: drop-and-rebuild adr-patterns + adr-edges from what's on disk right now |

## Commands (7 subcommands)

```bash
# Lifecycle
adr create <title>
adr list
adr status <adr-id> <new-status>
adr supersede <old-id> <new-id>

# Compliance
adr check                    # Scan recent git changes for ADR violations
adr graph                    # Show ADR dependency graph
adr search <query>           # Semantic search across ADRs
```

## ADR Lifecycle

```
proposed --> accepted --> deprecated
                    \--> superseded by ADR-XXX
```

Relationships tracked as causal edges: `supersedes`, `amends`, `depends-on`, `related`.

Body relationship fields accept qualifiers such as `**Amends by scope**:` or
`**Depends-on / confirms**:`, and `Relates` is an alias for `Related`. Wrapped
lists may continue on lines containing only ADR references (including Markdown
links) and separators. Narrative continuation is not scanned for relationships;
declare additional relationships in another bold field.

## Compatibility

- **CLI:** pinned to `@claude-flow/cli` v3.6 major+minor.
- **Verification:** `bash plugins/ruflo-adr/scripts/smoke.sh` is the contract.

## Namespace coordination

This plugin owns the `adr-patterns` AgentDB namespace. It defers to [ruflo-agentdb ADR-0001 §"Namespace convention"](../ruflo-agentdb/docs/adrs/0001-agentdb-optimization.md) for naming rules. Reserved namespaces (`pattern`, `claude-memories`, `default`) MUST NOT be shadowed.

`adr-patterns` follows kebab-case `<plugin-stem>-<intent>` per the convention. The plugin uses it for semantic ADR search and for cross-project pattern transfer (via `hooks_transfer` in `ruflo-intelligence`).

## Verification

```bash
bash plugins/ruflo-adr/scripts/smoke.sh
# Expected: "22 passed, 0 failed"
```

## Architecture Decisions

- [`ADR-0001` — ruflo-adr plugin contract (pinning, namespace coordination, smoke as contract)](./docs/adrs/0001-adr-plugin-pattern.md)
- [`ADR-0002` — Reconcile deleted ADRs (hard-delete primitive + drop-and-rebuild reindex)](./docs/adrs/0002-reconcile-deleted-adrs.md)

## Related Plugins

- `ruflo-agentdb` — namespace convention owner; backing store for the ADR graph
- `ruflo-ddd` — document domain decisions as ADRs
- `ruflo-sparc` — Architecture phase (Phase 3) produces ADRs
- `ruflo-migrations` — schema change decisions recorded as ADRs
- `ruflo-jujutsu` — ADR-aware diff analysis on PRs
- `ruflo-intelligence` — `hooks_transfer` ships ADR patterns across projects

## License

MIT

## As a mod

ADR also ships as a function-hook mod (ADR-445 pattern; hooks in `hooks/`, loaded with the plugin). No network, no process, no model call.

- **Guard (default on)**: refuses an ADR write (`agentdb_hierarchical-store`, `agentdb_causal-edge` or `memory_store` into an `adr*` namespace) that holds a key, token or password. It only tightens: it never allows anything the session would deny, and the refusal never repeats the secret. Turn it off with the `guard` option.
- **`/adr-mod`**: answered locally. `/adr-mod status`, `/adr-mod scan <text>`, `/adr-mod format`.
- **Status file**: `.claude-flow/adr-mod/status.json` (`version`, `updatedMs`, counters), written at session start and whenever a call is refused; the console reads it.
- **Options** (`userConfig`): `guard` (`on` by default).

Test: `claude plugin validate plugins/ruflo-adr`, `claude plugin test plugins/ruflo-adr`, and `bash plugins/ruflo-adr/scripts/smoke.sh`.
