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
1cargo add forgetless
Basic Usage
1use forgetless::{Config, Forgetless, WithPriority};23let result = Forgetless::new()4 .config(Config::default().context_limit(64_000))5 .add(WithPriority::critical(system_prompt))6 .add(conversation)7 .add_file("research.pdf")8 .add_file("diagram.png")9 .query("What changed in the latest design review?")10 .run()11 .await?;1213println!("output tokens: {}", result.total_tokens);14println!("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. |