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#

rust
use forgetless::{FileWithPriority, Forgetless, Priority, WithPriority};

let png = std::fs::read("diagram.png")?;

let result = Forgetless::new()
    .add("plain medium-priority text")
    .add(WithPriority::high("recent discussion"))
    .add_pinned("system instructions")
    .add_file("notes.md")
    .add_file(FileWithPriority::critical("architecture.pdf"))
    .add_bytes(&png, "image/png")
    .add_bytes_p(&png, "image/png", Priority::High)
    .run()
    .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.