@metasession.co/devaudit-cli 0.1.42 → 0.1.44

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metasession.co/devaudit-cli",
3
- "version": "0.1.42",
3
+ "version": "0.1.44",
4
4
  "description": "DevAudit CLI — installs, syncs, and operates the Metasession SDLC across consumer projects.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@clack/prompts": "^0.8.2",
36
- "@metasession.co/devaudit-plugin-sdk": "^0.1.42",
36
+ "@metasession.co/devaudit-plugin-sdk": "^0.1.44",
37
37
  "commander": "^12.1.0",
38
38
  "consola": "^3.2.3",
39
39
  "env-paths": "^3.0.0",
@@ -25,7 +25,7 @@ description: Define a new requirement in the RTM, classify risk, create implemen
25
25
 
26
26
  ### Step 1: Identify the GitHub Issue
27
27
 
28
- Every tracked change starts from a GitHub Issue. The issue provides the *what* and *why*; the RTM provides the compliance audit trail.
28
+ Every tracked change starts from a GitHub Issue. The issue provides the _what_ and _why_; the RTM provides the compliance audit trail.
29
29
 
30
30
  - If the user references an issue number (e.g., `#123`): fetch its title, description, and labels using `gh issue view 123`.
31
31
  - If the user describes work without an issue: ask **"Is there a GitHub Issue for this, or should we create one?"**
@@ -42,11 +42,11 @@ The next ID is one higher (e.g., if the last is REQ-007, use REQ-008).
42
42
 
43
43
  ### Step 3: Classify Risk Level
44
44
 
45
- | Risk Level | Criteria |
46
- |---|---|
47
- | **Low** | Internal tools, no regulated data, no auth changes |
45
+ | Risk Level | Criteria |
46
+ | ---------- | ---------------------------------------------------------------- |
47
+ | **Low** | Internal tools, no regulated data, no auth changes |
48
48
  | **Medium** | Touches PII, user-facing features, API changes, new dependencies |
49
- | **High** | Security, payments, RBAC, data handling, authentication |
49
+ | **High** | Security, payments, RBAC, data handling, authentication |
50
50
 
51
51
  AI involvement raises risk by one level when touching Medium or High categories. See Test Policy for the full risk matrix.
52
52
 
@@ -68,11 +68,12 @@ mkdir -p compliance/evidence/REQ-XXX
68
68
 
69
69
  ### Step 6: Implementation Plan (MEDIUM/HIGH Risk — Required)
70
70
 
71
- For MEDIUM and HIGH risk requirements, create an implementation plan before defining test scope. The implementation plan defines *what code changes are needed* — the test scope is then derived from it.
71
+ For MEDIUM and HIGH risk requirements, create an implementation plan before defining test scope. The implementation plan defines _what code changes are needed_ — the test scope is then derived from it.
72
72
 
73
73
  **Skip this step** for LOW risk requirements — proceed directly to Step 7.
74
74
 
75
75
  **6a. Explore the codebase:**
76
+
76
77
  - Understand existing patterns, models, services, and API routes relevant to the change
77
78
  - Identify files that will be created, modified, or affected
78
79
 
@@ -89,25 +90,35 @@ Create `compliance/evidence/REQ-XXX/implementation-plan.md`:
89
90
  **Date:** [YYYY-MM-DD]
90
91
 
91
92
  ## Approach
93
+
92
94
  [1-3 sentences describing the overall approach]
93
95
 
94
96
  ## Files to Create
97
+
95
98
  - `path/to/new-file.ts` — [purpose]
96
99
 
97
100
  ## Files to Modify
101
+
98
102
  - `path/to/existing-file.ts` — [what changes and why]
99
103
 
100
104
  ## Architecture Decisions
101
- - [Key decision 1 and rationale]
102
- - [Key decision 2 and rationale]
105
+
106
+ > Populated by the [`adr-author` skill](../skills/adr-author/SKILL.md) at Stage 1 plan APPROVAL. The skill applies a decision tree (new third-party dependency / new database, cache, or queue / new external service / pattern change spanning > 3 files / HIGH-CRITICAL risk) and either drafts `docs/ADR/ADR-NNN-<slug>.md` + injects "Produced ADR-NNN: <title>" here, or injects "No ADR needed — <one-line rationale>" so the question is visibly asked and answered. Don't author this section inline as bullets — the persistent decision lives in `docs/ADR/`, not buried in the plan.
107
+
108
+ - ADR-NNN — <title> (`docs/ADR/ADR-NNN-<slug>.md`) — Operator edits stub + flips to _Accepted_ before APPROVAL — OR — No ADR needed — <rationale>
103
109
 
104
110
  ## Dependencies
111
+
105
112
  - [New packages needed, or "None"]
106
113
 
107
114
  ## Risks / Considerations
108
- - [Anything that could go wrong or needs special attention]
115
+
116
+ > Populated by the [`risk-register-keeper` skill](../skills/risk-register-keeper/SKILL.md) at Stage 1 for MEDIUM/HIGH risk REQs (LOW skipped by default per `sdlc-config.json:risk_register_keeper.stage_1_min_risk_class`). The skill identifies discrete risks the change introduces, allocates `RISK-NNN` per project, drafts canonical rows in `compliance/risk-register.md`, and injects the RISK-NNN reference list here (replacing the inline bullets). Don't author this section inline as bullets — the persistent risk record lives in `compliance/risk-register.md`, not buried in the plan.
117
+
118
+ - RISK-NNN — <title> (`compliance/risk-register.md`) — Operator edits canonical row + signs off residual rating before APPROVAL — OR — @risk-deferred — <rationale>
109
119
 
110
120
  ## Post-Deploy Actions
