@ikon85/agent-workflow-kit 0.25.0 → 0.26.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.
@@ -26,7 +26,7 @@ This is a prompt-driven skill, not a deterministic script. Explore, present what
26
26
  | `## Agent skills` + `## Prod` in CLAUDE.md **and** AGENTS.md | one-line pointers + deploy target (Sections C/G + Write) |
27
27
  | `.github/workflows/agent-workflow-kit-update.yml` | optional tested Kit update pull request for GitHub consumers (Section A2) |
28
28
  | `docs/agents/census.md` | optional-census choice, paths, state, and safe disable contract seeded from [census.md](./census.md) (Section A3) |
29
- | `docs/agents/workflow-capabilities.json` + capability assets | consumer-owned Worktree Lifecycle, Memory Lifecycle, and Workflow Advisories choices (Sections A4–A6) |
29
+ | `docs/agents/workflow-capabilities.json` + capability assets | consumer-owned Worktree Lifecycle, Memory Lifecycle, Workflow Advisories, and Safety Guardrails choices (Sections A4–A7) |
30
30
 
31
31
  ## Idempotency contract — read before writing anything
32
32
 
@@ -57,7 +57,7 @@ Read the current state; don't assume. For every target file, read its first line
57
57
  - `CONTEXT.md`, `CONTEXT-MAP.md`, `docs/adr/` — domain-doc layout.
58
58
  - `docs/agents/`, `docs/agents/skills/`, `docs/conventions/` — prior output of this skill.
59
59
  - `docs/agents/census.md`, `.census/profile.json`, `.census/active.json` — an existing census choice or consumer-owned census to adopt.
60
- - `docs/agents/workflow-capabilities.json`, `.claude/settings.json` — existing capability choices/profile plus Worktree Lifecycle and Workflow Advisories hook wiring to adopt.
60
+ - `docs/agents/workflow-capabilities.json`, `.claude/settings.json`, `git config --get core.hooksPath` — existing capability choices/profile plus Worktree Lifecycle, Workflow Advisories, and Safety Guardrails wiring to adopt.
61
61
  - `.memory/active/`, `.memory/archive/`, and `.memory/receipts/` — consumer-owned Memory Lifecycle policies or recovery evidence to adopt without normalization.
62
62
  - `gh auth status` (if GitHub) — is `gh` authenticated, and with which scopes?
63
63
 
@@ -218,6 +218,31 @@ repository?"* Offer exactly **Yes**, **Later**, and **No**.
218
218
  - **Disable** — remove exact kit-owned commands first, then set `enabled:
219
219
  false`; preserve every profile value and unknown key.
220
220
 
221
+ ### 2f. Section A7 — Optional Safety Guardrails
222
+
223
+ > Safety Guardrails is a counted group of seven independently selectable
224
+ > protections: four agent-tool guards and three repository-security
225
+ > capabilities. Setup stages and validates the chosen profile plus wiring
226
+ > before activation; disabled rows remain exact no-ops.
227
+
228
+ Read [safety-guardrails.md](./safety-guardrails.md) in full. Reconcile its
229
+ complete `yes / later / no / existing / disable` matrix. If no choice exists,
230
+ ask: *"Should setup configure the portable Safety Guardrails for this
231
+ repository?"* Offer exactly **Yes**, **Later**, and **No**.
232
+
233
+ - **Yes** — ask which of the seven counted rows to enable, then reconcile only
234
+ `safetyGuardrails`, exact selected Agent-hook commands, and the selected
235
+ native Git-hook path. Report `N of 7 enabled`.
236
+ - **Later / No** — record the choice without Agent- or Git-hook wiring.
237
+ - **Existing** — adopt profile and wiring byte-safely; preserve unknown keys
238
+ and consumer-specific policies.
239
+ - **Disable** — remove only exact kit-owned Agent commands and Git wiring
240
+ first, then set `enabled: false`.
241
+
242
+ Testreporter uses the parity-on profile from the seed. Other consumers are
243
+ opt-in/manual: never copy its pnpm, path, shim, surface, or outage decisions
244
+ without repository evidence and user confirmation.
245
+
221
246
  ### 3. Section B — Triage labels
222
247
 
223
248
  > When `triage` processes an incoming issue it applies labels (or your tracker's equivalent). It needs strings you've actually configured, or it creates duplicates.
@@ -305,10 +330,11 @@ request changes a recorded choice.
305
330
 
306
331
  For `docs/agents/workflow-capabilities.json`, reconcile only each selected
307
332
  capability section. Never replace the whole file: Project Release, Memory
308
- Lifecycle, Worktree Lifecycle, Workflow Advisories, future sections, and
333
+ Lifecycle, Worktree Lifecycle, Workflow Advisories, Safety Guardrails, future sections, and
309
334
  unknown consumer keys share this profile. Apply the transition and hook
310
- ownership rules from [worktree-lifecycle.md](./worktree-lifecycle.md) and
311
- [workflow-advisories.md](./workflow-advisories.md) transactionally.
335
+ ownership rules from [worktree-lifecycle.md](./worktree-lifecycle.md),
336
+ [workflow-advisories.md](./workflow-advisories.md), and
337
+ [safety-guardrails.md](./safety-guardrails.md) transactionally.
312
338
 
313
339
  For Memory Lifecycle, use only the deterministic setup helper from Section A5.
314
340
  Do not copy templates with shell commands or edit the capability profile by
@@ -0,0 +1,155 @@
1
+ # Safety Guardrails setup contract
2
+
3
+ Safety Guardrails is a counted, opt-in capability group backed by the
4
+ consumer-owned `docs/agents/workflow-capabilities.json` profile. Its seven
5
+ rows are selected independently: four protect agent tool calls and three
6
+ bootstrap repository security. No repository name, package manager, hook
7
+ surface, threshold, path, or outage policy is inferred from the kit.
8
+
9
+ ## Choice matrix
10
+
11
+ | State | Setup action |
12
+ |---|---|
13
+ | `missing` | Ask `yes / later / no`; do not infer or write before the answer. |
14
+ | `yes` | Ask which rows to enable, stage profile plus selected wiring, validate, then activate. |
15
+ | `later` | Record the retryable deferral; do not activate any wiring. |
16
+ | `no` | Record the opt-out; do not activate any wiring. |
17
+ | `existing` | Adopt the consumer profile and existing wiring byte-safely. |
18
+ | `disable` | Remove exact kit-owned Agent and Git wiring first, then set `enabled: false`. |
19
+
20
+ ```json safety-guardrails-setup-effects
21
+ [
22
+ {"state":"missing","choice":null,"operations":[]},
23
+ {"state":"yes","choice":"yes","operations":["record-choice","stage-enabled-profile","stage-agent-hook-wiring","stage-git-hook-wiring","activate-staged-profile"]},
24
+ {"state":"later","choice":"later","operations":["record-choice"]},
25
+ {"state":"no","choice":"no","operations":["record-choice"]},
26
+ {"state":"existing","choice":"yes","operations":["adopt-existing"]},
27
+ {"state":"disable","choice":"yes","operations":["remove-agent-hook-wiring","remove-git-hook-wiring","update-profile-disabled"]}
28
+ ]
29
+ ```
30
+
31
+ ## Counted capability map
32
+
33
+ Every historical Safety row maps to one profile decision and one shipped
34
+ artifact. Setup reports the result as `N of 7 enabled`, never as one
35
+ all-or-nothing switch.
36
+
37
+ ```json safety-guardrails-capabilities
38
+ [
39
+ {"id":"secrets","profilePath":"safetyGuardrails.secrets.enabled","artifact":".claude/hooks/block-secrets.py"},
40
+ {"id":"packageManager","profilePath":"safetyGuardrails.packageManager.enabled","artifact":".claude/hooks/block-npm-install-in-pnpm.py"},
41
+ {"id":"doubleBackground","profilePath":"safetyGuardrails.doubleBackground.enabled","artifact":".claude/hooks/block-bg-double-background.py"},
42
+ {"id":"searchShim","profilePath":"safetyGuardrails.searchShim.enabled","artifact":".claude/hooks/grep-shim-guard.py"},
43
+ {"id":"gitHooks","profilePath":"safetyGuardrails.repositorySecurity.gitHooks.enabled","artifact":"scripts/security/install-git-hooks.mjs"},
44
+ {"id":"gitleaks","profilePath":"safetyGuardrails.repositorySecurity.gitleaks.enabled","artifact":"scripts/security/ensure-gitleaks.mjs"},
45
+ {"id":"dependencyAudit","profilePath":"safetyGuardrails.repositorySecurity.dependencyAudit.enabled","artifact":"scripts/security/audit-gate.mjs"}
46
+ ]
47
+ ```
48
+
49
+ ## Profile shape
50
+
51
+ Reconcile only `safetyGuardrails`; preserve every sibling section, unknown key,
52
+ and consumer-owned value. The following is the Testreporter parity-on example,
53
+ not a universal default. Other consumers choose each `enabled` value and fill
54
+ only facts proven in their repository.
55
+
56
+ ```json
57
+ {
58
+ "safetyGuardrails": {
59
+ "choice": "yes",
60
+ "enabled": true,
61
+ "secrets": {
62
+ "enabled": true,
63
+ "sensitiveNames": [".env", ".npmrc", "credentials.json"],
64
+ "sensitivePathFragments": ["secrets/", ".ssh/"],
65
+ "safeTemplateSuffixes": [".example", ".sample", ".template", ".dist"]
66
+ },
67
+ "packageManager": {
68
+ "enabled": true,
69
+ "lockfiles": {
70
+ "pnpm-lock.yaml": "pnpm",
71
+ "package-lock.json": "npm",
72
+ "yarn.lock": "yarn",
73
+ "bun.lockb": "bun"
74
+ }
75
+ },
76
+ "doubleBackground": {"enabled": true, "surfaces": ["claude"]},
77
+ "searchShim": {
78
+ "enabled": true,
79
+ "detected": true,
80
+ "commandNames": ["grep", "rg"]
81
+ },
82
+ "repositorySecurity": {
83
+ "gitHooks": {"enabled": true, "hooksPath": ".githooks"},
84
+ "gitleaks": {"enabled": true, "required": false},
85
+ "dependencyAudit": {
86
+ "enabled": true,
87
+ "packageManager": "pnpm",
88
+ "outagePolicy": "warn",
89
+ "blockSeverities": ["high", "critical"]
90
+ }
91
+ }
92
+ }
93
+ }
94
+ ```
95
+
96
+ An empty or disabled row is an honest no-op. `searchShim.detected` is a
97
+ consumer fact, not an installation request. `gitleaks.required: false` keeps
98
+ the verified optional provisioner non-blocking when the platform or network is
99
+ unsupported. Dependency-audit outage policy must be explicit.
100
+
101
+ ## Agent-hook ownership
102
+
103
+ Wire only enabled rows, using the exact kit-owned commands:
104
+
105
+ - `secrets` — `python3 "$CLAUDE_PROJECT_DIR/.claude/hooks/block-secrets.py"`
106
+ - `packageManager` —
107
+ `python3 "$CLAUDE_PROJECT_DIR/.claude/hooks/block-npm-install-in-pnpm.py"`
108
+ - `doubleBackground` —
109
+ `python3 "$CLAUDE_PROJECT_DIR/.claude/hooks/block-bg-double-background.py"`
110
+ - `searchShim` —
111
+ `python3 "$CLAUDE_PROJECT_DIR/.claude/hooks/grep-shim-guard.py"`
112
+
113
+ All four are PreToolUse adapters. Preserve unrelated matchers and commands in
114
+ `.claude/settings.json`. Disable removes only these exact commands.
115
+
116
+ ## Repository wiring
117
+
118
+ When `gitHooks.enabled` is true, run:
119
+
120
+ ```bash
121
+ node scripts/security/install-git-hooks.mjs <hooksPath>
122
+ ```
123
+
124
+ only after confirming the configured directory exists and contains the
125
+ consumer's intended hooks. Never create or replace consumer hook bodies.
126
+
127
+ When `gitleaks.enabled` is true, the pinned profile may be provisioned through
128
+ `scripts/security/ensure-gitleaks.mjs`; checksum mismatch, unsupported platform,
129
+ offline state, and unwritable destination remain distinct visible outcomes.
130
+ Never read a secret file to test the provisioner.
131
+
132
+ When `dependencyAudit.enabled` is true, use
133
+ `scripts/security/audit-gate.mjs` with the configured package manager and
134
+ outage policy. High/Critical findings block; Low/Moderate findings pass.
135
+
136
+ ## Transaction and failure contract
137
+
138
+ Prepare the next profile and `.claude/settings.json` in same-directory staging
139
+ files. Validate JSON, all selected artifact paths, the seven-row count, the
140
+ configured Git-hook directory, and package-manager facts before mutation.
141
+ Then:
142
+
143
+ 1. reconcile selected Agent commands in the staged settings;
144
+ 2. remember the prior `core.hooksPath` and apply the selected Git wiring;
145
+ 3. atomically rename staged settings and profile into place;
146
+ 4. on any failure, restore the prior Git config and leave active files
147
+ byte-for-byte unchanged.
148
+
149
+ Disable reverses the safety order: remove exact Agent commands and restore or
150
+ unset only the kit-owned Git wiring before committing `enabled: false`.
151
+ Repeated activation with the same choices is byte-idempotent.
152
+
153
+ Setup and verification may inspect paths, profile metadata, command exit
154
+ status, advisory counts, and hashes. They must never read secret contents or
155
+ print environment/config values.
@@ -26,7 +26,7 @@ This is a prompt-driven skill, not a deterministic script. Explore, present what
26
26
  | `## Agent skills` + `## Prod` in CLAUDE.md **and** AGENTS.md | one-line pointers + deploy target (Sections C/G + Write) |
27
27
  | `.github/workflows/agent-workflow-kit-update.yml` | optional tested Kit update pull request for GitHub consumers (Section A2) |
28
28
  | `docs/agents/census.md` | optional-census choice, paths, state, and safe disable contract seeded from [census.md](./census.md) (Section A3) |
29
- | `docs/agents/workflow-capabilities.json` + capability assets | consumer-owned Worktree Lifecycle, Memory Lifecycle, and Workflow Advisories choices (Sections A4–A6) |
29
+ | `docs/agents/workflow-capabilities.json` + capability assets | consumer-owned Worktree Lifecycle, Memory Lifecycle, Workflow Advisories, and Safety Guardrails choices (Sections A4–A7) |
30
30
 
31
31
  ## Idempotency contract — read before writing anything
32
32
 
@@ -57,7 +57,7 @@ Read the current state; don't assume. For every target file, read its first line
57
57
  - `CONTEXT.md`, `CONTEXT-MAP.md`, `docs/adr/` — domain-doc layout.
58
58
  - `docs/agents/`, `docs/agents/skills/`, `docs/conventions/` — prior output of this skill.
59
59
  - `docs/agents/census.md`, `.census/profile.json`, `.census/active.json` — an existing census choice or consumer-owned census to adopt.
60
- - `docs/agents/workflow-capabilities.json`, `.claude/settings.json` — existing capability choices/profile plus Worktree Lifecycle and Workflow Advisories hook wiring to adopt.
60
+ - `docs/agents/workflow-capabilities.json`, `.claude/settings.json`, `git config --get core.hooksPath` — existing capability choices/profile plus Worktree Lifecycle, Workflow Advisories, and Safety Guardrails wiring to adopt.
61
61
  - `.memory/active/`, `.memory/archive/`, and `.memory/receipts/` — consumer-owned Memory Lifecycle policies or recovery evidence to adopt without normalization.
62
62
  - `gh auth status` (if GitHub) — is `gh` authenticated, and with which scopes?
63
63
 
@@ -218,6 +218,31 @@ repository?"* Offer exactly **Yes**, **Later**, and **No**.
218
218
  - **Disable** — remove exact kit-owned commands first, then set `enabled:
219
219
  false`; preserve every profile value and unknown key.
220
220
 
221
+ ### 2f. Section A7 — Optional Safety Guardrails
222
+
223
+ > Safety Guardrails is a counted group of seven independently selectable
224
+ > protections: four agent-tool guards and three repository-security
225
+ > capabilities. Setup stages and validates the chosen profile plus wiring
226
+ > before activation; disabled rows remain exact no-ops.
227
+
228
+ Read [safety-guardrails.md](./safety-guardrails.md) in full. Reconcile its
229
+ complete `yes / later / no / existing / disable` matrix. If no choice exists,
230
+ ask: *"Should setup configure the portable Safety Guardrails for this
231
+ repository?"* Offer exactly **Yes**, **Later**, and **No**.
232
+
233
+ - **Yes** — ask which of the seven counted rows to enable, then reconcile only
234
+ `safetyGuardrails`, exact selected Agent-hook commands, and the selected
235
+ native Git-hook path. Report `N of 7 enabled`.
236
+ - **Later / No** — record the choice without Agent- or Git-hook wiring.
237
+ - **Existing** — adopt profile and wiring byte-safely; preserve unknown keys
238
+ and consumer-specific policies.
239
+ - **Disable** — remove only exact kit-owned Agent commands and Git wiring
240
+ first, then set `enabled: false`.
241
+
242
+ Testreporter uses the parity-on profile from the seed. Other consumers are
243
+ opt-in/manual: never copy its pnpm, path, shim, surface, or outage decisions
244
+ without repository evidence and user confirmation.
245
+
221
246
  ### 3. Section B — Triage labels
222
247
 
223
248
  > When `triage` processes an incoming issue it applies labels (or your tracker's equivalent). It needs strings you've actually configured, or it creates duplicates.
@@ -305,10 +330,11 @@ request changes a recorded choice.
305
330
 
306
331
  For `docs/agents/workflow-capabilities.json`, reconcile only each selected
307
332
  capability section. Never replace the whole file: Project Release, Memory
308
- Lifecycle, Worktree Lifecycle, Workflow Advisories, future sections, and
333
+ Lifecycle, Worktree Lifecycle, Workflow Advisories, Safety Guardrails, future sections, and
309
334
  unknown consumer keys share this profile. Apply the transition and hook
310
- ownership rules from [worktree-lifecycle.md](./worktree-lifecycle.md) and
311
- [workflow-advisories.md](./workflow-advisories.md) transactionally.
335
+ ownership rules from [worktree-lifecycle.md](./worktree-lifecycle.md),
336
+ [workflow-advisories.md](./workflow-advisories.md), and
337
+ [safety-guardrails.md](./safety-guardrails.md) transactionally.
312
338
 
313
339
  For Memory Lifecycle, use only the deterministic setup helper from Section A5.
314
340
  Do not copy templates with shell commands or edit the capability profile by
@@ -0,0 +1,155 @@
1
+ # Safety Guardrails setup contract
2
+
3
+ Safety Guardrails is a counted, opt-in capability group backed by the
4
+ consumer-owned `docs/agents/workflow-capabilities.json` profile. Its seven
5
+ rows are selected independently: four protect agent tool calls and three
6
+ bootstrap repository security. No repository name, package manager, hook
7
+ surface, threshold, path, or outage policy is inferred from the kit.
8
+
9
+ ## Choice matrix
10
+
11
+ | State | Setup action |
12
+ |---|---|
13
+ | `missing` | Ask `yes / later / no`; do not infer or write before the answer. |
14
+ | `yes` | Ask which rows to enable, stage profile plus selected wiring, validate, then activate. |
15
+ | `later` | Record the retryable deferral; do not activate any wiring. |
16
+ | `no` | Record the opt-out; do not activate any wiring. |
17
+ | `existing` | Adopt the consumer profile and existing wiring byte-safely. |
18
+ | `disable` | Remove exact kit-owned Agent and Git wiring first, then set `enabled: false`. |
19
+
20
+ ```json safety-guardrails-setup-effects
21
+ [
22
+ {"state":"missing","choice":null,"operations":[]},
23
+ {"state":"yes","choice":"yes","operations":["record-choice","stage-enabled-profile","stage-agent-hook-wiring","stage-git-hook-wiring","activate-staged-profile"]},
24
+ {"state":"later","choice":"later","operations":["record-choice"]},
25
+ {"state":"no","choice":"no","operations":["record-choice"]},
26
+ {"state":"existing","choice":"yes","operations":["adopt-existing"]},
27
+ {"state":"disable","choice":"yes","operations":["remove-agent-hook-wiring","remove-git-hook-wiring","update-profile-disabled"]}
28
+ ]
29
+ ```
30
+
31
+ ## Counted capability map
32
+
33
+ Every historical Safety row maps to one profile decision and one shipped
34
+ artifact. Setup reports the result as `N of 7 enabled`, never as one
35
+ all-or-nothing switch.
36
+
37
+ ```json safety-guardrails-capabilities
38
+ [
39
+ {"id":"secrets","profilePath":"safetyGuardrails.secrets.enabled","artifact":".claude/hooks/block-secrets.py"},
40
+ {"id":"packageManager","profilePath":"safetyGuardrails.packageManager.enabled","artifact":".claude/hooks/block-npm-install-in-pnpm.py"},
41
+ {"id":"doubleBackground","profilePath":"safetyGuardrails.doubleBackground.enabled","artifact":".claude/hooks/block-bg-double-background.py"},
42
+ {"id":"searchShim","profilePath":"safetyGuardrails.searchShim.enabled","artifact":".claude/hooks/grep-shim-guard.py"},
43
+ {"id":"gitHooks","profilePath":"safetyGuardrails.repositorySecurity.gitHooks.enabled","artifact":"scripts/security/install-git-hooks.mjs"},
44
+ {"id":"gitleaks","profilePath":"safetyGuardrails.repositorySecurity.gitleaks.enabled","artifact":"scripts/security/ensure-gitleaks.mjs"},
45
+ {"id":"dependencyAudit","profilePath":"safetyGuardrails.repositorySecurity.dependencyAudit.enabled","artifact":"scripts/security/audit-gate.mjs"}
46
+ ]
47
+ ```
48
+
49
+ ## Profile shape
50
+
51
+ Reconcile only `safetyGuardrails`; preserve every sibling section, unknown key,
52
+ and consumer-owned value. The following is the Testreporter parity-on example,
53
+ not a universal default. Other consumers choose each `enabled` value and fill
54
+ only facts proven in their repository.
55
+
56
+ ```json
57
+ {
58
+ "safetyGuardrails": {
59
+ "choice": "yes",
60
+ "enabled": true,
61
+ "secrets": {
62
+ "enabled": true,
63
+ "sensitiveNames": [".env", ".npmrc", "credentials.json"],
64
+ "sensitivePathFragments": ["secrets/", ".ssh/"],
65
+ "safeTemplateSuffixes": [".example", ".sample", ".template", ".dist"]
66
+ },
67
+ "packageManager": {
68
+ "enabled": true,
69
+ "lockfiles": {
70
+ "pnpm-lock.yaml": "pnpm",
71
+ "package-lock.json": "npm",
72
+ "yarn.lock": "yarn",
73
+ "bun.lockb": "bun"
74
+ }
75
+ },
76
+ "doubleBackground": {"enabled": true, "surfaces": ["claude"]},
77
+ "searchShim": {
78
+ "enabled": true,
79
+ "detected": true,
80
+ "commandNames": ["grep", "rg"]
81
+ },
82
+ "repositorySecurity": {
83
+ "gitHooks": {"enabled": true, "hooksPath": ".githooks"},
84
+ "gitleaks": {"enabled": true, "required": false},
85
+ "dependencyAudit": {
86
+ "enabled": true,
87
+ "packageManager": "pnpm",
88
+ "outagePolicy": "warn",
89
+ "blockSeverities": ["high", "critical"]
90
+ }
91
+ }
92
+ }
93
+ }
94
+ ```
95
+
96
+ An empty or disabled row is an honest no-op. `searchShim.detected` is a
97
+ consumer fact, not an installation request. `gitleaks.required: false` keeps
98
+ the verified optional provisioner non-blocking when the platform or network is
99
+ unsupported. Dependency-audit outage policy must be explicit.
100
+
101
+ ## Agent-hook ownership
102
+
103
+ Wire only enabled rows, using the exact kit-owned commands:
104
+
105
+ - `secrets` — `python3 "$CLAUDE_PROJECT_DIR/.claude/hooks/block-secrets.py"`
106
+ - `packageManager` —
107
+ `python3 "$CLAUDE_PROJECT_DIR/.claude/hooks/block-npm-install-in-pnpm.py"`
108
+ - `doubleBackground` —
109
+ `python3 "$CLAUDE_PROJECT_DIR/.claude/hooks/block-bg-double-background.py"`
110
+ - `searchShim` —
111
+ `python3 "$CLAUDE_PROJECT_DIR/.claude/hooks/grep-shim-guard.py"`
112
+
113
+ All four are PreToolUse adapters. Preserve unrelated matchers and commands in
114
+ `.claude/settings.json`. Disable removes only these exact commands.
115
+
116
+ ## Repository wiring
117
+
118
+ When `gitHooks.enabled` is true, run:
119
+
120
+ ```bash
121
+ node scripts/security/install-git-hooks.mjs <hooksPath>
122
+ ```
123
+
124
+ only after confirming the configured directory exists and contains the
125
+ consumer's intended hooks. Never create or replace consumer hook bodies.
126
+
127
+ When `gitleaks.enabled` is true, the pinned profile may be provisioned through
128
+ `scripts/security/ensure-gitleaks.mjs`; checksum mismatch, unsupported platform,
129
+ offline state, and unwritable destination remain distinct visible outcomes.
130
+ Never read a secret file to test the provisioner.
131
+
132
+ When `dependencyAudit.enabled` is true, use
133
+ `scripts/security/audit-gate.mjs` with the configured package manager and
134
+ outage policy. High/Critical findings block; Low/Moderate findings pass.
135
+
136
+ ## Transaction and failure contract
137
+
138
+ Prepare the next profile and `.claude/settings.json` in same-directory staging
139
+ files. Validate JSON, all selected artifact paths, the seven-row count, the
140
+ configured Git-hook directory, and package-manager facts before mutation.
141
+ Then:
142
+
143
+ 1. reconcile selected Agent commands in the staged settings;
144
+ 2. remember the prior `core.hooksPath` and apply the selected Git wiring;
145
+ 3. atomically rename staged settings and profile into place;
146
+ 4. on any failure, restore the prior Git config and leave active files
147
+ byte-for-byte unchanged.
148
+
149
+ Disable reverses the safety order: remove exact Agent commands and restore or
150
+ unset only the kit-owned Git wiring before committing `enabled: false`.
151
+ Repeated activation with the same choices is byte-idempotent.
152
+
153
+ Setup and verification may inspect paths, profile metadata, command exit
154
+ status, advisory counts, and hashes. They must never read secret contents or
155
+ print environment/config values.
package/README.md CHANGED
@@ -332,6 +332,24 @@ still reference. Flags: `--force` (overwrite pre-existing files on `init`),
332
332
 
333
333
  ## Release notes
334
334
 
335
+ ### 0.26.0
336
+
337
+ - added: `.agents/skills/setup-workflow/safety-guardrails.md`
338
+ - added: `.claude/hooks/_safety_guard.py`
339
+ - added: `.claude/hooks/block-bg-double-background.py`
340
+ - added: `.claude/hooks/block-npm-install-in-pnpm.py`
341
+ - added: `.claude/hooks/block-secrets.py`
342
+ - added: `.claude/hooks/grep-shim-guard.py`
343
+ - added: `.claude/skills/setup-workflow/safety-guardrails.md`
344
+ - added: `scripts/safety-guardrails/core.py`
345
+ - added: `scripts/safety-guardrails/search.py`
346
+ - added: `scripts/security/audit-gate.mjs`
347
+ - added: `scripts/security/ensure-gitleaks.mjs`
348
+ - added: `scripts/security/gitleaks-profile.json`
349
+ - added: `scripts/security/install-git-hooks.mjs`
350
+ - changed: `.agents/skills/setup-workflow/SKILL.md`
351
+ - changed: `.claude/skills/setup-workflow/SKILL.md`
352
+
335
353
  ### 0.25.0
336
354
 
337
355
  - added: `.claude/hooks/convention-drift-hint.py`
@@ -1,5 +1,5 @@
1
1
  {
2
- "kitVersion": "0.25.0",
2
+ "kitVersion": "0.26.0",
3
3
  "files": [
4
4
  {
5
5
  "path": ".agents/skills/ask-matt/SKILL.md",
@@ -568,12 +568,21 @@
568
568
  "mode": 420,
569
569
  "origin": "kit"
570
570
  },
571
+ {
572
+ "path": ".agents/skills/setup-workflow/safety-guardrails.md",
573
+ "kind": "skill",
574
+ "ownerSkill": "setup-workflow",
575
+ "surface": "codex",
576
+ "sha256": "08793fc7c9164cde9f7e09154e02d5718428272b85fb67d74681d3a415d4d483",
577
+ "mode": 420,
578
+ "origin": "kit"
579
+ },
571
580
  {
572
581
  "path": ".agents/skills/setup-workflow/SKILL.md",
573
582
  "kind": "skill",
574
583
  "ownerSkill": "setup-workflow",
575
584
  "surface": "codex",
576
- "sha256": "96c0c3ba9ed6b194030a8c45be618caf934e9c4ca8415ea19d726af33cd763cb",
585
+ "sha256": "b012c477612944d276e7012461f3ec38ecc25b5d92966b667150e1fb547b20cb",
577
586
  "mode": 420,
578
587
  "origin": "kit"
579
588
  },
@@ -890,6 +899,13 @@
890
899
  "mode": 420,
891
900
  "origin": "kit"
892
901
  },
902
+ {
903
+ "path": ".claude/hooks/_safety_guard.py",
904
+ "kind": "hook",
905
+ "sha256": "1f5c387b11731c7b1cd027fc58acd4c1e45c64799975dc50eeff72469df0deb0",
906
+ "mode": 420,
907
+ "origin": "kit"
908
+ },
893
909
  {
894
910
  "path": ".claude/hooks/baseline-capture-hint.py",
895
911
  "kind": "hook",
@@ -897,6 +913,27 @@
897
913
  "mode": 493,
898
914
  "origin": "kit"
899
915
  },
916
+ {
917
+ "path": ".claude/hooks/block-bg-double-background.py",
918
+ "kind": "hook",
919
+ "sha256": "ad0c763e3afbb25685f91eea2c39fc3ee58c765536a961810a49bd0c7bbd47b8",
920
+ "mode": 493,
921
+ "origin": "kit"
922
+ },
923
+ {
924
+ "path": ".claude/hooks/block-npm-install-in-pnpm.py",
925
+ "kind": "hook",
926
+ "sha256": "54da075f8e63e5e927cb752c26c47880da49eb1f730f078558f3f5eec9377c82",
927
+ "mode": 493,
928
+ "origin": "kit"
929
+ },
930
+ {
931
+ "path": ".claude/hooks/block-secrets.py",
932
+ "kind": "hook",
933
+ "sha256": "962c4f7f035c5cb4c322ee7c76b707a148526000427f4ebd49bfcac50af003b4",
934
+ "mode": 493,
935
+ "origin": "kit"
936
+ },
900
937
  {
901
938
  "path": ".claude/hooks/branch-context.py",
902
939
  "kind": "hook",
@@ -946,6 +983,13 @@
946
983
  "mode": 493,
947
984
  "origin": "kit"
948
985
  },
986
+ {
987
+ "path": ".claude/hooks/grep-shim-guard.py",
988
+ "kind": "hook",
989
+ "sha256": "9f69541c60c795bd5ec2a4f5d155f6fd3ced4f2ac6a28ed0c55c9a57772dd0d2",
990
+ "mode": 493,
991
+ "origin": "kit"
992
+ },
949
993
  {
950
994
  "path": ".claude/hooks/loc-offender-forewarn.py",
951
995
  "kind": "hook",
@@ -1702,12 +1746,21 @@
1702
1746
  "mode": 420,
1703
1747
  "origin": "kit"
1704
1748
  },
1749
+ {
1750
+ "path": ".claude/skills/setup-workflow/safety-guardrails.md",
1751
+ "kind": "skill",
1752
+ "ownerSkill": "setup-workflow",
1753
+ "surface": "claude",
1754
+ "sha256": "08793fc7c9164cde9f7e09154e02d5718428272b85fb67d74681d3a415d4d483",
1755
+ "mode": 420,
1756
+ "origin": "kit"
1757
+ },
1705
1758
  {
1706
1759
  "path": ".claude/skills/setup-workflow/SKILL.md",
1707
1760
  "kind": "skill",
1708
1761
  "ownerSkill": "setup-workflow",
1709
1762
  "surface": "claude",
1710
- "sha256": "96c0c3ba9ed6b194030a8c45be618caf934e9c4ca8415ea19d726af33cd763cb",
1763
+ "sha256": "b012c477612944d276e7012461f3ec38ecc25b5d92966b667150e1fb547b20cb",
1711
1764
  "mode": 420,
1712
1765
  "origin": "kit"
1713
1766
  },
@@ -2268,6 +2321,48 @@
2268
2321
  "mode": 420,
2269
2322
  "origin": "kit"
2270
2323
  },
2324
+ {
2325
+ "path": "scripts/safety-guardrails/core.py",
2326
+ "kind": "script",
2327
+ "sha256": "c69c9d4e1b17efca51de12454b119e9ee6758aa6c8d73fe64e4bafd76c804f4e",
2328
+ "mode": 420,
2329
+ "origin": "kit"
2330
+ },
2331
+ {
2332
+ "path": "scripts/safety-guardrails/search.py",
2333
+ "kind": "script",
2334
+ "sha256": "345b1456f1a00320b6ad3e4fad1b050d8dd21a16b51b5e5cfdaf6a579530eac1",
2335
+ "mode": 420,
2336
+ "origin": "kit"
2337
+ },
2338
+ {
2339
+ "path": "scripts/security/audit-gate.mjs",
2340
+ "kind": "script",
2341
+ "sha256": "c6129e77f58e80f5880ebd6d2d235e27e9e31a20ee3cd967ce64815738e61e54",
2342
+ "mode": 493,
2343
+ "origin": "kit"
2344
+ },
2345
+ {
2346
+ "path": "scripts/security/ensure-gitleaks.mjs",
2347
+ "kind": "script",
2348
+ "sha256": "5591f31d88362aa0df75f7b6bb7f22c094822b4bd00c5f6bf9ccff6a2313ed56",
2349
+ "mode": 493,
2350
+ "origin": "kit"
2351
+ },
2352
+ {
2353
+ "path": "scripts/security/gitleaks-profile.json",
2354
+ "kind": "doc",
2355
+ "sha256": "2480f7b4656d28cea1ede895970275d7b97f58d396341ee5e36b3df12575c1b6",
2356
+ "mode": 420,
2357
+ "origin": "kit"
2358
+ },
2359
+ {
2360
+ "path": "scripts/security/install-git-hooks.mjs",
2361
+ "kind": "script",
2362
+ "sha256": "8cf43120ea485fae7dc6aae38a14a3e703dbd18422ef13a199aedb3ec66b0184",
2363
+ "mode": 493,
2364
+ "origin": "kit"
2365
+ },
2271
2366
  {
2272
2367
  "path": "scripts/workflow-advisories/capabilities.json",
2273
2368
  "kind": "doc",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikon85/agent-workflow-kit",
3
- "version": "0.25.0",
3
+ "version": "0.26.0",
4
4
  "description": "Portable AI-agent workflow skills (plan → execute → land → learn) for Claude Code & Codex — grilling, TDD, diagnosis, two-axis code review, cross-model Codex review, design & domain-modeling, plus a skill router (ask-matt). npx init/update/diff/uninstall.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -124,6 +124,13 @@ def _known_hashes(root: Path) -> set:
124
124
  for f in data.get("files", []):
125
125
  if "sha256" in f:
126
126
  hashes.add(f["sha256"])
127
+ gitleaks = root / "scripts/security/gitleaks-profile.json"
128
+ if gitleaks.exists():
129
+ data = json.loads(gitleaks.read_text(encoding="utf-8"))
130
+ for platform in data.get("platforms", {}).values():
131
+ checksum = platform.get("sha256")
132
+ if isinstance(checksum, str):
133
+ hashes.add(checksum)
127
134
  return hashes
128
135
 
129
136
 
@@ -293,6 +300,14 @@ class Exemptions(unittest.TestCase):
293
300
  {"path": "x", "sha256": "f" * 64}]}), encoding="utf-8")
294
301
  self.assertEqual(audit_dir(self.dir), [])
295
302
 
303
+ def test_gitleaks_profile_checksums_are_verified_pin_metadata(self):
304
+ profile = self.dir / "scripts/security"
305
+ profile.mkdir(parents=True)
306
+ (profile / "gitleaks-profile.json").write_text(json.dumps({
307
+ "platforms": {"linux-x64": {"sha256": "e" * 64}},
308
+ }), encoding="utf-8")
309
+ self.assertEqual(audit_dir(self.dir), [])
310
+
296
311
  def test_loc_offender_traversal_guard_allowed(self):
297
312
  p = self.dir / "scripts"
298
313
  p.mkdir()
@@ -104,6 +104,20 @@ export const HELPER_FILES = [
104
104
  { path: '.claude/hooks/migration-snapshot-reminder.py', kind: 'hook', mode: 0o755 },
105
105
  { path: '.claude/hooks/loc-offender-forewarn.py', kind: 'hook', mode: 0o755 },
106
106
  { path: '.claude/hooks/drift-guard.py', kind: 'hook', mode: 0o755 },
107
+ // Counted Safety Guardrails unit: shared policy/search core, one loader,
108
+ // four thin Agent adapters, and three portable repository-security
109
+ // primitives. Activation stays consumer-owned through setup-workflow.
110
+ { path: 'scripts/safety-guardrails/core.py', kind: 'script', mode: 0o644 },
111
+ { path: 'scripts/safety-guardrails/search.py', kind: 'script', mode: 0o644 },
112
+ { path: '.claude/hooks/_safety_guard.py', kind: 'hook', mode: 0o644 },
113
+ { path: '.claude/hooks/block-secrets.py', kind: 'hook', mode: 0o755 },
114
+ { path: '.claude/hooks/block-npm-install-in-pnpm.py', kind: 'hook', mode: 0o755 },
115
+ { path: '.claude/hooks/block-bg-double-background.py', kind: 'hook', mode: 0o755 },
116
+ { path: '.claude/hooks/grep-shim-guard.py', kind: 'hook', mode: 0o755 },
117
+ { path: 'scripts/security/install-git-hooks.mjs', kind: 'script', mode: 0o755 },
118
+ { path: 'scripts/security/ensure-gitleaks.mjs', kind: 'script', mode: 0o755 },
119
+ { path: 'scripts/security/gitleaks-profile.json', kind: 'doc', mode: 0o644 },
120
+ { path: 'scripts/security/audit-gate.mjs', kind: 'script', mode: 0o755 },
107
121
  // SessionStart skill-freshness drift-hint (audit-skills names it). For each
108
122
  // <skill>/SOURCES.txt it flags sources newer in git than the SKILL.md. Imports
109
123
  // _hook_utils (shipped above); stdlib-only otherwise. Executable hook → 0o755.