Skip to main content

RecallSource

Trait RecallSource 

Source
pub trait RecallSource: Send + Sync {
    // Required method
    fn search(&self, query: &str, limit: usize) -> Result<Vec<SearchHit>>;

    // Provided method
    fn this_conversation_recent(&self, limit: usize) -> Result<Vec<SearchHit>> { ... }
}
Expand description

Read-only search over PAST conversations behind the recall tool.

Object-safe and shareable (the loop holds &dyn RecallSource; Sync because the borrow crosses .await points). Implementations MUST be scoped to the active workspace and MUST exclude the conversation the model is currently in — what’s said here is already in context, and a recall hit on it would teach the model to search instead of read. Hit order is the backend’s bm25 rank (§6: never re-sorted by any timestamp — wall-clock is a display claim, not an ordering key).

Required Methods§

Source

fn search(&self, query: &str, limit: usize) -> Result<Vec<SearchHit>>

Return up to limit best-first hits for query (plain keywords; the executor has already pre-flighted the 17.3 sanitizer).

Provided Methods§

Source

fn this_conversation_recent(&self, limit: usize) -> Result<Vec<SearchHit>>

Return up to limit of THIS conversation’s most recent durable turns — the deliberate OPPOSITE of Self::search’s exclusion filter (#714).

The recall contract refuses the active conversation (what’s said here is already in context); but after an interrupt + auto-resume the early turns compaction cut from the live window survive ONLY in the store and are reachable ONLY here. The resume_context tool uses this to let a resumed thread read its own pre-interrupt work. Hits are oldest-first (chronological), not bm25-ranked — this is a self-read, not a search.

Default impl returns Ok(vec![]) so existing mocks and headless callers (which have no conversation store) compile and behave unchanged — only StoreRecallSource overrides it.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§