Chunking

Chunking is content-aware. forgetless picks a strategy from ContentType, then applies token targets, overlap, and deduplication before scoring begins.

Chunk presets#

PresetTargetMaxGood for
ChunkConfig::default()5121024General text and mixed project context.
ChunkConfig::for_code()256512Codebases where smaller functions need independent ranking.
ChunkConfig::for_conversation()200400Chat transcripts and message histories.
ChunkConfig::for_speed()10002000Fast coarse compression with larger chunks.
ChunkConfig::for_quality()256512More selective ranking with finer chunk boundaries.

Content types#

TypeDetected fromNotes
TextFallback defaultUsed for plain text and unknown extensions.
Code.rs, .py, .ts, .tsx, .go, .java, and similarOptimized for source-oriented chunking.
Markdown.md, .markdownKeeps markdown documents out of the plain-text path.
ConversationExplicit config pathBest for message-oriented histories.
Structured.json, .yaml, .toml, .xmlUseful for config and data files.

Customization#

rust
use forgetless::{ChunkConfig, Config, ForgetlessConfig, ScoringConfig};

let advanced = ForgetlessConfig::new(
    Config::default().context_limit(64_000),
)
.with_chunk(
    ChunkConfig::for_quality()
        .with_target_tokens(256)
        .with_max_tokens(512)
        .with_min_tokens(10)
        .with_deduplication(true),
)
.with_scoring(ScoringConfig {
    semantic_weight: 0.6,
    keyword_weight: 0.25,
    priority_weight: 0.15,
});