Skip to content

docs(adr): adopt MADR with structured front matter - #215

Merged
furedea merged 7 commits into
mainfrom
docs/adopt-madr-for-adrs
Nov 15, 2026
Merged

furedea merged 7 commits into
mainfrom
docs/adopt-madr-for-adrs

Conversation

@furedea-agent

@furedea-agent furedea-agent Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

概要

ADR の書式として MADR(minimal 版)を採用し,メタデータを YAML front matter に移す.

  • ADR-0025 を追加し,MADR 採用,却下した代替案,移行方針,検証の置き場所を記録した.
  • ADR-0001〜0024(ADR-0022 を含む) のメタデータを front matter に移した.本文(タイトル行,Y-Statement,各節)は,移したメタデータ行の削除を除いて変更していない.
  • adr スキルを書き直し,判断(Decision Test,既存 ADR の確認,記録する内容,書き方,非目標)だけを残した.機械的な手順は「テンプレートをコピーして埋める」に短縮した(873 語 / 158 行 → 416 語 / 49 行).
  • 公式 MADR minimal テンプレートを agents/skills/adr/references/template.md に取り込み,front matter と出典・ライセンスの 1 行を加えた.

チェック(markdownlint MD043,lychee,front matter 検査,本文不変の CI,Jev)は,このPRでは実装しない(ADR-0025 に置き場所だけ記録).

メタデータの対応で判断した箇所

固定した key(status, date, supersedes, superseded-by, partly-superseded-by, amended, related)以外は追加していない.

既存の行 front matter 備考
Status: Superseded by [ADR-0007](...)(ADR-0004) status: superseded と superseded-by: [ADR-0007] リンクは除去
Originally: furedea/dotfiles ADR-00NN(0001〜0011) related: [dotfiles/ADR-00NN] 他リポジトリの ID は dotfiles/ 接頭辞で区別
Originally: the command-guard paragraph of ... ADR-0026(0016) related: [dotfiles/ADR-0026, ADR-0015] と YAML コメント 段落由来である旨をコメントに保持
Historical sources: [implementation at eaeec4d](...)(0002) related の YAML コメントに URL 対応する key がないため
Supersedes: [dotfiles ADR-0016], [dotfiles ADR-0030](0012) supersedes: [dotfiles/ADR-0016, dotfiles/ADR-0030] と YAML コメントで URL を保持 他リポジトリの ID は dotfiles/ 接頭辞付きで同じ key に置く.将来の検査は接頭辞なしの ID だけを解決する(ADR-0025 に記載)
Refines: ADR-0009(0017, 0018),Refines: ADR-0018(0019) related と YAML コメント # refines
Related: [ADR-0013](...) (who supplies the token)(0008, 0011),Related: ... (what the guards judge)(0016) related と YAML コメントで括弧内の説明を保持
Amended: 2026-11-11 (the hook behaviour, ...)(0021) amended: ["2026-11-11: the hook behaviour, the two reviews, the Keychain"]
Partly superseded by: ADR-0021(0020) partly-superseded-by: [ADR-0021] 本文の Note は変更なし

注意

  • docs(adr): judge agent commands by their effect #198(ADR-0022)は main に入ったため,rebase して ADR-0022 のメタデータも移した.Refines: ADR-0009, ADR-0006, ADR-0015 と Amended with: ADR-0021 (...)(ADR-0022 が ADR-0021 を修正する向き)は,related: [ADR-0009, ADR-0006, ADR-0015, ADR-0021] と YAML コメント(refines / amends ADR-0021 の説明)にした.amended は ADR 自身の変更履歴なので使っていない.
  • ADR-0025 とした(0022〜0024 は main にある).
  • ファイル名の変更,本文の MADR 節への変換,チェッカーや CI は範囲外.

Refs #169

🤖 Generated with Claude Code

@furedea

