@cleocode/core 2026.4.5 → 2026.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/dist/discovery.d.ts +69 -0
  2. package/dist/discovery.d.ts.map +1 -0
  3. package/dist/index.d.ts +3 -2
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +1643 -2349
  6. package/dist/index.js.map +4 -4
  7. package/dist/init.d.ts +51 -0
  8. package/dist/init.d.ts.map +1 -1
  9. package/dist/internal.d.ts +9 -1
  10. package/dist/internal.d.ts.map +1 -1
  11. package/dist/lifecycle/default-chain.d.ts +8 -2
  12. package/dist/lifecycle/default-chain.d.ts.map +1 -1
  13. package/dist/lifecycle/index.d.ts +1 -0
  14. package/dist/lifecycle/index.d.ts.map +1 -1
  15. package/dist/lifecycle/stage-guidance.d.ts +140 -0
  16. package/dist/lifecycle/stage-guidance.d.ts.map +1 -0
  17. package/dist/orchestration/protocol-validators.d.ts +122 -3
  18. package/dist/orchestration/protocol-validators.d.ts.map +1 -1
  19. package/dist/paths.d.ts +91 -0
  20. package/dist/paths.d.ts.map +1 -1
  21. package/dist/scaffold.d.ts +31 -1
  22. package/dist/scaffold.d.ts.map +1 -1
  23. package/dist/skills/dispatch.d.ts +1 -1
  24. package/dist/skills/skill-paths.d.ts +9 -6
  25. package/dist/skills/skill-paths.d.ts.map +1 -1
  26. package/dist/validation/protocols/_shared.d.ts +40 -0
  27. package/dist/validation/protocols/_shared.d.ts.map +1 -0
  28. package/dist/validation/protocols/architecture-decision.d.ts +23 -0
  29. package/dist/validation/protocols/architecture-decision.d.ts.map +1 -0
  30. package/dist/validation/protocols/artifact-publish.d.ts +22 -0
  31. package/dist/validation/protocols/artifact-publish.d.ts.map +1 -0
  32. package/dist/validation/protocols/consensus.d.ts +11 -17
  33. package/dist/validation/protocols/consensus.d.ts.map +1 -1
  34. package/dist/validation/protocols/contribution.d.ts +12 -17
  35. package/dist/validation/protocols/contribution.d.ts.map +1 -1
  36. package/dist/validation/protocols/decomposition.d.ts +18 -21
  37. package/dist/validation/protocols/decomposition.d.ts.map +1 -1
  38. package/dist/validation/protocols/implementation.d.ts +9 -17
  39. package/dist/validation/protocols/implementation.d.ts.map +1 -1
  40. package/dist/validation/protocols/provenance.d.ts +23 -0
  41. package/dist/validation/protocols/provenance.d.ts.map +1 -0
  42. package/dist/validation/protocols/release.d.ts +25 -0
  43. package/dist/validation/protocols/release.d.ts.map +1 -0
  44. package/dist/validation/protocols/research.d.ts +9 -17
  45. package/dist/validation/protocols/research.d.ts.map +1 -1
  46. package/dist/validation/protocols/specification.d.ts +7 -17
  47. package/dist/validation/protocols/specification.d.ts.map +1 -1
  48. package/dist/validation/protocols/testing.d.ts +22 -0
  49. package/dist/validation/protocols/testing.d.ts.map +1 -0
  50. package/dist/validation/protocols/validation.d.ts +22 -0
  51. package/dist/validation/protocols/validation.d.ts.map +1 -0
  52. package/package.json +7 -7
  53. package/src/__tests__/injection-mvi-tiers.test.js +54 -90
  54. package/src/__tests__/injection-mvi-tiers.test.js.map +1 -1
  55. package/src/discovery.ts +235 -0
  56. package/src/hooks/handlers/__tests__/hook-automation-e2e.test.js +3 -1
  57. package/src/hooks/handlers/__tests__/hook-automation-e2e.test.js.map +1 -1
  58. package/src/index.ts +16 -0
  59. package/src/init.ts +196 -0
  60. package/src/internal.ts +31 -1
  61. package/src/lifecycle/default-chain.ts +11 -2
  62. package/src/lifecycle/index.ts +10 -0
  63. package/src/lifecycle/stage-guidance.ts +282 -0
  64. package/src/metrics/__tests__/provider-detection.test.js +19 -7
  65. package/src/metrics/__tests__/provider-detection.test.js.map +1 -1
  66. package/src/orchestration/__tests__/protocol-validators.test.js +228 -8
  67. package/src/orchestration/__tests__/protocol-validators.test.js.map +1 -1
  68. package/src/orchestration/__tests__/protocol-validators.test.ts +259 -7
  69. package/src/orchestration/protocol-validators.ts +419 -4
  70. package/src/paths.ts +110 -0
  71. package/src/scaffold.ts +240 -4
  72. package/src/skills/dispatch.ts +6 -6
  73. package/src/skills/skill-paths.ts +27 -23
  74. package/src/validation/protocols/_shared.ts +88 -0
  75. package/src/validation/protocols/architecture-decision.ts +52 -0
  76. package/src/validation/protocols/artifact-publish.ts +49 -0
  77. package/src/validation/protocols/consensus.ts +44 -74
  78. package/src/validation/protocols/contribution.ts +28 -65
  79. package/src/validation/protocols/decomposition.ts +37 -64
  80. package/src/validation/protocols/implementation.ts +25 -65
  81. package/src/validation/protocols/protocols-markdown/architecture-decision.md +303 -0
  82. package/src/validation/protocols/protocols-markdown/artifact-publish.md +600 -0
  83. package/src/validation/protocols/protocols-markdown/consensus.md +322 -0
  84. package/src/validation/protocols/protocols-markdown/contribution.md +388 -0
  85. package/src/validation/protocols/protocols-markdown/decomposition.md +421 -0
  86. package/src/validation/protocols/protocols-markdown/implementation.md +357 -0
  87. package/src/validation/protocols/protocols-markdown/provenance.md +613 -0
  88. package/src/validation/protocols/protocols-markdown/release.md +783 -0
  89. package/src/validation/protocols/protocols-markdown/research.md +261 -0
  90. package/src/validation/protocols/protocols-markdown/specification.md +300 -0
  91. package/src/validation/protocols/protocols-markdown/testing.md +287 -0
  92. package/src/validation/protocols/protocols-markdown/validation.md +242 -0
  93. package/src/validation/protocols/provenance.ts +50 -0
  94. package/src/validation/protocols/release.ts +44 -0
  95. package/src/validation/protocols/research.ts +25 -87
  96. package/src/validation/protocols/specification.ts +27 -89
  97. package/src/validation/protocols/testing.ts +46 -0
  98. package/src/validation/protocols/validation.ts +46 -0
  99. package/dist/validation/protocols/release-protocol.d.ts +0 -27
  100. package/dist/validation/protocols/release-protocol.d.ts.map +0 -1
  101. package/dist/validation/protocols/testing-protocol.d.ts +0 -27
  102. package/dist/validation/protocols/testing-protocol.d.ts.map +0 -1
  103. package/dist/validation/protocols/validation-protocol.d.ts +0 -27
  104. package/dist/validation/protocols/validation-protocol.d.ts.map +0 -1
  105. package/schemas/agent-configs.schema.json +0 -120
  106. package/schemas/agent-registry.schema.json +0 -132
  107. package/schemas/archive.schema.json +0 -450
  108. package/schemas/brain-decision.schema.json +0 -69
  109. package/schemas/brain-learning.schema.json +0 -57
  110. package/schemas/brain-pattern.schema.json +0 -72
  111. package/schemas/critical-path.schema.json +0 -246
  112. package/schemas/deps-cache.schema.json +0 -97
  113. package/schemas/doctor-output.schema.json +0 -283
  114. package/schemas/error.schema.json +0 -161
  115. package/schemas/global-config.schema.json +0 -219
  116. package/schemas/grade.schema.json +0 -49
  117. package/schemas/log.schema.json +0 -250
  118. package/schemas/metrics.schema.json +0 -328
  119. package/schemas/migrations.schema.json +0 -150
  120. package/schemas/nexus-registry.schema.json +0 -90
  121. package/schemas/operation-constitution.schema.json +0 -438
  122. package/schemas/output.schema.json +0 -164
  123. package/schemas/projects-registry.schema.json +0 -107
  124. package/schemas/protocol-frontmatter.schema.json +0 -72
  125. package/schemas/rcasd-consensus-report.schema.json +0 -10
  126. package/schemas/rcasd-evidence.schema.json +0 -42
  127. package/schemas/rcasd-gate-result.schema.json +0 -46
  128. package/schemas/rcasd-hitl-resolution.schema.json +0 -10
  129. package/schemas/rcasd-index.schema.json +0 -10
  130. package/schemas/rcasd-manifest.schema.json +0 -10
  131. package/schemas/rcasd-research-output.schema.json +0 -10
  132. package/schemas/rcasd-spec-frontmatter.schema.json +0 -10
  133. package/schemas/rcasd-stage-transition.schema.json +0 -38
  134. package/schemas/releases.schema.json +0 -267
  135. package/schemas/skills-manifest.schema.json +0 -91
  136. package/schemas/spec-index.schema.json +0 -196
  137. package/schemas/system-flow-atlas.schema.json +0 -125
  138. package/src/conduit/__tests__/dual-api-e2e.test.d.ts.map +0 -1
  139. package/src/conduit/__tests__/dual-api-e2e.test.js +0 -178
  140. package/src/conduit/__tests__/dual-api-e2e.test.js.map +0 -1
  141. package/src/conduit/__tests__/dual-api-e2e.test.ts +0 -212
  142. package/src/validation/protocols/release-protocol.ts +0 -80
  143. package/src/validation/protocols/testing-protocol.ts +0 -93
  144. package/src/validation/protocols/validation-protocol.ts +0 -93
@@ -0,0 +1,613 @@
1
+ ---
2
+ id: PROV
3
+ title: Provenance Protocol
4
+ version: 1.0.0
5
+ status: active
6
+ type: cross-cutting
7
+ audience: [llm-agent, orchestrator]
8
+ tags: [provenance, traceability, lineage]
9
+ skillRef: ct-provenance-keeper
10
+ lastUpdated: 2026-04-07
11
+ enforcement: advisory
12
+ ---
13
+
14
+ # Provenance Protocol
15
+
16
+ **Version**: 1.0.0
17
+ **Type**: Conditional Protocol
18
+ **Max Active**: 3 protocols (including base)
19
+
20
+ ---
21
+
22
+ ## Trigger Conditions
23
+
24
+ This protocol activates when the task involves:
25
+
26
+ | Trigger | Keywords | Context |
27
+ |---------|----------|---------|
28
+ | Supply Chain | "provenance", "supply chain", "chain of custody" | Artifact traceability |
29
+ | Attestation | "attest", "attestation", "in-toto", "SLSA" | Cryptographic evidence |
30
+ | SBOM | "sbom", "bill of materials", "cyclonedx", "spdx" | Dependency inventory |
31
+ | Signing | "sign", "cosign", "sigstore", "verify signature" | Artifact integrity |
32
+ | Checksums | "checksum", "digest", "sha256", "integrity" | Content verification |
33
+
34
+ **Explicit Override**: `--protocol provenance` flag on task creation.
35
+
36
+ ---
37
+
38
+ ## Requirements (RFC 2119)
39
+
40
+ ### MUST
41
+
42
+ | Requirement | Description |
43
+ |-------------|-------------|
44
+ | PROV-001 | MUST record provenance chain from source commit to published artifact |
45
+ | PROV-002 | MUST compute SHA-256 digest for every produced artifact |
46
+ | PROV-003 | MUST generate attestation in in-toto Statement v1 format |
47
+ | PROV-004 | MUST record SLSA Build Level achieved (L1 minimum) |
48
+ | PROV-005 | MUST store provenance record in `.cleo/releases.json` via `record_release()` |
49
+ | PROV-006 | MUST verify provenance chain integrity before publishing attestation |
50
+ | PROV-007 | MUST set `agent_type: "provenance"` in manifest |
51
+
52
+ ### SHOULD
53
+
54
+ | Requirement | Description |
55
+ |-------------|-------------|
56
+ | PROV-010 | SHOULD generate SBOM (CycloneDX or SPDX) for artifacts with dependencies |
57
+ | PROV-011 | SHOULD sign attestations using keyless signing (sigstore/cosign) |
58
+ | PROV-012 | SHOULD publish provenance attestation alongside artifact |
59
+ | PROV-013 | SHOULD verify all input materials (dependencies, base images) have provenance |
60
+
61
+ ### MAY
62
+
63
+ | Requirement | Description |
64
+ |-------------|-------------|
65
+ | PROV-020 | MAY achieve SLSA Build Level 3 or 4 |
66
+ | PROV-021 | MAY use key-based signing (GPG) as alternative to keyless |
67
+ | PROV-022 | MAY generate multiple SBOM formats (both CycloneDX and SPDX) |
68
+
69
+ ---
70
+
71
+ ## Provenance Chain Model
72
+
73
+ ```
74
+ commit --> build --> artifact --> attestation --> registry
75
+ | | | | |
76
+ sha log digest signature published
77
+ | | | | |
78
+ source env checksum certificate location
79
+ identity capture file bundle URL
80
+ ```
81
+
82
+ ### Chain Links
83
+
84
+ | Stage | Input | Output | Required Field |
85
+ |-------|-------|--------|----------------|
86
+ | Source | Repository URL | Commit SHA | `invocation.configSource.digest.sha1` |
87
+ | Build | Commit + Config | Build log | `metadata.buildInvocationId` |
88
+ | Artifact | Build output | File + SHA-256 | `artifacts[].sha256` |
89
+ | Attestation | Artifact digest | in-toto Statement | `attestation.predicateType` |
90
+ | Registry | Attestation + Artifact | Published URL | `artifacts[].registry` |
91
+
92
+ ### Chain Integrity Rules
93
+
94
+ | Rule | Enforcement |
95
+ |------|-------------|
96
+ | Each link MUST reference previous link's output | `verify_provenance_chain()` validates |
97
+ | No link MAY be modified after creation | Append-only in `releases.json` |
98
+ | Missing links MUST be recorded as `incomplete` | `metadata.completeness` flags |
99
+ | Chain MUST be verifiable offline | Digests stored locally |
100
+
101
+ ---
102
+
103
+ ## SLSA Compliance Levels
104
+
105
+ ### Requirements Matrix
106
+
107
+ | Requirement | L1 | L2 | L3 | L4 |
108
+ |-------------|:--:|:--:|:--:|:--:|
109
+ | Provenance exists | MUST | MUST | MUST | MUST |
110
+ | Provenance is signed | -- | MUST | MUST | MUST |
111
+ | Build on hosted platform | -- | MUST | MUST | MUST |
112
+ | Non-falsifiable provenance | -- | -- | MUST | MUST |
113
+ | All dependencies have provenance | -- | -- | -- | MUST |
114
+ | Two-party review | -- | -- | -- | MUST |
115
+ | Hermetic, reproducible build | -- | -- | -- | MUST |
116
+
117
+ ### Level Detection Decision Tree
118
+
119
+ ```
120
+ HAS provenance record?
121
+ +-- NO -> Level 0 (non-compliant)
122
+ +-- YES
123
+ +-- IS provenance signed?
124
+ | +-- NO -> Level 1
125
+ | +-- YES
126
+ | +-- IS build on hosted/isolated platform?
127
+ | | +-- NO -> Level 1
128
+ | | +-- YES
129
+ | | +-- IS build non-falsifiable?
130
+ | | | +-- NO -> Level 2
131
+ | | | +-- YES
132
+ | | | +-- ALL deps pinned + hermetic + reproducible?
133
+ | | | | +-- NO -> Level 3
134
+ | | | | +-- YES -> Level 4
135
+ ```
136
+
137
+ ### Configuration
138
+
139
+ ```json
140
+ {
141
+ "release": {
142
+ "security": {
143
+ "provenance": {
144
+ "enabled": true,
145
+ "framework": "slsa",
146
+ "level": "SLSA_BUILD_LEVEL_3"
147
+ }
148
+ }
149
+ }
150
+ }
151
+ ```
152
+
153
+ ---
154
+
155
+ ## Attestation Schema
156
+
157
+ ### in-toto Statement (v1)
158
+
159
+ ```json
160
+ {
161
+ "_type": "https://in-toto.io/Statement/v1",
162
+ "subject": [
163
+ {
164
+ "name": "<artifact-name>",
165
+ "digest": {
166
+ "sha256": "<64-hex-chars>"
167
+ }
168
+ }
169
+ ],
170
+ "predicateType": "https://slsa.dev/provenance/v1",
171
+ "predicate": {
172
+ "buildDefinition": {
173
+ "buildType": "<build-system-uri>",
174
+ "externalParameters": {
175
+ "source": {
176
+ "uri": "git+<repo-url>",
177
+ "digest": { "sha1": "<commit-sha>" }
178
+ }
179
+ },
180
+ "internalParameters": {},
181
+ "resolvedDependencies": [
182
+ {
183
+ "uri": "<dependency-uri>",
184
+ "digest": { "sha256": "<dep-digest>" }
185
+ }
186
+ ]
187
+ },
188
+ "runDetails": {
189
+ "builder": {
190
+ "id": "<builder-id-uri>"
191
+ },
192
+ "metadata": {
193
+ "invocationId": "<unique-build-id>",
194
+ "startedOn": "<ISO-8601>",
195
+ "finishedOn": "<ISO-8601>"
196
+ }
197
+ }
198
+ }
199
+ }
200
+ ```
201
+
202
+ ### Required Fields
203
+
204
+ | Field | Required | Validation |
205
+ |-------|----------|------------|
206
+ | `subject[].digest.sha256` | MUST | 64-char hex, matches artifact |
207
+ | `predicateType` | MUST | Valid SLSA provenance URI |
208
+ | `buildDefinition.buildType` | MUST | Non-empty URI |
209
+ | `runDetails.builder.id` | MUST | Non-empty URI |
210
+ | `runDetails.metadata.invocationId` | SHOULD | Unique per build |
211
+ | `buildDefinition.resolvedDependencies` | SHOULD (L3+) | Array of URI+digest pairs |
212
+
213
+ ### Storage Locations
214
+
215
+ | Location | Format | Purpose |
216
+ |----------|--------|---------|
217
+ | `.cleo/attestations/<version>.intoto.jsonl` | in-toto Statement (DSSE envelope) | Local attestation store |
218
+ | `<artifact>.att` | DSSE envelope (JSON) | Bundled with artifact |
219
+ | OCI registry (tag: `sha256-<digest>.att`) | Cosign attachment | Registry-hosted attestation |
220
+
221
+ ---
222
+
223
+ ## SBOM Requirements
224
+
225
+ ### When to Generate
226
+
227
+ | Condition | SBOM Required |
228
+ |-----------|:-------------:|
229
+ | Artifact has runtime dependencies | MUST |
230
+ | Docker/OCI image | MUST |
231
+ | Library/package published to registry | MUST |
232
+ | Standalone binary with no deps | SHOULD |
233
+ | Documentation-only artifact | MAY skip |
234
+
235
+ ### Supported Formats
236
+
237
+ | Format | Spec Version | Use Case |
238
+ |--------|-------------|----------|
239
+ | CycloneDX | 1.5+ | Default (machine-readable, JSON) |
240
+ | SPDX | 2.3+ | Compliance-focused (regulatory) |
241
+
242
+ ### Minimum Schema (CycloneDX)
243
+
244
+ ```json
245
+ {
246
+ "bomFormat": "CycloneDX",
247
+ "specVersion": "1.5",
248
+ "version": 1,
249
+ "metadata": {
250
+ "timestamp": "<ISO-8601>",
251
+ "tools": [{ "name": "<generator>", "version": "<version>" }],
252
+ "component": {
253
+ "type": "application",
254
+ "name": "<artifact-name>",
255
+ "version": "<artifact-version>",
256
+ "purl": "<package-url>"
257
+ }
258
+ },
259
+ "components": [
260
+ {
261
+ "type": "library",
262
+ "name": "<dep-name>",
263
+ "version": "<dep-version>",
264
+ "purl": "<dep-purl>",
265
+ "hashes": [{ "alg": "SHA-256", "content": "<hex-digest>" }]
266
+ }
267
+ ]
268
+ }
269
+ ```
270
+
271
+ ### Storage
272
+
273
+ | Location | Purpose |
274
+ |----------|---------|
275
+ | `.cleo/sbom/<artifact-name>-<version>.cdx.json` | CycloneDX local store |
276
+ | `.cleo/sbom/<artifact-name>-<version>.spdx.json` | SPDX local store |
277
+ | `<artifact>.sbom.json` | Bundled with artifact |
278
+
279
+ ---
280
+
281
+ ## Signing Protocol
282
+
283
+ ### Method Decision Tree
284
+
285
+ ```
286
+ SIGNING_METHOD configured?
287
+ +-- "sigstore" (default)
288
+ | +-- IS keyless enabled? (default: true)
289
+ | +-- YES -> cosign sign-blob --yes <artifact>
290
+ | +-- NO -> cosign sign-blob --key <key-ref> <artifact>
291
+ +-- "gpg"
292
+ | +-- GPG_KEY_ID set?
293
+ | +-- YES -> gpg --detach-sign --armor -u <key-id> <artifact>
294
+ | +-- NO -> Exit 91 (E_SIGNING_KEY_MISSING)
295
+ +-- "none"
296
+ +-- Skip signing (SLSA L1 only)
297
+ ```
298
+
299
+ ### Command Templates
300
+
301
+ | Method | Command | Output |
302
+ |--------|---------|--------|
303
+ | Sigstore (keyless) | `cosign sign-blob --yes --output-signature <sig> --output-certificate <cert> <artifact>` | `.sig` + `.pem` |
304
+ | Sigstore (key) | `cosign sign-blob --key <ref> --output-signature <sig> <artifact>` | `.sig` |
305
+ | GPG | `gpg --detach-sign --armor -u <key-id> <artifact>` | `.asc` |
306
+ | None | (skip) | (none) |
307
+
308
+ ### Signing Metadata Record
309
+
310
+ ```json
311
+ {
312
+ "method": "sigstore",
313
+ "keyless": true,
314
+ "signed": true,
315
+ "signedAt": "<ISO-8601>",
316
+ "signature": "<path-to-sig>",
317
+ "certificate": "<path-to-cert>",
318
+ "transparencyLog": {
319
+ "index": "<rekor-log-index>",
320
+ "url": "https://rekor.sigstore.dev"
321
+ }
322
+ }
323
+ ```
324
+
325
+ ### Validation
326
+
327
+ | Check | Condition | Exit Code |
328
+ |-------|-----------|-----------|
329
+ | Method configured | `signing.method` in `["sigstore", "gpg", "none"]` | 90 |
330
+ | Key available (if key-based) | Key reference resolves | 91 |
331
+ | Signature produced | `.sig` or `.asc` file exists | 92 |
332
+ | Signature verifies | `cosign verify-blob` or `gpg --verify` passes | 92 |
333
+
334
+ ---
335
+
336
+ ## Verification Protocol
337
+
338
+ ### Verification Decision Tree
339
+
340
+ ```
341
+ VERIFY artifact provenance:
342
+ +-- 1. Digest check
343
+ | +-- Compute SHA-256, compare to recorded digest
344
+ | +-- MISMATCH -> Exit 93 (E_DIGEST_MISMATCH)
345
+ | +-- MATCH -> continue
346
+ +-- 2. Signature check (if signed)
347
+ | +-- Verify signature against artifact
348
+ | +-- FAIL -> Exit 92 (E_SIGNATURE_INVALID)
349
+ | +-- PASS -> continue
350
+ +-- 3. Attestation check (if exists)
351
+ | +-- Verify attestation subject matches artifact digest
352
+ | +-- MISMATCH -> Exit 94 (E_ATTESTATION_INVALID)
353
+ | +-- MATCH -> continue
354
+ +-- 4. Chain completeness
355
+ +-- Walk chain: commit -> build -> artifact -> attestation
356
+ +-- BROKEN -> report incomplete (warning, not blocking)
357
+ +-- COMPLETE -> VERIFIED
358
+ ```
359
+
360
+ ### Verification Result Schema
361
+
362
+ ```json
363
+ {
364
+ "artifact": "<name>",
365
+ "version": "<version>",
366
+ "verified": true,
367
+ "checks": {
368
+ "digest": { "status": "pass", "algorithm": "sha256", "value": "<hex>" },
369
+ "signature": { "status": "pass", "method": "sigstore" },
370
+ "attestation": { "status": "pass", "predicateType": "https://slsa.dev/provenance/v1" },
371
+ "chain": { "status": "pass", "completeness": { "source": true, "build": true, "artifact": true } }
372
+ },
373
+ "slsaLevel": "SLSA_BUILD_LEVEL_3",
374
+ "verifiedAt": "<ISO-8601>"
375
+ }
376
+ ```
377
+
378
+ ---
379
+
380
+ ## Checksum & Digest Management
381
+
382
+ ### Supported Algorithms
383
+
384
+ | Algorithm | Required | Use Case |
385
+ |-----------|:--------:|----------|
386
+ | SHA-256 | MUST | All artifacts, attestation subjects |
387
+ | SHA-512 | MAY | High-security contexts |
388
+
389
+ ### Computation Per Type
390
+
391
+ | Artifact Type | Input | Command |
392
+ |--------------|-------|---------|
393
+ | File | File path | `sha256sum <file> \| awk '{print $1}'` |
394
+ | Docker image | Image ref | `docker inspect --format='{{.Id}}' <image>` |
395
+ | OCI manifest | Manifest JSON | `sha256sum <manifest.json>` |
396
+
397
+ ### Storage Locations
398
+
399
+ | Location | Format | Purpose |
400
+ |----------|--------|---------|
401
+ | `releases.json` -> `artifacts[].sha256` | Hex string (64 chars) | Provenance record |
402
+ | `checksums.txt` (release artifact) | `<sha256> <filename>` | Distribution verification |
403
+ | Attestation `subject[].digest.sha256` | Hex string (64 chars) | Attestation binding |
404
+
405
+ ### Publishing Channels
406
+
407
+ | Channel | Format |
408
+ |---------|--------|
409
+ | Git tag annotation | `SHA-256: <hex>` per artifact |
410
+ | GitHub Release body | `## Checksums\n<sha256> <filename>` |
411
+ | Registry metadata | Registry-native digest field |
412
+ | `checksums.txt` file | `<sha256> <filename>` per line |
413
+
414
+ ---
415
+
416
+ ## Error Codes (90-94)
417
+
418
+ | Code | Constant | Meaning | Recovery |
419
+ |------|----------|---------|----------|
420
+ | 90 | `E_PROVENANCE_CONFIG_INVALID` | Invalid provenance/signing config | Check `.cleo/config.json` security section |
421
+ | 91 | `E_SIGNING_KEY_MISSING` | Signing key not found | Set `GPG_KEY_ID` or configure sigstore keyless |
422
+ | 92 | `E_SIGNATURE_INVALID` | Signature verification failed | Re-sign artifact, check key validity |
423
+ | 93 | `E_DIGEST_MISMATCH` | Computed digest does not match record | Investigate tampering or rebuild artifact |
424
+ | 94 | `E_ATTESTATION_INVALID` | Attestation subject/format error | Regenerate attestation from correct artifact |
425
+
426
+ ### Recoverability
427
+
428
+ | Code | Recoverable | Agent Action |
429
+ |------|:-----------:|--------------|
430
+ | 90 | Yes | Fix config, retry |
431
+ | 91 | Yes | Set key, retry |
432
+ | 92 | Yes | Re-sign, retry |
433
+ | 93 | No | Investigate tampering, rebuild |
434
+ | 94 | Yes | Regenerate attestation, retry |
435
+
436
+ ### Error Recovery Decision Tree
437
+
438
+ ```
439
+ EXIT CODE?
440
+ +-- 90 (CONFIG_INVALID) -> Fix .cleo/config.json security section -> Retry
441
+ +-- 91 (SIGNING_KEY) -> Set GPG_KEY_ID or enable sigstore keyless -> Retry
442
+ +-- 92 (SIGNATURE_INVALID) -> Re-sign artifact with valid key -> Retry
443
+ +-- 93 (DIGEST_MISMATCH) -> Investigate tampering, clean rebuild -> Retry
444
+ +-- 94 (ATTESTATION) -> Regenerate attestation from artifact -> Retry
445
+ ```
446
+
447
+ ---
448
+
449
+ ## Output Format
450
+
451
+ ### File Output
452
+
453
+ ```markdown
454
+ # Provenance Report: <artifact-name> v<version>
455
+
456
+ **Task**: T####
457
+ **Date**: YYYY-MM-DD
458
+ **Status**: complete|partial|blocked
459
+ **Agent Type**: provenance
460
+
461
+ ---
462
+
463
+ ## Summary
464
+
465
+ {2-3 sentence summary of provenance activities}
466
+
467
+ ## Provenance Chain
468
+
469
+ | Stage | Value | Verified |
470
+ |-------|-------|:--------:|
471
+ | Source commit | `<sha>` | PASS |
472
+ | Build invocation | `<id>` | PASS |
473
+ | Artifact digest | `sha256:<hex>` | PASS |
474
+ | Attestation | `<predicate-type>` | PASS |
475
+ | Signature | `<method>` | PASS |
476
+
477
+ ## SLSA Compliance
478
+
479
+ | Check | Status | Notes |
480
+ |-------|--------|-------|
481
+ | Level achieved | L3 | |
482
+ | Provenance exists | PASS | |
483
+ | Provenance signed | PASS | sigstore/keyless |
484
+ | Hardened build | PASS | CI/CD platform |
485
+
486
+ ## SBOM
487
+
488
+ | Format | Location | Components |
489
+ |--------|----------|:----------:|
490
+ | CycloneDX 1.5 | `.cleo/sbom/<name>.cdx.json` | 42 |
491
+
492
+ ## Verification Results
493
+
494
+ | Artifact | Digest | Signature | Attestation | Chain |
495
+ |----------|:------:|:---------:|:-----------:|:-----:|
496
+ | `<name>` | PASS | PASS | PASS | PASS |
497
+ ```
498
+
499
+ ### Manifest Entry
500
+
501
+ ```bash
502
+ cleo research add \
503
+ --title "Provenance: <artifact-name> v<version>" \
504
+ --file "YYYY-MM-DD_provenance-<artifact>.md" \
505
+ --topics "provenance,supply-chain,slsa,attestation" \
506
+ --findings "SLSA L3 achieved,SHA-256 verified,Attestation signed,SBOM generated" \
507
+ --status complete \
508
+ --task T#### \
509
+ --not-actionable \
510
+ --agent-type provenance
511
+ ```
512
+
513
+ ---
514
+
515
+ ## Integration Points
516
+
517
+ ### Base Protocol
518
+
519
+ - Inherits task lifecycle (start, execute, complete)
520
+ - Inherits manifest append requirement
521
+ - Inherits error handling patterns
522
+
523
+ ### Protocol Interactions
524
+
525
+ | Combined With | Behavior |
526
+ |---------------|----------|
527
+ | release | Release triggers provenance record via `record_release()` |
528
+ | artifact-publish | Artifact-publish delegates signing/attestation to provenance |
529
+ | implementation | Implementation produces artifacts requiring provenance |
530
+ | contribution | Contribution commits form source stage of chain |
531
+
532
+ ### Existing Infrastructure
533
+
534
+ | Function | File | Purpose |
535
+ |----------|------|---------|
536
+ | `record_release()` | `lib/release-provenance.sh` | Store provenance record |
537
+ | `link_task_to_release()` | `lib/release-provenance.sh` | Associate tasks |
538
+ | `get_release_provenance()` | `lib/release-provenance.sh` | Retrieve chain |
539
+ | `verify_provenance_chain()` | `lib/release-provenance.sh` | Validate integrity |
540
+ | `generate_provenance_report()` | `lib/release-provenance.sh` | Human-readable output |
541
+ | `get_security_config()` | `lib/release-config.sh` | Read signing/provenance config |
542
+
543
+ ### Handoff Patterns
544
+
545
+ | Scenario | Handoff Target |
546
+ |----------|----------------|
547
+ | Provenance complete, ready to publish | artifact-publish protocol |
548
+ | SBOM reveals vulnerable dependency | research protocol |
549
+ | Signing fails (key issue) | HITL escalation |
550
+ | Verification fails on consumed artifact | implementation protocol (rebuild) |
551
+
552
+ ---
553
+
554
+ ## Workflow Sequence
555
+
556
+ ```
557
+ 1. Read task requirements (cleo show T####)
558
+ 2. Set focus (cleo start T####)
559
+ 3. Compute artifact digests (SHA-256)
560
+ 4. Generate attestation (in-toto Statement v1)
561
+ 5. Sign attestation (sigstore/cosign or gpg)
562
+ 6. Generate SBOM (if applicable per PROV-010)
563
+ 7. Record provenance via record_release()
564
+ 8. Verify chain via verify_provenance_chain()
565
+ 9. Write output file
566
+ 10. Append manifest entry
567
+ 11. Complete task (cleo complete T####)
568
+ 12. Return: "Provenance complete. See MANIFEST.jsonl for summary."
569
+ ```
570
+
571
+ ---
572
+
573
+ ## Example
574
+
575
+ **Task**: Generate provenance for CLEO v0.85.0 release
576
+
577
+ **Manifest Entry Command**:
578
+ ```bash
579
+ cleo research add \
580
+ --title "Provenance: CLEO v0.85.0" \
581
+ --file "2026-02-09_provenance-v0850.md" \
582
+ --topics "provenance,slsa,v0.85.0,supply-chain" \
583
+ --findings "SLSA L3 achieved,3 artifacts signed,CycloneDX SBOM generated,Chain verified" \
584
+ --status complete \
585
+ --task T3200 \
586
+ --epic T3195 \
587
+ --not-actionable \
588
+ --agent-type provenance
589
+ ```
590
+
591
+ **Return Message**:
592
+ ```
593
+ Provenance complete. See MANIFEST.jsonl for summary.
594
+ ```
595
+
596
+ ---
597
+
598
+ ## Anti-Patterns
599
+
600
+ | Pattern | Why Avoid |
601
+ |---------|-----------|
602
+ | Skipping digest computation | Breaks chain integrity, unverifiable artifacts |
603
+ | Hardcoding signing keys in config | Security risk, key exposure |
604
+ | Generating attestation without matching digest | Attestation binds to wrong artifact |
605
+ | Publishing artifact before signing | Cannot retrofit signatures |
606
+ | Modifying provenance records after creation | Violates immutability, breaks audit trail |
607
+ | Skipping SBOM for artifacts with dependencies | Hidden supply chain risk |
608
+ | Using SHA-1 or MD5 for digests | Cryptographically broken, non-compliant |
609
+ | Storing private keys in `.cleo/` directory | Key compromise risk |
610
+
611
+ ---
612
+
613
+ *Protocol Version 1.0.0 - Supply Chain Provenance Protocol*