Skip to main content

Interface: IWorkingMemorySlidingWindow

Defined in: internal/working-memory/types.ts:234

The thread's recent turns are sent verbatim, sized by the model's context window; no summary, no helper model call.

Precise, and the cost grows with the length of the thread. Pick it for short or precision-critical threads; pick IWorkingMemorySummaryBuffer for long threads where the token bill matters more than the exact wording of old turns. Read by WorkingMemory.load.

Properties​

chatHistoryRatio?​

optional chatHistoryRatio?: number

Defined in: internal/working-memory/types.ts:250

Share of the history budget the turns may fill.

Bounds the history so it cannot starve the knowledge-base chunks and the answer.

The budget is the model's window minus the system prompt and the output reserve. The turns are taken newest first while they fit the share, at least one; the knowledge-base chunks (capped by their own topK) take the rest.

Examples​

0.8 - a chat assistant: the conversation is the point, the knowledge base is a side dish
0.5 - a RAG assistant: half the room stays for the retrieved chunks

Default​

0.8

maxLoadedTurns?​

optional maxLoadedTurns?: number

Defined in: internal/working-memory/types.ts:262

The most turns one load reads from the store before the token budget cuts them.

One read, no second round trip: the store pages by count, the budget is in tokens.

Raise it for a very large window with many one-line turns; lower it to cap the read on a slow store.

Example​

200 - two hundred short turns are about 20k tokens, enough for a 128k window at ratio 0.8 with a big system prompt

Default​

200

type​

type: SLIDING_WINDOW

Defined in: internal/working-memory/types.ts:236

The discriminator of TWorkingMemoryStrategy: this one is the sliding window.