Skip to content
reaatechREAATECH

reaatech/context-window-planner

0Last commit: Apr 30, 2026GitHub →

These packages give you a deterministic engine for deciding what content to include, summarize, or drop when packing prompts into an LLM's context window. You'd adopt them to solve the problem of overflowing a model's token budget—replacing ad-hoc truncation with a configurable planner that enforces budgets, reserves space for generation, and emits structured warnings about every decision. The most distinctive thing is the pluggable strategy system: you can swap between priority-greedy, sliding-window, summarize-and-replace, or RAG relevance selection strategies, or compose custom ones, all while using typed context item primitives and tokenizer adapters for different model families.

Packages

2 packages

@reaatech/context-window-planner

v0.1.0
A TypeScript library providing typed context items, packing strategies, and tokenizer adapters for deciding what to include, summarize, or drop when fitting prompts into LLM context windows. It exports factory functions for six context item primitives (SystemPrompt, ConversationTurn, RAGChunk, ToolSchema, ToolResult, GenerationBuffer), four packing strategies (priority-greedy, sliding-window, summarize-and-replace, RAG relevance), and three tokenizer adapters (OpenAI/tiktoken, Anthropic approximate, mock), all orchestrated through a `ContextPlannerBuilder` class.
status
published
published
11 days ago

@reaatech/context-window-planner-cli

v0.1.0
A CLI that reads a JSON context-window planning request from stdin and writes a packing plan (included, summarized, and dropped items with token counts) to stdout.
status
published
published
11 days ago

Comments

Sign in with GitHub to comment and vote.

Loading comments…