Expand description
Context compaction.
Two layers:
-
Compactor— LLM-driven summarisation of older transcript messages into a single system message. Disabled by default (threshold =usize::MAX), enabled viaAgentRuntimeBuilder::compactor(...). -
Microcompactor— no-LLM proactive pruning of old tool results by count. Runs before the LLM-driven compactor each step so the transcript may drop below the compaction threshold and the expensive LLM summary is skipped entirely.
Re-exports§
pub use micro::Microcompactor;pub use micro::MICROCOMPACT_PLACEHOLDER;pub use reinject::build_skill_reinjector_from_env;pub use reinject::FileReinjector;pub use reinject::PlanTodoReinjector;pub use reinject::SkillReinjector;pub use retry::truncate_head_for_retry;pub use retry::MAX_PTL_RETRIES;
Modules§
- micro
- No-LLM proactive pruning of old tool results by count.
- prompt
- Free-text compaction prompt template + post-processing.
- reinject
- Post-compaction re-injection of recently-read files as System attachments.
- retry
- PTL (prompt-too-long) retry helpers for compaction summarisation.
Structs§
- Compactor
- Configuration for LLM-driven transcript compaction.
Constants§
- MAX_
CONSECUTIVE_ COMPACT_ FAILURES - Stop attempting proactive compaction after this many consecutive
failures. Emergency compaction (
compact_on_overflow) is exempt — it is the last-resort recovery for an already-failed turn.