Skip to documentation
Docs navigation
Docs/RetrievalResult
Types

RetrievalResult

TypeScript contract for RetrievalResult.

What it does

TypeScript contract for RetrievalResult.

Use RetrievalResult to keep application code aligned with the values MemoGrafter accepts or returns at this boundary. It is a TypeScript-only contract and adds no runtime behavior.

Definition

TypeScript
interface RetrievalResult {
  facts: (MemoryNode & { similarity: number })[];
  nodes: TopicNode[];
  systemPrompt: string;
  tokenCount: number;
  tokenBudget?: number;
}

Fields and behavior

facts contains ranked memory objects augmented with a semantic similarity score.
nodes contains the parent topics represented by the returned facts.
systemPrompt is prompt-ready memory context; tokenCount reports its size against optional tokenBudget.

Result

A compile-time-only TypeScript contract with no runtime value.

Example

example.ts
import type { RetrievalResult } from "memo-grafter";

function useValue(value: RetrievalResult) {
  return value;
}

Important behavior

Use import type when the contract is not needed at runtime.