Skip to main content

Operations

Write

const receipt = await toda.remember("Deployments run on Fridays.", {
kind: "preference",
});

The API:

  1. validates the request
  2. resolves the caller and data key
  3. encrypts content with AES-256-GCM
  4. computes the leaf from plaintext content and metadata
  5. appends the row at the next leafIndex
  6. returns the receipt
{ "id": "6c1f...", "leafHash": "9ab3...", "leafIndex": 41 }

The write path does not submit a transaction. anchored remains false until an anchor includes the leaf.

Metadata is stored as plain JSON. Secrets belong in content.

Read

Reads are scoped to the authenticated userId. The API loads the user's data key, decrypts matching rows, and returns the memory with its leaf and anchor fields.

Rows owned by other users are not loaded.

Recall

const hits = await toda.recall("deployment schedule");
const context = await toda.recallForPrompt("deployment schedule", 10);

Recall performs substring matching over decrypted memory bodies. recallForPrompt formats the matching set for a prompt and returns an empty string when there are no matches.

Search is linear in the size of one user's log because encrypted bodies cannot be indexed by Postgres.

Prove

const bundle = await toda.getProof(id);

The API:

  1. loads the memory and ordered leaf set
  2. builds the inclusion proof
  3. loads the root and transaction for the memory's batch
  4. reads the current onchain tip
  5. returns the proof bundle
{
"proof": { "leaf": "9ab3...", "leafIndex": 41, "siblings": ["c40f..."], "directions": [true] },
"batchRoot": "7de2...",
"txSignature": "5Kx...",
"onchainRoot": "7de2..."
}

Verifying

verifyProof(bundle.proof, hexToBytes(bundle.batchRoot))
&& bundle.batchRoot === bundle.onchainRoot;

For independent verification, fetch the commitment account from a separate RPC instead of using onchainRoot from the bundle.

See Verifying a memory.

Delete

The API has no delete operation. Corrections are appended as new memories.

Removing a database row removes availability but does not remove the leaf from previously committed roots.

Next: The anchor service.