Introduction
Forgetless is a Rust-first context optimizer that previews, ranks, and compresses oversized working sets into prompts that fit a strict token budget.
Installation#
cargo add forgetlessBasic Usage#
use forgetless::{Config, Forgetless, WithPriority};
let result = Forgetless::new()
.config(Config::default().context_limit(64_000))
.add(WithPriority::critical(system_prompt))
.add(conversation)
.add_file("research.pdf")
.add_file("diagram.png")
.query("What changed in the latest design review?")
.run()
.await?;
println!("output tokens: {}", result.total_tokens);
println!("compression: {:.1}x", result.compression_ratio());Core Capabilities#
Lazy file ingestion
Large file sets stay as lightweight references until run() decides they are worth reading.
Query-aware filtering
When you pass a query, Forgetless previews files first and loads the most relevant ones before deeper scoring.
Priority-preserving selection
Critical content survives budget pressure while lower-priority background context drops away first.
Structured output
Selected chunks are grouped by source so the final prompt is still readable and easy for downstream models to use.
What Forgetless tunes#
| Area | Default | Why it matters |
|---|---|---|
| Context limit | 128,000 tokens | Defines the hard budget the selected chunks must fit inside. |
| Chunk size | 512 tokens | Balances selection granularity against processing overhead. |
| Parallel file reads | enabled | Lets large file batches load faster during the run pipeline. |
| Embedding cache | enabled | Avoids recomputing vectors for repeated content. |
Related#
Getting Started
Install the Forgetless crate with Cargo, enable optional features, add content and files, and run your first LLM context optimization pass in Rust.
Builder
Reference for the Forgetless builder API in Rust: chain config, add, add_file, and query, then call run to execute context optimization.
Inputs and Priorities
Control what the LLM context optimizer keeps using WithPriority, FileWithPriority, byte payloads, and lazy file inputs to rank and preserve critical content.