@metasession.co/devaudit-cli 0.1.36 → 0.1.37

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.36",
3
+ "version": "0.1.37",
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.36",
36
+ "@metasession.co/devaudit-plugin-sdk": "^0.1.37",
37
37
  "commander": "^12.1.0",
38
38
  "consola": "^3.2.3",
39
39
  "env-paths": "^3.0.0",
@@ -0,0 +1,126 @@
1
+ ---
2
+ title: "Implementation plan — REQ-XXX"
3
+ requirement_id: "REQ-XXX"
4
+ risk_class: "REPLACE — HIGH | MEDIUM | LOW"
5
+ change_type: "REPLACE — feat | fix | refactor | perf | chore | docs | ci | build | test | compliance | revert"
6
+ authored_by: "REPLACE — operator / agent"
7
+ authored_at: "REPLACE — YYYY-MM-DD"
8
+ ---
9
+
10
+ > ⚠️ **STARTER TEMPLATE — REPLACE EVERY `REPLACE` MARKER BEFORE COMMITTING.**
11
+ > The shape of this doc is load-bearing: the framework-coverage matrix
12
+ > closes four different clauses based on this plan being present + tagged
13
+ > with the correct evidence category. Empty stub commits flip the
14
+ > matrix to COVERED with placeholder content — auditors reject this.
15
+
16
+ # Implementation plan — REQ-XXX
17
+
18
+ ## Framework attribution
19
+
20
+ **Evidence type:** `compliance_document` · **Category:** `planning` · **Scope:** per-REQ
21
+
22
+ **Closes clauses** (every implementation plan satisfies all four):
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). |
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.** |
30
+
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
+
33
+ ## 1. Goal + acceptance criteria
34
+
35
+ > *Closes ISO 29119 §3.4 — test plan*
36
+
37
+ - **Goal:** REPLACE — one sentence describing what this REQ delivers, no jargon.
38
+ - **Acceptance criteria:**
39
+ - AC1 — REPLACE
40
+ - AC2 — REPLACE
41
+ - …
42
+
43
+ ## 2. Scope
44
+
45
+ - **In scope:** REPLACE — list every file / module / surface the change touches.
46
+ - **Out of scope:** REPLACE — adjacent areas the change deliberately leaves alone.
47
+
48
+ ## 3. Threat model + security considerations
49
+
50
+ > *Closes ISO 27001 A.8.25 — secure development life cycle*
51
+
52
+ | Threat | Likelihood | Impact | Mitigation |
53
+ |---|---|---|---|
54
+ | REPLACE — e.g. SQL injection via X param | REPLACE | REPLACE | REPLACE |
55
+ | REPLACE — e.g. unauthenticated access to Y route | REPLACE | REPLACE | REPLACE |
56
+
57
+ **Secrets / credentials:** REPLACE — does this REQ handle any? If yes, how stored, rotated, scoped?
58
+
59
+ **Dependencies introduced:** REPLACE — list new npm/pip packages; flag any with known CVEs or transitive concerns.
60
+
61
+ ## 4. Data protection (GDPR Art. 25)
62
+
63
+ > *Closes GDPR Art. 25 — data protection by design*
64
+
65
+ **Personal data processed by this REQ:** REPLACE — yes / no.
66
+
67
+ If **yes**, fill in:
68
+
69
+ - **Categories of data subjects:** REPLACE
70
+ - **Categories of personal data:** REPLACE (name, email, IP, etc.)
71
+ - **Special categories (Art. 9):** REPLACE — none / specify
72
+ - **Lawful basis:** REPLACE — Art. 6(1)(a-f) — pick one + justify
73
+ - **Purpose limitation:** REPLACE — how the design prevents repurposing
74
+ - **Data minimisation:** REPLACE — fields collected vs fields needed
75
+ - **Retention:** REPLACE — how long, then what happens
76
+ - **Cross-references:**
77
+ - Is the ROPA (`compliance/governance/ropa.md`) updated? REPLACE — yes / no / N/A
78
+ - Is a DPIA required? REPLACE — yes (file under `compliance/governance/dpia-<reqid>.md`) / no / N/A
79
+ - **Cross-border transfers:** REPLACE — none / specify mechanism
80
+
81
+ If **no**, write: *"N/A — this REQ does not process personal data. <Why — e.g. UI-only change, internal-routing refactor, dev-tooling.>"*
82
+
83
+ ## 5. AI / model considerations (EU AI Act Art. 11)
84
+
85
+ > *Closes EUAIA Art. 11 — technical documentation*
86
+
87
+ **AI / ML in scope for this REQ:** REPLACE — yes / no.
88
+
89
+ If **yes**, fill in:
90
+
91
+ - **Model(s) used:** REPLACE — provider, model name, version
92
+ - **Inputs / outputs:** REPLACE
93
+ - **Prompt sources:** REPLACE — hardcoded / user-supplied / template-substituted
94
+ - **Human-oversight path:** REPLACE — what stops a bad output reaching a user? Review gate / circuit breaker / rate limit / etc.
95
+ - **Accuracy / robustness considerations:** REPLACE — known failure modes, planned guardrails
96
+ - **Cross-references:**
97
+ - Is `compliance/governance/ai-disclosure.md` updated? REPLACE — yes / no / N/A
98
+
99
+ If **no**, write: *"N/A — this REQ does not introduce or change AI behaviour. <Why.>"*
100
+
101
+ ## 6. Rollback plan
102
+
103
+ - **Reversible via:** REPLACE — git revert / migration down / config flip / etc.
104
+ - **Data implications of rollback:** REPLACE — any data written by the new code that an older version can't read?
105
+ - **Notification path if rollback during a release:** REPLACE — who hears, how quickly?
106
+
107
+ ## 7. Verification
108
+
109
+ How the team will know the REQ is correct in production:
110
+
111
+ - **Unit + integration tests:** REPLACE — what's added / changed
112
+ - **E2E coverage:** REPLACE — which spec(s); reference per-AC `evidenceShot()` captures
113
+ - **Manual smoke after deploy:** REPLACE — bullet-list, or "none" with reason
114
+ - **Monitoring / alerting:** REPLACE — what dashboards / alerts the change adds or relies on
115
+
116
+ ## 8. Sign-off
117
+
118
+ - **Plan reviewer (eng):** REPLACE — name + date
119
+ - **Plan reviewer (security / DPO):** REPLACE — when GDPR or threat-model sections are non-trivial; otherwise "N/A"
120
+ - **Plan approved by operator:** REPLACE — name + date
121
+
122
+ ## Upload path
123
+
124
+ This file lives at `compliance/plans/REQ-XXX/implementation-plan.md` and is uploaded automatically on the next push to `develop` via `compliance-evidence.yml`. The portal's framework-coverage matrix flips ISO 29119 §3.4, ISO 27001 A.8.25, GDPR Art. 25, and EU AI Act Art. 11 to COVERED for this REQ once the upload lands.
125
+
126
+ Verify the upload at `https://devaudit.metasession.co/projects/<slug>/releases/REQ-XXX` — the "Evidence by requirement" list should show this plan tagged with `category=planning`.
@@ -7,10 +7,10 @@ review_cadence_days: 180
7
7
  risk_class: "REPLACE — minimal | limited | high | unacceptable"
