The Per-Turn Procedure of MemoryOS
STM · recent turns
queue of pages · FIFO
oldest page spills · match score
MTM · topic folders
pages by topic · heat · evict
heat > τ · promote
LPM · persona
user · agent
retrieve
all three tiers → prompt
generate
LLM → answer → new page
1
retrieve
2
generate
3
store the new page
4
overflow to mid-term
5
heat · promote or evict
STM
→ all pages in the queue
MTM
match score
→ top-m = 5 folders
embedding sim
→ top-k = 10 pages
N
visit
+= 1 · recency ← now
LPM
embedding sim
→ top-10 User KB entries
→ top-10 Agent Traits
+ all profiles and User Traits
LLM · query keywords
for the keyword term of the
match score (≤ 3 keywords, code)
LLM calls here: 1
prompt =
STM pages
+
MTM pages
LPM persona
+
query
LLM · final answer
reply R
"…don't forget the gym!"
one generation call
per turn, memory inlined
LLM calls here: 1
new page {Q, R, T}
query · reply · timestamp
LLM · link or reset?
continues the last page's
thread? → join the chain,
else start a new chain
LLM · chain summary
meta ← summary of the chain
push to the STM queue
capacity 7
LLM calls here: 2
STM longer than 7 ?
→ FIFO pop the oldest page
F = cos(emb) + Jaccard(kw)
against every folder's
summary and keyword set
F > θ = 0.6 ?
yes → join that folder
LLM · summary + keywords
no → open a new folder
the page is its first member
LLM calls here: ≤ 1
heat = N
visit
+ L
interaction
+ R
recency
α = β = γ = 1 · μ = 1e7 s
heat > τ = 5 ?
LLM · persona extraction
→ User KB · User Traits
→ Agent Traits
queues of 100 · L
interaction
← 0
folders > 2000 ?
evict the coldest folder
lowest heat leaves first
LLM calls here: ≤ 1
next turn
LLM call
embedding / keywords
constant
eviction
per response the paper measures 4.9 LLM calls and 3,874 recalled tokens on LoCoMo (Table 3)
LLM calls per turn
· link judge · summaries · persona extraction · the answer
19 / 25