Skip to content

Move module receipt: typed on-chain attribution receipt (op / digests / model / parent lineage) #9

Description

@harrymove-ctrl

Context

The one thing no existing primitive (Walrus bytes, Harbor/SEAL access control, MemWal recall) provides is a typed, queryable, composable attribution receipt that a Talus Nexus DAG node can reference by object ref and verify (roadmap §2). Today provenance is weak: packProofBundle computes a sha256 artifactDigest (packages/walrus/src/storage.ts:243) and chunkGraphDigest a deterministic content digest (packages/core/src/chunks.ts:59), but neither is anchored to an identity-bound on-chain object — and Tatum's key, not ours, signs the blob. This module is the Talus payload that fixes that.

Goal / user story

As an agent builder using the contextmem.extract/.recall/.remember Talus Tools, each tool run mints a verifiable on-chain Receipt object that records what operation happened, over what source/artifact, by whom, with which model, and which prior receipts it descends from — so I can audit and compose agent memory provenance as a DAG.

Acceptance criteria

  • module contextmem::receipt defines a Receipt struct with: op: u8 (0=Extract,1=Recall,2=Remember; document the enum), namespace: String, producer: address, tool_caller: Option<address>, source_digest: vector<u8>, artifact_digest: vector<u8>, walrus_blob_id: String, quilt_patch_id: Option<String>, memwal_ref: Option<String>, parents: vector<ID>, model: Option<String>, created_at_ms: u64, epoch: u64.
  • public fun mint_receipt(...) constructs the object, sets created_at_ms from a &Clock and epoch from TxContext, then freezes it (transfer::freeze_object) so the attestation is immutable + globally queryable by ID.
  • mint_receipt emits a ReceiptMinted event carrying the new receipt id, op, namespace, producer, and digests (so off-chain indexers can follow the DAG without loading every object).
  • parents: vector<ID> is accepted and stored verbatim so receipts compose into a lineage DAG (recall→remember→extract); add a parent_count/getter for read access.
  • #[test] coverage: mint with 0 parents and with N parents, assert event emission and that fields round-trip (use sui::test_scenario + clock::create_for_testing).
  • Public getters for every field so the TS client / Nexus can read receipts without BCS-decoding raw object bytes.

Implementation notes

  • Digests are bytes, not strings. artifactDigest flows in as the string "sha256:<hex>" (see WalrusStorageReceipt.artifactDigest, packages/core/src/types.ts:664); the TS client should strip the sha256: prefix and pass raw 32-byte vector<u8>. Same for source_digest (use chunkGraphDigest's hex output).
  • Freeze vs share: freeze receipts (immutable) — they're attestations, never mutated. A frozen object's ID is still referenceable from Namespace.head_receipt and from child receipts' parents.
  • Head pointer lives in registry: updating Namespace.head_receipt is a separate mutable-object operation; expose a public entry in registry rather than mutating the namespace from this module.
  • Schema freeze risk: confirm the Talus Nexus receipt schema/event ABI before finalizing struct field order/types (roadmap open question §2). Keep field naming aligned with StorageIndexInput/rememberStorageIndex (packages/memwal/src/index.ts:37,164) so the TS mapping is 1:1.
  • Granularity: start with one Receipt per op (precise lineage). If gas becomes a concern, a later issue can add a batched/Merkle-root variant — out of scope here.

Sui Overflow angle

This is the centerpiece that makes ContextMEM's agent-memory product genuinely Sui-native: composable, on-chain, model-tagged provenance for an AI agent DAG is a novel use of Move objects + events, and demos beautifully ("every fact your agent remembered has a verifiable on-chain receipt with full lineage"). It's the differentiator over plain Walrus storage.

Dependencies

  • Requires the Move scaffold issue (package + CI + publish).
  • The head_receipt update path depends on the registry module issue (can land independently; mint works without it).

Part of the ContextMEM roadmap (#4) • Sui Overflow build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0Demo-blocking: required for a working Sui Overflow demoagent-talusTalus/Nexus agent integration and attribution receiptsmoveSui Move smart-contract package (registry/receipt)suiSui chain: tx signing, objects, wallet, zkLogin, explorer

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions