Skip to Content
Anuma SDKReactInternalFunctionsarchiveVaultMemoryOp()

archiveVaultMemoryOp()

archiveVaultMemoryOp(ctx: VaultMemoryOperationsContext, id: string, opts?: object): Promise<boolean>

Defined in: src/lib/db/memoryVault/operations.ts:2359 

Archive a memory (decay soft state, PR2) — set archived_at. An archived row drops out of every recall lane via the baseVaultConditions choke point but stays recoverable via restoreVaultMemoryOp until the hard-delete window elapses.

Concurrency: re-checks is_deleted / ownership / archived_at INSIDE the serialized writer (mirrors updateVaultMemoryOp). Additionally, when opts.expectedUpdatedAt is given, the archive is skipped if the row’s current updated_at no longer matches — i.e. a retain() merge (which bumps updated_at) landed between the sweep’s candidate scan and this write, so the fact was just re-observed and must NOT be archived on stale data. Idempotent: a row another sweep already archived returns false (no double-write).

Parameters

ParameterTypeDescription

ctx

VaultMemoryOperationsContext

‐

id

string

‐

opts?

object

‐

opts.expectedLastObservedAt?

number | null

Also guard re-observations, which deliberately preserve updated_at.

opts.expectedUpdatedAt?

number

Optimistic-concurrency guard: skip if the row’s updated_at changed since the sweep observed it (a concurrent re-observation).

opts.now?

number

Timestamp to stamp into archived_at. Default Date.now().

Returns

Promise<boolean>

true if this call archived the row; false if it was stale (deleted / not owned / already archived / refreshed under us).

Deprecated

App code: use MemoryStore.archive (createLocalMemoryStore).

Last updated on