Examples
Pruning Engine
Manage memory lifecycle with intelligent forgetting policies.
Lifecycle Module
Scenario: Forgetting old weather reports
When to Use
Infinite memory is expensive and noisy. Use the Pruning Engine to automatically remove low-value information based on policies. Perfect for:
- Removing old "small talk" (weather, greetings)
- Enforcing data retention policies (e.g., "Delete financial data after 7 years")
- Cleaning up temporary facts
Key Operations
set_ttl()Define retention policy for item types
analyze()Dry-run to see what would be deleted
Code Example
We set a policy that "weather reports" should be forgotten after 1 day, while "medical history" is kept for a year.
Key Takeaways
- Pruning prevents context pollution. Too much irrelevant memory confuses the LLM.
- Structure your data with
item_type(e.g., 'weather', 'medical') to enable granular pruning policies. - Always run
analyze()(dry run) beforeexecute()in production.