Skip to main content

Module reinject

Module reinject 

Source
Expand description

Post-compaction re-injection of recently-read files as System attachments.

After an LLM-summary compaction, the transcript is [summary, …recent N]. The summary mentions file paths but not their contents, so the model on the next turn frequently re-Reads files it already read — paying for the read again and re-bloating the context.

FileReinjector re-injects the most-recently-read files as [Role::System] attachments right after the summary, capped at max_files files, token_budget total tokens, and per_file_budget per file, deduplicated against the preserved tail.

Structs§

FileReinjector
Post-compaction re-injector for recently-read files.
PlanTodoReinjector
Post-compaction re-injector for the pending plan and task list.
SkillReinjector
Post-compaction re-injector for invoked skills.

Functions§

build_file_reinjector_from_env
Build a FileReinjector from environment variables, returning None when file re-injection is disabled.
build_skill_reinjector_from_env
Build a SkillReinjector from environment variables, returning None when skill re-injection is disabled.