From 11edc6ea98a16164f0ac4d118c8ed0d6a25aa21e Mon Sep 17 00:00:00 2001 From: claude-bot-go Date: Tue, 28 Jul 2026 18:38:50 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20#150:=20[milestone=20Milestone=204=20]=20?= =?UTF-8?q?Add=20`schemas/aep/memory-evidence.schema.json`=20=E2=80=94=20t?= =?UTF-8?q?amper-evident=20memory=20read/wri...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 16 +++++++ schemas/aep/memory-evidence.schema.json | 43 +++++++++++++++++++ schemas/index.json | 16 +++++++ .../invalid/memory-evidence/example.json | 6 +++ .../valid/memory-evidence/example.json | 7 +++ 5 files changed, 88 insertions(+) create mode 100644 package-lock.json create mode 100644 schemas/aep/memory-evidence.schema.json create mode 100644 tests/fixtures/invalid/memory-evidence/example.json create mode 100644 tests/fixtures/valid/memory-evidence/example.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..68e1b18 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,16 @@ +{ + "name": "@wasmagent/protocol", + "version": "0.1.7", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "@wasmagent/protocol", + "version": "0.1.7", + "license": "Apache-2.0", + "bin": { + "wasmagent-protocol": "bin/cli.js" + } + } + } +} diff --git a/schemas/aep/memory-evidence.schema.json b/schemas/aep/memory-evidence.schema.json new file mode 100644 index 0000000..80cad02 --- /dev/null +++ b/schemas/aep/memory-evidence.schema.json @@ -0,0 +1,43 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://wasmagent.dev/schemas/aep/memory-evidence.schema.json", + "title": "MemoryEvidence", + "description": "Tamper-evident memory read/write record. Each op records the content digest of the memory cell plus the digest observed immediately before the op (prior_digest), so successive records form a hash chain: altering any past write changes its digest and breaks the chain at the next read/write, making tamper detectable. Records are linked into AEP actions via aep-record's memory_read_refs / memory_write_refs.", + "type": "object", + "required": [ + "mem_ref", + "op", + "digest", + "prior_digest", + "timestamp_ms" + ], + "properties": { + "mem_ref": { + "type": "string", + "description": "Stable reference (key/path) to the memory cell that was read or written" + }, + "op": { + "type": "string", + "enum": [ + "read", + "write" + ], + "description": "Memory operation performed against the referenced cell" + }, + "digest": { + "type": "string", + "description": "Content digest of the memory cell — post-write content for a write, or the value returned by a read" + }, + "prior_digest": { + "type": [ + "string", + "null" + ], + "description": "Digest of the memory cell's content immediately before this op. Null when the cell did not previously exist (first write / creation). Carries the hash-chain link that makes the record tamper-evident." + }, + "timestamp_ms": { + "type": "number", + "description": "UTC epoch milliseconds when the memory op was recorded" + } + } +} diff --git a/schemas/index.json b/schemas/index.json index 2bc43b1..65bbde7 100644 --- a/schemas/index.json +++ b/schemas/index.json @@ -41,6 +41,22 @@ ], "summary": "Shared envelope base for all AEP evidence records \u2014 schema_version, trace_id, created_at_ms, and optional signature." }, + { + "id": "memory-evidence", + "title": "MemoryEvidence", + "path": "schemas/aep/memory-evidence.schema.json", + "canonical_id": "https://wasmagent.dev/schemas/aep/memory-evidence.schema.json", + "version": "aep/v0.1", + "stability": "evolving", + "owners": [ + "wasmagent-protocol" + ], + "consumers": [ + "wasmagent-js", + "trace-pipeline" + ], + "summary": "Tamper-evident memory read/write record \u2014 digest + prior_digest hash chain over a memory cell (keys: mem_ref, op, digest, prior_digest, timestamp_ms)." + }, { "id": "constraint-ir", "title": "ConstraintIR", diff --git a/tests/fixtures/invalid/memory-evidence/example.json b/tests/fixtures/invalid/memory-evidence/example.json new file mode 100644 index 0000000..3ce578e --- /dev/null +++ b/tests/fixtures/invalid/memory-evidence/example.json @@ -0,0 +1,6 @@ +{ + "mem_ref": "mem://agent-1/context/window-7", + "op": "delete", + "digest": "sha256:abc", + "timestamp_ms": 1737600000500 +} diff --git a/tests/fixtures/valid/memory-evidence/example.json b/tests/fixtures/valid/memory-evidence/example.json new file mode 100644 index 0000000..7fc4187 --- /dev/null +++ b/tests/fixtures/valid/memory-evidence/example.json @@ -0,0 +1,7 @@ +{ + "mem_ref": "mem://agent-1/context/window-7", + "op": "write", + "digest": "sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08", + "prior_digest": "sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae", + "timestamp_ms": 1737600000500 +}