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#

bash
cargo add forgetless

Basic Usage#

rust
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#

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.