MemoGrafter
inject()
Assemble prompt context from explicit topic IDs.
What it does
Assemble prompt context from explicit topic IDs.
This lower-level API keeps session selection explicit, which is useful for services that manage many users or conversations through one instance.
Signature
TypeScript
inject(sessionId: string, topicIds: string[]): Promise<InjectionResult>Parameters
sessionId (string) — The application-owned session whose memory should be read or changed.topicIds (string[]) — Topic identifiers to include in the generated context.Result
The selected memory context and prompt text ready to pass to an LLM.
Example
example.ts
const context = await memo.inject("session-1", topicIds);