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};
2
3let 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?;
12
13println!("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

AreaDefaultWhy it matters
Context limit128,000 tokensDefines the hard budget the selected chunks must fit inside.
Chunk size512 tokensBalances selection granularity against processing overhead.
Parallel file readsenabledLets large file batches load faster during the run pipeline.
Embedding cacheenabledAvoids recomputing vectors for repeated content.