/** * Deep recall API types */ /** * Deep Recall Request. * POST /v1/memories/deep-recall * * A walker agent explores the context graph (up to 3 hops, choosing branches), * then retrieves with aimed queries and returns a synthesized answer with * evidence. Prefer this over `retrieveMemories` when the question likely spans * linked contexts (multi-hop, "what do we know about X and what did we decide"). * * @example * ```ts * const { summary, facts } = await client.deepRecall({ * question: 'What did we decide about churn, and why?', * contextIds: ['session:retention_research'], * }); * ``` */ export interface DeepRecallQuery { /** * Focused question — one thing, not a whole conversation. */ question: string; /** * Graph ID that owns the memories */ graph_id?: string; /** * Context IDs ('type:name') the walker should start from. A starting hint, * not a filter — the walk may go elsewhere. */ context_ids?: string[]; } /** One evidence item with provenance, ready to cite. */ export interface DeepRecallFact { text: string; /** Provenance source (policy/verified/tool/document/user/assistant/derived/system). */ source?: string; /** Locus ID — usable with deleteMemory / resolve APIs. */ locus: string; /** Owning context IDs (type:name) — reusable as contextIds in a follow-up call. */ contexts: string[]; /** * How well this fact answered the question, 0 to 1. Belongs to the search, so * it changes with every question — unlike `confidence`, which belongs to the * memory and is the same whoever asks. */ match_score: number; } /** LLM cost accounting for one deep recall call (walk rounds + summary pass). */ export interface DeepRecallUsage { llm_calls: number; prompt_tokens: number; completion_tokens: number; /** USD at the server's configured per-model pricing. */ cost_usd: number; } /** POST /v1/memories/deep-recall response */ export interface DeepRecallResult { facts: DeepRecallFact[]; /** Context IDs the walker opened, in walk order (empty on fallback). */ contexts_walked: string[]; /** Synthesized prose answer. Absent when the summary pass failed. */ summary?: string; /** "full" = walk completed cleanly; "partial" = cut short — consider re-calling with sharper contextIds. */ coverage: "full" | "partial"; /** Explore rounds used (0–3). */ rounds_used: number; /** True when the walk timed out/errored and facts came from a plain retrieval instead. */ fallback: boolean; usage: DeepRecallUsage; }