121
+
111
122
  - [Data migrations, backfill scripts, schema changes — or "None"]
112
123
  - [If any: create script in `scripts/`, document exact command and target environment]
113
124
  ```
@@ -115,6 +126,7 @@ Create `compliance/evidence/REQ-XXX/implementation-plan.md`:
115
126
  ### WAIT CHECKPOINT: Implementation Plan Review
116
127
 
117
128
  **Present the implementation plan to the developer.** Summarize:
129
+
118
130
  - Approach and rationale
119
131
  - Files to create/modify
120
132
  - Architecture decisions
@@ -275,6 +287,7 @@ EOF
275
287
  ### WAIT CHECKPOINT: Test Scope Review
276
288
 
277
289
  **Present the test scope to the developer.** Summarize:
290
+
278
291
  - Risk classification and rationale
279
292
  - Test approach (which additional testing applies)
280
293
  - Acceptance criteria
@@ -330,6 +343,7 @@ EOF
330
343
  ### WAIT CHECKPOINT: Test Plan Review
331
344
 
332
345
  **Present the test plan to the developer.** Summarize:
346
+
333
347
  - Tests to add, update, and remove
334
348
  - How acceptance criteria map to specific tests
335
349
  - Any non-functional testing required
@@ -21,27 +21,27 @@ authored_at: "REPLACE — YYYY-MM-DD"
21
21
 
22
22
  **Closes clauses** (every implementation plan satisfies all four):
23
23
 
24
- | Clause | What this plan must contain |
25
- |---|---|
26
- | **ISO 29119 §3.4** Test Plan | Acceptance criteria + the strategy for verifying each one. Reference the per-REQ `test-plan.md` if it lives separately. |
27
- | **ISO 27001 A.8.25** Secure development life cycle | Threat model + secure-design considerations (auth, data handling, dependencies, secrets). |
24
+ | Clause | What this plan must contain |
25
+ | --------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
26
+ | **ISO 29119 §3.4** Test Plan | Acceptance criteria + the strategy for verifying each one. Reference the per-REQ `test-plan.md` if it lives separately. |
27
+ | **ISO 27001 A.8.25** Secure development life cycle | Threat model + secure-design considerations (auth, data handling, dependencies, secrets). |
28
28
  | **GDPR Art. 25** Data protection by design and by default | Per-purpose data flows; minimisation; lawful basis; retention. **Required for any REQ that processes personal data; explicit "no personal data" callout if not.** |
29
- | **EU AI Act Art. 11** Technical documentation (Annex IV) | When the REQ touches AI / model behaviour: model provenance, prompt sources, oversight path. **Explicit "no AI in scope" callout if not.** |
29
+ | **EU AI Act Art. 11** Technical documentation (Annex IV) | When the REQ touches AI / model behaviour: model provenance, prompt sources, oversight path. **Explicit "no AI in scope" callout if not.** |
30
30
 
31
31
  Each section below maps to one (or more) of these clauses. Don't delete sections — mark with "N/A — <reason>" if the clause genuinely doesn't apply.
32
32
 
33
33
  ## 1. Goal + acceptance criteria
34
34
 
35
- > *Closes ISO 29119 §3.4 — test plan*
35
+ > _Closes ISO 29119 §3.4 — test plan_
36
36
 
37
37
  - **Goal:** REPLACE — one sentence describing what this REQ delivers, no jargon.
38
38
  - **Acceptance criteria:**
39
39
 
40
- | AC | Description | SRS item it traces to |
41
- |---|---|---|
40
+ | AC | Description | SRS item it traces to |
41
+ | --- | ------------------------------------------ | --------------------------------------------------------------------------------------- |
42
42
  | AC1 | REPLACE — one-line behavioural description | REQ-AREA-NNN (existing) / REQ-AREA-NNN (new — propose stub) / `@srs-deferred: <reason>` |
43
- | AC2 | REPLACE | REPLACE |
44
- | … | | |
43
+ | AC2 | REPLACE | REPLACE |
44
+ | … | | |
45
45
 
46
46
  > **SRS-ID column populated by the `requirements-aligner` skill** at Stage 1 plan APPROVAL. The skill fuzzy-matches each AC against `docs/SRS.md`, proposes new `REQ-AREA-NNN` stubs for behaviour the SRS doesn't yet describe, and flags stale items. Plan APPROVAL blocks (configurable per `sdlc-config.json:requirements_aligner.block_on_stage_1`, ramp-up mode default-on for legacy projects) until every AC has either an existing SRS item, a new SRS-ID stub added in this cycle, or an explicit `@srs-deferred` annotation. See [`requirements-aligner` skill](../skills/requirements-aligner/SKILL.md).
47
47
 
@@ -50,22 +50,49 @@ Each section below maps to one (or more) of these clauses. Don't delete sections
50
50
  - **In scope:** REPLACE — list every file / module / surface the change touches.
51
51
  - **Out of scope:** REPLACE — adjacent areas the change deliberately leaves alone.
52
52
 
53
- ## 3. Threat model + security considerations
53
+ ## 3. Architecture decisions
54
54
 
55
- > *Closes ISO 27001 A.8.25 secure development life cycle*
55
+ > _Populated by the [`adr-author` skill](../skills/adr-author/SKILL.md) at Stage 1 plan APPROVAL._
56
56
 
57
- | Threat | Likelihood | Impact | Mitigation |
58
- |---|---|---|---|
59
- | REPLACE — e.g. SQL injection via X param | REPLACE | REPLACE | REPLACE |
60
- | REPLACE — e.g. unauthenticated access to Y route | REPLACE | REPLACE | REPLACE |
57
+ Either an ADR-NNN reference list (when the skill judges the REQ architecturally significant) OR an explicit "no ADR" rationale. **Don't author this section inline as bullets** — the `adr-author` skill applies its decision tree and either drafts a `docs/ADR/ADR-NNN-<slug>.md` stub the operator edits, or annotates the no-ADR case.
58
+
59
+ When **ADR warranted**:
60
+
61
+ - **ADR-NNN — <decision title>** — Drafted by `adr-author`. File at `docs/ADR/ADR-NNN-<slug>.md`. Operator edits stub to canonical prose + flips status to _Accepted_ before plan APPROVAL.
62
+
63
+ When **No ADR needed**:
64
+
65
+ - **No ADR needed** — REPLACE one-line rationale. Examples: "Bug fix touching only `lib/services/order-service.ts:applyDiscount` — no structural change." / "CSS-only adjustment — no behavioural or dependency change." / "Patch-level dependency bump with no API change."
66
+
67
+ The negative case is audit evidence too — auditors examine "no ADR — <rationale>" to confirm the question was asked. Never leave this section empty.
68
+
69
+ ## 4. Threat model + security considerations
70
+
71
+ > _Closes ISO 27001 A.8.25 — secure development life cycle_
72
+
73
+ | Threat | Likelihood | Impact | Mitigation |
74
+ | ------------------------------------------------ | ---------- | ------- | ---------- |
75
+ | REPLACE — e.g. SQL injection via X param | REPLACE | REPLACE | REPLACE |
76
+ | REPLACE — e.g. unauthenticated access to Y route | REPLACE | REPLACE | REPLACE |
61
77
 
62
78
  **Secrets / credentials:** REPLACE — does this REQ handle any? If yes, how stored, rotated, scoped?
63
79
 
64
80
  **Dependencies introduced:** REPLACE — list new npm/pip packages; flag any with known CVEs or transitive concerns.
65
81
 
66
- ## 4. Data protection (GDPR Art. 25)
82
+ ### Risk register entries
83
+
84
+ > _Populated by the [`risk-register-keeper` skill](../skills/risk-register-keeper/SKILL.md) for MEDIUM/HIGH risk REQs at Stage 1 plan APPROVAL. The persistent risk record lives in [`compliance/risk-register.md`](../../risk-register.md); this section references the RISK-NNN entries this REQ opened, mitigated, or accepted._
85
+
86
+ When **risk class is MEDIUM or HIGH**, expect a list like:
87
+
88
+ - **RISK-NNN — <title>** — Status: OPEN. Opened by `risk-register-keeper`. Operator edits canonical row + signs off residual rating before plan APPROVAL.
89
+ - **RISK-NNN — <title>** — Status: MITIGATED. Controls landing in this PR close the residual.
90
+
91
+ When **risk class is LOW** OR no register-worthy risk is identified, write: _"@risk-deferred: <one-line rationale>"_ — the negative case is audit evidence too. Don't leave this section empty.
92
+
93
+ ## 5. Data protection (GDPR Art. 25)
67
94
 
68
- > *Closes GDPR Art. 25 — data protection by design*
95
+ > _Closes GDPR Art. 25 — data protection by design_
69
96
 
70
97
  **Personal data processed by this REQ:** REPLACE — yes / no.
71
98
 
@@ -83,11 +110,11 @@ If **yes**, fill in:
83
110
  - Is a DPIA required? REPLACE — yes (file under `compliance/governance/dpia-<reqid>.md`) / no / N/A
84
111
  - **Cross-border transfers:** REPLACE — none / specify mechanism
85
112
 
86
- If **no**, write: *"N/A — this REQ does not process personal data. <Why — e.g. UI-only change, internal-routing refactor, dev-tooling.>"*
113
+ If **no**, write: _"N/A — this REQ does not process personal data. <Why — e.g. UI-only change, internal-routing refactor, dev-tooling.>"_
87
114
 
88
- ## 5. AI / model considerations (EU AI Act Art. 11)
115
+ ## 6. AI / model considerations (EU AI Act Art. 11)
89
116
 
90
- > *Closes EUAIA Art. 11 — technical documentation*
117
+ > _Closes EUAIA Art. 11 — technical documentation_
91
118
 
92
119
  **AI / ML in scope for this REQ:** REPLACE — yes / no.
93
120
 
@@ -101,15 +128,15 @@ If **yes**, fill in:
101
128
  - **Cross-references:**
102
129
  - Is `compliance/governance/ai-disclosure.md` updated? REPLACE — yes / no / N/A
103
130
 
104
- If **no**, write: *"N/A — this REQ does not introduce or change AI behaviour. <Why.>"*
131
+ If **no**, write: _"N/A — this REQ does not introduce or change AI behaviour. <Why.>"_
105
132
 
106
- ## 6. Rollback plan
133
+ ## 7. Rollback plan
107
134
 
108
135
  - **Reversible via:** REPLACE — git revert / migration down / config flip / etc.
109
136
  - **Data implications of rollback:** REPLACE — any data written by the new code that an older version can't read?
110
137
  - **Notification path if rollback during a release:** REPLACE — who hears, how quickly?
111
138
 
112
- ## 7. Verification
139
+ ## 8. Verification
113
140
 
114
141
  How the team will know the REQ is correct in production:
115
142
 
@@ -118,7 +145,7 @@ How the team will know the REQ is correct in production:
118
145
  - **Manual smoke after deploy:** REPLACE — bullet-list, or "none" with reason
119
146
  - **Monitoring / alerting:** REPLACE — what dashboards / alerts the change adds or relies on
120
147
 
121
- ## 8. Sign-off
148
+ ## 9. Sign-off
122
149
 
123
150
  - **Plan reviewer (eng):** REPLACE — name + date
124
151
  - **Plan reviewer (security / DPO):** REPLACE — when GDPR or threat-model sections are non-trivial; otherwise "N/A"
@@ -0,0 +1,116 @@
1
+ ---
2
+ title: 'Risk register'
3
+ project: 'REPLACE — project name'
4
+ maintained_by: 'risk-register-keeper skill (DevAudit-Installer v0.1.44+)'
5
+ scoring_matrix: 'likelihood × impact (3×3)'
6
+ last_reviewed_at: 'REPLACE — YYYY-MM-DD'
7
+ review_cadence_days: 90
8
+ ---
9
+
10
+ > ⚠️ **STARTER TEMPLATE — REPLACE BEFORE COMMITTING.**
11
+ > Installed on demand via `devaudit bootstrap-governance` as a starting point.
12
+ > It does **not** describe your project's actual risks. The `risk-register-keeper` skill (DevAudit-Installer#121) maintains this file as REQs land, incidents close, and accepted risks come due for re-validation.
13
+ > Auditors reject unedited stubs.
14
+
15
+ # Risk register — REPLACE project
16
+
17
+ **Framework coverage:** primary audit surface for `SOC2.CC3.2` (Risk identification and assessment), `SOC2.CC3.4` (Risk monitoring), `ISO27001.A.5.1` (Policies for information security — risk-driven), `ISO27001.A.6.2` (Risk management procedures), `GDPR.Art-32` (Security of processing — risk-based) when a risk pertains to personal-data processing.
18
+
19
+ **Maintained by:** the [`risk-register-keeper` skill](../../.claude/skills/risk-register-keeper/SKILL.md) at Stage 1 (MEDIUM/HIGH risk classification — open new entries), at incident close (residual-risk entries), and at Stage 3 (per-REQ `risk-assessment.md` artefact summarises entries touched).
20
+
21
+ **Scoring:** likelihood × impact, 3×3 matrix (low / medium / high). CVSS-aware scoring deferred to Phase B.
22
+
23
+ ---
24
+
25
+ ## Scoring matrix
26
+
27
+ | Inherent + Residual rating | Likelihood (frequency / ease-of-exploit) | Impact (worst-case if realised) |
28
+ |---|---|---|
29
+ | **Low** | Unlikely in a typical year; requires unusual access or coincidence | Recoverable inconvenience; no regulatory exposure |
30
+ | **Medium** | Plausible within a year; standard skill or access | Recoverable but disruptive; possible reportable incident |
31
+ | **High** | Probable within months; trivial to trigger | Material loss; regulatory reporting required |
32
+
33
+ Residual = post-mitigation rating. **A risk's residual rating drives review cadence:** Low = annual, Medium = quarterly, High = monthly until reduced.
34
+
35
+ ---
36
+
37
+ ## OPEN risks
38
+
39
+ > Risks currently being treated — controls planned but not yet demonstrated effective, or monitoring continues.
40
+
41
+ ### RISK-001 — REPLACE one-line title
42
+
43
+ - **Status:** OPEN
44
+ - **Opened:** YYYY-MM-DD (REQ-XXX) — REPLACE
45
+ - **Owner:** REPLACE — operator
46
+ - **Description:** REPLACE — what the risk is, in operator-readable terms (2-3 sentences).
47
+ - **Inherent likelihood × impact:** REPLACE (e.g. medium × high)
48
+ - **Mitigations planned / in flight:** REPLACE — list controls being applied
49
+ - **Residual likelihood × impact (post-mitigation):** REPLACE
50
+ - **Framework cross-references:** REPLACE — ISO27001.A.X.Y / SOC2.CC3.2 / GDPR.Art-32 (as applicable)
51
+ - **Review due:** YYYY-MM-DD (default: monthly for OPEN-HIGH, quarterly for OPEN-MEDIUM, annually for OPEN-LOW)
52
+ - **Cross-links:** REPLACE — REQ-XXX implementation plan / ADR-NNN / incident-report-N
53
+
54
+ ---
55
+
56
+ ## MITIGATED risks
57
+
58
+ > Risks whose controls have landed and been demonstrated effective. Residual rating ≤ Low. Periodic re-validation confirms controls remain effective.
59
+
60
+ ### RISK-NNN — example template
61
+
62
+ - **Status:** MITIGATED
63
+ - **Opened:** YYYY-MM-DD (REQ-XXX) / **Mitigated:** YYYY-MM-DD
64
+ - **Owner:** REPLACE
65
+ - **Description:** REPLACE
66
+ - **Original inherent likelihood × impact:** medium × high
67
+ - **Mitigations applied:** REPLACE — list controls + evidence reference (e.g. "rate limit middleware shipped REQ-042; verified via integration test in `__tests__/auth/rate-limit.test.ts`")
68
+ - **Residual likelihood × impact:** low × low
69
+ - **Framework cross-references:** REPLACE
70
+ - **Re-validation due:** YYYY-MM-DD (default: annually for MITIGATED)
71
+ - **Cross-links:** REPLACE
72
+
73
+ ---
74
+
75
+ ## ACCEPTED risks
76
+
77
+ > Risks the operator has explicitly chosen to accept (typically: residual is tolerable + mitigation cost exceeds expected loss). Each acceptance needs sign-off + a periodic re-validation date.
78
+
79
+ ### RISK-NNN — example template
80
+
81
+ - **Status:** ACCEPTED
82
+ - **Opened:** YYYY-MM-DD / **Accepted:** YYYY-MM-DD
83
+ - **Owner:** REPLACE
84
+ - **Description:** REPLACE
85
+ - **Inherent likelihood × impact:** REPLACE
86
+ - **Mitigations applied:** REPLACE — partial mitigations + why full mitigation isn't pursued
87
+ - **Residual likelihood × impact:** REPLACE — tolerated
88
+ - **Acceptance rationale:** REPLACE — why the operator judges this acceptable (cost / use-case / compensating controls / regulatory context)
89
+ - **Acceptance sign-off:** REPLACE — operator name + date. For organisations with separate risk-owner role, the risk-owner signs off here, not the implementing engineer.
90
+ - **Framework cross-references:** REPLACE
91
+ - **Re-validation due:** YYYY-MM-DD (default: every 365d; sooner if the risk landscape changes)
92
+ - **Cross-links:** REPLACE
93
+
94
+ ---
95
+
96
+ ## CLOSED risks
97
+
98
+ > Risks that no longer apply (removed scope, deprecated dependency, etc.). Kept on the register for audit-trail completeness — auditors examine what was closed and why.
99
+
100
+ ### RISK-NNN — example template
101
+
102
+ - **Status:** CLOSED
103
+ - **Opened:** YYYY-MM-DD / **Closed:** YYYY-MM-DD
104
+ - **Owner:** REPLACE
105
+ - **Description:** REPLACE
106
+ - **Close rationale:** REPLACE — why this risk no longer applies (e.g. "feature deprecated REQ-080", "dependency removed REQ-095", "external dependency now provides the control")
107
+ - **Cross-links:** REPLACE
108
+
109
+ ---
110
+
111
+ ## Audit-trail rules
112
+
113
+ - **Append-only edits.** Never delete a RISK-NNN entry. Status transitions (OPEN → MITIGATED → ACCEPTED → CLOSED) are visible audit history.
114
+ - **Re-validation cadence is binding.** When an ACCEPTED risk's `Re-validation due:` date passes, the operator must either re-sign or change status. Stale acceptances are an audit finding.
115
+ - **Cross-linking is bidirectional.** When an entry references an incident report, the incident report's frontmatter references the entry. When an entry references an ADR, the ADR references the entry.
116
+ - **`solo_with_gap` projects** must carry a documented control-gap entry referencing `SOC2.CC8.1` — see the `risk-register-keeper` skill's Phase 4 for the canonical entry shape.
@@ -0,0 +1,266 @@
1
+ ---
2
+ name: adr-author
3
+ description: Catch the moment a tracked change makes an architecturally significant decision and either draft the canonical `docs/ADR/ADR-NNN-<slug>.md` artefact or document why no ADR was needed. Runs at Stage 1 (plan APPROVAL) and Stage 3 (evidence pack) of the SDLC. Decides "is this REQ architecturally significant?" via a calibrated heuristic (new third-party dependency, new database/cache/queue, new external service, pattern change spanning >3 files, HIGH/CRITICAL risk class), drafts a Context/Decision/Consequences/Alternatives/Status stub when warranted, allocates the next `ADR-NNN` ID, injects an ADR-NNN reference into the implementation plan, and produces a per-REQ `compliance/evidence/REQ-XXX/architecture-decision.md` artefact. Use when invoking on a single REQ ("draft an ADR for REQ-066", "does this REQ need an ADR?", "is the architectural decision documented?"); when `sdlc-implementer` delegates at Stage 1 plan-approval or Stage 3 evidence-compilation; when an operator asks for ADR-worthiness judgement on an in-flight branch. Do NOT use for authoring full ADR prose end-to-end (the operator edits the stub to canonical wording); for supersession-lifecycle handling (deferred to Phase B); for cross-link maintenance between ADRs and risk-register entries (that's `risk-register-keeper`); for framework-clause mapping of the `architecture_decision` evidence type (that's META-COMPLY's `framework-registry-auditor`).
4
+ ---
5
+
6
+ # ADR Author
7
+
8
+ Catches the moment a tracked REQ makes an architecturally significant decision that should produce a persistent record — and either drafts the ADR or documents why no ADR was needed. Sibling of [`requirements-aligner`](../requirements-aligner/SKILL.md) and `risk-register-keeper` in the SoT-alignment skill family.
9
+
10
+ The skill is **Phase A scope** (per [DevAudit-Installer#120](https://github.com/metasession-dev/DevAudit-Installer/issues/120)): Stage 1 + Stage 3 hooks only. Supersession-lifecycle, stale-decision detection, and cross-link maintenance between ADRs and other SoT artefacts all defer to Phase B — the v1 surface is the safest enforcement points.
11
+
12
+ ## What this skill owns
13
+
14
+ | Artefact | Lives at | Tier |
15
+ |---|---|---|
16
+ | `docs/ADR/ADR-NNN-<slug>.md` (the SoT, project-spanning) | Top-level project docs | 2 (project strategy) |
17
+ | `compliance/evidence/REQ-XXX/architecture-decision.md` (per-REQ Tier 3 evidence) | Per-REQ evidence directory | 3 (per-REQ) |
18
+
19
+ The skill does **not** own the canonical ADR prose. It drafts a stub the operator edits to publication-grade wording. Inventing decision rationale without operator review is exactly the kind of silent-drift this skill exists to prevent.
20
+
21
+ ## Scope
22
+
23
+ **In scope**
24
+
25
+ - Phase 1 (Stage-1 hook) — judge "is this REQ architecturally significant?" → if yes, allocate `ADR-NNN` + draft Context/Decision/Consequences/Alternatives/Status stub → inject ADR-NNN reference into implementation plan's *Architecture Decisions* section.
26
+ - Phase 2 (Stage-3 hook) — drop `compliance/evidence/REQ-XXX/architecture-decision.md` pointing at the ADR file (or recording the no-ADR rationale).
27
+ - Per-REQ ADR-worthiness audit (operator invocation).
28
+
29
+ **Out of scope**
30
+
31
+ - Drafting canonical ADR prose end-to-end — the skill drafts a stub; the operator authors final wording.
32
+ - Supersession lifecycle — when ADR-007 supersedes ADR-003, both stay on disk; ADR-003's status flips to `Superseded by ADR-007`. Deferred to Phase B.
33
+ - Stale-decision detection — when the file referenced by ADR-007's *Decision* section is heavily modified in a new REQ without producing a new ADR. Deferred to Phase B.
34
+ - Cross-link maintenance to SRS items (`requirements-aligner`'s domain) or risk-register entries (`risk-register-keeper`'s domain) — the skills cross-reference each other in their stubs but Phase B owns the bidirectional consistency.
35
+ - Framework-clause mapping of the `architecture_decision` evidence type — that's META-COMPLY's `framework-registry-auditor`.
36
+
37
+ ## The workflow
38
+
39
+ Five phases. Phase 0 routes; Phases 1–2 are the SDLC stage hooks; Phase 3 is the utility audit; Phase 4 reports.
40
+
41
+ ### Phase 0 — Route
42
+
43
+ Determine what's being decided:
44
+
45
+ - **Stage-1 plan APPROVAL** — `sdlc-implementer` (or operator) says *"check ADR-worthiness for REQ-XXX before approving the plan"* / *"does this need an ADR?"* → Phase 1.
46
+ - **Stage-3 evidence pack** — `sdlc-implementer` (or operator) says *"drop the architecture-decision.md for REQ-XXX"* → Phase 2.
47
+ - **Per-REQ ad-hoc audit** — operator says *"is REQ-XXX's architectural decision documented?"* / *"audit ADR-worthiness across this branch"* → Phase 3.
48
+
49
+ The skill does not fire spontaneously. The parent skill (`sdlc-implementer`) invokes it at Stages 1 + 3 per the parent's SKILL.md delegation contract.
50
+
51
+ ### Phase 1 — Stage-1 plan APPROVAL hook
52
+
53
+ Input: the REQ's `compliance/plans/REQ-XXX/implementation-plan.md` plus the working-tree diff.
54
+
55
+ **Step 1 — Read the file list + diff.** Identify which files the REQ touches.
56
+
57
+ **Step 2 — Apply the ADR-worthiness decision tree.** The skill judges *architectural significance* via these signals — any one matching ⇒ ADR warranted:
58
+
59
+ | Signal | Examples | Verdict |
60
+ |---|---|---|
61
+ | New third-party runtime dependency | adding `redis`, `bull`, a new ORM, a new auth provider package | ADR |
62
+ | New external service | introducing Stripe, Twilio, a new SaaS integration | ADR |
63
+ | New database / cache / queue tier | adding Redis alongside Postgres, swapping MongoDB for Postgres | ADR |
64
+ | Pattern change spanning > 3 files | moving from REST handlers to RPC, swapping auth flow across the API surface | ADR |
65
+ | Schema-level data model change | new tables that other tables FK to, fundamental relationship changes | ADR |
66
+ | Risk classification HIGH or CRITICAL | per `Test_Policy.md` §Risk-Based Testing | ADR (operator confirms) |
67
+ | File-path signal | `sdlc-config.json:adr_author.file_paths_signal_architecture` matches a touched file | ADR (operator confirms) |
68
+ | Bug fix touching ≤ 3 files in `app/` or `lib/` | a typo, a copy edit, a null-guard, a one-place validation | no ADR |
69
+ | Single-file refactor | extracting one function, renaming one variable | no ADR |
70
+ | Styling tweak | CSS-only, Tailwind class shuffle | no ADR |
71
+ | Dependency bump | `npm update foo` with no API change | no ADR |
72
+ | Documentation | `docs/`, `README.md`, doc-comments | no ADR |
73
+
74
+ **Step 3 — Branch on verdict:**
75
+
76
+ - **ADR warranted** → Phase 1 Step 4 (draft the stub).
77
+ - **No ADR** → Phase 1 Step 7 (inject the no-ADR rationale).
78
+ - **Ambiguous** → surface a candidate verdict + reasoning to the operator and ask. The operator can confirm or override. Do NOT silently default.
79
+
80
+ **Step 4 — Allocate the next `ADR-NNN`.** Scan `docs/ADR/` for the max-existing `ADR-NNN` (zero-padded to three digits where the project's convention has it) and propose `+1`. If `docs/ADR/` doesn't exist yet, create it + allocate `ADR-001`. The skill does NOT support cross-branch ID coordination — if two parallel branches both consume the same next-free ID, the git merge on the directory is the canonical conflict signal. Re-run the skill post-merge to re-allocate.
81
+
82
+ **Step 5 — Draft the stub `docs/ADR/ADR-NNN-<slug>.md`.** The slug is a kebab-case fragment of the decision (max 6 words). Format:
83
+
84
+ ```markdown
85
+ ---
86
+ adr_id: "ADR-NNN"
87
+ status: "Proposed"
88
+ date: "YYYY-MM-DD"
89
+ authored_by: "REPLACE — operator / agent"
90
+ related_reqs: ["REQ-XXX"]
91
+ supersedes: []
92
+ superseded_by: null
93
+ ---
94
+
95
+ # ADR-NNN: <decision title>
96
+
97
+ ## Status
98
+
99
+ **Proposed** (DRAFT — operator to flip to *Accepted* on plan APPROVAL)
100
+
101
+ ## Context
102
+
103
+ REPLACE — what forces (constraints, requirements, tradeoffs) motivate this decision? Two or three sentences. Reference REQ-XXX and any SRS items it traces to.
104
+
105
+ ## Decision
106
+
107
+ REPLACE — the choice made. One paragraph. Specific (not "we will use a queue" — "we will use Redis Streams as the queue substrate; consumers are FastAPI workers using `redis-py` ≥ 5.x").
108
+
109
+ ## Consequences
110
+
111
+ REPLACE — what follows. List both **good** and **bad** consequences honestly.
112
+
113
+ - **Good:** REPLACE
114
+ - **Bad:** REPLACE
115
+ - **Neutral / tradeoffs:** REPLACE
116
+
117
+ ## Alternatives considered
118
+
119
+ REPLACE — what other paths were on the table and why they were ruled out. At least one alternative; "we considered nothing else" is almost never honest.
120
+
121
+ - **Alternative 1:** REPLACE — ruled out because REPLACE
122
+ - **Alternative 2:** REPLACE — ruled out because REPLACE
123
+
124
+ ## Cross-references
125
+
126
+ - Implementation plan: `compliance/plans/REQ-XXX/implementation-plan.md`
127
+ - SRS items: REPLACE — list `REQ-AREA-NNN` items this decision affects, from `requirements-aligner` output
128
+ - Risk register: REPLACE — list `RISK-NNN` entries this decision touches, from `risk-register-keeper` output (when that skill exists)
129
+ - Supersedes / superseded-by: REPLACE — fill if this ADR replaces a prior one
130
+ ```
131
+
132
+ The stub is **draft-quality**; the operator edits each REPLACE marker before flipping the status from *Proposed* to *Accepted*.
133
+
134
+ **Step 6 — Inject ADR-NNN reference into the implementation plan.** The plan's *Architecture Decisions* section (converted from inline bullets to ADR-NNN references in this PR — see `Implementation_Plan_TEMPLATE.md`) gets a row added:
135
+
136
+ ```markdown
137
+ ## Architecture decisions
138
+
139
+ - **ADR-NNN — <decision title>** — Proposed by `adr-author` skill. Draft at `docs/ADR/ADR-NNN-<slug>.md`. Operator edits + flips status to *Accepted* before plan APPROVAL.
140
+ ```
141
+
142
+ **Step 7 — No-ADR rationale.** When the verdict is *no ADR*, the plan's *Architecture decisions* section gets:
143
+
144
+ ```markdown
145
+ ## Architecture decisions
146
+
147
+ - **No ADR needed** — REPLACE one-line rationale. Examples: "Bug fix touching only `lib/services/order-service.ts:applyDiscount` — no structural change." / "CSS-only adjustment to dashboard layout — no behavioural or dependency change." / "Dependency bump from `foo@1.2.3` to `foo@1.2.5` (patch-level, no API change)."
148
+ ```
149
+
150
+ The annotation is visible audit evidence that the *question was asked and answered* — auditors examine the negative case as well as the positive.
151
+
152
+ **Step 8 — Block plan APPROVAL** until each REQ has either:
153
+ - (a) an ADR file in this PR (status: Proposed → Accepted by operator), OR
154
+ - (b) an explicit "No ADR needed — <rationale>" annotation.
155
+
156
+ The block is configurable via `sdlc-config.json` — see *Configuration* below. Per the [#119 review](https://github.com/metasession-dev/DevAudit-Installer/issues/119#issuecomment-4631840651) defaults, advisory-with-strong-recommend in v1 (`block_on_stage_1: false`).
157
+
158
+ ### Phase 2 — Stage-3 evidence pack hook
159
+
160
+ Input: the REQ's implementation plan (post-approval) and the working-tree diff.
161
+
162
+ **Step 1 — Generate `compliance/evidence/REQ-XXX/architecture-decision.md`.** Format:
163
+
164
+ ```markdown
165
+ ---
166
+ req: REQ-XXX
167
+ generated_by: adr-author
168
+ generated_at: <ISO timestamp>
169
+ ---
170
+
171
+ # Architecture decision — REQ-XXX
172
+
173
+ ## Outcome
174
+
175
+ REPLACE — one of:
176
+
177
+ - "**Produced ADR-NNN:** <title> (`docs/ADR/ADR-NNN-<slug>.md`)" — when an ADR was authored in this cycle
178
+ - "**No ADR needed** — <rationale>" — when the no-ADR branch was taken
179
+
180
+ ## Detail
181
+
182
+ When **Produced ADR-NNN**:
183
+
184
+ - **ADR file:** `docs/ADR/ADR-NNN-<slug>.md`
185
+ - **Status:** Accepted (operator-confirmed during plan APPROVAL)
186
+ - **Summary:** REPLACE — one sentence from the ADR's *Decision* section
187
+ - **Affected files:** REPLACE — the file-path signals that triggered the verdict
188
+ - **Cross-references:** REPLACE — SRS items, risk-register entries
189
+
190
+ When **No ADR needed**:
191
+
192
+ - **Rationale:** REPLACE — one-line description copied from the plan's *Architecture decisions* section
193
+ - **Signals examined:** REPLACE — which signals from the decision tree were checked + how each scored
194
+
195
+ ## Operator sign-off
196
+
197
+ I have reviewed the ADR-worthiness verdict above and confirm:
198
+
199
+ - [ ] The verdict (ADR or no-ADR) matches the actual scope of this REQ.
200
+ - [ ] If ADR: the file at `docs/ADR/ADR-NNN-<slug>.md` is edited from stub to canonical prose and status is Accepted.
201
+ - [ ] If no-ADR: the rationale is specific enough that an auditor reading this in 12 months would agree.
202
+
203
+ **Reviewer:** <operator-name>
204
+ **Date:** <YYYY-MM-DD>
205
+ ```
206
+
207
+ **Step 2 — Tag for upload.** The CI's `compliance-evidence.yml` uploads this file as `evidence_type=architecture_decision` (added to META-COMPLY's `EVIDENCE_TYPE_REGISTRY` in the paired sub-PR). The framework-coverage matrix maps this to clauses per `framework-registry-auditor`'s review — see the META-COMPLY-side PR for the final clause attributions (v1 may ship orphan-by-design if the auditor rejects proposed mappings; see [`requirements-aligner`](../requirements-aligner/SKILL.md) for the precedent).
208
+
209
+ **Step 3 — Hand-off back to `sdlc-implementer`.** The skill's job ends at the artefact + the operator sign-off. The parent orchestrator continues with the rest of Stage 3.
210
+
211
+ ### Phase 3 — Per-REQ ad-hoc audit
212
+
213
+ Same logic as Phase 1's Step 2 + Step 3, but produces a markdown report rather than blocking. Useful when an operator asks *"does REQ-XXX need an ADR?"* outside the SDLC orchestration flow, or runs *"audit ADR-worthiness across this branch"* to surface gaps.
214
+
215
+ ### Phase 4 — Report
216
+
217
+ - For Phase 1 — the plan's injected section + the block/allow decision.
218
+ - For Phase 2 — the artefact path + summary line.
219
+ - For Phase 3 — markdown report (per-REQ verdict + reasoning).
220
+
221
+ ## Configuration (sdlc-config.json)
222
+
223
+ ```json
224
+ {
225
+ "adr_author": {
226
+ "enabled": true,
227
+ "block_on_stage_1": false,
228
+ "block_on_stage_3": true,
229
+ "file_paths_signal_architecture": [
230
+ "lib/services/",
231
+ "lib/repositories/",
232
+ "prisma/schema.prisma",
233
+ "infra/"
234
+ ]
235
+ }
236
+ }
237
+ ```
238
+
239
+ Per the [#119 review](https://github.com/metasession-dev/DevAudit-Installer/issues/119#issuecomment-4631840651) defaults:
240
+
241
+ - `block_on_stage_1: false` — advisory at Stage 1 by default. Operators flip to `true` once the heuristic is calibrated on the project (i.e. the skill's ADR/no-ADR verdicts have agreed with operator judgement on the last N runs).
242
+ - `block_on_stage_3: true` — the per-REQ evidence pack is the hard gate (the Stage 3 artefact is what actually lands as evidence; missing it leaks).
243
+ - `file_paths_signal_architecture` — list of file paths/prefixes that should signal an architectural change when touched. Defaults cover the common load-bearing surfaces; operators add project-specific paths (e.g. `infra/terraform/`, `app/auth/`).
244
+
245
+ ## Principles
246
+
247
+ **Don't author the ADR prose.** The skill drafts a stub the operator edits to publication-grade wording. Inventing decision rationale without operator review is exactly the kind of silent-drift this skill exists to prevent.
248
+
249
+ **Calibrate, don't presume.** The decision tree above is a starting heuristic, not a hard rule. When a verdict surfaces on the edge — say a single-file change that introduces a new dependency — surface the candidate verdict + reasoning and ask. The operator can confirm or override. False-positive ADRs (drafting noise the team has to edit-and-delete) are worse than false-negative no-ADRs (the operator catches the gap in review and asks for one).
250
+
251
+ **Block at Stage 3, advise at Stage 1.** The implementation plan can carry "No ADR needed — <rationale>" and ship. The evidence pack cannot — the per-REQ `architecture-decision.md` artefact must exist before Stage 3 completes. Symmetric with `requirements-aligner` per the [#119 review](https://github.com/metasession-dev/DevAudit-Installer/issues/119#issuecomment-4631840651).
252
+
253
+ **Sibling-skill awareness.** When this skill drafts an ADR, cross-link the SRS items the decision affects (from `requirements-aligner`'s output) and the risk-register entries the decision touches (from `risk-register-keeper` when that skill ships). The three SoT-alignment skills work together; each produces its own per-REQ Tier 3 artefact but they share the per-REQ context. v1 carries the cross-references as inline references the operator fills in; Phase B will own bidirectional consistency.
254
+
255
+ **The negative case is audit evidence too.** A "No ADR needed — <rationale>" annotation is what an auditor examines to confirm the question was asked. An empty *Architecture decisions* section is the silent-drift failure mode. Always inject one or the other; never leave the section unannotated.
256
+
257
+ ## References
258
+
259
+ - [DevAudit-Installer#120](https://github.com/metasession-dev/DevAudit-Installer/issues/120) — the issue this skill closes, with the case study + the locked Phase A scope.
260
+ - `sdlc-implementer/SKILL.md` Phase 1 + Phase 3 — the parent-skill invocation contract.
261
+ - `sdlc/files/_common/Implementation_Plan_TEMPLATE.md` — *Architecture decisions* section converted from inline bullets to ADR-NNN reference list in this PR (companion change).
262
+ - `sdlc/files/_common/1-plan-requirement.md` — stage-1 doc updated to point at the skill (companion change).
263
+ - `sdlc/files/_common/skills/requirements-aligner/SKILL.md` — sibling skill (same SoT-alignment family); see for the symmetric shape (Stage 1 + Stage 3 hooks; advisory-then-blocking enforcement).
264
+ - Sibling skill (forthcoming): `risk-register-keeper` (DevAudit-Installer#121).
265
+ - Meta-reviewer (META-COMPLY): `framework-registry-auditor` reviews the `architecture_decision` evidence type's clause mappings before the META-COMPLY sub-PR opens. Per the [#119 sequencing](https://github.com/metasession-dev/DevAudit-Installer/issues/119#issuecomment-4631840651).
266
+ - Existing ADRs in the framework itself: `DevAudit-Installer/docs/ADR/ADR-001-polyglot-sdlc-architecture.md`, `docs/devaudit-cli/ADR-001-language-and-distribution.md` — the pattern this skill maintains.