Skip to content

@agenticforge/context

npm

Token-aware context builder for precise LLM input window management, with MMR diversity selection, TF-IDF / dense-vector similarity, and recency time-decay scoring.

Installation

bash
npm install @agenticforge/context

Exports

NameDescription
ContextBuilderAssembles messages within a token budget
ContextPacketBuilderHelper to create and annotate context packets
fromMemoryEmbedderAdapts a @agenticforge/memory embedder for use in ContextBuilder
estimateTokensQuick token count estimate
TokenizerReusable tokenizer backed by js-tiktoken
TextEmbedderType: (texts: string[]) => Promise<number[][]>
MemoryEmbedderLikeInterface compatible with @agenticforge/memory embedders
ContextBuilderConfigFull configuration interface
ContextPacketPacket type (content + metadata + relevanceScore + timestamp)
BuiltContextReturn type of builder.build()

See the Context Builder Guide for detailed usage.

Released under the CC BY-NC-SA 4.0 License.