History compression
Automatically compress long conversations, preserve recent memory, and delegate old messages to a small model for summarization.
Compress history, prune tools, persist memory, and compile the same state to OpenAI / Anthropic / Gemini — without taking over your control flow.

Automatically compress long conversations, preserve recent memory, and delegate old messages to a small model for summarization.
pinned: true messages survive compression verbatim and are never cleared by compact() — policy text stays intact.
The full pre-compression span is stored and cited by URI; a recall_context tool restores exact details on demand.
Delegate LLM compression to Anthropic's server-side compaction while pruning, skills, memory, and VFS stay client-side.
planCompaction / compactHistory (plus AI SDK and TanStack ports) compact your own message store once and persist the result.
Dynamically prune the tool list per task, or use a two-layer namespace + lazy-loading architecture to eliminate tool hallucinations.
Pruner blocklist + checkToolCall for permission, environment safety, and rate limits — KV-cache preserving by default.
The same prompt architecture compiles to OpenAI / Anthropic / Gemini with automatic prefill, cache, and tool-call format adaptation.
Zod schema-based state injection forces the model to stay aligned with the current task on every call.
withGuardrails enforces an XML output contract and sets an assistant prefill, auto-degraded on providers without native prefill.
Auto-truncate oversized tool output and offload it to a virtual file system, keeping error lines plus a context:// URI pointer.
The model persists key information (project rules, user preferences) via tool calls, auto-injected on the next session.
Capture and roll back full context state for branching, exploration, and error recovery.
onBeforeCompile lets you inject RAG results, AST snippets, or MCP queries right before compilation.
A unified event system — chef.on('compress', ...) — for logging, metrics, and debugging across all internal modules.
The Skill primitive bundles instructions and tool annotations per phase, loadable from SKILL.md files (Claude Code / Mastra / OpenCode compatible).