Skip to content

ContextStrategy

Defined in: src/context-manager/types.ts:20

Experimental

A context reduction strategy that can offload, summarize, or otherwise transform the message array to reduce token usage.

Strategies are applied in order during apply(). Each decides whether to act based on the current context state (utilization, message count, etc.).

readonly name: string;

Defined in: src/context-manager/types.ts:22

Experimental

Stable identifier for logging and observability.

optional init(agent, stash?): void;

Defined in: src/context-manager/types.ts:28

Experimental

Called once when the ContextManager is attached to an agent. Strategies can use this to register hooks (e.g., eager offloading on message arrival).

ParameterType
agentLocalAgent
stash?Stash

void


apply(context): Promise<boolean>;

Defined in: src/context-manager/types.ts:34

Experimental

Attempt to reduce context. Returns true if it made changes, false if it decided not to act (e.g., conditions not met, nothing to offload).

ParameterType
contextContextState

Promise<boolean>