Pipeline

The runtime pipeline is built around lazy loading, content-aware chunking, embedding-based relevance and strict token-budget selection.

Pipeline#

Collect eager inputs and lazy files#

Strings and byte inputs are stored immediately, while file paths stay lazy until the optimizer decides to read them.

Preview files for query filtering#

If a query exists and there are more than five lazy files, Forgetless reads fast previews and embeds them to keep only the most relevant paths.

Read only the selected files#

PDFs, images, text and code are loaded in parallel. PDFs use pdftotext when available, and images can optionally invoke the vision model.

Chunk by content type#

The chunker adapts to text, code, markdown and structured data, then labels every chunk with priority and source metadata.

Score and rank chunks#

Embeddings, priority boosts, position heuristics, and conversation-style recency combine into the final ordering.

Select within budget and assemble output#

Top chunks are kept until the token limit is met, then the final context is grouped by source and optionally polished with the local text model.

Scoring signals#

SignalSourceNotes
Priorityuser inputCritical content outranks everything else and survives budget pressure first.
Algorithmic relevancechunk scoringThe exported algorithmic breakdown field currently tracks the position-based heuristic.
Semantic similarityembeddingsPreview text and chunk embeddings are compared to the query when one is present.
Recency factorscoring breakdownConversation-like chunks receive a recency-biased factor during ranking.
Optional LLM polishcontext_llmA local SmolLM2 pass can reorganize selected chunks after budget selection.

Models used locally#

PurposeModelWhen it loads
Embeddingsall-MiniLM-L6-v2Used for semantic similarity and preview filtering.
Text polishHuggingFaceTB/SmolLM2-135M-InstructOnly when context_llm(true) is enabled.
VisionHuggingFaceTB/SmolVLM-256M-InstructOnly when vision_llm(true) is enabled.

Output shape#

text
## system.md
You are preparing a release summary.

---

## design-review.pdf
Important design decisions and open questions...

---

## src/lib.rs
Public exports and library entry points...