furedea commented Nov 15, 2026

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T15:35:25.413575Z 00d4ffb Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Comment thread agents/skills/adr/SKILL.md Outdated
Comment on lines +12 to +36
Record a broad decision in `docs/adr/` in the same task that makes it. ADRs follow [MADR](https://github.com/adr/madr)
(ADR-0025); `tsdd` owns the tests, this skill owns the rationale.

## Decision Test

Before writing an ADR, ask:

1. Would a future maintainer ask "why this approach instead of the obvious alternative?"
2. Does the Why span multiple files, components, workflows, or future changes?
3. Were meaningful alternatives considered or rejected?
4. Would an inline comment either be too narrow or need to be repeated in several places?

Use these questions to assess significance, not as independent automatic triggers. Create an ADR
for a broad decision that constrains future changes, affects multiple components or workflows, or
is costly to reverse. Merely considering alternatives does not require an ADR for a local,
easily reversible implementation choice; prefer code, tests, or a local comment in that case.

## Repository Inspection

Before creating or changing ADRs:

1. Check whether `docs/adr/` exists.
2. Read existing ADR titles and metadata before choosing a new decision.
3. Search existing ADRs for the topic, chosen option, and rejected alternatives.
4. If an existing ADR already covers the decision, update code/tests to follow it instead of writing a duplicate.
5. If the new decision reverses or materially changes an old one, write a new ADR and mark the old one as superseded.

Use `rg --files docs/adr` and targeted `rg` searches when available.

## File Layout

Store ADRs here:

```text
docs/
└── adr/
├── 0001_record_architecture_decisions.md
├── 0002_<decision_snake_case>.md
└── 0003_<decision_snake_case>.md
```

Rules:

- Use one decision per file.
- Use sequential four-digit IDs.
- Never reuse an ID.
- Never delete old ADRs to hide history.
- Follow existing repository naming conventions. Otherwise use underscores between the ID and
decision words, as shown above. Do not rename existing ADRs solely to normalize filenames.
- Create `docs/adr/` if it does not exist.
- If the repository has no ADRs yet and the task adopts ADRs as a practice, create `0001_record_architecture_decisions.md` first.

## Status Rules

Allowed status values:

- `Proposed`
- `Accepted`
- `Superseded`
- `Deprecated`

Default to `Accepted` when the decision is implemented in the same change. Use `Proposed` only when the user asked for a proposal or no implementation change is being made.
Write an ADR when a future maintainer would ask "why this approach instead of the obvious alternative?" and the Why
spans several files, components, or future changes, or is costly to reverse. Considering alternatives alone does not
justify one for a local, easily reversible choice; use code, tests, or a comment.

Past ADRs are immutable except for metadata status changes. Do not rewrite the body of an accepted ADR to make it match a new decision.
## Inspect First

When reversing a decision:
1. Read the titles and front matter of the existing ADRs, then search them for the topic, the chosen option, and the
rejected alternatives.
2. If an ADR already covers the decision, make the code follow it instead of writing a duplicate.
3. If the decision reverses or materially changes an accepted ADR, write a new one that supersedes it.

1. Create a new ADR with the next sequential ID.
2. Add `- Supersedes: ADR-NNNN` to the new ADR metadata.
3. Change the old ADR status to `Superseded`.
4. Keep both ADRs in the same commit or change set.
## Write

## Preferred Template

Use the Y-Statement form by default:

```markdown
# ADR-NNNN: <Decision title>

- Status: Accepted
- Date: YYYY-MM-DD

In the context of <use case or situation>, facing <concern or forcing function>, we decided for <chosen option> and against <alternatives considered>, to achieve <quality or benefit gained>, accepting <downside or cost incurred>.
```

For superseding ADRs:

```markdown
# ADR-NNNN: <Decision title>

- Status: Accepted
- Date: YYYY-MM-DD
- Supersedes: ADR-0003

In the context of <use case or situation>, facing <concern or forcing function>, we decided for <chosen option> and against <alternatives considered>, to achieve <quality or benefit gained>, accepting <downside or cost incurred>.
```

Use the longer template only when a Y-Statement would be too compressed:

```markdown
# ADR-NNNN: <Decision title>

- Status: Accepted
- Date: YYYY-MM-DD

## Context

## Decision

## Alternatives Considered

## Consequences
```
1. Copy [references/template.md](references/template.md) to `docs/adr/NNNN_words.md`: NNNN is the highest existing ID
plus one (never reuse an ID), and the words are underscore-separated, as in the existing files. The ID comes from
the file name.
2. Fill the front matter. Use `accepted` when the decision is implemented in the same change, `proposed` when it is
not. The title line is `# <short title>` without an ID.
3. Fill the template. Add MADR's full-variant sections only when the minimal ones are too compressed.
4. To supersede, set `supersedes` in the new ADR and `status: superseded` plus `superseded-by` in the old one, in the

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This skill is rendered into the global ~/.claude / ~/.codex (see README), so agents use it in every repository, not just this one. The rewrite now assumes this repo's conventions everywhere:

  • It points to ADR-0025, which exists only in agent-config.
  • It dropped "Follow existing repository naming conventions", "Create docs/adr/ if it does not exist", and the bootstrap rule for repos with no ADRs yet.
  • Step 1 ("highest existing ID plus one", "as in the existing files") gives no guidance when docs/adr/ is empty or missing.
  • Step 4 tells the agent to add status: superseded / superseded-by front matter to the old ADR. In any repo that still uses - Status: bullets or Nygard/other formats, that mixes two formats in one file.

Suggest keeping a short rule: follow the target repo's existing ADR format and naming, use MADR plus this front matter only when the repo has no ADRs or has already adopted it, and create docs/adr/ when needed.

---
status: accepted
date: 2026-10-24
related: [dotfiles/ADR-0016, dotfiles/ADR-0030] # both superseded by this ADR (other repository)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The old Supersedes: line linked to the two dotfiles ADRs (0016_own_personal_agent_source.md, 0030_bootstrap_the_agent_harness_on_servers_without_nix.md). Those URLs are now gone, and a bare dotfiles/ADR-0016 can't be resolved without searching the other repo. For ADR-0002 you kept the historical URL in a YAML comment; doing the same here would keep the provenance links.

@github-actions

Copy link
Copy Markdown

Review summary

No blocking findings (0 × P0/P1).

  • P2: agents/skills/adr/SKILL.md is a global skill, rendered into ~/.claude and ~/.codex. The rewrite points to ADR-0025, which exists only in this repo. It also drops the rules to follow each repo's existing ADR conventions and to create docs/adr/ or a first ADR. In other repos, agents would put MADR front matter into ADRs written in other formats.
  • P3: ADR-0012 lost the URLs to the dotfiles ADRs it superseded. Keep them in a YAML comment, as ADR-0002 does.

Checked:

  • Supersession links match in both directions (0002↔0003, 0004↔0007, 0007↔0009).
  • Each body changes only by having its metadata lines removed.
  • No code, tests, or lint config in the repo read the old - Status: metadata, so the front-matter change breaks nothing.
  • No tests are expected, since this PR changes only docs and the skill.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: de44162251

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +32 to +33
<!-- This is an optional element. Feel free to remove. -->
### Consequences

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Consequences を必須としてテンプレートに反映して

agents/skills/adr/SKILL.md は受け入れるトレードオフを Consequences に記録するよう要求していますが,コピー元のテンプレートはこの節を削除可能と明記しています.エージェントがテンプレートの指示どおりに節を削除すると,新しい ADR から必須のトレードオフが欠落するため,この optional 表記を削除するか,省略可能な範囲を明確にしてください.

Useful? React with 👍 / 👎.

@furedea

furedea commented Nov 15, 2026

Copy link
Copy Markdown
Owner

@codex review

# related: [ADR-NNNN] # optional
# decision-makers, consulted, informed: optional MADR keys
---

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 The source/license comment sits in the body of the template, and SKILL.md step 1 says to copy this file to docs/adr/NNNN_words.md. Steps 2–3 never say to delete the comment, so every new ADR will likely carry "the front matter above is this user's, and Consequences is required here…", which is about the template, not the decision. Consider either moving the attribution outside the copied content (for example, a note in SKILL.md or a sibling README) or adding "remove the source comment" to step 3.

@github-actions

Copy link
Copy Markdown

Review summary

Blocking findings: 0 (P0: 0, P1: 0, P2: 0, P3: 1)

What I checked:

  • The metadata in ADR-0001 to ADR-0024 moved into front matter correctly. Status, date, and supersession pairs agree in both directions (0002↔0003, 0004↔0007, 0007↔0009). Under each title line, the body is unchanged apart from the removed metadata lines.
  • Nothing in the repository parses the old - Status: / - Supersedes: lines: no tests, hooks, or CI jobs read them. So the format change breaks no tooling.
  • The relative link references/template.md in adr/SKILL.md resolves, so tests/test_workflow_skill_layout.py link checks should pass. The new file names satisfy .ls-lint.yml.

Finding:

  • P3 agents/skills/adr/references/template.md: the source/license HTML comment will be copied into every new ADR, because the skill says to copy the template and never says to remove the comment.

Not verified: the external agent-harness generate-skills renderer. I couldn't confirm how it handles a reference file that starts with its own YAML front matter. The integration rendering tests should show that.

No tests are expected for this PR, since it only changes docs and skill prose. ADR-0025 records that the checks will be added in later changes.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fc752bfeed

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +32 to +36
1. Copy [references/template.md](references/template.md) to `docs/adr/NNNN_words.md`: NNNN is the highest existing ID
plus one (`0001` in an empty directory; never reuse an ID), and the words are underscore-separated unless the
existing files differ. The ID comes from the file name.
2. Fill the front matter. Use `accepted` when the decision is implemented in the same change, `proposed` when it is
not. The title line is `# <short title>` without an ID.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 既存 ADR の形式を Write 手順でも尊重して

MADR 以外の ADR が既にあるリポジトリでは 13~15 行目が既存形式・命名・status 値に従うよう求めていますが,この手順は無条件に同梱 MADR テンプレートのコピー,YAML front matter,小文字の accepted / proposed,ID なしタイトルを指示しています.そのため,例えば Nygard 形式や大文字 status を採用済みのリポジトリで新規 ADR を作ると,明示した互換方針に反して形式が混在します.この Write 手順を「ADR がないか既存形式が MADR の場合」に限定し,それ以外は既存テンプレートを使う分岐を示してください.

AGENTS.md reference: agents/AGENTS.md:L13-L15

Useful? React with 👍 / 👎.

@furedea

furedea commented Nov 15, 2026

Copy link
Copy Markdown
Owner

@codex review

`NNNN_words.md` convention. MADR's `decision-makers`, `consulted`, and `informed` may be used in new ADRs.
* New ADRs start from the vendored minimal template in `agents/skills/adr/references/template.md` and use the title
line `# <short title>` without an ID. The full-variant sections are added only when needed.
* Existing ADRs keep their bodies byte for byte; only their metadata moved into front matter. Lines that fit no key

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: ADR-0022 (docs/adr/0022_judge_agent_commands_by_their_effect.md, from #198) has now landed on main, and this PR doesn't migrate it. After the merge it still uses the bulleted - Status: Accepted / - Refines: / - Amended with: block, so this line ("Existing ADRs … only their metadata moved into front matter") will be false for one ADR. The front-matter check this ADR plans will fail on it as soon as it's added. The PR description says #198 isn't on main yet, but that's no longer true. Please rebase and convert 0022 the same way: related: [ADR-0009, ADR-0006, ADR-0015] # refines, plus an amended or related entry for the ADR-0021 note.

@github-actions

Copy link
Copy Markdown

Review summary (read-only)

No blocking findings (P0/P1: 0).

  • P2: ADR-0022 (from docs(adr): judge agent commands by their effect #198) is now on main, and this PR leaves it with the old bulleted metadata. That contradicts ADR-0025's statement that all existing ADRs moved their metadata to front matter. Please rebase and convert it (see the inline comment).

What I checked:

  • ADR-0001–0021, 0023 and 0024: only the metadata lines changed, and the bodies are untouched. Status values and the supersedes/superseded-by pairs match (0002↔0003, 0004↔0007, 0007↔0009).
  • The YAML front matter looks well-formed, including the inline comments and the amended list.
  • No code, test or lefthook hook parses ADR metadata, so moving to front matter breaks no tooling. This PR has no executable changes, so it needs no tests.

🤖 Generated with Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: e9212ee348

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

furedea and others added 4 commits November 16, 2026 00:16
Add ADR-0025, move the metadata of ADR-0001 to ADR-0024 into YAML front
matter without changing their bodies, and rewrite the adr skill around the
vendored MADR minimal template.

Refs #169

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@furedea-agent
furedea-agent Bot force-pushed the docs/adopt-madr-for-adrs branch from e9212ee to fb0babc Compare November 15, 2026 15:17
@furedea

furedea commented Nov 15, 2026

Copy link
Copy Markdown
Owner

@codex review

@github-actions

Copy link
Copy Markdown

Review summary

No blocking findings (P0: 0, P1: 0, P2: 0, P3: 0).

What I checked:

  • Metadata migration in ADR-0001 to ADR-0024: each diff only moves the old bullet metadata into front matter. Titles and bodies are unchanged. The supersession pairs agree in both directions (0002↔0003, 0004↔0007, 0007↔0009), and ADR-0020's partly-superseded-by fits the 'superseded-by exactly when superseded' rule in ADR-0025.
  • Front-matter syntax: I read every block by eye, but did not run a YAML parser because that command needed approval. Inline # comments come after the flow sequences, the URLs in comments contain no #, and the amended entries that contain : are quoted.
  • Skill and template: agents/skills/adr/references/template.md follows the references/ layout other skills already use. The relative link from SKILL.md resolves, so test_skill_relative_links_resolve_to_existing_files_and_headings should still pass. I did not run the test suite.
  • Downstream consumers: nothing outside docs/adr/ reads the old - Status: lines. README, DESIGN, and CONTRIBUTING link to ADR files by path, and no file was renamed.
  • Tests: no executable behaviour changes. ADR-0025 says the front-matter, MD043, lychee, and body-immutability checks will come in later changes, so I am not flagging missing tests here.

🤖 Generated with Claude Code

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fb0babc848

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

---
status: accepted
date: 2026-10-24
related: [dotfiles/ADR-0016, dotfiles/ADR-0030] # both superseded by this ADR (other repository): https://github.com/furedea/dotfiles/blob/main/docs/adr/0016_own_personal_agent_source.md, https://github.com/furedea/dotfiles/blob/main/docs/adr/0030_bootstrap_the_agent_harness_on_servers_without_nix.md

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 外部 ADR の supersedes 関係を related に落とさないで

この移行では,元の Supersedes メタデータが related に変換されているため,front matter を読むツールからは ADR-0012 が外部の 2 ADR を置き換えた事実を識別できません.その意味は YAML コメントにしか残っておらず,パーサーでは破棄されます.構造化メタデータへの移行時にも supersedes(または外部 ADR 用の同等フィールド)として関係を保持してください.

Useful? React with 👍 / 👎.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@furedea

furedea commented Nov 15, 2026

Copy link
Copy Markdown
Owner

@codex review

Comment on lines +4 to +6
amended:
- "2026-11-14: ADR-0021 (static ast-grep rules block; amendment in a separate change)"
related: [ADR-0009, ADR-0006, ADR-0015, ADR-0021] # refines ADR-0009, ADR-0006, ADR-0015; ADR-0021 amends

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This migration gets the direction of the ADR-0021 relationship backwards. The original line was Amended with: ADR-0021 (static ast-grep rules block; amendment in a separate change), and the body agrees (line ~53: "it reverses the advice-only reading in ADR-0021"). So ADR-0022 is the ADR that amends ADR-0021. The new metadata says the opposite in two places:

  • The related comment reads ADR-0021 amends, which says ADR-0021 amends this ADR.
  • ADR-0025 defines amended as "a list of YYYY-MM-DD: what changed" in the ADR itself. Putting this entry under amended therefore says ADR-0022 was changed on 2026-11-14. That never happened; the date is filled in from ADR-0022's own date.

A later front-matter check, or a reader looking for which ADRs changed after acceptance, would get this wrong. One option is to drop the amended entry and keep the relationship as a comment only, e.g. related: [ADR-0009, ADR-0006, ADR-0015, ADR-0021] # refines ADR-0009, ADR-0006, ADR-0015; amends ADR-0021 (static ast-grep rules block; amendment in a separate change).

@github-actions

Copy link
Copy Markdown

Review summary (read-only)

This PR changes only docs and the skill text. I found no P0 or P1 issues.

  • I checked how the metadata moved into front matter in ADR-0001 to ADR-0024. Only the metadata lines changed; the bodies are as they were. The supersession pairs agree in both directions: 0002↔0003, 0004↔0007, and 0007↔0009. The dotfiles/ prefix is used the same way throughout. The change also merges cleanly with ADR-0021 as edited in docs(adr): record which rules ast-grep may block #214.
  • No code or test parses the old - Status: style metadata, so moving it into front matter breaks nothing.
  • P2 (inline comment): in ADR-0022, the relationship with ADR-0021 is recorded the wrong way round. The ADR is listed as amended with a date that never happened, and the comment says "ADR-0021 amends". In fact ADR-0022 is the ADR that amends ADR-0021.

The front-matter schema has no check yet. ADR-0025 says this on purpose, so I am not counting it as a missing-test finding.

🤖 Generated with Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 9d859b445e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@furedea

furedea commented Nov 15, 2026

Copy link
Copy Markdown
Owner

@codex review

@github-actions

Copy link
Copy Markdown

Review summary

No P0–P3 findings.

What I checked:

  • ADR bodies: every hunk in docs/adr/0001–0024 touches only the old metadata block and the title's position. The title lines and all body text are unchanged, as the PR claims.
  • Supersession links agree both ways: 0002↔0003, 0004↔0007, 0007↔0009. 0020 is partly-superseded-by 0021.
  • Front matter is valid YAML: the inline # comments, the flow sequences with dotfiles/ prefixes, and the quoted amended entry in 0021 all parse. So do the commented-out keys in references/template.md.
  • Nothing reads the old format: no tests, hooks or scripts parse the - Status: / Supersedes: metadata lines, so the move breaks nothing. references/template.md passes the .ls-lint.yml naming rules, and other skills already use references/ directories.
  • Tests: the PR adds no automated checks for the new front-matter rules (ID uniqueness, supersession consistency, accepted bodies staying unchanged). ADR-0025 defers them to later changes on purpose, so I did not raise this as a finding.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1c21a2fb4e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread agents/skills/adr/SKILL.md Outdated
## Inspect First

When reversing a decision:
1. Read the titles and front matter of the existing ADRs, then search them for the topic, the chosen option, and the

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 検査でも既存 ADR のメタデータ形式に従って

既存 ADR が Nygard 形式や従来の Y-Statement 形式など front matter を使わないリポジトリでも,この手順は front matter を読むよう固定されています.その場合,箇条書きなどに記録された status や supersession を確認対象から外し,重複 ADR の作成や誤った supersession につながるため,Write 節と同様に「既存形式のタイトルとメタデータを読む」としてください.

AGENTS.md reference: agents/AGENTS.md:L13-L15

Useful? React with 👍 / 👎.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@furedea

furedea commented Nov 15, 2026

Copy link
Copy Markdown
Owner

@codex review

@github-actions

Copy link
Copy Markdown

Review summary (read-only): no findings.

I checked:

  • All 24 migrated ADRs keep the same status and date, and only their metadata lines changed.
  • Supersession links agree in both directions: 0002↔0003, 0004↔0007, 0007↔0009.
  • Cross-repository IDs carry the dotfiles/ prefix as ADR-0025 describes.
  • The front matter in every file is valid YAML, including the quoted amended entry in ADR-0021 and the trailing comments.
  • The new references/template.md link resolves for the skill link-integrity test.
  • Nothing else in the repo (scripts, tests, CI) parses the old - Status: bullet format, so moving to front matter breaks no consumer.

There are no tests for the front-matter format. ADR-0025 defers those checks to later changes on purpose, so I'm not raising that as a finding.

Blocking findings (P0/P1): 0.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 00d4ffb0cc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@furedea
furedea merged commit 03f2ba2 into main Nov 15, 2026
27 checks passed
@furedea
furedea deleted the docs/adopt-madr-for-adrs branch November 15, 2026 15:59
furedea added a commit that referenced this pull request Nov 16, 2026
…ore (#203)

Refs #74


計画:#74 (comment)

## マージ順序

言語ごとの規則の PR(#190〜#195)と #202 はすべてマージ済み.この PR は origin/main(1919b066)に
rebase してある.main にある `severity: error` の規則 28 件は,すべて規則テストの対象で,`note`
を持っている.追加した note は無い.

この PR が入ると,`severity: error` の static rule はすべて編集をブロックする.また,error の規則には
`note`(修正方法)が必須になる.

### rebase で解決したコンフリクト

- 1 回目(#190,#202,#205,#208 の後):ブランチのコミットごとに同じ関数で衝突したため,1 コミットにまとめてから
rebase した(squash merge なので結果は同じ).
- `agents/hooks/lib/static_rule_scan.py`:#202 の「設定ごとの基準ディレクトリから repo
相対パスで走査する」(`scan_root`,`cwd=root`,`--`)と,この PR の `Report`(error と advice
の分離),`note` の表示,信頼判定を両方残した.
- #202 の,git の無いプロジェクトでマニフェストのディレクトリを基準にするフォールバックと,そのテストは削除した.ユーザーの決定
(a) により共有規則は信頼できるリポジトリの中でしか走らないので,このフォールバックには到達しない.
- `tests/test_ast_grep_rules.py`:#190 の「error の規則は note を持つ」テストが,この PR の
`NOTE_PATTERN` を同名で上書きしていた.#190 の規則ごとのテストを残し,この PR の判定(空のブロック note
も検出する)を使うようにした.
    - `checkout_of` フィクスチャを `tests/conftest.py` に移した.
- 最新(#214,#215,#217,#218 の後):#215 で ADR が MADR の front matter
形式になったので,この PR の改訂日を front matter の `amended` に加えた.#214 が ADR-0021
に足した「Which rules ast-grep may block」の節は,この PR の改訂と矛盾しない.
- 2 回目以降(#191〜#195,#198,#199,#212 の後):テキストのコンフリクトは無かった.#194 で YAML
の規則が入ったので,「規則の言語はすべて抑制ガードの対象」というテストに yaml を加えた.YAML の `ast-grep-ignore`
はもともと検査している.

## 概要

ユーザーの決定:static(ast-grep)規則は,linter のエラーと同じくブロックする.advisory
の段階は設けず,規則は「有効(`severity:
error`,ブロックする)」か「削除」のどちらかとする.まれな正当な例外は,理由を書いた抑制コメントで扱う.抑制コメントはエージェントが勝手に追加してはならず,ユーザーが承認する.

- **ADR-0021 の改訂**(`docs/adr/0021_*.md`)
- static rule は編集時にブロックする.「advisory で始めて昇格する」経路は削除した.jev-lint の model
rule は変えていない.
    - 共有規則は所有者のスタイルなので,信頼できるオーナーのリポジトリでだけ動かす(「Whose style」).
    - error の規則は `note` に修正方法を持つ.抑制ガードはすべてのプロバイダで動く.
-
**ブロック**(`agents/hooks/lint_format.py`,`agents/hooks/lib/static_rule_scan.py`)
- ast-grep が `severity: error` の指摘を返したら,PostToolUse の `{"decision":
"block", "reason": ...}` を返す.
- reason には指摘ごとに,規則 ID,場所,規則の `message`(なぜ誤りか),`note`(`Fix:`
として修正方法)を並べる.その後に 1 回だけ次の指示文を続ける:「Fix the code as shown. Do not move or
split the code to avoid the rule; if a real exception is needed, add a
suppression comment, which is reviewed.」
- error,指示文,advice の順に並べ,全体を 1
つのサイズ上限(`NOTIFICATION_LIMIT_BYTES`)に収める.advice は残りに収まる分だけ入れる.
- error 未満の指摘,linter
の診断,走査の失敗はブロックせず,従来どおり通知する.壊れた走査でエージェントを止めないため.出力が切り詰められても,終了コード 1(error
あり)ならブロックする.
- dsh は PostToolUse で `systemMessage` を読むので,ブロック時は同じ文を `systemMessage`
にも入れる(プロバイダのプロファイルがブロックの形式も決める).
- **共有規則は信頼できるオーナーのリポジトリでだけ動かす**(`static_rule_scan.py`)
- 共有規則(`agents/hooks/lint/sgconfig.yml`)は,チェックアウトの origin のオーナーを
`trusted_owners` が信頼している場合にだけ走る(`AGENT_TRUSTED_OWNERS` も同様).
- 判定するのはオーナーだけ.fork かどうかは問わない.fork かどうかは model rule
が何を読めるかに関わることで,誰のスタイルを当てるかには関わらない.問い合わせをしないので,オフラインでも編集のたびに待たされず,オーナー自身のリポジトリで規則が知らせずに止まることもない.
- それ以外のリポジトリ,リポジトリ外,origin が無い,trusted_owners
ファイルが読めない場合は,共有規則を走らせない.プロジェクト自身の `sgconfig.yml` の規則は,従来どおりどこでも走る.
-
**抑制ガード**(`agents/hooks/guard_suppression.py`,`agents/hooks/lib/comment_nodes.py`,`agents/hooks/lib/patch_input.py`)
- `ast-grep-ignore` と Go の `//nolint` を対象に加えた.`ast-grep-ignore` は
`.go`,YAML,Nix でも検査する.
- **コメントかどうかは ast-grep 自身(tree-sitter)に判定させる**.`ast-grep scan --stdin`
で言語ごとのコメントノードを探す.ブロックコメント,複数行文字列,YAML のブロックスカラー,Rust の raw
string,ヒアドキュメント,JS の `<!--` コメントを正しく扱える.
- 以前は言語ごとに手書きの字句解析をしていたが,文字列の形式を見落とす指摘が続いたため置き換えた.対象の拡張子はすべて ast-grep
が解析できる.
- ast-grep
は,走査するテキスト中の抑制をこの走査自体にも当てはめ,マーカーの下のコメントを隠す.そこで,語を同じ長さの別の語に置き換えてから走査する.設定は空の
`sgconfig.yml` を明示的に渡し,プロジェクトや親ディレクトリの設定は読まない.
    - マーカーは件数ではなく,「効く位置にあるか」と「指示と対象の規則」の組で比べる.1 行にある複数のマーカーは,すべて照合する.
- 範囲は,マーカーからコメントの終わりまで(Rust
の属性は閉じ括弧まで,複数行でも)とする.その中で比べるのは,指示と規則の一覧だけ.たとえば `nolint` は linter
の一覧,`noqa` はコード,eslint は `--` の前まで,biome はコロンの前まで,Rust の属性は `reason =
"..."` を除いた部分.理由文の誤字を直すだけなら通る.`ast-grep-ignore`
は,マーカーの後ろの語をすべて規則名として読むので,コメント全体で比べる.
- Rust
の属性の閉じ括弧は,文字列とコメントの中の括弧を数えずに探す.閉じていない属性はファイルの終わりまでを範囲とする.範囲は,同じ種類の次のマーカーの手前で止める(コメントの中のマーカーで,属性の範囲は切らない).
- 判定の時間はファイルの大きさに比例する(行とノードは二分探索,括弧は 1 回の走査).マーカーが 2 万個のファイルでも 1 秒未満.
- そのため,`//nolint:errcheck` を `//nolint` や `//nolint:govet`
に変えるなど,対象の規則を減らす・変える・加える変更は,新しいマーカーと同じく確認する.`noqa` のコード,`type: ignore`
のコード,eslint の規則(複数行のブロックコメントも),`allow` / `expect` の lint,shellcheck
のコードも同じ.
- 規則名を書かない `ast-grep-ignore`
はすべての規則を抑制するので,規則名の変更も確認する.文字列をコメントに変える変更(同じ行でも,前後の行の変更でも)も確認する.
        - マーカーの移動や削除,マーカーの横のコードの編集は通る.
- ast-grep の走査は,1 回の判定の中で 20 秒の期限を共有する(フックの上限は 30
秒).期限は判定の開始時に決まる.期限で打ち切った走査があれば,コメントが不明なので確認する.
-
ファイル全体で比べるときは,コメントの外の語は数えない(文字列は何も抑制しない).文脈の無い断片(完全一致しないハンクなど)では,コメントの中に入るかどうかを判断できないので,すべてのマーカーをどこにあっても数える.
    - 相対パスは,payload の `cwd`(プロバイダがツールを実行するディレクトリ)を基準に読む.
- Rust の `#[allow(...)]` / `#[expect(...)]` は,Rust
の文字列とコメントの中以外なら数える.マクロ本体の中も数える(展開されると効くため).Rust 以外のファイルでは数えない.
    - ast-grep が無いか失敗したときは,コメントかどうかを判定できない.その場合は次の 2 つを確認する.
        - マーカーのある行が新しく現れた場合.行頭のインデントも比べる(YAML のブロックスカラーから外す変更など).
- マーカーを含むテキストで,変更した行に文字列やコメントの区切り(引用符,`/*`,`-->` と `--!>`,`<<`,YAML の
`|` など)がある場合.
- シェルスクリプトで,マーカーと `<<` を含むテキストの行を変えた場合(heredoc
の終端は記号を持たない語なので,行からは見分けられない).
        - それ以外の,抑制とは関係のない編集は通す.
        - 残る抜け道:ast-grep が無い環境で,区切りを含まない行の変更でマーカーがコメントに変わる場合は検出できない.
- Edit / MultiEdit / エディタの `insert` / Write
は,ファイル全体に適用した前後で比べる(replace_all,行の一部の編集,MultiEdit
の後続の手順も含む).エディタ系ツールのフィールド(`old_str`,`new_str`,`file_text`)も読む.置換がファイルに当てはまらないときは,マーカーを含むファイルなら確認する.
    - apply_patch
- すべてのハンクが既存ファイルに完全一致するなら,適用後のファイル全体で比べる.適用器はまず完全一致を探すので,同じ位置に当たる.
            - Add File は新しい内容そのもので比べる.
            - ハンク中の空行は空の文脈行として扱う.
            - ヘッダ行は前後の空白を除いて読む.
        - 次の場合は位置を判定できないので,マーカーを含むファイルなら確認する.
- 完全一致しないハンク,`*** End of File` のチャンク,解釈できない行,完全一致が 2 か所以上ある場合.
- 同じファイルに 2 回届くパッチは確認する.セクションの重複でも,`Move to:` の移動先でも,別の綴りや大文字小文字の違いでも同じ.
- `Move to:` は移動元と移動先の両方で判定する.移動先で初めて効くマーカーがあれば,それ自体を新しい抑制として確認する.
- 該当するのは,移動元では検査しない拡張子のマーカーと,移動先の文法でだけコメント(または Rust の属性)になるマーカー.
- 判定には,パッチを当てた後の内容を使う(再構築できないときは既存の内容).同じパッチでマーカーを消してから移動するなら通る.
            - `.py` から `.go` のような単なる移動は通る.
- ファイル単位の抑制:ast-grep は,1
行目のマーカーの直後に空行があるとファイル全体を抑制する.この状態になる編集や,この状態のマーカーを変える編集は確認する.1
行目のマーカーは,コメントノードの中にあるときだけ数える(1 行目が `MARKER = "ast-grep-ignore"`
のような文字列なら数えない).
    - 拡張子は小文字にして比べる.行の区切りは ast-grep と同じく改行だけとする.
- **プロバイダへの配線**(`agents/hooks.json`)
    - Devin,Hermes,pi,dsh の編集前フックに `content suppression` を加えた.
    - これらのプロバイダは確認を求められないので,新しい抑制はブロックされる.ユーザーが例外を追加する前提で,意図した挙動.
- **規則テスト**(`tests/test_ast_grep_rules.py`):`severity: error` で `note`
の無い規則があると失敗する.

## ユーザーの決定

- 第三者のリポジトリ:案
(a).共有規則は信頼できるオーナーのリポジトリでだけ走らせてブロックし,それ以外では走らせない.リポジトリ自身の規則は従来どおり.
- 抑制ガードを Devin,Hermes,pi,dsh にも配線し,そこでは新しい抑制をブロックする.Go の `//nolint`
も対象にした.
- ブロックメッセージ:指摘ごとの規則 ID,場所,message,note と,回避を禁じる指示文 1 回.note の無い error
規則は規則テストで落とす.
- レビューの指摘は別の Issue に回さず,この PR で直す.
- やらないこと:回避を検出する jev-lint 規則と,回避コストに関する ADR の基準.

## 文章と規則の対応表

| 規則 ID | 元の場所 | 元の規則(原文) | 判定 | 実装 | 例のテスト | 元の文章 |
| -------- | -------- | ---------------- | ---- |
------------------------------------------------------ | ---------- |
-------- |
| (なし) | — | — | — | hook と ADR の変更のみで,文章を規則に置き換えていない | — | — |

## 戻し方

static rule のブロックだけを止める環境変数のスイッチは無い(`AGENT_MODEL_RULES` は model rule
用で,static rule には効かない).戻すにはこの PR を revert する(squash merge の 1
コミット).急ぐ場合は,問題の規則の `severity` を `warning` に下げれば,その規則だけ従来の非ブロックの通知に戻る.ただし
ADR の「有効か削除か」に反するので,一時的な措置に限る.

## 検証

- `REQUIRE_AST_GREP=1 REQUIRE_JEV_LINT=1 uv run pytest
--cov`(b13175e9,CI と同じ設定):5357 passed,1 skipped.以前手元でだけ落ちていた model rule
のテストも,main の #218 の後は通る.
- `ruff check`,`ruff format --check`,`ty
check`,`ls-lint`,ファイル行数(pre-commit):通過.
- 追加・更新したテストは,各項目とも実装前に失敗することを確認した.
-
ブロック(`tests/hooks/test_static_rules.py`,`tests/hooks/test_lint_format.py`)
        - error でブロックし,reason は指摘と指示文 1 回で,全体が上限に収まる.
        - 実際の ast-grep でもブロックする.問題のないファイルと,規則の対象外の言語はブロックしない.
        - 異常終了した走査はブロックしない.切り詰められても,終了コード 1 ならブロックする.
        - Codex と dsh のアダプタ経由でもブロックする.
    - 信頼判定(`tests/hooks/test_static_rules_trust.py`)
        - 共有規則が走るのは,信頼できるオーナーのチェックアウトだけ.
        - fork の問い合わせはしない.
        - 別オーナーでも,プロジェクト自身の規則は走る.
    - コメントの走査(`tests/hooks/test_comment_nodes.py`)
        - 抑制マーカーの直下のコメントも見つける.
        - 作業ディレクトリの `sgconfig.yml` を読まない.
        - 文字列はコメントにしない.JS の `<!--` はコメントとする.エンコードできないテキストは不明として扱う.
-
抑制ガード(`tests/hooks/test_guard_suppression.py`,`tests/hooks/test_guard_suppression_scope.py`)
        - Codex と自動セキュリティレビューが報告したケースは,すべてテストにした.
- 文字列からコメントへの変化:同じ行,ブロックコメント,Python の複数行文字列,YAML のブロックスカラー,Rust の raw
string,ヒアドキュメント,Go の `"//nolint"`,ast-grep が無いときのテンプレート文字列.
        - 同じ行の 2 つ目のマーカー.
-
対象の変更(`tests/hooks/test_guard_suppression_target.py`):`//nolint`,`noqa`,`type:
ignore`,eslint,`allow` / `expect`,shellcheck
で規則を減らす・変える・加える変更は確認し,移動,削除,横のコードの編集は通る.
- 対象の変更では,属性の中のコメントや文字列にあるマーカーや括弧,閉じていない属性も確認する.理由文だけの修正(8 種類のマーカー)は通る.
- 走査の期限(`tests/hooks/test_guard_suppression_budget.py`):ハングする ast-grep
でも,移動を含むパッチの判定が期限内に終わり,確認する.期限切れの結果は次の判定に持ち越さない.マーカーが多いファイルも 5
秒以内に判定する.import
から時間が経っても,判定の外の走査は期限切れにならない(`tests/hooks/test_comment_nodes.py`).
- ast-grep が無いとき(`tests/hooks/test_guard_suppression_unparsed.py`):YAML
のインデント変更と heredoc 終端の挿入は確認し,heredoc の無いスクリプトの無関係な編集は通る.
        - payload の `cwd` にある相対パスのファイルを読む.
        - Rust の属性:raw string からコードへの変化,マクロ本体,Python のコメントから Rust への移動.
- パッチ:` ***`
で始まる文脈行で区切りが終わらない,配置できないハンクの断片で文字列に見えるマーカー,文脈行がコメントに変わる場合,Add
File,空行,`*** End of File`,解釈できない行,複数の一致,同じファイルへの重複(別の綴り,大文字小文字,移動先).
        - 移動:両方で効くマーカーは通る.移動先でだけ効くマーカーは確認する.
        - ast-grep が無いときは,抑制と関係のない編集を通す.`--!>` の変更は確認する.
- 1 行目の文字列はファイル単位の抑制にならない.移動の途中でマーカーを消せば通る.完全一致しないハンクが引用符の中に語を加えると確認する.
- apply_patch のテストは `tests/hooks/test_guard_suppression_patch.py`
に分けた(ファイル行数の上限のため).
- プロバイダ(`tests/test_provider_adapters.py`):5 つのアダプタすべてで,新しい抑制がブロックされる.
- 規則テスト(`tests/test_ast_grep_rules.py`):note の無い error 規則を検出する.main の
error 規則 28 件すべてに適用している.

## レビュー対応

- Codex,claude-review,自動セキュリティレビューの指摘は,すべてこの PR
で修正した.各スレッドにはコミットを添えて返信し,resolve した.
- 以前の返信にあるコミット ID の一部は,rebase の前のもの.
- 修正したもの
    - dsh のブロック表示.
    - 文字列からコメントへの変化.ここから,手書きの字句解析を tree-sitter に置き換えた.
    - 複数行コメント,YAML のブロックスカラー,Rust の raw string.
    - `//nolint` などのコメントの指示の判定.
    - 同じ行の 2 つ目のマーカー.
    - パッチの文脈行と配置.
    - ast-grep が無いときの判定.安全側に倒しつつ,抑制と関係のない編集は止めない.
    - ブロック全体の大きさ.
    - 拡張子をまたぐ移動.
    - 信頼判定の問い合わせ待ちと,規則が知らせずに止まる問題.
    - Rust の属性.
- CodeQL の HTML
コメントの終わり(`--!>`),ファイル単位の抑制のコメント判定,移動先で効くマーカーの判定に使う内容,断片の数え方.
    - 抑制の対象の変更(`//nolint:errcheck` → `//nolint` など)と,理由文の修正での誤検知.
    - 走査のタイムアウトの積み重ね,マーカーの多いファイルでの二乗の処理時間,属性の範囲の切り方と括弧の対応.
- ` ***` で始まる文脈行,payload の `cwd`,配置できないハンクの断片,ast-grep が無いときのインデントと
heredoc.
- CI の test ジョブの失敗:走査の期限が import の時点で決まっていたため,遅い実行では判定の外の走査が期限切れになっていた.
- 変えていないもの
    - 走査が失敗したときにブロックしない点:ADR の方針(壊れた走査でエージェントを止めない)どおり.
- この PR で入れた変更について jev-lint が出した advisory
の指摘(`command-query-naming`,`error-message-names-operation`)
- `_adds`,`_insert_change`,`_scan_within_budget` は query の名前に改め,走査の副作用は
`_scan` に寄せた.
    - `_patch_changes` は,返す値で命名した query なので当てはまらない.
    - `lint_format.py` の `TypeError` の文言は,この PR より前からある.
    - 規則そのものの扱いは #196 で記録する.

## 制限

完全な構文解析が要る理論上の抜け道で,この PR では扱わないもの.

- ast-grep
が無いか失敗したときは,行単位の推測で判定する.区切りの記号を含まない行の変更でマーカーがコメントに変わる場合(シェル以外の言語)は検出できない.ast-grep
は CI と dev shell で必須.期限切れは常に確認する.
-
指示と規則の一覧は,ツールごとの書式を正規表現で近似して切り出す.ツールが受け付けるのに正規表現が拾わない書き方で規則を足すと,理由文として扱われて見落とす.ツールの構文解析器を使えば防げるが,ツールごとの依存が増える.
- Rust の属性の範囲は,ast-grep
の文字列とコメントのノードを除いて括弧を対応づける.マクロの中の不均衡な括弧のように,tree-sitter と rustc
の解釈がずれる箇所は追わない.
- heredoc の判定は `.sh` と `.bash` に限る.他の言語の heredoc(Ruby,Perl
など)は対象の拡張子に無い.

## フォローアップ

- なし.

## ユーザーの判断事項

- 信頼できないリポジトリでも,そのリポジトリの `sgconfig.yml` にある `severity: error`
規則はブロックする.その規則の `message` と `note` は,エージェントへの指示としてそのまま渡る.
    - ユーザーの決定(プロジェクト自身の規則は従来どおり)に沿って変えていない.ただし,ブロックはこの PR で新しく入る挙動.
    - この PR の前も,同じ文言は通知として渡っていた.
    - ブロックするかどうかと,文言の扱いを信頼判定に合わせるかどうかは,ユーザーの判断事項.

## マージ後すぐ直す指摘

この PR では直さず,マージ直後のフォローアップ PR で直す(#216 と同じ扱い).

- markdown セルを code セルに変える NotebookEdit
で,比較元に旧本文が入る.元の本文にあるマーカーが変わらないものとして扱われ,確認なしで通る.
- Rust の属性で,`reason = "..."` の項目自体の追加・削除まで比較から外れる.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: furedea <132188853+furedea@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
furedea added a commit that referenced this pull request Nov 17, 2026
## 概要

`docs/adr/` の ADR を共有チェック(`adr-check`,markdownlint,lychee)に通し,CI で
`adr-lint` と `ast-grep` を実行します.

## 変更

- 16 件すべての ADR に YAML フロントマターを追加しました.値は各 ADR の Status / Date /
Supersedes / Superseded by
の行から取りました.メタデータの箇条書き行は削除し,決定の本文は変えていません(agent-config #215 と同じ扱いです).
- ファイル名を `NNNN-words.md` から `NNNN_words.md` に `git mv` で改名し,ADR
間リンクを直しました.
- `docs/adr/.markdownlint.yml` を追加しました(`default: true`,`MD013:
false`,`MD024: false`).MD043 は有効にしていません.
- `ci.yml` に `adr-lint`(`madr-from: 17`)と `ast-grep` を v1.6.0
で追加し,`all-green` の `needs` に入れました.

## 保守的な値

- ADR-0007 は本文が「Superseded」とだけ書いていて,置き換え先がありません.スキーマは `superseded-by`
を必須とするため,ADR-0008 が `Supersedes: ADR-0007` と書いていることから `superseded-by:
[ADR-0008]` としました.
- それ以外に曖昧な値はありません.`amended` と `related` は本文に記述がないため付けていません.

## 検証

- `adr-check docs/adr`: 成功.
- markdownlint-cli2: 0 error.追加で無効にしたルールはありません.
- `lychee --offline docs/adr`: 0 error.ただし検出されたリンクは 1 件のみで,ADR
間の相対リンクが検査されたかは確認できていません.壊れたリンクは見つかっていません.

Refs #169

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: furedea <132188853+furedea@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant