enigma-memory 0.1.13 → 0.1.14

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 (32) hide show
  1. package/README.md +36 -17
  2. package/apps/cli/bin/enigma.mjs +320 -42
  3. package/deploy/docker-compose.local-production-simulation.yml +10 -11
  4. package/docs/benchmark-attestation-network.md +487 -487
  5. package/docs/benchmark-reproducibility.md +10 -9
  6. package/docs/demo-proof-network.md +275 -275
  7. package/docs/developer-ecosystem.md +223 -223
  8. package/docs/developer-proof-quickstart.md +325 -325
  9. package/docs/enigma-memory-ready-conformance.md +376 -376
  10. package/docs/hosted-cloud-product.md +10 -0
  11. package/docs/install-anywhere.md +34 -17
  12. package/docs/installers-and-desktop.md +9 -7
  13. package/docs/proof-network-build-notes.md +240 -240
  14. package/docs/proof-network.md +257 -257
  15. package/docs/sdk-api.md +324 -324
  16. package/docs/solana-devnet-acceptance.md +48 -0
  17. package/docs/solana-proof-rail.md +453 -453
  18. package/examples/ci/github-actions.yml +6 -8
  19. package/package.json +8 -1
  20. package/packages/mcp-server/src/index.js +1 -1
  21. package/packages/passport/src/index.js +9 -5
  22. package/scripts/build-benchmark-proof-release.mjs +391 -0
  23. package/scripts/build-goal-completion-audit.mjs +11 -5
  24. package/scripts/build-hosted-api-key-lifecycle.mjs +1 -1
  25. package/scripts/build-hosted-customer-lifecycle.mjs +1 -1
  26. package/scripts/build-installer-assets.mjs +126 -10
  27. package/scripts/build-production-handoff-packet.mjs +7 -6
  28. package/scripts/build-production-unblocker.mjs +409 -0
  29. package/scripts/build-proof-network-packet.mjs +1 -1
  30. package/scripts/release-audit.mjs +71 -2
  31. package/scripts/run-standard-memory-benchmarks.mjs +1 -1
  32. package/scripts/wait-for-backend-ready.mjs +4 -2
@@ -1,240 +1,240 @@
1
- # Proof Network build notes
2
-
3
- These notes are for future engineers extending Enigma's privacy-preserving Proof Network into a Solana program or hosted verifier. The 0.1.13 scope is local-only: create and verify public-safe proof artifacts, prepare opaque root batches for future chain anchoring, and never submit transactions or write private memory material into proof payloads.
4
-
5
- Paths below are relative to `enigma/`.
6
-
7
- ## Current implementation inventory
8
-
9
- | Surface | Current file | Notes for builders |
10
- | --- | --- | --- |
11
- | Pure package API | `packages/proof-network/src/index.js` | Exports constructors, validators, schema constants, `assertNoPrivateProofPayload`, and `sha256Json`. Keep it pure: no filesystem, network, provider SDK, Solana RPC, subprocess, or mutable runtime state. |
12
- | Package export | `package.json` | Includes `packages/proof-network/src/` in `files` and exports `./proof-network`. |
13
- | CLI commands | `apps/cli/bin/enigma.mjs` | Implements `enigma chain anchor`, `grant`, `revoke`, `attest`, and `verify` as local planning/verification commands. The help text states these commands do not submit Solana transactions or put raw memory on-chain. |
14
- | Packet builder | `scripts/build-proof-network-packet.mjs` | Builds a public-safe packet from hashes/refs and hashes benchmark report files without copying their body or path into the packet. |
15
- | Schemas | `specs/proof-network-anchor-batch-v1.schema.json`, `specs/proof-network-capability-grant-v1.schema.json`, `specs/proof-network-benchmark-attestation-v1.schema.json`, `specs/proof-network-packet-v1.schema.json` | Add `specs/proof-network-capability-revocation-v1.schema.json` before release so every artifact schema has a JSON Schema. |
16
- | Tests | `test/enigma-proof-network.test.mjs`, `test/enigma-chain-cli.test.mjs` | Keep fixtures public-safe. Add cases when any field, schema, or CLI flag changes. |
17
- | Root product docs | `../docs/proof-network.md`, `../docs/proof-network-faq.md`, `../docs/proof-network-threat-model.md`, `../docs/proof-network-build-notes.md` | Keep positioning bounded to local proof generation, local verification, Solana-ready payload shape, and public-safe commitments. |
18
-
19
- Do not touch website, Cloudflare, live infrastructure, publishing, account creation, or external provider integrations while building this layer.
20
-
21
- ## Scope boundary
22
-
23
- Allowed public evidence:
24
-
25
- - exact schema ids
26
- - artifact ids
27
- - `sha256:` digests
28
- - Merkle roots
29
- - opaque refs
30
- - counts
31
- - timestamps
32
- - reviewed public keys or signature refs
33
- - boolean claim-boundary flags
34
- - transaction planning metadata with `transaction_submitted:false`
35
-
36
- Forbidden public evidence: raw memory, prompts, transcripts, completions, embeddings, ACL bodies, tenant names, private keys, API keys, seed phrases, provider responses, customer identifiers, private local paths, and raw benchmark rows. The Proof Network proves commitments to private memory workflows; it does not publish those workflows.
37
-
38
- ## Public artifact contracts
39
-
40
- Future Solana and hosted-verifier code should switch on exact schema id, not filename. Preserve the package's current field names unless there is a coordinated clean cutover across schemas, CLI, tests, and docs.
41
-
42
- ### `enigma.proof_network.anchor_batch.v1`
43
-
44
- Purpose: group public commitments into one Solana-ready opaque anchoring payload.
45
-
46
- Current package fields include:
47
-
48
- - `schema:"enigma.proof_network.anchor_batch.v1"`
49
- - `generated_at`
50
- - `anchor_ref`
51
- - `chain`
52
- - `cluster_ref`
53
- - `commitment_count`
54
- - `commitment_root`
55
- - `commitments`: objects containing public `kind`, `root`, and optional `ref`
56
- - `solana_ready_anchor.payload_hash`
57
- - `solana_ready_anchor.account_seed`
58
- - `solana_ready_anchor.instruction_ref`
59
- - `solana_ready_anchor.opaque_payload_only:true`
60
- - `anchor_batch_id`
61
- - `anchor_batch_hash`
62
- - `transaction_submitted:false`
63
- - `raw_memory_on_chain:false`
64
- - `provider_deletion_claim:false`
65
- - `model_forgetting_claim:false`
66
- - `hosted_saas_claim:false`
67
-
68
- The Solana program should only need the compact payload hash and public metadata for schema/version/count auditing. It should not need ACL bodies, memory plaintext, benchmark reports, or provider outputs.
69
-
70
- ### `enigma.proof_network.capability_grant.v1`
71
-
72
- Purpose: represent a scoped, public-safe grant without revealing the underlying tenant, memory, ACL, or account body.
73
-
74
- Current package fields include `issued_at`, `expires_at`, `grant_ref`, `issuer_ref`, `subject_ref`, `audience_ref`, `scopes`, `resource_root`, `resource_roots`, `max_uses`, `nonce_hash`, `signature_ref`, `capability_grant_id`, `capability_grant_hash`, and all safety flags listed above.
75
-
76
- Use refs and hashes for scopes. Never embed policy documents that contain names, tenant identifiers, access-control bodies, or business-sensitive terms.
77
-
78
- ### `enigma.proof_network.capability_revocation.v1`
79
-
80
- Purpose: revoke a grant with a public nullifier/commitment.
81
-
82
- Current package fields include `revoked_at`, `revocation_ref`, `grant_id`, `grant_hash`, `issuer_ref`, `reason_ref`, `nullifier_root`, `signature_ref`, `capability_revocation_id`, `capability_revocation_hash`, and all safety flags listed above.
83
-
84
- The nullifier must not be reversible to a tenant name, account id, private ACL, or raw grant body. Add the missing JSON Schema file for this artifact before release.
85
-
86
- ### `enigma.proof_network.benchmark_attestation.v1`
87
-
88
- Purpose: attest benchmark evidence without publishing raw datasets, prompts, completions, judge responses, provider outputs, or report bodies.
89
-
90
- Current package fields include `attested_at`, `benchmark_ref`, `dataset_ref`, `runner_ref`, `package_ref`, `report_hash`, `metric_root`, `metric_roots`, `sample_count`, `run_count`, `signature_ref`, `benchmark_attestation_id`, `benchmark_attestation_hash`, and all safety flags listed above.
91
-
92
- If a CLI or script accepts a report file, hash the file locally and emit only the digest plus public refs unless the report has already been reviewed as public-safe.
93
-
94
- ### `enigma.proof_network.packet.v1`
95
-
96
- Purpose: bundle supported proof-network artifacts into one verifier-ready packet.
97
-
98
- Current package fields include `created_at`, `packet_ref`, `artifact_count`, `artifact_root`, `artifact_hashes`, `artifacts`, `proof_network_packet_id`, `proof_network_packet_hash`, and all safety flags listed above.
99
-
100
- Packets must recursively validate nested artifacts. A packet hash must not hide unsupported schemas, invalid counts, or private nested fields. Nested packets are rejected by current validation.
101
-
102
- ## Pure package API contract
103
-
104
- `packages/proof-network/src/index.js` exports:
105
-
106
- ```js
107
- assertNoPrivateProofPayload(value)
108
- sha256Json(value)
109
- createProofNetworkAnchorBatch(input = {})
110
- validateProofNetworkAnchorBatch(batch)
111
- createCapabilityGrant(input = {})
112
- validateCapabilityGrant(grant)
113
- createCapabilityRevocation(input = {})
114
- validateCapabilityRevocation(revocation)
115
- createBenchmarkAttestation(input = {})
116
- validateBenchmarkAttestation(attestation)
117
- createProofNetworkPacket(input = {})
118
- validateProofNetworkPacket(packet)
119
- ```
120
-
121
- Implementation rules:
122
-
123
- 1. Keep every function pure: no filesystem, network, environment reads, provider SDKs, Solana RPC, subprocesses, or mutable module state.
124
- 2. Constructors may accept caller-provided ids and timestamps. If defaults exist, keep them deterministic or label them local artifact metadata only.
125
- 3. `sha256Json` must canonicalize object keys before hashing so equivalent JSON yields the same digest.
126
- 4. Validators should return a validation result or normalized artifact according to the existing package pattern; do not silently coerce private or malformed fields.
127
- 5. Every constructor and validator must call `assertNoPrivateProofPayload` before returning success.
128
- 6. Freeze schema constants and enums to prevent mutation.
129
- 7. Error messages must be public-safe: name the rejected key/path, never echo the rejected private value.
130
-
131
- ## Forbidden fields and values
132
-
133
- Reject these exact keys anywhere in proof artifacts, nested packet artifacts, docs examples, and test fixtures:
134
-
135
- - `memory`
136
- - `memory_text`
137
- - `raw_memory`
138
- - `prompt`
139
- - `prompts`
140
- - `transcript`
141
- - `transcripts`
142
- - `completion`
143
- - `completions`
144
- - `embedding`
145
- - `embeddings`
146
- - `acl`
147
- - `acl_body`
148
- - `access_control_list`
149
- - `tenant`
150
- - `tenant_name`
151
- - `customer_name`
152
- - `organization_name`
153
- - `org_name`
154
- - `private_key`
155
- - `secret_key`
156
- - `api_key`
157
- - `seed_phrase`
158
- - `mnemonic`
159
- - `provider_response`
160
- - `provider_responses`
161
- - `response_body`
162
- - `access_token`
163
- - `refresh_token`
164
- - `password`
165
- - `credential`
166
- - `credentials`
167
-
168
- Also reject values that look private even under disguised keys: seed phrases, PEM private keys, bearer/basic/API-token prefixes, provider transcript blocks, raw embedding arrays, absolute private local paths, tenant/customer/account/company names, and raw benchmark prompt/completion/dataset rows.
169
-
170
- Safe replacements: use `memory_root`, `memory_hash`, `receipt_root`, `prompt_hash`, `transcript_hash`, `completion_hash`, `embedding_set_hash`, `scope_ref`, `policy_hash`, `subject_ref`, `issuer_ref`, `opaque_account_ref`, `provider_ref`, `report_hash`, aggregate counts, public key refs, and signature refs.
171
-
172
- ## CLI contract
173
-
174
- `enigma chain` is a local command group. It must not submit transactions, read Solana keypairs, call Solana RPC, contact hosted Enigma services, or call external providers.
175
-
176
- - `enigma chain anchor`: accepts one or more `--root <sha256:...>` values plus optional public refs and writes an anchor batch.
177
- - `enigma chain grant`: accepts public `--subject`, `--capability`, `--scope`, optional resource refs, policy hash, expiry, and writes a grant.
178
- - `enigma chain revoke`: accepts `--grant-hash`, `--reason`, optional public refs, and writes a revocation with `nullifier_root`.
179
- - `enigma chain attest`: accepts `--report-hash` or `--report-file`, dataset/runner/package refs, optional public scores, and writes a benchmark attestation.
180
- - `enigma chain verify --file <json>`: loads one supported artifact, runs the matching validator, and prints a public-safe validation result.
181
-
182
- Every command output must include or summarize `transaction_submitted:false` and `raw_memory_on_chain:false`.
183
-
184
- ## Packet builder script
185
-
186
- `scripts/build-proof-network-packet.mjs` exists for a local release/demo packet. Preserve these rules: hash the benchmark report file; never copy its body into the packet; reject absolute output paths; keep `transaction_submitted:false` and `raw_memory_on_chain:false`; do not call a network, deploy contracts, create accounts, sign transactions, or write private payload classes.
187
-
188
- ## Solana program handoff
189
-
190
- The future Solana program should treat Enigma artifacts as commitments, not data stores.
191
-
192
- Recommended instruction shape:
193
-
194
- 1. `anchor_batch(payload_hash, schema_hash, commitment_count, created_at_bucket)`
195
- 2. `grant_capability(grant_hash, subject_ref_hash, issuer_ref_hash, scope_hash, expires_at)`
196
- 3. `revoke_capability(nullifier_root, grant_hash, revoked_at, reason_code)`
197
- 4. `attest_benchmark(attestation_hash, report_hash, dataset_ref_hash, runner_ref_hash, package_ref_hash, sample_count)`
198
-
199
- On-chain accounts should store compact hashes, counters, timestamps, and public status. They should not store JSON blobs unless the blob has passed the same forbidden-payload scanner and strict size caps. Even then, prefer storing only a digest plus schema discriminator.
200
-
201
- ## Hosted verifier handoff
202
-
203
- A hosted verifier can add convenience, not authority over private content. It may validate schema ids, JSON Schemas, package validators, canonical hashes, packet nesting, artifact counts, and public registry/chain observations. It must return bounded public-safe error codes and never echo private submitted values.
204
-
205
- Verifier non-goals: no raw memory ingestion, provider transcript ingestion, embedding upload endpoint, tenant-name lookup endpoint, Solana transaction submission, or hosted secret custody in the 0.1.13 proof-network layer.
206
-
207
- ## Targeted test plan
208
-
209
- Run only targeted tests while building this layer. The orchestrator owns project-wide gates.
210
-
211
- Core package tests in `test/enigma-proof-network.test.mjs` should cover constructor schemas, safety flags, deterministic `sha256Json`, valid/invalid validators, recursive packet validation, forbidden key/value rejection without value echoing, Solana-ready anchor content, and benchmark attestation privacy boundaries.
212
-
213
- CLI tests in `test/enigma-chain-cli.test.mjs` should cover `chain anchor`, `chain grant`, `chain revoke`, `chain attest --report-hash`, `chain attest --report-file`, `chain verify --file` success/failure paths, required false safety flags, and the absence of transaction submission, keypair reads, Solana RPC, provider calls, or hosted credentials.
214
-
215
- Use fixtures that contain only placeholder refs and hashes. Do not create realistic memory text, tenant names, prompts, completions, embeddings, provider responses, private keys, seed phrases, or API tokens in tests.
216
-
217
- ## Release gates
218
-
219
- Do not mark the release ready unless all of these are true:
220
-
221
- 1. `packages/proof-network/src/index.js` exposes the full API contract listed above.
222
- 2. `package.json` includes the package export and publish file path for `./proof-network`.
223
- 3. JSON Schemas exist for all five schema ids, including `proof-network-capability-revocation-v1.schema.json`.
224
- 4. CLI commands exist for `chain anchor`, `chain grant`, `chain revoke`, `chain attest`, and `chain verify`.
225
- 5. Every generated CLI artifact includes `transaction_submitted:false` and `raw_memory_on_chain:false`.
226
- 6. Validators reject forbidden keys at arbitrary nesting depth.
227
- 7. Validators reject private-looking values without printing them.
228
- 8. Packets recursively validate nested artifacts and counts.
229
- 9. Tests cover pure package APIs, packet builder behavior, and CLI behavior with public-safe fixtures.
230
- 10. Documentation examples contain only hashes, roots, refs, counts, and signatures.
231
- 11. No Solana deploy, RPC submission, account creation, npm publish, Cloudflare change, external provider call, or live infrastructure action is part of the release path.
232
- 12. Benchmark attestations are claim-bounded to reviewed report hashes/refs and aggregate metrics, not raw datasets or model outputs.
233
- 13. Hosted verifier docs state that it verifies public commitments and never ingests raw memory.
234
- 14. Public positioning avoids claims of provider deletion proof, model forgetting proof, hosted SaaS proof, compliance certification, or official benchmark superiority unless separate audited evidence exists.
235
-
236
- ## Copy review checklist
237
-
238
- Before merging proof-network docs or examples, search changed files for private payload language. Any occurrence of the forbidden keys above should be absent or inside a warning list like this document. Examples should use `subject_ref`, `issuer_ref`, `scope_ref`, `sha256:...`, `root_...`, `packet_...`, and `signature:...`; they should not use customer names, real local paths, account ids, provider transcripts, memory snippets, or keys.
239
-
240
- The safest engineering rule is simple: if a future Solana explorer, README, CI log, npm tarball, hosted verifier response, or benchmark artifact could show it publicly, the value must already be public-safe before it enters the Proof Network.
1
+ # Proof Network build notes
2
+
3
+ These notes are for future engineers extending Enigma's privacy-preserving Proof Network into a Solana program or hosted verifier. The 0.1.14 scope is local-only: create and verify public-safe proof artifacts, prepare opaque root batches for future chain anchoring, and never submit transactions or write private memory material into proof payloads.
4
+
5
+ Paths below are relative to `enigma/`.
6
+
7
+ ## Current implementation inventory
8
+
9
+ | Surface | Current file | Notes for builders |
10
+ | --- | --- | --- |
11
+ | Pure package API | `packages/proof-network/src/index.js` | Exports constructors, validators, schema constants, `assertNoPrivateProofPayload`, and `sha256Json`. Keep it pure: no filesystem, network, provider SDK, Solana RPC, subprocess, or mutable runtime state. |
12
+ | Package export | `package.json` | Includes `packages/proof-network/src/` in `files` and exports `./proof-network`. |
13
+ | CLI commands | `apps/cli/bin/enigma.mjs` | Implements `enigma chain anchor`, `grant`, `revoke`, `attest`, and `verify` as local planning/verification commands. The help text states these commands do not submit Solana transactions or put raw memory on-chain. |
14
+ | Packet builder | `scripts/build-proof-network-packet.mjs` | Builds a public-safe packet from hashes/refs and hashes benchmark report files without copying their body or path into the packet. |
15
+ | Schemas | `specs/proof-network-anchor-batch-v1.schema.json`, `specs/proof-network-capability-grant-v1.schema.json`, `specs/proof-network-benchmark-attestation-v1.schema.json`, `specs/proof-network-packet-v1.schema.json` | Add `specs/proof-network-capability-revocation-v1.schema.json` before release so every artifact schema has a JSON Schema. |
16
+ | Tests | `test/enigma-proof-network.test.mjs`, `test/enigma-chain-cli.test.mjs` | Keep fixtures public-safe. Add cases when any field, schema, or CLI flag changes. |
17
+ | Root product docs | `../docs/proof-network.md`, `../docs/proof-network-faq.md`, `../docs/proof-network-threat-model.md`, `../docs/proof-network-build-notes.md` | Keep positioning bounded to local proof generation, local verification, Solana-ready payload shape, and public-safe commitments. |
18
+
19
+ Do not touch website, Cloudflare, live infrastructure, publishing, account creation, or external provider integrations while building this layer.
20
+
21
+ ## Scope boundary
22
+
23
+ Allowed public evidence:
24
+
25
+ - exact schema ids
26
+ - artifact ids
27
+ - `sha256:` digests
28
+ - Merkle roots
29
+ - opaque refs
30
+ - counts
31
+ - timestamps
32
+ - reviewed public keys or signature refs
33
+ - boolean claim-boundary flags
34
+ - transaction planning metadata with `transaction_submitted:false`
35
+
36
+ Forbidden public evidence: raw memory, prompts, transcripts, completions, embeddings, ACL bodies, tenant names, private keys, API keys, seed phrases, provider responses, customer identifiers, private local paths, and raw benchmark rows. The Proof Network proves commitments to private memory workflows; it does not publish those workflows.
37
+
38
+ ## Public artifact contracts
39
+
40
+ Future Solana and hosted-verifier code should switch on exact schema id, not filename. Preserve the package's current field names unless there is a coordinated clean cutover across schemas, CLI, tests, and docs.
41
+
42
+ ### `enigma.proof_network.anchor_batch.v1`
43
+
44
+ Purpose: group public commitments into one Solana-ready opaque anchoring payload.
45
+
46
+ Current package fields include:
47
+
48
+ - `schema:"enigma.proof_network.anchor_batch.v1"`
49
+ - `generated_at`
50
+ - `anchor_ref`
51
+ - `chain`
52
+ - `cluster_ref`
53
+ - `commitment_count`
54
+ - `commitment_root`
55
+ - `commitments`: objects containing public `kind`, `root`, and optional `ref`
56
+ - `solana_ready_anchor.payload_hash`
57
+ - `solana_ready_anchor.account_seed`
58
+ - `solana_ready_anchor.instruction_ref`
59
+ - `solana_ready_anchor.opaque_payload_only:true`
60
+ - `anchor_batch_id`
61
+ - `anchor_batch_hash`
62
+ - `transaction_submitted:false`
63
+ - `raw_memory_on_chain:false`
64
+ - `provider_deletion_claim:false`
65
+ - `model_forgetting_claim:false`
66
+ - `hosted_saas_claim:false`
67
+
68
+ The Solana program should only need the compact payload hash and public metadata for schema/version/count auditing. It should not need ACL bodies, memory plaintext, benchmark reports, or provider outputs.
69
+
70
+ ### `enigma.proof_network.capability_grant.v1`
71
+
72
+ Purpose: represent a scoped, public-safe grant without revealing the underlying tenant, memory, ACL, or account body.
73
+
74
+ Current package fields include `issued_at`, `expires_at`, `grant_ref`, `issuer_ref`, `subject_ref`, `audience_ref`, `scopes`, `resource_root`, `resource_roots`, `max_uses`, `nonce_hash`, `signature_ref`, `capability_grant_id`, `capability_grant_hash`, and all safety flags listed above.
75
+
76
+ Use refs and hashes for scopes. Never embed policy documents that contain names, tenant identifiers, access-control bodies, or business-sensitive terms.
77
+
78
+ ### `enigma.proof_network.capability_revocation.v1`
79
+
80
+ Purpose: revoke a grant with a public nullifier/commitment.
81
+
82
+ Current package fields include `revoked_at`, `revocation_ref`, `grant_id`, `grant_hash`, `issuer_ref`, `reason_ref`, `nullifier_root`, `signature_ref`, `capability_revocation_id`, `capability_revocation_hash`, and all safety flags listed above.
83
+
84
+ The nullifier must not be reversible to a tenant name, account id, private ACL, or raw grant body. Add the missing JSON Schema file for this artifact before release.
85
+
86
+ ### `enigma.proof_network.benchmark_attestation.v1`
87
+
88
+ Purpose: attest benchmark evidence without publishing raw datasets, prompts, completions, judge responses, provider outputs, or report bodies.
89
+
90
+ Current package fields include `attested_at`, `benchmark_ref`, `dataset_ref`, `runner_ref`, `package_ref`, `report_hash`, `metric_root`, `metric_roots`, `sample_count`, `run_count`, `signature_ref`, `benchmark_attestation_id`, `benchmark_attestation_hash`, and all safety flags listed above.
91
+
92
+ If a CLI or script accepts a report file, hash the file locally and emit only the digest plus public refs unless the report has already been reviewed as public-safe.
93
+
94
+ ### `enigma.proof_network.packet.v1`
95
+
96
+ Purpose: bundle supported proof-network artifacts into one verifier-ready packet.
97
+
98
+ Current package fields include `created_at`, `packet_ref`, `artifact_count`, `artifact_root`, `artifact_hashes`, `artifacts`, `proof_network_packet_id`, `proof_network_packet_hash`, and all safety flags listed above.
99
+
100
+ Packets must recursively validate nested artifacts. A packet hash must not hide unsupported schemas, invalid counts, or private nested fields. Nested packets are rejected by current validation.
101
+
102
+ ## Pure package API contract
103
+
104
+ `packages/proof-network/src/index.js` exports:
105
+
106
+ ```js
107
+ assertNoPrivateProofPayload(value)
108
+ sha256Json(value)
109
+ createProofNetworkAnchorBatch(input = {})
110
+ validateProofNetworkAnchorBatch(batch)
111
+ createCapabilityGrant(input = {})
112
+ validateCapabilityGrant(grant)
113
+ createCapabilityRevocation(input = {})
114
+ validateCapabilityRevocation(revocation)
115
+ createBenchmarkAttestation(input = {})
116
+ validateBenchmarkAttestation(attestation)
117
+ createProofNetworkPacket(input = {})
118
+ validateProofNetworkPacket(packet)
119
+ ```
120
+
121
+ Implementation rules:
122
+
123
+ 1. Keep every function pure: no filesystem, network, environment reads, provider SDKs, Solana RPC, subprocesses, or mutable module state.
124
+ 2. Constructors may accept caller-provided ids and timestamps. If defaults exist, keep them deterministic or label them local artifact metadata only.
125
+ 3. `sha256Json` must canonicalize object keys before hashing so equivalent JSON yields the same digest.
126
+ 4. Validators should return a validation result or normalized artifact according to the existing package pattern; do not silently coerce private or malformed fields.
127
+ 5. Every constructor and validator must call `assertNoPrivateProofPayload` before returning success.
128
+ 6. Freeze schema constants and enums to prevent mutation.
129
+ 7. Error messages must be public-safe: name the rejected key/path, never echo the rejected private value.
130
+
131
+ ## Forbidden fields and values
132
+
133
+ Reject these exact keys anywhere in proof artifacts, nested packet artifacts, docs examples, and test fixtures:
134
+
135
+ - `memory`
136
+ - `memory_text`
137
+ - `raw_memory`
138
+ - `prompt`
139
+ - `prompts`
140
+ - `transcript`
141
+ - `transcripts`
142
+ - `completion`
143
+ - `completions`
144
+ - `embedding`
145
+ - `embeddings`
146
+ - `acl`
147
+ - `acl_body`
148
+ - `access_control_list`
149
+ - `tenant`
150
+ - `tenant_name`
151
+ - `customer_name`
152
+ - `organization_name`
153
+ - `org_name`
154
+ - `private_key`
155
+ - `secret_key`
156
+ - `api_key`
157
+ - `seed_phrase`
158
+ - `mnemonic`
159
+ - `provider_response`
160
+ - `provider_responses`
161
+ - `response_body`
162
+ - `access_token`
163
+ - `refresh_token`
164
+ - `password`
165
+ - `credential`
166
+ - `credentials`
167
+
168
+ Also reject values that look private even under disguised keys: seed phrases, PEM private keys, bearer/basic/API-token prefixes, provider transcript blocks, raw embedding arrays, absolute private local paths, tenant/customer/account/company names, and raw benchmark prompt/completion/dataset rows.
169
+
170
+ Safe replacements: use `memory_root`, `memory_hash`, `receipt_root`, `prompt_hash`, `transcript_hash`, `completion_hash`, `embedding_set_hash`, `scope_ref`, `policy_hash`, `subject_ref`, `issuer_ref`, `opaque_account_ref`, `provider_ref`, `report_hash`, aggregate counts, public key refs, and signature refs.
171
+
172
+ ## CLI contract
173
+
174
+ `enigma chain` is a local command group. It must not submit transactions, read Solana keypairs, call Solana RPC, contact hosted Enigma services, or call external providers.
175
+
176
+ - `enigma chain anchor`: accepts one or more `--root <sha256:...>` values plus optional public refs and writes an anchor batch.
177
+ - `enigma chain grant`: accepts public `--subject`, `--capability`, `--scope`, optional resource refs, policy hash, expiry, and writes a grant.
178
+ - `enigma chain revoke`: accepts `--grant-hash`, `--reason`, optional public refs, and writes a revocation with `nullifier_root`.
179
+ - `enigma chain attest`: accepts `--report-hash` or `--report-file`, dataset/runner/package refs, optional public scores, and writes a benchmark attestation.
180
+ - `enigma chain verify --file <json>`: loads one supported artifact, runs the matching validator, and prints a public-safe validation result.
181
+
182
+ Every command output must include or summarize `transaction_submitted:false` and `raw_memory_on_chain:false`.
183
+
184
+ ## Packet builder script
185
+
186
+ `scripts/build-proof-network-packet.mjs` exists for a local release/demo packet. Preserve these rules: hash the benchmark report file; never copy its body into the packet; reject absolute output paths; keep `transaction_submitted:false` and `raw_memory_on_chain:false`; do not call a network, deploy contracts, create accounts, sign transactions, or write private payload classes.
187
+
188
+ ## Solana program handoff
189
+
190
+ The future Solana program should treat Enigma artifacts as commitments, not data stores.
191
+
192
+ Recommended instruction shape:
193
+
194
+ 1. `anchor_batch(payload_hash, schema_hash, commitment_count, created_at_bucket)`
195
+ 2. `grant_capability(grant_hash, subject_ref_hash, issuer_ref_hash, scope_hash, expires_at)`
196
+ 3. `revoke_capability(nullifier_root, grant_hash, revoked_at, reason_code)`
197
+ 4. `attest_benchmark(attestation_hash, report_hash, dataset_ref_hash, runner_ref_hash, package_ref_hash, sample_count)`
198
+
199
+ On-chain accounts should store compact hashes, counters, timestamps, and public status. They should not store JSON blobs unless the blob has passed the same forbidden-payload scanner and strict size caps. Even then, prefer storing only a digest plus schema discriminator.
200
+
201
+ ## Hosted verifier handoff
202
+
203
+ A hosted verifier can add convenience, not authority over private content. It may validate schema ids, JSON Schemas, package validators, canonical hashes, packet nesting, artifact counts, and public registry/chain observations. It must return bounded public-safe error codes and never echo private submitted values.
204
+
205
+ Verifier non-goals: no raw memory ingestion, provider transcript ingestion, embedding upload endpoint, tenant-name lookup endpoint, Solana transaction submission, or hosted secret custody in the 0.1.14 proof-network layer.
206
+
207
+ ## Targeted test plan
208
+
209
+ Run only targeted tests while building this layer. The orchestrator owns project-wide gates.
210
+
211
+ Core package tests in `test/enigma-proof-network.test.mjs` should cover constructor schemas, safety flags, deterministic `sha256Json`, valid/invalid validators, recursive packet validation, forbidden key/value rejection without value echoing, Solana-ready anchor content, and benchmark attestation privacy boundaries.
212
+
213
+ CLI tests in `test/enigma-chain-cli.test.mjs` should cover `chain anchor`, `chain grant`, `chain revoke`, `chain attest --report-hash`, `chain attest --report-file`, `chain verify --file` success/failure paths, required false safety flags, and the absence of transaction submission, keypair reads, Solana RPC, provider calls, or hosted credentials.
214
+
215
+ Use fixtures that contain only placeholder refs and hashes. Do not create realistic memory text, tenant names, prompts, completions, embeddings, provider responses, private keys, seed phrases, or API tokens in tests.
216
+
217
+ ## Release gates
218
+
219
+ Do not mark the release ready unless all of these are true:
220
+
221
+ 1. `packages/proof-network/src/index.js` exposes the full API contract listed above.
222
+ 2. `package.json` includes the package export and publish file path for `./proof-network`.
223
+ 3. JSON Schemas exist for all five schema ids, including `proof-network-capability-revocation-v1.schema.json`.
224
+ 4. CLI commands exist for `chain anchor`, `chain grant`, `chain revoke`, `chain attest`, and `chain verify`.
225
+ 5. Every generated CLI artifact includes `transaction_submitted:false` and `raw_memory_on_chain:false`.
226
+ 6. Validators reject forbidden keys at arbitrary nesting depth.
227
+ 7. Validators reject private-looking values without printing them.
228
+ 8. Packets recursively validate nested artifacts and counts.
229
+ 9. Tests cover pure package APIs, packet builder behavior, and CLI behavior with public-safe fixtures.
230
+ 10. Documentation examples contain only hashes, roots, refs, counts, and signatures.
231
+ 11. No Solana deploy, RPC submission, account creation, npm publish, Cloudflare change, external provider call, or live infrastructure action is part of the release path.
232
+ 12. Benchmark attestations are claim-bounded to reviewed report hashes/refs and aggregate metrics, not raw datasets or model outputs.
233
+ 13. Hosted verifier docs state that it verifies public commitments and never ingests raw memory.
234
+ 14. Public positioning avoids claims of provider deletion proof, model forgetting proof, hosted SaaS proof, compliance certification, or official benchmark superiority unless separate audited evidence exists.
235
+
236
+ ## Copy review checklist
237
+
238
+ Before merging proof-network docs or examples, search changed files for private payload language. Any occurrence of the forbidden keys above should be absent or inside a warning list like this document. Examples should use `subject_ref`, `issuer_ref`, `scope_ref`, `sha256:...`, `root_...`, `packet_...`, and `signature:...`; they should not use customer names, real local paths, account ids, provider transcripts, memory snippets, or keys.
239
+
240
+ The safest engineering rule is simple: if a future Solana explorer, README, CI log, npm tarball, hosted verifier response, or benchmark artifact could show it publicly, the value must already be public-safe before it enters the Proof Network.