Memory Retrieval and Response Generation
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
query · "I feel like eating a burger, any recommendations?" · week 4
STM · recent turns
MTM · topic folders
LPM · user & agent persona
p9 · "remember the wetland park?"
p8 · "flying to Busan next month"
p7 · "gym three times a week"
p6 · "a pasta recipe for dinner?"
… p5, p4, p3 · 7 pages in the queue
all 7 pages, taken as they are
no ranking · the current context
stage 1 · match score per folder
wetland park outing
0.83
recipe ideas
0.71
favourite restaurants
0.66
work deadlines
0.58
old laptop issue
0.49
… ~2,000 folders below
top-m = 5 folders
stage 2 · semantic similarity
p3 · ran two laps, slimmer
0.78
p−12 · no fast food, tracking
0.72
p−7 · best burger in town?
0.70
p−9 · a lighter dinner idea
0.61
p1 · wetland park scenery
0.55
… within the 5 folders
top-k = 10 pages
chosen folders: N
visit
+= 1 · recency ← now (they get hotter)
User KB · top-10 by similarity
"wants to get slimmer" · "ran two laps in the park"
"went to the wetland park (week 1)" · …
Agent Traits · top-10 by similarity
"promised to keep the user motivated" · …
User Profile · Agent Profile · User Traits
taken whole: name, role, "goal: get slimmer", …
who the user is · what the agent promised
final prompt
STM pages
MTM pages
LPM persona
query
+
+
+
LLM
"The cheeseburger at […] is great,
just don't forget you're hitting the gym!"
recent context from STM · the relevant past from MTM · who the user is from LPM · one generation call
◂
▸
18 / 25