Skip to main content

createPrincipalMemoryProvider

@forge/monorepo


@forge/monorepo / backend/src / createPrincipalMemoryProvider

Function: createPrincipalMemoryProvider()

createPrincipalMemoryProvider(config): ContextProvider

Defined in: backend/src/principal-memory/index.ts:118

A budgeted context provider over principal memory. Retrieves only relevant, active entries under maxEntries, and emits them as user-context sections — so they never crowd out recent turns (history bucket) or session state. Each section's provenance carries the entry id for attribution.

Parameters

config

estimateTokens?

(text) => number

maxEntries?

number

queryOf?

(context) => string | undefined

Optional query derived from the turn (e.g. the latest user message) to focus retrieval.

store

PrincipalMemoryStore

Returns

ContextProvider