8
8
  ---
9
9
 
10
- > ⚠️ **STARTER TEMPLATE — REPLACE BEFORE GOING TO PRODUCTION.**
11
- > This file was auto-installed by `devaudit install` as a starting point.
12
- > It does **not** describe your project's actual AI use. Edit and commit.
13
- > Auditors will reject unedited stubs. See `docs/governance-templates.md` for guidance.
10
+ > ⚠️ **STARTER TEMPLATE — REPLACE BEFORE COMMITTING.**
11
+ > Installed on demand via `devaudit bootstrap-governance` (v0.1.36+) as a starting point.
12
+ > It does **not** describe your project's actual AI use. Edit before committing.
13
+ > Auditors reject unedited stubs. See `docs/governance-templates.md` for guidance.
14
14
 
15
15
  # AI Use Disclosure — Provision of information to deployers
16
16
 
@@ -20,6 +20,23 @@ risk_class: "REPLACE — minimal | limited | high | unacceptable"
20
20
 
21
21
  > The EU AI Act requires providers to give deployers (the people who put the AI system into use in their professional activity) **clear, comprehensive, accurate and unambiguous** information about the system's capabilities, limitations, and intended use. This file is that disclosure for our project — both for AI we develop and for third-party AI we incorporate.
22
22
 
23
+ ## Uploading this artefact
24
+
25
+ - **File path:** `compliance/governance/ai-disclosure.md`
26
+ - **Upload trigger:** automatic — on every push to `develop` that touches `compliance/**`, `compliance-evidence.yml` uploads this file as `ai_disclosure` evidence.
27
+ - **Verify after merge:** open `/projects/<slug>/compliance`. The **EU AI Act Art. 13** clause should flip MISSING → COVERED within ~2 minutes.
28
+ - **Refresh cadence:** every 180 days, or whenever an AI tool / model / prompt-class is added or materially changed. Source data: git `Co-Authored-By: Claude` trailers + CI usage logs + per-REQ implementation-plan §5.
29
+
30
+ ## Framework checklist — EU AI Act Art. 13
31
+
32
+ - [ ] §1 Intended purpose: what the AI does + intended use + foreseeable misuse
33
+ - [ ] §2 Capabilities + limitations: known performance bounds + known failure modes
34
+ - [ ] §3 Each AI tool listed: provider, model, version, where invoked in the codebase
35
+ - [ ] §4 Human-oversight path documented per Art. 14 (cross-reference: four-eyes release approval)
36
+ - [ ] §5 Accuracy + robustness measures named (Art. 15)
37
+ - [ ] §6 Data inputs / training data provenance disclosed where applicable
38
+ - [ ] `last_reviewed_at` frontmatter matches the actual review date
39
+
23
40
  ## 1. Intended purpose
24
41
 
25
42
  - **What the AI system does:** REPLACE
@@ -7,10 +7,10 @@ review_cadence_days: 365
7
7
  risk_level: "REPLACE — low | medium | high"
8
8
  ---
9
9
 
10
- > ⚠️ **STARTER TEMPLATE — REPLACE BEFORE GOING TO PRODUCTION.**
11
- > This file was auto-installed by `devaudit install` as a starting point.
12
- > It does **not** describe your project's actual data protection risks. Edit and commit.
13
- > Auditors will reject unedited stubs. See `docs/governance-templates.md` for guidance.
10
+ > ⚠️ **STARTER TEMPLATE — REPLACE BEFORE COMMITTING.**
11
+ > Installed on demand via `devaudit bootstrap-governance` (v0.1.36+) as a starting point.
12
+ > It does **not** describe your project's actual data protection risks. Edit before committing.
13
+ > Auditors reject unedited stubs. See `docs/governance-templates.md` for guidance.
14
14
 
15
15
  # Data Protection Impact Assessment
16
16
 
@@ -20,6 +20,22 @@ risk_level: "REPLACE — low | medium | high"
20
20
 
21
21
  > A DPIA is **mandatory** for processing likely to result in high risk to data subjects: large-scale special-category data, systematic monitoring, automated decision-making with legal effect, etc. See Art. 35(3) and your supervisory authority's "blacklist" guidance.
22
22
 
23
+ ## Uploading this artefact
24
+
25
+ - **File path:** `compliance/governance/dpia.md` (or `dpia-<reqid>.md` for a per-REQ DPIA tied to a HIGH-risk requirement)
26
+ - **Upload trigger:** automatic — on every push to `develop` that touches `compliance/**`, `compliance-evidence.yml` uploads this file as `dpia` evidence.
27
+ - **Verify after merge:** open `/projects/<slug>/compliance`. The **GDPR Art. 35** clause should flip MISSING → COVERED within ~2 minutes.
28
+ - **Refresh cadence:** annually (365 days), or sooner whenever the assessed processing materially changes (new data category, new recipient, new automated-decision path).
29
+
30
+ ## Framework checklist — GDPR Art. 35
31
+
32
+ - [ ] §1 Description of processing: purpose + scope + lawful basis + data flow diagram or text-equivalent
33
+ - [ ] §2 Necessity + proportionality: justified why this processing is needed, alternatives considered
34
+ - [ ] §3 Risks to rights and freedoms: each risk → likelihood + severity + affected data subjects
35
+ - [ ] §4 Measures to address the risks: each risk has a concrete mitigation (technical or organisational)
36
+ - [ ] §5 Consultation: DPO + affected stakeholders consulted (or "not applicable — sole-dev project" stated explicitly)
37
+ - [ ] §6 Sign-off: data controller approval recorded with date
38
+
23
39
  ## 1. Description of the processing
24
40
 
25
41
  - **Activity name:** REPLACE
@@ -10,11 +10,11 @@ notification_window_72h: "REPLACE — within | outside | n/a"
10
10
  last_reviewed_at: "REPLACE — YYYY-MM-DD"
11
11
  ---
12
12
 
13
- > ⚠️ **STARTER TEMPLATE — REPLACE BEFORE GOING TO PRODUCTION.**
14
- > This file was auto-installed by `devaudit install` as a starting point.
13
+ > ⚠️ **STARTER TEMPLATE — REPLACE BEFORE COMMITTING.**
14
+ > Installed on demand via `devaudit bootstrap-governance` (v0.1.36+) as a starting point.
15
15
  > If you reach for this file it's because something **happened** — replace this banner
16
16
  > with the actual incident details. One incident per file (rename to
17
- > `incident-report-<id>.md` if you keep multiple). Auditors will reject unedited stubs.
17
+ > `incident-report-<id>.md` if you keep multiple). Auditors reject unedited stubs.
18
18
 
19
19
  # Incident Report
20
20
 
@@ -27,6 +27,39 @@ last_reviewed_at: "REPLACE — YYYY-MM-DD"
27
27
 
28
28
  **Evidence type:** `incident_report` · One artefact can satisfy multiple clauses depending on its scope (test defect, ops incident, personal-data breach).
29
29
 
30
+ ## Uploading this artefact
31
+
32
+ - **File path:** `compliance/governance/incident-report.md` (the template) or `compliance/governance/incident-report-<id>.md` (per-incident — recommended; the `incident-export.yml` workflow auto-produces these from closed GitHub issues labelled `incident`)
33
+ - **Upload trigger:** automatic — on every push to `develop` that touches `compliance/**`, `compliance-evidence.yml` uploads this file as `incident_report` evidence via the `upload_governance` helper.
34
+ - **Verify after merge:** open `/projects/<slug>/compliance`. `ISO29119.3.5.4` always flips to COVERED (baseline). `SOC2.CC7.2`, `GDPR.Art-33`, `GDPR.Art-34` flip only when the relevant attribution sections below are non-stub.
35
+ - **Refresh cadence:** none — incidents are point-in-time. Authoring is event-driven.
36
+
37
+ ## Framework attribution — which clauses THIS incident closes
38
+
39
+ Mandatory baseline (every incident_report attributes to it):
40
+
41
+ - [x] **ISO 29119 §3.5.4** Test incident report — always.
42
+
43
+ Conditional — tick the boxes that match this incident's scope, then ensure the corresponding section is fully populated:
44
+
45
+ - [ ] **SOC 2 CC7.2** System monitoring and incident response — ops impact / downtime / persistent errors / perf regression / data corruption
46
+ - [ ] **GDPR Art. 33** Breach notification (supervisory authority) — personal data was exposed, lost, or mishandled (72h window applies)
47
+ - [ ] **GDPR Art. 34** Breach notification (data subject) — affected data subjects need to be told (high-risk threshold per Art. 34(1))
48
+ - [ ] **EU AI Act Art. 9 / 14 / 15** — AI / model failure, oversight bypass, accuracy / robustness regression. Cross-reference `compliance/governance/ai-disclosure.md`.
49
+
50
+ If none of the conditional boxes apply, this is still a valid incident_report — it just closes ISO 29119 §3.5.4 only. The "no specific framework impact" case is genuine and should not be padded.
51
+
52
+ ## Framework checklist — fields auditors look for
53
+
54
+ - [ ] §1 Summary: incident ID, severity, dates discovered/contained/closed, root cause one-liner
55
+ - [ ] §2 Timeline: actor + action + time, chronological
56
+ - [ ] §3 Affected scope: systems, data, users (counts where known)
57
+ - [ ] §4 GDPR triage: personal data Y/N → if Y, categories + count of data subjects + notification path
58
+ - [ ] §5 Root cause: blameless, technical, sufficient detail to prevent recurrence
59
+ - [ ] §6 Containment + remediation: what was done, what's still open
60
+ - [ ] §7 Follow-up actions: each → owner → due date
61
+ - [ ] §8 Sign-off: incident commander + eng lead (+ DPO when PII, + security lead when security)
62
+
30
63
  ## 1. Summary
31
64
 
32
65
  - **Incident ID:** REPLACE
@@ -7,14 +7,14 @@ last_reviewed_at: "REPLACE — YYYY-MM-DD"
7
7
  review_cadence_days: 90
8
8
  ---
9
9
 
10
- > ⚠️ **STARTER TEMPLATE — REPLACE BEFORE GOING TO PRODUCTION.**
11
- > This file was auto-installed by `devaudit install` as a starting point.
10
+ > ⚠️ **STARTER TEMPLATE — REPLACE BEFORE COMMITTING.**
11
+ > Installed on demand via `devaudit bootstrap-governance` (v0.1.36+) as a starting point.
12
12
  > The Periodic Review workflow (`.github/workflows/periodic-review.yml`, shipped in
13
13
  > v0.1.31) auto-regenerates this file quarterly with locally-derived metrics and
14
14
  > opens a PR. The human attestation sections (Review notes, control-effectiveness
15
15
  > judgement, dual-actor sign-off) still need to be filled in before each PR can
16
16
  > merge — the auto-generator can't produce defensible attestation on its own.
17
- > Auditors will reject unedited stubs. See `docs/governance-templates.md` for guidance.
17
+ > Auditors reject unedited stubs. See `docs/governance-templates.md` for guidance.
18
18
 
19
19
  # Periodic Review of Internal Controls
20
20
 
@@ -25,6 +25,23 @@ review_cadence_days: 90
25
25
 
26
26
  **Evidence type:** `periodic_review` · **Cadence:** every 90 days (quarterly). The portal flags this evidence as `expired` after 365 days — but a 90-day cadence is the practical minimum.
27
27
 
28
+ ## Uploading this artefact
29
+
30
+ - **File path:** `compliance/governance/periodic-review.md` (auto-regenerated by the workflow each quarter; commit it as-is then fill the operator sections)
31
+ - **Upload trigger:** automatic — on the PR-merge push to `develop`, `compliance-evidence.yml` uploads this file as `periodic_review` evidence.
32
+ - **Verify after merge:** open `/projects/<slug>/compliance`. **SOC 2 CC4.1** AND **ISO 27001 A.12.1** should flip MISSING → COVERED within ~2 minutes.
33
+ - **Refresh cadence:** quarterly (every 90 days). The portal's `freshnessDays: 365` window means a stale review eventually flips to `expired`; the workflow's quarterly cron keeps you well inside that window.
34
+
35
+ ## Framework checklist — SOC 2 CC4.1 + ISO 27001 A.12.1
36
+
37
+ The 60% of this doc that the operator must fill (auto-generated sections at the top cover the other 40%):
38
+
39
+ - [ ] §1 Review period: dates + reviewer + approver (dual-actor when `risk_tier=medium`+)
40
+ - [ ] §3 Control-effectiveness review: a sentence per gate (typescript / sast / dep-audit / e2e / build) — *worked / didn't work / why*
41
+ - [ ] §4 Findings: each material finding → severity → owner → due date
42
+ - [ ] §5 Follow-up actions: items carried over from last quarter, with status
43
+ - [ ] §6 Sign-off: reviewer + approver names + dates (signatures by commit, not by image)
44
+
28
45
  ## 1. Review period
29
46
 
30
47
  - **From:** REPLACE — YYYY-MM-DD
@@ -7,10 +7,10 @@ review_cadence_days: 365
7
7
  processing_activities: []
8
8
  ---
9
9
 
10
- > ⚠️ **STARTER TEMPLATE — REPLACE BEFORE GOING TO PRODUCTION.**
11
- > This file was auto-installed by `devaudit install` as a starting point.
12
- > It does **not** describe your project's actual processing activities. Edit and commit.
13
- > Auditors will reject unedited stubs. See `docs/governance-templates.md` for guidance.
10
+ > ⚠️ **STARTER TEMPLATE — REPLACE BEFORE COMMITTING.**
11
+ > Installed on demand via `devaudit bootstrap-governance` (v0.1.36+) as a starting point.
12
+ > It does **not** describe your project's actual processing activities. Edit before committing.
13
+ > Auditors reject unedited stubs. See `docs/governance-templates.md` for guidance.
14
14
 
15
15
  # Records of Processing Activities
16
16
 
@@ -18,6 +18,24 @@ processing_activities: []
18
18
 
19
19
  **Evidence type:** `ropa` · **Cadence:** refresh every 365 days (portal flags as `expired` after)
20
20
 
21
+ ## Uploading this artefact
22
+
23
+ - **File path:** `compliance/governance/ropa.md`
24
+ - **Upload trigger:** automatic — on every push to `develop` that touches `compliance/**`, the `compliance-evidence.yml` workflow uploads this file as `ropa` evidence via the `upload_governance` helper.
25
+ - **Verify after merge:** open `/projects/<slug>/compliance` on the DevAudit portal. The **GDPR Art. 30** clause should flip MISSING → COVERED within ~2 minutes.
26
+ - **Refresh cadence:** annually (365 days). The portal flags the clause as `expired` once the most-recent ropa upload is older than that window.
27
+
28
+ ## Framework checklist — GDPR Art. 30
29
+
30
+ Before committing, confirm each item below — if any is unchecked, the document is not yet audit-ready:
31
+
32
+ - [ ] Controller's legal name + contact + DPO listed
33
+ - [ ] At least one processing activity documented (no placeholder "Activity 1" row left in)
34
+ - [ ] Each activity carries: purpose, lawful basis (Art. 6), data subject categories, data categories, recipients, retention, transfers
35
+ - [ ] Special categories (Art. 9) flagged where applicable
36
+ - [ ] Cross-border transfer mechanism named where data leaves the EEA
37
+ - [ ] `last_reviewed_at` frontmatter matches the actual review date
38
+
21
39
  ## Controller
22
40
 
23
41
  - **Legal name:** REPLACE
@@ -220,6 +220,75 @@ Each filed issue needs:
220
220
  - **Evidence** — link or path to the failing test, error output, screenshot, trace.
221
221
  - **Link back** to the originating issue/PR.
222
222
  - **Severity** — your honest call: blocker, major, minor. Don't inflate.
223
+ - **`### Framework attribution`** section — the clauses this defect closes when its incident report lands. Always lists `ISO29119.3.5.4` as baseline; additional clauses depending on classification below.
224
+
225
+ #### Framework classification + the `incident` label
226
+
227
+ Every defect filed from Phase 6 becomes `incident_report` evidence when (a) the issue is labelled `incident` and (b) the issue is closed. The flow: closed-with-label → `incident-export.yml` exports the body to `compliance/governance/incident-report-<N>.md` → `compliance-evidence.yml` uploads as `incident_report` evidence → portal flips the attributed clauses MISSING → COVERED.
228
+
229
+ Classify the defect against this table when filing — the canonical version lives at `governance-doc-author/references/incident-classification.md`, mirrored here for the e2e workflow:
230
+
231
+ | Defect characteristic | Frameworks/clauses attributed |
232
+ |---|---|
233
+ | **Any test failure / defect** (baseline — always) | `ISO29119.3.5.4` Test incident report |
234
+ | **Ops impact** (downtime, persistent errors, perf regression, data corruption) | + `SOC2.CC7.2` System monitoring and incident response |
235
+ | **Security vulnerability** (auth bypass, injection, data exposure) | + `SOC2.CC7.2` + relevant ISO 27001 controls |
236
+ | **Personal data exposed / lost / mishandled** | + `GDPR.Art-33` (always — 72h supervisory notification) + `GDPR.Art-34` (when data subjects need notification) |
237
+ | **AI/ML failure** (model hallucination, biased output, oversight bypass) | + relevant EU AI Act articles (`Art-9` risk, `Art-14` human oversight, `Art-15` accuracy/robustness) |
238
+
239
+ **Baseline rule:** the first row is **mandatory**. Even a defect with no specific framework impact STILL produces a valid incident_report attributed to `ISO29119.3.5.4`. Never silently drop the artefact because "it's just a bug".
240
+
241
+ **Apply the `incident` label at filing time** for defects that warrant incident_report evidence — don't wait for the operator to add it later. Confirm with the operator first (per the **Confirm before destructive or public actions** principle).
242
+
243
+ If the `incident` label doesn't exist yet on the repo, create it idempotently:
244
+
245
+ ```bash
246
+ gh label list --json name --jq '.[].name' | grep -qx incident || \
247
+ gh label create incident --color 'B60205' --description 'Operational, test, or compliance incident; close to auto-archive as portal evidence'
248
+ ```
249
+
250
+ Then file with `--label incident,<existing-labels>`.
251
+
252
+ #### Issue body template
253
+
254
+ Embed the `### Framework attribution` section near the end of every defect issue body so the auto-export PR (after close) inherits the attribution:
255
+
256
+ ```markdown
257
+ ### Framework attribution
258
+
259
+ This defect, once closed with the `incident` label, will be auto-exported as `incident_report` evidence and attribute to:
260
+
261
+ - [x] `ISO29119.3.5.4` (baseline — every incident_report)
262
+ - [ ] `SOC2.CC7.2` — ops impact: <REPLACE — yes/no, with one-line rationale>
263
+ - [ ] `GDPR.Art-33` — personal data scope: <REPLACE — yes/no>
264
+ - [ ] `GDPR.Art-34` — data-subject notification required: <REPLACE — yes/no>
265
+ - [ ] `EUAIA.Art-9 / Art-14 / Art-15` — AI failure: <REPLACE — yes/no, which article(s)>
266
+
267
+ Once closed, the `incident-export.yml` workflow exports this issue's body to `compliance/governance/incident-report-<N>.md`, auto-files a PR with the GDPR triage + sign-off sections to fill in. Merge that PR → `compliance-evidence.yml` uploads as `incident_report`.
268
+ ```
269
+
270
+ Pre-tick boxes you're confident about. Leave the operator-judgement ones (GDPR triage, AI-failure classification) for the operator to confirm in the export PR.
271
+
272
+ #### Worked examples
273
+
274
+ **Example 1 — Non-PII, non-security defect.** A unit-conversion bug rounds metric prices incorrectly. Found by failing e2e. No data exposure, no service impact beyond cosmetic.
275
+
276
+ - Apply `incident` label: **yes** (every defect produces an incident_report on close).
277
+ - Pre-ticked attribution: `ISO29119.3.5.4` only.
278
+ - Operator confirms in the export PR: no SOC 2 / GDPR / EU AI Act ticks added.
279
+ - Result: valid incident_report closing the baseline clause. Don't pad with false ticks.
280
+
281
+ **Example 2 — PII exposure via misconfigured RLS.** Users see other users' applications. Found via e2e regression. ~3,000 users affected over 6 hours.
282
+
283
+ - Apply `incident` label: **yes**.
284
+ - Pre-ticked attribution: `ISO29119.3.5.4` + `SOC2.CC7.2` + `GDPR.Art-33`.
285
+ - Leave `GDPR.Art-34` unticked — high-risk threshold needs operator + DPO judgement.
286
+ - Severity: blocker.
287
+ - The export PR will surface the GDPR triage section for the operator + DPO to fill in (data-subject count, notification method, 72h-window timestamp).
288
+
289
+ #### Skipping the issue path — direct incident report
290
+
291
+ When the incident wasn't found by an e2e run (e.g. an ops event surfaced externally, or a retrospective documentation of an event the team handled outside the tracker), file directly using the `governance-doc-author` skill against `compliance/governance/incident-report.md.template`. Same classification table applies; the doc gets committed, `compliance-evidence.yml` auto-uploads it.
223
292
 
224
293
  Show the user the full set of issues you're about to file. Get confirmation. Then file them.
225
294
 
@@ -0,0 +1,148 @@
1
+ ---
2
+ name: governance-doc-author
3
+ description: Author or refresh one of the project's governance documents — RoPA (GDPR Art. 30), DPIA (GDPR Art. 35), AI use disclosure (EU AI Act Art. 13), Periodic Security Review Schedule (ISO 27001 A.12.1 / SOC 2 CC4.1), or the project-level incident-report template. Drives source-data gathering, framework-clause attribution, content authoring against the existing starter template, and the commit + upload + portal-verification loop. Use when the user wants to "create / refresh the RoPA", "write a DPIA", "update the AI disclosure", "set up the periodic review schedule", or generally "I need to make our <governance doc> audit-ready". Use also when the framework-coverage matrix on the portal shows GDPR.Art-30 / GDPR.Art-35 / EUAIA.Art-13 / SOC2.CC4.1 / ISO27001.A.12.1 as MISSING and the operator asks how to close them. Do NOT use for incident response itself (that's the e2e-test-engineer + incident-export.yml pipeline), or for portal upload mechanics of evidence the CI already auto-uploads (test_report, e2e_result, sast_report, audit_log, screenshot).
4
+ ---
5
+
6
+ # Governance Doc Author
7
+
8
+ Author or refresh a single governance document so it correctly closes the framework clauses it's meant to satisfy. Five document classes covered:
9
+
10
+ | Document | File | Closes |
11
+ |---|---|---|
12
+ | **RoPA** | `compliance/governance/ropa.md` | `GDPR.Art-30` |
13
+ | **DPIA** | `compliance/governance/dpia.md` (or `dpia-<reqid>.md`) | `GDPR.Art-35` |
14
+ | **AI Use Disclosure** | `compliance/governance/ai-disclosure.md` | `EUAIA.Art-13` |
15
+ | **Periodic Security Review Schedule** | `SDLC/Periodic_Security_Review_Schedule.md` *(Tier 2, uploaded as `compliance_document` via the portal Upload form)* | `ISO27001.A.12.1` (the schedule itself; the quarterly runs close `ISO27001.A.12.1` + `SOC2.CC4.1` via `periodic_review` evidence — see Phase 6) |
16
+ | **Incident Report (project-level template)** | `compliance/governance/incident-report.md` | `ISO29119.3.5.4` baseline; conditionals via [[incident-classification]] |
17
+
18
+ Each doc has a starter template under `sdlc/files/_common/governance/*.md.template` (installed on demand via `devaudit bootstrap-governance` since v0.1.36). This skill does NOT regenerate the template — it walks the operator through *filling it in* against the project's actual state.
19
+
20
+ ## Scope
21
+
22
+ **In scope**
23
+ - Authoring or refreshing one (or more) of the five governance docs above.
24
+ - Gathering source data from the codebase / CI runs / git history.
25
+ - Confirming framework attribution before commit.
26
+ - Driving the commit + push → CI auto-upload → portal verification loop.
27
+
28
+ **Out of scope**
29
+ - Incident response itself — that path is the `e2e-test-engineer` skill's defect-filing flow plus `incident-export.yml` on issue close.
30
+ - Test execution evidence — handled by `e2e-test-engineer`.
31
+ - Implementation plans for individual REQs — handled by the `sdlc-implementer` skill's Phase 1 against `Implementation_Plan_TEMPLATE.md`.
32
+ - Framework registry changes — clause definitions live in META-COMPLY (`lib/config/frameworks/`) and are not authored here.
33
+
34
+ ## The workflow
35
+
36
+ Six phases. Phase 0 is a routing step; phases 1–5 are per-document.
37
+
38
+ ### Phase 0 — Route
39
+
40
+ Determine which document the operator needs. Ask if ambiguous; otherwise infer from the trigger phrase.
41
+
42
+ - *"create / refresh the RoPA"* → Phase 1 with doc = ROPA
43
+ - *"write / update a DPIA"* → Phase 1 with doc = DPIA (ask: tied to a specific HIGH-risk REQ, or project-wide?)
44
+ - *"AI use disclosure"* / *"document our AI use"* → Phase 1 with doc = AI_DISCLOSURE
45
+ - *"periodic security review schedule"* / *"how often do we review"* → Phase 1 with doc = REVIEW_SCHEDULE
46
+ - *"incident-report template"* → Phase 1 with doc = INCIDENT_TEMPLATE (and remind the operator that per-incident reports come from `incident-export.yml`, not this skill)
47
+
48
+ When the trigger is *"GDPR.Art-30 is MISSING on the matrix, what do I upload?"* and similar — route to the matching doc above.
49
+
50
+ ### Phase 1 — Confirm the starter exists
51
+
52
+ 1. Check whether the starter template is on disk at the expected path. If yes, skip to Phase 2.
53
+ 2. If absent, tell the operator the v0.1.36+ install no longer auto-seeds these — the `devaudit bootstrap-governance` command copies them on demand. Offer to run it (with operator confirmation per the **Confirm before destructive or public actions** principle).
54
+ 3. Re-check the path. If still missing, halt with a clear error pointing at the starter file in the installer.
55
+
56
+ ### Phase 2 — Gather source data
57
+
58
+ Each doc class has different inputs. Read what's needed; don't ask the operator for what you can derive from the codebase.
59
+
60
+ - **ROPA**
61
+ - Read `app/`, `lib/`, `prisma/schema.prisma` (or equivalent) to enumerate processing activities.
62
+ - For each, infer: data categories, recipients (third-party SDKs / services), retention (DB triggers, env vars naming retention windows), lawful basis where reasonable.
63
+ - Read `.env.example` for third-party service names.
64
+ - Ask the operator to confirm purposes (you can guess the technical surface; the *purpose* is a business decision).
65
+
66
+ - **DPIA**
67
+ - Project-wide DPIA → same source data as RoPA, plus a risk identification pass against Art. 35(3) triggers (large-scale special category, systematic monitoring, automated decisions with legal effect).
68
+ - Per-REQ DPIA → read `compliance/plans/REQ-XXX/implementation-plan.md` §4 (data protection) for the specific REQ being assessed.
69
+
70
+ - **AI_DISCLOSURE**
71
+ - Grep `git log --grep "Co-Authored-By: Claude\|Co-Authored-By: GPT"` for model usage signals.
72
+ - Grep the codebase for AI SDK imports (`@anthropic-ai/sdk`, `openai`, etc.) and prompt strings.
73
+ - Cross-reference each per-REQ implementation plan's §5 (AI / model considerations).
74
+ - Ask the operator about human-oversight paths if not documented in the implementation plans.
75
+
76
+ - **REVIEW_SCHEDULE**
77
+ - Read `sdlc-config.json` for `risk_tier` — drives the cadence (low = annual + ad-hoc; medium = quarterly; high = monthly).
78
+ - Read `.github/workflows/periodic-review.yml` to confirm the cron is wired (or note it as a follow-up if not).
79
+ - Ask the operator which control areas to schedule (default: access control / secure SDLC / SAST / dep-audit / E2E / change management / monitoring).
80
+
81
+ - **INCIDENT_TEMPLATE**
82
+ - No source-data gathering — the project-level template is the form per-incident reports inherit. Ensure the latest [[incident-classification]] reference is up to date.
83
+
84
+ ### Phase 3 — Author against the starter
85
+
86
+ 1. Open the starter at the path Phase 1 confirmed.
87
+ 2. Replace every `REPLACE — …` marker with project-specific content. Use the Phase 2 source data; don't invent values.
88
+ 3. Tick the **Framework checklist** items in the starter as you go. If you can't tick one honestly, leave it unticked and surface the gap in the Phase 5 report — never tick falsely.
89
+ 4. Update the frontmatter (`last_reviewed_at`, `controller`, etc.) to today's date and the project's actual values.
90
+
91
+ ### Phase 4 — Verify framework attribution
92
+
93
+ For each clause the doc closes, confirm the corresponding section of the doc is non-stub:
94
+
95
+ | Doc | Clause | Section that must be non-stub |
96
+ |---|---|---|
97
+ | ROPA | GDPR.Art-30 | §Controller + ≥1 §Processing activities row with all fields filled |
98
+ | DPIA | GDPR.Art-35 | All six sections (description / necessity / risks / measures / consultation / sign-off) |
99
+ | AI_DISCLOSURE | EUAIA.Art-13 | All six checklist items in the template's Framework checklist |
100
+ | REVIEW_SCHEDULE | ISO27001.A.12.1 | A schedule entry per control area + a named reviewer per cadence |
101
+ | INCIDENT_TEMPLATE | ISO29119.3.5.4 baseline | §1–§8 of the template are skeletal but coherent (per-incident files inherit the shape) |
102
+
103
+ If any required section is still stub, **do not commit**. Surface the gap in the Phase 5 report, ask the operator for the missing input.
104
+
105
+ ### Phase 5 — Commit + verify
106
+
107
+ 1. Show the operator the diff. Confirm before committing (per the **Confirm before destructive or public actions** principle).
108
+ 2. Commit with a conventional-commit message: `compliance(governance): refresh <doc> for <reason>` — e.g. `compliance(governance): refresh ropa.md — annual review 2026-Q2`.
109
+ 3. Push to the current working branch. Surface the path: "next `git push` to `develop` → `compliance-evidence.yml` auto-uploads as `<evidence_type>`, closing `<framework_clause>` within ~2 minutes."
110
+ 4. Suggest the operator open `/projects/<slug>/compliance` on the portal post-merge to verify the clause flipped MISSING → COVERED.
111
+
112
+ ### Phase 6 — Special case: the Periodic Review Schedule vs the quarterly review itself
113
+
114
+ These are **two different artefacts** and the skill must not conflate them:
115
+
116
+ | Artefact | What | Closes | Cadence | Skill responsibility |
117
+ |---|---|---|---|---|
118
+ | **Periodic_Security_Review_Schedule.md** | The *plan* — which controls get reviewed, how often, by whom | `ISO27001.A.12.1` (the schedule presence) | Once, refresh annually | **In scope.** Author / refresh via this skill. |
119
+ | **periodic-review.md** | The *execution evidence* — this quarter's actual review | `ISO27001.A.12.1` + `SOC2.CC4.1` (effectiveness evidence) | Quarterly | **Out of scope.** Auto-generated by `periodic-review.yml`; the operator fills in the 60% operator-fill section per the PR body's checklist. |
120
+
121
+ If the operator asks for "the periodic review", clarify which they mean. If they want the quarterly execution, point them at the open auto-PR (or, if cron hasn't fired yet, suggest `gh workflow run periodic-review.yml`).
122
+
123
+ ## Filing follow-ups + handoff
124
+
125
+ When Phase 5 commits successfully, append a short narrator update in the final report:
126
+
127
+ - Doc(s) authored, paths committed, framework clauses closed.
128
+ - Any framework checklist items left unticked → file each as a follow-up issue (with operator confirmation) OR list as known gaps in the final report.
129
+ - For DPIA tied to a HIGH-risk REQ: cross-link back to the REQ's `implementation-plan.md` §4.
130
+
131
+ ## Principles
132
+
133
+ **One doc per invocation.** Don't try to refresh RoPA + DPIA + AI disclosure in one run. They have different cadences and different source data; batching them produces sloppy output.
134
+
135
+ **Don't invent.** If you can't derive a value from the codebase / CI / git, ask the operator. Never guess at lawful basis, retention windows, controller contacts, or AI provider names.
136
+
137
+ **Framework checklist is load-bearing.** The portal's matrix uses the *presence* of the doc to flip COVERED; auditors use the *content* to decide if that's defensible. Tick boxes only when they're actually true.
138
+
139
+ **Confirm before destructive or public actions.** Same as the e2e-test-engineer principle. Diff, confirm, commit. The operator approves the doc going to GitHub before push.
140
+
141
+ **Ambiguity is a question, not a guess.** Same as e2e-test-engineer.
142
+
143
+ ## References
144
+
145
+ - `references/incident-classification.md` — the conditional-attribution decision tree for incident_report evidence (mirrors the table in `e2e-test-engineer` Phase 6 Filing Defects).
146
+ - Starter templates: `sdlc/files/_common/governance/{ropa,dpia,ai-disclosure,periodic-review,incident-report}.md.template`.
147
+ - Framework registries (META-COMPLY): `lib/config/frameworks/{gdpr,eu-ai-act,iso-27001,soc-2,iso-29119}.ts`.
148
+ - Related skills: `sdlc-implementer` (per-REQ implementation plans), `e2e-test-engineer` (incident reports from defects).