A.·Protocol · draft v0.1

The standard,
the primitive, the layers.

What follows is the on-chain interface, the engram unit, the Seal / Stream / Trade stack, and the proximity-proof scheme that distinguishes Engram Infra from prior fungible-memory drafts.

iii.Primitive · the engram
engram.struct

The atomic unit
of memory.

Every engram is encrypted, indexed by embedding, hash-chained to its predecessor. The publisher can recall it. Anyone with quota can retrieve it. The chain proves nothing was rewritten.

schema · v0.1rfc 8785
00payloadJSON · RFC 8785
01embeddingfloat32[N]
02vectorCommitmentbytes32
03ciphertextHashbytes32
04ciphertextUristring
05prevEngrambytes32
cipher
AES-256
GCM
per-engram key
chain · linkage

Each engram pins a keccak256 of its ciphertext, a KZG vector commit of its embedding, and the hash of the previous engram. The chain stays linear and append-only — silent rewrites cannot happen.

append-only
storage
IPFS · Arweave · S3 · any URI

The protocol does not dictate where ciphertext lives — only that its hash matches the on-chain commit.

iv.Architecture · three layers
stack.md

Seal · Stream · Trade.

Three layers; each upper one adds one property to the lower. A publisher may live only on Seal — never on-chain. The Trade layer is what makes the market exist.

l1 · sealL1
L1Seal
Encryption + local commit.

AES-256-GCM with a unique key per engram. KZG commit of the embedding. keccak256 of the ciphertext. No blockchain — useful for private memory the agent does not yet publish.

l2 · streamL2
L2Stream
Append-only log on-chain.

Timestamped provenance and hash-chain continuity. Every appendEngram extends head. The past does not rewrite.

l3 · tradeL3
L3Trade
Burn-to-query market.

Fungible ERC-20 access. Burn $ENGRAM for a retrieval quota. Any consumer can buy through a liquidity pool — pay-per-thought rather than per-archive.

burn-to-query
composable
Lower layers run alone.
Upper layers add one property.
vii.Standard · interface
standard.md

The interface,
draft v0.1.

Extends ERC-20. Adds streaming engram append and verifiable top-k retrieval. What distinguishes Engram Infra is the proximity proof — without it, a publisher could return arbitrary engrams and claim they were closest.

IStreamMemory.solERC-XXXX
1// SPDX-License-Identifier: MIT
2pragma solidity ^0.8.24;
3
4/// @title IStreamMemory — tokenised, semantically addressed memory.
5/// @notice Extends ERC-20 with append-only engram stream + verifiable top-k.
6interface IStreamMemory /* is IERC20 */ {
7 function publisher() external view returns (address);
8 function head() external view returns (bytes32);
9
10 function appendEngram(
11 bytes32 vectorCommitment,
12 bytes32 ciphertextHash,
13 string calldata ciphertextUri,
14 bytes32 prevEngram
15 ) external returns (bytes32 engramId);
16
17 function queryReceipt(
18 bytes32 queryCommitment,
19 uint256 k,
20 bytes32[] calldata returned,
21 bytes calldata proximityProof
22 ) external;
23
24 function burnForQueries(uint256 quota) external;
25}
key field
proximityProof

zk-KZG when the math hardens. TEE attestation in v0 — fast, hardware-rooted.