Maintains a sliding window of conversation messages and persists them to the session as JSONL. Default provider of memory.history.
ID nexus.memory.capped
Dependencies None
Key Type Default Description
max_messagesint 100Maximum messages to keep in the buffer
persistbool trueWrite messages to context/conversation.jsonl in the session
Event Priority Purpose
io.input10 Records user messages
io.output10 Records agent responses
tool.invoke50 Records tool calls
tool.result50 Records tool results
memory.store50 Explicit memory storage requests
memory.query50 Responds to history queries
memory.compacted50 Replaces history with compacted version
Event When
memory.resultResponse to a memory.query
Messages are stored in a rolling buffer of size max_messages
Oldest messages are dropped when the buffer is full
If persist: true, each message is appended to context/conversation.jsonl as it arrives
On memory.compacted, the buffer is replaced with the compacted messages
Other plugins can query conversation history:
bus.Emit("memory.query", events.MemoryQuery{
Query: "", // Not filtered — returns all
Limit: 50, // Max messages to return
SessionID: "...", // Current session
})
// Listen for memory.result event with the messages
nexus.memory.capped:
max_messages: 200
persist: true