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.).
Extended by
Section titled “Extended by”Properties
Section titled “Properties”readonly name: string;Defined in: src/context-manager/types.ts:22
Experimental
Stable identifier for logging and observability.
Methods
Section titled “Methods”init()?
Section titled “init()?”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).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
agent | LocalAgent |
stash? | Stash |
Returns
Section titled “Returns”void
apply()
Section titled “apply()”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).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
context | ContextState |
Returns
Section titled “Returns”Promise<boolean>