Skip to documentation
Docs navigation
Docs/enqueueIncrementalIngest()
MemoGrafter

enqueueIncrementalIngest()

Submit an indexed conversation delta without copying the complete session history into Redis.

What it does

Submit an indexed conversation delta without copying the complete session history into Redis.

When to use it

Use for a known indexed message delta when avoiding complete-history queue payloads. Most applications should call ingest(); MemoGrafterAgent uses this path internally.

Signature

TypeScript
enqueueIncrementalIngest(messages: Message[], sessionId: string, startIndex: number, options?: IngestOptions): Promise<void>

Parameters

messages (Message[]) — Ordered conversation messages to extract memory from.
sessionId (string) — The application-owned session whose memory should be read or changed.
startIndex (number) — Absolute zero-based message index for the first message in this incremental delta.
options? (IngestOptions) — A typed options object. The applicable fields and defaults are documented below.

IngestOptions fields

tags? (string[]) — Normalized metadata copied to topics and memories created by this ingestion.

Result

The number of records changed by the operation.

Behavior

Compares the absolute range with the stored cursor, skips or trims completed indexes, and loads limited preceding context for drift detection. Gaps reject without advancing the cursor.

Side effects and completion

Queue mode resolves after acceptance; inline mode resolves after persistence.

Example

example.ts
await memo.enqueueIncrementalIngest(newMessages, "user-42", previousMessageCount);

Important behavior

This is primarily the path used internally by MemoGrafterAgent.
The worker skips or trims completed ranges and rejects gaps without advancing the ingest cursor.
Without queue configuration the delta is processed synchronously.