Chuyển tới nội dung chính

beam_memory

beam_memory stores memory in named scopes and loads several scopes as one conversation history.

beam_memory = { path = "../riverbeam/crates/beam_memory" }
ItemRole
MemoryScopenew(name, id), system(), session(id), key()
MemoryItemA stored turn (turn(scope, messages)) or fact (fact(scope, kind, text))
MemoryBackendStorage trait: load_layer, append_layer, forget
InMemoryBackendThe shipped backend, keyed by scope
ContextStrategyTrimming trait: apply(messages, max_tokens)
TokenLimitStrategyKeeps the newest messages that fit, at about four characters per token
MemoryManagernew(backend, strategy), load_context(scopes, max_tokens), save_turn, remember, forget

There are no feature flags.

How the pipeline chooses scopes is in Memory. InMemoryBackend lives in the process, so memory does not survive restarts and is not shared between workers.