agent-context
Multi-backend LLM conversation context manager built on the kameo actor model.
Three-Zone + Scratch Memory
Messages are split into three storage zones plus a transient scratch layer:
| Zone | Mutability | Purpose |
|---|---|---|
| immutable | Read-only | System prompts, preset context |
| compressed | Write-once (during compression) | Summaries of older messages |
| incremental | Full CRUD | Active conversation |
| scratch | Not stored | Per-turn metadata (time, cwd, etc.) |
Concatenation order: immutable → compressed → incremental → scratch.
Usage
use ;
// 1. Implement ContextBackend for your LLM backend
// 2. Spawn the actor
let actor = spawn;
// 3. Append user message and send to LLM
actor.ask.await?;
actor.ask.await?;
// 4. Read all messages
let messages = actor.ask.await?;
ContextBackend
The core trait — implement it to support any LLM provider. Provides message factories, format conversion, response parsing, and streaming.
Compression
Use CompressMsg with CompressStrategy::Summarize to compress older messages into a summary when the conversation gets too long.
License
MIT OR Apache-2.0