neuron-context
Context window management strategies for neuron operators
Overview
neuron-context implements the ContextStrategy types used by providers to manage conversation
history before sending requests to an LLM. As conversations grow, context strategies control
what messages are kept, trimmed, or summarized to fit within a model's context window.
Built-in strategies:
| Strategy | Behaviour |
|---|---|
Unlimited |
No windowing — all history is sent (default, risky for long conversations) |
LastN { n } |
Keep only the last n turns |
MaxTokens { limit } |
Trim oldest messages until estimated token count is within limit |
Usage
[]
= "0.4"
= "0.4"
use ContextStrategy;
use TurnRequest;
let strategy = LastN ;
// Pass to a provider or operator that accepts ContextStrategy
Part of the neuron workspace
neuron is a composable async agentic AI framework for Rust. See the book for architecture and guides.