Inputs and Priorities

The crate splits inputs into eager text records and lazy file records. Priority influences which chunks survive when the token budget tightens.

Content inputs

1use forgetless::{FileWithPriority, Forgetless, Priority, WithPriority};
2
3let png = std::fs::read("diagram.png")?;
4
5let result = Forgetless::new()
6 .add("plain medium-priority text")
7 .add(WithPriority::high("recent discussion"))
8 .add_pinned("system instructions")
9 .add_file("notes.md")
10 .add_file(FileWithPriority::critical("architecture.pdf"))
11 .add_bytes(&png, "image/png")
12 .add_bytes_p(&png, "image/png", Priority::High)
13 .run()
14 .await?;

Priority helpers

HelperPriorityWhere it lives
WithPriority::criticalCriticalText content wrapper for `.add()`.
WithPriority::highHighText content wrapper for `.add()`.
WithPriority::mediumMediumExplicit default if you want to be verbose.
WithPriority::lowLowBackground context with weaker retention.
FileWithPriority::criticalCriticalLazy file wrapper for `.add_file()`.
FileWithPriority::highHighLazy file wrapper for `.add_file()`.
FileWithPriority::mediumMediumExplicit medium file priority.
FileWithPriority::lowLowLazy file wrapper for lower-value file context.

Lazy files

`Forgetless` stores file paths first and delays real reads until `run()`. That matters because the builder can preview and filter paths before paying the cost of parsing every PDF, image, or source tree.

BehaviorImplementation detail
Default priorityPlain path inputs become `LazyFile` with `Priority::Medium`.
Accepted path forms`&str`, `String`, `PathBuf`, `&Path`, and `FileWithPriority<P>`.
Preview phaseWhen a query exists and more than five lazy files were registered, previews are used to shortlist files.
Read phaseOnly shortlisted files are converted into `ContentInput` and chunked.