Skip to main content

TotalReclawMemory

Struct TotalReclawMemory 

Source
pub struct TotalReclawMemory { /* private fields */ }
Expand description

TotalReclaw memory backend for ZeroClaw.

Implements the ZeroClaw Memory trait with full E2E encryption.

Implementations§

Source§

impl TotalReclawMemory

Source

pub async fn new(config: TotalReclawConfig) -> Result<Self>

Create a new TotalReclaw memory backend.

This initializes all crypto keys, derives the EOA and Smart Account, sets up the LSH hasher, the embedding provider, and registers with the relay.

Source

pub fn wallet_address(&self) -> &str

Get the wallet address.

Source

pub fn relay(&self) -> &RelayClient

Get a reference to the relay client.

Source

pub fn keys(&self) -> &DerivedKeys

Get a reference to the derived keys.

Source

pub fn private_key(&self) -> &[u8; 32]

Get a reference to the private key.

Source

pub fn name(&self) -> &str

Backend name.

Source

pub async fn store( &self, _key: &str, content: &str, category: MemoryCategory, _session_id: Option<&str>, ) -> Result<()>

Store a memory entry using native UserOp.

Importance defaults to 10 (max) if not specified. Per the client-consistency spec, decayScore = importance / 10, so importance=10 -> decayScore=1.0.

Clears the hot cache after storing to avoid stale results.

Source

pub async fn store_with_importance( &self, _key: &str, content: &str, category: MemoryCategory, _session_id: Option<&str>, importance: f64, ) -> Result<()>

Store a memory entry with explicit importance (1-10 scale).

Per the client-consistency spec, decayScore = importance / 10.

Source

pub async fn store_batch(&self, facts: &[(&str, &str)]) -> Result<Vec<String>>

Store multiple memory entries as a single batched UserOp.

Gas savings: ~64% vs individual submissions for batch of 5.

Source

pub async fn recall( &self, query: &str, limit: usize, _session_id: Option<&str>, ) -> Result<Vec<MemoryEntry>>

Recall memories matching a query.

Uses a hot cache to skip remote queries when a semantically similar query (cosine >= 0.85) was recently answered.

Source

pub async fn auto_recall(&self, query: &str) -> Result<Vec<MemoryEntry>>

Auto-recall: search with the spec-mandated top_k=8.

Per the client-consistency spec, auto-recall at session start uses the raw user message as query and returns top 8 after reranking.

Source

pub async fn get(&self, key: &str) -> Result<Option<MemoryEntry>>

Get a specific memory entry by key/ID.

Source

pub async fn list( &self, _category: Option<&MemoryCategory>, _session_id: Option<&str>, ) -> Result<Vec<MemoryEntry>>

List all memories (paginated export).

Parses each decrypted envelope to extract the correct category (previously hardcoded to Core).

Source

pub async fn forget(&self, key: &str) -> Result<bool>

Forget (soft-delete) a memory entry using native UserOp.

Emits a Memory Taxonomy v1 tombstone (outer protobuf version = 4) so the subgraph can distinguish v1 deletes from legacy v3 deletes.

Source

pub async fn store_v1(&self, input: &V1StoreInput) -> Result<String>

Store a Memory Taxonomy v1 claim (explicit v1 write path).

Use this when the caller has full v1 context (type, source, scope, volatility, optional reasoning). Produces a v4 protobuf envelope with the canonical MemoryClaimV1 JSON inner blob.

For the ZeroClaw Memory trait’s simpler (key, content, category) shape, store_with_importance() remains the primary entry point and continues to emit v3 envelopes during the v0→v1 migration window. Switch your agent to store_v1() when you want v1 provenance-weighted reranking at recall time.

Source

pub async fn pin(&self, _memory_id: &str) -> Result<()>

Pin a memory claim — supersede it with a new v1 blob whose volatility: stable signals “never auto-supersede”.

ZeroClaw implements pin as a supersede operation: fetch the fact, re-store it as a v1 claim with volatility: stable, then tombstone the prior version. The new claim’s superseded_by field tracks the previous id so a future unpin can reverse the chain.

Not-yet-implemented: this method returns an error advising the caller to run the MCP server’s totalreclaw_pin tool instead. See ZeroClaw 2.0 Known Gaps in CLAUDE.md.

Source

pub async fn retype( &self, _memory_id: &str, _new_type: MemorySource, ) -> Result<()>

Retype a memory claim — change its v1 type (claim → directive, etc.) via supersede.

Not-yet-implemented in ZeroClaw’s native trait. The MCP server’s totalreclaw_retype tool is the canonical path.

Source

pub async fn set_scope( &self, _memory_id: &str, _new_scope: MemoryScope, ) -> Result<()>

Set or change the v1 scope of a memory claim via supersede.

Not-yet-implemented in ZeroClaw’s native trait. The MCP server’s totalreclaw_set_scope tool is the canonical path.

Source

pub async fn count(&self) -> Result<usize>

Count active memories.

Source

pub async fn health_check(&self) -> bool

Health check.

Source

pub async fn status(&self) -> Result<BillingStatus>

Billing status – tier, usage, limits. Also updates the billing cache.

Source

pub async fn billing_cache(&self) -> Result<BillingCache>

Fetch billing cache (from disk or relay, with 2h TTL).

Returns a cached billing status with parsed feature flags.

Source

pub async fn quota_warning(&self) -> Option<String>

Check for quota warnings (>80% usage).

Returns a human-readable warning message or None if usage is below 80%. Call at session start (before_agent_start equivalent).

Source

pub async fn debrief(&self, items: &[DebriefItem]) -> Result<usize>

Store debrief items from a session.

ZeroClaw calls this from its consolidation phase or session-end handler. The caller is responsible for running the LLM and passing parsed results.

Each item is stored via the existing store pipeline with source: "zeroclaw_debrief".

Source

pub async fn export(&self) -> Result<Vec<MemoryEntry>>

Export all memories as plaintext (decrypted).

Source

pub async fn upgrade(&self) -> Result<String>

Upgrade to Pro tier – returns Stripe checkout URL.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more