@rvdbreemen/adr-kit-opencode 0.52.0 → 0.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/.claude-plugin/plugin.json +29 -29
  2. package/README.md +865 -850
  3. package/bin/adr +0 -0
  4. package/bin/adr-audit +0 -0
  5. package/bin/adr-context +0 -0
  6. package/bin/adr-discover +0 -0
  7. package/bin/adr-doctor +0 -0
  8. package/bin/adr-generate-scripts +0 -0
  9. package/bin/adr-grill-signal +0 -0
  10. package/bin/adr-guardian +0 -0
  11. package/bin/adr-index +0 -0
  12. package/bin/adr-judge +0 -0
  13. package/bin/adr-judge-precommit +0 -0
  14. package/bin/adr-lint +0 -0
  15. package/bin/adr-mcp +96 -4
  16. package/bin/adr-migrate +0 -0
  17. package/bin/adr-quality +0 -0
  18. package/bin/adr-readiness +0 -0
  19. package/bin/adr-readiness-ci +0 -0
  20. package/bin/adr-related +0 -0
  21. package/bin/adr-renumber +254 -254
  22. package/bin/adr-retire +0 -0
  23. package/bin/adr-settings +0 -0
  24. package/bin/adr-status +0 -0
  25. package/bin/adr-suggest +0 -0
  26. package/bin/adr-watch +0 -0
  27. package/bin/adr_doctor_probes.py +2 -0
  28. package/bin/bump-version +0 -0
  29. package/clients/workflows.json +229 -229
  30. package/hooks/__init__.py +1 -1
  31. package/hooks/adapters/__init__.py +13 -13
  32. package/hooks/adapters/claude.py +27 -27
  33. package/hooks/adapters/codex.py +26 -26
  34. package/hooks/adapters/copilot.py +11 -11
  35. package/hooks/adr-hook.py +128 -128
  36. package/hooks/adr_hook_core.py +843 -843
  37. package/hooks/adr_pr_guard.py +367 -367
  38. package/instructions/ADR-guide.md +101 -48
  39. package/instructions/adr.coding.md +82 -82
  40. package/instructions/adr.review.md +182 -182
  41. package/opencode/plugin.ts +1 -4
  42. package/package.json +5 -2
  43. package/schemas/adr-context-probes.schema.json +56 -56
  44. package/schemas/adr-enforcement.schema.json +57 -57
  45. package/schemas/adr-frontmatter.schema.json +144 -144
  46. package/schemas/adr-index.schema.json +276 -276
  47. package/schemas/adr-kit-config.schema.json +371 -371
  48. package/schemas/adr-readiness.schema.json +41 -41
  49. package/schemas/client-capabilities.schema.json +503 -503
  50. package/schemas/client-certification.schema.json +101 -101
  51. package/schemas/doctor-output.schema.json +92 -92
  52. package/skills/adr/SKILL.md +780 -780
  53. package/skills/audit/SKILL.md +103 -103
  54. package/skills/context/SKILL.md +77 -77
  55. package/skills/grill/SKILL.md +84 -84
  56. package/skills/grill/agents/openai.yaml +4 -4
  57. package/skills/guardian/SKILL.md +316 -316
  58. package/skills/init/SKILL.md +499 -499
  59. package/skills/install-hooks/SKILL.md +154 -154
  60. package/skills/judge/SKILL.md +168 -168
  61. package/skills/lint/SKILL.md +321 -321
  62. package/skills/migrate/SKILL.md +313 -313
  63. package/skills/related/SKILL.md +62 -62
  64. package/skills/retire/SKILL.md +41 -41
  65. package/skills/review/SKILL.md +167 -167
  66. package/skills/settings/SKILL.md +73 -73
  67. package/skills/setup/SKILL.md +128 -128
  68. package/skills/supersede/SKILL.md +136 -136
  69. package/skills/upgrade/SKILL.md +273 -273
  70. package/templates/adr-kit-guide.md +354 -354
  71. package/templates/adr-template.canonical.md +115 -115
  72. package/templates/adr-template.madr.md +131 -131
  73. package/templates/adr-template.md +131 -131
  74. package/templates/adr-template.nygard.md +111 -111
  75. package/templates/cc-settings/guardian-hook-entry.json +9 -9
  76. package/templates/githooks/pre-commit +1 -1
  77. package/templates/github-workflows/adr-audit.yml +58 -58
  78. package/templates/github-workflows/adr-guardian-audit.yml +133 -133
  79. package/templates/github-workflows/adr-index-check.yml +30 -30
  80. package/templates/github-workflows/adr-judge.yml +31 -31
  81. package/templates/github-workflows/adr-readiness.yml +18 -18
  82. package/templates/validate_adr_template.py +38 -38
  83. package/templates/validate_adr_template.sh +74 -74
@@ -1,321 +1,321 @@
1
- ---
2
- name: lint
3
- description: "Lint ADRs against schema and four verification gates. Use for ADR lint, validation, status-history checks, or file-and-line findings. Read-only."
4
- argument-hint: "[file or directory; defaults to docs/adr/]"
5
- disable-model-invocation: true
6
- allowed-tools: [Read, Glob, Grep]
7
- ---
8
-
9
- # adr-kit lint
10
-
11
- Use `$ARGUMENTS` as the ADR file or directory; default to `docs/adr/` when it
12
- is empty.
13
-
14
- You are running `/adr-kit:lint`. The user wants to know whether existing ADRs in their project pass the four verification gates that the main `adr` skill enforces and, for v0.14 ADRs, whether their status histories are intact. You read files; you do not modify them. You report.
15
-
16
- The deterministic CLI also returns read-only migration notices. Report them
17
- even when every canonical ADR passes. A notice may contain an exact
18
- `adr-migrate --dry-run` command for a supported legacy file or a guided
19
- `/adr-kit:migrate` instruction for Y-Statement, Tyree/Akerman, arc42, hybrid,
20
- or unknown shapes. Never execute the reported write command from this skill.
21
-
22
- ## Inputs
23
-
24
- - **No argument**: lint every `docs/adr/ADR-*.md` file in the project root.
25
- - **A directory path**: lint every `ADR-*.md` file under that directory.
26
- - **A file path**: lint that one file.
27
-
28
- If the user passed something else (a glob, a non-existent path), explain politely and stop.
29
-
30
- ## Configuration (since v0.9.0)
31
-
32
- Established projects often have a long history of ADRs that predate the four canonical gates. Linting them under strict rules produces noise rather than actionable feedback. Two opt-in mechanisms let a project apply the gates surgically: strict on new ADRs, advisory on legacy ones.
33
-
34
- ### Mechanism 1: project-level config file
35
-
36
- Before linting, look for `docs/adr/.adr-kit.json` (relative to the project root, or to the directory passed as argument if the user pointed elsewhere). If it exists, read it and apply it as policy. If it does not exist, fall back to default behaviour (everything strict, exact match to v0.7.x output).
37
-
38
- Recognised fields:
39
-
40
- - `strict_from` (string, optional): first ADR identifier (inclusive) on which all gates are enforced strictly. ADRs with a numerically lower number are linted in *advisory* mode for the gates that opt in (see `severity`). Format: `ADR-XXX` matching the filename pattern. Example: `"ADR-082"`.
41
- - `ignore` (array of strings, optional): list of ADR identifiers (`ADR-XXX`) or full filenames to skip entirely. Useful for archived or superseded ADRs whose status is final. Skipped ADRs appear in the aggregate as SKIPPED but produce no gate output.
42
- - `severity` (object, optional): per-gate severity. Keys are `completeness`, `audit`, `evidence`, `clarity`, and `consistency`. Values are one of:
43
- - `always_strict`: failures are FAIL regardless of `strict_from`.
44
- - `always_advisory`: failures are ADVISORY regardless of `strict_from`.
45
- - `advisory_before_strict_from`: failures are ADVISORY for ADRs that predate `strict_from`, FAIL otherwise. This is the default for `completeness`, `evidence`, `clarity` when `strict_from` is set.
46
- - For `audit` and `consistency` the implicit default stays `always_strict` even when `strict_from` is set, because an invalid status chain, filename / heading mismatch, duplicate number, or broken cross-reference is a real bug regardless of when the ADR was written. Projects can override this in their config but the default is loud-on-purpose.
47
- - `template.required_sections` (array of strings, optional): advanced override for a project-specific section list. Each entry is the exact heading text including the `## ` prefix. Without it, Completeness resolves required headings from each ADR's MADR, Nygard, or canonical profile.
48
- - `template.profile` (string, optional): operational creation default and
49
- profile contract. Legal values are `madr` (default), `nygard`, and
50
- `canonical`. Per-file `format` frontmatter wins; otherwise headings are
51
- detected. `unknown` and `hybrid` fail strict lint.
52
-
53
- Example `.adr-kit.json`:
54
-
55
- ```json
56
- {
57
- "strict_from": "ADR-082",
58
- "ignore": ["ADR-001", "ADR-007"],
59
- "severity": {
60
- "completeness": "advisory_before_strict_from",
61
- "audit": "always_strict",
62
- "evidence": "advisory_before_strict_from",
63
- "clarity": "always_advisory",
64
- "consistency": "always_strict"
65
- },
66
- "template": {
67
- "profile": "madr"
68
- }
69
- }
70
- ```
71
-
72
- The file may contain top-level `"_comment"` keys (any name starting with `_`); ignore them silently. They are a convention to embed annotations in JSON without breaking parse.
73
-
74
- If the file is malformed JSON, report the parse error and stop without linting. Do not silently fall back to defaults: a broken policy file is a bug the user should know about. If a field has an unrecognised value (e.g. `"severity.completeness": "lol"`), report the unrecognised value, list the legal values, and stop.
75
-
76
- ### Mechanism 2: per-ADR markers
77
-
78
- Inside an individual ADR, an HTML comment line of one of these shapes flips the policy for that file only:
79
-
80
- ```html
81
- <!-- adr-kit-lint: skip -->
82
- <!-- adr-kit-lint: skip completeness, evidence -->
83
- <!-- adr-kit-lint: advisory -->
84
- ```
85
-
86
- Forms (case-insensitive on the directive, whitespace-tolerant):
87
-
88
- - `skip` (no args): the ADR is skipped entirely. Counts as SKIPPED in the aggregate.
89
- - `skip <gate>[, <gate>...]`: those gates are skipped on this file only. Other gates still run.
90
- - `advisory`: all gates run on this file in advisory mode. Failures are ADVISORY, not FAIL.
91
-
92
- The marker may appear anywhere in the file (top, bottom, inside or outside a section). Scan the full file for the first matching marker line and apply it. If multiple marker lines disagree (e.g. one says `skip`, another says `advisory`), the *first* matching marker wins; report the conflict in the file's output.
93
-
94
- ### Severity decision tree
95
-
96
- When evaluating a single (file, gate) pair, apply policies in this order. The first matching rule wins.
97
-
98
- ```dot
99
- digraph severity {
100
- "Is the file in config.ignore?" [shape=diamond];
101
- "Skip whole file" [shape=box];
102
- "Per-ADR marker says skip (no args)?" [shape=diamond];
103
- "Per-ADR marker says skip <this gate>?" [shape=diamond];
104
- "Skip this gate only" [shape=box];
105
- "Per-ADR marker says advisory?" [shape=diamond];
106
- "ADVISORY (reason: marker)" [shape=box];
107
- "config.severity[gate] resolved to always_strict?" [shape=diamond];
108
- "FAIL on failure" [shape=box];
109
- "config.severity[gate] resolved to always_advisory?" [shape=diamond];
110
- "ADVISORY (reason: severity=always_advisory)" [shape=box];
111
- "config.severity[gate] = advisory_before_strict_from AND ADR predates strict_from?" [shape=diamond];
112
- "ADVISORY (reason: predates strict_from)" [shape=box];
113
- "Is config absent?" [shape=diamond];
114
- "FAIL on failure (default behaviour)" [shape=box];
115
- "FAIL on failure (post-strict_from)" [shape=box];
116
-
117
- "Is the file in config.ignore?" -> "Skip whole file" [label="yes"];
118
- "Is the file in config.ignore?" -> "Per-ADR marker says skip (no args)?" [label="no"];
119
- "Per-ADR marker says skip (no args)?" -> "Skip whole file" [label="yes"];
120
- "Per-ADR marker says skip (no args)?" -> "Per-ADR marker says skip <this gate>?" [label="no"];
121
- "Per-ADR marker says skip <this gate>?" -> "Skip this gate only" [label="yes"];
122
- "Per-ADR marker says skip <this gate>?" -> "Per-ADR marker says advisory?" [label="no"];
123
- "Per-ADR marker says advisory?" -> "ADVISORY (reason: marker)" [label="yes"];
124
- "Per-ADR marker says advisory?" -> "Is config absent?" [label="no"];
125
- "Is config absent?" -> "FAIL on failure (default behaviour)" [label="yes"];
126
- "Is config absent?" -> "config.severity[gate] resolved to always_strict?" [label="no"];
127
- "config.severity[gate] resolved to always_strict?" -> "FAIL on failure" [label="yes"];
128
- "config.severity[gate] resolved to always_strict?" -> "config.severity[gate] resolved to always_advisory?" [label="no"];
129
- "config.severity[gate] resolved to always_advisory?" -> "ADVISORY (reason: severity=always_advisory)" [label="yes"];
130
- "config.severity[gate] resolved to always_advisory?" -> "config.severity[gate] = advisory_before_strict_from AND ADR predates strict_from?" [label="no"];
131
- "config.severity[gate] = advisory_before_strict_from AND ADR predates strict_from?" -> "ADVISORY (reason: predates strict_from)" [label="yes"];
132
- "config.severity[gate] = advisory_before_strict_from AND ADR predates strict_from?" -> "FAIL on failure (post-strict_from)" [label="no"];
133
- }
134
- ```
135
-
136
- In plain words: ignore beats markers, markers beat config, and within config the precedence is `always_strict` > `always_advisory` > `advisory_before_strict_from`. If the gate would PASS on its own checks, the severity rule does not apply: PASS stays PASS regardless of policy.
137
-
138
- ## What you check, gate by gate
139
-
140
- For every ADR you read, evaluate each of the four gates separately. A gate either passes or fails for a given file. Cite line numbers when reporting a failure.
141
-
142
- ### Gate 1: Completeness
143
-
144
- A passing ADR has every load-bearing semantic section for its detected or
145
- declared profile, with non-empty content.
146
-
147
- Required semantic roles are Status, Context/Problem, Decision/Outcome,
148
- Alternatives/Considered Options, Consequences, Related Decisions, and
149
- References. MADR uses `Context and Problem Statement`, `Considered Options`,
150
- and `Decision Outcome`; Nygard/canonical use their shorter equivalents.
151
- If `.adr-kit.json` defines `template.required_sections`, use that custom list.
152
-
153
- Sub-checks within sections:
154
-
155
- - **Status** line is one of: `Proposed`, `Accepted`, `Deprecated`, `Superseded by ADR-XXX`, `Amended by ADR-XXX`. Date in `YYYY-MM-DD` format must be present.
156
- - **Alternatives/Considered Options** has at least 2 alternatives, each with rejection reasoning. A single bullet point of one word does not count as an alternative.
157
- - **Consequences** has both a positive and a negative direction. Look for `Benefits`/`Trade-offs`/`Positive`/`Negative` subheadings or a clearly mixed list. A one-sided Consequences section fails this gate.
158
- - **Risks** are named with at least one mitigation each (typically inside Consequences as `Risks and mitigations` or similar).
159
-
160
- Failure example: `Completeness: missing ## Risks and mitigations subsection (line 47); only positive consequences listed.`
161
-
162
- ### Audit: Status History (v0.14.0+)
163
-
164
- When an ADR contains a `status_history` YAML list, validate that each entry has
165
- `date`, `status`, `changed_by`, `reason`, and `changed_via`; dates are in
166
- chronological order and are not in the future; and the latest history status
167
- matches the `## Status` section. ADRs without a history block predate v0.14 and
168
- pass this supplemental gate until deliberately migrated.
169
-
170
- Failure example: `Audit: latest status_history entry is Proposed but ## Status is Accepted. Append the missing Accepted transition; do not rewrite older entries.`
171
-
172
- ### Gate 2: Evidence
173
-
174
- A passing ADR replaces challengeable claims with measurements or citations.
175
-
176
- Heuristic checks:
177
-
178
- - **Bare adjectives** in critical positions (Decision, Consequences, Alternatives) without an accompanying number or citation. Examples to flag: "fast", "slow", "faster", "slower", "better", "worse", "improves", "reduces", "more reliable", "more performant" when not followed by a measurement or citation.
179
- - **Constraint claims** ("X has Y RAM", "Y supports up to Z connections") without an anchor (vendor doc, datasheet, measured, internal doc, RFC).
180
- - **Code references**: when a claim is about code, look for `file:line` or `file.ext` references. A claim about an algorithm that does not cite the implementation is suspicious.
181
- - **External claims** (specs, RFCs, vendor docs): should be linked, not paraphrased.
182
-
183
- You will see false positives ("the new system is faster" might be acceptable in a Context paragraph if a measurement appears later in Consequences). Use judgment: if a measurement or citation backs the claim within ~5 lines, count it as supported.
184
-
185
- Failure example: `Evidence: line 24 says "improves performance" with no measurement in the surrounding paragraphs. Suggest replacing with a measured improvement, e.g. "reduces request latency from 120 ms to 40 ms p99 (load-test on staging, see PERF-103)".`
186
-
187
- ### Gate 3: Clarity
188
-
189
- A passing ADR is readable to a developer who has never seen the codebase.
190
-
191
- Heuristic checks:
192
-
193
- - **Acronyms**: any ALL-CAPS sequence of 2 to 6 letters that appears for the first time without an inline expansion. Example: "TLS" should be "TLS (Transport Layer Security)" on first use.
194
- - **Project-specific jargon** without explanation: terms like internal service names, internal status codes, or proprietary protocols.
195
- - **Decision summary at top**: the Decision section should open with a single declarative sentence. If the Decision opens with a multi-paragraph discussion before stating what was chosen, flag it.
196
- - **Code examples** for technical decisions (algorithm choice, protocol selection): expected to be present in either Decision or Implementation Notes if applicable.
197
-
198
- Failure example: `Clarity: line 12 uses "WAL" without expansion. Suggest "WAL (write-ahead log)" on first use. Line 31 opens the Decision section with "There are several considerations..." instead of a declarative sentence; suggest leading with the choice and unpacking after.`
199
-
200
- ### Gate 4: Consistency
201
-
202
- A passing ADR fits the existing record without contradictions.
203
-
204
- Heuristic checks:
205
-
206
- - **Filename matches heading**: file `ADR-042-foo.md` should have a first-line heading `# ADR-042 ...`. Mismatch fails this gate.
207
- - **Filename pattern**: `ADR-XXX-kebab-case-title.md` with uppercase prefix and 3-digit zero-padded number. Lowercase prefixes (`adr-`), unpadded numbers (`ADR-42-`), or non-kebab-case (`ADR-042-MyTitle.md`) fail.
208
- - **Cross-references** in `## Related Decisions` follow the `ADR-XXX` format. References to non-existent files (broken links) fail.
209
- - **Duplicate ADR numbers** in the directory: if two files share an ADR number, both fail the Consistency gate. Recommend a renumbering follow-up.
210
- - **Status conflicts**: if this ADR's Status says "Supersedes ADR-XXX" but ADR-XXX's Status is not "Superseded by", flag the inconsistency.
211
-
212
- Failure example: `Consistency: filename ADR-042-foo.md but heading says "# ADR-42 Foo" (missing zero-padding, line 1). Filename and heading must agree.`
213
-
214
- ## Output format
215
-
216
- For each ADR file, produce a one-line summary plus details for any failing or advisory gate. Three result tiers exist: PASS, ADVISORY (a finding that does not block but is reported), and FAIL.
217
-
218
- If a config file is in effect, prefix the run with a one-line config banner so the user knows which policy is being applied.
219
-
220
- ### Single-file output (no config)
221
-
222
- ```
223
- ADR-042-foo.md
224
- Completeness: PASS
225
- Evidence: FAIL
226
- line 24: "improves performance" with no measurement.
227
- line 38: "scales better" with no number.
228
- Clarity: PASS
229
- Consistency: PASS
230
-
231
- Summary: 3 of 4 gates pass strictly. 1 FAIL. To flip Status to Accepted, fix the Evidence gate.
232
- ```
233
-
234
- ### Single-file output (config in effect, gate reduced to advisory)
235
-
236
- ```
237
- ADR-042-foo.md
238
- Completeness: PASS
239
- Evidence: ADVISORY
240
- line 24: "improves performance" with no measurement (ADVISORY: ADR predates strict_from=ADR-042)
241
- line 38: "scales better" with no number (ADVISORY: ADR predates strict_from=ADR-042)
242
- Clarity: PASS
243
- Consistency: PASS
244
-
245
- Summary: 3 of 4 gates pass strictly. 1 advisory. No FAIL.
246
- ```
247
-
248
- ### Directory-tree output (no config)
249
-
250
- ```
251
- Linting docs/adr/ (12 ADRs)
252
-
253
- PASS (9):
254
- ADR-001-foo.md
255
- ADR-003-bar.md
256
- ...
257
-
258
- FAIL (3):
259
- ADR-002-baz.md
260
- Evidence: line 24 ("faster"), line 38 ("scales better").
261
- ADR-007-qux.md
262
- Completeness: missing ## Related Decisions section.
263
- ADR-011-quux.md
264
- Consistency: filename has lowercase prefix "adr-011-...", expected "ADR-011-...".
265
-
266
- Aggregate:
267
- Most common FAIL gate: Evidence (2 of 3 failures).
268
- Next steps: focus on ADR-002-baz.md, which fails the most gates.
269
- ```
270
-
271
- ### Directory-tree output (config in effect)
272
-
273
- ```
274
- Linting docs/adr/ (50 ADRs)
275
- Config: .adr-kit.json found (strict_from=ADR-042; severity: completeness=advisory_before_strict_from, evidence=advisory_before_strict_from, consistency=always_strict)
276
-
277
- PASS strictly (8):
278
- ADR-042-...
279
- ADR-043-...
280
- ...
281
-
282
- ADVISORY only (38):
283
- Most common advisory gate: Completeness (38 of 38; legacy template predates canonical seven).
284
- Listed by ADR id; expand on request.
285
-
286
- FAIL (4):
287
- ADR-045-foo.md
288
- Evidence: line 24 ("faster") with no measurement.
289
- ADR-046-bar.md
290
- Consistency: filename ADR-046-bar.md but heading "# ADR-46 Bar" (line 1).
291
- ...
292
-
293
- SKIPPED (0)
294
-
295
- Aggregate:
296
- Most common FAIL gate: Evidence (3 of 4 failures).
297
- Next steps: focus on ADR-045-foo.md, which fails 2 of 4 gates.
298
- ```
299
-
300
- The aggregate's bottom line always names the FAIL count, never the ADVISORY count. ADVISORY is informational; FAIL is what the user is asked to act on.
301
-
302
- ## When you find no ADRs
303
-
304
- If `docs/adr/` is empty or does not exist, say so plainly:
305
-
306
- ```
307
- No ADRs found at docs/adr/. The toolkit is installed but no decisions have been recorded yet.
308
- Create your first ADR with /adr-kit:adr.
309
- ```
310
-
311
- ## Reporting
312
-
313
- Always end with a single recommended next action that points at a FAIL, not an ADVISORY. ADVISORY findings are background noise the project has explicitly chosen to tolerate; FAIL findings are what the user is being asked to fix. The next-action sentence names which ADR to fix first (the one with the most FAIL gates, or the most-referenced one) and which gate to focus on. Concrete, not abstract.
314
-
315
- If the run produced zero FAILs, say so plainly: "All linted ADRs pass at the configured severity. <N> ADVISORY findings remain, treated as informational by the project's policy." Do not invent a FAIL where there is none.
316
-
317
- ## What you do *not* do
318
-
319
- - You do not modify ADRs. Read-only by design.
320
- - You do not invoke the `adr-generator` agent. The lint skill is informational; the user decides whether to fix.
321
- - You do not call out style preferences that are not in the four gates. No bikeshedding on heading capitalisation, list-marker style, or whitespace. The gates are the contract.
1
+ ---
2
+ name: lint
3
+ description: "Lint ADRs against schema and four verification gates. Use for ADR lint, validation, status-history checks, or file-and-line findings. Read-only."
4
+ argument-hint: "[file or directory; defaults to docs/adr/]"
5
+ disable-model-invocation: true
6
+ allowed-tools: [Read, Glob, Grep]
7
+ ---
8
+
9
+ # adr-kit lint
10
+
11
+ Use `$ARGUMENTS` as the ADR file or directory; default to `docs/adr/` when it
12
+ is empty.
13
+
14
+ You are running `/adr-kit:lint`. The user wants to know whether existing ADRs in their project pass the four verification gates that the main `adr` skill enforces and, for v0.14 ADRs, whether their status histories are intact. You read files; you do not modify them. You report.
15
+
16
+ The deterministic CLI also returns read-only migration notices. Report them
17
+ even when every canonical ADR passes. A notice may contain an exact
18
+ `adr-migrate --dry-run` command for a supported legacy file or a guided
19
+ `/adr-kit:migrate` instruction for Y-Statement, Tyree/Akerman, arc42, hybrid,
20
+ or unknown shapes. Never execute the reported write command from this skill.
21
+
22
+ ## Inputs
23
+
24
+ - **No argument**: lint every `docs/adr/ADR-*.md` file in the project root.
25
+ - **A directory path**: lint every `ADR-*.md` file under that directory.
26
+ - **A file path**: lint that one file.
27
+
28
+ If the user passed something else (a glob, a non-existent path), explain politely and stop.
29
+
30
+ ## Configuration (since v0.9.0)
31
+
32
+ Established projects often have a long history of ADRs that predate the four canonical gates. Linting them under strict rules produces noise rather than actionable feedback. Two opt-in mechanisms let a project apply the gates surgically: strict on new ADRs, advisory on legacy ones.
33
+
34
+ ### Mechanism 1: project-level config file
35
+
36
+ Before linting, look for `docs/adr/.adr-kit.json` (relative to the project root, or to the directory passed as argument if the user pointed elsewhere). If it exists, read it and apply it as policy. If it does not exist, fall back to default behaviour (everything strict, exact match to v0.7.x output).
37
+
38
+ Recognised fields:
39
+
40
+ - `strict_from` (string, optional): first ADR identifier (inclusive) on which all gates are enforced strictly. ADRs with a numerically lower number are linted in *advisory* mode for the gates that opt in (see `severity`). Format: `ADR-XXX` matching the filename pattern. Example: `"ADR-082"`.
41
+ - `ignore` (array of strings, optional): list of ADR identifiers (`ADR-XXX`) or full filenames to skip entirely. Useful for archived or superseded ADRs whose status is final. Skipped ADRs appear in the aggregate as SKIPPED but produce no gate output.
42
+ - `severity` (object, optional): per-gate severity. Keys are `completeness`, `audit`, `evidence`, `clarity`, and `consistency`. Values are one of:
43
+ - `always_strict`: failures are FAIL regardless of `strict_from`.
44
+ - `always_advisory`: failures are ADVISORY regardless of `strict_from`.
45
+ - `advisory_before_strict_from`: failures are ADVISORY for ADRs that predate `strict_from`, FAIL otherwise. This is the default for `completeness`, `evidence`, `clarity` when `strict_from` is set.
46
+ - For `audit` and `consistency` the implicit default stays `always_strict` even when `strict_from` is set, because an invalid status chain, filename / heading mismatch, duplicate number, or broken cross-reference is a real bug regardless of when the ADR was written. Projects can override this in their config but the default is loud-on-purpose.
47
+ - `template.required_sections` (array of strings, optional): advanced override for a project-specific section list. Each entry is the exact heading text including the `## ` prefix. Without it, Completeness resolves required headings from each ADR's MADR, Nygard, or canonical profile.
48
+ - `template.profile` (string, optional): operational creation default and
49
+ profile contract. Legal values are `madr` (default), `nygard`, and
50
+ `canonical`. Per-file `format` frontmatter wins; otherwise headings are
51
+ detected. `unknown` and `hybrid` fail strict lint.
52
+
53
+ Example `.adr-kit.json`:
54
+
55
+ ```json
56
+ {
57
+ "strict_from": "ADR-082",
58
+ "ignore": ["ADR-001", "ADR-007"],
59
+ "severity": {
60
+ "completeness": "advisory_before_strict_from",
61
+ "audit": "always_strict",
62
+ "evidence": "advisory_before_strict_from",
63
+ "clarity": "always_advisory",
64
+ "consistency": "always_strict"
65
+ },
66
+ "template": {
67
+ "profile": "madr"
68
+ }
69
+ }
70
+ ```
71
+
72
+ The file may contain top-level `"_comment"` keys (any name starting with `_`); ignore them silently. They are a convention to embed annotations in JSON without breaking parse.
73
+
74
+ If the file is malformed JSON, report the parse error and stop without linting. Do not silently fall back to defaults: a broken policy file is a bug the user should know about. If a field has an unrecognised value (e.g. `"severity.completeness": "lol"`), report the unrecognised value, list the legal values, and stop.
75
+
76
+ ### Mechanism 2: per-ADR markers
77
+
78
+ Inside an individual ADR, an HTML comment line of one of these shapes flips the policy for that file only:
79
+
80
+ ```html
81
+ <!-- adr-kit-lint: skip -->
82
+ <!-- adr-kit-lint: skip completeness, evidence -->
83
+ <!-- adr-kit-lint: advisory -->
84
+ ```
85
+
86
+ Forms (case-insensitive on the directive, whitespace-tolerant):
87
+
88
+ - `skip` (no args): the ADR is skipped entirely. Counts as SKIPPED in the aggregate.
89
+ - `skip <gate>[, <gate>...]`: those gates are skipped on this file only. Other gates still run.
90
+ - `advisory`: all gates run on this file in advisory mode. Failures are ADVISORY, not FAIL.
91
+
92
+ The marker may appear anywhere in the file (top, bottom, inside or outside a section). Scan the full file for the first matching marker line and apply it. If multiple marker lines disagree (e.g. one says `skip`, another says `advisory`), the *first* matching marker wins; report the conflict in the file's output.
93
+
94
+ ### Severity decision tree
95
+
96
+ When evaluating a single (file, gate) pair, apply policies in this order. The first matching rule wins.
97
+
98
+ ```dot
99
+ digraph severity {
100
+ "Is the file in config.ignore?" [shape=diamond];
101
+ "Skip whole file" [shape=box];
102
+ "Per-ADR marker says skip (no args)?" [shape=diamond];
103
+ "Per-ADR marker says skip <this gate>?" [shape=diamond];
104
+ "Skip this gate only" [shape=box];
105
+ "Per-ADR marker says advisory?" [shape=diamond];
106
+ "ADVISORY (reason: marker)" [shape=box];
107
+ "config.severity[gate] resolved to always_strict?" [shape=diamond];
108
+ "FAIL on failure" [shape=box];
109
+ "config.severity[gate] resolved to always_advisory?" [shape=diamond];
110
+ "ADVISORY (reason: severity=always_advisory)" [shape=box];
111
+ "config.severity[gate] = advisory_before_strict_from AND ADR predates strict_from?" [shape=diamond];
112
+ "ADVISORY (reason: predates strict_from)" [shape=box];
113
+ "Is config absent?" [shape=diamond];
114
+ "FAIL on failure (default behaviour)" [shape=box];
115
+ "FAIL on failure (post-strict_from)" [shape=box];
116
+
117
+ "Is the file in config.ignore?" -> "Skip whole file" [label="yes"];
118
+ "Is the file in config.ignore?" -> "Per-ADR marker says skip (no args)?" [label="no"];
119
+ "Per-ADR marker says skip (no args)?" -> "Skip whole file" [label="yes"];
120
+ "Per-ADR marker says skip (no args)?" -> "Per-ADR marker says skip <this gate>?" [label="no"];
121
+ "Per-ADR marker says skip <this gate>?" -> "Skip this gate only" [label="yes"];
122
+ "Per-ADR marker says skip <this gate>?" -> "Per-ADR marker says advisory?" [label="no"];
123
+ "Per-ADR marker says advisory?" -> "ADVISORY (reason: marker)" [label="yes"];
124
+ "Per-ADR marker says advisory?" -> "Is config absent?" [label="no"];
125
+ "Is config absent?" -> "FAIL on failure (default behaviour)" [label="yes"];
126
+ "Is config absent?" -> "config.severity[gate] resolved to always_strict?" [label="no"];
127
+ "config.severity[gate] resolved to always_strict?" -> "FAIL on failure" [label="yes"];
128
+ "config.severity[gate] resolved to always_strict?" -> "config.severity[gate] resolved to always_advisory?" [label="no"];
129
+ "config.severity[gate] resolved to always_advisory?" -> "ADVISORY (reason: severity=always_advisory)" [label="yes"];
130
+ "config.severity[gate] resolved to always_advisory?" -> "config.severity[gate] = advisory_before_strict_from AND ADR predates strict_from?" [label="no"];
131
+ "config.severity[gate] = advisory_before_strict_from AND ADR predates strict_from?" -> "ADVISORY (reason: predates strict_from)" [label="yes"];
132
+ "config.severity[gate] = advisory_before_strict_from AND ADR predates strict_from?" -> "FAIL on failure (post-strict_from)" [label="no"];
133
+ }
134
+ ```
135
+
136
+ In plain words: ignore beats markers, markers beat config, and within config the precedence is `always_strict` > `always_advisory` > `advisory_before_strict_from`. If the gate would PASS on its own checks, the severity rule does not apply: PASS stays PASS regardless of policy.
137
+
138
+ ## What you check, gate by gate
139
+
140
+ For every ADR you read, evaluate each of the four gates separately. A gate either passes or fails for a given file. Cite line numbers when reporting a failure.
141
+
142
+ ### Gate 1: Completeness
143
+
144
+ A passing ADR has every load-bearing semantic section for its detected or
145
+ declared profile, with non-empty content.
146
+
147
+ Required semantic roles are Status, Context/Problem, Decision/Outcome,
148
+ Alternatives/Considered Options, Consequences, Related Decisions, and
149
+ References. MADR uses `Context and Problem Statement`, `Considered Options`,
150
+ and `Decision Outcome`; Nygard/canonical use their shorter equivalents.
151
+ If `.adr-kit.json` defines `template.required_sections`, use that custom list.
152
+
153
+ Sub-checks within sections:
154
+
155
+ - **Status** line is one of: `Proposed`, `Accepted`, `Deprecated`, `Superseded by ADR-XXX`, `Amended by ADR-XXX`. Date in `YYYY-MM-DD` format must be present.
156
+ - **Alternatives/Considered Options** has at least 2 alternatives, each with rejection reasoning. A single bullet point of one word does not count as an alternative.
157
+ - **Consequences** has both a positive and a negative direction. Look for `Benefits`/`Trade-offs`/`Positive`/`Negative` subheadings or a clearly mixed list. A one-sided Consequences section fails this gate.
158
+ - **Risks** are named with at least one mitigation each (typically inside Consequences as `Risks and mitigations` or similar).
159
+
160
+ Failure example: `Completeness: missing ## Risks and mitigations subsection (line 47); only positive consequences listed.`
161
+
162
+ ### Audit: Status History (v0.14.0+)
163
+
164
+ When an ADR contains a `status_history` YAML list, validate that each entry has
165
+ `date`, `status`, `changed_by`, `reason`, and `changed_via`; dates are in
166
+ chronological order and are not in the future; and the latest history status
167
+ matches the `## Status` section. ADRs without a history block predate v0.14 and
168
+ pass this supplemental gate until deliberately migrated.
169
+
170
+ Failure example: `Audit: latest status_history entry is Proposed but ## Status is Accepted. Append the missing Accepted transition; do not rewrite older entries.`
171
+
172
+ ### Gate 2: Evidence
173
+
174
+ A passing ADR replaces challengeable claims with measurements or citations.
175
+
176
+ Heuristic checks:
177
+
178
+ - **Bare adjectives** in critical positions (Decision, Consequences, Alternatives) without an accompanying number or citation. Examples to flag: "fast", "slow", "faster", "slower", "better", "worse", "improves", "reduces", "more reliable", "more performant" when not followed by a measurement or citation.
179
+ - **Constraint claims** ("X has Y RAM", "Y supports up to Z connections") without an anchor (vendor doc, datasheet, measured, internal doc, RFC).
180
+ - **Code references**: when a claim is about code, look for `file:line` or `file.ext` references. A claim about an algorithm that does not cite the implementation is suspicious.
181
+ - **External claims** (specs, RFCs, vendor docs): should be linked, not paraphrased.
182
+
183
+ You will see false positives ("the new system is faster" might be acceptable in a Context paragraph if a measurement appears later in Consequences). Use judgment: if a measurement or citation backs the claim within ~5 lines, count it as supported.
184
+
185
+ Failure example: `Evidence: line 24 says "improves performance" with no measurement in the surrounding paragraphs. Suggest replacing with a measured improvement, e.g. "reduces request latency from 120 ms to 40 ms p99 (load-test on staging, see PERF-103)".`
186
+
187
+ ### Gate 3: Clarity
188
+
189
+ A passing ADR is readable to a developer who has never seen the codebase.
190
+
191
+ Heuristic checks:
192
+
193
+ - **Acronyms**: any ALL-CAPS sequence of 2 to 6 letters that appears for the first time without an inline expansion. Example: "TLS" should be "TLS (Transport Layer Security)" on first use.
194
+ - **Project-specific jargon** without explanation: terms like internal service names, internal status codes, or proprietary protocols.
195
+ - **Decision summary at top**: the Decision section should open with a single declarative sentence. If the Decision opens with a multi-paragraph discussion before stating what was chosen, flag it.
196
+ - **Code examples** for technical decisions (algorithm choice, protocol selection): expected to be present in either Decision or Implementation Notes if applicable.
197
+
198
+ Failure example: `Clarity: line 12 uses "WAL" without expansion. Suggest "WAL (write-ahead log)" on first use. Line 31 opens the Decision section with "There are several considerations..." instead of a declarative sentence; suggest leading with the choice and unpacking after.`
199
+
200
+ ### Gate 4: Consistency
201
+
202
+ A passing ADR fits the existing record without contradictions.
203
+
204
+ Heuristic checks:
205
+
206
+ - **Filename matches heading**: file `ADR-042-foo.md` should have a first-line heading `# ADR-042 ...`. Mismatch fails this gate.
207
+ - **Filename pattern**: `ADR-XXX-kebab-case-title.md` with uppercase prefix and 3-digit zero-padded number. Lowercase prefixes (`adr-`), unpadded numbers (`ADR-42-`), or non-kebab-case (`ADR-042-MyTitle.md`) fail.
208
+ - **Cross-references** in `## Related Decisions` follow the `ADR-XXX` format. References to non-existent files (broken links) fail.
209
+ - **Duplicate ADR numbers** in the directory: if two files share an ADR number, both fail the Consistency gate. Recommend a renumbering follow-up.
210
+ - **Status conflicts**: if this ADR's Status says "Supersedes ADR-XXX" but ADR-XXX's Status is not "Superseded by", flag the inconsistency.
211
+
212
+ Failure example: `Consistency: filename ADR-042-foo.md but heading says "# ADR-42 Foo" (missing zero-padding, line 1). Filename and heading must agree.`
213
+
214
+ ## Output format
215
+
216
+ For each ADR file, produce a one-line summary plus details for any failing or advisory gate. Three result tiers exist: PASS, ADVISORY (a finding that does not block but is reported), and FAIL.
217
+
218
+ If a config file is in effect, prefix the run with a one-line config banner so the user knows which policy is being applied.
219
+
220
+ ### Single-file output (no config)
221
+
222
+ ```
223
+ ADR-042-foo.md
224
+ Completeness: PASS
225
+ Evidence: FAIL
226
+ line 24: "improves performance" with no measurement.
227
+ line 38: "scales better" with no number.
228
+ Clarity: PASS
229
+ Consistency: PASS
230
+
231
+ Summary: 3 of 4 gates pass strictly. 1 FAIL. To flip Status to Accepted, fix the Evidence gate.
232
+ ```
233
+
234
+ ### Single-file output (config in effect, gate reduced to advisory)
235
+
236
+ ```
237
+ ADR-042-foo.md
238
+ Completeness: PASS
239
+ Evidence: ADVISORY
240
+ line 24: "improves performance" with no measurement (ADVISORY: ADR predates strict_from=ADR-042)
241
+ line 38: "scales better" with no number (ADVISORY: ADR predates strict_from=ADR-042)
242
+ Clarity: PASS
243
+ Consistency: PASS
244
+
245
+ Summary: 3 of 4 gates pass strictly. 1 advisory. No FAIL.
246
+ ```
247
+
248
+ ### Directory-tree output (no config)
249
+
250
+ ```
251
+ Linting docs/adr/ (12 ADRs)
252
+
253
+ PASS (9):
254
+ ADR-001-foo.md
255
+ ADR-003-bar.md
256
+ ...
257
+
258
+ FAIL (3):
259
+ ADR-002-baz.md
260
+ Evidence: line 24 ("faster"), line 38 ("scales better").
261
+ ADR-007-qux.md
262
+ Completeness: missing ## Related Decisions section.
263
+ ADR-011-quux.md
264
+ Consistency: filename has lowercase prefix "adr-011-...", expected "ADR-011-...".
265
+
266
+ Aggregate:
267
+ Most common FAIL gate: Evidence (2 of 3 failures).
268
+ Next steps: focus on ADR-002-baz.md, which fails the most gates.
269
+ ```
270
+
271
+ ### Directory-tree output (config in effect)
272
+
273
+ ```
274
+ Linting docs/adr/ (50 ADRs)
275
+ Config: .adr-kit.json found (strict_from=ADR-042; severity: completeness=advisory_before_strict_from, evidence=advisory_before_strict_from, consistency=always_strict)
276
+
277
+ PASS strictly (8):
278
+ ADR-042-...
279
+ ADR-043-...
280
+ ...
281
+
282
+ ADVISORY only (38):
283
+ Most common advisory gate: Completeness (38 of 38; legacy template predates canonical seven).
284
+ Listed by ADR id; expand on request.
285
+
286
+ FAIL (4):
287
+ ADR-045-foo.md
288
+ Evidence: line 24 ("faster") with no measurement.
289
+ ADR-046-bar.md
290
+ Consistency: filename ADR-046-bar.md but heading "# ADR-46 Bar" (line 1).
291
+ ...
292
+
293
+ SKIPPED (0)
294
+
295
+ Aggregate:
296
+ Most common FAIL gate: Evidence (3 of 4 failures).
297
+ Next steps: focus on ADR-045-foo.md, which fails 2 of 4 gates.
298
+ ```
299
+
300
+ The aggregate's bottom line always names the FAIL count, never the ADVISORY count. ADVISORY is informational; FAIL is what the user is asked to act on.
301
+
302
+ ## When you find no ADRs
303
+
304
+ If `docs/adr/` is empty or does not exist, say so plainly:
305
+
306
+ ```
307
+ No ADRs found at docs/adr/. The toolkit is installed but no decisions have been recorded yet.
308
+ Create your first ADR with /adr-kit:adr.
309
+ ```
310
+
311
+ ## Reporting
312
+
313
+ Always end with a single recommended next action that points at a FAIL, not an ADVISORY. ADVISORY findings are background noise the project has explicitly chosen to tolerate; FAIL findings are what the user is being asked to fix. The next-action sentence names which ADR to fix first (the one with the most FAIL gates, or the most-referenced one) and which gate to focus on. Concrete, not abstract.
314
+
315
+ If the run produced zero FAILs, say so plainly: "All linted ADRs pass at the configured severity. <N> ADVISORY findings remain, treated as informational by the project's policy." Do not invent a FAIL where there is none.
316
+
317
+ ## What you do *not* do
318
+
319
+ - You do not modify ADRs. Read-only by design.
320
+ - You do not invoke the `adr-generator` agent. The lint skill is informational; the user decides whether to fix.
321
+ - You do not call out style preferences that are not in the four gates. No bikeshedding on heading capitalisation, list-marker style, or whitespace. The gates are the contract.